Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[quickfix] acsphotcte #117

Merged
merged 1 commit into from
Apr 1, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions acstools/acsphotcte.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
`ACS Photometric CTE Webtool <https://acsphotometriccte.stsci.edu>`_.
The API is a cloud-based service that employs a serverless approach on AWS
with API Gateway and Lambda to compute the photometric CTE corrections
using the model described in ACS ISR 2012-02.
using the model described in ACS ISR 2012-05.
The model corrects ACS/WFC aperture photometry extracted from FLT images for
CTE losses using the most recent formula from Chiaberge's ISR 2012-05. It is
CTE losses using the most recent formula described in Chiaberge's ISR 2012-05. It is
only calibrated for photometry obtained after SM4 in May 2009. For pre-SM4
data, please see Chiaberge et al. 2009 (ISR 2009-01), or use pixel-based
CTE-corrected files obtained from MAST. Currently, only 3 and 5
Expand Down Expand Up @@ -36,12 +36,13 @@

>>> import numpy as np
>>> from acstools import acsphotcte
>>> ytransfers = 2048 * np.random.random(size=1000)
>>> fluxes = 20000*np.random.random(size=len(ytransfers))
>>> n_sample = 1000
>>> ytransfers = 2048 * np.random.random(size=n_sample)
>>> fluxes = 20000*np.random.random(size=n_sample)
>>> magnitudes = -2.5 * np.log10(fluxes)
>>> print(magnitudes[:5])
[-10.75088228 -9.56321561 -10.10571966 -9.01893015 -10.48463087]
>>> local_skys = 80*np.random.random(size=len(ytransfers))
>>> local_skys = 80*np.random.random(size=n_sample)
>>> mjd = 59341.
>>> radius = 3.
>>> photctecalc = acsphotcte.PhotCTEAPI()
Expand All @@ -59,6 +60,9 @@
import json
import logging

# LOCAL
from .utils_calib import SM4_MJD

import numpy as np
import requests

Expand Down Expand Up @@ -210,6 +214,10 @@ def _check_inputs(self, **inputs):
)
LOG.error(msg)
return
# Check to see if the date occurs before SM4
if inputs['mjd'] < SM4_MJD:
LOG.error(f"Observation MJD must occur after SM4, {SM4_MJD}")
return 'mjd'

return inputs

Expand Down Expand Up @@ -258,7 +266,7 @@ def correct_photometry(
inputs = self._check_inputs(**inputs)

if not isinstance(inputs, dict) and isinstance(inputs, str):
LOG.error(f'Please check the following input {inputs}')
LOG.error(f'Please check the following input: {inputs}')
return
elif inputs is None:
LOG.error('Please check the iterable inputs')
Expand Down