예제 #1
0
from DZ_DataExplorer                import Plots_Manager


# We declare the folder and log file to drop the lines data
dz = Plots_Manager()
  
# Forcing the remake of new log file
dz.RemakeFiles = True
    
#Identify spectrum (It assumes it is on the same folder of the code)
FileFolder, FileName = '', 'objSHOC579_WHT.fits'
  
#Load fits file data
Wave, Int, Header = dz.File2Data(FileFolder, FileName)

#Six wavelengths which mark the blue continuum, the line, and the red continuum (example for OIII 5007Angstroms)
Wavelength_points = [4967.758991, 4984.263585, 4999.928963, 5012.657082, 5030.420501, 5046.505486]

#Using a direct gausshermite
results_dict = dz.Command_LineMesuring(Wave, Int, Wavelength_points, Measuring_Method = 'kmpfit_GaussHermite')

#Using a MC gauss-hermite
results_dict_MCMC = dz.Command_LineMesuring(Wave, Int, Wavelength_points, Measuring_Method = 'kmpfit_GaussHermite_MCMC')

#Dictionary with the results from the analysis
print '\nResults example1'
for key in results_dict:
    print key, results_dict[key]

print '\nResults example2'
#Dictionary with the results from the analysis
#!/usr/bin/python

from numpy                          import searchsorted as np_searchsorted
from DZ_DataExplorer                import Plots_Manager
from ManageFlow                     import DataToTreat

# We declare the folder and log file to drop the lines data
Catalogue_Dic       = DataToTreat()
Pattern             = Catalogue_Dic['Datatype'] + '_dered2nd_Neb2nd.fits'                               #First batch process for untreated spectra
DataLog_Extension   = '_' + Catalogue_Dic['Datatype'] + '_dered2nd_Neb2nd_LinesLog_v3.txt'    #First data log for reduced spectra

# Importing Dazer libraries for launching the batch measurement
pv                  = Plots_Manager()

# Forcing the remake of new files
pv.RemakeFiles      = True

#Find and organize files from terminal command or .py file
FilesList           = pv.Folder_Explorer(Pattern, Catalogue_Dic['Obj_Folder'], CheckComputer=False)

for i in range(len(FilesList)):

#       Get the spectrum:              
        CodeName, FileName, FileFolder  = pv.Analyze_Address(FilesList[i])
        Wave, Int, ExtraData            = pv.File2Data(FileFolder, FileName)
    
#       Get the text file:  
        Lick_TextFileName               = CodeName + '_LickIndexes.txt'
        Lick_TextFile                   = open(FileFolder + Lick_TextFileName,"r")
        TextLines                       = Lick_TextFile.readlines()
        Lick_TextFile.close()
예제 #3
0
        index = str(i)
        scale_params['A'+ index]     = ufloat(fit_output['A'+ index].value, fit_output['A'+ index].stderr) * y_scale
        scale_params['mu'+ index]    = ufloat(fit_output['mu'+ index].value, fit_output['mu'+ index].stderr) + x_scale
        scale_params['sigma'+ index] = ufloat(fit_output['sigma'+ index].value, fit_output['sigma'+ index].stderr)
        scale_params['fwhm'+ index]  = ufloat(fit_output['fwhm'+ index].value, fit_output['fwhm'+ index].stderr)
        scale_params['FWHM'+ index]  = ufloat(fit_output['FWHM'+ index].value, fit_output['FWHM'+ index].stderr)
        scale_params['Flux'+ index]  = ufloat(fit_output['Flux'+ index].value, fit_output['Flux'+ index].stderr) * y_scale
        
    return scale_params

# We declare the folder and log file to drop the lines data

pv = Plots_Manager()
  
# Forcing the remake of new files
pv.RemakeFiles = True
  
#Object and line to treat
Obj_Folder      = '/home/vital/Dropbox/Astrophysics/Data/WHT_Catalogue_SulfurRegression/Objects/SHOC579/'
Obj_Pattern     = 'objSHOC579_WHT.fits'
 
#Find and organize files from terminal command or .py file
FilesList = pv.Folder_Explorer(Obj_Pattern, Obj_Folder, CheckComputer=False)
List_wide_component = ['SHOC579']

#Set color format
pv.FigFormat_One(ColorConf='Night1')

#Identify file
CodeName, FileName, FileFolder = pv.Analyze_Address(FilesList[0])