Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

warn missing x_scatter in read simulated spectrum instead of exception #127

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions fact/io.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import warnings
from os import path
import pandas as pd
import json
Expand Down Expand Up @@ -509,11 +510,12 @@ def read_simulated_spectrum(corsika_headers_path):
r = f['corsika_runs'].attrs.get('scatter_radius')
unit = f['corsika_runs'].attrs.get('scatter_radius_unit', u.m)
if r is None:
raise ValueError(
warnings.warn(
'File does neither contain column `/corsika_runs/x_scatter` '
'nor the attribute `scatter_radius`'
)
summary['x_scatter'] = u.Quantity(r, u.m)
else:
summary['x_scatter'] = u.Quantity(r, u.m)

for key, unit in keys.items():
unique_values = runs[key].unique()
Expand Down