Clusterization and interpolation implemented in python
This commit is contained in:
112
examples/cluster_example.py
Normal file
112
examples/cluster_example.py
Normal file
@@ -0,0 +1,112 @@
|
||||
import os, sys
|
||||
from pathlib import Path
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
#from creader import ClusterFileReader
|
||||
import creader as cr
|
||||
import clustersFunctions as cf
|
||||
|
||||
fname = "/mnt/myData/230914_30s_star_100um_nofi/star_"
|
||||
fnameff = "/mnt/myData/230914_30s_flat_100um_nofi/flat_"
|
||||
fname = "/mnt/jungfrau_data1/POLLUX20230815/clust_5Sigma/clust_mountain/Position2_500eV_W17_300V_-40deg_Xrays_d0_f22_1.clust"
|
||||
xmin=161+20
|
||||
xmax=xmin+40
|
||||
ymin=161+20
|
||||
ymax=ymin+40
|
||||
emin=0
|
||||
emax=30
|
||||
ecutmin=8
|
||||
ecutmax=12
|
||||
etabins=251
|
||||
csize=3
|
||||
gain=150
|
||||
nbins=100
|
||||
indmin=1
|
||||
indmax=20
|
||||
|
||||
|
||||
fname="/mnt/moench_data/tests20231005/sample_20kV_2mA_d0_f0_0.clust"
|
||||
|
||||
ymin=0
|
||||
ymax=400
|
||||
xmin=0
|
||||
xmax=400
|
||||
emin=0
|
||||
emax=50
|
||||
ecutmin=0
|
||||
ecutmax=50
|
||||
gain=150
|
||||
indmin=0
|
||||
indmax=0
|
||||
|
||||
|
||||
|
||||
subpix=5
|
||||
|
||||
|
||||
im=None
|
||||
intim=None
|
||||
etas=None
|
||||
sp=None
|
||||
ietax=None
|
||||
ietay=None
|
||||
|
||||
for i in range(indmin,indmax+1):
|
||||
ff=fname
|
||||
#ff=fnameff+str(i)+".clust"
|
||||
print(ff)
|
||||
r = cr.ClusterFileReader(ff)
|
||||
im, sp, ebins, etas, etabinsx, etabinsy=cf.analyze_clusters(r, emin, emax, ecutmin, ecutmax, xmin, xmax, ymin, ymax, ietax, ietay, im, sp, etas, intim,csize, gain, nbins, etabins)
|
||||
print(np.sum(im))
|
||||
|
||||
ietax, ietay=cf.prepare_interpolation(etas)
|
||||
|
||||
|
||||
|
||||
|
||||
im=None
|
||||
intim=None
|
||||
etas=None
|
||||
sp=None
|
||||
|
||||
#for i in range(1,21):
|
||||
for i in range(indmin,indmax+1):
|
||||
ff=fname
|
||||
#ff=fname+str(i)+".clust"
|
||||
print(ff)
|
||||
r = cr.ClusterFileReader(ff)
|
||||
im, intim, sp, ebins, etas, etabinsx, etabinsy=cf.analyze_clusters(r, emin, emax, ecutmin, ecutmax, xmin, xmax, ymin, ymax, ietax, ietay, im, sp, etas, intim, csize, gain, nbins, etabins, subpix)
|
||||
|
||||
|
||||
|
||||
imff=None
|
||||
intimff=None
|
||||
etasff=None
|
||||
spff=None
|
||||
"""
|
||||
|
||||
for i in range(1,21):
|
||||
ff=fnameff+str(i)+".clust"
|
||||
print(ff)
|
||||
r = cr.ClusterFileReader(ff)
|
||||
imff, intimff, spff, ebins, etasff, etabinsx, etabinsy=cf.analyze_clusters(r, emin, emax, ecutmin, ecutmax, xmin, xmax, ymin, ymax,ietax, ietay, imff, spff, etasff, intimff, csize, gain, nbins, etabins, subpix)
|
||||
|
||||
"""
|
||||
|
||||
|
||||
fig, ax = plt.subplots()
|
||||
ax.plot(ebins[:-1],sp)
|
||||
#ax.set_yscale('log')
|
||||
fig.show()
|
||||
"""
|
||||
fig1, axs1 = plt.subplots()
|
||||
vv=axs1.imshow(intim/intimff,vmax=1.,origin='upper',cmap=plt.cm.jet)
|
||||
fig1.colorbar(vv, ax=axs1)
|
||||
fig1.show()
|
||||
"""
|
||||
cf.plot_colz(im)#/imff,1.1)
|
||||
cf.plot_colz(intim)#/intimff,1.1)
|
||||
|
||||
cf.plot_colz(etas,np.max(etas))
|
||||
cf.plot_colz(ietax,1.1)
|
||||
cf.plot_colz(ietay,1.1)
|
||||
Reference in New Issue
Block a user