Forked from
EIC / detectors / athena
128 commits behind the upstream repository.
-
Whitney Armstrong authoredWhitney Armstrong authored
generate_eps 1.98 KiB
#!/bin/bash
#trignometry
sin ()
{
echo "scale=5;s($1)" | bc -l
}
cos ()
{
echo "scale=5;c($1)" | bc -l
}
tan ()
{
echo "scale=5;s($1)/c($1)" | bc -l
}
#export DAWN_PS_PREVIEWER="derp"
function print_the_help {
echo "USAGE: $0 <PRIM_FILE> "
echo " OPTIONS: "
echo " -t,--tag filename tag (default: view1)"
exit
}
FILE_TAG="view11"
INPUT_FILE="g4_0000.prim"
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-h|--help)
shift # past argument
print_the_help
;;
-t|--tag)
FILE_TAG="$2"
shift # past argument
shift # past value
;;
-i|--input)
INPUT_FILE="$2"
shift # past argument
shift # past value
;;
*) # unknown option
#POSITIONAL+=("$1") # save it in an array for later
echo "unknown option $1"
print_the_help
shift # past argument
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
echo "view11 produces a series of slightly rotated XY slices a different z locations. Along beamline"
#dawncut 1 0 0 100 ${INPUT_FILE} ${FILE_TAG}_temp0.prim
#dawncut -1 0 0 100 ${FILE_TAG}_temp0.prim ${FILE_TAG}.prim
#cp ${INPUT_FILE} ${FILE_TAG}.prim
dawncut 1 0 -0.01666 200 ${INPUT_FILE} ${FILE_TAG}_temp0.prim
dawncut -1 0 0.01666 200 ${FILE_TAG}_temp0.prim ${FILE_TAG}.prim
dawn -d ${FILE_TAG}.prim
ps2pdf ${FILE_TAG}.eps ${FILE_TAG}_full.pdf
gs -o ${FILE_TAG}.pdf -sDEVICE=pdfwrite \
-c "[/CropBox [51 250 550 590] /PAGES pdfmark" \
-f ${FILE_TAG}_full.pdf
pdftoppm ${FILE_TAG}.pdf ${FILE_TAG} -png -singlefile -cropbox
dawncut 1 0 -0.01666 200 ${INPUT_FILE} ${FILE_TAG}a_temp0.prim
dawncut -1 0 0.01666 200 ${FILE_TAG}a_temp0.prim ${FILE_TAG}a.prim
dawn -d ${FILE_TAG}a.prim
ps2pdf ${FILE_TAG}a.eps ${FILE_TAG}a_full.pdf
gs -o ${FILE_TAG}a.pdf -sDEVICE=pdfwrite \
-c "[/CropBox [51 250 550 590] /PAGES pdfmark" \
-f ${FILE_TAG}a_full.pdf
pdftoppm ${FILE_TAG}a.pdf ${FILE_TAG}a -png -singlefile -cropbox