Skip to content

Commit

Permalink
Add fuller explanation of one test condition
Browse files Browse the repository at this point in the history
Also fixed an import in a test.
  • Loading branch information
mwcraig committed Feb 9, 2024
1 parent c342ddb commit f63f2cc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
Empty file.
2 changes: 1 addition & 1 deletion stellarphot/photometry/tests/test_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
from astropy.stats import gaussian_sigma_to_fwhm
from astropy.table import QTable
from astropy.utils.exceptions import AstropyUserWarning
from fake_image import FakeImage

from stellarphot.photometry import compute_fwhm, source_detection
from stellarphot.photometry.tests.fake_image import FakeImage

# Make sure the tests are deterministic by using a random seed
SEED = 5432985
Expand Down
16 changes: 12 additions & 4 deletions stellarphot/photometry/tests/test_photometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from astropy.io import ascii
from astropy.utils.data import get_pkg_data_filename
from astropy.utils.metadata.exceptions import MergeConflictWarning
from fake_image import FakeCCDImage, shift_FakeCCDImage

from stellarphot.core import SourceListData
from stellarphot.photometry import (
Expand All @@ -19,6 +18,7 @@
single_image_photometry,
source_detection,
)
from stellarphot.photometry.tests.fake_image import FakeCCDImage, shift_FakeCCDImage
from stellarphot.settings import (
Camera,
Observatory,
Expand Down Expand Up @@ -549,11 +549,19 @@ def test_photometry_on_directory(coords):
# less than the expected one sigma deviation.
assert np.abs(expected_flux - obs_avg_net_cnts) < expected_deviation
else:
# The expected result is that either obs_avg_net_cnts is nan or the
# difference is bigger than the expected_deviation.
# In this case we are trying to do photometry in pixel coordinates,
# using the pixel location of the sources as found in the first image --
# see the line where found_sources is defined.
#
# However, the images are shifted with respect to each other by
# list_of_fakes, so there are no long stars at those positions in the
# other images.
#
# Because of that, the expected result is that either obs_avg_net_cnts
# is nan or the difference is bigger than the expected_deviation.
assert (
np.isnan(obs_avg_net_cnts)
or np.abs(expected_flux - obs_avg_net_cnts) < expected_deviation
or np.abs(expected_flux - obs_avg_net_cnts) > expected_deviation
)


Expand Down

0 comments on commit f63f2cc

Please sign in to comment.