HErmes.icecube_goodies package

Submodules

HErmes.icecube_goodies.conversions module

Unit conversions and such

HErmes.icecube_goodies.conversions.ConvertPrimaryFromPDG(pid)[source]

Convert a primary id in an i3 file to the new values given by the pdg

HErmes.icecube_goodies.conversions.ConvertPrimaryToPDG(pid)[source]

Convert a primary id in an i3 file to the new values given by the pdg

HErmes.icecube_goodies.conversions.IsPDGEncoded(pid, neutrino=False)[source]

Check if the particle has already a pdg compatible pid

Parameters:id (int) – Partilce Id
Keyword Arguments:
 neutrino (bool) – as nue is H in PDG, set true if you know already that ihe particle might be a neutrino

Returns (bool): True if PDG compatible

class HErmes.icecube_goodies.conversions.PDGCode[source]

Bases: object

Namespace for PDG conform particle type codes

Al26Nucleus = 1000130260
Al27Nucleus = 1000130270
Ar36Nucleus = 1000180360
Ar37Nucleus = 1000180370
Ar38Nucleus = 1000180380
Ar39Nucleus = 1000180390
Ar40Nucleus = 1000180400
Ar41Nucleus = 1000180410
Ar42Nucleus = 1000180420
B10Nucleus = 1000050100
B11Nucleus = 1000050110
Be9Nucleus = 1000040090
C12Nucleus = 1000060120
C13Nucleus = 1000060130
Ca40Nucleus = 1000200400
Ca41Nucleus = 1000200410
Ca42Nucleus = 1000200420
Ca43Nucleus = 1000200430
Ca44Nucleus = 1000200440
Ca45Nucleus = 1000200450
Ca46Nucleus = 1000200460
Ca47Nucleus = 1000200470
Ca48Nucleus = 1000200480
Cl35Nucleus = 1000170350
Cl36Nucleus = 1000170360
Cl37Nucleus = 1000170370
Cr50Nucleus = 1000240500
Cr51Nucleus = 1000240510
Cr52Nucleus = 1000240520
Cr53Nucleus = 1000240530
Cr54Nucleus = 1000240540
D0 = 421
D0Bar = -421
DMinus = -411
DPlus = 411
DsMinusBar = -431
DsPlus = 431
EMinus = 11
EPlus = -11
Eta = 221
F19Nucleus = 1000090190
Fe54Nucleus = 1000260540
Fe55Nucleus = 1000260550
Fe56Nucleus = 1000260560
Fe57Nucleus = 1000260570
Fe58Nucleus = 1000260580
Gamma = 22
He3Nucleus = 1000020030
He4Nucleus = 1000020040
K0_Long = 130
K0_Short = 310
K39Nucleus = 1000190390
K40Nucleus = 1000190400
K41Nucleus = 1000190410
KMinus = -321
KPlus = 321
Lambda = 3122
LambdaBar = -3122
LambdacPlus = 4122
Li6Nucleus = 1000030060
Li7Nucleus = 1000030070
Mg24Nucleus = 1000120240
Mg25Nucleus = 1000120250
Mg26Nucleus = 1000120260
Mn52Nucleus = 1000250520
Mn53Nucleus = 1000250530
Mn54Nucleus = 1000250540
Mn55Nucleus = 1000250550
MuMinus = 13
MuPlus = -13
N14Nucleus = 1000070140
N15Nucleus = 1000070150
Na23Nucleus = 1000110230
Ne20Nucleus = 1000100200
Ne21Nucleus = 1000100210
Ne22Nucleus = 1000100220
Neutron = 2112
NeutronBar = -2112
NuE = 12
NuEBar = -12
NuMu = 14
NuMuBar = -14
NuTau = 16
NuTauBar = -16
O16Nucleus = 1000080160
O17Nucleus = 1000080170
O18Nucleus = 1000080180
OmegaMinus = 3334
OmegaPlusBar = -3334
P31Nucleus = 1000150310
P32Nucleus = 1000150320
P33Nucleus = 1000150330
PMinus = -2212
PPlus = 2212
Pi0 = 111
PiMinus = -211
PiPlus = 211
S32Nucleus = 1000160320
S33Nucleus = 1000160330
S34Nucleus = 1000160340
S35Nucleus = 1000160350
S36Nucleus = 1000160360
Sc44Nucleus = 1000210440
Sc45Nucleus = 1000210450
Sc46Nucleus = 1000210460
Sc47Nucleus = 1000210470
Sc48Nucleus = 1000210480
Si28Nucleus = 1000140280
Si29Nucleus = 1000140290
Si30Nucleus = 1000140300
Si31Nucleus = 1000140310
Si32Nucleus = 1000140320
Sigma0 = 3212
Sigma0Bar = -3212
SigmaMinus = 3112
SigmaMinusBar = -3222
SigmaPlus = 3222
SigmaPlusBar = -3112
TauMinus = 15
TauPlus = -15
Ti44Nucleus = 1000220440
Ti45Nucleus = 1000220450
Ti46Nucleus = 1000220460
Ti47Nucleus = 1000220470
Ti48Nucleus = 1000220480
Ti49Nucleus = 1000220490
Ti50Nucleus = 1000220500
V48Nucleus = 1000230480
V49Nucleus = 1000230490
V50Nucleus = 1000230500
V51Nucleus = 1000230510
WMinus = -24
WPlus = 24
Xi0 = 3322
Xi0Bar = -3322
XiMinus = 3312
XiPlusBar = -3312
Z0 = 23
unknown = 0
class HErmes.icecube_goodies.conversions.ParticleType[source]

Bases: object

Namespace for icecube particle type codes

Al26Nucleus = 2613
Al27Nucleus = 2713
Ar36Nucleus = 3618
Ar37Nucleus = 3718
Ar38Nucleus = 3818
Ar39Nucleus = 3918
Ar40Nucleus = 4018
Ar41Nucleus = 4118
Ar42Nucleus = 4118
B11Nucleus = 1105
Be9Nucleus = 904
C12Nucleus = 1206
Ca40Nucleus = 4020
Cl35Nucleus = 3517
Cr52Nucleus = 5224
EMinus = 3
EPlus = 2
F19Nucleus = 1909
Fe56Nucleus = 5626
Gamma = 1
He4Nucleus = 402
K0_Long = 10
K0_Short = 16
K39Nucleus = 3919
KMinus = 12
KPlus = 11
Li7Nucleus = 703
Mg24Nucleus = 2412
Mn55Nucleus = 5525
MuMinus = 6
MuPlus = 5
N14Nucleus = 1407
Na23Nucleus = 2311
Ne20Nucleus = 2010
Neutron = 13
NuE = 66
NuEBar = 67
NuMu = 68
NuMuBar = 69
NuTau = 133
NuTauBar = 134
O16Nucleus = 1608
P31Nucleus = 3115
PMinus = 15
PPlus = 14
Pi0 = 7
PiMinus = 9
PiPlus = 8
S32Nucleus = 3216
Sc45Nucleus = 4521
Si28Nucleus = 2814
TauMinus = 132
TauPlus = 131
Ti48Nucleus = 4822
V51Nucleus = 5123
unknown = 0

HErmes.icecube_goodies.fluxes module

Flux models for atmospheric neutrino and muon fluxes as well as power law fluxes

HErmes.icecube_goodies.fluxes.AtmoWrap(*args, **kwargs)[source]

Allows currying atmospheric flux functions for class interface :param *args: passed through to AtmosphericNuFlux :param **kwargs: passed through to AtmosphericNuFlux

Returns: AtmosphericNuFlux with applied arguments

HErmes.icecube_goodies.fluxes.AtmosphericNuFlux(*args, **kwargs)[source]
class HErmes.icecube_goodies.fluxes.ICMuFluxes[source]

Bases: object

GaisserH3a = None
GaisserH4a = None
Hoerandel = None
Hoerandel5 = None
class HErmes.icecube_goodies.fluxes.MuFluxes[source]

Bases: object

Namespace for atmospheric muon fluxes

GaisserH3a = None
GaisserH4a = None
Hoerandel = None
Hoerandel5 = None
class HErmes.icecube_goodies.fluxes.NuFluxes[source]

Bases: object

Namespace for neutrino fluxes

static BARTOL(x)
static BERSSH3a(x)
static BERSSH4a(x)
static E2(mc_p_energy, mc_p_type, mc_p_zenith, fluxconst=1e-08, gamma=-2)
static ERS(x)
static ERSH3a(x)
static ERSH4a(x)
static Honda2006(x)
static Honda2006H3a(x)
static Honda2006H4a(x)
HErmes.icecube_goodies.fluxes.PowerLawFlux(fluxconst=1e-08, gamma=2)[source]

A simple powerlaw flux

Parameters:
  • fluxconst (float) – normalization
  • gamma (float) – spectral index

Returns (func): the flux function

HErmes.icecube_goodies.fluxes.PowerWrap(*args, **kwargs)[source]

Allows currying PowerLawFlux for class interface

Parameters:
  • *args – applied to PowerLawFlux
  • **kwargs – applied to PowerLawFlux

Returns: PowerLawFlux with applied arguments

HErmes.icecube_goodies.fluxes.generated_corsika_flux(ebinc, datasets)[source]

Calculate the livetime of a number of given coriska datasets using the weighting moduel The calculation here means a comparison of the number of produced events per energy bin with the expected event yield from fluxes in nature. If necessary call home to the simprod db. Works for 5C datasets.

Parameters:
  • ebinc (np.array) – Energy bins (centers)
  • datasets (list) – A list of dictionaries with properties of the datasets or dataset numbers. If only nu8mbers are given, then simprod db will be queried format of dataset dict: example_datasets ={42: {“nevents”: 1, “nfiles”: 1, “emin”: 1, “emax”: 1, “normalization”: [10., 5., 3., 2., 1.], “gamma”: [-2.]*5, “LowerCutoffType”: ‘EnergyPerNucleon’, “UpperCutoffType”: ‘EnergyPerParticle’, “height”: 1600, “radius”: 800}}
Returns:

tuple (generated protons, generated irons)

HErmes.icecube_goodies.helpers module

Goodies for icecube

class HErmes.icecube_goodies.helpers.IceCubeGeometry[source]

Bases: object

Provide icecube geometry information

coordinates(string, dom)[source]

Calculate the xy position of a given string

load_geo()[source]

Load geometry information

HErmes.icecube_goodies.weighting module

An interface to icecube’s weighting schmagoigl

HErmes.icecube_goodies.weighting.GetGenerator(datasets)[source]

datasets must be a dict of dataset_id : number_of_files

Parameters:datasets (dict) – Query the database for these datasets. dict dataset_id -> number of files

Returns (icecube.weighting…): Generation probability object

HErmes.icecube_goodies.weighting.GetModelWeight(model, datasets, mc_datasets=None, mc_p_en=None, mc_p_ty=None, mc_p_ze=None, mc_p_we=1.0, mc_p_ts=1.0, mc_p_gw=1.0, **model_kwargs)[source]

Compute weights using a predefined model

Parameters:
  • model (func) – Used to calculate the target flux
  • datasets (dict) – Get the generation pdf for these datasets from the db dict needs to be dataset_id -> nfiles
Keyword Arguments:
 
  • mc_p_en (array-like) – primary energy
  • mc_p_ty (array-like) – primary particle type
  • mc_p_ze (array-like) – primary particle cos(zenith)
  • mc_p_we (array-like) – weight for mc primary, e.g. some interaction probability

Returns (array-like): Weights

class HErmes.icecube_goodies.weighting.Weight(generator, flux)[source]

Bases: object

Provides the weights for weighted MC simulation. Uses the pdf from simulation and the desired flux

HErmes.icecube_goodies.weighting.constant_weights(size, scale=1.0)[source]

Calculate a constant weight for all the entries, e.g. unity

Parameters:size (int) – The size of the returned arraz (d)
Keyword Arguments:
 scale (float) – The returned weight is 1/scale
Returns:np.ndarray
HErmes.icecube_goodies.weighting.get_weight_from_weightmap(model, datasets, mc_datasets=None, mc_p_en=None, mc_p_ty=None, mc_p_ze=None, mc_p_we=1.0, mc_p_ts=1.0, mc_p_gw=1.0, **model_kwargs)[source]

Get weights for weighted datasets (generation spectra is already the target flux)

Parameters:
  • model (func) – Not used, only for compatibility
  • datasets (dict) – used to provide nfiles
Keyword Arguments:
 
  • mc_p_en (array-like) – primary energy
  • mc_p_ty (array-like) – primary particle type
  • mc_p_ze (array-like) – primary particle cos(zenith)
  • mc_p_we (array-like) – weight for mc primary, e.g. some interaction probability
  • mc_p_gw (array-like) – generation weight
  • mc_p_ts (array-like) – mc timescale
  • mc_datasets (array-like) – an array which has per-event dataset information

Returns (array-like): Weights

Module contents