Skip to content

Commit

Permalink
docs(General): Fix parameters documentation format
Browse files Browse the repository at this point in the history
  • Loading branch information
ibressler committed Mar 21, 2023
1 parent 554db3a commit b680822
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 37 deletions.
33 changes: 22 additions & 11 deletions src/mcsas3/mccore.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,28 @@

class McCore:
"""
The core of the MC procedure. Strict requirements on input include:
modelFunc: SasModels function
measData: measurement data dictionary with Q, I, ISigma containing arrays.
For 2D data, Q is a two-element list with [Qx, Qy].
This is why it's not a Pandas Dataframe
pickParameters: dict of values with new random picks, named by parameter names
modelParameterLimits: dict of value pairs (tuples) with random pick bounds,
named by parameter names
x0: continually updated new guess for total scaling, background values.
weighting: volume-weighting / compensation factor for the contributions
nContrib: number of contributions
The core of the MC procedure.
Parameters
----------
modelFunc:
SasModels function
measData: dict
measurement data dictionary with Q, I, ISigma containing arrays.
For 2D data, Q is a two-element list with [Qx, Qy].
This is why it's not a Pandas Dataframe.
pickParameters: dict
dict of values with new random picks, named by parameter names
modelParameterLimits: dict
dict of value pairs (tuples) with random pick bounds,
named by parameter names
x0:
continually updated new guess for total scaling, background values.
weighting:
volume-weighting / compensation factor for the contributions
nContrib:
number of contributions
"""

_measData = None # measurement data dict with entries for Q, I, ISigma
Expand Down
34 changes: 19 additions & 15 deletions src/mcsas3/mcmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,21 +236,25 @@ class McModel:
Specifies the fit parameter details and contains random pickers.
Configuration can be alternatively loaded from an existing result file.
parameters:
===
*fitParameterLimits*: dict of value pairs {"param1": (lower, upper), ... } for fit parameters
*staticParameters*: dict of parameter-value pairs to keep static during the fit:
{"param2": value, ...}.
*seed*: random number generator seed, should vary for parallel execution
*nContrib*: number of individual SasModel contributions
from which the total model intensity is calculated
*modelName*: SasModels model name to load, default 'sphere'
or:
===
*loadFromFile*: A filename from a previous optimization that contains the required settings
*loadFromRepetition*: if the filename is specified, load the parameters
from this particular repetition
Parameters
----------
fitParameterLimits: dict of value pairs {"param1": (lower, upper), ... }
for fit parameters
staticParameters: dict of parameter-value pairs {"param2": value, ...}
to keep static during the fit
seed:
random number generator seed, should vary for parallel execution
nContrib:
number of individual SasModel contributions
from which the total model intensity is calculated
modelName:
SasModels model name to load, default 'sphere'
OR: alternatively:
loadFromFile: str
A filename from a previous optimization that contains the required settings
loadFromRepetition: int
If the filename is specified, load the parameters from this particular repetition
"""

func = None # SasModels model instance
Expand Down
32 changes: 21 additions & 11 deletions src/mcsas3/osb.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,30 @@ class optimizeScalingAndBackground(object):
"""small class derived from the McSAS mcsas/backgroundscalingfit.py class,
quickly provides an optimized scaling and background value for two datasets.
TODO (maybe): include a porod background contribution? If so, Q should be
**TODO (maybe)**: include a porod background contribution? If so, Q should be
available to this class.
inputs:
*measDataI*: numpy array of measured intensities
*measDataISigma*: associated uncertainties
*modelDataI*: array of model intensities.
*x0* (optional): two-element tuple with initial guess for scaling and background
*xBounds* (optional): constraints to the optimization,
speeds up when appropriate constraints are given
Parameters
----------
measDataI:
numpy array of measured intensities
measDataISigma:
associated uncertainties
modelDataI:
array of model intensities.
x0:
optional, two-element tuple with initial guess for scaling and background
xBounds:
optional, constraints to the optimization,
speeds up when appropriate constraints are given
Returns
-------
x:
length 2 ndarray with optimized scaling parameter and background parameter
cs:
final reduced chi-squared
Returns:
:x: length 2 ndarray with optimized scaling parameter and background parameter
:cs: final reduced chi-squared
Usage example:
Expand Down

0 comments on commit b680822

Please sign in to comment.