nirs4all.data.parsers.folder_parser module
Folder parser for dataset configuration.
This parser handles folder paths, scanning for data files matching standard naming conventions (Xcal, Xval, etc.).
- class nirs4all.data.parsers.folder_parser.FolderParser[source]
Bases:
BaseParserParser for folder-based dataset configuration.
This parser scans a folder for data files matching standard naming conventions and creates a configuration dictionary.
Supported file formats: - CSV files (.csv) - Compressed CSV files (.csv.gz, .csv.zip)
Multi-source detection: - If multiple files match the same pattern (e.g., Xcal_NIR.csv, Xcal_MIR.csv),
they are treated as multi-source data.
- SUPPORTED_EXTENSIONS = {'.csv', '.csv.gz', '.csv.zip', '.gz', '.zip'}
- can_parse(input_data: Any) bool[source]
Check if input is a folder path.
- Parameters:
input_data – The input to check.
- Returns:
True if input is a string path to an existing directory.
- parse(input_data: Any) ParserResult[source]
Parse a folder path into a configuration.
- Parameters:
input_data – Folder path (str, Path) or dict with ‘folder’ key.
- Returns:
ParserResult with configuration from scanned files.