Skip to content

Instantly share code, notes, and snippets.

View annawoodard's full-sized avatar

Anna Woodard annawoodard

  • University of Chicago
  • Chicago, USA
View GitHub Profile
@annawoodard
annawoodard / checkpoint.py
Last active September 6, 2023 20:52
pytorch checkpointing
def restart_from_checkpoint(checkpoint_path, restore_objects=None, **kwargs):
"""
Re-start training or inference from a previous checkpoint.
Args:
checkpoint_path (str): Path to checkpoint file
restore_objects (dict): Dict containing objects to reload from checkpoint
**kwargs (dict): Keyword args containing model states to reload
Returns:
from scipy.stats import norm
def detectable_difference(alpha, power, proportion, n_positives):
"""
Calculate the detectable difference in proportions for a given sample size, power, significance level, and proportion.
Parameters:
alpha: Significance level
power: Desired power of the test
@annawoodard
annawoodard / merge.pl
Created February 26, 2015 19:12
LHE file merger
#!/usr/bin/perl -w
################################################################################
# merge.pl
# Richard Corke (richard.corke@thep.lu.se)
#
# Changed structure to not read entire files into memory
#
# Based on merge.pl v1.2 by Michel Herquet (UCL-CP3)
# DESCRIPTION : script to merge to LHE events files
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@annawoodard
annawoodard / rsync.sh
Created March 23, 2021 14:52
rsync radiology -> cri
LOCK_NAME="chimec_sync"
LOCK_DIR='/tmp/'${LOCK_NAME}.lock
PID_FILE=${LOCK_DIR}'/'${LOCK_NAME}'.pid'
if mkdir ${LOCK_DIR} 2>/dev/null; then
# If the ${LOCK_DIR} doesn't exist, then start working & store the ${PID_FILE}
echo $$ > ${PID_FILE}
rsync --remove-source-files -avPz /mnt/hiro/ t.cri.awoodard@gardner.cri.uchicago.edu:/gpfs/data/huo-lab/Image/ChiMEC/ >& /home/annawoodard/rsync.log
rm -rf ${LOCK_DIR}
@annawoodard
annawoodard / python3-vs-numpy.ipynb
Created July 24, 2020 21:40
python-vs-numpy.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# only the first time:
git clone git@github.com:annawoodard/coffeandbacon.git
source coffeandbacon/setup_lcg.sh
pip install https://github.com/Parsl/parsl/zipball/master --user
mkdir coffeandbacon/analysis/runinfo
fs sa coffeandbacon/analysis/runinfo nd_campus rlidwk # this is necessary because condor logs will be written here-- otherwise jobs fail for me with a permission denied error
cd coffeandbacon/analysis/
./compile_corrections.py # this step could be automated, I'm just following what's already implemented
./boostedHbbProcessor.py # this step could be automated, I'm just following what's already implemented