Skip to content

In situ UV-Vis Spectroscopy

UVVIS module for in situ data.

UVVisInsituBlock

Bases: GenericInSituBlock

This datablock processes in situ UV-Vis data from an input .zip file containing two specific directories:

  • UV-Vis Data Directory: Contains multiple UV-Vis in-situ experiment datasets.
  • Echem Data Directory: Contains echem data files in .txt format.

Attributes:

Name Type Description
accepted_file_extensions
available_folders List[str]
block_db_model
blocktype
defaults
description
echem_folder_name
folder_name
name
plot_functions
plotting_label_dict
uvvis_folder_name
version str

accepted_file_extensions

accepted_file_extensions = ('.zip',)

available_folders

available_folders: List[str] = []

block_db_model

block_db_model = InsituBlockResponse

blocktype

blocktype = 'insitu-uvvis'

defaults

defaults = {'start_exp': 0, 'exclude_exp': None, 'scan_time': None, 'target_sample_number': 1000, 'target_data_number': 1000, 'data_granularity': None, 'sample_granularity': None}

description

description = __doc__

echem_folder_name

echem_folder_name = None

folder_name

folder_name = None

name

name = 'UV-Vis insitu'

plot_functions

plot_functions

plotting_label_dict

plotting_label_dict = {'x_axis_label': 'Wavelength (nm)', 'time_series_y_axis_label': 'Time (h)', 'line_y_axis_label': 'Absorbance', 'time_series_x_axis_label': 'Voltage (V)', 'label_source': {'label_template': 'Exp. # {exp_num}, t = {time} h, V = {voltage} V', 'label_field_map': {'exp_num': 'exp_num', 'time': 'time', 'voltage': 'voltage'}}}

uvvis_folder_name

uvvis_folder_name = None

version

version: str = __version__

generate_insitu_uvvis_plot

generate_insitu_uvvis_plot(file_path: Path | None = None, link_plots: bool = False)

Generate combined UVVis and electrochemical 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 UVVis and electrochemical data, rather than looking up in the database for attached files.

None

get_available_folders

get_available_folders(file_path: Path) -> List[str]

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_and_store_data(file_path: str | Path)

Process all in situ UV-Vis and electrochemical data and store results. This method is a wrapper for processing both UV-Vis and electrochemical 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.