Skip to content
Snippets Groups Projects
Commit b853a7b8 authored by Antonello, Dr. Massimiliano's avatar Antonello, Dr. Massimiliano
Browse files

Merge branch 'revert-16bb59d0' into 'main'

Revert "Updated version with better allocations"

See merge request !2
parents 16bb59d0 8caaf206
No related branches found
No related tags found
1 merge request!2Revert "Updated version with better allocations"
......@@ -5,7 +5,7 @@ import matplotlib.pyplot as plt
from scipy.stats._distn_infrastructure import (
rv_discrete, get_distribution_names)
rv_discrete, _ncx2_pdf, _ncx2_cdf, get_distribution_names)
class gpd_gen(rv_discrete):
......
Example.png

32 KiB | W: | H:

Example.png

25.3 KiB | W: | H:

Example.png
Example.png
Example.png
Example.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -55,7 +55,7 @@ s = SiPMSimulation()
s.AddVariables(variables)
n_events = int(1e2)
n_events = int(1e5)
#################################
......
......@@ -250,7 +250,7 @@ class SiPMSimulation:
line = _RemoveNonAscii(line)
elems = line.replace('"', "").split(",")
elems = _ToFloats(elems)
t0 = 0 #ns
if elems[0] in self.VariableDictionary:
variables[elems[0]] = elems[1::]
......@@ -304,7 +304,18 @@ class SiPMSimulation:
partialSum = 0
for _i in dXT_n:
temp = []
for _ii in _i:t0 = 0 #ns
for _ii in _i:
temp.append(dXT_nt[partialSum:partialSum+_ii])
partialSum += _ii
output.append(temp)
return output
def AllGeiger(self, ns):
pbar = tqdm(range(len(self.pb_ag_text)-1))
pbar.set_description("{0}".format(self.pb_ag_text[0]))
nlight = np.asarray(ns.dist_flight.rvs(size=ns.n_sim))
nDC = np.asarray(ns.dist_fDC.rvs(size=ns.n_sim))
......@@ -316,7 +327,16 @@ class SiPMSimulation:
nPG = nDC + nlight
pbar.update(1)t0 = 0 #ns
pbar.update(1)
pbar.set_description("{0}".format(self.pb_ag_text[1]))
nlight_sum = np.sum(nlight)
nDC_sum = np.sum(nDC)
nPG_sum = nlight_sum + nDC_sum
npXT = np.array(ns.dist_fpXT.rvs(size=nPG_sum))
ndXT = np.array(ns.dist_fdXT.rvs(size=nPG_sum))
npXT_sum = np.sum(npXT)
nPG_pXT_sum = nPG_sum + npXT_sum
......@@ -336,7 +356,13 @@ class SiPMSimulation:
pg_l_d = np.split(pg_l_d, nlight_cumsum)[:-1]
pg_l_t = np.split(pg_l_t, nlight_cumsum)[:-1]
pg_dc_d = np.split(pg_dc_d, nDC_cumsum)[:-1]
pg_dc_t = np.split(pg_dc_t, nDC_cumsum)[:-1]t0 = 0 #ns
pg_dc_t = np.split(pg_dc_t, nDC_cumsum)[:-1]
pXT_n = np.split(npXT, nPG_cumsum)[:-1]
dXT_n = np.split(ndXT, nPG_cumsum)[:-1]
pg_d = [np.concatenate(elem) for elem in zip(pg_l_d, pg_dc_d)]
pg_t = [np.concatenate(elem) for elem in zip(pg_l_t, pg_dc_t)]
pbar.update(1)
......@@ -466,7 +492,23 @@ class SiPMSimulation:
pbar.update(1)t0 = 0 #ns
pbar.update(1)
pbar.set_description("{0}".format(self.pb_ag_text[5]))
ag_d = [
np.concatenate( (list_pg_d, list_pXT_d, list_dXT_d, list_Ap_d))
for list_pg_d, list_pXT_d, list_dXT_d, list_Ap_d, in zip(pg_d, pXT_d, dXT_d, Ap_d)
]
ag_t = [
np.concatenate( (list_pg_t, list_pXT_t, list_dXT_t, list_Ap_t))
for list_pg_t, list_pXT_t, list_dXT_t, list_Ap_t, in zip(pg_t, pXT_t, dXT_t, Ap_t)
]
ns.ag_d = ag_d
ns.ag_t = ag_t
pbar.update(1)
pbar.set_description("{0}".format(self.pb_ag_text[6]))
......@@ -687,7 +729,8 @@ class SiPMSimulation:
end_time = time.time()
self.pars.at[index, "GeigerArray"] = np.vstack([ns.ag_d, ns.ag_t]) # self.pars.at[index, "TimeElapsed_GeigerArray"] = end_time-start_time
self.pars.at[index, "GeigerArray"] = np.vstack([ns.ag_d, ns.ag_t])
# self.pars.at[index, "TimeElapsed_GeigerArray"] = end_time-start_time
self.pars.at[index, "ChargeSpectrum"] = Qs
......
File deleted
File deleted
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment