mantidimaging.core.io.instrument_log module#
- class mantidimaging.core.io.instrument_log.BaseParser(lines: list[str])[source]#
Bases:
ABC
Base class for parsers
- class mantidimaging.core.io.instrument_log.InstrumentLog(lines: list[str], source_file: Path)[source]#
Bases:
object
Multiformat instrument log reader
New parsers can be implemented by subclassing InstrumentLogParser
- parser: type[InstrumentLogParser]#
- parsers: ClassVar[list[type[InstrumentLogParser]]] = [<class 'mantidimaging.core.io.instrument_log_implmentations.LegacySpectraLogParser'>, <class 'mantidimaging.core.io.instrument_log_implmentations.LegacyIMATLogFile'>]#
- projection_angles() ProjectionAngles [source]#
- classmethod register_parser(parser: type[InstrumentLogParser]) None [source]#
- class mantidimaging.core.io.instrument_log.InstrumentLogParser(lines: list[str])[source]#
Bases:
BaseParser
A base class for parsing instrument log files.
This class provides a template for parsing instrument log files. Subclasses should implement the parse method to define the specific parsing logic.
- Attributes:
None
- Methods:
parse: Parse the log file and return the parsed data.
- class mantidimaging.core.io.instrument_log.InstrumentShutterCountParser(lines: list[str])[source]#
Bases:
BaseParser
A parser for instrument shutter count logs.
This class is responsible for parsing instrument shutter count log files and returning the parsed shutter count data.
- Attributes:
None
- Methods:
parse: Parse the log file and return the shutter count data.
- exception mantidimaging.core.io.instrument_log.InvalidLog[source]#
Bases:
RuntimeError
- class mantidimaging.core.io.instrument_log.LogColumn(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
Bases:
Enum
- COUNTS_AFTER = 6#
- COUNTS_BEFORE = 5#
- IMAGE_TYPE_IMAGE_COUNTER = 2#
- PROJECTION_ANGLE = 4#
- PROJECTION_NUMBER = 3#
- SPECTRUM_COUNTS = 8#
- TIMESTAMP = 1#
- TIME_OF_FLIGHT = 7#
- exception mantidimaging.core.io.instrument_log.NoParserFound[source]#
Bases:
RuntimeError
- class mantidimaging.core.io.instrument_log.ShutterCount(lines: list[str], source_file: Path)[source]#
Bases:
object
Represents a shutter count log.
- Attributes:
parsers (ClassVar[list[type[InstrumentShutterCountParser]]]): List of registered parsers. parser (type[InstrumentShutterCountParser]): The parser used to parse the log. data (ShutterCountType): The parsed data from the log. length (int): The length of the log data.
- Methods:
__init__(self, lines: list[str], source_file: Path): Initializes a new instance of the ShutterCount class. _find_parser(self) -> None: Finds the appropriate parser for the log. parse(self) -> None: Parses the log using the selected parser. register_parser(cls, parser: type[InstrumentShutterCountParser]) -> None: Registers a parser for the log. get_column(self, key: ShutterCountColumn) -> list[float | int]: Returns the specified column from the log data. pulse_per_shutter_range_numbers(self) -> np.array: Returns an array of pulse per shutter range numbers. has_Pulse(self) -> bool: Checks if the log contains the ‘PULSE’ column. raise_if_counts_missing(self): Raises an exception if the counts are missing in the log.
- parser: type[InstrumentShutterCountParser]#
- parsers: ClassVar[list[type[InstrumentShutterCountParser]]] = [<class 'mantidimaging.core.io.instrument_log_implmentations.LegacyShutterCountLogParser'>]#
- classmethod register_parser(parser: type[InstrumentShutterCountParser]) None [source]#