nicetoolbox.detectors.in_out.IO¶
- class nicetoolbox.detectors.in_out.IO(config)[source]¶
Bases:
objectThe IO class handles input/output operations and folder management for the NICE toolbox.
- Parameters:
config (dict) – A dictionary containing the configuration parameters.
- out_folder¶
The path to the output folder.
- Type:
str
- log_level¶
The log level.
- Type:
str
- out_sub_folder¶
The path to the output sub-folder.
- Type:
str
- tmp_folder¶
The path to the temporary folder.
- Type:
str
- data_folder¶
The path to the data folder.
- Type:
str
- data_input_folder¶
The path to the input data folder.
- Type:
str
- calibration_file¶
The path to the calibration file.
- Type:
str
- conda_path¶
The path to the Conda installation directory.
- Type:
str
- algorithm_names¶
A list of algorithm names.
- Type:
list
- detector_out_folder¶
The path to the detector output folder.
- Type:
str
- detector_visualization_folder¶
The path to the detector visualization folder.
- Type:
str
- detector_additional_output_folder¶
The path to the detector additional output folder.
- Type:
str
- detector_tmp_folder¶
The path to the detector temporary folder.
- Type:
str
- detector_run_config_path¶
The path to the detector run configuration file.
- Type:
str
- detector_final_result_folder¶
The path to the detector final result folder.
- Type:
str
Initializes IO by creating the output folder and setting the log level.
- Parameters:
config (dict) – A dictionary containing configuration parameters.
- Raises:
OSError – If there is an error creating the output folder or the base data folder.
Methods
Check the validity of the given configuration.
Creates the necessary output and data folders.
Returns the calibration file path.
Returns the path to the Conda installation directory.
Returns the path of the configuration file.
Returns the data folder associated with the current instance.
Get the output folder path for a specific component, algorithm, and token.
Returns the input folder path.
Returns the path of the log file and the log level.
Returns the output folder based on the given name and token.
Initializes the necessary variables and folders for data processing.
- check_config(config)[source]¶
Check the validity of the given configuration.
- Parameters:
config (dict) – The configuration dictionary.
- Raises:
TypeError – If the ‘process_data_to’ value is not a string.
ValueError – If the ‘process_data_to’ value is not ‘tmp_folder’ or ‘data_folder’.
ValueError – If any of the detector input folders are invalid.
OSError – If any of the detector input folders are not accessible.
- create_folders()[source]¶
Creates the necessary output and data folders.
This method creates the output folder and data folder if they don’t already exist. If the folders cannot be created, an exception is raised.
- Raises:
OSError – If the output folder or data folder cannot be created.
- get_calibration_file()[source]¶
Returns the calibration file path.
- Returns:
The path of the calibration file.
- Return type:
str
- get_conda_path()[source]¶
Returns the path to the Conda installation directory.
- Returns:
The path to the Conda installation directory.
- Return type:
str
- get_config_file()[source]¶
Returns the path of the configuration file.
- Returns:
The path of the configuration file.
- Return type:
str
- get_data_folder()[source]¶
Returns the data folder associated with the current instance.
- Returns:
The path to the data folder.
- Return type:
str
- get_detector_output_folder(component, algorithm, token)[source]¶
Get the output folder path for a specific component, algorithm, and token.
- Parameters:
component (str) – The name of the component.
algorithm (str) – The name of the algorithm.
token (str) – The token indicating the type of output folder.
- Returns:
The path of the output folder.
- Return type:
str
- Raises:
NotImplementedError – If the algorithm or token is not supported.
- get_input_folder()[source]¶
Returns the input folder path.
- Returns:
The path to the input folder.
- Return type:
str
- get_log_file_level()[source]¶
Returns the path of the log file and the log level.
- Returns:
A tuple containing the path of the log file and the log level.
- Return type:
tuple
- get_output_folder(token)[source]¶
Returns the output folder based on the given name and token.
- Parameters:
token (str) – The token specifying the type of output folder
('tmp' –
'output' –
'main' –
'csv'). (or) –
- Returns:
The path to the output folder.
- Return type:
str
- Raises:
NotImplementedError – If the token is not ‘tmp’, ‘output’, ‘main’, or ‘csv’.