UniformSampleFromScaleVector
- class sherpa.sim.sample.UniformSampleFromScaleVector[source] [edit on github]
Bases:
UniformParameterSampleFromScaleVectorUse a uniform distribution to sample statistic and parameters.
The parameters are drawn from a uniform distribution which is set to
factortimes the parameter error (the lower bound is included but the upper bound is not).Methods
clip(fit, samples[, clip])Clip the samples if out of bounds.
get_sample(fit, *[, num, factor, numcores, ...])Return the statistic and parameter samples.
Methods Summary
clip(fit, samples[, clip])Clip the samples if out of bounds.
get_sample(fit, *[, num, factor, numcores, ...])Return the statistic and parameter samples.
Methods Documentation
- clip(fit: Fit, samples: ndarray, clip: Literal['none', 'hard', 'soft'] = 'none') ndarray [edit on github]
Clip the samples if out of bounds.
- Parameters:
- fit
sherpa.fit.Fitinstance Contains the thawed parameters used to generate the samples.
- samples2D
numpyarray The samples array, stored as a n by npar matrix. This array is changed in place.
- clip{‘none’, ‘hard’, ‘soft’}
optional How should the values be clipped? The default (‘none’) has no clipping. The other methods restrict the values to lie within the hard or soft limits of the parameters.
- fit
- Returns:
- get_sample(fit: Fit, *, num: int = 1, factor: float = 4, numcores: int | None = None, rng: Generator | RandomState | None = None, clip: Literal['none', 'hard', 'soft'] = 'none') ndarray[source] [edit on github]
Return the statistic and parameter samples.
Changed in version 4.18.0: The clip argument has been added, and the return value now has an extra column, indicating if the row was clipped.
Changed in version 4.16.0: All arguments but the first one must be passed as a keyword argument. The rng parameter was added.
- Parameters:
- fit
sherpa.fit.Fitinstance This defines the thawed parameters that are used to generate the samples, along with any possible error analysis.
- num
int,optional The number of samples to return.
- factor
number,optional The half-width of the uniform distribution is factor times the one-sigma error.
- numcores
intorNone,optional Should the calculation be done on multiple CPUs? The default (None) is to rely on the parallel.numcores setting of the configuration file.
- rng
numpy.random.Generator,numpy.random.RandomState,orNone,optional Determines how random numbers are created. If set to None then the routines from
numpy.randomare used, and so can be controlled by callingnumpy.random.seed.- clip{‘hard’, ‘soft’, ‘none’},
optional What clipping strategy should be applied to the sampled parameters. The default (‘none’) applies no clipping, ‘hard’ uses the hard parameter limits, and ‘soft’ the soft limits.
- fit
- Returns: