StudentTParameterSampleFromScaleMatrix

class sherpa.sim.sample.StudentTParameterSampleFromScaleMatrix[source] [edit on github]

Bases: ParameterSampleFromScaleMatrix

Use a student’s t-distribution to sample parameters (correlated),

The parameters are drawn from a normal distribution based on the parameter errors, and include the correlations between the parameters. The errors will be generated from the fit object or specified directly as a covariance matrix.

Methods

clip(fit, samples[, clip])

Clip the samples if out of bounds.

get_sample(fit, *, dof[, num, rng])

Return the parameter samples.

Methods Summary

clip(fit, samples[, clip])

Clip the samples if out of bounds.

get_sample(fit, *, dof[, num, rng])

Return the 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:
fitsherpa.fit.Fit instance

Contains the thawed parameters used to generate the samples.

samples2D numpy array

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.

Returns:
clipped1D numpy array

A 1D boolean array indicating whether any sample in a row was clipped. Note that the input samples array will have been updated if any element in clipped is True.

get_sample(fit: Fit, *, dof: int, num: int = 1, rng: Generator | RandomState | None = None) ndarray[source] [edit on github]

Return the parameter samples.

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:
fitsherpa.fit.Fit instance

This defines the thawed parameters that are used to generate the samples, along with any possible error analysis.

dofint

The degrees of freedom of the distribution.

numint, optional

The number of samples to return.

rngnumpy.random.Generator, numpy.random.RandomState, or None, optional

Determines how random numbers are created. If set to None then the routines from numpy.random are used, and so can be controlled by calling numpy.random.seed.

Returns:
samples2D numpy array

The array is num by npar size, where npar is the number of free parameters in the fit argument.