alpaca.sectors

Classes

class alpaca.sectors.Sector(name: str, tex: str, observables: set | None = None, obs_measurements: dict[str, set[str]] | None = None, description: str = '', color: str | None = None, lw: float | None = None, ls: str | None = None)

A class representing a sector of observables.

Attributes

namestr

The name of the sector.

observablesset

A set of observables associated with the sector. All measurements of these observables are included in the sector.

obs_measurementsdict

A dictionary of specific measurements for each observable in the sector.

texstr

The LaTeX representation of the sector name.

descriptionstr, optional

A description of the sector (default is an empty string).

colorstr, optional

A color associated with the sector, used for plotting (default is None).

contains_observable(observable: str) bool

Check if the sector contains a specific observable.

Parameters

observablestr

The observable to check for.

Returns

bool

True if the sector contains the observable, False otherwise.

exclude_measurements(measurements: tuple[str, str] | list[tuple[str, str]]) Sector

Remove specific measurements from the sector.

Parameters

measurementstuple[str, str] | list[tuple[str, str]]

The measurements to remove, specified as tuples of (observable, measurement).

Returns

Sector

A new Sector instance with the specified measurements removed.

exclude_observables(observables: str | list[str]) Sector

Remove an observable from the sector.

Parameters

observablestr

The observable to remove.

classmethod load(filename: str)

Load a sector from a YAML file.

Parameters

filenamestr

The name of the file to load the sector from.

Returns

Sector

An instance of the Sector class.

save(filename: str)

Save the sector to a YAML file.

Parameters

filenamestr

The name of the file to save the sector to.

Functions

alpaca.sectors.combine_sectors(sectors: list[Sector], name: str, tex: str, description: str = '') Sector

Combine multiple sectors into a single sector.

Parameters

sectorslist[Sector]

A list of Sector instances to combine.

namestr

The name of the combined sector.

texstr

The LaTeX representation of the combined sector name.

descriptionstr, optional

A description of the combined sector (default is an empty string).

Returns

Sector

An instance of the Sector class representing the combined sector.

alpaca.sectors.initialize_sectors(sector_dir: str | None = None) dict[str, Sector]

Initialize sectors from YAML files in a directory.

Parameters

sector_dirstr

The directory containing the YAML files for the sectors.

Returns

dict[str, Sector]

A dictionary mapping sector names to Sector instances.

Objects

alpaca.sectors.default_sectors

Dictionary of the pre-defined sectors in ALPaca.