Skip to content

Commit

Permalink
Added aberration approximation correction
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher J. Burke committed Oct 17, 2020
1 parent 2a16d74 commit d699b43
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 21 deletions.
13 changes: 6 additions & 7 deletions README.md
Expand Up @@ -34,9 +34,10 @@ Alternatively, the python module is a single file, tess_stars2px.py, so one can
### AUTHORS
Original programming in C and focal plane geometry solutions by Alan Levine (MIT). This python translation by Christopher J. Burke (MIT). Testing and focal plane geometry refinements by Michael Fausnaugh & Roland Vanderspek (MIT). Testing by Thomas Barclay (NASA Goddard) and Jessica Roberts (Univ. of Colorado). By target name resolving implemented by Brett Morris (UW). Python help from Brigitta Sipocz and Martin Owens. Bug reports by Adina Feinstein (Univ. Chicago). Proxy implementation by Dishendra Mishra.

### VERSION: 0.5.0
### VERSION: 0.5.1

### WHAT'S NEW:
- An approximate aberration correction is available with command line option. Uses astropy GCRS Earth based frame which is close to TESS aberration

- Inverse transform (input Sector, Camera, CCD, pixel Column, pixel Row --> RA and Dec) is now 'analytic' rather than through brute force minimization. The inverse transform is much faster and much more reliable.

Expand All @@ -50,15 +51,15 @@ Burke, C. J., Levine, A., Fausnaugh, M., Vanderspek, R., Barclay, T., Libby-Robe

- Pointing prediction algorithm is same as employed internally at MIT for target management. However, hard coded focal plane geometry is not up to date and may contain inaccurate results.

- Testing shows pointing with this tool should be accurate to better than a pixel, but without including aberration effects, ones algorithm adopted for centroiding highly assymmetric point-spread function at edge of camera, and by-eye source location, a 2 pixel accuracy estimate is warranted.
- Testing shows pointing with this tool should be accurate to better than a pixel, but without including aberration effects, ones algorithm adopted for centroiding highly assymmetric point-spread function at edge of camera, and by-eye source location, a 2 pixel accuracy estimate is warranted. Use aberration option for better accuracy

- The output pixel coordinates assume the ds9 convention with 1,1 being the middle of the lower left corner.

- Pointing table is unofficial, and the pointings may change.

- See https://tess.mit.edu/observations/ for latest TESS pointing table

- No corrections for velocity aberration are calculated. Potentially more accurate results can be obtained if the target RA and Declination coordinates have aberration effects applied.
- No corrections for velocity aberration are calculated by default. Potentially more accurate results can be obtained if the target RA and Declination coordinates have aberration effects applied. The aberrate option uses the astropy GCRS Earth based frame in order to approximate a TESS frame. Earth has a velocity of 30km/s in solar system whereas TESS moves <4km/s relative to Earth, thus the GCRS correction should largely remove the 20arcsecond Earth induced aberration amplitude

- For proposals to the TESS science office or directors discretionary time, please consult the TESS prediction webtool available at https://heasarc.gsfc.nasa.gov/cgi-bin/tess/webtess/wtv.py for official identification of 'observable' targets. However, if your proposal depends on a single or few targets, then this tool is helpful to further refine the likelihood of the target being available on the detectors.

Expand All @@ -73,13 +74,11 @@ Burke, C. J., Levine, A., Fausnaugh, M., Vanderspek, R., Barclay, T., Libby-Robe

- Pre filter step previously depended on the current mission profile of pointings aligned with ecliptic coordinates to work. The pre filter step was rewritten in order to support mission planning not tied to ecliptic alignment. End users should not see any change in results with this change. However, local copies can be modified for arbitrary spacecraft ra,dec, roll and get same functionality.

- A reverse option is added to find the ra and dec for a given sector, camera, ccd, colpix, rowpix. This is most useful for planning arbitrary pointing boundaries and internal use to identify targets on uncalibrated images that don't have WCS info available. For precision work one should defer to WCS information on calibrated FFIs rather than this tool. The reverse is a brute force 'hack' that uses a minimizer on the forward direction code to find ra and dec. In principle it is possible to reverse the matrix transforms to get the ra and dec directly, but I chose this less efficient method for expediency. The minimizer is not guaranteed to converge at correct answer. The current method is a slow way to do this.

- A reverse option is added to find the ra and dec for a given sector, camera, ccd, colpix, rowpix. This is most useful for planning arbitrary pointing boundaries and internal use to identify targets on uncalibrated images that don't have WCS info available. For precision work one should defer to WCS information on calibrated FFIs rather than this tool.


### TODOS:
1. Include approximate or detailed velocity aberration corrections
2. Time dependent Focal plane geometry
1. Time dependent Focal plane geometry

### DEPENDENCIES:
- python 3+
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="tess-point",
version="0.5.0",
version="0.5.1",
author="Christopher J. Burke",
author_email="cjburke@mit.edu",
description="Determine pixel coordinates for TESS targets",
Expand Down
67 changes: 54 additions & 13 deletions tess_stars2px.py
Expand Up @@ -20,9 +20,14 @@
Sesame queries by Brett Morris (UW)
Proxy Support added by Dishendra Mishra
VERSION: 0.5.0
VERSION: 0.5.1
WHAT'S NEW:
-Now has option to perform an approximate aberration correction.
Uses astropy GCRS geocentric aberrated frame. The Earth has velocity of 30km/s
whereas TESS has velocity relative to Earth of <4km/s. Thus, correcting
for Earth aberration is most of the way there. Earth aberrates ~20 arcsec ~ 1 TESS pixel
Aberration is only done in forward ra,dec-> pix direction. No aberratuib correction is done for inverse pix->ra,dec direction
-Inverse transform (input Sector, Camera, CCD, pixel Column, pixel Row --> RA and Dec) is now 'analytic' rather than through brute force minimization. The inverse transform is much faster and much more reliable.
-MUCH FASTER NOW - skipped rough estimate step which was much much slower
than just doing the matrix math for position.
Expand All @@ -46,7 +51,7 @@
adopted for centroiding highly assymmetric point-spread function
at edge of
camera, and by-eye source location, a 2 pixel accuracy estimate is
warranted.
warranted. There is an approximate aberration option now available
-The output pixel coordinates assume the ds9 convention with
1,1 being the middle of the lower left corner.
-No corrections for velocity aberration are calculated.
Expand Down Expand Up @@ -85,20 +90,10 @@
targets on uncalibrated
images that don't have WCS info available. For precision work one
shold defer to WCS information on calibrated FFIs rather than this tool.
The reverse is a brute force 'hack' that uses a minimizer on the
forward direction code to find ra and dec. In principle it is possible
to reverse the matrix transforms to get the ra and dec directly, but
I chose this less efficient method for expediency. The minimizer
is not guaranteed to converge at correct answer. The current method
is a slow way to do this.
TODOS:
-Include approximate or detailed velocity aberration corrections
-Time dependent Focal plane geometry
-Do the reverse transormation go from pixel to RA and Dec in a direct
reverse transform manner rather than the current implementation
that does a brute force minimization from the forward ra,dec-->pix code
DEPENDENCIES:
python 3+
Expand Down Expand Up @@ -149,6 +144,8 @@
import os
import argparse
from astropy.coordinates import SkyCoord
import astropy.units as u
from astropy.time import Time
import sys
import datetime
import json
Expand Down Expand Up @@ -859,7 +856,19 @@ class TESS_Spacecraft_Pointing_Data:
152.4006,143.7306,138.1685,139.3519,\
161.5986], dtype=np.float)

midtimes = np.array([ 2458339.652778, 2458368.593750, 2458396.659722, 2458424.548611, 2458451.548611,\
2458478.104167, 2458504.697917, 2458530.256944, 2458556.722222,\
2458582.760417, 2458610.774306, 2458640.031250, 2458668.618056,\
2458697.336806, 2458724.934028, 2458751.649306, 2458777.722222,\
2458803.440972, 2458828.958333, 2458856.388889, 2458884.916667, 2458913.565972,\
2458941.829861, 2458969.263889, 2458996.909722, 2459023.107639,\
2459049.145833, 2459075.166667, 2459102.319444, 2459130.201389,\
2459158.854167, 2459186.940972, 2459215.427083, 2459241.979167,\
2459268.579861, 2459295.301177, 2459322.577780, 2459349.854382,\
2459377.130985], dtype=np.float)

camSeps = np.array([36.0, 12.0, 12.0, 36.0], dtype=np.float)


def __init__(self, trySector=None, fpgParmFileList=None):
# Convert S/C boresite pointings to ecliptic coords for each camera
Expand All @@ -870,6 +879,7 @@ def __init__(self, trySector=None, fpgParmFileList=None):
self.ras = self.ras[idx]
self.decs = self.decs[idx]
self.rolls = self.rolls[idx]
self.midtimes = self.midtimes[idx]
nPoints = len(self.sectors)
self.camRa = np.zeros((4, nPoints), dtype=np.float)
self.camDec = np.zeros((4, nPoints), dtype=np.float)
Expand Down Expand Up @@ -1053,7 +1063,7 @@ def fileOutputHeader(fp, fpgParmFileList=None):

def tess_stars2px_function_entry(starIDs, starRas, starDecs, trySector=None, scInfo=None, \
fpgParmFileList=None, combinedFits=False,\
noCollateral=False):
noCollateral=False, aberrate=False):
if scInfo == None:
# Instantiate Spacecraft position info
scinfo = TESS_Spacecraft_Pointing_Data(trySector=trySector, fpgParmFileList=fpgParmFileList)
Expand All @@ -1078,6 +1088,21 @@ def tess_stars2px_function_entry(starIDs, starRas, starDecs, trySector=None, scI
starDecs = np.array([curTarg.dec])
for curSec in scinfo.sectors:
idxSec = np.where(scinfo.sectors == curSec)[0][0]
# Apply an approximate aberration correction
if aberrate:
useTime = Time(scinfo.midtimes[idxSec], format='jd')
# Make coordinate object in ICRS coordinates
ccat = SkyCoord(ra=starRas * u.deg,
dec=starDecs * u.deg,
obstime=useTime, frame='icrs')
# convert to Geocentric aberrated coordinates
# This is only an approximation to TESS
# because TESS orbits Earth and has
# velocity <=4km/s relative to Earth whereas Earth is 30km/s
cgcrs = ccat.transform_to('gcrs')
starRas = np.array(cgcrs.ra.degree)
starDecs = np.array(cgcrs.dec.degree)

starInCam, starCcdNum, starFitsXs, starFitsYs, starCcdXs, starCcdYs = scinfo.fpgObjs[idxSec].radec2pix(\
starRas, starDecs)
for jj, cam in enumerate(starInCam):
Expand Down Expand Up @@ -1158,6 +1183,8 @@ def tess_stars2px_reverse_function_entry(trySector, camera, ccd, colWant, rowWan
help="Search for a target by resolving its name with SESAME")
parser.add_argument("-p", "--proxy_uri", nargs=1, type=str, \
help="Use proxy e.g.\"http://<user>:<passwd>@<proxy_server>:<proxy_port>\" ")
parser.add_argument("-a", "--aberrate", action='store_true',\
help="Apply approximate aberration correction to input coordinates. Uses astropy GCRS coordinate frame to approximate TESS aberration")
args = parser.parse_args()

# DEBUG BLOCK for hard coding input parameters and testing
Expand Down Expand Up @@ -1265,6 +1292,20 @@ def tess_stars2px_reverse_function_entry(trySector, camera, ccd, colWant, rowWan
starDecs = np.array([curTarg.dec])
for curSec in scinfo.sectors:
idxSec = np.where(scinfo.sectors == curSec)[0][0]
# Apply an approximate aberration correction
if args.aberrate:
useTime = Time(scinfo.midtimes[idxSec], format='jd')
# Make coordinate object in ICRS coordinates
ccat = SkyCoord(ra=starRas * u.deg,
dec=starDecs * u.deg,
obstime=useTime, frame='icrs')
# convert to Geocentric aberrated coordinates
# This is only an approximation to TESS
# because TESS orbits Earth and has
# velocity <=4km/s relative to Earth whereas Earth is 30km/s
cgcrs = ccat.transform_to('gcrs')
starRas = np.array(cgcrs.ra.degree)
starDecs = np.array(cgcrs.dec.degree)
starInCam, starCcdNum, starFitsXs, starFitsYs, starCcdXs, starCcdYs = scinfo.fpgObjs[idxSec].radec2pix(\
starRas, starDecs)
for jj, cam in enumerate(starInCam):
Expand Down

0 comments on commit d699b43

Please sign in to comment.