Skip to content

Commit

Permalink
Whitespace and shellcheck fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
wmwv committed Feb 14, 2016
1 parent fdac689 commit a673f37
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 48 deletions.
2 changes: 0 additions & 2 deletions bin.src/makeRunList.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
import os.path
import sys

import yaml

from lsst.validate.drp import validate


Expand Down
3 changes: 2 additions & 1 deletion examples/runCfhtQuickTest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ CAMERA=CfhtQuick
CONFIG_FILE="${PRODUCT_DIR}"/config/anetAstrometryConfig.py
MAPPER=lsst.obs.cfht.MegacamMapper

"${PRODUCT_DIR}"/examples/runExample.sh $CAMERA $MAPPER ${VALIDATION_DATA_CFHT_DIR}/raw "${CONFIG_FILE}"
"${PRODUCT_DIR}"/examples/runExample.sh $CAMERA $MAPPER \
${VALIDATION_DATA_CFHT_DIR}/raw "${CONFIG_FILE}"
3 changes: 2 additions & 1 deletion examples/runCfhtTest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ CAMERA=Cfht
CONFIG_FILE="${PRODUCT_DIR}"/config/anetAstrometryConfig.py
MAPPER=lsst.obs.cfht.MegacamMapper

"${PRODUCT_DIR}"/examples/runExample.sh $CAMERA $MAPPER ${VALIDATION_DATA_CFHT_DIR}/raw "${CONFIG_FILE}"
"${PRODUCT_DIR}"/examples/runExample.sh $CAMERA $MAPPER \
"${VALIDATION_DATA_CFHT_DIR}/raw" "${CONFIG_FILE}"
4 changes: 3 additions & 1 deletion examples/runDecamQuickTest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ CAMERA=DecamQuick
CONFIG_FILE="${PRODUCT_DIR}"/config/decamConfig.py
MAPPER=lsst.obs.decam.DecamMapper

"${PRODUCT_DIR}"/examples/runExample.sh $CAMERA $MAPPER ${VALIDATION_DATA_DECAM_DIR}/instcal "${CONFIG_FILE}" ingestImagesDecam.py processCcdDecam.py
"${PRODUCT_DIR}"/examples/runExample.sh $CAMERA $MAPPER \
${VALIDATION_DATA_DECAM_DIR}/instcal "${CONFIG_FILE}" \
ingestImagesDecam.py processCcdDecam.py
4 changes: 3 additions & 1 deletion examples/runDecamTest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ CAMERA=Decam
CONFIG_FILE="${PRODUCT_DIR}"/config/decamConfig.py
MAPPER=lsst.obs.decam.DecamMapper

"${PRODUCT_DIR}"/examples/runExample.sh $CAMERA $MAPPER ${VALIDATION_DATA_DECAM_DIR}/instcal "${CONFIG_FILE}" ingestImagesDecam.py processCcdDecam.py
"${PRODUCT_DIR}"/examples/runExample.sh $CAMERA $MAPPER \
"${VALIDATION_DATA_DECAM_DIR}/instcal" "${CONFIG_FILE}" \
ingestImagesDecam.py processCcdDecam.py
14 changes: 7 additions & 7 deletions examples/runExample.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,22 @@ if [[ -z "$DYLD_LIBRARY_PATH" ]]; then
fi

WORKSPACE=${CAMERA}
if [ -d ${WORKSPACE} ]; then
rm -rf ${WORKSPACE}
if [ -d "${WORKSPACE}" ]; then
rm -rf "${WORKSPACE}"
fi

# cleanup and create directories
echo "Ingesting Raw data"
INPUT=${WORKSPACE}/input
mkdir -p $INPUT
mkdir -p "$INPUT"
OUTPUT=${WORKSPACE}/output
mkdir -p $OUTPUT
mkdir -p "$OUTPUT"

echo $MAPPER > ${INPUT}/_mapper
echo "$MAPPER" > "${INPUT}"/_mapper

# ingest raw data
RAWDATA=${VALIDATION_DATA}
${INGEST} ${INPUT} "${RAWDATA}"/*.fz --mode link
${INGEST} "${INPUT}" "${RAWDATA}"/*.fz --mode link

# Set up astrometry
export ASTROMETRY_NET_DATA_DIR="${VALIDATION_DATA}"/../astrometry_net_data
Expand All @@ -64,7 +64,7 @@ makeRunList.py "${YAMLCONFIG}" > "${RUNLIST}"
${PROCESSCCD} "${INPUT}" --output "${OUTPUT}" \
@"${RUNLIST}" \
--logdest "${WORKSPACE}"/processCcd.log \
--configfile ${CONFIG_FILE} \
--configfile "${CONFIG_FILE}" \
-j $NUMPROC

# Run astrometry check on src
Expand Down
3 changes: 1 addition & 2 deletions python/lsst/validate/drp/calcSrd.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

from .util import averageRaFromCat, averageDecFromCat
from .srdSpec import srdSpec
from lsst.afw.table import matchRaDec


def calcPA1(groupView, magKey):
Expand Down Expand Up @@ -317,7 +316,7 @@ def matchVisitComputeDistance(visit_obj1, ra_obj1, dec_obj1,
visit_obj2, ra_obj2, dec_obj2):
"""Calculate obj1-obj2 distance for each visit in which both objects are seen.
For each visit shared between visit_obj1 and visit_obj2,
For each visit shared between visit_obj1 and visit_obj2,
calculate the spherical distance between the obj1 and obj2.
Inputs
Expand Down
10 changes: 5 additions & 5 deletions python/lsst/validate/drp/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ def plotAstrometry(mag, mmagerr, mmagrms, dist, match, good_mag_limit=19.5,
ax[0].set_ylim([0., 500.])
ax[0].set_ylabel("Distance [mas]")
ax[0].set_title("Median : %.1f, %.1f mas" %
(bright_dist_median, dist_median),
x=0.55, y=0.88)
(bright_dist_median, dist_median),
x=0.55, y=0.88)
plotOutlinedLines(ax[0], dist_median, bright_dist_median)

ax[1].scatter(mag, dist, s=10, color=color['all'], label='All')
Expand Down Expand Up @@ -262,7 +262,7 @@ def plotPA1(gv, magKey, plotbase=""):
# ax1.set_xlabel(u"12-pixel aperture magnitude")
ax1.set_xlabel("psf magnitude")
ax1.set_ylabel("psf magnitude diff (mmag)")
for label in ax2.get_yticklabels():
for label in ax2.get_yticklabels():
label.set_visible(False)

plt.suptitle("PA1: %s" % plotbase.rstrip('_'))
Expand Down Expand Up @@ -331,7 +331,7 @@ def plotAMx(rmsDistMas, annulus, magrange,
ax1.axvline(AMx, 0, 1, linewidth=2, color='red',
label='AM%d: %.2f mas' % (x, AMx))
ax1.axvline(AMx+ADx, 0, 1, linewidth=2, color='green',
label='AM%d+AD%d: %.2f mas\nAF%d: %2.f%% > AM%d+AD%d = %2.f%%' %\
label='AM%d+AD%d: %.2f mas\nAF%d: %2.f%% > AM%d+AD%d = %2.f%%' %
(x, x, AMx+ADx, x, AFx, x, x, percentOver))

ax1.set_title('The %d stars separated by D = [%.2f, %.2f] arcmin' %
Expand All @@ -343,6 +343,6 @@ def plotAMx(rmsDistMas, annulus, magrange,
ax1.legend(loc='upper right', fontsize=16)

figName = plotbase+'D_%d_ARCMIN_%.1f-%.1f.png' % \
(int(sum(annulus)/2), magrange[0], magrange[1])
(int(sum(annulus)/2), magrange[0], magrange[1])

plt.savefig(figName, dpi=300)
7 changes: 3 additions & 4 deletions python/lsst/validate/drp/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,9 @@ def loadAndMatchData(repo, visitDataIds,
# create temporary catalog
tmpCat = SourceCatalog(SourceCatalog(newSchema).table)
tmpCat.extend(oldSrc, mapper=mapper)
(tmpCat['base_PsfFlux_mag'][:],
tmpCat['base_PsfFlux_magerr'][:]) = \
calib.getMagnitude(tmpCat['base_PsfFlux_flux'],
tmpCat['base_PsfFlux_fluxSigma'])
(tmpCat['base_PsfFlux_mag'][:], tmpCat['base_PsfFlux_magerr'][:]) = \
calib.getMagnitude(tmpCat['base_PsfFlux_flux'],
tmpCat['base_PsfFlux_fluxSigma'])
srcVis.extend(tmpCat, False)
mmatch.add(catalog=tmpCat, dataId=vId)

Expand Down
17 changes: 5 additions & 12 deletions tests/testCoord.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,17 @@

from __future__ import print_function

import os
import sys

import unittest
import warnings

import numpy as np
from numpy.testing import assert_allclose

import lsst.afw.geom as afwGeom
import lsst.afw.coord as afwCoord
import lsst.pex.exceptions as pexExcept
import lsst.utils.tests as utilsTests

from lsst.validate.drp.base import ValidateError
from lsst.validate.drp import util, calcSrd
from lsst.validate.drp import util
from lsst.validate.drp.plot import plotAMx


Expand All @@ -58,25 +53,23 @@ def setUp(self):
self.annulus = [1, 2]
self.magrange = [20, 25]


def tearDown(self):
pass


def testZeroDecSimpleAverageCoord(self):
meanRa, meanDec = util.averageRaDec(self.simpleRa, self.zeroDec)
assert_allclose([20, 0], np.rad2deg([meanRa, meanDec]))

def testSimpleAverageCoord(self):
meanRa, meanDec = util.averageRaDec(self.simpleRa, self.simpleDec)
assert_allclose([19.493625, 37.60447], np.rad2deg([meanRa, meanDec]))

def testPlotAMxFailureEmpty(self):
self.assertRaises(ValidateError,
self.assertRaises(ValidateError,
plotAMx, [], self.annulus, self.magrange, x=1)

def testPlotAMxFailureNox(self):
self.assertRaises(ValidateError,
self.assertRaises(ValidateError,
plotAMx, self.simpleRms, self.annulus, self.magrange, x=None)


Expand Down
14 changes: 2 additions & 12 deletions tests/testLoading.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,11 @@
import sys

import unittest
import warnings

import numpy as np
from numpy.testing import assert_allclose

import lsst.afw.geom as afwGeom
import lsst.afw.coord as afwCoord
import lsst.pex.exceptions as pexExcept
import lsst.utils
import lsst.utils.tests as utilsTests

from lsst.validate.drp.base import ValidateError
from lsst.validate.drp import util, calcSrd, validate
from lsst.validate.drp import validate


class LoadDataTestCase(unittest.TestCase):
Expand All @@ -51,11 +43,9 @@ def setUp(self):
testDataDir = os.path.join(validateDrpDir, 'tests')
self.configFile = os.path.join(testDataDir, 'runCfht.yaml')


def tearDown(self):
pass


def testLoadingOfConfigFile(self):
dataIds, good_mag_limit, \
medianAstromscatterRef, medianPhotoscatterRef, matchRef = \
Expand All @@ -66,7 +56,7 @@ def testLoadingOfConfigFile(self):
self.assertAlmostEqual(matchRef, 5000)
# Tests of the dict entries require constructing and comparing sets
self.assertEqual(set(['r']), set([d['filter'] for d in dataIds]))
self.assertEqual(set([849375, 850587]),
self.assertEqual(set([849375, 850587]),
set([d['visit'] for d in dataIds]))


Expand Down

0 comments on commit a673f37

Please sign in to comment.