cosraymodifiediso
A Python library for acquiring galactic cosmic ray spectra at Earth from the ISO model as modified by DLR. All the details and equations about this model can be found in Matthiae et al., A ready-to-use galactic cosmic ray model, Advances in Space Research 51.3 (2013): 329-338, https://doi.org/10.1016/j.asr.2012.09.022 .
Science Score: 57.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 4 DOI reference(s) in README -
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (13.6%) to scientific vocabulary
Keywords
Repository
A Python library for acquiring galactic cosmic ray spectra at Earth from the ISO model as modified by DLR. All the details and equations about this model can be found in Matthiae et al., A ready-to-use galactic cosmic ray model, Advances in Space Research 51.3 (2013): 329-338, https://doi.org/10.1016/j.asr.2012.09.022 .
Basic Info
- Host: GitHub
- Owner: ssc-maire
- License: other
- Language: Python
- Default Branch: master
- Homepage: https://pypi.org/project/CosRayModifiedISO/
- Size: 33.8 MB
Statistics
- Stars: 5
- Watchers: 2
- Forks: 2
- Open Issues: 0
- Releases: 16
Topics
Metadata Files
README.md
CosRayModifiedISO
A simple library for running the ISO galactic cosmic ray spectrum model as modified by DLR.
All the details and equations about this model can be found in Matthiä et al., "A ready-to-use galactic cosmic ray model", Advances in Space Research 51.3 (2013): 329-338, https://doi.org/10.1016/j.asr.2012.09.022 . This model only requires a single parameter, W, which describes the modulation of the Sun at a given date and time, to calculate the flux of cosmic rays hitting Earth.
If you use this software for scientific research, please reference the above paper, and this software appropriately according to the appropriate journal publication rules.
Installation
You can either install directly from PyPi using
shell
pip install CosRayModifiedISO
Or clone CosRayModifiedISO from https://github.com/ssc-maire/CosRayModifiedISO, and then from the cloned directory, run
shell
sudo python setup.py install
Usage
to import this module, use
python
from CosRayModifiedISO import CosRayModifiedISO
unless otherwise stated, all of the quantities specified in this library use the following units: * Energies are always in units of MeV * Rigidities are always in units of GV * Differential energy fluxes are always in units of cts / cm2 / s / sr / (MeV/n) * Differential rigidity fluxes are always in units of cts / cm2 / s / sr / (GV/n)
It should be noted that in the field of space radiation, "energy" is frequently generally used specifically as a shorthand for "kinetic energy" rather than the total energy of a particle (rest mass energy + kinetic energy), and all references to "energy" in this library should be assumed to be kinetic energy unless otherwise specified.
All users should be always be careful to remember which differential flux type they are using for their application, as differential energy flux and differential rigidity flux are different quantities which have a non-linear conversion between them. In general, differential energy flux should always be used when working with energies, and differential rigidity flux should be used when working with particle rigidities. If you're trying to create something like a particle 'kinetic energy spectrum' for instance, you should use particle kinetic energy on the x-axis, and the differential energy flux on the y-axis (here using energy as a shorthand for kinetic energy).
Unit description:
| Symbol | name | | ----------- | ----------- | | cm | centimeter | | s | seconds | | sr | steradian | | MeV | Megaelectronvolts | | GV | Gigavolts | | n | nucleons |
Single differential flux values and ranges of differential flux values
to get a single differential flux value for a particle value of solar modulation, and for a particular particle with a given atomic number and kinetic energy
(or range of kinetic energies), the appropriate method for CosRayModifiedISO is
python
CosRayModifiedISO.getEnergyFluxesFromEnergies(solarModulationWparameter,
atomicNumber,
energyListInMeV)
For example, the script ```python from CosRayModifiedISO import CosRayModifiedISO
solarModulationWparameter = 19.25 # the solar modulation at a specific point in the solar cycle atomicNumber = 1 # the atomic number of the particle in question - in this case a proton/hydrogen ion, which has an atomic number of 1 energyListInMeV = 945.2 # kinetic energy of particle in MeV
print(CosRayModifiedISO.getEnergyFluxesFromEnergies(solarModulationWparameter,
atomicNumber,
energyListInMeV))
gives
python
[0.00012419]
```
as output.
The argument energyListInMeV can be supplied as either a single float or as a list of floats to give either a single differential flux as output,
or a range of differential fluxes corresponding to each supplied kinetic energy.
If you instead want to acquire differential rigidity fluxes rather than differential energy fluxes, you can use
python
CosRayModifiedISO.getRigidityFluxesFromRigidities(solarModulationWparameter, atomicNumber, rigidityListInGV)
which has exactly the same syntax and usage as the getEnergyFluxesFromEnergies method, but where rigidities in GV must be supplied instead
of kinetic energies in MeV.
Outputting full particle spectra from a date and time, from neutron monitor data, or from the solar modulation.
Instead of directly needing to input the solar modulation and required kinetic energies or rigidities for each calculation, methods are available to return differential fluxes automatically based on neutron monitor data and a default set of kinetic energies designed to cover a range corresponding to particles that are relevant specifically for radiation dose rate calculations in Earth's atmosphere.
The method
python
CosRayModifiedISO.getSpectrumUsingTimestamp(timestamp, atomicNumber)
method can be used to output the differential fluxes for a given date and time, for example,
```python from CosRayModifiedISO import CosRayModifiedISO import datetime as dt
datetimeToUse = dt.datetime( year = 2001, month = 10, day = 27, hour = 0, minute = 10, second = 35 )
print(CosRayModifiedISO.getSpectrumUsingTimestamp(datetimeToUse,atomicNumber=1))
returns the output
python
Energy (MeV/n) dFlux / dE (cm-2 s-1 sr-1 (MeV/n)-1) Rigidity (GV/n) dFlux / dR (cm-2 s-1 sr-1 (GV/n)-1)
0 11.294627 2.290835e-07 0.146022 3.522790e-05
1 14.219093 3.785376e-07 0.163966 6.516322e-05
2 17.900778 6.157642e-07 0.184152 1.185919e-04
3 22.535744 9.848618e-07 0.206875 2.120539e-04
4 28.370820 1.546788e-06 0.232474 3.719962e-04
...
``
getSpectrumUsingTimestamp` returns output in the form of a Pandas DataFrame.
This method uses historic values from the OULU neutron monitor to determine values of solar modulation for input into the model, using the method described in Matthiä et al., (2013). Currently only dates between 1964/04/01 00:00 and 2021/01/31 00:00 can be used.
Count rates from the OULU neutron monitor (or representative values) can be supplied directly into the model using the
python
CosRayModifiedISO.getSpectrumUsingOULUcountRate(OULUcountRatePerSecond, atomicNumber)
method, where OULUcountRatePerSecond is a single float representing the count rate per second of the OULU neutron monitor at a given instance of time.
The solar modulation parameter can also be supplied directly using
python
CosRayModifiedISO.getSpectrumUsingSolarModulation(solarModulationWparameter, atomicNumber)
This function can be identically supplied with the monthly averaged sunspot number instead of the solar modulation parameter, which the solar modulation parameter
is essentially a proxy for. Alternatively the identical function
python
CosRayModifiedISO.getSpectrumUsingSSN(sunspotNumber, atomicNumber)
can be used instead for code understandability.
Each of these three methods output Pandas DataFrames in the same format as outputted by getSpectrumUsingTimestamp. The value of the solar modulation parameter
as a function of OULU neutron monitor monitor count rate can also be outputted by running
python
CosRayModifiedISO.getWparameterFromOULUcountRate(OULUcountRateInSeconds)
Quantity Conversion Functions
In addition to the above spectrum calculation methods, there are also several methods for performing conversion between different quantities for input and output.
The methods
python
CosRayModifiedISO.convertParticleRigidityToEnergy(particleRigidityInGV,
particleMassAU,
particleChargeAU)
and
python
CosRayModifiedISO.convertParticleRigidityToEnergy(particleRigidityInGV,
particleMassAU,
particleChargeAU)
can be used to convert particle rigidities to kinetic energies and vice versa, respectively. Currently particle rigidities and energy must be supplied
as Pandas Series objects. Particle masses and charges here must be inputted as single numbers
and in atomic units.
The methods
python
CosRayModifiedISO.convertParticleRigiditySpecToEnergySpec(particleRigidityInGV,
fluxInRigidityGVform,
particleMassAU,
particleChargeAU)
and
python
CosRayModifiedISO.convertParticleEnergySpecToRigiditySpec(particleKineticEnergyInMeV,
fluxInEnergyMeVform,
particleMassAU,
particleChargeAU)
can be used to convert differential rigidity flux to differential energy flux and vice versa, respectively. Both the particle rigidity values and their
respective differential flux values must be inputted as Pandas Series objects.
The particle mass for all of these methods can be acquired directly from atomic number using
python
CosRayModifiedISO.getAtomicMass(atomicNumber)
Acknowledgments
Thank you to Daniel Matthiä and others at DLR for allowing us to test their model initially using their own scripts.
This package contains and for certain functions uses data from the OULU neutron monitor, as acquired from https://www.nmdb.eu/ , where data can also be found at https://cosmicrays.oulu.fi/ . We therefore acknowledge the NMDB database www.nmdb.eu, founded under the European Union's FP7 programme (contract no. 213007) for providing data.
Owner
- Name: Surrey Space Centre
- Login: ssc-maire
- Kind: organization
- Email: maire+@surrey.ac.uk
- Website: www.maire.uk
- Repositories: 1
- Profile: https://github.com/ssc-maire
Citation (CITATION.cff)
cff-version: 1.2.0 message: "If you use this software, please cite it as below. The homepage for this software can be found at https://github.com/ssc-maire/CosRayModifiedISO" authors: - alias: "Space Environment and Protection Group, University of Surrey" title: "CosRayModifiedISO" type: software version: 1.2.7 doi: 10.5281/zenodo.10992395 date-released: 2024-04-18 url: "https://github.com/ssc-maire/CosRayModifiedISO" repository-code: "https://github.com/ssc-maire/CosRayModifiedISO" repository-artifact: "https://pypi.org/project/CosRayModifiedISO/"
GitHub Events
Total
- Release event: 2
- Watch event: 2
- Push event: 2
- Fork event: 2
- Create event: 2
Last Year
- Release event: 2
- Watch event: 2
- Push event: 2
- Fork event: 2
- Create event: 2
Committers
Last synced: over 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| Chris Davis | C****s@g****m | 64 |
| Fan Lei | 5****i | 2 |
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 0
- Total pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: 2 minutes
- Total issue authors: 0
- Total pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 1.0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 1
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
- dependabot[bot] (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 77 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 12
- Total maintainers: 1
pypi.org: cosraymodifiediso
A Python library for acquiring galactic cosmic ray spectra at Earth from the ISO model as modified by DLR. All the details and equations about this model can be found in Matthiae et al., A ready-to-use galactic cosmic ray model, Advances in Space Research 51.3 (2013): 329-338, https://doi.org/10.1016/j.asr.2012.09.022 .
- Homepage: https://github.com/ssc-maire/CosRayModifiedISO
- Documentation: https://cosraymodifiediso.readthedocs.io/
- License: CC BY-NC-SA 4.0
-
Latest release: 1.2.10
published 11 months ago