Beispiel #1
0
def deepsky_date_survey(save_suffix):

    dir = os.path.dirname(__file__)
    savedir = os.path.join(dir, '../../data/deepsky_test/date1_s1/')

    # FOV Dimensions
    FOV_Dim = (2048 * 6.2 / 3600) * (pi / 180)  # Base Dimension
    FOV_phi = FOV_Dim * 2
    FOV_theta = FOV_Dim

    # Pointings

    pointings1 = gen_deepskydate1_points()

    #pointings1=np.array([[1.0, pi/36,0, 0],
    #                    [1.0, pi/62, 0, 0]])

    days = np.unique(pointings1[:, 0])

    # Initializations
    skymap = SkyMap(nside=2**10,
                    LVF_theta=FOV_theta,
                    LVF_phi=FOV_phi,
                    cap_theta=pi / 4)
    skyplot1 = SkyPlots2()
    fig_sub, ax_sub = plt.subplots(1, 4, subplot_kw=dict(polar=True))
    sub_ind = 0
    subplot_days = [1, 91, 182, 365]
    #subplot_days=[1,3,7,10]
    plot_days = [1, 3, 45, 91, 130, 182, 230, 290, 365]
    #plot_days=[1,2,3,7,10]
    plot_lambda_ranges = [(.75, 2.34), (.75, .76), (1.30, 1.33), (2.26, 2.34)]

    for day in days:
        points_in = map(tuple, pointings1[pointings1[:, 0] == day, 1:4])

        for i, tupler in enumerate(points_in):
            print "day:%s, step:%s" % (day, i)
            skymap.make_dicts(day, tupler)

        if day in plot_days:
            for j, tupler in enumerate(plot_lambda_ranges):
                fig1, ax1 = plt.subplots(1, 1, subplot_kw=dict(polar=True))
                redu_mat2, redu_dict2 = redu_data(skymap.lambda_dict,
                                                  lambda_min=tupler[0],
                                                  lambda_max=tupler[1])

                scat, Nhits = redu_deepsky(ax1, redu_mat2, redu_dict2)

                fig1.colorbar(scat)
                fig1.set_size_inches(20, 10)
                fig1.suptitle("Day %s, Nhits=%s, [%s, %s]" %
                              (day, Nhits, tupler[0], tupler[1]))

                savename2 = "date1_s1_%s_%s" % (day, tupler)
                plt.savefig(savedir + "%s.png" % (savename2))

        if day in subplot_days:
            redu_mat1, redu_dict1 = redu_data(skymap.lambda_dict, .75, 5)
            redu_deepsky(ax_sub[sub_ind], redu_mat1, redu_dict1)
            sub_ind += 1

    subplot_proposal1(fig_sub, ax_sub)
    fig_sub.savefig(savedir + "%s.png" % ("MultiPanel_date1_s1"))
Beispiel #2
0
def allsky_survey(pointing_file, save_suffix):
    dir= os.path.dirname(__file__)
    savedir = os.path.join(dir, '../../data/allsky_test/')


    # FOV Dimensions
    FOV_Dim=(2048*6.2/3600)*(pi/180) # Base Dimension
    FOV_phi=FOV_Dim*2
    FOV_theta=FOV_Dim
    Nstrip=21 # Number of strips on each band of FOV 
    skymap = SkyMap(nside=2**9,LVF_theta=FOV_theta, LVF_phi=FOV_phi, cap_theta=pi) 

    pointings1 = read_in_date(pointing_file)
    

    days = np.unique(pointings1[:,0])
    

    # Initializations
    skyplot1=SkyPlots2()
    fig_sub, ax_sub= plt.subplots(1, 4, subplot_kw=dict(projection="mollweide"))        
    sub_ind=0
    subplot_days=[91,182,273,365]
    plot_days=[1,91,182,273,365]
    
    plot_lambda_ranges=[(.75,2.34),(.75,.76),(1.30,1.33),(2.26,2.34)]

    for day in days:
        points_in=map(tuple, pointings1[ pointings1[:,0]==day, 1:4] )

        for i, tupler in enumerate(points_in):
            print "day:%s, step:%s" %(day, i)
            skymap.make_dicts(day, tupler )

        if day in plot_days:
            for j,tupler in enumerate(plot_lambda_ranges):
                fig1, ax1= plt.subplots(1,1, subplot_kw=dict(projection="mollweide"))        
                redu_mat2, redu_dict2 = redu_data(skymap.lambda_dict, lambda_min=tupler[0] ,lambda_max=tupler[1])
                
                scat, Nhits=redu_allsky( ax1, redu_mat2, redu_dict2)

                ax1.get_xaxis().set_ticks([])
                ax1.get_yaxis().set_ticks([])
                  
                fig1.colorbar(scat)
                fig1.set_size_inches(20,10)
                #fig1.suptitle("Day %s, Nhits=%s, [%s, %s]" %(day, Nhits, tupler[0], tupler[1]) )        

                savename2="allsky_date1_3_%s_%s" %(day,tupler)
                plt.savefig( savedir + "%s.svg" %(savename2) )   


        if day in subplot_days:
            redu_mat1, redu_dict1=redu_data(skymap.lambda_dict, .75, .76)
            scat_mult, Nhits=redu_allsky( ax_sub[sub_ind], redu_mat1, redu_dict1)
            ax_sub[sub_ind].get_xaxis().set_ticks([])
            ax_sub[sub_ind].get_yaxis().set_ticks([])

            sub_ind+=1

    subplot_proposal1( fig_sub, ax_sub)
    fig_sub.subplots_adjust(right=0.8)
    cbar_ax=fig_sub.add_axes([.85,.23,.01,.5])
    fig_sub.colorbar(scat_mult, cax=cbar_ax)

    fig_sub.savefig( savedir + "%s.svg" %("MultiPanel_3") )   
    
    # Save Dictionary
    skymap.save_lambda_dict(save_suffix)
def deepsky_date_survey(save_suffix, gen_name, rel_save_location):

    dir = os.path.dirname(__file__)
    savedir = os.path.join(dir, rel_save_location)

    # FOV Dimensions
    FOV_Dim = (2048 * 6.2 / 3600) * (pi / 180)  # Base Dimension
    FOV_phi = FOV_Dim * 2
    FOV_theta = FOV_Dim

    # Pointings

    pointings1 = gen_deepskydate1_points()
    #pointings1=np.array([[1.0, pi/36, 0, 0]])

    days = np.unique(pointings1[:, 0])

    # Initializations
    skymap = SkyMap(nside=2**9,
                    LVF_theta=FOV_theta,
                    LVF_phi=FOV_phi,
                    cap_theta=15 * pi / 180)
    skyplot1 = SkyPlots2()
    fig_sub, ax_sub = plt.subplots(1, 4, subplot_kw=dict(polar=True))
    sub_ind = 0
    subplot_days = [91, 182, 273, 364]
    #subplot_days=[1,3,7,10]
    plot_days = [1, 2, 3, 4, 5, 6, 91, 182, 273, 364]
    #plot_days=[1,2,3,7,10]
    plot_lambda_ranges = [(.75, 2.34), (.75, .76), (1.30, 1.33), (2.26, 2.34)]

    for day in days:
        points_in = map(tuple, pointings1[pointings1[:, 0] == day, 1:4])

        for i, tupler in enumerate(points_in):
            print "day:%s, step:%s" % (day, i)
            skymap.make_dicts(day, tupler)

        if day in plot_days:
            for j, tupler in enumerate(plot_lambda_ranges):
                fig1, ax1 = plt.subplots(1, 1, subplot_kw=dict(polar=True))
                redu_mat2, redu_dict2 = redu_data(skymap.lambda_dict,
                                                  lambda_min=tupler[0],
                                                  lambda_max=tupler[1])

                scat, Nhits = redu_deepsky(ax1, redu_mat2, redu_dict2)

                fig1.colorbar(scat)
                fig1.set_size_inches(20, 15)
                fig1.suptitle("Day %s, Nhits=%s, [%s, %s]" %
                              (day, Nhits, tupler[0], tupler[1]))

                savename2 = "%s_%s_%s" % (gen_name, day, tupler)
                plt.savefig(savedir + "%s.png" % (savename2), dpi=150)

        if day in subplot_days:
            redu_mat1, redu_dict1 = redu_data(skymap.lambda_dict, .75, 5)
            redu_deepsky(ax_sub[sub_ind], redu_mat1, redu_dict1)
            sub_ind += 1

    # Make FOM Plots
    out_array = lam_dict_to_array(skymap.lambda_dict)
    array_mean_std_plots(out_array, gen_name, savedir)

    proposal_deepsky_specs(fig_sub, ax_sub)
    fig_sub.savefig(savedir + "MultiPanel_%s.png" % (gen_name), dpi=150)

    # Save Dictionary
    skymap.save_lambda_dict(save_suffix)
Beispiel #4
0
def allsky_survey(pointing_file, save_suffix):
    dir = os.path.dirname(__file__)
    savedir = os.path.join(dir, '../../data/allsky_test/')

    # FOV Dimensions
    FOV_Dim = (2048 * 6.2 / 3600) * (pi / 180)  # Base Dimension
    FOV_phi = FOV_Dim * 2
    FOV_theta = FOV_Dim
    Nstrip = 21  # Number of strips on each band of FOV
    skymap = SkyMap2(nside=2**8,
                     LVF_theta=FOV_theta,
                     LVF_phi=FOV_phi,
                     cap_theta=pi)

    pointings1 = read_in_date(pointing_file)

    days = np.unique(pointings1[:, 0])

    # Initializations
    skyplot1 = SkyPlots2()
    fig_sub, ax_sub = plt.subplots(1,
                                   4,
                                   subplot_kw=dict(projection="mollweide"))
    sub_ind = 0
    sum_plot_days = [2, 91, 182, 273, 365]
    least_plot_days = [91, 181, 273, 365]

    plot_lambda_ranges = [(.75, 2.34), (.75, .76), (1.30, 1.33), (2.26, 2.34)]

    for day in days:
        points_in = map(tuple, pointings1[pointings1[:, 0] == day, 1:4])

        for i, tupler in enumerate(points_in):
            print "day:%s, step:%s" % (day, i)
            skymap.make_dicts(day, tupler)

            if (day in least_plot_days) & (i == 0):
                least_hits_arr = skymap.least_hits()

                theta_in = least_hits_arr[:, 0]
                phi_in = least_hits_arr[:, 1]
                hits_in = least_hits_arr[:, 2]

                moll_plot(theta_in, phi_in, hits_in,
                          "least_allsky: Day %s" % (day),
                          "least_allsky_4_day_%s" % (day))

            if (day in sum_plot_days) & (i == 0):
                sum_hits_arr = skymap.sum_hits()

                theta_in = sum_hits_arr[:, 0]
                phi_in = sum_hits_arr[:, 1]
                hits_in = sum_hits_arr[:, 2]

                moll_plot(theta_in, phi_in, hits_in,
                          "sum_allsky: Day %s" % (day),
                          "sum_allsky_4_day_%s" % (day))

    least_hits_arr = skymap.least_hits()
    theta_in = least_hits_arr[:, 0]
    phi_in = least_hits_arr[:, 1]
    hits_in = least_hits_arr[:, 2]
    moll_plot(theta_in, phi_in, hits_in, "least_allsky: Day %s" % ("FINAL"),
              "least_allsky_4_day_%s" % ("FINAL"))

    sum_hits_arr = skymap.sum_hits()
    theta_in = sum_hits_arr[:, 0]
    phi_in = sum_hits_arr[:, 1]
    hits_in = sum_hits_arr[:, 2]
    moll_plot(theta_in, phi_in, hits_in, "sum_allsky: Day %s" % ("FINAL"),
              "sum_allsky_4_day_%s" % ("FINAL"))