Esempio n. 1
0
        ax1.minorticks_on()
        ax1.set_xlabel(xtit)
        ax1.set_ylabel(ytit)
        #ax1.tick_params(labelsize=fs-2)
        ax1.text(42.5, -1.7, zleg[iz])
    else:
        ax = fig.add_subplot(jj, sharex=ax1, sharey=ax1)
        ax.set_autoscale_on(False)
        ax.minorticks_on()
        ax.set_xlabel(xtit)
        ax.set_ylabel(ytit)
        ax.text(42.5, -1.7, zleg[iz])

    # Plot all observations
    ox, oy, el, eh = jc.read_jc_lf(obs_dir+'lf_may16_comparat/',zz,h0=obsh0,\
                                       infile=\
                                       'O2_3728-data-summary-Planck15.txt')
    ind = np.where(oy > -5)
    oxr = ox[ind]
    oyr = oy[ind]
    arrinds = oxr.argsort()
    oxr = oxr[arrinds]
    oyr = oyr[arrinds]

    #if(isinstance(ox, (np.ndarray))):
    #    if (iz == 0):
    #        ax1.errorbar(ox,oy,yerr=[el,eh],fmt='o',\
    #                         ecolor='grey',color='grey',mec='grey')
    #    else:
    #        ax.errorbar(ox,oy,yerr=[el,eh],fmt='o',\
    #                        ecolor='grey',color='grey',mec='grey')
import read_jc_obs as jc
from matplotlib import pyplot as plt  # para usar legend
from pylab import figure, plot, xlabel, ylabel, errorbar, legend, xlim
from numpy import zeros, size, histogram, log10, append, arange

from astropy.utils.data import get_pkg_data_filename
from astropy.table import Table

obs_path = '/Users/pablofernandez/Documents/5º curso/TFG2/Datos/Comparat_2016/'
redshift = 0.94

ox, oy, el, eh = jc.read_jc_lf(obs_path,
                               redshift,
                               infile='O2_3728-data-summary-Planck15.txt')

# 'ox' es la luminosidad y 'oy' la funcion luminosidad (ambos en escala logaritmica)
# 'el' es el error inferior y 'eh' es el error superior de los datos de 'oy'

# Creo una matriz que guarde estos errores para poder usar la funcion errorbar

Merror = zeros((2, size(el)))
Merror[0, :] = el  # en la primera fila se pone el inferior
Merror[1, :] = eh  # en la segunda fila se pone el superior

# Dibujamos la funion luminosidad con las barras de error

figure(1)
errorbar(ox, oy, Merror, fmt='o', color='grey', capsize=2)
# capsize pone remates a las barras de error

xlabel("$log_{10}$(L[OII][erg $s^{-1}$ $h^{-2}$]])")
lbins = arange(lmin, lmax, dl)
lhist = lbins
vbins = append(lbins, lmax)

types = ['Sin atenuar', 'Calzetti', 'Calzetti X Saito']
lines = ['-', '-.', '--']

fig = 0  # parámetro de control de las 4 figuras

for redshift in z:

    # DATOS EXPERIMENTALES DEL OII
    obs_path = '/Users/pablofernandez/Documents/5º curso/TFG2/Datos/Comparat_2016/'

    ox, oy, el, eh = jc.read_jc_lf(obs_path,
                                   redshift,
                                   infile='O2_3728-data-summary-Planck15.txt',
                                   h2unitL=True)

    if not unitsh:  # ahora, sin h^-2 ni h^-3
        ox, oy, el, eh = jc.read_jc_lf(
            obs_path,
            redshift,
            infile='O2_3728-data-summary-Planck15.txt',
            h2unitL=False)

    Merror = zeros((2, size(el)))  # guarda las barras de error
    Merror[0, :] = el
    Merror[1, :] = eh

    # DATOS MILLENIUM: 4 ARCHIVOS DIFERENTES
    data = loadtxt(files[fig], float, delimiter=',')
Esempio n. 4
0
        ax1.minorticks_on()
        ax1.set_xlabel(xtit)
        ax1.set_ylabel(ytit)
        #ax1.tick_params(labelsize=fs-2)
        ax1.text(42.5, -1.7, zleg[iz])
    else:
        ax = fig.add_subplot(jj, sharex=ax1, sharey=ax1)
        ax.set_autoscale_on(False)
        ax.minorticks_on()
        ax.set_xlabel(xtit)
        ax.set_ylabel(ytit)
        ax.text(42.5, -1.7, zleg[iz])

    # Plot all observations
    ox, oy, el, eh = jc.read_jc_lf(obs_dir,zz,h0=obsh0,\
                                       infile=\
                                       'O2_3728-data-summary-Planck15.txt')
    ind = np.where(oy > -5)
    oxr = ox[ind]
    oyr = oy[ind]
    arrinds = oxr.argsort()
    oxr = oxr[arrinds]
    oyr = oyr[arrinds]

    if (isinstance(ox, (np.ndarray))):
        if (iz == 0):
            ax1.errorbar(ox,oy,yerr=[el,eh],fmt='o',\
                             ecolor='grey',color='grey',mec='grey')
        else:
            ax.errorbar(ox,oy,yerr=[el,eh],fmt='o',\
                            ecolor='grey',color='grey',mec='grey')