示例#1
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, Nstrips=Nstrip, lambda_min1=.75, lambda_min2=1.25) 

    pointings1 = read_in_date(pointing_file)
    

    days = np.unique(pointings1[:,0])
   
    # Initializations
    skyplot1=SkyPlots2()
    fig_sub, ax_sub= plt.subplots(3, 4, subplot_kw=dict(projection="mollweide"))        
    sub_ind=0
    subplot_days=[91, 182, 273, 365]
    plot_days=[1,2,3]
    plot_lambda_ranges=[(.75,2.40),(.75,.76),(1.30,1.33),(2.33,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)

                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_time_%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)
            for j in [0,1,2]:
                redu_allsky( ax_sub[j,sub_ind], redu_mat1, redu_dict1)
            sub_ind+=1

    subplot_proposal1( fig_sub, ax_sub)
    fig_sub.savefig( savedir + "%s.png" %("MultiPanel") )   
    
    # Save Dictionary
    skymap.save_lambda_dict(save_suffix)
示例#2
0
def allsky_survey(pointing_file):
    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
    skymap = SkyMap2(nside=2**8,
                     LVF_theta=FOV_theta,
                     LVF_phi=FOV_phi,
                     cap_theta=pi)
    #print skymap.skydata.sky_df
    #skymap.skydata.sky_df.save("testdf")

    pointings1 = read_in_date(pointing_file)

    pointings3 = pointings1[(pointings1[:, 0] <= 200)]
    pointings1 = pointings3[(pointings3[:, 2] <= pi + 1.5 * FOV_phi)
                            & (pointings3[:, 2] >= pi - 1.5 * FOV_phi)]
    print "Length of pointings", pointings1.shape[0]

    days = np.unique(pointings1[:, 0])
    print "Number of Days", len(days)

    # Initializations
    fig_sub, ax_sub = plt.subplots(1,
                                   4,
                                   subplot_kw=dict(projection="mollweide"))
    #sum_plot_days=[]
    least_plot_days = [182, 183, 184, 185, 186, 187, 188, 189]

    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 = np.copy(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 - 1),
                          "least_allsky_7_day_%s" % (day - 1))

    least_hits_arr = np.copy(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_7_day_%s" % ("FINAL"))
    np.save("check180_3", least_hits_arr)
    skymap.skydata.sky_df.save("testdf_3")
示例#3
0
def allsky_survey(pointing_file):
    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
    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
    fig_sub, ax_sub = plt.subplots(1,
                                   4,
                                   subplot_kw=dict(projection="mollweide"))
    sum_plot_days = [2, 8, 9, 10, 11, 12, 13, 31]
    least_plot_days = [2, 8, 9, 10, 11, 12, 13, 31]

    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 = np.copy(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 - 1),
                          "least_allsky_8_day_%s" % (day - 1))

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

                theta_in = sum_hits_arr[:, 0]
                phi_in = sum_hits_arr[:, 1]
                hits_in = sum_hits_arr[:, 2]
                moll_plot2(theta_in, phi_in, hits_in,
                           "sum_allsky: Day %s" % (day - 1),
                           "sum_allsky_8_day_%s" % (day - 1))
示例#4
0
def allsky_survey(pointing_file):
    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
    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
    fig_sub, ax_sub= plt.subplots(1, 4, subplot_kw=dict(projection="mollweide"))        
    sum_plot_days=[2,8,10,31, 45, 92,183,184,274]
    least_plot_days=[92,93,183,184,274,275]
    
    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-1), "least_allsky_6_day_%s" %(day-1))
                
            #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-1), "sum_allsky_4_day_%s" %(day-1))

    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_6_day_%s" %("FINAL"))
示例#5
0
def allsky_survey(pointing_file):
    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
    skymap = SkyMap2(nside=2**8,LVF_theta=FOV_theta, LVF_phi=FOV_phi, cap_theta=pi) 
    #print skymap.skydata.sky_df
    #skymap.skydata.sky_df.save("testdf")

    pointings1 = read_in_date(pointing_file)

    pointings3=pointings1[(pointings1[:,0]<= 200)]
    pointings1=pointings3[(pointings3[:,2]<=pi+1.5*FOV_phi) & (pointings3[:,2]>=pi-1.5*FOV_phi)]
    print "Length of pointings", pointings1.shape[0]

    days = np.unique(pointings1[:,0])
    print "Number of Days", len(days)

    # Initializations
    fig_sub, ax_sub= plt.subplots(1, 4, subplot_kw=dict(projection="mollweide"))        
    #sum_plot_days=[]
    least_plot_days=[182,183,184,185,186,187,188,189]
    
    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=np.copy(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-1), "least_allsky_7_day_%s" %(day-1))
                
    least_hits_arr=np.copy(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_7_day_%s" %("FINAL"))
    np.save("check180_3", least_hits_arr)
    skymap.skydata.sky_df.save("testdf_3")
示例#6
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)
示例#7
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"))
示例#8
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"))