Пример #1
0
def get_one_contrast_and_SN(data, positions, fwhm, fwhm_flux):
    '''
    Args:
        path : a string. The path of repository where the files are.
        positions : a list of tuple (x,y). The coordinates of companions.
    Return:
        flux : a np.array, 1 dimension. Store the list of each companion's flux.
        SN : a np.array, 1 dimension. Store the list of each companion's Signal to Noise ratio.
    '''

    # flux
    aperture = CircularAperture(positions, r=2)
    annulus = CircularAnnulus(positions, r_in=4, r_out=6)

    # flux
    flux_companion = aperture_photometry(data, [aperture, annulus])
    flux_companion['aperture_sum_0', 'aperture_sum_1'].info.format = '%.8g'
    flux = (flux_companion['aperture_sum_0'] / aperture.area) / fwhm_flux

    # SN
    ds9 = vip.Ds9Window()
    ds9.display(data)
    SN = vip.metrics.snr(data, source_xy=positions[0], fwhm=fwhm, plot=True)

    return flux[0], SN
Пример #2
0
#    library.build_covariance_matrix()
#    library.save_covariance_matrix()
    library.load_covariance_matrix()
#    target = 'HD9672'
#    target = 'HD71722'
#    target = 'HD105'
    target = 'HD206893'

    score = library.analyze_correlation(target,highest_rank_to_test=10,save=True)
#    library.get_name_and_id_from_index(353)
#    library.get_name_and_id_from_index_list([353,340,83])
#    library.build_library([353,340,83],filename='library_HD182681.fits')
#    library.build_library(np.where(score>10)[0],filename='library_{0:s}_{1:d}x{1:d}_{2:s}_O.fits'.format(target,library.size,library.channel))

    import vip_hci as vip
    ds9=vip.Ds9Window()
    
    highest_correlated_indices = library.find_highest_correlated_frames(target)
    cube = library.build_library(highest_correlated_indices)
    cube_target = fits.getdata(os.path.join(library.pathOut_targets[target],target+'_199x199_left_O.fits'))
    parang_target = fits.getdata(os.path.join(library.pathOut_targets[target],target+'_derotation_angles_O.fits'))
    ds9.display(cube[6:9,:,:],cube_target[6:9,:,:])



    i=0
    corr_vector = library.correlate_frame_with_library(cube_target[i,:,:],save=False)


#    import adiUtilities as adi
#    cube_subtracted_rdi = adi.simple_reference_subtraction(cube_target,cube,library.mask_correlation)