Skip to content
Snippets Groups Projects
Commit 16bb59d0 authored by Cedric Engler's avatar Cedric Engler
Browse files

Updated version with better allocations

parent 5c8fd4c8
Branches
Tags
No related merge requests found
......@@ -5,7 +5,7 @@ import matplotlib.pyplot as plt
from scipy.stats._distn_infrastructure import (
rv_discrete, _ncx2_pdf, _ncx2_cdf, get_distribution_names)
rv_discrete, get_distribution_names)
class gpd_gen(rv_discrete):
......
Example.png

25.3 KiB | W: | H:

Example.png

32 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(1e5)
n_events = int(1e2)
#################################
......
......@@ -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,18 +304,7 @@ class SiPMSimulation:
partialSum = 0
for _i in dXT_n:
temp = []
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]))
for _ii in _i:t0 = 0 #ns
nlight = np.asarray(ns.dist_flight.rvs(size=ns.n_sim))
nDC = np.asarray(ns.dist_fDC.rvs(size=ns.n_sim))
......@@ -327,16 +316,7 @@ class SiPMSimulation:
nPG = nDC + nlight
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))
pbar.update(1)t0 = 0 #ns
npXT_sum = np.sum(npXT)
nPG_pXT_sum = nPG_sum + npXT_sum
......@@ -356,13 +336,7 @@ 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]
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)]
pg_dc_t = np.split(pg_dc_t, nDC_cumsum)[:-1]t0 = 0 #ns
pbar.update(1)
......@@ -492,23 +466,7 @@ class SiPMSimulation:
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.update(1)t0 = 0 #ns
pbar.set_description("{0}".format(self.pb_ag_text[6]))
......@@ -729,8 +687,7 @@ 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 added
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment