mirror of
https://github.com/pim-n/pg-rad
synced 2026-02-03 14:43:08 +01:00
refactor code into modules
This commit is contained in:
23
src/pg_rad/isotopes/isotope.py
Normal file
23
src/pg_rad/isotopes/isotope.py
Normal file
@ -0,0 +1,23 @@
|
||||
class Isotope:
|
||||
"""Represents the essential information of an isotope.
|
||||
|
||||
Args:
|
||||
name (str): Full name (e.g. Caesium-137).
|
||||
E (float): Energy of the primary gamma in keV.
|
||||
b (float): Branching ratio for the gamma at energy E.
|
||||
"""
|
||||
def __init__(
|
||||
self,
|
||||
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)")
|
||||
|
||||
self.name = name
|
||||
self.E = E
|
||||
self.b = b
|
||||
Reference in New Issue
Block a user