mirror of
https://github.com/pim-n/pg-rad
synced 2026-03-11 19:58:11 +01:00
Add mu_mass_air to isotope automatically calculated from energy and fix error msg
This commit is contained in:
@ -1,3 +1,6 @@
|
||||
from pg_rad.physics import get_mass_attenuation_coeff
|
||||
|
||||
|
||||
class Isotope:
|
||||
"""Represents the essential information of an isotope.
|
||||
|
||||
@ -11,13 +14,14 @@ class Isotope:
|
||||
name: str,
|
||||
E: float,
|
||||
b: float
|
||||
):
|
||||
):
|
||||
if E <= 0:
|
||||
raise ValueError("primary_gamma must be a positive energy (keV).")
|
||||
|
||||
if not (0 <= b <= 1):
|
||||
raise ValueError("branching_ratio_pg must be a ratio (0 <= b <= 1)")
|
||||
raise ValueError("branching_ratio_pg must be a ratio b in [0,1]")
|
||||
|
||||
self.name = name
|
||||
self.E = E
|
||||
self.b = b
|
||||
self.mu_mass_air = get_mass_attenuation_coeff(E / 1000)
|
||||
|
||||
Reference in New Issue
Block a user