#!/usr/bin/env python

import pymc
import numpy as np
from dazer_methods import Dazer
from scipy.interpolate import interp1d
from libraries.Astro_Libraries.Nebular_Continuum import Nebular_Bayesian
from lmfit.models import LinearModel

#Declare code classes
dz = Dazer()
nb = Nebular_Bayesian()

#Declare data to treat
Catalogue_Dic       = dz.import_catalogue()
nebular_exten       = '_NebularContinuum.fits'
Stellar_ext         = '_StellarContinuum.fits'
emitting_ext        = '_Emission.fits'
cHbeta_type         = 'cHBeta_red'
AbundancesFileExtension = '_' + Catalogue_Dic['Datatype'] + '_emission_LinesLog_v3.txt'    #First data log for reduced spectra

#Find and organize files from terminal command or .py file
FilesList           = dz.Folder_Explorer(Stellar_ext,  Catalogue_Dic['Obj_Folder'], CheckComputer=False)
catalogue_frame     = dz.load_catalogue_frame(FilesList)
# 
# print catalogue_frame
# 
# #Define plot frame and colors
dz.FigConf(n_colors=5, fontsize=30)
# 
# lineal_mod = LinearModel(prefix='lineal_')
from dazer_methods import Dazer

#Create class object
dz = Dazer()
script_code = dz.get_script_code()

#Define operation
catalogue_dict = dz.import_catalogue()

#Load catalogue dataframe
catalogue_df = dz.load_dataframe(catalogue_dict['dataframe'])

#Set figure format
dz.FigConf()

#Loop through the objects
for i in range(len(catalogue_df.index)):

    #Treat each arm file
    for color in ['Blue', 'Red']:
    
        if (color == 'Red') and (catalogue_df.iloc[i].tell_correction != 'None'):
            fits_file = catalogue_df.iloc[i].tellRed_file
        
        else:
            fits_file = catalogue_df.iloc[i]['{}_file'.format(color)]
        
        #Read the data
        redshift = catalogue_df.iloc[i]['z_{}'.format(color)]
        z_fits_file = fits_file.replace('.fits', '_z.fits')
from pandas import read_csv
from dazer_methods import Dazer
from timeit import default_timer as timer
from DZ_LineMesurer import LineMesurer_v2

#Define main class
dz = Dazer()
lm = LineMesurer_v2('/home/vital/workspace/dazer/format/',
                    'DZT_LineLog_Headers.dz')

#Making the plot:
dz.FigConf()

#Load catalogue dataframe
catalogue_dict = dz.import_catalogue()
catalogue_df = dz.load_excel_DF(
    '/home/vital/Dropbox/Astrophysics/Data/WHT_observations/WHT_Galaxies_properties.xlsx'
)
lickIndcs_extension = '_lick_indeces.txt'

#Declare object to treat
objName = 'SHOC575_n2'

#Load line regions
ouput_folder = '{}{}/'.format(catalogue_dict['Obj_Folder'], objName)
lick_idcs_df = read_csv(ouput_folder + objName + lickIndcs_extension,
                        delim_whitespace=True,
                        header=0,
                        index_col=0,
                        comment='L')  #Dirty trick to avoid the Line_label row
#!/usr/bin/python

from dazer_methods import Dazer

#Create class object
dz = Dazer()
script_code     = dz.get_script_code()

#Load catalogue dataframe
catalogue_dict  = dz.import_catalogue()
catalogue_df    = dz.load_dataframe(catalogue_dict['dataframe'])
log_exension    = '_' + catalogue_dict['Datatype'] + '_linesLog_reduc.txt'

#Define operation
Catalogue_Dic           = dz.import_catalogue()
Pattern                 =  '_' + Catalogue_Dic['Datatype'] + '_linesLog_reduc.txt'

#Define table shape
Width                   = "%" + str(50+2) + "s"
HeaderSize              = 2
LickIndexesHeader       = ['Ion', 'lambda_theo', 'group_label','Wave1', 'Wave2', 'Wave3', 'Wave4', 'Wave5', 'Wave6', 'add_wide_component']
columns_format          = ['%11.6f', '%11.6f', '%11.6f','%11.6f', '%11.6f', '%11.6f', '%11.6f', '%11.6f', '%11.6f', '%11.6f']

#Loop through the objects
for i in range(len(catalogue_df.index)):

    #Object
    objName             = catalogue_df.iloc[i].name
    fits_file           = catalogue_df.iloc[i].reduction_fits
    ouput_folder        = '{}{}/'.format(catalogue_dict['Obj_Folder'], objName) 
    lineslog_address    = '{objfolder}{codeName}_WHT_linesLog_reduc.txt'.format(objfolder = ouput_folder, codeName=objName)
Пример #5
0
from dazer_methods import Dazer
import matplotlib

# Generate dazer object
dz = Dazer()

# Choose plots configuration
dz.FigConf()

# Import catalogue
Catalogue = dz.import_catalogue()

# Perform operations

x = [1, 2, 3, 4, 5, 6]
y = [1, 2, 3, 4, 5, 6]

# Plot the data
dz.data_plot(x, y, markerstyle="o")

# Generate the figure
dz.display_fig()


# from DZ_DataExplorer                import Plots_Manager
#
# # We declare the folder and log file to drop the lines data
# pv = Plots_Manager()
#
# # Forcing the remake of new files
# pv.RemakeFiles = True
Пример #6
0
from numpy import where
from uncertainties import ufloat
from dazer_methods import Dazer

#Declare objects
dz = Dazer()

#Define data type and location
Catalogue_Dic = dz.import_catalogue()
Table_Name = '_lineslog'
log_extension = '_log.txt'
cHbeta_type = 'cHBeta_red'
emission_log = '_' + Catalogue_Dic['Datatype'] + '_LinesLog_v3.txt'
# emission_log_st = '_' + Catalogue_Dic['Datatype'] + '_emission_LinesLog_v3.txt'

#Get file list
FilesList = dz.Folder_Explorer(emission_log,
                               Catalogue_Dic['Obj_Folder'],
                               CheckComputer=False)

#Get the dictionary with the headers format and the data
dz.EmissionLinesLog_header()

#Generate list of objects (Dazer should have a method for this)
for i in range(len(FilesList)):

    CodeName, FileName, FileFolder = dz.Analyze_Address(FilesList[i])

    #load object data
    cHbeta = dz.GetParameter_ObjLog(CodeName,
                                    FileFolder,
#!/usr/bin/python

from dazer_methods import Dazer

#Create class object
dz = Dazer()
script_code = dz.get_script_code()

#Load catalogue dataframe
catalogue_dict = dz.import_catalogue()
catalogue_df = dz.load_excel_DF(
    '/home/vital/Dropbox/Astrophysics/Data/WHT_observations/WHT_Galaxies_properties.xlsx'
)
log_exension = '_' + catalogue_dict['Datatype'] + '_linesLog_reduc.txt'

#Define operation
Catalogue_Dic = dz.import_catalogue()
Pattern = '_' + Catalogue_Dic['Datatype'] + '_linesLog_reduc.txt'

#Define table shape
Width = "%" + str(50 + 2) + "s"
HeaderSize = 2
LickIndexesHeader = [
    'Ion', 'lambda_theo', 'group_label', 'Wave1', 'Wave2', 'Wave3', 'Wave4',
    'Wave5', 'Wave6', 'add_wide_component'
]
columns_format = [
    '%11.6f', '%11.6f', '%11.6f', '%11.6f', '%11.6f', '%11.6f', '%11.6f',
    '%11.6f', '%11.6f', '%11.6f'
]
from pymc               import deterministic, stochastic, Normal, Uniform, MCMC, Bernoulli, stochastic_from_dist

from dazer_methods import Dazer

#Generate dazer object
dz = Dazer()
 
#Choose plots configuration
dz.FigConf()
 
#Import catalogue
Catalogue = dz.import_catalogue()
 
#Perform operations
x = [1,2,3,4,5,6]
y = [1,2,3,4,5,6]
 
#Plot the data
dz.data_plot(x, y, markerstyle = 'o')
 
#Generate the figure
dz.display_fig()