sda.io.extract_oscilloscope_files#
The aim of this file is to extract data from a zip folder generated by LeCroy Oscilloscope.
It will extract the data in a folder on the desktop and rename the folder with the title of the lab notebook.
Functions#
|
Extract data from a zip folder generated by LeCroy Oscilloscope. |
|
Rename the folder with the title of the lab notebook. |
|
Convert all trc files from a folder to a chosen type. |
Module Contents#
- sda.io.extract_oscilloscope_files.extract_oscilloscope_files(zip_folder_path, destination_folder_path=None)#
Extract data from a zip folder generated by LeCroy Oscilloscope.
- Parameters:
zip_folder_path (
Path) – Path to the zip folder.destination_folder_path (
Path | None, optional) – Path to the folder where the data will be extracted, by default None. If None, the data will be extracted in the same folder as the zip file.
- Returns:
Path to the destination folder.
- Return type:
Path
- sda.io.extract_oscilloscope_files.rename_oscilloscope_folders(source_folder_path, destination_folder_path=None, remove_source_folder=False, name_style='datetime')#
Rename the folder with the title of the lab notebook.
- Parameters:
source_folder_path (
Path) – Path to the folder containing the data.destination_folder_path (
Path | None, optional) – Path to the folder where the data will be copied, by default None. If None, the data will be copied in the same folder as the source folder.remove_source_folder (
bool, optional) – If True, the source folder will be removed after the data is copied. By default False.name_style (
str, optional) – Type of the name to use for the folder. Options are “datetime” or “title”. By default “datetime”. “title” only works if the XPortRecord.xml file is present.
- Returns:
Path to the destination folder.
- Return type:
Path
- sda.io.extract_oscilloscope_files.convert_oscilloscope_files_batch(folder_path, file_type='csv')#
Convert all trc files from a folder to a chosen type.
- Parameters:
folder_path (
Path) – Path to the folder containing the data.file_type (
str, optional) – Type of the file to convert to, by default “csv”.
- Returns:
Path to the destination folder.
- Return type:
Path
Examples
>>> from sda.io.extract_oscilloscope_files import convert_oscilloscope_files_batch >>> from pathlib import Path >>> folder_path = ( ... Path(sda.__file__).parent.parent / "test" / "data" / "extracted_trc_data" ... ) >>> convert_oscilloscope_files_batch(folder_path, "csv") >>> # The csv files will be created in the same folder as the trc files.