# Euclid: Validation of the MontePython forecasting tools

S Casas, J Lesgourgues, N Schöneberg, Sabarish V.M., L Rathmann, M Doerenkamp, M Archidiacono, E Bellini, S Clesse, N Frusciante, et al.

► To cite this version:

S Casas, J Lesgourgues, N Schöneberg, Sabarish V.M., L Rathmann, et al. Euclid: Validation of the MontePython forecasting tools. Astronomy and Astrophysics - A&A, 2024, 682, pp.A90. 10.1051/0004-6361/202346772. [hal-04053837](https://hal.science/hal-04053837)

HAL Id: hal-04053837

https://hal.science/hal-04053837

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
# Euclid: Validation of the MontePython forecasting tools*

S. Casas¹, J. Lesgourgues¹, N. Schöneberg², V. M. Sabarish¹,³, L. Rathmann¹, M. Doerenkamp¹,⁴, M. Archidiacono⁵, E. Bellini⁶,⁷,⁸,⁹, S. Clesse¹⁰, N. Frusciante¹¹, M. Martinelli¹²,¹³, F. Pace¹⁴,¹⁵,¹⁶, D. Sapone¹⁷, Z. Sakr¹⁸,¹⁹,²⁰, A. Blanchard²⁰, T. Brinckmann²¹,²², S. Camera¹⁴,¹⁵,¹⁶, C. Carbone²³, S. Ilić²⁴,²⁵,²⁰, K. Markovic²⁶, V. Pettorino²⁷, I. Tutusaus²⁰, N. Aghanim²⁸, A. Amara²⁹, L. Amendola¹⁹, N. Auricchio³⁰, M. Baldi³¹,³⁰,³², D. Bonino¹⁶, E. Branchini³³,³⁴, M. Brescia¹¹,³⁵, J. Brinchmann³⁶, V. Capobianco¹⁶, V. F. Cardone¹²,¹³, J. Carretero³⁷,³⁸, M. Castellano¹², S. Cavuoti³⁵,³⁹, A. Cimatti⁴⁰, R. Cledassou²⁵,⁴¹, G. Congedo⁴², L. Conversi⁴³,⁴⁴, Y. Copin⁴⁵, L. Corcione¹⁶, F. Courbin⁴⁶, M. Cropper⁴⁷, H. Degaudenzi⁴⁸, J. Dinis⁴⁹,⁵⁰, M. Douspis²⁸, F. Dubath⁴⁸, X. Dupac⁴⁴, S. Dusini⁵¹, S. Farrens²⁷, M. Frailis⁸, E. Franceschi³⁰, M. Fumana²³, S. Galeotta⁸, B. Garilli²³, B. Gillis⁴², C. Giocoli³⁰,³², A. Grazian⁵², F. Grupp⁵³,⁵⁴, L. Guzzo⁵,⁹¹,⁹², S. V. H. Haugan⁵⁵, F. Hormuth⁵⁶, A. Hornstrup⁵⁷,⁵⁸, K. Jahnke⁵⁹, M. Kümmel⁶⁰, A. Kiessling²⁶, M. Kilbinger²⁷, T. Kitching⁴⁷, M. Kunz⁶¹, H. Kurki-Suonio⁶²,⁶³, S. Ligori¹⁶, P. B. Lilje⁵⁵, I. Lloro⁶⁴, O. Mansutti⁸, O. Marggraf⁶⁵, F. Marulli³¹,³⁰,³², R. Massey⁶⁶, E. Medinaceli³⁰, S. Mei⁶⁷, M. Meneghetti³⁰,³², E. Merlin¹², G. Meylan⁴⁶, M. Moresco³¹,³⁰, L. Moscardini³¹,³⁰,³², E. Munari⁸, S.-M. Niemi⁶⁸, C. Padilla³⁷, S. Paltani⁴⁸, F. Pasian⁸, K. Pedersen⁶⁹, W. J. Percival⁷⁰,⁷¹,⁷², S. Pires⁷³,⁷⁴, G. Polenta⁷⁵, M. Poncet²⁵, L. A. Popa⁷⁶, F. Raison⁵³, A. Renzi⁷⁷,⁵¹, J. Rhodes²⁶, G. Riccio³⁵, E. Romelli⁸, M. Roncarelli³⁰, E. Rossetti⁷⁸, R. Saglia⁶⁰,⁵³, B. Sartoris⁶⁰,⁸, P. Schneider⁶⁵, A. Secroun⁷⁹, G. Seidel⁵⁹, S. Serrano⁸⁰,⁸¹, C. Sirignano⁷⁷,⁵¹, G. Sirri³², L. Stanco⁵¹, J.-L. Starck⁷³, C. Surace⁸², P. Tallada-Crespi⁸³,³⁸, A. N. Taylor⁴², I. Tereno⁵⁰,⁸⁴, R. Toledo-Moreo⁸⁵, F. Torradeflot⁸³,³⁸, E. A. Valentijn⁸⁶, L. Valenziano³⁰,⁸⁷, T. Vassallo⁸, Y. Wang⁸⁸, J. Weller⁶⁰,⁵³, G. Zamorani³⁰, J. Zoubian⁷⁹, V. Scottez⁸⁹,⁶⁰, and A. Veropalumbo⁵

*(Affiliations can be found after the references)*

Received 28 April 2023 / Accepted 6 August 2023

## ABSTRACT

**Context.** The Euclid mission of the European Space Agency will perform a survey of weak lensing cosmic shear and galaxy clustering in order to constrain cosmological models and fundamental physics.

**Aims.** We expand and adjust the mock Euclid likelihoods of the MontePython software in order to match the exact recipes used in previous Euclid Fisher matrix forecasts for several probes: weak lensing cosmic shear, photometric galaxy clustering, the cross-correlation between the latter observables, and spectroscopic galaxy clustering. We also establish which precision settings are required when running the Einstein-Boltzmann solvers CLASS and CAMB in the context of Euclid.

**Methods.** For the minimal cosmological model, extended to include dynamical dark energy, we perform Fisher matrix forecasts based directly on a numerical evaluation of second derivatives of the likelihood with respect to model parameters. We compare our results with those of previously validated Fisher codes using an independent method based on first derivatives of the Euclid observables.

**Results.** We show that such MontePython forecasts agree very well with previous Fisher forecasts published by the Euclid Collaboration, and also, with new forecasts produced by the CosmicFish code, now interfaced directly with the two Einstein-Boltzmann solvers CAMB and CLASS. Moreover, to establish the validity of the Gaussian approximation, we show that the Fisher matrix marginal error contours coincide with the credible regions obtained when running Monte Carlo Markov chains with MontePython while using the exact same mock likelihoods.

**Conclusions.** The new Euclid forecast pipelines presented here are ready for use with additional cosmological parameters, in order to explore extended cosmological models.

**Key words.** cosmology: theory – surveys – cosmology: observations – large-scale structure of Universe – cosmological parameters

## 1. Introduction

Forecasts for large-scale structure surveys are useful, first, for predicting the sensitivity of future experiments to cosmological models and parameters, and second, for paving the way to the analysis of real data. After the publication of many independent Euclid-like forecasts, an effort was undertaken within the Euclid

Collaboration to compare several forecasting pipelines and validate them across each other. This has led to the publication of Euclid Collaboration (2020, 'Euclid preparation: VII', hereafter EP:VII).

EP:VII presents a comparison of Fisher forecasts, based on the calculation of the Fisher information matrix. This method provides a good approximation to the true experimental sensitivity as long as the posterior is nearly Gaussian, that is, as long as the likelihood is a nearly Gaussian function of model

<footnote>* This paper is published on behalf of the Euclid Consortium.</footnote>
# Euclid: Validation of the MontePython forecasting tools*

S. Casas¹, J. Lesgourgues¹, N. Schöneberg², V. M. Sabarish¹,³, L. Rathmann¹, M. Doerenkamp¹,⁴, M. Archidiacono⁵, E. Bellini⁶,⁷,⁸,⁹, S. Clesse¹⁰, N. Frusciante¹¹, M. Martinelli¹²,¹³, F. Pace¹⁴,¹⁵,¹⁶, D. Sapone¹⁷, Z. Sakr¹⁸,¹⁹,²⁰, A. Blanchard²⁰, T. Brinckmann²¹,²², S. Camera¹⁴,¹⁵,¹⁶, C. Carbone²³, S. Ilić²⁴,²⁵,²⁰, K. Markovic²⁶, V. Pettorino²⁷, I. Tutusaus²⁰, N. Aghanim²⁸, A. Amara²⁹, L. Amendola¹⁹, N. Auricchio³⁰, M. Baldi³¹,³⁰,³², D. Bonino¹⁶, E. Branchini³³,³⁴, M. Brescia¹¹,³⁵, J. Brinchmann³⁶, V. Capobianco¹⁶, V. F. Cardone¹²,¹³, J. Carretero³⁷,³⁸, M. Castellano¹², S. Cavuoti³⁵,³⁹, A. Cimatti⁴⁰, R. Cledassou²⁵,⁴¹, G. Congedo⁴², L. Conversi⁴³,⁴⁴, Y. Copin⁴⁵, L. Corcione¹⁶, F. Courbin⁴⁶, M. Cropper⁴⁷, H. Degaudenzi⁴⁸, J. Dinis⁴⁹,⁵⁰, M. Douspis²⁸, F. Dubath⁴⁸, X. Dupac⁴⁴, S. Dusini⁵¹, S. Farrens²⁷, M. Frailis⁸, E. Franceschi³⁰, M. Fumana²³, S. Galeotta⁸, B. Garilli²³, B. Gillis⁴², C. Giocoli³⁰,³², A. Grazian⁵², F. Grupp⁵³,⁵⁴, L. Guzzo⁵,⁹¹,⁹², S. V. H. Haugan⁵⁵, F. Hormuth⁵⁶, A. Hornstrup⁵⁷,⁵⁸, K. Jahnke⁵⁹, M. Kümmel⁶⁰, A. Kiessling²⁶, M. Kilbinger²⁷, T. Kitching⁴⁷, M. Kunz⁶¹, H. Kurki-Suonio⁶²,⁶³, S. Ligori¹⁶, P. B. Lilje⁵⁵, I. Lloro⁶⁴, O. Mansutti⁸, O. Marggraf⁶⁵, F. Marulli³¹,³⁰,³², R. Massey⁶⁶, E. Medinaceli³⁰, S. Mei⁶⁷, M. Meneghetti³⁰,³², E. Merlin¹², G. Meylan⁴⁶, M. Moresco³¹,³⁰, L. Moscardini³¹,³⁰,³², E. Munari⁸, S.-M. Niemi⁶⁸, C. Padilla³⁷, S. Paltani⁴⁸, F. Pasian⁸, K. Pedersen⁶⁹, W. J. Percival⁷⁰,⁷¹,⁷², S. Pires⁷³,⁷⁴, G. Polenta⁷⁵, M. Poncet²⁵, L. A. Popa⁷⁶, F. Raison⁵³, A. Renzi⁷⁷,⁵¹, J. Rhodes²⁶, G. Riccio³⁵, E. Romelli⁸, M. Roncarelli³⁰, E. Rossetti⁷⁸, R. Saglia⁶⁰,⁵³, B. Sartoris⁶⁰,⁸, P. Schneider⁶⁵, A. Secroun⁷⁹, G. Seidel⁵⁹, S. Serrano⁸⁰,⁸¹, C. Sirignano⁷⁷,⁵¹, G. Sirri³², L. Stanco⁵¹, J.-L. Starck⁷³, C. Surace⁸², P. Tallada-Crespi⁸³,³⁸, A. N. Taylor⁴², I. Tereno⁵⁰,⁸⁴, R. Toledo-Moreo⁸⁵, F. Torradeflot⁸³,³⁸, E. A. Valentijn⁸⁶, L. Valenziano³⁰,⁸⁷, T. Vassallo⁸, Y. Wang⁸⁸, J. Weller⁶⁰,⁵³, G. Zamorani³⁰, J. Zoubian⁷⁹, V. Scottez⁸⁹,⁶⁰, and A. Veropalumbo⁵

*(Affiliations can be found after the references)*

Received 28 April 2023 / Accepted 6 August 2023

## ABSTRACT

**Context.** The Euclid mission of the European Space Agency will perform a survey of weak lensing cosmic shear and galaxy clustering in order to constrain cosmological models and fundamental physics.

**Aims.** We expand and adjust the mock Euclid likelihoods of the MontePython software in order to match the exact recipes used in previous Euclid Fisher matrix forecasts for several probes: weak lensing cosmic shear, photometric galaxy clustering, the cross-correlation between the latter observables, and spectroscopic galaxy clustering. We also establish which precision settings are required when running the Einstein-Boltzmann solvers CLASS and CAMB in the context of Euclid.

**Methods.** For the minimal cosmological model, extended to include dynamical dark energy, we perform Fisher matrix forecasts based directly on a numerical evaluation of second derivatives of the likelihood with respect to model parameters. We compare our results with those of previously validated Fisher codes using an independent method based on first derivatives of the Euclid observables.

**Results.** We show that such MontePython forecasts agree very well with previous Fisher forecasts published by the Euclid Collaboration, and also, with new forecasts produced by the CosmicFish code, now interfaced directly with the two Einstein-Boltzmann solvers CAMB and CLASS. Moreover, to establish the validity of the Gaussian approximation, we show that the Fisher matrix marginal error contours coincide with the credible regions obtained when running Monte Carlo Markov chains with MontePython while using the exact same mock likelihoods.

**Conclusions.** The new Euclid forecast pipelines presented here are ready for use with additional cosmological parameters, in order to explore extended cosmological models.

**Key words.** cosmology: theory – surveys – cosmology: observations – large-scale structure of Universe – cosmological parameters

## 1. Introduction

Forecasts for large-scale structure surveys are useful, first, for predicting the sensitivity of future experiments to cosmological models and parameters, and second, for paving the way to the analysis of real data. After the publication of many independent Euclid-like forecasts, an effort was undertaken within the Euclid

Collaboration to compare several forecasting pipelines and validate them across each other. This has led to the publication of Euclid Collaboration (2020, 'Euclid preparation: VII', hereafter EP:VII).

EP:VII presents a comparison of Fisher forecasts, based on the calculation of the Fisher information matrix. This method provides a good approximation to the true experimental sensitivity as long as the posterior is nearly Gaussian, that is, as long as the likelihood is a nearly Gaussian function of model

<footnote>* This paper is published on behalf of the Euclid Consortium.</footnote>
parameters (for fixed fiducial data and assuming flat priors on model parameters). Fisher matrices can be tricky to compute because they involve a calculation of derivatives with a finite difference method. The results may depend on the choice of algorithm and stepsizes because of two factors: (i) numerical noise in the theory codes and Fisher matrix codes lead to unstable derivatives in the small stepsize limit, and (ii) the posterior may deviate from a multivariate Gaussian. EP:VII shows how to mitigate these issues and obtains a very good level of agreement between several Fisher matrix codes. We choose one of them, CosmicFish (Raveri et al. 2016), as a representative case of EP:VII codes. In this work, we validated a handful of new pipelines by comparing them directly with CosmicFish.

In order to compare different Fisher matrix codes in nearly ideal conditions, one can make a strategical choice. First, compute theory predictions in advance at various points in parameter space using an Einstein-Boltzmann Solver (EBS) and store the results in files. Secondly, let different Fisher matrix codes read these data and compute the Fisher matrix with their own algorithm. This strategy is the one adopted in EP:VII with theory predictions usually computed by the EBS CAMB (Lewis et al. 2000)<fnref n="1" />.

This approach is very well suited for the cross-comparison of several Fisher matrix codes, but not for testing the impact of different EBSs. One of the intermediate goals of this work is to achieve such a task. We compared CosmicFish results when the code reads some files produced either by CAMB or CLASS (Lesgourgues 2011a; Blas et al. 2011). We found very good agreement between these two choices. We also provide a discussion of the settings that need to be imposed to each code in order to get stable, accurate, and mutually agreeing results.

The strategy described above relies on the storage of the data containing theoretical predictions in some files. This was a ratio-
nal attitude for the purpose of comparing different Fisher matrix
codes. However, once Fisher matrix codes have been validated,
the need to run EBSs separately and to fill up a directory with
a substantial amount of data appears as relatively heavy. Ideally,
one would like to call the EBS on the fly from the Fisher code
in order to save time and memory. Another intermediate goal of
the current work is to implement this possibility in CosmicFish.
We validated forecasts in which CosmicFish calls either CAMB
or CLASS on the fly.

The Gaussian posterior approximation breaks in the case of
parameters with asymmetric error bars, with a posterior hitting
the prior edge (e.g. for parameters that are always positive and
whose best-fit value is close to zero), or in presence of a strong
nonlinear degeneracy between parameters. In order to go beyond
the Gaussian approximation, it is necessary to explore directly
the full likelihood instead of just its second derivatives computed
at the best-fit point. This is often done using Bayesian infer-
ence algorithms – such as, for instance, the Metropolis-Hastings
algorithm – involving Monte Carlo Markov chains (MCMCs).
Such MCMCs require a direct coding of the likelihood L unlike
Fisher matrix codes such as CosmicFish that require the coding
of its second derivatives, that is, of formulas in which the full
likelihood itself does not appear explicitly.

Euclid forecasts based on an MCMC approach were per-
formed earlier in a few papers (Audren et al. 2013b; Sprenger
et al. 2019; Brinckmann et al. 2019) using the framework of the

MontePython Bayesian inference package (Audren et al. 2013a; Brinckmann & Lesgourgues 2019). However, the Euclid recipes used in these works were never accurately compared to those validated in EP:VII.

An advantage of the MontePython package is that, once
the mock likelihood describing an experiment has been imple-
mented, it is possible to run MontePython either in Fisher
mode or in MCMC mode. The former mode estimates the Fisher
matrix directly from the likelihood evaluated at a few points
in the vicinity of the best fit (for details see Brinckmann &
Lesgourgues 2019). The MCMC mode allows for more reliable
forecasts beyond the Gaussian approximation. It is important to
stress that both methods rely on the numerical implementation of
the likelihood formula in a single place in the code. Thus, once
the likelihood has been validated in one mode, it can be con-
sidered as equally valid in the other mode. In our case, we can
validate the MontePython Euclid likelihoods against the fore-
casts of EP:VII by running MontePython (MP) in Fisher mode
(referred to as MP/Fisher from now on), and then, if needed,
use the same likelihoods in the MontePython MCMC mode
(which we call MP/MCMC). As such, MontePython is a valuable
tool to transition from reliable Fisher forecasts to reliable MCMC
forecasts.

One of the main goals of this paper is actually to validate the MP/Fisher Euclid pipeline against EP:VII pipelines, for the same cosmological model as in EP:VII, that is, the minimal ΛCDM model extended to dark energy with two equation-of-state parameters $w_0$ and $w_a$ – usually referred as the Chevallier–Polarski–Linder (CPL) model (Chevallier & Polarski 2001; Linder 2003). This validation has established that the MontePython Euclid likelihoods contain exactly the same modelling of Euclid data as EP:VII, and can thus be used for robust forecasts in both MP/Fisher and MP/MCMC modes. Note that MontePython can be readily used with all the free parameters of all the cosmological models implemented in the CLASS code. Thus, this validation is an important step for cosmologists who want to produce robust Euclid forecasts in essentially whatever extended cosmological model with or without the Fisher approximation.

However, we should stress that the MontePython mock Euclid likelihoods used within this paper should not be confused with the official Euclid likelihood meant to be used with real data, that is currently under development within the Euclid Collaboration. At this stage, the MontePython likelihoods are only meant for forecasting purposes. They do not account for the state of the art in the modelling of theoretical and instrumental effects within the Euclid Collaboration.

In Sect. 2 we discuss the general analytic form of the like-
lihood and of the Fisher matrix assumed in EP:VII codes –
such as CosmicFish – and in MontePython. These expres-
sions rely on the same observable power spectra describing
the data at the level of two-point statistics. In Sect. 3 we pro-
vide more details on the calculation of these observable power
spectra, taking into account nonlinear corrections and instru-
mental errors. In Sect. 4 we compare five ways to compute
the Fisher matrix with either CosmicFish or MontePython. In
Sect. 5 we summarise our results for the sensitivity of Euclid
to the parameters of the ΛCDM+$\{w_0, w_a\}$ model, showing also
the results of a MontePython MCMC forecast for comparison.
In Sect. 6 we discuss the importance of correctly setting the
input parameters of CAMB or CLASS in order to get consistent
and robust results – showing in particular that precision settings
need to be carefully handled in CAMB. We present our conclusions
in Sect. 7.

<footnote n="1">¹ This was not the case for all the algorithms used in EP:VII: for the photometric probe, two of the pipelines could call directly the EBS instead of storing its results in files.</footnote>
parameters (for fixed fiducial data and assuming flat priors on model parameters). Fisher matrices can be tricky to compute because they involve a calculation of derivatives with a finite difference method. The results may depend on the choice of algorithm and stepsizes because of two factors: (i) numerical noise in the theory codes and Fisher matrix codes lead to unstable derivatives in the small stepsize limit, and (ii) the posterior may deviate from a multivariate Gaussian. EP:VII shows how to mitigate these issues and obtains a very good level of agreement between several Fisher matrix codes. We choose one of them, CosmicFish (Raveri et al. 2016), as a representative case of EP:VII codes. In this work, we validated a handful of new pipelines by comparing them directly with CosmicFish.

In order to compare different Fisher matrix codes in nearly ideal conditions, one can make a strategical choice. First, compute theory predictions in advance at various points in parameter space using an Einstein-Boltzmann Solver (EBS) and store the results in files. Secondly, let different Fisher matrix codes read these data and compute the Fisher matrix with their own algorithm. This strategy is the one adopted in EP:VII with theory predictions usually computed by the EBS CAMB (Lewis et al. 2000)<fnref n="1" />.

This approach is very well suited for the cross-comparison of several Fisher matrix codes, but not for testing the impact of different EBSs. One of the intermediate goals of this work is to achieve such a task. We compared CosmicFish results when the code reads some files produced either by CAMB or CLASS (Lesgourgues 2011a; Blas et al. 2011). We found very good agreement between these two choices. We also provide a discussion of the settings that need to be imposed to each code in order to get stable, accurate, and mutually agreeing results.

The strategy described above relies on the storage of the data containing theoretical predictions in some files. This was a ratio-
nal attitude for the purpose of comparing different Fisher matrix
codes. However, once Fisher matrix codes have been validated,
the need to run EBSs separately and to fill up a directory with
a substantial amount of data appears as relatively heavy. Ideally,
one would like to call the EBS on the fly from the Fisher code
in order to save time and memory. Another intermediate goal of
the current work is to implement this possibility in CosmicFish.
We validated forecasts in which CosmicFish calls either CAMB
or CLASS on the fly.

The Gaussian posterior approximation breaks in the case of
parameters with asymmetric error bars, with a posterior hitting
the prior edge (e.g. for parameters that are always positive and
whose best-fit value is close to zero), or in presence of a strong
nonlinear degeneracy between parameters. In order to go beyond
the Gaussian approximation, it is necessary to explore directly
the full likelihood instead of just its second derivatives computed
at the best-fit point. This is often done using Bayesian infer-
ence algorithms – such as, for instance, the Metropolis-Hastings
algorithm – involving Monte Carlo Markov chains (MCMCs).
Such MCMCs require a direct coding of the likelihood L unlike
Fisher matrix codes such as CosmicFish that require the coding
of its second derivatives, that is, of formulas in which the full
likelihood itself does not appear explicitly.

Euclid forecasts based on an MCMC approach were per-
formed earlier in a few papers (Audren et al. 2013b; Sprenger
et al. 2019; Brinckmann et al. 2019) using the framework of the

MontePython Bayesian inference package (Audren et al. 2013a; Brinckmann & Lesgourgues 2019). However, the Euclid recipes used in these works were never accurately compared to those validated in EP:VII.

An advantage of the MontePython package is that, once
the mock likelihood describing an experiment has been imple-
mented, it is possible to run MontePython either in Fisher
mode or in MCMC mode. The former mode estimates the Fisher
matrix directly from the likelihood evaluated at a few points
in the vicinity of the best fit (for details see Brinckmann &
Lesgourgues 2019). The MCMC mode allows for more reliable
forecasts beyond the Gaussian approximation. It is important to
stress that both methods rely on the numerical implementation of
the likelihood formula in a single place in the code. Thus, once
the likelihood has been validated in one mode, it can be con-
sidered as equally valid in the other mode. In our case, we can
validate the MontePython Euclid likelihoods against the fore-
casts of EP:VII by running MontePython (MP) in Fisher mode
(referred to as MP/Fisher from now on), and then, if needed,
use the same likelihoods in the MontePython MCMC mode
(which we call MP/MCMC). As such, MontePython is a valuable
tool to transition from reliable Fisher forecasts to reliable MCMC
forecasts.

One of the main goals of this paper is actually to validate the MP/Fisher Euclid pipeline against EP:VII pipelines, for the same cosmological model as in EP:VII, that is, the minimal ΛCDM model extended to dark energy with two equation-of-state parameters $w_0$ and $w_a$ – usually referred as the Chevallier–Polarski–Linder (CPL) model (Chevallier & Polarski 2001; Linder 2003). This validation has established that the MontePython Euclid likelihoods contain exactly the same modelling of Euclid data as EP:VII, and can thus be used for robust forecasts in both MP/Fisher and MP/MCMC modes. Note that MontePython can be readily used with all the free parameters of all the cosmological models implemented in the CLASS code. Thus, this validation is an important step for cosmologists who want to produce robust Euclid forecasts in essentially whatever extended cosmological model with or without the Fisher approximation.

However, we should stress that the MontePython mock Euclid likelihoods used within this paper should not be confused with the official Euclid likelihood meant to be used with real data, that is currently under development within the Euclid Collaboration. At this stage, the MontePython likelihoods are only meant for forecasting purposes. They do not account for the state of the art in the modelling of theoretical and instrumental effects within the Euclid Collaboration.

In Sect. 2 we discuss the general analytic form of the like-
lihood and of the Fisher matrix assumed in EP:VII codes –
such as CosmicFish – and in MontePython. These expres-
sions rely on the same observable power spectra describing
the data at the level of two-point statistics. In Sect. 3 we pro-
vide more details on the calculation of these observable power
spectra, taking into account nonlinear corrections and instru-
mental errors. In Sect. 4 we compare five ways to compute
the Fisher matrix with either CosmicFish or MontePython. In
Sect. 5 we summarise our results for the sensitivity of Euclid
to the parameters of the ΛCDM+{w₀, wₐ} model, showing also
the results of a MontePython MCMC forecast for comparison.
In Sect. 6 we discuss the importance of correctly setting the
input parameters of CAMB or CLASS in order to get consistent
and robust results – showing in particular that precision settings
need to be carefully handled in CAMB. We present our conclusions
in Sect. 7.

<footnote n="1">¹ This was not the case for all the algorithms used in EP:VII: for the photometric probe, two of the pipelines could call directly the EBS instead of storing its results in files.</footnote>
## 2. Likelihood-based Fisher matrices

Forecasts for cosmological surveys are often based on the Fisher matrix formalism. In a Bayesian context the Fisher matrix describes the curvature of the logarithm of the likelihood $\mathcal{L}$ in the vicinity of the best fit<fnref n="2" />.

$$F_{\alpha\beta} = -\partial_{\alpha}\partial_{\beta}\ln \mathcal{L}|_{\text{best fit}}, \quad (1)$$

where $\{\alpha, \beta\}$ are the model (cosmological or nuisance) parameter indices. The Fisher matrix provides an accurate representation of the true likelihood only if the latter is close to being Gaussian, but it is fast to evaluate compared to a full MCMC forecast. In the presence of strong degeneracies among the parameters and highly non-Gaussian likelihoods, the Fisher matrix results may depend heavily on the steps used to evaluate numerical derivatives and may differ significantly from MCMC results. However, in the case of a sufficiently Gaussian posterior, the inverse of the Fisher matrix can be used to estimate confidence ellipses for pairs of parameters and confidence intervals for individual parameters. The present work confirms that for forecasts on the sensitivity of Euclid to the parameters of the $\Lambda$CDM+$\{w_0, w_\alpha\}$ model the Fisher formalism is applicable.

### 2.1. Photometric surveys

In a usual analysis of the photometric surveys of weak lensing (WL) and galaxy clustering (GCph), the observed<fnref n="3" /> signal is decomposed into spherical harmonic coefficients $a_i^{\text{fid}}(\ell, m)$ in each redshift bin $i$. In many analyses, these coefficients are modelled to be Gaussian distributed with a covariance matrix $C_{ij}^{\text{th}}(\ell)$. In a realistic universe this only captures a part of the information contained within the signal, but within this work we are not concerned with the analysis of other higher order statistics (such as for example the bi- or trispectrum, void or peak counts). Furthermore, it is often presumed that a reduced analyzed fraction of the sky $f_{\text{sky}} < 1$ causes a corresponding proportional decrease in the covariance matrix. This leads to the likelihood

$$\mathcal{L} = N \prod_{\ell m} \frac{1}{\sqrt{\det C_{\ell}^{\text{th}}}} e^{-f_{\text{sky}} \frac{1}{2} \sum_{ij} a_i^{\text{fid}}(\ell, m) (C_{ij}^{\text{th}})^{-1}(\ell) [a_j^{\text{fid}}(\ell, m)]^*}, \quad (2)$$

where the indices $\{i, j\}$ run over each bin of each probe, while $N$ is the likelihood normalization factor. Using the fact that the observed covariance can be estimated via $C_{ij}^{\text{fid}}(\ell) = \frac{1}{2\ell+1} \sum_m a_i^{\text{fid}}(\ell, m) [a_j^{\text{fid}}(\ell, m)]^*$, a few steps of algebra lead to

$$\chi^2 = -2 \ln \frac{\mathcal{L}}{\mathcal{L}_{\text{max}}} = f_{\text{sky}} \sum_{\ell} (2\ell + 1) \times \left\{ \ln \left[ \frac{\det C^{\text{th}}(\ell)}{\det C^{\text{fid}}(\ell)} \right] + \text{Tr}[(C^{\text{th}})^{-1}(\ell) C^{\text{fid}}(\ell)] - N \right\}, \quad (3)$$

where $N$ is the size of each $C(\ell)$ matrix. From here, two possible steps can be taken. Either one follows the definition of Eq. (1) to derive the Fisher matrix or one derives a more compact expression of the likelihood. The latter approach leads to

$$\chi^2 = f_{\text{sky}} \sum_{\ell} (2\ell + 1) \left( \frac{d_{\ell}^{\text{mix}}}{d_{\ell}^{\text{th}}} + \ln \frac{d_{\ell}^{\text{th}}}{d_{\ell}^{\text{fid}}} - N \right), \quad (4)$$

with

$$d_{\ell}^{\text{th}} = \det[C_{ij}^{\text{th}}(\ell)], \quad (5)$$

$$d_{\ell}^{\text{fid}} = \det[C_{ij}^{\text{fid}}(\ell)], \quad (6)$$

$$d_{\ell}^{\text{mix}} = \sum_{k} \det \begin{cases} C_{ij}^{\text{th}}(\ell) & \text{if } j \neq k \\ C_{ij}^{\text{fid}}(\ell) & \text{if } j = k \end{cases}. \quad (7)$$

In the last definition $k$ is an index running over each bin of each probe and thus over each column of the theory matrix $C^{\text{th}}$. In each term of the sum the determinant is evaluated over a matrix such that the $k$th column of the theory matrix $C^{\text{th}}$ has been substituted by one column of the fiducial matrix $C^{\text{fid}}$.

The likelihood of Eq. (3) can also be used to derive an expression for the Fisher matrix by differentiating twice with respect to an arbitrary pair of parameters of indices $\{\alpha, \beta\}$ and evaluating at the fiducial. Then we find a well-known compact expression for the Fisher matrix (Carron 2013; EP:VII)

$$F_{\alpha\beta} = \frac{1}{2} f_{\text{sky}} \sum_{\ell} (2\ell + 1) \text{Tr} \left\{ \left[C^{\text{fid}}(\ell)\right]^{-1} \left[\partial_{\alpha} C^{\text{th}}(\ell)\right]_{\text{fid}} \right\} \quad (8) \\ \left[C^{\text{fid}}(\ell)\right]^{-1} \left[\partial_{\beta} C^{\text{th}}(\ell)\right]_{\text{fid}} \right\},$$

where we omitted redshift bin indices for concision. All derivatives are evaluated precisely at the fiducial model<fnref n="4" />.

### 2.2. Spectroscopic surveys

Similarly, for galaxy clustering data in a spectroscopic survey (GCs) the likelihood is commonly assumed to be Gaussian with respect to the observed galaxy power spectrum $P_{\text{obs}}(k, \mu, z)$, such that $\chi^2 \equiv -2 \ln(\mathcal{L}/\mathcal{L}_{\text{max}})$ reads

$$\chi^2 \equiv -2 \ln \frac{\mathcal{L}}{\mathcal{L}_{\text{max}}} = \sum_i \int k^2 dk \int d\mu \frac{V_i^{\text{fid}}}{8\pi^2} \times \left\{ \frac{P_{\text{obs}}^{\text{th}}[k_{\text{obs}}(k, \mu, z_i), \mu_{\text{obs}}(\mu, z_i), z_i] - P_{\text{obs}}^{\text{fid}}(k, \mu, z_i)}{P_{\text{obs}}^{\text{th}}[k_{\text{obs}}(k, \mu, z_i), \mu_{\text{obs}}(\mu, z_i), z_i]} \right\}^2, \quad (9)$$

where $k$ is the Fourier wavenumber, $\mu$ is the cosine of the angle between the Fourier wavevector and the line of sight, $z_i$ is the central redshift of bin $i$, and $V_i^{\text{fid}}$ is the volume covered by this bin. In the previous expression $P_{\text{obs}}^{\text{th}}$ is the observable power spectrum, given by the galaxy spectrum of the theoretical cosmology (the cosmology that one wants to confront to the data) plus shot noise, and $P_{\text{obs}}^{\text{fid}}$ is the power spectrum of the mock observation (set equal to the galaxy spectrum of the fiducial cosmology plus shot noise). The volume $V_i^{\text{fid}}$ is evaluated for the latter cosmology. Importantly, Eq. (9) already contains the Alcock-Paczyński effect, in which the wavenumber $k$ and angle $\mu$ for the observed power spectrum are distorted through the impact of the analysis pipeline that converts the observed angular positions $\theta$ and redshifts $z$ of individual galaxies into a power spectrum through the use of some reference cosmology. This gives $z$-dependent relations between the value of $(k, \mu)$ in the reference cosmology and the observed values $(k_{\text{obs}}, \mu_{\text{obs}})$. We identify the reference

<footnote n="2">² In the context of forecasts the best fit is simply the assumed fiducial model.</footnote>

<footnote n="3">³ In typical forecasts there is no actual observed data. Instead, the fiducial model (referred here as “fid”) is used to emulate a possible observation.</footnote>

<footnote n="4">⁴ There exists another option: one may use a likelihood that is Gaussian in the $C(\ell)$'s instead of the $a_{\ell m}$'s. The EP:VII paper uses both methods to compute the Fisher matrix forecasts, showing that they are equivalent for all our practical purposes. See Eq. (142) and Eq. (143) in EP:VII for details.</footnote>
## 2. Likelihood-based Fisher matrices

Forecasts for cosmological surveys are often based on the Fisher matrix formalism. In a Bayesian context the Fisher matrix describes the curvature of the logarithm of the likelihood $\mathcal{L}$ in the vicinity of the best fit<fnref n="2" />.

$$F_{\alpha\beta} = -\partial_{\alpha}\partial_{\beta}\ln \mathcal{L}|_{\text{best fit}}, \quad (1)$$

where {$\alpha, \beta$} are the model (cosmological or nuisance) parameter indices. The Fisher matrix provides an accurate representation of the true likelihood only if the latter is close to being Gaussian, but it is fast to evaluate compared to a full MCMC forecast. In the presence of strong degeneracies among the parameters and highly non-Gaussian likelihoods, the Fisher matrix results may depend heavily on the steps used to evaluate numerical derivatives and may differ significantly from MCMC results. However, in the case of a sufficiently Gaussian posterior, the inverse of the Fisher matrix can be used to estimate confidence ellipses for pairs of parameters and confidence intervals for individual parameters. The present work confirms that for forecasts on the sensitivity of Euclid to the parameters of the $\Lambda$CDM+$\{w_0, w_\alpha\}$ model the Fisher formalism is applicable.

### 2.1. Photometric surveys

In a usual analysis of the photometric surveys of weak lensing (WL) and galaxy clustering (GCph), the observed<fnref n="3" /> signal is decomposed into spherical harmonic coefficients $a_i^{\text{fid}}(\ell, m)$ in each redshift bin $i$. In many analyses, these coefficients are modelled to be Gaussian distributed with a covariance matrix $C_{ij}^{\text{th}}(\ell)$. In a realistic universe this only captures a part of the information contained within the signal, but within this work we are not concerned with the analysis of other higher order statistics (such as for example the bi- or trispectrum, void or peak counts). Furthermore, it is often presumed that a reduced analyzed fraction of the sky $f_{\text{sky}} < 1$ causes a corresponding proportional decrease in the covariance matrix. This leads to the likelihood

$$\mathcal{L} = N \prod_{\ell m} \frac{1}{\sqrt{\det C_{\ell}^{\text{th}}}} e^{-f_{\text{sky}} \frac{1}{2} \sum_{ij} a_i^{\text{fid}}(\ell, m) (C_{ij}^{\text{th}})^{-1}(\ell) [a_j^{\text{fid}}(\ell, m)]^*}, \quad (2)$$

where the indices {$i, j$} run over each bin of each probe, while $N$ is the likelihood normalization factor. Using the fact that the observed covariance can be estimated via $C_{ij}^{\text{fid}}(\ell) = \frac{1}{2\ell+1} \sum_m a_i^{\text{fid}}(\ell, m) [a_j^{\text{fid}}(\ell, m)]^*$, a few steps of algebra lead to

$$\chi^2 \equiv -2 \ln \frac{\mathcal{L}}{\mathcal{L}_{\text{max}}} = f_{\text{sky}} \sum_{\ell} (2\ell + 1) \times \left\{ \ln \left[ \frac{\det C^{\text{th}}(\ell)}{\det C^{\text{fid}}(\ell)} \right] + \text{Tr}[(C^{\text{th}})^{-1}(\ell) C^{\text{fid}}(\ell)] - N \right\}, \quad (3)$$

where $N$ is the size of each $C(\ell)$ matrix. From here, two possible steps can be taken. Either one follows the definition of Eq. (1) to derive the Fisher matrix or one derives a more compact expression of the likelihood. The latter approach leads to

$$\chi^2 = f_{\text{sky}} \sum_{\ell} (2\ell + 1) \left( \frac{d_{\ell}^{\text{mix}}}{d_{\ell}^{\text{th}}} + \ln \frac{d_{\ell}^{\text{th}}}{d_{\ell}^{\text{fid}}} - N \right), \quad (4)$$

with

$$d_{\ell}^{\text{th}} = \det[C_{ij}^{\text{th}}(\ell)], \quad (5)$$

$$d_{\ell}^{\text{fid}} = \det[C_{ij}^{\text{fid}}(\ell)], \quad (6)$$

$$d_{\ell}^{\text{mix}} = \sum_{k} \det \begin{bmatrix} C_{ij}^{\text{th}}(\ell) & \text{if } j \neq k \\ C_{ij}^{\text{fid}}(\ell) & \text{if } j = k \end{bmatrix}. \quad (7)$$

In the last definition $k$ is an index running over each bin of each probe and thus over each column of the theory matrix $C^{\text{th}}$. In each term of the sum the determinant is evaluated over a matrix such that the $k$th column of the theory matrix $C^{\text{th}}$ has been substituted by one column of the fiducial matrix $C^{\text{fid}}$.

The likelihood of Eq. (3) can also be used to derive an expression for the Fisher matrix by differentiating twice with respect to an arbitrary pair of parameters of indices {$\alpha, \beta$} and evaluating at the fiducial. Then we find a well-known compact expression for the Fisher matrix (Carron 2013; EP:VII)

$$F_{\alpha\beta} = \frac{1}{2} f_{\text{sky}} \sum_{\ell} (2\ell + 1) \text{Tr} \left\{ \left[C^{\text{fid}}(\ell)\right]^{-1} \left[\partial_{\alpha} C^{\text{th}}(\ell)\right]_{\text{fid}} \right\} \quad (8) \\ \left[C^{\text{fid}}(\ell)\right]^{-1} \left[\partial_{\beta} C^{\text{th}}(\ell)\right]_{\text{fid}},$$

where we omitted redshift bin indices for concision. All derivatives are evaluated precisely at the fiducial model<fnref n="4" />.

### 2.2. Spectroscopic surveys

Similarly, for galaxy clustering data in a spectroscopic survey (GCs) the likelihood is commonly assumed to be Gaussian with respect to the observed galaxy power spectrum $P_{\text{obs}}(k, \mu, z)$, such that $\chi^2 \equiv -2 \ln(\mathcal{L}/\mathcal{L}_{\text{max}})$ reads

$$\chi^2 \equiv -2 \ln \frac{\mathcal{L}}{\mathcal{L}_{\text{max}}} = \sum_{i} \int k^2 dk \int d\mu \frac{V_i^{\text{fid}}}{8\pi^2} \times \left\{ \frac{P_{\text{obs}}^{\text{th}}[k_{\text{obs}}(k, \mu, z_i), \mu_{\text{obs}}(\mu, z_i), z_i] - P_{\text{obs}}^{\text{fid}}(k, \mu, z_i)}{P_{\text{obs}}^{\text{th}}[k_{\text{obs}}(k, \mu, z_i), \mu_{\text{obs}}(\mu, z_i), z_i]} \right\}^2, \quad (9)$$

where $k$ is the Fourier wavenumber, $\mu$ is the cosine of the angle between the Fourier wavevector and the line of sight, $z_i$ is the central redshift of bin $i$, and $V_i^{\text{fid}}$ is the volume covered by this bin. In the previous expression $P_{\text{obs}}^{\text{th}}$ is the observable power spectrum, given by the galaxy spectrum of the theoretical cosmology (the cosmology that one wants to confront to the data) plus shot noise, and $P_{\text{obs}}^{\text{fid}}$ is the power spectrum of the mock observation (set equal to the galaxy spectrum of the fiducial cosmology plus shot noise). The volume $V_i^{\text{fid}}$ is evaluated for the latter cosmology. Importantly, Eq. (9) already contains the Alcock-Paczyński effect, in which the wavenumber $k$ and angle $\mu$ for the observed power spectrum are distorted through the impact of the analysis pipeline that converts the observed angular positions $\theta$ and redshifts $z$ of individual galaxies into a power spectrum through the use of some reference cosmology. This gives $z$-dependent relations between the value of $(k, \mu)$ in the reference cosmology and the observed values $(k_{\text{obs}}, \mu_{\text{obs}})$. We identify the reference

<footnote n="2">² In the context of forecasts the best fit is simply the assumed fiducial model.</footnote>

<footnote n="3">³ In typical forecasts there is no actual observed data. Instead, the fiducial model (referred here as “fid”) is used to emulate a possible observation.</footnote>

<footnote n="4">⁴ There exists another option: one may use a likelihood that is Gaussian in the $C(\ell)$'s instead of the $a_{\ell m}$'s. The EP:VII paper uses both methods to compute the Fisher matrix forecasts, showing that they are equivalent for all our practical purposes. See Eq. (142) and Eq. (143) in EP:VII for details.</footnote>
cosmology and the fiducial cosmology in order to get simpler equations, since in this case $P_{\text{obs}}^{\text{fid}}$ does not receive additional Alcock-Paczyński factors. We write the precise formulas for the Alcock-Paczyński effect and the full observed power spectrum $P_{\text{obs}}(k, \mu, z)$ further below in Sect. 3.2.

By taking again the second derivative of Eq. (9) and evaluating it at the fiducial cosmology, we find the well-known and compact expression for the Fisher matrix

$$F_{\alpha\beta} = \sum_i \frac{1}{8\pi^2} \int d\mu \int k^2 dk \times \partial_\alpha \ln(P_{\text{obs}}^{\text{th}})|_{\text{fid}} \partial_\beta \ln(P_{\text{obs}}^{\text{th}})|_{\text{fid}} V_i^{\text{fid}}, \quad (10)$$

where the derivatives are evaluated precisely at the fiducial model and the arguments of the observed power spectrum are again $P_{\text{obs}}^{\text{th}}[k_{\text{obs}}(k, \mu, z_i), \mu_{\text{obs}}(\mu, z_i), z_i]^5$.

## 2.3. Likelihood derivatives

A specific code can compute the Fisher matrix with various methods, always involving the calculation of derivatives (of cosmological observables or directly of the likelihood) with respect to cosmological and nuisance parameters. Usually these derivatives are computed using numerical methods, such as an n-point derivative stencil or more advanced methods (such as fitting a low-order polynomial curve through a set of n points), but in several cases (such as bias parameters or shot noise) analytical formulas can be used instead. To compute the derivatives a given code receives the matter power spectrum $P_m(k, z)$ computed by an EBS (either linear as in Sect. 3.2 or corrected for nonlinear clustering using a specific recipe as in Sect. 3.1) evaluated at a few points in model parameter space. The spectrum is used to compute the cosmological observable (that is, the photometric harmonic spectra $C_{ij}^{\text{th}}(\ell)$ or the observable galaxy power spectrum $P_{\text{obs}}^{\text{th}}$) or directly the likelihood $\mathcal{L}$ and the derivative can be inferred.

### 2.3.1. The CosmicFish method

EP:VII uses various codes to get the Fisher matrix directly from Eqs. (8) and (10). The first-order derivatives $\partial_\alpha C^{\text{th}}(\ell)|_{\text{fid}}$ or $\partial_\alpha \ln(P_{i,\text{obs}}^{\text{th}})|_{\text{fid}}$ are inferred from finite differences, with $C^{\text{th}}(\ell)$ or $P_{i,\text{obs}}^{\text{th}}$ being computed at the fiducial point and in its vicinity by an EBS. The main purpose of EP:VII was to compare such codes. Each of them was reading the same input matter power spectra in some files produced by the EBS CAMB. These codes differed through the detailed numerical implementation of the Fisher formula and through the algorithm used to compute first-order derivatives. The validation of these different codes was based on a comparison between the predicted marginalised error on each model parameter (that is, the 68% confidence limit on a each parameter when all other parameters are unknown). A given code was validated when all marginalised errors lied within 10%

$$V_i^{\text{eff}}(k, \mu, z_i) = V_i^{\text{fid}} \left( \frac{n_i^{\text{fid}} P_{\text{obs}}^{\text{fid}}(k, \mu, z_i)}{n_i^{\text{fid}} P_{\text{obs}}^{\text{fid}}(k, \mu, z_i) + 1} \right)^2, \quad (11)$$

where $n_i^{\text{fid}}$ is the galaxy number density in each redshift bin and the product $n_i^{\text{fid}} P_{\text{obs}}^{\text{fid}}$ is dimensionless.

of the median computed across all the codes – which means that a maximum deviation of 20% on each marginalised error was allowed between pairs of codes.

Since our goal in this work was to validate a few additional pipelines, we needed to compare our new results with at least one of the validated EP:VII codes (comparing with all of them would have been intractable). We choose CosmicFish as our reference EP:VII code. CosmicFish can be set to compute the first-order derivative of cosmological spectra either with a simple two-sided finite difference method or with a more advanced SteM algorithm using ten different step sizes, which essentially fits a tangent to the curve as a function of the cosmological parameters, see Appendix B of Camera et al. (2017) for further details.

### 2.3.2. The MP/Fisher method

This method relies on the MontePython Euclid mock likelihoods, which are simply the numerical implementation of Eqs. (4) and (9) in the Python-based inference code MontePython (MP; Audren et al. 2013a; Brinckmann & Lesgourgues 2019). These Euclid mock likelihoods could easily be transposed to other samplers such as Cobaya. Simpler forms of these likelihoods have been presented in previous papers (Audren et al. 2013b; Sprenger et al. 2019) under the names euclid_pk and euclid_lensing. Together with this paper, we release<fnref n="6" /> an improved version of these likelihoods, named euclid_spectroscopic and euclid_photometric. These are designed to match the same recipes as EP:VII.

To derive the corresponding Fisher matrices the MP code does not use Eqs. (8) or (10), but computes the derivative directly from the likelihood (or $\chi^2$), using Eq. (1). All second derivatives are evaluated with a two-sided finite difference method. MP uses the EBS CLASS to compute the full $\chi^2$ at the fiducial point $\{\tilde{\theta}_\alpha\}$ and in its vicinity. Second derivatives with respect to a given parameter $\theta_\alpha$ are inferred from the likelihood at the fiducial point and at two adjacent points with $\theta_\alpha = \{\tilde{\theta}_\alpha \pm \Delta\theta_\alpha\}$. Cross derivatives with respect to two parameters $\{\theta_\alpha, \theta_\beta\}$ are inferred from the likelihood at the fiducial point and at four adjacent points with $\theta_\alpha = \{\tilde{\theta}_\alpha \pm \Delta\theta_\alpha\}$ and $\theta_\beta = \{\tilde{\theta}_\beta \pm \Delta\theta_\beta\}$.

EP:VII and the MP/Fisher method would give the same result for any given stepsize $\Delta\theta_\alpha$ if there was no numerical noise inherent to the codes and if the likelihood was a perfect multivariate Gaussian function of model parameters. However, neither of these criteria is fulfilled, leading to a possible dependence of the result on the chosen stepsize. We have illustrated this issue in the result section, and concluded that it can be overcome for the purpose of Euclid forecasts, at least in the case of the $\Lambda$CDM+$\{w_0, w_\alpha\}$ model.

The MP code was initially designed for Bayesian parameter inference with various MCMC algorithms but it features an automatic calculation of the Fisher matrix through finite differences since the release of version 3 in 2018 (Brinckmann & Lesgourgues 2019). The public code offers an advanced scheme for the choice of parameter stepsize, such as a search by iteration of each stepsize such that the variation of each parameter from $\tilde{\theta}_\alpha$ to $\tilde{\theta}_\alpha + \Delta\theta_\alpha$ leads to an increase of $-\ln \mathcal{L}$ by a target value $\Delta \ln \mathcal{L}$ chosen by the user, up to some tolerance. In this paper, for the sake of simplicity and efficiency, we disabled these iterations. In each run we directly fix the stepsize in our input files. We have

<footnote n="5">⁵ Note that EP:VII uses an equivalent expression in which the spectrum that appears in Eq. (10) does not include shot noise, while here we do assume that $P_{\text{obs}}^{\text{th}}$ and $P_{\text{obs}}^{\text{th}}$ include shot noise. In the conventions of EP:VII, to compensate for this, $V_i^{\text{fid}}$ needs to be replaced by</footnote>

<footnote n="6">⁶ The release will take place upon acceptance of this paper as an update of the main MontePython branch in the public repository.</footnote>
cosmology and the fiducial cosmology in order to get simpler equations, since in this case $P_{\text{obs}}^{\text{fid}}$ does not receive additional Alcock-Paczyński factors. We write the precise formulas for the Alcock-Paczyński effect and the full observed power spectrum $P_{\text{obs}}(k, \mu, z)$ further below in Sect. 3.2.

By taking again the second derivative of Eq. (9) and evaluating it at the fiducial cosmology, we find the well-known and compact expression for the Fisher matrix

$$F_{\alpha\beta} = \sum_i \frac{1}{8\pi^2} \int d\mu \int k^2 dk \times \partial_\alpha \ln(P_{\text{obs}}^{\text{th}})_{\text{fid}} \partial_\beta \ln(P_{\text{obs}}^{\text{th}})_{\text{fid}} V_i^{\text{fid}}, \quad (10)$$

where the derivatives are evaluated precisely at the fiducial model and the arguments of the observed power spectrum are again $P_{\text{obs}}^{\text{th}}[k_{\text{obs}}(k, \mu, z_i), \mu_{\text{obs}}(\mu, z_i), z_i]^5$.

## 2.3. Likelihood derivatives

A specific code can compute the Fisher matrix with various methods, always involving the calculation of derivatives (of cosmological observables or directly of the likelihood) with respect to cosmological and nuisance parameters. Usually these derivatives are computed using numerical methods, such as an n-point derivative stencil or more advanced methods (such as fitting a low-order polynomial curve through a set of n points), but in several cases (such as bias parameters or shot noise) analytical formulas can be used instead. To compute the derivatives a given code receives the matter power spectrum $P_m(k, z)$ computed by an EBS (either linear as in Sect. 3.2 or corrected for nonlinear clustering using a specific recipe as in Sect. 3.1) evaluated at a few points in model parameter space. The spectrum is used to compute the cosmological observable (that is, the photometric harmonic spectra $C_{ij}^{\text{th}}(\ell)$ or the observable galaxy power spectrum $P_{\text{obs}}^{\text{th}}$) or directly the likelihood $\mathcal{L}$ and the derivative can be inferred.

### 2.3.1. The CosmicFish method

EP:VII uses various codes to get the Fisher matrix directly from Eqs. (8) and (10). The first-order derivatives $\partial_\alpha C^{\text{th}}(\ell)_{\text{fid}}$ or $\partial_\alpha \ln(P_{i,\text{obs}}^{\text{th}})_{\text{fid}}$ are inferred from finite differences, with $C^{\text{th}}(\ell)$ or $P_{i,\text{obs}}^{\text{th}}$ being computed at the fiducial point and in its vicinity by an EBS. The main purpose of EP:VII was to compare such codes. Each of them was reading the same input matter power spectra in some files produced by the EBS CAMB. These codes differed through the detailed numerical implementation of the Fisher formula and through the algorithm used to compute first-order derivatives. The validation of these different codes was based on a comparison between the predicted marginalised error on each model parameter (that is, the 68% confidence limit on each parameter when all other parameters are unknown). A given code was validated when all marginalised errors lied within 10%

$$V_i^{\text{eff}}(k, \mu, z_i) = V_i^{\text{fid}} \left( \frac{n_i^{\text{fid}} P_{\text{obs}}^{\text{fid}}(k, \mu, z_i)}{n_i^{\text{fid}} P_{\text{obs}}^{\text{fid}}(k, \mu, z_i) + 1} \right)^2, \quad (11)$$

where $n_i^{\text{fid}}$ is the galaxy number density in each redshift bin and the product $n_i^{\text{fid}} P_{\text{obs}}^{\text{fid}}$ is dimensionless.

of the median computed across all the codes – which means that a maximum deviation of 20% on each marginalised error was allowed between pairs of codes.

Since our goal in this work was to validate a few additional pipelines, we needed to compare our new results with at least one of the validated EP:VII codes (comparing with all of them would have been intractable). We choose CosmicFish as our reference EP:VII code. CosmicFish can be set to compute the first-order derivative of cosmological spectra either with a simple two-sided finite difference method or with a more advanced SteM algorithm using ten different step sizes, which essentially fits a tangent to the curve as a function of the cosmological parameters, see Appendix B of Camera et al. (2017) for further details.

### 2.3.2. The MP/Fisher method

This method relies on the MontePython Euclid mock likelihoods, which are simply the numerical implementation of Eqs. (4) and (9) in the Python-based inference code MontePython (MP; Audren et al. 2013a; Brinckmann & Lesgourgues 2019). These Euclid mock likelihoods could easily be transposed to other samplers such as Cobaya. Simpler forms of these likelihoods have been presented in previous papers (Audren et al. 2013b; Sprenger et al. 2019) under the names euclid_pk and euclid_lensing. Together with this paper, we release<fnref n="6" /> an improved version of these likelihoods, named euclid_spectroscopic and euclid_photometric. These are designed to match the same recipes as EP:VII.

To derive the corresponding Fisher matrices the MP code does not use Eqs. (8) or (10), but computes the derivative directly from the likelihood (or $\chi^2$), using Eq. (1). All second derivatives are evaluated with a two-sided finite difference method. MP uses the EBS CLASS to compute the full $\chi^2$ at the fiducial point $\{\tilde{\theta}_\alpha\}$ and in its vicinity. Second derivatives with respect to a given parameter $\theta_\alpha$ are inferred from the likelihood at the fiducial point and at two adjacent points with $\theta_\alpha = \{\tilde{\theta}_\alpha \pm \Delta\theta_\alpha\}$. Cross derivatives with respect to two parameters $\{\theta_\alpha, \theta_\beta\}$ are inferred from the likelihood at the fiducial point and at four adjacent points with $\theta_\alpha = \{\tilde{\theta}_\alpha \pm \Delta\theta_\alpha\}$ and $\theta_\beta = \{\tilde{\theta}_\beta \pm \Delta\theta_\beta\}$.

EP:VII and the MP/Fisher method would give the same result for any given stepsize $\Delta\theta_\alpha$ if there was no numerical noise inherent to the codes and if the likelihood was a perfect multivariate Gaussian function of model parameters. However, neither of these criteria is fulfilled, leading to a possible dependence of the result on the chosen stepsize. We have illustrated this issue in the result section, and concluded that it can be overcome for the purpose of Euclid forecasts, at least in the case of the $\Lambda$CDM+$\{w_0, w_\alpha\}$ model.

The MP code was initially designed for Bayesian parameter inference with various MCMC algorithms but it features an automatic calculation of the Fisher matrix through finite differences since the release of version 3 in 2018 (Brinckmann & Lesgourgues 2019). The public code offers an advanced scheme for the choice of parameter stepsize, such as a search by iteration of each stepsize such that the variation of each parameter from $\tilde{\theta}_\alpha$ to $\tilde{\theta}_\alpha + \Delta\theta_\alpha$ leads to an increase of $-\ln \mathcal{L}$ by a target value $\Delta \ln \mathcal{L}$ chosen by the user, up to some tolerance. In this paper, for the sake of simplicity and efficiency, we disabled these iterations. In each run we directly fix the stepsize in our input files. We have

<footnote n="5">⁵ Note that EP:VII uses an equivalent expression in which the spectrum that appears in Eq. (10) does not include shot noise, while here we do assume that $P_{\text{obs}}^{\text{th}}$ and $P_{\text{obs}}^{\text{th}}$ include shot noise. In the conventions of EP:VII, to compensate for this, $V_i^{\text{fid}}$ needs to be replaced by</footnote>

<footnote n="6">⁶ The release will take place upon acceptance of this paper as an update of the main MontePython branch in the public repository.</footnote>
placed all our input files, scripts, and results in a public GitHub repository<fnref n="7" /> to make our results entirely reproducible.

# 3. Likelihood recipes

## 3.1. Photometric likelihood

### 3.1.1. General expression

The detailed calculation leading to the expression of the photometric spectra and likelihood adopted here has been described in many previous papers, including EP:VII. Here, we just want to precise the set of relations and assumptions used by our CosmicFish and MontePython pipelines, which match the previous settings adopted in EP:VII.

For the purpose of evaluating either the likelihood, see Eq. (4), or directly of the Fisher matrix, see Eq. (8), both CosmicFish and MontePython require the calculation of the photometric spectra $C_i^{XY}$ in multipole space, where $X, Y = L$ for the cosmic shear data or $G$ for the photometric galaxy data. In the sub-Hubble (Newtonian) limit and using the Limber approximation, one can write these spectra under the generic form

$$C_{ij}^{XY}(\ell) = \int_{z_{\min}}^{z_{\max}} dz \frac{W_i^X(z) W_j^Y(z)}{c^{-1} H(z) r^2(z)} P_m \left[ \frac{\ell + 1/2}{r(z)}, z \right] + N_{ij}^{XY}(\ell), \quad (12)$$

where $W_i^X(z)$ is the window function of the X observable in the ith redshift bin, $H(z)$ is the Hubble rate at redshift $z$, $r(z)$ is the comoving distance to $z$, $P_m(k, z)$ is the nonlinear matter power spectrum in Fourier space and $N_{ij}^{XY}(\ell)$ is the noise spectrum. In the codes we adopt units of Mpc⁻¹ for H/c, Mpc for r and Mpc³ for $P_m$, making the $C_{ij}^{XY}$ dimensionless. The integrals run over the redshift range [$z_{\min}, z_{\max}$] covered by the survey and we distinguish between $N_{\text{bin}}$ redshift bins.

In absence of intrinsic alignment effects (and assuming that the standard Poisson equation applies to sub-Hubble scales) the lensing window function in the ith bin would simply be given by

$$W_i^Y(z) = \frac{3}{2} c^{-2} H_0^2 \Omega_{m,0} (1+z) r(z) \times \int_z^{z_{\max}} dz' n_i(z') \left[ 1 - \frac{r(z)}{r(z')} \right], \quad (13)$$

where $n_i(z)$ is the observed galaxy density in each redshift bin.

In accordance with EP:VII, we model this density as some true underlying distribution $n(z)$, which is calibrated using a variety of different techniques (van den Busch et al. 2020; Naidoo et al. 2023), convolved with the photometric error $p_{\text{ph}}(z_p|z)$ of the experiment and normalized to unity,

$$n_i(z) = \frac{\int_{z_i^-}^{z_i^+} dz_p n(z) p_{\text{ph}}(z_p|z)}{\int_{z_{\min}}^{z_{\max}} dz \int_{z_i^-}^{z_i^+} dz_p n(z) p_{\text{ph}}(z_p|z)}, \quad (14)$$

where $z_i^-$ and $z_i^+$ are the edges of the ith redshift bin. As in EP:VII, we assume that the galaxy distribution is given by<fnref n="8" />

$$n(z) = \left(\frac{z}{z_0}\right)^2 \exp\left[-\left(\frac{z}{z_0}\right)^{1.5}\right], \quad (15)$$

with $z_0 = z_{\text{mean}}/\sqrt{2}$ and the mean redshift of the distribution, $z_{\text{mean}}$, is given in Table 1. The photometric redshift error is modeled as EP:VII.

$$p_{\text{ph}}(z_p|z) = \frac{1 - f_{\text{out}}}{\sqrt{2\pi}\sigma_b(1+z)} \exp\left\{-\frac{1}{2}\left[\frac{z - c_b z_p - z_b}{\sigma_b(1+z)}\right]^2\right\} + \frac{f_{\text{out}}}{\sqrt{2\pi}\sigma_0(1+z)} \exp\left\{-\frac{1}{2}\left[\frac{z - c_0 z_p - z_0}{\sigma_0(1+z)}\right]^2\right\}, \quad (16)$$

where the second term accounts for a fraction $f_{\text{out}}$ of catastrophic outliers. The parameters of this model are detailed in Table 1, while the observed galaxy density in each bin is shown in Fig. 1.

The contribution of intrinsic alignment effects to the total observed shear angular power spectrum can be modelled through a modification of the lensing window function. As a first step, one can assume the intrinsic alignment tracer to be biased with respect to the matter overdensity $\delta_m$ as $\delta_{\text{IA}}(k, z) = -\mathcal{A}_{\text{IA}} C_{\text{IA}} \Omega_{m,0} \mathcal{F}_{\text{IA}}(z) \delta_m(k, z)/D(z)$, where $\mathcal{A}_{\text{IA}}$ and $C_{\text{IA}}$ are two parameters, $D(z)$ is the linear growth factor of matter density fluctuations, and $\mathcal{F}_{\text{IA}}(z)$ is a function of the redshift-dependent mean luminosity of galaxies $\langle L \rangle(z)$ in units of a characteristic luminosity $L_*(z)$ EP:VII,

$$\mathcal{F}_{\text{IA}}(z) = (1+z)^{\eta_{\text{IA}}} [\langle L \rangle(z)/L_*(z)]^{\beta_{\text{IA}}}. \quad (17)$$

The parameters $\eta_{\text{IA}}$ and $A_{\text{IA}}$ are treated as nuisance parameters for the inference, while $C_{\text{IA}}$ and $\beta_{\text{IA}}$ are fixed in our analysis. With such a model, one can account for intrinsic alignment by adding a new term to $W_i^Y(z)$. The total lensing window function then reads

$$W_i^L(z) = W_i^Y(z) - \mathcal{A}_{\text{IA}} C_{\text{IA}} \Omega_{m,0} \frac{\mathcal{F}_{\text{IA}}(z)}{D(z)} W_i^{\text{IA}}(z), \quad (18)$$

with the definition

$$W_i^{\text{IA}}(z) = c^{-1} n_i(z) H(z). \quad (19)$$

The values of the parameters entering these expressions are summarized in Table 1. The function $\langle L \rangle(z)/L_*(z)$ is instead read in a file `scaledmeanlum_E2Sa.dat` provided on the public repository of the EP:VII publication<fnref n="9" />.

The inclusion of photometric data on galaxy clustering involves the galaxy window function

$$W_i^G(z) = c^{-1} n_i(z) H(z) b_i(z), \quad (20)$$

where $n_i(z)$ is again the observed galaxy density in each redshift bin, still given by Eq. (14), while $b_i(z)$ account for light-to-mass bias in the ith bin at redshift $z$. In principle, one could model bias as a unique continuous function of redshift, $b(z)$. However,

<footnote n="7">⁷ https://github.com/sabarish-vm/Euclid_w0wa.git</footnote>

<footnote n="8">⁸ Notice that a more realistic photometric distribution based on the Euclid Consortium Flagship was recently published in Euclid Collaboration (2021). However, for the sake of validation, we stick to the analytic formula used in EP:VII.</footnote>

<footnote n="9">⁹ https://github.com/euclidist-forecasting/fisher_for_public</footnote>
placed all our input files, scripts, and results in a public GitHub repository<fnref n="7" /> to make our results entirely reproducible.

# 3. Likelihood recipes

## 3.1. Photometric likelihood

### 3.1.1. General expression

The detailed calculation leading to the expression of the photometric spectra and likelihood adopted here has been described in many previous papers, including EP:VII. Here, we just want to precise the set of relations and assumptions used by our CosmicFish and MontePython pipelines, which match the previous settings adopted in EP:VII.

For the purpose of evaluating either the likelihood, see Eq. (4), or directly of the Fisher matrix, see Eq. (8), both CosmicFish and MontePython require the calculation of the photometric spectra $C_i^{XY}$ in multipole space, where X, Y = L for the cosmic shear data or G for the photometric galaxy data. In the sub-Hubble (Newtonian) limit and using the Limber approximation, one can write these spectra under the generic form

$$C_{ij}^{XY}(\ell) = \int_{z_{\min}}^{z_{\max}} dz \frac{W_i^X(z) W_j^Y(z)}{c^{-1} H(z) r^2(z)} P_m \left[ \frac{\ell + 1/2}{r(z)}, z \right] + N_{ij}^{XY}(\ell), \quad (12)$$

where $W_i^X(z)$ is the window function of the X observable in the ith redshift bin, $H(z)$ is the Hubble rate at redshift $z$, $r(z)$ is the comoving distance to $z$, $P_m(k, z)$ is the nonlinear matter power spectrum in Fourier space and $N_{ij}^{XY}(\ell)$ is the noise spectrum. In the codes we adopt units of Mpc⁻¹ for H/c, Mpc for r and Mpc³ for $P_m$, making the $C_{ij}^{XY}$ dimensionless. The integrals run over the redshift range [$z_{\min}, z_{\max}$] covered by the survey and we distinguish between $N_{\text{bin}}$ redshift bins.

In absence of intrinsic alignment effects (and assuming that the standard Poisson equation applies to sub-Hubble scales) the lensing window function in the ith bin would simply be given by

$$W_i^Y(z) = \frac{3}{2} c^{-2} H_0^2 \Omega_{m,0} (1+z) r(z) \times \int_z^{z_{\max}} dz' n_i(z') \left[ 1 - \frac{r(z)}{r(z')} \right], \quad (13)$$

where $n_i(z)$ is the observed galaxy density in each redshift bin.

In accordance with EP:VII, we model this density as some true underlying distribution $n(z)$, which is calibrated using a variety of different techniques (van den Busch et al. 2020; Naidoo et al. 2023), convolved with the photometric error $p_{\text{ph}}(z_p|z)$ of the experiment and normalized to unity,

$$n_i(z) = \frac{\int_{z_i^-}^{z_i^+} dz_p n(z) p_{\text{ph}}(z_p|z)}{\int_{z_{\min}}^{z_{\max}} dz \int_{z_i^-}^{z_i^+} dz_p n(z) p_{\text{ph}}(z_p|z)}, \quad (14)$$

where $z_i^-$ and $z_i^+$ are the edges of the ith redshift bin. As in EP:VII, we assume that the galaxy distribution is given by<fnref n="8" />

$$n(z) = \left(\frac{z}{z_0}\right)^2 \exp\left[-\left(\frac{z}{z_0}\right)^{1.5}\right], \quad (15)$$

with $z_0 = z_{\text{mean}}/\sqrt{2}$ and the mean redshift of the distribution, $z_{\text{mean}}$, is given in Table 1. The photometric redshift error is modeled as EP:VII.

$$p_{\text{ph}}(z_p|z) = \frac{1 - f_{\text{out}}}{\sqrt{2\pi}\sigma_b(1+z)} \exp\left\{-\frac{1}{2}\left[\frac{z - c_b z_p - z_b}{\sigma_b(1+z)}\right]^2\right\} + \frac{f_{\text{out}}}{\sqrt{2\pi}\sigma_0(1+z)} \exp\left\{-\frac{1}{2}\left[\frac{z - c_0 z_p - z_0}{\sigma_0(1+z)}\right]^2\right\}, \quad (16)$$

where the second term accounts for a fraction $f_{\text{out}}$ of catastrophic outliers. The parameters of this model are detailed in Table 1, while the observed galaxy density in each bin is shown in Fig. 1.

The contribution of intrinsic alignment effects to the total observed shear angular power spectrum can be modelled through a modification of the lensing window function. As a first step, one can assume the intrinsic alignment tracer to be biased with respect to the matter overdensity $\delta_m$ as $\delta_{\text{IA}}(k, z) = -\mathcal{A}_{\text{IA}} C_{\text{IA}} \Omega_{m,0} \mathcal{F}_{\text{IA}}(z) \delta_m(k, z)/D(z)$, where $\mathcal{A}_{\text{IA}}$ and $C_{\text{IA}}$ are two parameters, $D(z)$ is the linear growth factor of matter density fluctuations, and $\mathcal{F}_{\text{IA}}(z)$ is a function of the redshift-dependent mean luminosity of galaxies $\langle L \rangle(z)$ in units of a characteristic luminosity $L_*(z)$ EP:VII,

$$\mathcal{F}_{\text{IA}}(z) = (1+z)^{\eta_{\text{IA}}} [\langle L \rangle(z)/L_*(z)]^{\beta_{\text{IA}}}. \quad (17)$$

The parameters $\eta_{\text{IA}}$ and $A_{\text{IA}}$ are treated as nuisance parameters for the inference, while $C_{\text{IA}}$ and $\beta_{\text{IA}}$ are fixed in our analysis. With such a model, one can account for intrinsic alignment by adding a new term to $W_i^Y(z)$. The total lensing window function then reads

$$W_i^L(z) = W_i^Y(z) - \mathcal{A}_{\text{IA}} C_{\text{IA}} \Omega_{m,0} \frac{\mathcal{F}_{\text{IA}}(z)}{D(z)} W_i^{\text{IA}}(z), \quad (18)$$

with the definition

$$W_i^{\text{IA}}(z) = c^{-1} n_i(z) H(z). \quad (19)$$

The values of the parameters entering these expressions are summarized in Table 1. The function $\langle L \rangle(z)/L_*(z)$ is instead read in a file `scaledmeanlum_E2Sa.dat` provided on the public repository of the EP:VII publication<fnref n="9" />.

The inclusion of photometric data on galaxy clustering involves the galaxy window function

$$W_i^G(z) = c^{-1} n_i(z) H(z) b_i(z), \quad (20)$$

where $n_i(z)$ is again the observed galaxy density in each redshift bin, still given by Eq. (14), while $b_i(z)$ account for light-to-mass bias in the ith bin at redshift $z$. In principle, one could model bias as a unique continuous function of redshift, $b(z)$. However,

<footnote n="8">⁸ Notice that a more realistic photometric distribution based on the Euclid Consortium Flagship was recently published in Euclid Collaboration (2021). However, for the sake of validation, we stick to the analytic formula used in EP:VII.</footnote>

<footnote n="9">⁹ https://github.com/euclidist-forecasting/fisher_for_public</footnote>

<footnote n="7">⁷ https://github.com/sabarish-vm/Euclid_w0wa.git</footnote>
<table><caption>**Table 1.** Constants used in the Fisher and likelihood formulas.</caption><thead><tr><th>Type</th><th>Name</th><th>Value (pessimistic/optimistic)</th></tr></thead><tbody><tr><td>Redshift bins</td><td>N<sub>bin</sub></td><td>10</td></tr><tr><td>Redshift bins</td><td>z<sub>min</sub></td><td>0.001</td></tr><tr><td>Redshift bins</td><td>z<sub>max</sub></td><td>2.5</td></tr><tr><td>Redshift bins</td><td>z<sub>1</sub><sup>+</sup>, .., z<sub>5</sub><sup>+</sup></td><td>0.418, 0.560, 0.678, 0.789, 0.900</td></tr><tr><td>Redshift bins</td><td>z<sub>6</sub><sup>+</sup>, .., z<sub>9</sub><sup>+</sup></td><td>1.019, 1.155, 1.324, 1.576</td></tr><tr><td>Redshift bins</td><td>z<sub>mean</sub></td><td>0.9</td></tr><tr><td>Photometric error</td><td>c<sub>0</sub></td><td>1.0</td></tr><tr><td>Photometric error</td><td>c<sub>b</sub></td><td>1.0</td></tr><tr><td>Photometric error</td><td>z<sub>0</sub></td><td>0.1</td></tr><tr><td>Photometric error</td><td>z<sub>b</sub></td><td>0.0</td></tr><tr><td>Photometric error</td><td>σ<sub>0</sub></td><td>0.05</td></tr><tr><td>Photometric error</td><td>σ<sub>b</sub></td><td>0.05</td></tr><tr><td>Photometric error</td><td>f<sub>out</sub></td><td>0.1</td></tr><tr><td>Intrinsic alignment</td><td>C<sub>1A</sub></td><td>0.0134</td></tr><tr><td>Intrinsic alignment</td><td>β<sub>1A</sub></td><td>2.17</td></tr><tr><td>Noise</td><td>σ<sub>ε</sub></td><td>0.3</td></tr><tr><td>Noise</td><td>n<sub>gal</sub></td><td>30 arcmin<sup>-2</sup></td></tr><tr><td>Multipoles</td><td>ℓ<sub>min</sub></td><td>10</td></tr><tr><td>Multipoles</td><td>ℓ<sub>max</sub><sup>WL</sup></td><td>1500/5000</td></tr><tr><td>Multipoles</td><td>ℓ<sub>max</sub><sup>GCph</sup></td><td>750/1500</td></tr><tr><td>Sky coverage</td><td>f<sub>sky</sub></td><td>0.3636</td></tr></tbody></table>

**Notes.** Only the maximum multipole values vary between the pessimistic and optimistic settings.

<figure><img src="image_1.png" /><figcaption>**Fig. 1.** Underlying theoretical distribution of the number density of galaxies *n(z)* (black dashed line), normalised to one, together with the *n*<sub>i</sub>(*z*) (solid colored lines) at each of the 10 tomographic redshift bins (dotted vertical colored lines), normalised to 1/10. The *n*<sub>i</sub>(*z*) are wide and overlap each other due to the photometric redshift errors.</figcaption></figure>

in absence of a reliable bias model, the EP:VII group treated the mean biases $b_i$ in each bin as nuisance parameters. Technically, this could be implemented in various ways. Either with a constant bias for each bin *i* such that $b_i(z) = b_i$ for $z_{min} < z < z_{max}$ or with a unique function across all bins such that $b_i(z) = b(z)$ for $z_{min} < z < z_{max}$, where $b(z)$ is a step-like function taking the value $b_i$ within the range $z_i^- < z < z_i^+$. As a consequence of photometric redshift errors, the latter is not equivalent to the former because the functions $n_i(z)$ do not vanish outside of the range $[z_i^-, z_i^+]$. Thus, in the second simplified model, the functions

$n_i(z)$ feature discontinuities at each $z_i^+ = z_{i+1}^-$. Both options are implemented in our CosmicFish and MontePython pipelines. However, since EP:VII adopted the second model, we have also maintained it<fnref n="10" />.

Finally, we take into account the noise contribution to all auto-correlation spectra. Assuming a Poissonian distribution of galaxies, the noise spectra read

$$ 
\begin{aligned}
N_{ij}^{LL}(\ell) &= \frac{\sigma_{\epsilon}^2}{\bar{n}_i} \delta_{ij}, \\
N_{ij}^{GG}(\ell) &= \frac{1}{\bar{n}_i} \delta_{ij}, \\
N_{ij}^{LG}(\ell) &= N_{ij}^{GL}(\ell) = 0,
\end{aligned} 
\qquad (21) $$

where $\bar{n}_i$ is the expected average number of galaxies per steradian in the given bin *i* and $\sigma_{\epsilon}^2$ is the variance of the observed ellipticities. The number $\bar{n}_i$ is computed as the expected total number of galaxies per steradian, $n_{gal}$, divided by the number of bins<fnref n="11" />. Like in EP:VII we take a $\sigma_{\epsilon}$ of 0.21 per degree of freedom. Given the two degrees of freedom in the WL maps, this implies $\sigma_{\epsilon} = 0.21 \sqrt{2} \approx 0.30$.

The lensing spectra, galaxy clustering spectra, and cross-correlation spectra can be gathered in the full cross-correlation matrix

$$ C^{\text{ph}}(\ell) = \begin{bmatrix} C_{ij}^{\text{LL}}(\ell) & C_{ij}^{\text{GL}}(\ell) \\ C_{ij}^{\text{LG}}(\ell) & C_{ij}^{\text{GG}}(\ell) \end{bmatrix}. \qquad (22) $$

<footnote n="10">¹⁰ This technical detail is important for calculating derivatives with respect to the $b_i$'s. Thus it is necessary to stick to the same convention in order to recover a similar Fisher matrix. In the codes the second option (used here) is called *binned*, while the first option is called *binned constant*.</footnote>

<footnote n="11">¹¹ We are assuming equally populated bins as in EP:VII.</footnote>
<table><caption>**Table 1.** Constants used in the Fisher and likelihood formulas.</caption><thead><tr><th>Type</th><th>Name</th><th>Value (pessimistic/optimistic)</th></tr></thead><tbody><tr><td>Redshift bins</td><td>N<sub>bin</sub></td><td>10</td></tr><tr><td>Redshift bins</td><td>z<sub>min</sub></td><td>0.001</td></tr><tr><td>Redshift bins</td><td>z<sub>max</sub></td><td>2.5</td></tr><tr><td>Redshift bins</td><td>z<sub>1</sub><sup>+</sup>, .., z<sub>5</sub><sup>+</sup></td><td>0.418, 0.560, 0.678, 0.789, 0.900</td></tr><tr><td>Redshift bins</td><td>z<sub>6</sub><sup>+</sup>, .., z<sub>9</sub><sup>+</sup></td><td>1.019, 1.155, 1.324, 1.576</td></tr><tr><td>Redshift bins</td><td>z<sub>mean</sub></td><td>0.9</td></tr><tr><td>Photometric error</td><td>c<sub>0</sub></td><td>1.0</td></tr><tr><td>Photometric error</td><td>c<sub>b</sub></td><td>1.0</td></tr><tr><td>Photometric error</td><td>z<sub>0</sub></td><td>0.1</td></tr><tr><td>Photometric error</td><td>z<sub>b</sub></td><td>0.0</td></tr><tr><td>Photometric error</td><td>σ<sub>0</sub></td><td>0.05</td></tr><tr><td>Photometric error</td><td>σ<sub>b</sub></td><td>0.05</td></tr><tr><td>Photometric error</td><td>f<sub>out</sub></td><td>0.1</td></tr><tr><td>Intrinsic alignment</td><td>C<sub>1A</sub></td><td>0.0134</td></tr><tr><td>Intrinsic alignment</td><td>β<sub>1A</sub></td><td>2.17</td></tr><tr><td>Noise</td><td>σ<sub>ε</sub></td><td>0.3</td></tr><tr><td>Noise</td><td>n<sub>gal</sub></td><td>30 arcmin<sup>-2</sup></td></tr><tr><td>Multipoles</td><td>ℓ<sub>min</sub></td><td>10</td></tr><tr><td>Multipoles</td><td>ℓ<sub>max</sub><sup>WL</sup></td><td>1500/5000</td></tr><tr><td>Multipoles</td><td>ℓ<sub>max</sub><sup>GCph</sup></td><td>750/1500</td></tr><tr><td>Sky coverage</td><td>f<sub>sky</sub></td><td>0.3636</td></tr></tbody></table>

**Notes.** Only the maximum multipole values vary between the pessimistic and optimistic settings.

<figure><img src="image_2.png" /><figcaption>**Fig. 1.** Underlying theoretical distribution of the number density of galaxies *n(z)* (black dashed line), normalised to one, together with the *n*<sub>i</sub>(*z*) (solid colored lines) at each of the 10 tomographic redshift bins (dotted vertical colored lines), normalised to 1/10. The *n*<sub>i</sub>(*z*) are wide and overlap each other due to the photometric redshift errors.</figcaption></figure>

in absence of a reliable bias model, the EP:VII group treated the mean biases $b_i$ in each bin as nuisance parameters. Technically, this could be implemented in various ways. Either with a constant bias for each bin *i* such that $b_i(z) = b_i$ for $z_{\min} < z < z_{\max}$ or with a unique function across all bins such that $b_i(z) = b(z)$ for $z_{\min} < z < z_{\max}$, where $b(z)$ is a step-like function taking the value $b_i$ within the range $z_i^- < z < z_i^+$. As a consequence of photometric redshift errors, the latter is not equivalent to the former because the functions $n_i(z)$ do not vanish outside of the range $[z_i^-, z_i^+]$. Thus, in the second simplified model, the functions

$n_i(z)$ feature discontinuities at each $z_i^+ = z_{i+1}^-$. Both options are implemented in our CosmicFish and MontePython pipelines. However, since EP:VII adopted the second model, we have also maintained it<fnref n="10" />.

Finally, we take into account the noise contribution to all auto-correlation spectra. Assuming a Poissonian distribution of galaxies, the noise spectra read

$$ 
\begin{align} 
N_{ij}^{LL}(\ell) &= \frac{\sigma_{\epsilon}^2}{\bar{n}_i} \delta_{ij}, \nonumber \\ 
N_{ij}^{GG}(\ell) &= \frac{1}{\bar{n}_i} \delta_{ij}, \nonumber \\ 
N_{ij}^{LG}(\ell) &= N_{ij}^{GL}(\ell) = 0, \nonumber 
\end{align} 
\tag{21} $$

where $\bar{n}_i$ is the expected average number of galaxies per steradian in the given bin *i* and $\sigma_{\epsilon}^2$ is the variance of the observed ellipticities. The number $\bar{n}_i$ is computed as the expected total number of galaxies per steradian, $n_{\text{gal}}$, divided by the number of bins<fnref n="11" />. Like in EP:VII we take a $\sigma_{\epsilon}$ of 0.21 per degree of freedom. Given the two degrees of freedom in the WL maps, this implies $\sigma_{\epsilon} = 0.21 \sqrt{2} \approx 0.30$.

The lensing spectra, galaxy clustering spectra, and cross-correlation spectra can be gathered in the full cross-correlation matrix

$$ C^{\text{ph}}(\ell) = \begin{bmatrix} C_{ij}^{\text{LL}}(\ell) & C_{ij}^{\text{GL}}(\ell) \\ C_{ij}^{\text{LG}}(\ell) & C_{ij}^{\text{GG}}(\ell) \end{bmatrix}. \tag{22} $$

<footnote n="10">¹⁰ This technical detail is important for calculating derivatives with respect to the $b_i$'s. Thus it is necessary to stick to the same convention in order to recover a similar Fisher matrix. In the codes the second option (used here) is called *binned*, while the first option is called *binned constant*.</footnote>

<footnote n="11">¹¹ We are assuming equally populated bins as in EP:VII.</footnote>
<table><caption>**Table 2.** Redshift-dependent survey specifications evaluated at the central redshift $z_i$ of each redshift bin.</caption><thead><tr><th colspan="3">Redshift bin</th><th rowspan="2">Survey volume<br>V<sup>fid</sup><sub>i</sub> [Gpc<sup>3</sup>/(h<sup>fid</sup>)<sup>3</sup>]</th><th rowspan="2">Galaxy number density<br>n<sup>fid</sup><sub>i</sub> [10<sup>-4</sup> (h<sup>fid</sup>)<sup>3</sup>/Mpc<sup>3</sup>]</th><th rowspan="2">Galaxy bias<br>b<sup>fid</sup><sub>i</sub></th></tr><tr><th>z<sub>min</sub></th><th>z<sub>i</sub></th><th>z<sub>max</sub></th></tr></thead><tbody><tr><td>0.90</td><td>1.00</td><td>1.10</td><td>7.94</td><td>6.86</td><td>1.46</td></tr><tr><td>1.10</td><td>1.20</td><td>1.30</td><td>9.15</td><td>5.58</td><td>1.61</td></tr><tr><td>1.30</td><td>1.40</td><td>1.50</td><td>10.05</td><td>4.21</td><td>1.75</td></tr><tr><td>1.50</td><td>1.65</td><td>1.80</td><td>16.22</td><td>2.61</td><td>1.90</td></tr></tbody></table>

**Notes.** Quantities with units h Mpc⁻¹ are converted into Mpc⁻¹ always using the unique fiducial value h<sup>fid</sup>.

The calculation of the likelihood, see Eq. (4), or directly of the Fisher matrix, see Eq. (8), relies on two matrices for each ℓ, with elements $C_{ij}^{th}(ℓ)$ and $C_{ij}^{fid}(ℓ)$. These matrices are simply the $(2N_{\text{bin}}) \times (2N_{\text{bin}})$ matrix of Eq. (22), computed either at an arbitrary point in parameter space in the case of $C_{ij}^{th}(ℓ)$, or at fiducial parameter values in the case of $C_{ij}^{fid}(ℓ)$. Equations (4) and (8) feature a sum over ℓ from $ℓ_{\text{min}}$ to some $ℓ_{\text{max}}$. Following EP:VII conventions, we choose a smaller value of the maximum multipole for the galaxy survey, $ℓ_{\text{max}}^{\text{GCph}}$, than for the lensing survey, $ℓ_{\text{max}}^{\text{WL}} = ℓ_{\text{max}}$. This choice allows us to stick to scales where galaxy bias can be modelled as approximately linear. The boundary values are given in Table 1. This means that for $ℓ > ℓ_{\text{max}}^{\text{GCph}}$, $C_{ij}^{\text{ph}}(ℓ)$ reduces to the $N_{\text{bin}} \times N_{\text{bin}}$ matrix $C_{ij}^{\text{LL}}(ℓ)$.

### 3.1.2. Detailed numerical implementation

The nonlinear matter power spectrum $P_m(k, z)$ is obtained from either CLASS or CAMB. Nonlinear corrections are computed within these codes using Halofit – including Takahashi et al. (2020) and Bird et al. (2012) corrections, see Appendix A.4 for details. The nonlinear power spectrum is approximated as zero outside of the range [$k_{\text{min}}, k_{\text{max}}$] = [0.001, 50] h Mpc⁻¹. This range is sufficient to include most of the tails of the convolution kernels in Eq. (12) even for the multipoles $ℓ_{\text{min}} = 10$ and $ℓ_{\text{max}} = 5000$. The growth factor $D(z)$ is also extracted from CLASS or CAMB. In the case of MontePython, CLASS is called on-the-fly at every point in cosmological parameter space. On the other hand, CosmicFish can call either CLASS or CAMB on-the-fly, but it also can read a set of pre-computed files with cosmological quantities produced by any arbitrary EBS.

In the case of MontePython, which can also be used to perform MCMCs, computing the matrix elements $C_{ij}^{ph}(ℓ)$ for every single ℓ would be numerically expensive. Using the fact that these elements are smooth functions of ℓ, we only compute them on a discrete grid of values of size 100 (with logarithmic spacing between $ℓ_{\text{min}}$ and $ℓ_{\text{max}}$) and then use a spline interpolation to get them at every integer ℓ within the range [$ℓ_{\text{min}}, ℓ_{\text{max}}$]. The log-likelihood is computed by summing over all integer values of ℓ. In the case of CosmicFish, the angular spectra are computed on the same grid and do not need further interpolation, since the sum is evaluated only over the 100 ℓ-bins.

## 3.2. Spectroscopic likelihood

### 3.2.1. General expression

The details of our recipe for the spectroscopic likelihood have been described in many previous papers, including EP:VII. Here we just summarize briefly the set of relations and assumptions

used by our CosmicFish and MontePython pipelines, which match the prescription adopted by EP:VII.

For the purpose of evaluating either the likelihood, see Eq. (9), or directly of the Fisher matrix, see Eq. (10), both CosmicFish and MontePython require the calculation of the observed redshift-space galaxy power spectrum $P_{\text{obs}}(k, \mu, z)$ at wavenumber $k$, angle cosine $\mu$, and redshift $z$. The calculation of this quantity starts from the evaluation of the linear real-space matter power spectrum $P_{\text{m,lin}}(k, z)$, which can be computed with CAMB or CLASS. The calculation sticks to scales where one can assume a linear relation between the galaxy and matter power spectra. Then, the real-space galaxy linear power spectrum reads

$$P_{\text{gal,lin}}(k, z) = b^2(z)P_{\text{m,lin}}(k, z), \quad (23)$$

where $b(z)$ is the effective galaxy bias. We assume a constant bias $b_i$ in each redshift bin $i$ (with central redshift value $z_i$). Bin edges and fiducial bias values are specified in Table 2. To obtain the redshift-space galaxy linear power spectrum, one should further multiply $P_{\text{m,lin}}$ by the Kaiser correction factor (Kaiser 1987)

$$[b(z) + f(z)\mu^2]^2, \quad (24)$$

where $\mu = k \cdot \hat{r}/k$ is the cosine of the angle between the wave-vector $k$ and the line-of-sight direction $\hat{r}$ and $f(z)$ is the scale-independent growth rate<fnref n="12" />. In absence of massive neutrinos (or modified gravity effects), the redshift dependence of $\sigma_8(z)$ can be modeled as

$$\sigma_8(z) = D(z)\sigma_8(z=0). \quad (25)$$

The Fingers-of-God effect can be accounted with an additional prefactor $F_{\text{FoG}}(z)$, that we model as a Lorentzian (see e.g. Percival et al. 2004),

$$F_{\text{FoG}}(z) = \frac{1}{1 + [f(z) k \mu \sigma_p^{\text{fid}}(z)]^2}, \quad (26)$$

where the dispersion $\sigma_p^{\text{fid}}$ is given by an integral over the linear spectrum of the fiducial model,

$$[\sigma_p^{\text{fid}}(z)]^2 = \frac{1}{6\pi^2} \int dk P_{\text{m,lin}}^{\text{fid}}(k, z). \quad (27)$$

In practice, for the latter integral, we use finite boundaries specified in the next section.

Furthermore, baryon acoustic oscillations in the power spectrum are smoothed out by nonlinear matter clustering. This effect

<footnote n="12">¹² We recall that when the growth factor $D$ and growth rate $f$ are expressed as a function of the scale factor $a$, they are related to each other through $f(a) = d \ln D(a)/d \ln a$.</footnote>
<table><caption>**Table 2.** Redshift-dependent survey specifications evaluated at the central redshift $z_i$ of each redshift bin.</caption><thead><tr><th colspan="3">Redshift bin</th><th rowspan="2">Survey volume<br>V<sup>fid</sup><sub>i</sub> [Gpc<sup>3</sup>/(h<sup>fid</sup>)<sup>3</sup>]</th><th rowspan="2">Galaxy number density<br>n<sup>fid</sup><sub>i</sub> [10<sup>-4</sup> (h<sup>fid</sup>)<sup>3</sup>/Mpc<sup>3</sup>]</th><th rowspan="2">Galaxy bias<br>b<sup>fid</sup><sub>i</sub></th></tr><tr><th>z<sub>min</sub></th><th>z<sub>i</sub></th><th>z<sub>max</sub></th></tr></thead><tbody><tr><td>0.90</td><td>1.00</td><td>1.10</td><td>7.94</td><td>6.86</td><td>1.46</td></tr><tr><td>1.10</td><td>1.20</td><td>1.30</td><td>9.15</td><td>5.58</td><td>1.61</td></tr><tr><td>1.30</td><td>1.40</td><td>1.50</td><td>10.05</td><td>4.21</td><td>1.75</td></tr><tr><td>1.50</td><td>1.65</td><td>1.80</td><td>16.22</td><td>2.61</td><td>1.90</td></tr></tbody></table>

**Notes.** Quantities with units h Mpc⁻¹ are converted into Mpc⁻¹ always using the unique fiducial value h<sup>fid</sup>.

The calculation of the likelihood, see Eq. (4), or directly of the Fisher matrix, see Eq. (8), relies on two matrices for each ℓ, with elements $C_{ij}^{th}(ℓ)$ and $C_{ij}^{fid}(ℓ)$. These matrices are simply the $(2N_{\text{bin}}) \times (2N_{\text{bin}})$ matrix of Eq. (22), computed either at an arbitrary point in parameter space in the case of $C_{ij}^{th}(ℓ)$, or at fiducial parameter values in the case of $C_{ij}^{fid}(ℓ)$. Equations (4) and (8) feature a sum over ℓ from $ℓ_{\text{min}}$ to some $ℓ_{\text{max}}$. Following EP:VII conventions, we choose a smaller value of the maximum multipole for the galaxy survey, $ℓ_{\text{max}}^{\text{GCph}}$, than for the lensing survey, $ℓ_{\text{max}}^{\text{WL}} = ℓ_{\text{max}}$. This choice allows us to stick to scales where galaxy bias can be modelled as approximately linear. The boundary values are given in Table 1. This means that for $ℓ > ℓ_{\text{max}}^{\text{GCph}}$, $C_{ij}^{\text{ph}}(ℓ)$ reduces to the $N_{\text{bin}} \times N_{\text{bin}}$ matrix $C_{ij}^{\text{LL}}(ℓ)$.

### 3.1.2. Detailed numerical implementation

The nonlinear matter power spectrum $P_m(k, z)$ is obtained from either CLASS or CAMB. Nonlinear corrections are computed within these codes using Halofit – including Takahashi et al. (2020) and Bird et al. (2012) corrections, see Appendix A.4 for details. The nonlinear power spectrum is approximated as zero outside of the range [$k_{\text{min}}, k_{\text{max}}$] = [0.001, 50] h Mpc⁻¹. This range is sufficient to include most of the tails of the convolution kernels in Eq. (12) even for the multipoles $ℓ_{\text{min}} = 10$ and $ℓ_{\text{max}} = 5000$. The growth factor $D(z)$ is also extracted from CLASS or CAMB. In the case of MontePython, CLASS is called on-the-fly at every point in cosmological parameter space. On the other hand, CosmicFish can call either CLASS or CAMB on-the-fly, but it also can read a set of pre-computed files with cosmological quantities produced by any arbitrary EBS.

In the case of MontePython, which can also be used to perform MCMCs, computing the matrix elements $C_{ij}^{ph}(ℓ)$ for every single ℓ would be numerically expensive. Using the fact that these elements are smooth functions of ℓ, we only compute them on a discrete grid of values of size 100 (with logarithmic spacing between $ℓ_{\text{min}}$ and $ℓ_{\text{max}}$) and then use a spline interpolation to get them at every integer ℓ within the range [$ℓ_{\text{min}}, ℓ_{\text{max}}$]. The log-likelihood is computed by summing over all integer values of ℓ. In the case of CosmicFish, the angular spectra are computed on the same grid and do not need further interpolation, since the sum is evaluated only over the 100 ℓ-bins.

## 3.2. Spectroscopic likelihood

### 3.2.1. General expression

The details of our recipe for the spectroscopic likelihood have been described in many previous papers, including EP:VII. Here we just summarize briefly the set of relations and assumptions

used by our CosmicFish and MontePython pipelines, which match the prescription adopted by EP:VII.

For the purpose of evaluating either the likelihood, see Eq. (9), or directly of the Fisher matrix, see Eq. (10), both CosmicFish and MontePython require the calculation of the observed redshift-space galaxy power spectrum $P_{\text{obs}}(k, \mu, z)$ at wavenumber $k$, angle cosine $\mu$, and redshift $z$. The calculation of this quantity starts from the evaluation of the linear real-space matter power spectrum $P_{\text{m,lin}}(k, z)$, which can be computed with CAMB or CLASS. The calculation sticks to scales where one can assume a linear relation between the galaxy and matter power spectra. Then, the real-space galaxy linear power spectrum reads

$$P_{\text{gal,lin}}(k, z) = b^2(z)P_{\text{m,lin}}(k, z), \quad (23)$$

where $b(z)$ is the effective galaxy bias. We assume a constant bias $b_i$ in each redshift bin $i$ (with central redshift value $z_i$). Bin edges and fiducial bias values are specified in Table 2. To obtain the redshift-space galaxy linear power spectrum, one should further multiply $P_{\text{m,lin}}$ by the Kaiser correction factor (Kaiser 1987)

$$[b(z) + f(z)\mu^2]^2, \quad (24)$$

where $\mu = k \cdot \hat{r}/k$ is the cosine of the angle between the wave-vector $k$ and the line-of-sight direction $\hat{r}$ and $f(z)$ is the scale-independent growth rate<fnref n="12" />. In absence of massive neutrinos (or modified gravity effects), the redshift dependence of $\sigma_8(z)$ can be modeled as

$$\sigma_8(z) = D(z)\sigma_8(z=0). \quad (25)$$

The Fingers-of-God effect can be accounted with an additional prefactor $F_{\text{FoG}}(z)$, that we model as a Lorentzian (see e.g. Percival et al. 2004),

$$F_{\text{FoG}}(z) = \frac{1}{1 + [f(z) k \mu \sigma_p^{\text{fid}}(z)]^2}, \quad (26)$$

where the dispersion $\sigma_p^{\text{fid}}$ is given by an integral over the linear spectrum of the fiducial model,

$$[\sigma_p^{\text{fid}}(z)]^2 = \frac{1}{6\pi^2} \int dk P_{\text{m,lin}}^{\text{fid}}(k, z). \quad (27)$$

In practice, for the latter integral, we use finite boundaries specified in the next section.

Furthermore, baryon acoustic oscillations in the power spectrum are smoothed out by nonlinear matter clustering. This effect

<footnote n="12">¹² We recall that when the growth factor $D$ and growth rate $f$ are expressed as a function of the scale factor $a$, they are related to each other through $f(a) = d \ln D(a)/d \ln a$.</footnote>
<table><caption>**Table 3.** Specifications used in the spectroscopic likelihood and Fisher formulas.</caption><thead><tr><th>Type</th><th>Name</th><th>Value (Pessimistic/Optimistic)</th></tr></thead><tbody><tr><td>Spectroscopic error</td><td>σ<sub>0,z</sub></td><td>0.001</td></tr><tr><td>Wavenumber</td><td>k<sub>min</sub></td><td>0.001 h<sup>fid</sup>/Mpc</td></tr><tr><td>Wavenumber</td><td>k<sub>max</sub></td><td>(0.25/0.30) h<sup>fid</sup>/Mpc</td></tr></tbody></table>

can be approximately modelled by replacing $P_{\text{m,lin}}$ with the de-wiggled power spectrum

$$P_{\text{dw}}(k, \mu, z) \equiv P_{\text{m,lin}}(k, z) e^{-g_{\mu}k^2} + P_{\text{nw}}(k, z) (1 - e^{-g_{\mu}k^2}), \quad (28)$$

$$g_{\mu}(k, \mu, z) = [\sigma_{v}^{\text{fid}}(z)]^2 \{1 - \mu^2 + \mu^2[1 + f^{\text{fid}}(z)]^2\}, \quad (29)$$

where in this case $f^{\text{fid}}(z)$ is fixed to the fiducial cosmology. The no-wiggle power spectrum $P_{\text{nw}}(k, z)$ is obtained by smoothing $P_{\text{m,lin}}(k, z)$ as described in the next section. The variance of the displacement field $[\sigma_v^{\text{fid}}]^2$ for the fiducial model is set equal to the quantity $[\sigma_p^{\text{fid}}]^2$ defined in Eq. (27).

In EP:VII, two cases were considered. In the first one, $\sigma_v$ and $\sigma_p$ were treated as free parameters in each redshift bin, with fiducial values calculated at the $z_{\text{mean}}$ of the survey and rescaled by the growth factor $D(z)$. These parameters were then marginalized over. In the second one, in each redshift bin, these parameters were fixed to their fiducial value (computed with the power spectrum of the fiducial cosmology). The latter case assumes a better knowledge of nonlinear corrections and leads to more optimistic constraints. In this paper, we have stuck to the second option and kept these variables fixed in both our pessimistic and optimistic approaches.

Additionally, spectroscopic redshift errors further suppress this power spectrum by an overall factor

$$F_z(k, \mu, z) = \exp[-k^2 \mu^2 \sigma_r^2(z)], \quad (30)$$

where $\sigma_r(z)$ is the comoving distance error, which depends on the linear scaling of the redshift error $\sigma_{0,z}$:

$$\sigma_r(z) = \frac{c}{H(z)}(1+z)\sigma_{0,z}. \quad (31)$$

The value of $\sigma_{0,z}$ is given in Table 3.

Next, the Alcock-Paczyński effect introduces a change of the observed wavenumbers and angles with respect to the reference cosmology used for the analysis (identified here to the fiducial model). In particular, distances parallel to the line of sight and orthogonal to it are modified respectively by

$$k_{\perp,\text{obs}} = k_{\perp} q_{\perp} \frac{h}{h^{\text{fid}}}, \qquad k_{\parallel,\text{obs}} = k_{\parallel} q_{\parallel} \frac{h}{h^{\text{fid}}}, \quad (32)$$

where

$$q_{\perp} = \frac{D_{A}^{\text{fid}}(z)}{D_{A}(z)}, \qquad q_{\parallel} = \frac{H(z)}{H^{\text{fid}}(z)}. \quad (33)$$

Then, using $k^2 = k_{\perp}^2 + k_{\parallel}^2$ and $\mu = k_{\parallel}/k$ for both the fiducial wavevector (with no subscript) and the observed one (with subscript 'obs'), we can express the observed wavevector components as a function of the fiducial ones,

$$k_{\text{obs}} = k q_{\perp} \frac{h}{h^{\text{fid}}} \left[ 1 + \mu^2 \left( \frac{q_{\parallel}^2}{q_{\perp}^2} - 1 \right) \right]^{1/2}, \quad (34)$$

$$\mu_{\text{obs}} = \mu \frac{q_{\parallel}}{q_{\perp}} \left[ 1 + \mu^2 \left( \frac{q_{\parallel}^2}{q_{\perp}^2} - 1 \right) \right]^{-1/2}. \quad (35)$$

This shows explicitly that $\mu_{\text{obs}}$ is a function of $(\mu, z)$ while $k_{\text{obs}}$ is a function of $(k, \mu, z)$. Additionally, the Alcock-Paczyński effect implies that the overall power spectrum is multiplied by a factor of $q_{\perp}^2 q_{\parallel}$.

Finally, we also include a shot noise parameter $P_s(z)$:

$$P_s(z_i) = \frac{1}{n_i^{\text{fid}}} + p_s(z_i), \quad (36)$$

where the residual shot noise $p_s(z_i)$ is treated as a nuisance parameter with a fiducial value of 0 in each redshift bin, and $n_i^{\text{fid}}$ is the galaxy number density in each bin given in Table 2. In summary, the observed galaxy power spectrum in each bin $i$ reads (EP:VII)

$$P_{\text{obs}}(k_{\text{obs}}, \mu_{\text{obs}}, z_i) = q_{\perp}^2 q_{\parallel} \times \frac{[b_i \sigma_8(z_i) + f(z_i) \sigma_8(z_i) \mu_{\text{obs}}^2]^2}{1 + [f^{\text{fid}}(z_i) k_{\text{obs}} \mu_{\text{obs}} \sigma_p^{\text{fid}}(z_i)]^2} \times \frac{P_{\text{dw}}(k_{\text{obs}}, \mu_{\text{obs}}, z_i)}{\sigma_8^2(z_i)} F_z(k_{\text{obs}}, \mu_{\text{obs}}, z_i) + P_s(z_i), \quad (37)$$

where we omitted the arguments of the functions $k_{\text{obs}}(k, \mu, z)$ and $\mu_{\text{obs}}(\mu, z)$. In each redshift bin the product $b_i \sigma_8(z_i)$ is actually treated as an independent nuisance parameter, which means that it is kept fixed when varying the cosmological parameter $\sigma_8$. Together with the values of $p_s(z_i)$ the spectroscopic case features a total of 8 nuisance parameters. The fiducial value of each $b_i \sigma_8(z_i)$ is inferred from the $b_i^{\text{fid}}$ value reported in Table 2 multiplied by $\sigma_8^{\text{fid}}(z_i)$ (see Table B.2 for exact values).

To evaluate the likelihood (resp. the Fisher matrix), one should insert this expression into Eq. (9) (resp. into Eq. 10), which also depends on the volume $V_i^{\text{fid}}$ and $n_i^{\text{fid}}$ in each bin, whose values are listed in Table 2. Finally, one should integrate over $k$ from $k_{\text{min}}$ to $k_{\text{max}}$ (whose values are given in Table 3 for the pessimistic and an optimistic case) and $\mu$ from -1 to +1.

### 3.2.2. Detailed numerical implementation

For the sake of reproducibility, we provide here some details on the discretisation schemes, interpolation routines and integration algorithms used in our CosmicFish and MontePython pipelines. These settings ensure some well-converged calculations, such that changing them slightly would have a negligible impact on our results.

In our CosmicFish or MontePython algorithms the linear matter power spectrum $P_{\text{m,lin}}(k, z)$ is returned by CAMB or CLASS
<table><caption>**Table 3.** Specifications used in the spectroscopic likelihood and Fisher formulas.</caption><thead><tr><th>Type</th><th>Name</th><th>Value (Pessimistic/Optimistic)</th></tr></thead><tbody><tr><td>Spectroscopic error</td><td>σ<sub>0,z</sub></td><td>0.001</td></tr><tr><td>Wavenumber</td><td>k<sub>min</sub></td><td>0.001 h<sup>fid</sup>/Mpc</td></tr><tr><td>Wavenumber</td><td>k<sub>max</sub></td><td>(0.25/0.30) h<sup>fid</sup>/Mpc</td></tr></tbody></table>

can be approximately modelled by replacing $P_{m,lin}$ with the de-wiggled power spectrum

$$P_{\text{dw}}(k, \mu, z) \equiv P_{\text{m,lin}}(k, z) e^{-g_{\mu}k^2} + P_{\text{nw}}(k, z) (1 - e^{-g_{\mu}k^2}), \quad (28)$$

$$g_{\mu}(k, \mu, z) = [\sigma_{v}^{\text{fid}}(z)]^2 \{1 - \mu^2 + \mu^2[1 + f^{\text{fid}}(z)]^2\}, \quad (29)$$

where in this case $f^{\text{fid}}(z)$ is fixed to the fiducial cosmology. The no-wiggle power spectrum $P_{\text{nw}}(k, z)$ is obtained by smoothing $P_{\text{m,lin}}(k, z)$ as described in the next section. The variance of the displacement field $[\sigma_v^{\text{fid}}]^2$ for the fiducial model is set equal to the quantity $[\sigma_p^{\text{fid}}]^2$ defined in Eq. (27).

In EP:VII, two cases were considered. In the first one, $\sigma_v$ and $\sigma_p$ were treated as free parameters in each redshift bin, with fiducial values calculated at the $z_{\text{mean}}$ of the survey and rescaled by the growth factor $D(z)$. These parameters were then marginalized over. In the second one, in each redshift bin, these parameters were fixed to their fiducial value (computed with the power spectrum of the fiducial cosmology). The latter case assumes a better knowledge of nonlinear corrections and leads to more optimistic constraints. In this paper, we have stuck to the second option and kept these variables fixed in both our pessimistic and optimistic approaches.

Additionally, spectroscopic redshift errors further suppress this power spectrum by an overall factor

$$F_z(k, \mu, z) = \exp[-k^2 \mu^2 \sigma_r^2(z)], \quad (30)$$

where $\sigma_r(z)$ is the comoving distance error, which depends on the linear scaling of the redshift error $\sigma_{0,z}$:

$$\sigma_r(z) = \frac{c}{H(z)}(1+z)\sigma_{0,z}. \quad (31)$$

The value of $\sigma_{0,z}$ is given in Table 3.

Next, the Alcock-Paczyński effect introduces a change of the observed wavenumbers and angles with respect to the reference cosmology used for the analysis (identified here to the fiducial model). In particular, distances parallel to the line of sight and orthogonal to it are modified respectively by

$$k_{\perp,\text{obs}} = k_{\perp} q_{\perp} \frac{h}{h^{\text{fid}}}, \qquad k_{\parallel,\text{obs}} = k_{\parallel} q_{\parallel} \frac{h}{h^{\text{fid}}}, \quad (32)$$

where

$$q_{\perp} = \frac{D_{A}^{\text{fid}}(z)}{D_{A}(z)}, \qquad q_{\parallel} = \frac{H(z)}{H^{\text{fid}}(z)}. \quad (33)$$

Then, using $k^2 = k_{\perp}^2 + k_{\parallel}^2$ and $\mu = k_{\parallel}/k$ for both the fiducial wavevector (with no subscript) and the observed one (with subscript 'obs'), we can express the observed wavevector components as a function of the fiducial ones,

$$k_{\text{obs}} = k q_{\perp} \frac{h}{h^{\text{fid}}} \left[ 1 + \mu^2 \left( \frac{q_{\parallel}^2}{q_{\perp}^2} - 1 \right) \right]^{1/2}, \quad (34)$$

$$\mu_{\text{obs}} = \mu \frac{q_{\parallel}}{q_{\perp}} \left[ 1 + \mu^2 \left( \frac{q_{\parallel}^2}{q_{\perp}^2} - 1 \right) \right]^{-1/2}. \quad (35)$$

This shows explicitly that $\mu_{\text{obs}}$ is a function of $(\mu, z)$ while $k_{\text{obs}}$ is a function of $(k, \mu, z)$. Additionally, the Alcock-Paczyński effect implies that the overall power spectrum is multiplied by a factor of $q_{\perp}^2 q_{\parallel}$.

Finally, we also include a shot noise parameter $P_s(z)$:

$$P_s(z_i) = \frac{1}{n_i^{\text{fid}}} + p_s(z_i), \quad (36)$$

where the residual shot noise $p_s(z_i)$ is treated as a nuisance parameter with a fiducial value of 0 in each redshift bin, and $n_i^{\text{fid}}$ is the galaxy number density in each bin given in Table 2. In summary, the observed galaxy power spectrum in each bin $i$ reads (EP:VII)

$$P_{\text{obs}}(k_{\text{obs}}, \mu_{\text{obs}}, z_i) = q_{\perp}^2 q_{\parallel} \times \frac{[b_i \sigma_8(z_i) + f(z_i) \sigma_8(z_i) \mu_{\text{obs}}^2]^2}{1 + [f^{\text{fid}}(z_i) k_{\text{obs}} \mu_{\text{obs}} \sigma_p^{\text{fid}}(z_i)]^2} \times \frac{P_{\text{dw}}(k_{\text{obs}}, \mu_{\text{obs}}, z_i)}{\sigma_8^2(z_i)} F_z(k_{\text{obs}}, \mu_{\text{obs}}, z_i) + P_s(z_i), \quad (37)$$

where we omitted the arguments of the functions $k_{\text{obs}}(k, \mu, z)$ and $\mu_{\text{obs}}(\mu, z)$. In each redshift bin the product $b_i \sigma_8(z_i)$ is actually treated as an independent nuisance parameter, which means that it is kept fixed when varying the cosmological parameter $\sigma_8$. Together with the values of $p_s(z_i)$ the spectroscopic case features a total of 8 nuisance parameters. The fiducial value of each $b_i \sigma_8(z_i)$ is inferred from the $b_i^{\text{fid}}$ value reported in Table 2 multiplied by $\sigma_8^{\text{fid}}(z_i)$ (see Table B.2 for exact values).

To evaluate the likelihood (resp. the Fisher matrix), one should insert this expression into Eq. (9) (resp. into Eq. 10), which also depends on the volume $V_i^{\text{fid}}$ and $n_i^{\text{fid}}$ in each bin, whose values are listed in Table 2. Finally, one should integrate over $k$ from $k_{\text{min}}$ to $k_{\text{max}}$ (whose values are given in Table 3 for the pessimistic and an optimistic case) and $\mu$ from -1 to +1.

### 3.2.2. Detailed numerical implementation

For the sake of reproducibility, we provide here some details on the discretisation schemes, interpolation routines and integration algorithms used in our CosmicFish and MontePython pipelines. These settings ensure some well-converged calculations, such that changing them slightly would have a negligible impact on our results.

In our CosmicFish or MontePython algorithms the linear matter power spectrum $P_{\text{m,lin}}(k, z)$ is returned by CAMB or CLASS
on a logarithmically-spaced grid of 1055 discrete values of $k$ ranging from $k_{\min} = 3.528 \times 10^{-5}$ Mpc$^{-1}$ to $k_{\max} = 50.79$ Mpc$^{-1}$, corresponding to a logarithmic stepsize of $d \ln k = 0.01354$.

The value of $\sigma_8(z=0)$ is read from CAMB or CLASS. The growth factor $D(z)$ and growth rate $f(z)$ are also extracted from CAMB or CLASS. Then $\sigma_8(z_i)$ is approximated as $\sigma_8(0) D(z_i)/D(0)$.

The no-wiggle power spectrum $P_{\text{nw}}(k, z)$ is inferred from $P_{\text{m,lin}}(k, z)$ using a Savitzky-Golay filter of order 3 on the same grid of 1055 points evenly spaced in $(\ln k)$ (see e.g. Boyle & Komatsu 2018). The filter's window length is set to 101 points, which corresponds to a smoothing over $\Delta \ln k = 100 \ln(1 + d \ln k) = 1.359$.

The algorithm then builds interpolators for $P_{\text{m,lin}}(k, z)$ and $P_{\text{nw}}(k, z)$ (using the `scipy CubicSpline` algorithm in `MontePython` and the order-3 `RectBivariate` spline algorithm in `CosmicFish`). The final likelihood requires the evaluation of several quantities – including these two spectra – on a three-dimensional grid $(k_i, \mu_j, z_k)$, or, in the case of theoretical power spectra, $(k_{\text{obs},i}, \mu_{\text{obs},i}, z_k) = [k_{\text{obs}}(k_i, \mu_j, z_k), \mu_{\text{obs}}(\mu_j, z_k), z_k]$. In this grid, for `MontePython` (`CosmicFish`), $k_i$ takes 500 (2048) discrete values of $k$ between some $k_{\min}$ and $k_{\max}$ (whose values are reported in Table 3) with even logarithmic spacing, additionally $\mu_j$ takes 9 (128) discrete values evenly spaced between -1 and +1. Finally, $z_k$ runs over the 4 central redshift values of the 4 redshift bins reported in Table 3.

We have tested that having only 9 values for the grid in $\mu$ is enough for our purposes in both `MontePython` and `CosmicFish` when the integral is performed using the Simpson algorithm of the Python package `scipy` (Virtanen et al. 2020). However, for `CosmicFish` we kept the grid of 128 values in $\mu$, since in general it is a much more time-efficient code. In both codes the final integral over $k$ is also performed using the Simpson algorithm.

# 4. Validation of the forecast pipelines

## 4.1. Methodology

In this work, for each survey and each settings, we have compared five Fisher matrices corresponding to the following five cases:

1. **CF/ext/CAMB:** With this method, `CosmicFish` (CF) reads the information (spectra, distances...) in files produced in advance (externally) by CAMB. This is one of the methods used in EP:VII. Thus, we include this case in order to cross-check that nothing significant has changed within the `CosmicFish` code such that, a couple of years later, it still agrees with the results of EP:VII.

2. **CF/int/CAMB:** `CosmicFish` calls CAMB internally to extract all relevant information (spectra, distances...) on the fly: this is a more efficient approach that we also want to validate here. The comparison with the first case has proven that we integrated CAMB within `CosmicFish` in a correct way, with a proper use of the CAMB Python wrapper.

3. **CF/ext/CLASS:** `CosmicFish` reads the relevant information in files similar to those of the first method, but produced in advance by CLASS. The comparison of this method with the first one has proven that the theoretical predictions from CAMB and CLASS agree within the sensitivity of Euclid.

4. **CF/int/CLASS:** `CosmicFish` calls CLASS internally to extract all relevant information on the fly: this is again a more efficient approach than the external one. The comparison with the third case is a proof that we integrated CLASS

within `CosmicFish` in a correct way, with a proper use of the CLASS Python wrapper.

5. **MP/Fisher:** `MontePython` (MP) runs in Fisher mode and extracts all cosmological information on the fly from CLASS. The primary goal of this paper is to validate this pipeline against that of EP:VII.

We have treated our results for the `CF/ext/CAMB` case as the “reference result” corresponding to the recipes of EP:VII. In order to show that this choice is justified, we have also directly compared the above five Fisher matrices with a second reference Fisher matrix from EP:VII. In the photometric case our second reference was the Fisher matrix posted on the online repository `fisher_for_public`⁹. In the spectroscopic case the second reference was provided by `SoapFish` (SF), which is another of the codes validated by the EP:VII group. Similar to `CF/ext/CAMB`, the SF pipeline relies on external files produced by CAMB.

Finally, we can also estimate the survey sensitivity to cosmological parameter using the MP/MCMC method, that is, fitting some fiducial Euclid data with our Euclid mock likelihoods (which are the very same likelihoods as in the MP/Fisher method), while exploring the parameter space with MCMCs. The focus of this paper is not on the comparison between Fisher and MCMC results. Still, knowing the MCMC results is useful in order to cross-check our Fisher results, evaluate the level of Gaussianity of our likelihood with respect to model parameters, or get insight on parameter degeneracies.

In the following section, we have compared the results given by all these methods with a seven-parameter cosmology ($\Lambda$CDM+$\{w_0, w_a\}$). Fiducial values of cosmological and nuisance parameters are summarised in Table B.1. We have proven that all our Fisher pipelines agree with each other within at most 10%, which is the validation threshold set by the EP:VII publication.

Since for each case (photometric/spectroscopic survey with pessimistic/optimistic settings) we have five ways to compute the Fisher matrix, we can perform ten comparisons between pairs of matrices. The comparison can be made at the level of unmarginalised or marginalised errors. Unmarginalised errors correspond to the error on one parameter when all other parameters are kept fixed. This only involves the diagonal coefficients of the Fisher matrices. Marginalised errors instead represent the error on one parameter when all the others are unknown (and only constrained by the experiment). This involves the diagonal coefficients of the inverse Fisher matrices. As such, it depends on all coefficients in the Fisher matrices, or in other words, on the Fisher estimate of correlations between all pairs of parameters.

The most important quantities which we use for validation are of course the marginalised errors. Still, the knowledge of the unmarginalised ones is often useful. We have reported on both in what follows.

## 4.2. Photometric likelihood

### 4.2.1. Pessimistic setting

Table 4 contains the most relevant information for the photometric survey with pessimistic settings, that is, the biggest discrepancy between marginalised errors computed across all cosmological and nuisance parameters in each of the 10 comparisons that can be made. The result is presented as a five-by-five symmetric matrix (with no information along the diagonal since each method agrees with itself). In a nutshell, since the worst difference is at the level of 2% and thus well below the 10%
on a logarithmically-spaced grid of 1055 discrete values of $k$ ranging from $k_{min} = 3.528 \times 10^{-5}$ Mpc$^{-1}$ to $k_{max} = 50.79$ Mpc$^{-1}$, corresponding to a logarithmic stepsize of $d \ln k = 0.01354$.

The value of $\sigma_8(z=0)$ is read from CAMB or CLASS. The growth factor $D(z)$ and growth rate $f(z)$ are also extracted from CAMB or CLASS. Then $\sigma_8(z_i)$ is approximated as $\sigma_8(0) D(z_i)/D(0)$.

The no-wiggle power spectrum $P_{nw}(k, z)$ is inferred from $P_{m,lin}(k, z)$ using a Savitzky-Golay filter of order 3 on the same grid of 1055 points evenly spaced in $\ln(k)$ (see e.g. Boyle & Komatsu 2018). The filter's window length is set to 101 points, which corresponds to a smoothing over $\Delta \ln k = 100 \ln(1 + d \ln k) = 1.359$.

The algorithm then builds interpolators for $P_{m,lin}(k, z)$ and $P_{nw}(k, z)$ (using the `scipy CubicSpline` algorithm in `MontePython` and the order-3 `RectBivariate` spline algorithm in `CosmicFish`). The final likelihood requires the evaluation of several quantities – including these two spectra – on a three-dimensional grid $(k_i, \mu_j, z_k)$, or, in the case of theoretical power spectra, $(k_{obs,i}, \mu_{obs,j}, z_k) = [k_{obs}(k_i, \mu_j, z_k), \mu_{obs}(\mu_j, z_k), z_k]$. In this grid, for `MontePython` (`CosmicFish`), $k_i$ takes 500 (2048) discrete values of $k$ between some $k_{min}$ and $k_{max}$ (whose values are reported in Table 3) with even logarithmic spacing, additionally $\mu_j$ takes 9 (128) discrete values evenly spaced between -1 and +1. Finally, $z_k$ runs over the 4 central redshift values of the 4 redshift bins reported in Table 3.

We have tested that having only 9 values for the grid in $\mu$ is enough for our purposes in both `MontePython` and `CosmicFish` when the integral is performed using the Simpson algorithm of the Python package `scipy` (Virtanen et al. 2020). However, for `CosmicFish` we kept the grid of 128 values in $\mu$, since in general it is a much more time-efficient code. In both codes the final integral over $k$ is also performed using the Simpson algorithm.

# 4. Validation of the forecast pipelines

## 4.1. Methodology

In this work, for each survey and each settings, we have compared five Fisher matrices corresponding to the following five cases:

1. **CF/ext/CAMB:** With this method, `CosmicFish` (CF) reads the information (spectra, distances...) in files produced in advance (externally) by CAMB. This is one of the methods used in EP:VII. Thus, we include this case in order to cross-check that nothing significant has changed within the `CosmicFish` code such that, a couple of years later, it still agrees with the results of EP:VII.

2. **CF/int/CAMB:** `CosmicFish` calls CAMB internally to extract all relevant information (spectra, distances...) on the fly: this is a more efficient approach that we also want to validate here. The comparison with the first case has proven that we integrated CAMB within `CosmicFish` in a correct way, with a proper use of the CAMB Python wrapper.

3. **CF/ext/CLASS:** `CosmicFish` reads the relevant information in files similar to those of the first method, but produced in advance by CLASS. The comparison of this method with the first one has proven that the theoretical predictions from CAMB and CLASS agree within the sensitivity of *Euclid*.

4. **CF/int/CLASS:** `CosmicFish` calls CLASS internally to extract all relevant information on the fly: this is again a more efficient approach than the external one. The comparison with the third case is a proof that we integrated CLASS

within `CosmicFish` in a correct way, with a proper use of the CLASS Python wrapper.

5. **MP/Fisher:** `MontePython` (MP) runs in Fisher mode and extracts all cosmological information on the fly from CLASS. The primary goal of this paper is to validate this pipeline against that of EP:VII.

We have treated our results for the `CF/ext/CAMB` case as the “reference result” corresponding to the recipes of EP:VII. In order to show that this choice is justified, we have also directly compared the above five Fisher matrices with a second reference Fisher matrix from EP:VII. In the photometric case our second reference was the Fisher matrix posted on the online repository `fisher_for_public`⁹. In the spectroscopic case the second reference was provided by `SoapFish` (SF), which is another of the codes validated by the EP:VII group. Similar to `CF/ext/CAMB`, the SF pipeline relies on external files produced by CAMB.

Finally, we can also estimate the survey sensitivity to cosmological parameter using the MP/MCMC method, that is, fitting some fiducial *Euclid* data with our *Euclid* mock likelihoods (which are the very same likelihoods as in the MP/Fisher method), while exploring the parameter space with MCMCs. The focus of this paper is not on the comparison between Fisher and MCMC results. Still, knowing the MCMC results is useful in order to cross-check our Fisher results, evaluate the level of Gaussianity of our likelihood with respect to model parameters, or get insight on parameter degeneracies.

In the following section, we have compared the results given by all these methods with a seven-parameter cosmology ($\Lambda$CDM+$\{w_0, w_a\}$). Fiducial values of cosmological and nuisance parameters are summarised in Table B.1. We have proven that all our Fisher pipelines agree with each other within at most 10%, which is the validation threshold set by the EP:VII publication.

Since for each case (photometric/spectroscopic survey with pessimistic/optimistic settings) we have five ways to compute the Fisher matrix, we can perform ten comparisons between pairs of matrices. The comparison can be made at the level of unmarginalised or marginalised errors. Unmarginalised errors correspond to the error on one parameter when all other parameters are kept fixed. This only involves the diagonal coefficients of the Fisher matrices. Marginalised errors instead represent the error on one parameter when all the others are unknown (and only constrained by the experiment). This involves the diagonal coefficients of the inverse Fisher matrices. As such, it depends on all coefficients in the Fisher matrices, or in other words, on the Fisher estimate of correlations between all pairs of parameters.

The most important quantities which we use for validation are of course the marginalised errors. Still, the knowledge of the unmarginalised ones is often useful. We have reported on both in what follows.

## 4.2. Photometric likelihood

### 4.2.1. Pessimistic setting

Table 4 contains the most relevant information for the photometric survey with pessimistic settings, that is, the biggest discrepancy between marginalised errors computed across all cosmological and nuisance parameters in each of the 10 comparisons that can be made. The result is presented as a five-by-five symmetric matrix (with no information along the diagonal since each method agrees with itself). In a nutshell, since the worst difference is at the level of 2% and thus well below the 10%
<table><caption>**Table 4.** For the photometric survey with pessimistic settings, and for each pair of Fisher matrices obtained with different methods, largest percentage difference between the predicted marginalised error on each parameter (across all cosmological and nuisance parameters).</caption><thead><tr><th></th><th>CF/ext/CLASS</th><th>CF/int/CLASS</th><th>MP/Fisher</th><th>CF/ext/CAMB</th><th>CF/int/CAMB</th></tr></thead><tbody><tr><th>CF/ext/CLASS</th><td>0.0</td><td>0.01</td><td>1.61</td><td>1.17</td><td>0.48</td></tr><tr><th>CF/int/CLASS</th><td>0.01</td><td>0.0</td><td>1.6</td><td>1.17</td><td>0.48</td></tr><tr><th>MP/Fisher</th><td>1.61</td><td>1.6</td><td>0.0</td><td>1.98</td><td>1.62</td></tr><tr><th>CF/ext/CAMB</th><td>1.17</td><td>1.17</td><td>1.98</td><td>0.0</td><td>1.28</td></tr><tr><th>CF/int/CAMB</th><td>0.48</td><td>0.48</td><td>1.62</td><td>1.28</td><td>0.0</td></tr></tbody></table>

<figure><img src="image_2.png" /><figcaption>**Fig. 2.** For the photometric survey with pessimistic settings, and for selected pair of Fisher matrices obtained with different methods, comparison of each Fisher marginalised (blue dot/light grey) and unmarginalised (orange dot/dark grey) error on each cosmological and nuisance parameters, for: (First) CF/ext/CAMB versus CF/int/CAMB; (Second) CF/ext/CLASS versus CF/int/CLASS; (Third) CF/int/CLASS versus CF/int/CAMB; (Fourth) CF/int/CLASS versus MP/Fisher. Each forecasted error $\sigma_i$ for each case and parameter is compared to the median of the two cases (see footnote 13). The discrepancy is expressed in percent.</figcaption></figure>

threshold set in the EP:VII publication, all five methods are validated – that is, are in sufficiently good agreement with EP:VII results. We provide a more detailed discussion below.

To begin, we observe that the two methods that use CosmicFish combined with CAMB are highly consistent with each other. The largest difference across all errors is only of 1.2%. Individual marginalised and unmarginalised errors for these two cases are compared in Fig. 2 (first panel). In such plots, sticking to the plotting conventions of previous papers such as EP:VII, we show the percentage discrepancy of each marginalised or unmarginalised error $\sigma_i$ with respect to the median<fnref n="13" />. This comparison proves that the integration of CAMB within CosmicFish has been done consistently. Note that CF/ext/CAMB uses only the CAMB Fortran code, while CF/int/CAMB uses also the CAMB Python wrapper to extract quantities. The order 1% differences found here can be attributed to details in the numerical algorithms used within this Python wrapper or within CosmicFish, or different ways to interpret precision parameters in the CAMB Fortran code and Python wrapper, see Sect. 6 for details on accuracy settings. These differences are anyway hardly relevant and do not deserve further attention.

The two methods using CosmicFish combined with CLASS are even more consistent, with a worst error of 0.02%. Individual marginalised and unmarginalised errors for these two cases are

compared in Fig. 2 (second panel). This proves that the integration of CLASS within CosmicFish has also been done correctly. In the CLASS case, there is less room for differences, because the Python wrapper *classy* is used by both the external and internal methods<fnref n="14" />.

At this point, we know that using CosmicFish in external or internal mode makes no difference, and we can investigate the level of consistency of the CAMB and CLASS predictions. Comparing for instance the CF/int/CAMB and CF/int/CLASS methods, we find again excellent agreement, with a worst error of 0.10%. All individual marginalised and unmarginalised errors for these two cases are compared in Fig. 2 (third panel). Other comparisons between the CAMB-based and CLASS-based methods are nearly as good, as can be checked from Table 4. This shows that using CAMB or CLASS as our theory code makes no difference at the level of sensitivity of Euclid. Note that, in order to reach such a conclusion, we had to enhance the settings of a few accuracy parameters in the two codes and to ensure a very good match of the physical assumptions that they use, for example on the neutrino sector. These precise settings are detailed in Appendix A and commented in Sect. 6. We recommend using at least the precision settings discussed in Sect. 6 in any forecast or real data analysis for Euclid or experiments with comparable sensitivity.

At this stage, we have validated all the methods involving CosmicFish. We are only left with the comparison of the CosmicFish versus MP/Fisher results.

We see in Table 4 and in the fourth panel of Fig. 2 that the worst discrepancy between the CosmicFish and MontePython pipelines reaches about 2.0%. Since this is much lower than the validation threshold, the MontePython Fisher pipeline is validated. We even performed a more demanding test: We compared all the pipelines presented in this paper to the final average results of EP:VII, available in the public repository fisher_for_public⁹. Figure 3 shows a final comparison between the Fisher marginalised and unmarginalised error from CosmicFish, MontePython, and EP:VII. We find a maximum deviation with respect to the mean of 5%, which confirms validation. Note that CosmicFish results are already known to agree with the results of EP:VII, since an older Fortran-based version of this code was one of the codes employed for the code-comparison project of EP:VII. However, these last tests demonstrates that the CosmicFish pipeline used in this work is fully consistent with the older CosmicFish implementation.

Moreover, the visual comparison of Fisher ellipses with MCMC confidence contours presented in Fig. 4 for cosmological parameters (and in Figs. C.1 and C.2 for nuisance parameters) is enlightening. The MCMC contours turn out to be almost perfectly elliptical for all parameters. Thus, the

<footnote n="13">¹³ In Fig. 2 each panel presents a comparison between two cases only. Thus the median is just the average of the two errors and the plotted discrepancy stands for one half of the relative difference between the two errors. In other figures such as in Fig. 3 the median is instead computed across four different cases.</footnote>

<footnote n="14">¹⁴ The extremely small (0.02%) differences can be attributed to very small details in the sampling of functions, rounding errors when writing in files, etc. They are totally irrelevant at the *Euclid* sensitivity level.</footnote>
<table><caption>**Table 4.** For the photometric survey with pessimistic settings, and for each pair of Fisher matrices obtained with different methods, largest percentage difference between the predicted marginalised error on each parameter (across all cosmological and nuisance parameters).</caption><thead><tr><th></th><th>CF/ext/CLASS</th><th>CF/int/CLASS</th><th>MP/Fisher</th><th>CF/ext/CAMB</th><th>CF/int/CAMB</th></tr></thead><tbody><tr><td>CF/ext/CLASS</td><td>0.0</td><td>0.01</td><td>1.61</td><td>1.17</td><td>0.48</td></tr><tr><td>CF/int/CLASS</td><td>0.01</td><td>0.0</td><td>1.6</td><td>1.17</td><td>0.48</td></tr><tr><td>MP/Fisher</td><td>1.61</td><td>1.6</td><td>0.0</td><td>1.98</td><td>1.62</td></tr><tr><td>CF/ext/CAMB</td><td>1.17</td><td>1.17</td><td>1.98</td><td>0.0</td><td>1.28</td></tr><tr><td>CF/int/CAMB</td><td>0.48</td><td>0.48</td><td>1.62</td><td>1.28</td><td>0.0</td></tr></tbody></table>

<figure><img src="image_3.png" /><figcaption>**Fig. 2.** For the photometric survey with pessimistic settings, and for selected pair of Fisher matrices obtained with different methods, comparison of each Fisher marginalised (blue dot/light grey) and unmarginalised (orange dot/dark grey) error on each cosmological and nuisance parameters, for: (First) CF/ext/CAMB versus CF/int/CAMB; (Second) CF/ext/CLASS versus CF/int/CLASS; (Third) CF/int/CLASS versus CF/int/CAMB; (Fourth) CF/int/CLASS versus MP/Fisher. Each forecasted error $\sigma_i$ for each case and parameter is compared to the median of the two cases (see footnote 13). The discrepancy is expressed in percent.</figcaption></figure>

threshold set in the EP:VII publication, all five methods are validated – that is, are in sufficiently good agreement with EP:VII results. We provide a more detailed discussion below.

To begin, we observe that the two methods that use CosmicFish combined with CAMB are highly consistent with each other. The largest difference across all errors is only of 1.2%. Individual marginalised and unmarginalised errors for these two cases are compared in Fig. 2 (first panel). In such plots, sticking to the plotting conventions of previous papers such as EP:VII, we show the percentage discrepancy of each marginalised or unmarginalised error $\sigma_i$ with respect to the median<fnref n="13" />. This comparison proves that the integration of CAMB within CosmicFish has been done consistently. Note that CF/ext/CAMB uses only the CAMB Fortran code, while CF/int/CAMB uses also the CAMB Python wrapper to extract quantities. The order 1% differences found here can be attributed to details in the numerical algorithms used within this Python wrapper or within CosmicFish, or different ways to interpret precision parameters in the CAMB Fortran code and Python wrapper, see Sect. 6 for details on accuracy settings. These differences are anyway hardly relevant and do not deserve further attention.

The two methods using CosmicFish combined with CLASS are even more consistent, with a worst error of 0.02%. Individual marginalised and unmarginalised errors for these two cases are

compared in Fig. 2 (second panel). This proves that the integration of CLASS within CosmicFish has also been done correctly. In the CLASS case, there is less room for differences, because the Python wrapper *classy* is used by both the external and internal methods<fnref n="14" />.

At this point, we know that using CosmicFish in external or internal mode makes no difference, and we can investigate the level of consistency of the CAMB and CLASS predictions. Comparing for instance the CF/int/CAMB and CF/int/CLASS methods, we find again excellent agreement, with a worst error of 0.10%. All individual marginalised and unmarginalised errors for these two cases are compared in Fig. 2 (third panel). Other comparisons between the CAMB-based and CLASS-based methods are nearly as good, as can be checked from Table 4. This shows that using CAMB or CLASS as our theory code makes no difference at the level of sensitivity of Euclid. Note that, in order to reach such a conclusion, we had to enhance the settings of a few accuracy parameters in the two codes and to ensure a very good match of the physical assumptions that they use, for example on the neutrino sector. These precise settings are detailed in Appendix A and commented in Sect. 6. We recommend using at least the precision settings discussed in Sect. 6 in any forecast or real data analysis for Euclid or experiments with comparable sensitivity.

At this stage, we have validated all the methods involving CosmicFish. We are only left with the comparison of the CosmicFish versus MP/Fisher results.

We see in Table 4 and in the fourth panel of Fig. 2 that the worst discrepancy between the CosmicFish and MontePython pipelines reaches about 2.0%. Since this is much lower than the validation threshold, the MontePython Fisher pipeline is validated. We even performed a more demanding test: We compared all the pipelines presented in this paper to the final average results of EP:VII, available in the public repository fisher_for_public⁹. Figure 3 shows a final comparison between the Fisher marginalised and unmarginalised error from CosmicFish, MontePython, and EP:VII. We find a maximum deviation with respect to the mean of 5%, which confirms validation. Note that CosmicFish results are already known to agree with the results of EP:VII, since an older Fortran-based version of this code was one of the codes employed for the code-comparison project of EP:VII. However, these last tests demonstrates that the CosmicFish pipeline used in this work is fully consistent with the older CosmicFish implementation.

Moreover, the visual comparison of Fisher ellipses with MCMC confidence contours presented in Fig. 4 for cosmological parameters (and in Figs. C.1 and C.2 for nuisance parameters) is enlightening. The MCMC contours turn out to be almost perfectly elliptical for all parameters. Thus, the

<footnote n="13">¹³ In Fig. 2 each panel presents a comparison between two cases only. Thus the median is just the average of the two errors and the plotted discrepancy stands for one half of the relative difference between the two errors. In other figures such as in Fig. 3 the median is instead computed across four different cases.</footnote>

<footnote n="14">¹⁴ The extremely small (0.02%) differences can be attributed to very small details in the sampling of functions, rounding errors when writing in files, etc. They are totally irrelevant at the *Euclid* sensitivity level.</footnote>
<figure><img src="image_3.png" /><figcaption>**Fig. 3.** For the photometric survey with pessimistic settings, comparison of each Fisher marginalised (light grey) and un marginalised (dark grey) errors on the cosmological and nuisance parameters, for: CF/int/CLASS (blue circles) versus CF/int/CAMB (orange squares) versus MP/Fisher (green stars) versus the public EP:VII results (red crosses, referred in the legend as IST:F). Each forecasted error σᵢ for each case and parameter is compared to the median of the four cases, and the discrepancy is expressed in percent.</figcaption></figure>

<figure><img src="image_4.png" /><figcaption>**Fig. 4.** For the photometric survey with pessimistic settings, comparison of 1D posteriors and 2D contours (for 68 and 95% confidence level) from different methods: MP/MCMC (grey lines/contours), MP/Fisher (orange lines), CF/int/CLASS (blue lines). We only show here the cosmological parameters, but our contours involving nuisance parameters are shown in Appendix C. Plotted using GetDist.</figcaption></figure>

approximation of a multivariate Gaussian likelihood, assumed in the Fisher method, is a good one. In all cases, the MCMC contours remain very close to the Fisher ellipses. This excludes the possibility that our Fisher results agree with each other accidentally, while being far from the actual confidence limits associated to the full likelihoods. It also confirms that, for each one of our Fisher methods, the numerical derivative step sizes have been chosen in a sensible way, that is, large enough to overcome numerical noise and small enough to remain in the region where the likelihood is approximately Gaussian (see Appendices B.2 and B.3 for details).

<figure><img src="image_5.png" /><figcaption>**Fig. 5.** Same as Fig. 2 with optimistic settings.</figcaption></figure>

### 4.2.2. Optimistic setting

In this case, our results are summarised in Table 5 and Fig. 5. Qualitatively, all the conclusions reached for the pessimistic case also apply to this case.

A priori, with optimistic settings, we may expect larger differences between our four CosmicFish pipelines, because the likelihood is more sensitive to theoretical predictions for the nonlinear matter power spectrum. Indeed, the optimistic likelihood probes a larger range of *k* values in the nonlinear power spectrum and has smaller observational errors. Thus, numerical errors are less likely to be masked by observational errors. However, we find that the differences between the four CosmicFish pipelines (with internal/external CAMB/CLASS) increase only marginally. For instance, CF/int/CAMB and CF/int/CLASS still agree at an impressive 0.55% level (instead of 0.11% with pessimistic settings). The agreement between CF/int/CAMB and CF/ext/CAMB is a bit worse (1.3%), showing that the CAMB Fortran code and the CAMB Python wrapper handle accuracy settings differently, with a small but noticeable impact on small-scale predictions for the nonlinear power spectrum. The better agreement of the CF/int/CAMB pipeline with the CLASS pipeline suggests that CAMB is more accurate when called through the Python wrapper – consistent with the fact that this implementation is the most recent one<fnref n="15" />.

Besides, differences between CosmicFish and MontePython also increase with respect to the pessimistic case, but only to the level of 4.3%. Figure 5 (bottom plot) shows that the difference is now dominated by the marginalised error on ($w_0, w_a$), that is, by the calculation of correlations between dark energy parameters and other parameters. However, the 10% validation threshold is fulfilled. Even when we include the official EP:VII results in the comparison, as in Fig. 6, the (un)marginalised errors differ from the median by at most 9%.

In conclusion, our pipelines are also all validated in the photometric optimistic case. As a final check, the comparison between MCMC contours and Fisher ellipses in Fig. 7 brings a final confirmation of the robustness of our forecasts against possible issues related to numerical noise or non-Gaussian posteriors (Fig. 7 only includes cosmological parameters, but the plots for nuisance parameters are available in our public repository<fnref n="16" />).

<footnote n="15">¹⁵ The small deviation of the CF/ext/CAMB pipeline with respect to the other ones may have to do with a small unexplained feature in the derivative of the nonlinear power spectrum with respect to $w_a$ observed in Fig. B.1 of Appendix B.2. We leave this issue for future investigation.</footnote>

<footnote n="16">¹⁶ In the GitHub repository https://github.com/sabarish-vm/Euclid_w0wa.git, these plots are located in plots/photometric/optimistic/WLxGCPh_Opt_nuisance.pdf and plots/photometric/optimistic/WLxGCPh_Opt cross.pdf.</footnote>
<figure><img src="image_4.png" /><figcaption>**Fig. 3.** For the photometric survey with pessimistic settings, comparison of each Fisher marginalised (light grey) and un marginalised (dark grey) errors on the cosmological and nuisance parameters, for: CF/int/CLASS (blue circles) versus CF/int/CAMB (orange squares) versus MP/Fisher (green stars) versus the public EP:VII results (red crosses, referred in the legend as IST:F). Each forecasted error σᵢ for each case and parameter is compared to the median of the four cases, and the discrepancy is expressed in percent.</figcaption></figure>

<figure><img src="image_5.png" /><figcaption>**Fig. 4.** For the photometric survey with pessimistic settings, comparison of 1D posteriors and 2D contours (for 68 and 95% confidence level) from different methods: MP/MCMC (grey lines/contours), MP/Fisher (orange lines), CF/int/CLASS (blue lines). We only show here the cosmological parameters, but our contours involving nuisance parameters are shown in Appendix C. Plotted using GetDist.</figcaption></figure>

approximation of a multivariate Gaussian likelihood, assumed in the Fisher method, is a good one. In all cases, the MCMC contours remain very close to the Fisher ellipses. This excludes the possibility that our Fisher results agree with each other accidentally, while being far from the actual confidence limits associated to the full likelihoods. It also confirms that, for each one of our Fisher methods, the numerical derivative step sizes have been chosen in a sensible way, that is, large enough to overcome numerical noise and small enough to remain in the region where the likelihood is approximately Gaussian (see Appendices B.2 and B.3 for details).

<figure><img src="image_6.png" /><figcaption>**Fig. 5.** Same as Fig. 2 with optimistic settings.</figcaption></figure>

### 4.2.2. Optimistic setting

In this case, our results are summarised in Table 5 and Fig. 5. Qualitatively, all the conclusions reached for the pessimistic case also apply to this case.

A priori, with optimistic settings, we may expect larger differences between our four CosmicFish pipelines, because the likelihood is more sensitive to theoretical predictions for the nonlinear matter power spectrum. Indeed, the optimistic likelihood probes a larger range of *k* values in the nonlinear power spectrum and has smaller observational errors. Thus, numerical errors are less likely to be masked by observational errors. However, we find that the differences between the four CosmicFish pipelines (with internal/external CAMB/CLASS) increase only marginally. For instance, CF/int/CAMB and CF/int/CLASS still agree at an impressive 0.55% level (instead of 0.11% with pessimistic settings). The agreement between CF/int/CAMB and CF/ext/CAMB is a bit worse (1.3%), showing that the CAMB Fortran code and the CAMB Python wrapper handle accuracy settings differently, with a small but noticeable impact on small-scale predictions for the nonlinear power spectrum. The better agreement of the CF/int/CAMB pipeline with the CLASS pipeline suggests that CAMB is more accurate when called through the Python wrapper – consistent with the fact that this implementation is the most recent one<fnref n="15" />.

Besides, differences between CosmicFish and MontePython also increase with respect to the pessimistic case, but only to the level of 4.3%. Figure 5 (bottom plot) shows that the difference is now dominated by the marginalised error on ($w_0, w_a$), that is, by the calculation of correlations between dark energy parameters and other parameters. However, the 10% validation threshold is fulfilled. Even when we include the official EP:VII results in the comparison, as in Fig. 6, the (un)marginalised errors differ from the median by at most 9%.

In conclusion, our pipelines are also all validated in the photometric optimistic case. As a final check, the comparison between MCMC contours and Fisher ellipses in Fig. 7 brings a final confirmation of the robustness of our forecasts against possible issues related to numerical noise or non-Gaussian posteriors (Fig. 7 only includes cosmological parameters, but the plots for nuisance parameters are available in our public repository<fnref n="16" />).

<footnote n="15">¹⁵ The small deviation of the CF/ext/CAMB pipeline with respect to the other ones may have to do with a small unexplained feature in the derivative of the nonlinear power spectrum with respect to $w_a$ observed in Fig. B.1 of Appendix B.2. We leave this issue for future investigation.</footnote>

<footnote n="16">¹⁶ In the GitHub repository https://github.com/sabarish-vm/Euclid_w0wa.git, these plots are located in plots/photometric/optimistic/WLxGCPh_Opt_nuisance.pdf and plots/photometric/optimistic/WLxGCPh_Opt cross.pdf.</footnote>
<table><caption>**Table 5.** Same as Table 4 with optimistic settings.</caption><thead><tr><th></th><th>CF/ext/CLASS</th><th>CF/int/CLASS</th><th>MP/Fisher</th><th>CF/ext/CAMB</th><th>CF/int/CAMB</th></tr></thead><tbody><tr><th>CF/ext/CLASS</th><td>0.0</td><td>0.01</td><td>4.27</td><td>1.51</td><td>0.56</td></tr><tr><th>CF/int/CLASS</th><td>0.01</td><td>0.0</td><td>4.26</td><td>1.51</td><td>0.55</td></tr><tr><th>MP/Fisher</th><td>4.27</td><td>4.26</td><td>0.0</td><td>4.26</td><td>4.25</td></tr><tr><th>CF/ext/CAMB</th><td>1.51</td><td>1.51</td><td>4.26</td><td>0.0</td><td>1.35</td></tr><tr><th>CF/int/CAMB</th><td>0.56</td><td>0.55</td><td>4.25</td><td>1.35</td><td>0.0</td></tr></tbody></table>

<figure><img src="image_6.png" /><figcaption>**Fig. 6.** Same as Fig. 3 with optimistic settings.</figcaption></figure>

<figure><img src="image_7.png" /><figcaption>**Fig. 8.** Same as Fig. 2 for the spectroscopic survey with pessimistic settings.</figcaption></figure>

<figure><img src="image_8.png" /><figcaption>**Fig. 7.** Same as Fig. 4 with optimistic settings.</figcaption></figure>

<figure><img src="image_9.png" /><figcaption>**Fig. 9.** For the spectroscopic survey with pessimistic settings, comparison of each Fisher marginalised (light grey) and un marginalised (dark grey) errors on the cosmological and nuisance parameters, for the cases of: CF/int/CLASS (blue circles) versus CF/int/CAMB (orange squares) versus MP/Fisher (green stars) versus EP:VII results from SOAPFish (SF, red crosses). Plotting conventions are the same as in Fig. 3.</figcaption></figure>

## 4.3. Spectroscopic likelihood

### 4.3.1. Pessimistic setting

In this case, our results are summarised in Table 6 and Fig. 8. Qualitatively, there are no big differences between the conclusions to be drawn from the photometric and spectroscopic surveys.

As a matter of fact, the two pipelines using CosmicFish combined with CAMB are consistent with each other, with small differences in the errors of at most 2.1% – caused again by differences in the treatment of accuracy between the Fortran and

Python methods for calling CAMB. Once more, the pipelines using CosmicFish combined with CLASS are even more consistent, with a largest differences of 0.12%. When CosmicFish switches from the CF/int/CAMB method to the CF/int/CLASS method, the errors remain unchanged up to 0.26% differences.

The MP/Fisher pipeline gets validated in the spectroscopic/optimistic case, with differences of at most 2.9% with respect to CF/ext/CAMB and 1.4% with respect to the other CosmicFish methods. This was comparable to our results for the photometric probe. Our pipelines also passed successfully a more demanding test: when we add to the comparison set some previous EP:VII results, all errors remain within 5% of the median, as shown in Fig. 9. In this case, previous EP:VII results are represented by those of the SOAPFish code, as already mentioned in Sect. 4.1.

Our Fisher forecasts agree very well not only among each other, but also with the MCMC forecast shown for comparison in Fig. 10 for cosmological parameters (and Figs. C.3 and
<table><caption>**Table 5.** Same as Table 4 with optimistic settings.</caption><thead><tr><th></th><th>CF/ext/CLASS</th><th>CF/int/CLASS</th><th>MP/Fisher</th><th>CF/ext/CAMB</th><th>CF/int/CAMB</th></tr></thead><tbody><tr><th>CF/ext/CLASS</th><td>0.0</td><td>0.01</td><td>4.27</td><td>1.51</td><td>0.56</td></tr><tr><th>CF/int/CLASS</th><td>0.01</td><td>0.0</td><td>4.26</td><td>1.51</td><td>0.55</td></tr><tr><th>MP/Fisher</th><td>4.27</td><td>4.26</td><td>0.0</td><td>4.26</td><td>4.25</td></tr><tr><th>CF/ext/CAMB</th><td>1.51</td><td>1.51</td><td>4.26</td><td>0.0</td><td>1.35</td></tr><tr><th>CF/int/CAMB</th><td>0.56</td><td>0.55</td><td>4.25</td><td>1.35</td><td>0.0</td></tr></tbody></table>

<figure><img src="image_7.png" /><figcaption>**Fig. 6.** Same as Fig. 3 with optimistic settings.</figcaption></figure>

<figure><img src="image_8.png" /><figcaption>**Fig. 8.** Same as Fig. 2 for the spectroscopic survey with pessimistic settings.</figcaption></figure>

<figure><img src="image_9.png" /><figcaption>**Fig. 7.** Same as Fig. 4 with optimistic settings.</figcaption></figure>

<figure><img src="image_10.png" /><figcaption>**Fig. 9.** For the spectroscopic survey with pessimistic settings, comparison of each Fisher marginalised (light grey) and un marginalised (dark grey) errors on the cosmological and nuisance parameters, for the cases of: CF/int/CLASS (blue circles) versus CF/int/CAMB (orange squares) versus MP/Fisher (green stars) versus EP:VII results from SOAPFish (SF, red crosses). Plotting conventions are the same as in Fig. 3.</figcaption></figure>

## 4.3. Spectroscopic likelihood

### 4.3.1. Pessimistic setting

In this case, our results are summarised in Table 6 and Fig. 8. Qualitatively, there are no big differences between the conclusions to be drawn from the photometric and spectroscopic surveys.

As a matter of fact, the two pipelines using CosmicFish combined with CAMB are consistent with each other, with small differences in the errors of at most 2.1% – caused again by differences in the treatment of accuracy between the Fortran and

Python methods for calling CAMB. Once more, the pipelines using CosmicFish combined with CLASS are even more consistent, with a largest differences of 0.12%. When CosmicFish switches from the CF/int/CAMB method to the CF/int/CLASS method, the errors remain unchanged up to 0.26% differences.

The MP/Fisher pipeline gets validated in the spectroscopic/optimistic case, with differences of at most 2.9% with respect to CF/ext/CAMB and 1.4% with respect to the other CosmicFish methods. This was comparable to our results for the photometric probe. Our pipelines also passed successfully a more demanding test: when we add to the comparison set some previous EP:VII results, all errors remain within 5% of the median, as shown in Fig. 9. In this case, previous EP:VII results are represented by those of the SOAPFish code, as already mentioned in Sect. 4.1.

Our Fisher forecasts agree very well not only among each other, but also with the MCMC forecast shown for comparison in Fig. 10 for cosmological parameters (and Figs. C.3 and
<table><caption>**Table 6.** Same as Table 4 for the spectroscopic survey with pessimistic settings.</caption><thead><tr><th></th><th>CF/ext/CLASS</th><th>CF/int/CLASS</th><th>MP/Fisher</th><th>CF/ext/CAMB</th><th>CF/int/CAMB</th></tr></thead><tbody><tr><th>CF/ext/CLASS</th><td>0.0</td><td>0.12</td><td>1.35</td><td>2.1</td><td>0.24</td></tr><tr><th>CF/int/CLASS</th><td>0.12</td><td>0.0</td><td>1.32</td><td>2.12</td><td>0.26</td></tr><tr><th>MP/Fisher</th><td>1.35</td><td>1.32</td><td>0.0</td><td>2.91</td><td>1.45</td></tr><tr><th>CF/ext/CAMB</th><td>2.1</td><td>2.12</td><td>2.91</td><td>0.0</td><td>2.02</td></tr><tr><th>CF/int/CAMB</th><td>0.24</td><td>0.26</td><td>1.45</td><td>2.02</td><td>0.0</td></tr></tbody></table>

<figure><img src="image_10.png" /><figcaption>**Fig. 10.** Same as Fig. 4 for the spectroscopic survey with pessimistic settings.</figcaption></figure>

<figure><img src="image_11.png" /><figcaption>**Fig. 11.** Same as Fig. 2 for the spectroscopic survey with optimistic settings.</figcaption></figure>

<figure><img src="image_12.png" /><figcaption>**Fig. 12.** Same as Fig. 9 with optimistic settings.</figcaption></figure>

C.4 for nuisance parameters). Here, we can see by eye a small level of non-Gaussianity in the 1D and 2D posteriors. However, the Fisher ellipses appear to be excellent approximations to the actual confidence contours.

In a previously published work by Yahia-Cherif et al. (2021), the emphasis was placed on validating only the spectroscopic likelihood for stage-IV surveys. The authors conducted a thorough evaluation of various numerical derivative methods, assessing their impact on the stability of the Fisher matrix. Additionally, they compared the results of their analysis with those obtained through MCMC runs. Our findings align with those of Yahia-Cherif et al. (2021), demonstrating a comparable level of agreement.

### 4.3.2. Optimistic setting

This last case is very similar to the previous one. Switching to optimistic settings in the spectroscopic likelihood does not degrade nor improve significantly the comparison between the various approaches as can be seen by comparing Fig. 8 to Fig. 11. The difference between all marginalised CosmicFish and MontePython Fisher errors is below the 2.5% level, see Table 7. When adding SOAPFish to the comparison set, the difference increases to 6%, see Fig. 12, still small enough to validate our MP/Fisher pipeline. The very good agreement between all Fisher forecasts and an MP/MCMC forecast is shown

for comparison in Fig. 13 for cosmological parameters (and in the repository<fnref n="17" /> for nuisance parameters).

## 5. Forecast results

### 5.1. Photometric survey alone

In Tables 8 and 9 we show the absolute $1\sigma$ errors on each cosmological parameters obtained for the photometric probe with our CosmicFish, MP/Fisher, and MP/MCMC pipelines. We compare them with the mean values obtained by EP:VII. For CosmicFish, we take here numbers from the CF/int/CLASS case – but we know from previous sections that other cases give essentially the same results.

Previous tables showed the largest percentage difference between error bars across all cosmological and nuisance parameters. Here, by comparing different columns, one can check

<footnote n="17">¹⁷ In the GitHub repository https://github.com/sabarish-vm/Euclid_w0wa.git, these plots are located in plots/spectroscopic/optimistic/GCsp_Opt_nuisance.pdf and plots/spectroscopic/optimistic/GCsp_Opt cross.pdf</footnote>
<table><caption>**Table 6.** Same as Table 4 for the spectroscopic survey with pessimistic settings.</caption><thead><tr><th></th><th>CF/ext/CLASS</th><th>CF/int/CLASS</th><th>MP/Fisher</th><th>CF/ext/CAMB</th><th>CF/int/CAMB</th></tr></thead><tbody><tr><th>CF/ext/CLASS</th><td>0.0</td><td>0.12</td><td>1.35</td><td>2.1</td><td>0.24</td></tr><tr><th>CF/int/CLASS</th><td>0.12</td><td>0.0</td><td>1.32</td><td>2.12</td><td>0.26</td></tr><tr><th>MP/Fisher</th><td>1.35</td><td>1.32</td><td>0.0</td><td>2.91</td><td>1.45</td></tr><tr><th>CF/ext/CAMB</th><td>2.1</td><td>2.12</td><td>2.91</td><td>0.0</td><td>2.02</td></tr><tr><th>CF/int/CAMB</th><td>0.24</td><td>0.26</td><td>1.45</td><td>2.02</td><td>0.0</td></tr></tbody></table>

<figure><img src="image_11.png" /><figcaption>**Fig. 10.** Same as Fig. 4 for the spectroscopic survey with pessimistic settings.</figcaption></figure>

C.4 for nuisance parameters). Here, we can see by eye a small level of non-Gaussianity in the 1D and 2D posteriors. However, the Fisher ellipses appear to be excellent approximations to the actual confidence contours.

In a previously published work by Yahia-Cherif et al. (2021), the emphasis was placed on validating only the spectroscopic likelihood for stage-IV surveys. The authors conducted a thorough evaluation of various numerical derivative methods, assessing their impact on the stability of the Fisher matrix. Additionally, they compared the results of their analysis with those obtained through MCMC runs. Our findings align with those of Yahia-Cherif et al. (2021), demonstrating a comparable level of agreement.

### 4.3.2. Optimistic setting

This last case is very similar to the previous one. Switching to optimistic settings in the spectroscopic likelihood does not degrade nor improve significantly the comparison between the various approaches as can be seen by comparing Fig. 8 to Fig. 11. The difference between all marginalised CosmicFish and MontePython Fisher errors is below the 2.5% level, see Table 7. When adding SOAPFish to the comparison set, the difference increases to 6%, see Fig. 12, still small enough to validate our MP/Fisher pipeline. The very good agreement between all Fisher forecasts and an MP/MCMC forecast is shown

<figure><img src="image_12.png" /><figcaption>**Fig. 11.** Same as Fig. 2 for the spectroscopic survey with optimistic settings.</figcaption></figure>

<figure><img src="image_13.png" /><figcaption>**Fig. 12.** Same as Fig. 9 with optimistic settings.</figcaption></figure>

for comparison in Fig. 13 for cosmological parameters (and in the repository<fnref n="17" /> for nuisance parameters).

## 5. Forecast results

### 5.1. Photometric survey alone

In Tables 8 and 9 we show the absolute $1\sigma$ errors on each cosmological parameters obtained for the photometric probe with our CosmicFish, MP/Fisher, and MP/MCMC pipelines. We compare them with the mean values obtained by EP:VII. For CosmicFish, we take here numbers from the CF/int/CLASS case – but we know from previous sections that other cases give essentially the same results.

Previous tables showed the largest percentage difference between error bars across all cosmological and nuisance parameters. Here, by comparing different columns, one can check

<footnote n="17">¹⁷ In the GitHub repository https://github.com/sabarish-vm/Euclid_w0wa.git, these plots are located in plots/spectroscopic/optimistic/GCsp_Opt_nuisance.pdf and plots/spectroscopic/optimistic/GCsp_Opt cross.pdf</footnote>
<table><caption>**Table 7.** Same as Table 4 for the spectroscopic survey with optimistic settings.</caption><thead><tr><th></th><th>CF/ext/CLASS</th><th>CF/int/CLASS</th><th>MP/Fisher</th><th>CF/ext/CAMB</th><th>CF/int/CAMB</th></tr></thead><tbody><tr><th>CF/ext/CLASS</th><td>0.0</td><td>0.25</td><td>1.28</td><td>1.63</td><td>0.2</td></tr><tr><th>CF/int/CLASS</th><td>0.25</td><td>0.0</td><td>1.03</td><td>1.8</td><td>0.25</td></tr><tr><th>MP/Fisher</th><td>1.28</td><td>1.03</td><td>0.0</td><td>2.49</td><td>1.12</td></tr><tr><th>CF/ext/CAMB</th><td>1.63</td><td>1.8</td><td>2.49</td><td>0.0</td><td>1.71</td></tr><tr><th>CF/int/CAMB</th><td>0.2</td><td>0.25</td><td>1.12</td><td>1.71</td><td>0.0</td></tr></tbody></table>

<figure><img src="image_13.png" /><figcaption>**Fig. 13.** Same as Fig. 4 for the spectroscopic survey with optimistic settings.</figcaption></figure>

<table><caption>**Table 8.** For the photometric survey with pessimistic settings, marginalised $1\sigma$ errors on cosmological parameters found by: the average of EP:VII results, CF/int/CLASS (the other versions of CosmicFish give nearly the same results), MontePython in Fisher mode, MontePython in MCMC mode.</caption><thead><tr><th></th><th>EP:VII</th><th>CF/int/CLASS</th><th>MP/Fisher</th><th>MP/MCMC</th></tr></thead><tbody><tr><th>Ω<sub>b,0</sub></th><td>0.0027</td><td>0.0027</td><td>0.0027</td><td>0.0026</td></tr><tr><th>h</th><td>0.020</td><td>0.020</td><td>0.021</td><td>0.021</td></tr><tr><th>n<sub>s</sub></th><td>0.0097</td><td>0.010</td><td>0.010</td><td>0.011</td></tr><tr><th>σ<sub>8</sub></th><td>0.0039</td><td>0.0041</td><td>0.0042</td><td>0.0044</td></tr><tr><th>Ω<sub>m,0</sub></th><td>0.0035</td><td>0.0036</td><td>0.0036</td><td>0.0038</td></tr><tr><th>w<sub>0</sub></th><td>0.042</td><td>0.043</td><td>0.044</td><td>0.045</td></tr><tr><th>w<sub>a</sub></th><td>0.17</td><td>0.17</td><td>0.18</td><td>0.18</td></tr></tbody></table>

for individual parameters that these percentage differences are always very small – even if the error bars of EP:VII are usually more optimistic than other errors by a tiny amount.

## 5.2. Spectroscopic survey alone

In Tables 10 and 11 we show the absolute $1\sigma$ errors on each cosmological parameters obtained with the same pipelines, but now for the spectroscopic probe. Note that there is a minor

<table><caption>**Table 9.** Same as Table 8 for the photometric survey with optimistic settings.</caption><thead><tr><th></th><th>EP:VII</th><th>CF/int/CLASS</th><th>MP/Fisher</th><th>MP/MCMC</th></tr></thead><tbody><tr><th>Ω<sub>b,0</sub></th><td>0.0023</td><td>0.0022</td><td>0.0022</td><td>0.0022</td></tr><tr><th>h</th><td>0.014</td><td>0.013</td><td>0.013</td><td>0.013</td></tr><tr><th>n<sub>s</sub></th><td>0.0037</td><td>0.0037</td><td>0.0037</td><td>0.0038</td></tr><tr><th>σ<sub>8</sub></th><td>0.0018</td><td>0.0019</td><td>0.0020</td><td>0.0020</td></tr><tr><th>Ω<sub>m,0</sub></th><td>0.0019</td><td>0.0020</td><td>0.0021</td><td>0.0020</td></tr><tr><th>w<sub>0</sub></th><td>0.027</td><td>0.028</td><td>0.031</td><td>0.028</td></tr><tr><th>w<sub>a</sub></th><td>0.10</td><td>0.11</td><td>0.11</td><td>0.11</td></tr></tbody></table>

<table><caption>**Table 10.** Same as Table 8 for the spectroscopic survey with pessimistic settings.</caption><thead><tr><th></th><th>SoapFish</th><th>CF/int/CLASS</th><th>MP/Fisher</th><th>MP/MCMC</th></tr></thead><tbody><tr><th>Ω<sub>b,0</sub></th><td>0.0021</td><td>0.0022</td><td>0.0023</td><td>0.0020</td></tr><tr><th>h</th><td>0.0038</td><td>0.0038</td><td>0.0038</td><td>0.0034</td></tr><tr><th>n<sub>s</sub></th><td>0.014</td><td>0.015</td><td>0.015</td><td>0.014</td></tr><tr><th>σ<sub>8</sub></th><td>0.013</td><td>0.013</td><td>0.013</td><td>0.012</td></tr><tr><th>Ω<sub>m,0</sub></th><td>0.011</td><td>0.011</td><td>0.011</td><td>0.0106</td></tr><tr><th>w<sub>0</sub></th><td>0.10</td><td>0.10</td><td>0.11</td><td>0.10</td></tr><tr><th>w<sub>a</sub></th><td>0.33</td><td>0.35</td><td>0.35</td><td>0.33</td></tr></tbody></table>

<table><caption>**Table 11.** Same as Table 8 for the spectroscopic survey with optimistic settings.</caption><thead><tr><th></th><th>SoapFish</th><th>CF/int/CLASS</th><th>MP/Fisher</th><th>MP/MCMC</th></tr></thead><tbody><tr><th>Ω<sub>b,0</sub></th><td>0.0019</td><td>0.0019</td><td>0.0020</td><td>0.0019</td></tr><tr><th>h</th><td>0.0032</td><td>0.0032</td><td>0.0032</td><td>0.0029</td></tr><tr><th>n<sub>s</sub></th><td>0.013</td><td>0.013</td><td>0.013</td><td>0.013</td></tr><tr><th>σ<sub>8</sub></th><td>0.012</td><td>0.012</td><td>0.012</td><td>0.011</td></tr><tr><th>Ω<sub>m,0</sub></th><td>0.010</td><td>0.010</td><td>0.010</td><td>0.0095</td></tr><tr><th>w<sub>0</sub></th><td>0.090</td><td>0.093</td><td>0.095</td><td>0.087</td></tr><tr><th>w<sub>a</sub></th><td>0.29</td><td>0.31</td><td>0.31</td><td>0.28</td></tr></tbody></table>

difference between our implementation and the EP:VII one regarding the nonlinear modelling. As a matter of fact, our pessimistic and optimistic cases agree in the $k_{max}$ used for the probes, namely $0.25h\,\text{Mpc}^{-1}$ and $0.30h\,\text{Mpc}^{-1}$, respectively. However, the pessimistic case of EP:VII is more conservative, since it marginalizes over the nonlinear parameters $\sigma_p$ and $\sigma_v$, while here we keep them both fixed at the fiducial cosmology, as already explained in Sect. 3.2. Moreover, the recipe of EP:VII assumes a separation into shape- and redshift-dependent parameters for the observed galaxy power spectrum. In that recipe, the redshift-dependent parameters – which are $H(z_i)$, $d_A(z_i)$, $f\sigma_8(z_i)$ and $b\sigma_8(z_i)$ – are varied freely at each redshift bin $i$ and then projected onto the final cosmological parameter basis
<table><caption>**Table 7.** Same as Table 4 for the spectroscopic survey with optimistic settings.</caption><thead><tr><th></th><th>CF/ext/CLASS</th><th>CF/int/CLASS</th><th>MP/Fisher</th><th>CF/ext/CAMB</th><th>CF/int/CAMB</th></tr></thead><tbody><tr><th>CF/ext/CLASS</th><td>0.0</td><td>0.25</td><td>1.28</td><td>1.63</td><td>0.2</td></tr><tr><th>CF/int/CLASS</th><td>0.25</td><td>0.0</td><td>1.03</td><td>1.8</td><td>0.25</td></tr><tr><th>MP/Fisher</th><td>1.28</td><td>1.03</td><td>0.0</td><td>2.49</td><td>1.12</td></tr><tr><th>CF/ext/CAMB</th><td>1.63</td><td>1.8</td><td>2.49</td><td>0.0</td><td>1.71</td></tr><tr><th>CF/int/CAMB</th><td>0.2</td><td>0.25</td><td>1.12</td><td>1.71</td><td>0.0</td></tr></tbody></table>

<figure><img src="image_14.png" /><figcaption>**Fig. 13.** Same as Fig. 4 for the spectroscopic survey with optimistic settings.</figcaption></figure>

<table><caption>**Table 8.** For the photometric survey with pessimistic settings, marginalised $1\sigma$ errors on cosmological parameters found by: the average of EP:VII results, CF/int/CLASS (the other versions of CosmicFish give nearly the same results), MontePython in Fisher mode, MontePython in MCMC mode.</caption><thead><tr><th></th><th>EP:VII</th><th>CF/int/CLASS</th><th>MP/Fisher</th><th>MP/MCMC</th></tr></thead><tbody><tr><th>Ω<sub>b,0</sub></th><td>0.0027</td><td>0.0027</td><td>0.0027</td><td>0.0026</td></tr><tr><th>h</th><td>0.020</td><td>0.020</td><td>0.021</td><td>0.021</td></tr><tr><th>n<sub>s</sub></th><td>0.0097</td><td>0.010</td><td>0.010</td><td>0.011</td></tr><tr><th>σ<sub>8</sub></th><td>0.0039</td><td>0.0041</td><td>0.0042</td><td>0.0044</td></tr><tr><th>Ω<sub>m,0</sub></th><td>0.0035</td><td>0.0036</td><td>0.0036</td><td>0.0038</td></tr><tr><th>w<sub>0</sub></th><td>0.042</td><td>0.043</td><td>0.044</td><td>0.045</td></tr><tr><th>w<sub>a</sub></th><td>0.17</td><td>0.17</td><td>0.18</td><td>0.18</td></tr></tbody></table>

for individual parameters that these percentage differences are always very small – even if the error bars of EP:VII are usually more optimistic than other errors by a tiny amount.

## 5.2. Spectroscopic survey alone

In Tables 10 and 11 we show the absolute $1\sigma$ errors on each cosmological parameters obtained with the same pipelines, but now for the spectroscopic probe. Note that there is a minor

<table><caption>**Table 9.** Same as Table 8 for the photometric survey with optimistic settings.</caption><thead><tr><th></th><th>EP:VII</th><th>CF/int/CLASS</th><th>MP/Fisher</th><th>MP/MCMC</th></tr></thead><tbody><tr><th>Ω<sub>b,0</sub></th><td>0.0023</td><td>0.0022</td><td>0.0022</td><td>0.0022</td></tr><tr><th>h</th><td>0.014</td><td>0.013</td><td>0.013</td><td>0.013</td></tr><tr><th>n<sub>s</sub></th><td>0.0037</td><td>0.0037</td><td>0.0037</td><td>0.0038</td></tr><tr><th>σ<sub>8</sub></th><td>0.0018</td><td>0.0019</td><td>0.0020</td><td>0.0020</td></tr><tr><th>Ω<sub>m,0</sub></th><td>0.0019</td><td>0.0020</td><td>0.0021</td><td>0.0020</td></tr><tr><th>w<sub>0</sub></th><td>0.027</td><td>0.028</td><td>0.031</td><td>0.028</td></tr><tr><th>w<sub>a</sub></th><td>0.10</td><td>0.11</td><td>0.11</td><td>0.11</td></tr></tbody></table>

<table><caption>**Table 10.** Same as Table 8 for the spectroscopic survey with pessimistic settings.</caption><thead><tr><th></th><th>SoapFish</th><th>CF/int/CLASS</th><th>MP/Fisher</th><th>MP/MCMC</th></tr></thead><tbody><tr><th>Ω<sub>b,0</sub></th><td>0.0021</td><td>0.0022</td><td>0.0023</td><td>0.0020</td></tr><tr><th>h</th><td>0.0038</td><td>0.0038</td><td>0.0038</td><td>0.0034</td></tr><tr><th>n<sub>s</sub></th><td>0.014</td><td>0.015</td><td>0.015</td><td>0.014</td></tr><tr><th>σ<sub>8</sub></th><td>0.013</td><td>0.013</td><td>0.013</td><td>0.012</td></tr><tr><th>Ω<sub>m,0</sub></th><td>0.011</td><td>0.011</td><td>0.011</td><td>0.0106</td></tr><tr><th>w<sub>0</sub></th><td>0.10</td><td>0.10</td><td>0.11</td><td>0.10</td></tr><tr><th>w<sub>a</sub></th><td>0.33</td><td>0.35</td><td>0.35</td><td>0.33</td></tr></tbody></table>

<table><caption>**Table 11.** Same as Table 8 for the spectroscopic survey with optimistic settings.</caption><thead><tr><th></th><th>SoapFish</th><th>CF/int/CLASS</th><th>MP/Fisher</th><th>MP/MCMC</th></tr></thead><tbody><tr><th>Ω<sub>b,0</sub></th><td>0.0019</td><td>0.0019</td><td>0.0020</td><td>0.0019</td></tr><tr><th>h</th><td>0.0032</td><td>0.0032</td><td>0.0032</td><td>0.0029</td></tr><tr><th>n<sub>s</sub></th><td>0.013</td><td>0.013</td><td>0.013</td><td>0.013</td></tr><tr><th>σ<sub>8</sub></th><td>0.012</td><td>0.012</td><td>0.012</td><td>0.011</td></tr><tr><th>Ω<sub>m,0</sub></th><td>0.010</td><td>0.010</td><td>0.010</td><td>0.0095</td></tr><tr><th>w<sub>0</sub></th><td>0.090</td><td>0.093</td><td>0.095</td><td>0.087</td></tr><tr><th>w<sub>a</sub></th><td>0.29</td><td>0.31</td><td>0.31</td><td>0.28</td></tr></tbody></table>

difference between our implementation and the EP:VII one regarding the nonlinear modelling. As a matter of fact, our pessimistic and optimistic cases agree in the $k_{max}$ used for the probes, namely $0.25h \text{ Mpc}^{-1}$ and $0.30h \text{ Mpc}^{-1}$, respectively. However, the pessimistic case of EP:VII is more conservative, since it marginalizes over the nonlinear parameters $\sigma_p$ and $\sigma_v$, while here we keep them both fixed at the fiducial cosmology, as already explained in Sect. 3.2. Moreover, the recipe of EP:VII assumes a separation into shape- and redshift-dependent parameters for the observed galaxy power spectrum. In that recipe, the redshift-dependent parameters – which are $H(z_i)$, $d_A(z_i)$, $f\sigma_8(z_i)$ and $b\sigma_8(z_i)$ – are varied freely at each redshift bin $i$ and then projected onto the final cosmological parameter basis
<table><caption>**Table 12.** For the combined photometric and spectroscopic surveys with various combinations of pessimistic and optimistic settings, marginalised $1\sigma$ errors on cosmological parameters found by CF/int/CLASS (the other versions of CosmicFish give nearly the same results).</caption><thead><tr><th rowspan="2"></th><th colspan="4">Combined photometric/spectroscopic</th></tr><tr><th>pess/pess</th><th>pess/opt</th><th>opt/pess</th><th>opt/opt</th></tr></thead><tbody><tr><td>Ω<sub>b,0</sub></td><td>0.00099</td><td>0.00095</td><td>0.00075</td><td>0.00072</td></tr><tr><td>h</td><td>0.0016</td><td>0.0015</td><td>0.0012</td><td>0.0011</td></tr><tr><td>n<sub>s</sub></td><td>0.0047</td><td>0.0046</td><td>0.0019</td><td>0.0019</td></tr><tr><td>σ<sub>8</sub></td><td>0.0033</td><td>0.0032</td><td>0.0018</td><td>0.0018</td></tr><tr><td>Ω<sub>m,0</sub></td><td>0.0031</td><td>0.0031</td><td>0.0019</td><td>0.0019</td></tr><tr><td>w<sub>0</sub></td><td>0.036</td><td>0.035</td><td>0.026</td><td>0.025</td></tr><tr><td>w<sub>a</sub></td><td>0.14</td><td>0.13</td><td>0.096</td><td>0.094</td></tr></tbody></table>

(or marginalized over in the case of the galaxy bias). This is again more conservative, firstly, because it assumes more freedom in the modelling of the observables, and secondly, because the marginalization over a larger parameter space degrades the constraints. Since EP:VII did not publish a Fisher matrix using our direct full-shape method approach, we compare against the code SoapFish, which does contain the same implementation and is one of the validated codes of the EP:VII group.

### 5.3. Combined surveys

We finally combine the photometric and spectroscopic probes, which amounts in summing up their Fisher matrices. We consider all four combinations of pessimistic or optimistic settings for each probe. The absolute $1\sigma$ errors on each cosmological parameters obtained with CosmicFish are shown in Table 12. We take here numbers from the CF/int/CLASS case – but we cross-checked that other cases give essentially the same numbers. To visualise the way in which the combined probe lifts parameter degeneracies, the best is to compare the Fisher ellipses coming from individual and combined probes. These are shown in Fig. 14 for the optimistic-optimistic case, in Appendix D for the pessimistic-pessimistic case, and in our repository for other cases<fnref n="18" />.

Note that, in principle, there is a correlation between data from the photometric and spectroscopic galaxy clustering probes at the redshifts where they overlap. In this section, we neglect this correlation for simplicity, which makes our forecasts slightly too optimistic. This differs from the ‘EP:VII pessimistic’ approach, in which high-redshift data were removed from the photometric survey, leading instead to slightly too pessimistic results.

The combination is particularly efficient for the determination of $\Omega_{b,0}$ and $h$, for which the photometric and spectroscopic surveys probe different degeneracy directions. The combination reduces significantly the error on these parameters compared to each individual probe. For other parameters the measurement is dominated by the photometric probe.

A traditional estimate of the constraining power of a survey dedicated to the study of dark energy is the dark energy Figure of Merit (DE FoM), which is defined as

$$ \text{FoM} = \sqrt{\det(\tilde{F}_{w_0 w_a})}, \qquad (38) $$

where $\tilde{F}_{w_0 w_a}$ is the $2 \times 2$ Fisher matrix after marginalizing over all other cosmological and nuisance parameters except $w_0$ and $w_a$. For a Gaussian posterior (i.e. for elliptical Fisher contours) this quantity is related to the area $S$ of the $1\sigma$ probability contours by

$$ \text{FoM} = \frac{2.3\pi}{S}. \qquad (39) $$

For a Fisher matrix the computation of the determinant is a trivial operation, while for MCMC chains there are two options. The first option, and most common in the literature, is to compute the covariance matrix of the chains, which is a good approximation if the posterior is Gaussian: then, the covariance matrix is equivalent to the inverse of the Fisher matrix. However, since the covariance matrix is by definition symmetrical, computing the DE FoM from it might under- or over-estimate the constraining power of the probe in the $w_0-w_a$ parameter space. The difference would depend on the exact shape of the MCMC contours and how non-Gaussian they are. The second option is to use Eq. (39) to calculate the FoM from the enclosed area of the MCMC contour itself. The computation of such contours is a well-known problem in the literature. The reader can refer to Lewis (2019) and Brinckmann & Lesgourgues (2019) for more details on the estimation of the probability contours from a discrete set of Markov chains.

For the photometric probe, since our approach is exactly equivalent to the one of EP:VII, we also find exactly the same DE FoM. For the spectroscopic one, we have highlighted and proved in this work that, while using the same likelihood recipe, we adopt a different parametrisation: we directly compute the Fisher matrix in the space of cosmological parameters, while EP:VII computed it with respect to a basis of phenomenological parameters and then used a non-trivial transformation to go to the space of cosmological parameters. Thus we find a slightly different FoM, that we provide for completeness in Table 13 – using either one of the CosmicFish Fisher pipelines or the MCMC pipeline with an evaluation of the area enclosed by the marginalised contours.

## 6. Impact of accuracy settings in Einstein-Boltzmann solvers

CAMB and CLASS have been proved to agree remarkably well with each other when using very high accuracy settings (see Lesgourgues 2011b). The settings defined in Lesgourgues (2011b) are however unpractical because they slow down both codes considerably. The question of properly choosing the

<footnote n="18">¹⁸ In the GitHub repository https://github.com/sabarish-vm/Euclid_w0wa.git these plots are located in plots/combined/combined_pess_opt_cosmo.pdf and plots/combined/combined_opt_pess_cosmo.pdf</footnote>
<table><caption>**Table 12.** For the combined photometric and spectroscopic surveys with various combinations of pessimistic and optimistic settings, marginalised $1\sigma$ errors on cosmological parameters found by CF/int/CLASS (the other versions of CosmicFish give nearly the same results).</caption><thead><tr><th rowspan="2"></th><th colspan="4">Combined photometric/spectroscopic</th></tr><tr><th>pess/pess</th><th>pess/opt</th><th>opt/pess</th><th>opt/opt</th></tr></thead><tbody><tr><td>Ω<sub>b,0</sub></td><td>0.00099</td><td>0.00095</td><td>0.00075</td><td>0.00072</td></tr><tr><td>h</td><td>0.0016</td><td>0.0015</td><td>0.0012</td><td>0.0011</td></tr><tr><td>n<sub>s</sub></td><td>0.0047</td><td>0.0046</td><td>0.0019</td><td>0.0019</td></tr><tr><td>σ<sub>8</sub></td><td>0.0033</td><td>0.0032</td><td>0.0018</td><td>0.0018</td></tr><tr><td>Ω<sub>m,0</sub></td><td>0.0031</td><td>0.0031</td><td>0.0019</td><td>0.0019</td></tr><tr><td>w<sub>0</sub></td><td>0.036</td><td>0.035</td><td>0.026</td><td>0.025</td></tr><tr><td>w<sub>a</sub></td><td>0.14</td><td>0.13</td><td>0.096</td><td>0.094</td></tr></tbody></table>

(or marginalized over in the case of the galaxy bias). This is again more conservative, firstly, because it assumes more freedom in the modelling of the observables, and secondly, because the marginalization over a larger parameter space degrades the constraints. Since EP:VII did not publish a Fisher matrix using our direct full-shape method approach, we compare against the code SoapFish, which does contain the same implementation and is one of the validated codes of the EP:VII group.

### 5.3. Combined surveys

We finally combine the photometric and spectroscopic probes, which amounts in summing up their Fisher matrices. We consider all four combinations of pessimistic or optimistic settings for each probe. The absolute $1\sigma$ errors on each cosmological parameters obtained with CosmicFish are shown in Table 12. We take here numbers from the CF/int/CLASS case – but we cross-checked that other cases give essentially the same numbers. To visualise the way in which the combined probe lifts parameter degeneracies, the best is to compare the Fisher ellipses coming from individual and combined probes. These are shown in Fig. 14 for the optimistic-optimistic case, in Appendix D for the pessimistic-pessimistic case, and in our repository for other cases<fnref n="18" />.

Note that, in principle, there is a correlation between data from the photometric and spectroscopic galaxy clustering probes at the redshifts where they overlap. In this section, we neglect this correlation for simplicity, which makes our forecasts slightly too optimistic. This differs from the ‘EP:VII pessimistic’ approach, in which high-redshift data were removed from the photometric survey, leading instead to slightly too pessimistic results.

The combination is particularly efficient for the determination of $\Omega_{b,0}$ and $h$, for which the photometric and spectroscopic surveys probe different degeneracy directions. The combination reduces significantly the error on these parameters compared to each individual probe. For other parameters the measurement is dominated by the photometric probe.

A traditional estimate of the constraining power of a survey dedicated to the study of dark energy is the dark energy Figure of Merit (DE FoM), which is defined as

$$ \text{FoM} = \sqrt{\det(\tilde{F}_{w_0 w_a})}, \qquad (38) $$

where $\tilde{F}_{w_0 w_a}$ is the $2 \times 2$ Fisher matrix after marginalizing over all other cosmological and nuisance parameters except $w_0$ and $w_a$. For a Gaussian posterior (i.e. for elliptical Fisher contours) this quantity is related to the area $S$ of the $1\sigma$ probability contours by

$$ \text{FoM} = \frac{2.3\pi}{S}. \qquad (39) $$

For a Fisher matrix the computation of the determinant is a trivial operation, while for MCMC chains there are two options. The first option, and most common in the literature, is to compute the covariance matrix of the chains, which is a good approximation if the posterior is Gaussian: then, the covariance matrix is equivalent to the inverse of the Fisher matrix. However, since the covariance matrix is by definition symmetrical, computing the DE FoM from it might under- or over-estimate the constraining power of the probe in the $w_0-w_a$ parameter space. The difference would depend on the exact shape of the MCMC contours and how non-Gaussian they are. The second option is to use Eq. (39) to calculate the FoM from the enclosed area of the MCMC contour itself. The computation of such contours is a well-known problem in the literature. The reader can refer to Lewis (2019) and Brinckmann & Lesgourgues (2019) for more details on the estimation of the probability contours from a discrete set of Markov chains.

For the photometric probe, since our approach is exactly equivalent to the one of EP:VII, we also find exactly the same DE FoM. For the spectroscopic one, we have highlighted and proved in this work that, while using the same likelihood recipe, we adopt a different parametrisation: we directly compute the Fisher matrix in the space of cosmological parameters, while EP:VII computed it with respect to a basis of phenomenological parameters and then used a non-trivial transformation to go to the space of cosmological parameters. Thus we find a slightly different FoM, that we provide for completeness in Table 13 – using either one of the CosmicFish Fisher pipelines or the MCMC pipeline with an evaluation of the area enclosed by the marginalised contours.

## 6. Impact of accuracy settings in Einstein-Boltzmann solvers

CAMB and CLASS have been proved to agree remarkably well with each other when using very high accuracy settings (see Lesgourgues 2011b). The settings defined in Lesgourgues (2011b) are however unpractical because they slow down both codes considerably. The question of properly choosing the

<footnote n="18">¹⁸ In the GitHub repository https://github.com/sabarish-vm/ Euclid_w0wa.git these plots are located in plots/combined/ combined_pess_opt_cosmo.pdf and plots/combined/combined_opt_pess_cosmo.pdf</footnote>
<figure><img src="image_14.png" /><figcaption>**Fig. 14.** For the individual and combined photometric and spectroscopic surveys with optimistic settings, 1D posterior and 2D contours (for 68% and 95% confidence level) on cosmological parameters from CF/int/CLASS (dotted lines) and MP/Fisher (solid lines). Plotted using GetDist.</figcaption></figure>

<table><caption>**Table 13.** Dark energy Figure of Merit for the spectroscopic survey with optimistic and pessimistic settings, found by: the determinant of the CosmicFish Fisher matrix and the area of the MontePython MCMC contours.</caption><thead><tr><th colspan="3">Dark energy Figure of Merit (FoM)</th></tr><tr><th></th><th>CosmicFish<br>determinant</th><th>MontePython<br>MCMC area</th></tr></thead><tbody><tr><td>GCsp pessimistic</td><td>69</td><td>76</td></tr><tr><td>GCsp optimistic</td><td>87</td><td>92</td></tr></tbody></table>

default value of each precision parameter in CAMB and CLASS has been extensively investigated and tested by various groups from 2011 to 2013, that is, during the first stages of the *Planck* data analysis (see Hamann et al. 2009; Lesgourgues 2011b; Lesgourgues & Tram 2014). Since then, both codes are provided with default-precision settings designed to avoid biasing the results of MCMC analyses of, typically, *Planck* and SDSS/BOSS data, while keeping them as fast as possible.

Accuracy settings in CAMB and CLASS deserve to be revisited in the present context, mainly for three reasons. First, in general, Fisher analyses require more precision than MCMC runs. Indeed, the calculation of numerical derivatives involves the comparison of power spectra obtained under very small variations of cosmological parameters. These variations should

be dominated by physical effects rather than numerical errors. MCMC runs avoid such an issue because, in MCMCs random numerical errors tend to be averaged out each time that results are marginalised over unwanted parameters. Thus, in this work, MCMC runs are always performed with default CLASS precision. Second, among the Fisher methods used here, the MP/Fisher method, which requires the calculation of second derivatives of the likelihood, tends to require even higher precision. Third, Euclid probes the matter power spectrum with much higher accuracy than SDSS/BOSS. Precision parameters that are particularly relevant for computing the matter power spectrum need to be tuned accordingly.

## 6.1. Accuracy settings and fiducial spectra

In Appendix A we detail the list of all fixed parameters passed to CAMB and CLASS before each run. The list includes a few options concerning the setting of key precision parameters. Here we summarise these different settings and we show how they impact the accuracy of the power spectrum calculation for a given cosmological model – in this section we just chose to focus on the fiducial model<fnref n="19" />. For more details the reader can consult Appendix A.

<footnote n="19">¹⁹ In this section we only compared the linear and nonlinear power spectra from CAMB and CLASS. Internally, we also compared the functions $D(z)$, $f(z)$, and $\sigma_8(z)$. For the latter, we did not find any noticeable difference that would be worth reporting.</footnote>
<figure><img src="image_15.png" /><figcaption>**Fig. 14.** For the individual and combined photometric and spectroscopic surveys with optimistic settings, 1D posterior and 2D contours (for 68% and 95% confidence level) on cosmological parameters from CF/int/CLASS (dotted lines) and MP/Fisher (solid lines). Plotted using GetDist.</figcaption></figure>

<table><caption>**Table 13.** Dark energy Figure of Merit for the spectroscopic survey with optimistic and pessimistic settings, found by: the determinant of the CosmicFish Fisher matrix and the area of the MontePython MCMC contours.</caption><thead><tr><th colspan="3">Dark energy Figure of Merit (FoM)</th></tr><tr><th></th><th>CosmicFish<br>determinant</th><th>MontePython<br>MCMC area</th></tr></thead><tbody><tr><td>GCsp pessimistic</td><td>69</td><td>76</td></tr><tr><td>GCsp optimistic</td><td>87</td><td>92</td></tr></tbody></table>

default value of each precision parameter in CAMB and CLASS has been extensively investigated and tested by various groups from 2011 to 2013, that is, during the first stages of the *Planck* data analysis (see Hamann et al. 2009; Lesgourgues 2011b; Lesgourgues & Tram 2014). Since then, both codes are provided with default-precision settings designed to avoid biasing the results of MCMC analyses of, typically, *Planck* and SDSS/BOSS data, while keeping them as fast as possible.

Accuracy settings in CAMB and CLASS deserve to be revisited in the present context, mainly for three reasons. First, in general, Fisher analyses require more precision than MCMC runs. Indeed, the calculation of numerical derivatives involves the comparison of power spectra obtained under very small variations of cosmological parameters. These variations should

be dominated by physical effects rather than numerical errors. MCMC runs avoid such an issue because, in MCMCs random numerical errors tend to be averaged out each time that results are marginalised over unwanted parameters. Thus, in this work, MCMC runs are always performed with default CLASS precision. Second, among the Fisher methods used here, the MP/Fisher method, which requires the calculation of second derivatives of the likelihood, tends to require even higher precision. Third, Euclid probes the matter power spectrum with much higher accuracy than SDSS/BOSS. Precision parameters that are particularly relevant for computing the matter power spectrum need to be tuned accordingly.

## 6.1. Accuracy settings and fiducial spectra

In Appendix A we detail the list of all fixed parameters passed to CAMB and CLASS before each run. The list includes a few options concerning the setting of key precision parameters. Here we summarise these different settings and we show how they impact the accuracy of the power spectrum calculation for a given cosmological model – in this section we just chose to focus on the fiducial model<fnref n="19" />. For more details the reader can consult Appendix A.

<footnote n="19">¹⁹ In this section we only compared the linear and nonlinear power spectra from CAMB and CLASS. Internally, we also compared the functions $D(z)$, $f(z)$, and $\sigma_8(z)$. For the latter, we did not find any noticeable difference that would be worth reporting.</footnote>
Fisher matrices derived in the previous sections. For the nonlinear power spectrum the level of agreement is similar (excepted for a narrow spike of 0.2% at $k \approx 3.3 \times 10^{-3}$ Mpc$^{-1}$ coming from the transition from linear to nonlinear calculations in both codes – but a feature at such a low values of $k$ is harmless for *Euclid* predictions).

Next, we can investigate the impact of degrading precision in the two codes. With CLASS DP the error remains below the 0.1% level on large scales, but slightly exceeds 0.12% on small scales for the linear power spectrum. This is anyhow a very small degradation compared to the sensitivity of *Euclid*. As a matter of fact, we only observe very small differences between the CosmicFish results obtained with either CLASS DP or HP. However, the HP settings provide more stability against the choice of step sizes when computing the second derivatives of the likelihood with the MP/Fisher approach, as shown in Appendix B.3. Thus, in the rest of this work, we decided to stick everywhere to CLASS HP settings.

Comparing the results from CAMB P2 and P3 in Fig. 15, we see that CAMB P2 is a bit further away from CLASS HP than CAMB P3 on small scales, but this is rather unimportant. The results for P1 and P2 are identical at the level of the linear spectra, since these settings only differ at the level of one Halofit parameter. However, the nonlinear spectra from P1 and P2 differ significantly – at the 0.25% for our fiducial model. This shows that a Halofit tolerance of $10^{-3}$ is insufficient. It leads to a poorly converged bisection in Halofit, and thus to a spurious step-like response of the nonlinear spectrum to small variations in the cosmological parameters. Thus, it compromises the calculation of numerical derivatives. We believe that the EP:VII group overcame this difficulty by using advanced methods for the calculation of derivatives, based on multiple steps. With simple two-sided derivatives, it would be nearly impossible to obtain stable derivatives with P1 settings, as we shall see better in the next subsection.

As a small technical detail, we note that in order to produce Fig. 15 we adjusted two parameters in a slightly different way than in the rest of this paper. Instead of passing the same value of $\sigma_8$ to both codes, we passed the same value of $A_s$ in order to be insensitive to very small differences in the $\sigma_8$-to-$A_s$ conversion performed inside CAMB or CLASS. This choice is relevant only for the sake of producing Fig. 15. Indeed, in the rest of this work we only want to compute the variation of the spectra in the vicinity of the fiducial model. Thus, a very small difference in the absolute value of one cosmological parameter ($A_s$) is irrelevant. Therefore, in other sections we can safely adopt the same input value of $\sigma_8$ in the two codes. In order to match the scale $k_*$ at which both codes start computing nonlinear corrections to the power spectrum, we adjusted manually the transition scale parameter in CLASS to its CAMB value, that is, `halofit_min_k_nonlinear=3.3e-3`. Otherwise, nonlinear corrections are computed by CLASS for any $k > k_*^{CLASS} = 10^{-4}$ Mpc$^{-1}$ and by CAMB for any $k > k_*^{CAMB} = 3.3 \times 10^{-3}$ Mpc$^{-1}$. This produces a small degradation of the CAMB-CLASS agreement for $k_*^{CLASS} < k < k_*^{CAMB}$. However, *Euclid* does not probe accurately such huge huge scales or tiny wavenumbers. Thus, in other parts of this work, we stick to the default value of the CLASS parameter `halofit_min_k_nonlinear`.

## 6.2. Accuracy settings and first derivatives of the spectra

We now bring our precision tests to the level of first derivative calculations. Since we use the Limber approximation for the photometric probe, the quantities of interest for both probes

are the derivatives of the matter power spectrum. We have shown here the derivatives $\partial_\alpha \ln P(k, z)$ of the linear and nonlinear power spectrum at $z=0$ for all cosmological parameters $\alpha$. Like in our CosmicFish runs we use two-sided derivatives with step sizes $\Delta p_\alpha$ set to 1% of fiducial values (or 0.01 in the case of $w_0$ and $w_a$). Figure 16 shows the derivatives $\partial_\alpha \ln P(k, z=0)$ as a function of $k$ computed with CLASS DP, HP, and CAMB P1, P2, P3. To see better the difference between these curves, we show in Fig. 17 the difference between the derivatives computed with either CLASS DP, CAMB P1, CAMB P2, or CAMB P3 and those computed with CLASS HP.

For the linear power spectrum all codes and all accuracy settings predict derivatives that are visually identical in Figs. 16 and 17 reveals tiny differences. By comparing the two figures, we see that differences are typically two order of magnitude smaller than the derivative themselves (the biggest discrepancy is a 5% difference between the CAMB and CLASS predictions for the derivative with respect to $h$). Such a high level of agreement on linear derivatives explains the very good match between the Fisher matrices obtained with CosmicFish/CAMB and CosmicFish/CLASS for the spectroscopic probe.

At the level of the nonlinear power spectrum, we see in both figures that CAMB P1 predictions are very discrepant – especially for $(\Omega_b, \sigma_8)$, but also for $(\Omega_{m,0}, h, n_s)$. This is due to the glitches generated by insufficient settings for the Halofit tolerance parameter. However, the level of agreement between CLASS DP, HP and CAMB P2, P3 is again excellent, typically of the same order of magnitude as for the linear spectrum – which proves that Halofit is implemented consistently and accurately in the two codes.

From a glance at Figs. 16 and 17 it is difficult to assess whether the Fisher matrix of the CosmicFish pipeline should be computed with DP or HP for CLASS and with P2 or P3 for CAMB: these settings seem roughly equivalent at the level of these plots. However, tiny differences at the level of derivatives – and thus of Fisher matrices – can be amplified by the Fisher matrix inversion. Thus the only way to check the required level of accuracy is to compare the marginalised errors obtained with different precision levels. We performed such tests using the CF/ext pipeline.

We show the difference between the error inferred from CAMB P2 versus P3 or from CLASS DP versus HP in Fig. 18. In each test we consider the case of the photometric/optimistic probe (top panels) and spectroscopic/optimistic probe (bottom panels). Here we always use the CF/ext pipeline.

The largest differences appear between CAMB P2 and CAMB P3 for the spectroscopic probe: they are of the order of 1% on marginalised errors. These differences are still small, which suggests that results obtained with P2 are already reasonable, while those of P3 are likely to be well converged. We checked that the results obtained with P3 are the closest ones to the average of other pipelines, and thus, as expected, the most accurate. This motivates our choice to stick to P3 precision in the rest of this work. We recall that the matrices of EP:VII were based on P1 settings and that the significant error introduced by such settings was mitigated through the use of the SteM scheme for the calculation of derivatives.

Between CLASS DP and CLASS HP, we never find differences exceeding 0.5%. Thus, running with HP is not strictly necessary, but it confers extra precision and robustness to the results. In all previous sections, our Fisher matrices were obtained with HP settings.
Fisher matrices derived in the previous sections. For the nonlinear power spectrum the level of agreement is similar (excepted for a narrow spike of 0.2% at $k \approx 3.3 \times 10^{-3}$ Mpc$^{-1}$ coming from the transition from linear to nonlinear calculations in both codes – but a feature at such a low values of $k$ is harmless for *Euclid* predictions).

Next, we can investigate the impact of degrading precision in the two codes. With CLASS DP the error remains below the 0.1% level on large scales, but slightly exceeds 0.12% on small scales for the linear power spectrum. This is anyhow a very small degradation compared to the sensitivity of *Euclid*. As a matter of fact, we only observe very small differences between the CosmicFish results obtained with either CLASS DP or HP. However, the HP settings provide more stability against the choice of step sizes when computing the second derivatives of the likelihood with the MP/Fisher approach, as shown in Appendix B.3. Thus, in the rest of this work, we decided to stick everywhere to CLASS HP settings.

Comparing the results from CAMB P2 and P3 in Fig. 15, we see that CAMB P2 is a bit further away from CLASS HP than CAMB P3 on small scales, but this is rather unimportant. The results for P1 and P2 are identical at the level of the linear spectra, since these settings only differ at the level of one Halofit parameter. However, the nonlinear spectra from P1 and P2 differ significantly – at the 0.25% for our fiducial model. This shows that a Halofit tolerance of $10^{-3}$ is insufficient. It leads to a poorly converged bisection in Halofit, and thus to a spurious step-like response of the nonlinear spectrum to small variations in the cosmological parameters. Thus, it compromises the calculation of numerical derivatives. We believe that the EP:VII group overcame this difficulty by using advanced methods for the calculation of derivatives, based on multiple steps. With simple two-sided derivatives, it would be nearly impossible to obtain stable derivatives with P1 settings, as we shall see better in the next subsection.

As a small technical detail, we note that in order to produce Fig. 15 we adjusted two parameters in a slightly different way than in the rest of this paper. Instead of passing the same value of $\sigma_8$ to both codes, we passed the same value of $A_s$ in order to be insensitive to very small differences in the $\sigma_8$-to-$A_s$ conversion performed inside CAMB or CLASS. This choice is relevant only for the sake of producing Fig. 15. Indeed, in the rest of this work we only want to compute the variation of the spectra in the vicinity of the fiducial model. Thus, a very small difference in the absolute value of one cosmological parameter ($A_s$) is irrelevant. Therefore, in other sections we can safely adopt the same input value of $\sigma_8$ in the two codes. In order to match the scale $k_*$ at which both codes start computing nonlinear corrections to the power spectrum, we adjusted manually the transition scale parameter in CLASS to its CAMB value, that is, halofit_min_k_nonlinear=3.3e-3. Otherwise, nonlinear corrections are computed by CLASS for any $k > k_*^{CLASS} = 10^{-4}$ Mpc$^{-1}$ and by CAMB for any $k > k_*^{CAMB} = 3.3 \times 10^{-3}$ Mpc$^{-1}$. This produces a small degradation of the CAMB-CLASS agreement for $k_*^{CLASS} < k < k_*^{CAMB}$. However, *Euclid* does not probe accurately such huge huge scales or tiny wavenumbers. Thus, in other parts of this work, we stick to the default value of the CLASS parameter halofit_min_k_nonlinear.

## 6.2. Accuracy settings and first derivatives of the spectra

We now bring our precision tests to the level of first derivative calculations. Since we use the Limber approximation for the photometric probe, the quantities of interest for both probes

are the derivatives of the matter power spectrum. We have shown here the derivatives $\partial_\alpha \ln P(k, z)$ of the linear and nonlinear power spectrum at $z=0$ for all cosmological parameters $\alpha$. Like in our CosmicFish runs we use two-sided derivatives with step sizes $\Delta p_\alpha$ set to 1% of fiducial values (or 0.01 in the case of $w_0$ and $w_a$). Figure 16 shows the derivatives $\partial_\alpha \ln P(k, z=0)$ as a function of $k$ computed with CLASS DP, HP, and CAMB P1, P2, P3. To see better the difference between these curves, we show in Fig. 17 the difference between the derivatives computed with either CLASS DP, CAMB P1, CAMB P2, or CAMB P3 and those computed with CLASS HP.

For the linear power spectrum all codes and all accuracy settings predict derivatives that are visually identical in Figs. 16 and 17 reveals tiny differences. By comparing the two figures, we see that differences are typically two order of magnitude smaller than the derivative themselves (the biggest discrepancy is a 5% difference between the CAMB and CLASS predictions for the derivative with respect to $h$). Such a high level of agreement on linear derivatives explains the very good match between the Fisher matrices obtained with CosmicFish/CAMB and CosmicFish/CLASS for the spectroscopic probe.

At the level of the nonlinear power spectrum, we see in both figures that CAMB P1 predictions are very discrepant – especially for $(\Omega_b, \sigma_8)$, but also for $(\Omega_{m,0}, h, n_s)$. This is due to the glitches generated by insufficient settings for the Halofit tolerance parameter. However, the level of agreement between CLASS DP, HP and CAMB P2, P3 is again excellent, typically of the same order of magnitude as for the linear spectrum – which proves that Halofit is implemented consistently and accurately in the two codes.

From a glance at Figs. 16 and 17 it is difficult to assess whether the Fisher matrix of the CosmicFish pipeline should be computed with DP or HP for CLASS and with P2 or P3 for CAMB: these settings seem roughly equivalent at the level of these plots. However, tiny differences at the level of derivatives – and thus of Fisher matrices – can be amplified by the Fisher matrix inversion. Thus the only way to check the required level of accuracy is to compare the marginalised errors obtained with different precision levels. We performed such tests using the CF/ext pipeline.

We show the difference between the error inferred from CAMB P2 versus P3 or from CLASS DP versus HP in Fig. 18. In each test we consider the case of the photometric/optimistic probe (top panels) and spectroscopic/optimistic probe (bottom panels). Here we always use the CF/ext pipeline.

The largest differences appear between CAMB P2 and CAMB P3 for the spectroscopic probe: they are of the order of 1% on marginalised errors. These differences are still small, which suggests that results obtained with P2 are already reasonable, while those of P3 are likely to be well converged. We checked that the results obtained with P3 are the closest ones to the average of other pipelines, and thus, as expected, the most accurate. This motivates our choice to stick to P3 precision in the rest of this work. We recall that the matrices of EP:VII were based on P1 settings and that the significant error introduced by such settings was mitigated through the use of the SteM scheme for the calculation of derivatives.

Between CLASS DP and CLASS HP, we never find differences exceeding 0.5%. Thus, running with HP is not strictly necessary, but it confers extra precision and robustness to the results. In all previous sections, our Fisher matrices were obtained with HP settings.