On the detectability of the moving lens signal in CMB experiments

Upcoming cosmic microwave background (CMB) experiments are expected to detect new signals probing interaction of CMB photons with intervening large-scale structure. Among these the moving-lens effect, the CMB temperature anisotropy induced by cosmological structures moving transverse to our line of sight, is anticipated to be measured to high significance in the near future. In this paper, we investigate two possible strategies for the detection of this signal: pairwise transverse-velocity estimation and oriented stacking. We expand on previous studies by including in the analysis realistic simulations of competing signals and foregrounds. We confirm that the moving lens effect can be detected at ≥ 10σ level by a combination of CMB-S4 and LSST surveys. We show that the limiting factors in the detection depend on the strategy: for the stacking analysis, correlated extragalactic foregrounds, namely the cosmic infrared background and thermal Sunyaev Zel'dovich effect, play the most important role. The addition of foregrounds make the signal-to-noise ratio be most influenced by large and nearby objects. As for the pairwise detection, halo lensing and pair number counts are the main issues. In light of our findings, we elaborate on possible strategies to improve the analysis approach for the moving lens detection with upcoming experiments. We also deliver to the community all the simulations and tools we developed for this study.


INTRODUCTION
The anisotropies of cosmic microwave background (CMB) provide a wealth of information and has become the backbone of modern cosmological inference.Improvements in the sensitivity of CMB experiments are now opening the window to high-precision measurements of small-scale CMB anisotropies sourced by the interactions of CMB photons with the intervening matter, providing promising new probes of cosmology and astrophysics.These anisotropies include scattering of CMB photons off energetic electrons (Sunyaev Zel'dovich effects) (Zeldovich & Sunyaev 1969;Zel'Dovich 1970;Sunyaev & Zeldovich 1980, 1972;Sazonov & Sunyaev 1999), weak gravitational lensing (see e.g.Lewis & Challinor 2006, for a review) and the integrated Sachs-Wolfe (ISW) effects (Sachs & Wolfe 1967).In this work, we focus on a particular type of ISW: the moving-lens effect (otherwise also known as Birkinshaw-Gull, hereafter ML Birkinshaw & Gull 1983;Gurvits & Mitrofanov 1986).
The ML effect is sourced by the time variation of the gravitational potentials due to peculiar velocities of halos in the direction perpendicular to our line of sight.The expected signal is small compared to other CMB foregrounds (typically of the order of ≃ 0.1 − 0.01µK) and has the same frequency dependence as the primary CMB.However, this is one of the two physical effects that potentially allow us to determine transverse velocities of large-scale structure from CMB (the other being the polarized kinetic Sunyaev-Zel'dovich effect Hotinli et al. 2022a), and it is therefore of great interest to pursue.
Velocity fields are powerful probes of the growth of large-scale structure, and can be related to the underlying matter perturbations on large scales.So far, only the radial velocity field has been inferred from CMB observations by measurements of the kinetic Sunyaev-Zel'dovich (kSZ) effect, which has important cosmological applications (e.g.Münchmeyer et al. 2019;Anil Kumar et al. 2022;Hotinli et al. 2023aHotinli et al. , 2019a)).Specifically, recent CMB experiments allowed the detection of the pairwise radial velocity: a statistic sensitive to the average gravitational attraction of pairs of galaxies at a given comoving distance (Hand et al. 2012;Ade et al. 2016;De Bernardis et al. 2017;Soergel et al. 2 2016).These measurements used a pairwise-velocity estimator based on the observed radial velocity (Ferreira et al. 1999), similar in spirit to the one used in this work (Yasini et al. 2019), which is based on transverse velocities (Hotinli et al. 2019b).
While the kSZ is expected to be measured at very high significance with future CMB surveys (Smith et al. 2018;Cayuso et al. 2023), preliminary studies suggest that transverse velocities will also be detected (e.g.Hotinli et al. 2019b;Yasini et al. 2019;Hotinli et al. 2021), albeit to lower significance.Nevertheless, this supplemental information will indeed improve the determination of the cosmological 3-dimensional velocity field.Furthermore, the ML effect is subject to different systematics than the kSZ.The cosmological information available from the kSZ effect is limited by the degeneracy of this signal with the optical depth of galaxies (see e.g.Smith et al. 2018, for a detailed discussion).While mitigating strategies have been proposed (e.g.Madhavacheril et al. 2019), it is not clear whether they can be readily implemented in the near future.The measurement of the transverse velocities hence have the potential of improving the information content of the reconstructed 3-velocity field, as well as potentially breaking degeneracies suffered by kSZ measurements (see e.g Hotinli et al. 2021).
In this work, we expand on previous studies on the ML detectability (Hotinli et al. 2019b;Yasini et al. 2019;Hotinli et al. 2021) by considering a more realistic setting for the analysis of upcoming surveys like the Simons Observatory (Ade et al. 2019;Lee et al. 2019) and CMB-S4 (Abazajian et al. 2016;Abazajian et al. 2022), together with the Vera Rubin Observatory (LSST) (LSST Science Collaboration et al. 2009) and DESI (DESI Collaboration et al. 2016).
We perform a map-based analysis of the detectability of the ML signal with two different methods: oriented stacking of CMB patches around DM halos and pairwise-velocity reconstruction, discussing the advantages and limitations for each of them, when standard component separation methods are applied to the observed maps.For the first time, we use in our analysis realistic simulations of correlated and non-Gaussian CMB foregrounds, including thermal and kinetic Sunyaev Zel'dovich effects (tSZ and kSZ), the cosmic infrared background (CIB), halo lensing, radio point sources, as well as the ML effect from dark matter (DM) halos of all masses (see Fig. 1 for a display of these effects).As pointed out in Hotinli et al. (2023b), the ML measurement from stacking is challenged by physical effects that are correlated with ML.In general, foregrounds will dictate which halo masses and redshifts are most relevant for the detection, and ultimately what can be measured with each detection strategy.In our analysis, we also investigate the relevance of photo-z errors and uncertainly in the halo mass estimation.
Throughout this paper, we use the flat ΛCDM cosmology, with parameters satisfying (Ω m , Ω b , σ 8 , n s h, τ ) = (0.31, 0.049, 0.81, 0.965, 0.68, 0.055) consistent with Planck 2018 (Aghanim et al. 2020) and the websky simulation (Stein et al. 2020).Unless otherwise stated, we define the halo mass to be M 200c , corresponding to the mass contained within a radius r 200 inside of which the mean interior mass density is 200 times the critical density ρ crit .
This paper is organized as follows.In Sec. 2 we introduce the ML signal.In Sec. 3 we introduce the dark matter halo catalog and the extra-galactic CMB simulations we use in our analysis.Section 4 describes our choices for the experimental specification we consider.In Sec. 5 we analyse the performance of two methods for detecting the ML effect with upcoming CMB and galaxy data.Section 6 is dedicated to our discussion and conclusions.

THE MOVING LENS EFFECT
Gravitational potentials that evolve in time induce a black-body temperature modulation on the CMB known as the integrated Sachs-Wolfe (ISW) effect.The induced temperature anisotropy in a given direction n has the form where Φ is the gravitational potential.Here, Θ( n) = T ( n)/T CMB is the fractional CMB temperature where T CMB is the sky-averaged mean CMB temperature.The ISW effect can be sourced by peculiar transverse velocities of cosmological structure where the effect on the CMB satisfies where ∇ ⊥ is the gradient on the 2-sphere.This signal is referred to as ML effect in cosmology literature due to the analogy with gravitational lensing, since, for the observer on the rest frame of the halo, the effect is equivalent to lensing.
Note that the ISW effect on small scales is also sourced by the non-linear collapse of matter around galaxies and clusters, which induces a radially-symmetric imprint on the CMB around halos, known as the Rees-Sciama (RS) effect.Here, we are interested in measuring the dipolar signature from the moving lens effect aligned with transverse velocities of cosmological structure, and our estimators will be insensitive to the RS effect.Prospects to detect the RS signal has been recently discussed in Ferraro et al. (2022).
The ML effect sourced by the bulk transverse velocity of DM halos, assumed nearly constant within the range where the integrand in Eq. ( 2) in non-vanishing, can be further simplified to take the form where is the lensing deflection vector, ∇ is the three-dimensional angular derivative, satisfying ∇ ⊥ = (1/χ)∇, and Φ h is the gravitational lensing only potential of a halo.The top left two panels in Fig. 1 demonstrate the ML effect in a 2 o × 2 o patch.The right panel includes the signal from the most massive halos.The dipolar ML signature aligned with the bulk velocity can be seen around the central halo in that panel.Furthermore, the ML signal can be seen to extend beyond the virial radius of the halo, which is around 10 arcminutes in angular size here.The left panel corresponds to the total signal from the ML effect including all halos in the webksy simulation in that patch.The otherwise apparent dipolar pattern from the individual high mass halo can be seen to be distorted by the ML signal from other (smaller-mass and higher-redshift) halos.Other panels demonstrate the effect of various CMB foregrounds, which we describe in the next paragraph.Because the ML effect has a black-body frequency dependence, its signature will be imprinted in the CMB map that gets reconstructed from multi-frequency observations.We expect the same map to also contain the other effects which follow a black-body spectrum, namely the kSZ and halo lensing.Moreover, some residual signal from other foregrounds can remain in the CMB reconstructed map.As Fig. 1 shows, the amplitude of the ML signal is very small, and it is subdominant with respect to other competing signals as well as to the residual foregrounds.The ML signal is likely to be detected statistically for an ensemble of objects as opposed to for individual ones.This paper studies in detail the detectability of the ML while considering ensembles of halos, and considering the challenges posed by the other sky signals.

DARK MATTER HALO CATALOG AND EXTRAGALACTIC CMB SIMULATIONS
Throughout this work we use the websky1 DM halo catalog and extragalactic CMB simulations (Stein et al. 2020) which share the same cosmological parameters cited in Sec. 1.The websky DM halo catalog is modelled with ellipsoidal collapse dynamics with the corresponding displacement field is modelled with Lagrangian perturbation theory.The catalog spans a redshift interval 0 < z < 4.6 over the full-sky spanning a volume of ∼ (600Gpc/h)3 and consists of approximately a billion halos of mass satisfying M h > 10 12 M ⊙ .
The halo catalog and the displacement field are also used to generate a range of intensity maps to simulate scattering and lensing effects on the CMB photons.These publicly available maps include the CIB, infrared emission from dusty star forming galaxies; tSZ, inverse Compton scattering of the CMB photons by the energetic free electrons in the intergalactic media; kSZ, Doppler boosting of CMB photons due to Thomson scattering off free electrons; as well as the weak gravitational lensing of the CMB due to intervening large-scale structure.In addition to CIB and tSZ, we use maps of radio point sources based on the websky catalog provided in (Li et al. 2022).We generate halo lensing from the websky catalog using the AstroPaint code2  (Yasini et al. 2020). 3 Fig. 1 shows the overall amplitude and morphological shape of these foregrounds.The typical foregrounds signal is multiple orders of magnitude larger than ML effect.In this work, we will use the standard Internal Linear Combination (ILC) component separation method to perform foreground cleaning and recover the "CMB map", that is the map which contains only the black-body signals.As it is visible in the panel titled 'Freq.foregrounds' of Fig. 1, the residual contribution of foregrounds is still orders of magnitude larger than the ML effect.

63
-333 153 Figure 1.The panels show 2 o × 2 o patches of the ML signal, the CMB, and relevant foregrounds, as computed from the websky simulations in the same area of the sky.The two top-left panels show the ML signal, the two central-left panels show the cluster lensing, while the lower left panels show the kSZ effect.Within these, the left panels show the maps of ∼ 8000 halos of mass M h > 10 12 M⊙ within 0 < z < 4.6; while the right panels include only halos with M h ≳ 10 14 M⊙.All the above-mentioned effects share the same black-body frequency dependence of the primary CMB (which is shown in the bottom right).Other foregrounds have different frequency dependencies.The top-right panels show the CIB and tSZ signals at 150GHz, while the central-right panel show the signal from point sources at the same frequency, appropriate for CMB-S4 and based on the websky catalog, provided in Li et al. (2022).The bottom-right panel shows the ILC reconstructed map for all signals with a black-body frequency spectrum.The panel marked "Freq.foregrounds" show the residual level of foreground signal in the ILC reconstructed map using CMB-S4 level white noise and beam.Note that throughout this study we omit considering the lensing of CMB foregrounds such as CIB and tSZ which might induce further, albeit small, correlations between the LSS and observed CMB maps.
measurement of the ML effect through the methods outlined in this paper also requires a galaxy catalog with galaxy locations.The galaxy survey specifications we consider here are shown in Table 2.We consider the DESI (DESI Collaboration et al. 2016) and LSST (LSST Science Collaboration et al. 2009) as our representative set of galaxy surveys.Specifically, we will combine data from DESI with SO, and from LSST with CMB-S4.
DESI is an ongoing survey that aims to measure over 30 million spectroscopic galaxy and quasar redshifts over 14000 deg 2 .The DESI galaxy catalogue could be separated into the Bright Galaxy Sample (BGS), LRG, emission-line galaxy (ELG) sample and the quasar (QSO) sample.BGS is anticipated to have a number density larger than BOSS for z ≲ 0.4 and the same is anticipated for DESI LRGs over 0.6 ≲ z ≲ 1; the ELG sample over 0.6 ≲ z ≲ 1.6 and the QSO sample over 0.6 ≲ z ≲ 1.8.
Rubin LSST is an ongoing survey that aims to measure up to 2 billion galaxies at the end of its 10 years observation which will cover a sky area around ∼ 20000 deg   For LSST, we approximate the galaxy density of the "gold" sample, with n(z) = n gal (z/z 0 ) 2 exp(−z/z 0 )/2z 0 with n gal = 40 arcmin −2 and z 0 = 0.3 and take the galaxy bias as b g (z) = 0.95(1 + z).
While we have galaxy number count predictions for LSST and DESI, websky is a halo catalog.Large halos may contain more than one galaxy, therefore we cannot apply a one-to-one correspondence between halos and galaxy numbers.We use the Halo occupation distribution model as described in Leauthaud et al. (2011) to decide how many halos should be considered to be detected in DESI and LSST.The resulting number of halos is a bit (around 10 per cent or less) lower than the number of galaxies that result from table.We verified that the details of the strategy for halo occupation model is not relevant for any of the analysis presented in this paper.

DETECTING THE MOVING LENS EFFECT
In this section, we present strategies for the detection of the ML effect.We first apply a component separation method from multi-frequency CMB observations in order to minimize the contamination from frequency-dependent foregrounds.We describe the standard ILC-cleaning method we apply in Appendix 8.1.The ILC-cleaned maps contain all black-body signals including the primary (lensed) CMB, kSZ effect, halo lensing and the ML effect.Although reduced by around an order of magnitude from ILC-cleaning, note that our maps still contain significant residual foregrounds that dominate the CMB on sub-degree scales (see Fig. 1).
Here we study two methods for the detection of the ML effect: pairwise transverse velocity estimation (Sec.5.2.2) and oriented stacking (Sec.5.1.2).While aiming at the same goal and in principle containing equivalent information (in case both methods are performed optimally, see e.g.Smith et al. 2018); in practice the two methods follow different procedures and the results can depend differently on systematic effects, feasibility on the analyses, and survey selections.Our goal is to provide an assessment of each method for detecting the ML effect for a realistic analysis in the presence of all contributions to the reconstructed CMB map.
We discuss to what extent the results depend on the number of objects/pairs considered, their mass and their redshift, and what are the main obstacles for the detection implied by each strategy.We ultimately aim at offering guidelines for the most feasible and best possible data analysis of future experiments, and help improve current strategies for , for one of the two transverse velocity components on 2-sphere x = {ϕ, θ}.The results are qualitatively identical for the two components.Our velocity reconstruction procedure from galaxy number count distribution is described in Sec.5.1.1.Estimated velocities corresponding to a LSST-like survey are shown.We find for both DESI-and LSST-like surveys similar Pearson correlation coefficients 4 of around ∼ 70 percent for transverse velocity reconstruction (around ∼ 65 percent for radial velocity reconstruction).We also find that the velocities are over estimated for large values.
detecting and utilizing the ML signal.While the two methods follow different procedures, they use the same set of simulations, as described above.

Detection via oriented stacking
One of the promising ways for the first detection of the ML effect is by stacking patches of CMB maps at the locations of DM halos, after orienting each patch along the direction of the local bulk transverse velocity.While the ML signal is typically small to be observed per halo basis, oriented-stacking many CMB patches increases the prospect of detecting this signal.The procedure involves estimating the bulk transverse-velocity field through a linear reconstruction from a galaxy survey, briefly described in Sec.5.1.1,followed with oriented stacking using these estimates, described in Sec.5.1.2.We demonstrate the disparaging effects of different contributions to CMB on the ML detection in Sec.5.1.3.

Transverse velocity reconstruction from galaxy surveys
On linear scales, large-scale structure density and velocity fluctuations related by the continuity relation where a is the scale factor, H is the Hubble parameter and f = d ln D(a)/d ln a is the cosmological growth rate, v( n) is the bulk 3D velocity at the line-of-sight direction n and δ( n) is the density fluctuations.Also on these scales, fluctuations of galaxy number counts trace the density fluctuations, satisfying δ g ( n) ≃ b g δ( n), and as a result, bulk transverse velocity field could be estimated from a linear reconstruction from the galaxy density field.
In order to estimate the galaxy velocities, we first place our galaxy catalogs on a 3D grid in real space, which yields an estimate of the 3D galaxy density field.This field can then be converted to velocities using the continuity equation in Eq. ( 4).The second term in the left-hand side of Eq. ( 4) takes into account the linear redshift-space distortion (Kaiser effect) that affects the radial velocity component.The velocity reconstruction is hence not perfect due to redshift distortions, as well as finite number count of galaxies (i.e.shot noise), non-linearity of the galaxy over-density and the finite volume observed.We find our reconstructed velocities to be ∼ 65 − 70 percent correlated with the true halo velocities for LSST-and DESI-like galaxy survey specifications; 4 in agreement with the fidelity of the velocity reconstruction achieved in earlier studies (e.g.Schaan et al. 2016).We show a comparison between reconstructed halo velocities from a LSST-like survey specifications and true halo velocities from websky simulation in Fig. 3. 4 Here, we use the Pearson correlation coefficient defined as (5) where i runs over halos, x ∈ {θ, ϕ}, and vest x,i (v true x,i ) correspond to estimated (true) velocities.The moving lens is apparent from the second stack although halo lensing contributes a significant gradient largely obscuring the dipolar ML signature.The middle panel shows the halo lensing signal in isolation (note that here, the direction of the gradient is accidental and not correlated with the velocity).The right two panels correspond to the contribution of CIB and tSZ effects to the ILC-cleaned CMB maps we describe in Sec.5.1.3,which are still orders of magnitude large than the ML signal.The contour lines on this panels correspond to pixels corresponding to 50 and 15 percent of the central pixel value, demonstrating the anisotropic profile of the residual foregrounds aligned with the transverse velocity on the stacked patches.

Oriented stacking
We stack grids of CMB patches around the line-of-sight direction of halos in the halo catalog after rotating them to align the estimated velocities.We map the aligned patches onto a N p × N p grid of pixels whose centers evenly cover the range [−λr/r s , , +λr/r s ] in two orthogonal directions on the 2-sphere.Our algorithm is described in Appendix 8.3.Once rotated with Eq. ( 27), we stack each of these N p × N p pixels individually over the catalog.We choose N p = 21 and λ = 2.5 unless otherwise stated, which sufficiently captures the characteristic profile of the ML signal as can be seen from the leftmost panel in Fig. 4, for example.We avoid patches larger than than λ ∼ 2.5, for which we have found the contribution to the stacked profiles remain dominated by foregrounds (Hotinli et al. 2023b).

Foreground biases
Figs. 4-7 demonstrate the results from our stacking analysis.We find that foregrounds such as halo lensing, tSZ and CIB, introduce significant gradients on the stacked patches aligned with the transverse velocity direction.The three panels from right in Fig. 4 show contributions to stacks from halo lensing, CIB and tSZ respectively.The CIB and tSZ contributions are calculated by taking the difference between ILC-cleaned CMB maps including all foregrounds, and similarly-ILC-cleaned CMB maps however omitting either CIB or tSZ foregrounds, respectively.We generate the map of halo lensing by painting the lensing signal from each halo using AstroPaint.We define the halo lensing signal as Θ , where χ * is the comoving distance to recombination surface and T u ( n) is the unlensed CMB temperature from websky.We find halo lensing corresponds to the dominant contribution from black-body CMB, leading to an overall factor ∼ 2 larger gradient compared to ML signal.The residual contributions to the stacks from CIB and tSZ effects after ILC-cleaning also lead to contributions that are multiple orders of magnitude larger than the ML and halo lensing, with a similar gradient that is a factor ∼ 5 larger than ML signature.
The significance of these contributions (or biases) we note here (and also in Hotinli et al. 2023b) suggest that the foreground contributions to the CMB needs to be mitigated more effectively (for example by removing the frequency dependent CIB and tSZ foregrounds with a more effective cleaning method) or be modelled, where model parameters must be marginalized.In the following section we demonstrate the prospects of detecting the ML effect if the latter is achieved.We leave studying the improvements of more advanced ILC-cleaning methods such as discussed in (e.g.McCarthy & Hill 2023a,b;Delabrouille et al. 2009;Chen & Wright 2009;Remazeilles et al. 2011) to upcoming work, although see Appendix 8.2 for a preliminary analysis.That brings a marginal (10%) improvement to these results.

Forecasts and bias modelling
In this section, we use the simulated ILC-cleaned CMB maps to assess the prospects of detecting the ML signal in the presence of detrimental contributions to stacks from foregrounds shown above.We adopt an analytical approach to investigate which foreground or competing signal has the largest impact on the detection.We find CIB and tSZ foregrounds correspond to the dominant contribution to reducing the prospects of an unambiguous detection of the ML signal.
The signal we consider, ∆S, corresponds to the difference between patches produced by orienting the stacks of ILCcleaned CMB maps based on the estimated transverse velocities, and patches produced by stacking the same images with random orientation.In order to assess the contribution from ML signal, primary CMB and different foregrounds to this statistic, we approximate ∆S as: where ∆ S is a template we construct from summing the contributions from different components to ∆S.Here π = {A ML , A lCMB , A kSZ , A HL , A CIB , A tSZ } is a set of parameters that correspond to amplitudes of various contributions to ∆S which we calculate from the websky simulations.These are the ML effect, lensed primary CMB, kSZ effect, halo lensing, CIB, and tSZ effect, respectively.For components other than ML, we calculate these contributions by taking the difference between the total stack ∆S obtained from ILC-cleaned CMB maps, and ones that follow the same procedure except exclude each component, as described in Sec.5.1.3CIB and tSZ.While ∆ S is not strictly equal to ∆S, since the performance of ILC-cleaning depends on the combination of all foregrounds in the observed map, this procedure allows us to produce a tentative template for each contribution and assess the degeneracy between different components and the ML signal via a Fisher matrix analysis, which we describe below.We find experimental noise and point sources mainly contribute as sources of noise, hence do not bias the ML detection.
We calculate the noise for each pixel via the 'delete-d' jack-knife method (Escoffier et al. 2016) which we perform by rerunning our analysis a second time after calculating each stack, this time recording the difference between each pixel of the patches and the total stack, in quadrature.We quote the mean of this difference as our pixel variance.The pixel variance is shown in Fig. 5 for a range of CMB and LSS experiments.As evident from this figure, we find halo number counts play a crucial role in improving the pixel variance for the stacking analysis, especially when going from DESI-like halo number counts to those expected from LSST.
We define the signal-to-noise (SNR) for detecting the ML signal as the error on the amplitude A ML , after marginalizing over the remaining amplitudes.To this aim, we define an ensemble-information matrix as where signal and noise vectors satisfy and the noise vector N corresponds to the errors on each pixel of the ILC-cleaned CMB patches including all foregrounds (after removing randomly oriented patches).The subscript indices span the N p × N p grid points of the rotated CMB patches we described earlier, and we take N p = 21.Here π array consists of the set of parameters, as defined above.Fig. 6 demonstrates the anticipated SNR of the detection of the ML effect (i.e.defined as the SNR on the A ML parameter).The x-axes on these plots correspond to enforced priors on the amplitudes of the remaining CMB foregrounds.The degrading effect of the degeneracies between the ML signature and the other CMB foregrounds can be seen from the right end of each panel.In the absence of prior knowledge of the anticipated biases, the SNR of detecting the ML effect is small (≃ 3).It is therefore mandatory to find a better cleaning method to be able to use the stacking analysis to recover peculiar velocities.What will a better method need to address?Fig. 6 shows that the main limiting factor in the oriented stacking analysis is the residual CIB, followed by the tSZ, since these signals have the same directionality than the moving lens (though for different physical reasons) as shown with the rightmost two panels in Fig. 5.1.3.The use of the reconstructed velocity instead of the true halo velocity reduces the maximum attainable S/N from 20 to 15, and the uncertainty on mass estimate and redshifts further reduces the maximum SNR to ∼ 10.Indeed, better strategies for velocity reconstruction are already available (e.g.Hadzhiyska et al. 2023;Guachalla et al. 2023, and references therein) including via non-linear methods and efforts to improve mass reconstruction are already ongoing (e.g.Bayer et al. 2023).
From our maps, we can also assess which types of objects mainly impact the SNR.Indeed, larger objects at low redshifts produce the largest moving lens signal.However, there are fewer of them, and they also have larger foreground The RMS is dominantly sourced by the lensed primary CMB and vary below the order of perfect of the mean throughout the pixels in the grids.The RMS values can be seen to be lower than the ML signal amplitude (here parametrised by the maximum value of the ML profile in µK with the purple dashed line) for all experiments we consider.
Figure 6.The anticipated signal-to-noise ratio (SNR) for the detection of the ML effect (which we define as the SNR on the AML parameter defined in the text), for CMB-S4 and LSST.The x-axes on these plots correspond to priors on the amplitudes of most significant CMB foregrounds: {ACIB, AtSZ, AHL}, for CIB, tSZ and halo lensing, respectively.The degrading effect of the degeneracy between the ML signature and the other CMB signals can be seen from the right end of each panel: in the absence of prior knowledge of the anticipated biases, the SNR of detecting the ML effect is small.The black curves correspond to assuming priors on all of the other CMB signals or foregrounds defined in Eq. ( 6), and the SNR can be seen to improve as stronger priors are set.The green and orange curves correspond to assuming priors on the tSZ and CIB biases alone, which can be seen as the dominant contributions to the reducing the ML detection.The blue curves are from assuming (equal percent) priors on both CIB and tSZ biases.The red curve corresponds to similarly assuming priors on {ACIB, AtSZ, AHL}.We omit showing results for kSZ, lensed primary CMB and halo lensing alone, as these are within few percents of the gray curves, which assume no priors.
signals.So we analyzed which objects contribute the most, given the current strategy for map cleaning.Results are shown in Fig. 7.
The contribution to the total SNR can be shown to shift towards lower-redshift and higher-mass halos with the inclusion of other CMB foregrounds.The effect is most pronounced from adding the tSZ signal.Our analysis so far suggests the bulk of the SNR will be provided from M h ≳ 3×10 13 M ⊙ halos due to detrimental effects from foregrounds, with lower redshift objects being increasingly important.Considerations of potential survey strategies and alternative foreground cleaning methods can change these results.We will explore such possibilities in future works.

Detecting the pairwise velocity
Next, we consider pairwise transverse-velocity detection from the ML effect.As discussed above, the method of pairwise-velocity detection has been valuable for the detection of kSZ effect in the past years (see e.g.Hall & Challinor 2014;Schaan et al. 2017).One of the benefits of pairwise-velocity detection is that the method does not rely on the estimation of the halo bulk velocities from a galaxy survey.Since due to gravity any two halos are more likely to be moving towards each other, this method naturally allows reconstructing the non-zero mean pairwise velocity signal from pairs of halos at O(10 − 100) Mpc distances, given sufficient statistical power.By virtue of the fact that the relevant peculiar velocity here is not the total peculiar velocity but rather the projection of it in the direction of the vector connecting the pair, we expect the CIB and tSZ bias to be reduced or eliminated.In what follows, we test our speculation and assess the expected SNR for the detection.
In order to measure the pairwise velocities for a given combination of CMB experiment and galaxy catalog, we adopt the estimator presented in (Yasini et al. 2019).We first estimate the halos' individual peculiar transverse velocities from the same CMB maps we use for the stacking analysis.In Sec.5.2.1 we describe how we recover individual transverse velocities from CMB patches.In Sec.5.2.2 we then use these individually-determined velocities to infer the estimated pairwise transverse-velocity signal.We present our results for different experimental configurations, halo mass and redshift cuts in Sec.5.2.3.Note that similar to oriented stacking, pairwise velocity estimation is also computationally challenging due to large, ∼ O(10 8 ), number of halo pairs needed for the analysis to be representative of CMB-S4 and LSST, for example.We have made our parallelized and efficient code available at selimhotinli/moving lens.

Detecting individual velocities
Here we apply a matched filter to patches of CMB to estimate transverse velocity components v ϕ,i ( n) and v θ,i ( n).The matched filter we use is a simple modification of the one presented in Hotinli et al. (2019a), and has the Fourierspace form (and similarly for φ).Here, the 'obt' superscript indicates the obtained CMB variance including residual foregrounds and noise after ILC cleaning, and is the normalisation of the filter.The velocity estimator can then be calculated as done in Hotinli et al. (2019a), and takes the form  , respectively.The blue data points on the left and right panels correspond to results from pairwise-velocity estimation using our baseline ILC-cleaned CMB which includes all foregrounds, with white noise matching that of CMB-S4.The orange data points on the same panels correspond to an identical analysis except omitting the contribution to the observed CMB maps from cluster lensing.The left (right) panels correspond to applying a halo mass cut of M h > 5 × 10 13 M⊙ (M h > 1 × 10 14 M⊙).The purple and pink data points on the middle panels correspond to contributions to the pairwise-velocity signal from frequency-dependent CIB and tSZ foregrounds, respectively, for M h > 5 × 10 13 M⊙.We calculate these purple and pink data points by performing ILC-cleaning with identical foregrounds except omitting CIB and tSZ, respectively, and subtracting these maps from our baseline ILC-cleaned maps, which include all foregrounds.The remaining maps leading to purple and pink data points capture the contribution to the baseline ILC-cleaned maps from CIB and tSZ foregrounds in isolation, respectively.We calculate the error bars with the jackknife method, as described in the text.The total number count of halos satisfy the corresponding mass cuts, as well as the sky fraction, which match the anticipated values from joint analysis of CMB-S4 and LSST surveys.For M h > 5 × 10 13 M⊙, we find the total detection signal-to-noise (S/N ) of the pairwise velocity to be 9.4 (14.1) for our baseline (unlensed) results, which we detail in Table 3.For M h > 1 × 10 14 M⊙, we find corresponding S/N satisfy 6.3 (7.9), for baseline (unlensed), which we show in Table 4.
in flat-sky coordinates x, where Θθ (x) is the obtained CMB patch filtered to satisfy in Fourier space.The estimator for vϕ,i (x) can be obtained similarly by trading φ with θ in the above expressions.
Here, we apply our matched filter to patches of CMB centered at websky halo centers and obtain estimations for the two velocities vϕ,i and vθ,i .Next, we apply our pairwise-velocity estimator to pairs of halos to measure the velocity signal.

Estimating the pairwise velocities
Following Yasini et al. (2019), the mean pairwise velocity between all pairs {i, j} at distance r from each other can be defined as where v ij = v i − v j is the relative 3-dimensional velocity between two halos and r ij = r rij = r j − r i is the distance between a pair of halos at locations r i and r j .The estimator for v ⟨ij⟩ can be found to satisfy where ti = ri × (ṽ i × ri ) and tj = rj × (ṽ j × rj ) are transverse velocities and Here, we have used tilde on estimated observables.We use Eq. ( 13) with the estimated individual velocities as described in Sec.5.2.1.We calculate the covariance of estimated velocities ṽ⟨ij⟩ via the 'delete-d' jacknife method (Escoffier et al. 2016).We divide our full sample of velocities into a 100 sub-samples.We select one of these sub-samples and delete it from our full sample.We calculate mean pairwise velocity given redshift bin for the 99 out of 100 sub-samples.We repeat this process for each of the 100 sub-samples and calculate the resulting variance.Next, we assess the fidelity of the pairwise transfer-velocity measurement for a range halo masses, redshifts and experimental considerations.

Forecasts
Fig. 8 corresponds to our forecasts for an analysis of CMB-S4-like survey joint with a LSS survey matching specifications of LSST.The blue data points throughout correspond to our baseline choice of CMB maps following standard ILC-cleaning taking into account frequency dependent CIB and tSZ foregrounds, white noise matching CMB-S4, point sources, and frequency-independent effects including halo lensing, kSZ, in addition to primary (lensed) CMB, as we have done for oriented stacking analysis above.The orange data points in both figures correspond to following up an identical analysis, however not taking into account the halo lensing foreground.
The panels on the middle column in Fig. 8 show the contributions to the measured pairwise velocities from CIB or tSZ foregrounds after ILC cleaning, which we calculate by repeating our baseline analysis while omitting CIB or tSZ foreground entirely; and subtracting the resulting velocity estimates from our baseline velocity estimates, shown with purple and pink data points.For the mass and redshift ranges we consider, we find CIB and tSZ foregrounds do not induce a significant bias to the transverse-velocity reconstruction, however they provide a significant contribution to the estimator variance.
In order to assess the detection significance of pairwise velocities we define a chi-square statistic as where ṽ⟨ij⟩ is the estimated pairwise transverse velocity (for a given R bin), v model ⟨ij⟩ is the model prediction of the signal and C is the covariance of the estimated pairwise velocity signal, calculated using 'd-delete' jack-knife method detailed in Sec.5.2.2.In our analysis we calculate three chi-square statistic setting v model ⟨ij⟩ one of (v bf ⟨ij⟩ , 0, ṽnoML ⟨ij⟩ ).Here v bf ⟨ij⟩ corresponds to our 'best fit' simulation prediction of the true pairwise transverse-velocity signal from repeating our analyses including only the ML signal, and '0' represents the true null condition in the absence of any pairwise-velocity signal.The term ṽnoML ⟨ij⟩ corresponds to the estimated pairwise velocities in the absence of ML effect.Note that Eq. 14 includes the bin-to-bin correlation errors that are not displayed in Fig. 8.
We define the detection SNR as where we set v model ⟨ij⟩ = 0 (= v bf ⟨ij⟩ ) when calculating χ 2 null (χ 2 bf ).This statistic assesses whether the estimated pairwise velocities can be better modelled by the true pairwise-velocity signal rather than zero velocity.Since our results depend Table 3. Signal-to-noise (SNR) of pairwise transverse velocity measurements from a joint analysis of CMB and galaxy surveys matching anticipated specifications of CMB-S4 and LSST for halos satisfying M h > 5 × 10 13 M⊙.The first row corresponds to our baseline consideration, following standard ILC-cleaning including all foregrounds and CMB-S4-like survey specifications.
The second row corresponds to unlensed corresponds to omitting the cluster-lensing contribution to the CMB maps, otherwise identical to baseline.Rows correspond to the same-colored data points on the left panels Fig. 8.The signal-to-noise for a given range of radial distance bins satisfy SNR= ∆χ 2 = χ 2 null − χ 2 bf where we set v model ⟨ij⟩ = 0 (= v bf ⟨ij⟩ ) when calculating χ 2 null (χ 2 bf ).Here ṽ⟨ij⟩ is the measured pairwise velocity at the and v bf ⟨ij⟩ is the (best-fit) true pairwise-velocity signal calculated from simulations including only the ML effect.Defined this way, the SNR corresponds to chi-square significance of observations being better explained by the true pairwise-velocity signal as opposed to zero signal.Columns correspond to the three redshift bins we consider, matching the rows of Fig. 8.The first two of three sub-columns for each redshift correspond to taking only the data points with comoving distance between pairs satisfying R < 150Mpc and R > 150Mpc, respectively.The third sub-column of each 3-column corresponds to taking all data points.We only show SNR results if the ∆χ 2 noML = χ 2 null − χ 2 noML is negative, where we set ṽmodel ⟨ij⟩ equal to ṽnoML ⟨ij⟩ when defining χ 2 noML = ṽnoML ij , and ṽnoML ⟨ij⟩ is the estimated pairwise transfer velocity in the absence of ML effect.The positivity of ∆χ 2 noML indices a non-zero significance of false detection of pairwise transfer velocity 'signal' in the absence of ML effect, i.e. detection of a bias.

SNR
z significantly on the foregrounds, we also define a separate statistic, where we set ṽmodel ⟨ij⟩ equal to ṽnoML ⟨ij⟩ .For cases ∆χ 2 noML > 0, this may indicate significant contribution to pairwisevelocity estimates from residual foregrounds other than the ML effect; which can in principle be a better fit to the data than the null condition.Particularly in case (SNR) 2 ∼ ∆χ 2 noML (or < ∆χ 2 noML ), the residual foreground contribution to the pairwise-velocity estimate is a similarly good (or better) fit to data than the underlying pairwise-velocity signal.In what follows we omit assigning SNR to data in case ṽmodel ⟨ij⟩ to avoid interpreting velocity estimate residuals (or biases) as signal.
Our signal-to-noise (SNR) results for a CMB-S4 and LSST-like joint analysis are shown in Tables 3 and 4 for halo mass cuts M h > 5 × 10 13 M ⊙ and > 10 14 M ⊙ respectively.For both cases we find the halo lensing to be a significant source of confusion and a potential bias to the pairwise velocity estimates from the ML effect.Furthermore, as can also be seen from Fig. 8, we find the advert effect of halo lensing becomes more pronounced with increasing redshifts, as our baseline results deviate from the transverse-velocity signal (black solid lines) more significantly for lower panels.Removing halo lensing from CMB maps, however, leads to a significant improvement for velocity estimates as can be seen form the data points labelled unlensed.As a result, we find for our baseline assumptions, data points from pairs with higher comoving distance separations give ∆χ 2 noML > 0, which we exclude from our total signal-to-noise results.Tables 3 and 4 consist of three wide columns corresponding to our redshift ranges, with another three sub-columns for each, corresponding taking data points on smaller comoving separations R < 150Mpc, larger (150Mpc < R < 200Mpc) and total (R < 200Mpc, labelled 'All') comoving distance separations.Empty (labelled '-') entries correspond to ∆χ 2 noML > 0. For baseline M h > 5 × 10 13 M ⊙ , we find SNR ≃ 5 from z ∈ [0.1, 0.5], ≃ 7 from z ∈ [0.5, 1.0] and ≃ 3 from z ∈ [1.0, 2.0].In case the cluster lensing could be mitigated, we find for unlensed M h > 5 × 10 13 M ⊙ , SNR ≃ 10 from z ∈ [0.1, 0.5], ≃ 9 from z ∈ [0.5, 1, 0] and ∼ 4 from z ∈ [1.0, 2, 0].The total SNR is around 9 (14) for baseline (unlensed).For a higher halo mass cut satisfying M h > 10 14 M ⊙ , we find it will be difficult to unambiguously detect the transverse velocity signal unless lensing could be mitigated.For the baseline results, we find SNR ≃ 5 (4) for the lowest and middle redshift bins with a total SNR ≃ 6.For the unlensed results, we find SNR ≃ 6 from z ∈ [0.1, 0.5], ≃ 6 from z ∈ [0.5, 1, 0] and < 1 from z ∈ [1.0, 2, 0] with total SNR ≃ 8.
Figure 8 also demonstrates the contributions of CIB and tSZ effects on the pairwise transfer-velocity signal on the middle panels of each row, with data in purple and pink color, respectively.We calculate these contributions by repeating our baseline analysis while omitting either CIB or tSZ foregrounds completely, and subtracting the results from the baseline results.This way we isolate and remove the net contribution from these frequency-dependent foregrounds while considering the ILC-cleaning procedure.For the halo masses and redshifts we consider in this analysis, we find CIB and tSZ foregrounds do not introduce significant biases (unlike what happened with that stacking analysis).Note however that in the stacking analysis we include halos of all redshifts and masses satisfying M h ≳ 10 12 .As shown in Hotinli et al. (2023b), halos with lower masses and at higher redshifts lead to a more significant bias which considered a wider range of masses and redshifts, and observed the CIB and tSZ foregrounds can potentially introduce a significant bias for lower mass halos (and in case of CIB, at higher redshifts).Nevertheless we find CIB and tSZ foregrounds contribute as significant confusion factors boosting the covariance, as can be seen from comparing the error bars on the left and middle panels of Fig. 8.
We consider combination of CMB and LSS surveys matching SO and DESI specifications in Fig. 9.As the number of pairs scale like halo-number squared, around an order-of-magnitude lower number of halos for SO×DESI compared to CMB-S4×LSST, lead to ∼ 1M halo pairs for the pairwise transfer-velocity estimation.As a result we find the detection SNR such a combination of surveys is less than one for all mass and redshift ranges we consider, even in the absence of halo lensing.The dominant factor that contributes to the reduced detection significance is the halo number counts.We demonstrate this in Fig. 9 for a range of galaxy number densities and a mass cut of M h < 5 × 10 13 .The top (bottom) rows of panels correspond to experimental specifications matching combination of DESI and SO (LSST and CMB-S4).The middle three panels we take a survey area matching LSST and CMB-S4, and vary the galaxy number count by a factor 1/2.The corresponding number of galaxy pairs satisfying R < 200Mpc is ∼ 18M.For our baseline analysis we find SNR > 1 only on lowest panel while for unlensed we find surveys with galaxy number density only within a factor ≳ 0.2 of LSST×CMB-S4 can potentially reach SNR > 1.
Last, we find our results are not sensitive to halo mass and photo-z redshift errors considered in our matched filter defined in Sec.5.2.1, latter set equal to anticipated σ z = 0.03(1 + z) error from LSST, and we set the mass errors to 40 percent as anticipated by galaxy-galaxy-lensing cross correlation and SZ measurements (e.g.Murata et al. 2018;Palmese et al. 2020;Ballardini et al. 2019).Our results are shown in Fig. 10 for a range of mass and redshift error combinations.We find the SNR to be nearly identical between different considerations of error.

DISCUSSION AND CONCLUSIONS
Our analysis in Sec. 5 suggests Stage-4 CMB and LSS experiments will have the ability to detect the ML effect to high significance, in agreement with previous works (e.g.Hotinli et al. 2019b;Yasini et al. 2019;Hotinli et al. 2021;Hotinli et al. 2021).Here we included in the analysis for the first time simulations of extra-galactic foregrounds that are non-Gaussian and correlated with LSS, and found that they may be a significant limitation to an unambiguous detection of ML.
The oriented stacking analysis showed that some foregrounds contribute a significant gradient to the final stacks, an effect we first described in Hotinli et al. (2023b), due to average motion of halos towards higher density regions in their LSS environment.As a result, CMB patches oriented along the transverse velocity of halos show an enhanced signal of CIB and tSZ foregrounds towards the velocity direction, leading to an aligned density gradient, in part mimicking the ML signal and biasing the results.It could be possible, however, to mitigate this bias by applying mass and redshift cuts to the oriented stacking analysis.As shown in Hotinli et al. (2023b), such correlations between transverse velocities and matter gradient are more enhanced for lower masses in general, and according to whether it is tSZ or CIB, it affects low or intermediate redshifts, respectively.In an upcoming work we will further explore how applying high halo-mass cuts impact the contribution from these foregrounds to stacks, and what is the trade-off in terms of SNR between removing the most problematic objects and reducing the number of halos in the oriented-stacking analysis.
Our results from the pairwise transverse-velocity estimation also demonstrate the significant impact of halo lensing on the ML detection, which we find to be the main limiting factor.The estimated pairwise-velocity signals shown in Figs. 8 and 9 show how halo lensing boosts the error on the data points and derive measurements away from the predicted ML signal.A similar contribution is also apparent in oriented stacking, as the halo lensing leads to The top panels correspond to a joint analysis of a DESI and SO like experiment.The following row of panels correspond to a joint analysis of CMB-S4 and LSST, with the exception that we reduce the galaxy density of LSST survey by a factor of 2. The lowest panels correspond to velocity estimates for our baseline choice (along with unlensed, CIB and tSZ), identical to results the top row of panels in Fig. 8.We find the fidelity of the pairwise velocity measurement is significantly sensitive to the galaxy number count. Figure 10.The effect of halo mass and redshift errors on the measurement fidelity of the pairwise velocities for a combination of surveys matching LSST and CMB-S4 specifications.We compare perfect knowledge of halo redshifts and halo mass in our filters with 40 percent mass errors and the standard σz = 0.03(1 + z) photo-z error anticipated by the LSST survey.We find for these experimental specifications, the pairwise velocity estimation is insensitive to errors on halo mass and redshift in our filters.We discuss these result in Sec.5.2.3.
a significant gradient on the final stacks, dominating the contribution from black-body CMB, which can be seen in Fig. 4. Note however that the contribution from halo lensing could in principle be mitigated by CMB delensing, the procedure of reversing the effects on lensing on the CMB, which has a variety of benefits for cosmological inference (see e. g.Hotinli et al. 2022b;Coulton et al. 2020).The coherence of unlensed CMB gradient at small scales makes the measurement of small-scale CMB lensing due to halos feasible (see e.g.Schaan & Ferraro 2019;Horowitz et al. 2019).
The methods developed for lensing reconstruction can in principle be applied for delensing.It is highly plausible that the adverse effect of halo lensing to ML detection can be mitigated effectively in the following years, and our analysis motivates further study on the prospects of delensing the small-scale CMB temperature maps.Note also that the tSZ and CIB bias we find in the stacking analysis is not apparent in our pairwise-transverse velocity estimation, due to pairwise velocity estimation reducing the relevance of individual halo velocity direction.
In this paper we have only considered standard harmonic ILC cleaning method-which has been used for decades-to mitigate the contribution to CMB from frequency-dependent foregrounds (Tegmark et al. 2003).While standard ILC is the simplest method to reduce foregrounds, it is not always the most powerful one for the analysis of small-scale signatures.Recent years have seen an influx of more advanced methods such as the needled (wavelet) ILC (Delabrouille et al. 2009), an implementation of ILC that works in the needlet (wavelet) domain.In this method, the input maps are decomposed into 'needlets' at different angular scales and the ILC solution for the CMB is produced by minimizing the variance at each scale.This allows the procedure to depend on sky location and in principle be optimized against small-scale LSS sources, potentially improving the prospects of ML detection.
Another method for improving the measurement of black-body CMB signals is de-projection of frequency-dependent foregrounds such as the CIB from maps of observed CMB.We describe this method briefly in Appendix 8.2 and perform a preliminary application to our analysis.We find the improvement to the SNR from oriented stacking to be less than 10 percent.In what follows we will perform a more in-depth analysis to assess the prospects constrained ILC method by better modelling of the CIB foreground.
Throughout our analysis we have implemented a matched filter based on the ensemble-averaged total CMB variance to minimize the contribution of foregrounds and primary (lensed) CMB to our stacks and pairwise velocity estimators.While proven optimal for previous spectra-level forecasts based on Gaussian approximation of foregrounds (see e.g.Hotinli et al. 2021), it is conceivable that our filters can be significantly improved in multitude of ways, taking into account halo-specific foreground profiles.First, as the halo-induced non-Gaussian foregrounds dominate the contributions to the oriented stacks, we could in principle use filters that aim to minimize the contribution from foregrounds in a way depending on the spatial profile of the foreground, the halo mass and redshift; rather than weighting-down profiles against ensemble-average foreground variance.Note, however, that the dominant source of confusion for our stacking analysis is the matter-gradients correlated with transverse velocities; the profile of the contributions depend on the overall density gradient of the halo environment, in addition to halo mass and redshift.As a results, the optimal filters that would mitigate such contributions should take into account the full contribution to the stacks as discussed in (Hotinli et al. 2023b), which could be difficult to model.Furthermore, in our pairwise transverse velocity analysis, we have chosen to individually filter the pairs of CMB patches to detect individual halo velocities and then combine these to compute the pairwise velocities.In principle one can develop filters optimized for the extraction of pairwise velocities directly from the CMB map.We leave a detailed study on developing more optimal filtering techniques for the purpose of ML detection to an upcoming work.
Note we have omitted forecasting for planned Stage-5 surveys such as CMB-HD (Aiola et al. 2022;Sehgal et al. 2020Sehgal et al. , 2019)), a futuristic follow-up of CMB-S4 with CMB white noise RMS anticipated to reach ∆ T ≃ 0.2µK ′ and beam ∼ 15 ′′ , or MegaMapper (Schlegel et al. 2019), the spectroscopic follow-up of LSST.Such surveys will have access to smaller scales compared to what we model here, and a forecast that would be representative of the precision of these surveys require improved simulations with higher-resolution maps, which are currently not widely available.
Overall our analysis shows that upcoming Stage-4 surveys like CMB-S4 and LSST can detect the ML signal within 10−20σ significance, while the prospects of detection for ongoing Stage-3 surveys such as DESI and SO are likely less optimistic due to lower number of halos.In order to maximize the detection prospects with oriented stacking, the CIB and tSZ foregrounds will need to be mitigated more effectively as compared to standard ILC-cleaning, or modelled, and model parameters marginalized with informed priors.Halo lensing likely will adversely impact the detection prospects in case not accounted for, in particular for the pairwise-velocity estimation.We find large halo masses M h > 5×10 13 M ⊙ at lower redshifts z ≲ 1 will likely provide the bulk of the detection SNR.Although potentially difficult, we nevertheless anticipate the exciting prospect of detecting ML effect in the near future warranting continuation of dedicated work to overcome the challenges we highlighted here.
Computing (CARC) at the University of Southern California for providing computing resources that have contributed to the research results reported within this publication.This work was also carried out at the Advanced Research Computing at Hopkins (ARCH) core facility (rockfish.jhu.edu), which is supported by the National Science Foundation (NSF) grant number OAC1920103.SCH was in part supported by the Horizon Fellowship from Johns Hopkins University.This research used resources of the National Energy Research Scientific Computing Center (NERSC), a U.S. Department of Energy Office of Science User Facility located at Lawrence Berkeley National Laboratory, operated under Contract No. DE-AC02-05CH11231 using NERSC award HEP-ERCAPmp107.This research was supported in part by grant NSF PHY-1748958 to the Kavli Institute for Theoretical Physics (KITP).The distinct frequency dependence of black-body signals such as CIB, tSZ and point sources allows separating these foregrounds from black-body signals such as primary CMB and the ML effect.Component separation strategies aim at reconstructing the best possible map that primarily contain black-body signals.The most common "component separation" strategy is an internal linear combination (ILC) method which aims at reconstructing the minimum variance CMB map.In this work we use a standard harmonic-space ILC procedure as prescribed in (Tegmark et al. 2003), which we detail below.We describe the experimental specifications we use for the CMB instrumental noise in Table 1.
We write the covariance between the de-beamed CMB at different frequencies as a matrix where C T T ℓ contains the black-body component of the CMB (primary lensed CMB, kSZ and the ML effects), e = {1, 1, 1 . ..},C XG ℓ contains the correlated CIB, tSZ and radio point sources, and (B −1 N ) ℓ is the de-beamed instrumental noise covariance (which we assume diagonal).The blackbody component after the ILC procedure satisfy where the weights that minimize the variance of the multipole moments Θℓm are given by

CIB de-projection
One method to improve the measurements of the black-body CMB signals is the deprojection of various frequencydependent foregrounds such as CIB to minimize their contamination, also known as 'constrained ILC' (see for a recent application, for example McCarthy & Hill 2023a).Since CIB contribute significantly to the oriented stacking analysis, constrained ILC can be a valuable method to enhance detection prospects of ML effect in the future.Note however that these methods require knowledge of the frequency-dependence of the foregrounds that are deprojected, which does not always have a well-understood spectral energy distribution (SED) as in the case of CIB, for example.
As a preliminary analysis, we use the publicly available pyilc5 code to deproject the CIB foreground from our websky maps using harmonic constrained ILC.We model the frequency dependence of CIB with ν β frequency dependence and effective dust temperature T d = T 0 (1 + z) α setting β = 0.2, α = 0.2 and T 0 = 20.7 following (Stein et al. 2019).While we find CIB deprojection reduces the contribution to CMB by around a factor ∼ 2 on ∼ arcminute scales, we find the effect on the final ML detection SNR from oriented stacking to be less than 10 percent.

Stacking
For a given pixel in the sky, we define a 3 × 3 rotation matrix pivoted at the location of the halo (labelled i below) as where I 1 ≡ {1, 0, 0}, I 2 ≡ {0, 1, 0}, I 3 ≡ {0, 0, 1} and Here, xi = x i /χ, ŷi = y i /χ, ẑi = z i /χ where x i , y i , z i are the comoving 3-dimensional coordinates of the halo and where χ i is the comoving distance to the halo.The velocity unit vectors satisfy where v i ⊥ is the three-dimensional bulk transverse velocity at the location of the halo and xi , ŷi , ẑi are the threedimensional Cartesian unit vectors corresponding to the pixel's location on the 2-sphere.The Cartesian coordinates for a pixel on the rotated map then satisfies where x map , y map , z map are the Cartesian coordinates of the pixel on the input patch prior to rotation, and x rot , y rot , z rot are the Cartesian coordinates of the pixel on the rotated map.We choose x map , y map , z map to correspond to N p × N p pixels covering the range [−λr/r s , , +λr/r s ] in two orthogonal directions on the 2-sphere and choose λ = 2.5 and N p = 21 unless we state otherwise.

Figure 2 .
Figure 2. Joint sky coverage (red) of the upcoming CMB experiments and galaxy surveys.(Left) Sky coverage of DESI and Simons Observatory (f sky ≃ 0.20).(Right) Sky coverage of LSST and CMB-S4 (f sky ≃ 0.45).These maps were generated in part using code available at github/cmb-x-galaxy-overlaps (Coulton et al. 2022).

Figure 3 .
Figure 3.Comparison between reconstructed halo transverse velocities v est θ with the true halo velocities from websky simulation v true θ

Figure 4 .
Figure 4. Stacked CMB patches for a CMB-S4-like resolution and noise.The Number of CMB patches, equal in each stack, matches the halo number count anticipated from an LSST-like galaxy survey.The color bars correspond to the mean temperature at each pixel after averaging.The leftmost panel corresponds to the moving lens signal in isolation.The second panel to the left corresponds to the total black-body signal in the CMB map, including kSZ, halo lensing as well as the primary lensed CMB.The moving lens is apparent from the second stack although halo lensing contributes a significant gradient largely obscuring the dipolar ML signature.The middle panel shows the halo lensing signal in isolation (note that here, the direction of the gradient is accidental and not correlated with the velocity).The right two panels correspond to the contribution of CIB and tSZ effects to the ILC-cleaned CMB maps we describe in Sec.5.1.3,which are still orders of magnitude large than the ML signal.The contour lines on this panels correspond to pixels corresponding to 50 and 15 percent of the central pixel value, demonstrating the anisotropic profile of the residual foregrounds aligned with the transverse velocity on the stacked patches.

Figure 5 .
Figure5.The mean RMS of pixels in stacks of ILC-cleaned CMB matching CMB-S4 and SO experimental specifications, for varying halo number count matching DESI and LSST surveys.Star markers correspond to various experiment combinations with varying halo number count and CMB specifications.The RMS is dominantly sourced by the lensed primary CMB and vary below the order of perfect of the mean throughout the pixels in the grids.The RMS values can be seen to be lower than the ML signal amplitude (here parametrised by the maximum value of the ML profile in µK with the purple dashed line) for all experiments we consider.

Figure 7 .
Figure 7.The fractional SNR contribution from halos within bins of redshift and mass to the total detection SNR with stacking, for CMB-S4-and LSST-like experiments.Different panels correspond to considering the ML signal in isolation (top left panel) and together with one other CMB signal (the right three panels in the top and left two panels in the bottom row).The right-most bottom panel corresponds to ILC-cleaned CMB maps including all foregrounds as well as the ML effect.The contour lines correspond to the area that includes 75% of the total SNR.The black solid (colored dot-dashed) contour lines correspond to taking the same percentile in SNR, considering ML signal in isolation (considering the combination of signals labelled at the top of each panel).The contribution to the total SNR can be shown to shift towards lower redshift higher mass halos with the inclusion of other CMB foregrounds.Masses are in logarithmic units in all plots.

Figure 8 .
Figure8.Pairwise transverse-velocity signal and measurement error at different redshifts for the combination of CMB-S4 and LSST surveys.The black lines on all panels correspond to the pairwise transverse-velocity signal from maps including simulations of ML effect alone, which we verifies to follow the theoretical prediction for the pairwise velocity signal.The top panels corresponds to results of pairwise-velocity estimation from low-redshift halos at z ∈ [0.1 − 0.5].The middle and lower panels corresponds to redshift bins z ∈ [0.5, 1.0] and z ∈ [1.0, 2.0], respectively.The blue data points on the left and right panels correspond to results from pairwise-velocity estimation using our baseline ILC-cleaned CMB which includes all foregrounds, with white noise matching that of CMB-S4.The orange data points on the same panels correspond to an identical analysis except omitting the contribution to the observed CMB maps from cluster lensing.The left (right) panels correspond to applying a halo mass cut of M h > 5 × 10 13 M⊙ (M h > 1 × 10 14 M⊙).The purple and pink data points on the middle panels correspond to contributions to the pairwise-velocity signal from frequency-dependent CIB and tSZ foregrounds, respectively, for M h > 5 × 10 13 M⊙.We calculate these purple and pink data points by performing ILC-cleaning with identical foregrounds except omitting CIB and tSZ, respectively, and subtracting these maps from our baseline ILC-cleaned maps, which include all foregrounds.The remaining maps leading to purple and pink data points capture the contribution to the baseline ILC-cleaned maps from CIB and tSZ foregrounds in isolation, respectively.We calculate the error bars with the jackknife method, as described in the text.The total number count of halos satisfy the corresponding mass cuts, as well as the sky fraction, which match the anticipated values from joint analysis of CMB-S4 and LSST surveys.For M h > 5 × 10 13 M⊙, we find the total detection signal-to-noise (S/N ) of the pairwise velocity to be 9.4 (14.1) for our baseline (unlensed) results, which we detail in Table3.For M h > 1 × 10 14 M⊙, we find corresponding S/N satisfy 6.3 (7.9), for baseline (unlensed), which we show in Table4.

Figure 9 .
Figure9.Pairwise velocity estimates for a range of galaxy survey specifications for mass cut of M h > 5 × 10 13 and the lower redshift bin z ∈ [0.1, 0.5].The top panels correspond to a joint analysis of a DESI and SO like experiment.The following row of panels correspond to a joint analysis of CMB-S4 and LSST, with the exception that we reduce the galaxy density of LSST survey by a factor of 2. The lowest panels correspond to velocity estimates for our baseline choice (along with unlensed, CIB and tSZ), identical to results the top row of panels in Fig.8.We find the fidelity of the pairwise velocity measurement is significantly sensitive to the galaxy number count.

Table 4 .
The SNR of pairwise transverse velocity measurements from a joint analysis of CMB and galaxy surveys matching anticipated specifications of CMB-S4 and LSST for halos satisfying M h > 10 14 M⊙.Table otherwise identical to Table 3. Corresponding data points are shown in Fig. 8.