In situ X-ray Diffraction (XRD)¶
XRD module for in situ data.
XRDInsituBlock
¶
Bases: GenericInSituBlock
This datablock processes in-situ XRD data from an input .zip file containing two or three specific directories:
- XRD data directory: Contains multiple XRD patterns (.xy, or otherwise based on datalab XRDBlock) measured at different times,
- Time series directory: Contains the log data (.csv) with temperature or other time of measurement metadata,
- (Optional) Electrochemical data directory: Contains electrochemical data with voltage vs time data.
Attributes:
defaults
¶
defaults = {'start_exp': 1, 'exclude_exp': None, 'metadata': None, 'target_sample_number': 1000, 'target_data_number': 1000, 'data_granularity': None, 'sample_granularity': None}
generate_insitu_xrd_plot
¶
Generate combined XRD and electrochemical or Temperature plots using the operando-style layout.
This method coordinates the creation of various plot components and combines them into a unified visualization.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
Path | None
|
Path to the zip file containing XRD and electrochemical data, rather than looking up in the database for attached files. |
None
|
link_plots
|
bool
|
Boolean to indicate if the plots should be linked using bokeh js scripts. |
False
|
get_available_folders
¶
Extract and return a list of available folders from the zip file.
This method opens the zip file identified by file_id, extracts the main folder and its subfolders, and returns a sorted list of subfolder names.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
Path
|
Path to the zip file. |
required |
Returns:
| Type | Description |
|---|---|
List[str]
|
Sorted list of subfolder names, or empty list if file not found or on error. |
process_and_store_data
¶
Process all in situ XRD, log and (optional) electrochemical data and store results. This method is a wrapper for processing both XRD and electrochemical data and the log data.
subsample_data
¶
subsample_data(data: Union[DataFrame, ndarray], sample_granularity: int, data_granularity: int, method: str = 'linear') -> Union[DataFrame, ndarray]
Subsample data to a specified granularity in both sample and feature dimensions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Union[DataFrame, ndarray]
|
The data to be subsampled. |
required |
sample_granularity
|
int
|
Subsampling step along rows (samples). |
required |
data_granularity
|
int
|
Subsampling step along columns (features). |
required |
method
|
str
|
Subsampling method; currently supports only 'linear' and 'max_pooling'. |
'linear'
|
Returns:
| Type | Description |
|---|---|
Union[DataFrame, ndarray]
|
Subsampled data of the same type as input. |