flitsr.input.tcm_input.TCM

class flitsr.input.tcm_input.TCM

Bases: Input

__init__()

Methods

__init__()

check_format(input_path)

Check whether the files from the specified input_path are of the concrete types format.

construct_details(f, method_level, sb)

Fills the spectrum object with elements read in from the open file 'f'.

construct_tests(f, sb)

fill_spectrum(f, sb)

get_elem_separators()

Method to get the separators used for printing out elements when writing a spectrum in the format of this input type.

get_reader(input_path)

Static helper method that guesses the input type of the given input path out of all available input types.

get_run_file_name(input_path)

Return the name of the run file that this input type determines for the given input string.

get_type()

Return the InputType enum of this input type.

read_in(input_path, split_faults[, method_level])

Static helper method that guesses the input type of the given input path out of all available input types, and reads in the spectrum using that input type.

read_spectrum(input_path, split_faults[, ...])

Read in the spectrum from the given input file using this input type.

write_spectrum(spectrum, output_path)

Output the spectrum in TCM format

static check_format(input_path: str) bool

Check whether the files from the specified input_path are of the concrete types format. The implementation of this abstract method must return a boolean, where True indicates that the input is in the format recognized by the implementing class, and False otherwise

Parameters:

input_path – str: The input path to check for format.

Returns:

True if the input path refers to input in the format that this input type can read, or False otherwise.

construct_details(f: TextIOWrapper, method_level: bool, sb: SpectrumBuilder)

Fills the spectrum object with elements read in from the open file ‘f’.

construct_tests(f: TextIOWrapper, sb: SpectrumBuilder)
fill_spectrum(f: TextIOWrapper, sb: SpectrumBuilder)
classmethod get_elem_separators()

Method to get the separators used for printing out elements when writing a spectrum in the format of this input type. NOTE: this method does not need to be implemented by an input type unless it is used in the implemented write_spectrum method.

get_run_file_name(input_path: str)

Return the name of the run file that this input type determines for the given input string.

Parameters:

input_path – str: The name of the input file.

Returns:

The name of the run file.

read_spectrum(input_path: str, split_faults: bool, method_level=False) Spectrum

Read in the spectrum from the given input file using this input type.

Parameters:
  • input_path – str: The path string of the input spectrum.

  • split_faults – bool: Whether to split faults using FLITSR’s split_faults functionality.

  • method_level – (Default value = False) Whether to read this spectrum in as a method level spectrum.

Returns:

The spectrum that was read in.

classmethod write_spectrum(spectrum: Spectrum, output_path: str)

Output the spectrum in TCM format