{'fraction_non_alphanumeric': 0.03816717522885298, 'fraction_numerical': 0.017783002351057977, 'mean_word_length': 4.74881380301941, 'pattern_counts': {'":': 0, '<': 34, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Photometric Redshifts of Galaxies in COSMOS

We measure photometric redshifts and spectral types for galaxies in the COSMOS survey. We use template fitting technique combined with luminosity function priors and with the option to simultaneously estimate dust extinction (i.e. E(B-V)) for each galaxy.Our estimated redshifts are accurate to i<25 and z~1.2. Using simulations with sampling and noise characteristics similar to those in COSMOS, the accuracy and reliability is estimated for the photometric redshifts as a function of the magnitude limits of the sample, S/N ratios and the number of bands used. From the simulations we find that the ratio of derived 95% confidence interval in the redshift probability distribution to the estimated photometric redshift (D95) can be used to identify and exclude the catastrophic failures in the photometric redshift estimates. We compare the derived redshifts with high-reliability spectroscopic redshifts for a sample of 868 normal galaxies with z<1.2 from zCOSMOS. Considering different scenarios, depending on using prior, no prior and/or extinction, we compare the photometric and spectroscopic redshifts for this sample. This corresponds to an rms scatter of 0.031, with a small number of outliers (<2.5%). We also find good agreement (rms=0.10) between photometric and spectroscopic redshifts for Type II AGNs. We compare results from our photometric redshift procedure with three other independent codes and find them in excellent agreement. We show preliminary results, based on photometric redshifts for the entire COSMOS sample (to i<25 mag.).

new code, optimized to yield accurate and reliable redshifts and spectral types of galaxies down to faint magnitudes and redshifts out to z ∼ 1.2. The technique uses χ 2 template fitting, combined with luminosity function priors and with the option to estimate the internal extinction (or E(B − V )). The median mostprobable redshift, best-fit spectral type and reddening, absolute magnitude and stellar mass are derived in addition to the full redshift probability distributions. Using simulations with sampling and noise similar to those in COSMOS, the accuracy and reliability is estimated for the photometric redshifts as a function of the magnitude limits of the sample, S/N ratios and the number of bands used. We find from the simulations that the ratio of derived 95% confidence interval in the χ 2 probability distribution to the estimated photometric redshift (D 95 ) can be used to identify and exclude the catastrophic failures in the photometric redshift estimates.
To evaluate the reliability of the photometric redshifts, we compare the derived redshifts with high-reliability spectroscopic redshifts for a sample of 868 normal galaxies with z < 1.2 from zCOSMOS. Considering different scenarios, depending on using prior, no prior and/or extinction, we compare the photometric and spectroscopic redshifts for this sample. The rms scatter between the estimated photometric redshifts and known spectroscopic redshifts is σ(∆(z)) = 0.031, where ∆(z) = (z phot − z spec )/(1 + z spec ) with a small fraction of outliers (< 2.5%)-(outliers are defined as objects with ∆(z) > 3σ(∆(z)) where σ(∆(z)) is the rms scatter in ∆(z)). We also find good agreement (σ(∆(z)) = 0.10) between photometric and spectroscopic redshifts for Type II AGNs.
We compare results from our photometric redshift procedure with three other independent codes and find them in excellent agreement. We show preliminary results, based on photometric redshifts for the entire COSMOS sample (to i < 25 mag.).

INTRODUCTION
The determination of galaxy redshifts is a prerequisite to studies of their cosmological evolution-measuring both distance-dependent quantities such as luminosities, masses and star formation rates and in specifying the lookback times. Redshifts are also necessary to separate out large scale structures and galaxies along the line of sight. With the advent of new sensitive detectors on large ground-based telescopes (Subaru, VLT, Keck) and spaceborne facilities (HST, Spitzer, GALEX), we have now been able to perform extensive galaxy surveys to unprecedented depths. Measurement of spectroscopic redshifts to these galaxies is limited by two factors: their faintness (Papovich et al. 2006;Mobasher et al. 2005;Yan et al. 2005) and the large number of galaxies for which such information is needed (Wolf et al. 2004;Mobasher et al. 2004;Ilbert et al. . 2006;. Recently, photometric redshifts have been used extensively in deep cosmological surveys, yielding the galaxy luminosity functions Caputi et al. 2005) and the evolution of star formation rates (Gabasch et al. 2004;Giavalisco et al. 2004;Dahlen et al. 2006). The photometric redshift technique has the advantage of providing redshifts for large samples of faint galaxies with a relatively modest investment in observing time. For maximal success with photometric redshifts the photometry should cover as wide a range in wavelength as possible. The principle disadvantage of the photometric redshifts is the relatively low resolution in wavelength and redshift (due to the width of filters) compared to spectroscopic redshifts. Photometric redshifts are, however, vital in resolving redshift ambiguities where spectroscopy shows only a single spectral line (Lilly et al. 2006).
In this paper we present measurements of photometric redshifts for galaxies in the Cosmic Evolution Survey (COSMOS) and explore the accuracy of the photometric redshifts based on extensive simulations, comparison with spectroscopic redshifts from zCOSMOS (Lilly et al. 2006) and with photometric redshifts estimated from a number of other independent algorithms. Over the 1.4 • × 1.4 • area covered by COSMOS, we detect 367,000 galaxies to i ∼ 25 (Capak et al. 2006), making it difficult to obtain spectroscopic redshifts for the entire galaxy sample. Extensive multi-waveband photometric data are now available for these galaxies, allowing measurement of photometric redshifts for a complete sample. These results are used to identify the large scale structures Finoguenov et al. 2006;Guzzo et al. 2006), to study the evolution of density-morphology relation (Capak et al. 2006), dependence of the star formation activity on the environment ) and study of morphologies and rest-frame properties of individual galaxies (Scarlatta et al. 2006;Zamojski et al. 2006).
We present the photometric redshift technique in §2 followed by the photometric observations and photometric data in §3. In §4 we present simulations to explore the dependence of photometric redshifts to the magnitude limit, photometric accuracy and S/N ratios. We compare photometric and spectroscopic redshifts to a sample of galaxies with available such data in §5. In §6 we compare results from various photometric redshift codes. We summarise the galaxy properties derived from the photometric data, including SED types and stellar mass measurements in §7.
In this paper we use the standard cosmology with Ω M = 0.3, Ω Λ = 0.7, and h = 0.7. Magnitudes are given in the AB-system unless otherwise stated.

Photometric Redshift Technique
The photometric redshift code developed for COSMOS is based on template fitting technique (Gwyn 1995;Mobasher et al. 1996;Chen et al. 1999;Arnouts et al. ., 1999;Benitez 2001;Bolzonella et al. 2000;). The templates, representing the rest-frame Spectral Energy Distribution (SED) for galaxies of different types, are convolved with the response functions of filters used in the COSMOS photometric observations. These were then shifted in redshift space and fitted to the observed SEDs of individual galaxies by minimizing the χ 2 function, The summation is over the passbands (i.e. number of photometric points) and n is the total number of passbands. F i obs and F i template are, respectively, the observed and template fluxes for each passband; σ i is the uncertainty in the observed flux and α is the overall flux normalisation. The redshift corresponding to the centroid of redshift probability distribution and SED (i.e. spectral type) yielding the minimum χ 2 value are then assigned to each galaxy. The redshift probability function for each galaxy is defined as p(z, T ) = e −χ(z,T ) 2 /2 , where z and T are respectively, the redshift and spectral type of galaxies. The estimated redshift corresponds to the centroid of this probability distribution, defined as This is used as the best estimate for the photometric redshifts in this study. The code gives the option of using Bayesian priors based on luminosity functions (LFs). The main effect of a LF prior is to discriminate between cases in which the redshift probability distribution shows multiple peaks due to ambiguity between the Lyman and 4000Å features. The inferred absolute magnitudes of the galaxy if it is at either of the redshift peaks can then be used to discriminate between these possibilities (i.e. an implied absolute magnitude significantly brighter than M * is increasingly unlikely). Thus, for each redshift, we calculate the restframe absolute V-band magnitude and compare it to the LF. For this study we use a Schecter LF with M * = −22 mag and faint-end slope α = −1.26. This corresponds to the mean of the characteristic magnitudes and faint-end slopes of the B-band luminosity functions for all spectral types of galaxies and over the redshift range 0 < z < 1 , converted to V-band absolute magnitude using rest-frame B − V colors. Compared to Bband, the V-band luminosity function (LF) is less sensitive to details of the spectral types of galaxies, allowing us to use a single LF for all types. In any case, the final photometric redshifts are not dependent on the LF used. Evolution with redshift of both M * V and faintend slope of the LF  are incorporated into the LF prior. Nevertheless, we explored sensitivity of our results on different choices of M * and α and found them to be relatively insensitive to the choice of these parameters. Finally, using the spectroscopic sample (section 4.3), we optimised the prior LF parameters to minimise the scatter between the estimated photometric and spectroscopic redshifts.
We also include internal extinction (E B−V ) as a free parameter in the χ 2 minimisation process (alongside redshift and spectral types) and estimate E B−V for individual galaxies using Galactic extinction law for early-type galaxies and Calzetti law (Calzetti et al. 2000) for late-type and starbursts. Absorption due to intergalactic HI is included using the parametrization in Madau (1995).
Basic template spectral energy distributions (SEDs) for normal galaxies (E, Sbc, Scd and Im) from Colman et al. (1980) and two starburst templates are from Kinney et al. (1996)-(SB2 and SB3- Figure 1). The templates are corrected for systematic calibration errors and extended to the ultraviolet and infrared wavelengths using the method of Budavari et. al. (2000). The template corrections were derived from over 3000 galaxies with spectroscopic redshifts in the Hawaii Hubble Deep Field North (H-HDFN) (Capak et. al. 2004;Cowie et al. 2004;Wirth et al. 2004;Treu et al. 2005;Steidel et al. 2004;Erb et al. 2004). These galaxies had deep optical and infrared photometry (U,B J ,V J ,R c ,I c ,z + ,J,H,K s ,HK ′ )- (Capak et al. 2004;Bundy et al. 2005;Wang et al. 2005). Our corrections in the optical and UV are consistent with the calibration errors estimated by Coleman et al. (1980) and Kinney et al. (1996). The largest correction is in the UV where Coleman et al. (1980) forced agreement between their ground-based and IUE data. The infrared properties of our templates do differ significantly from those extended using Bruzual & Charlot (2000) models (Bolzonella et al. 2000). This is not surprising since stellar population models have large uncertainties in the infrared (Maraston 2005). The details of our template optimisation method will be discussed in Capak et al. (in prep 2007). The final, modified template SEDs are shown in Figure 1. we constructed intermediate-type templates from the weighted mean of the adjacent templates, defining five intermediate-type templates between the main spectral types. Our fitting therefore included a total of 31 SED templates, each redshifted between z = 0 and z = 6 in ∆z = 0.01 steps.

Photometric Data
The photometric observations for COSMOS were carried out at optical (u * : CFHT; BgVriz: SuprimeCam/Subaru; i−: CFHT; i 814 : ACS/HST) and near-Infrared (K s : Flamingos/CTIO and Kitt Peak) wavelengths. We also obtained narrow-band survey of the COS-MOS field at 815 nm (NB815 filter) with SupremeCam/Subaru. The response functions for these filters are shown in Figure 2. Table 1 lists the filters, including the effective wavelength and band-width for each filter and the corresponding depth and image seeing. Details of the ground-based observations and data reduction are presented in Capak et al. (2006) and Taniguchi et al. (2006).
The reduced images in all bands were PSF matched by Gaussian convolution with FWHM corresponding to the worst seeing (1.5" in K s band), allowing for non-Gaussian wings of the PSFs. The multi-waveband photometry catalog was then generated using SExtractor (Bertin & Arnout 1995). This is first done by measuring the total (mag auto ) and aperture (3" diameter) magnitudes on the detection image (i−band) and, for each galaxy, estimate the correction from aperture to total magnitudes. This correction is subsequently applied to the respective galaxies, detected in other bands. Details of the photometry, star/galaxy separation and catalog generation are given in Capak et al. (2006).
In the next section we simulate the COSMOS catalog by constructing a similar mock galaxy catalog with the same filters, depths and SED shapes and assign a random redshift to each simulated galaxy. The simulated catalog will then be used to test the accuracy of our estimated photometric redshifts and the consistency of our technique. This will be further examined by comparing the photometric and spectroscopic redshifts to a sample of COSMOS galaxies with available such data.

Mock Catalog
To explore the accuracy of photometric redshifts, we generated mock catalogs consisting of galaxies with the SEDs shown in Figure 1 and photometry measured in the same filters used for COSMOS ( Figure 2). The aims of the simulation is to explore dependence of the photometric redshifts on the S/N ratio, magnitude limit, redshift and galaxy type and how we could minimise the number of outliers (objects with very different output and input photometric redshifts).
We use the rest-frame B-band LFs derived for different spectral types of galaxies, using the GOODS data ; therefore, both the type-dependence and evolution of the LFs are incorporated into the simulations. Each galaxy is assigned a random absolute magnitude in the range −24 < M B < −16 mag and spectral type, drawn from the typedependent LFs. The six galaxy templates are the same as used in the photometric redshift calculation ( §2). To each simulated galaxy, we also specified a redshift in the range 0 < z < 6.
For any given galaxy, the K-correction in each band was estimated by convolution of the filter responses with the SED associated with that galaxy, shifted to its assigned redshift. We then estimate the apparent magnitudes using the rest-frame absolute magnitudes and the distance moduli. We restrict the mock catalog to galaxies with apparent magnitudes (in any given band) brighter than the observed magnitude limits in COSMOS (Table 1). We also assign photometric errors to each magnitude, depending on the S/N ratios with the same depth as real COSMOS data. Ideally, the photometric errors need to be estimated, also taking into account blending or defects on the images (sources near bright objects and internal camera reflections). This can be performed by distributing images of galaxies with known mag/type/redshift into the existing multi-band images, apply the same photometric measurement scheme and then running the photometric redshift code. Therefore, simulations here only provide an internal consistency check in reproducing the input parameters.
The resulting catalog consists of simulated data, including: magnitudes and their associated errors in the same filters as in the initial COSMOS catalog, redshifts and spectral types for each galaxy, all consistently derived. The mock catalog contains a total of ∼96,000 galaxies to a magnitude limit of i = 26.2 mag (S/N=5 -similar to the observed COSMOS catalog).
The photometric redshift code ( §2) was used to estimate redshifts and spectral types for mock galaxies, using prior and considering extinction as a free parameter. Results from the simulated catalog, showing the performance of the code, are presented in Table 2 where, for each value of the magnitude limit (i.e. S/N ratio) and spectral type, we estimate the rms scatter in photometric redshift error, defined as; ∆(z) = (|z output − z input |)/(1 + z input ), the fraction and total number of outliers, defined as galaxies with ∆(z) > 3σ(∆(z)), and changes in the median redshift as a function of the S/N ratios. The simulation results in Table 2 clearly illustrates that the accuracy of photometric redshifts decreases as the limiting magnitude becomes fainter and the S/N ratio is reduced. Moreover, we find that for early-type galaxies there is better agreement between the input and output redshifts, with a smaller fraction of outliers, compared to late-type and starbursts. This is likely due to a stronger 4000Åbreak in ellipticals compared to later type galaxies. Figure 3 shows comparison between the input and output redshifts as a function of i-band magnitude and S/N. At i > 25 mag, the photometric redshift accuracy starts to significantly degrade. It is clear that at higher S/N values (i.e. brighter m i ), photometric redshift code recovers the input redshifts. Also, most of the scatter at faint magnitudes (low S/N) is due to late-type galaxies and starbursts. This will be used as a guide to adopt the photometric or magnitude limit of the sample in order to optimise photometric redshift measurement.

Accuracy of photometric redshifts
The simulation results can be used to define a useful measure of the photometric redshift accuracy for each galaxy. This parameter is defined as where ∆ 95 is the 95% confidence interval (i.e. the width of the redshift probability distribution corresponding to 95% confidence interval) and z output is the estimated photometric redshift. Therefore, D 95 can be calculated independent from any knowledge about spectroscopic redshift. If the error distribution is Gaussian, then, by definition, ∆ 95 = 2σ z .
To explore how D 95 is related to the accuracy of photometric redshifts, we study the correlation between D 95 with σ(∆(z)) and ∆(z), using the mock cataloge, as shown in Table 3 and Figure 4 respectively. The sample used in Table 3 is limited to galaxies with S/N > 10. This is to minimise photometric uncertainties and to uncouple performance of different photometric redshift error estimators independent from photometric problems at faint flux levels. For simulated sub-samples, selected based on D 95 limits (Table 3; column 1), we estimate σ(∆(z)) values for the full sample and when excluding the outliers, defined as galaxies with ∆(z) > 3σ(∆(z)). Results are listed in Table 3, where it shows a clear decrease in σ(∆(z)) values and in fraction of the outliers towards smaller D 95 . This demonstrates that D 95 provides a useful and practical measure to identify the fraction of outliers. Moreover, the median redshift of the survey is found to be independent of D 95 , due to our S/N cut.
The scatter in ∆(z) increases with increasing D 95 and for fainter magnitude limits. For galaxies with D 95 > 0.2, the scatter in ∆(z) significantly increases, indicating an increase in photometric redshift errors. For fainter galaxies (i > 24.2 mag), where the accuracy of photometric redshifts decreases, we find an increase in D 95 parameter and larger scatter in ∆(z).
In summary, D 95 enables the identification of outliers in derived photometric redshifts, independent at all redshifts in the sample.

Comparison with Spectroscopic Redshifts
The ultimate test of the accuracy of photometric redshifts is the comparison with the spectroscopic redshifts. The spectroscopic sample here consists of galaxies observed to i AB ∼ 24 mag. in the zCOSMOS program, using VIMOS on VLT (Lilly et al. 2006). We select 958 galaxies with the most reliable spectroscopic redshifts (based on two or three lines). We restrict the sample to redshift range z < 1.2, as beyond this, the 4000Å break lies at the edge of the optical bands. Also, due to the relatively shallow depth of our K s -band data, these are not available for fainter galaxies. This reduces total number of galaxies with spectroscopic redshifts to 879.
Photometric redshifts were derived using the techniques described in §3 and compared with the spectroscopic redshifts in Figure 5. The effects of the luminosity function prior and extinction corrections are also explored. A total of 12 galaxies in the spectroscopic sample (z < 1.2) were identified as AGNs from their X-ray emission (Brusa et al. 2006). The AGNs were removed from the spectroscopic sample and only the "normal" galaxies were used in the comparison.
We measure the D 95 parameter for the 868 galaxies with z < 1.2 in our spectroscopic sample. The relation between D 95 and ∆(z) = (z phot −z spec )/(1+z spec ) is shown in Figure 6a. Galaxies with D 95 < 0.2 are seen to have, on average, ∆(z) ∼ 0 although with some scatter. This confirms that, on average, D 95 parameter provides a good measure of the reliability of photometric redshifts. Distribution of D 95 values for three spectral types of galaxies (elliptical, spiral and starbursts) in the spectroscopic sample are presented in Figure 6b. The width of the distributions for different types are consistent with the observed scatter in Figure 6a. The peak of the D 95 distributions are at D 95 ∼ 0.08 (for ellipticals) and 0.12 (for spirals and starbursts), indicating the reliability with which one could measure photometric redshifts for different spectral types of galaxies. Table 4 compares the σ(∆(z)) values and the fraction of outliers, defined as objects with ∆(z) > 3σ(∆(z)), for different cases (with and without prior and extinction). It is clear from Table 4 and Figure 5 that the best agreement between the photometric and spectroscopic redshifts are obtained when both prior and extinction corrections are enabled. In its best case, this corresponds to an rms of σ(∆(z)) = 0.031. This is consistent with the rms estimated from the simulations in §3. It is also clear from Table 4 that D 95 parameter is directly correlated with the fraction of outliers, as defined by σ(∆(z))-(i.e. deviation of photometric redshift from its spectroscopic counterpart). No trend is found between redshift and spectral types in Figure 5, indicating there is no significant bias in redshift estimates as a function of spectral type.
Finally, the relation between ∆(z) and i-band magnitudes for "normal" galaxies in the spectroscopic sample is shown in Figure 7. The errors in the photometric redshift shows no dependance on the magnitude of the galaxies or their spectral type.
We divide galaxies into spectral type bins (ellipticals, spirals and starbursts) and compare their estimated photometric and spectroscopic redshifts, as listed in Table 4. The photometric redshifts are estimated for the case assuming prior and extinction (the optimum case), considering all galaxies regardless of their D 95 . We find comparable σ(∆(z)) values for elliptical (0.034), spiral (0.030) and starbursts (0.042). For each of the scenarios in Table 4, we also estimate the fraction of galaxies (with respect to total) of different spectral types. The result, listed in Table 4, shows a simultaneous decrease in the fraction of ellipticals and increase in the fraction of starbursts when extinction correction is enabled. No significant change in the fraction of spirals is observed. Figure 5 shows a reduction in σ(∆(z)) for ellipticals when extinction correction is applied, with this having a less significant effect for the starbursts, contrary to expectations. However, as shown in Table 4, we find a change in the fraction of both ellipticals and starbursts when dust extinction is included as a free parameter in the photometric redshift fits. This indicates a change in the best-fit spectral types of galaxies ( Figure 5), depending wether or not we apply the dust extinction correction. The derived spectral types of elliptical and later type (spirals, irregulars and starbursts) galaxies here are examined by comparing them with independently estimated quantitative morphologies (compactness, asymmetry and Gini coefficients). These morphological parameters are consistent with the derived spectral types (Capak et al. 2006).
We now estimate photometric redshifts for 12 AGNs with z < 1.2, including the prior and extinction. These are compared with their spectroscopic redshifts in Figure 8 and show that the rms scatter is again lowest when including the prior and correcting for local extinction. This corresponds to σ(∆(z)) = 0.10 ( Table 4). The small rms measured for AGNs (type II) indicates that once extinction fitting is enabled, one can derive their photometric redshifts using templates based on normal galaxies.

Other Photometric Redshift Codes
In this section we explore how photometric redshifts depend on different techniques, codes and choice of priors, using a variety of photometric redshift codes. We compare results from the code presented in the previous section (refered to as "COSMOS") with three other codes: Zurich Extragalacitc Bayesian Redshift Analyzer (ZEBRA; Feldmann et al. 2006), Le Phare (Arnout 1999) and Baysian Photometric Redshift code (BPZ; Benitez 2000). Here we give a summary of basic characteristics of these codes.
The Zurich Extragalactic Baysian Redshift Analyzer (ZEBRA): ZEBRA estimates redshifts and template types of galaxies using medium-and broad-band photometric data (Feldmann et al. 2006). In the photometry check mode, for each galaxy and in any given filter, ZEBRA computes the difference between the observed magnitudes and those predicted by templates, using a training set with available spectroscopic redshifts. A linear (or higher order) regression is then applied to the relation between the residual and observed galaxy magnitude, with a constant offset estimated and subsequently applied to magnitudes in any given filter. In the template check mode, ZEBRA uses the χ 2 minimization technique to optimize the difference between the observed and template-based fluxes for all passbands, averaged over all galaxies in the photometric catalog. By introducing additional terms to the χ 2 equation, ZEBRA prevents too large deviations between the observed and model templates and regularizes the template shapes. It is run in both Maximum Likelihood and Baysian modes. In the later case, a prior is calculated in redshift and template space, using an iterative procedure. In the current release of this code, reddening due to dust extinction is not included.
Le Phare photometric redshift code: The Le Phare code (Arnouts et al. 1999) is based on χ 2 fitting method, comparing the observed magnitudes with those predicted from an SED library. This simultaneously runs libraries for stars, galaxies and quasars, which are then used to separate different classes of objects. An automatic calibration method is applied by using the spectroscopic redshift sample as training set (Ilbert et al. ., 2006). This adaptive method combines an iterative correction of the photometric zero-points and an optimisation of the SED templates. It allows to remove systematic differences between the spectroscopic and photometric redshifts and reduce the fraction of catastrophic failures. Reddening correction is applied to templates later than Sbc types, using the small Magellanic cloud extinction law. In this work, we adopt the same empirical templates as Ilbert et al. (2006). An additional Bayesian approach has been used, involving priors based on redshift distributions, following the formalism of Benitez (2000).

Baysian Photometric Redshift Code (BPZ):
The Bayesian approach considers the redshift distribution, p(z|C, m), as a function of the observed color (C) and magnitude (m)- (Benitez 2000). The prior used here is therefore based on the probability of a galaxy having redshift, z, and spectral type, T , given its magnitude. This is different from a luminosity function based prior used in the previous sections (the COSMOS code). Therefore the BPZ code provides redshifts based on both maximum liklihood and prior based techniques. The prior-based photometric redshifts from the BPZ are generally found to be more accurate than the results obtained when no priors are used.
The four codes are not completely identical and hence, we need to specify any intrinsic differences between them when comparing results from the codes. We present a list of the set up parameters used in each of the above codes in Table 5.

Comparison between different photometric redshift codes
The four photometric redshift codes have been applied on the same spectroscopic sample, with the ∆z = (z phot − z spec )/(1 + z spec ) distributions compared in Figures 9 (without prior) and 10 (with prior). The ∆z distributions from the codes used here are approximately fitted by a Gaussian with σ = 0.026 (Figures 9 and 10). However, the distributions for some codes are slightly offset from ∆z = 0, with extended wings.
The absolute accuracy in each code depends on the way the outliers are defined. To directly compare the photometric redshift accuracy from various codes, we follow the same procedure for all the four photometric redshift codes and present the results in Table 6 (with no priors) and Table 7 (with priors). For each code, we calculate the upper and lower 68% intervals (top-left and top-right number in each grid) from the distribution of ∆(z) between the photometric and spectroscopic redshifts and between the photometric redshifts from different codes. This is a different definition than the "average" rms values presented for COSMOS photometric redshifts in Table 4 and is defined to more clearly show the asymmetry in ∆(z) distributions between different codes. This also explains the difference in the scatter between photometric and spectroscopic redshifts found here (Tables 6 and 7) compared to that listed in Table 4.
Assuming a Gaussian distribution for ∆(z) values, that would correspond to 1σ standard deviation and for symmetric distributions the top-left and the top-right number should be the same. Objects with ∆(z) values outside the 1σ limit (bold number in each grid in Tables 6 and 7) are considered as outliers. This prescription defines the accuracy independent of the definition of the outliers.
The comparison between the estimated redshifts from various photometric redshift codes with their spectroscopic counterparts are also shown on the first row of Tables 6 and 7. The rest of the entries present comparison between the different codes. Results listed in the tables show excellent agreement between different photometric redshift codes, with all agreeing well with the spectroscopic redshifts. However, there is a slight improvement in the rms scatter for COSMOS code when using the prior while, prior has no such effect on other codes. This is likely due to the fact that the prior here was partly optimised on the spectroscopic data, using the photometric data set.

Analysis of Photometric data
In the previous sections we demonstrated that one could derive reliable photometric redshifts, using the available multi-waveband data for galaxies in COSMOS. These are extensively used in the analysis of COSMOS dataset. In this section we present preliminary results, using the photometric redshifts for the entire COSMOS galaxies with i < 25 mag. Given the results in Table 4, we use prior and consider extinction as an independent parameter in the fit.
The photometric redshift distributions for different spectral types of galaxies in COS-MOS are presented in Figure 11. Only galaxies with i < 25 mag are used here, as they have the most reliable photometric redshifts. Moreover, as discussed in §4.3, we restrict the sample to galaxies with z < 1.2. There is similar distribution for all the spectral types with redshift. The photometric redshift distribution for COSMOS (to i AB < 24) is compared in Figure 12 with the spectroscopic redshift distribution for the VVDS to the same depth (Le Fevre et al. 2005), after normalising the number of sources to the areas of their respective surveys. The overall agreement is good, with similar median redshifts. The VVDS only targets 25% of the galaxies to its spectroscopic magnitude limit. This, combined with the difficulty in measuring spectroscopic redshifts for fainter galaxies in VVDS and cosmic variance are responsible for the observed difference between the two distributions in Figure  12.
In Figure 13 we present rest-frame absolute magnitudes (M V ) for COSMOS galaxies. These are estimated using its best-fit photometric redshift and spectral type, following the prescription described in . As expected, there is a trend in M V absolute magnitudes with spectral types, with objects with earlier types being brighter. The median absolute magnitudes correspond to M V = −21.3 (E/SO), −20.5 (Sa/Sb), −19.7 (Sc), −18.7 (starbursts).

Stellar Mass Estimates
The stellar mass for COSMOS galaxies is measured using the relation between M/L V and rest-frame (B − V ) 0 colors M/L V = −0.628 + 1.305 (B − V ) 0 Bell et al. (2005). We assume Salpeter IMF with 0.1M ⊙ < M < 100M ⊙ . Average rest-frame < B − V > 0 colors, corrected for extinction, are estimated for each spectral type (E, Sa, Sb, Sc, Im and starburst), using the appropriate templates. Then, to each galaxy, using its best-fit spectral type (which is derived consistently with its estimated extinction and photometric redshift), we assign the < B − V > 0 color and hence, the M/L V ratio from the above equation. Combined with rest-frame absolute V-band magnitudes (M V ), the stellar mass is then estimated as K-band luminosities, being produced by evolved stellar population in galaxies, are more directly correlated with the stellar mass in galaxies. However, due to shallowness of our Kband data over the COSMOS area, many galaxies are not detected in this band. Therefore, we use the V-band luminosity as a proxy for the K-band to measure the stellar mass. For a sub-set of our galaxies, the stellar masses measured using the K-and V-band luminosities were compared and agree better than 5%. However, by definition, this is a sample dominated by the most massive and reddest galaxies and therefore, this cannot be used as a measure of the accuracy for stellar masses for the rest of the galaxies in this sample. The main source of uncertainty in our stellar mass estimates here is the scatter in the mean < B − V > 0 colors for each spectral type and the accuracy with which the spectral types are measured for individual galaxies.
In Figure 14 we present the distribution of M stellar /M ⊙ values as a function of spectral type and redshift. In a given redshift range, elliptical and early-type spiral galaxies are more massive than later type galaxies. However, for a given spectral type of galaxies, we find an increase in galaxy mass with redshift. This is likely caused by a bias in our magnitude limited sample, due to selecting brighter galaxies at higher redshifts.

Summary
We develop a photometric redshift code and use that to measure redshifts and spectral types for galaxies in the COSMOS survey. The technique uses χ 2 template fitting, combined with luminosity function priors and with the option to estimate internal extinction (E(B − V )). We use extensive simulations to examine reliability of the code and study its accuracy as a function of photometric magnitude limits and S/N ratios. We define a new parameter, D 95 , to identify the objects with catastrophic failure in photometric redshift estimate.
We estimate photometric redshifts for a sample of 868 galaxies with available spectroscopic redshifts (to z < 1.2) from zCOSMOS. Considering different scenarios, dependeing on using prior and/or extinction, we compare the photometric and spectroscopic redshifts for this sample. The best agreement is found when invoking both prior and dust extinction correction, giving σ(∆(z)) = 0.031, where ∆(z) = (z phot −z spec )/(1+z spec ). This gives a small fraction of outliers (2.5%). For a sample of 12 type II AGNs with available spectroscopic redshifts, we find σ(∆(z)) = 0.10.
Our photometric redshift code here is compared with three independent codes. The estimated redshifts are in excellent agreement. We measure photometric redshifts and spectral types for the entire COSMOS galaxies and present preliminary results concerning redshift and absolute magnitude distributions. We use the estimated photometric redshifts and spectral types to measure stellar masses of galaxies and study changes in stellar mass among galaxies with different spectral types and with redshift. Wirth, G. D. 2004AJ. 127, 3121 Yan, H. et al. 2005 This preprint was prepared with the AAS L A T E X macros v5.2. 2 In AB magnitudes.
3 AB magnitude = Vega Magnitude + Offset. This offset does not include the color conversions to the Johnson-Cousins system used by Landolt (1992). * Compact objects saturate at i + < 21.8 due to the exceptional seeing. + The sensitivity for photometry of a point source in a 0.15 ′′ aperture is 26.6, for optimal photometry of a 1 ′′ galaxy it is 26.1 The optimization of the SED has been done externally to the codes.  These are trained to minimise the residuals between the photometric and spectroscopic redshifts for a sample of galaxies in HDF-N with available such data. -Simulation presenting the comparison between the input and output redshifts as a function of magnitude limit, S/N ratios and spectral types (elliptical (red), early/intermediate type spirals (green); late-type and starburst galaxies (blue). on ∆(z), which is a measure of the accuracy of the estimated photometric redshifts. The scatter in ∆(z) increases towards higher D 95 values and fainter magnitude limits. The black line shows variation in rms for ∆(z) as a function of D 95 . For clarity, we only present the plots for 0 < D 95 < 0.5. A number of points on the i < 26.2 panel scatter beyond the above D 95 and ∆(z) range, as they are undetected in the short wavelength bands and photometric redshift get less reliable . This is the reason for a relatively smaller number of points on the i < 26.2 mag. panel. -Comparison between photometric and spectroscopic redshifts for a sample of 958 galaxies in COSMOS with available spectroscopic redshifts. The colors correspond to elliptical (red), spiral (green) and starburst (blue) spectral types. The spectral types are evenly distributed with redshift, indicating no bias in spectral type classification as a function of redshift. The smallest scatter in ∆(z) ((z phot − z spec )/(1 + z spec )) obtained for the case including the prior and extinction.       Fig. 11.-Photometric Redshift distributions for different spectral types of galaxies for the entire COSMOS galaxies with i < 25. The distributions for each spectral type are normalized to the total number of galaxies with that spectral type.  Fig. 13.-Rest-frame absolute magnitude distributions for different spectral types of galaxies in the entire COSMOS catalog. The expected trend is present, with early-type galaxies having brighter absolute magnitudes. The distributions for each spectral type are normalized to the total number of galaxies with that spectral type.