Skip to content

Instantly share code, notes, and snippets.

@pdeperio
Last active February 10, 2018 15:54
Show Gist options
  • Save pdeperio/2203f4bf2006b83a844db31a238ecd74 to your computer and use it in GitHub Desktop.
Save pdeperio/2203f4bf2006b83a844db31a238ecd74 to your computer and use it in GitHub Desktop.
Waveform stitching
# Make sure to use same pax version as processing
source activate pax_v6.8.0
# Output directories
mkdir -p s1 s2 joined
RAWDIR=/project/lgrandi/xenon1t/raw_for_waveforms
# Specify SR to use same maps as processing
SCIENCE_RUN=1
DATASET=170606_0556
RUN_NUMBER=10233
EVENT_NUMBER=15001
FULLPATH=${RAWDIR}/${DATASET}
# Create S1 and S2 zoom plots
paxer --config XENON1T SR${SCIENCE_RUN}_parameters --input ${FULLPATH} --event ${EVENT_NUMBER} --plot_interactive --output s1 --config_string "[Plotting.PeakViewer]starting_peak='main_s1'" &
paxer --config XENON1T SR${SCIENCE_RUN}_parameters --input ${FULLPATH} --event ${EVENT_NUMBER} --plot_interactive --output s2 --config_string "[Plotting.PeakViewer]starting_peak='main_s2'" &
# Parallelize above two commands cuz they take forever
wait
# Output file name format
PAX_PNG_FILENAME=`printf "%06d\n" ${RUN_NUMBER}`_`printf "%06d\n" ${EVENT_NUMBER}`
# Running paxer with SR${SCIENCE_RUN}_parameters config sets run number to 0 for some reason
# in output files, so rename accordingly
mv s1/`printf "%06d\n" 0`_`printf "%06d\n" ${EVENT_NUMBER}`.png s1/${PAX_PNG_FILENAME}.png
mv s2/`printf "%06d\n" 0`_`printf "%06d\n" ${EVENT_NUMBER}`.png s2/${PAX_PNG_FILENAME}.png
# First crop out bottom half of S1 image
convert s1/${PAX_PNG_FILENAME}.png -gravity north -crop 100x50% +repage ${PAX_PNG_FILENAME}_s1_crop.png
# Then stitch to top of S2 image
convert -append ${PAX_PNG_FILENAME}_s1_crop.png s2/${PAX_PNG_FILENAME}.png joined/${PAX_PNG_FILENAME}_join.png
# Cleanup
rm ${PAX_PNG_FILENAME}_s1_crop.png
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment