Package diffpy :: Package pdfgui :: Package control :: Module fitdataset :: Class FitDataSet
[hide private]
[frames] | no frames]

Class FitDataSet

source code

               object --+        
                        |        
pdfcomponent.PDFComponent --+    
                            |    
        pdfdataset.PDFDataSet --+
                                |
                               FitDataSet

FitDataSet stores experimental and calculated PDF data and related
fitting parameters.  Inherited from PDFDataSet.

Data members (in addition to those in PDFDataSet):

fitrmin     -- lower boundary for data fitting, property
fitrmax     -- upper boundary for data fitting, property
fitrstep    -- r-step used for fitted data, property
constraints -- dictionary of { var_string : Constraint_instance }
initial     -- dictionary of initial values of refinable variables
refined     -- dictionary of refined values of refinable variables

Calculated members:

rcalc       -- list of r points where Gcalc is calculated, cached property
Gcalc       -- list of calculated G values, cached property
dGcalc      -- list of standard deviations of Gcalc, cached property
Gtrunc      -- Gobs resampled to rcalc grid, cached property
dGtrunc     -- dGobs resampled to rcalc grid, cached property
Gdiff       -- difference curve, Gdiff = Gtrunc - Gcalc, property
crw         -- cumulative rw of the fit

The data in rcalc, Gcalc, dGcalc, Gtrunc, dGtrunc are recalculated
and cached when r-sampling changes.  Any change to fitrmin,
fitrmax and fitrstep sets the _rcalc_changed flag.

Refinable variables:  qdamp, qbroad, dscale
Note: self.refvar is the same as self.initial[refvar].

Class data:

persistentItems -- list of attributes saved in project file



Instance Methods [hide private]
 
__init__(self, name)
Initialize FitDataSet.
source code
 
__setattr__(self, name, value)
Assign refinable variables to self.initial.
source code
 
__getattr__(self, name)
Obtain refinable variables from self.initial.
source code
 
_getStrId(self)
make a string identifier...
source code
 
getYNames(self)
get names of data item which can be plotted as y...
source code
 
getXNames(self)
get names of data item which can be plotted as x...
source code
 
getData(self, name, step=-1)
get self's data member...
source code
 
clear(self)
Reset all data members to initial empty values.
source code
 
clearRefined(self)
Clear all refinement results.
source code
 
obtainRefined(self, server, idataset)
Upload refined datataset from PdfFit server instance.
source code
 
read(self, filename)
Same as readObs().
source code
 
_updateRcalcRange(self)
Helper method for updating fitrmin, fitrmax and fitrstep just after reading observed values.
source code
 
readObs(self, filename)
Load experimental PDF data from PDFGetX2 or PDFGetN gr file.
source code
 
readStr(self, datastring)
Same as readObsStr().
source code
 
readObsStr(self, datastring)
Read experimental PDF data from a string...
source code
 
write(self, filename)
Same as writeCalc().
source code
 
writeCalc(self, filename)
Write calculated PDF data to a file.
source code
 
writeStr(self)
Same as writeCalcStr.
source code
 
writeCalcStr(self)
String representation of calculated PDF data.
source code
 
writeObs(self, filename)
Write observed PDF data to a file.
source code
 
writeObsStr(self)
String representation of observed PDF data.
source code
 
_resampledPDFDataSet(self)
Return instance of PDFDataSet with resampled observed data.
source code
 
writeResampledObs(self, filename)
Write resampled PDF data in Gtrunc to a file.
source code
 
writeResampledObsStr(self)
String representation of resampled PDF data in Gtrunc.
source code
 
findParameters(self)
Obtain dictionary of parameters used by self.constraints.
source code
 
applyParameters(self, parameters)
Evaluate constraint formulas and adjust self.initial parameters -- dictionary of parameter indices with Parameter instances.
source code
 
changeParameterIndex(self, oldidx, newidx)
Change a parameter index to a new value.
source code
 
copy(self, other=None)
Copy self to other.
source code
 
load(self, z, subpath)
Load data from a zipped project file.
source code
 
save(self, z, subpath)
Save data to a zipped project file.
source code
 
getFitSamplingType(self)
Description of r-sampling used in the fit.
source code
 
setFitSamplingType(self, tp, value=None)
GUI interface to set fitrstep, i.e., r-grid for fitting.
source code
 
getObsSampling(self)
Return the average r-step used in robs or zero when not defined.
source code
 
getNyquistSampling(self)
Return r-step corresponding to Nyquist sampling at the qmax value.
source code
 
_updateRcalcSampling(self)
Helper method for resampling rcalc and interpolating related data.
source code
 
_get_fitrmin(self) source code
 
_set_fitrmin(self, value) source code
 
_get_fitrmax(self) source code
 
_set_fitrmax(self, value) source code
 
_get_fitrstep(self) source code
 
_set_fitrstep(self, value) source code
 
_get_rcalc(self) source code
 
_set_rcalc(self, value) source code
 
_get_Gcalc(self) source code
 
_set_Gcalc(self, value) source code
 
_get_dGcalc(self) source code
 
_set_dGcalc(self, value) source code
 
_get_Gtrunc(self) source code
 
_set_Gtrunc(self, value) source code
 
_get_dGtrunc(self) source code
 
_set_dGtrunc(self, value) source code
 
_get_Gdiff(self) source code
 
_get_crw(self) source code
 
_set_crw(self, value) source code

Inherited from pdfdataset.PDFDataSet: getvar, setvar

Inherited from pdfcomponent.PDFComponent: close

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __str__

Class Variables [hide private]
  persistentItems = ['rcalc', 'Gcalc', 'dGcalc', 'fitrmin', 'fit...

Inherited from pdfdataset.PDFDataSet: refinableVars

Properties [hide private]
  fitrmin
Lower boundary for simulated PDF curve.
  fitrmax
Upper boundary for simulated PDF curve.
  fitrstep
R-step used for simulated PDF curve.
  rcalc
R-grid for refined data, read-only.
  Gcalc
List of calculate G values.
  dGcalc
List of standard deviations of Gcalc.
  Gtrunc
Gobs resampled to rcalc grid.
  dGtrunc
dGobs resampled to rcalc grid.
  Gdiff
Difference between observed and calculated PDF on rcalc grid.
  crw
cumulative rw on rcalc grid

Inherited from object: __class__

Method Details [hide private]

__init__(self, name)
(Constructor)

source code 
Initialize FitDataSet.

name -- name of the data set. It must be a unique identifier.

Overrides: pdfdataset.PDFDataSet.__init__

__setattr__(self, name, value)

source code 
Assign refinable variables to self.initial.
        

Overrides: object.__setattr__

__getattr__(self, name)
(Qualification operator)

source code 
Obtain refinable variables from self.initial.
This is called only when normal attribute lookup fails.

_getStrId(self)

source code 
make a string identifier

return value: string id

getYNames(self)

source code 
get names of data item which can be plotted as y

returns list of strings

getXNames(self)

source code 
get names of data item which can be plotted as x

returns list of strings

getData(self, name, step=-1)

source code 
get self's data member

name -- data item name
step -- step info, it can be:
        (1) a number ( -1 means latest step ): for single step
        (2) a list of numbers: for multiple steps
        (3) None: for all steps

returns data object, be it a single number, a list, or a list of list

clear(self)

source code 
Reset all data members to initial empty values.
        

Overrides: pdfdataset.PDFDataSet.clear

obtainRefined(self, server, idataset)

source code 
Upload refined datataset from PdfFit server instance.

server   -- instance of PdfFit server
idataset -- index of this dataset in server

read(self, filename)

source code 
Same as readObs().
        

Overrides: pdfdataset.PDFDataSet.read

_updateRcalcRange(self)

source code 
Helper method for updating fitrmin, fitrmax and fitrstep
just after reading observed values.

No return value.

readObs(self, filename)

source code 
Load experimental PDF data from PDFGetX2 or PDFGetN gr file.

filename -- file to read from

returns self

readStr(self, datastring)

source code 
Same as readObsStr().
        

Overrides: pdfdataset.PDFDataSet.readStr

readObsStr(self, datastring)

source code 
Read experimental PDF data from a string

datastring -- string of raw data

returns self

write(self, filename)

source code 
Same as writeCalc().  Use writeObs() to save experimental PDF data.

filename -- name of file to write to

No return value.

Overrides: pdfdataset.PDFDataSet.write

writeCalc(self, filename)

source code 
Write calculated PDF data to a file.

filename -- name of file to write to

No return value.

writeStr(self)

source code 
Same as writeCalcStr.  Use writeObsStr() for experimental PDF.

Return data string.

Overrides: pdfdataset.PDFDataSet.writeStr

writeCalcStr(self)

source code 
String representation of calculated PDF data.

Return data string.

writeObs(self, filename)

source code 
Write observed PDF data to a file.

filename -- name of file to write to

No return value.

writeObsStr(self)

source code 
String representation of observed PDF data.

Return data string.

_resampledPDFDataSet(self)

source code 
Return instance of PDFDataSet with resampled observed data.
Helper method for writeResampledObs and writeResampledObsStr.

writeResampledObs(self, filename)

source code 
Write resampled PDF data in Gtrunc to a file.

filename -- name of the file to write to

No return value.

writeResampledObsStr(self)

source code 
String representation of resampled PDF data in Gtrunc.

Return data string.

findParameters(self)

source code 
Obtain dictionary of parameters used by self.constraints.
The keys of returned dictionary are integer parameter indices, and
their values Parameter instances, with guessed initial values.

returns dictionary of indices and Parameter instances

applyParameters(self, parameters)

source code 
Evaluate constraint formulas and adjust self.initial

parameters -- dictionary of parameter indices with Parameter instances.
              Dictionary may also have float-type values.

changeParameterIndex(self, oldidx, newidx)

source code 
Change a parameter index to a new value.

This will replace all instances of one parameter name with another in
this fit.

copy(self, other=None)

source code 
Copy self to other. if other is None, create new instance

other -- ref to other object

returns reference to copied object

Overrides: pdfdataset.PDFDataSet.copy

load(self, z, subpath)

source code 
Load data from a zipped project file.

z       -- zipped project file
subpath -- path to its own storage within project file

save(self, z, subpath)

source code 
Save data to a zipped project file.

z       -- zipped project file
subpath -- path to its own storage within project file

getFitSamplingType(self)

source code 
Description of r-sampling used in the fit.  This method
compares self.fitrstep with r-sampling in the observed data
and with Nyquist r step.

Return a string, possible values are "data", "Nyquist" or "custom".

setFitSamplingType(self, tp, value=None)

source code 
GUI interface to set fitrstep, i.e., r-grid for fitting.

tp    -- description of fit sampling type.  Possible values are
         "data"    ... same as used in experimental PDF
         "Nyquist" ... sampling at Nyquist spacing
         "custom"  ... user specified value
value -- new value of fitrstep, only used when tp is "custom".

No return value.

Raises ValueError for unknown tp string.

getNyquistSampling(self)

source code 
Return r-step corresponding to Nyquist sampling at the qmax value.
When qmax is zero, return r-step in the observed data.

_updateRcalcSampling(self)

source code 
Helper method for resampling rcalc and interpolating related data.
This method interpolates Gcalc, dGcalc, Gtrunc, dGtrunc, crw to new r
grid.

No return value.


Class Variable Details [hide private]

persistentItems

Value:
['rcalc',
 'Gcalc',
 'dGcalc',
 'fitrmin',
 'fitrmax',
 'fitrstep',
 'initial',
 'refined']

Property Details [hide private]

fitrmin

Lower boundary for simulated PDF curve.

Get Method:
diffpy.pdfgui.control.fitdataset.FitDataSet._get_fitrmin(self)
Set Method:
diffpy.pdfgui.control.fitdataset.FitDataSet._set_fitrmin(self, value)

fitrmax

Upper boundary for simulated PDF curve.

Get Method:
diffpy.pdfgui.control.fitdataset.FitDataSet._get_fitrmax(self)
Set Method:
diffpy.pdfgui.control.fitdataset.FitDataSet._set_fitrmax(self, value)

fitrstep

R-step used for simulated PDF curve.

Get Method:
diffpy.pdfgui.control.fitdataset.FitDataSet._get_fitrstep(self)
Set Method:
diffpy.pdfgui.control.fitdataset.FitDataSet._set_fitrstep(self, value)

rcalc

R-grid for refined data, read-only.
Use fitrmin, fitrmax, fitrstep to change it

Get Method:
diffpy.pdfgui.control.fitdataset.FitDataSet._get_rcalc(self)
Set Method:
diffpy.pdfgui.control.fitdataset.FitDataSet._set_rcalc(self, value)

Gcalc

List of calculate G values.

Get Method:
diffpy.pdfgui.control.fitdataset.FitDataSet._get_Gcalc(self)
Set Method:
diffpy.pdfgui.control.fitdataset.FitDataSet._set_Gcalc(self, value)

dGcalc

List of standard deviations of Gcalc.

Get Method:
diffpy.pdfgui.control.fitdataset.FitDataSet._get_dGcalc(self)
Set Method:
diffpy.pdfgui.control.fitdataset.FitDataSet._set_dGcalc(self, value)

Gtrunc

Gobs resampled to rcalc grid.

Get Method:
diffpy.pdfgui.control.fitdataset.FitDataSet._get_Gtrunc(self)
Set Method:
diffpy.pdfgui.control.fitdataset.FitDataSet._set_Gtrunc(self, value)

dGtrunc

dGobs resampled to rcalc grid.

Get Method:
diffpy.pdfgui.control.fitdataset.FitDataSet._get_dGtrunc(self)
Set Method:
diffpy.pdfgui.control.fitdataset.FitDataSet._set_dGtrunc(self, value)

Gdiff

Difference between observed and calculated PDF on rcalc grid.

Get Method:
diffpy.pdfgui.control.fitdataset.FitDataSet._get_Gdiff(self)

crw

cumulative rw on rcalc grid

Get Method:
diffpy.pdfgui.control.fitdataset.FitDataSet._get_crw(self)
Set Method:
diffpy.pdfgui.control.fitdataset.FitDataSet._set_crw(self, value)