pyccapt.calibration.leap_tools package

Submodules

pyccapt.calibration.leap_tools.ccapt_tools module

pyccapt.calibration.leap_tools.ccapt_tools.apt_to_ccapt(file_path)[source]

Convert APT data to PyCCAPT format.

Parameters:

file_path – APT data file path.

Returns:

CCAPT data.

Return type:

pandas.DataFrame

pyccapt.calibration.leap_tools.ccapt_tools.ccapt_to_epos(data, path=None, name=None, chunk_size=1000000)[source]

Convert CCAPT data to EPOS format, processing in chunks to avoid memory errors.

Parameters:
  • data (pandas.DataFrame) – CCAPT data.

  • path (str) – Optional. Path to save the EPOS file.

  • name (str) – Optional. Name of the EPOS file.

  • chunk_size (int) – Number of rows to process in each chunk.

Returns:

Writes EPOS data to file if path and name are provided.

Return type:

None

pyccapt.calibration.leap_tools.ccapt_tools.ccapt_to_pos(data, path=None, name=None)[source]

Convert CCAPT data to POS format.

Parameters:
  • data (pandas.DataFrame) – CCAPT data.

  • path (str) – Optional. Path to save the POS file.

  • name (str) – Optional. Name of the POS file.

Returns:

POS data.

Return type:

bytes

pyccapt.calibration.leap_tools.ccapt_tools.epos_to_ccapt(file_path)[source]

Convert EPOS data to PyCCAPT format.

Parameters:

file_path – EPOS data file path.

Returns:

CCAPT data.

Return type:

pandas.DataFrame

pyccapt.calibration.leap_tools.ccapt_tools.pos_to_ccapt(file_path)[source]

Convert POS data to CCAPT format.

Parameters:

file_path – POS data file_path.

Returns:

CCAPT data.

Return type:

pandas.DataFrame

pyccapt.calibration.leap_tools.leap_tools module

class pyccapt.calibration.leap_tools.leap_tools.ByteFormat(*values)[source]

Bases: Enum

CHAR = 1
INT_32 = 4
INT_64 = 8
TIME_STAMP = 8
WIDE_CHAR = 2
class pyccapt.calibration.leap_tools.leap_tools.DataCategory(*values)[source]

Bases: Enum

CONSTANT = 1
INDEXED_VARIABLE = 3
UNSPECIFIED = 0
VARIABLE = 2
class pyccapt.calibration.leap_tools.leap_tools.DataFormat(*values)[source]

Bases: Enum

CUSTOM = 5
DECIMAL = 3
INTEGER = 1
TEXT = 4
UNSIGNED_INT = 2
UNSPECIFIED = 0
class pyccapt.calibration.leap_tools.leap_tools.RelationKind(*values)[source]

Bases: Enum

INDEPENDENT = 3
INDEXED = (2,)
MULTIPLE = 4
SINGLE = 1
UNSPECIFIED = 0
pyccapt.calibration.leap_tools.leap_tools.deconvolve(lpos)[source]

Takes a composition-labelled pos file and deconvolves the complex ions. Produces a DataFrame of the same input format with the extra columns: ‘element’: element name ‘n’: stoichiometry For complex ions, the location of the different components is not altered - i.e. xyz position will be the same for several elements.

Parameters: - lpos (DataFrame): A composition-labelled pos file DataFrame.

Returns: - out (DataFrame): A deconvolved DataFrame with additional ‘element’ and ‘n’ columns.

pyccapt.calibration.leap_tools.leap_tools.label_ions(pos, rrngs)[source]

Labels ions in a .pos or .epos DataFrame (anything with a ‘Da’ column) with composition and color, based on an imported .rrng file.

Parameters: - pos (DataFrame): A DataFrame containing ion positions, with a ‘Da’ column. - rrngs (DataFrame): A DataFrame containing range data imported from a .rrng file.

Returns: - pos (DataFrame): The modified DataFrame with added ‘comp’ and ‘colour’ columns.

pyccapt.calibration.leap_tools.leap_tools.parse_rng(file_path)[source]

Load a legacy IVAS/LEAP .rng file and return raw ion and range tables.

Returns:

(ions, ranges) in a normalized raw schema.

Return type:

tuple[pd.DataFrame, pd.DataFrame]

pyccapt.calibration.leap_tools.leap_tools.parse_rrng(file_path)[source]

Load a .rrng file produced by IVAS and return the raw ion and range tables.

Returns:

(ions, rrngs) in the IVAS schema.

Return type:

tuple[pd.DataFrame, pd.DataFrame]

pyccapt.calibration.leap_tools.leap_tools.read_apt(file_path: str, debug: bool = False) DataFrame[source]

Load data from an APT file into a pandas DataFrame.

Parameters:
  • file_path (str) – The path to the APT file.

  • debug (bool) – If True, print detailed information during loading.

Returns:

A DataFrame containing the loaded data.

Return type:

pd.DataFrame

pyccapt.calibration.leap_tools.leap_tools.read_epos(file_path)[source]

Loads an APT .epos file as a pandas DataFrame.

Columns:

x: Reconstructed x position y: Reconstructed y position z: Reconstructed z position Da: Mass/charge ratio of ion ns: Ion Time Of Flight DC_kV: Potential pulse_kV: Size of voltage pulse (voltage pulsing mode only) det_x: Detector x position det_y: Detector y position pslep: Pulses since last event pulse (i.e. ionisation rate) ipp: Ions per pulse (multihits)

pyccapt.calibration.leap_tools.leap_tools.read_pos(file_path)[source]

Loads an APT .pos file as a pandas DataFrame.

Columns:

x: Reconstructed x position y: Reconstructed y position z: Reconstructed z position Da: Mass/charge ratio of ion

pyccapt.calibration.leap_tools.leap_tools.read_rng(file_path, return_tables: bool = False)[source]

Load a legacy .rng file produced by older IVAS/LEAP workflows.

Parameters: - file_path (str): The path to the .rng file. - return_tables (bool): When True, return the raw (ions, ranges)

tables. Otherwise return the normalized PyCCAPT range dataframe.

pyccapt.calibration.leap_tools.leap_tools.read_rrng(file_path, return_tables: bool = False)[source]

Load a .rrng file produced by IVAS.

Parameters: - file_path (str): The path to the .rrng file. - return_tables (bool): When True, return the raw (ions, rrngs)

IVAS tables. Otherwise return the normalized PyCCAPT range dataframe.

pyccapt.calibration.leap_tools.leap_tools.volvis(pos, size=2, alpha=1)[source]

Displays a 3D point cloud in an OpenGL viewer window. If points are not labelled with colors, point brightness is determined by Da values (higher = whiter).

Parameters: - pos (DataFrame): A DataFrame containing 3D point cloud data. - size (int): The size of the markers representing the points. Default is 2. - alpha (float): The transparency of the markers. Default is 1.

Returns: - None

pyccapt.calibration.leap_tools.leap_tools.write_rrng(file_path, ions, rrngs)[source]

Write ion and range DataFrames to an IVAS-style .rrng file.

Parameters: - file_path (str): Destination path for the .rrng file. - ions (DataFrame): Ion table with at least the name column. - rrngs (DataFrame): Range table with lower, upper, vol, comp, and color columns.

Returns: - None

Module contents

LEAP format readers, converters, and visualization helpers.