From 812a30de4420e23c470e0321359bdc1633e432d1 Mon Sep 17 00:00:00 2001 From: Simon Krughoff Date: Thu, 25 Jan 2018 14:16:26 -0700 Subject: [PATCH] Add switches to dataset runner scripts These switches allow processing and verification steps to be turned off. --- examples/processData.sh | 2 +- examples/runCfhtQuickTest.sh | 50 ++++++++++++++++++++++++++------ examples/runCfhtTest.sh | 50 ++++++++++++++++++++++++++------ examples/runDecamQuickTest.sh | 51 ++++++++++++++++++++++++++------- examples/runDecamTest.sh | 51 ++++++++++++++++++++++++++------- examples/runHscQuickTest.sh | 54 ++++++++++++++++++++++++++--------- examples/runHscTest.sh | 54 ++++++++++++++++++++++++++--------- examples/validateRepo.sh | 3 +- 8 files changed, 249 insertions(+), 66 deletions(-) diff --git a/examples/processData.sh b/examples/processData.sh index 90dfdb6b..0dd94b22 100755 --- a/examples/processData.sh +++ b/examples/processData.sh @@ -11,7 +11,7 @@ ASTROMDIR=astrometry_net_data usage() { print_error - print_error "Usage: $0 [-cmvfiear] [-h] [-- ]" + print_error "Usage: $0 [-cmvfiear] [-h]" print_error print_error "Specifc options:" print_error " -c Camera" diff --git a/examples/runCfhtQuickTest.sh b/examples/runCfhtQuickTest.sh index d42b8946..634c59e2 100755 --- a/examples/runCfhtQuickTest.sh +++ b/examples/runCfhtQuickTest.sh @@ -7,12 +7,44 @@ CAMERA=CfhtQuick CONFIG_FILE="${PRODUCT_DIR}/config/cfhtConfig.py" MAPPER=lsst.obs.cfht.MegacamMapper -"${PRODUCT_DIR}/examples/processData.sh" \ - -c "$CAMERA" \ - -m "$MAPPER" \ - -v "$VALIDATION_DATA_DIR" \ - -f "$CONFIG_FILE" \ - -- "$@" -"${PRODUCT_DIR}/examples/validateRepo.sh" \ - -c "$CAMERA" \ - -- "$@" +print_error() { + >&2 echo "$@" +} + +DOPROCESS=true +DOVERIFY=true + +usage() { + print_error + print_error "Usage: $0 [-pv] [-h] [-- ]" + print_error + print_error "Specifc options:" + print_error " -p Skip processing?" + print_error " -v Skip verification?" + print_error " -h show this message" + exit 1 +} + +# thank OSX for not including getopt +while getopts "vph" option; do + case "$option" in + p) DOPROCESS=false;; + v) DOVERIFY=false;; + h) usage;; + esac +done +shift $((OPTIND-1)) + +if [[ $DOPROCESS == true ]] ; then + "${PRODUCT_DIR}/examples/processData.sh" \ + -c "$CAMERA" \ + -m "$MAPPER" \ + -v "$VALIDATION_DATA_DIR" \ + -f "$CONFIG_FILE" +fi + +if [[ $DOVERIFY = true ]] ; then + "${PRODUCT_DIR}/examples/validateRepo.sh" \ + -c "$CAMERA" \ + -- "$@" +fi diff --git a/examples/runCfhtTest.sh b/examples/runCfhtTest.sh index 81bfb55b..541c1bca 100755 --- a/examples/runCfhtTest.sh +++ b/examples/runCfhtTest.sh @@ -7,12 +7,44 @@ CAMERA=Cfht CONFIG_FILE="${PRODUCT_DIR}/config/cfhtConfig.py" MAPPER=lsst.obs.cfht.MegacamMapper -"${PRODUCT_DIR}/examples/processData.sh" \ - -c "$CAMERA" \ - -m "$MAPPER" \ - -v "$VALIDATION_DATA_DIR" \ - -f "$CONFIG_FILE" \ - -- "$@" -"${PRODUCT_DIR}/examples/validateRepo.sh" \ - -c "$CAMERA" \ - -- "$@" +print_error() { + >&2 echo "$@" +} + +DOPROCESS=true +DOVERIFY=true + +usage() { + print_error + print_error "Usage: $0 [-pv] [-h] [-- ]" + print_error + print_error "Specifc options:" + print_error " -p Skip processing?" + print_error " -v Skip verification?" + print_error " -h show this message" + exit 1 +} + +# thank OSX for not including getopt +while getopts "vph" option; do + case "$option" in + p) DOPROCESS=false;; + v) DOVERIFY=false;; + h) usage;; + esac +done +shift $((OPTIND-1)) + +if [[ $DOPROCESS == true ]] ; then + "${PRODUCT_DIR}/examples/processData.sh" \ + -c "$CAMERA" \ + -m "$MAPPER" \ + -v "$VALIDATION_DATA_DIR" \ + -f "$CONFIG_FILE" +fi + +if [[ $DOVERIFY = true ]] ; then + "${PRODUCT_DIR}/examples/validateRepo.sh" \ + -c "$CAMERA" \ + -- "$@" +fi diff --git a/examples/runDecamQuickTest.sh b/examples/runDecamQuickTest.sh index 25759e3b..38c8ba47 100755 --- a/examples/runDecamQuickTest.sh +++ b/examples/runDecamQuickTest.sh @@ -7,13 +7,44 @@ CAMERA=DecamQuick CONFIG_FILE="${PRODUCT_DIR}/config/decamConfig.py" MAPPER=lsst.obs.decam.DecamMapper -"${PRODUCT_DIR}/examples/processData.sh" \ - -c "$CAMERA" \ - -m "$MAPPER" \ - -v "$VALIDATION_DATA_DIR" \ - -f "$CONFIG_FILE" \ - -i ingestImagesDecam.py \ - -- "$@" -"${PRODUCT_DIR}/examples/validateRepo.sh" \ - -c "$CAMERA" \ - -- "$@" +print_error() { + >&2 echo "$@" +} + +DOPROCESS=true +DOVERIFY=true + +usage() { + print_error + print_error "Usage: $0 [-pv] [-h] [-- ]" + print_error + print_error "Specifc options:" + print_error " -p Skip processing?" + print_error " -v Skip verification?" + print_error " -h show this message" + exit 1 +} + +# thank OSX for not including getopt +while getopts "vph" option; do + case "$option" in + p) DOPROCESS=false;; + v) DOVERIFY=false;; + h) usage;; + esac +done +shift $((OPTIND-1)) + +if [[ $DOPROCESS == true ]] ; then + "${PRODUCT_DIR}/examples/processData.sh" \ + -c "$CAMERA" \ + -m "$MAPPER" \ + -v "$VALIDATION_DATA_DIR" \ + -f "$CONFIG_FILE" +fi + +if [[ $DOVERIFY = true ]] ; then + "${PRODUCT_DIR}/examples/validateRepo.sh" \ + -c "$CAMERA" \ + -- "$@" +fi diff --git a/examples/runDecamTest.sh b/examples/runDecamTest.sh index 06f9e1ee..4355a02c 100755 --- a/examples/runDecamTest.sh +++ b/examples/runDecamTest.sh @@ -7,13 +7,44 @@ CAMERA=Decam CONFIG_FILE="${PRODUCT_DIR}/config/decamConfig.py" MAPPER=lsst.obs.decam.DecamMapper -"${PRODUCT_DIR}/examples/processData.sh" \ - -c "$CAMERA" \ - -m "$MAPPER" \ - -v "$VALIDATION_DATA_DIR" \ - -f "$CONFIG_FILE" \ - -i ingestImagesDecam.py \ - -- "$@" -"${PRODUCT_DIR}/examples/validateRepo.py" \ - -c "$CAMERA" \ - -- "$@" +print_error() { + >&2 echo "$@" +} + +DOPROCESS=true +DOVERIFY=true + +usage() { + print_error + print_error "Usage: $0 [-pv] [-h] [-- ]" + print_error + print_error "Specifc options:" + print_error " -p Skip processing?" + print_error " -v Skip verification?" + print_error " -h show this message" + exit 1 +} + +# thank OSX for not including getopt +while getopts "vph" option; do + case "$option" in + p) DOPROCESS=false;; + v) DOVERIFY=false;; + h) usage;; + esac +done +shift $((OPTIND-1)) + +if [[ $DOPROCESS == true ]] ; then + "${PRODUCT_DIR}/examples/processData.sh" \ + -c "$CAMERA" \ + -m "$MAPPER" \ + -v "$VALIDATION_DATA_DIR" \ + -f "$CONFIG_FILE" +fi + +if [[ $DOVERIFY = true ]] ; then + "${PRODUCT_DIR}/examples/validateRepo.sh" \ + -c "$CAMERA" \ + -- "$@" +fi diff --git a/examples/runHscQuickTest.sh b/examples/runHscQuickTest.sh index 2cc848bc..6b3a50de 100755 --- a/examples/runHscQuickTest.sh +++ b/examples/runHscQuickTest.sh @@ -14,16 +14,44 @@ exit 1 ASTROMDIR=sdss-dr9-fink-v5b -"${PRODUCT_DIR}/examples/processData.sh" \ - -c "$CAMERA" \ - -m "$MAPPER" \ - -v "$VALIDATION_DATA_DIR" \ - -f "$CONFIG_FILE" \ - -e "fits" \ - -a "$ASTROMDIR" \ - -d "$CALIB_DATA" \ - -r \ - -- "$@" -"${PRODUCT_DIR}/examples/validateRepo.sh" \ - -c "$CAMERA" \ - -- "$@" +print_error() { + >&2 echo "$@" +} + +DOPROCESS=true +DOVERIFY=true + +usage() { + print_error + print_error "Usage: $0 [-pv] [-h] [-- ]" + print_error + print_error "Specifc options:" + print_error " -p Skip processing?" + print_error " -v Skip verification?" + print_error " -h show this message" + exit 1 +} + +# thank OSX for not including getopt +while getopts "vph" option; do + case "$option" in + p) DOPROCESS=false;; + v) DOVERIFY=false;; + h) usage;; + esac +done +shift $((OPTIND-1)) + +if [[ $DOPROCESS == true ]] ; then + "${PRODUCT_DIR}/examples/processData.sh" \ + -c "$CAMERA" \ + -m "$MAPPER" \ + -v "$VALIDATION_DATA_DIR" \ + -f "$CONFIG_FILE" +fi + +if [[ $DOVERIFY = true ]] ; then + "${PRODUCT_DIR}/examples/validateRepo.sh" \ + -c "$CAMERA" \ + -- "$@" +fi diff --git a/examples/runHscTest.sh b/examples/runHscTest.sh index 2b7b0640..a584900a 100755 --- a/examples/runHscTest.sh +++ b/examples/runHscTest.sh @@ -9,16 +9,44 @@ CONFIG_FILE="${PRODUCT_DIR}/config/hscConfig.py" MAPPER=lsst.obs.hsc.HscMapper ASTROMDIR=sdss-dr9-fink-v5b -"${PRODUCT_DIR}/examples/processData.sh" \ - -c "$CAMERA" \ - -m "$MAPPER" \ - -v "$VALIDATION_DATA_DIR" \ - -f "$CONFIG_FILE" \ - -e "fits" \ - -a "$ASTROMDIR" \ - -d "$CALIB_DATA" \ - -r \ - -- "$@" -"${PRODUCT_DIR}/examples/validateRepo.sh" \ - -c "$CAMERA" \ - -- "$@" +print_error() { + >&2 echo "$@" +} + +DOPROCESS=true +DOVERIFY=true + +usage() { + print_error + print_error "Usage: $0 [-pv] [-h] [-- ]" + print_error + print_error "Specifc options:" + print_error " -p Skip processing?" + print_error " -v Skip verification?" + print_error " -h show this message" + exit 1 +} + +# thank OSX for not including getopt +while getopts "vph" option; do + case "$option" in + p) DOPROCESS=false;; + v) DOVERIFY=false;; + h) usage;; + esac +done +shift $((OPTIND-1)) + +if [[ $DOPROCESS == true ]] ; then + "${PRODUCT_DIR}/examples/processData.sh" \ + -c "$CAMERA" \ + -m "$MAPPER" \ + -v "$VALIDATION_DATA_DIR" \ + -f "$CONFIG_FILE" +fi + +if [[ $DOVERIFY = true ]] ; then + "${PRODUCT_DIR}/examples/validateRepo.sh" \ + -c "$CAMERA" \ + -- "$@" +fi diff --git a/examples/validateRepo.sh b/examples/validateRepo.sh index db2ade5d..7e7cb5b7 100755 --- a/examples/validateRepo.sh +++ b/examples/validateRepo.sh @@ -36,7 +36,8 @@ WORKSPACE=${CAMERA} OUTPUT=${WORKSPACE}/output if ! [ -d "${OUTPUT}" ]; then - print_error "Repository does not exist. Please run processData.sh first." + print_error "Repository does not exist. Please run processData.sh first." + exit 1 fi # YAML config file for validation configuration