Skip to content

Commit

Permalink
bug fic for mean_camera_display.py
Browse files Browse the repository at this point in the history
  • Loading branch information
hashkar committed Jun 21, 2023
1 parent ae1a052 commit 51fc818
Showing 1 changed file with 37 additions and 27 deletions.
64 changes: 37 additions & 27 deletions src/nectarchain/dqm/mean_camera_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ def ConfigureForRun(self, path, Chan, Samp, Reader1):
self.cmap = "gnuplot2"
self.cmap2 = "gnuplot2"

self.CameraAverage = []
self.CameraAverage_ped = []


def ProcessEvent(self, evt, noped):
self.pixelBAD = evt.mon.tel[0].pixel_status.hardware_failing_pixels
pixel = evt.nectarcam.tel[0].svc.pixel_ids
Expand All @@ -41,28 +45,31 @@ def ProcessEvent(self, evt, noped):

if evt.trigger.event_type.value == 32: #count peds
self.counter_ped += 1
else:
self.counter_evt += 1
self.CameraAverage_ped1 = (
evt.r0.tel[0].waveform[self.k].sum(axis=1))
self.CameraAverage_ped.append(self.CameraAverage_ped1[pixels])

if evt.trigger.event_type.value == 32: # only peds now
self.CameraAverage_ped += (
evt.r0.tel[0].waveform[self.k].sum(axis=1)
) # fill channels one by one and sum them for peds only
self.CameraAverage_ped = self.CameraAverage_ped[pixels]
else:
self.CameraAverage += (
evt.r0.tel[0].waveform[self.k].sum(axis=1)
) # fill channels one by one and sum them
self.CameraAverage = self.CameraAverage[pixels]
self.counter_evt += 1
self.CameraAverage1 = (
evt.r0.tel[0].waveform[self.k].sum(axis=1))
self.CameraAverage.append(self.CameraAverage1[pixels])

return None

def FinishRun(self):
self.CameraAverage_overEvents = self.CameraAverage / self.counter_evt
self.CameraAverage_overEvents_overSamp = (
self.CameraAverage_overEvents / self.Samp
)
if self.counter_evt > 0:
self.CameraAverage = np.array(self.CameraAverage)
self.CameraAverage = self.CameraAverage.sum(axis = 0)
self.CameraAverage_overEvents = (self.CameraAverage / self.counter_evt)

self.CameraAverage_overEvents_overSamp = (
self.CameraAverage_overEvents / self.Samp
)

if self.counter_ped > 0:
self.CameraAverage_ped = np.array(self.CameraAverage_ped)
self.CameraAverage_ped = self.CameraAverage_ped.sum(axis = 0)
self.CameraAverage_ped_overEvents = (
self.CameraAverage_ped / self.counter_ped
)
Expand All @@ -76,12 +83,14 @@ def GetResults(self):

# ASSIGN RESUTLS TO DICT
if self.k == 0:
# self.MeanCameraDisplay_Results_Dict[
# "CAMERA-AVERAGE-OverEVENTS-HIGH-GAIN"
# ] = self.CameraAverage_overEvents
self.MeanCameraDisplay_Results_Dict[
"CAMERA-AVERAGE-PHY-OverEVENTS-OverSamp-HIGH-GAIN"
] = self.CameraAverage_overEvents_overSamp

if self.counter_evt > 0:
# self.MeanCameraDisplay_Results_Dict[
# "CAMERA-AVERAGE-OverEVENTS-HIGH-GAIN"
# ] = self.CameraAverage_overEvents
self.MeanCameraDisplay_Results_Dict[
"CAMERA-AVERAGE-PHY-OverEVENTS-OverSamp-HIGH-GAIN"
] = self.CameraAverage_overEvents_overSamp

if self.counter_ped > 0:
# self.MeanCameraDisplay_Results_Dict[
Expand All @@ -92,12 +101,13 @@ def GetResults(self):
] = self.CameraAverage_ped_overEvents_overSamp

if self.k == 1:
# self.MeanCameraDisplay_Results_Dict[
# "CAMERA-AVERAGE-OverEVENTS-LOW-GAIN"
# ] = self.CameraAverage_overEvents
self.MeanCameraDisplay_Results_Dict[
"CAMERA-AVERAGE-PHY-OverEVENTS-OverSamp-LOW-GAIN"
] = self.CameraAverage_overEvents_overSamp
if self.counter_evt > 0:
# self.MeanCameraDisplay_Results_Dict[
# "CAMERA-AVERAGE-OverEVENTS-LOW-GAIN"
# ] = self.CameraAverage_overEvents
self.MeanCameraDisplay_Results_Dict[
"CAMERA-AVERAGE-PHY-OverEVENTS-OverSamp-LOW-GAIN"
] = self.CameraAverage_overEvents_overSamp

if self.counter_ped > 0:
# self.MeanCameraDisplay_Results_Dict[
Expand Down

0 comments on commit 51fc818

Please sign in to comment.