RNO-G / mattak

RNO-G dataformats
1 stars 1 forks source link

Add interface function #10

Closed fschlueter closed 1 year ago

fschlueter commented 1 year ago

Allows a similar interface to d.wfs():

d.setEntries((0, d.N()))
wfs = d.get_selected_wfs(tigger_filter)
fschlueter commented 1 year ago

Uh, I think this PR contains #9 ... so maybe we merge that first.

fschlueter commented 1 year ago

@cozzyd, I was thinking it is probably better to do this:

    def get_selected_wfs(self, selector: Callable[[EventInfo], bool], calibrated : bool = False) -> Optional[numpy.ndarray]:
         """ Convenience interface to use selector """
         return numpy.array([wf for _, wf in self.iterate(start=self.start, stop=self.stop, selector=selector)])

(adding explicit start and stop). Or what do you think? Is there a better way to implement such an interface which does not need to use iterate?

fschlueter commented 1 year ago

I only committed what I have suggested in the comment before