Skip to content

Commit

Permalink
Merge pull request #893 from griffin-h/bugfix/atlas_processor
Browse files Browse the repository at this point in the history
Fix calculation of upper limits from ATLAS forced photometry
  • Loading branch information
phycodurus authored Apr 11, 2024
2 parents 36d9b4d + 02092e8 commit 2b1aad0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ class BaseForcedPhotometryService(ABC):
form for a particular forced photometry service.
"""
name = 'BaseForcedPhotometryService'
info_url = None
service_notes = None

@abstractmethod
def get_form(self):
Expand Down
12 changes: 6 additions & 6 deletions tom_dataproducts/processors/atlas_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from astropy import units
import astropy.io.ascii
from astropy.time import Time, TimezoneInfo
import numpy as np

from tom_dataproducts.data_processor import DataProcessor
from tom_dataproducts.exceptions import InvalidFileFormatException
Expand Down Expand Up @@ -63,17 +64,16 @@ def _process_photometry_from_plaintext(self, data_product):
value = {
'timestamp': time.to_datetime(timezone=utc),
'filter': str(datum['F']),
'error': float(datum['dm']),
'telescope': 'ATLAS',
}
# If the signal is in the noise, set the non-detection limit to the
# absolute value of the reported magnitude.
# If the signal is in the noise, calculate the non-detection limit from the reported flux uncertainty.
# see https://fallingstar-data.com/forcedphot/resultdesc/
signal_to_noise = abs(float(datum['uJy']))/abs(float(datum['duJy']))
signal_to_noise = float(datum['uJy']) / float(datum['duJy'])
if signal_to_noise <= signal_to_noise_cutoff:
value['limit'] = abs(float(datum['m']))
value['limit'] = 23.9 - 2.5 * np.log10(signal_to_noise_cutoff * float(datum['duJy']))
else:
value['magnitude'] = abs(float(datum['m']))
value['magnitude'] = float(datum['m'])
value['error'] = float(datum['dm'])

photometry.append(value)
except Exception as e:
Expand Down
2 changes: 1 addition & 1 deletion tom_dataproducts/tests/test_atlas.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ def test_mags_under_SN_cutoff_become_limits(self):
# this is the call under test
photometry = AtlasProcessor()._process_photometry_from_plaintext(self.data_product)

expected_non_detection_count = 9 # known apriori from test data in test_atlas_fp.csv
expected_non_detection_count = 17 # known a priori from test data in test_atlas_fp.csv
self.assertEqual(expected_non_detection_count,
len([datum for datum in photometry if 'limit' in datum.keys()]))

0 comments on commit 2b1aad0

Please sign in to comment.