feat: add CLI options for custom CSV separator and normalize-to-one branch normalization
This commit is contained in:
@@ -471,6 +471,8 @@ def decay_info_to_config(
|
||||
e_step_MeV: float = 0.001,
|
||||
intensity_cutoff: float = 0.0,
|
||||
neutrino_mass_MeV: float = 0.0,
|
||||
csv_separator: str = ',',
|
||||
normalize_to_one: bool = False,
|
||||
) -> SpectrumConfig:
|
||||
"""
|
||||
Convert DecayInfo to a SpectrumConfig.
|
||||
@@ -485,6 +487,10 @@ def decay_info_to_config(
|
||||
Minimum branch intensity fraction to include.
|
||||
neutrino_mass_MeV : float
|
||||
Neutrino mass in MeV.
|
||||
csv_separator : str
|
||||
CSV column separator.
|
||||
normalize_to_one : bool
|
||||
If True, normalize each branch to 1, ignoring intensity.
|
||||
|
||||
Returns
|
||||
-------
|
||||
@@ -516,6 +522,8 @@ def decay_info_to_config(
|
||||
neutrino_mass_MeV=neutrino_mass_MeV,
|
||||
branches=branches,
|
||||
intensity_cutoff=intensity_cutoff,
|
||||
csv_separator=csv_separator,
|
||||
normalize_to_one=normalize_to_one,
|
||||
)
|
||||
|
||||
|
||||
@@ -690,12 +698,16 @@ def create_config_from_source(
|
||||
e_step = kwargs.get("e_step_MeV", 0.001)
|
||||
intensity_cutoff = kwargs.get("intensity_cutoff", 0.0)
|
||||
neutrino_mass = kwargs.get("neutrino_mass_MeV", 0.0)
|
||||
csv_separator = kwargs.get("csv_separator", ',')
|
||||
normalize_to_one = kwargs.get("normalize_to_one", False)
|
||||
info = get_decay_info_from_paceENSDF(nuclide, decay_type, decay_index)
|
||||
return decay_info_to_config(
|
||||
info,
|
||||
e_step_MeV=e_step,
|
||||
intensity_cutoff=intensity_cutoff,
|
||||
neutrino_mass_MeV=neutrino_mass,
|
||||
csv_separator=csv_separator,
|
||||
normalize_to_one=normalize_to_one,
|
||||
)
|
||||
elif source == "json":
|
||||
if not json_path:
|
||||
|
||||
Reference in New Issue
Block a user