Skip to content

Commit 72df21e

Browse files
jwaitonmcidlaso
authored andcommitted
912 Remove event model - phase1
#912 [author: gonzaponte] This PR is the first step towards removing the superfluous parts of the event model. It replaces the Hit class and its subsidiaries with DataFrames, which are much more convenient. [reviewer: jwaiton] This PR begins the much desired process of removing the Hit class from IC, including changes across many cities and functions to accommodate this removal while retaining the same functionality. It also adds documentation to some darker areas of the code related to these changes, and has highlighted some new issues (#939, #936). Approved! Great work, I'm excited for phase 2 😸
2 parents 2cba90c + 66f4360 commit 72df21e

18 files changed

+748
-349
lines changed

invisible_cities/cities/beersheba.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -93,31 +93,6 @@
9393
from typing import Union
9494

9595

96-
# Temporary. The removal of the event model will fix this.
97-
def hitc_to_df_(hitc):
98-
columns = "event time npeak Xpeak Ypeak nsipm X Y Xrms Yrms Z Q E Qc Ec track_id Ep".split()
99-
columns = {col:[] for col in columns}
100-
101-
for hit in hitc.hits:
102-
columns["event" ].append(hitc.event)
103-
columns["time" ].append(hitc.time)
104-
columns["npeak" ].append(hit .npeak)
105-
columns["Xpeak" ].append(hit .Xpeak)
106-
columns["Ypeak" ].append(hit .Ypeak)
107-
columns["nsipm" ].append(hit .nsipm)
108-
columns["X" ].append(hit .X)
109-
columns["Y" ].append(hit .Y)
110-
columns["Xrms" ].append(hit .Xrms)
111-
columns["Yrms" ].append(hit .Yrms)
112-
columns["Z" ].append(hit .Z)
113-
columns["Q" ].append(hit .Q)
114-
columns["E" ].append(hit .E)
115-
columns["Qc" ].append(hit .Qc)
116-
columns["Ec" ].append(hit .Ec)
117-
columns["track_id"].append(hit .track_id)
118-
columns["Ep" ].append(hit .Ep)
119-
return pd.DataFrame(columns)
120-
12196
def event_info_adder(timestamp : float, dst : pd.DataFrame):
12297
return dst.assign(time=timestamp/1e3, nsipm=0, Xrms=0, Yrms=0)
12398

@@ -490,7 +465,6 @@ def beersheba( files_in : OneOrManyFiles
490465
"""
491466
correct_hits = fl.map(hits_corrector(**corrections), item="hits")
492467
threshold_hits = fl.map(hits_thresholder(threshold, same_peak), item="hits")
493-
hitc_to_df = fl.map(hitc_to_df_, item="hits")
494468

495469
deconv_params['psf_fname' ] = expandvars(deconv_params['psf_fname'])
496470
deconv_params['satellite_params'] = satellite_params
@@ -537,7 +511,6 @@ def beersheba( files_in : OneOrManyFiles
537511
correct_hits ,
538512
threshold_hits ,
539513
fl.branch(write_thr_hits) ,
540-
hitc_to_df ,
541514
cut_sensors ,
542515
drop_sensors ,
543516
filter_events_no_hits ,

0 commit comments

Comments
 (0)