Esempio n. 1
0
force_recompute_photometry = False  # True

# Calculate master dark/flat:
if not os.path.exists(master_dark_path) or not os.path.exists(
        master_flat_path):
    print('Calculating master flat:')
    generate_master_flat_and_dark(flat_paths, dark_paths, master_flat_path,
                                  master_dark_path)

# Do photometry:

if not os.path.exists(output_path) or force_recompute_photometry:
    print('Calculating photometry:')
    phot_results = photometry(image_paths, master_dark_path, master_flat_path,
                              target_centroid, comparison_flux_threshold,
                              aperture_radii, centroid_stamp_half_width,
                              psf_stddev_init, aperture_annulus_radius,
                              output_path)

else:
    phot_results = PhotometryResults.load(output_path)

print('Calculating PCA...')
light_curve = PCA_light_curve(phot_results, transit_parameters, plots=True)

plt.figure()
plt.plot(phot_results.times, light_curve, 'k.')
#egress = 2457777.01
#post_egress_std = np.std(light_curve[phot_results.times > egress])
#plt.axvline(egress)
plt.xlabel('Time [JD]')
Esempio n. 2
0
force_recompute_photometry = True

# Calculate master dark/flat:
if not os.path.exists(master_dark_path) or not os.path.exists(
        master_flat_path):
    print('Calculating master flat:')
    generate_master_flat_and_dark(night_flat_paths, dark_30s_paths,
                                  master_flat_path, master_dark_path)

# Do photometry:

if not os.path.exists(output_path) or force_recompute_photometry:
    print('Calculating photometry:')
    phot_results = photometry(image_paths, master_dark_path, master_flat_path,
                              star_positions, aperture_radii,
                              centroid_stamp_half_width, psf_stddev_init,
                              aperture_annulus_radius, output_path,
                              brightest_star_coords_init)

else:
    phot_results = PhotometryResults.load(output_path)

# print('Calculating PCA...')

target = phot_results.fluxes[:, 0, 0]
mean_comparison = phot_results.fluxes[:, 1, 0]
light_curve = target / mean_comparison
plt.plot(phot_results.times, light_curve / np.median(light_curve), '.')

np.savetxt('outputs/20160705.txt',
           np.vstack([phot_results.times, light_curve]).T)
transit_parameters = params_c


output_path = 'outputs/trappist1c_20160619.npz'
force_recompute_photometry = False  #True

# Calculate master dark/flat:
if not os.path.exists(master_dark_path):
    generate_master_dark(dark_paths, master_dark_path)

# Do photometry:
if not os.path.exists(output_path) or force_recompute_photometry:
    print('Calculating photometry:')
    phot_results = photometry(image_paths, master_dark_path, master_flat_path,
                              target_centroid, comparison_flux_threshold,
                              aperture_radii, centroid_stamp_half_width,
                              psf_stddev_init, aperture_annulus_radius,
                              output_path)

else:
    phot_results = PhotometryResults.load(output_path)

print('Calculating PCA...')
light_curve = PCA_light_curve(phot_results, transit_parameters,
                              validation_duration_fraction=0.5, plots=True,
                              plot_validation=False, validation_time=0.9,
                              outlier_rejection=False)


plt.figure()
plt.plot(phot_results.times, light_curve, 'k.')