mcsas.mcsas.mcsasparameters module

class McSASParameters(paramDefFile=None)[source]

Bases: utils.propertynames.PropertyNames

Defines the static parameters used for the fitting procedure:
  • model: an instance of McSAS.model defining the fitting model
  • contribParamBounds: Bounds of the active (fitting) parameter
  • qBounds: limits in q between which the fit is applied
  • psiBounds: limits in azimuthal angle (2D patterns only) to which
    the fit is applied
  • qMagnitude: indicates the multiplier to scale q to m^-1
  • iMagnitude: indicates the multiplier to scale I to (m sr)^-1
  • histogramBins: number of bins to use for size distribution
    determination. Does not affect fit
  • histogramXScale: can be “log” or “linear”, sets the horizontal
    axis scaling. Does not affect fit
  • histogramWeighting: can be “volume”(recommended) or “number”.
    Determines whether to plot the volume-weighted size distribution (which is closest to what is measured in a scattering measurement) or a number-weighted size distribution.
  • deltaRhoSquared the value (in m^{-4}) of the squared electron
    density contrast. Typically on the order of 10^{25} to 10^{30} for X-ray scattering measurements. To get a correct volume fraction, the intensity must be in reciprocal meters, as must q and the object size parameters must be adjusted accordingly.
  • startFromMinimum: may be depreciated: starts with an initial guess
    consisting of minimum size values rather than random. For testing purposes only.
  • maxRetries: if a single optimisation fails, it will be retried
    this integer of times.
  • maskNegativeInt: may be depreciated due to overlap with similar
    functionality in the McSAS.data molule. Setting this will ignore datapoints with intensity values < 0
  • maskZeroInt: similar to above, but for intensity values = 0

Most of them should be moved to McSAS as dynamic parameters of type Parameter which allows them to be configurable in the GUI. Some, esp. histogramBins and histogramXScale should be moved to a custom FitParameter class along with the active flag. (WIP)

Extension in progress: the class can take keyword-value pairs to overwrite (some of) the parameter values. Additionally, a default configuration file (json-style) can be provided using kwarg: paramDefFile = 'path/to/file' A (limited) set of custom parameters can be supplied in another configuration file that overwrite the defaults: paramFile = 'path/to/file'

The order is:

  • default file, whose values are superseded by
  • custom file, whose values are superseded by
  • keyword-value pairs, which only set parameter values, or
  • keyword-dict pairs, which sets parameter attributes as defined in the supplied dictionary

initialise the defaults and populate the database with values where appropriate default parameter file can be provided using kwarg: paramDefFile = ‘path/to/file’ relative to application root dir

contribParamBounds = ()
loadParameters(filename)[source]

Warning

method ‘mcsas.mcsasparameters.McSASParameters.loadParameters’ undocumented

model = None
paramDefFile = 'mcsas/mcsasparameters.json'
parameters = []
pickUnit(unitClass=None, displayUnit=None)[source]

returns a unit object instance of the right class and displayUnit

Parameter(*args, **kwargs)

Warning

function ‘mcsas.mcsasparameters.Parameter’ undocumented