Esempio n. 1
0
def noStar_noReduction(params, output_path):

    numb = 1
    (ref_cube, img_cube,
     _img_params) = gen_disk_dataset_without_star_perfect_psf(params)

    clean_psf = psf.get_clean()
    (_, shift_cube) = center_cube(ref_cube, ref_img=clean_psf)
    img_cube = center_cube(img_cube, shifts=shift_cube)

    (left, right) = find_sub_psf_location(clean_psf)

    right_psfs = []
    left_psfs = []
    for img in img_cube:
        (left_psf, right_psf) = extract_psfs(img, left, right)
        left_psfs.append(left_psf)
        right_psfs.append(right_psf)

    plotslow.saveImage_withCb(left_psfs[0],
                              output_path + "right_no_star_noReductin",
                              log=True)
    plotslow.saveImage_withCb(right_psfs[0],
                              output_path + "left_no_star_noReduction",
                              log=True)
Esempio n. 2
0
def noStar_ADI(params, output_path):

    (ref_cube, img_cube,
     img_params) = gen_disk_dataset_without_star_perfect_psf(params)

    clean_psf = psf.get_clean()
    (_, shift_cube) = center_cube(ref_cube, ref_img=clean_psf)
    img_cube = center_cube(img_cube, shifts=shift_cube)

    (left, right) = find_sub_psf_location(clean_psf)

    right_psfs = []
    left_psfs = []
    for img in img_cube:
        (left_psf, right_psf) = extract_psfs(img, left, right)
        left_psfs.append(left_psf)
        right_psfs.append(right_psf)

    right_final = simple_adi(right_psfs, img_params)
    left_final = simple_adi(left_psfs, img_params)

    plotslow.saveImage_withCb(right_final,
                              output_path + "right_no_star_ADI",
                              log=False)
    plotslow.saveImage_withCb(left_final,
                              output_path + "left_no_star_ADI",
                              log=False)
Esempio n. 3
0
def plot_model(output_path):
    numb = 1
    model = d.disk(field_size=field_size, with_star=True, inner_radius=inner_radius,
                   outer_radius=outer_radius, rotation=rotation, inclination=inclination, rings=rings, amplification=amplification)
    (disk_cube, _disk_params) = d.gen_cube(numb, model, set_rotation)

    plotslow.saveImage_withCb(disk_cube[0],output_path+"model", log=True, lim=[[50,150],[50,150]])
Esempio n. 4
0
def coro_psf(params, output_path):

    numb = 1
    (psf_cube,
     psf_params) = psf.calc_cube(numb,
                                 fried_parameter=params.fried_parameter,
                                 time_between=params.time_between_exposures)

    for idx, psf_slicle in enumerate(psf_cube):
        psf_cube[idx] = psf_slicle.reshape(200, 200)

    clean_psf = psf.get_clean()
    (img_cube, _) = center_cube(psf_cube, ref_img=clean_psf)

    (left, right) = find_sub_psf_location(clean_psf)

    right_psfs = []
    left_psfs = []
    for img in img_cube:
        (left_psf, right_psf) = extract_psfs(img, left, right)
        left_psfs.append(left_psf)
        right_psfs.append(right_psf)

    #plotfast.image(np.array(left_psfs[0]))
    #data = np.abs(left_psfs[0])
    #clipped = (data/data.max()).clip(min=1e-60)
    #plotfast.image(np.array([np.log10(clipped)]))
    plotslow.saveImage_withCb(left_psfs[0],
                              output_path + "right_coro_psf",
                              log=True)
    plotslow.saveImage_withCb(right_psfs[0],
                              output_path + "left_coro_psf",
                              log=True)
Esempio n. 5
0
def coro_psf(output_path):

    numb = 1
    (psf_cube, psf_params) = psf.calc_cube(
        numb, fried_parameter=fried_parameter, time_between=time_between_exposures)
    
    for idx, psf_slicle in enumerate(psf_cube):
        psf_cube[idx] = psf_slicle.reshape(200,200)

    clean_psf = psf.get_clean()
    (img_cube, _) = center_cube(psf_cube, ref_img=clean_psf)

    (left, right) = find_sub_psf_location(clean_psf)

    right_psfs = []
    left_psfs = []
    for img in img_cube:
        (left_psf, right_psf) = extract_psfs(img, left, right)
        left_psfs.append(left_psf)
        right_psfs.append(right_psf)

    #plotfast.image(np.array(left_psfs[0]))
    #data = np.abs(left_psfs[0])
    #clipped = (data/data.max()).clip(min=1e-60)
    #plotfast.image(np.array([np.log10(clipped)]))
    plotslow.saveImage_withCb(left_psfs[0],output_path+"right_coro_psf", log=True)
    plotslow.saveImage_withCb(right_psfs[0],output_path+"left_coro_psf", log=True)
Esempio n. 6
0
def withADI(output_path):

    (img_cube, img_params) = gen_disk_dataset(time_between_exposures, fried_parameter, field_size, inner_radius, outer_radius, 
        rotation, inclination, set_rotation, numb, rings=rings, amplification=amplification)

    clean_psf = psf.get_clean()
    (img_cube, _) = center_cube(img_cube, ref_img=clean_psf)

    (left, right) = find_sub_psf_location(clean_psf)

    right_psfs = []
    left_psfs = []
    for img in img_cube:
        (left_psf, right_psf) = extract_psfs(img, left, right)
        left_psfs.append(left_psf)
        right_psfs.append(right_psf)

    right_final = simple_adi(right_psfs, img_params)
    left_final = simple_adi(left_psfs, img_params)

    #data = np.abs(right_final)
    #plotfast.image(np.array([np.log10(data/data.max())]))

    plotslow.saveImage_withCb(right_final,output_path+"right_ADI", log=False, vmax=.1)
    plotslow.saveImage_withCb(left_final,output_path+"left_ADI", log=False, vmax=.1)
Esempio n. 7
0
def plot_model(params, output_path):
    numb = 1
    model = d.disk(field_size=params.field_size,
                   with_star=True,
                   rotation=params.rotation,
                   inclination=params.inclination,
                   rings=params.rings,
                   amplification=params.amplification)
    (disk_cube, _disk_params) = d.gen_cube(numb, model, params.set_rotation)

    plotslow.saveImage_withCb(disk_cube[0],
                              output_path + "model",
                              log=True,
                              lim=[[50, 150], [50, 150]])
Esempio n. 8
0
def withADI(params, output_path):

    (img_cube,
     img_params) = gen_disk_dataset(params.time_between_exposures,
                                    params.fried_parameter,
                                    params.field_size,
                                    0,
                                    0,
                                    params.rotation,
                                    params.inclination,
                                    params.set_rotation,
                                    params.numb,
                                    rings=params.rings,
                                    amplification=params.amplification)

    clean_psf = psf.get_clean()
    (img_cube, _) = center_cube(img_cube, ref_img=clean_psf)

    (left, right) = find_sub_psf_location(clean_psf)

    right_psfs = []
    left_psfs = []
    for img in img_cube:
        (left_psf, right_psf) = extract_psfs(img, left, right)
        left_psfs.append(left_psf)
        right_psfs.append(right_psf)

    #plotfast.image(np.array(right_psfs))

    right_final = simple_adi(right_psfs, img_params)
    left_final = simple_adi(left_psfs, img_params)

    plotslow.saveImage_withCb(right_final,
                              output_path + "right_ADI",
                              log=False,
                              vmax=.004 * params.amplification)
    plotslow.saveImage_withCb(left_final,
                              output_path + "left_ADI",
                              log=False,
                              vmax=.004 *
                              params.amplification)  #vmin=.005 at ampl = 10
Esempio n. 9
0
def noStar_noReduction(output_path):

    numb=1
    (ref_cube, img_cube, _img_params) = gen_disk_dataset_without_star_perfect_psf(field_size, inner_radius, outer_radius, 
                                       rotation, inclination, set_rotation, numb, rings=rings)

    clean_psf = psf.get_clean()
    (_, shift_cube) = center_cube(ref_cube, ref_img=clean_psf)
    img_cube = center_cube(img_cube, shifts=shift_cube)

    (left, right) = find_sub_psf_location(clean_psf)

    right_psfs = []
    left_psfs = []
    for img in img_cube:
        (left_psf, right_psf) = extract_psfs(img, left, right)
        left_psfs.append(left_psf)
        right_psfs.append(right_psf)

    plotslow.saveImage_withCb(left_psfs[0],output_path+"right_no_star_noReductin", log=True)
    plotslow.saveImage_withCb(right_psfs[0],output_path+"left_no_star_noReduction", log=True)
Esempio n. 10
0
def noReduction(params, output_path):

    numb = 1
    (img_cube,
     _img_params) = gen_disk_dataset(params.time_between_exposures,
                                     params.fried_parameter,
                                     params.field_size,
                                     0,
                                     0,
                                     params.rotation,
                                     params.inclination,
                                     params.set_rotation,
                                     numb,
                                     rings=params.rings,
                                     amplification=params.amplification)

    clean_psf = psf.get_clean()
    (img_cube, _) = center_cube(img_cube, ref_img=clean_psf)

    (left, right) = find_sub_psf_location(clean_psf)

    right_psfs = []
    left_psfs = []
    for img in img_cube:
        (left_psf, right_psf) = extract_psfs(img, left, right)
        left_psfs.append(left_psf)
        right_psfs.append(right_psf)

    #plotfast.image(np.array(left_psfs[0]))

    plotslow.saveImage_withCb(left_psfs[0],
                              output_path + "right_noReductin",
                              log=True,
                              vmin=1e-9,
                              vmax=1e-2)
    plotslow.saveImage_withCb(right_psfs[0],
                              output_path + "left_noReduction",
                              log=True,
                              vmin=1e-9,
                              vmax=1e-2)
Esempio n. 11
0
def noReduction(output_path):

    numb = 1
    (img_cube, _img_params) = gen_disk_dataset(time_between_exposures, fried_parameter, field_size, inner_radius, outer_radius, 
        rotation, inclination, set_rotation, numb, rings=rings, amplification=amplification)

    clean_psf = psf.get_clean()
    (img_cube, _) = center_cube(img_cube, ref_img=clean_psf)

    (left, right) = find_sub_psf_location(clean_psf)

    right_psfs = []
    left_psfs = []
    for img in img_cube:
        (left_psf, right_psf) = extract_psfs(img, left, right)
        left_psfs.append(left_psf)
        right_psfs.append(right_psf)

    #plotfast.image(np.array(left_psfs[0]))

    plotslow.saveImage_withCb(left_psfs[0],output_path+"right_noReductin", log=True, vmin=1e-9)
    plotslow.saveImage_withCb(right_psfs[0],output_path+"left_noReduction", log=True, vmax=1e-2)
Esempio n. 12
0
def run():
    
    time_between_exposures: float = 0.7
    fried_parameter: float = 4
    field_size: float = 10 
    inner_radius: float = 2
    outer_radius: float = 5
    rotation: float = 120
    inclination: float = 60 
    set_rotation: float = 60
    numb: int = 20
    
    output_path = get_output_path("miscellaneous")

    ################################ disk image #########################

    # set disk properties
    disk_with_star = d.disk(field_size=field_size, with_star=False, inner_radius=inner_radius,
        outer_radius=outer_radius, rotation=45, inclination=60, rings = [(0.2,0.5)])

    # create disk cube
    (disk_cube, disk_params) = d.gen_cube(
        1, disk_with_star, set_rotation)
    #plotfast.image(disk_cube[0])
    plotslow.saveImage(disk_cube[0], output_path+"disk_45_60")

    # set disk properties
    disk_with_star = d.disk(field_size=field_size, with_star=False, inner_radius=2.2,
        outer_radius=2.3, rotation=45, inclination=80, rings = [(1.0,1.3),(0.3,0.8)] )

    # create disk cube
    (disk_cube, disk_params) = d.gen_cube(
        1, disk_with_star, set_rotation)
    #plotfast.image(disk_cube[0])
    plotslow.saveImage(disk_cube[0], output_path+"disk_45_10_22_23")

    ############################### psf difference ##########################

    (psf_cube, psf_params) = psf.calc_cube(
        50, fried_parameter=fried_parameter, time_between=time_between_exposures)

    clean_psf = psf.get_clean()

    length = int(np.sqrt(psf_cube[0].shape[0]))
    psf_cube = [psf.reshape(length,length) for psf in psf_cube]
    (psf_cube, _) = center_cube(psf_cube, ref_img=clean_psf)

    difference1 = psf_cube[0]-psf_cube[1]
    difference2 = psf_cube[0]-psf_cube[9]
    difference3 = psf_cube[0]-psf_cube[49]

    plotslow.saveImage_withCb(difference1, output_path+"psf_diff_007", 0.0015)
    plotslow.saveImage_withCb(difference2, output_path+"psf_diff_070", 0.0015)
    plotslow.saveImage_withCb(difference3, output_path+"psf_diff_140", 0.0015)
Esempio n. 13
0
def on_sky():
    ############################### on sky psf difference ######################

    script_path = os.path.realpath(__file__).split("vApp_reduction", 1)[0]
    full_path = script_path + "vApp_reduction/data/"

    hdul = fits.open(full_path + "pbimage_14_36_50.575271241_bg.fits")
    data = hdul[0].data
    hdul.info()

    ref_psf = data[0]

    padded = [
        np.pad(data[i], ((4 + 25, 4 + 25), (13, 13)),
               'constant',
               constant_values=((0, 0), (0, 0))) for i in range(50)
    ]
    (aligned, _) = center_cube(padded, ref_img=padded[0])

    #leakage term location:
    #122 -140 x
    #84 - 102 y
    #plotfast.image(aligned[0][84:102, 122:140])

    normalised = []
    for psfimg in aligned:
        #leakage_max = psf[84:102, 122:140].max()
        leakage_max = psfimg.max()
        normalised.append(psfimg / leakage_max)

    # still contains a few bad shot, not a problem for our purpose
    plotfast.image(np.array(normalised))

    difference1 = normalised[0] - normalised[1]
    difference2 = normalised[0] - normalised[9]
    difference3 = normalised[0] - normalised[49]

    difference1 = np.rot90(difference1[15:-75, 40:-50])
    difference2 = np.rot90(difference2)[20:205, :175]
    difference3 = np.rot90(difference3)[20:205, :175]

    output_path = get_output_path("miscellaneous")
    plotslow.saveImage_withCb(difference1,
                              output_path + "on_sky_psf_diff_007",
                              norm=False)
    plotslow.saveImage_withCb(difference2,
                              output_path + "on_sky_psf_diff_070",
                              norm=False)
    plotslow.saveImage_withCb(difference3,
                              output_path + "on_sky_psf_diff_140",
                              norm=False)
Esempio n. 14
0
def on_sky():
    ############################### on sky psf difference ######################

    script_path = os.path.realpath(__file__).split("vApp_reduction",1)[0]
    full_path = script_path+"vApp_reduction/data/"

    hdul = fits.open(full_path+"pbimage_14_36_50.575271241_bg.fits")
    data = hdul[0].data
    hdul.info()

    ref_psf = data[0]

    padded = [np.pad(data[i], ((4+25,4+25),(13,13)), 'constant', constant_values=((0,0),(0,0))) for i in range(50)]
    (aligned, _) = center_cube(padded, ref_img=padded[0])

    #leakage term location:
    #122 -140 x
    #84 - 102 y
    #plotfast.image(aligned[0][84:102, 122:140])

    normalised = []
    for psf in aligned:
        leakage_max = psf[84:102, 122:140].max()
        normalised.append(psf/leakage_max)
    
    # still contains a few bad shot, not a problem for our purpose
    #plotfast.image(np.array(normalised))

    difference1 = normalised[0]-normalised[1]
    difference2 = normalised[0]-normalised[9]
    difference3 = normalised[0]-normalised[49]

    difference1 = np.rot90(difference1[15:-75, 40:-50])
    difference2 = np.rot90(difference2)[20:205, :175]
    difference3 = np.rot90(difference3)[20:205, :175]
    print(difference1.shape)
    print(difference2.shape)
    print(difference3.shape)

    output_path = get_output_path("miscellaneous")
    plotslow.saveImage_withCb(difference1, output_path+"on_sky_psf_diff_007", 0.5)
    plotslow.saveImage_withCb(difference2, output_path+"on_sky_psf_diff_070", 0.5)
    plotslow.saveImage_withCb(difference3, output_path+"on_sky_psf_diff_140", 0.5)
Esempio n. 15
0
def run():

    time_between_exposures: float = 20
    fried_parameter: float = 18
    field_size: float = 10
    inner_radius: float = 2
    outer_radius: float = 5
    rotation: float = 120
    inclination: float = 60
    set_rotation: float = 60
    numb: int = 20

    output_path = get_output_path("miscellaneous")

    ################################ disk image #########################

    # set disk properties
    disk_with_star = d.disk(field_size=field_size,
                            with_star=False,
                            inner_radius=inner_radius,
                            outer_radius=outer_radius,
                            rotation=45,
                            inclination=60,
                            rings=[(0.2, 0.5)])

    # create disk cube
    (disk_cube, disk_params) = d.gen_cube(1, disk_with_star, set_rotation)
    #plotfast.image(disk_cube[0])
    plotslow.saveImage(disk_cube[0], output_path + "disk_45_60")

    # set disk properties
    disk_with_star = d.disk(field_size=field_size,
                            with_star=False,
                            inner_radius=2.2,
                            outer_radius=2.3,
                            rotation=45,
                            inclination=80,
                            rings=[(1.0, 1.3), (0.3, 0.8)])

    # create disk cube
    (disk_cube, disk_params) = d.gen_cube(1, disk_with_star, set_rotation)
    #plotfast.image(disk_cube[0])
    plotslow.saveImage(disk_cube[0], output_path + "disk_45_10_22_23")

    ############################### psf difference ##########################

    (psf_cube, psf_params) = psf.calc_cube(50,
                                           fried_parameter=fried_parameter,
                                           time_between=time_between_exposures)

    clean_psf = psf.get_clean()

    length = int(np.sqrt(psf_cube[0].shape[0]))
    psf_cube = [psf.reshape(length, length) for psf in psf_cube]
    (psf_cube, _) = center_cube(psf_cube, ref_img=clean_psf)

    normalised = []
    for psfimg in psf_cube:
        #leakage_max = psfimg[95:105, 95:105].max()
        leakage_max = psfimg.max()
        normalised.append(psfimg / leakage_max)

    #plt.imshow(psf_cube[0])
    #plt.show()
    plotfast.image(np.array(normalised))

    difference1 = normalised[0] - normalised[1]
    difference2 = normalised[0] - normalised[9]
    difference3 = normalised[0] - normalised[49]

    plotslow.saveImage_withCb(difference1,
                              output_path + "psf_diff_007",
                              norm=False)
    plotslow.saveImage_withCb(difference2,
                              output_path + "psf_diff_070",
                              norm=False)
    plotslow.saveImage_withCb(difference3,
                              output_path + "psf_diff_140",
                              norm=False)