Skip to content

Commit

Permalink
Merge pull request #17 from lsst/bugfix/SIM-1264_remove_eups
Browse files Browse the repository at this point in the history
Removing EUPS and replacing productDir calls.
  • Loading branch information
mareuter committed Aug 24, 2015
2 parents ab1d668 + 0f85abd commit aef155b
Show file tree
Hide file tree
Showing 13 changed files with 56 additions and 56 deletions.
4 changes: 2 additions & 2 deletions examples/matchSEDs_examples/matchGalSEDs.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"input": [
"import os\n",
"import numpy as np\n",
"import eups\n",
"import lsst.utils\n",
"from lsst.sims.photUtils.Photometry import PhotometryBase as phot\n",
"\n",
"#Import sample galaxy catalog organized as [RA, Dec, z, mag_g, mag_r, mag_i, mag_z, mag_y]\n",
Expand Down Expand Up @@ -140,7 +140,7 @@
"#If using full SDSS ugriz then you do not have to load the Bandpasses ahead of time\n",
"#or specify the extCoeffs since these are the default values for matchToObserved.\n",
"sdssPhot = phot()\n",
"sdssPhot.loadTotalBandpassesFromFiles(['g', 'r', 'i', 'z'], bandpassDir = os.path.join(eups.productDir('throughputs'),'sdss'),\n",
"sdssPhot.loadTotalBandpassesFromFiles(['g', 'r', 'i', 'z'], bandpassDir = os.path.join(lsst.utils.getPackageDir('throughputs'),'sdss'),\n",
" bandpassRoot ='sdss_')\n",
"\n",
"catMagsObs = np.transpose([mag_g, mag_r, mag_i, mag_z])\n",
Expand Down
4 changes: 2 additions & 2 deletions examples/readGalfast_examples/readGalfastExample.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
"input": [
"import numpy as np\n",
"import os\n",
"import eups\n",
"import lsst.utils\n",
"from lsst.sims.photUtils.readGalfast import readGalfast\n",
"\n",
"#Setup list of km01 metallicity Kurucz SEDs\n",
"kuruczList = os.listdir(str(eups.productDir('sims_sed_library') + '/starSED/kurucz/'))\n",
"kuruczList = os.listdir(str(lsst.utils.getPackageDir('sims_sed_library') + '/starSED/kurucz/'))\n",
"km01List = []\n",
"for kuruczName in kuruczList:\n",
" if kuruczName.startswith('km01'):\n",
Expand Down
4 changes: 2 additions & 2 deletions python/lsst/sims/photUtils/Photometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

import os
import numpy
import eups
from collections import OrderedDict
import lsst.utils
from lsst.sims.photUtils import Sed, Bandpass, LSSTdefaults, calcGamma, \
calcMagError_m5, PhotometricParameters, magErrorFromSNR
from lsst.sims.utils import defaultSpecMap
Expand Down Expand Up @@ -63,7 +63,7 @@ class PhotometryHardware(object):
waveLenStep = None

def loadBandpassesFromFiles(self, bandpassNames=['u', 'g', 'r', 'i', 'z', 'y'],
filedir = os.path.join(eups.productDir('throughputs'), 'baseline'),
filedir = os.path.join(lsst.utils.getPackageDir('throughputs'), 'baseline'),
bandpassRoot = 'filter_',
componentList = ['detector.dat', 'm1.dat', 'm2.dat', 'm3.dat',
'lens1.dat', 'lens2.dat', 'lens3.dat'],
Expand Down
6 changes: 3 additions & 3 deletions python/lsst/sims/photUtils/matchUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
@author: Bryce Kalmbach
"""
import numpy as np
import eups
import os
import re

import lsst.utils
from lsst.sims.photUtils.Sed import Sed
from lsst.sims.photUtils.Bandpass import Bandpass
from lsst.sims.utils import SpecMap
Expand Down Expand Up @@ -158,7 +158,7 @@ def __init__(self, sEDDir = None, kuruczDir = None, mltDir = None, wdDir = None)
"""

if sEDDir is None:
self.sEDDir = eups.productDir('sims_sed_library')
self.sEDDir = lsst.utils.getPackageDir('sims_sed_library')
else:
self.sEDDir = sEDDir
#Use SpecMap to pull the directory locations
Expand Down Expand Up @@ -359,7 +359,7 @@ def __init__(self, galDir = None):
for key, val in sorted(specMap.subdir_map.iteritems()):
if re.match(key, specFileStart):
galSpecDir = str(val)
self.galDir = str(eups.productDir('sims_sed_library') + '/' + galSpecDir)
self.galDir = str(lsst.utils.getPackageDir('sims_sed_library') + '/' + galSpecDir)
else:
self.galDir = galDir

Expand Down
4 changes: 2 additions & 2 deletions python/lsst/sims/photUtils/readGalfast/readGalfast.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import os
import gzip
import pyfits
import eups
import itertools
import numpy as np

import lsst.utils
from lsst.sims.photUtils.Sed import Sed
from lsst.sims.photUtils.Bandpass import Bandpass
from lsst.sims.photUtils.selectStarSED import selectStarSED
Expand Down Expand Up @@ -206,7 +206,7 @@ def loadGalfast(self, filenameList, outFileList, sEDPath = None, kuruczPath = No

sdssPhot = phot()
sdssPhot.loadTotalBandpassesFromFiles(['u','g','r','i','z'],
bandpassDir = os.path.join(eups.productDir('throughputs'),
bandpassDir = os.path.join(lsst.utils.getPackageDir('throughputs'),
'sdss'),
bandpassRoot = 'sdss_')
sdssPhot.setupPhiArray_dict()
Expand Down
6 changes: 3 additions & 3 deletions python/lsst/sims/photUtils/selectGalaxySED.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import numpy as np
import eups

import lsst.utils
from lsst.sims.photUtils.Sed import Sed
from lsst.sims.photUtils.matchUtils import matchGalaxy
from lsst.sims.photUtils.Photometry import PhotometryBase as phot
Expand Down Expand Up @@ -51,7 +51,7 @@ def matchToRestFrame(self, sedList, catMags, mag_error = None, bandpassDict = No
galPhot = phot()
if bandpassDict is None:
galPhot.loadTotalBandpassesFromFiles(['u','g','r','i','z'],
bandpassDir = os.path.join(eups.productDir('throughputs'),'sdss'),
bandpassDir = os.path.join(lsst.utils.getPackageDir('throughputs'),'sdss'),
bandpassRoot = 'sdss_')
else:
galPhot.bandpassDict = bandpassDict
Expand Down Expand Up @@ -171,7 +171,7 @@ def matchToObserved(self, sedList, catMags, catRedshifts, catRA = None, catDec =
galPhot = phot()
if bandpassDict is None:
galPhot.loadTotalBandpassesFromFiles(['u','g','r','i','z'],
bandpassDir = os.path.join(eups.productDir('throughputs'),'sdss'),
bandpassDir = os.path.join(lsst.utils.getPackageDir('throughputs'),'sdss'),
bandpassRoot = 'sdss_')
else:
galPhot.bandpassDict = bandpassDict
Expand Down
6 changes: 3 additions & 3 deletions python/lsst/sims/photUtils/selectStarSED.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import os
import numpy as np
import eups
import warnings

import lsst.utils
from lsst.sims.photUtils.matchUtils import matchStar
from lsst.sims.photUtils.Photometry import PhotometryBase as phot
from lsst.sims.photUtils.EBV import EBVbase as ebv
Expand Down Expand Up @@ -72,8 +72,8 @@ def findSED(self, sedList, catMags, catRA = None, catDec = None, mag_error = Non

starPhot = phot()
if bandpassDict is None:
starPhot.loadTotalBandpassesFromFiles(['u','g','r','i','z'],
bandpassDir = os.path.join(eups.productDir('throughputs'),
starPhot.loadTotalBandpassesFromFiles(['u','g','r','i','z'],
bandpassDir = os.path.join(lsst.utils.getPackageDir('throughputs'),
'sdss'),
bandpassRoot = 'sdss_')
else:
Expand Down
28 changes: 14 additions & 14 deletions tests/testMatchSEDs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import shutil
import numpy as np
import re
import eups
import lsst.utils
import lsst.utils.tests as utilsTests
from lsst.sims.photUtils.selectStarSED import selectStarSED
from lsst.sims.photUtils.selectGalaxySED import selectGalaxySED
Expand All @@ -26,7 +26,7 @@ def setUpClass(cls):
for key, val in sorted(specMap.subdir_map.iteritems()):
if re.match(key, specFileStart):
galSpecDir = str(val)
cls.galDir = str(eups.productDir('sims_sed_library') + '/' + galSpecDir + '/')
cls.galDir = str(lsst.utils.getPackageDir('sims_sed_library') + '/' + galSpecDir + '/')
cls.filterList = ('u', 'g', 'r', 'i', 'z')

@classmethod
Expand All @@ -42,7 +42,7 @@ def testCalcMagNorm(self):
testUtils = matchBase()
testPhot = phot()
testPhot.loadTotalBandpassesFromFiles(self.filterList,
bandpassDir = os.path.join(eups.productDir('throughputs'),'sdss'),
bandpassDir = os.path.join(lsst.utils.getPackageDir('throughputs'),'sdss'),
bandpassRoot = 'sdss_')
testPhot.setupPhiArray_dict()

Expand Down Expand Up @@ -82,7 +82,7 @@ def testCalcBasicColors(self):
testSED = Sed()
testPhot = phot()
testPhot.loadTotalBandpassesFromFiles(self.filterList,
bandpassDir = os.path.join(eups.productDir('throughputs'),'sdss'),
bandpassDir = os.path.join(lsst.utils.getPackageDir('throughputs'),'sdss'),
bandpassRoot = 'sdss_')
testPhot.setupPhiArray_dict()

Expand All @@ -106,7 +106,7 @@ def testSEDCopyBasicColors(self):
testPhot = phot()

testPhot.loadTotalBandpassesFromFiles(self.filterList,
bandpassDir = os.path.join(eups.productDir('throughputs'),'sdss'),
bandpassDir = os.path.join(lsst.utils.getPackageDir('throughputs'),'sdss'),
bandpassRoot = 'sdss_')
testSED.readSED_flambda(str(self.galDir + os.listdir(self.galDir)[0]))
copyTest.setSED(wavelen = testSED.wavelen, flambda = testSED.flambda)
Expand Down Expand Up @@ -164,9 +164,9 @@ def setUpClass(cls):
os.makedirs(cls.testKDir)
os.mkdir(cls.testMLTDir)
os.mkdir(cls.testWDDir)
cls.kDir = eups.productDir('sims_sed_library') + '/' + cls._specMapDict['kurucz'] + '/'
cls.mltDir = eups.productDir('sims_sed_library') + '/' + cls._specMapDict['mlt'] + '/'
cls.wdDir = eups.productDir('sims_sed_library') + '/' + cls._specMapDict['wd'] + '/'
cls.kDir = lsst.utils.getPackageDir('sims_sed_library') + '/' + cls._specMapDict['kurucz'] + '/'
cls.mltDir = lsst.utils.getPackageDir('sims_sed_library') + '/' + cls._specMapDict['mlt'] + '/'
cls.wdDir = lsst.utils.getPackageDir('sims_sed_library') + '/' + cls._specMapDict['wd'] + '/'
kList = os.listdir(cls.kDir)[0:20]
#Use particular indices to get different types of seds within mlt and wds
for kFile, mltFile, wdFile in zip(kList,
Expand Down Expand Up @@ -324,7 +324,7 @@ def setUpClass(cls):
for key, val in sorted(specMap.subdir_map.iteritems()):
if re.match(key, specFileStart):
galSpecDir = str(val)
cls.galDir = str(eups.productDir('sims_sed_library') + '/' + galSpecDir + '/')
cls.galDir = str(lsst.utils.getPackageDir('sims_sed_library') + '/' + galSpecDir + '/')

#Set up Test Spectra Directory
cls.testSpecDir = 'testGalaxySEDSpectrum/'
Expand Down Expand Up @@ -388,7 +388,7 @@ def setUpClass(cls):
for key, val in sorted(specMap.subdir_map.iteritems()):
if re.match(key, specFileStart):
galSpecDir = str(val)
cls.galDir = str(eups.productDir('sims_sed_library') + '/' + galSpecDir + '/')
cls.galDir = str(lsst.utils.getPackageDir('sims_sed_library') + '/' + galSpecDir + '/')

#Set up Test Spectra Directory
cls.testSpecDir = 'testGalaxySEDSpectrum/'
Expand Down Expand Up @@ -599,9 +599,9 @@ def setUpClass(cls):
os.makedirs(cls.testKDir)
os.mkdir(cls.testMLTDir)
os.mkdir(cls.testWDDir)
cls.kDir = eups.productDir('sims_sed_library') + '/' + cls._specMapDict['kurucz'] + '/'
cls.mltDir = eups.productDir('sims_sed_library') + '/' + cls._specMapDict['mlt'] + '/'
cls.wdDir = eups.productDir('sims_sed_library') + '/' + cls._specMapDict['wd'] + '/'
cls.kDir = lsst.utils.getPackageDir('sims_sed_library') + '/' + cls._specMapDict['kurucz'] + '/'
cls.mltDir = lsst.utils.getPackageDir('sims_sed_library') + '/' + cls._specMapDict['mlt'] + '/'
cls.wdDir = lsst.utils.getPackageDir('sims_sed_library') + '/' + cls._specMapDict['wd'] + '/'
kList = os.listdir(cls.kDir)[0:3]
#Use particular indices to get different types of seds within mlt and wds
for kFile, mltFile, wdFile in zip(kList,
Expand Down Expand Up @@ -633,7 +633,7 @@ def testFindSED(self):
np.random.seed(42)
starPhot = phot()
starPhot.loadTotalBandpassesFromFiles(('u','g','r','i','z'),
bandpassDir = os.path.join(eups.productDir('throughputs'),'sdss'),
bandpassDir = os.path.join(lsst.utils.getPackageDir('throughputs'),'sdss'),
bandpassRoot = 'sdss_')
starPhot.setupPhiArray_dict()

Expand Down
4 changes: 2 additions & 2 deletions tests/testPhotometricParameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
import numpy
import unittest
import eups
import lsst.utils
import lsst.utils.tests as utilsTests

from lsst.sims.photUtils import Bandpass, Sed, PhotometricParameters, \
Expand Down Expand Up @@ -209,7 +209,7 @@ def testApplication(self):
testSed.setFlatSED()

testBandpass = Bandpass()
testBandpass.readThroughput(os.path.join(eups.productDir('throughputs'),
testBandpass.readThroughput(os.path.join(lsst.utils.getPackageDir('throughputs'),
'baseline','total_g.dat'))

control = testSed.calcADU(testBandpass,
Expand Down
22 changes: 11 additions & 11 deletions tests/testPhotometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import os
import unittest
import eups
import lsst.utils
import lsst.utils.tests as utilsTests
from lsst.sims.utils import ObservationMetaData
from lsst.sims.utils import defaultSpecMap
Expand Down Expand Up @@ -41,7 +41,7 @@ def testAlternateBandpassesStars(self):
boundType='circle',unrefractedRA=200.0,unrefractedDec=-30.0,
boundLength=1.0)

bandpassDir=os.path.join(eups.productDir('sims_photUtils'),'tests','cartoonSedTestData')
bandpassDir=os.path.join(lsst.utils.getPackageDir('sims_photUtils'),'tests','cartoonSedTestData')

cartoon_phot = PhotometryBase()
cartoon_phot.loadTotalBandpassesFromFiles(['u','g','r','i','z'],bandpassDir = bandpassDir,
Expand All @@ -60,7 +60,7 @@ def testAlternateBandpassesStars(self):
sedObj = Sed()
phiArray, waveLenStep = sedObj.setupPhiArray(bplist)

sedFileName = os.path.join(eups.productDir('sims_sed_library'),'starSED','kurucz')
sedFileName = os.path.join(lsst.utils.getPackageDir('sims_sed_library'),'starSED','kurucz')
sedFileName = os.path.join(sedFileName,'km20_5750.fits_g40_5790.gz')
ss = Sed()
ss.readSED_flambda(sedFileName)
Expand Down Expand Up @@ -117,7 +117,7 @@ class uncertaintyUnitTest(unittest.TestCase):
"""

def setUp(self):
starName = os.path.join(eups.productDir('sims_sed_library'),defaultSpecMap['km20_5750.fits_g40_5790'])
starName = os.path.join(lsst.utils.getPackageDir('sims_sed_library'),defaultSpecMap['km20_5750.fits_g40_5790'])
self.starSED = Sed()
self.starSED.readSED_flambda(starName)
imsimband = Bandpass()
Expand All @@ -132,16 +132,16 @@ def setUp(self):
'lens1.dat', 'lens2.dat', 'lens3.dat']
hardwareComponents = []
for c in componentList:
hardwareComponents.append(os.path.join(eups.productDir('throughputs'),'baseline',c))
hardwareComponents.append(os.path.join(lsst.utils.getPackageDir('throughputs'),'baseline',c))

self.bandpasses = ['u', 'g', 'r', 'i', 'z', 'y']
for b in self.bandpasses:
filterName = os.path.join(eups.productDir('throughputs'),'baseline','filter_%s.dat' % b)
filterName = os.path.join(lsst.utils.getPackageDir('throughputs'),'baseline','filter_%s.dat' % b)
components = hardwareComponents + [filterName]
bandpassDummy = Bandpass()
bandpassDummy.readThroughputList(components)
self.hardwareBandpasses.append(bandpassDummy)
components = components + [os.path.join(eups.productDir('throughputs'),'baseline','atmos.dat')]
components = components + [os.path.join(lsst.utils.getPackageDir('throughputs'),'baseline','atmos.dat')]
bandpassDummy = Bandpass()
bandpassDummy.readThroughputList(components)
self.totalBandpasses.append(bandpassDummy)
Expand Down Expand Up @@ -190,7 +190,7 @@ def testSignalToNoise(self):
photParams, seeing=defaults.seeing(filt)))


sedDir = eups.productDir('sims_sed_library')
sedDir = lsst.utils.getPackageDir('sims_sed_library')
sedDir = os.path.join(sedDir, 'starSED', 'kurucz')
fileNameList = os.listdir(sedDir)

Expand Down Expand Up @@ -242,7 +242,7 @@ def testRawUncertainty(self):

for i in range(len(self.bandpasses)):
skyDummy = Sed()
skyDummy.readSED_flambda(os.path.join(eups.productDir('throughputs'), 'baseline', 'darksky.dat'))
skyDummy.readSED_flambda(os.path.join(lsst.utils.getPackageDir('throughputs'), 'baseline', 'darksky.dat'))
normalizedSkyDummy = setM5(obs_metadata.m5[self.bandpasses[i]], skyDummy,
self.totalBandpasses[i], self.hardwareBandpasses[i],
seeing=LSSTdefaults().seeing(self.bandpasses[i]),
Expand Down Expand Up @@ -280,7 +280,7 @@ def testSystematicUncertainty(self):

for i in range(len(self.bandpasses)):
skyDummy = Sed()
skyDummy.readSED_flambda(os.path.join(eups.productDir('throughputs'), 'baseline', 'darksky.dat'))
skyDummy.readSED_flambda(os.path.join(lsst.utils.getPackageDir('throughputs'), 'baseline', 'darksky.dat'))
normalizedSkyDummy = setM5(obs_metadata.m5[self.bandpasses[i]], skyDummy,
self.totalBandpasses[i], self.hardwareBandpasses[i],
seeing=LSSTdefaults().seeing(self.bandpasses[i]),
Expand Down Expand Up @@ -325,7 +325,7 @@ def testNoSystematicUncertainty(self):

for i in range(len(self.bandpasses)):
skyDummy = Sed()
skyDummy.readSED_flambda(os.path.join(eups.productDir('throughputs'), 'baseline', 'darksky.dat'))
skyDummy.readSED_flambda(os.path.join(lsst.utils.getPackageDir('throughputs'), 'baseline', 'darksky.dat'))
normalizedSkyDummy = setM5(obs_metadata.m5[self.bandpasses[i]], skyDummy,
self.totalBandpasses[i], self.hardwareBandpasses[i],
seeing=LSSTdefaults().seeing(self.bandpasses[i]),
Expand Down
8 changes: 4 additions & 4 deletions tests/testReadGalfast.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import gzip
import pyfits
import re
import eups
import lsst.utils
import lsst.utils.tests as utilsTests
from lsst.sims.photUtils.readGalfast.readGalfast import readGalfast
from lsst.sims.utils import SpecMap
Expand Down Expand Up @@ -38,9 +38,9 @@ def setUpClass(cls):
os.makedirs(cls.testKDir)
os.mkdir(cls.testMLTDir)
os.mkdir(cls.testWDDir)
cls.kDir = eups.productDir('sims_sed_library') + '/' + cls._specMapDict['kurucz'] + '/'
cls.mltDir = eups.productDir('sims_sed_library') + '/' + cls._specMapDict['mlt'] + '/'
cls.wdDir = eups.productDir('sims_sed_library') + '/' + cls._specMapDict['wd'] + '/'
cls.kDir = lsst.utils.getPackageDir('sims_sed_library') + '/' + cls._specMapDict['kurucz'] + '/'
cls.mltDir = lsst.utils.getPackageDir('sims_sed_library') + '/' + cls._specMapDict['mlt'] + '/'
cls.wdDir = lsst.utils.getPackageDir('sims_sed_library') + '/' + cls._specMapDict['wd'] + '/'
#Use particular indices to get different types of seds within mlt and wds
for kFile, mltFile, wdFile in zip(os.listdir(cls.kDir)[0:20],
np.array(os.listdir(cls.mltDir))[np.arange(-10,11)],
Expand Down
Loading

0 comments on commit aef155b

Please sign in to comment.