aboutsummaryrefslogtreecommitdiff
path: root/utils
AgeCommit message (Collapse)Author
2020-05-12add a script to do a closure test on the contamination analysistlatorre
2020-05-11update python code to avoid importing matplotlib when running submit-grid-jobstlatorre
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-11don't import everything in __init__.pytlatorre
This commit updates utils/sddm/__init__.py to not import everything by default. The reason is that on the open science grid login machine they don't have the module scipy.stats by default.
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-27update submit-grid-jobs to include priority in condor submit filetlatorre
2020-04-27add a script to plot the results of the ROOT fitstlatorre
2020-04-15update submit-grid-jobs to add a priority column to the databasetlatorre
This commit updates submit-grid-jobs so that jobs are now submitted first in order of priority and then timestamp. So any jobs with a higher priority will be submitted preferentially first, and within each priority level jobs are submitted in the order they are added to the database.
2020-04-15add ability to retry jobs in submit-grid-jobstlatorre
This commit updates submit-grid-jobs to look for jobs in the RETRY state and to retry them if the number of retries is less than --max-retries. This way if you ever want to retry a bunch of jobs you can update the database: $ sqlite3 ~/state.db sqlite> update state set state = 'RETRY' where state == 'FAILED'; And then rerun submit-grid-jobs with more retries: $ submit-grid-jobs --max-retries 10 ---auto
2020-04-15fix typo in submit-grid-jobstlatorre
2020-04-14add some tests to gen-dark-mattertlatorre
2020-04-13speed up submit-grid-jobs a lot by only calling condor_q oncetlatorre
2020-04-13update plot-fit-results script to be able to handle files with ↵tlatorre
multi-particle fits
2020-04-13update plot script to be able to handle files with multi-particle fitstlatorre
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 cat-grid-jobs since I now add 2 fit results per particle combotlatorre
2020-04-13update plot script now that we have multiple fits per particle combotlatorre
2020-04-13fix a few bugs in plot-energytlatorre
2020-02-19add scripts to apply neutrino oscillations to the atmospheric fluxestlatorre
This commit adds four scripts: 1. calculate-atmospheric-oscillations This script uses an independent python package called nucraft to calculate the neutrino oscillation probabilities for atmospheric neutrinos. These probabilities are calculated as a function of energy and cosine of the zenith angle and stored in text files. 2. apply-atmospheric-oscillations This script combines the high energy 2D atmospheric neutrino flux from Barr and the low energy 1D flux from Battistoni and then applies neutrino oscillations to them. The results are then stored in new flux files that can be used with a modified version of GENIE to simulate the oscillated atmospheric neutrino flux from 10 MeV to 10 GeV. 3. plot-atmospheric-fluxes This is a simple script to plot the atmospheric flux files produced by apply-atmospheric-oscillations. 4. plot-atmospheric-oscillations This is a simple script to plot the 2D neutrino oscillation probabilities.
2020-01-21fix a few bugs in submit-grid-jobstlatorre
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-20from __future__ import print_function, divisiontlatorre
2020-01-20add some comments to analyze-genie-mctlatorre
2020-01-20update submit-grid-jobs to not add new jobs for runs which are already in ↵tlatorre
the database Also add a -r or --reprocess command line option to reprocess runs which are already in the database.
2020-01-20open files with 'r' so we don't update the timestamp if there are no new fit ↵tlatorre
results
2020-01-20specify -attributes to speed up condor_q in get_job_status()tlatorre
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-13update script to calculate contaminationtlatorre
This commit updates the dc script to calculate the instrumental contamination to now treat all 4 high level variables as correlated for muons. Previously I had assumed that the reconstructed radius was independent from udotr, z, and psi, but based on the corner plots it seems like the radius is strongly correlated with udotr. I also updated the plotting code when using the save command line argument to be similar to plot-fit-results.
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-12-04update submit-grid-jobs and cat-grid-jobstlatorre
This commit updates submit-grid-jobs so that it keeps a database of jobs. This allows the script to make sure that we only have a certain number of jobs in the job queue at a single time and automatically resubmitting failed jobs. The idea is that it can now be run once to add jobs to the database: $ submit-grid-jobs ~/zdabs/SNOCR_0000010000_000_p4_reduced.xzdab.gz and then be run periodically via crontab: PATH=/usr/bin:$HOME/local/bin SDDM_DATA=$HOME/sddm/src DQXX_DIR=$HOME/dqxx 0 * * * * submit-grid-jobs --auto --logfile ~/submit.log Similarly I updated cat-grid-jobs so that it uses the same database and can also be run via a cron job: PATH=/usr/bin:$HOME/local/bin SDDM_DATA=$HOME/sddm/src DQXX_DIR=$HOME/dqxx 0 * * * * cat-grid-jobs --logfile cat.log --output-dir $HOME/fit_results I also updated fit so that it keeps track of the total time elapsed including the initial fits instead of just counting the final fits.
2019-12-04update calculate_limits.py to produce nicer plotstlatorre
2019-12-04update plot-fit-results to make nicer plotstlatorre
2019-12-02small fix to prevent an Exception when there is only one data pointtlatorre
2019-11-22update plot-fit-results to use median and iqr instead of mean and stdtlatorre
This commit updates plot-fit-results to use the median when plotting the energy and position bias and the interquartile range (times 1.35) when plotting the energy and position resolution. The reason is that single large outliers for higher energy muons were causing the energy bias and resolution to no longer represent the central part of the distribution well.
2019-11-20fix small bug in cat-grid-jobstlatorre
This commit fixes a small bug in cat-grid-jobs which was causing it to print the wrong filename when there was no git_sha1 attrs in the HDF5 file.
2019-11-19update submit-grid-jobs to hopefully only run jobs on nodes which have modulestlatorre
I noticed that many of my jobs were failing with the following error: module: command not found My submit description files *should* only be selecting nodes with modules because of this line: requirements = (HAS_MODULES =?= true) && (OSGVO_OS_STRING == "RHEL 7") && (OpSys == "LINUX") which I think I got from https://support.opensciencegrid.org/support/solutions/articles/12000048518-accessing-software-using-distributed-environment-modules. I looked up what the =?= operator does and it's a case sensitive search. I also found another site (https://support.opensciencegrid.org/support/solutions/articles/5000633467-steer-your-jobs-with-htcondor-job-requirements) which uses the normal == operator. Therefore, I'm going to switch to the == operator and hope that fixes the issue.
2019-11-18fix a bug in the position generation in gen-dark-mattertlatorre
This commit fixes a bug in gen-dark matter which was causing the positions to all be generated with positive x, y, and z values. Doh!
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-25update zdab-reprocess to be faster and run FTP and RSPtlatorre
This commit updates the zdab-reprocess script with the following changes: - don't run RAA - don't run a bunch of the other fitters like FTI, etc. - run the path and RSP fitters - add --lower-nhit and --upper-nhit command line arguments to control the primary nhit cut range
2019-09-25fix another small bug in zdab-reprocesstlatorre
2019-09-24fix bugs introduced into zdab-reprocess in commit 1e35deatlatorre
2019-09-24update zdab-reprocess to be able to handle more filenamestlatorre
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