Commit 4cdba28d authored by Pierre Aubert's avatar Pierre Aubert
Browse files

Add plotter for R0 gain and pedestal info

parent 13ef6338
Pipeline #109649 canceled with stage
...@@ -27,6 +27,7 @@ def plotCalibEvent(pdf, tabImage, varName, nbbin): ...@@ -27,6 +27,7 @@ def plotCalibEvent(pdf, tabImage, varName, nbbin):
plt.ylabel("nb") plt.ylabel("nb")
plt.yscale("log") plt.yscale("log")
plt.grid() plt.grid()
plt.text(0.05, 0.95, strValue, transform=fig.transFigure, size=14)
pdf.savefig() # saves the current figure into a pdf page pdf.savefig() # saves the current figure into a pdf page
plt.close() plt.close()
except KeyError: except KeyError:
......
"""
Author : Pierre Aubert
Mail : aubertp7@gmail.com
Licence : CeCILL-C
"""
import os
import tables
import argparse
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
def plotTable(pdf, tabValue, varName, nbbin):
fig = plt.figure(figsize=(16, 10))
strValue = varName + ", size = " + str(tabValue.size) + ", Min : " + str(tabValue.min()) + ", max : " + str(tabValue.max()) + ", mean : " + str(tabValue.mean()) + ", std : " + str(tabValue.std())
print(strValue)
plt.hist(tabValue, bins=nbbin, alpha=1.0)
plt.xlabel(varName)
plt.title("Signal "+varName)
plt.ylabel("nb")
plt.yscale("log")
plt.grid()
plt.text(0.05, 0.95, strValue, transform=fig.transFigure, size=14)
pdf.savefig() # saves the current figure into a pdf page
plt.close()
def processAllFile(outputPlotFile, inputFile, nbBin):
'''
List of the input files
Parameters:
outputPlotFile : name of the output plot
inputFile : input file
nbBin : number of bins of the plot
'''
hfile = tables.open_file(inputFile, mode="r")
tabGain = hfile.root.r0.monitoring.telescope.gain.tel_001.read()
tabPed = hfile.root.r0.monitoring.telescope.pedestal.tel_001.col("pedestal")[0]
with PdfPages(outputPlotFile) as pdf:
plotTable(pdf, tabGain[0], "high gain", nbBin)
plotTable(pdf, tabGain[1], "low gain", nbBin)
plotTable(pdf, tabPed[0], "high pedestal", nbBin)
plotTable(pdf, tabPed[1], "low pedestal", nbBin)
def main():
parser = argparse.ArgumentParser()
parser.add_argument('-i', '--input', type=str, dest='input_file', help="input HDF5 DL1 file", required=True)
parser.add_argument('-o', '--output', type=str, dest='output', help="output DL1 plot", default='output_dl1_plot.pdf')
parser.add_argument('-b', '--nbbin', type=int, dest='nb_bin', help="number of bins of the plot", default=100)
args = parser.parse_args()
processAllFile(args.output, args.input_file, args.nb_bin)
if __name__ == '__main__':
main()
...@@ -9,7 +9,8 @@ entry_points = { ...@@ -9,7 +9,8 @@ entry_points = {
'stream_get_zfits_pix_order = hiperta_stream.get_zfits_pixel_order:main', 'stream_get_zfits_pix_order = hiperta_stream.get_zfits_pixel_order:main',
'stream_create_base_config = hiperta_stream.create_base_hdf5_config_structure_for_hiperta_stream:main', 'stream_create_base_config = hiperta_stream.create_base_hdf5_config_structure_for_hiperta_stream:main',
'stream_log_summary = hiperta_stream.create_log_summary:main', 'stream_log_summary = hiperta_stream.create_log_summary:main',
'stream_plot_dl1 = hiperta_stream.stream_plot_dl1:main' 'stream_plot_dl1 = hiperta_stream.stream_plot_dl1:main',
'stream_plot_r0_calib = hiperta_stream.stream_plot_r0_calib:main'
]} ]}
setup( setup(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment