ptypy.experiment.ID16Anfp.ID16AScan#
- class ptypy.experiment.ID16Anfp.ID16AScan(pars=None, **kwargs)#
Bases:
PtyScanSubclass of PtyScan for ID16A beamline (specifically for near-field ptychography).
Default data parameters. See
scan.data- __init__(pars=None, **kwargs)#
Create a PtyScan object that will load ID16A data.
Methods
__init__([pars])Create a PtyScan object that will load ID16A data.
auto(frames)Repeated calls to this function will process the data.
check(frames[, start])This method checks how many frames the preparation routine may process, starting from frame start at a request of frames.
correct(raw, weights, common)Place holder for dark and flatfield correction.
get_data_chunk(chunksize[, start])This function prepares a container that is compatible to data package.
Begins the Data preparation and intended as the first method that does read-write access on (large) data.
load(indices)Loads data according to node specific scanpoint indices that have been determined by
LoadManageror otherwise.Loads anything that is common to all frames and stores it in dict.
Loads all positions for all diffraction patterns in this scan.
Function description see parent class.
Placeholder.
report([what, shout])Make a report on internal structure.
Attributes
CODESDEFAULTEOSKeys to store in meta param
WAITabortend_of_scanframes_accessibleTotal number of frames to prepare / load.
Minimum number of frames to prepare / load with call of
auto()Paramcontainer that stores all input parameters.- METAKEYS = ['version', 'num_frames', 'label', 'shape', 'psize', 'energy', 'center', 'distance']#
Keys to store in meta param
- auto(frames)#
Repeated calls to this function will process the data.
- Parameters:
frames (int) – Number of frames to process.
- Returns:
- one of the following
WAIT, if scan’s end is not reached, but no data could be prepared yet
EOS, if scan’s end is reached
a data package otherwise
- Return type:
variable
- check(frames, start=0)#
This method checks how many frames the preparation routine may process, starting from frame start at a request of frames. Returns the number of frames available from starting index start, and whether the end of the scan was reached.
- Parameters:
frames (int or None) – Number of frames requested
start (int or None) – Scanpoint index to start checking from
- Returns:
frame_accessible (int) – Number of frames readable from a starting point start
end_of_scan (bool or None) – Check if the end of scan was reached, otherwise None if this routine doesn’t know
- correct(raw, weights, common)#
Place holder for dark and flatfield correction. Apply (eventual) corrections to the raw frames. Convert from “raw” frames to usable data.
- Parameters:
raw (dict) – Dict containing index matched data frames (np.array).
weights (dict) – Dict containing possible weights.
common (dict) – Dict containing possible dark and flat frames.
- Returns:
data, weights – Flat and dark-corrected data dictionaries. These dictionaries must have the same keys as the input raw and contain corrected frames (data) and statistical weights (weights)
- Return type:
dict
Note
If the negative values results from the calculation, they will be forced to be equal to 0.
- get_data_chunk(chunksize, start=None)#
This function prepares a container that is compatible to data package.
This function is called from the auto() function.
- info#
Paramcontainer that stores all input parameters.
- initialize()#
Begins the Data preparation and intended as the first method that does read-write access on (large) data. Does the following:
Creates a *.ptyd data file at location specified by
dfile(master node only)Calls
load_weight(),load_positions()load_common()(master node only forload_parallel==Noneorload_parallel=='data')Sets
num_framesif neededCalls
post_initialize()
- load(indices)#
Loads data according to node specific scanpoint indices that have been determined by
LoadManageror otherwise.- Returns:
raw, pos, weight – Dictionaries whose keys are the given scan point indices and whose values are the respective frame / position according to the scan point index. weight and positions may be empty
- Return type:
dict
Note
If one weight (mask) is to be used for the whole scan, it should be loaded with load_weights(). The same goes for the positions, which sould be loade with load_positions().
- load_common()#
Loads anything that is common to all frames and stores it in dict.
- Returns:
common – contains information common to all frames such as dark, flat-field, detector flat-field, normalization couter, and distortion files
- Return type:
dict
- load_positions()#
Loads all positions for all diffraction patterns in this scan.
- Returns:
Positions – A (N,2)-array where N is the number of positions.
- Return type:
ndarray
- load_weight()#
Function description see parent class. For now, this function will be used to load the mask.
- Returns:
weight2d – A two-dimensional array with a shape compatible to the raw diffraction data frames if provided from file
- Return type:
ndarray
- num_frames#
Total number of frames to prepare / load. Set by
num_frames
- post_initialize()#
Placeholder. Called at the end of
initialize()by all processes.Use this method to benefit from ‘hard-to-retrieve but now available’ information after initialize.
- report(what=None, shout=True)#
Make a report on internal structure.