CHAP.utils.parfile
¶
Utilities for interacting with scans using an SMB-style .par file as input
Module Contents¶
Classes¶
Representation of a .par file |
API¶
- class CHAP.utils.parfile.ParFile(par_file, scann_col_name='SCAN_N')¶
Representation of a .par file
- Variables:
par_file – name of the .par file
json_file – name of the .json file containing the key for column names of the .par file
spec_file – name of the SPEC data file associated with this .par file
column_names – list of the names of each column in the par file
data – a 2D array of the data in this .par file. 0th index: row. 1st index: column
Initialization
- get_map(experiment_type, station, par_dims, other_dims=[])¶
Return a map configuration based on this par file.
- Parameters:
experiment_type (Literal['SAXSWAXS', 'EDD', 'XRF', 'TOMO']) – name of the experiment type for the map that this .par file represents
station (Literal['id1a3','id3a','id3b']) – name of the station at which the data were collected
par_dims (list[dict[str, str]]) – list of dictionaries configuring the map’s independent dimensions.
other_dims (list[dict[str,str]], optional) – a list of other dimensions to include in the returned MapConfig’s independednt_dimensions. Use this if each scans in thhis par ile captured more than one frame of data. Defaults to []
- Returns:
a map configuration
- Return type:
- good_scan_numbers(good_col_name='1/0')¶
Return the numbers of scans marked with a “1” in the indicated “good” column of the .par file.
- Parameters:
good_col_name (str, optional) – the name of the “good” column of the par file, defaults to “1/0”
- Raises:
ValueError – if this .par file does not have a column with the same name as
good_col_name
- Returns:
“good” scan numbers
- Return type:
list[int]
- get_values(column, scan_numbers=None)¶
Return values from a single column of the par file.
- Parameters:
column (str or int) – the string name OR index of the column to return values for
scan_numbers (list[int], optional) – list of specific scan numbers to return values in the given column for (instead of the default behavior: return the entire column of values), defaults to None
- Returns:
a list of values from a single column in the par file
- Return type:
list[object]
- map_values(map_config, values)¶
Return a reshaped array of the 1D list
values
so that it matches up with the coordinates ofmap_config
.- Parameters:
map_config (MapConfig) – the map configuration according to which values will be reshaped
values (list or np.ndarray) – a 1D list of values to reshape
- Returns:
reshaped array of values
- Return type:
np.ndarray