Skip to content

Commit

Permalink
desi_root only defined at NERSC
Browse files Browse the repository at this point in the history
  • Loading branch information
moustakas committed Jan 2, 2024
1 parent 08abfa0 commit 7c839d4
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions py/desispec/test/test_photo.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@

import numpy as np
from desispec.io.photo import gather_targetphot, gather_tractorphot, gather_targetdirs

from desispec.io.meta import get_desi_root_readonly
desi_root = get_desi_root_readonly()

if 'NERSC_HOST' in os.environ and os.getenv('DESI_SPECTRO_DATA') == os.path.join(desi_root, 'spectro', 'data'):
standard_nersc_environment = True
Expand Down Expand Up @@ -64,6 +62,7 @@ def setUp(self):
@unittest.skipUnless(standard_nersc_environment, "not at NERSC")
def test_gather_targetdirs(self):
"""Test that we get the correct targeting directories given a tile."""
desi_root = get_desi_root_readonly()
surveyops_dir = os.environ['DESI_SURVEYOPS']
truedirs = {
# sv1
Expand Down Expand Up @@ -102,8 +101,8 @@ def test_gather_tractorphot(self):
@unittest.skipUnless(standard_nersc_environment, "not at NERSC")
def test_gather_tractorphot_dr10(self):
"""Like test_gather_tractorphot but for DR10 photometry."""

legacysurveydir = os.path.join(os.getenv('DESI_ROOT'), 'external', 'legacysurvey', 'dr10')
desi_root = get_desi_root_readonly()
legacysurveydir = os.path.join(desi_root, 'external', 'legacysurvey', 'dr10')
tractorphot = gather_tractorphot(self.input_cat_dr10, legacysurveydir=legacysurveydir)
for col in self.tractorphot_dr10.colnames:
self.assertTrue(np.all(tractorphot[col] == self.tractorphot_dr10[col]))
Expand Down

0 comments on commit 7c839d4

Please sign in to comment.