usansred package

usansred.reduce

class usansred.reduce.Experiment(csvFilePath, logbin=False, outputFolder=None)[source]

Bases: object

DarwinWidth = 5.1
dumpReducedData()[source]

dump reduced data to txt files return

logbin = False
minQ = 1e-06
primWave = 3.6
reduce(outputFolder=None)[source]

Reduce the USANS data outputFolder - the result will be dumped to the output folder. If none will just use current folder return

stepPerDec = 33
vAngle = 0.042
class usansred.reduce.Sample(experiment, name, startNumber, numOfScans, thickness=0.1, isBackground=False, exclude=None)[source]

Bases: object

A scan consists of multiple experiments

property data
The main data from detector, stitched and normalized with monitor data,

currently the first bank detector data, scaled with monitor

property dataReduced

Return the reduced data, this is a wrapper when one decide the stage of reduction

dumpDataToCSV(filePath, data, title=None)[source]

Dump data to CSV file filePath - the file path to dump data - the data to dump, each key is a column. title - the colume title in list or tuple, if not specified use the key

return

dumpReducedDataToCSV(detectorData=True, scaledData=True, logBinnedData=True, bgSubtractedData=True)[source]

Dump the data to output folder defined in experiment

Filenames follow the legacy Igor output file names

"UN_" + sampleName + "_det_1.txt" "UN_" + sampleName + "_det_1_lb.txt" "UN_" + sampleName + "_det_1_lbs.txt"

Parameters

detectorData: bool

dump detector data if True

scaledData: bool

dump scaling data if True

logBinnedData: bool

dump log binned data if True

bgSubtractedData: bool

dump background subtracted data if True

getFileNamesFromSample(sampleName)[source]

Get the reduced file names from sample name sampleName - sample name return - a list of reduced file names associated with this sample

isBackground = False

Exclude the bad runs then keep counting

property isLogBinned

Check if he data is log binned

property isReduced

Check if the data is reduced

logBin(momentum_transfer, intensity, energy)[source]

log bin the data return

property numOfBanks

number of banks are defined in experiment class

property numOfLogBins

Return the size of log binnd data

property numOfScans
reduce()[source]

Reduce this scan return

rescaleData(guess_init=False)[source]

Rescale data with thickness. Fit the I(Q) data with gaussian and calculate the peak area.

guess_init: if guess the initial value with differential_evolution return

property size

return the length of detector data points

property sizeReduced

The data size of reduced data

stitchData()[source]

Stitch scans together The stitched data will be stored in property self.data

return

subtractBg(background, vScale=1.0)[source]

Subtract the background background - the background sample, should be processed (stitched, scaled, and binned)

return

class usansred.reduce.Scan(experiment, sample, number, isBackground=False)[source]

Bases: object

Contains sample information

convertXYToIQData(XYData)[source]

Convert XY data to I(Q)

Parameters

XYData: dict A dictionary of lists, XYData = {“X”: [], “Y”: [], “E”: [], “T”: []}

Returns

Dictionary of lists {“Q”: [], “I”: [], “E”: [], “T”: []}

isBackground = False
load()[source]

Load experiment data files

loadDetectorFile()[source]

Load detector file

load_monitor_file()[source]

Load monitor file

property numOfBanks

number of banks are defined in Experiment class

property range

property of q range

readXYFile(XYFilePath)[source]

Load XY File to data structure XYFilePath - the xy file path return - a dictionary of lists

property size

Number of data points in this scan

usansred.reduce.main()[source]
usansred.reduce.parse_arguments()[source]

usansred.reduce_USANS

usansred.reduce_USANS.get_sequence_info(seq_file)[source]

Get the sequence information from local autoreduce folder json files for autoreduction

usansred.reduce_USANS.main()[source]
usansred.reduce_USANS.update_sequence_info(out_file, info)[source]

usansred.summary

summary.py: summary of the reduced data.

usansred.summary.reportFromCSV(csvFilePath, outputFolder=None)[source]

generate report from csv file with a list csvFile - file location of csv file