Flux Model
The flux model supplies the physical spectrum that the simweights processor reweights simulated events onto. It is selected by name under
the processor’s flux option.
Usage
flux:
name: gaisser-h4a
kwargs: {}
Variants
Gaisser H4a: the Gaisser H4a cosmic-ray flux model.
Power Law: a configurable power-law flux.
Registering a new flux model
A flux model is a subclass of FluxModel that declares a name and
version and implements the abstract methods below. Register it with
FluxModelFactory.
build(self) -> NoneOne-time setup.
__call__(self, *args, **kwargs) -> ArrayLikeEvaluate the flux; called by
simweightsduring weight computation.
from typing import Any, ClassVar
from numpy.typing import ArrayLike
from icegraph.data.processor.variants.simweights.model import FluxModel, FluxModelFactory
from .config import MyFluxConfig
class MyFlux(FluxModel[MyFluxConfig]):
name: ClassVar[str] = "my-flux"
version: ClassVar[int] = 1
@classmethod
def validate_config(cls, config: dict[str, Any]) -> MyFluxConfig:
return MyFluxConfig(**config)
def build(self) -> None:
...
def __call__(self, *args: ArrayLike, **kwargs: ArrayLike) -> ArrayLike:
...
FluxModelFactory.register(MyFlux)