Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pixel participation #81

Merged
merged 9 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/nectarchain/dqm/camera_monitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
self.Pix = Pix
self.Samp = Samp

self.camera = CameraGeometry.from_name("NectarCam-003").transform_to(
self.camera = Reader1.subarray.tel[0].camera.geometry.transform_to(

Check warning on line 21 in src/nectarchain/dqm/camera_monitoring.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/camera_monitoring.py#L21

Added line #L21 was not covered by tests
EngineeringCameraFrame()
)
self.cmap = "gnuplot2"
Expand Down
3 changes: 2 additions & 1 deletion src/nectarchain/dqm/charge_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
self.counter_evt = 0
self.counter_ped = 0

self.camera = CameraGeometry.from_name("NectarCam-003").transform_to(
self.camera = Reader1.subarray.tel[0].camera.geometry.transform_to(

Check warning on line 23 in src/nectarchain/dqm/charge_integration.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/charge_integration.py#L23

Added line #L23 was not covered by tests
EngineeringCameraFrame()
)

self.cmap = "gnuplot2"

self.subarray = Reader1.subarray
Expand Down
21 changes: 17 additions & 4 deletions src/nectarchain/dqm/dqm_summary_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,12 @@
def WriteAllResults(self, path, DICT):
data2 = Table()
data1 = Table()
data0 = Table()

Check warning on line 39 in src/nectarchain/dqm/dqm_summary_processor.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/dqm_summary_processor.py#L39

Added line #L39 was not covered by tests
data = Table()
hdu, hdu1, hdu2 = None, None, None
hdu, hdu0, hdu1, hdu2 = None, None, None, None

Check warning on line 41 in src/nectarchain/dqm/dqm_summary_processor.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/dqm_summary_processor.py#L41

Added line #L41 was not covered by tests
hdulist = fits.HDUList()
for i, j in DICT.items():
if i == "Results_TriggerStatistics":
if (i == "Results_TriggerStatistics"):

Check warning on line 44 in src/nectarchain/dqm/dqm_summary_processor.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/dqm_summary_processor.py#L44

Added line #L44 was not covered by tests
for n2, m2 in j.items():
data2[n2] = m2
hdu2 = fits.BinTableHDU(data2)
Expand All @@ -52,7 +53,13 @@
for n1, m1 in j.items():
data1[n1] = m1
hdu1 = fits.BinTableHDU(data1)
hdu1.name = "MWF"
hdu1.name = "MWF"

Check warning on line 56 in src/nectarchain/dqm/dqm_summary_processor.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/dqm_summary_processor.py#L56

Added line #L56 was not covered by tests

elif (i == "Results_PixelTimeline_HighGain") or (i == "Results_PixelTimeline_LowGain"):
for n0, m0 in j.items():
data0[n0] = m0
hdu0 = fits.BinTableHDU(data0)
hdu0.name = "BPX"

Check warning on line 62 in src/nectarchain/dqm/dqm_summary_processor.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/dqm_summary_processor.py#L58-L62

Added lines #L58 - L62 were not covered by tests

else:
for n, m in j.items():
Expand All @@ -67,11 +74,17 @@
hdulist.append(hdu1)
else:
print("No MWF studies requests")
if hdu0:
hdulist.append(hdu0)

Check warning on line 78 in src/nectarchain/dqm/dqm_summary_processor.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/dqm_summary_processor.py#L77-L78

Added lines #L77 - L78 were not covered by tests
else:
print("No Pixel Timeline studies requests")

Check warning on line 80 in src/nectarchain/dqm/dqm_summary_processor.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/dqm_summary_processor.py#L80

Added line #L80 was not covered by tests
if hdu:
hdulist.append(hdu)
else:
print("No Camera studies requests")
FileName = path + "_Results.fits"


FileName = path + '_Results.fits'

Check warning on line 87 in src/nectarchain/dqm/dqm_summary_processor.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/dqm_summary_processor.py#L87

Added line #L87 was not covered by tests
print(FileName)
hdulist.writeto(FileName, overwrite=True)
return None
148 changes: 148 additions & 0 deletions src/nectarchain/dqm/pixel_participation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
from dqm_summary_processor import DQMSummary
from matplotlib import pyplot as plt
from ctapipe.visualization import CameraDisplay
from ctapipe.instrument import CameraGeometry
from ctapipe.coordinates import EngineeringCameraFrame
import numpy as np

Check warning on line 6 in src/nectarchain/dqm/pixel_participation.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_participation.py#L1-L6

Added lines #L1 - L6 were not covered by tests


class PixelParticipation_HighLowGain(DQMSummary):
def __init__(self, gaink):
self.k = gaink
return None

Check warning on line 12 in src/nectarchain/dqm/pixel_participation.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_participation.py#L9-L12

Added lines #L9 - L12 were not covered by tests
jlenain marked this conversation as resolved.
Show resolved Hide resolved

def ConfigureForRun(self, path, Pix, Samp, Reader1):

Check warning on line 14 in src/nectarchain/dqm/pixel_participation.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_participation.py#L14

Added line #L14 was not covered by tests
# define number of pixels and samples
self.Pix = Pix
self.Samp = Samp

Check warning on line 17 in src/nectarchain/dqm/pixel_participation.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_participation.py#L16-L17

Added lines #L16 - L17 were not covered by tests

self.counter_evt = 0
self.counter_ped = 0

Check warning on line 20 in src/nectarchain/dqm/pixel_participation.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_participation.py#L19-L20

Added lines #L19 - L20 were not covered by tests

self.camera = CameraGeometry.from_name("NectarCam-003").transform_to(EngineeringCameraFrame())
jlenain marked this conversation as resolved.
Show resolved Hide resolved
self.camera2 = CameraGeometry.from_name("NectarCam-003").transform_to(EngineeringCameraFrame())

Check warning on line 23 in src/nectarchain/dqm/pixel_participation.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_participation.py#L22-L23

Added lines #L22 - L23 were not covered by tests

self.cmap = "gnuplot2"
self.cmap2 = "gnuplot2"

Check warning on line 26 in src/nectarchain/dqm/pixel_participation.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_participation.py#L25-L26

Added lines #L25 - L26 were not covered by tests


self.BadPixels_ped = np.zeros(self.Pix)
jlenain marked this conversation as resolved.
Show resolved Hide resolved
self.BadPixels = np.zeros(self.Pix)

Check warning on line 30 in src/nectarchain/dqm/pixel_participation.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_participation.py#L29-L30

Added lines #L29 - L30 were not covered by tests

def ProcessEvent(self, evt, noped):
pixelBAD = evt.mon.tel[0].pixel_status.hardware_failing_pixels[self.k]
pixel = evt.nectarcam.tel[0].svc.pixel_ids
if len(pixel) < self.Pix:
pixel21 = list(np.arange(0, self.Pix - len(pixel), 1, dtype=int))
pixel = list(pixel)
pixels = np.concatenate([pixel21, pixel])

Check warning on line 38 in src/nectarchain/dqm/pixel_participation.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_participation.py#L32-L38

Added lines #L32 - L38 were not covered by tests
else:
pixels = pixel

Check warning on line 40 in src/nectarchain/dqm/pixel_participation.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_participation.py#L40

Added line #L40 was not covered by tests

if evt.trigger.event_type.value == 32: # count peds
self.counter_ped += 1
BadPixels_ped1 = list(map(int, pixelBAD[pixels]))
self.BadPixels_ped += BadPixels_ped1

Check warning on line 45 in src/nectarchain/dqm/pixel_participation.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_participation.py#L42-L45

Added lines #L42 - L45 were not covered by tests

else:
self.counter_evt += 1
BadPixels1 = list(map(int, pixelBAD[pixels]))
self.BadPixels += BadPixels1
return None

Check warning on line 51 in src/nectarchain/dqm/pixel_participation.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_participation.py#L48-L51

Added lines #L48 - L51 were not covered by tests

def FinishRun(self):
self.BadPixels_ped = np.array(self.BadPixels_ped)
self.BadPixels = np.array(self.BadPixels)

Check warning on line 55 in src/nectarchain/dqm/pixel_participation.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_participation.py#L53-L55

Added lines #L53 - L55 were not covered by tests



def GetResults(self):

Check warning on line 59 in src/nectarchain/dqm/pixel_participation.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_participation.py#L59

Added line #L59 was not covered by tests
jlenain marked this conversation as resolved.
Show resolved Hide resolved
# INITIATE DICT
self.PixelParticipation_Results_Dict = {}

Check warning on line 61 in src/nectarchain/dqm/pixel_participation.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_participation.py#L61

Added line #L61 was not covered by tests

# ASSIGN RESUTLS TO DICT
if self.k == 0:

Check warning on line 64 in src/nectarchain/dqm/pixel_participation.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_participation.py#L64

Added line #L64 was not covered by tests

if self.counter_evt > 0:
self.PixelParticipation_Results_Dict[

Check warning on line 67 in src/nectarchain/dqm/pixel_participation.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_participation.py#L66-L67

Added lines #L66 - L67 were not covered by tests
"CAMERA-BadPix-PHY-OverEVENTS-HIGH-GAIN"
] = self.BadPixels

if self.counter_ped > 0:
self.PixelParticipation_Results_Dict[

Check warning on line 72 in src/nectarchain/dqm/pixel_participation.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_participation.py#L71-L72

Added lines #L71 - L72 were not covered by tests
"CAMERA-BadPix-PED-PHY-OverEVENTS-HIGH-GAIN"
] = self.BadPixels_ped

if self.k == 1:
if self.counter_evt > 0:
self.PixelParticipation_Results_Dict[

Check warning on line 78 in src/nectarchain/dqm/pixel_participation.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_participation.py#L76-L78

Added lines #L76 - L78 were not covered by tests
"CAMERA-BadPix-PHY-OverEVENTS-LOW-GAIN"
] = self.BadPixels

if self.counter_ped > 0:
self.PixelParticipation_Results_Dict[

Check warning on line 83 in src/nectarchain/dqm/pixel_participation.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_participation.py#L82-L83

Added lines #L82 - L83 were not covered by tests
"CAMERA-BadPix-PED-PHY-OverEVENTS-LOW-GAIN"
] = self.BadPixels_ped

return self.PixelParticipation_Results_Dict

Check warning on line 87 in src/nectarchain/dqm/pixel_participation.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_participation.py#L87

Added line #L87 was not covered by tests

def PlotResults(self, name, FigPath):
self.PixelParticipation_Figures_Dict = {}
self.PixelParticipation_Figures_Names_Dict = {}

Check warning on line 91 in src/nectarchain/dqm/pixel_participation.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_participation.py#L89-L91

Added lines #L89 - L91 were not covered by tests

# titles = ['All', 'Pedestals']
if self.k == 0:
gain_c = "High"
if self.k == 1:
gain_c = "Low"

Check warning on line 97 in src/nectarchain/dqm/pixel_participation.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_participation.py#L94-L97

Added lines #L94 - L97 were not covered by tests

if self.counter_evt > 0:
fig1, self.disp1 = plt.subplots()
self.disp1 = CameraDisplay(

Check warning on line 101 in src/nectarchain/dqm/pixel_participation.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_participation.py#L99-L101

Added lines #L99 - L101 were not covered by tests
geometry=self.camera,
image=self.BadPixels,
cmap=self.cmap,
)
self.disp1.cmap = self.cmap
self.disp1.cmap = plt.cm.coolwarm
self.disp1.add_colorbar()
self.disp1.axes.text(2.0, 0, "Bad Pixels", rotation=90)
plt.title("Camera BPX %s gain (ALL)" % gain_c)

Check warning on line 110 in src/nectarchain/dqm/pixel_participation.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_participation.py#L106-L110

Added lines #L106 - L110 were not covered by tests

self.PixelParticipation_Figures_Dict[

Check warning on line 112 in src/nectarchain/dqm/pixel_participation.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_participation.py#L112

Added line #L112 was not covered by tests
"CAMERA-BADPIX-PHY-DISPLAY-%s-GAIN" % gain_c
] = fig1
full_name = name + "_Camera_BPX_%sGain.png" % gain_c
FullPath = FigPath + full_name
self.PixelParticipation_Figures_Names_Dict[

Check warning on line 117 in src/nectarchain/dqm/pixel_participation.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_participation.py#L115-L117

Added lines #L115 - L117 were not covered by tests
"CAMERA-BADPIX-PHY-DISPLAY-%s-GAIN" % gain_c
] = FullPath
plt.close()

Check warning on line 120 in src/nectarchain/dqm/pixel_participation.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_participation.py#L120

Added line #L120 was not covered by tests

if self.counter_ped > 0:
fig2, self.disp2 = plt.subplots()
jlenain marked this conversation as resolved.
Show resolved Hide resolved
self.disp2 = CameraDisplay(

Check warning on line 124 in src/nectarchain/dqm/pixel_participation.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_participation.py#L122-L124

Added lines #L122 - L124 were not covered by tests
geometry=self.camera2,
image=self.BadPixels_ped,
cmap=self.cmap2,
)
self.disp2.cmap = self.cmap2
self.disp2.cmap = plt.cm.coolwarm
self.disp2.add_colorbar()
self.disp2.axes.text(2.0, 0, "Bad Pixels", rotation=90)
plt.title("Camera BPX %s gain (PED)" % gain_c)

Check warning on line 133 in src/nectarchain/dqm/pixel_participation.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_participation.py#L129-L133

Added lines #L129 - L133 were not covered by tests

self.PixelParticipation_Figures_Dict[

Check warning on line 135 in src/nectarchain/dqm/pixel_participation.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_participation.py#L135

Added line #L135 was not covered by tests
"CAMERA-BADPIX-PED-DISPLAY-%s-GAIN" % gain_c
] = fig2
full_name = name + "_Pedestal_BPX_%sGain.png" % gain_c
FullPath = FigPath + full_name
self.PixelParticipation_Figures_Names_Dict[

Check warning on line 140 in src/nectarchain/dqm/pixel_participation.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_participation.py#L138-L140

Added lines #L138 - L140 were not covered by tests
"CAMERA-BADPIX-PED-DISPLAY-%s-GAIN" % gain_c
] = FullPath
plt.close()

Check warning on line 143 in src/nectarchain/dqm/pixel_participation.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_participation.py#L143

Added line #L143 was not covered by tests

return (

Check warning on line 145 in src/nectarchain/dqm/pixel_participation.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_participation.py#L145

Added line #L145 was not covered by tests
self.PixelParticipation_Figures_Dict,
self.PixelParticipation_Figures_Names_Dict,
)
155 changes: 155 additions & 0 deletions src/nectarchain/dqm/pixel_timeline.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
from dqm_summary_processor import DQMSummary
from matplotlib import pyplot as plt
from ctapipe.visualization import CameraDisplay
from ctapipe.instrument import CameraGeometry
from ctapipe.coordinates import EngineeringCameraFrame
import numpy as np

Check warning on line 6 in src/nectarchain/dqm/pixel_timeline.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_timeline.py#L1-L6

Added lines #L1 - L6 were not covered by tests


class PixelTimeline_HighLowGain(DQMSummary):
jlenain marked this conversation as resolved.
Show resolved Hide resolved
def __init__(self, gaink):
self.k = gaink
return None

Check warning on line 12 in src/nectarchain/dqm/pixel_timeline.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_timeline.py#L9-L12

Added lines #L9 - L12 were not covered by tests
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

__init__ should not return anything.


def ConfigureForRun(self, path, Pix, Samp, Reader1):

Check warning on line 14 in src/nectarchain/dqm/pixel_timeline.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_timeline.py#L14

Added line #L14 was not covered by tests
# define number of pixels and samples
self.Pix = Pix
jlenain marked this conversation as resolved.
Show resolved Hide resolved
jlenain marked this conversation as resolved.
Show resolved Hide resolved
self.Samp = Samp

Check warning on line 17 in src/nectarchain/dqm/pixel_timeline.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_timeline.py#L16-L17

Added lines #L16 - L17 were not covered by tests


self.counter_evt = 0
jlenain marked this conversation as resolved.
Show resolved Hide resolved
self.counter_ped = 0

Check warning on line 21 in src/nectarchain/dqm/pixel_timeline.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_timeline.py#L20-L21

Added lines #L20 - L21 were not covered by tests

self.camera = CameraGeometry.from_name("NectarCam-003").transform_to(EngineeringCameraFrame())
jlenain marked this conversation as resolved.
Show resolved Hide resolved
self.camera2 = CameraGeometry.from_name("NectarCam-003").transform_to(EngineeringCameraFrame())

Check warning on line 24 in src/nectarchain/dqm/pixel_timeline.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_timeline.py#L23-L24

Added lines #L23 - L24 were not covered by tests

self.cmap = "gnuplot2"
self.cmap2 = "gnuplot2"

Check warning on line 27 in src/nectarchain/dqm/pixel_timeline.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_timeline.py#L26-L27

Added lines #L26 - L27 were not covered by tests


self.SumBadPixels_ped = []
self.SumBadPixels = []

Check warning on line 31 in src/nectarchain/dqm/pixel_timeline.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_timeline.py#L30-L31

Added lines #L30 - L31 were not covered by tests

def ProcessEvent(self, evt, noped):
pixelBAD = evt.mon.tel[0].pixel_status.hardware_failing_pixels[self.k]
pixel = evt.nectarcam.tel[0].svc.pixel_ids
if len(pixel) < self.Pix:
pixel21 = list(np.arange(0, self.Pix - len(pixel), 1, dtype=int))
pixel = list(pixel)
pixels = np.concatenate([pixel21, pixel])

Check warning on line 39 in src/nectarchain/dqm/pixel_timeline.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_timeline.py#L33-L39

Added lines #L33 - L39 were not covered by tests
else:
pixels = pixel

Check warning on line 41 in src/nectarchain/dqm/pixel_timeline.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_timeline.py#L41

Added line #L41 was not covered by tests

if evt.trigger.event_type.value == 32: # count peds
self.counter_ped += 1
self.counter_evt += 1
BadPixels_ped1 = list(map(int, pixelBAD[pixels]))
SumBadPixelsEvent_ped = sum(BadPixels_ped1)
self.SumBadPixels_ped.append(SumBadPixelsEvent_ped)
self.SumBadPixels.append(0)

Check warning on line 49 in src/nectarchain/dqm/pixel_timeline.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_timeline.py#L43-L49

Added lines #L43 - L49 were not covered by tests

else:
self.counter_evt += 1
self.counter_ped += 1
BadPixels1 = list(map(int, pixelBAD[pixels]))
SumBadPixelsEvent = sum(BadPixels1)
self.SumBadPixels.append(SumBadPixelsEvent)
self.SumBadPixels_ped.append(0)

Check warning on line 57 in src/nectarchain/dqm/pixel_timeline.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_timeline.py#L52-L57

Added lines #L52 - L57 were not covered by tests

return None

Check warning on line 59 in src/nectarchain/dqm/pixel_timeline.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_timeline.py#L59

Added line #L59 was not covered by tests

def FinishRun(self):

Check warning on line 61 in src/nectarchain/dqm/pixel_timeline.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_timeline.py#L61

Added line #L61 was not covered by tests

self.BadPixelTimeline_ped = np.array(self.SumBadPixels_ped, dtype=float)/self.Pix
self.BadPixelTimeline = np.array(self.SumBadPixels, dtype=float)/self.Pix
print(self.BadPixelTimeline)
print( self.BadPixelTimeline_ped)

Check warning on line 66 in src/nectarchain/dqm/pixel_timeline.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_timeline.py#L63-L66

Added lines #L63 - L66 were not covered by tests




def GetResults(self):

Check warning on line 71 in src/nectarchain/dqm/pixel_timeline.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_timeline.py#L71

Added line #L71 was not covered by tests
# INITIATE DICT
self.PixelTimeline_Results_Dict = {}

Check warning on line 73 in src/nectarchain/dqm/pixel_timeline.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_timeline.py#L73

Added line #L73 was not covered by tests

# ASSIGN RESUTLS TO DICT
if self.k == 0:

Check warning on line 76 in src/nectarchain/dqm/pixel_timeline.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_timeline.py#L76

Added line #L76 was not covered by tests

if self.counter_evt > 0:
self.PixelTimeline_Results_Dict[

Check warning on line 79 in src/nectarchain/dqm/pixel_timeline.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_timeline.py#L78-L79

Added lines #L78 - L79 were not covered by tests
"CAMERA-BadPixTimeline-PHY-HIGH-GAIN"
] = self.BadPixelTimeline


if self.counter_ped > 0:
self.PixelTimeline_Results_Dict[

Check warning on line 85 in src/nectarchain/dqm/pixel_timeline.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_timeline.py#L84-L85

Added lines #L84 - L85 were not covered by tests
"CAMERA-BadPixTimeline-PED-HIGH-GAIN"
] = self.BadPixelTimeline_ped


if self.k == 1:
if self.counter_evt > 0:
self.PixelTimeline_Results_Dict[

Check warning on line 92 in src/nectarchain/dqm/pixel_timeline.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_timeline.py#L90-L92

Added lines #L90 - L92 were not covered by tests
"CAMERA-BadPixTimeline-PHY-LOW-GAIN"
] = self.BadPixelTimeline

if self.counter_ped > 0:
self.PixelTimeline_Results_Dict[

Check warning on line 97 in src/nectarchain/dqm/pixel_timeline.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_timeline.py#L96-L97

Added lines #L96 - L97 were not covered by tests
"CAMERA-BadPixTimeline-PED-LOW-GAIN"
] = self.BadPixelTimeline_ped


return self.PixelTimeline_Results_Dict

Check warning on line 102 in src/nectarchain/dqm/pixel_timeline.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_timeline.py#L102

Added line #L102 was not covered by tests

def PlotResults(self, name, FigPath):
self.PixelTimeline_Figures_Dict = {}
self.PixelTimeline_Figures_Names_Dict = {}

Check warning on line 106 in src/nectarchain/dqm/pixel_timeline.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_timeline.py#L104-L106

Added lines #L104 - L106 were not covered by tests

# titles = ['All', 'Pedestals']
if self.k == 0:
gain_c = "High"
if self.k == 1:
gain_c = "Low"

Check warning on line 112 in src/nectarchain/dqm/pixel_timeline.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_timeline.py#L109-L112

Added lines #L109 - L112 were not covered by tests

if self.counter_evt > 0:
fig1, disp = plt.subplots()
plt.plot(np.arange(self.counter_evt), self.BadPixelTimeline*100, label = "Physical events")
plt.legend()
plt.xlabel("Timeline")
plt.ylabel("BPX fraction (%)")
plt.title("BPX Timeline %s gain (ALL)" % gain_c)

Check warning on line 120 in src/nectarchain/dqm/pixel_timeline.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_timeline.py#L114-L120

Added lines #L114 - L120 were not covered by tests

full_name = name + "_BPX_Timeline_%sGain_All.png" % gain_c
FullPath = FigPath + full_name
self.PixelTimeline_Figures_Dict[

Check warning on line 124 in src/nectarchain/dqm/pixel_timeline.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_timeline.py#L122-L124

Added lines #L122 - L124 were not covered by tests
"BPX-TIMELINE-ALL-%s-GAIN" % gain_c
] = fig1
self.PixelTimeline_Figures_Names_Dict[

Check warning on line 127 in src/nectarchain/dqm/pixel_timeline.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_timeline.py#L127

Added line #L127 was not covered by tests
"BPX-TIMELINE-ALL-%s-GAIN" % gain_c
] = FullPath

plt.close()

Check warning on line 131 in src/nectarchain/dqm/pixel_timeline.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_timeline.py#L131

Added line #L131 was not covered by tests

if self.counter_ped > 0:
fig2, disp = plt.subplots()
plt.plot(np.arange(self.counter_ped), self.BadPixelTimeline_ped*100, label = "Pedestal events")
plt.legend()
plt.xlabel("Timeline")
plt.ylabel("BPX fraction (%)")
plt.title("BPX Timeline %s gain (PED)" % gain_c)

Check warning on line 139 in src/nectarchain/dqm/pixel_timeline.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_timeline.py#L133-L139

Added lines #L133 - L139 were not covered by tests

full_name = name + "_BPX_Timeline_%sGain_Ped.png" % gain_c
FullPath = FigPath + full_name
self.PixelTimeline_Figures_Dict[

Check warning on line 143 in src/nectarchain/dqm/pixel_timeline.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_timeline.py#L141-L143

Added lines #L141 - L143 were not covered by tests
"BPX-TIMELINE-PED-%s-GAIN" % gain_c
] = fig2
self.PixelTimeline_Figures_Names_Dict[

Check warning on line 146 in src/nectarchain/dqm/pixel_timeline.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_timeline.py#L146

Added line #L146 was not covered by tests
"BPX-TIMELINE-PED-%s-GAIN" % gain_c
] = FullPath

plt.close()

Check warning on line 150 in src/nectarchain/dqm/pixel_timeline.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_timeline.py#L150

Added line #L150 was not covered by tests

return (

Check warning on line 152 in src/nectarchain/dqm/pixel_timeline.py

View check run for this annotation

Codecov / codecov/patch

src/nectarchain/dqm/pixel_timeline.py#L152

Added line #L152 was not covered by tests
self.PixelTimeline_Figures_Dict,
self.PixelTimeline_Figures_Names_Dict,
)
Loading