UniformSampleFromScaleVector

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

Bases: UniformParameterSampleFromScaleVector

Use a uniform distribution to sample statistic and parameters.

The parameters are drawn from a uniform distribution which is set to factor times the parameter error (the lower bound is included but the upper bound is not).

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, samples, clip='none') [edit on github]

Clip the samples if out of bounds.

Parameters:
  • fit (sherpa.fit.Fit instance) – Contains the thawed parameters used to generate the samples.

  • samples (2D 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:

clipped – The clipped samples (may be unchanged) and a 1D boolean array indicating whether any sample in a row was clipped.

Return type:

1D numpy array

get_sample(fit, num=1, factor=4, numcores=None)[source] [edit on github]

Return the statistic and parameter samples.

Parameters:
  • fit (sherpa.fit.Fit instance) – 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 (int or None, optional) – Should the calculation be done on multiple CPUs? The default (None) is to rely on the parallel.numcores setting of the configuration file.

Returns:

samples – The array is num by (npar + 1) size, where npar is the number of free parameters in the fit argument. The first element in each row is the statistic value, and the remaining are the parameter values.

Return type:

2D numpy array