Skip to content

Commit

Permalink
fix file handling closure data
Browse files Browse the repository at this point in the history
  • Loading branch information
RoyStegeman committed Dec 23, 2024
1 parent 692e6d4 commit 03f807f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions validphys2/src/validphys/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,6 @@ def _filter_closure_data(filter_path, data, fakepdf, fakenoise, filterseed, data
log.info("Writing Level1 data")
else:
log.info("Writing Level0 data")

for cd in closure_data:
# Write the full dataset, not only the points that pass the filter
data_path, unc_path = generate_path_filtered_data(filter_path.parent, cd.setname)
Expand All @@ -347,8 +346,10 @@ def _filter_closure_data(filter_path, data, fakepdf, fakenoise, filterseed, data
output_cd = raw_cd.with_central_value(new_cv)

# And export it to file
output_cd.export_data(data_path.open("w", encoding="utf-8"))
output_cd.export_uncertainties(unc_path.open("w", encoding="utf-8"))
with open(data_path, "w", encoding="utf-8") as f:
output_cd.export_data(f)
with open(unc_path, "w", encoding="utf-8") as f:
output_cd.export_uncertainties(f)

return total_data_points, total_cut_data_points

Expand Down

0 comments on commit 03f807f

Please sign in to comment.