Skip to content

Commit

Permalink
this will be the 'core'
Browse files Browse the repository at this point in the history
  • Loading branch information
relleums committed Dec 20, 2023
1 parent bd62477 commit 905e72b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
18 changes: 11 additions & 7 deletions plenoirf/event_table/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ def init_table_structure():
t["cherenkovsizepart"] = init_cherenkovsizepart_level_structure()
t["cherenkovpoolpart"] = init_cherenkovpoolpart_level_structure()

t["core"] = init_core_level_structure()

return t


Expand Down Expand Up @@ -203,6 +205,15 @@ def init_cherenkovpoolpart_level_structure():
return init_cherenkovpool_level_structure()


def init_core_level_structure():
return {
"bin_idx_x": {"dtype": "<i8", "comment": ""},
"bin_idx_y": {"dtype": "<i8", "comment": ""},
"core_x_m": {"dtype": "<f8", "comment": ""},
"core_y_m": {"dtype": "<f8", "comment": ""},
}


"""
STRUCTURE = {}
STRUCTURE["particlepool"] = {
Expand Down Expand Up @@ -274,13 +285,6 @@ def init_cherenkovpoolpart_level_structure():
"bunch_size_median": {"dtype": "<f8", "comment": ""},
}
STRUCTURE["core"] = {
"bin_idx_x": {"dtype": "<i8", "comment": ""},
"bin_idx_y": {"dtype": "<i8", "comment": ""},
"core_x_m": {"dtype": "<f8", "comment": ""},
"core_y_m": {"dtype": "<f8", "comment": ""},
}
STRUCTURE["particlepoolonaperture"] = {
"num_air_cherenkov_on_aperture": {
"dtype": "<i8",
Expand Down
13 changes: 13 additions & 0 deletions plenoirf/producing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,12 @@ def __corsika_and_grid(
)
del cherenkov_bunches_in_choice

core_rec = make_core_record(
uid=uid,
groundgrid_result_choice=groundgrid_result["choice"],
)
tabrec["core"].append_record(core_rec)

EventTape_append_event(
evttar=evttar,
corsika_evth=corsika_evth,
Expand Down Expand Up @@ -650,6 +656,13 @@ def make_groundgrid_record(
return rec


def make_core_record(uid, groundgrid_result_choice):
rec = uid["record"].copy()
for key in event_table.init_core_level_structure():
rec[key] = groundgrid_result_choice[rec]
return rec


def read_all_cherenkov_bunches(cherenkov_reader):
return np.vstack([b for b in cherenkov_reader])

Expand Down

0 comments on commit 905e72b

Please sign in to comment.