Package: atmosphericRadiationDoseAndFlux
atmosphericRadiationDoseAndFluxA calculation toolkit for determining radiation dose rates in the atmosphere due to an incoming spectrum of particles from space.InstallationAfter cloning this directory to your computer, install this package from the cloned directory using the commandsudo pip3 install .or alternatively,sudo python3 setup.py installUsageCalculating dose rates from an input spectrum as a functionRadiation dose rates that aircraft experience are dependent on the incoming radiation spectrum from space for each incoming particle type,
altitude above ground level and the 'vertical cut-off rigidity' (which is a function of latitude and longitude).You can directly calculate radiation dose rates from an incoming rigidity spectrum using thecalculate_from_rigidity_specfunction.calculate_from_rigidity_spectakes in an input rigidity specrum as a Python function, as well as an altitude or a list of altitudes,
and outputs the dose rates aircraft will experience at that altitude. You can optionally also include a vertical cut-off rigidity (the
default vertical cut-off rigidity is set to 0.0 GV).The usage ofcalculate_from_rigidity_specis:calculate_from_rigidity_spec(rigiditySpectrum:Function, 
                             altitudesInkm:float|list, 
                             particleName="proton", 
                             inputRigidityBins=None,
                             verticalCutOffRigidity=0.0)where the input parameters are:parameterdescriptionrigiditySpectrumcallable function: must be specified in units ofparticles/cm2/sr/GV/s, and as a function of rigidity in GV. rigiditySpectrum can be specified as any callable single argument function, representing an incoming particle spectrum with any distribution. You may wish to use Python'slambda functionto do this.altitudesInkmfloatorlist: if specified as a list, calculations will be performed in a loop over each of the specified altitudes and returned in the output Pandas DataFrame.particleNamestr: must be either "proton" or "alpha". Currently using the setting "alpha" actually calculates dose rates associated with all particles species with atomic numbers 2 and greater rather than just for alpha particles. Default = "proton".inputRigidityBinslist: an optional input parameter, do not use unless experienced with using this library. Setting this parameter to a value overrides this module's internal application of therigiditySpectrumparameter to an internal default set of energy bins for the purpose of calculating dose rates and fluxes.verticalCutOffRigidityfloat: units of gigavolts (GV). Default = 0.0.For example, after importing the module usingfrom atmosphericRadiationDoseAndFlux import doseAndFluxCalculator as DAFcalcand defining an input rigidity spectrum as a function;testA = 2.77578789
testmu = 2.82874076

testRigiditySpectrum = lambda x:testA*(x**(-testmu))runningDAFcalc.calculate_from_rigidity_spec(testRigiditySpectrum, 
                                    particleName="proton",altitudesInkm=18.5928, verticalCutOffRigidity=0.0)will returnaltitude (km)      edose      adose      dosee        tn1       tn2  \
0        18.5928  62.219856  41.774429  34.169926  12.323553  7.639987   

        tn3           SEU           SEL  
0  5.108492  7.639987e-13  7.639987e-08as aPandas DataFrame. HeretestRigiditySpectrumis a power law distribution in rigidity, with a spectral index oftestmuand a value at x = 1 oftestA.The outputted dose rate (or flux) labels represent the following dose rate/flux types:labeldose rate/flux typeadoseambient dose equivalent in µSv/hredoseeffective dose in µSv/hrdoseedose equivalent in µSv/hrtn1>1 MeV neutron flux, in n/cm2/stn2>10 MeV neutron flux, in n/cm2/stn3>60 MeV neutron flux, in n/cm2/sSEUsingle event upset rate for an SRAM device in upsets/second/bitSELsingle event latch-up rate for an SRAM device in latch-ups/second/deviceDose rates can also be generated from an energy spectrum usingcalculate_from_energy_spec, which has the same syntax ascalculate_from_rigidity_spec,
but where the incoming spectrum (now in units ofparticles/cm2/sr/MeV/s) must be specified in terms of energy in MeV instead of rigidity and the optionalinputRigidityBinsparameter is insteadinputEnergyBinsin MeV.Calculating dose rates from an input spectrum as an arrayWhile it is recommended that the user uses functions as the method of inputting spectra, you can also use thecalculate_from_rigidity_spec_arrayandcalculate_from_energy_spec_arrayfunctions to calculate dose rates directly from an array of spectral flux values and energy bins.The general syntax for inputs to these are:calculate_from_rigidity_spec_array(
                            inputRigidityBins:list,
                            inputFluxesGV:list, 
                            altitudesInkm:list, 
                            particleName="proton",
                            verticalCutOffRigidity = 0.0)whereinputRigidityBinsis the full list of rigidity bin edge locations in GV that the input fluxes specified byinputFluxesGVare specified for. AsinputRigidityBinsrepresent the bin edge locations forinputFluxesGV, the length ofinputRigidityBinsmust therefore be exactly 1 greater than the length ofinputFluxesGV.calculate_from_energy_spec_arrayhas a nearly identical syntax tocalculate_from_rigidity_spec_array, where the only difference is that the first argument ofcalculate_from_energy_spec_arraymust be specified in MeV instead of GV, and the second argument is the energy spectrum in particles/cm2/sr/MeV/s instead of the rigidity spectrum in particles/cm2/sr/GV/s.