Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
data = []
for i in range(147):
data.append(card_info[i])
d = dict(zip(card_info.colnames[0:146], data))
hdr = fits.Header(cards=d)
xy = WCS(hdr).all_world2pix(pos[0], pos[1], 1)
# Corrects position with pointing model
pm = np.loadtxt('pointingModel_3-3.txt', skiprows=1, usecols=(1,2,3))
initShift = pm[0]
initShift[0] = np.radians(initShift[0])
x = xy[0]*np.cos(initShift[0]) - xy[1]*np.sin(initShift[0]) - initShift[1]
y = xy[0]*np.sin(initShift[0]) + xy[1]*np.cos(initShift[0]) - initShift[2]
post_fits = ktpf.from_fits(postcard)
# Extracts camera & chip from postcard name
camera, chip = postcard[11:12], postcard[13:14]
xy = init_shift(xy, camera, chip)
delY, delX = xy[0]-card_info['POST_CENX'], xy[1]-card_info['POST_CENY']
newX, newY = card_info['POST_SIZE1']/2. + delX, card_info['POST_SIZE2']/2. + delY
newX, newY = int(np.ceil(newX)), int(np.ceil(newY))
tpf = post_fits.flux[:,newX-4:newX+5, newY-4:newY+5]
plt.imshow(tpf[0], origin='lower')#, vmin=50, vmax=200)
plt.show()
print(len(tpf))
#### LC CORRECTION IN ellie.py NOT WORKING ####
radius, shape, lc, uncorrLC = lcClass.aperture_fitting(tpf=tpf)
----------
cmap: Allows the user to choose the color map for their movie
(Defaults to the only acceptable colormap)
cbar: Allows the user to decide if they want a colorbar for scale
(Defaults to True)
aperture: Allows the user to decide if they want the aperture on
their movie (Defaults to False)
com: Allows the user to decide if they want to see the center of
mass of the target (Defaults to False)
lc: Allows the user to plot the light curve and movement along light curve
with TPF movie (Defaults to False)
Returns
----------
Creates an MP4 file
"""
tp = ktpf.from_fits(self.tpf)
lc = tp.to_lightcurve()
# lc = fits.getdata(self.lcf)
time, lc = lc.time, lc.flux/np.nanmedian(lc.flux)
if 'vmax' not in kwargs:
kwargs['vmax'] = np.max(tp.flux[0])
if 'vmin' not in kwargs:
kwargs['vmin'] = np.min(tp.flux[0])
print(kwargs)
def animate(i):
nonlocal line
ax.imshow(tp.flux[i], origin='lower', **kwargs)
# Plots motion of COM when the user wants
if com==True:
def main():
id = 198593129
file = './figures/{}_tpf.fits'.format(id)
tpf = ktpf.from_fits(file)
coords, rectList = click_pixels(tpf)
check = check_pixels(tpf, rectList, coords)
if check == True:
plot_lightcurve(tpf, coords, id, rectList)
else:
main()