pyccapt.calibration.tutorials.tutorials_helpers package

Submodules

pyccapt.calibration.tutorials.tutorials_helpers.helper_3d_reconstruction module

pyccapt.calibration.tutorials.tutorials_helpers.helper_3d_reconstruction.call_x_y_z_calculation(variables, flight_path_length, element_selected, colab=False)[source]

pyccapt.calibration.tutorials.tutorials_helpers.helper_calibration module

pyccapt.calibration.tutorials.tutorials_helpers.helper_calibration.call_voltage_bowl_calibration(variables, det_diam, flight_path_length, pulse_mode, t0=0.0)[source]

pyccapt.calibration.tutorials.tutorials_helpers.helper_data_loader module

pyccapt.calibration.tutorials.tutorials_helpers.helper_data_loader.add_columns(variables, max_mc)[source]
pyccapt.calibration.tutorials.tutorials_helpers.helper_data_loader.load_calibrated_h5(dataset_path, variables, *, range_path=None, show_progress=True)[source]

Load a PyCCAPT .h5 (or LEAP .RHIT) file for raw-data analysis.

Three file layouts are supported, dispatched by file extension:

  1. Calibrated PyCCAPT bundle (.h5, preferred) — produced by data_tools.save_data(..., save_tdc=True, save_range=True). Contains /df (calibrated dld), and optionally /tdc (raw delay-line timestamps linked via event_group_id) and /range (identified ion windows).

  2. Pure raw PyCCAPT acquisition (.h5) — the file as written by the control software: /dld and /tdc groups (no /df, no /range). The dld records are converted to the processed dataframe schema in memory, and the linked raw tdc rows are kept on variables.data_tdc.

  3. LEAP CAMECA RHIT (.rhit) — a Cameca-LEAP ROOT bundle. Decoded via pyccapt.calibration.leap_tools.cameca_raw.rhit_load() and converted to the processed dataframe schema with rhit_to_ccapt(). RHIT files have no raw delay-line tdc data (the mass/charge and detector positions are already calibrated by the instrument), so variables.data_tdc is set to None and the downstream analyses that require /tdc (DLTS-per-pulse, combinatorial recovery) are skipped automatically.

Older datasets that store the range table in a separate <dataset>_range.h5 file are also supported via range_path.

Populates variables.data, variables.data_tdc, variables.range_data, and the standard backup fields.

pyccapt.calibration.tutorials.tutorials_helpers.helper_data_loader.load_data(dataset_path, max_mc, flightPathLength, pulse_mode, tdc, variables, processing_mode=True, load_tdc_raw=False, merge_partial_tdc=None, recover_from_matched_multihit=False, multihit_match_tol_cm=0.1, detector_kind='surface_concept', show_progress=True)[source]

Load a calibration dataset and stash it on variables.

Parameters:
  • load_tdc_raw (bool, default False) – If True and tdc == 'pyccapt', also load the raw /tdc group from the h5 file. The dld and tdc dataframes are linked via a shared event_group_id column so dld filtering decisions can later be propagated to tdc at save time. Stored on variables.data_tdc.

  • merge_partial_tdc (bool or None, default None) – Whether to run partial-hit recovery after the main DLD frame is loaded. None (default) means “follow load_tdc_raw”: if the raw /tdc group is loaded for a pyccapt h5 dataset, recovery runs automatically and the recovered atoms (full xy, 3-of-4 time-sum, and 1-D partials) are appended to variables.data – so enabling “Load raw tdc” actually adds the recovered events and increases len(variables.data). Pass True/False to force it on/off. When True (and load_tdc_raw is True on a pyccapt h5 dataset), after the main DLD frame is loaded, run the partial-hit recovery pipeline: orphan TDC ticks (pulses with 1-3 channels fired) are paired axis-by-axis, gated by the detector-surface constraint, and the physically-valid candidates are merged into variables.data as additional rows. Partial rows have NaN on the axis that could not be reconstructed and a dlts column (2 for single-axis, 4 for native or recovered xy). Downstream code that needs both detector axes must filter rows with NaN in x_det (cm) or y_det (cm).

  • recover_from_matched_multihit (bool, default False) – Forwarded to partial_recovery.merge_partial_tdc_into_dld(). When True (and recovery runs), also mine MATCHED multi-hit pulses for a second ion the firmware discarded (it keeps one hit per pulse): the firmware’s stops are inverse-matched to its DLD event(s) and removed, and the residual stops are recovered. Opt-in because the inverse match is heuristic (a pulse whose firmware stops cannot be matched within multihit_match_tol_cm is skipped, so the firmware’s own hit is never double-counted).

  • multihit_match_tol_cm (float, default 0.1) – Position tolerance (cm) for inverse-matching the firmware’s stops to its DLD event in matched multi-hit recovery.

  • detector_kind (str, default 'surface_concept') – Detector-geometry key forwarded to the partial-hit recovery. Use 'roentdek' for RoentDek hardware. Ignored when merge_partial_tdc=False.

pyccapt.calibration.tutorials.tutorials_helpers.helper_data_loader.summarize_loaded_events(variables, *, print_summary=True)[source]

Report complete vs partial event counts for the loaded dataset.

Combines two views of the just-loaded data:

  • DLD side (variables.data): how many reconstructed events the file contains. When partial-hit recovery has run (the dlts column is present) the count is split into complete (native + recovered xy) and partial (single-axis recovered) hits.

  • Raw TDC side (variables.data_tdc, present only when the dataset was loaded with raw tdc): how many pulses fired the full delay-line channel set (complete) versus only part of it (partial), via partial_hit_diagnostics.tdc_pulse_completeness().

Returns the counts as a dict and, by default, prints a short summary.

pyccapt.calibration.tutorials.tutorials_helpers.helper_ion_list module

pyccapt.calibration.tutorials.tutorials_helpers.helper_ion_list.call_ion_list(variables, selector, mode, path='../../../files/')[source]
pyccapt.calibration.tutorials.tutorials_helpers.helper_ion_list.reset_back_on_click(variables, mode)[source]

pyccapt.calibration.tutorials.tutorials_helpers.helper_ion_selection module

pyccapt.calibration.tutorials.tutorials_helpers.helper_ion_selection.call_ion_selection(variables, colab=False, show_gaussian_controls=False)[source]

pyccapt.calibration.tutorials.tutorials_helpers.helper_mc_plot module

pyccapt.calibration.tutorials.tutorials_helpers.helper_mc_plot.call_mc_plot(variables, selector)[source]

pyccapt.calibration.tutorials.tutorials_helpers.helper_special_crop module

pyccapt.calibration.tutorials.tutorials_helpers.helper_special_crop.apply_crop(variables, out, use_manual_values, center_x_widget, center_y_widget, radius_widget)[source]
pyccapt.calibration.tutorials.tutorials_helpers.helper_special_crop.call_plot_crop_fdm(variables)[source]
pyccapt.calibration.tutorials.tutorials_helpers.helper_special_crop.reset(variables, out)[source]

pyccapt.calibration.tutorials.tutorials_helpers.helper_t_0_tune module

pyccapt.calibration.tutorials.tutorials_helpers.helper_t_0_tune.call_fine_tune_t_0(variables, flightPathLength, pulse_mode, t0)[source]

pyccapt.calibration.tutorials.tutorials_helpers.helper_temporal_crop module

pyccapt.calibration.tutorials.tutorials_helpers.helper_temporal_crop.apply_crop(variables, out, use_manual_values, start_widget, end_widget)[source]
pyccapt.calibration.tutorials.tutorials_helpers.helper_temporal_crop.call_plot_crop_experiment(variables, pulse_mode)[source]
pyccapt.calibration.tutorials.tutorials_helpers.helper_temporal_crop.reset(variables, out)[source]

pyccapt.calibration.tutorials.tutorials_helpers.helper_visualization module

pyccapt.calibration.tutorials.tutorials_helpers.helper_visualization.call_visualization(variables, colab=False)[source]

Module contents

Shared helper functions used by calibration tutorial notebooks.