Module: xrd.experiment

Module for wrapping the main functionality of the xrd package.

The Experiment class is the primary interface. Other classes are helpers.

9 Classes

class hexrd.xrd.experiment.FitModes[source]

Bases: object

Indicators for single-frame or multiframe data files

class hexrd.xrd.experiment.ImageModes[source]

Bases: object

Indicators for single-frame or multiframe data files

class hexrd.xrd.experiment.Experiment(cfgFile='/home/docs/checkouts/readthedocs.org/user_builds/hexrd/envs/0.2.x/local/lib/python2.7/site-packages/hexrd/data/materials.cfg', matFile='/home/docs/checkouts/readthedocs.org/user_builds/hexrd/envs/0.2.x/local/lib/python2.7/site-packages/hexrd/data/all_materials.cfg')[source]

Bases: object

Wrapper for xrd functionality

__init__(cfgFile='/home/docs/checkouts/readthedocs.org/user_builds/hexrd/envs/0.2.x/local/lib/python2.7/site-packages/hexrd/data/materials.cfg', matFile='/home/docs/checkouts/readthedocs.org/user_builds/hexrd/envs/0.2.x/local/lib/python2.7/site-packages/hexrd/data/all_materials.cfg')[source]

Constructor for Experiment

INPUTS

cfgFile – name of the config file to use for initialization;
an empty string indicates that default values for options are used
matFile – name of the materials data file; a real file name
is required here
activeImage[source]

Active image

activeMaterial

Active Material

Can be set by number (index in material list) or by name.

On output, it is always a material instance.

activeReader

Get method for activeReader

Reader is set by using index in reader list or by name.

active_img[source]

Current image

add_to_img_list(name)[source]

Append the active image to the image list

calInput[source]

(read only) Calibration input data

calibrate(log=None)[source]

Calibrate the detector

Currently, uses polar rebin only.

clear_reader()[source]

Close current reader

clear_spots()[source]

Reset the list of spots

curFrameNumber[source]

Current frame number

detector[source]

(read only) detector

dump_grainList(f)[source]

dump grainList to cPickle

export_grainList(f, dspTol=None, etaTol=None, omeTol=None, doFit=False, sort=True)[source]

export method for grainList

find_raw_spots()[source]

find spots using current reader and options

fitRMats[source]

(get-only) Rotation matrices from indexing

getSavedReader(which)[source]

Get a specified reader

get_spots_ind()[source]

Select spots for indexing

hydra[source]

(read only) hydra image class

img_list[source]

(get only) List of saved images (get only)

img_names[source]

(get-only) List of names for saved images

index_opts[source]

(get-only) Options for indexing

loadDetector(fname)[source]

Load the detector information from a file

INPUTS fname – the name of the file to load from

loadMaterialList(fname)[source]

Load the pickled material list from a file

INPUTS fname – the name of the file to load from

loadRawSpots(fname)[source]

Load the detector information from a file

INPUTS fname – the name of the file to load from

loadReaderList(fname)[source]

Load the reader list from a file

INPUTS fname – the name of the file to load from

matDict[source]

(read only) Dictionary mapping material names to material

matList

List of materials

matNames[source]

(read only) List of material names

newDetector(gp, dp)[source]

Create a new detector with given geometry and distortion parameters

gp - initial geometric parameters dp - initial distortion parameters

newMaterial()[source]

Create a new material and add it to the list

newReader()[source]

Add new reader to the list and make it active

Changes name if necessary.

numFramesTotal[source]

Number of frames available for reading

raw_spots[source]

(get-only) spots from image before culling and association with rings

readImage(frameNum=1)[source]

Read and return an image

DESCRIPTION

This reads an image according to the active reader specification, saving it in the activeImage attribute.

readerListAddCurrent()[source]

Add current list to list of saved readers

readerNames[source]

Return list of saved readers

refineFlags[source]

(read only) refinement flags for calibration

refine_grains(minCompl, nSubIter=3, doFit=False, etaTol=valWUnit("etaTol", "ANGLE", 1.0, "degrees"), omeTol=valWUnit("etaTol", "ANGLE", 1.0, "degrees"), fineDspTol=0.005, fineEtaTol=valWUnit("etaTol", "ANGLE", 0.5, "degrees"), fineOmeTol=valWUnit("etaTol", "ANGLE", 0.5, "degrees"))[source]

refine a grain list

run_indexer()[source]

Run indexer

saveDetector(fname)[source]

Save the detector information to a file

INPUTS fname – the name of the file to save in

saveRMats(f)[source]

save rMats to npy file

saveRawSpots(fname)[source]

Save the detector information to a file

INPUTS fname – the name of the file to save in

saveReaderList(fname)[source]

Save the reader list to a file

INPUTS fname – the name of the file to save in

savedReaders[source]

Return list of saved readers

Experiment.simulateGrain(rMat=array([[ 1., 0., 0.],
[ 0., 1., 0.],
[ 0., 0., 1.]]), vMat=array([ 1., 1., 1., 0., 0., 0.]), planeData=None, detector=None, omegaRanges=[(-3.141592653589793, 3.141592653589793)], output=None)

Simulate a grain with choice of active material

spotOpts[source]

(get-only) spot finding options

spot_readers[source]

(get-only) list of readers used to generate spots

spots_for_indexing[source]

(get-only) spots associated with rings

class hexrd.xrd.experiment.ReaderInput(name='reader', desc='no description')[source]

Bases: object

ReaderInput

This class is for holding input required to instantiate a reader object. Currently, only GE reader is supported.

__init__(name='reader', desc='no description')[source]

Constructor for ReaderInput

INPUT name – [optional] (str) name desc – [optional] (str) description

NOTES * currently only GE reader is supported

RC

alias of ReadGE

aggMode[source]

Mode identifier for frame aggregation

aggModeOp[source]

(read only) option to pass to GE reader instances for aggregation mode

darkFile

Full pathname of dark file

getNumberOfFrames()[source]

Return number of frames available in data files

hasImages[source]

(get only) true if list of images has been set

imageNames

Get method for imageNames

makeReader()[source]

Return a reader instance based on self

setOmegaInfo(imgName, omin, omax, odel)[source]

Set omega info for the specified image

class hexrd.xrd.experiment.CalibrationInput(mat, xtol=1e-06)[source]

Bases: object

CalibrationInput

__init__(mat, xtol=1e-06)[source]

Constructor for CalibrationInput

cakeArgs[source]

(get only) Keyword arguments for polar rebinning

calData[source]

(get only) Lattice parameter data for calibrant

This provides a deepcopy with wavelength, strain magnitude and two-theta width set.

calMat

Calibration material (calibrant)

fitType

fit type: direct or caked

class hexrd.xrd.experiment.DetectorInfo(gParms=, []dParms=[])[source]

Bases: object

Class for detector and associated data

__init__(gParms=, []dParms=[])[source]

Constructor for detectorInfo

calibrate(calInp, rdrInp, mat, log=None)[source]

Calibrate this detector using specified reader and options

class hexrd.xrd.experiment.PolarRebinOpts[source]

Bases: object

Options for polar rebinning

__init__()[source]

Constructor for PolarRebinOpts

This routine sets default values for caking options.

The following attributes (with initial values) can be modified directly.
etaMin = 0 etaMax = 360 rhoMin = 100 rhoMax = 1000 numEta = 36 numRho = 500 correct = True
kwArgs[source]

(get only) Return keyword args to pass to polarRebin

class hexrd.xrd.experiment.SpotOptions[source]

Bases: object

Manage options available for spot finding and analysis

Mainly, this manages the keyword options to the findSpotsOmegaStack() static method in the Spots class.

__init__()[source]

SpotOptions Constructor

class hexrd.xrd.experiment.IndexOptions[source]

Bases: object

indexOptions

__init__()[source]

Constructor for indexOptions

5 Functions

hexrd.xrd.experiment.newName(name, nlist)[source]

return a name not in the list, but based on name input

hexrd.xrd.experiment.saveExp(e, f)[source]

save experiment to file

hexrd.xrd.experiment.loadExp(inpFile, matFile='/home/docs/checkouts/readthedocs.org/user_builds/hexrd/envs/0.2.x/local/lib/python2.7/site-packages/hexrd/data/materials.cfg')[source]

Load an experiment from a config file or from a saved exp file

inpFile – the name of either the config file or the saved exp file;
empty string means start new experiment

matFile – name of the materials file

hexrd.xrd.experiment.refineDetector(grainList, scl=None, gtol=1e-06)[source]
hexrd.xrd.experiment.objFunc(x, grainList, scl)[source]