aboutsummaryrefslogtreecommitdiff
path: root/utils/plot-fit-results
diff options
context:
space:
mode:
authortlatorre <tlatorre@uchicago.edu>2019-07-12 10:28:31 -0500
committertlatorre <tlatorre@uchicago.edu>2019-07-12 10:28:31 -0500
commit3c3720143201915729759478c7e7e36c71ac3bbd (patch)
treefe9af4c0f502c6638393ed3c792dc40f7c7660b8 /utils/plot-fit-results
parent80490012a62eff5ca61fff3ea1e8f2a5537523b0 (diff)
downloadsddm-3c3720143201915729759478c7e7e36c71ac3bbd.tar.gz
sddm-3c3720143201915729759478c7e7e36c71ac3bbd.tar.bz2
sddm-3c3720143201915729759478c7e7e36c71ac3bbd.zip
fix a couple of bugs in plot-energy
This commit fixes two small bugs in the plotting scripts. First, after the HDF5 commit I wasn't correctly computing the particle ID string which I had been using before which was needed in order to plot things correctly. Second, I realized that the dataframe groupby function first() actually selects the first non-null column from each group! What I really wanted was the first row from each group, so all instances of .first() were updated to .nth(0). See https://stackoverflow.com/questions/20067636/pandas-dataframe-get-first-row-of-each-group.
Diffstat (limited to 'utils/plot-fit-results')
-rwxr-xr-xutils/plot-fit-results2
1 files changed, 1 insertions, 1 deletions
diff --git a/utils/plot-fit-results b/utils/plot-fit-results
index 7115b81..cb90c8d 100755
--- a/utils/plot-fit-results
+++ b/utils/plot-fit-results
@@ -97,7 +97,7 @@ if __name__ == '__main__':
mcgn = pd.concat([pd.read_hdf(filename, "mcgn").assign(filename=filename) for filename in args.filenames])
# get rid of 2nd events like Michel electrons
- ev = ev.sort_values(['run','gtid']).groupby(['filename','evn'],as_index=False).first()
+ ev = ev.sort_values(['run','gtid']).groupby(['filename','evn'],as_index=False).nth(0)
# Now, we merge all three datasets together to produce a single
# dataframe. To do so, we join the ev dataframe with the mcgn frame