From ff7f5117095f451f5b62f9b3caec6a5d21bdd891 Mon Sep 17 00:00:00 2001 From: tlatorre Date: Sun, 27 Dec 2020 12:51:50 -0600 Subject: reduce memory usage --- utils/chi2 | 2 ++ utils/sddm/plot_energy.py | 2 +- utils/sddm/renormalize.py | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/utils/chi2 b/utils/chi2 index 4c1309b..fec97a7 100755 --- a/utils/chi2 +++ b/utils/chi2 @@ -559,6 +559,8 @@ if __name__ == '__main__': # Carlo. weights = pd.merge(weights,mcpl[['run','evn','unique_id']],on=['run','evn'],how='left') + del weights['evn'] + # There are a handful of weights which turn out to be slightly negative for # some reason. For example: # diff --git a/utils/sddm/plot_energy.py b/utils/sddm/plot_energy.py index c421db8..bdce750 100644 --- a/utils/sddm/plot_energy.py +++ b/utils/sddm/plot_energy.py @@ -63,7 +63,7 @@ def get_unique_id(df): Note: This has to match up with the calculation in read_mcpl_df(). """ - return hashlib.sha1(np.array([df['x'],df['y'],df['z']]).astype(int).view(np.uint8)).hexdigest() + return hashlib.sha1(np.array([df['x'],df['y'],df['z']]).astype(int).view(np.uint8)).hexdigest()[:8] def unwrap(p, delta, axis=-1): """ diff --git a/utils/sddm/renormalize.py b/utils/sddm/renormalize.py index 8d06263..55d09da 100644 --- a/utils/sddm/renormalize.py +++ b/utils/sddm/renormalize.py @@ -111,7 +111,7 @@ def read_mcpl_df(filename): # # Note: This has to match up with the calculation in get_unique_id() in # plot_energy.py. - unique_id = hashlib.sha1(ev[0,16:19].astype(int).view(np.uint8)).hexdigest() + unique_id = hashlib.sha1(ev[0,16:19].astype(int).view(np.uint8)).hexdigest()[:8] data.append((run,evn,nu,energy,r,cc,unique_id)) run, evn, nu, energy, r, cc, unique_id = zip(*data) -- cgit