spacepy.irbempy.Shieldose2¶
- class spacepy.irbempy.Shieldose2(*args, **kwargs)[source]¶
A class for performing dose calculations using Shieldose2
Notes
Added in version 0.5.0.
Examples
>>> import spacepy.irbempy >>> import spacepy.toolbox >>> import numpy as np >>> dosemod = spacepy.irbempy.Shieldose2() >>> dosemod.set_shielding(depths=spacepy.toolbox.logspace(0.1, 15, 45), units='mm') >>> e_spec = lambda E: 2*np.exp(-E/0.3) >>> e_grid = spacepy.toolbox.logspace(0.01, 10, 50) >>> dosemod.set_flux(e_spec(e_grid), e_grid, species='e') >>> dosemod.get_dose(detector=10, nucmeth=3) >>> import spacepy.plot >>> spacepy.plot.style('spacepy') >>> dosemod.plot_dose(source=['e'])
Methods
get_dose
([detector, nucmeth, fluence])Calculate dose (given shielding/incident flux)
plot_dose
([source, target, loc, add_legend])Make plot of dose versus depth for contributing sources
set_flux
(flux, energy, species[, tau, mult])Set the flux/fluence spectrum for a given incident species
set_shielding
([depths, units])- Parameters:
Attributes
- get_dose(detector=3, nucmeth=1, fluence='NASA')[source]¶
Calculate dose (given shielding/incident flux)
Shielding calculation results are stored in
results
.- Parameters:
- detector
int
, optional Detector type, default is Silicon (type 3). Detector materials options are: 1-Aluminium; 2-Graphite; 3-Silicon; 4-Air; 5-Bone; 6-Calcium Fluoride; 7-Gallium Arsenide; 8-Lithium Fluoride; 9-Silicon Dioxide; 10-Tissue; 11-Water
- nucmeth
int
, optional Nuclear interactions settings. Option 1 (default), no nuclear attenuation for protons in Al. 2. Nuclear attenuation, local charged secondary energy deposition. 3. As 2. but with approx. exponential distribution of neutron dose.
- fluence
str
, optional If the detector type is Silicon, the results contain an estimate of the integral fluence at each depth of shielding. This is calculated from the Silicon dose with an empirical conversion factor. The default is ‘nasa’ (aka ‘wenaas’). The other options are ‘coakley’ and ‘dictat’. See appendix C.4.1 of NASA-HDBK-4002 for details.
- detector
Examples
Example calculation of dose-depth curve, compare to figure 3 in https://www.vdl.afrl.af.mil/programs/ae9ap9/files/techreports/20160513_Aerospace_OBrien_ATR-2016-01756_effects_kernels.pdf
>>> import spacepy.irbempy >>> import matplotlib.pyplot as plt >>> import spacepy.plot >>> spacepy.plot.style('default') >>> dosemod = spacepy.irbempy.Shieldose2() >>> dosemod.get_dose() >>> dosemod.results.tree() >>> dosemod.plot_dose(source=['e', 'brems', 'p_un']) >>> plt.show()
- plot_dose(source=['e', 'brems', 'p_tr', 'p_un'], target=None, loc=111, add_legend=True, **kwargs)[source]¶
Make plot of dose versus depth for contributing sources
- Parameters:
- source
list
ofstr
List of dose contributions to plot. Supported options are: e (electrons); brems (Bremsstrahlung); p_tr (trapped protons); p_un (untrapped protons); tot (total dose). If both ‘e’ and ‘brems’ are present in the list they will be summed and plotted.
- target
matplotlib.axes.Axes
ormatplotlib.figure.Figure
, optional The target object for plotting. Default is to create a new figure with a single subplot. If
Axes
, will draw into that subplot (and will not draw a legend or figure title); ifFigure
, will make a single subplot (and not set figure title). Handled byset_target
.- loc
int
, optional The subplot triple that specifies the location of the axes object. Defaults to matplotlib default (111).
- add_legend
bool
If True (default) add a legend to the figure.
- source
- set_flux(flux, energy, species, tau=1, mult=1)[source]¶
Set the flux/fluence spectrum for a given incident species
- Parameters:
- fluxarray-like
A 1D array of differential number fluxes
- energyarray-like
A 1D array of energies (same length as flux)
- species
str
, optional Code for supplied species. Options are: ‘e’ (electrons); ‘p_tr’ (trapped protons); ‘p_un’ (untrapped protons/solar energetic protons)
- tau
int
, optional Simulation interval in seconds. If flux input is given and assumed constant over the interval, tau should be set to the desired duration. If fluence input is given, this should be set to 1 (default).
- mult
int
, optional Multiplier to convert from [1/energy] to [1/MeV], if energies are in keV and flux is [1/keV] then mult=1000. Default is 1.
- set_shielding(depths=array([4.00000000e+00, 5.11505128e+00, 6.54093739e+00, 8.36430754e+00, 1.06959655e+01, 1.36776030e+01, 1.74904102e+01, 2.23660862e+01, 2.86009195e+01, 3.65737924e+01, 4.67692059e+01, 5.98067216e+01, 7.64786119e+01, 9.77980053e+01, 1.25060453e+02, 1.59922658e+02, 2.04503148e+02, 2.61511023e+02, 3.34410573e+02, 4.27631807e+02, 5.46839655e+02, 6.99278218e+02, 8.94210986e+02, 1.14348376e+03, 1.46224452e+03, 1.86986392e+03, 2.39111246e+03, 3.05766571e+03, 3.91002923e+03, 5.00000000e+03]), units='Mil')[source]¶
- Parameters:
- depthsarray-like
Array of layer depths (not thicknesses) in given units. Must be monotonically increasing.
- units
str
Options are “mil” (thousandths of a inch; default), “g/cm2” (density), or “mm” (millimeters). The shielding is assumed to be aluminium-equivalent.
- settings¶
Settings for the dose calculation (
SpaceData
). Updated byset_flux
,set_shielding
, andget_dose
.