Skip to content

Commit

Permalink
Pull tests out to be individual
Browse files Browse the repository at this point in the history
  • Loading branch information
mfisherlevine committed Oct 25, 2022
1 parent a64f6db commit 4bba683
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,19 +144,32 @@ def test_fluxFromFootprint(self):

# check it can accept a footprintSet, and single and iterables of
# footprints
for obj in (footPrintSet, singleFootprint, twoFootprints):
fluxes = fluxesFromFootprints(obj, self.exp)
if isinstance(obj, FootprintSet):
expectedLength = len(footPrintSet.getFootprints())
self.assertEqual(len(fluxes), expectedLength) # always one flux per footprint

self.assertIsInstance(fluxes, Iterable)
self.assertIsInstance(fluxes[0], np.floating) # always returns floats
# check the footPrintSet
fluxes = fluxesFromFootprints(footPrintSet, self.exp)
expectedLength = len(footPrintSet.getFootprints())
self.assertEqual(len(fluxes), expectedLength) # always one flux per footprint
self.assertIsInstance(fluxes, Iterable)
self.assertIsInstance(fluxes[0], np.floating) # always returns floats

# check the singleFootprint
fluxes = fluxesFromFootprints(singleFootprint, self.exp)
expectedLength = 1
self.assertEqual(len(fluxes), expectedLength) # always one flux per footprint
self.assertIsInstance(fluxes, Iterable)
self.assertIsInstance(fluxes[0], np.floating) # always returns floats

# check the list of twoFootprints
fluxes = fluxesFromFootprints(twoFootprints, self.exp)
expectedLength = 2
self.assertEqual(len(fluxes), expectedLength) # always one flux per footprint
self.assertIsInstance(fluxes, Iterable)
self.assertIsInstance(fluxes[0], np.floating) # always returns floats

# ensure that subtracting the image median from fluxes leave image
# functionally unchanged
oldExpArray = copy.deepcopy(self.exp.image.array)
fluxes = fluxesFromFootprints(obj, self.exp, subtractImageMedian=True)
fluxes = fluxesFromFootprints(footPrintSet, self.exp, subtractImageMedian=True)
self.assertTrue(np.alltrue(np.equal(self.exp.image.array, oldExpArray)))


Expand Down

0 comments on commit 4bba683

Please sign in to comment.