feat: change CSV output format to use tab delimiters instead of comma delimiters
This commit is contained in:
@@ -212,7 +212,9 @@ class BetaSpectrumAnalyzer:
|
||||
branch_endpoint_keV = branch.endpoint_MeV * 1000
|
||||
neutrino_mass_keV = self.config.neutrino_mass_MeV * 1000
|
||||
is_excluded_by_mass = branch_endpoint_keV <= neutrino_mass_keV
|
||||
is_excluded_by_intensity = branch.intensity < self.config.intensity_cutoff
|
||||
is_excluded_by_intensity = (
|
||||
branch.intensity < self.config.intensity_cutoff
|
||||
)
|
||||
if not is_excluded_by_mass and not is_excluded_by_intensity:
|
||||
active_branches += 1
|
||||
|
||||
@@ -333,7 +335,9 @@ class BetaSpectrumAnalyzer:
|
||||
branch_endpoint_keV = self._unified_branches[i].endpoint_MeV * 1000
|
||||
neutrino_mass_keV = self.config.neutrino_mass_MeV * 1000
|
||||
is_excluded_by_mass = branch_endpoint_keV <= neutrino_mass_keV
|
||||
is_excluded_by_intensity = self._unified_branches[i].intensity < self.config.intensity_cutoff
|
||||
is_excluded_by_intensity = (
|
||||
self._unified_branches[i].intensity < self.config.intensity_cutoff
|
||||
)
|
||||
if not is_excluded_by_mass and not is_excluded_by_intensity:
|
||||
active_branch_indices.append(i)
|
||||
|
||||
@@ -433,7 +437,9 @@ class BetaSpectrumAnalyzer:
|
||||
branch_endpoint_keV = self._unified_branches[i].endpoint_MeV * 1000
|
||||
neutrino_mass_keV = self.config.neutrino_mass_MeV * 1000
|
||||
is_excluded_by_mass = branch_endpoint_keV <= neutrino_mass_keV
|
||||
is_excluded_by_intensity = self._unified_branches[i].intensity < self.config.intensity_cutoff
|
||||
is_excluded_by_intensity = (
|
||||
self._unified_branches[i].intensity < self.config.intensity_cutoff
|
||||
)
|
||||
if not is_excluded_by_mass and not is_excluded_by_intensity:
|
||||
active_branch_indices.append(i)
|
||||
|
||||
@@ -800,7 +806,7 @@ class BetaSpectrumAnalyzer:
|
||||
data[f"branch_{i + 1}"] = branch_spectrum
|
||||
|
||||
df = pd.DataFrame(data)
|
||||
df.to_csv(filename, index=False, float_format="%.4e")
|
||||
df.to_csv(filename, index=False, float_format="%.4e", sep='\t')
|
||||
|
||||
with open(filename, "r") as f:
|
||||
content = f.read()
|
||||
|
||||
@@ -460,8 +460,8 @@ class TestMultiBranchCSVExport:
|
||||
|
||||
import pandas as pd
|
||||
|
||||
# Read CSV (skip comment headers)
|
||||
df = pd.read_csv(csv_path, comment="#")
|
||||
# Read CSV (skip comment headers, use tab delimiter)
|
||||
df = pd.read_csv(csv_path, comment="#", sep='\t')
|
||||
|
||||
# Should have total spectrum column
|
||||
assert "total_spectrum" in df.columns
|
||||
@@ -500,7 +500,7 @@ class TestMultiBranchCSVExport:
|
||||
|
||||
import pandas as pd
|
||||
|
||||
df = pd.read_csv(csv_path, comment="#")
|
||||
df = pd.read_csv(csv_path, comment="#", sep='\t')
|
||||
|
||||
assert "total_spectrum" in df.columns
|
||||
assert "branch_1_spectrum" in df.columns
|
||||
|
||||
Reference in New Issue
Block a user