We have a lot of TFOP datasets that have very close neighboring stars. I wanted to check from which star the signal comes from by limiting the range of apertures in the pipeline. For example,
ta = TFOPAnalysis(target='toi06240.01',
date=230811,
tid=0,
cids=[4,5,6],
dataroot='./photometry',
aperture_lims=(0, 2), # small aper
# aperture_lims=(3, 7), # big aper
)
Here I superpose the selected apertures with the centroids to visualize if the aperture fully encapsulates the centroid spread.
import matplotlib.pyplot as pl
from matplotlib.patches import Circle
import astropy.units as u
import pandas as pd
def plot_apertures(starid, band_id=0, unit="arcsec", rlim=7, pix_scale=0.44, ax=None):
d = ta.distances[starid]*u.arcmin.to(u.arcsec)
apers_in_pix = ta.phs[band_id]._ds.aperture.data[:rlim]
centroids = ta.phs[band_id]._ds.centroid[:,starid,]
dx,dy = centroids.T*pix_scale
if unit=="arcmin":
dx*=u.arcsec.to(u.arcmin)
dy*=u.arcsec.to(u.arcmin)
d *=u.arcsec.to(u.arcmin)
if ax is None:
fig, ax = pl.subplots()
ax.set_title(f'star ID={starid} (d={d:.1f} {unit} = {round(d/pix_scale)} pix)');
ax.scatter(dx+d,dy+d)
#get centroid median and place apertures there
mx, my = np.median(dx+d), np.median(dy+d)
ax.plot(mx, my,'ko', label=f"dx,dy=({mx:.1f},{my:.1f}) {unit}", ms=10, lw=5)
ax.plot(d, d,'rx', ms=10, lw=5)
for index,p in enumerate(apers_in_pix):
ls = '--' if index%2 else '-'
r = p*pix_scale
if unit=="arcmin":
r *= u.arcsec.to(u.arcmin)
circle = Circle((mx, my), r, facecolor='none',
edgecolor='k', linewidth=3, alpha=0.5, ls=ls)
ax.add_patch(circle)
ax.set_xlabel(f'dx ({unit})')
ax.set_ylabel(f'dy ({unit})')
ax.legend()
return ax
#plot the target and the nearest neighbor
idx = pd.Series(ta.distances).sort_values().argsort().index.tolist()
fig, ax = pl.subplots()
plot_apertures(idx[0], ax=ax, rlim=3);
plot_apertures(idx[1], ax=ax, rlim=3);
In this case, is it correct that aperture_lims=(0, 2) can be used to avoid flux contamination from the nearby star?
We have a lot of TFOP datasets that have very close neighboring stars. I wanted to check from which star the signal comes from by limiting the range of apertures in the pipeline. For example,
Here I superpose the selected apertures with the centroids to visualize if the aperture fully encapsulates the centroid spread.
In this case, is it correct that
aperture_lims=(0, 2)
can be used to avoid flux contamination from the nearby star?