Understanding meaning of duplicate Sectors but different Camera and CCD in tess_stars2px_function_entry output?
daxfeliz opened this issue · 1 comments
While making a target list, I noticed that some targets have duplicate sector outputs but differing Camera and CCD outputs.
For example, TIC 278779899 (TESS mag 8) has duplicate sector outputs of 7,7 with different values for Camera (3,4) and CCD (3,2). I thought maybe setting aberrate=True might change the result for improved pixel accuracy but that doesn't seem to be the case.
See example code below:
# values queried from the TIC, hard-coded for reproducibility
ex_ID, ex_ra, ex_dec, ex_Tmag = 278779899, 99.9068482588882, -55.6096758823263, 8.08899974822998
print(ex_ID,ex_ra,ex_dec,ex_Tmag,'\n')
from tess_stars2px import tess_stars2px_function_entry as tess_stars2px
print('abberate = False')
results = tess_stars2px_function_entry(starIDs=ex_ID,starRas=ex_ra,starDecs=ex_dec,aberrate=False)
outID, outEclipLong, outEclipLat, outSector, outCam, outCcd, outColPix, outRowPix, scinfo = results
print(outSector,'\n',outCam,'\n',outCcd,'\n')
print('abberate = True')
results = tess_stars2px_function_entry(starIDs=ex_ID,starRas=ex_ra,starDecs=ex_dec,aberrate=True)
outID, outEclipLong, outEclipLat, outSector, outCam, outCcd, outColPix, outRowPix, scinfo = results
print(outSector,'\n',outCam,'\n',outCcd)
Does this simply mean the target falls in between CCDs of the adjacent cameras? This is also the result with the updated TESS Web Viewing Tool website (https://heasarc.gsfc.nasa.gov/wsgi-scripts/TESS/TESS-point_Web_Tool/TESS-point_Web_Tool/wtv_v2.0.py/)
I can see that within the "tess_stars2px_reverse_function_entry" there is a string output for edgeWarn for targets within 6 pixels of the edge of a CCD, which in this target stars' case, happens to get flagged as 1 with the use of
python -m tess_stars2px -t 278779899
Is there a way to reproduce the edge warning with the "tess_stars2px_function_entry" function?
Maybe an additional helper function, something like the following (based on L1415-1447 in "tess_stars2px_reverse_function_entry"):
def edgeWarn_tesspt2px(outSector,ra,dec,scinfo, aberrate=False,
combinedFits=False,noCollateral=False,
verbose=False):
from astropy.time import Time
from astropy.coordinates import SkyCoord
edge_warnings=[]
for S in range(len(outSector)):
Sector=int(outSector[S])
if Sector==-1:
edgeWarn=-1 #to match other non-science image area results (when outSector, outCam, outCcd = -1)
else:
idxSec = np.where(scinfo.sectors == Sector)[0][0]
starRas=np.array([ra])
starDecs=np.array([dec])
if aberrate==True:
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):
# SPOC calibrated FFIs have 44 collateral pixels in x and are 1 based
xUse = starCcdXs[jj] + 45.0
yUse = starCcdYs[jj] + 1.0
xMin = 44.0
ymaxCoord = 2049
xmaxCoord = 2093
edgeWarn = 0
if combinedFits==True:
xUse = starFitsXs[jj]
yUse = starFitsYs[jj]
xmaxCoord = 4097
ymaxCoord = 4097
xMin = 0.0
if noCollateral==True:
xUse = starCcdXs[jj]
yUse = starCcdYs[jj]
xMin = 0.0
if xUse>xMin and yUse>0 and xUse<xmaxCoord and yUse<ymaxCoord:
findAny=True
edgeWarn = 0
edgePix = 6
if xUse<=(xMin+edgePix):
edgeWarn = 1
if verbose==True:
print('xUse<=(xMin+edgePix) in S'+str(Sector))
if xUse>=(xmaxCoord-edgePix):
if verbose==True:
print('xUse>=(xmaxCoord-edgePix) in S'+str(Sector))
edgeWarn = 1
if yUse<=edgePix:
if verbose==True:
print('yUse<=edgePix in S'+str(Sector))
edgeWarn = 1
if yUse>=(ymaxCoord-edgePix):
if verbose==True:
print('yUse>=(ymaxCoord-edgePix) in S'+str(Sector))
edgeWarn = 1
edge_warnings=np.append(edge_warnings,edgeWarn)
# print('edgeWarn',edgeWarn,xMin+edgePix,xUse,xmaxCoord-edgePix,yUse,ymaxCoord)
return edge_warnings.astype(int)
Although, I'm not sure what the optional flags for "combinedFits" and "noCollateral" mean. There doesn't seem to be documentation for these flags. I assume noCollateral refers to inclusion/exclusion of pixels in collateral data (https://heasarc.gsfc.nasa.gov/docs/tess/data-products.html#collateral-data) but not sure about "combinedFits".