Commit 6f574929 authored by Markus Gaug's avatar Markus Gaug
Browse files

new script to visualize multiple data sets

parent 40283acf
Pipeline #6859 canceled with stages
import glob
import numpy as np
from matplotlib import pyplot as plt
import pandas as pd
import json
import sys
from os.path import basename
from licel_reader import LICEL
x_min = 0.
x_max = 1000.
y_min = 1e-4
y_max = 1e3
is_groundline = True
sig_range = 140000
labels = [ '355 nm (analog)', '355 nm (photon counting)',
'389 nm (analog)', '389 nm (photon counting)',
'532 nm (analog)', '532 nm (photon counting)',
'near range (analog)', 'near range (photon counting)' ]
rebin = -1
rebin_thres = 0
#global_offset = -5
offsets = [ 6 , -3 , 14, 2, 0, 0, 0, 0 ]
offsets = [ 6 , -2 , 14, 2, 0, 0, -10, -10 ]
offsets = [ 7-5 , -2-5 , 15-5, 0-5 ,3-10, 1-10, -3, -5 ]
offsets = [ 2 , -7 , 10, -5 , -7, -9, -3, -5 ]
bg_range = 5000 # 5000 # Background subtraction (both atmospheric and electronic)
if (is_groundline):
bg_range = 5000
def show_file(filename):
licel = LICEL(filename)
licel.print_header()
nr = 0
plt.figure(figsize=[15,7])
if (is_groundline):
plt.subplot(421)
for (channel_id,channel) in enumerate(licel.channels):
channel.offset_range = offsets[nr] # + global_offset # correct for the different zero-offset
if (channel_id > 3):
channel.bin_width = 3.75
channel.print_header() # print channel header
if (channel_id == 2):
(x,y,yerr,offset,offseterr) = channel.get_data(rebin=rebin,rebin_thres=0,rebin_seq=50,rebin_fac=0,bg_range=bg_range+(int)(channel.num_data/2),bg_range2=(int)(channel.num_data/2),verbose=False)
else:
(x,y,yerr,offset,offseterr) = channel.get_data(rebin=rebin,rebin_thres=0,rebin_seq=50,rebin_fac=0,bg_range=bg_range,verbose=False)
#plt.plot(x,np.log(y*x**2),label=labels[channel_id])
if (channel_id == 0):
x = x - 2 # move x by 2 meters to the left
if (channel.analog == False):
y = y * 0.008
if (is_groundline):
ax = plt.subplot(4,2,channel_id+1)
ax.plot(x,y,label=labels[channel_id])
ax.set_xlim(0.,sig_range)
if (channel_id > 3):
ax.set_xlim(0.,sig_range/2.)
ax.set_xlabel('distance (m)')
if (channel.analog):
ax.set_ylabel('raw signal (mV)')
if (bg_range == 0):
ax.set_ylim(4.,6.)
else:
if (channel_id == 6):
ax.set_ylim(-0.01,0.01)
else:
ax.set_ylim(-0.03,0.03)
else:
ax.set_ylabel('raw signal (MHz)')
if (bg_range == 0):
ax.set_ylim(-0.1,0.5)
else:
ax.set_ylim(-1.,2.5)
ax.axhline(y=0., color='k')
ax.legend(loc='best')
else:
plt.plot(x,y,label=labels[channel_id])
plt.xlim(x_min,x_max)
plt.ylim(y_min,y_max)
plt.yscale('log')
nr = nr + 1
plt.legend(loc='best')
plt.grid(axis='x')
plt.title(basename(filename))
plt.show()
for name in glob.glob(sys.argv[1]):
print(name)
show_file(name)
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