mantidimaging.core.utility.imat_log_file_parser module#

class mantidimaging.core.utility.imat_log_file_parser.CSVLogParser(data: list[str])[source]#

Bases: object

EXPECTED_HEADER_FOR_IMAT_CSV_LOG_FILE = 'TIME STAMP,IMAGE TYPE,IMAGE COUNTER,COUNTS BM3 before image,COUNTS BM3 after image\n'#
parse() dict[IMATLogColumn, list][source]#
static try_insert_header(file_contents: list[str]) list[str][source]#

Attempt to normalise data where no header is present by inserting one.

@param file_contents: The file contents to be reformatted @return: The reformatted file contents

static try_remove_invalid_lines(file_contents: list[str]) list[str][source]#

Attempt to normalise data where invalid lines are the incorrect number of columns are present.

@param file_contents: The file contents to be reformatted @return: The reformatted file contents

class mantidimaging.core.utility.imat_log_file_parser.IMATLogColumn(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#
TIMESTAMP = 1#
class mantidimaging.core.utility.imat_log_file_parser.IMATLogFile(data: list[str], source_file: Path)[source]#

Bases: object

counts() Counts[source]#
static find_parser(data: list[str])[source]#

Try and determine the format of the log file by checking the first row. for the type of seperator used and then attempting to normalise the data if needed before selecting the appropriate parser.

static get_seperator(first_row: str) bool[source]#

Try and determine the seperator used in the log file. If neither a tab or comma is found, then return a RuntimeError as the format is not recognised.

@param data: The file contents to be checked @return: The seperator used in the file Exception: RuntimeError if the format is not recognised

projection_angles() ProjectionAngles[source]#
projection_numbers() ndarray[source]#
raise_if_angle_missing(image_filenames: list[str] | None) None[source]#
property source_file: Path#
class mantidimaging.core.utility.imat_log_file_parser.TextLogParser(data: list[str])[source]#

Bases: object

EXPECTED_HEADER_FOR_IMAT_TEXT_LOG_FILE = ' TIME STAMP  IMAGE TYPE   IMAGE COUNTER   COUNTS BM3 before image   COUNTS BM3 after image\n'#
parse() dict[IMATLogColumn, list][source]#
static try_insert_header(file_contents: list[str]) list[str][source]#

Attempt to normalise data where no header is present by inserting one.

@param file_contents: The file contents to be reformatted @return: The reformatted file contents

static try_remove_invalid_lines(file_contents: list[str]) list[str][source]#

Attempt to normalise data where invalid lines are the incorrect number of columns are present.

@param file_contents: The file contents to be reformatted @return: The reformatted file contents