graphnet_file_reader¶
Module containing different FileReader classes in GraphNeT.
These methods are used to open and apply Extractors to experiment-specific file formats.
- class graphnet.data.readers.graphnet_file_reader.GraphNeTFileReader(name, class_name, level, log_folder, **kwargs)[source]¶
Bases:
Logger
,ABC
A generic base class for FileReaders in GraphNeT.
Classes inheriting from GraphNeTFileReader must implement a __call__ method that opens a file, applies `Extractor`(s) and returns a list of ordered dictionaries.
In addition, Classes inheriting from GraphNeTFileReader must set class properties accepted_file_extensions and accepted_extractors.
Construct Logger.
- Parameters:
name (str | None)
class_name (str | None)
level (int)
log_folder (str | None)
kwargs (Any)
- property accepted_file_extensions: List[str]¶
Return list of accepted file extensions.
- property extracor_names: List[str]¶
Return list of table names produced by extractors.
- find_files(path)[source]¶
Search directory for input files recursively.
This method may be overwritten by custom implementations.
- Parameters:
path (
Union
[str
,List
[str
]]) – path to directory.- Return type:
Union
[List
[str
],List
[I3FileSet
]]- Returns:
List of files matching accepted file extensions.
- set_extractors(extractors)[source]¶
Set `Extractor`(s) as member variable.
- Parameters:
extractors (
Union
[List
[Extractor
],List
[I3Extractor
],List
[ParquetExtractor
],List
[H5Extractor
],List
[PrometheusExtractor
]]) – A list of `Extractor`(s) to set as member variable.- Return type:
None