Module flarefly.components.pdf_kind

Module defining PDF kinds

Classes

class PDFKind (kind: PDFType | str,
order: int | None = None)
Expand source code
@dataclass
class PDFKind:
    """Class representing the kind of PDF"""
    kind: Union[PDFType, str]
    order: Union[int, None] = None

    def __post_init__(self):
        # Allow to use string representation for kind
        if isinstance(self.kind, str):
            self.kind = PDFType(self.kind)

    def __eq__(self, other):
        if isinstance(other, PDFKind):
            return self.kind is other.kind
        if isinstance(other, PDFType):
            return self.kind is other
        return NotImplemented

    def __hash__(self):
        return hash(self.kind)

    def __getattr__(self, name):
        """Delegate unknown attributes/methods to PDFType Enum"""
        return getattr(self.kind, name)

Class representing the kind of PDF

Instance variables

var kindPDFType | str
var order : int | None
class PDFType (*args, **kwds)
Expand source code
class PDFType(Enum):
    """Enumeration of supported PDF types"""

    # Signal PDFs
    NO_SIGNAL = "nosignal"
    GAUSSIAN = "gaussian"
    DOUBLE_GAUS = "doublegaus"
    GAUS_EXP_TAIL = "gausexptail"
    GENER_GAUS_EXP_TAIL = "genergausexptail"
    GENER_GAUS_EXP_TAIL_SYMM = "genergausexptailsymm"
    BIFUR_GAUS = "bifurgaus"
    CRYSTAL_BALL = "crystalball"
    DOUBLE_CB = "doublecb"
    DOUBLE_CB_SYMM = "doublecbsymm"
    GENER_CRYSTAL_BALL = "genercrystalball"
    CAUCHY = "cauchy"
    VOIGTIAN = "voigtian"
    KDE_EXACT = "kde_exact"
    KDE_GRID = "kde_grid"
    KDE_FFT = "kde_fft"
    KDE_ISJ = "kde_isj"
    HIST = "hist"

    # Background PDFs
    NO_BKG = "nobkg"
    CHEBPOL = "chebpol"
    EXPO = "expo"
    POW_LAW = "powlaw"
    EXPO_POW = "expopow"
    EXPO_POW_EXT = "expopowext"

    # Reflection PDFs
    NONE = "none"

    def is_kde(self) -> bool:
        """Check if PDF type is KDE"""
        return self.value.startswith("kde_")

    def is_hist(self) -> bool:
        """Check if PDF type is histogram"""
        return self.value == "hist"

    def has_sigma(self) -> bool:
        """Check if PDF type has sigma parameter"""
        return self.value in [
            "gaussian",
            "gausexptail",
            "genergausexptailsymm",
            "crystalball",
            "doublecb",
            "doublecbsymm",
            "voigtian",
            "hist",
        ]

    def has_hwhm(self) -> bool:
        """Check if PDF type has HWHM"""
        return self.value in ["gaussian", "cauchy", "voigtian"]

    def uses_m_not_mu(self) -> bool:
        """Check if PDF uses 'm' instead of 'mu' for mass parameter"""
        return self.value in ["cauchy", "voigtian"]

    def mass_limits(self) -> bool:
        """Check if PDF has mass limits"""
        return self.value in ["powlaw", "expopow", "expopowext"]

Enumeration of supported PDF types

Ancestors

  • enum.Enum

Class variables

var BIFUR_GAUS
var CAUCHY
var CHEBPOL
var CRYSTAL_BALL
var DOUBLE_CB
var DOUBLE_CB_SYMM
var DOUBLE_GAUS
var EXPO
var EXPO_POW
var EXPO_POW_EXT
var GAUSSIAN
var GAUS_EXP_TAIL
var GENER_CRYSTAL_BALL
var GENER_GAUS_EXP_TAIL
var GENER_GAUS_EXP_TAIL_SYMM
var HIST
var KDE_EXACT
var KDE_FFT
var KDE_GRID
var KDE_ISJ
var NONE
var NO_BKG
var NO_SIGNAL
var POW_LAW
var VOIGTIAN

Methods

def has_hwhm(self) ‑> bool
Expand source code
def has_hwhm(self) -> bool:
    """Check if PDF type has HWHM"""
    return self.value in ["gaussian", "cauchy", "voigtian"]

Check if PDF type has HWHM

def has_sigma(self) ‑> bool
Expand source code
def has_sigma(self) -> bool:
    """Check if PDF type has sigma parameter"""
    return self.value in [
        "gaussian",
        "gausexptail",
        "genergausexptailsymm",
        "crystalball",
        "doublecb",
        "doublecbsymm",
        "voigtian",
        "hist",
    ]

Check if PDF type has sigma parameter

def is_hist(self) ‑> bool
Expand source code
def is_hist(self) -> bool:
    """Check if PDF type is histogram"""
    return self.value == "hist"

Check if PDF type is histogram

def is_kde(self) ‑> bool
Expand source code
def is_kde(self) -> bool:
    """Check if PDF type is KDE"""
    return self.value.startswith("kde_")

Check if PDF type is KDE

def mass_limits(self) ‑> bool
Expand source code
def mass_limits(self) -> bool:
    """Check if PDF has mass limits"""
    return self.value in ["powlaw", "expopow", "expopowext"]

Check if PDF has mass limits

def uses_m_not_mu(self) ‑> bool
Expand source code
def uses_m_not_mu(self) -> bool:
    """Check if PDF uses 'm' instead of 'mu' for mass parameter"""
    return self.value in ["cauchy", "voigtian"]

Check if PDF uses 'm' instead of 'mu' for mass parameter

class SignalBkgOrRefl (*args, **kwds)
Expand source code
class SignalBkgOrRefl(Enum):
    """Enumeration of type of component"""
    SIGNAL = "signal"
    BACKGROUND = "background"
    REFLECTION = "reflection"

Enumeration of type of component

Ancestors

  • enum.Enum

Class variables

var BACKGROUND
var REFLECTION
var SIGNAL