pyccapt.calibration.tutorials.tutorials_helpers package
Submodules
pyccapt.calibration.tutorials.tutorials_helpers.helper_3d_reconstruction module
pyccapt.calibration.tutorials.tutorials_helpers.helper_calibration module
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:
Calibrated PyCCAPT bundle (
.h5, preferred) — produced bydata_tools.save_data(..., save_tdc=True, save_range=True). Contains/df(calibrated dld), and optionally/tdc(raw delay-line timestamps linked viaevent_group_id) and/range(identified ion windows).Pure raw PyCCAPT acquisition (
.h5) — the file as written by the control software:/dldand/tdcgroups (no/df, no/range). The dld records are converted to the processed dataframe schema in memory, and the linked raw tdc rows are kept onvariables.data_tdc.LEAP CAMECA RHIT (
.rhit) — a Cameca-LEAP ROOT bundle. Decoded viapyccapt.calibration.leap_tools.cameca_raw.rhit_load()and converted to the processed dataframe schema withrhit_to_ccapt(). RHIT files have no raw delay-line tdc data (the mass/charge and detector positions are already calibrated by the instrument), sovariables.data_tdcis set toNoneand 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.h5file are also supported viarange_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/tdcgroup from the h5 file. The dld and tdc dataframes are linked via a sharedevent_group_idcolumn so dld filtering decisions can later be propagated to tdc at save time. Stored onvariables.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 “followload_tdc_raw”: if the raw/tdcgroup 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 tovariables.data– so enabling “Load raw tdc” actually adds the recovered events and increaseslen(variables.data). PassTrue/Falseto force it on/off. When True (andload_tdc_rawis 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 intovariables.dataas additional rows. Partial rows haveNaNon the axis that could not be reconstructed and adltscolumn (2for single-axis,4for native or recovered xy). Downstream code that needs both detector axes must filter rows with NaN inx_det (cm)ory_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 withinmultihit_match_tol_cmis 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 whenmerge_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 (thedltscolumn 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), viapartial_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_selection module
pyccapt.calibration.tutorials.tutorials_helpers.helper_mc_plot module
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_t_0_tune module
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_visualization module
Module contents
Shared helper functions used by calibration tutorial notebooks.