@@ -125,6 +125,10 @@ def finish_run(self):
125125 self .DrawerTemp22 = self .DrawerTemp21 [self .DrawerTimes_new < self .run_end ]
126126 self .DrawerNum2 = self .DrawerNum1 [self .DrawerTimes_new < self .run_end ]
127127
128+ self .DrawerTimes_run = self .DrawerTimes_new [
129+ self .DrawerTimes_new < self .run_end
130+ ]
131+
128132 TotalDrawers = np .max (self .DrawerNum2 )
129133
130134 for i in range (TotalDrawers + 1 ):
@@ -142,11 +146,27 @@ def finish_run(self):
142146 np .std (self .DrawerTemp22 [self .DrawerNum2 == i ])
143147 )
144148
149+ self .DrawerTemp1_trend = np .array (
150+ [
151+ self .DrawerTemp12 [self .DrawerNum2 == ii ]
152+ for ii in range (TotalDrawers + 1 )
153+ ]
154+ )
155+ self .DrawerTemp2_trend = np .array (
156+ [
157+ self .DrawerTemp22 [self .DrawerNum2 == ii ]
158+ for ii in range (TotalDrawers + 1 )
159+ ]
160+ )
145161 self .DrawerTemp1_mean = np .array (self .DrawerTemp1_mean )
146162 self .DrawerTemp2_mean = np .array (self .DrawerTemp2_mean )
147163 self .DrawerTemp1_std = np .array (self .DrawerTemp1_std )
148164 self .DrawerTemp2_std = np .array (self .DrawerTemp2_std )
149165
166+ self .DrawerTemp_trend = [
167+ (self .DrawerTemp1_trend [ii ] + self .DrawerTemp2_trend [ii ]) / 2.0
168+ for ii in range (TotalDrawers + 1 )
169+ ]
150170 self .DrawerTemp_mean = (self .DrawerTemp1_mean + self .DrawerTemp2_mean ) / 2
151171 # std of drawer temperatures as mean of std of temp FEB1 and temp FEB2
152172 self .DrawerTemp_std = (self .DrawerTemp1_std + self .DrawerTemp2_std ) / 2
@@ -162,9 +182,12 @@ def get_results(self):
162182 self .CameraMonitoring_Results_Dict [
163183 "CAMERA-TEMPERATURE-AVERAGE"
164184 ] = self .DrawerTemp_mean
165- self .CameraMonitoring_Results_Dict [
166- "CAMERA-TEMPERATURE-STD"
167- ] = self .DrawerTemp_std
185+ self .CameraMonitoring_Results_Dict ["CAMERA-TEMPERATURE-STD" ] = (
186+ self .DrawerTemp_std
187+ )
188+ self .CameraMonitoring_Results_Dict ["CAMERA-TEMPERATURE-TREND" ] = (
189+ self .DrawerTemp_trend
190+ )
168191 except Exception as err :
169192 log .error (
170193 f"Drawer temperature could not be retrieved. Received error "
@@ -275,6 +298,134 @@ def plot_results(self, name, fig_path):
275298
276299 plt .close ()
277300
301+ fig_trend , _ = plt .subplots ()
302+ for ii in range (len (self .DrawerTemp_trend )):
303+ plt .plot (
304+ self .DrawerTimes_run ,
305+ self .DrawerTemp_trend [ii ],
306+ label = f"Drawer { ii } " ,
307+ color = "blue" ,
308+ alpha = 0.5 ,
309+ )
310+ plt .xlabel ("Time" )
311+ plt .ylabel ("Temperature (°C)" )
312+ plt .title ("Camera temperature trend" )
313+ full_name = name + "_CameraTemperature_Trend.png"
314+ full_path = os .path .join (fig_path , full_name )
315+ self .ChargeInt_Figures_Dict ["CAMERA-TEMPERATURE-IMAGE-TREND" ] = fig_trend
316+ self .ChargeInt_Figures_Names_Dict [
317+ "CAMERA-TEMPERATURE-IMAGE-TREND"
318+ ] = full_path
319+
320+ plt .close ()
321+
322+ fig1_trend , _ = plt .subplots ()
323+ for ii in range (len (self .DrawerTemp1_trend )):
324+ plt .plot (
325+ self .DrawerTimes_run ,
326+ self .DrawerTemp1_trend [ii ],
327+ label = f"Drawer { ii } " ,
328+ color = "blue" ,
329+ alpha = 0.5 ,
330+ )
331+ plt .xlabel ("Time" )
332+ plt .ylabel ("Temperature (°C)" )
333+ plt .title ("Camera temperature trend 1" )
334+ full_name = name + "_CameraTemperature_Trend1.png"
335+ full_path = os .path .join (fig_path , full_name )
336+ self .ChargeInt_Figures_Dict ["CAMERA-TEMPERATURE-IMAGE-TREND-1" ] = fig1_trend
337+ self .ChargeInt_Figures_Names_Dict [
338+ "CAMERA-TEMPERATURE-IMAGE-TREND-1"
339+ ] = full_path
340+
341+ plt .close ()
342+
343+ fig2_trend , _ = plt .subplots ()
344+ for ii in range (len (self .DrawerTemp2_trend )):
345+ plt .plot (
346+ self .DrawerTimes_run ,
347+ self .DrawerTemp2_trend [ii ],
348+ label = f"Drawer { ii } " ,
349+ color = "blue" ,
350+ alpha = 0.5 ,
351+ )
352+ plt .xlabel ("Time" )
353+ plt .ylabel ("Temperature (°C)" )
354+ plt .title ("Camera temperature trend 2" )
355+ full_name = name + "_CameraTemperature_Trend2.png"
356+ full_path = os .path .join (fig_path , full_name )
357+ self .ChargeInt_Figures_Dict ["CAMERA-TEMPERATURE-IMAGE-TREND-2" ] = fig2_trend
358+ self .ChargeInt_Figures_Names_Dict [
359+ "CAMERA-TEMPERATURE-IMAGE-TREND-2"
360+ ] = full_path
361+
362+ plt .close ()
363+
364+ plt .close ()
365+
366+ fig_trend , _ = plt .subplots ()
367+ for ii in range (len (self .DrawerTemp_trend )):
368+ plt .plot (
369+ self .DrawerTimes_run ,
370+ self .DrawerTemp_trend [ii ],
371+ label = f"Drawer { ii } " ,
372+ color = "blue" ,
373+ alpha = 0.5 ,
374+ )
375+ plt .xlabel ("Time" )
376+ plt .ylabel ("Temperature (°C)" )
377+ plt .title ("Camera temperature trend" )
378+ full_name = name + "_CameraTemperature_Trend.png"
379+ full_path = os .path .join (fig_path , full_name )
380+ self .ChargeInt_Figures_Dict ["CAMERA-TEMPERATURE-IMAGE-TREND" ] = fig_trend
381+ self .ChargeInt_Figures_Names_Dict [
382+ "CAMERA-TEMPERATURE-IMAGE-TREND"
383+ ] = full_path
384+
385+ plt .close ()
386+
387+ fig1_trend , _ = plt .subplots ()
388+ for ii in range (len (self .DrawerTemp1_trend )):
389+ plt .plot (
390+ self .DrawerTimes_run ,
391+ self .DrawerTemp1_trend [ii ],
392+ label = f"Drawer { ii } " ,
393+ color = "blue" ,
394+ alpha = 0.5 ,
395+ )
396+ plt .xlabel ("Time" )
397+ plt .ylabel ("Temperature (°C)" )
398+ plt .title ("Camera temperature trend 1" )
399+ full_name = name + "_CameraTemperature_Trend1.png"
400+ full_path = os .path .join (fig_path , full_name )
401+ self .ChargeInt_Figures_Dict ["CAMERA-TEMPERATURE-IMAGE-TREND-1" ] = fig1_trend
402+ self .ChargeInt_Figures_Names_Dict [
403+ "CAMERA-TEMPERATURE-IMAGE-TREND-1"
404+ ] = full_path
405+
406+ plt .close ()
407+
408+ fig2_trend , _ = plt .subplots ()
409+ for ii in range (len (self .DrawerTemp2_trend )):
410+ plt .plot (
411+ self .DrawerTimes_run ,
412+ self .DrawerTemp2_trend [ii ],
413+ label = f"Drawer { ii } " ,
414+ color = "blue" ,
415+ alpha = 0.5 ,
416+ )
417+ plt .xlabel ("Time" )
418+ plt .ylabel ("Temperature (°C)" )
419+ plt .title ("Camera temperature trend 2" )
420+ full_name = name + "_CameraTemperature_Trend2.png"
421+ full_path = os .path .join (fig_path , full_name )
422+ self .ChargeInt_Figures_Dict ["CAMERA-TEMPERATURE-IMAGE-TREND-2" ] = fig2_trend
423+ self .ChargeInt_Figures_Names_Dict [
424+ "CAMERA-TEMPERATURE-IMAGE-TREND-2"
425+ ] = full_path
426+
427+ plt .close ()
428+
278429 except Exception as err :
279430 log .error (f"Received error code: { err } " )
280431
0 commit comments