Skip to content

Commit

Permalink
Modifications to permit running on MacOS
Browse files Browse the repository at this point in the history
  • Loading branch information
jmeyers314 committed Oct 26, 2023
1 parent d02ea46 commit fc750a6
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 51 deletions.
3 changes: 2 additions & 1 deletion python/lsst/ts/wep/utils/taskUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
]

import os
import shlex
import subprocess

import lsst.obs.lsst as obs_lsst
Expand Down Expand Up @@ -59,7 +60,7 @@ def runProgram(command, binDir=None, argstring=None):
command += " " + argstring

# Call the program w/o arguments
if subprocess.call(command, shell=True) != 0:
if subprocess.call(shlex.split(command), shell=False) != 0:
raise RuntimeError("Error running: %s" % command)


Expand Down
116 changes: 66 additions & 50 deletions tests/task/test_generateDonutCatalogWcsTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.

import os
import unittest
from lsst.utils.tests import TestCase

import lsst.geom
import numpy as np
Expand All @@ -38,7 +38,7 @@
)


class TestGenerateDonutCatalogWcsTask(unittest.TestCase):
class TestGenerateDonutCatalogWcsTask(TestCase):
def setUp(self):
self.config = GenerateDonutCatalogWcsTaskConfig()
self.config.donutSelector.unblendedSeparation = 1
Expand Down Expand Up @@ -163,31 +163,39 @@ def testPipeline(self):
"blend_centroid_y",
],
)
self.assertCountEqual(
[
3806.7636478057957,
2806.982895217227,
607.3861483168994,
707.3972344551466,
614.607342274194,
714.6336433247832,
3815.2649173460436,
2815.0561553920156,
],
outputDf["centroid_x"],
self.assertFloatsAlmostEqual(
np.sort(
[
3806.7636478057957,
2806.982895217227,
607.3861483168994,
707.3972344551466,
614.607342274194,
714.6336433247832,
3815.2649173460436,
2815.0561553920156,
],
),
np.sort(outputDf["centroid_x"]),
atol=1e-15,
rtol=1e-15,
)
self.assertCountEqual(
[
3196.070534224157,
2195.666002294077,
394.8907003737886,
394.9087004171349,
396.2407036464963,
396.22270360324296,
3196.1965343932648,
2196.188002312585,
],
outputDf["centroid_y"],
self.assertFloatsAlmostEqual(
np.sort(
[
3196.070534224157,
2195.666002294077,
394.8907003737886,
394.9087004171349,
396.2407036464963,
396.22270360324296,
3196.1965343932648,
2196.188002312585,
],
),
np.sort(outputDf["centroid_y"]),
atol=1e-15,
rtol=1e-15,
)
fluxTruth = np.ones(8)
fluxTruth[:6] = 3630780.5477010026
Expand Down Expand Up @@ -252,31 +260,39 @@ def testDonutCatalogGeneration(self):
self.assertEqual(len(outputDf), 8)
self.assertCountEqual(np.radians(inputCat["ra"]), outputDf["coord_ra"])
self.assertCountEqual(np.radians(inputCat["dec"]), outputDf["coord_dec"])
self.assertCountEqual(
[
3806.7636478057957,
2806.982895217227,
607.3861483168994,
707.3972344551466,
614.607342274194,
714.6336433247832,
3815.2649173460436,
2815.0561553920156,
],
outputDf["centroid_x"],
self.assertFloatsAlmostEqual(
np.sort(
[
3806.7636478057957,
2806.982895217227,
607.3861483168994,
707.3972344551466,
614.607342274194,
714.6336433247832,
3815.2649173460436,
2815.0561553920156,
],
),
np.sort(outputDf["centroid_x"]),
atol=1e-15,
rtol=1e-15,
)
self.assertCountEqual(
[
3196.070534224157,
2195.666002294077,
394.8907003737886,
394.9087004171349,
396.2407036464963,
396.22270360324296,
3196.1965343932648,
2196.188002312585,
],
outputDf["centroid_y"],
self.assertFloatsAlmostEqual(
np.sort(
[
3196.070534224157,
2195.666002294077,
394.8907003737886,
394.9087004171349,
396.2407036464963,
396.22270360324296,
3196.1965343932648,
2196.188002312585,
],
),
np.sort(outputDf["centroid_y"]),
atol=1e-15,
rtol=1e-15,
)
fluxTruth = np.ones(8)
fluxTruth[:6] = 3630780.5477010026
Expand Down

0 comments on commit fc750a6

Please sign in to comment.