API Documentation
- panama.add_weight(df_run, df_event, df, model=<panama.fluxes.fluxes.FastHillasGaisser2012 object>)
Adds the collumn “weight” too df_particle to reweight for given primary flux.
- Parameters:
df_run (The run dataframe (as returned by read_corsika_particle_files_to_dataframe)) –
df_event (The event dataframe (as returned by read_corsika_particle_files_to_dataframe)) –
df (The particle dataframe (as returned by read_corsika_particle_files_to_dataframe)) –
model (The Cosmic Ray primary flux model (instance of CRFlux)) –
- panama.add_weight_prompt(df, prompt_factor)
Adds collumn “weight_prompt” to df, to set a weight for every prompt particle, non prompt particles get weight 1
- panama.add_weight_prompt_per_event(df, prompt_factor)
Adds collumn “weight_prompt_per_event” to df, which will be prompt_factor for every particle, which is inside a shower, which has at least one prompt muon. For every other particle, it will be 1.
- panama.read_DAT(files: Path | [Path] | None = None, glob: str | None = None, max_events: int | None = None, run_header_features: tuple | None = None, event_header_features: tuple | None = None, additional_columns: bool = True, mother_columns: bool = False, drop_mothers: bool = True, drop_non_particles: bool = True, noparse: bool = True) Tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame]
Read CORSIKA DAT files to Pandas.DataFrame. Exactly one of files or glob must be provided. Made for CORSIKA>7.4, other compatibility not garantueed, but probably approximate.
- Parameters:
files (Path or List of Paths) – Single or list of DAT files to read into the dataframe. They must all have unique run_numbers and event_numbers. If None glob must be provided
glob – Globbing expression like path/to/corsika/output/DAT*. If None, files must be provided.
max_events (int | None) – Maximum number of events to read in. If None, read in everything.
run_header_features (tuple or None) – Names of the run header to actually save, corresponding to the naming of pycorsikaio. If None uses a default list. (default: None)
event_header_features (tuple or None) – Names of the event header to actually save, corresponding to the naming of pycorsikaio. If None uses a default list. (default: None)
additional_columns (bool) –
Weather to add (and calculate) additional columns not present in standard corsika output, to make life easier. They take minimal time to calculate. These include:
corsikaid
hadron_gen
n_obs_level
is_mother
pdgid
mass
energy
zenith
mother_columns (bool) – Weather to add columns related to the mother/grandmother output of the EHIST option. They take more time to calculate, since the columns are dependend of each other.
drop_mothers (bool) – Weather to remove all mother rows (default: True)
drop_non_particles (bool) – Weather to remove all rows not representing a real particle (like muon additional information) (default: True)
noparse – Use the “noparse” feature of pycorsikaio, which theoretically makes reading in the corsika files faster
- Returns:
- run_header: pandas.DataFrame
DataFrame with the information about each run
- event_header: pandas.DataFrame
DataFrame with the information about each event
- particles: pandas.DataFrame
DataFrame with the information about each particle
- Return type:
A tuple (run_header, event_header, particles)
Fluxes
- class panama.fluxes.FastHillasGaisser2012(model='H4a')
Gaisser, T.K., Astroparticle Physics 35, 801 (2012).
Fast version of HillasGaisser2012,if numpy is used.
- Parameters:
model (str) – can be either H3a or H4a.
- nucleus_flux(corsika_id, E)
Returns the flux of nuclei corresponding to the
corsika_idat energyE.- Parameters:
corsika_id (int) – see
crfluxfor description.E (float) – laboratory energy of nucleus in GeV
- Returns:
flux of single nucleus type \(\Phi_{nucleus}\) in \((\text{m}^2 \text{s sr GeV})^{-1}\)
- Return type:
(float)
- class panama.fluxes.FastPrimaryFlux
Fast version of PrimaryFlux, which uses numpy where applicable.
- p_and_n_flux(E)
Returns tuple with proton fraction, proton flux and neutron flux.
The proton fraction is defined as \(\frac{\Phi_p}{\Phi_p + \Phi_n}\).
- Parameters:
E (float) – laboratory energy of nucleons in GeV
- Returns:
proton fraction, proton flux, neutron flux
- Return type:
(float,float,float)
- class panama.fluxes.FastThunman(*args, **kwargs)
Popular broken power-law flux model. The parameters of this model are taken from the prompt flux calculation paper by M. Thunman, G. Ingelman, and P. Gondolo, Astroparticle Physics 5, 309 (1996). The model contians only protons with a power-law index of -2.7 below the knee, located at 5 PeV, and -3.0 for energies higher than that.
- nucleus_flux(corsika_id, E)
Broken power law spectrum for protons.
- class panama.fluxes.FastThunmanCO(cutoff=1000000000.0, *args, **kwargs)
Popular broken power-law flux model. The parameters of this model are taken from the prompt flux calculation paper by M. Thunman, G. Ingelman, and P. Gondolo, Astroparticle Physics 5, 309 (1996). The model contians only protons with a power-law index of -2.7 below the knee, located at 5 PeV, and -3.0 for energies higher than that.
- nucleus_flux(corsika_id, E)
Broken power law spectrum for protons.