pwassist.io.catalog.Catalog#

class pwassist.io.catalog.Catalog(input_dir, sig_kinematic_digits=3, ignore_files=None, ignore_bins=None)[source]#

Bases: object

A catalog of PWA result files in a directory structure.

What type of file the CSV is (fit, covariance, etc.) will primarily be determined by its content and structure. See ResultsFile for details.

Parameters:
  • input_dir (Path | str)

  • sig_kinematic_digits (int)

  • ignore_files (str | list[str] | None)

  • ignore_bins (Sequence[tuple[str, float, float]] | None)

input_dir#

The directory to scan for PWA results.

Type:

pathlib.Path

OPTIONAL_FILE_TYPES = [<class 'pwassist.io.catalog.CorrelationFile'>, <class 'pwassist.io.catalog.CovarianceFile'>, <class 'pwassist.io.catalog.NormIntFile'>, <class 'pwassist.io.catalog.RandomizedFile'>, <class 'pwassist.io.catalog.BootstrapFile'>]#
REQUIRED_FILE_TYPES = [<class 'pwassist.io.catalog.FitFile'>, <class 'pwassist.io.catalog.DataFile'>]#
RESULT_FILE_TYPES = [<class 'pwassist.io.catalog.FitFile'>, <class 'pwassist.io.catalog.DataFile'>, <class 'pwassist.io.catalog.CorrelationFile'>, <class 'pwassist.io.catalog.CovarianceFile'>, <class 'pwassist.io.catalog.NormIntFile'>, <class 'pwassist.io.catalog.RandomizedFile'>, <class 'pwassist.io.catalog.BootstrapFile'>]#
__init__(input_dir, sig_kinematic_digits=3, ignore_files=None, ignore_bins=None)[source]#
Parameters:
  • input_dir (Path | str) – The top level directory to scan for PWA results. All CSV files in this directory and its subdirectories will be scanned and cataloged.

  • sig_kinematic_digits (int) – The number of significant digits to use when rounding kinematic bin values (mass, t, energy) for bin identification. Defaults to 3.

  • ignore_files (str | list[str] | None) – If provided, any CSV file whose name matches this string will be ignored during the scan.

  • ignore_bins (Sequence[tuple[str, float, float]] | None) – Kinematic bins to skip entirely, each given as (dimension, low, high) with dimension one of ‘mass’, ‘t’, or ‘energy’. Every bin whose range in that dimension matches is ignored, along with all of its files, e.g. (“t”, 0.075, 0.100) drops that t-bin for all energies and masses.

identify_file_type(path)[source]#

Identify file type by using class’ identify method.

Return type:

type[ResultsFile]

Parameters:

path (Path)

property manifest: DataFrame#

The manifest DataFrame produced by scan().

Returns:

A DataFrame with columns ‘bin_id’, ‘file_path’, and

’file_type’ describing the catalog of PWA result files.

Return type:

pd.DataFrame

scan()[source]#

Scan the input directory for CSV files and catalog them.

We assume that:
  1. There is a data CSV file in each kinematic bin directory that contains

    the binning information (t, beam energy, mass).

  2. All csv’s in the same directory, or subdirectories, of the data csv

    belong to the same kinematic bin.

Returns:

A DataFrame with columns ‘mass’, ‘t’, ‘energy’,

’file_path’, and ‘file_type’ describing the catalog of PWA result files.

Return type:

DataFrame

Raises:
  • ValueError – If a CSV file is found that cannot be identified as a known result file type.

  • FileNotFoundError – If a kinematic bin is missing the required file types (FitFile and DataFile).