File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -71,9 +71,25 @@ def main(outputfile, inputdir):
7171 df = pd .DataFrame (event_headers [event_columns ])
7272 to_h5py (df , outputfile , key = 'corsika_events' , mode = 'a' )
7373
74+
7475 print ('saving runwise information' )
7576 runs = pd .DataFrame (np .array (run_headers )[run_header_columns ])
76- runs ['n_events' ] = np .array (run_ends )['n_events' ]
77+
78+ # some runs might have failed and thus no run end block
79+ for run_end in run_ends :
80+ if run_end is not None :
81+ dtype = run_end .dtype
82+ break
83+ else :
84+ raise IOError ('All run_end blocks are None, all runs failed.' )
85+
86+ dummy = np .array ([(b'RUNE' , np .nan , np .nan )], dtype = dtype )[0 ]
87+ run_ends = [r if r is not None else dummy for r in run_ends ]
88+ run_ends = np .array (run_ends )
89+
90+ print ('Number of failed runs:' , np .count_nonzero (np .isnan (run_ends ['n_events' ])))
91+
92+ runs ['n_events' ] = run_ends ['n_events' ]
7793
7894 to_h5py (runs , outputfile , key = 'corsika_runs' , mode = 'a' )
7995 print ('done' )
Original file line number Diff line number Diff line change 33
44setup (
55 name = 'irf' ,
6- version = '0.5.1 ' ,
6+ version = '0.5.2 ' ,
77 description = 'Functions to do instrument response functions for FACT' ,
88 url = 'http://github.com/fact-project/irf' ,
99 author = 'Kai Brügge, Maximilian Nöthe' ,
You can’t perform that action at this time.
0 commit comments