From f69c1122ebb26f87eba12c86edd258d76a837f20 Mon Sep 17 00:00:00 2001 From: Jack Christopher Hutchinson Rolph <jack.rolph@desy.de> Date: Tue, 13 Sep 2022 12:33:25 +0200 Subject: [PATCH] Update LightSimtastic.py --- LightSimtastic.py | 87 +++++++++++++++++------------------------------ 1 file changed, 32 insertions(+), 55 deletions(-) diff --git a/LightSimtastic.py b/LightSimtastic.py index a5a733d..bc6ddb9 100644 --- a/LightSimtastic.py +++ b/LightSimtastic.py @@ -336,9 +336,6 @@ class SiPMSimulation: npXT_sum = np.sum(npXT) - nPG_pXT_sum = nPG_sum + npXT_sum - - pg_l_d = np.ones(nlight_sum) pg_l_t = np.asarray(ns.dist_ftlight.rvs(size=nlight_sum)) @@ -361,9 +358,6 @@ class SiPMSimulation: 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_pXT_d = [np.concatenate(elem) for elem in zip(pg_d, pXT_n)] - pg_pXT_t = [np.concatenate(elem) for elem in zip(pg_t, pg_t)] - @@ -440,17 +434,32 @@ class SiPMSimulation: ] + + + ag_d = [ + np.concatenate(elem) for elem in zip(pg_d, pXT_d, dXT_d) + ] + + ag_t = [ + np.concatenate(elem) for elem in zip(pg_t, pXT_t, dXT_t) + ] + + pbar.update(1) pbar.set_description("{0}".format(self.pb_ag_text[4])) + + Ap_d = [] Ap_t = [] - for list_pg_pXT_d, list_pg_pXT_t in zip(pg_pXT_d, pg_pXT_t): - _Apd_list = [] - _Apt_list = [] + + for list_ag_d, list_ag_t in zip(ag_d, ag_t): + + _list_Ap_d = [] + _list_Ap_t = [] - for d, t in zip(list_pg_pXT_d, list_pg_pXT_t): + for d, t in zip(list_ag_d, list_ag_t): if(d>0): @@ -470,73 +479,41 @@ class SiPMSimulation: _Apd = (1-np.exp(-_tAp/ns.tslow))*_nAp - _Apdt = t + _tAp + _Apt = t + _tAp else: _Apd = [] - _Apdt = [] + _Apt = [] else: _Apd = [] - _Apdt = [] + _Apt = [] - _Apd_list.extend(list(_Apd)) - _Apt_list.extend(list(_Apdt)) + _list_Ap_d.extend(list(_Apd)) + _list_Ap_t.extend(list(_Apt)) - Ap_d.append(_Apd_list) - Ap_t.append(_Apt_list) + Ap_d.append(_list_Ap_d) + Ap_t.append(_list_Ap_t) Ap_d = np.array(Ap_d) Ap_t = np.array(Ap_t) - -# Ap_d = [ -# np.array( -# list(chain.from_iterable( -# [ -# [1-np.exp(-elem_Ap_t/ns.tslow)]*elem_Ap_n -# if(elem_Ap_n > 0 and elem_pg_d >0) -# else [] -# for elem_pg_d, elem_pg_t, elem_Ap_n, elem_Ap_t in zip(list_pg_d, list_pg_t, list_Ap_n, list_Ap_t) -# ] -# ) -# ) - -# ) -# for list_pg_d, list_pg_t, list_Ap_n, list_Ap_t, in zip(pg_pXT_d, pg_pXT_t, Ap_n, Ap_t) -# ] - - -# Ap_t = [ -# np.array( -# list(chain.from_iterable( -# [ -# [elem_pg_t + elem_Ap_t]*elem_Ap_n -# if(elem_Ap_n > 0 and elem_pg_d >0) -# else [] -# for elem_pg_d, elem_pg_t, elem_Ap_n, elem_Ap_t in zip(list_pg_d, list_pg_t, list_Ap_n, list_Ap_t) -# ] -# ) -# ) -# ) - -# for list_pg_d, list_pg_t, list_Ap_n, list_Ap_t, in zip(pg_pXT_d, pg_pXT_t, Ap_n, Ap_t) -# ] - 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) + np.concatenate(elem) + for elem in zip(ag_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) + np.concatenate(elem) + for elem in zip(ag_t, Ap_t) ] + ns.ag_d = ag_d ns.ag_t = ag_t -- GitLab