Bases: object
Storing fit result
alias of type
x.__delattr__(‘name’) <==> del x.name
x.__getattribute__(‘name’) <==> x.name
x.__hash__() <==> hash(x)
helper for pickle
helper for pickle
x.__repr__() <==> repr(x)
x.__setattr__(‘name’, value) <==> x.name = value
list of weak references to the object (if defined)
Bases: exceptions.Exception
Exception raise to stop the fit
alias of type
x.__delattr__(‘name’) <==> del x.name
x.__getattribute__(‘name’) <==> x.name
x.__getitem__(y) <==> x[y]
x.__getslice__(i, j) <==> x[i:j]
Use of negative indices is not supported.
x.__hash__() <==> hash(x)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
helper for pickle
x.__repr__() <==> repr(x)
x.__setattr__(‘name’, value) <==> x.name = value
x.__str__() <==> str(x)
list of weak references to the object (if defined)
exception message
Class FitArrange contains a set of data for a given model to perform the Fit.FitArrange must contain exactly one model and at least one data for the fit to be performed.
model: the model selected by the user Ldata: a list of data what the user wants to fit
add_data fill a self.data_list with data to fit
Parameters: | data – Data to add in the list |
---|
Returns: | list of data data_list |
---|
Returns: | saved model |
---|
return self.selected value
Remove one element from the list
Parameters: | data – Data to remove from data_list |
---|
set_model save a copy of the model
Parameters: | model – the model being set |
---|
set self.selected to 0 or 1 for other values raise an exception
Parameters: | value – integer between 0 or 1 |
---|
Bases: sans.dataloader.data_info.Data1D
Wrapper class for SANS data FitData1D inherits from DataLoader.data_info.Data1D. Implements a way to get residuals from data.
Add two data sets
Parameters: | other – data set to add to the current one |
---|---|
Returns: | new data set |
Raises ValueError: | |
raised when two data sets are incompatible |
Divided a data set by another
Parameters: | other – data set that the current one is divided by |
---|---|
Returns: | new data set |
Raises ValueError: | |
raised when two data sets are incompatible |
Parameters: | smearer – is an object of class QSmearer or SlitSmearer that will smear the theory data (slit smearing or resolution smearing) when set. |
---|
The proper way to set the smearing object would be to do the following:
from DataLoader.qsmearing import smear_selection
smearer = smear_selection(some_data)
fitdata1d = FitData1D( x= [1,3,..,],
y= [3,4,..,8],
dx=None,
dy=[1,2...], smearer= smearer)
Note : | that some_data _HAS_ to be of class DataLoader.data_info.Data1D Setting it back to None will turn smearing off. |
---|
Multiply two data sets
Parameters: | other – data set to subtract from the current one |
---|---|
Returns: | new data set |
Raises ValueError: | |
raised when two data sets are incompatible |
Add two data sets
Parameters: | other – data set to add to the current one |
---|---|
Returns: | new data set |
Raises ValueError: | |
raised when two data sets are incompatible |
Divided a data set by another
Parameters: | other – data set that the current one is divided by |
---|---|
Returns: | new data set |
Raises ValueError: | |
raised when two data sets are incompatible |
Multiply two data sets
Parameters: | other – data set to subtract from the current one |
---|---|
Returns: | new data set |
Raises ValueError: | |
raised when two data sets are incompatible |
Subtract two data sets
Parameters: | other – data set to subtract from the current one |
---|---|
Returns: | new data set |
Raises ValueError: | |
raised when two data sets are incompatible |
Nice printout
Subtract two data sets
Parameters: | other – data set to subtract from the current one |
---|---|
Returns: | new data set |
Raises ValueError: | |
raised when two data sets are incompatible |
Checks that the data lengths are compatible. Checks that the x vectors are compatible. Returns errors vectors equal to original errors vectors if they were present or vectors of zeros when none was found.
Parameters: | other – other data set for operation |
---|---|
Returns: | dy for self, dy for other [numpy arrays] |
Raises ValueError: | |
when lengths are not compatible |
Add notes to datainfo
Clone the current object, without copying the data (which will be filled out by a subsequent operation). The data arrays will be initialized to zero.
Parameters: |
|
---|
return the range of data.x to fit
Check whether the data has slit smearing information
Returns: | True is slit smearing info is present, False otherwise |
---|
Compute residuals.
If self.smearer has been set, use if to smear the data before computing chi squared.
Parameters: | fn – function that return model value |
---|---|
Returns: | residuals |
Returns: | residuals derivatives . |
---|---|
Note : | in this case just return empty array |
to set the fit range
set the x axis label and unit
set the y axis label and unit
Bases: sans.dataloader.data_info.Data2D
Wrapper class for SANS data
Add two data sets
Parameters: | other – data set to add to the current one |
---|---|
Returns: | new data set |
Raises ValueError: | |
raised when two data sets are incompatible |
Divided a data set by another
Parameters: | other – data set that the current one is divided by |
---|---|
Returns: | new data set |
Raises ValueError: | |
raised when two data sets are incompatible |
Multiply two data sets
Parameters: | other – data set to subtract from the current one |
---|---|
Returns: | new data set |
Raises ValueError: | |
raised when two data sets are incompatible |
Add two data sets
Parameters: | other – data set to add to the current one |
---|---|
Returns: | new data set |
Raises ValueError: | |
raised when two data sets are incompatible |
Divided a data set by another
Parameters: | other – data set that the current one is divided by |
---|---|
Returns: | new data set |
Raises ValueError: | |
raised when two data sets are incompatible |
Multiply two data sets
Parameters: | other – data set to subtract from the current one |
---|---|
Returns: | new data set |
Raises ValueError: | |
raised when two data sets are incompatible |
Subtract two data sets
Parameters: | other – data set to subtract from the current one |
---|---|
Returns: | new data set |
Raises ValueError: | |
raised when two data sets are incompatible |
Subtract two data sets
Parameters: | other – data set to subtract from the current one |
---|---|
Returns: | new data set |
Raises ValueError: | |
raised when two data sets are incompatible |
Perform 2D operations between data sets
Parameters: |
|
---|
Checks that the data lengths are compatible. Checks that the x vectors are compatible. Returns errors vectors equal to original errors vectors if they were present or vectors of zeros when none was found.
Parameters: | other – other data set for operation |
---|---|
Returns: | dy for self, dy for other [numpy arrays] |
Raises ValueError: | |
when lengths are not compatible |
Add notes to datainfo
Clone the current object, without copying the data (which will be filled out by a subsequent operation). The data arrays will be initialized to zero.
Parameters: |
|
---|
return the range of data.x to fit
return the residuals
Returns: | residuals derivatives . |
---|---|
Note : | in this case just return empty array |
Determine the correct qx_data and qy_data within range to fit
to set the fit range
Set smearer
set the x axis label and unit
set the y axis label and unit
set the z axis label and unit
Base class for scipy and park fit engine
Parameters: | id – id is key in the dictionary containing the model to return |
---|---|
Returns: | a model at this id or None if no FitArrange element was created with this id |
return the self.selected value of the fit problem of id
Parameters: | id – the id of the problem |
---|
remove fitarrange in id
select a couple of model and data at the id position in dictionary and set in self.selected value to value
Parameters: | value – the value to allow fitting. can only have the value one or zero |
---|
Receives plottable, creates a list of data to fit,set data in a FitArrange object and adds that object in a dictionary with key id.
Parameters: |
|
---|
set a model on a given in the fit engine.
Parameters: | model – sans.models type |
---|
Parameters: |
|
---|---|
Note : | pars must contains only name of existing model’s parameters |
Bases: park.model.Model
PARK wrapper for SANS models.
alias of MetaModel
x.__delattr__(‘name’) <==> del x.name
x.__getattribute__(‘name’) <==> x.name
x.__hash__() <==> hash(x)
Parameters: | sans_model – the sans model to wrap using park interface |
---|
alias of MetaModel
helper for pickle
helper for pickle
x.__repr__() <==> repr(x)
x.__setattr__(‘name’, value) <==> x.name = value
x.__str__() <==> str(x)
list of weak references to the object (if defined)
override eval method of park model.
Parameters: | x – the x value used to compute a function |
---|
Evaluate the model and derivatives wrt pars at x.
pars is a list of the names of the parameters for which derivatives are desired.
This method needs to be specialized in the model to evaluate the model function. Alternatively, the model can implement is own version of residuals which calculates the residuals directly instead of calling eval.
return a list of value of paramter to fit
Parameters: | fitparams – list of paramaters name to fit |
---|
Set the initial value for a set of parameters.
E.g., model.set(width=3,center=5)
Set value for parameters to fit
Parameters: | params – list of value for parameters to fit |
---|
Sans Assembly class a class wrapper to be call in optimizer.leastsq method
Compute residuals
Parameters: | params – value of parameters to fit |
---|
Parameters: |
|
---|
Check the lower and upper bound of the parameter value and set res to the inf if the value is outside of the range :limitation: the initial values must be within range.
Calculates chi^2
Parameters: | params – list of parameter values |
---|---|
Returns: | chi^2 |
Bases: park.parameter.Parameter
SANS model parameters for use in the PARK fitting service. The parameter attribute value is redirected to the underlying parameter value in the SANS model.
alias of type
x.__delattr__(‘name’) <==> del x.name
x.__getattribute__(‘name’) <==> x.name
x.__hash__() <==> hash(x)
Parameters: |
|
---|
helper for pickle
helper for pickle
x.__setattr__(‘name’, value) <==> x.name = value
list of weak references to the object (if defined)
Override _getrange of park parameter return the range of parameter
override the _getvalue of park parameter
:return value the parameter associates with self.name
override _setrange of park parameter
Parameters: | r – the value of the range to set |
---|
override the _setvalue pf park parameter
Parameters: | value – the value to set on a given parameter |
---|
Return the current value for a parameter.
Return true if the value is in the range
parameter name
Override _getrange of park parameter return the range of parameter
Set a parameter to a value, a range or an expression. If it is a value, the parameter will be fixed for the fit. If it is a range, the value will be varying for the fit. If it is an expression, the parameter will be calculated from the values of other parameters in the fit.
Raises ValueError if the value could not be interpreted.
Set the full path to the parameter as used in expressions involving the parameter name.
Return parameter range string.
E.g., ” Gold .....|.... 5.2043 in [2,7]”
override the _getvalue of park parameter
:return value the parameter associates with self.name