Package diffpy :: Package srrietveld :: Module project :: Class Project
[frames] | no frames]

Class Project

source code

                       object --+        
                                |        
refinementdata.hdf5.object.Object --+    
                                    |    
       refinementdata.project.Project --+
                                        |
                                       Project

Project class defines a SrRietveld refinement project. It consists of a number of single refinements. A project can call different Rietveld engines to run its refinements.

A project object contains the list of refinemenets, and list of jobs.

Instance Methods
 
__init__(self, path, mode='a', mainframe=None)
Create a SrRietveld project from saved project data file.
source code
 
addJob(self, job)
Add a job to the job list of the project
source code
 
addToZip(self, zipFilePath)
Archive the project data file, and other associated files, such as the histogram files, instrument files, and incident spectrum files into a zip folder.
source code
 
close(self)
Close the opened project.
source code
 
deleteJob(self, job)
Delete job from the job list
source code
 
exportEngineFit(self, refinementObj, index=None)
Build an engine fit based on given fit and index.
source code
 
getRefinementByName(self, name)
Get the refinement object by its name
source code
 
importDataFiles(self)
Read the data files and instrument files into the pattern objects
source code
 
importEngineFile(self, fullpath, refinementObjName=None)
Import an engine file (EXP or pcr files).
source code
 
importEngineFit(self, enginefit, name, fullpath, index=None)
Import an engine Fit object.
source code
 
importProject(self, projPath)
Import the refinements from another project file.
source code
 
listParams(self, obj, recursively=False, excluded=[])
List all parameters in an object.
source code
 
listRefinementNames(self)
Different from the methdo listRefinemetns, this function will return a list of names of the refinements
source code
 
plot(self, ydatasets, xdataset=None, xlabel='')
Make a plot of selected Dataset objects
source code
 
plotHistory(self, datasets)
Make a plot of the historic values of selected parameters.
source code
 
plotPatterns(self, objects)
Make a quick plot of patterns.
source code
 
saveToDisk(self, fullpath)
Save the project data to local drive.
source code
 
updateFit(self, fitrt)
Update the fit data with an fit object.
source code
 
updatePaths(self)
Update the histogram and instrument file paths saved in the project
source code
 
updatePlot(self, index=None)
Update all plots based the data in the project
source code
 
verifyFitName(self, fitName)
Compare the fitname with existing names of refienments in the project.
source code

Inherited from refinementdata.project.Project: add, addRefinement, listRefinements, removeRefinement

Inherited from refinementdata.hdf5.object.Object: addObject, copy, copyMeta, delete, exportFile, get, getAttr, getByPath, getFlatIndex, getMetaData, getMultiDimIndex, getObject, getPyObj, hasAttr, hasMeta, importFile, isDescendant, list, listAttrs, listNames, listObjects, load, loadLocalData, loadLocalObjects, loadObject, move, range, readStr, removeObject, rename, repeat, replicate, reshape, save, set, setAttr, setByPath, setLabels, setPyObj, unset, unsetAttr, writeStr

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties

Inherited from refinementdata.hdf5.object.Object: labels, name, ndim, path

Inherited from object: __class__

Method Details

__init__(self, path, mode='a', mainframe=None)
(Constructor)

source code 

Create a SrRietveld project from saved project data file.

Parameters:
  • path (file path string) - the path of the project data file. If it does not exist, an empty project will be created.
  • mode (one character string, possible value r, w, a) - the mode to open the project.
    • r -- read,
    • w -- write,
    • a -- append
  • mainframe (the main frame object) - the pointer to the main window in the GUI object set to be None in script mode
Overrides: object.__init__

addJob(self, job)

source code 

Add a job to the job list of the project

Parameters:
  • job (a Job object) - a refinement job to be added
Returns:
no return value

addToZip(self, zipFilePath)

source code 

Archive the project data file, and other associated files, such as the histogram files, instrument files, and incident spectrum files into a zip folder.

Parameters:
  • zipFilePath (zip file path string) - the full path to save the zip file
Returns:
no return value

close(self)

source code 

Close the opened project.

Returns:
no return value
Overrides: refinementdata.project.Project.close

deleteJob(self, job)

source code 

Delete job from the job list

Parameters:
  • job (a job object) - the job to be deleted
Returns:
no return value

exportEngineFit(self, refinementObj, index=None)

source code 

Build an engine fit based on given fit and index.

Parameters:
  • refinementObj (a diffpy.refinementdata.Refinement object or its derivatives) - a refinement usually contains a series of single refinements The information will be read from this object to construct a engine fit, which contains information for a single step refinement
  • index (tuple or int) - the index of the single refinement in the refinementObj a tuple represents the index in a multidimensinal data if the refinementObj is one dimensional, index can be an integer
Returns:
an engine fit object

getRefinementByName(self, name)

source code 

Get the refinement object by its name

Parameters:
  • name (string) - the refinement name to get
Returns:
the refinement object with the name, None if there is no such refinement object. If there are duplicate names, the first refinement object with this name will be returned, and the program with emit a warning

importDataFiles(self)

source code 

Read the data files and instrument files into the pattern objects

Returns:
no return value

importEngineFile(self, fullpath, refinementObjName=None)

source code 

Import an engine file (EXP or pcr files). A refinement will be created based on the data in the imported engine file.

Parameters:
  • fullpath (file path string) - the full file path of the engine file to be imported
  • refinementObjName (string) - the proposed name of the refinement object to be created. If the refinementObjName is None, the engine file name will be used
Returns:
no return value

importEngineFit(self, enginefit, name, fullpath, index=None)

source code 

Import an engine Fit object. It is provided for backward compatiblity, namely when the fit is created using xml interface.

Parameters:
  • enginefit (an engine Fit object) - the engine fit, which contains all the information for one refinement for that engine (GSAS or FullProf)
  • name (string) - the name to be assigned to the new Fit object
  • fullpath (file path string) - the fullpath is used to locate the supplement files (data, instrument, engine files)
  • index () - the index to a Fit in a Fit array ( not applicable if shape is given )
Returns:
the new Fit object

importProject(self, projPath)

source code 

Import the refinements from another project file.

Parameters:
  • projPath (file path string) - the file path of the project to be imported.
Returns:
no return value

listParams(self, obj, recursively=False, excluded=[])

source code 

List all parameters in an object.

Parameters:
  • obj (a data object) - the object whose parameters to be listed
  • recursively (boolean) - if True, the parameters in the sub-objects will be included. False otherwise
  • excluded (a list of objects, whose child parameters should be excluded in the result)
Returns:
a list of parameters (Dataset object).

listRefinementNames(self)

source code 

Different from the methdo listRefinemetns, this function will return a list of names of the refinements

Returns:
the names of the refinements in this project

plot(self, ydatasets, xdataset=None, xlabel='')

source code 

Make a plot of selected Dataset objects

Parameters:
  • ydatasets (a list of Dataset objects) - contains the list of y values in the plot
  • xdataset (a Dataset object) - the x values in the plot. If xdataset is None a list of consecutive integers will be used
Returns:
the plot figure object

plotHistory(self, datasets)

source code 

Make a plot of the historic values of selected parameters.

Parameters:
  • datasets (a list of Dataset objects) - the data to be plotted
Returns:
no return value

plotPatterns(self, objects)

source code 

Make a quick plot of patterns.

objects -- a list of selected objects

saveToDisk(self, fullpath)

source code 

Save the project data to local drive.

Parameters:
  • fullpath (file path string) - the file path to save the project data
Returns:
no return value

updateFit(self, fitrt)

source code 

Update the fit data with an fit object.

Parameters:
  • fitrt - the run-time fit instance
Returns:
no return value

updatePaths(self)

source code 

Update the histogram and instrument file paths saved in the project

Returns:
no return value

updatePlot(self, index=None)

source code 

Update all plots based the data in the project

Parameters:
  • index (tuple or int) - the index of the curve in the plot
Returns:
no return value

verifyFitName(self, fitName)

source code 

Compare the fitname with existing names of refienments in the project. A valid name will be returned.

  • All the dots (.) will be replaced with underscore (_)
  • The same refinement names will be surfixed with numbers with brakets such as Refinement, Refinement (1), Refinement (2)
Parameters:
  • fitName (string) - refinement name to be verified
Returns:
If fitName is valid, return value will be the same as fitName; if fitName conains invalid characters or has duplications, a valid refinement name will be returned