Пример #1
0
from CodeTools.PlottingManager import myPickle
from Plotting_Libraries.dazer_plotter import Plot_Conf
from numpy import linspace
import seaborn as sns
import pyneb as pn

# pn.atomicData.setDataFile('h_i_rec_SH95.hdf5', 'H1', 'rec')
# pn.atomicData.setDataFile('he_ii_rec_SH95.hdf5', 'He2', 'rec')

#Declare Classes
pv = myPickle()
dz = Plot_Conf()

#Define figure format
dz.FigConf()

# Atom creation and definition of physical conditions
S4 = pn.Atom('S', 4)

#Define physical conditions
tem = 10000
tem_range = linspace(10000, 25000, 100)

den = 100
den_range = linspace(10, 300, 100)

# Comment the second if you want all the lines to be plotted
# S_Lines=[105100, 1404.81, 1423.84, 1398.04, 1416.89, 290100.0, 1387.46, 1406.02, 112300, 183200]
# S_Lines=[1404.81, 1423.84, 1416.89, 1406.02, 112300]
S_Lines = [105000]
from numpy import concatenate
from Plotting_Libraries.dazer_plotter import Plot_Conf

#Declare coding classes
pv = myPickle()
Reddening = ReddeningLaws()
dz = Plot_Conf()

#Declare data location and type
Catalogue_Dic = DataToTreat()
Pattern = Catalogue_Dic['Datatype'] + '.fits'
DataLog_Extension = '_' + Catalogue_Dic[
    'Datatype'] + '_LinesLog_v3.txt'  #/First batch process for untreated spectra

#Define figure format
dz.FigConf(FigWidth=16, FigHeight=9)

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

Object_Giving_errors = []

# Loop through files
for i in range(len(FilesList)):

    #Import spectrum data
    CodeName, FileName, FileFolder = pv.Analyze_Address(FilesList[i])

    #Determine reddening coefficients
Пример #3
0
colors_list = [
    '#0072B2', '#009E73', '#D55E00', '#CC79A7', '#F0E442', '#56B4E9',
    '#bcbd22', '#7f7f7f', '#FFB5B8'
]

#Declare the number of colors
size_dict = {
    'axes.labelsize': 20,
    'legend.fontsize': 18,
    'font.family': 'Times New Roman',
    'mathtext.default': 'regular',
    'xtick.labelsize': 18,
    'ytick.labelsize': 18
}
dz.FigConf(plotSize=size_dict)

#Define script name and location
ScriptFolder = '/home/vital/Dropbox/Astrophysics/Tools/Cloudy/S_Ar_test/Total_Q_R_Grid2/'

#Load the conditions in the scripts
Grid_Values = OrderedDict()
Grid_Values['age'] = [
    '5.', '5.48', '5.7', '5.85', '6.', '6.1', '6.18', '6.24', '6.3', '6.35',
    '6.4', '6.44', '6.48', '6.51', '6.54', '6.57', '6.6', '6.63', '6.65',
    '6.68', '6.7', '6.72'
]
Grid_Values['clus_mass'] = ['12000.', '20000.', '60000.', '100000.', '200000.']
Grid_Values['zGas'] = ['0.0001', '0.0004', '0.004',
                       '0.008']  #, '0.02', '0.05']
Grid_Values['zStars'] = ['-2.1']
        if All_observed:
            Valid_objects.append(array(Empty_Array, copy=True))
            
    return array(Valid_objects)

pv                              = myPickle()
dz                              = Plot_Conf()
ct                              = Cloudy_Tools()
diags                           = pn.Diagnostics()

#Define data type and location
Catalogue_Dic                   = DataToTreat()
Pattern                         = Catalogue_Dic['Datatype'] + '.fits'

#Define figure format
dz.FigConf(n_colors=3)

print 'Colors initial'
print dz.ColorVector[2], len(dz.ColorVector[2])

#Define script name and location
# ScriptFolder    = '/home/vital/Dropbox/Astrophysics/Tools/Cloudy/S_Ar_test/Few_Models/'
ScriptFolder    = '/home/vital/Dropbox/Astrophysics/Tools/Cloudy/S_Ar_test/Ionization_Models/'
ScriptPrefix    = 'S_Ar_test'

#4 metallicities 0.004, 0.008, 0.02, 0.05
#5 ages 5.0, 5.5, 6.0, 6.5, 7.0, 7.5
Model_dict, Legends_dict, Colors_dict = Figure_Legends_Colors(dz.ColorVector)

list_xvalues = array([])
list_yvalues = array([])
Grid_Values = OrderedDict()

Grid_Values['age'] = ['5.0', '5.5', '6.0', '6.5', '7.0', '7.5']
Grid_Values['zStars'] = ['-2.4', '-2.1', '-1.7', '-1.31']
Grid_Values['zGas'] = ['0.1', '0.31', '0.62']
Grid_Values['u'] = ['-3.0', '-2.0', '-1.0']

#Dictionary of dictionaries
Grid_frame = ({k: Series(v) for k, v in Grid_Values.iteritems()})

#Trick to create a frame with different lengths
# Grid_frame = DataFrame({k : Series(v) for k, v in Grid_Values.iteritems()})

#Declare the number of colors
dz.FigConf(n_colors=len(Grid_Values['age']))

list_xvalues = array([])
list_yvalues = array([])
list_TSIII = array([])
list_TOIII = array([])

#Fore the each grid point run a cloudy simulation
Model_dict = OrderedDict()
for age in Grid_Values['age']:
    for zStar in Grid_Values['zStars']:
        for zGas in Grid_Values['zGas']:
            for ionization_parameter in Grid_Values['u']:
                #Format star
                #'S_Ar_Test_' + 'age'+ age + '_zStar' + zStar + '_zGas' + zGas + '_u' + ionization_parameter