Example #1
0
def plotResult(idnum,catalog,save=False):

    id=str(idnum)

    obsData=Table.read(catalog).to_pandas()
    rmag=-2.5*np.log10(obsData['fRauto'][idnum])+23.9
    
    axes = eazy.plotExampleSED(idx=idnum, writePNG=False, MAIN_OUTPUT_FILE='photz',
                            OUTPUT_DIRECTORY='OUTPUT', CACHE_FILE='Same', lrange=[3800, 3.e4],
                            axes=None, individual_templates=False, fnu=False)
			   
    sed = eazy.getEazySED(idnum, MAIN_OUTPUT_FILE='photz', OUTPUT_DIRECTORY='./OUTPUT',
                        CACHE_FILE='Same', scale_flambda=True, verbose=False,
                        individual_templates=False)

    lambdaz, temp_sed, lci, obs_sed, fobs, efobs = sed

    zgrid, pzi, prior = eazy.getEazyPz(idnum, MAIN_OUTPUT_FILE='photz', OUTPUT_DIRECTORY='./OUTPUT',
                                    CACHE_FILE='Same', binaries=None, get_prior=True)
    
    axes[1].plot(zgrid, pzi, color='black')
    axes[1].plot(zgrid, prior/prior.max()*pzi.max(), color='purple')

    axes[1].set_xlim([0.,1.])
    axes[0].text(5500.,axes[0].get_ylim()[1]*0.1,r'$m_{R}$ = '+str(rmag)[:5]+' mag')

    if save == True:
        plt.savefig('OUTPUT/'+id+'.pdf',format='pdf',dpi=6000)
        plt.clf()
    else:
        plt.show()
    plt.close()
Example #2
0
import numpy as np
import pylab as pl
import matplotlib.pyplot as plt
import threedhst.eazyPy as eazy
import threedhst.utils as utils

ROOT = os.environ['SCRATCH']
OUTPUT = ROOT + '/3D-HST/aegis.v4.1/Eazy'

start = 1

results = []
LBGCOLORS = ['u-g', 'g-r', 'r-i', 'i-z']

for idx in np.arange(41201 - start):
    result = eazy.plotExampleSED(idx= start + idx, pdfname='plot.pdf', MAIN_OUTPUT_FILE='photz', OUTPUT_DIRECTORY=OUTPUT,\
                                 CACHE_FILE='Same', lrange=[1.e3, 1.e5], axes=None, individual_templates=False, fnu=False)

    results.append(result)

    if idx % 500 == 0:
        ##  Save as backup during run.
        np.savetxt('dat/aegis_mag_24p5_colors.txt', np.array(results), fmt='%.6lf',\
                                                    header='id \t zpeak \t colors \t noisy colors; ' + ''.join(x for x in LBGCOLORS))

##  Save at the run end.
np.savetxt('dat/aegis_mag_24p5_colors.txt', np.array(results), fmt='%.6lf',\
                                            header='id \t zpeak \t colors \t noisy colors; ' + ''.join(x for x in LBGCOLORS))

print("\n\nDone.\n\n")
Example #3
0
            for idx in np.arange(ngal):
                if field == 'UVUDF':
                    EAZYROOT = '/global/homes/m/mjwilson/Rafelski15/UVUDF-EAZY/'
                    MAIN_OUTPUT_FILE = 'photz'

                elif field == 'uds':
                    EAZYROOT = '/global/homes/m/mjwilson/3D-HST/%s.v4.2/Eazy/' % field
                    MAIN_OUTPUT_FILE = '%s_3dhst.v4.2' % field

                else:
                    EAZYROOT = '/global/homes/m/mjwilson/3D-HST/%s.v4.1/Eazy/' % field
                    MAIN_OUTPUT_FILE = '%s_3dhst.v4.1' % field


                header, result = eazy.plotExampleSED(idx=idx, pdfname='plot.pdf', MAIN_OUTPUT_FILE=MAIN_OUTPUT_FILE,\
                                                     OUTPUT_DIRECTORY=EAZYROOT, CACHE_FILE='Same', lrange=[1.e3, 1.e5], axes=None, individual_templates=False,\
                                                     fnu=fnu, depths=depths, field=field, plotit=plotit)

                results.append(tuple(result))

                if save & (idx % blocksize == 0):
                    write_table(results, header, depths, blockcount, ddir=ddir)

                    ##  Wipe results.
                    results = []
                    blockcount += 1

            if save:
                ##  Catch the rest.
                write_table(results, header, depths, blockcount, ddir=ddir)
Example #4
0
"""
import os
import matplotlib.pyplot as plt
import threedhst.eazyPy as eazy

################################################
#### z_phot vs z_spec
################################################
eazy.zPhot_zSpec('OUTPUT/photz.zout')
plt.savefig('zphot_zspec.png'); plt.close()

################################################
#### Example object.  `idx` is zero-indexed
################################################
axes = eazy.plotExampleSED(idx=17, writePNG=False, MAIN_OUTPUT_FILE='photz',
                           OUTPUT_DIRECTORY='OUTPUT', CACHE_FILE='Same', lrange=[3800, 3.e4],
                           axes=None, individual_templates=True, fnu=False)
                           
plt.savefig('eazy_fit.png'); plt.close()

################################################
#### Pull out data from the BINARY_OUTPUTS files
################################################

## SED, data & fit
sed = eazy.getEazySED(17, MAIN_OUTPUT_FILE='photz', OUTPUT_DIRECTORY='./OUTPUT',
                      CACHE_FILE='Same', scale_flambda=True, verbose=False,
                      individual_templates=False)

lambdaz, temp_sed, lci, obs_sed, fobs, efobs = sed
axes[0].scatter(lci, obs_sed, color='orange', zorder=2)
Example #5
0
################################################
#### z_phot vs z_spec
################################################
eazy.zPhot_zSpec('OUTPUT/photz.zout')
plt.savefig('zphot_zspec.png')
plt.close()

################################################
#### Example object.  `idx` is zero-indexed
################################################
axes = eazy.plotExampleSED(idx=17,
                           writePNG=False,
                           MAIN_OUTPUT_FILE='photz',
                           OUTPUT_DIRECTORY='OUTPUT',
                           CACHE_FILE='Same',
                           lrange=[3800, 3.e4],
                           axes=None,
                           individual_templates=True,
                           fnu=False)

plt.savefig('eazy_fit.png')
plt.close()

################################################
#### Pull out data from the BINARY_OUTPUTS files
################################################

## SED, data & fit
sed = eazy.getEazySED(17,
                      MAIN_OUTPUT_FILE='photz',