From 0a42f251ee9a09d629229391403ef7fda73a1e9f Mon Sep 17 00:00:00 2001 From: Yoann Kermaidic Date: Thu, 9 Dec 2021 15:50:18 +0100 Subject: [PATCH 1/4] Plotting options update --- analysis_parameters.py | 36 +++++---- lardon.py | 22 +++--- plotting/noise.py | 8 +- settings/analysis_parameters.json | 118 +++++++++++++++--------------- 4 files changed, 100 insertions(+), 84 deletions(-) diff --git a/analysis_parameters.py b/analysis_parameters.py index 414c4e3..5b185b7 100644 --- a/analysis_parameters.py +++ b/analysis_parameters.py @@ -15,6 +15,7 @@ def __init__(self): self.noise_coh_group = [32] # coherent noise channel grouping + self.noise_fft_store = 0 # store FFT spectrum (large file!!) self.noise_fft_freq = -1 # specific frequency removal (-1 is none) self.noise_fft_lcut = 0.6 # low-pass filter frequency cut @@ -37,14 +38,18 @@ def __init__(self): self.trk3D_len_min = 2. #min trk length to be considered in matching self.trk3D_dtol = 0.5 #distance tolerance to detector boundaries for timing computation - self.plt_noise_show = 0 + self.plt_noise_show = 0 # 0: do not plot - 1 plot before/after CNR - 2 before CNR - 3 after CNR + self.plt_corr_daq_show = 0 + self.plt_corr_glb_show = 0 self.plt_evt_disp_daq_show = 0 - self.plt_evt_disp_vch_show = 0 + self.plt_evt_disp_vch_show = 0 # 0: do not plot - 1 plot before/after CNR - 2 before CNR - 3 after CNR - self.plt_noise_zrange= [0,900] # color scale for noise plots - self.plt_evt_disp_daq_zrange = [-1000,1000] # color scale for DAQ channels event display plots - self.plt_evt_disp_vch_ind_zrange = [-100,100] # color scale for induction view event display plots - self.plt_evt_disp_vch_col_zrange = [-50,50] # color scale for collection view event display plots + self.plt_noise_zrange = [0,900] # color scale for noise plots + self.plt_corr_daq_zrange = [-1,1] # color scale daq-wise correlation plot + self.plt_corr_glb_zrange = [-1,1] # color scale view-wise correlation plot + self.plt_evt_disp_daq_zrange = [-1000,1000] # color scale for DAQ channels event display plots + self.plt_evt_disp_vch_ind_zrange = [-100,100] # color scale for induction view event display plots + self.plt_evt_disp_vch_col_zrange = [-50,50] # color scale for collection view event display plots def read(self,elec="top",config="1"): with open('settings/analysis_parameters.json','r') as f: @@ -64,6 +69,7 @@ def read(self,elec="top",config="1"): self.ped_zero_cross_thr = data[config][elec]['pedestal']['zero_cross_thr'] self.noise_coh_group = data[config][elec]['noise']['coherent']['groupings'] + self.noise_fft_store = data[config][elec]['noise']['fft']['store'] self.noise_fft_freq = data[config][elec]['noise']['fft']['freq'] self.noise_fft_lcut = data[config][elec]['noise']['fft']['low_cut'] @@ -88,13 +94,17 @@ def read(self,elec="top",config="1"): self.trk3D_dtol = data[config][elec]['track_3d']['d_tol'] - self.plt_noise_show = data[config][elec]['plot']['noise']['show'] - self.plt_noise_zrange = data[config][elec]['plot']['noise']['zrange'] - self.plt_evt_disp_daq_show = data[config][elec]['plot']['evt_display']['daqch']['show'] - self.plt_evt_disp_daq_zrange = data[config][elec]['plot']['evt_display']['daqch']['zrange'] - self.plt_evt_disp_vch_show = data[config][elec]['plot']['evt_display']['viewch']['show'] - self.plt_evt_disp_vch_ind_zrange = data[config][elec]['plot']['evt_display']['viewch']['ind_zrange'] - self.plt_evt_disp_vch_col_zrange = data[config][elec]['plot']['evt_display']['viewch']['col_zrange'] + self.plt_noise_show = data[config]['plot']['noise']['show'] + self.plt_noise_zrange = data[config]['plot']['noise']['zrange'] + self.plt_corr_daq_show = data[config]['plot']['corr']['daq']['show'] + self.plt_corr_daq_zrange = data[config]['plot']['corr']['daq']['zrange'] + self.plt_corr_glb_show = data[config]['plot']['corr']['glb']['show'] + self.plt_corr_glb_zrange = data[config]['plot']['corr']['glb']['zrange'] + self.plt_evt_disp_daq_show = data[config]['plot']['evt_display']['daqch']['show'] + self.plt_evt_disp_daq_zrange = data[config]['plot']['evt_display']['daqch']['zrange'] + self.plt_evt_disp_vch_show = data[config]['plot']['evt_display']['viewch']['show'] + self.plt_evt_disp_vch_ind_zrange = data[config]['plot']['evt_display']['viewch']['ind_zrange'] + self.plt_evt_disp_vch_col_zrange = data[config]['plot']['evt_display']['viewch']['col_zrange'] # setters and getters (potentially not useful now) def set_ped_amp_sig_fst(self,value): diff --git a/lardon.py b/lardon.py index 2ec1308..819409a 100644 --- a/lardon.py +++ b/lardon.py @@ -117,9 +117,9 @@ """ compute the raw pedestal """ ped.compute_pedestal(noise_type='raw', pars=pars) - - #plot.plot_noise_vch(noise_type='raw', vrange=pars.plt_noise_zrange,to_be_shown=True) - #plot.event_display_per_daqch(pars.plt_evt_disp_daqch_zrange,option='raw',to_be_shown=False) + if(pars.plt_noise_show == 1 or pars.plt_noise_show == 2): + plot.plot_noise_vch(noise_type='raw', vrange=pars.plt_noise_zrange,to_be_shown=True) + plot.event_display_per_daqch(pars.plt_evt_disp_daqch_zrange,option='raw',to_be_shown=True) @@ -135,15 +135,15 @@ cmap.arange_in_view_channels() - #plot.event_display_per_view(pars.plt_evt_disp_vch_ind_zrange,pars.plt_evt_disp_vch_col_zrange,option='coh', to_be_shown=True) + if(pars.plt_evt_disp_vch_show == 1 or pars.plt_evt_disp_vch_show == 2): + plot.event_display_per_view(pars.plt_evt_disp_vch_ind_zrange,pars.plt_evt_disp_vch_col_zrange,option='coh', to_be_shown=True) tf = time.time() ps = noise.FFT_low_pass(pars.noise_fft_lcut,pars.noise_fft_freq) - """ DO NOT STORE ALL FFT PS !! """ - #store.store_fft(output, ps) + if(pars.noise_fft_store == 1): store.store_fft(output, ps) @@ -153,10 +153,11 @@ #cmap.arange_in_view_channels() - #plot.event_display_per_view(pars.plt_evt_disp_vch_ind_zrange,pars.plt_evt_disp_vch_col_zrange,option='fft', option='fitlered', to_be_shown=False) + if(pars.plt_evt_disp_vch_show == 1 or pars.plt_evt_disp_vch_show == 3): + lot.event_display_per_view(pars.plt_evt_disp_vch_ind_zrange,pars.plt_evt_disp_vch_col_zrange,option='filtered', to_be_shown=True) - #plot.plot_correlation_daqch(option='filtered',to_be_shown=True) - #plot.plot_correlation_globch(option='filtered', to_be_shown=False) + if(pars.plt_corr_daq_show == 1): plot.plot_correlation_daqch(option='filtered',colorscale=pars.plt_corr_daq_zrange,to_be_shown=True) + if(pars.plt_corr_glb_show == 1): plot.plot_correlation_globch(option='filtered',colorscale=pars.plt_corr_daq_zrange, to_be_shown=True) @@ -165,7 +166,8 @@ #noise.coherent_noise(pars.noise_coh_group) #print("coherent time took ", time.time()-tcoh) - #plot.plot_noise_vch(noise_type='filt', vrange=pars.plt_noise_zrange,option='coherent',to_be_shown=False) + if(pars.plt_noise_show == 1 or pars.plt_noise_show == 3): + plot.plot_noise_vch(noise_type='filt', vrange=pars.plt_noise_zrange,option='coherent',to_be_shown=True) diff --git a/plotting/noise.py b/plotting/noise.py index 789e340..284e8de 100644 --- a/plotting/noise.py +++ b/plotting/noise.py @@ -332,7 +332,7 @@ def plot_FFT_vch(ps, option=None, to_be_shown=False): -def plot_correlation_globch(option=None, to_be_shown=False): +def plot_correlation_globch(option=None, colorscale=[-1,1],to_be_shown=False): data_globch = np.zeros(dc.data_daq.shape) for i in range(cf.n_tot_channels): gch = dc.chmap[i].globch @@ -343,12 +343,12 @@ def plot_correlation_globch(option=None, to_be_shown=False): plot_correlation(np.corrcoef(data_globch),"glob",option,to_be_shown) -def plot_correlation_daqch(option=None, to_be_shown=False): +def plot_correlation_daqch(option=None, colorscale=[-1,1],to_be_shown=False): plot_correlation(np.corrcoef(dc.data_daq),"daq",option,to_be_shown) -def plot_correlation(corr,corr_type,option,to_be_shown): +def plot_correlation(corr,corr_type,colorscale,option,to_be_shown): fig = plt.figure(figsize=(8,8)) gs = gridspec.GridSpec(nrows=2, ncols=1, @@ -363,7 +363,7 @@ def plot_correlation(corr,corr_type,option,to_be_shown): interpolation='none', cmap = cmap_corr, extent=[0, cf.n_tot_channels, 0., cf.n_tot_channels], - vmin=-1, vmax=1) + vmin=colorscale[0], vmax=colorscale[1]) if(corr_type=='daq'): title = 'DAQ Channels' diff --git a/settings/analysis_parameters.json b/settings/analysis_parameters.json index e241989..58a99f0 100644 --- a/settings/analysis_parameters.json +++ b/settings/analysis_parameters.json @@ -1,5 +1,32 @@ { "1":{ + "plot":{ + "noise":{ + "show": 0, + "zrange": [0,15] + }, + "corr":{ + "daq":{ + "show": 0, + "zrange": [-1,1] + }, + "glb":{ + "show": 0, + "zrange": [-1,1] + } + }, + "evt_display":{ + "daqch":{ + "show":0, + "zrange":[-50,50] + }, + "viewch":{ + "show":0, + "ind_zrange":[-50,50], + "col_zrange":[-50,50] + } + } + }, "top":{ "pedestal":{ "first_pass_thrs": 3, @@ -15,6 +42,7 @@ "groupings":[32] }, "fft":{ + "store":0, "freq":-1, "low_cut":0.6 } @@ -43,25 +71,7 @@ "qfrac":5.0, "len_min":2.0, "d_tol":0.5 - }, - - "plot":{ - "noise":{ - "show": 0, - "zrange": [0,15] - }, - "evt_display":{ - "daqch":{ - "show":0, - "zrange":[-50,50] - }, - "viewch":{ - "show":0, - "ind_zrange":[-50,50], - "col_zrange":[-50,50] - } - } - } + } }, "bot":{ @@ -81,6 +91,7 @@ }, "fft":{ + "store":0, "freq":-1, "low_cut":0.4 } @@ -109,29 +120,38 @@ "qfrac":5.0, "len_min":2.0, "d_tol":0.5 - }, - - "plot":{ - "noise":{ - "show": 0, - "zrange": [0,900] - }, - "evt_display":{ - "daqch":{ - "show": 0, - "zrange":[-1000,1000] - }, - "viewch":{ - "show": 0, - "ind_zrange":[-500,500], - "col_zrange":[-100,100] - } - } - } + } } }, "2":{ - "top":{ + "plot":{ + "noise":{ + "show": 0, + "zrange": [0,15] + }, + "corr":{ + "daq":{ + "show": 0, + "zrange": [-1,1] + }, + "glb":{ + "show": 0, + "zrange": [-1,1] + } + }, + "evt_display":{ + "daqch":{ + "show":0, + "zrange":[-50,50] + }, + "viewch":{ + "show":0, + "ind_zrange":[-50,50], + "col_zrange":[-50,50] + } + } + }, + "top":{ "pedestal":{ "first_pass_thrs": 5, "other_pass_thrs": 3, @@ -146,6 +166,7 @@ "groupings":[32] }, "fft":{ + "store": 0, "freq":-1, "low_cut":0.6 } @@ -157,24 +178,7 @@ "left": 6, "right": 10 } - }, - "plot":{ - "noise":{ - "show": 0, - "zrange": [0,900] - }, - "evt_display":{ - "daqch":{ - "show": 0, - "zrange":[-1000,1000] - }, - "viewch":{ - "show": 0, - "ind_zrange":[-100,100], - "col_zrange":[-50,50] - } - } - } + } } } } From 5f743ce25aa7df11d169239cc6f7dfec1b983347 Mon Sep 17 00:00:00 2001 From: Yoann Kermaidic Date: Thu, 9 Dec 2021 17:27:25 +0100 Subject: [PATCH 2/4] More plotting options for hits and debug --- analysis_parameters.py | 8 ++++++++ lardon.py | 7 +++---- pedestals.py | 6 +++--- settings/analysis_parameters.json | 15 +++++++++++++-- 4 files changed, 27 insertions(+), 9 deletions(-) diff --git a/analysis_parameters.py b/analysis_parameters.py index 5b185b7..f48b236 100644 --- a/analysis_parameters.py +++ b/analysis_parameters.py @@ -12,6 +12,7 @@ def __init__(self): self.ped_amp_thr = [2,2,3] # RMS amplitude threshold self.ped_dt_thr = 100 # trigger window duration in which a signal is looked for self.ped_zero_cross_thr = 15 # minimal number of samples after downward zero-crossing to look for upward zero-crossing + self.ped_debug = 0 # show mask waveform-wise after refinment step self.noise_coh_group = [32] # coherent noise channel grouping @@ -43,6 +44,9 @@ def __init__(self): self.plt_corr_glb_show = 0 self.plt_evt_disp_daq_show = 0 self.plt_evt_disp_vch_show = 0 # 0: do not plot - 1 plot before/after CNR - 2 before CNR - 3 after CNR + self.plt_2dh_show = 0 + self.plt_2dt_show = 0 + self.plt_3d_show = 0 self.plt_noise_zrange = [0,900] # color scale for noise plots self.plt_corr_daq_zrange = [-1,1] # color scale daq-wise correlation plot @@ -67,6 +71,7 @@ def read(self,elec="top",config="1"): self.ped_amp_thr = data[config][elec]['pedestal']['amp_thr'] self.ped_dt_thr = data[config][elec]['pedestal']['dt_thr'] self.ped_zero_cross_thr = data[config][elec]['pedestal']['zero_cross_thr'] + self.ped_debug = data[config][elec]['pedestal']['debug'] self.noise_coh_group = data[config][elec]['noise']['coherent']['groupings'] self.noise_fft_store = data[config][elec]['noise']['fft']['store'] @@ -105,6 +110,9 @@ def read(self,elec="top",config="1"): self.plt_evt_disp_vch_show = data[config]['plot']['evt_display']['viewch']['show'] self.plt_evt_disp_vch_ind_zrange = data[config]['plot']['evt_display']['viewch']['ind_zrange'] self.plt_evt_disp_vch_col_zrange = data[config]['plot']['evt_display']['viewch']['col_zrange'] + self.plt_2dh_show = data[config]['plot']['2d_hits']['show'] + self.plt_2dt_show = data[config]['plot']['2d_tracks']['show'] + self.plt_3d_show = data[config]['plot']['3d']['show'] # setters and getters (potentially not useful now) def set_ped_amp_sig_fst(self,value): diff --git a/lardon.py b/lardon.py index 819409a..e83b286 100644 --- a/lardon.py +++ b/lardon.py @@ -130,7 +130,6 @@ ped.compute_pedestal(noise_type='filt') #tp = time.time() - #ped.refine_mask(pars) ped.update_mask(pars.ped_amp_sig_oth) @@ -182,7 +181,7 @@ print("hit %.2f s"%(time.time()-th)) print("Number Of Hits found : ", dc.evt_list[-1].n_hits) - #plot.plot_2dview_hits(to_be_shown=True) + if(pars.plt_2dh_show == 1): plot.plot_2dview_hits(to_be_shown=True) @@ -198,7 +197,7 @@ [t.mini_dump() for t in dc.tracks2D_list] - #plot.plot_2dview_2dtracks(to_be_shown=True) + if(pars.plt_2dt_show == 1): plot.plot_2dview_2dtracks(to_be_shown=True) trk3d.find_tracks_rtree(pars.trk3D_ztol, @@ -206,7 +205,7 @@ pars.trk3D_len_min, pars.trk3D_dtol) - #plot.plot_3d(to_be_shown=True) + if(pars.plt_3d_show == 1): plot.plot_3d(to_be_shown=True) print("Number of 3D tracks found : ", len(dc.tracks3D_list)) print(' %.2f s to process '%(time.time()-t0)) diff --git a/pedestals.py b/pedestals.py index bbd8891..afdebca 100644 --- a/pedestals.py +++ b/pedestals.py @@ -83,8 +83,8 @@ def update_mask_inputs(thresh, mean, rms): np.logical_and(dc.mask_daq, dc.alive_chan) -def refine_mask(pars, debug=False): - if(debug == True): import matplotlib.pyplot as plt +def refine_mask(pars): + if(pars.ped_debug == 1): import matplotlib.pyplot as plt for ch in range(cf.n_tot_channels): @@ -112,7 +112,7 @@ def refine_mask(pars, debug=False): pars.ped_dt_thr, pars.ped_zero_cross_thr) - if(debug==True and ch > 1 and (ch % 50) == 0): + if(pars.ped_debug == 1 and ch > 1 and (ch % 50) == 0): nrows, ncols = 10, 5 fig = plt.figure() for it,channel in enumerate(range(ch-50,ch)): diff --git a/settings/analysis_parameters.json b/settings/analysis_parameters.json index 58a99f0..ea73f59 100644 --- a/settings/analysis_parameters.json +++ b/settings/analysis_parameters.json @@ -25,6 +25,15 @@ "ind_zrange":[-50,50], "col_zrange":[-50,50] } + }, + "2d_hits":{ + "show": 0 + }, + "2d_tracks":{ + "show": 0 + }, + "3d":{ + "show": 0 } }, "top":{ @@ -35,7 +44,8 @@ "ramp_thr": [1,1,2], "amp_thr": [2,2,3], "dt_thr": 100, - "zero_cross_thr": 15 + "zero_cross_thr": 15, + "debug": 0 }, "noise":{ "coherent":{ @@ -82,7 +92,8 @@ "ramp_thr": [1,1,2], "amp_thr": [2,2,3], "dt_thr": 100, - "zero_cross_thr": 15 + "zero_cross_thr": 15, + "debug": 0 }, "noise":{ From 393f50914d68d0bb8574026b1d6d9d6a302737a7 Mon Sep 17 00:00:00 2001 From: Yoann Kermaidic Date: Wed, 15 Dec 2021 08:47:24 +0100 Subject: [PATCH 3/4] More settings for plots --- analysis_parameters.py | 6 ++++++ pedestals.py | 13 +++++++------ plotting/event_display.py | 22 +++++++++++++++++----- settings/analysis_parameters.json | 11 +++++++---- 4 files changed, 37 insertions(+), 15 deletions(-) diff --git a/analysis_parameters.py b/analysis_parameters.py index f48b236..24bee85 100644 --- a/analysis_parameters.py +++ b/analysis_parameters.py @@ -51,7 +51,10 @@ def __init__(self): self.plt_noise_zrange = [0,900] # color scale for noise plots self.plt_corr_daq_zrange = [-1,1] # color scale daq-wise correlation plot self.plt_corr_glb_zrange = [-1,1] # color scale view-wise correlation plot + self.plt_evt_disp_daq_xrange = [-1,-1] # chan scale for DAQ channels event display plots + self.plt_evt_disp_daq_yrange = [-1,-1] # time scale for DAQ channels event display plots self.plt_evt_disp_daq_zrange = [-1000,1000] # color scale for DAQ channels event display plots + self.plt_evt_disp_vch_yrange = [-1,-1] # time scale for view event display plots self.plt_evt_disp_vch_ind_zrange = [-100,100] # color scale for induction view event display plots self.plt_evt_disp_vch_col_zrange = [-50,50] # color scale for collection view event display plots @@ -106,8 +109,11 @@ def read(self,elec="top",config="1"): self.plt_corr_glb_show = data[config]['plot']['corr']['glb']['show'] self.plt_corr_glb_zrange = data[config]['plot']['corr']['glb']['zrange'] self.plt_evt_disp_daq_show = data[config]['plot']['evt_display']['daqch']['show'] + self.plt_evt_disp_daq_xrange = data[config]['plot']['evt_display']['daqch']['xrange'] + self.plt_evt_disp_daq_yrange = data[config]['plot']['evt_display']['daqch']['yrange'] self.plt_evt_disp_daq_zrange = data[config]['plot']['evt_display']['daqch']['zrange'] self.plt_evt_disp_vch_show = data[config]['plot']['evt_display']['viewch']['show'] + self.plt_evt_disp_vch_yrange = data[config]['plot']['evt_display']['viewch']['yrange'] self.plt_evt_disp_vch_ind_zrange = data[config]['plot']['evt_display']['viewch']['ind_zrange'] self.plt_evt_disp_vch_col_zrange = data[config]['plot']['evt_display']['viewch']['col_zrange'] self.plt_2dh_show = data[config]['plot']['2d_hits']['show'] diff --git a/pedestals.py b/pedestals.py index afdebca..3043fdb 100644 --- a/pedestals.py +++ b/pedestals.py @@ -84,7 +84,7 @@ def update_mask_inputs(thresh, mean, rms): def refine_mask(pars): - if(pars.ped_debug == 1): import matplotlib.pyplot as plt + if(pars.ped_debug > 0): import matplotlib.pyplot as plt for ch in range(cf.n_tot_channels): @@ -112,7 +112,7 @@ def refine_mask(pars): pars.ped_dt_thr, pars.ped_zero_cross_thr) - if(pars.ped_debug == 1 and ch > 1 and (ch % 50) == 0): + if(pars.ped_debug > 0 and ch > 1 and (ch % 50) == 0): nrows, ncols = 10, 5 fig = plt.figure() for it,channel in enumerate(range(ch-50,ch)): @@ -120,11 +120,12 @@ def refine_mask(pars): ax = fig.add_subplot(nrows, ncols, it+1) ax.set_title(title) ax.plot(dc.data_daq[channel],'o',markersize=0.2) - ax.axhline(y=dc.evt_list[-1].noise_filt.ped_rms[channel]*pars.ped_amp_thr[dc.chmap[channel].view], color='gray') - ax.axhline(y=0, color='lightgray') - ax.axhline(y=-dc.evt_list[-1].noise_filt.ped_rms[channel]*pars.ped_amp_thr[dc.chmap[channel].view], color='gray') - ax.plot(np.max(dc.data_daq[channel, :])*dc.mask_daq[channel,:],linestyle='-',linewidth=1,color='r') + ax.axhline(y=dc.evt_list[-1].noise_filt.ped_rms[channel]*pars.ped_amp_thr[dc.chmap[channel].view], color='gray',linewidth=0.1) + ax.axhline(y=0, color='lightgray',linewidth=0.1) + ax.axhline(y=-dc.evt_list[-1].noise_filt.ped_rms[channel]*pars.ped_amp_thr[dc.chmap[channel].view], color='gray',linewidth=0.1) + if(pars.ped_debug==1): ax.plot(np.max(dc.data_daq[channel, :])*dc.mask_daq[channel,:],linestyle='-',linewidth=1,color='r') ax.set(xlabel=None,ylabel=None) + ax.set_xlim(500,2000) ax.axis('off') plt.subplots_adjust(left=0.01, bottom=0.01, right=0.99, top=0.95, wspace=0.05, hspace=1) plt.show() diff --git a/plotting/event_display.py b/plotting/event_display.py index 0052a2f..3c8028b 100644 --- a/plotting/event_display.py +++ b/plotting/event_display.py @@ -13,7 +13,7 @@ cmap_ed_ind = cc.cm.diverging_tritanopic_cwr_75_98_c20 -def draw(view, ax, adc_min, adc_max): +def draw(view, ax, t_min, t_max, adc_min, adc_max): ax = plt.gca() if ax is None else ax cmap = cmap_ed_coll if(cf.view_type[view] == 'Collection') else cmap_ed_ind @@ -24,10 +24,13 @@ def draw(view, ax, adc_min, adc_max): cmap = cmap, vmin = adc_min, vmax = adc_max) + # custom time map limit for controlled zoom + if(t_min >=0 and t_max>=0): + ax.set_ylim(t_min,t_max) return ax -def event_display_per_view(adc_ind=[-10,10], adc_coll=[-5,30], option=None, to_be_shown=False): +def event_display_per_view(time_range=[-1,-1],adc_ind=[-10,10], adc_coll=[-5,30], option=None, to_be_shown=False): fig = plt.figure(figsize=(10,5)) gs = gridspec.GridSpec(nrows=2, @@ -46,10 +49,10 @@ def event_display_per_view(adc_ind=[-10,10], adc_coll=[-5,30], option=None, to_b if(cf.view_type[iv] == 'Induction'): - axs[iv] = draw(iv, axs[iv], adc_ind[0], adc_ind[1]) + axs[iv] = draw(iv, axs[iv], time_range[0], time_range[1], adc_ind[0], adc_ind[1]) vname = 'Ind.' else: - axs[iv] = draw(iv, axs[iv], adc_coll[0], adc_coll[1]) + axs[iv] = draw(iv, axs[iv], time_range[0], time_range[1], adc_coll[0], adc_coll[1]) vname = 'Coll.' axs[iv].set_title('View '+str(iv)+'/'+cf.view_name[iv]+' ('+vname+')') @@ -98,7 +101,7 @@ def event_display_per_view(adc_ind=[-10,10], adc_coll=[-5,30], option=None, to_b -def event_display_per_daqch(adc_range=[-10,10], option=None, to_be_shown=False): +def event_display_per_daqch(ch_range=[-1,-1],time_range=[-1,-1],adc_range=[-10,10], option=None, to_be_shown=False): fig = plt.figure(figsize=(9,4)) gs = gridspec.GridSpec(nrows=2, @@ -116,6 +119,15 @@ def event_display_per_daqch(adc_range=[-10,10], option=None, to_be_shown=False): vmin = adc_range[0], vmax = adc_range[1]) + # custom (x,y) map limits for controlled zoom + if(ch_range[0] >=0 and ch_range[1]>=0): + ax.set_xlim(ch_range[0], ch_range[1]) + + if(time_range[0] >=0 and time_range[1]>=0): + ax.set_ylim(time_range[0], time_range[1]) + + for i in range(int(len(dc.data_daq)/32.)): + ax.axvline(x=i*32-0.5) ax.set_xlabel('DAQ Channel Number') diff --git a/settings/analysis_parameters.json b/settings/analysis_parameters.json index ea73f59..4ba2d04 100644 --- a/settings/analysis_parameters.json +++ b/settings/analysis_parameters.json @@ -17,13 +17,16 @@ }, "evt_display":{ "daqch":{ - "show":0, + "show": 0, + "xrange":[670,1580], + "yrange":[500,2000], "zrange":[-50,50] }, "viewch":{ - "show":0, - "ind_zrange":[-50,50], - "col_zrange":[-50,50] + "show": 3, + "yrange":[500,2000], + "ind_zrange":[-50,50], + "col_zrange":[-10,50] } }, "2d_hits":{ From 7847b3939d668e1f9e8715e6f4b316992fcbb151 Mon Sep 17 00:00:00 2001 From: Yoann Kermaidic Date: Wed, 15 Dec 2021 08:56:22 +0100 Subject: [PATCH 4/4] Set plot conditions --- lardon.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lardon.py b/lardon.py index e83b286..231a350 100644 --- a/lardon.py +++ b/lardon.py @@ -119,12 +119,14 @@ if(pars.plt_noise_show == 1 or pars.plt_noise_show == 2): plot.plot_noise_vch(noise_type='raw', vrange=pars.plt_noise_zrange,to_be_shown=True) - plot.event_display_per_daqch(pars.plt_evt_disp_daqch_zrange,option='raw',to_be_shown=True) + if(pars.plt_evt_disp_daq_show == 1 or pars.plt_evt_disp_daq_show == 2): + plot.event_display_per_daqch(pars.plt_evt_disp_daq_yrange,pars.plt_evt_disp_daq_zrange,option='raw',to_be_shown=True) tcoh = time.time() - noise.coherent_noise_per_view(pars.noise_coh_group) +# noise.coherent_noise_per_view(pars.noise_coh_group) + noise.coherent_noise(pars.noise_coh_group) print("coherent noise : ", time.time()-tcoh) @@ -153,7 +155,16 @@ #cmap.arange_in_view_channels() if(pars.plt_evt_disp_vch_show == 1 or pars.plt_evt_disp_vch_show == 3): - lot.event_display_per_view(pars.plt_evt_disp_vch_ind_zrange,pars.plt_evt_disp_vch_col_zrange,option='filtered', to_be_shown=True) + plot.event_display_per_view(time_range=pars.plt_evt_disp_vch_yrange, + adc_ind=pars.plt_evt_disp_vch_ind_zrange, + adc_coll=pars.plt_evt_disp_vch_col_zrange, + option='filtered', to_be_shown=True) + if(pars.plt_evt_disp_daq_show == 1 or pars.plt_evt_disp_daq_show == 3): + plot.event_display_per_daqch(ch_range=pars.plt_evt_disp_daq_xrange, + time_range=pars.plt_evt_disp_daq_yrange, + adc_range=pars.plt_evt_disp_daq_zrange, + option='filtered',to_be_shown=True) + if(pars.plt_corr_daq_show == 1): plot.plot_correlation_daqch(option='filtered',colorscale=pars.plt_corr_daq_zrange,to_be_shown=True) if(pars.plt_corr_glb_show == 1): plot.plot_correlation_globch(option='filtered',colorscale=pars.plt_corr_daq_zrange, to_be_shown=True)