Open HealthyPear opened 1 year ago
As discussed in slack: I'd propose to add unit
to Field
, so that we can just do something like this:
table = Table(data, units={field.name: field.unit for field in fields})
A minor update on this: I have used #23 to simplify the way units are treated in my development class, so now they don't use any more astropy structured units, but just dictionaries built from the subblock fields.
Also, the class now supports the identical Corsika versions as native pycorsikaio.
I have copied corsika757_particle for my unit tests which are satisfactory for the moment.
The only issues are now perhaps the possibly low-quality design of the class...
I have developed an initial version of a
CorsikaNPOReader
class which uses pycorsikaio to load the content of 1 or multiple files in astropy QTables.This class behaves similarly to
ctapipe.io.TableLoader
, meaning that it can load each file block separately if enabled and joins each table using all common 1D fields. A couple functions (not methods at the moment) have been indeed taken fromTableLoader
.u.StructuredUnit
(from v7.7 only)run_number
andevent_number
when available are always placed at the beginning of the table (some datablocks lack at least one of them so I append those fields where necessary to make sure that any combination of load options will be guaranteed to export this information).If this can be of interest for this project I could preemptively open a pull request for early feedback. The code is definitely not final but it's working and it could be tested with a very small corsika file with say 10 showers.