diff options
author | tlatorre <tlatorre@uchicago.edu> | 2020-07-06 11:29:47 -0500 |
---|---|---|
committer | tlatorre <tlatorre@uchicago.edu> | 2020-07-06 11:29:47 -0500 |
commit | d48be389e496801d48af305fad67c0d79bb7585a (patch) | |
tree | cc43c87fbe83ff02e283bcd9c2de14d4e3346f39 /utils | |
parent | 4f63d9b3bc6d15dd8962b5de81ccfc78a63f3b75 (diff) | |
download | sddm-d48be389e496801d48af305fad67c0d79bb7585a.tar.gz sddm-d48be389e496801d48af305fad67c0d79bb7585a.tar.bz2 sddm-d48be389e496801d48af305fad67c0d79bb7585a.zip |
small updates to plot-muons and plot_energy.py
- use pd.Series.where() instead of DataFrame.loc() to speed things up in
tag_michels
- don't set y limits when plotting bias and resolution for stopping
muons
Diffstat (limited to 'utils')
-rwxr-xr-x | utils/plot-muons | 2 | ||||
-rwxr-xr-x | utils/sddm/plot_energy.py | 8 |
2 files changed, 4 insertions, 6 deletions
diff --git a/utils/plot-muons b/utils/plot-muons index f130444..ab2be0e 100755 --- a/utils/plot-muons +++ b/utils/plot-muons @@ -203,7 +203,6 @@ if __name__ == '__main__': fig = plt.figure() plt.errorbar(T, dT['median']*100/T, yerr=dT['median_err']*100/T, color='C0', label="Data") plt.errorbar(T, dT_mc['median']*100/T, yerr=dT_mc['median_err']*100/T, color='C1', label="Monte Carlo") - plt.gca().set_ylim(-500,500) plt.legend() despine(fig,trim=True) plt.xlabel("Kinetic Energy (MeV)") @@ -218,7 +217,6 @@ if __name__ == '__main__': fig = plt.figure() plt.errorbar(T, dT['iqr_std']*100/T, yerr=dT['iqr_std_err']*100/T, color='C0', label="Data") plt.errorbar(T, dT_mc['iqr_std']*100/T, yerr=dT_mc['iqr_std_err']*100/T, color='C1', label="Monte Carlo") - plt.gca().set_ylim(-500,500) despine(fig,trim=True) plt.xlabel("Kinetic Energy (MeV)") plt.ylabel(r"Energy resolution (\%)") diff --git a/utils/sddm/plot_energy.py b/utils/sddm/plot_energy.py index 90c4498..cf59bc6 100755 --- a/utils/sddm/plot_energy.py +++ b/utils/sddm/plot_energy.py @@ -116,10 +116,10 @@ def tag_michels(ev): ev['michel'] &= ev.dc & (DC_JUNK | DC_CRATE_ISOTROPY | DC_QVNHIT | DC_FLASHER | DC_NECK | DC_ESUM | DC_OWL | DC_OWL_TRIGGER | DC_FTS) == 0 ev['michel'] &= ev.nhit >= 100 ev['michel'] &= (time_since_last_prompt_plus_muon > 800) & (time_since_last_prompt_plus_muon < 200e3) - ev.loc[~ev.michel,'muon_gtid'] = -1 - ev.loc[~ev.michel,'muon_nhit'] = -1 - ev['stopping_muon'] = np.zeros(len(ev),dtype=np.bool) - ev.loc[ev.gtid.isin(ev.muon_gtid[ev.muon_gtid > 0].values),'stopping_muon'] = 1 + ev['muon_gtid'] = ev.muon_gtid.where(ev.michel,other=-1) + ev['muon_nhit'] = ev.muon_nhit.where(ev.michel,other=-1) + ev['stopping_muon'] = np.ones(len(ev),dtype=np.bool) + ev['stopping_muon'] = ev.stopping_muon.where(ev.gtid.isin(ev.muon_gtid[ev.muon_gtid > 0].values),other=False) return ev def atmospheric_events(ev): |