Пример #1
0
    dz.data_plot(Input_Wavelength, Output_Flux, 'Stellar fit')
    dz.data_plot(ClippedPixels[0],
                 ClippedPixels[1],
                 'Clipped pixels',
                 color=dz.colorVector['green'],
                 markerstyle='o')
    dz.data_plot(FlagPixels[0],
                 FlagPixels[1],
                 'Flagged pixels',
                 color=dz.colorVector['pink'],
                 markerstyle='o')

    #Check flagged pixels
    dz.area_fill(InitialPoints,
                 FinalPoints,
                 'Masks',
                 color=dz.colorVector['orangish'],
                 alpha=0.2)

    # Set titles and legend
    PlotTitle = r'Object ' + objName + ' spectrum with masked and flagged pixels'
    dz.FigWording(r'Wavelength $(\AA)$',
                  'Flux' + r'$(erg\,cm^{-2} s^{-1} \AA^{-1})$', PlotTitle)
    dz.Axis.set_aspect(3)
    dz.display_fig()

#     # Save data
#     output_pickle = '{objFolder}{stepCode}_{objCode}_{ext}'.format(objFolder=ouput_folder, stepCode=dz.ScriptCode, objCode=objName, ext='Sl_MasksFlags')
#     dz.save_manager(output_pickle, save_pickle = True)

#-----------------------------------------------------------------------------------------------------
Пример #2
0
        IntEmi_dered = dz.derreddening_spectrum(Wave_E,
                                                Int_E,
                                                reddening_curve=red_curve,
                                                cHbeta=cHbeta.nominal_value,
                                                R_v=R_v)

        Int_Sum = IntEmi_dered + Int_Stellar_Resampled + Int_N

        dz.data_plot(Wave_O, IntObs_dered, 'Observed spectrum')
        dz.data_plot(Wave_N, Int_N, 'Nebular continuum', linestyle='-')
        dz.data_plot(Wave_S, Int_S, 'Stellar continuum', linestyle='-')
        #         dz.insert_image('/home/vital/Dropbox/Astrophysics/Papers/Yp_AlternativeMethods/images/SHOC579_invert.png', Image_Coordinates = [0.07,0.875], Zoom=0.25, Image_xyCoords = 'axes fraction')

        dz.area_fill(metals_regions - 10,
                     metals_regions + 10,
                     'Collisional excitation lines',
                     color=dz.colorVector['olive'],
                     alpha=0.5)
        dz.area_fill(recombination_regions - 10,
                     recombination_regions + 10,
                     'Recombination lines',
                     color=dz.colorVector['pink'],
                     alpha=0.5)

        #Set titles and legend
        PlotTitle = ''
        dz.FigWording(r'Wavelength $(\AA)$',
                      'Flux' + r'$(erg\,cm^{-2} s^{-1} \AA^{-1})$',
                      PlotTitle,
                      loc='upper right',
                      ncols_leg=2)
for i in range(len(FilesList)):
    
    
    
    #Analyze file address
    CodeName, FileName, FileFolder  = dz.Analyze_Address(FilesList[i])
    
    #Import fits file    
    Wave, Int, ExtraData            = dz.File_to_data(FileFolder,FileName)
        
    #Getting the masks as a two lists with initial and final points            #WARNING the masks generated do not distinguish the absorptions
    MaskFileName                    = CodeName + '_Mask.lineslog'
    InitialPoints, FinalPoints      = loadtxt(FileFolder + MaskFileName, usecols=(0,1) ,skiprows=1,unpack=True) #Change by new method 
    
    #Plot the data
    dz.data_plot(Wave, Int, "Input spectrum", dz.ColorVector[2][1])               
    dz.area_fill(InitialPoints, FinalPoints, 'Masks', dz.ColorVector[2][0], 0.2)
           
    # Set titles and legend
    PlotTitle = r'Object ' + CodeName + ' spectrum with masked and flagged pixels' 
    dz.FigWording(r'Wavelength $(\AA)$', 'Flux' + r'$(erg\,cm^{-2} s^{-1} \AA^{-1})$', PlotTitle)
       
    # Save data  
    dz.save_manager(FileFolder + dz.ScriptCode + '_' + CodeName + '_Sl_MasksFlags') 

    print i+1, '/' , len(FilesList)

#-----------------------------------------------------------------------------------------------------

print "All data treated"