opatio.convert.opal module

opatio.convert.opal.OPALI_2_OPAT(inPath: str, outPath: str, saveAsASCII: bool = False) None[source]

Convert OPAL type I files to OPAT format.

Parameters:
  • inPath (str) – Path to the input OPAL type I file.

  • outPath (str) – Path to save the converted OPAT file.

  • saveAsASCII (bool, optional) – If True, also save the OPAT file as an ASCII file (default is False).

Return type:

None

Examples

>>> OPALI_2_OPAT("path/to/opal_file.txt", "path/to/output.opat")
>>> OPALI_2_OPAT("path/to/opal_file.txt", "path/to/output.opat", saveAsASCII=True)
opatio.convert.opal.get_OPAL_I_log_R() ndarray[source]

Generate the target log(R) values for OPAL type I files.

Returns:

Array of log(R) values ranging from -8.0 to 1.0 with a step of 0.5.

Return type:

np.ndarray

Examples

>>> logR = get_OPAL_I_log_R()
>>> print(logR)
[-8.  -7.5 -7.  ...  0.5  1. ]
opatio.convert.opal.get_OPAL_I_log_T() ndarray[source]

Generate the target log(T) values for OPAL type I files.

The spacing is non-uniform and is divided into three sections: - Section A: 3.75 to 6.0 with a step of 0.05 - Section B: 6.0 to 8.1 with a step of 0.1 - Section C: 8.1 to 8.8 with a step of 0.2

Returns:

Array of log(T) values.

Return type:

np.ndarray

Examples

>>> logT = get_OPAL_I_log_T()
>>> print(logT[:5])
[3.75 3.8  3.85 3.9  3.95]
opatio.convert.opal.load_opat1_as_opat(path: str) OPAT[source]
opatio.convert.opal.parse_OPAL_I(path: str) ndarray[source]

Parse OPAL type I data from a file.

Parameters:

path (str) – Path to the OPAL I file.

Returns:

A tuple containing: - logR (np.ndarray): Array of log(R) values. - logT (np.ndarray): Array of log(T) values. - p (np.ndarray): Parsed intensity data.

Return type:

tuple

Raises:

ValueError – If the file does not contain the expected table structure.

Examples

>>> logR, logT, p = parse_OPAL_I("path/to/opal_file.txt")
>>> print(logR.shape, logT.shape, p.shape)
(19,) (81,) (n_tables, 81, 19)