# Mass reconstruction and noise reduction with cosmic-web environments

Feng Fang1 Yan-Chuan Cai2<EMAIL_ADDRESS>Zhuoyang Li1,3 Shiyu Yue1 Weishan Zhu1
Longlong Feng1<EMAIL_ADDRESS>1School of Physics and Astronomy,
Sun Yat-Sen University, Zhuhai 519082, China 2Institute for Astronomy,
University of Edinburgh, Blackford Hill, Edinburgh, EH9 3HJ, UK 3Department of
Astronomy, Tsinghua University, Beijing 100084, China

###### Abstract

The clustering of galaxies and their connections to their initial conditions
is a major means by which we learn about cosmology. However, the stochasticity
between galaxies and their underlying matter field is a major limitation for
precise measurements of galaxy clustering. It also hinders accurate mass
reconstruction for retrieving cosmological information from observations.
Efforts have been made with an optimal weighting scheme to reduce this
stochasticity using the mass-dependent clustering of dark matter halos, but
its application to observation is challenging due to the difficulties in
measuring the mass of halos precisely. Here, we show that this is not optimal.
We demonstrate that the cosmic-web environments (voids, sheets, filaments &
knots) of halos provide extra information for reducing stochasticity. Using
the environmental information alone can increase the signal-to-noise of
clustering by approximately a factor of 3, better than the Poisson level at
the scales of the baryon acoustic oscillations. This improvement is comparable
to using halo mass information alone. The information about the environment
and halo mass are complementary. Their combination increases the signal-to-
noise by another factor of 2-3. The information about the cosmic web
correlates with other properties of halos, including halo concentrations and
tidal forces, thus, these are among the most dominant factors that can help
improve the reconstruction. We attribute the extra information from the
environment and secondary properties of halos primarily to the assembly bias
of halos. Our findings open a new avenue for mass reconstruction and noise
reduction using information beyond the halo mass.

large-scale structure of Universe – dark matter – Galaxy: halo – methods:
numerical

A major challenge in cosmology with large-scale structure is to reconstruct
the initial conditions from observations of the late-time Universe. While the
initial matter density field is thought to be linear and continuous, what we
observe in the late-time Universe is a discrete sampling of a non-linear
matter field, typically traced out by galaxies. The accuracy of the
reconstruction determines the amount of cosmological information we can
extract from observations. It can be quantified with the correlation
coefficient $r$ between the galaxy number density field $\delta_{g}$ and the
matter density field $\delta_{m}$,

$r\equiv\frac{\langle\delta_{g}\delta_{m}\rangle}{\sqrt{\langle\delta_{g}^{2}\rangle\langle\delta_{m}^{2}\rangle}}.$
(1)

The $\langle\,\rangle$ symbol denotes the ensemble average. To the first
order, galaxies are linearly biased against matter. With the presence of shot
noise $\epsilon$, we have $\delta_{g}=b\delta_{m}+\epsilon$, where $b$ is the
linear bias of galaxies. With $\langle\epsilon\delta_{m}\rangle=0$, we have
$P_{g}=\langle\delta_{g}^{2}\rangle=b^{2}P_{m}+\langle\epsilon^{2}\rangle$,
$P_{gm}=\langle\delta_{g}\delta_{m}\rangle=bP_{m}$, where $P_{m}$ is the
matter power spectrum; and so

$\frac{\langle\epsilon^{2}\rangle}{b^{2}P_{m}}=\frac{1-r^{2}}{r^{2}}.$ (2)

All the above quantities are functions of the Fourier number $k$. We can see
that the presence of the noise, or stochasticity, degrades the correlation
coefficient $r$ [1, 2, 3]. Minimizing stochasticity, increasing correlation
coefficients and optimizing mass reconstruction are different sides of the
same coin. Reducing $\epsilon$ has the following observational implications:

(1) increasing the signal-to-noise ratio for the clustering of galaxies [e.g.
4, 5, 3], which is particularly beneficial for analyses of the baryon acoustic
oscillations (BAO) with sparse tracers [e.g. 6, 7, 8, 9, 10, 11, 12, 13];

(2) increasing the correlations between the galaxy field and the matter field,
allowing more cosmological information to be retrieved from the measurement of
galaxy-galaxy lensing and reconstruction [e.g. 14, 15, 16, 17, 18, 19].

If $\epsilon$ is Poissonian, its power spectrum is $1/\bar{n}$, with $\bar{n}$
being the number density of tracers. Recent work has shown that we can improve
beyond the Poisson limit [14, 4, 5, 3, 20, 21, 22, 23]. In N-body simulations
where the masses of dark matter halos are known, [5] and [3] have shown that a
linear combination of halos of different masses with different weights can
significantly reduce stochasticity. The primary information used for the
improvement is the mass-dependence of halo power spectra $P_{h}(k,M)$, where
$M$ is the mass of halos. One way to understand this is that the linear halo
bias $b(M)$ increases with $M$; for the same number of halos, the signal-to-
noise of $P_{h}(k,M)$ is higher for halos with larger masses. Therefore, it is
preferable to up-weight the high-mass halos to increase the signal-to-noise.
This is indeed the case for the optimal weights found in [5, 3].

However, this can not be the full physical picture. In addition to $M$, the
clustering of halos depends also on other secondary properties. Among them,
the formation time of halos is known to affect the halo clustering. For low-
mass halos, those who formed earlier tend to exhibit stronger clustering than
younger ones. This is known as the halo assembly bias [24, 25]. This indicates
that there is room for further improvement in the reconstruction if this
secondary property of halos can be used, and it is the focus of this letter.

A main challenge for this is that the formation time of halos or galaxies is
difficult to measure in observations. However, it is known to correlate with
other properties of halos, especially with halo concentration, tidal force,
and their cosmic-web environments [e.g. 26, 27, 28], with some arguing that
cosmic-web anisotropy is the main indicator for halo assembly bias [29, 30,
31], the latter is accessible in observations. We will, therefore, focus on
using the cosmic-web environment for the reconstruction.

Suppose we have an observed halo number density field, denoted as
$\delta_{h}$; It is a discrete sampling of its underlying matter field
$\delta_{m}$. Our aim is to maximize the correlation coefficient $r$ between
these two fields, defined in equation (1), substituting the subscript $b$ by
$h$ to represent halos. We can see that $r$ is agnostic about the linear halo
bias. When $r=1$, perturbation modes are in phase, but their amplitudes can be
different.

To maximize $r$, we split the halo catalog $n_{h}$ into $N_{s}$ sub-samples
with $n_{h}=\sum_{i=1}^{N_{s}}n_{i}$, and weight each sub-sample with
$W_{i}\in\mathbb{R}$. We then combine these weighted sub-samples to obtain the
reconstructed density field $n_{c}=\sum_{i}^{N_{s}}W_{i}n_{i}$. The $i$th sub-
sample can be written as
$n_{i}=\sum_{j=1}^{N_{i}}w_{j}\delta_{D}(\vec{x}-\vec{x}_{j})$, where
$\delta_{D}$ is the Dirac delta function and $w_{j}$ represents the initial
weight of each tracer, which could be the selection function in observation or
the halo mass in simulation, and $N_{i}$ is the number of halos in the $i$th
sub-sample. Thus, the overdensity of the reconstructed fields $\delta_{c}$ is

$\delta_{c}\equiv\frac{n_{c}}{\bar{n}_{c}}-1=\frac{\sum_{i}^{N_{s}}W_{i}\bar{n}_{i}(1+\delta_{i})}{\sum_{i}^{N_{s}}W_{i}\bar{n}_{i}}-1=\bm{\omega}^{T}\bm{\delta},$
(3)

where $\bm{\omega}$ and $\bm{\delta}$ are $N_{s}$-vectors, with elements
$\omega_{i}=\frac{W_{i}\bar{n}_{i}}{\sum W_{i}\bar{n}_{i}}$ and
$\delta_{i}=\frac{n_{i}}{\bar{n}_{i}}-1$ respectively. Combining equations (1)
and (3), we have:

$r_{c}^{2}=\frac{\sum_{ij}\omega_{i}B_{ij}\omega_{j}}{\sum_{ij}\omega_{i}C_{ij}\omega_{j}}=\frac{\bm{\omega}^{T}\bm{B}\bm{\omega}}{\bm{\omega}^{T}\bm{C}\bm{\omega}},$
(4)

with the symmetric matrices $\bm{B}$ and $\bm{C}$ defined as

$\left\\{\begin{aligned}
B_{ij}&=\frac{\langle\delta_{i}\delta_{m}\rangle\langle\delta_{j}\delta_{m}\rangle}{\langle\delta_{m}\delta_{m}\rangle},\\\
C_{ij}&=\langle\delta_{i}\delta_{j}\rangle.\end{aligned}\right.$ (5)

To solve for the weights that maximize $r_{c}^{2}$, we set the derivative of
$r_{c}^{2}$ to be $0$ to obtain:

$\bm{B}\bm{\omega}=r_{c}^{2}\bm{C}\bm{\omega}.$ (6)

Figure 1: Joint probability density distributions of matter density fields
$\delta_{m}$ and reconstructed halo density field with different weights. Each
panel contains a random sampling of $\sim 10^{7}$ points within the simulation
box, smoothed by a top-hat filter with the radius of
$R=30~{}h^{-1}\text{Mpc}$. The colorbar indicates the particle number density.
Panel A: halo number density $\delta_{h}^{N}$ (equal weighting) versus
$\delta_{m}$. B: Mass-weighted halo density $\delta_{h}^{M}$ versus
$\delta_{m}$. C: Optimal-environmental weighted halo density
$\delta_{h}^{N+Env}$ versus $\delta_{m}$. D: $\delta_{h}^{M+Env}$ versus
$\delta_{m}$: optimally weighted halo density field with four halo mass bins
and four environmental bins. The threshold parameter for the environmental
split has been optimized, with $\lambda_{\text{th}}=11.25$ and $17.5$ for C
and D, respectively. See also Figure 3 and the main text for the details.
Quadratic fits with the best-fit parameters shown in the legends.

The above eigenvalue equation (6) is a generalized eigen-problem that can be
solved numerically. We use the linear algebra library
LAPACK111https://netlib.org/lapack::dspgv() to do this. The square root of the
maximum eigenvalue corresponds to the maximum correlation coefficient, and the
corresponding normalized eigenvector represents the optimal weight
$\bm{\omega}$. The key information needed for solving the above equation is
the matrices of $\bm{C}$ and $\bm{B}$. These can be measured from N-body
simulations.

In summary, our method for the reconstruction is to maximize the correlation
coefficients between the halo field and the matter density field. To do that,
we make a linear combination of the tracers; each is given a weight. We can
solve for the weights $\bm{\omega}$ that maximize the correlation
coefficients. The above derivation follows closely that of [3] but using a
different target function $r^{2}$. The results agree with each other. The
derivation is general i.e., given any field of tracers, which can be dark
matter haloes, galaxies, or HI field, and its underlying matter field
$\delta_{m}$, we can solve equation (6) to find the optimal $\bm{\omega}$ that
maximizes $r_{c}$. Next, we will apply this method to halos in simulations,
using information about their cosmic-web environment.

Figure 2: Upper panel: the power spectra of the noise
$\langle\epsilon^{2}\rangle=\langle(b\delta_{m}-\delta_{h})^{2}\rangle$ for
the four reconstructed halo fields shown in Figure 1 and labeled in the
legend. $\delta_{h}^{N}$:equal weighting; $\delta_{h}^{M}$: mass weighting;
$\delta_{h}^{N}+Env$: environmental weighting; $\delta_{h}^{M}+Env$: optimal
mass and environmental weighting. Their corresponding Poisson noise levels are
shown in horizontal lines of the same color. Bottom: the corresponding
fractional errors on the power spectra, or the ‘noise-to-signal’ ratio
$\langle\epsilon^{2}\rangle/(b^{2}P_{m})$, see also equation (2).

We use the public MultiDark MDPL2 simulations [33] and their corresponding
rockstar halo catalogues [34] for our analysis. The simulation is run with
$3840^{3}$ particles in a box of $1\,h^{-1}$Gpc following a flat $\Lambda$CDM
model with
$\Omega_{m}=0.307,\Omega_{b}=0.048,h=0.678,n_{s}=0.96,\sigma_{8}=0.823$. We
use a sample of $\sim 2.37\times 10^{6}$ halos with the minimal halo mass of
$2.0\times 10^{12}\,h^{-1}\rm{M}_{\odot}$.

We first split the halos sample into equal-number bins according to their
masses. We then further split each mass bin according to their cosmic-web
environment– voids, sheets, filaments, and knots. We define the environment
using the Hessian of the gravitational potential [26, 35] smoothed at
$1\,h^{-1}$Mpc. The three eigenvalues of the field ($\lambda_{1,2,3}$) are
compared with a threshold value $\lambda_{\text{th}}$ to classify each volume
as voids ($\lambda_{1,2,3}<\lambda_{\text{th}}$), sheets
($\lambda_{1,2}<\lambda_{\text{th}}<\lambda_{3}$), filaments
($\lambda_{1}<\lambda_{\text{th}}<\lambda_{2,3}$), and knots
($\lambda_{\text{th}}<\lambda_{1,2,3}$) [35]. The threshold value of
$\lambda_{\text{th}}$ is a free parameter that will be commented later. With
this, the halo sample is split into four environmental bins according to their
host cosmic-web environment. So, the halo field has two dependencies, mass $M$
and environment $Env$. The auto- and cross-correlations of $\delta_{h}(M,Env)$
form the matrix of $\bm{C}$ needed in equation (6). We have four bins of the
environment by definition. If we choose four mass bins, $\bm{C}$ will be a
matrix of $16\times 16$. Its correlation with the matter density field
$\delta_{m}$ yields the matrix $\bm{B}$. These will be inserted into equation
(6) to find the maximum $r_{c}$ and the optimal weights ${\bm{\omega}}$.

Figure 1 presents comparisons of scatter plots between the dark matter density
field versus the reconstructed halo field with different weights. We can see
that the scatter is the largest when halos are weighted equally (panel A),
followed by mass-weighting (panel B), and then the optimization with cosmic-
web information (panel C). It is clear that by optimizing with the cosmic-web
information, we can reduce the stochasticity to a level which is comparable
with the mass weighting case. Panel D shows the result from optimizing with
$M$ and $Env$, which reduces the stochasticity further to achieve the lowest
level of all. Therefore, the information from $M$ and $Env$ are complementary.
Their combination is better than having each of them alone.

It is also worth noting that the mean correlation relation between the halo
field and the mass field, which is the deterministic component of the bias,
also tends to be more linear for the optimal weighting cases i.e., having the
smallest quadratic coefficient $b_{2}$ when fitted with a second-order
polynomial function ($b_{2}=-0.21,0.37,0.07,0.07$ for the four cases shown in
the legend of the figure). This suggests that the second-order bias of halos
is suppressed by the optimization – an unexpected but preferable outcome. This
is consistent with the results report in [3].

The reduction of scatter in Figure 1 can be translated into an increase of
signal-to-noise for halo clustering. The upper panel of Figure 2 compares the
noise spectra for the above four cases. Note that the Poisson noise levels are
different for different weighting schemes. We can see that except equal-
weighting where $\langle\epsilon^{2}\rangle$ is comparable to Poisson noise,
all the other noise spectra are below their Poisson noise levels. By weighting
with the cosmic-web environment (orange line), we are able to bring the noise
level down below the case of mass weighting (green line). When we incorporate
both $M$ and $Env$ for the optimization, the noise level is the lowest,
approximately one order of magnitude below the Poisson level. This is
$\sim$75% lower than using the information of $M$ alone.

The lower panel of Figure 2 compares $\langle\epsilon^{2}\rangle/(b^{2}P_{m})$
– the fractional errors on the power spectra, or the ‘noise-to-signal’, for
all the four cases. This is directly related to $r_{c}$ through equation (2).
We can see again that environmental weighting alone is comparable to mass
weighting. They are approximately three times lower than equal weighting at
low-$k$’s where the baryon acoustic oscillations are. Optimizing with both $M$
and $Env$ reduces the ratio further by another factor of $\sim$2-3. The
optimal weighting is thus expected to increase the signal-to-noise ratio of
halo clustering by the same amount in the regime where shot-noise dominates.

Figure 3: The correlation coefficient $r_{c}$ between the matter density and
reconstructed fields versus the threshold value $\lambda_{\text{th}}$ for
cosmic-web classification. Orange lines ($N$): equal-weighting plus
environmental weighting; red lines ($M$): mass-weighting plus environmental
weighting. The horizontal lines of dashed gray and solid black represent
results from mass weighting and equal weighting only respectively, without any
environmental information. Blue vertical lines indicate the peak $r_{c}$
values, Their length indicates the impact of the environment. The measurements
are performed in configuration space with a $R=15\,h^{-1}\text{Mpc}$ top-hat
smoothing.

The level of improvement for the reconstruction by having the information
about the environment depends on the number of halo mass bins
${M}_{\text{bin}}$ and the threshold value $\lambda_{\text{th}}$ for the
cosmic-web classification. We discuss these two variables as follows.

For a fixed ${M}_{\text{bin}}$, $r_{c}$ varies with $\lambda_{\text{th}}$, as
shown in orange and red lines in Figure 3. There is an optimal
$\lambda_{\text{th}}$ at which $r_{c}$ is maximized. We find that the optimal
$\lambda_{\text{th}}$ is typically larger than zero. This makes both the
volume fraction for voids and the number of halos classified as void-halos to
be the largest, followed by sheets, filaments, and knots (see also figures in
Supplementary Material and [26, 35]). We have optimized $\lambda_{\text{th}}$
for results in the paper unless specified. We present the best-fit functions
for the optimal $\lambda_{\text{th}}$ versus ${M}_{\text{bin}}$ and the
corresponding $r_{c}$ versus ${M}_{\text{bin}}$ in Supplementary Material.

With the optimal $\lambda_{\text{th}}$, $r_{c}$ increases with increasing
${M}_{\text{bin}}$ (horizontal lines in Figure 3). When ${M}_{\text{bin}}$ is
large, each individual halo is effectively in a single bin. All properties of
halos are used in the optimization, leaving no room for further improvement.
In the other extreme case where no information about the halo mass is known,
i.e., ${M}_{\text{bin}}=1$, the improvement for the reconstruction with the
cosmic-web information is maximized. This is illustrated in Figure 3 by the
length of the blue vertical line in terms of the correlation coefficient
$r_{c}$. We can see that equal-weighting provides the lowest $r_{c}$ (gray
dashed line, labeled as $N$); using the cosmic-web information alone (orange
line, labeled as $N+Env$) significantly improves $r_{c}$, and slightly
outperforms the mass weighting case (labeled as $M$); having two or more mass
bin for the optimization increases $r_{c}$ further. $r_{c}=0.99$ is achieved
by having one mass bin and the environment information ($M+Env$, red-solid
line). This is approximately the same as having 16 mass bins ($M$-16) for
optimization. Note that having many mass bins is unrealistic, given the
challenge of measuring the mass of halos in observations. The gain we can
achieve using the cosmic-web information is, therefore, highly complementary.

It is worth noting that when optimizing with the mass information, we assume
that the mass of each individual halo is known. This is unrealistic in
practice. We anticipate large uncertainties for estimating halo mass in real
observations. Therefore, the benefit of using environmental weighting may be
more prominent than we have shown.

In summary, we have found significant improvement for the correlation between
halos and their underlying mass field using information about the cosmic-web
environment. The level of improvement for the reconstruction is at least as
good as optimizing using halo mass. Environment and halo mass complement each
other. Their combination yields the best reconstruction than having each of
them individually. Our findings have direct observational implications.

Reducing stochasticity, or noise, for the galaxy/halo population will directly
increase the signal-to-noise for galaxy clustering. This is crucial for
precise measurement of the BAO, especially at high redshifts where the tracers
are sparse [e.g. 6, 8, 9, 10, 11, 13]. Galaxy redshift surveys such as BOSS
[36], eBOSS [37] and DESI [38], are designed to target at a specific type of
galaxy, such as LRG, galaxies with approximately constant stellar mass, and
emission line galaxies, but it is challenging to know the mass of individual
halos. This limits the potential of shot-noise reduction using the halo mass
information. In contrast, the cosmic-web information is more readily available
from computing the Hessian matrix using the galaxy samples themselves. A
caveat is that the smoothing scale will be limited by the number density of
galaxies, but we have tested using a relatively large smoothing scale
($R=5\,h^{-1}\text{Mpc}$) to define the cosmic web, and there is still an
obvious gain of information. An additional challenge is that the observed
galaxies are in redshift space and so the defined cosmic web may be different
from its real-space version. Further investigations are needed to fully
realize the strength of the method in observations.

Reducing stochasticity between galaxies/halos versus the matter field also has
direct benefits for forward modeling e.g. Borg [39], constrained simulations
[e.g. 40], and cosmological inference at the field level using observations of
the large-scale structure [e.g. 41, 42]. The common starting point for the
above analyses is the observed galaxy number density field $\delta_{g}$, one
then try to find the initial matter density field $\delta_{m}^{i}$ which,
after non-linear evolution, may generate the observed $\delta_{g}$. Reducing
stochasticity for $\delta_{g}$ will directly reduce the errors between the
observational constraints with their initial conditions. Our method opens a
promising path for achieving this.

We are aware that the environment is not the only secondary property of halos
that can be useful for reconstruction. We have explored all other halo
properties typically defined in N-body simulations, finding that information
from the tidal force and halo concentration can also help to improve the
reconstruction. This is expected as these halo properties are correlated and
are all related to the assembly bias of halos [e.g. 26, 28].

##  I Acknowledgements

The CosmoSim database used in this paper is a service by the Leibniz-Institute
for Astrophysics Potsdam (AIP). The MultiDark database was developed in
cooperation with the Spanish MultiDark Consolider Project CSD2009-00064. The
authors gratefully acknowledge the Gauss Centre for Supercomputing e.V.
(www.gauss-centre.eu) and the Partnership for Advanced Supercomputing in
Europe (PRACE, www.prace-ri.eu) for funding the MultiDark simulation project
by providing computing time on the GCS Supercomputer SuperMUC at Leibniz
Supercomputing Centre (LRZ, www.lrz.de). FLL is supported by the National Key
R&D Program of China through grant 2020YFC2201400 and the Key Program of NFSC
through grant 11733010 and 11333008. YC acknowledges the support of the Royal
Society through a University Research Fellowship. For the purpose of open
access, the author has applied a Creative Commons Attribution (CC BY) licence
to any Author Accepted Manuscript version arising from this submission.

##  Appendix A Supplementary Material

###  A.1 Understanding the optimal weights

To understand the physics for the optimal weights, we turn to look at their
two dependants, halo mass and cosmic-web environment, $(M,Env)$.

(i) On the axis $M$: we can see from the lower panels of Figure 4 that high-
mass halos are given more weights. This is consistent with what was found in
[5, 3], and the trend is the same among all four different cosmic-web
environments. This is expected as in the extreme case where all matter
collapses into halos, mass weighting must be the optimal. In practice, we have
a low-mass cutoff, therefore, the optimal weight function versus halo mass has
a shallower slope than the mass weighting case – more weight is given to the
low-mass halos to account for the missing mass below the cutoff mass. The
general trend is that it is the optimal to give massive halos more weight.
Given that the linear bias of halos $b(M)$ increases with halo mass and the
slope of $b(M)$ is steeper for the massive halos i.e., the most massive halos
have the highest amplitude of clustering and the highest signal-to-noise in
the Poisson model. They are indeed the most ‘valuable’ for the reconstruction.

(ii) On the axis of $Env$: for halos in a fixed mass bin, we find that void-
halos is given significantly more weights, followed by sheets, filaments, and
knots, but the weights correlated strongly with the number fraction of halos
in these four cosmic-web environments (top-left panel of Figure 4). This
indicates that the weights are driven primarily by the number of halos in each
bin (top-middle panel of Figure 4). Intuitively, we do expect that the more
halos in the environmental bin, the more information about the underlying
matter density field that bin may contain, and therefore more weight should be
given to the bin that has the most numerous halos. However, a further question
is, does the weight per halo follow the same trend i.e., is a void-halo
weighted more significantly than a knot-halo? To test this, we take the ratio
between the weights and the number of halos in each environmental bin, shown
in the top-right panel of Figure 4. We find that the picture is mixed: For the
low-mass bins, each void-halo is indeed weighted more, followed by sheets,
filaments, and knots; This is consistent with our expectation that low-mass
halos in a void environment may have the largest dynamical range of formation
time, hence a stronger assembly bias. This makes void-halos more ‘valuable’
for the reconstruction, and thus their weight is larger. For the highest mass
bin, however, the trend is of the opposite, with each knot-halo being weighted
most. We think that this is the combined consequence of the wider dynamical
range in halo mass in that bin, and that knot-halos are the most massive ones.
As we recall from (i), along the axis of halo mass, it is preferable to up-
weight massive halos as they are more ‘valuable’. Also, massive halos
typically form in the late-time Universe, with relatively few of them in
voids, and most of them are in knots, and may not sample very well other
cosmic-web environments – a relatively narrow range of cosmic-web environment.
Both these factors make it preferable to up-weight knot-halos.

To further illustrate the above points, we made a two mass-bin case presented
in Figure 5. We can see that for the low-mass bin, the range of halo mass is
much narrower, further splitting it into finer mass bins does not help for the
reconstruction (bear in mind that the function of $b(M)$ is also relatively
flat in this mass range). Therefore, adding the environmental dependence
significantly improves the cross-correlation coefficients. For the high-mass
bin, the range of mass is a lot wider (also $b(M)$ is a relatively steep
function of $M$ in this mass range). Therefore, splitting the sample in mass
helps to improve the reconstruction more significantly, and the improvement
with the additional split in the environment is relatively minor.

In summary, when considering the weight of each halo, mass and environment can
be seen as two competing factors. For high-mass halos, due to the steep
relationship of $b(M)$, and the narrower range in formation time, mass-
weighting is winning over the environmental factor; for low-mass halos, the
opposite is true. With an almost flat function of $b(M)$, and a wider range in
formation time (approximate as a wider range of cosmic-web environment being
sampled), it is preferable to give halos in low-density (voids) environments
more weight.

Figure 4: Optimal weight and number fraction of halos for the $4\times 4$
cases i.e., four mass bins and four environmental bins. Top: environmental
dependence after projecting over halo mass; Bottom: mass dependence after
projecting over environments. Left: total weight given to each
environmental/mass bin; Middle: number fraction of halos; Right: weight per
halo. The threshold for cosmic-web classification, $\lambda_{\text{th}}=17.5$
has been optimized. Figure 5: Comparing the effect of environment in two
different mass bins. The y-axis on the left shows the cross-correlation
coefficient $r_{c}$; the y-axis on the right indicates the histogram of halo
mass with 50 logarithm mass bins. For visual clarity, we truncated the high-
mass end at $10^{14}\rm{M}_{\odot}$ for the plot. The halo catalogue is
initially partitioned into two equal-number bins, denoted as $M1$ and $M2$,
separated by the vertical line in the plot. We then computed $r_{c}$ between
$M1$, $M2$, and the matter density field $\delta_{m}$, respectively, shown in
the black-solid and black-dash lines. Within $M1$ and $M2$, we further divide
each bin into 2, 4, 8 bins and use the mass-dependent information to optimize
$r_{c}$, shown in fainter horizontal lines as indicated in the legend.
Additionally, we split both the $M1$ and $M2$ samples into four environmental
bins, with the optimized environmental threshold value of
$\lambda_{\text{th}}=12.5$. The corresponding optimized $r_{c}$ are shown in
the red-solid line for $M1+Env$ and the red-dash line for $M2+Env$. For the
low-mass bin $M1$, using the mass information only provides little additional
gain for the reconstruction; $M1+Env$ improves $r_{c}$ by $\sim 5\%$, and so
the information about the environment plays a dominant role. For the high-mass
bin $M2$, reconstruction with the environmental information is slightly
better, providing only an additional gain of $\sim 2\%$ for the
reconstruction.  Figure 6: Various of quantities as a function of the
threshold value $\lambda_{\text{th}}$ for cosmic-web classification. The first
row: optimal weight for each environmental bin; the second row: the number
fraction (NF) of halos in each bin; the third row: the weight per halo; the
fourth row: the mean mass of halos in each bin; the fifth row: the volume
fraction (VF) classified into each cosmic-web type. Left: halos are treated
equally – equally weighted; Right: halos are weighted by their mass. The
vertical gray line indicates the optimal $\lambda_{\text{th}}$ at which
$r_{c}$ is maximized. Figure 7: Top: the optimal threshold value
$\lambda_{\text{th}}$ at which the correlation coefficient $r_{c}$ is
maximized as a function of the number of halo mass bins ${M}_{\text{bin}}$.
The data points are measurements from the simulation, with the best-fit
function shown in the legend. Bottom: the corresponding maximal $r_{c}$
achieved with the optimal $\lambda_{\text{th}}$ values from the top. A best-
fit function is also shown in the legend.

## References

  * Dekel and Lahav [1999] A. Dekel and O. Lahav, app 520, 24 (1999), arXiv:astro-ph/9806193 [astro-ph] .
  * Seljak and Warren [2004] U. Seljak and M. S. Warren, maras 355, 129 (2004), arXiv:astro-ph/0403698 [astro-ph] .
  * Cai  _et al._ [2011] Y.-C. Cai, G. Bernstein, and R. K. Sheth, maras 412, 995 (2011), arXiv:1007.3500 [astro-ph.CO] .
  * Seljak  _et al._ [2009] U. Seljak, N. Hamaus, and V. Desjacques, prl 103, 091303 (2009), arXiv:0904.2963 [astro-ph.CO] .
  * Hamaus  _et al._ [2010] N. Hamaus, U. Seljak, V. Desjacques, R. E. Smith, and T. Baldauf, pre 82, 043515 (2010), arXiv:1004.5377 [astro-ph.CO] .
  * Seo and Eisenstein [2007] H.-J. Seo and D. J. Eisenstein, app 665, 14 (2007), arXiv:astro-ph/0701079 [astro-ph] .
  * Angulo  _et al._ [2008] R. E. Angulo, C. M. Baugh, C. S. Frenk, and C. G. Lacey, maras 383, 755 (2008), arXiv:astro-ph/0702543 [astro-ph] .
  * White [2010] M. White, arXiv e-prints , arXiv:1004.0250 (2010), arXiv:1004.0250 [astro-ph.CO] .
  * Cohn  _et al._ [2016] J. D. Cohn, M. White, T.-C. Chang, G. Holder, N. Padmanabhan, and O. Doré, maras 457, 2068 (2016), arXiv:1511.07377 [astro-ph.CO] .
  * Lepori  _et al._ [2017] F. Lepori, E. Di Dio, M. Viel, C. Baccigalupi, and R. Durrer, cap 2017, 020 (2017), arXiv:1606.03114 [astro-ph.CO] .
  * Ding  _et al._ [2018] Z. Ding, H.-J. Seo, Z. Vlah, Y. Feng, M. Schmittfull, and F. Beutler, maras 479, 1021 (2018), arXiv:1708.01297 [astro-ph.CO] .
  * Patej and Eisenstein [2018] A. Patej and D. J. Eisenstein, maras 477, 5090 (2018), arXiv:1709.03514 [astro-ph.CO] .
  * Seo  _et al._ [2022] H.-J. Seo, A. Ota, M. Schmittfull, S. Saito, and F. Beutler, maras 511, 1557 (2022), arXiv:2106.00530 [astro-ph.CO] .
  * Bonoli and Pen [2009] S. Bonoli and U. L. Pen, maras 396, 1610 (2009), arXiv:0810.0273 [astro-ph] .
  * Cai and Bernstein [2012] Y.-C. Cai and G. Bernstein, maras 422, 1045 (2012), arXiv:1112.4478 [astro-ph.CO] .
  * Yang  _et al._ [2015] X. Yang, P. Zhang, J. Zhang, and Y. Yu, maras 447, 345 (2015), arXiv:1309.2474 [astro-ph.CO] .
  * Eriksen and Gaztañaga [2018] M. Eriksen and E. Gaztañaga, maras 480, 5226 (2018), arXiv:1508.00035 [astro-ph.CO] .
  * Zhou  _et al._ [2023] S. Zhou, P. Zhang, and Z. Chen, maras 523, 5789 (2023), arXiv:2304.11540 [astro-ph.CO] .
  * Ma  _et al._ [2023] R. Ma, P. Zhang, Y. Yu, and J. Qin, arXiv e-prints , arXiv:2306.15177 (2023), arXiv:2306.15177 [astro-ph.CO] .
  * Baldauf  _et al._ [2013] T. Baldauf, U. Seljak, R. E. Smith, N. Hamaus, and V. Desjacques, pre 88, 083507 (2013), arXiv:1305.2917 [astro-ph.CO] .
  * Ginzburg  _et al._ [2017] D. Ginzburg, V. Desjacques, and K. C. Chan, pre 96, 083528 (2017), arXiv:1706.08738 [astro-ph.CO] .
  * Liu  _et al._ [2021] Y. Liu, Y. Yu, and B. Li, apps 254, 4 (2021), arXiv:2012.11251 [astro-ph.CO] .
  * Friedrich  _et al._ [2022] O. Friedrich, A. Halder, A. Boyle, C. Uhlemann, D. Britt, S. Codis, D. Gruen, and C. Hahn, maras 510, 5069 (2022), arXiv:2107.02300 [astro-ph.CO] .
  * Gao  _et al._ [2005] L. Gao, V. Springel, and S. D. M. White, maras 363, L66 (2005), arXiv:astro-ph/0506510 [astro-ph] .
  * Gao and White [2007] L. Gao and S. D. M. White, maras 377, L5 (2007), arXiv:astro-ph/0611921 [astro-ph] .
  * Hahn  _et al._ [2007] O. Hahn, C. Porciani, C. M. Carollo, and A. Dekel, maras 375, 489 (2007), arXiv:astro-ph/0610280 [astro-ph] .
  * Skibba and Macciò [2011] R. A. Skibba and A. V. Macciò, maras 416, 2388 (2011), arXiv:1103.1641 [astro-ph.CO] .
  * Chen  _et al._ [2020] Y. Chen, H. J. Mo, C. Li, H. Wang, X. Yang, Y. Zhang, and K. Wang, app 899, 81 (2020), arXiv:2003.05137 [astro-ph.GA] .
  * Borzyszkowski  _et al._ [2017] M. Borzyszkowski, C. Porciani, E. Romano-Díaz, and E. Garaldi, maras 469, 594 (2017), arXiv:1610.04231 [astro-ph.CO] .
  * Ramakrishnan  _et al._ [2019] S. Ramakrishnan, A. Paranjape, O. Hahn, and R. K. Sheth, maras 489, 2977 (2019), arXiv:1903.02007 [astro-ph.CO] .
  * Mansfield and Kravtsov [2020] P. Mansfield and A. V. Kravtsov, maras 493, 4763 (2020), arXiv:1902.00030 [astro-ph.CO] .
  * Note [1] https://netlib.org/lapack.
  * Klypin  _et al._ [2016] A. Klypin, G. Yepes, S. Gottlöber, F. Prada, and S. Heß, maras 457, 4340 (2016), arXiv:1411.4001 [astro-ph.CO] .
  * Behroozi  _et al._ [2013] P. S. Behroozi, R. H. Wechsler, and H.-Y. Wu, app 762, 109 (2013), arXiv:1110.4372 [astro-ph.CO] .
  * Forero-Romero  _et al._ [2009] J. E. Forero-Romero, Y. Hoffman, S. Gottlöber, A. Klypin, and G. Yepes, maras 396, 1815 (2009), arXiv:0809.4135 [astro-ph] .
  * Dawson  _et al._ [2013] K. S. Dawson _et al._ , aj 145, 10 (2013), arXiv:1208.0022 [astro-ph.CO] .
  * Alam  _et al._ [2021] S. Alam _et al._ , pre 103, 083533 (2021), arXiv:2007.08991 [astro-ph.CO] .
  * DESI Collaboration  _et al._ [2016] DESI Collaboration _et al._ , arXiv e-prints , arXiv:1611.00036 (2016), arXiv:1611.00036 [astro-ph.IM] .
  * Jasche and Lavaux [2019] J. Jasche and G. Lavaux, aap 625, A64 (2019), arXiv:1806.11117 [astro-ph.CO] .
  * Wang  _et al._ [2014] H. Wang, H. J. Mo, X. Yang, Y. P. Jing, and W. P. Lin, app 794, 94 (2014), arXiv:1407.3451 [astro-ph.CO] .
  * Schmittfull  _et al._ [2019] M. Schmittfull, M. Simonović, V. Assassi, and M. Zaldarriaga, pre 100, 043514 (2019), arXiv:1811.10640 [astro-ph.CO] .
  * Junzhe Zhou and Dodelson [2023] A. Junzhe Zhou and S. Dodelson, arXiv e-prints , arXiv:2304.01387 (2023), arXiv:2304.01387 [astro-ph.CO] .