mcsas.bases.model.scatteringmodel module

class ScatteringModel[source]

Bases: bases.algorithm.algorithmbase.AlgorithmBase

Creates instances from defined parameters and replaces the class attributes accordingly.

absVolume()[source]

Forwarding to usual volume() by default. Can be overridden to include SLD.

activeParamCount = functools.partial(<function ScatteringModel.activeParamCount>, <class 'bases.model.scatteringmodel.ScatteringModel'>)
activeParamNames = functools.partial(<function ScatteringModel.activeParamNames>, <class 'bases.model.scatteringmodel.ScatteringModel'>)
activeParams = functools.partial(<function ScatteringModel.activeParams>, <class 'bases.model.scatteringmodel.ScatteringModel'>)
calc(data, pset, compensationExponent=None)[source]

Calculates the total intensity and scatterer volume contributions using the current model. pset number columns equals the number of active parameters. Returns a ModelData object for a certain type of measurement.

calcIntensity(data, compensationExponent=None)[source]

Calculates the model intensity which is later compared to the data. Returns a tuple containing an array of the calculated intensities for the grid provided with the data and the volume of a single particle based on the model parameters. Has to be implemented in derived classes specific to a certain type of measurement.

fixTestParams = functools.partial(<function ScatteringModel.fixTestParams>, <class 'bases.model.scatteringmodel.ScatteringModel'>)
formfactor(dataset)[source]

Calculates the Rayleigh function of this model. Reimplement this for new models.

generateParameters(count=1)[source]

Generates a set of parameters for this model using the predefined Parameter.generator. Allows for different random number distributions.

getModelData(cumInt, vset, wset, sset)[source]

Warning

method ‘bases.model.scatteringmodel.ScatteringModel.getModelData’ undocumented

classmethod getParametersFromFilename(filename)[source]

Derives model parameters for testing from reference data file.

hdfWrite(hdf)[source]

Warning

method ‘bases.model.scatteringmodel.ScatteringModel.hdfWrite’ undocumented

modelDataType()[source]

Returns the appropriate ModelData class for this type of model.

surface()[source]

Returns the surface area of a single scatterer. Used for the surface weighted distribution histogram. Returns 0 by default. Reimplement this for a model.

classmethod test(filename)[source]

Regression test of a scattering model. File names are expected to contain the parameter values which produce the provided intensity. Otherwise implement fixTestParams() for the particular model.

  • filename: Name of the file in cls.testDataDir to test against.
  • cls.testRelErr: Acceptable mean of relative error against reference
    intensity. Default: 1e-5
  • cls.testVolExp: Volume compensation exponent, sets the amount of
    volume contribution the intensity is scaled by.
  • cls.testDataDir: Directory of test data relative to program dir.
    Default: “testdata”
update = functools.partial(<function ScatteringModel.update>, <class 'bases.model.scatteringmodel.ScatteringModel'>)
updateParamBounds(bounds)[source]

Warning

method ‘bases.model.scatteringmodel.ScatteringModel.updateParamBounds’ undocumented

volume()[source]

Calculates the volume of this model, taking compensationExponent into account from input or preset parameters. Reimplement this for new models.

weight()[source]

A weighting function for the form factor. With SAXS, it is usually the volume squared.