aboutsummaryrefslogtreecommitdiff
path: root/utils/plot-energy
AgeCommit message (Collapse)Author
2020-11-30update code to work with python3tlatorre
This commit updates the python code to work with python 3 and with a newer version of matplotlib. - zip_longest -> izip_longest - fix tick marks for log plots - scipy.misc -> scipy.special
2020-07-06add first draft of plot-muonstlatorre
This commit adds a first draft of a script to plot the michel energy distribution and particle id histograms for data and Monte Carlo and to plot the energy bias and resolution for stopping muons.
2020-06-23first draft of a script to do the chi2 analysistlatorre
This commit adds a first draft of a script called chi2. This script calculates a chi2 for the null hypothesis test if the events in the energy range 20 MeV - 10 GeV match what we expect from atmospheric neutrino events.
2020-06-16update follower cuts to be more memory efficient by using ffill()tlatorre
2020-06-15create new plot-dc script to replace plot-energy --dctlatorre
2020-06-04update plot-energy to calculate likelihood ratiotlatorre
2020-05-12add a script to do a closure test on the contamination analysistlatorre
2020-05-11update ockham factor, remove hack, and don't submit all flasherstlatorre
This commit contains the following updates: - remove hack to get rid of low energy events in plot-energy since while writing the unidoc I realized it's not necessary now that we add +100 to multi-particle fits - update Ockham factor to use an energy resolution of 5% - update submit-grid-jobs to submit jobs according to the following criteria: - always submit prompt events with no data cleaning cuts - submit 10% of prompt flasher events - submit all other prompt events - submit followers only if they have no data cleaning cuts - update submit-grid-jobs to place the nhit cut of 100 on the calibrated nhit
2020-05-11add setup_matplotlib function and switch to logarithmic binstlatorre
This commit contains the following small updates: - create a setup_matplotlib() function to set up matplotlib correctly depending on if we are saving the plots or just displaying them - change default font size to 12 when displaying plots - switch to using logarithmic bins in plot-energy - fix despine() function when x axis is logarithmic
2020-05-11update utils/ folder to make a python package called sddmtlatorre
This commit adds an sddm python package to the utils/ folder. This allows me to consolidate code used across all the various scripts. This package is now installed by default to /home/tlatorre/local/lib/python2.7/site-packages so you should add the following to your .bashrc file: export PYTHONPATH=$HOME/local/lib/python2.7/site-packages/:$PYTHONPATH before using the scripts installed to ~/local/bin.
2020-04-13update plot-energy to fix a bug with muons and michels since we now store ↵tlatorre
more than one fit per particle combo
2020-04-13fix a few bugs in plot-energytlatorre
2020-01-20add a --save command line argument to plot-energytlatorre
This commit adds the --save command line argument to plot-energy to save either the corner plots or the energy distribution plots. It also updates the code to make plots similar to plot-fit-results. In addition there are a bunch of other small changes: - plot the theoretical Michel spectrum for free muons - energy plots now assume there are only a max of 2 particles fit for each event - display particle IDs as letters instead of numbers, i.e. 2022 -> eu
2020-01-20update plot-energy to plot energy bias and resolution for stopping muonstlatorre
To select stopping muons we simply look for the muons before a Michel event. The muon distance is calculated by first projecting the muon fit back to the PSUP along the fitted direction and then taking the distance between this point and the fitted position of the Michel event. I then calculate the expected kinetic energy of the muon by using the muon lookup tables of the CSDA range to convert the distance to an energy. I also changed a few other things like changing as_index=False -> group_keys=False when grouping events. The reason for this is just that if we do this we don't have to reset the index and drop the new index after calling apply(). I also fixed a small bug I had introduced recently where I selected only prompt events before finding the michel events and atmospheric events. This commit updates the plot-energy script to plot the energy bias and resolution for stopping muons by computing the expected
2020-01-06add script to calculate background contaminationtlatorre
This commit adds a script to calculate the background contamination using a method inspired by the bifurcated analysis method used in SNO. The method works by looking at the distribution of several high level variables (radius, udotr, psi, and reconstructed z position) for events tagged by the different data cleaning cuts and assuming that any background events which sneak past the data cleaning cuts will have a similar distribution (for certain backgrounds this is assumed and for others I will actually test this assumption. For more details see the unidoc). Then, by looking at the distribution of these high level variables for all the untagged events we can use a maximum likelihood fit to determine the residual contamination. There are also a few other updates to the plot-energy script: - add a --dc command line argument to plot corner plots for the high level variables used in the contamination analysis - add a fudge factor to the Ockham factor of 100 per extra particle - fix a bug by correctly setting the final kinetic energy to the sum of the individual kinetic energies instead of just the first particle - fix calculation of prompt events by applying at the run level
2019-10-05fix typo in plot-energytlatorre
2019-09-30fix a SettingWithCopyWarning in plot-energytlatorre
2019-09-30update plot-energy to sort events by GTIDtlatorre
2019-09-23select prompt events before data cleaning cutstlatorre
This commit updates plot-energy to select prompt events before applying the data cleaning cuts. This fixes an issue where we might accidentally classify an event as a prompt event even if it came after an event that was flagged by data cleaning. For example, suppose there was a breakdown but for whatever reason the event immediately after the breakdown wasn't tagged (ignoring the fact that we apply a breakdown follower cut). If we apply the data cleaning first and then the prompt event selection, that event would be a part of the prompt events. There are several other small updates to plot-energy: - fix bug in 00-orphan cut - make michel event selection a separate function - make atmospheric tag into a separate function
2019-09-23add sub_run variable to the events array in the HDF5 filetlatorre
This commit adds the sub_run variable to the ev array in the HDF5 output file and updates plot-energy to order the events using the run and sub_run variables. This fixes a potential issue where I was sorting by GTID before, but the GTID can wrap around and so isn't guaranteed to put the events in the right order.
2019-09-23add the 00-orphan cut to plot-energytlatorre
2019-09-09add retrigger, flasher follower, and breakdown follower cuts to plot-energytlatorre
2019-08-29add itc cut to plot-energytlatorre
2019-08-28unwrap the 50 MHz clock in plot-energytlatorre
2019-08-27fix the fts cuttlatorre
This commit fixes the FTS cut so that it returns 1 when the event is flagged as failing the cut. Previously, the function returned the following: not enough PMT pairs: 0 (fail) median time > 6.8 ns: 0 (fail) otherwise: 1 (pass) This had two issues: the return value wasn't consistent with the rest of the data cleaning cuts and it should pass if there aren't enough PMT pairs. Now, I fixed the not enough PMT pairs case and made the return value consistent with the rest of the data cleaning cuts: not enough PMT pairs: 0 (pass) median time > 6.8 ns: 1 (fail) otherwise: 0 (pass)
2019-07-12set ignore_index=True in pd.concat() since we don't care about the indextlatorre
2019-07-12fix a couple of bugs in plot-energytlatorre
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.
2019-07-11switch from YAML output to HDF5 to speed things uptlatorre
2019-07-04small updates to plot-energytlatorre
- apply muon follower and muon cuts to atmospheric sample - print warnings in red - fix how events with fmin = nan are counted
2019-06-26update plot-energy scripttlatorre
Tidy up the code in the script by creating a function to plot the energy distributions for each particle combo. Also fixed a bug which was causing the neutron follower cut not to be applied.
2019-06-26plot Michel electrons and muons in plot-energytlatorre
This commit is a major update to the plot-energy script. The most significant changes are: - new prompt event selection We now define prompt events as any event >= 100 nhit which is at least 250 ms away from the last 100 nhit event. - add Michel electron event selection. Michel electrons are now selected as any event between 800 ns and 20 microseconds after a muon or prompt event. Additionally they are required to be >= 100 nhit and pass an extra set of data cleaning cuts (compared to the prompt events). - add an atmospheric "sideband" I also updated the script to plot the energy distribution and particle ID for all events that *do* have a neutron follower as a kind of sideband which should contain only atmospheric events. - plot muon energy spectrum and angular distribution
2019-06-24update plot-energy to apply neutron follower cuttlatorre
2019-06-24update plot-energy to apply data cleaning cutstlatorre
2019-06-19update plot-energy to include ockham factortlatorre
2019-06-05fix x labeltlatorre
2019-06-05try to import CLoader if possible since it's *much* fastertlatorre
2019-06-05add a script to plot the total energy of the best fit resulttlatorre