Skip to content

Commit

Permalink
Merge pull request #13 from lsst/tickets/DM-14842
Browse files Browse the repository at this point in the history
DM-14842: Fix deprecation warnings from PropertyList/Set.get
  • Loading branch information
r-owen committed Jun 22, 2018
2 parents 6eadbc3 + a5fa565 commit 4ef91f3
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
*.pyc
.scon*
_build.*
.cache
.pytest_cache
pytest_session.txt
.coverage
tests/.tests
config.log
ups/*.cfgc
python/lsst/obs/comCam/version.py
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
sudo: false
language: python
matrix:
include:
- python: '3.6'
install:
- pip install flake8
script: flake8
21 changes: 10 additions & 11 deletions python/lsst/obs/comCam/ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def __init__(self, config, *args, **kwargs):
def getInfo(self, filename):
""" Get the basename and other data which is only available from the filename/path.
This seems fragile, but this is how the teststand data will *always* be written out,
This seems fragile, but this is how the teststand data will *always* be written out,
as the software has been "frozen" as they are now in production mode.
Parameters
Expand Down Expand Up @@ -51,11 +51,11 @@ def getInfo(self, filename):
if runId != phuInfo['run']:
raise RuntimeError("Expected runId %s, found %s from path %s" % phuInfo['run'], runId, pathname)

phuInfo['raftId'] = raftId # also in the header - RAFTNAME
phuInfo['field'] = acquisitionType # NOT in the header
phuInfo['jobId'] = int(jobId) # NOT in the header
phuInfo['raftId'] = raftId # also in the header - RAFTNAME
phuInfo['field'] = acquisitionType # NOT in the header
phuInfo['jobId'] = int(jobId) # NOT in the header
phuInfo['raft'] = 'R00'
phuInfo['ccd'] = sensorLocationInRaft # NOT in the header
phuInfo['ccd'] = sensorLocationInRaft # NOT in the header

return phuInfo, infoList

Expand All @@ -81,12 +81,13 @@ def translate_wavelength(self, md):
wavelength : `int`
The recorded wavelength as an int
"""
raw_wl = md.get("MONOWL")
raw_wl = md.getScalar("MONOWL")
wl = int(round(raw_wl))
if abs(raw_wl-wl) >= 0.1:
logger = lsstLog.Log.getLogger('obs.comCam.ingest')
logger.warn(
'Translated significantly non-integer wavelength; %s is more than 0.1nm from an integer value', raw_wl)
'Translated significantly non-integer wavelength; '
'%s is more than 0.1nm from an integer value', raw_wl)
return wl

def translate_visit(self, md):
Expand All @@ -104,19 +105,17 @@ def translate_visit(self, md):
visit_num : `int`
Visit number, as translated
"""
mjd = md.get("MJD-OBS")
mjd = md.getScalar("MJD-OBS")
mmjd = mjd - 55197 # relative to 2010-01-01, just to make the visits a tiny bit smaller
return int(1e5*mmjd) # 86400s per day, so we need this resolution

##############################################################################################################


class ComCamCalibsParseTask(CalibsParseTask):
"""Parser for calibs"""

def _translateFromCalibId(self, field, md):
"""Get a value from the CALIB_ID written by constructCalibs"""
data = md.get("CALIB_ID")
data = md.getScalar("CALIB_ID")
match = re.search(".*%s=(\S+)" % field, data)
return match.groups()[0]

Expand Down
9 changes: 9 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[flake8]
max-line-length = 110
ignore = E133, E226, E228, N802, N803, N806
exclude = __init__.py, config/*

[tool:pytest]
addopts = --flake8
flake8-ignore = E133 E226 E228 N802 N803 N806
config/*
2 changes: 1 addition & 1 deletion tests/SConscript
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# -*- python -*-
from lsst.sconsUtils import scripts
scripts.BasicSConscript.tests()
scripts.BasicSConscript.tests(pyList=[])
22 changes: 22 additions & 0 deletions tests/test_import.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import unittest

import lsst.utils.tests
import lsst.obs.comCam


class ImportTest(unittest.TestCase):
def testImport(self):
self.assertTrue(hasattr(lsst.obs.comCam, "ComCam"))


class TestMemory(lsst.utils.tests.MemoryTestCase):
pass


def setup_module(module):
lsst.utils.tests.init()


if __name__ == "__main__":
lsst.utils.tests.init()
unittest.main()

0 comments on commit 4ef91f3

Please sign in to comment.