# Dark Energy Survey Year 3 Results: Redshift Calibration of the MagLim Lens Sample from the combination of SOMPZ and clustering and its impact on Cosmology

G. Giannini, A. Alarcon, M. Gatti, A. Porredon, M. Crocce, G.M. Bernstein, R. Cawthon, C. Sánchez, C. Doux, J. Elvin-Poole, et al.

► To cite this version:

G. Giannini, A. Alarcon, M. Gatti, A. Porredon, M. Crocce, et al. Dark Energy Survey Year 3 Results: Redshift Calibration of the MagLim Lens Sample from the combination of SOMPZ and clustering and its impact on Cosmology. Mon.Not.Roy.Astron.Soc., 2024, 527 (2), pp.2010-2036. 10.1093/mnras/stad2945. hal-03791422

HAL Id: hal-03791422

https://hal.science/hal-03791422

Submitted on 20 Apr 2024

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# Dark Energy Survey Year 3 results: redshift calibration of the MAGLIM lens sample from the combination of SOMPZ and clustering and its impact on cosmology

G. Giannini<sup>1,2,3*</sup> A. Alarcon<sup>4</sup> M. Gatti<sup>5</sup> A. Porredon<sup>6,7</sup> M. Crocce<sup>8,9</sup> G. M. Bernstein<sup>5</sup>

R. Cawthon<sup>10</sup> C. Sánchez<sup>3</sup> C. Doux<sup>5</sup> J. Elvin-Poole<sup>6,7</sup> M. Raveri<sup>5</sup> J. Myles<sup>11,12,13</sup> H. Lin<sup>14</sup>

A. Amon<sup>15,16</sup> S. Allam<sup>14</sup> O. Alves<sup>17</sup> F. Andrade-Oliveira<sup>18</sup> E. Baxter<sup>19</sup> K. Bechtol<sup>20</sup> M. R. Becker<sup>4</sup>

J. Blazek<sup>21</sup> H. Camacho<sup>18,22</sup> A. Campos<sup>23</sup> A. Carnero Rosell<sup>24,25</sup> M. Carrasco Kind<sup>26,27</sup> A. Choi<sup>6,7</sup>

J. Cordero<sup>28</sup> J. De Vicente<sup>29</sup> J. DeRose<sup>30</sup> H. T. Diehl<sup>14</sup> S. Dodelson<sup>23,31</sup> A. Drlica-Wagner<sup>32,14,33</sup>

K. Eckert<sup>5</sup> X. Fang<sup>34,35</sup> A. Farahi<sup>36</sup> P. Fosalba<sup>8,9</sup> O. Friedrich<sup>17</sup> D. Gruen<sup>37</sup> R. A. Gruendl<sup>26,27</sup>

J. Gschwend<sup>22,38</sup> I. Harrison<sup>39</sup> W. G. Hartley<sup>38</sup> E. M. Huff<sup>32</sup> M. Jarvis<sup>5</sup> E. Krause<sup>40</sup> N. Kuropatkin<sup>14</sup>

P. Lemos<sup>39,41</sup> N. MacCrann<sup>42</sup> J. McCullough<sup>14</sup> J. Muir<sup>11</sup> S. Pandey<sup>5</sup> J. Prat<sup>1,2</sup>

M. Rodriguez-Monroy<sup>29</sup> A. J. Ross<sup>6</sup> E. S. Rykoff<sup>12,13</sup> S. Samuroff<sup>23</sup> L. F. Secco<sup>1,2</sup> I. Sevilla-Noarbe<sup>29</sup>

E. Sheldon<sup>43</sup> M. A. Troxel<sup>44</sup> D. L. Tucker<sup>14</sup> N. Weaverdyck<sup>17</sup> B. Yanny<sup>14</sup> B. Yin<sup>23</sup> Y. Zhang<sup>4</sup>

T. M. C. Abbott<sup>45</sup> M. Aguena<sup>22</sup> D. Bacon<sup>46</sup> E. Bertin<sup>47,48</sup> S. Bocquet<sup>35</sup> D. Brooks<sup>39</sup> D. L. Burke<sup>11</sup>

J. Carretero<sup>3</sup> F. J. Castander<sup>8,9</sup> M. Costanzi<sup>49,50,51</sup> L. N. da Costa<sup>22</sup> M. E. S. Pereira<sup>52</sup> S. Desai<sup>53</sup>

P. Doel<sup>39</sup> I. Ferrero<sup>54</sup> B. Flaugher<sup>14</sup> D. Friedel<sup>24</sup> J. Frieman<sup>14,1,2</sup> J. García-Bellido<sup>55</sup> D. W. Gerdes<sup>56,17</sup>

G. Gutierrez<sup>14</sup> S. R. Hinton<sup>57</sup> D. L. Hollowood<sup>58</sup> K. Honscheid<sup>6,7</sup> D. J. James<sup>59</sup> S. Kent<sup>14,31</sup>

K. Kuehn<sup>60,61</sup> O. Lahav<sup>39</sup> C. Lidman<sup>62,63</sup> M. Lima<sup>64,21</sup> P. Melchior<sup>65</sup> J. Mena-Fernández<sup>29</sup>

F. Menanteau<sup>26,27</sup> R. Miquel<sup>3,66</sup> R. L. C. Ogando<sup>36</sup> M. Paterno<sup>14</sup> F. Paz-Chinchón<sup>26,67</sup> A. Pieres<sup>22,36</sup>

A. A. Plazas Malagón<sup>65</sup> A. Roodman<sup>11</sup> E. Sanchez<sup>29</sup> V. Scarpine<sup>14</sup> M. Smith<sup>68</sup> E. Suchyta<sup>69</sup>

M. E. C. Swanson<sup>39</sup> G. Tarle<sup>17</sup> D. Thomas<sup>46</sup> C. To<sup>6</sup> and M. Vincenzi<sup>46,68</sup> (DES Collaboration)

*Affiliations are listed at the end of the paper*

Accepted 2023 September 20. Received 2023 September 6; in original form 2023 February 1

## ABSTRACT

We present an alternative calibration of the MAGLIM lens sample redshift distributions from the Dark Energy Survey (DES) first 3 yr of data (Y3). The new calibration is based on a combination of a self-organizing-map-based scheme and clustering redshifts to estimate redshift distributions and inherent uncertainties, which is expected to be more accurate than the original DES Y3 redshift calibration of the lens sample. We describe in detail the methodology, and validate it on simulations and discuss the main effects dominating our error budget. The new calibration is in fair agreement with the fiducial DES Y3 $n(z)$ calibration, with only mild differences ($<3\sigma$) in the means and widths of the distributions. We study the impact of this new calibration on cosmological constraints, analysing DES Y3 galaxy clustering and galaxy–galaxy lensing measurements, assuming a Lambda cold dark matter cosmology. We obtain $\Omega_m = 0.30 \pm 0.04$, $\sigma_8 = 0.81 \pm 0.07$, and $S_8 = 0.81 \pm 0.04$, which implies a $\sim 0.4\sigma$ shift in the $\Omega - S_8$ plane compared to the fiducial DES Y3 results, highlighting the importance of the redshift calibration of the lens sample in multiprobe cosmological analyses.

**Key words:** gravitational lensing: weak – galaxies: distances and redshifts – dark energy.

## 1 INTRODUCTION

The Dark Energy Survey (DES, Flaugher et al. 2015) is currently the largest photometric galaxy survey to date, spanning 5000 deg² of the

Southern hemisphere and having detected hundreds of millions of galaxies. Together with other ongoing and future galaxy surveys (e.g. Kilo-Degree Survey KIDS, Kuijken et al. 2015; Hyper Suprime-Cam HSC, Aihara et al. 2018; Vera Rubin Observatory Legacy Survey of Space and Time (LSST), LSST Science Collaboration 2009; Euclid, Laureijs et al. 2011), DES can achieve competitive constraints on

<footnote>*E-mail: giulia.giannini15@gmail.com</footnote>
<figure><img src="image_2.png" /></figure>

# Dark Energy Survey Year 3 results: redshift calibration of the MAGLIM lens sample from the combination of SOMPZ and clustering and its impact on cosmology

G. Giannini,¹,²,³★ A. Alarcon,⁴ M. Gatti,⁵ A. Porredon,⁶,⁷ M. Crocce,⁸,⁹ G. M. Bernstein,⁵

R. Cawthon,¹⁰ C. Sánchez,³ C. Doux,⁵ J. Elvin-Poole,⁶,⁷ M. Raveri,⁵ J. Myles,¹¹,¹²,¹³ H. Lin,¹⁴

A. Amon,¹⁵,¹⁶ S. Allam,¹⁴ O. Alves,¹⁷ F. Andrade-Oliveira,¹⁸ E. Baxter,¹⁹ K. Bechtol,²⁰ M. R. Becker,⁴

J. Blazek,²¹ H. Camacho,¹⁸,²² A. Campos,²³ A. Carnero Rosell,²⁴,²⁵ M. Carrasco Kind,²⁶,²⁷ A. Choi,⁶,⁷

J. Cordero,²⁸ J. De Vicente,²⁹ J. DeRose,³⁰ H. T. Diehl,¹⁴ S. Dodelson,²³,³¹ A. Drlica-Wagner,³²,¹⁴,³³

K. Eckert,⁵ X. Fang,³⁴,³⁵ A. Farahi,³⁶ P. Fosalba,⁸,⁹ O. Friedrich,¹⁷ D. Gruen,³⁷ R. A. Gruendl,²⁶,²⁷

J. Gschwend,²²,³⁸ I. Harrison,³⁹ W. G. Hartley,³⁸ E. M. Huff,³² M. Jarvis,⁵ E. Krause,⁴⁰ N. Kuropatkin,¹⁴

P. Lemos,³⁹,⁴¹ N. MacCrann,⁴² J. McCullough,¹⁴ J. Muir,¹¹ S. Pandey,⁵ J. Prat,¹,²

M. Rodriguez-Monroy,²⁹ A. J. Ross,⁶ E. S. Rykoff,¹²,¹³ S. Samuroff,²³ L. F. Secco,¹,² I. Sevilla-Noarbe,²⁹

E. Sheldon,⁴³ M. A. Troxel,⁴⁴ D. L. Tucker,¹⁴ N. Weaverdyck,¹⁷ B. Yanny,¹⁴ B. Yin,²³ Y. Zhang,⁴

T. M. C. Abbott,⁴⁵ M. Aguena,²² D. Bacon,⁴⁶ E. Bertin,⁴⁷,⁴⁸ S. Bocquet,³⁵ D. Brooks,³⁹ D. L. Burke,¹¹

J. Carretero,³ F. J. Castander,⁸,⁹ M. Costanzi,⁴⁹,⁵⁰,⁵¹ L. N. da Costa,²² M. E. S. Pereira,⁵² S. Desai,⁵³

P. Doel,³⁹ I. Ferrero,⁵⁴ B. Flaugher,¹⁴ D. Friedel,²⁴ J. Frieman,¹⁴,¹,² J. García-Bellido,⁵⁵ D. W. Gerdes,⁵⁶,¹⁷

G. Gutierrez,¹⁴ S. R. Hinton,⁵⁷ D. L. Hollowood,⁵⁸ K. Honscheid,⁶,⁷ D. J. James,⁵⁹ S. Kent,¹⁴,³¹

K. Kuehn,⁶⁰,⁶¹ O. Lahav,³⁹ C. Lidman,⁶²,⁶³ M. Lima,⁶⁴,²¹ P. Melchior,⁶⁵ J. Mena-Fernández,²⁹

F. Menanteau,²⁶,²⁷ R. Miquel,³,⁶⁶ R. L. C. Ogando,³⁶ M. Paterno,¹⁴ F. Paz-Chinchón,²⁶,⁶⁷ A. Pieres,²²,³⁶

A. A. Plazas Malagón,⁶⁵ A. Roodman,¹¹ E. Sanchez,²⁹ V. Scarpine,¹⁴ M. Smith,⁶⁸ E. Suchyta,⁶⁹

M. E. C. Swanson,³⁹ G. Tarle,¹⁷ D. Thomas,⁴⁶ C. To,⁶ and M. Vincenzi⁴⁶,⁶⁸ (DES Collaboration)

*Affiliations are listed at the end of the paper*

Accepted 2023 September 20. Received 2023 September 6; in original form 2023 February 1

## ABSTRACT

We present an alternative calibration of the MAGLIM lens sample redshift distributions from the Dark Energy Survey (DES) first 3 yr of data (Y3). The new calibration is based on a combination of a self-organizing-map-based scheme and clustering redshifts to estimate redshift distributions and inherent uncertainties, which is expected to be more accurate than the original DES Y3 redshift calibration of the lens sample. We describe in detail the methodology, and validate it on simulations and discuss the main effects dominating our error budget. The new calibration is in fair agreement with the fiducial DES Y3 $n(z)$ calibration, with only mild differences ($<3\sigma$) in the means and widths of the distributions. We study the impact of this new calibration on cosmological constraints, analysing DES Y3 galaxy clustering and galaxy–galaxy lensing measurements, assuming a Lambda cold dark matter cosmology. We obtain $\Omega_m = 0.30 \pm 0.04$, $\sigma_8 = 0.81 \pm 0.07$, and $S_8 = 0.81 \pm 0.04$, which implies a ~0.4$\sigma$ shift in the $\Omega - S_8$ plane compared to the fiducial DES Y3 results, highlighting the importance of the redshift calibration of the lens sample in multiprobe cosmological analyses.

**Key words:** gravitational lensing: weak – galaxies: distances and redshifts – dark energy.

## 1 INTRODUCTION

The Dark Energy Survey (DES, Flaugher et al. 2015) is currently the largest photometric galaxy survey to date, spanning 5000 deg² of the

Southern hemisphere and having detected hundreds of millions of galaxies. Together with other ongoing and future galaxy surveys (e.g. Kilo-Degree Survey KIDS, Kuijken et al. 2015; Hyper Suprime-Cam HSC, Aihara et al. 2018; Vera Rubin Observatory Legacy Survey of Space and Time (LSST), LSST Science Collaboration 2009; Euclid, Laureijs et al. 2011), DES can achieve competitive constraints on

<footnote>*E-mail: giulia.giannini15@gmail.com</footnote>
cosmological parameters by studying both the spatial distribution of the detected galaxies and by measuring the tiny distortions in their observed shapes due to gravitational lensing effects induced by the large-scale structure of the Universe. For instance, the analysis of the first 3 yr (Y3) of DES data (DES Collaboration 2022) placed tight constraints on cosmological parameters combining three different measurements of the two-point (3x2pt) correlation functions that involved galaxy positions and measured galaxy shapes. These measurements are as follows:

(i) Cosmic shear, i.e. the two-point correlation function of galaxy shapes; the DES Y3 measurements (Amon et al. 2022; Secco et al. 2022) involve the angular correlation of $10^8$ galaxy shapes from the weak lensing sample (Gatti et al. 2021), divided into four tomographic bins. We refer to this as the ‘source’ sample:

(ii) galaxy clustering: the two-point correlation function of the positions of bright galaxies (which we refer to as the ‘lens’ sample) (Rodríguez-Monroy et al. 2022).

(iii) galaxy–galaxy lensing: the cross-correlation function of galaxy shapes and the position of the galaxies of the lens sample (Prat et al. 2022).

The modelling of each of these correlation functions requires knowledge of the redshift distributions (from hereafter $n(z)$) of the two samples (lens and source galaxies), which have to be estimated with great accuracy in order to avoid biased cosmological results (Huterer et al. 2006; Cunha et al. 2012; Benjamin et al. 2013; Huterer, Cunha & Fang 2013; Bonnett et al. 2016; Hildebrandt et al. 2017, 2021; Hoyle et al. 2018; Joudaki et al. 2020; Tessore & Harrison 2020). The optimal solution would be to avail ourselves of spectroscopic observations, providing an accurate redshift measurement of each targeted galaxy. Unfortunately, it is not feasible to obtain said spectra other than for a small fraction of the science sample, due to the required time and cost of the observing campaign. Cosmological surveys like DES therefore have to use for their redshift estimation measurements only a few, noisy, broad-band fluxes, requiring inventive methods to create robust and unbiased redshift calibration pipelines.

For the DES Y3 3x2pt analysis, two different lens samples were used. The first sample is defined by selecting luminous red galaxies through the RedMaGiC algorithm (Rozo et al. 2016), which retains galaxies with high-quality photometric redshift, by fitting each galaxy to a red-sequence template. The galaxies passing the RedMaGiC selection have, however, a low number density, and the final sample comprises roughly 3000 000 galaxies. The second sample slightly compromises on the redshift accuracy to the benefit of a larger number density. The MAGLIM sample (Porredon et al. 2021) is a magnitude-limited sample with a number density more than three times greater than RedMaGiC, comprising roughly 10 000 000 galaxies. In the fiducial DES 3x2pt (DES Collaboration 2022) and 2x2pt analyses (Porredon et al. 2022) that rely on the MAGLIM sample; the redshift distributions of the sample have been characterized using the machine learning photometric redshift code Directional Neighbourhood Fitting (DNF, De Vicente, Sánchez & Sevilla-Noarbe 2016). In its current implementation, the DNF code provides per-galaxy redshift estimates using nearest neighbour techniques. The redshift distributions were then further calibrated using clustering redshift (hereafter WZ), which relies on cross-correlation measurements with spectroscopic samples (Cawthon et al. 2022). This calibration step also placed uncertainties on the redshift distribution estimates, which were modelled by ‘shifting’ and ‘stretching’ the redshift distributions.

This work presents an additional and more sophisticated calibration of the redshift distributions of the lens sample, and studies the impact of these new redshift distribution estimates on the cosmological constraints using DES Y3 galaxy clustering and galaxy–galaxy lensing measurements (2x2pt). In particular, we adopt an approach similar to the one adopted to characterize the redshift distributions of the DES Y3 weak lensing (WL) sample, presented in Myles et al. (2021) and Gatti et al. (2022). This methodology also combines photometric and clustering constraints to produce redshift estimates, and it is more powerful than the fiducial redshift calibration adopted for the lenses for a number of reasons. The photometric information is used to produce redshift estimates using a self-organizing-map-based scheme (hereafter SOMPZ), which allows a meticulous control over all the (known) potential sources of uncertainties affecting the estimates. The SOMPZ method works by leveraging the DES deep fields, which have deeper observations with additional photometric bands and overlap with many-band redshift surveys available. It is possible to reproduce realistic selection functions in the deep fields from the injection of galaxies into actual DES images using the sophisticated image simulation tool BALROG (Everett et al. 2022). The SOMPZ method provides an ensemble of redshift $n(z)$ for a given galaxy sample, which captures the uncertainties in the redshift distributions at all orders (i.e. not only in the mean or width of the distributions). The clustering constraints are then incorporated through a rigorous joint likelihood framework where the clustering data are forward modelled as a function of the input $n(z)$, and the specific WZ systematics are marginalized over. This scheme allows to draw $n(z)$ samples conditioned on both clustering and photometric measurements, improving the $n(z)$ estimates by correctly taking into account the significance of the information provided by each source of information. This combined approach has proven to be more robust than SOMPZ or WZ applied individually (Gatti et al. 2022), as the combination exploits the complementarity of both methods and reduces the overall $n(z)$ uncertainty.

The paper is organized as follows. In Section 2 we introduce all the samples used in this work, both on data and simulations. Simulated samples are used to validate the methodology. Section 3 summarizes the SOMPZ+WZ methodology adopted in this paper, also outlining the differences with the ‘standard’ SOMPZ+WZ methodology used to model the DES Y3 source redshift distributions (Myles et al. 2021; Gatti et al. 2022). Section 4 is devoted to the characterization of the method’s uncertainties. Section 5 presents the redshift distributions MAGLIM sample produced using the techniques described in this work. Section 6 describes the impact of this new redshift calibration on cosmological parameters estimation and compares it to the ‘fiducial’ constraints obtained using the DNF+WZ redshift calibration (Porredon et al. 2022). In Appendix A we provide details on the construction of the MAGLIM sample in simulations. Appendix B complements the paper with a validation of the methodology in simulations. In Appendix C are listed the values of parameters and the prior functions used in the cosmological inference; Appendix D discusses the impact of different redshift uncertainties marginalization techniques on the cosmological parameters estimation.

## 2 DATA

We describe in this section the data and simulated products used in this work. The samples used in this work are the following:

(i) the DES MAGLIM sample, used as lenses in the DES cosmological analysis. Characterizing its redshift distribution is the main goal of this work;
cosmological parameters by studying both the spatial distribution of the detected galaxies and by measuring the tiny distortions in their observed shapes due to gravitational lensing effects induced by the large-scale structure of the Universe. For instance, the analysis of the first 3 yr (Y3) of DES data (DES Collaboration 2022) placed tight constraints on cosmological parameters combining three different measurements of the two-point (3x2pt) correlation functions that involved galaxy positions and measured galaxy shapes. These measurements are as follows:

(i) Cosmic shear, i.e. the two-point correlation function of galaxy shapes; the DES Y3 measurements (Amon et al. 2022; Secco et al. 2022) involve the angular correlation of $10^8$ galaxy shapes from the weak lensing sample (Gatti et al. 2021), divided into four tomographic bins. We refer to this as the ‘source’ sample:

(ii) galaxy clustering: the two-point correlation function of the positions of bright galaxies (which we refer to as the ‘lens’ sample) (Rodríguez-Monroy et al. 2022).

(iii) galaxy–galaxy lensing: the cross-correlation function of galaxy shapes and the position of the galaxies of the lens sample (Prat et al. 2022).

The modelling of each of these correlation functions requires knowledge of the redshift distributions (from hereafter $n(z)$) of the two samples (lens and source galaxies), which have to be estimated with great accuracy in order to avoid biased cosmological results (Huterer et al. 2006; Cunha et al. 2012; Benjamin et al. 2013; Huterer, Cunha & Fang 2013; Bonnett et al. 2016; Hildebrandt et al. 2017, 2021; Hoyle et al. 2018; Joudaki et al. 2020; Tessore & Harrison 2020). The optimal solution would be to avail ourselves of spectroscopic observations, providing an accurate redshift measurement of each targeted galaxy. Unfortunately, it is not feasible to obtain said spectra other than for a small fraction of the science sample, due to the required time and cost of the observing campaign. Cosmological surveys like DES therefore have to use for their redshift estimation measurements only a few, noisy, broad-band fluxes, requiring inventive methods to create robust and unbiased redshift calibration pipelines.

For the DES Y3 3x2pt analysis, two different lens samples were used. The first sample is defined by selecting luminous red galaxies through the RedMaGiC algorithm (Rozo et al. 2016), which retains galaxies with high-quality photometric redshift, by fitting each galaxy to a red-sequence template. The galaxies passing the RedMaGiC selection have, however, a low number density, and the final sample comprises roughly 3000 000 galaxies. The second sample slightly compromises on the redshift accuracy to the benefit of a larger number density. The MAGLIM sample (Porredon et al. 2021) is a magnitude-limited sample with a number density more than three times greater than RedMaGiC, comprising roughly 10 000 000 galaxies. In the fiducial DES 3x2pt (DES Collaboration 2022) and 2x2pt analyses (Porredon et al. 2022) that rely on the MAGLIM sample; the redshift distributions of the sample have been characterized using the machine learning photometric redshift code Directional Neighbourhood Fitting (DNF, De Vicente, Sánchez & Sevilla-Noarbe 2016). In its current implementation, the DNF code provides per-galaxy redshift estimates using nearest neighbour techniques. The redshift distributions were then further calibrated using clustering redshift (hereafter WZ), which relies on cross-correlation measurements with spectroscopic samples (Cawthon et al. 2022). This calibration step also placed uncertainties on the redshift distribution estimates, which were modelled by ‘shifting’ and ‘stretching’ the redshift distributions.

This work presents an additional and more sophisticated calibration of the redshift distributions of the lens sample, and studies the impact of these new redshift distribution estimates on the cosmological constraints using DES Y3 galaxy clustering and galaxy–galaxy lensing measurements (2x2pt). In particular, we adopt an approach similar to the one adopted to characterize the redshift distributions of the DES Y3 weak lensing (WL) sample, presented in Myles et al. (2021) and Gatti et al. (2022). This methodology also combines photometric and clustering constraints to produce redshift estimates, and it is more powerful than the fiducial redshift calibration adopted for the lenses for a number of reasons. The photometric information is used to produce redshift estimates using a self-organizing-map-based scheme (hereafter SOMPZ), which allows a meticulous control over all the (known) potential sources of uncertainties affecting the estimates. The SOMPZ method works by leveraging the DES deep fields, which have deeper observations with additional photometric bands and overlap with many-band redshift surveys available. It is possible to reproduce realistic selection functions in the deep fields from the injection of galaxies into actual DES images using the sophisticated image simulation tool BALROG (Everett et al. 2022). The SOMPZ method provides an ensemble of redshift $n(z)$ for a given galaxy sample, which captures the uncertainties in the redshift distributions at all orders (i.e. not only in the mean or width of the distributions). The clustering constraints are then incorporated through a rigorous joint likelihood framework where the clustering data are forward modelled as a function of the input $n(z)$, and the specific WZ systematics are marginalized over. This scheme allows to draw $n(z)$ samples conditioned on both clustering and photometric measurements, improving the $n(z)$ estimates by correctly taking into account the significance of the information provided by each source of information. This combined approach has proven to be more robust than SOMPZ or WZ applied individually (Gatti et al. 2022), as the combination exploits the complementarity of both methods and reduces the overall $n(z)$ uncertainty.

The paper is organized as follows. In Section 2 we introduce all the samples used in this work, both on data and simulations. Simulated samples are used to validate the methodology. Section 3 summarizes the SOMPZ+WZ methodology adopted in this paper, also outlining the differences with the ‘standard’ SOMPZ+WZ methodology used to model the DES Y3 source redshift distributions (Myles et al. 2021; Gatti et al. 2022). Section 4 is devoted to the characterization of the method’s uncertainties. Section 5 presents the redshift distributions MAGLIM sample produced using the techniques described in this work. Section 6 describes the impact of this new redshift calibration on cosmological parameters estimation and compares it to the ‘fiducial’ constraints obtained using the DNF+WZ redshift calibration (Porredon et al. 2022). In Appendix A we provide details on the construction of the MAGLIM sample in simulations. Appendix B complements the paper with a validation of the methodology in simulations. In Appendix C are listed the values of parameters and the prior functions used in the cosmological inference; Appendix D discusses the impact of different redshift uncertainties marginalization techniques on the cosmological parameters estimation.

## 2 DATA

We describe in this section the data and simulated products used in this work. The samples used in this work are the following:

(i) the DES MAGLIM sample, used as lenses in the DES cosmological analysis. Characterizing its redshift distribution is the main goal of this work;
(ii) the DES deep field samples, which are observed in small fields by DES with deeper observations than wide field ones and where information from additional photometric bands are available. Deep fields are a key element of the SOMPZ methodology;

(iii) the DES BALROG sample; this sample consists of software-injected deep field galaxies into DES wide field images and is a key element of the SOMPZ methodology;

(iv) the 'redshift' samples, which are a collection of either spectroscopic or multiband photometric samples collected by other surveys in the DES deep field region. The redshift samples are a key element in the SOMPZ methodology;

(v) BOSS/eBOSS spectroscopic galaxy catalogues; these are galaxies with spectroscopic redshift overlapping with the DES wide field footprint used for the WZ measurement;

(vi) the DES WL sample, used as sources in the DES cosmological analysis; we use the WL sample here when presenting the impact of MAGLIM SOMPZ redshift distributions on the cosmological analysis results.

All of these samples in data have also been reproduced in simulation for testing purposes.

## 2.1 DES Year 3 data

DES (Flaugher et al. 2015) is a five broad-band (grizY) photometric survey that mapped roughly 5000 deg² of the southern sky, using a 570 megapixel camera (DECam; Flaugher et al. 2015) mounted on the 4 m Blanco telescope at the Cerro Tololo Inter-American Observatory (CTIO) in Chile. In this work we use data from the first 3 yr (out of six) of observations (Y3), which were taken from 2013 August to 2016 February. The DES Data Management (DESDM) team was in charge of processing the raw images (Sevilla et al. 2011; Abbott et al. 2018; Morganson et al. 2018); full details are provided in Sevilla-Noarbe et al. (2021) and Gatti et al. (2021). The main catalogue upon which all the DES samples are built is the DES gold catalogue, obtained using observations in the griz bands. Objects belonging to the gold catalogue have passed a number of selections aimed at removing objects in problematic regions of the sky or anomalous detections (e.g. objects with pixels affected by saturation or truncation issues). The gold catalogue consists of 388 millions objects (Sevilla-Noarbe et al. 2021). Each object comes with morphological and photometric measurements based on two different pipelines, the Multi-Object Fitting pipeline (MOF) and the Single-Object Fitting pipeline (SOF). The former performs a simultaneous multi-object, multi-epoch, multiband fit to estimate morphology and photometric information; the latter does not perform the multi-object fit when it comes to crowded objects. The DES Y3 SOF implementation is faster and less prone to fit failures compared to the MOF pipeline, and it does not suffer from any significant loss in terms of accuracy (Sevilla-Noarbe et al. 2021).

## 2.2 MAGLIM sample

The main galaxy sample considered in this work is the MAGLIM sample. The MAGLIM sample is a subset of the DES gold catalogue and consists of bright galaxies selected with an ad hoc selection that optimizes the number density and the redshift accuracy of the sample (Porredon et al. 2021). The MAGLIM sample spans the full DES Y3 wide field footprint, for a total of ~4143 deg². SOF magnitudes in the riz bands<fnref n="1" /> are used for the selection and photometry. The selection

<table><caption>**Table 1.** Summary of the MAGLIM sample. We have outlined for each tomographic bin the redshift range (selected using DNF $z_{mean}$), the number of galaxies, the number density, and the magnification coefficient as measured in Elvin-Poole et al. (2023).</caption><thead><tr><th>Bin</th><th>z range</th><th>N galaxies</th><th>n density</th><th>C<sub>flux</sub></th></tr></thead><tbody><tr><td>1</td><td>[0.20, 0.40]</td><td>2236 473</td><td>0.150</td><td>0.43</td></tr><tr><td>2</td><td>[0.40, 0.55]</td><td>1599 500</td><td>0.107</td><td>0.30</td></tr><tr><td>3</td><td>[0.55, 0.70]</td><td>1627 413</td><td>0.109</td><td>1.75</td></tr><tr><td>4</td><td>[0.70, 0.85]</td><td>2175 184</td><td>0.146</td><td>1.94</td></tr><tr><td>5</td><td>[0.85, 0.95]</td><td>1583 686</td><td>0.106</td><td>1.56</td></tr><tr><td>6</td><td>[0.95, 1.05]</td><td>1494 250</td><td>0.100</td><td>2.96</td></tr></tbody></table>

is meant to be linear in redshift and magnitude, and reads

$$i < 4 * z_{\text{mean}} + 18 \quad i > 17.5, \qquad (1)$$

where $m_i$ is the i-band SOF magnitude and $z_{mean}$ is a per-object redshift estimate from the photo-z code DNF (De Vicente et al. 2016; see also the next subsection). The sample is then further limited to the redshift range $0.2 < z_{mean} < 1.05$. This leads to a sample in the range $18.8 < i_{mag} < 22.2$. The MAGLIM sample is divided into six tomographic bins using DNF $z_{mean}$ and considering the following bin edges: [0.2, 0.4, 0.55, 0.7, 0.85, 0.95, 1.05], with a total of a 10 716 506 galaxies, distributed across bins as summarized in Table 1. The MAGLIM sample is used as lens sample in the galaxy–galaxy lensing and galaxy clustering measurements of the DES Y3 2x2 cosmological analysis (Porredon et al. 2022).

### 2.2.1 DNF

The photo-z code DNF is used to define the MAGLIM selection and to define the MAGLIM tomographic bins. The DNF algorithm computes a point estimate $z_{mean}$ of redshift of the galaxies by performing a fit to a hyper-plane in colour and magnitude space using up to 80 nearest neighbours taken from a reference sample made of spectroscopic galaxies with secure redshift information. For this purpose, a large number of spectroscopic catalogues collected by Gschwend et al. (2018) has been used, including spectra from SDSS DR4 (Abolfathi et al. 2018), OzDES (Lidman et al. 2020), VIPERS (Garilli et al. 2014), and from the PAU spectro-photometric catalogue (Eriksen et al. 2019). The total number of spectra used for training is ~$10^5$. DNF also provides a redshift estimate $z_{DNF}$ drawn from the redshift PDF for each individual galaxy, although only the quantity $z_{mean}$ (used for the selection and for the binning) is of interest in this work.

## 2.3 Deep fields sample

The Deep fields catalogue is a key element of the SOMPZ methodology. We provide here a few key details, but we refer the reader to Hartley et al. (2022) for extensive details and the characterization of the sample.

This work uses four different deep fields, i.e. E2, X3, C3, and COSMOS (COS) covering 3.32, 3.29, 1.94, and 1.38 square degrees, respectively. Each deep field has undergone a scrupulous masking procedure aimed at removing artefacts (e.g. cosmic rays, meteors, saturated pixels, etc.). Considering the final unmasked area overlapping with the UltraVISTA and VIDEO near-infrared (NIR) surveys (McCracken et al. 2012; Jarvis et al. 2013), which is needed to provide photometric information in additional bands, we are left with 5.2 square degrees of area for a total of 267 229 galaxies with measured u, g, r, i, z, J, H, Ks photometry with limiting magnitudes 24.64, 25.57, 25.28, 24.66, 24.06, 24.02, 23.69, and 23.58. Note that

<footnote n="1">¹We exclude the g band as its photometry is known to be affected by PSF estimation issues (Jarvis et al. 2021).</footnote>
(ii) the DES deep field samples, which are observed in small fields by DES with deeper observations than wide field ones and where information from additional photometric bands are available. Deep fields are a key element of the SOMPZ methodology;

(iii) the DES BALROG sample; this sample consists of software-injected deep field galaxies into DES wide field images and is a key element of the SOMPZ methodology;

(iv) the 'redshift' samples, which are a collection of either spectroscopic or multiband photometric samples collected by other surveys in the DES deep field region. The redshift samples are a key element in the SOMPZ methodology;

(v) BOSS/eBOSS spectroscopic galaxy catalogues; these are galaxies with spectroscopic redshift overlapping with the DES wide field footprint used for the WZ measurement;

(vi) the DES WL sample, used as sources in the DES cosmological analysis; we use the WL sample here when presenting the impact of MAGLIM SOMPZ redshift distributions on the cosmological analysis results.

All of these samples in data have also been reproduced in simulation for testing purposes.

## 2.1 DES Year 3 data

DES (Flaugher et al. 2015) is a five broad-band (grizY) photometric survey that mapped roughly 5000 deg² of the southern sky, using a 570 megapixel camera (DECam; Flaugher et al. 2015) mounted on the 4 m Blanco telescope at the Cerro Tololo Inter-American Observatory (CTIO) in Chile. In this work we use data from the first 3 yr (out of six) of observations (Y3), which were taken from 2013 August to 2016 February. The DES Data Management (DESDM) team was in charge of processing the raw images (Sevilla et al. 2011; Abbott et al. 2018; Morganson et al. 2018); full details are provided in Sevilla-Noarbe et al. (2021) and Gatti et al. (2021). The main catalogue upon which all the DES samples are built is the DES gold catalogue, obtained using observations in the griz bands. Objects belonging to the gold catalogue have passed a number of selections aimed at removing objects in problematic regions of the sky or anomalous detections (e.g. objects with pixels affected by saturation or truncation issues). The gold catalogue consists of 388 millions objects (Sevilla-Noarbe et al. 2021). Each object comes with morphological and photometric measurements based on two different pipelines, the Multi-Object Fitting pipeline (MOF) and the Single-Object Fitting pipeline (SOF). The former performs a simultaneous multi-object, multi-epoch, multiband fit to estimate morphology and photometric information; the latter does not perform the multi-object fit when it comes to crowded objects. The DES Y3 SOF implementation is faster and less prone to fit failures compared to the MOF pipeline, and it does not suffer from any significant loss in terms of accuracy (Sevilla-Noarbe et al. 2021).

## 2.2 MAGLIM sample

The main galaxy sample considered in this work is the MAGLIM sample. The MAGLIM sample is a subset of the DES gold catalogue and consists of bright galaxies selected with an ad hoc selection that optimizes the number density and the redshift accuracy of the sample (Porredon et al. 2021). The MAGLIM sample spans the full DES Y3 wide field footprint, for a total of ~4143 deg². SOF magnitudes in the riz bands<fnref n="1" /> are used for the selection and photometry. The selection

<table><caption>**Table 1.** Summary of the MAGLIM sample. We have outlined for each tomographic bin the redshift range (selected using DNF $z_{mean}$), the number of galaxies, the number density, and the magnification coefficient as measured in Elvin-Poole et al. (2023).</caption><thead><tr><th>Bin</th><th>z range</th><th>N galaxies</th><th>n density</th><th>C<sub>flux</sub></th></tr></thead><tbody><tr><td>1</td><td>[0.20, 0.40]</td><td>2236 473</td><td>0.150</td><td>0.43</td></tr><tr><td>2</td><td>[0.40, 0.55]</td><td>1599 500</td><td>0.107</td><td>0.30</td></tr><tr><td>3</td><td>[0.55, 0.70]</td><td>1627 413</td><td>0.109</td><td>1.75</td></tr><tr><td>4</td><td>[0.70, 0.85]</td><td>2175 184</td><td>0.146</td><td>1.94</td></tr><tr><td>5</td><td>[0.85, 0.95]</td><td>1583 686</td><td>0.106</td><td>1.56</td></tr><tr><td>6</td><td>[0.95, 1.05]</td><td>1494 250</td><td>0.100</td><td>2.96</td></tr></tbody></table>

is meant to be linear in redshift and magnitude, and reads

$$i < 4 * z_{\text{mean}} + 18 \quad i > 17.5, \qquad (1)$$

where $m_i$ is the i-band SOF magnitude and $z_{mean}$ is a per-object redshift estimate from the photo-z code DNF (De Vicente et al. 2016; see also the next subsection). The sample is then further limited to the redshift range $0.2 < z_{mean} < 1.05$. This leads to a sample in the range $18.8 < i_{mag} < 22.2$. The MAGLIM sample is divided into six tomographic bins using DNF $z_{mean}$ and considering the following bin edges: [0.2, 0.4, 0.55, 0.7, 0.85, 0.95, 1.05], with a total of a 10 716 506 galaxies, distributed across bins as summarized in Table 1. The MAGLIM sample is used as lens sample in the galaxy–galaxy lensing and galaxy clustering measurements of the DES Y3 2x2 cosmological analysis (Porredon et al. 2022).

### 2.2.1 DNF

The photo-z code DNF is used to define the MAGLIM selection and to define the MAGLIM tomographic bins. The DNF algorithm computes a point estimate $z_{mean}$ of redshift of the galaxies by performing a fit to a hyper-plane in colour and magnitude space using up to 80 nearest neighbours taken from a reference sample made of spectroscopic galaxies with secure redshift information. For this purpose, a large number of spectroscopic catalogues collected by Gschwend et al. (2018) has been used, including spectra from SDSS DR4 (Abolfathi et al. 2018), OzDES (Lidman et al. 2020), VIPERS (Garilli et al. 2014), and from the PAU spectro-photometric catalogue (Eriksen et al. 2019). The total number of spectra used for training is ~$10^5$. DNF also provides a redshift estimate $z_{DNF}$ drawn from the redshift PDF for each individual galaxy, although only the quantity $z_{mean}$ (used for the selection and for the binning) is of interest in this work.

## 2.3 Deep fields sample

The Deep fields catalogue is a key element of the SOMPZ methodology. We provide here a few key details, but we refer the reader to Hartley et al. (2022) for extensive details and the characterization of the sample.

This work uses four different deep fields, i.e. E2, X3, C3, and COSMOS (COS) covering 3.32, 3.29, 1.94, and 1.38 square degrees, respectively. Each deep field has undergone a scrupulous masking procedure aimed at removing artefacts (e.g. cosmic rays, meteors, saturated pixels, etc.). Considering the final unmasked area overlapping with the UltraVISTA and VIDEO near-infrared (NIR) surveys (McCracken et al. 2012; Jarvis et al. 2013), which is needed to provide photometric information in additional bands, we are left with 5.2 square degrees of area for a total of 267 229 galaxies with measured u, g, r, i, z, J, H, Ks photometry with limiting magnitudes 24.64, 25.57, 25.28, 24.66, 24.06, 24.02, 23.69, and 23.58. Note that

<footnote n="1">¹We exclude the g band as its photometry is known to be affected by PSF estimation issues (Jarvis et al. 2021).</footnote>
<figure><img src="image_1.png" /><figcaption>**Figure 1.** Scheme illustrating the operation of BALROG: the practically noiseless deep field galaxies are injected many times in the DES real wide field images; those dichotomous images are then processed through the fiducial DES detection pipeline, to construct a sample containing several noisy representations of the same deep galaxies.</figcaption></figure>

deep field galaxies have deeper photometry and photometry available in more bands compared to the wide field galaxies; this is key for a good performance of the SOMPZ method as it reduces the colour-redshift degeneracy.

## 2.4 BALROG sample

The BALROG sample is another key element of the SOMPZ methodology. It is used to relate galaxies with given deep photometry to observed galaxies with wide field photometry, which are noisier. To this aim we rely on BALROG (Suchyta et al. 2016), a software which injects ‘fake’ galaxies into real images. For this analysis, BALROG was used to inject deep field galaxies into the broader wide field footprint (Everett et al. 2022). After injecting galaxies into images, the output BALROG images are passed into the DES Y3 photometric pipeline and injected galaxies are detected equivalently to real galaxies, yielding multiple realizations of each injected galaxy. The BALROG sample spans ~20 per cent of the DES Y3 footprint. We further select injected galaxies using the MAGLIM selection. We then construct a matched catalogue matching BALROG injected wide field MAGLIM galaxies with their deep field counterparts, for a total of 351 165 galaxies with both deep and wide photometric information. The resulting catalogue is called the BALROG sample. Fig. 1 shows a schematic illustration of Balrog.

## 2.5 Redshift samples

The redshift samples used for the SOMPZ section of the analysis consist of galaxies with secure redshift information (either spectroscopic or high-quality multiband photometric) observed in the deep fields. These samples are key to characterize the redshifts of the deep field sample and, in turn, to transfer the redshift information to the wide field MAGLIM sample.

We consider three separate redshift selections, similarly to what has been used in source sample redshift characterization (Myles et al. 2021):

(i) a collection of spectra from a number of different public and private spectroscopic samples, from the spectroscopic compilation by Gschwend et al. (2018). We have not restricted ourselves to a few, selected surveys as in the case of the DES Y3 weak lensing sample (Myles et al. 2021), where only zCOSMOS (Lilly et al. 2009), C3R2 (Masters et al. 2017, 2019), VVDS (Le Fèvre et al. 2013), and VIPERS (Scodeggio et al. 2018) were considered, because due

<table><caption>**Table 2.** Number of unique galaxies belonging to each of the three redshift catalogues (spectroscopic collection, COSMOS, and PAU) for each of the samples SPC (composed by galaxies from spectra, PAU, COSMOS in this order), SC (spectra, COSMOS), PC (PAU, COSMOS). The sample selection for the MAGLIM sample applied to the corresponding BALROG injections reduces greatly the size of all samples. For more information, see Section 2.5.</caption><thead><tr><th rowspan="2"></th><th colspan="3">Raw</th><th colspan="3">After MagLim selection</th></tr><tr><th>SPC</th><th>SC</th><th>PC</th><th>SPC</th><th>SC</th><th>PC</th></tr></thead><tbody><tr><td>Spec-z</td><td>35 826</td><td>35 826</td><td>-</td><td>10 429</td><td>10 429</td><td>-</td></tr><tr><td>PAU</td><td>18 780</td><td>-</td><td>28 780</td><td>3950</td><td>-</td><td>7015</td></tr><tr><td>COSMOS</td><td>64 139</td><td>82 856</td><td>69 686</td><td>3299</td><td>7231</td><td>3721</td></tr><tr><td>Total</td><td>118 745</td><td>118 682</td><td>98 466</td><td>17 678</td><td>17 660</td><td>10 736</td></tr></tbody></table>

the bright nature of the MAGLIM sample we would mostly select high signal-to-noise galaxies. Furthermore, using more spectra from different surveys allows us to simultaneously reduce the shot noise and improve the completeness of the sample, while minimizing the impact of possible outliers;

(ii) multiband photo-z galaxies from the COSMOS field; in particular, we used the COSMOS2015 30-band photometric redshift catalogue (Laigle et al. 2016), which is equipped with narrow, intermediate, and broad-bands covering the IR, optical, and UV regions of the electromagnetic spectrum;

(iii) redshifts from the PAUS + COSMOS 66-band photometric redshift catalogue (Alarcon et al. 2021), which adds 40 narrow-band filters from the PAU Survey.

We match these redshift catalogues to our deep field galaxies and keep only those that are selected at least once into our MAGLIM selection according to their BALROG injections. Due to the bright nature of the MAGLIM sample, the number of galaxies in our final redshift samples is greatly reduced: for the SPC sample, for example, the unique total number of galaxies passes from 118 745 to 17 718, a reduction of around 85 per cent.

In some cases, the same galaxy might have redshift information from multiple surveys. Following Myles et al. (2021), we created three slightly different redshift samples, where in case of multiple information from different surveys we use as fiducial the redshift from a specific survey. The samples are:

(1) SPC, where in case of multiple information available we first use the spectroscopic catalogue (S), then PAUS + COSMOS (P), and finally COSMOS2015 (C);

(2) PC, where we rank first the PAUS + COSMOS catalogue before COSMOS2015, and we do not include spectroscopic redshifts;

(3) SC: where we first use the spectroscopic catalogue before COSMOS2015, but we do not include the PAUS + COSMOS catalogue.

Table 2 summarizes the number of unique galaxies appearing in each of the three redshift samples, before and after performing the MAGLIM sample selection. The fiducial ensemble of redshift distributions is generated by marginalizing over all three of these redshift samples (SPC, PC, SC) with equal prior, which in practice is achieved by simply merging the $n(z)$ samples produced from the three redshift samples, creating a three times larger pool of $n(z)$. In such a way we marginalize over potential uncertainties and biases in the different redshift catalogues (S, P, and C).
<figure><img src="image_3.png" /><figcaption>**Figure 1.** Scheme illustrating the operation of BALROG: the practically noiseless deep field galaxies are injected many times in the DES real wide field images; those dichotomous images are then processed through the fiducial DES detection pipeline, to construct a sample containing several noisy representations of the same deep galaxies.</figcaption></figure>

deep field galaxies have deeper photometry and photometry available in more bands compared to the wide field galaxies; this is key for a good performance of the SOMPZ method as it reduces the colour-redshift degeneracy.

## 2.4 BALROG sample

The BALROG sample is another key element of the SOMPZ methodology. It is used to relate galaxies with given deep photometry to observed galaxies with wide field photometry, which are noisier. To this aim we rely on BALROG (Suchyta et al. 2016), a software which injects ‘fake’ galaxies into real images. For this analysis, BALROG was used to inject deep field galaxies into the broader wide field footprint (Everett et al. 2022). After injecting galaxies into images, the output BALROG images are passed into the DES Y3 photometric pipeline and injected galaxies are detected equivalently to real galaxies, yielding multiple realizations of each injected galaxy. The BALROG sample spans ~20 per cent of the DES Y3 footprint. We further select injected galaxies using the MAGLIM selection. We then construct a matched catalogue matching BALROG injected wide field MAGLIM galaxies with their deep field counterparts, for a total of 351 165 galaxies with both deep and wide photometric information. The resulting catalogue is called the BALROG sample. Fig. 1 shows a schematic illustration of Balrog.

## 2.5 Redshift samples

The redshift samples used for the SOMPZ section of the analysis consist of galaxies with secure redshift information (either spectroscopic or high-quality multiband photometric) observed in the deep fields. These samples are key to characterize the redshifts of the deep field sample and, in turn, to transfer the redshift information to the wide field MAGLIM sample.

We consider three separate redshift selections, similarly to what has been used in source sample redshift characterization (Myles et al. 2021):

(i) a collection of spectra from a number of different public and private spectroscopic samples, from the spectroscopic compilation by Gschwend et al. (2018). We have not restricted ourselves to a few, selected surveys as in the case of the DES Y3 weak lensing sample (Myles et al. 2021), where only zCOSMOS (Lilly et al. 2009), C3R2 (Masters et al. 2017, 2019), VVDS (Le Fèvre et al. 2013), and VIPERS (Scodeggio et al. 2018) were considered, because due

<table><caption>**Table 2.** Number of unique galaxies belonging to each of the three redshift catalogues (spectroscopic collection, COSMOS, and PAU) for each of the samples SPC (composed by galaxies from spectra, PAU, COSMOS in this order), SC (spectra, COSMOS), PC (PAU, COSMOS). The sample selection for the MAGLIM sample applied to the corresponding BALROG injections reduces greatly the size of all samples. For more information, see Section 2.5.</caption><thead><tr><th rowspan="2"></th><th colspan="3">Raw</th><th colspan="3">After MagLim selection</th></tr><tr><th>SPC</th><th>SC</th><th>PC</th><th>SPC</th><th>SC</th><th>PC</th></tr></thead><tbody><tr><td>Spec-z</td><td>35 826</td><td>35 826</td><td>—</td><td>10 429</td><td>10 429</td><td>—</td></tr><tr><td>PAU</td><td>18 780</td><td>—</td><td>28 780</td><td>3950</td><td>—</td><td>7015</td></tr><tr><td>COSMOS</td><td>64 139</td><td>82 856</td><td>69 686</td><td>3299</td><td>7231</td><td>3721</td></tr><tr><td>Total</td><td>118 745</td><td>118 682</td><td>98 466</td><td>17 678</td><td>17 660</td><td>10 736</td></tr></tbody></table>

the bright nature of the MAGLIM sample we would mostly select high signal-to-noise galaxies. Furthermore, using more spectra from different surveys allows us to simultaneously reduce the shot noise and improve the completeness of the sample, while minimizing the impact of possible outliers;

(ii) multiband photo-z galaxies from the COSMOS field; in particular, we used the COSMOS2015 30-band photometric redshift catalogue (Laigle et al. 2016), which is equipped with narrow, intermediate, and broad-bands covering the IR, optical, and UV regions of the electromagnetic spectrum;

(iii) redshifts from the PAUS + COSMOS 66-band photometric redshift catalogue (Alarcon et al. 2021), which adds 40 narrow-band filters from the PAU Survey.

We match these redshift catalogues to our deep field galaxies and keep only those that are selected at least once into our MAGLIM selection according to their BALROG injections. Due to the bright nature of the MAGLIM sample, the number of galaxies in our final redshift samples is greatly reduced: for the SPC sample, for example, the unique total number of galaxies passes from 118 745 to 17 718, a reduction of around 85 per cent.

In some cases, the same galaxy might have redshift information from multiple surveys. Following Myles et al. (2021), we created three slightly different redshift samples, where in case of multiple information from different surveys we use as fiducial the redshift from a specific survey. The samples are:

(1) SPC, where in case of multiple information available we first use the spectroscopic catalogue (S), then PAUS + COSMOS (P), and finally COSMOS2015 (C);

(2) PC, where we rank first the PAUS + COSMOS catalogue before COSMOS2015, and we do not include spectroscopic redshifts;

(3) SC: where we first use the spectroscopic catalogue before COSMOS2015, but we do not include the PAUS + COSMOS catalogue.

Table 2 summarizes the number of unique galaxies appearing in each of the three redshift samples, before and after performing the MAGLIM sample selection. The fiducial ensemble of redshift distributions is generated by marginalizing over all three of these redshift samples (SPC, PC, SC) with equal prior, which in practice is achieved by simply merging the $n(z)$ samples produced from the three redshift samples, creating a three times larger pool of $n(z)$. In such a way we marginalize over potential uncertainties and biases in the different redshift catalogues (S, P, and C).
<table><caption>**Table 3.** List of the spectroscopic samples from BOSS/eBOSS overlapping with the DES Y3 footprint used as reference galaxies for clustering redshifts in this work.</caption><thead><tr><th colspan="4">Spectroscopic samples</th></tr><tr><th>Name</th><th>Redshifts</th><th>N<sub>gal</sub></th><th>Area</th></tr></thead><tbody><tr><td>LOWZ (BOSS)</td><td>z ∈ [0.0, 0.5]</td><td>45 671</td><td>~860 deg<sup>2</sup></td></tr><tr><td>CMASS (BOSS)</td><td>z ∈ [0.35, 0.8]</td><td>74 186</td><td>~860 deg<sup>2</sup></td></tr><tr><td>LRG (eBOSS)</td><td>z ∈ [0.6, 1.0]</td><td>24 404</td><td>~700 deg<sup>2</sup></td></tr><tr><td>ELG (eBOSS)</td><td>z ∈ [0.6, 1.1]</td><td>89 967</td><td>~620 deg<sup>2</sup></td></tr><tr><td>QSO (eBOSS)</td><td>z ∈ [0.8, 1.1]</td><td>7759</td><td>~700 deg<sup>2</sup></td></tr></tbody></table>

## 2.6 BOSS/eBOSS galaxy catalogues

The BOSS/eBOSS galaxy catalogue is our reference sample for the WZ measurement. It consists of a number of spectroscopic samples from the Sloan Digital Sky Survey (SDSS, Gunn et al. 2006; Eisenstein et al. 2011; Blanton et al. 2017), and combines SDSS galaxies from Baryonic Oscillation Spectroscopic Survey (BOSS, Dawson et al. 2013; Smee et al. 2013) and from extended-Baryon Oscillation Spectroscopic Survey (eBOSS, Dawson et al. 2016; Ahumada et al. 2020; Alam et al. 2021). In particular, the BOSS sample includes the LOWZ and CMASS catalogues from the SDSS DR 12 (Reid et al. 2016), while we included the large-scale structure catalogues from emission-line galaxies (ELGs, Raichoor et al. 2017), luminous red galaxies (LRGs, Prakash et al. 2016), and quasi-stellar objects (QSOs) (in preparation) from eBOSS. Following Cawthon et al. (2022) and Gatti et al. (2022), we stack together the different samples and use them as a single reference sample. We also create a single random catalogue by stacking all the random catalogues of each individual samples. The BOSS/eBOSS sample is divided into 50 bins spanning the 0.1 < z < 1.1 range of the catalogue (width Δz = 0.02). The number of galaxies for each sample is listed in Table 3, with the final sample consisting of 241 987 objects and covering an area ranging from 14 to 17 per cent of the total DES footprint.

We note that estimates of the magnification coefficients are not available for BOSS/eBOSS galaxies. For our fiducial analysis we assumed magnification values for the BOSS/eBOSS sample to be set to zero. We are confident about this choice for the narrow shape of the MAGLIM tomographic bins, since the magnification is usually significant in the tails of the distribution when the clustering kernel due to selection effects is larger. We none the less verify in this work that our analysis is not very sensitive to the particular choice of the values of the magnification parameters (see Section 6.1.2).

## 2.7 Weak lensing catalogue

The DES Y3 WL sample is used in this work as a source in the galaxy–galaxy lensing measurement with the MAGLIM sample. The WL sample is created using the METACALIBRATION pipeline (described and tested in Huff & Mandelbaum 2017 and Sheldon & Huff 2017 and applied to the Y3 data in Gatti et al. 2021) and it is a subset of the gold catalogue. The METACALIBRATION pipeline provides a per-galaxy self-calibrated shape measurement, which is free from shear and selection biases. An additional, small calibration based on image simulations (MacCrann et al. 2022) accounts for blending and detection biases. The final catalogue consists of ~100 million galaxies, spanning the full DES Y3 wide field footprint and with an effective number density of $n_{eff} = 5.59$ gal arcmin$^{-2}$. The WL sample is divided into four tomographic bin using the SOMPZ method (Myles et al. 2021).

## 2.8 Simulated galaxy catalogues

Our methodology is thoroughly validated using simulated catalogues. In particular, we use one realization of the sets of the Buzzard N-body simulations (DeRose et al. 2022). All the catalogues we used in data have their simulated counterparts, although we adopted some reasonable simplifications, when needed. We give here a brief summary of the Buzzard simulation and the simulated catalogue we had to create for this project, i.e. the simulated MAGLIM sample. The simulated BOSS/eBOSS catalogue description is provided in Gatti et al. (2022), whereas the simulated WL sample is described in DeRose et al. (2022).

Buzzard is a synthetic galaxy catalogue built starting from N-body light-cones produced by L-GADGET2 (Springel 2005). Galaxies are incorporated in the dark matter light-cones using the ADDGALS algorithm (DeRose et al. 2019). Buzzard spans 10 313 square degrees. The cosmological parameters chosen are $\Omega_m = 0.286$, $\sigma_8 = 0.82$, $\Omega_b = 0.047$, $n_s = 0.96$, $h = 0.7$. The simulations are created starting from three light-cones with different resolutions and size (1050$^3$, 2600$^3$, and 4000$^3$ Mpc$^3 h^{-3}$ boxes and 1400$^3$, 2048$^3$, and 2048$^3$ particles), to accommodate the need of a larger box at high redshift. Haloes are identified using the public code ROCKSTAR (Behroozi, Wechsler & Wu 2013) and they are populated with galaxies using ADDGALS (DeRose et al. 2019), which provides positions, velocities, magnitudes, spectral energy distributions (SEDs), and ellipticities. Galaxies are assigned their properties based on the relation between redshift, r-band absolute magnitude, and large-scale density from a subhalo abundance matching model (Conroy, Wechsler & Kravtsov 2006; Lehmann et al. 2017) in higher resolution N-body simulations. SEDs are assigned to galaxies by imposing the matching with the SED–luminosity–density relationship measured in the SDSS data. SEDs are K-corrected and integrated over the DES filter bands to generate DES grizY magnitudes. Ray-tracing is performed through the CALCLENS algorithm (Becker 2013), to introduce lensing effects, in order to provide weak-lensing shear, magnification, and lensed galaxy positions for the light-cone outputs. CALCLENS is run on to the sphere, masked with the DES Y3 footprint, using the HEALPIX algorithm (Górski & Hivon 2011) and is accurate to ~6.4 arcsec.

### 2.8.1 Simulated MAGLIM sample

In order to define a simulated MAGLIM sample, the photo-z code DNF has been run on a subset of the Buzzard simulations, restricted to i-band magnitudes $i < 23$, so as to reduce the running time without affecting the final result (note that the MAGLIM selection presents a cut at $i < 22.2$). The goal is to attain similar number density and colour distributions as in data. We provide more detailed information on the adaptation to the sample selection for Buzzard in Appendix A.

### 2.8.2 Simulated deep catalogue

The simulated true fluxes from Buzzard are used as the deep measurements, but we further assign a realistic error using the limiting flux for each mock deep band. We use the same uncertainties as in data, but as the Buzzard simulation has a different zero-point, those values have to be converted in magnitude using zero-point of 30, and then is converted to a flux uncertainty for a zero-point of 22.5, which is the zero-point of the Buzzard fluxes. We do not differentiate between fields, as it has been proven in Myles et al. (2021) that this had no impact on the simulated redshift distribution. The size of the sample is 968 759 galaxies. We use the true redshift for the redshift
<table><caption>**Table 3.** List of the spectroscopic samples from BOSS/eBOSS overlapping with the DES Y3 footprint used as reference galaxies for clustering redshifts in this work.</caption><thead><tr><th colspan="4">Spectroscopic samples</th></tr><tr><th>Name</th><th>Redshifts</th><th>N<sub>gal</sub></th><th>Area</th></tr></thead><tbody><tr><td>LOWZ (BOSS)</td><td>z &isin; [0.0, 0.5]</td><td>45 671</td><td>~860 deg<sup>2</sup></td></tr><tr><td>CMASS (BOSS)</td><td>z &isin; [0.35, 0.8]</td><td>74 186</td><td>~860 deg<sup>2</sup></td></tr><tr><td>LRG (eBOSS)</td><td>z &isin; [0.6, 1.0]</td><td>24 404</td><td>~700 deg<sup>2</sup></td></tr><tr><td>ELG (eBOSS)</td><td>z &isin; [0.6, 1.1]</td><td>89 967</td><td>~620 deg<sup>2</sup></td></tr><tr><td>QSO (eBOSS)</td><td>z &isin; [0.8, 1.1]</td><td>7759</td><td>~700 deg<sup>2</sup></td></tr></tbody></table>

## 2.6 BOSS/eBOSS galaxy catalogues

The BOSS/eBOSS galaxy catalogue is our reference sample for the WZ measurement. It consists of a number of spectroscopic samples from the Sloan Digital Sky Survey (SDSS, Gunn et al. 2006; Eisenstein et al. 2011; Blanton et al. 2017), and combines SDSS galaxies from Baryonic Oscillation Spectroscopic Survey (BOSS, Dawson et al. 2013; Smee et al. 2013) and from extended-Baryon Oscillation Spectroscopic Survey (eBOSS, Dawson et al. 2016; Ahumada et al. 2020; Alam et al. 2021). In particular, the BOSS sample includes the LOWZ and CMASS catalogues from the SDSS DR 12 (Reid et al. 2016), while we included the large-scale structure catalogues from emission-line galaxies (ELGs, Raichoor et al. 2017), luminous red galaxies (LRGs, Prakash et al. 2016), and quasi-stellar objects (QSOs) (in preparation) from eBOSS. Following Cawthon et al. (2022) and Gatti et al. (2022), we stack together the different samples and use them as a single reference sample. We also create a single random catalogue by stacking all the random catalogues of each individual samples. The BOSS/eBOSS sample is divided into 50 bins spanning the 0.1 < z < 1.1 range of the catalogue (width Δz = 0.02). The number of galaxies for each sample is listed in Table 3, with the final sample consisting of 241 987 objects and covering an area ranging from 14 to 17 per cent of the total DES footprint.

We note that estimates of the magnification coefficients are not available for BOSS/eBOSS galaxies. For our fiducial analysis we assumed magnification values for the BOSS/eBOSS sample to be set to zero. We are confident about this choice for the narrow shape of the MAGLIM tomographic bins, since the magnification is usually significant in the tails of the distribution when the clustering kernel due to selection effects is larger. We none the less verify in this work that our analysis is not very sensitive to the particular choice of the values of the magnification parameters (see Section 6.1.2).

## 2.7 Weak lensing catalogue

The DES Y3 WL sample is used in this work as a source in the galaxy–galaxy lensing measurement with the MAGLIM sample. The WL sample is created using the METACALIBRATION pipeline (described and tested in Huff & Mandelbaum 2017 and Sheldon & Huff 2017 and applied to the Y3 data in Gatti et al. 2021) and it is a subset of the gold catalogue. The METACALIBRATION pipeline provides a per-galaxy self-calibrated shape measurement, which is free from shear and selection biases. An additional, small calibration based on image simulations (MacCrann et al. 2022) accounts for blending and detection biases. The final catalogue consists of ~100 million galaxies, spanning the full DES Y3 wide field footprint and with an effective number density of $n_{eff} = 5.59$ gal arcmin$^{-2}$. The WL sample is divided into four tomographic bin using the SOMPZ method (Myles et al. 2021).

## 2.8 Simulated galaxy catalogues

Our methodology is thoroughly validated using simulated catalogues. In particular, we use one realization of the sets of the Buzzard N-body simulations (DeRose et al. 2022). All the catalogues we used in data have their simulated counterparts, although we adopted some reasonable simplifications, when needed. We give here a brief summary of the Buzzard simulation and the simulated catalogue we had to create for this project, i.e. the simulated MAGLIM sample. The simulated BOSS/eBOSS catalogue description is provided in Gatti et al. (2022), whereas the simulated WL sample is described in DeRose et al. (2022).

Buzzard is a synthetic galaxy catalogue built starting from N-body light-cones produced by L-GADGET2 (Springel 2005). Galaxies are incorporated in the dark matter light-cones using the ADDGALS algorithm (DeRose et al. 2019). Buzzard spans 10 313 square degrees. The cosmological parameters chosen are $\Omega_m = 0.286$, $\sigma_8 = 0.82$, $\Omega_b = 0.047$, $n_s = 0.96$, $h = 0.7$. The simulations are created starting from three light-cones with different resolutions and size (1050$^3$, 2600$^3$, and 4000$^3$ Mpc$^3 h^{-3}$ boxes and 1400$^3$, 2048$^3$, and 2048$^3$ particles), to accommodate the need of a larger box at high redshift. Haloes are identified using the public code ROCKSTAR (Behroozi, Wechsler & Wu 2013) and they are populated with galaxies using ADDGALS (DeRose et al. 2019), which provides positions, velocities, magnitudes, spectral energy distributions (SEDs), and ellipticities. Galaxies are assigned their properties based on the relation between redshift, r-band absolute magnitude, and large-scale density from a subhalo abundance matching model (Conroy, Wechsler & Kravtsov 2006; Lehmann et al. 2017) in higher resolution N-body simulations. SEDs are assigned to galaxies by imposing the matching with the SED–luminosity–density relationship measured in the SDSS data. SEDs are K-corrected and integrated over the DES filter bands to generate DES grizY magnitudes. Ray-tracing is performed through the CALCLENS algorithm (Becker 2013), to introduce lensing effects, in order to provide weak-lensing shear, magnification, and lensed galaxy positions for the light-cone outputs. CALCLENS is run on to the sphere, masked with the DES Y3 footprint, using the HEALPIX algorithm (Górski & Hivon 2011) and is accurate to ~6.4 arcsec.

### 2.8.1 Simulated MAGLIM sample

In order to define a simulated MAGLIM sample, the photo-z code DNF has been run on a subset of the Buzzard simulations, restricted to i-band magnitudes $i < 23$, so as to reduce the running time without affecting the final result (note that the MAGLIM selection presents a cut at $i < 22.2$). The goal is to attain similar number density and colour distributions as in data. We provide more detailed information on the adaptation to the sample selection for Buzzard in Appendix A.

### 2.8.2 Simulated deep catalogue

The simulated true fluxes from Buzzard are used as the deep measurements, but we further assign a realistic error using the limiting flux for each mock deep band. We use the same uncertainties as in data, but as the Buzzard simulation has a different zero-point, those values have to be converted in magnitude using zero-point of 30, and then is converted to a flux uncertainty for a zero-point of 22.5, which is the zero-point of the Buzzard fluxes. We do not differentiate between fields, as it has been proven in Myles et al. (2021) that this had no impact on the simulated redshift distribution. The size of the sample is 968 759 galaxies. We use the true redshift for the redshift
sample and to compare our inferred redshift distributions to the true ones.

### 2.8.3 Simulated BALROG catalogue

We mimic the BALROG algorithm by randomly selecting positions over the full Y3 footprint and run the corresponding error model on the galaxies of the simulated deep catalogue to obtain noisy versions, according to the exposure times of each location. The deep galaxies can be injected an arbitrary number of times and we set this at 10. Only the wide counterparts of the deep galaxies that respect the MAGLIM selection defined in the Buzzard simulation are then included in the sample, yielding the final number of 250 193 galaxies.

## 3 REDSHIFT INFERENCE METHODOLOGY

We describe in this section the methodology adopted in this work to infer the redshift distributions of the lens sample. The methodology is similar to the one adopted for the weak lensing sample (Myles et al. 2021) and relies on two key techniques:

(i) photometric classification with self-organizing maps (SOM), known as the SOMPZ method (Buchs et al. 2019; Myles et al. 2021). The SOMPZ method takes advantage of the deeper photometry of eight bands (ugrizJHKs) available in the DES deep fields, where galaxies with high-quality redshifts can be accurately classified in the deep colour space, to ensure small selection biases, and well-characterized redshift estimates and uncertainties of DES wide field galaxies;

(ii) clustering-based or clustering redshift techniques (WZ), more established in cosmology (Newman 2008; Ménard et al. 2013). The redshift distributions calibration is based on angular correlation with a reference sample with high-quality redshift estimates. This method is affected by systematic biases different than photometric methods, which makes this combination interesting and improves the robustness of our redshift estimates. For example, it does not require the spectroscopic sample used for calibration to be representative of the target sample. On the other hand, the galaxy bias evolution of the galaxy samples is involved, and magnification effects have to be taken into account.

These two techniques are combined together to provide an estimate of the redshift distributions of the lens sample. Such a combination is powerful because it exploits the complementarity of the two methods, which are affected by two very different sets of biases and uncertainties. We provide the key ingredients of these two techniques in the following sections, followed by a description of how the two are combined together.

We note that this method is an alternate method compared to the one presented in Porredon et al. (2022) and Cawthon et al. (2022), which provides redshift estimates combining photometric estimates from the photo-z code DNF (De Vicente et al. 2016) and clustering constraints from Cawthon et al. (2022). We delay the comparison between the two methods to Section 5.1. Fig. 2 presents a flowchart illustration of MagLim redshift distributions calibration scheme.

### 3.1 SOMPZ methodology

The SOMPZ methodology estimates wide field redshift distributions by exploiting a mapping between wide field galaxies and deep field galaxies with deeper and more precise photometry. Extracting the redshift information from deep, several band photometry in order

to estimate the redshift of an observed wide field galaxy amounts to marginalizing over deep photometric information (Buchs et al. 2019). Let us consider the probability distribution function for the redshift of a galaxy $p(z)$; let us assume such a probability to be conditioned on observed wide field colour-magnitude $\hat{x}$ and covariance matrix $\hat{\Sigma}$. The probability can be written by marginalizing over deep photometric colour $\mathbf{x}$ as follows:

$$p(z|\hat{\mathbf{x}}, \hat{\mathbf{\Sigma}}) = \int d\mathbf{x} p(z|\mathbf{x}, \hat{\mathbf{x}}, \hat{\mathbf{\Sigma}}) p(\mathbf{x}|\hat{\mathbf{x}}, \hat{\mathbf{\Sigma}}). \quad (2)$$

The large dimensionality of this form prevents us from applying it to real situations. This problem can be circumvented by discretizing the colour space $\mathbf{x}$ and $(\hat{\mathbf{x}}, \hat{\mathbf{\Sigma}})$ in cells $c$ and $\hat{c}$, each spanning a portion of the whole and representing a specific galaxy phenotype, respectively, of the deep and wide field. The galaxy samples are arranged in cells/phenotypes using SOM (Kohonen 1982), which is an unsupervised machine learning technique used to produce a lower dimensional representation of a complex data set, while preserving its core properties. The choice of the topology of the cells follows Buchs et al. (2019), where a two-dimensional representation of the colour space was chosen as it ensures an immediate visualization of the data not possible otherwise. Once we compressed our data in a more manageable set of information, we can write the $p(z)$ for the group of galaxies living in a particular wide cell $\hat{c}$. Since the MAGLIM tomographic bins $\hat{b}$ are already defined, we are going to construct one set of SOMs (one deep and one wide) for each bin. Assigning all galaxies belonging to a tomographic bin to a wide SOM is straightforward. In order to construct the deep SOM we have to use our BALROG sample, consisting of all detected and selected BALROG realizations of the galaxies in the wide field, each associated with its own ‘noiseless’ replica in the deep sample. We therefore can assign to the deep SOM associated with a tomographic bin, galaxies whose BALROG wide replica is selected in that specific wide bin. Therefore, we can marginalize over deep field phenotypes $c$ as

$$p(z|\hat{c}, \hat{b}) = \sum_{c} p(z|c, \hat{c}, \hat{b}) p(c|\hat{c}, \hat{b}). \quad (3)$$

At this point we want to marginalize over all wide cells $\hat{c}$ belonging to each tomographic bin. Again, we are computing $p(z|\hat{b})$ for each bin separately from different sets of SOMs:

$$p(z|\hat{b}) \approx \sum_{\hat{c}} \sum_{c} p(z|c, \hat{c}, \hat{b}) p(c|\hat{c}, \hat{b}) p(\hat{c}, \hat{b}). \quad (4)$$

Unfortunately there are very few galaxies for each $(c, \hat{c})$ pair, and in many cases there are none. This makes the term $p(z|c, \hat{c})$ quite difficult to estimate. However, we can reasonably assume that the $p(z)$ for galaxies assigned to a given deep cell $c$ should not depend on the noisy wide photometry of that galaxy. Therefore, we can relax the selection:

$$p(z|\hat{b}) \approx \sum_{\hat{c}} \sum_{c} p(z|c, \hat{b}) p(c|\hat{c}, \hat{b}) p(\hat{c}, \hat{b}). \quad (5)$$

We use this approximation for our fiducial result. We obtain each of the terms appearing in equation (3.1) by placing galaxy samples to the SOM cells, as follows:

(i) $p(\hat{c})$ is computed collecting wide field galaxies from the MAGLIM sample into a wide field SOM (one per tomographic bin);

(ii) $p(c|\hat{c})$ is computed from the deep/BALROG sample. It consists of all detected and selected BALROG replicas of the deep galaxies injected in the wide field. We therefore can arrange the deep/BALROG sample simultaneously into a wide and deep SOMs. We call this term the transfer function. We weight the deep field galaxies according
sample and to compare our inferred redshift distributions to the true ones.

### 2.8.3 Simulated BALROG catalogue

We mimic the BALROG algorithm by randomly selecting positions over the full Y3 footprint and run the corresponding error model on the galaxies of the simulated deep catalogue to obtain noisy versions, according to the exposure times of each location. The deep galaxies can be injected an arbitrary number of times and we set this at 10. Only the wide counterparts of the deep galaxies that respect the MAGLIM selection defined in the Buzzard simulation are then included in the sample, yielding the final number of 250 193 galaxies.

## 3 REDSHIFT INFERENCE METHODOLOGY

We describe in this section the methodology adopted in this work to infer the redshift distributions of the lens sample. The methodology is similar to the one adopted for the weak lensing sample (Myles et al. 2021) and relies on two key techniques:

(i) photometric classification with self-organizing maps (SOM), known as the SOMPZ method (Buchs et al. 2019; Myles et al. 2021). The SOMPZ method takes advantage of the deeper photometry of eight bands (ugrizJHKs) available in the DES deep fields, where galaxies with high-quality redshifts can be accurately classified in the deep colour space, to ensure small selection biases, and well-characterized redshift estimates and uncertainties of DES wide field galaxies;

(ii) clustering-based or clustering redshift techniques (WZ), more established in cosmology (Newman 2008; Ménard et al. 2013). The redshift distributions calibration is based on angular correlation with a reference sample with high-quality redshift estimates. This method is affected by systematic biases different than photometric methods, which makes this combination interesting and improves the robustness of our redshift estimates. For example, it does not require the spectroscopic sample used for calibration to be representative of the target sample. On the other hand, the galaxy bias evolution of the galaxy samples is involved, and magnification effects have to be taken into account.

These two techniques are combined together to provide an estimate of the redshift distributions of the lens sample. Such a combination is powerful because it exploits the complementarity of the two methods, which are affected by two very different sets of biases and uncertainties. We provide the key ingredients of these two techniques in the following sections, followed by a description of how the two are combined together.

We note that this method is an alternate method compared to the one presented in Porredon et al. (2022) and Cawthon et al. (2022), which provides redshift estimates combining photometric estimates from the photo-z code DNF (De Vicente et al. 2016) and clustering constraints from Cawthon et al. (2022). We delay the comparison between the two methods to Section 5.1. Fig. 2 presents a flowchart illustration of MagLim redshift distributions calibration scheme.

### 3.1 SOMPZ methodology

The SOMPZ methodology estimates wide field redshift distributions by exploiting a mapping between wide field galaxies and deep field galaxies with deeper and more precise photometry. Extracting the redshift information from deep, several band photometry in order

to estimate the redshift of an observed wide field galaxy amounts to marginalizing over deep photometric information (Buchs et al. 2019). Let us consider the probability distribution function for the redshift of a galaxy $p(z)$; let us assume such a probability to be conditioned on observed wide field colour–magnitude $\hat{x}$ and covariance matrix $\hat{\Sigma}$. The probability can be written by marginalizing over deep photometric colour $\mathbf{x}$ as follows:

$$p(z|\hat{\mathbf{x}}, \hat{\Sigma}) = \int d\mathbf{x} p(z|\mathbf{x}, \hat{\mathbf{x}}, \hat{\Sigma}) p(\mathbf{x}|\hat{\mathbf{x}}, \hat{\Sigma}). \quad (2)$$

The large dimensionality of this form prevents us from applying it to real situations. This problem can be circumvented by discretizing the colour space $\mathbf{x}$ and $(\hat{\mathbf{x}}, \hat{\Sigma})$ in cells $c$ and $\hat{c}$, each spanning a portion of the whole and representing a specific galaxy phenotype, respectively, of the deep and wide field. The galaxy samples are arranged in cells/phenotypes using SOM (Kohonen 1982), which is an unsupervised machine learning technique used to produce a lower dimensional representation of a complex data set, while preserving its core properties. The choice of the topology of the cells follows Buchs et al. (2019), where a two-dimensional representation of the colour space was chosen as it ensures an immediate visualization of the data not possible otherwise. Once we compressed our data in a more manageable set of information, we can write the $p(z)$ for the group of galaxies living in a particular wide cell $\hat{c}$. Since the MAGLIM tomographic bins $\hat{b}$ are already defined, we are going to construct one set of SOMs (one deep and one wide) for each bin. Assigning all galaxies belonging to a tomographic bin to a wide SOM is straightforward. In order to construct the deep SOM we have to use our BALROG sample, consisting of all detected and selected BALROG realizations of the galaxies in the wide field, each associated with its own ‘noiseless’ replica in the deep sample. We therefore can assign to the deep SOM associated with a tomographic bin, galaxies whose BALROG wide replica is selected in that specific wide bin. Therefore, we can marginalize over deep field phenotypes $c$ as

$$p(z|\hat{c}, \hat{b}) = \sum_{c} p(z|c, \hat{c}, \hat{b}) p(c|\hat{c}, \hat{b}). \quad (3)$$

At this point we want to marginalize over all wide cells $\hat{c}$ belonging to each tomographic bin. Again, we are computing $p(z|\hat{b})$ for each bin separately from different sets of SOMs:

$$p(z|\hat{b}) \approx \sum_{\hat{c}} \sum_{c} p(z|c, \hat{c}, \hat{b}) p(c|\hat{c}, \hat{b}) p(\hat{c}, \hat{b}). \quad (4)$$

Unfortunately there are very few galaxies for each $(c, \hat{c})$ pair, and in many cases there are none. This makes the term $p(z|c, \hat{c})$ quite difficult to estimate. However, we can reasonably assume that the $p(z)$ for galaxies assigned to a given deep cell $c$ should not depend on the noisy wide photometry of that galaxy. Therefore, we can relax the selection:

$$p(z|\hat{b}) \approx \sum_{\hat{c}} \sum_{c} p(z|c, \hat{b}) p(c|\hat{c}, \hat{b}) p(\hat{c}, \hat{b}). \quad (5)$$

We use this approximation for our fiducial result. We obtain each of the terms appearing in equation (3.1) by placing galaxy samples to the SOM cells, as follows:

(i) $p(\hat{c})$ is computed collecting wide field galaxies from the MAGLIM sample into a wide field SOM (one per tomographic bin);

(ii) $p(c|\hat{c})$ is computed from the deep/BALROG sample. It consists of all detected and selected BALROG replicas of the deep galaxies injected in the wide field. We therefore can arrange the deep/BALROG sample simultaneously into a wide and deep SOMs. We call this term the transfer function. We weight the deep field galaxies according
<figure><img src="image_2.png" /><figcaption>**Figure 2.** Flowchart illustrating the MAGLIM redshift distributions calibration scheme. The two methodologies included in the analysis are SOMPZ and clustering redshifts, which are inspired by the flowchart in Myles et al. (2021).</figcaption></figure>

to their detection rate measured from BALROG. An alternative to BALROG would be using a subsection of the wide field and deep fields overlap, giving us both deep and wide photometry for a limited number of galaxies. However, the area of overlap is small and the particular observing conditions found in this area will not be representative of the overall observing conditions found in the Y3 footprint as highlighted in Myles et al. (2021).

(iii) $p(z|c)$ is computed from the redshift sample, which is a subset of the deep sample, for which we have both credible redshifts, eight-band deep photometry, and due to BALROG also wide-field realizations.

### 3.1.1 SOM properties

As in Buchs et al. (2019) and Myles et al. (2021), we use squared-shaped SOMs with $n$ cells for each side (for a total of $n \times n$ cells) and periodic boundaries, which makes the visualization easier without compromising the efficiency. We parametrize the SOMs using luptitudes and lupticolours, following Buchs et al. (2019). Luptitudes are defined in Lupton, Gunn & Szalay (1999) as inverse hyperbolic sine transformation of fluxes:

$$ \mu = \mu_0 - a \sinh^{-1} \frac{f}{2b} \qquad \mu_0 = m_0 - 2.5 \log b, \qquad (6) $$

where $m$ are magnitudes, $f$ are fluxes, $a = 2.5 \log b$, and $b$ is a softening parameter that defines at which scale luptitudes transition between logarithmic and linear behaviour. For the deep SOM we compute seven lupticolours with respect to the $i$ band

$$ \mu = (\mu_1 - \mu_i, \dots, \mu_7 - \mu_i), \qquad (7) $$

where the index from one to seven runs over the deep bands *urgzJHK*. We avoid using the $g$ band for the wide field galaxies, as any observational systematics and chromatic effects are more evident in the $g$ band. With only two lupticolours available in the wide SOM, we decided to add the $i$-band luptitude, as Buchs et al. (2019) find empirically that addition of the luptitude improves the training

performance:

$$ \mu = (\mu_i, \mu_r - \mu_i, \mu_z - \mu_i). \qquad (8) $$

The resolutions of the SOMs are 32x32 cells for the wide, and 12x12 cells for the deep. The reason behind the fewer cells in the deep SOM lies in the MAGLIM selection: the bright magnitude–redshift cuts must be applied also to the wide-component of the deep and redshift samples, and only the deep galaxies whose wide component is selected are included in the sample. This results in smaller deep and redshift samples covering a very small portion of the colour space, compared to the weak lensing source sample Myles et al. (2021). Also, reducing the number of cells means yielding more galaxies in each one. This is necessary in order to minimize the number of wide field galaxies assigned by the transfer function to a deep SOM cell with no redshift information. Reducing this number under 1 per cent is crucial to ensure that we get a correctly estimated redshift distribution for our sample. We note that shot noise caused by a small number of redshifts in a deep cell can play a significant role in biasing the estimate. We therefore performed a test to identify the optimal SOM size which would minimize these issues. We first computed several estimates in the Buzzard simulations using different resolutions for the deep SOM. We then evaluated which setting produced the smallest shift on the mean redshift with respect to the true value. As mentioned at the beginning of this section, SOMs require to be trained before being able to classify galaxies. After ensuring that the redshift samples and the MAGLIM sample span the same luptitude–lupticolour space (achieved using BALROG to obtain the redshift samples wide photometry), we decided to use the redshift sample for the deep SOM training. We instead use the MAGLIM sample itself to train the wide SOM.

## 3.2 WZ

Clustering redshift is a widely used method (Newman 2008; Ménard et al. 2013; Davis et al. 2017; Johnson et al. 2017; Morrison et al. 2017; Gatti et al. 2018, 2022; Scottez et al. 2018; van den Busch et al. 2020; Hildebrandt et al. 2021; Cawthon et al. 2022) to infer
<figure><img src="image_4.png" /><figcaption>**Figure 2.** Flowchart illustrating the MAGLIM redshift distributions calibration scheme. The two methodologies included in the analysis are SOMPZ and clustering redshifts, which are inspired by the flowchart in Myles et al. (2021).</figcaption></figure>

to their detection rate measured from BALROG. An alternative to BALROG would be using a subsection of the wide field and deep fields overlap, giving us both deep and wide photometry for a limited number of galaxies. However, the area of overlap is small and the particular observing conditions found in this area will not be representative of the overall observing conditions found in the Y3 footprint as highlighted in Myles et al. (2021).

(iii) $p(z|c)$ is computed from the redshift sample, which is a subset of the deep sample, for which we have both credible redshifts, eight-band deep photometry, and due to BALROG also wide-field realizations.

### 3.1.1 SOM properties

As in Buchs et al. (2019) and Myles et al. (2021), we use squared-shaped SOMs with $n$ cells for each side (for a total of $n \times n$ cells) and periodic boundaries, which makes the visualization easier without compromising the efficiency. We parametrize the SOMs using luptitudes and lupticolours, following Buchs et al. (2019). Luptitudes are defined in Lupton, Gunn & Szalay (1999) as inverse hyperbolic sine transformation of fluxes:

$$ \mu = \mu_0 - a \sinh^{-1} \frac{f}{2b} \qquad \mu_0 = m_0 - 2.5 \log b, \qquad (6) $$

where $m$ are magnitudes, $f$ are fluxes, $a = 2.5 \log b$, and $b$ is a softening parameter that defines at which scale luptitudes transition between logarithmic and linear behaviour. For the deep SOM we compute seven lupticolours with respect to the $i$ band

$$ \mu = (\mu_1 - \mu_i, \dots, \mu_7 - \mu_i), \qquad (7) $$

where the index from one to seven runs over the deep bands *urgzJHK*. We avoid using the $g$ band for the wide field galaxies, as any observational systematics and chromatic effects are more evident in the $g$ band. With only two lupticolours available in the wide SOM, we decided to add the $i$-band luptitude, as Buchs et al. (2019) find empirically that addition of the luptitude improves the training

performance:

$$ \mu = (\mu_i, \mu_r - \mu_i, \mu_z - \mu_i). \qquad (8) $$

The resolutions of the SOMs are 32x32 cells for the wide, and 12x12 cells for the deep. The reason behind the fewer cells in the deep SOM lies in the MAGLIM selection: the bright magnitude–redshift cuts must be applied also to the wide-component of the deep and redshift samples, and only the deep galaxies whose wide component is selected are included in the sample. This results in smaller deep and redshift samples covering a very small portion of the colour space, compared to the weak lensing source sample Myles et al. (2021). Also, reducing the number of cells means yielding more galaxies in each one. This is necessary in order to minimize the number of wide field galaxies assigned by the transfer function to a deep SOM cell with no redshift information. Reducing this number under 1 per cent is crucial to ensure that we get a correctly estimated redshift distribution for our sample. We note that shot noise caused by a small number of redshifts in a deep cell can play a significant role in biasing the estimate. We therefore performed a test to identify the optimal SOM size which would minimize these issues. We first computed several estimates in the Buzzard simulations using different resolutions for the deep SOM. We then evaluated which setting produced the smallest shift on the mean redshift with respect to the true value. As mentioned at the beginning of this section, SOMs require to be trained before being able to classify galaxies. After ensuring that the redshift samples and the MAGLIM sample span the same luptitude–lupticolour space (achieved using BALROG to obtain the redshift samples wide photometry), we decided to use the redshift sample for the deep SOM training. We instead use the MAGLIM sample itself to train the wide SOM.

## 3.2 WZ

Clustering redshift is a widely used method (Newman 2008; Ménard et al. 2013; Davis et al. 2017; Johnson et al. 2017; Morrison et al. 2017; Gatti et al. 2018, 2022; Scottez et al. 2018; van den Busch et al. 2020; Hildebrandt et al. 2021; Cawthon et al. 2022) to infer
or calibrate redshift distributions of galaxy samples. It relies on the assumption that the cross-correlation between two samples of objects is non-zero only in the case of overlap of the distribution of objects in physical space, due to their mutual gravitational influence.

Various implementations of the clustering redshift methodology differ in their details, but they all agree on one key aspect: the ‘target’ sample (hereafter dubbed ‘unknown’ sample), which has to be calibrated, has to be cross-correlated with a ‘reference’ sample divided into thin redshift bins. The reference sample consists of either high-quality photometric or spectroscopic redshift galaxies, and has to spatially overlap with the unknown sample.

Assuming linear galaxy-matter bias, we can express the clustering $w_{\text{ur}}$ between the unknown sample and each of the reference sample thin bins as a function of the separation angle $\theta$ between the unknown and reference sample:

$$w_{\text{ur}}(\theta) = \int dz' n_r(z') n_u(z') b_r(z') b_u(z') w_{\text{DM}}(\theta, z') + M(\theta), \quad (9)$$

where $n_r$ and $n_u$ are the redshift distributions of the reference and unknown sample, $b_r$ and $b_u$ are the galaxy-matter biases of both samples, $w_{\text{DM}}$ is the clustering of dark matter, and $M(\theta)$ denotes contributions due to magnification. Note that we are assuming Limber approximation (Limber 1953), but this has been shown to have no impact on the results (McQuinn & White 2013).

In our methodology, we use a single estimated value from the cross-correlation signal for each thin redshift bin. In practice, we do this by measuring the correlation function as a function of angular separation and then averaging it with a weight function to produce the single estimate:

$$\bar{w}_{\text{ur}} = \int_{\theta_{\text{min}}}^{\theta_{\text{max}}} d\theta \, W(\theta) w_{\text{ur}}(\theta), \quad (10)$$

where $W(\theta) \propto \theta^{-1}$ is a weighting function (Gatti et al. 2022). The integration limits in the integral in equation (10) are set to fixed physical scales (1.5 to 5 Mpc).

Since the $n_r$ are binned in narrow bins we can approximate the number density of the sample of reference as a Dirac delta, and the revised expression becomes:

$$\bar{w}_{\text{ur}} \approx n_u b_r b_u \bar{w}_{\text{DM}} + \bar{M}. \quad (11)$$

The above equation relates the redshift distribution of the unknown sample to the measured clustering signal $\bar{w}_{\text{ur}}$. The galaxy-matter biases of the reference can be estimated from the autocorrelation of the reference sample. Usually the galaxy-matter bias of the unknown sample cannot be inferred and is treated as nuisance parameter. In this work, however, due to the relatively good redshift provided by DNF for the MAGLIM sample, we also use the autocorrelation of the latter as a prior for $b_u$ (see Section 4.2). The other terms in the above equation are the clustering of dark matter $\bar{w}_{\text{DM}}$, which can be estimated from theory and it is not very sensitive to the cosmological parameters (Gatti et al. 2022), and the magnification term, which is expected to have a little impact (Gatti et al. 2022) and can be estimated if magnification coefficients for the samples are provided.

The angular scales considered have been chosen to span the physical interval between 1.5 and 5.0 Mpc. These bounds, applied to data as well as simulations, are selected so that the upper bound is below the range used for the galaxy clustering cosmological analyses, therefore granting the WZ likelihoods to be essentially independent of the assumed cosmology, and allowing us to produce $n(z)$ samples in an MCMC chain that runs independently of the cosmological ones. We perform the cross-correlations of MAGLIM with each of the 50 bins of width $\Delta z = 0.02$ of the BOSS/eBOSS catalogue, which

spans in the range $0.1 < z < 1.1$ as previously mentioned. We also weigh each galaxy of the MAGLIM sample by the clustering weights computed in Rodríguez-Monroy et al. (2022).

We use the Davis & Peebles (1983) estimator for the cross-correlation signal,

$$w_{\text{ur}}(\theta) = \frac{N_{\text{Rr}} D_u D_r(\theta)}{N_{\text{Dr}} D_u R_r(\theta)} - 1, \quad (12)$$

where $D_u D_r(\theta)$ and $D_u R_r(\theta)$ represent data–data and data–random pairs. The pairs are normalized through $N_{\text{Dr}}$ and $N_{\text{Rr}}$, which is the total number of galaxies in the reference sample and in the reference random catalogue. The correlation estimates were computed using treecorr.<fnref n="2" />

# 4 CHARACTERIZATION OF SOURCES OF UNCERTAINTY

In this section, we present the characterization of the systematic uncertainties of our methodology. The dominant sources of uncertainties for the SOMPZ method are sample variance and shot noise. In the clustering redshift method, the main uncertainty is caused by the lack of prior knowledge on the redshift evolution of the galaxy-matter bias of the MAGLIM sample. This is modelled by a flexible systematic function, informed by a measurement of the MAGLIM autocorrelation function in data. Other minor sources of uncertainties are related to magnification effects and the approximation of linear bias (Gatti et al. 2022). We provide further details on each source of uncertainty in the following subsections. A full catalogue-to-cosmology validation of the method (in simulations) is then presented in Appendix B.

## 4.1 SOMPZ uncertainties

For the SOMPZ method we consider the following sources of uncertainty:

(i) *sample variance of the deep fields*: main uncertainty, caused by the limited area of the deep fields. We model the effect of sample variance by means of the three step Dirichlet (3sDir) analytical model described in Section 4.1.1;

(ii) *shot noise in the deep and redshift samples*: this is induced by the limited number of galaxies available in the deep and redshift samples. We model the effect of shot noise by means of the 3sDir analytical model described in Section 4.1.1;

(iii) *SOMPZ method uncertainty*: this uncertainty stems from discretizing the colour space in the SOMPZ mapping. We do estimate its impact on the SOMPZ estimates by replicating the SOMPZ methods multiple times in simulations, and incorporate its effects using probability integral transforms (PITs) (Section 4.1.2);

(iv) *photometric calibration*: related to uncertainties in the calibration of the deep fields zero-point, it is accounted for in the SOMPZ estimates by means of PITs (Section 4.1.3).

(v) *redshift sample biases*: these biases stem from uncertainties and biases in the redshift estimates of the redshift samples. Their impact is accounted for in our methodology by marginalizing over three different combinations of redshift samples (Section 4.1.4);

(vi) *transfer function*: any bias induced by an erroneous estimation of the transfer function due to a size-limited BALROG sample; we anticipate this to be negligible following the results from Myles et al. (2021) (Section 4.1.5).

<footnote n="2">²https://github.com/rmjarvis/TreeCorr</footnote>
or calibrate redshift distributions of galaxy samples. It relies on the assumption that the cross-correlation between two samples of objects is non-zero only in the case of overlap of the distribution of objects in physical space, due to their mutual gravitational influence.

Various implementations of the clustering redshift methodology differ in their details, but they all agree on one key aspect: the ‘target’ sample (hereafter dubbed ‘unknown’ sample), which has to be calibrated, has to be cross-correlated with a ‘reference’ sample divided into thin redshift bins. The reference sample consists of either high-quality photometric or spectroscopic redshift galaxies, and has to spatially overlap with the unknown sample.

Assuming linear galaxy-matter bias, we can express the clustering $w_{\text{ur}}$ between the unknown sample and each of the reference sample thin bins as a function of the separation angle $\theta$ between the unknown and reference sample:

$$w_{\text{ur}}(\theta) = \int dz' n_r(z') n_u(z') b_r(z') b_u(z') w_{\text{DM}}(\theta, z') + M(\theta), \quad (9)$$

where $n_r$ and $n_u$ are the redshift distributions of the reference and unknown sample, $b_r$ and $b_u$ are the galaxy-matter biases of both samples, $w_{\text{DM}}$ is the clustering of dark matter, and $M(\theta)$ denotes contributions due to magnification. Note that we are assuming Limber approximation (Limber 1953), but this has been shown to have no impact on the results (McQuinn & White 2013).

In our methodology, we use a single estimated value from the cross-correlation signal for each thin redshift bin. In practice, we do this by measuring the correlation function as a function of angular separation and then averaging it with a weight function to produce the single estimate:

$$\bar{w}_{\text{ur}} = \int_{\theta_{\text{min}}}^{\theta_{\text{max}}} d\theta \, W(\theta) w_{\text{ur}}(\theta), \quad (10)$$

where $W(\theta) \propto \theta^{-1}$ is a weighting function (Gatti et al. 2022). The integration limits in the integral in equation (10) are set to fixed physical scales (1.5 to 5 Mpc).

Since the $n_r$ are binned in narrow bins we can approximate the number density of the sample of reference as a Dirac delta, and the revised expression becomes:

$$\bar{w}_{\text{ur}} \approx n_u b_r b_u \bar{w}_{\text{DM}} + \bar{M}. \quad (11)$$

The above equation relates the redshift distribution of the unknown sample to the measured clustering signal $\bar{w}_{\text{ur}}$. The galaxy-matter biases of the reference can be estimated from the autocorrelation of the reference sample. Usually the galaxy-matter bias of the unknown sample cannot be inferred and is treated as nuisance parameter. In this work, however, due to the relatively good redshift provided by DNF for the MAGLIM sample, we also use the autocorrelation of the latter as a prior for $b_u$ (see Section 4.2). The other terms in the above equation are the clustering of dark matter $\bar{w}_{\text{DM}}$, which can be estimated from theory and it is not very sensitive to the cosmological parameters (Gatti et al. 2022), and the magnification term, which is expected to have a little impact (Gatti et al. 2022) and can be estimated if magnification coefficients for the samples are provided.

The angular scales considered have been chosen to span the physical interval between 1.5 and 5.0 Mpc. These bounds, applied to data as well as simulations, are selected so that the upper bound is below the range used for the galaxy clustering cosmological analyses, therefore granting the WZ likelihoods to be essentially independent of the assumed cosmology, and allowing us to produce $n(z)$ samples in an MCMC chain that runs independently of the cosmological ones. We perform the cross-correlations of MAGLIM with each of the 50 bins of width $\Delta z = 0.02$ of the BOSS/eBOSS catalogue, which

spans in the range $0.1 < z < 1.1$ as previously mentioned. We also weigh each galaxy of the MAGLIM sample by the clustering weights computed in Rodríguez-Monroy et al. (2022).

We use the Davis & Peebles (1983) estimator for the cross-correlation signal,

$$w_{\text{ur}}(\theta) = \frac{N_{\text{Rr}} D_u D_r(\theta)}{N_{\text{Dr}} D_u R_r(\theta)} - 1, \quad (12)$$

where $D_u D_r(\theta)$ and $D_u R_r(\theta)$ represent data–data and data–random pairs. The pairs are normalized through $N_{\text{Dr}}$ and $N_{\text{Rr}}$, which is the total number of galaxies in the reference sample and in the reference random catalogue. The correlation estimates were computed using `treecorr`<fnref n="2" />.

# 4 CHARACTERIZATION OF SOURCES OF UNCERTAINTY

In this section, we present the characterization of the systematic uncertainties of our methodology. The dominant sources of uncertainties for the SOMPZ method are sample variance and shot noise. In the clustering redshift method, the main uncertainty is caused by the lack of prior knowledge on the redshift evolution of the galaxy-matter bias of the MAGLIM sample. This is modelled by a flexible systematic function, informed by a measurement of the MAGLIM autocorrelation function in data. Other minor sources of uncertainties are related to magnification effects and the approximation of linear bias (Gatti et al. 2022). We provide further details on each source of uncertainty in the following subsections. A full catalogue-to-cosmology validation of the method (in simulations) is then presented in Appendix B.

## 4.1 SOMPZ uncertainties

For the SOMPZ method we consider the following sources of uncertainty:

(i) *sample variance of the deep fields*: main uncertainty, caused by the limited area of the deep fields. We model the effect of sample variance by means of the three step Dirichlet (3sDir) analytical model described in Section 4.1.1;

(ii) *shot noise in the deep and redshift samples*: this is induced by the limited number of galaxies available in the deep and redshift samples. We model the effect of shot noise by means of the 3sDir analytical model described in Section 4.1.1;

(iii) *SOMPZ method uncertainty*: this uncertainty stems from discretizing the colour space in the SOMPZ mapping. We do estimate its impact on the SOMPZ estimates by replicating the SOMPZ methods multiple times in simulations, and incorporate its effects using probability integral transforms (PITs) (Section 4.1.2);

(iv) *photometric calibration*: related to uncertainties in the calibration of the deep fields zero-point, it is accounted for in the SOMPZ estimates by means of PITs (Section 4.1.3).

(v) *redshift sample biases*: these biases stem from uncertainties and biases in the redshift estimates of the redshift samples. Their impact is accounted for in our methodology by marginalizing over three different combinations of redshift samples (Section 4.1.4);

(vi) *transfer function*: any bias induced by an erroneous estimation of the transfer function due to a size-limited BALROG sample; we anticipate this to be negligible following the results from Myles et al. (2021) (Section 4.1.5).

<footnote n="2">²https://github.com/rmjarvis/TreeCorr</footnote>
In the following sections we will proceed to describe in detail how we account for each of the items listed above.

### 4.1.1 Sample variance and shot noise (3sDir)

Sample variance is the dominant uncertainty affecting our SOMPZ estimates, and stems from the limited size and area coverage of the redshift and deep samples, with respect to the whole wide field. The deep fields only cover ~9 deg², which means we could be learning the colour/redshift relation from a non-representative sample of the sky due to fluctuations in the matter density field; moreover, the finite size of the redshift sample can introduce shot noise effects, preventing a correct sampling of the quantities required for the redshift inference.

Generally the impact of sample variance can be evaluated estimating the redshift distributions in simulations multiple times using different line of sights for the deep fields (e.g. Hildebrandt et al. 2017, 2021; Hoyle et al. 2018; Buchs et al. 2019; Wright et al. 2020). Although we also performed a test where we evaluated the impact of sample variance using the Buzzard simulation, in our standard procedure we use the three step Dirichlet (3sDir) approach 3sDir presented in Sánchez et al. (2020) and applied to the redshift calibration of the DES Year 3 source sample (Myles et al. 2021).

The 3sDir method consists of an analytical sample variance model predicting what the redshift-colour distribution would be from the observed individual redshift and galaxy phenotypes (colours) of galaxies coming from smaller deep fields. Using this model we can build an ensemble of redshift distributions realizations whose fluctuations realistically represent the effect of sample variance. During the cosmological inference, by sampling over these realizations, one can effectively marginalize over the effect of sample variance. Here, we provide a short description of the 3sDir method, but we direct the reader to Myles et al. (2021) and Sánchez et al. (2020) for more details. The 3sDir method assumes the probability p(z, c) that galaxies belong to a redshift bin z and colour phenotype c to be described by a probability histogram with coefficients $f_{zc}$ (with $\sum f_{zc} = 1$ and $0 \le f_{zc} \le 1$). Under this assumption, the expected number counts of galaxies in a deep SOM cell given the coefficients $f_{zc}$ are described by a multinomial distribution; if we assume a Dirichlet function for the prior on $f_{zc}$, the posterior of $f_{zc}$ given the observed number count will also be described by a Dirichlet function. Such a Dirichlet posterior can be used to draw samples and naturally accounts for the effect of shot noise in the data. The effect of sample variance can be introduced by tuning the width of the prior on $f_{zc}$, which does not change the expected value for $f_{zc}$ in the Dirichlet distribution, but does change its variance to simultaneously account for shot noise and sample variance.

If all the galaxies belonging to the redshift sample were independently drawn, then a Dirichlet distribution parametrized by the redshift sample counts in each couple of redshift bin z and phenotype c, $N_{zc}$, would fully characterize $f_{zc}$. However, one subtlety is that sample variance correlates with redshifts; to increase the variance with the correct redshift dependence one can use the fact that two different phenotypes (deep SOM cells) overlapping in redshift are correlated due to the same underlying large-scale structure fluctuations. The 3sDir model assumes that phenotypes at the same redshift share the same sample variance, and therefore groups cells with similar redshifts in superphenotypes T. One can then express the $f_{zc}$ as

$$f_{zc} = \sum f_c^{zT} f_z^T f_T. \quad (13)$$

The 3sDir method consists of drawing values of these three sets of

coefficients with three Dirichlet functions. In this way, it is possible to include a redshift-dependent variance while conserving the expected value of $f_{zc}$.

The validation of the 3sDir method has been carried out in Myles et al. (2021), applied to the weak lensing source sample. The only difference with this work stands in the fact we are performing the 3sDir estimation independently for each tomographic bin, due to their definition.

As reported in Table 4, this uncertainty is dominant, both on the mean and width values of the $n(z)$ distributions, computed from the ensemble of realizations provided by the 3sDir method.

### 4.1.2 SOMPZ method uncertainty

The SOMPZ method relies on the discretization on the colour space spanned by our deep field sample, and this is an approximation that can lead to small biases or additional uncertainties. In order to estimate these, we compute our SOMPZ $n(z)$ a large number of times in the Buzzard simulations. In order to factor out sample variance, each time we randomly select patches of the Buzzard footprint to construct the mock deep fields. In this way, by averaging over all the final $n(z)$ realizations, we can produce an estimate of the $n(z)$ only minimally biased by sample variance, and test the agreement with the true $n(z)$. Due to the computational cost of the SOMPZ pipeline, we decided to produce 300 $n(z)$ replicas. To perform this test, we assumed that the redshift sample would only be limited to one of our four fields, of the size of COSMOS.

We computed the mean redshift offset of the ensemble with respect to the true value, for each tomographic bin. As reported in Table 4, these values are smaller than the effect of sample variance. These values are incorporated into our final $n(z)$ ensemble using the PIT method described in the following section, by additionally shifting each PIT (used to correct for the zero-point uncertainties) by a value drawn from a Gaussian centred at zero with standard deviation equal to the root-mean-square of the aforementioned mean offset values.

### 4.1.3 Deep fields photometric calibration uncertainty

Although the uncertainty in the photometry of each individual galaxy is implicitly accounted for in the SOM training, the uncertainty on the photometric calibrations as a whole must be evaluated by testing how the measured $n(z)$ are affected by changes in the photometric zero-point in each band. This is relevant for the deep fields, where the relatively precise fluxes are key to constraining reliable $p(z)$ in parts of parameter space that are not subject to selection biases. Ideally, this would be tested by rerunning the full analysis for an ensemble of perturbations of the photometric zero-point according to the zero-point uncertainty, but the computational requirements of the BALROG injection procedure make this infeasible. Instead, we produce an analogous ensemble of realizations in simulations, where the BALROG mock photometric survey is reduced to a computationally simpler procedure of adding Gaussian noise to true magnitudes. For each realization of this ensemble, we perturb all deep field magnitudes by a draw from a Gaussian whose width is determined by the photometric zero-point uncertainty in the Y3 deep fields catalogue in a specified band, as computed in Hartley et al. (2022). We then 'inject' these perturbed deep field fluxes with a mock BALROG procedure to generate wide field realizations of the galaxies and measure the corresponding $n(z)$. In this way we generate a full ensemble of $n(z)$ realizations reflecting the uncertainty in our redshift calibration due to the photometric calibration. We apply
In the following sections we will proceed to describe in detail how we account for each of the items listed above.

### 4.1.1 Sample variance and shot noise (3sDir)

Sample variance is the dominant uncertainty affecting our SOMPZ estimates, and stems from the limited size and area coverage of the redshift and deep samples, with respect to the whole wide field. The deep fields only cover ~9 deg², which means we could be learning the colour/redshift relation from a non-representative sample of the sky due to fluctuations in the matter density field; moreover, the finite size of the redshift sample can introduce shot noise effects, preventing a correct sampling of the quantities required for the redshift inference.

Generally the impact of sample variance can be evaluated estimating the redshift distributions in simulations multiple times using different line of sights for the deep fields (e.g. Hildebrandt et al. 2017, 2021; Hoyle et al. 2018; Buchs et al. 2019; Wright et al. 2020). Although we also performed a test where we evaluated the impact of sample variance using the Buzzard simulation, in our standard procedure we use the three step Dirichlet (3sDir) approach 3sDir presented in Sánchez et al. (2020) and applied to the redshift calibration of the DES Year 3 source sample (Myles et al. 2021).

The 3sDir method consists of an analytical sample variance model predicting what the redshift-colour distribution would be from the observed individual redshift and galaxy phenotypes (colours) of galaxies coming from smaller deep fields. Using this model we can build an ensemble of redshift distributions realizations whose fluctuations realistically represent the effect of sample variance. During the cosmological inference, by sampling over these realizations, one can effectively marginalize over the effect of sample variance. Here, we provide a short description of the 3sDir method, but we direct the reader to Myles et al. (2021) and Sánchez et al. (2020) for more details. The 3sDir method assumes the probability p(z, c) that galaxies belong to a redshift bin z and colour phenotype c to be described by a probability histogram with coefficients $f_{zc}$ (with $\sum f_{zc} = 1$ and $0 \le f_{zc} \le 1$). Under this assumption, the expected number counts of galaxies in a deep SOM cell given the coefficients $f_{zc}$ are described by a multinomial distribution; if we assume a Dirichlet function for the prior on $f_{zc}$, the posterior of $f_{zc}$ given the observed number count will also be described by a Dirichlet function. Such a Dirichlet posterior can be used to draw samples and naturally accounts for the effect of shot noise in the data. The effect of sample variance can be introduced by tuning the width of the prior on $f_{zc}$, which does not change the expected value for $f_{zc}$ in the Dirichlet distribution, but does change its variance to simultaneously account for shot noise and sample variance.

If all the galaxies belonging to the redshift sample were independently drawn, then a Dirichlet distribution parametrized by the redshift sample counts in each couple of redshift bin z and phenotype c, $N_{zc}$, would fully characterize $f_{zc}$. However, one subtlety is that sample variance correlates with redshifts; to increase the variance with the correct redshift dependence one can use the fact that two different phenotypes (deep SOM cells) overlapping in redshift are correlated due to the same underlying large-scale structure fluctuations. The 3sDir model assumes that phenotypes at the same redshift share the same sample variance, and therefore groups cells with similar redshifts in superphenotypes T. One can then express the $f_{zc}$ as

$$f_{zc} = \sum f_c^{zT} f_z^T f_T. \qquad (13)$$

The 3sDir method consists of drawing values of these three sets of

coefficients with three Dirichlet functions. In this way, it is possible to include a redshift-dependent variance while conserving the expected value of $f_{zc}$.

The validation of the 3sDir method has been carried out in Myles et al. (2021), applied to the weak lensing source sample. The only difference with this work stands in the fact we are performing the 3sDir estimation independently for each tomographic bin, due to their definition.

As reported in Table 4, this uncertainty is dominant, both on the mean and width values of the $n(z)$ distributions, computed from the ensemble of realizations provided by the 3sDir method.

### 4.1.2 SOMPZ method uncertainty

The SOMPZ method relies on the discretization on the colour space spanned by our deep field sample, and this is an approximation that can lead to small biases or additional uncertainties. In order to estimate these, we compute our SOMPZ $n(z)$ a large number of times in the Buzzard simulations. In order to factor out sample variance, each time we randomly select patches of the Buzzard footprint to construct the mock deep fields. In this way, by averaging over all the final $n(z)$ realizations, we can produce an estimate of the $n(z)$ only minimally biased by sample variance, and test the agreement with the true $n(z)$. Due to the computational cost of the SOMPZ pipeline, we decided to produce 300 $n(z)$ replicas. To perform this test, we assumed that the redshift sample would only be limited to one of our four fields, of the size of COSMOS.

We computed the mean redshift offset of the ensemble with respect to the true value, for each tomographic bin. As reported in Table 4, these values are smaller than the effect of sample variance. These values are incorporated into our final $n(z)$ ensemble using the PIT method described in the following section, by additionally shifting each PIT (used to correct for the zero-point uncertainties) by a value drawn from a Gaussian centred at zero with standard deviation equal to the root-mean-square of the aforementioned mean offset values.

### 4.1.3 Deep fields photometric calibration uncertainty

Although the uncertainty in the photometry of each individual galaxy is implicitly accounted for in the SOM training, the uncertainty on the photometric calibrations as a whole must be evaluated by testing how the measured $n(z)$ are affected by changes in the photometric zero-point in each band. This is relevant for the deep fields, where the relatively precise fluxes are key to constraining reliable $p(z)$ in parts of parameter space that are not subject to selection biases. Ideally, this would be tested by rerunning the full analysis for an ensemble of perturbations of the photometric zero-point according to the zero-point uncertainty, but the computational requirements of the BALROG injection procedure make this infeasible. Instead, we produce an analogous ensemble of realizations in simulations, where the BALROG mock photometric survey is reduced to a computationally simpler procedure of adding Gaussian noise to true magnitudes. For each realization of this ensemble, we perturb all deep field magnitudes by a draw from a Gaussian whose width is determined by the photometric zero-point uncertainty in the Y3 deep fields catalogue in a specified band, as computed in Hartley et al. (2022). We then 'inject' these perturbed deep field fluxes with a mock BALROG procedure to generate wide field realizations of the galaxies and measure the corresponding $n(z)$. In this way we generate a full ensemble of $n(z)$ realizations reflecting the uncertainty in our redshift calibration due to the photometric calibration. We apply
<table><caption>**Table 4.** Summary of values for systematic uncertainties and centre values for mean (top panel) and width (bottom panel) for the *n(z)* distributions. The various components are computed as described in Section 4 and as they are not completely independent it is not expected that they sum up to the total value. The values related to SOMPZ and SOMPZ+WZ refer to Fig. 5, and include only the 3sDir uncertainty due to sample variance and shot noise (and the redshift samples uncertainty), because it was logistically not possible to add the SOMPZ method and the zero-point sources of uncertainty before the combination with WZ. As a comparison, the 'SOMPZ (with all unc)' includes all uncertainties. The final *n(z)* which has been used in the cosmological analysis is the bottom line.</caption><thead><tr><th rowspan="2">Uncertainty</th><th colspan="6">Mean</th></tr><tr><th>Bin 1<br/>z ∈ [0.2, 0.4]</th><th>Bin 2<br/>z ∈ [0.4, 0.55]</th><th>Bin 3<br/>z ∈ [0.55, 0.7]</th><th>Bin 4<br/>z ∈ [0.7, 0.85]</th><th>Bin 5<br/>z ∈ [0.85, 0.95]</th><th>Bin 6<br/>z ∈ [0.95, 1.05]</th></tr></thead><tbody><tr><td>Sample Variance and shot noise</td><td>0.015</td><td>0.010</td><td>0.010</td><td>0.008</td><td>0.009</td><td>0.009</td></tr><tr><td>SOMPZ method</td><td>0.004</td><td>0.003</td><td>0.005</td><td>0.001</td><td>0.007</td><td>0.005</td></tr><tr><td>Redshift samples</td><td>0.009</td><td>0.001</td><td>0.006</td><td>0.003</td><td>0.004</td><td>0.007</td></tr><tr><td>Zero-point</td><td>0.008</td><td>0.007</td><td>0.004</td><td>0.005</td><td>0.005</td><td>0.005</td></tr><tr><td>SOMPZ</td><td>0.315 ± 0.015</td><td>0.445 ± 0.010</td><td>0.630 ± 0.010</td><td>0.776 ± 0.008</td><td>0.895 ± 0.009</td><td>0.983 ± 0.012</td></tr><tr><td>SOMPZ+WZ</td><td>0.316 ± 0.014</td><td>0.456 ± 0.008</td><td>0.632 ± 0.008</td><td>0.780 ± 0.007</td><td>0.893 ± 0.008</td><td>0.985 ± 0.010</td></tr><tr><td>SOMPZ (with all unc)</td><td>0.317 ± 0.020</td><td>0.447 ± 0.012</td><td>0.634 ± 0.013</td><td>0.778 ± 0.010</td><td>0.897 ± 0.011</td><td>0.988 ± 0.013</td></tr><tr><td>SOMPZ+WZ (with all unc)</td><td>0.315 ± 0.016</td><td>0.463 ± 0.010</td><td>0.633 ± 0.009</td><td>0.781 ± 0.008</td><td>0.893 ± 0.009</td><td>0.990 ± 0.012</td></tr><tr><td colspan="7" style="text-align: center;">Width</td></tr><tr><td>Sample variance and shot noise</td><td>0.007</td><td>0.005</td><td>0.003</td><td>0.003</td><td>0.004</td><td>0.009</td></tr><tr><td>SOMPZ method</td><td>0.003</td><td>0.003</td><td>0.0007</td><td>0.0003</td><td>0.002</td><td>0.0001</td></tr><tr><td>Redshift samples</td><td>0.001</td><td>0.005</td><td>0.0007</td><td>0.0006</td><td>0.0003</td><td>0.001</td></tr><tr><td>Zero-point</td><td>0.003</td><td>0.004</td><td>0.001</td><td>0.0004</td><td>0.001</td><td>0.001</td></tr><tr><td>SOMPZ</td><td>0.077 ± 0.007</td><td>0.093 ± 0.007</td><td>0.065 ± 0.004</td><td>0.081 ± 0.004</td><td>0.071 ± 0.004</td><td>0.096 ± 0.009</td></tr><tr><td>SOMPZ+WZ</td><td>0.080 ± 0.004</td><td>0.089 ± 0.004</td><td>0.060 ± 0.002</td><td>0.077 ± 0.003</td><td>0.074 ± 0.004</td><td>0.105 ± 0.006</td></tr><tr><td>SOMPZ (with all unc)</td><td>0.081 ± 0.008</td><td>0.096 ± 0.007</td><td>0.067 ± 0.005</td><td>0.081 ± 0.004</td><td>0.073 ± 0.005</td><td>0.098 ± 0.009</td></tr><tr><td>SOMPZ+WZ (with all unc)</td><td>0.080 ± 0.005</td><td>0.081 ± 0.005</td><td>0.060 ± 0.002</td><td>0.073 ± 0.003</td><td>0.074 ± 0.004</td><td>0.101 ± 0.007</td></tr></tbody></table>

PITs as in Myles et al. (2021) to transfer the variation encoded in the ensemble from simulated *n(z)* to our fiducial data result. Essentially, this process involves calculating the inverse cumulative distribution function (CDF) for each simulated realization *n*<sub>i</sub>(*z*) in the ensemble. The PIT is then obtained by computing the difference between the CDF of each realization and the average CDF of the entire ensemble. To apply these transformations to the data, the PIT value is added to the inverse CDF of the fiducial data *n(z)*. The PIT resulting from a single draw of zero-point offsets is determined and collectively applied to all tomographic bins. More details on this new implementation of the PIT can be found in Myles et al. (2023).

### 4.1.4 Redshift sample uncertainty

As mentioned in Section 2.5, we decided to choose three different catalogues to infer our redshift distributions from: a collection of spectroscopic surveys galaxies (Gschwend et al. 2018), PAU + COSMOS redshift as in Alarcon et al. (2021), and COSMOS30 photometric redshifts (Laigle et al. 2016). The reason for availing ourselves of more than one catalogue lies in the fact neither of these are exempt from systematic uncertainties: each survey uses different photometry, different model assumptions, and can be affected systematically by selection effects, incorrect templates, photometric outliers, etc. Since there is a considerable overlap in the number of galaxies belonging to more than one of the redshift catalogues selected for this work, to account for the intrinsic biases we decided to build three samples which are combinations of the aforementioned catalogues. We ranked the redshift catalogues differently for each sample: if a galaxy has information from multiple origins, we assign the redshift from the highest ranked catalogue. The three redshift samples, SPC, PC, SC, are described in Section 2.5.

For each of these, we will perform the complete pipeline, and the final set of realization will be constructed by an equal fraction $p(R) = 1/3$ from each survey. By placing equal prior probability to each sample, this is equivalent as saying that we do not believe any of the samples is more likely to be correct. But note that for galaxies from which we have information from only one catalogue, we are assuming that information to be true, and this is a caveat of this approach. Fig. 3 shows the uncertainty in the mean redshift of each tomographic bin, for each of the redshift samples and for their combination.

### 4.1.5 Transfer function uncertainty

One of the key points in this redshift calibration is the transfer function $p(c|\hat{c})$, the intermediate step necessary to assign redshifts from deep field galaxies to the whole wide field. If the transfer function is inaccurate, regardless of how precise the colour/redshift characterization is in the deep SOM, it can bias the final *n(z)* distributions. $p(c|\hat{c})$ depends on the observation conditions in that location, determining if the galaxy is detected or not. Observing conditions vary across the wide field, but for our analysis we are interested in redshift distributions estimated across all the footprint. BALROG injects the same deep galaxies in random wide tiles, and despite these covering only around ~20 per cent of the DES footprint, in Myles et al. (2021) it was verified that BALROG is adequately sampling the observing conditions in the wide field. They boostrapped the sample by the injected position and recomputed 1000 different transfer functions. They concluded that the dispersion in the final *n(z)* mean redshift from repeating the analysis using each time a different transfer function was completely negligible. Here, we repeated that test, since our deep field sample has less galaxies and might impact differently the transfer function. We found that this is
<table><caption>**Table 4.** Summary of values for systematic uncertainties and centre values for mean (top panel) and width (bottom panel) for the *n(z)* distributions. The various components are computed as described in Section 4 and as they are not completely independent it is not expected that they sum up to the total value. The values related to SOMPZ and SOMPZ+WZ refer to Fig. 5, and include only the 3sDir uncertainty due to sample variance and shot noise (and the redshift samples uncertainty), because it was logistically not possible to add the SOMPZ method and the zero-point sources of uncertainty before the combination with WZ. As a comparison, the 'SOMPZ (with all unc)' includes all uncertainties. The final *n(z)* which has been used in the cosmological analysis is the bottom line.</caption><thead><tr><th rowspan="2">Uncertainty</th><th colspan="6">Mean</th></tr><tr><th>Bin 1<br/>z ∈ [0.2, 0.4]</th><th>Bin 2<br/>z ∈ [0.4, 0.55]</th><th>Bin 3<br/>z ∈ [0.55, 0.7]</th><th>Bin 4<br/>z ∈ [0.7, 0.85]</th><th>Bin 5<br/>z ∈ [0.85, 0.95]</th><th>Bin 6<br/>z ∈ [0.95, 1.05]</th></tr></thead><tbody><tr><td>Sample Variance and shot noise</td><td>0.015</td><td>0.010</td><td>0.010</td><td>0.008</td><td>0.009</td><td>0.009</td></tr><tr><td>SOMPZ method</td><td>0.004</td><td>0.003</td><td>0.005</td><td>0.001</td><td>0.007</td><td>0.005</td></tr><tr><td>Redshift samples</td><td>0.009</td><td>0.001</td><td>0.006</td><td>0.003</td><td>0.004</td><td>0.007</td></tr><tr><td>Zero-point</td><td>0.008</td><td>0.007</td><td>0.004</td><td>0.005</td><td>0.005</td><td>0.005</td></tr><tr><td>SOMPZ</td><td>0.315 ± 0.015</td><td>0.445 ± 0.010</td><td>0.630 ± 0.010</td><td>0.776 ± 0.008</td><td>0.895 ± 0.009</td><td>0.983 ± 0.012</td></tr><tr><td>SOMPZ+WZ</td><td>0.316 ± 0.014</td><td>0.456 ± 0.008</td><td>0.632 ± 0.008</td><td>0.780 ± 0.007</td><td>0.893 ± 0.008</td><td>0.985 ± 0.010</td></tr><tr><td>SOMPZ (with all unc)</td><td>0.317 ± 0.020</td><td>0.447 ± 0.012</td><td>0.634 ± 0.013</td><td>0.778 ± 0.010</td><td>0.897 ± 0.011</td><td>0.988 ± 0.013</td></tr><tr><td>SOMPZ+WZ (with all unc)</td><td>0.315 ± 0.016</td><td>0.463 ± 0.010</td><td>0.633 ± 0.009</td><td>0.781 ± 0.008</td><td>0.893 ± 0.009</td><td>0.990 ± 0.012</td></tr><tr><td colspan="7" style="text-align: center;">Width</td></tr><tr><td>Sample variance and shot noise</td><td>0.007</td><td>0.005</td><td>0.003</td><td>0.003</td><td>0.004</td><td>0.009</td></tr><tr><td>SOMPZ method</td><td>0.003</td><td>0.003</td><td>0.0007</td><td>0.0003</td><td>0.002</td><td>0.0001</td></tr><tr><td>Redshift samples</td><td>0.001</td><td>0.005</td><td>0.0007</td><td>0.0006</td><td>0.0003</td><td>0.001</td></tr><tr><td>Zero-point</td><td>0.003</td><td>0.004</td><td>0.001</td><td>0.0004</td><td>0.001</td><td>0.001</td></tr><tr><td>SOMPZ</td><td>0.077 ± 0.007</td><td>0.093 ± 0.007</td><td>0.065 ± 0.004</td><td>0.081 ± 0.004</td><td>0.071 ± 0.004</td><td>0.096 ± 0.009</td></tr><tr><td>SOMPZ+WZ</td><td>0.080 ± 0.004</td><td>0.089 ± 0.004</td><td>0.060 ± 0.002</td><td>0.077 ± 0.003</td><td>0.074 ± 0.004</td><td>0.105 ± 0.006</td></tr><tr><td>SOMPZ (with all unc)</td><td>0.081 ± 0.008</td><td>0.096 ± 0.007</td><td>0.067 ± 0.005</td><td>0.081 ± 0.004</td><td>0.073 ± 0.005</td><td>0.098 ± 0.009</td></tr><tr><td>SOMPZ+WZ (with all unc)</td><td>0.080 ± 0.005</td><td>0.081 ± 0.005</td><td>0.060 ± 0.002</td><td>0.073 ± 0.003</td><td>0.074 ± 0.004</td><td>0.101 ± 0.007</td></tr></tbody></table>

PITs as in Myles et al. (2021) to transfer the variation encoded in the ensemble from simulated *n(z)* to our fiducial data result. Essentially, this process involves calculating the inverse cumulative distribution function (CDF) for each simulated realization *n*<sub>i</sub>(*z*) in the ensemble. The PIT is then obtained by computing the difference between the CDF of each realization and the average CDF of the entire ensemble. To apply these transformations to the data, the PIT value is added to the inverse CDF of the fiducial data *n(z)*. The PIT resulting from a single draw of zero-point offsets is determined and collectively applied to all tomographic bins. More details on this new implementation of the PIT can be found in Myles et al. (2023).

### 4.1.4 Redshift sample uncertainty

As mentioned in Section 2.5, we decided to choose three different catalogues to infer our redshift distributions from: a collection of spectroscopic surveys galaxies (Gschwend et al. 2018), PAU + COSMOS redshift as in Alarcon et al. (2021), and COSMOS30 photometric redshifts (Laigle et al. 2016). The reason for availing ourselves of more than one catalogue lies in the fact neither of these are exempt from systematic uncertainties: each survey uses different photometry, different model assumptions, and can be affected systematically by selection effects, incorrect templates, photometric outliers, etc. Since there is a considerable overlap in the number of galaxies belonging to more than one of the redshift catalogues selected for this work, to account for the intrinsic biases we decided to build three samples which are combinations of the aforementioned catalogues. We ranked the redshift catalogues differently for each sample: if a galaxy has information from multiple origins, we assign the redshift from the highest ranked catalogue. The three redshift samples, SPC, PC, SC, are described in Section 2.5.

For each of these, we will perform the complete pipeline, and the final set of realization will be constructed by an equal fraction $p(R) = 1/3$ from each survey. By placing equal prior probability to each sample, this is equivalent as saying that we do not believe any of the samples is more likely to be correct. But note that for galaxies from which we have information from only one catalogue, we are assuming that information to be true, and this is a caveat of this approach. Fig. 3 shows the uncertainty in the mean redshift of each tomographic bin, for each of the redshift samples and for their combination.

### 4.1.5 Transfer function uncertainty

One of the key points in this redshift calibration is the transfer function $p(c|\hat{c})$, the intermediate step necessary to assign redshifts from deep field galaxies to the whole wide field. If the transfer function is inaccurate, regardless of how precise the colour/redshift characterization is in the deep SOM, it can bias the final *n(z)* distributions. $p(c|\hat{c})$ depends on the observation conditions in that location, determining if the galaxy is detected or not. Observing conditions vary across the wide field, but for our analysis we are interested in redshift distributions estimated across all the footprint. BALROG injects the same deep galaxies in random wide tiles, and despite these covering only around ~20 per cent of the DES footprint, in Myles et al. (2021) it was verified that BALROG is adequately sampling the observing conditions in the wide field. They boostrapped the sample by the injected position and recomputed 1000 different transfer functions. They concluded that the dispersion in the final *n(z)* mean redshift from repeating the analysis using each time a different transfer function was completely negligible. Here, we repeated that test, since our deep field sample has less galaxies and might impact differently the transfer function. We found that this is
<figure><img src="image_3.png" /><figcaption>**Figure 3.** Uncertainty on the mean redshift represented by the number counts of the three redshift samples: SPC (prioritizes spectra, then PAU photo-z, then COSMOS30), PC (prioritizes PAU photo-z, then COSMOS30), and SC (prioritizes spectra, then COSMOS30). In red the total uncertainty given by their combination is shown.</figcaption></figure>

also negligible for our case, with variations on the $n(z)$ mean $<10^{-3}$ in each tomographic bin, and therefore decided not to propagate this in the final $n(z)$ estimate.

## 4.2 WZ uncertainties

The WZ systematic uncertainties have been identified and characterized in detail for the WL sample in Gatti et al. (2022). Namely, the systematic budget was found to be dominated by our lack of prior knowledge of the redshift evolution of the galaxy-matter bias of the unknown sample. This is also expected to be the case for the MAGLIM sample, although the amplitude of the effect might differ from the WL sample (ideally, since the MAGLIM redshift distributions are narrower, we might expect a smaller impact due to systematics slowly varying with redshift like the galaxy-matter bias of the unknown sample).

Similarly to Gatti et al. (2022), we model our systematics by means of a flexible function, Sys(s), which mostly captures the redshift evolution of the galaxy-matter of the unknown sample. The Sys(s) function is parametrized by s = {$s_1, s_2, ...$} that we will marginalize over and is given by

$$ \log[\text{Sys}(z, s)] = \sum_{k=0}^{M} \frac{\sqrt{2k + 1}}{0.85} s_k P_k(u), \quad (14) $$

$$ u = 0.85 \frac{z - 0.5(z_{\text{max}} + z_{\text{min}})}{(z_{\text{max}} - z_{\text{min}})/2}, \quad (15) $$

with $P_k(z_i)$ being the k-th Legendre polynomial and M = 6 is the maximum order. In this work, we set the prior p(s) to be a simple diagonal normal distribution, with the standard deviations {$\sigma_{s0}, ..., \sigma_{sM}$} and means informed by the measured autocorrelation of the MAGLIM sample.

In Gatti et al. (2022), such a systematic function was let to vary by the typical amplitude of the redshift evolution of the galaxy-matter

bias of the WL sample we measured in simulations. In practice, this was achieved by imposing a Gaussian prior with zero mean p(s) on the coefficients s of the systematic function.

In the case of the MAGLIM sample, we can use a more informative prior p(s) that uses the information we have from the data about the galaxy-matter bias evolution of the sample. In particular, we rely on the fact that the MAGLIM sample has good per-galaxy redshift estimates, which allows us to divide the sample in relatively small bins and measure the autocorrelation of such bins. This was not possible for WL sample, due to the poor per-galaxy redshift accuracy.

To this aim, we use DNF one-point estimates $z_{\text{mean}}$ to further divide the MAGLIM sample in bins of width of $\Delta z = 0.02$, and we measure the autocorrelation of each bin. We note that the true width of each bin will be much larger than $\Delta z = 0.02$, as the DNF photo-z are uncertain. Under the approximation of negligible redshift evolution of the galaxy-matter bias of the MAGLIM sample over each thin bin, the measured autocorrelation can be related to the galaxy-matter bias by knowing how broad the true $n(z)$ distribution of each bin is (Gatti et al. 2018; Cawthon et al. 2022):

$$ w_{uu}(z_i) = b_u^2(z_i) w_{DM}(z_i) \int dz' n_{u,i}^2(z'), \quad (16) $$

where $n_{u,i}(z')$ is indeed the true distribution of the thin bin MAGLIM sample. Such a quantity is estimated using the PDF estimate from DNF $z_{\text{PDF}}$.

From this measurement performed in data we can then retrieve the galaxy bias $b_u(z)$ by inverting equation (16). We fit the Sys(s) function presented in equation (14) to the measured $b_u(z)$ and obtain the best-fitting s values, which we show in Fig. 4. These best-fitting coefficients are then used as the mean value of the Gaussian prior p(s). The best-fitting Sys(s) function to the data is shown in the right panel of Fig. 4.

To estimate the width of the prior p(s) we took a different approach. First, we estimate the bias evolution in simulations by dividing galaxies into thin redshift bins using (i) the true redshifts from the simulation; and (ii) the photo-z estimated from the DNF code. When dividing the galaxies with the photo-z from DNF, we further correct the measured autocorrelation using equation (16). These measurements are shown in the left panel of Fig. 4. The discrepancy between the measured bias evolution from photo-z (equivalent to the application with real data) relative to the measured bias evolution with true redshifts (equivalent to the truth) is a systematic bias. We use the sum in quadrature of this difference with the statistical uncertainty of the bias measurement as the prior width of $s_0$. For the higher order parameters we estimate the standard deviation of the prior by summing in quadrature the ratio between the two biases and the statistical uncertainty from the bias measurement in data. This allows to best capture the RMS variations of the bias function itself. As can be seen in Fig. 4, the 68 per cent confidence interval spanned by the Sys(s) function both brackets the ideal and real world measurements. The values for the mean and width of the prior are displayed in Table 5. Both the width of the prior on the 0-th and higher order coefficients are much tighter than in Myles et al. (2021), where $s_0 = 0.6$ and $s_{1.4} = 0.15$. As already explained, the difference lies in the initial accuracy of the photo-z estimates, which enables the measurement of the autocorrelation of the galaxy sample in thin redshift bins. For the weak lensing source sample such information was not available, and therefore a more conservative prior was deemed appropriate. In the MAGLIM sample case instead, the greater accuracy on its photo-z allows to extract more information from the autocorrelation.
<figure><img src="image_5.png" /><figcaption>**Figure 3.** Uncertainty on the mean redshift represented by the number counts of the three redshift samples: SPC (prioritizes spectra, then PAU photo-z, then COSMOS30), PC (prioritizes PAU photo-z, then COSMOS30), and SC (prioritizes spectra, then COSMOS30). In red the total uncertainty given by their combination is shown.</figcaption></figure>

also negligible for our case, with variations on the $n(z)$ mean $<10^{-3}$ in each tomographic bin, and therefore decided not to propagate this in the final $n(z)$ estimate.

## 4.2 WZ uncertainties

The WZ systematic uncertainties have been identified and characterized in detail for the WL sample in Gatti et al. (2022). Namely, the systematic budget was found to be dominated by our lack of prior knowledge of the redshift evolution of the galaxy-matter bias of the unknown sample. This is also expected to be the case for the MAGLIM sample, although the amplitude of the effect might differ from the WL sample (ideally, since the MAGLIM redshift distributions are narrower, we might expect a smaller impact due to systematics slowly varying with redshift like the galaxy-matter bias of the unknown sample).

Similarly to Gatti et al. (2022), we model our systematics by means of a flexible function, Sys(s), which mostly captures the redshift evolution of the galaxy-matter of the unknown sample. The Sys(s) function is parametrized by s = {$s_1, s_2, ...$} that we will marginalize over and is given by

$$ \log[\text{Sys}(z, s)] = \sum_{k=0}^{M} \frac{\sqrt{2k + 1}}{0.85} s_k P_k(u), \quad (14) $$

$$ u = 0.85 \frac{z - 0.5(z_{\text{max}} + z_{\text{min}})}{(z_{\text{max}} - z_{\text{min}})/2}, \quad (15) $$

with $P_k(z_i)$ being the k-th Legendre polynomial and M = 6 is the maximum order. In this work, we set the prior p(s) to be a simple diagonal normal distribution, with the standard deviations {$\sigma_{s0}, ..., \sigma_{sM}$} and means informed by the measured autocorrelation of the MAGLIM sample.

In Gatti et al. (2022), such a systematic function was let to vary by the typical amplitude of the redshift evolution of the galaxy-matter

bias of the WL sample we measured in simulations. In practice, this was achieved by imposing a Gaussian prior with zero mean p(s) on the coefficients s of the systematic function.

In the case of the MAGLIM sample, we can use a more informative prior p(s) that uses the information we have from the data about the galaxy-matter bias evolution of the sample. In particular, we rely on the fact that the MAGLIM sample has good per-galaxy redshift estimates, which allows us to divide the sample in relatively small bins and measure the autocorrelation of such bins. This was not possible for WL sample, due to the poor per-galaxy redshift accuracy.

To this aim, we use DNF one-point estimates $z_{\text{mean}}$ to further divide the MAGLIM sample in bins of width of $\Delta z = 0.02$, and we measure the autocorrelation of each bin. We note that the true width of each bin will be much larger than $\Delta z = 0.02$, as the DNF photo-z are uncertain. Under the approximation of negligible redshift evolution of the galaxy-matter bias of the MAGLIM sample over each thin bin, the measured autocorrelation can be related to the galaxy-matter bias by knowing how broad the true $n(z)$ distribution of each bin is (Gatti et al. 2018; Cawthon et al. 2022):

$$ w_{uu}(z_i) = b_u^2(z_i) w_{DM}(z_i) \int dz' n_{u,i}^2(z'), \quad (16) $$

where $n_{u,i}(z')$ is indeed the true distribution of the thin bin MAGLIM sample. Such a quantity is estimated using the PDF estimate from DNF $z_{\text{PDF}}$.

From this measurement performed in data we can then retrieve the galaxy bias $b_u(z)$ by inverting equation (16). We fit the Sys(s) function presented in equation (14) to the measured $b_u(z)$ and obtain the best-fitting s values, which we show in Fig. 4. These best-fitting coefficients are then used as the mean value of the Gaussian prior p(s). The best-fitting Sys(s) function to the data is shown in the right panel of Fig. 4.

To estimate the width of the prior p(s) we took a different approach. First, we estimate the bias evolution in simulations by dividing galaxies into thin redshift bins using (i) the true redshifts from the simulation; and (ii) the photo-z estimated from the DNF code. When dividing the galaxies with the photo-z from DNF, we further correct the measured autocorrelation using equation (16). These measurements are shown in the left panel of Fig. 4. The discrepancy between the measured bias evolution from photo-z (equivalent to the application with real data) relative to the measured bias evolution with true redshifts (equivalent to the truth) is a systematic bias. We use the sum in quadrature of this difference with the statistical uncertainty of the bias measurement as the prior width of $s_0$. For the higher order parameters we estimate the standard deviation of the prior by summing in quadrature the ratio between the two biases and the statistical uncertainty from the bias measurement in data. This allows to best capture the RMS variations of the bias function itself. As can be seen in Fig. 4, the 68 per cent confidence interval spanned by the Sys(s) function both brackets the ideal and real world measurements. The values for the mean and width of the prior are displayed in Table 5. Both the width of the prior on the 0-th and higher order coefficients are much tighter than in Myles et al. (2021), where $s_0 = 0.6$ and $s_{1.4} = 0.15$. As already explained, the difference lies in the initial accuracy of the photo-z estimates, which enables the measurement of the autocorrelation of the galaxy sample in thin redshift bins. For the weak lensing source sample such information was not available, and therefore a more conservative prior was deemed appropriate. In the MAGLIM sample case instead, the greater accuracy on its photo-z allows to extract more information from the autocorrelation.
<figure><img src="image_4.png" /><figcaption>**Figure 4.** Left panel: galaxy-matter bias of Bin 1 or the MAGLIM sample (0.2 < z < 0.4) as estimated in simulation following the methodology outlined in Section 4.2. The green points are obtained by dividing the sample into thin bins using the true redshifts, while the orange ones are obtained by binning the sample using the DNF redshift estimates. The grey band encompasses the 68 per cent confidence interval of the Sys(s) function. Right panel: galaxy-matter bias of Bin 1 of the MAGLIM sample (0.2 < z < 0.4) as measured from the data (orange points); the blue line shows the best-fitting Sys(s) function, and the grey band encompasses its 68 per cent confidence interval.</figcaption></figure>

<table><caption>**Table 5.** Means and widths of the Gaussian prior function p(s) appearing in equation (18).</caption><thead><tr><th></th><th colspan="6">Mean</th></tr><tr><th></th><th>Bin 1</th><th>Bin 2</th><th>Bin 3</th><th>Bin 4</th><th>Bin 5</th><th>Bin 6</th></tr></thead><tbody><tr><th>&lt;s<sub>0</sub> &gt;</th><td>-0.028</td><td>-0.085</td><td>-0.319</td><td>-2.630</td><td>-0.119</td><td>-2.249</td></tr><tr><th>&lt;s<sub>1</sub> &gt;</th><td>0.186</td><td>0.559</td><td>0.007</td><td>1.161</td><td>-1.660</td><td>0.819</td></tr><tr><th>&lt;s<sub>2</sub> &gt;</th><td>0.046</td><td>0.139</td><td>-0.120</td><td>0.202</td><td>0.134</td><td>0.033</td></tr><tr><th>&lt;s<sub>3</sub> &gt;</th><td>0.035</td><td>0.105</td><td>-0.130</td><td>0.314</td><td>0.293</td><td>0.174</td></tr><tr><th>&lt;s<sub>4</sub> &gt;</th><td>0.037</td><td>0.111</td><td>-0.112</td><td>-0.197</td><td>0.211</td><td>0.279</td></tr><tr><th>&lt;s<sub>5</sub> &gt;</th><td>-0.062</td><td>-0.189</td><td>-0.203</td><td>-0.210</td><td>1.408</td><td>0.569</td></tr></tbody><thead><tr><th></th><th colspan="6">Width</th></tr><tr><th></th><th>Bin 1</th><th>Bin 2</th><th>Bin 3</th><th>Bin 4</th><th>Bin 5</th><th>Bin 6</th></tr></thead><tbody><tr><th>&sigma;<sub>s<sub>0</sub></sub></th><td>0.107</td><td>0.216</td><td>0.123</td><td>0.072</td><td>0.067</td><td>0.198</td></tr><tr><th>&sigma;<sub>s<sub>1.5</sub></sub></th><td>0.029</td><td>0.053</td><td>0.041</td><td>0.052</td><td>0.081</td><td>0.044</td></tr></tbody></table>

Last, we mention that an additional source of uncertainties for the WZ measurement is related to the impact of magnification. We do model magnification effects, but the accuracy of that model is limited by our knowledge of the magnification coefficients for the two samples. In particular, we do not have any prior knowledge of such coefficients for the BOSS/eBOSS sample. Those coefficients are set to 0 for our fiducial analysis (on the contrary, estimates for the magnification coefficient of the MAGLIM sample are available). We expect magnification to have a small impact, based on tests performed in Gatti et al. (2022), but we none the less test in the following section the impact of having a non-null magnification coefficient for the BOSS/eBOSS sample.

## 4.3 Combination of SOMPZ and WZ

In order to combine SOMPZ and WZ constraints, we follow Gatti et al. (2022) and write the clustering likelihood by forward modelling the full clustering signal as a function of the SOMPZ redshift distributions estimates $n(z)_{pz}$. Moreover, we include the systematic function Sys(s) introduced in the previous section, which describes the uncertainties on the WZ measurement, mostly driven by the lack

of knowledge of $b_u$ and its redshift dependence:

$$ \hat{w}_{\text{ur}}(z_i) = n(z)_{\text{pz}}(z_i) b_r(z_i) w_{\text{DM}}(z_i) \times \text{Sys}(z_i, \mathbf{s}) + M(\alpha_u, \alpha_r, b_u, n(z)_{\text{pz}}). \quad (17) $$

In the above equation, the quantities $\alpha_u(z_i)$ and $\alpha_r(z_i)$ are the magnification coefficients for the unknown and reference samples. See Gatti et al. (2022) for full description of the magnification term $M$. The clustering of dark matter $w_{DM}(z_i)$ is estimated from theory assuming fixed cosmology. We tested that varying cosmology has a negligible impact on our methodology.

The likelihood of the WZ data conditioned on the target $n(z)$ and all the systematic parameters reads as

$$ \mathcal{L}[\text{WZ}|n_u(z), b_r(z), \alpha_r(z), w_{\text{DM}}(z)] \propto \int \mathrm{d}s \, \mathrm{d}p \, \exp \left[ -\frac{1}{2} (w_{\text{ur}} - \hat{w}_{\text{ur}})^T \Sigma_w^{-1} (w_{\text{ur}} - \hat{w}_{\text{ur}}) \right] p(s) p(p), \quad (18) $$

where $\Sigma_w$ is the clustering covariance, estimated through jackknife, and $p = b_u, \alpha_u$. We implemented a Hamiltonian Monte Carlo sampler (HMC) that simultaneously samples the SOMPZ and WZ likelihood. The HMC does directly take as input the SOMs output of the sample variance estimation (described in 4.1.1), and it perturbs selectively the number counts in the SOMs in such a way to produce realizations that are already more likely to match the clustering redshift data.

## 5 RESULTS IN DATA

In this section, we present the final redshift distributions for the MAGLIM sample as obtained in data. We also compare the SOMPZ+WZ redshift distributions with the fiducial DNF+WZ estimates used for the same sample and adopted in the cosmological analysis presented in Porredon et al. (2022). A complete validation of the method in simulations is presented in Appendix B.

We first compare in Fig. 5 the redshift estimates obtained using the 3sDir method and the estimates obtained including the WZ information as described in Section 4. Due to logistics, the combination of the two methods was performed before incorporating the SOMPZ and zero-point errors. As here we are just displaying the effect of the combination, we are showing only how the 3sDir uncertainty from sample variance and shot noise (from the three redshift samples) varies once we add the information from WZ. The combination
<figure><img src="image_6.png" /><figcaption>**Figure 4.** Left panel: galaxy-matter bias of Bin 1 or the MAGLIM sample (0.2 < z < 0.4) as estimated in simulation following the methodology outlined in Section 4.2. The green points are obtained by dividing the sample into thin bins using the true redshifts, while the orange ones are obtained by binning the sample using the DNF redshift estimates. The grey band encompasses the 68 per cent confidence interval of the Sys(s) function. Right panel: galaxy-matter bias of Bin 1 of the MAGLIM sample (0.2 < z < 0.4) as measured from the data (orange points); the blue line shows the best-fitting Sys(s) function, and the grey band encompasses its 68 per cent confidence interval.</figcaption></figure>

<table><caption>**Table 5.** Means and widths of the Gaussian prior function p(s) appearing in equation (18).</caption><thead><tr><th></th><th colspan="6">Mean</th></tr><tr><th></th><th>Bin 1</th><th>Bin 2</th><th>Bin 3</th><th>Bin 4</th><th>Bin 5</th><th>Bin 6</th></tr></thead><tbody><tr><th>&lt;s<sub>0</sub> &gt;</th><td>-0.028</td><td>-0.085</td><td>-0.319</td><td>-2.630</td><td>-0.119</td><td>-2.249</td></tr><tr><th>&lt;s<sub>1</sub> &gt;</th><td>0.186</td><td>0.559</td><td>0.007</td><td>1.161</td><td>-1.660</td><td>0.819</td></tr><tr><th>&lt;s<sub>2</sub> &gt;</th><td>0.046</td><td>0.139</td><td>-0.120</td><td>0.202</td><td>0.134</td><td>0.033</td></tr><tr><th>&lt;s<sub>3</sub> &gt;</th><td>0.035</td><td>0.105</td><td>-0.130</td><td>0.314</td><td>0.293</td><td>0.174</td></tr><tr><th>&lt;s<sub>4</sub> &gt;</th><td>0.037</td><td>0.111</td><td>-0.112</td><td>-0.197</td><td>0.211</td><td>0.279</td></tr><tr><th>&lt;s<sub>5</sub> &gt;</th><td>-0.062</td><td>-0.189</td><td>-0.203</td><td>-0.210</td><td>1.408</td><td>0.569</td></tr></tbody><thead><tr><th></th><th colspan="6">Width</th></tr><tr><th></th><th>Bin 1</th><th>Bin 2</th><th>Bin 3</th><th>Bin 4</th><th>Bin 5</th><th>Bin 6</th></tr></thead><tbody><tr><th>&sigma;<sub>s<sub>0</sub></sub></th><td>0.107</td><td>0.216</td><td>0.123</td><td>0.072</td><td>0.067</td><td>0.198</td></tr><tr><th>&sigma;<sub>s<sub>1.5</sub></sub></th><td>0.029</td><td>0.053</td><td>0.041</td><td>0.052</td><td>0.081</td><td>0.044</td></tr></tbody></table>

Last, we mention that an additional source of uncertainties for the WZ measurement is related to the impact of magnification. We do model magnification effects, but the accuracy of that model is limited by our knowledge of the magnification coefficients for the two samples. In particular, we do not have any prior knowledge of such coefficients for the BOSS/eBOSS sample. Those coefficients are set to 0 for our fiducial analysis (on the contrary, estimates for the magnification coefficient of the MAGLIM sample are available). We expect magnification to have a small impact, based on tests performed in Gatti et al. (2022), but we none the less test in the following section the impact of having a non-null magnification coefficient for the BOSS/eBOSS sample.

## 4.3 Combination of SOMPZ and WZ

In order to combine SOMPZ and WZ constraints, we follow Gatti et al. (2022) and write the clustering likelihood by forward modelling the full clustering signal as a function of the SOMPZ redshift distributions estimates $n(z)_{pz}$. Moreover, we include the systematic function Sys(s) introduced in the previous section, which describes the uncertainties on the WZ measurement, mostly driven by the lack

of knowledge of $b_u$ and its redshift dependence:

$$ \hat{w}_{\text{ur}}(z_i) = n(z)_{\text{pz}}(z_i) b_r(z_i) w_{\text{DM}}(z_i) \times \text{Sys}(z_i, \mathbf{s}) + M(\alpha_u, \alpha_r, b_u, n(z)_{\text{pz}}). \quad (17) $$

In the above equation, the quantities $\alpha_u(z_i)$ and $\alpha_r(z_i)$ are the magnification coefficients for the unknown and reference samples. See Gatti et al. (2022) for full description of the magnification term $M$. The clustering of dark matter $w_{DM}(z_i)$ is estimated from theory assuming fixed cosmology. We tested that varying cosmology has a negligible impact on our methodology.

The likelihood of the WZ data conditioned on the target $n(z)$ and all the systematic parameters reads as

$$ \mathcal{L}[\text{WZ}|n_u(z), b_r(z), \alpha_r(z), w_{\text{DM}}(z)] \propto \int \mathrm{d}s \mathrm{d}p \exp \left[ -\frac{1}{2} (w_{\text{ur}} - \hat{w}_{\text{ur}})^T \Sigma_w^{-1} (w_{\text{ur}} - \hat{w}_{\text{ur}}) \right] p(s)p(p), \quad (18) $$

where $\Sigma_w$ is the clustering covariance, estimated through jackknife, and $p = b_u, \alpha_u$. We implemented a Hamiltonian Monte Carlo sampler (HMC) that simultaneously samples the SOMPZ and WZ likelihood. The HMC does directly take as input the SOMs output of the sample variance estimation (described in 4.1.1), and it perturbs selectively the number counts in the SOMs in such a way to produce realizations that are already more likely to match the clustering redshift data.

## 5 RESULTS IN DATA

In this section, we present the final redshift distributions for the MAGLIM sample as obtained in data. We also compare the SOMPZ+WZ redshift distributions with the fiducial DNF+WZ estimates used for the same sample and adopted in the cosmological analysis presented in Porredon et al. (2022). A complete validation of the method in simulations is presented in Appendix B.

We first compare in Fig. 5 the redshift estimates obtained using the 3sDir method and the estimates obtained including the WZ information as described in Section 4. Due to logistics, the combination of the two methods was performed before incorporating the SOMPZ and zero-point errors. As here we are just displaying the effect of the combination, we are showing only how the 3sDir uncertainty from sample variance and shot noise (from the three redshift samples) varies once we add the information from WZ. The combination
<figure><img src="image_5.png" /><figcaption>**Figure 5.** 3sDir distributions before (lighter shades) and after the combination with clustering-z (solid shades), and after the combination with clustering-z but using a broader prior on the parameters of the galaxy-matter bias function Sys(s)(the same values of the width of the prior p(s) that were used in Gatti et al. 2022). In the top row we have bins 1 and 4, in the middle row bins 2 and 5, and in the bottom rows bins 3 and 6. The bands represent the $1\sigma$ error from the central value. Note how the combination with WZ tightens the constraint on the shape of the $n(z)$.</figcaption></figure>

of the two methods results in stronger constraints on the shape of the $n(z)$, due to the complementarity in the information provided by each SOMPZ and WZ. Particularly, the WZ signal strongly correlates across adjacent bins, excluding large portions of possible $n(z)$ shapes allowed by the SOMPZ likelihood alone, which are affected by sample variance fluctuations from the small calibration fields, and resulting in a smoother distribution. The improvement on the uncertainty on the mean is more modest, but not null, as reported in Table 4. Usually, WZ data provide limited information on the mean redshift, especially compared to SOMPZ, as the systematic uncertainty on the galaxy bias evolution of the target sample is large and directly degenerate with the mean redshift, as is the case in Gatti et al. (2022). However, in this work we have included a tighter prior on the Sys(s) function describing the galaxy bias evolution uncertainty by measuring it directly from the MAGLIM autocorrelation function. The addition of the WZ information has a modest impact on the values of the mean and width of the redshift distributions, at most at the $1\sigma$ level (see Table 4); this is somewhat expected, as the WZ and SOMPZ information is independent, but consistent with each other.

## 5.1 Comparison with DNF

We find it interesting to compare the final SOMPZ+WZ redshift distributions with the fiducial ones used for DES Y3, obtained using DNF photometric estimates and clustering constraints (hereafter DNF+WZ). Since the two sets of distributions have been obtained with two different methods, we also briefly discuss the major differences between the two pipelines. The DNF code presented in Section 2.2.1 produces per-galaxy redshift estimates; these are stacked to produce the redshift distributions for the lens samples. Then, following Cawthon et al. (2022), a clustering redshift measurement is performed, using BOSS/eBOSS galaxies as reference sample, similarly to this work. The DNF $n(z)$ are matched to the WZ-estimated $n(z)$ through a chi-square fitting; in particular, the DNF $n(z)$

are allowed to shift and stretch to improve the $\chi^2$. The maximum a posteriori values of the shift and stretch and related uncertainties obtained through this matching procedure are used as a prior for the DNF $n(z)$ shift and stretch used in the cosmological inference.

Despite the DNF+WZ and SOMPZ+WZ methods using the same photometric and clustering measurements, the methodologies differ in a number of aspects:

(i) **SOMPZ versus DNF uncertainties:** SOMPZ and DNF are both machine learning methods, but they are substantially different in spirit and implementation. DNF is a traditional supervised machine learning code where the likelihood (directional neighbourhood) between wide field magnitudes/colours and redshift is learned from training with a subsample of galaxies with both reliable redshift information and measured wide field photometry. On the other hand, in SOMPZ machine learning is only used in an unsupervised fashion (without knowledge of redshift), to group self-similar parts of wide field magnitude/colour space together. Then, these groups (wide SOM cells) are probabilistically related using Bayes theorem to the colour-redshift relation measured empirically in the calibration deep fields, where much better information is available. The likelihood between each set of wide and deep field photometry is also measured empirically by injecting galaxies of the latter into images of the former. Furthermore, SOMPZ provides a comprehensive list of statistical as well as systematic uncertainties affecting the calibration samples which are rigorously propagated through the $n(z)$. On the other hand, DNF only describes statistical uncertainties related to the residual differences to the closest training neighbours to the fitted hyperplane of the target galaxies.

(ii) **Combination:** The clustering information is included and combined with the photometric estimates in a substantially different way. In this work, SOMPZ and WZ are combined by sampling from the joint posterior using the HMC method. No approximation is performed when combining the two likelihoods. On the other hand, matching DNF $n(z)$ to the WZ measurements it has been implicitly assumed that the DNF $n(z)$ estimates can only be biased at the level of their mean and width, and that inaccuracies in the higher order moments of the $n(z)$ can be neglected (or do not affect the matching procedure with the WZ measurements). However, if the DNF and WZ $n(z)$ estimates are substantially different beyond their first two moments, the matching might cause biases (Gatti et al. 2018) also in the first and second moments. Furthermore, in the combination of the fiducial method, the DNF shape is only allowed to be modified by shifting and stretching it. Therefore, the shift and stretch parameters are centred at the WZ values. This means that the photo-z priors for the cosmological inference only carry uncertainty from the WZ measurement, as this method does not propagate any systematic uncertainties related to uncertainty from the accuracy of DNF or the quality of its training sample photometry. In comparison, SOMPZ+WZ properly combines the statistical significance from SOMPZ and WZ yielding a final uncertainty that truly combines the information from each of them separately. Finally, the SOMPZ+WZ $n(z)$ samples also capture the uncertainties in the higher moments of the redshift distributions, whereas the DNF+WZ uncertainties are only relative to the mean and width.

(iii) **WZ distribution tails:** The WZ measurements used to calibrate the DNF $n(z)$ have clipped tails, since the measurements were performed in a restricted redshift window to avoid biases related to un-modelled magnification effects in the tails of the redshift distribution. On the other hand, in this work, when combining the clustering information with SOMPZ estimates, we use the WZ measurements over all the redshift range, since we also marginalize over magnification effects.
<figure><img src="image_7.png" /><figcaption>**Figure 5.** 3sDir distributions before (lighter shades) and after the combination with clustering-z (solid shades), and after the combination with clustering-z but using a broader prior on the parameters of the galaxy-matter bias function Sys(s)(the same values of the width of the prior p(s) that were used in Gatti et al. 2022). In the top row we have bins 1 and 4, in the middle row bins 2 and 5, and in the bottom rows bins 3 and 6. The bands represent the $1\sigma$ error from the central value. Note how the combination with WZ tightens the constraint on the shape of the $n(z)$.</figcaption></figure>

of the two methods results in stronger constraints on the shape of the $n(z)$, due to the complementarity in the information provided by each SOMPZ and WZ. Particularly, the WZ signal strongly correlates across adjacent bins, excluding large portions of possible $n(z)$ shapes allowed by the SOMPZ likelihood alone, which are affected by sample variance fluctuations from the small calibration fields, and resulting in a smoother distribution. The improvement on the uncertainty on the mean is more modest, but not null, as reported in Table 4. Usually, WZ data provide limited information on the mean redshift, especially compared to SOMPZ, as the systematic uncertainty on the galaxy bias evolution of the target sample is large and directly degenerate with the mean redshift, as is the case in Gatti et al. (2022). However, in this work we have included a tighter prior on the Sys(s) function describing the galaxy bias evolution uncertainty by measuring it directly from the MAGLIM autocorrelation function. The addition of the WZ information has a modest impact on the values of the mean and width of the redshift distributions, at most at the $1\sigma$ level (see Table 4); this is somewhat expected, as the WZ and SOMPZ information is independent, but consistent with each other.

## 5.1 Comparison with DNF

We find it interesting to compare the final SOMPZ+WZ redshift distributions with the fiducial ones used for DES Y3, obtained using DNF photometric estimates and clustering constraints (hereafter DNF+WZ). Since the two sets of distributions have been obtained with two different methods, we also briefly discuss the major differences between the two pipelines. The DNF code presented in Section 2.2.1 produces per-galaxy redshift estimates; these are stacked to produce the redshift distributions for the lens samples. Then, following Cawthon et al. (2022), a clustering redshift measurement is performed, using BOSS/eBOSS galaxies as reference sample, similarly to this work. The DNF $n(z)$ are matched to the WZ-estimated $n(z)$ through a chi-square fitting; in particular, the DNF $n(z)$

are allowed to shift and stretch to improve the $\chi^2$. The maximum a posteriori values of the shift and stretch and related uncertainties obtained through this matching procedure are used as a prior for the DNF $n(z)$ shift and stretch used in the cosmological inference.

Despite the DNF+WZ and SOMPZ+WZ methods using the same photometric and clustering measurements, the methodologies differ in a number of aspects:

(i) **SOMPZ versus DNF uncertainties:** SOMPZ and DNF are both machine learning methods, but they are substantially different in spirit and implementation. DNF is a traditional supervised machine learning code where the likelihood (directional neighbourhood) between wide field magnitudes/colours and redshift is learned from training with a subsample of galaxies with both reliable redshift information and measured wide field photometry. On the other hand, in SOMPZ machine learning is only used in an unsupervised fashion (without knowledge of redshift), to group self-similar parts of wide field magnitude/colour space together. Then, these groups (wide SOM cells) are probabilistically related using Bayes theorem to the colour-redshift relation measured empirically in the calibration deep fields, where much better information is available. The likelihood between each set of wide and deep field photometry is also measured empirically by injecting galaxies of the latter into images of the former. Furthermore, SOMPZ provides a comprehensive list of statistical as well as systematic uncertainties affecting the calibration samples which are rigorously propagated through the $n(z)$. On the other hand, DNF only describes statistical uncertainties related to the residual differences to the closest training neighbours to the fitted hyperplane of the target galaxies.

(ii) **Combination:** The clustering information is included and combined with the photometric estimates in a substantially different way. In this work, SOMPZ and WZ are combined by sampling from the joint posterior using the HMC method. No approximation is performed when combining the two likelihoods. On the other hand, matching DNF $n(z)$ to the WZ measurements it has been implicitly assumed that the DNF $n(z)$ estimates can only be biased at the level of their mean and width, and that inaccuracies in the higher order moments of the $n(z)$ can be neglected (or do not affect the matching procedure with the WZ measurements). However, if the DNF and WZ $n(z)$ estimates are substantially different beyond their first two moments, the matching might cause biases (Gatti et al. 2018) also in the first and second moments. Furthermore, in the combination of the fiducial method, the DNF shape is only allowed to be modified by shifting and stretching it. Therefore, the shift and stretch parameters are centred at the WZ values. This means that the photo-z priors for the cosmological inference only carry uncertainty from the WZ measurement, as this method does not propagate any systematic uncertainties related to uncertainty from the accuracy of DNF or the quality of its training sample photometry. In comparison, SOMPZ+WZ properly combines the statistical significance from SOMPZ and WZ yielding a final uncertainty that truly combines the information from each of them separately. Finally, the SOMPZ+WZ $n(z)$ samples also capture the uncertainties in the higher moments of the redshift distributions, whereas the DNF+WZ uncertainties are only relative to the mean and width.

(iii) **WZ distribution tails:** The WZ measurements used to calibrate the DNF $n(z)$ have clipped tails, since the measurements were performed in a restricted redshift window to avoid biases related to un-modelled magnification effects in the tails of the redshift distribution. On the other hand, in this work, when combining the clustering information with SOMPZ estimates, we use the WZ measurements over all the redshift range, since we also marginalize over magnification effects.
<figure><img src="image_6.png" /><figcaption>**Figure 6.** Left panel: final $n(z)$ realizations obtained from the SOMPZ methodology alone compared to the fiducial DNF distribution for MAGLIM (in black). Right panel: final $n(z)$ realizations obtained from both SOMPZ and WZ methodology compared to the fiducial DNF distribution for MAGLIM (grey bands) after shifting and stretching them to fit WZ measurement. Since in the inference the shift and stretch values are marginalized over, the uncertainties of the gray bands are obtained by sampling over the allowed ranges of shift and stretch defined by the prior, and applied, respectively, to the DNF estimate. Note that for a fairer comparison of the methods, the two remaining uncertainties were applied to the SOMPZ ensemble (zero-point and SOMPZ intrinsic), to include all the SOMPZ-related uncertainties. For both plots, in the top row we have bins 1 and 4, in the middle row bins 2 and 5, and in the bottom row bins 3 and 6.</figcaption></figure>

<table><caption>**Table 6.** Values of mean and width of the SOMPZ+WZ final ensemble of distributions and the DNF estimate. The statistical difference $\Delta_{<z>}$ is computed by considering the uncertainties of both methods summed in quadrature, as in $\Delta_{<z>} = (\langle z \rangle_{SOMPZ} - \langle z \rangle_{DNF})/\sqrt{\sigma(\langle z \rangle_{SOMPZ})^2 + \sigma(\langle z \rangle_{DNF})^2}$. We refer to these as are lower limits. Because the WZ measurement is very similar in the two cases, and the uncertainties summed in quadrature are correlated and therefore we are likely underestimating $\Delta_{<z>}$.</caption><thead><tr><th></th><th></th><th>Bin 1<br>z &isin; [0.2, 0.4]</th><th>Bin 2<br>z &isin; [0.4, 0.55]</th><th>Bin 3<br>z &isin; [0.55, 0.7]</th><th>Bin 4<br>z &isin; [0.7, 0.85]</th><th>Bin 5<br>z &isin; [0.85, 0.95]</th><th>Bin 6<br>z &isin; [0.95, 1.05]</th></tr></thead><tbody><tr><td rowspan="2">&lt;z&gt;</td><td>SOMPZ+WZ</td><td>0.315 &plusmn; 0.016</td><td>0.463 &plusmn; 0.010</td><td>0.633 &plusmn; 0.009</td><td>0.781 &plusmn; 0.008</td><td>0.893 &plusmn; 0.009</td><td>0.990 &plusmn; 0.012</td></tr><tr><td>DNF+WZ</td><td>0.292 &plusmn; 0.007</td><td>0.422 &plusmn; 0.011</td><td>0.616 &plusmn; 0.006</td><td>0.762 &plusmn; 0.006</td><td>0.887 &plusmn; 0.007</td><td>0.969 &plusmn; 0.008</td></tr><tr><td></td><td>&Delta;<sub>&lt;z&gt;</sub></td><td>1.3</td><td>2.7</td><td>1.7</td><td>1.9</td><td>0.5</td><td>1.5</td></tr><tr><td rowspan="2">&sigma;<sub>z</sub></td><td>SOMPZ+WZ</td><td>0.080 &plusmn; 0.005</td><td>0.081 &plusmn; 0.005</td><td>0.060 &plusmn; 0.002</td><td>0.073 &plusmn; 0.003</td><td>0.074 &plusmn; 0.004</td><td>0.102 &plusmn; 0.007</td></tr><tr><td>DNF+WZ</td><td>0.078 &plusmn; 0.005</td><td>0.094 &plusmn; 0.007</td><td>0.055 &plusmn; 0.003</td><td>0.062 &plusmn; 0.003</td><td>0.075 &plusmn; 0.004</td><td>0.080 &plusmn; 0.007</td></tr><tr><td></td><td>&Delta;<sub>&sigma;<sub>z</sub></sub></td><td>0.2</td><td>1.6</td><td>1.3</td><td>2.2</td><td>0.3</td><td>2.3</td></tr></tbody></table>

(iv) **WZ galaxy-matter bias:** The WZ measurements used in the DNF+WZ estimates are corrected for the redshift evolution of the galaxy-matter bias of the MAGLIM sample computed from autocorrelations measurements following equation (16) (Cawthon et al. 2022). As for this work we use the forward modelling approach described in Section 4.2, we instead do not correct directly for the bias, but from the MAGLIM autocorrelations we determine prior values of the parameters of our Sys(s), and then marginalize over possible bias functions in the sampling from the joint likelihood. We are therefore assuming an uncertainty on the galaxy-matter bias and validating the central value using SOMPZ data.

We must highlight that in Porredon et al. (2022) and Cawthon et al. (2022) several tests were performed to test the robustness of the DNF+WZ method. In particular, Cawthon et al. (2022) tested the performance of the clustering measurements in simulations, whereas Porredon et al. (2022) tested that matching DNF $n(z)$ to the WZ measurements was not introducing biases in the cosmological constraints, and that modelling only the uncertainties in the mean and width of the distributions was sufficient for the DES Y3 cosmological

analysis. These tests should cover potential worries raised in points (ii), (iii), and (iv) above for the DNF+WZ method. Having said this, any discrepancy between the SOMPZ+WZ $n(z)$ and the DNF+WZ $n(z)$ should boil down to the points listed above.

In Fig. 6, the shapes and uncertainties of the two methodologies are compared, before and after the inclusion of WZ information, respectively, in the left and right panel. Visually the DNF+WZ $n(z)$ look very similar to the SOMPZ+WZ ones, although some discrepancies can be noticed (e.g. in the second bin). We report in Table 6 the redshift means and widths of the two sets of distributions, and their agreement. The means and widths are also visually compared in Fig. 7. The agreement is computed assuming the uncertainties of the two methods to be uncorrelated, which is likely not true; therefore, the reported agreements are optimistic. Computing the level of correlation between the two redshift estimates is not trivial. The DNF+WZ estimates and uncertainties are driven only by the WZ measurements in the range where WZ measurements are available and magnification effects are negligible; the tails of the distribution, on the other hand, are described by the DNF
<figure><img src="image_8.png" /><figcaption>**Figure 6.** Left panel: final $n(z)$ realizations obtained from the SOMPZ methodology alone compared to the fiducial DNF distribution for MAGLIM (in black). Right panel: final $n(z)$ realizations obtained from both SOMPZ and WZ methodology compared to the fiducial DNF distribution for MAGLIM (grey bands) after shifting and stretching them to fit WZ measurement. Since in the inference the shift and stretch values are marginalized over, the uncertainties of the gray bands are obtained by sampling over the allowed ranges of shift and stretch defined by the prior, and applied, respectively, to the DNF estimate. Note that for a fairer comparison of the methods, the two remaining uncertainties were applied to the SOMPZ ensemble (zero-point and SOMPZ intrinsic), to include all the SOMPZ-related uncertainties. For both plots, in the top row we have bins 1 and 4, in the middle row bins 2 and 5, and in the bottom row bins 3 and 6.</figcaption></figure>

<table><caption>**Table 6.** Values of mean and width of the SOMPZ+WZ final ensemble of distributions and the DNF estimate. The statistical difference $\Delta_{<z>}$ is computed by considering the uncertainties of both methods summed in quadrature, as in $\Delta_{<z>} = (<z>_{SOMPZ} - <z>_{DNF})/\sqrt{\sigma(<z>_{SOMPZ})^2 + \sigma(<z>_{DNF})^2}$. We refer to these as are lower limits. Because the WZ measurement is very similar in the two cases, and the uncertainties summed in quadrature are correlated and therefore we are likely underestimating $\Delta_{<z>}$.</caption><thead><tr><th></th><th></th><th>Bin 1</th><th>Bin 2</th><th>Bin 3</th><th>Bin 4</th><th>Bin 5</th><th>Bin 6</th></tr><tr><th></th><th></th><th>z &isin; [0.2, 0.4]</th><th>z &isin; [0.4, 0.55]</th><th>z &isin; [0.55, 0.7]</th><th>z &isin; [0.7, 0.85]</th><th>z &isin; [0.85, 0.95]</th><th>z &isin; [0.95, 1.05]</th></tr></thead><tbody><tr><td rowspan="2">&lt;z&gt;</td><td>SOMPZ+WZ</td><td>0.315 &plusmn; 0.016</td><td>0.463 &plusmn; 0.010</td><td>0.633 &plusmn; 0.009</td><td>0.781 &plusmn; 0.008</td><td>0.893 &plusmn; 0.009</td><td>0.990 &plusmn; 0.012</td></tr><tr><td>DNF+WZ</td><td>0.292 &plusmn; 0.007</td><td>0.422 &plusmn; 0.011</td><td>0.616 &plusmn; 0.006</td><td>0.762 &plusmn; 0.006</td><td>0.887 &plusmn; 0.007</td><td>0.969 &plusmn; 0.008</td></tr><tr><td></td><td>&Delta;<sub>&lt;z&gt;</sub></td><td>1.3</td><td>2.7</td><td>1.7</td><td>1.9</td><td>0.5</td><td>1.5</td></tr><tr><td rowspan="2">&sigma;<sub>z</sub></td><td>SOMPZ+WZ</td><td>0.080 &plusmn; 0.005</td><td>0.081 &plusmn; 0.005</td><td>0.060 &plusmn; 0.002</td><td>0.073 &plusmn; 0.003</td><td>0.074 &plusmn; 0.004</td><td>0.102 &plusmn; 0.007</td></tr><tr><td>DNF+WZ</td><td>0.078 &plusmn; 0.005</td><td>0.094 &plusmn; 0.007</td><td>0.055 &plusmn; 0.003</td><td>0.062 &plusmn; 0.003</td><td>0.075 &plusmn; 0.004</td><td>0.080 &plusmn; 0.007</td></tr><tr><td></td><td>&Delta;<sub>&sigma;<sub>z</sub></sub></td><td>0.2</td><td>1.6</td><td>1.3</td><td>2.2</td><td>0.3</td><td>2.3</td></tr></tbody></table>

(iv) **WZ galaxy-matter bias:** The WZ measurements used in the DNF+WZ estimates are corrected for the redshift evolution of the galaxy-matter bias of the MAGLIM sample computed from autocorrelations measurements following equation (16) (Cawthon et al. 2022). As for this work we use the forward modelling approach described in Section 4.2, we instead do not correct directly for the bias, but from the MAGLIM autocorrelations we determine prior values of the parameters of our Sys(s), and then marginalize over possible bias functions in the sampling from the joint likelihood. We are therefore assuming an uncertainty on the galaxy-matter bias and validating the central value using SOMPZ data.

We must highlight that in Porredon et al. (2022) and Cawthon et al. (2022) several tests were performed to test the robustness of the DNF+WZ method. In particular, Cawthon et al. (2022) tested the performance of the clustering measurements in simulations, whereas Porredon et al. (2022) tested that matching DNF $n(z)$ to the WZ measurements was not introducing biases in the cosmological constraints, and that modelling only the uncertainties in the mean and width of the distributions was sufficient for the DES Y3 cosmological

analysis. These tests should cover potential worries raised in points (ii), (iii), and (iv) above for the DNF+WZ method. Having said this, any discrepancy between the SOMPZ+WZ $n(z)$ and the DNF+WZ $n(z)$ should boil down to the points listed above.

In Fig. 6, the shapes and uncertainties of the two methodologies are compared, before and after the inclusion of WZ information, respectively, in the left and right panel. Visually the DNF+WZ $n(z)$ look very similar to the SOMPZ+WZ ones, although some discrepancies can be noticed (e.g. in the second bin). We report in Table 6 the redshift means and widths of the two sets of distributions, and their agreement. The means and widths are also visually compared in Fig. 7. The agreement is computed assuming the uncertainties of the two methods to be uncorrelated, which is likely not true; therefore, the reported agreements are optimistic. Computing the level of correlation between the two redshift estimates is not trivial. The DNF+WZ estimates and uncertainties are driven only by the WZ measurements in the range where WZ measurements are available and magnification effects are negligible; the tails of the distribution, on the other hand, are described by the DNF
<figure><img src="image_7.png" /><figcaption>**Figure 7.** Visual representation of the uncertainties on mean (above) and width (below) of the redshift distributions estimated using the SOMPZ (square markers) and DNF (round markers) methods, before and after including the WZ information, for each tomographic bin. Below the dashed line is the comparison of the values computed in the redshift range used for the $\chi^2$ fit of the DNF estimate with the smoothed WZ $n(z)$.</figcaption></figure>

estimates. The SOMPZ+WZ estimates receive contributions from both SOMPZ and WZ; if the SOMPZ method was to completely drive our estimates, then the SOMPZ+WZ and the DNF+WZ estimates could be assumed to be independent. This is likely the case for the mean redshift estimates, as we have seen that WZ is not particularly constraining on the mean redshift (see Fig. 7). The width estimates are inferred more by the WZ measurements, and this might indicate that our tensions are underestimated, because we know that the two calibration methods share part of the WZ information. With this in mind, large tensions between means/widths of the two methods might indicate that either the DNF+WZ uncertainties are underestimated, or there are some real differences between the two methods (one or both are biased). The reported values in Table 6 does not point to dramatic differences between the two methods: the most extreme statistical distance is $2.7\sigma$ between means of Bin 2, and $2.3\sigma$ between widths of Bin 6.

From Table 6 we note that SOMPZ+WZ uncertainties on the mean are larger than the DNF+WZ ones, while uncertainties on the widths are comparable. This is due to the fact that the uncertainties in the mean redshifts for the SOMPZ estimates are very sensitive to contributions from outliers at high redshift. The DNF+WZ mean redshift estimates (and uncertainties), on the other hand, are driven by the match with the WZ measurements with clipped tails, i.e. they do not take into account uncertainties in the tails, and are therefore smaller. The fact that the modelling of the tails is different between the two methodologies is also responsible for the slightly higher mean redshifts of the SOMPZ+WZ estimates compared to the DNF+WZ estimates. If we restrict the comparison of the aforementioned quantities in redshift intervals that exclude the tails of the distributions, the match between SOMPZ+WZ and DNF+WZ improves (Fig. 7). We further investigate the importance of the tails on the cosmological constraints in Appendix D1, finding that, despite them being important, they do not drive the main difference between the SOMPZ+WZ and DNF+WZ constraints.

### 5.1.1 Galaxy-matter bias prior from WZ autocorrelation

We tested the impact on the Lambda cold dark matter (ΛCDM) cosmological parameters of using the same broad prior on the Sys(s) function describing the galaxy-matter bias as was done for the WL sample (Gatti et al. 2022). In this work we used more informative values computed from the clustering autocorrelation of the MAGLIM sample, the application of which is explained in more detail in Section 4.2. It is particularly interesting to look at the shape of distributions, especially for bin 2. Fig. 5 shows in grey the $1\sigma$ bands for the case without using the autocorrelation, and leaving a much broader prior. While in most bins the difference is not appreciable, and the grey bands are very similar to the solid bands, in bin 2 there is an evident difference. It is therefore suggested that this implementation of the autocorrelation information used as priors in the SOMPZ+WZ combination is able to help us constraining the galaxy-matter bias value, in a way that otherwise would not have been possible with traditional methods. In Fig. 7 is shown the comparison over mean redshift and width of the distributions between SOMPZ+WZ with the more informative prior from the autocorrelation, against the broad prior (labelled as 'SOMPZ+WZ (broad prior)'). The means and widths are well compatible with the standard SOMPZ+WZ results, and for bins 2 and 3 they are slightly closer to the DNF+WZ results. Even in bin 2, where the shape of the $n(z)$ is substantially different, the values of mean and width do not differ greatly from the standard case, reinforcing the notion that mean and width alone are not sufficient to fully characterize redshift distributions of a lens sample.

## 6 COSMOLOGICAL RESULTS

In this section, we show the constraints on cosmological and nuisance parameters obtained using the DES Y3 measurements for galaxy–galaxy lensing and galaxy clustering (Prat et al. 2022; Rodríguez-
<figure><img src="image_9.png" /><figcaption>**Figure 7.** Visual representation of the uncertainties on mean (above) and width (below) of the redshift distributions estimated using the SOMPZ (square markers) and DNF (round markers) methods, before and after including the WZ information, for each tomographic bin. Below the dashed line is the comparison of the values computed in the redshift range used for the $\chi^2$ fit of the DNF estimate with the smoothed WZ $n(z)$.</figcaption></figure>

estimates. The SOMPZ+WZ estimates receive contributions from both SOMPZ and WZ; if the SOMPZ method was to completely drive our estimates, then the SOMPZ+WZ and the DNF+WZ estimates could be assumed to be independent. This is likely the case for the mean redshift estimates, as we have seen that WZ is not particularly constraining on the mean redshift (see Fig. 7). The width estimates are inferred more by the WZ measurements, and this might indicate that our tensions are underestimated, because we know that the two calibration methods share part of the WZ information. With this in mind, large tensions between means/widths of the two methods might indicate that either the DNF+WZ uncertainties are underestimated, or there are some real differences between the two methods (one or both are biased). The reported values in Table 6 does not point to dramatic differences between the two methods: the most extreme statistical distance is $2.7\sigma$ between means of Bin 2, and $2.3\sigma$ between widths of Bin 6.

From Table 6 we note that SOMPZ+WZ uncertainties on the mean are larger than the DNF+WZ ones, while uncertainties on the widths are comparable. This is due to the fact that the uncertainties in the mean redshifts for the SOMPZ estimates are very sensitive to contributions from outliers at high redshift. The DNF+WZ mean redshift estimates (and uncertainties), on the other hand, are driven by the match with the WZ measurements with clipped tails, i.e. they do not take into account uncertainties in the tails, and are therefore smaller. The fact that the modelling of the tails is different between the two methodologies is also responsible for the slightly higher mean redshifts of the SOMPZ+WZ estimates compared to the DNF+WZ estimates. If we restrict the comparison of the aforementioned quantities in redshift intervals that exclude the tails of the distributions, the match between SOMPZ+WZ and DNF+WZ improves (Fig. 7). We further investigate the importance of the tails on the cosmological constraints in Appendix D1, finding that, despite them being important, they do not drive the main difference between the SOMPZ+WZ and DNF+WZ constraints.

### 5.1.1 Galaxy-matter bias prior from WZ autocorrelation

We tested the impact on the Lambda cold dark matter (ΛCDM) cosmological parameters of using the same broad prior on the Sys(s) function describing the galaxy-matter bias as was done for the WL sample (Gatti et al. 2022). In this work we used more informative values computed from the clustering autocorrelation of the MAGLIM sample, the application of which is explained in more detail in Section 4.2. It is particularly interesting to look at the shape of distributions, especially for bin 2. Fig. 5 shows in grey the $1\sigma$ bands for the case without using the autocorrelation, and leaving a much broader prior. While in most bins the difference is not appreciable, and the grey bands are very similar to the solid bands, in bin 2 there is an evident difference. It is therefore suggested that this implementation of the autocorrelation information used as priors in the SOMPZ+WZ combination is able to help us constraining the galaxy-matter bias value, in a way that otherwise would not have been possible with traditional methods. In Fig. 7 is shown the comparison over mean redshift and width of the distributions between SOMPZ+WZ with the more informative prior from the autocorrelation, against the broad prior (labelled as 'SOMPZ+WZ (broad prior)'). The means and widths are well compatible with the standard SOMPZ+WZ results, and for bins 2 and 3 they are slightly closer to the DNF+WZ results. Even in bin 2, where the shape of the $n(z)$ is substantially different, the values of mean and width do not differ greatly from the standard case, reinforcing the notion that mean and width alone are not sufficient to fully characterize redshift distributions of a lens sample.

## 6 COSMOLOGICAL RESULTS

In this section, we show the constraints on cosmological and nuisance parameters obtained using the DES Y3 measurements for galaxy–galaxy lensing and galaxy clustering (Prat et al. 2022; Rodríguez-
Monroy et al. (2022) (a.k.a. 2x2pt), and the $n(z)$ from this paper. As in Porredon et al. (2022), we also include in our analysis an additional likelihood constructed with the Shear Ratio (SR) measurements (Sánchez et al. 2022). This exploits galaxy–galaxy lensing signal at small scales ($<$6 Mpc h⁻¹) to provide further constraint to the redshift distributions and intrinsic alignment parameters. The ratio of a galaxy–galaxy lensing signal of each lens sample redshift bin computed with respect to two source sample bins results in a primarily geometric measurement, which has been proven to be a powerful method for constraining systematics and nuisance parameters. This adds independent information from SOMPZ and WZ to the source redshift calibration. The posterior distribution obtained follows the Bayes theorem:

$$P(p|D, M) \propto \mathcal{L}(D, p, M)\Pi(p|M), \qquad (19)$$

where $\Pi(p|M)$ is the prior distribution for all the parameters of the model $M$. For the cosmological inference we use the CosmoSIS pipeline (Zuntz et al. 2015), and we sample the parameter posteriors using the PolyChord sampler (Handley, Hobson & Lasenby 2015a,b).

Our data vector $D = \{w(\theta), \gamma_i(\theta)\}$ is compared to theoretical predictions $T(p) = \{w(\theta, p), \gamma_i(\theta, p)\}$ in a Bayesian fashion, and the posterior of the parameters conditional on the data is evaluated assuming a Gaussian likelihood for the data:

$$\log \mathcal{L} \propto -\frac{1}{2}(D - T(p))^T C^{-1} (D - T(p)), \qquad (20)$$

where $C$ is the measurement covariance. In our analysis, we vary five (or six) cosmological parameters assuming a $\Lambda$CDM (or wCDM) cosmology: $\Omega_m, \sigma_8, n_s, \Omega_b, h_{100}$, and $w$ for the wCDM case. Moreover, we also marginalize over ‘astrophysical’ nuisance parameters (describing intrinsic alignment effects and the galaxy-matter bias of the lens sample), and calibration parameters (redshift uncertainties, shear measurement uncertainties). In short, our set-up (covariance, parameters varied, prior ranges, etc.) is the same as the one adopted in Porredon et al. (2022), except for the redshift $n(z)$ and uncertainties priors of the lens sample, where the ones obtained in this work have been assumed, and other minor changes that we describe below. All modelling and analysis choices, together with the calculations of the theoretical two-point functions, are described in detail in Krause et al. (2021).

Our analyses were not ‘blinded’, since this work occurred after the ‘unblinding’ of the DES Y3 3x2pt results. We did not perform any cosmological analysis until the redshift distributions were frozen; no changes to the redshift distributions (and uncertainties prior) have been performed after looking at the cosmological constraints. To ensure the robustness of our final estimates, we adopted a $p$-value criteria on the best-fitting models to our data vector. Following Porredon et al. (2022), we required the goodness-of-fit $p$-value on unblinded data vectors was larger than 1 per cent. The goodness-of-fit has been computed using the predictive posterior distribution (PPD, Doux et al. 2021) and adopted in the main DES Y3 3x2pt analysis. The PPD methodology derives a calibrated probability-to-exceed $p$; in the case of goodness-of-fit tests, this is achieved by drawing realizations of the data vector for parameters drawn from the posterior under study which are then compared to actual observations. The distance metric ($\chi^2$) is computed in data space, which is then used to compute the $p$-value.

Concerning the redshift uncertainties, as it is the primary goal of this work, we proceeded using the fiducial DES Y3 methodology: we parametrize the redshift uncertainties with two parameters for each tomographic bin, which modify a fiducial $n(z)$ distribution with

a shift on the mean and a stretch on the width. The fiducial $n(z)$ is estimated by averaging the SOMPZ+WZ $n(z)$ realizations. The Gaussian priors on the mean and stretch parameters are centred at the mean and width of the fiducial $n(z)$, while the Gaussian priors width are measured from the variance in the mean and width of the $n(z)$ ensemble. This parametrization can be compared directly to the fiducial DES Y3 2x2pt analysis (Porredon et al. 2022). In Appendix D we describe an alternative marginalization of the redshift uncertainties, by marginalizing over the full sets of $n(z)$ realizations provided by the SOMPZ+WZ method. In principle, this latter method describes better the redshift uncertainties of our method. However, we find that the currently available techniques that marginalize over the full ensemble of realizations during cosmology inference are prohibitively computationally expensive. Therefore, we defer its application to future work.

Besides the different $n(z)$, we also ran a few analyses where we marginalized over magnification parameters of the lens samples over wide priors. This is different from Porredon et al. (2022), where magnification parameters have been fixed.

For the fiducial DES Y3 2x2pt analysis, the $p$-value from the data-model $\chi^2$ using all six bins of MAGLIM was not sufficient to pass the 1 per cent criteria. After a series of tests the consensus was that the two highest redshift tomographic bins were responsible for worsening the fit. Therefore, the analysis in Porredon et al. (2022) included only the first four MAGLIM bins. Here, we perform the analyses using all the six bins of the MAGLIM sample, but also using only the first four bins, to verify if the same applies also to this work using different redshift distributions.

In particular, we consider the following scenarios:

(i) $\Lambda$CDM ($w$CDM); four and six lens bins, fixed magnification. This is the fiducial analysis that mirrors the one presented in Porredon et al. (2022). Five (six) cosmological parameters are varied, including $\Omega_m, \sigma_8, n_s, \Omega_b, h_{100}$ (and $w$ for the $w$CDM case). Intrinsic alignment, shear measurement, and redshift uncertainties parameters (of both lenses and sources) and galaxy-matter linear biases of the lenses also are marginalized over. The magnification coefficients of the lens sample, however, are fixed to the values estimated from Balrog (Everett et al. 2022). Uncertainties in the redshift distributions of the lens sample are modelled as a shift and stretch in the distributions.

(ii) $\Lambda$CDM ($w$CDM); four and six lens bins, free magnification. Same parameters as the ones above, but magnification parameters are marginalized over using Gaussian priors. This is an additional set-up considered only after analysing the results from the aforementioned fixed magnification set-up.

In what follows, we will also quote results in terms of the $S_8$ parameter, defined as $S_8 \equiv \sigma_8(\Omega_m/0.3)^{0.5}$. In Table 7 we summarize the best-fitting values of $S_8, \Omega_m, \sigma_8, w$, and the computed PPD goodness-of-fit $p$-value for all the different analyses.

## 6.1 $\Lambda$CDM results

### 6.1.1 Fiducial results: four bins, fixed magnification, and comparison with DNF results

The first cosmological constraints we analyse are the ones obtained assuming a $\Lambda$CDM cosmology, using four lens bins and fixed magnification parameters. The decision on which set of results will be quoted as ‘fiducial’ for this work had to be made before conducting any cosmological analysis on data. We initially planned to only run the fiducial analyses with fixed magnification, as in Porredon et al. (2021). The choice between four or six lens bins would depend on the