betaFeedback

WorksPhysics and Astronomy

Precise Deep-Learning Reconstruction of Galaxy Cluster Mass Maps and Substructures from Optical Observations

Abstract

Accurately mapping the total mass distribution within galaxy clusters, including dark matter, is fundamental to understanding structure formation and constraining cosmological parameters. Conventional mass-mapping techniques rely predominantly on gravitational lensing and often produce smooth mass distributions based on analytical profiles, potentially missing important internal substructures. We introduce a complementary, simulation-based inference approach to reconstruct detailed galaxy cluster mass maps and resolve their internal substructures directly from optical imaging. We trained deep learning models on realistic hydrodynamical simulations of galaxy clusters to infer their mass distributions from optical observations. We subsequently applied this framework to observations of real galaxy clusters obtained with the Hubble Space Telescope (HST) as part of the Cluster Lensing And Supernova survey with Hubble (CLASH) programme. The reconstructed mass maps successfully reproduce the overall shapes and radial mass profiles of the CLASH clusters, showing strong agreement with independent gravitational lensing measurements. Furthermore, the subhalo mass functions derived from the reconstructed maps exhibit power-law behaviour broadly consistent with predictions from numerical simulations. Our results demonstrate that combining optical imaging with deep learning provides a scalable and physically meaningful approach to mapping galaxy cluster mass distributions. This framework opens a new avenue for exploiting upcoming wide-field imaging surveys to systematically investigate dark matter substructures across large cluster samples, complementing traditional gravitational lensing techniques. Moreover, the model is inherently flexible and can incorporate multi-wavelength observations, including X-ray and Sunyaev–Zel'dovich data, to further improve total mass predictions.

Introduction

Galaxy clusters, which represent the final stage of hierarchical structure formation, are primarily composed of dark matter, contributing ∼85%\sim85\% of their total mass, while ordinary baryonic matter (i.e., gas and stars) accounts for only the remaining 15%15\%[82, 28]. The dominant dark matter component cannot be directly observed; its presence must be inferred from its gravitational influence on ordinary matter. Therefore, estimating the total mass of clusters (including both dark and baryonic matter) is challenging. However, this is crucial for many astrophysics and cosmology studies. For example, the abundance of galaxy clusters as a function of mass and redshift is highly sensitive to the fundamental cosmological parameters such as the matter density parameter Ωm\Omega_{\mathrm{m}} and the mass fluctuation amplitude σ8\sigma_8 on a scale of 8 h−1 Mpc8\ h^{-1}\,\mathrm{Mpc}. As such, cluster masses can serve as a powerful tool for constraining cosmological parameters [79, 51, 2]. Hence, it is essential to improve the accuracy of total mass estimates in galaxy clusters (for an extensive review see Pratt et al. [69]).

The global masses of galaxy clusters are commonly inferred from X-ray [80, 47, 25] and Sunyaev–Zel’dovich (SZ) observations [1, 24] (Planck Collaboration et al. 2016) of the intracluster medium, or from the kinematics of member galaxies [3, 9, 74]. These approaches rely on assumptions of hydrostatic or dynamical equilibrium, which are sensitive to non-thermal gas motions, substructure, projection effects, and contamination by interlopers, leading to systematic biases—most notably the hydrostatic mass bias—that can underestimate the true cluster mass [71, 53, 8, 63, 30]. Cosmological simulations play a key role in robustly quantifying the systematic ics and biases [64, 5, 27, 56]. Nevertheless, these methods are limited to determining total cluster masses within only a few characteristic radii. As such, they cannot recover detailed mass distributions or characterize the subhalo population within galaxy clusters.

Alternatively, strong and weak gravitational lensing [41, 6, 44, 85, 62] provide a direct probe of the total projected mass distribution of galaxy clusters, which can reveal such detailed information through lensing maps; see Meneghetti et al. [52] for the galaxy-galaxy lensing crisis. However, its sensitivity to line-of-sight projection effects such as halo triaxiality and uncorrelated foreground and background structure can limit its ability to precisely recover the mass distribution [e.g. 31].

Recent deep learning (DL)–based mass inference methods trained on cosmologically based hydrodynamical simulations have attracted significant attention. This enables a more direct data-driven modeling approach that is independent of these conventional theoretical assumptions discussed above. DL models trained on simulated X-ray, Sunyaev-Zel’dovich, galaxy kinematics, and weak-lensing data have been shown to recover cluster masses with high fidelity [61, 26, 46, 36]. By applying the DL method to the observed Planck SZ cluster images, de Andres et al. [18] showed that it can recover cluster masses without a bias. More recently, DL techniques have been shown to successfully reconstruct projected total mass maps of galaxy clusters from multi-wavelength images generated by hydrodynamic simulations, providing far richer information than scalar mass estimates alone [19, 37]. However, that approach has so far been tested only on simulations and has not yet been applied to real observations.

In this work, we build upon de Andres et al. [19] by applying a U-Net–based deep learning model to predict projected mass maps as output for galaxy clusters observed with the Hubble Space Telescope (HST), focusing on the Cluster Lensing and Supernova Survey with Hubble (CLASH; Postman et al. [68]). The CLASH program comprises 25 massive clusters spanning 0.19≲z≲0.890.19 \lesssim z \lesssim0.89 with high-quality multi-band HST observations, making it well suited for lensing and mass map studies. Furthermore, all CLASH clusters have both reconstructed strong- and weak-lensing mass maps [86, 76], which enable a direct validation of our mass maps inferred via deep learning. Note that the original CLASH lensing results are adopted here for consistency considerations; therefore, their latest results from the Frontier Fields programme, as well as the constructed maps from other works, are not included.

To train the U-Net model, we select a sample of 3,273 simulated clusters from The Three Hundred project (The300; Cui et al. [16]), selected to match the CLASH clusters in both mass and redshift. The PyMSZal (Jungwiert & Cui 2025) package is used to mimic the HST ACS/WFC optical-to-NIR filters (F606W, F625W, F775W, F814W, and F850LP), as well as the noise and instrumental characteristics of the real CLASH HST data. Therefore, seven U-Net models in total—five using the individual HST ACS/WFC filters and two using multi-filter input configurations—are trained. The remainder of this paper is structured as follows. In § 2, we introduce the numerical datasets and sample selection criteria from The300 simulation suite. § 3 outlines the methodology for generating mock HST observations using PyMSZal, details our instrumental effects and noise modeling, and describes the creation of the target projected mass maps. In § 4, we present the architecture of our single-channel and multi-filter U-Net models alongside the data preprocessing and training configurations. § 5 evaluates the performance of the trained U-Net models on the independent simulation test dataset, while § 6 details their application to real HST observations of the CLASH clusters. Here, we validate the deep-learning–inferred mass maps against independent strong- and weak-lensing models [86] and X-ray observations [22]. Furthermore, we derive the cluster subhalo masses to verify the well-known power-law mass function predicted by simulations [29, 20, 77, 33 and references therein]. Finally, our conclusions are summarized in § 7.

The Three Hundred Simulations

We used a sample of galaxy clusters based on the suite of hydrodynamical simulations from The Three Hundred project [16]. The300 utilizes the spherical regions around the 324 most massive cluster regions identified in the dark-matter-only MDPL2 simulation [43] with a box size of 1h−11h^{-1} Gpc. Each of these selected cluster regions is re-simulated at high resolution using the zoom-in simulation technique within a radius of 15h−115h^{-1} Mpc by adopting the Planck cosmology parameters (Planck Collaboration 2016) of the parent MDPL2 simulation ΩM=0.307,ΩB=0.048,ΩΛ=0.693,h=0.678,σ8=0.823,ns=0.96\Omega_{\mathrm{M}} = 0.307, \Omega_{\mathrm{B}} = 0.048, \Omega_{\Lambda} = 0.693, h = 0.678, \sigma_8 = 0.823, n_{\mathrm{s}} = 0.96, including different baryonic physics models within the high-resolution volume. The high-resolution particle masses are mDM≈1.27×109h−1M⊙m_{\mathrm{DM}} \approx1.27 \times10^{9}h^{-1}M_{\odot} for dark matter and mgas≈2.36×108h−1M⊙m_{\mathrm{gas}} \approx2.36 \times10^{8}h^{-1}M_{\odot} for gas. Outside the 15h−115h^{-1} Mpc region, the simulations use lower-resolution particles to capture large-scale tidal fields efficiently.

For this study, we focus on clusters re-simulated with the Gizmo-Simba sub-grid baryonic physics model [17, 15]. For each cluster, 128 snapshots are saved with redshifts ranging from z=16.98z = 16.98 to z=0z = 0. The dark matter halos for each cluster region in the The300 project simulation are identified using the Amiga Halo Finder (AHF) [45]. Halos are defined as spherical regions with an average density of 500 times the redshift-dependent critical density, ρcrit(z)\rho_{\mathrm{crit}}(z), yielding a mass

M500c=4π3R500c3 500 ρcrit(z),(1)M_{500c} = \frac{4\pi}{3}R_{500c}^{3}\,500\,\rho_{\mathrm{crit}}(z), \tag*{(1)}

where R500cR_{500c} is the corresponding halo radius.

The procedure adopted for selecting the simulated halos used to train the deep learning models is as follows:

  • Based on the redshift and lensing-based M500cM_{500c} estimates of the CLASH clusters in Table A.1, we selected 3,273 halos from The300 simulations that match both the M500cM_{500c} and the redshift of the CLASH sample. These halos span the redshift range 0.152<z<0.6070.152 < z < 0.607. We also required fMHIRES>0.99f_{\mathrm{MHIRES}} > 0.99, where fMHIRESf_{\mathrm{MHIRES}} is the fraction of the halo mass contained in high-resolution particles; this ensures that the halos are uncontaminated by low-resolution particles and lie within the high-resolution zoom-in region.

  • In Figure 1, we present the distribution of the selected The300 halos alongside the CLASH clusters, where the simulated counterparts matched in redshift and M500cM_{500c} are shown as black points, the perturbed halos (with random redshift shifts

Figure 1. Cluster M500cM_{500c} versus redshift zz distribution for the selected sample. Black and grey points denote The300 simulated clusters at their exact simulation redshifts and with an applied uniform random perturbation (δz∼U(−0.015,0.015)\delta z \sim\mathcal{U}(-0.015,0.015)), respectively. Red points and annotations indicate observed CLASH clusters, labeled by their IDs from Table A.1. The marginal histograms display the projected zz (x-axis) and M500cM_{500c} (y-axis) distributions for both The300 (grey) and CLASH (red) samples.

drawn uniformly within ±0.015\pm0.015 to break degeneracies) are shown as grey points, and the CLASH clusters are shown as red points annotated following Table A.1.

  • The redshift histogram indicates that the simulated halos broadly cover the redshift range of the CLASH clusters; however, the M500cM_{500c} histogram reveals that the simulated sample is not uniformly distributed and contains fewer high-mass clusters, whereas a flatter distribution would be preferable to avoid bias.

  • The catalog was split into training, validation, and test sets using a simulation-region-based strategy, in which halos were first grouped by simulation region identifier and the split was performed on the set of unique regions rather than on individual halos. This ensures that all snapshots and evolutionary states of a given halo, including its progenitors and later stages, remain within the same dataset and do not appear in multiple splits.

  • Out of a total of 284 simulation regions, 11% were allocated to the test set, while 15% of the remaining regions were used for validation and the rest for training; aggregating the halos within these regions resulted in 2,497 halos for training, 430 halos for validation, and 346 halos for the test set.

Mock HST observations and projected mass maps

Theoretical Mock HST observations using PyMGal

Mock HST observations (i.e. input dataset) for each simulated cluster were generated in units of erg/sec using PyMGal [39]. PyMGal first uses EzGal [50] to assign Spectral Energy Distributions (SEDs) to each star population in the simulation based on a simple Stellar Population Synthesis (SPS) model and the physical properties of the particles, namely their age, metallicity, and mass. The SEDs, together with the filter response files of the respective telescope instruments, are then used to compute magnitudes in the observer’s frame following the EzGal approach. These magnitudes are then converted to luminosities in the observer’s frame and finally projected to create synthetic observations. While generating our mock HST observations with PyMGal, we adopted the simple stellar population (SSP) models of Bruzual & Charlot [11] with a Chabrier initial mass function [13], which is agreed to the simulation, and used the HST ACS/WFC F606W, F625W, F775W, F814W, and F850LP filter response curves to produce the mock HST maps.

To augment the dataset, each cluster was rotated around its center along 30 different lines of sight to generate 30 pseudo-independent mock observations per filter. The depth along the line of sight for generating the mock observations is ±5R500c\pm5R_{500c}. We generated mock HST observations for each simulated cluster with a fixed physical FOV of 500×500500 \times500 kpc2^2. The number of pixels (NpixN_{\rm pix}) depends on the cluster redshift through the angular diameter distance, which is computed assuming Planck cosmology, since the pixel scale is fixed to the HST value of 0.065 arcsec per pixel.

Instrumental effects and noise modeling

The synthetic HST observations generated with PyMGal do not include the point spread function (PSF) or other filter-specific instrumental effects. To produce more realistic mock observations that better mimic real HST data, we incorporate these effects in a post-processing step. Specifically, for each filter, the mock maps were first convolved with the corresponding PSF obtained from the CLASH PSF model archive2.

To model realistic background noise, we used blank-sky regions from the real CLASH HST data that contain minimal sources and are located far from the cluster centers. For each filter, we extracted multiple patches of approximately 400×400400 \times400 pix2^2 from the corresponding HST images and processed them using the photutils package [10]. Small residual sources in the extracted patches were identified and masked using background estimation combined with 2.5σ2.5\sigma threshold-based segmentation. The masked regions, including the faint wings of detected sources, were then replaced with randomly sampled background pixels drawn from the same image to preserve the intrinsic noise properties.

The resulting source-free noise patches were mean-subtracted and averaged to construct a representative correlated noise template for each filter. These noise templates were converted to physical flux units (ergs−1^{-1}cm−2^{-2}) using the PHOTFLAM calibration factor and the corresponding filter bandwidth. To incorporate noise into the mock HST observations, the noise maps were further converted from flux to luminosity units (erg, s−1^{-1}) using the luminosity distance appropriate for each simulated cluster redshift. The noise was then added to the mock images using GalSim [73].

The final noise added to each mock observation corresponds to a random realization of a correlated noise field based on the source-free noise templates derived from the real CLASH data. This GalSim-based procedure ensures that each mock HST observation incorporates a unique noise realization while preserving the underlying two-dimensional correlation properties of the original HST background.

Projected Mass Maps from The300 Simulations

The corresponding projected mass maps (i.e. target dataset) for each simulated cluster were also generated by projecting the masses of all particles in the simulation—i.e., gas, star, dark matter, and black hole particles—along the line of sight, using the same pixel resolution scale and FOV as the mock HST observation maps. The depth along the line of sight for generating the mass maps is also ±5R500c\pm5R_{500c}. Finally, both the mock HST observations and the mass maps for the simulated clusters were down-sampled to a common pixel size of 128×128128 \times128, ensuring that they are conserved during the down-sampling procedure. This ensures that the dimensionality of the maps is consistent and helps stabilize the model during training. This also makes the dataset manageable for training on GPUs. In Figure 2, we show the projected total mass map and the mock HST luminosity maps in different filters, expressed in erg s−1^{-1}, for one of the The300 simulated clusters from the test set.

Figure 2. Mass and mock HST luminosity maps of an example cluster from The300 simulation. Top left: Projected total mass distribution (log⁡10M⊙\log_{10} M_{\odot}). Remaining panels: Mock HST optical luminosity maps across the F606W, F625W, F775W, F814W, and F850LP filters on a shared logarithmic scale. All panels share the same field of view, line of sight, and corresponding color bar scales.

U-Net Architecture and Training

The deep-learning architecture used to reconstruct the projected total mass maps is based on the U-Net framework, originally developed for biomedical image segmentation (Ronneberger et al. [72]) and subsequently applied to a wide range of image-to-image regression tasks. The U-Net model was previously tested on The300 simulations in de Andres et al. [19] to reconstruct projected mass maps using idealized X-ray, Sunyaev–Zel’dovich, and stellar mass density maps. However, their study did not include observational noise or systematic effects in the generated maps and therefore did not test the model on realistic observational data. In this work, we train the U-Net on mock HST observations that incorporate realistic HST instrumental effects and noise for each filter, enabling a direct application of the model to CLASH clusters observed with HST. Below, we describe our four-level single-channel U-Net architecture, which predicts projected mass maps using a single HST/ACS/WFC filter observation (F606W, F625W, F775W, F814W, or F850LP), as illustrated in Figure 4.

Single-channel U-Net architecture

Figure 4. Single-channel U-Net architecture for processing individual 128×128×1128 \times128 \times1 HST filter images (F606W, F625W, F775W, F814W, or F850LP). The network compresses the input through a four-stage encoder (starting with F=32F=32 filters) to a bottleneck, followed by a symmetric decoder path with skip connections to reconstruct the final projected mass map. Each stage utilizes the convolutional block shown in Figure 3. Redshift conditioning is integrated at the bottleneck and throughout the decoder using FiLM layers to modulate the latent feature maps, capturing redshift-dependent features.

  1. The encoder (down-sampling) path consists of successive convolutional blocks that progressively reduce the spatial resolution of the input image while increasing the depth of the feature representation. Each block comprises two 3×3 convolutional layers, each followed by rectified linear unit (ReLU) activation [57] and batch normalization [38]. The number of filters doubles at each level of the encoder, starting from 32 in the first block. The structure of an individual convolutional block is illustrated in the upper panel of Figure 3 for reference. After each block, a two-dimensional max-pooling operation is applied to reduce the spatial dimensions of the feature maps by half, enabling the network to capture progressively larger contextual features.

Schematic of the convolutional block and Feature-wise Linear Modulation layer

Figure 3. Schematic of the convolutional block (top) and Feature-wise Linear Modulation (FiLM) layer (bottom) implemented in the U-Net architecture. Each convolutional block contains two sets of convolutional layers (F=fF=f filters), batch normalization, and ReLU activation functions, used across both down-sampling and up-sampling paths. The FiLM layer modulates the bottleneck and decoder feature maps to condition the network on cluster redshift zz using learned scale γ(z)\gamma(z) and shift β(z)\beta(z) parameters.

  1. The output of the final encoder block is passed to the bottleneck, which consists of two additional convolutional blocks, with the number of filters determined by the depth of the U-Net architecture. At this stage, we introduce redshift conditioning using Feature-wise Linear Modulation (FiLM; Dumoulin et al. [23]). This conditioning is motivated by the fact that the relationship between the observed optical properties of galaxy clusters and their underlying projected mass distributions can depend on redshift. Therefore, a network trained across a range of redshifts should be able to adapt its feature representations according to the redshift of the input cluster, rather than learning a single mapping that is independent of redshift.

FiLM provides a mechanism for achieving this by using the cluster redshift as an additional scalar input to modulate the bottleneck feature maps. Specifically, the redshift is passed through a small fully connected network consisting of two dense layers, which generates two sets of channel-wise modulation parameters: a scaling parameter γ(z)\gamma(z) and a shift parameter β(z)\beta(z). Each set contains CC parameters, where CC is the number of channels in the bottleneck representation. These parameters are broadcast across the spatial dimensions of the feature maps and applied through an affine transformation:

FiLM⁡(x,z)=γ(z)x+β(z),\operatorname{FiLM}(x,z) = \gamma(z)x + \beta(z),

where xx denotes the bottleneck feature maps and zz is the cluster redshift. The scaling parameters control the relative contribution of individual feature channels, while the shift parameters introduce an additional redshift-dependent adjustment to their activations. In this way, the network can adapt its internal representations to the redshift of each cluster while retaining the shared convolutional architecture and learned spatial features. A schematic illustration of the FiLM conditioning mechanism is provided in Figure 3.

  1. The decoder (up-sampling) path mirrors the encoder structure and progressively reconstructs the spatial resolution of the feature maps. At each decoding stage, the feature maps are up-sampled and concatenated with the corresponding encoder feature maps via skip connections, preserving spatial information lost during down-sampling. The concatenated features are processed by two convolutional blocks. The number of filters is halved at each decoding level to maintain symmetry with the encoder. Redshift conditioning is again applied at each decoder stage using a FiLM layer, which modulates the feature maps according to the input cluster redshift. Through these sequential operations, the decoder reconstructs the final projected total mass map from the bottleneck representation.

The U-Net framework allows multiple HST filters to be incorporated simultaneously. We explored two different extensions:

  1. Multi-channel: In this configuration, the network architecture remains identical to the single-channel U-Net, but the input consists of a five-channel image formed by stacking the F606W, F625W, F775W, F814W, and F850LP observations. The resulting input tensor has dimensions 128×128×5128 \times128 \times5, analogous to an RGB image with additional channels. This configuration follows an early-fusion strategy, where information from all five filters is processed jointly from the initial convolutional layers. This allows the network to learn shared feature representations by combining information across the different photometric bands during the feature extraction process.

  1. Multi-encoder: In this configuration, each HST filter is processed through an independent encoder branch, allowing the network to initially extract features from each filter separately. This follows a late-fusion strategy, in which the feature maps extracted by the individual encoders are concatenated at the bottleneck to form a joint multi-filter latent representation. This representation is subsequently conditioned on the cluster redshift via a feature-wise linear modulation (FiLM) layer. A shared decoder then reconstructs the projected mass map from the combined representation, incorporating skip connections from all encoder branches to retain spatial information at different resolutions. Unlike the multi-channel configuration, where information across filters is combined from the initial convolutional layers, the multi-encoder architecture delays the fusion of the independently extracted feature representations until the bottleneck and subsequent decoding stages. Similar parallel-processing and feature-fusion strategies have been explored in multimodal CNN architectures [e.g. 4]. This architecture is shown in Figure 5.

Multi-encoder U-Net architecture for simultaneous processing of five HST filter images

Figure 5. Multi-encoder U-Net architecture for simultaneous processing of five HST filter images (F606W, F625W, F775W, F814W, and F850LP) of the same cluster. Each 128×128×1128 \times128 \times1 input passes through an independent encoder branch (3×33 \times3 kernels, base filter size F=32F = 32). The resulting feature maps are concatenated at the bottleneck into a joint latent representation and conditioned on cluster redshift via a FiLM layer. A shared decoder then reconstructs the final projected mass map, utilizing FiLM modulation at each stage and multi-branch skip connections to preserve spatial information.

Before training the models, we applied preprocessing steps to ensure that the U-Net training is stable. Since luminosity maps for each HST filter can contain negative values (arising from background subtraction), we applied a signed logarithmic transform,

x~={log⁡10(x)x>0,−log⁡10(∣x∣)x<0,0x=0,(2)\tilde{x} = \begin{cases} \log_{10}(x) & x > 0, \\ -\log_{10}(|x|) & x < 0, \\ 0 & x = 0, \end{cases} \tag*{(2)}

which preserves the sign of the original pixel values while symmetrically compressing both positive and negative ranges. By using the signed transform, all information—including negative pixels resulting from background subtraction—is preserved, with negative luminosities retained as meaningful signal without the loss of any signal.

For the mass maps, which are non-negative, we apply a standard logarithmic transform,

m~={log⁡10(m)m>0,0m≤0,(3)\tilde{m} = \begin{cases} \log_{10}(m) & m > 0, \\ 0 & m \leq0, \end{cases} \tag*{(3)}

where pixels with zero or nonphysical values are masked to zero. Following these transformations, both maps are standardized using the mean and standard deviation computed exclusively from the training set, and the same statistics are applied to the validation set to prevent any leakage of validation information into the normalization. The normalization statistics for each HST filter and the mass maps are saved and reused at inference time to ensure consistency between training and prediction. For a discussion of the impact of different preprocessing choices on model performance, we refer the reader to Appendix Section C.

The model is optimized using the Adam optimizer [42] starting with a learning rate of 10−410^{-4} and a batch size of 64, for a maximum of 150 epochs. To stabilize and improve convergence, three callbacks were employed during training. First, a ReduceLROnPlateau which halves the learning rate whenever the validation loss fails to improve for 20 consecutive epochs, down to a minimum of 10−710^{-7}. Second, EarlyStopping that monitors the validation loss and terminates training if no improvement is observed for 30 epochs, restoring the best weights at the end. Finally, ModelCheckpoint that saves the model weights to disk whenever a new best validation loss is achieved, ensuring that the optimal model state is retained regardless of when training terminates. The model is trained by minimising a per-map mean absolute error (MAE) loss. All U-Net models were trained on NVIDIA A100 GPUs.

U-Net Model Performance on the The300 Test Set

We show the predictions by the different U-Net models for an example simulated cluster from the test set. The mock HST luminosity maps shown in Figure 2 are used as inputs to reconstruct the corresponding projected total mass maps, shown in Figure 6. All U-Net models successfully recover the overall morphology of the true projected mass distribution, including small-scale features, by using only the optical information associated with the stellar population component in the simulation. The residual maps corresponding to each U-Net model prediction, quantified in terms of relative errors, are shown in lower panel of Figure 6. To evaluate the performance of the U-Net-predicted mass maps on the The300 test set, we compare their surface mass density radial profiles and power spectra with those of the ground truth in Figure 7. In the top panels, the black curves show the median radial profiles of the true projected mass distributions, while the blue curves represent the corresponding median profiles predicted by the different U-Net models.

Figure 6. Performance of different U-Net models in predicting projected total mass maps for a representative cluster from the simulation test set. Top panel shows the reconstructed maps, and lower panel shows the corresponding relative error residual maps, defined as (Σ2D,pred−Σ2D,true)/Σ2D,true(\Sigma_{\mathrm{2D,pred}} - \Sigma_{\mathrm{2D,true}})/\Sigma_{\mathrm{2D,true}}.

Figure 7. Comparison of ground truth and predicted mass maps from different U-Net models over the test dataset. The upper panels show surface mass density radial profiles, whereas, the lower panels show power spectra estimated from the mass maps. Solid lines represent the test set medians, and shaded regions show the 16th–84th percentile range; each subplot compares an individual U-Net architecture against the ground truth. Vertical black dotted lines indicate the spatial resolution of The300 simulations (≈6.5\approx6.5 kpc, top) and the Nyquist limit of the 128×128128 \times128 pixel mass maps (k≈0.8k \approx0.8 kpc−1^{-1} or λ≈7.85\lambda\approx7.85 kpc, bottom).

dictated by the different U-Net models. The shaded regions indicate the 16th–84th percentile range, illustrating the cluster-to-cluster variation in the profiles. Overall, the predicted profiles reproduce the shape of the true distributions well over most of the radial range. The best agreement is achieved by the multi-encoder model, where both the median profiles and the scatter closely match the ground truth. Models trained on individual filters show small systematic offsets, suggesting that single-band information is less effective in fully recovering the projected mass distribution. All models, however, show discrepancies in the innermost regions, highlighting the difficulty of accurately reconstructing the mass distribution near the cluster center.

A similar trend is seen in the power spectra shown in the bottom panels of Figure 7. The predicted mass maps recover the large-scale features of the true mass maps well, as indicated by the good agreement between the ground-truth and reconstructed power spectra at low spatial frequencies. On smaller scales, however, the U-Net reconstructed mass maps’ power spectra begin to deviate from the ground truth, indicating that the models are less effective at recovering the fine-scale structure of the mass distribution. Among all models, the multi-encoder configurations again show the closest agreement, demonstrating that combining information from multiple photometric bands improves the reconstruction of both the radial mass profiles and the spatial structure of the projected mass maps.

In Figure 8 (top), we compare the total projected mass predicted by each U-Net model with the true total projected mass from the simulations for the full test set. The predictions broadly follow the one-to-one relation, with moderate scatter and a mild underestimation towards the high-mass end (log⁡10(Tot,Σ2D)≳14.4\log_{10}(\mathrm{Tot}, \Sigma_{\mathrm{2D}}) \gtrsim14.4). This behaviour is consistent with the regression-to-the-mean effect, whereby predictions for clusters at the extremes of the target distribution tend to be closer to the values characteristic of the training sample. As illustrated by the cluster mass distribution in Figure 1, the most massive clusters are less well represented in the training set. Consequently, the network may have limited ability to learn the distinctive mass distributions of these clusters, potentially leading to an underestimation of their total projected masses. This effect is particularly noticeable for the models based on the F606w, F625w, and F850lp filters, which show a tendency to under-predict the total projected mass.

Figure 8. Overall performance of the U-Net models in reconstructing total matter distributions. The top panel compares the predicted total projected mass from different U-Net models against the ground truth across the entire simulation test set; red dotted lines denote the ideal 1:1 relation, and blue contours show the kernel density estimation. The bottom panel displays the pixel-wise relative error distribution between predictions and true values for all test set maps, with the legend indicating the mean error and ±1σ\pm1\sigma standard deviation for each architecture.

We also examine pixel-wise relative residuals between the predicted and true projected mass maps (Figure 8 (bottom)). The residuals are defined as (Σ2D,pred−Σ2D,true)/Σ2D,true(\Sigma_{\mathrm{2D,pred}}-\Sigma_{\mathrm{2D,true}})/\Sigma_{\mathrm{2D,true}} and are computed across all pixels and clusters in the test set. The resulting distributions show a ±1σ\pm1\sigma scatter of approximately 19–24%. Models trained on individual filters exhibit minimal mean residuals, with the exception of the F850lp-based model, which shows the largest bias (∼10%\sim10\%).

For details regarding the performance of the U-Net models trained on the The300 simulations and tested on the TNG cluster suite, we refer the reader to Appendix Section B. Based on the evaluation of all U-Net architectures across both the The300 test set and the TNG cluster (in Appendix Section B) suite, the multi-encoder model demonstrated the most robust performance. Consequently, we selected this model for the subsequent reconstruction of mass maps from the HST observations of the CLASH sample.

Results

We applied our trained U-Net models to 21 CLASH clusters with HST observations. However, we present the results for five of these clusters—Abell 209, MACS J0416–2403, MACS J1149+2223, MACS J1206–0847, and RXJ 2248.7–4431-CLASH-VLT individually, of which the spectroscopic information is available. This is essential for accurately masking non-cluster members for correctly identifying and studying subhalos. Furthermore, point sources in the HST images of the clusters are also excluded before applying the U-Net models to predict the total mass maps. For the remaining 16 CLASH clusters, a similar preprocessing procedure was applied, but with only the CLASH HST photometric-redshift (BPZ) catalog. For assessing the robustness of the U-Net predictions, we compared the inferred projected mass maps with independent lensing-based mass estimates from the CLASH survey. In particular, we adopted the light-traces-mass (LTM) models derived from joint strong and weak lensing analysis [86], which provide convergence maps for all clusters in our sample. Full details of the preprocessing applied to the CLASH HST images prior to their use as input to the U-Net models, the conversion of LTM κ\kappa maps to projected mass maps, are provided in Appendix Section A.

Figure 9 shows two representative CLASH clusters: MACS J0416−2403, a merging (dynamically unrelaxed) system, and RXJ 2248.7−4431, a relaxed system. For each cluster, the left panel shows the HST image, created by combining the F850LP, F775W, and F606W filters as the R, G, and B channels, respectively. The right panels show the lensing-derived mass map (top) and the mass map reconstructed by the multi-encoder U-Net (bottom). For the performance of the remaining U-Net architectures on the CLASH cluster sample, we refer the reader to the project repository3, where the complete analysis is hosted.

Two example CLASH clusters HST images, lensing maps, and multi-encoder U-Net predicted total mass maps

Figure 9. Two example CLASH clusters HST images, the lensing and the multi-encoder U-Net model predicted total mass maps. The CLASH clusters MACS J0416−2403 (top, unrelaxed) and RXJ 2248.7−4431 (bottom, relaxed). For each cluster, the left column shows the HST observation, while the right column displays the projected total mass maps derived from lensing analysis (upper row) and by the multi-encoder U-Net model (lower row).

It is clear that the U-Net-based mass maps qualitatively preserve the general shape and structure of the clusters, matching both the HST observations and the lens-derived mass maps. This is not surprising as the LTM models rely on the assumption of light tracing mass, while the U-Net models are solely based on the observed luminosity maps. It seems that the U-Net model predictions are also clumpier and exhibit higher contrast than

the lensing results, with more substructures clearly shown. We suspect the reason is that the LTM lensing model adopts an analytical density profile to fill the overall map, while the U-Net relies on the distributions and connections of the galaxy luminosities.

To quantitatively assess the performance of the multiencoder U-Net model in reconstructing projected mass maps and information contained at different spatial frequencies, we analyze radial surface mass density profiles and power spectra. Figure 10 compares U-Net predictions with lensing-based results using radial surface mass density profiles (top panel) and power spectra as a function of spatial scale λ\lambda (bottom panel). Furthermore, the radial surface mass density profiles of these clusters, estimated from hydrostatic equilibrium mass profiles derived from Chandra X-ray observations [22], are included for comparison. The Chandra hydrostatic mass profiles are derived by Donahue et al. [22] using the Joint Analysis of Cluster Observations (JACO) code [49], which fits a parametric NFW dark matter profile and a triple β\beta-model gas density simultaneously to the X-ray spectra under the assumption of hydrostatic equilibrium. Annular bin boundaries are selected to contain at least 1500 source counts each, with a minimum width of several times the Chandra PSF. The best-fit parameters are constrained via a Markov Chain Monte Carlo (MCMC) procedure, from which the cumulative enclosed mass inside shells is estimated. We convert these 3D cumulative mass profiles into projected surface mass density maps by computing the mean 3D density within each spherical shell and applying an analytic Abel projection, assuming spherical symmetry and constant density per shell.4 It is well known that the hydrostatic equilibrium mass is biased relative to the true mass by around 20 % (e.g. Gianfagna et al. [30]), so we simply include that fixed value in the profile to correct this effect. In the lower panels of both plots in Figure 10, we show the logarithmic ratio difference for the surface mass density and power spectra, which more clearly quantifies the differences between the multi-encoder U-Net inference and the lensing-derived results. The shaded gray region in both upper plots indicates the envelope of the projected surface mass density profiles and power spectra derived from the The300 simulated cluster sample used in this study. To estimate the surface mass density radial profiles, the projected mass maps were binned into logarithmically spaced annular regions, and the average surface mass density in each annulus was computed by summing the projected mass of all pixels in the bin and dividing by the annular area. The power spectrum of the total mass maps was computed directly using the PYLIANS library [81] from these 2D mass maps.

Figure 10. Radial profiles of surface mass density (top) and mass power spectra (bottom) for five CLASH clusters with spectroscopic redshifts. Solid lines show multi-encoder U-Net predictions, long-dash-dotted lines denote lensing-based LTM model estimates, and dotted lines represent hydrostatic-equilibrium profiles derived from Chandra X-ray data. Colored shaded areas indicate the 16th^{\mathrm{th}}–84th^{\mathrm{th}} percentile range across all 21 CLASH clusters, while the grey-shaded region spans the full range of The300 simulations. Median trends are denoted by solid lines with diamond markers with increased line widths; the U-Net and LTM medians are computed over the full CLASH clusters, whereas the simulation median is calculated across the entire simulated cluster sample. Lower panels display the log-ratios calculated with respect to the U-Net predictions: log⁡10(ΣLTM/X−rayΣU−Net)\log_{10}\left(\frac{\Sigma_{\mathrm{LTM/X-ray}}}{\Sigma_{\mathrm{U-Net}}}\right). Power spectra are plotted against wavenumber kk (spatial scale λ=2π/k\lambda= 2\pi/k). Vertical black dotted lines indicate the spatial resolution of The300 simulations (≈6.5\approx6.5 kpc, top panel) and the Nyquist limit of the 128 × 128 pixel mass maps (k≈0.8k \approx0.8 kpc−1^{-1} or λ≈7.85\lambda\approx7.85 kpc, bottom panel).

By direct visual inference, we can see that the radial surface mass density profiles from lensing and U-Net-reconstructed mass maps (Figure 10) show overall consistency in both slope and normalization across the cluster sample. In the central core regions, approximately within the BCG area, the multi-encoder U-Net predictions are in very good agreement with the lensing-based profiles. Both methods consistently recover a slight central dip, indicating that the network can capture and generalize features that deviate from the median trends observed in simulations. This agreement indicates that the two models can reliably reconstruct the inner mass distribution, where baryon effects are expected to be significant.

At intermediate radii, the differences between clusters become more evident. For MACS J0416–2403 and RXJ 2248.7–4431, the multi-encoder U-Net reconstructed profiles reproduce the lensing profiles, whereas for MACS J1149+2223 and MACS J1206–0847, the multi-encoder U-Net tends to give lower surface mass densities relative to the lensing-based estimates.

In the outer regions, the discrepancies become more prominent. The lensing profiles mostly sit above the U-Net profiles in this regime, as visible in Figure 10, except for Abell 209, which shows good agreement in the center (≤20\leq20 kpc), but the U-Net profile becomes systematically higher than the lensing estimate at larger radii. In the outer region, more generally, the U-Net predictions tend to lie toward the upper range of The300 cluster samples. We suspect that this is due to a large fraction of non-member galaxies being included: Even with spectroscopic information [35, 84, 59] (Wu et al. 2022), it is hard to determine the true member galaxies due to the redshift distortion effect. Another possibility is that their true masses at that radius are actually higher by chance; as such, the predictions from U-Net are always in close proximity to the most massive samples in The300 simulation. A third possibility is a mismatch between observations and simulations, potentially arising from differences in baryonic physics or the assumed cosmological model.

Comparisons with X-ray hydrostatic profiles reveal that for MACS-J1149+2223, MACS J1206−0847, and RXJ 2248.7−4431, the Chandra profiles lie below the lensing estimates but slightly above the U-Net predictions at outer region, while for Abell 209 and MACS J0416−2403, they remain systematically lower than both LTM and U-Net. Although all the profiles have been corrected to the cosmological parameters of The300, it may still play a role in altering the halo density profiles (see Ragagnin et al. [70], for example). Though the overall distribution of the mass profiles is higher for LTM than U-Net, multiple other photo-z clusters from the CLASH sample do have their U-Net predictions lying in the central part of the shadow region.

The power spectra of these clusters in Figure 10 (bottom panel) quantify the total mass density fluctuation differences between the two models across spatial scales. We find that the spectra derived from the U-Net–reconstructed mass maps are systematically higher than those obtained from the lensing-based mass maps, specifically at larger λ≳20\lambda\gtrsim20. This indicates that U-Net–based mass maps contain more high-spatial-frequency features and, possibly more substructures than their lensing counterparts. In contrast, for MACS J0416−2403, the U-Net power spectrum exceeds the lensing spectrum at k<0.31 kpc−1k < 0.31\ \mathrm{kpc}^{-1} (λ>20 kpc\lambda> 20\ \mathrm{kpc}), but the trend inverts at smaller scales, i.e., at k>0.31 kpc−1k > 0.31\ \mathrm{kpc}^{-1} (or at less than 20 kpc20\ \mathrm{kpc}). For Abell 209, the lensing-based mass map power spectrum shows a fluctuating trend compared to the U-Net–reconstructed mass map. To consider that statistical result, the agreement is particularly good at small scales, k≳k \gtrsim Nyquist limit; whereas at intermediate and larger spatial scales, the U-Net prediction shows slightly higher power than the lensing-based reconstruction. Nevertheless, the power spectra from the multi-encoder U-Net model again lie within, or very close to, the power spectrum band of the The300 cluster sample.

From the power spectrum comparison, we find that the U-Net generally reconstructs mass maps with enhanced substructure features. To further quantify how well the U-Net reconstructions recover the abundance and mass distribution of substructure, in Figure 11, we compare the cumulative (top) and differential (bottom) subhalo mass functions (CSMF and DSMF, respectively) derived from the U-Net–predicted mass maps with those obtained from lensing-based mass maps. The lower panels in both plots show the relative ratios between lensing-derived and U-Net–based subhalo mass functions. Subhalos in both lensing- and U-Net–predicted mass maps are identified using a peak-finding algorithm [Srivastava et al., in prep] that detects local maxima in a background-subtracted map with the subhalo masses are calculated using simulation-calibrated radii. Note that the central galaxy is excluded in the identification. Detailed documentation regarding the algorithmic and technical implementation of the subhalo identification procedure is available in Appendix Section D.

Figure 11. Cumulative (top) and differential (bottom) subhalo mass functions (CSMF and DSMF) derived from the multi-encoder U-Net predictions and lensing-based LTM maps. Solid curves trace individual CLASH clusters with spectroscopic catalogs. The grey-shaded region spans the full scatter of The300 simulations, while the soft pink (U-Net) and light teal (LTM) shaded areas mark the 16th–84th percentile ranges across all 21 CLASH clusters. Median trends are denoted by solid lines with diamond markers and increased line width; the U-Net and LTM medians are computed over the full CLASH clusters, whereas the simulation median is calculated across the entire simulated dataset. Analytical power-law predictions calibrated from simulations are overplotted for comparison [29, 20, 34]. Lower panels display the logarithmic differences log⁡R=log⁡(LTM/U−Net)\log R = \log(\mathrm{LTM}/\mathrm{U-Net}). The vertical black dotted line indicates the subhalo mass resolution cutoff at 1.87×1011 M⊙1.87 \times10^{11}\,M_\odot determined from the simulation maps.

The gray shaded region indicates the CSMF and DSMF envelopes for the full The300 cluster sample, but from 2D mass maps. The median thick dotted lines for 3D results of The300 clusters are computed in the same way from the projected total mass maps, but simply using the subhalo masses from the corresponding AHF catalog. This provides us with a ground truth to compare against, on which these theoretical subhalo mass functions are based. Here, we use only one line-of-sight projection, and the subhalo selection using the AHF catalog is performed along the same line of sight. The peak detection algorithm recovers, on average, ∼97%\sim97\% of AHF subhalos with 1011 M⊙10^{11}\ M_{\odot}, evaluated across simulation maps from The300, using a matching radius 2 pixels. The relative differences between this algorithm and the 3D AHF results are explored further in Srivastava (in prep.) and are also discussed briefly in Appendix Section D.

From the CSMF(top panel) in Figure 11, we see that over the subhalo mass range of ∼1011\sim10^{11}–1012 M⊙10^{12}\ M_{\odot} for Abell 209, MACS J0416−2403, and RXJ 2248.7−4431, the U-Net predicts ∼×1.5\sim\times1.5–2 more subhalos, mostly at low masses. This is understandable because these low-mass subhalos can not create a deep enough potential to produce detectable lensing signals (Vegetti et al. [78]; Despali et al. [21]). As subhalo mass increases, the deviations tend to be smaller. While for the other two clusters, the two models are more-or-less consistent for MACS J1149+2223, but U-Net tends to have more massive subhalos at ≳1012M⊙\gtrsim10^{12}M_{\odot} for MACS J1206−0847. It is interesting to see that the statistical results from all CLASH clusters are well aligned between the two models all the way down to the vertical line, which indicates the resolution and detection limits. Both the lensing- and U-Net–derived CSMFs largely lie on the The300 upper envelope, which indicates that these observed clusters tend to be subhalo-rich compared with the median from the simulations.

The DSMFs (bottom panel) are noisier due to the limited number of subhaloes within the small sky coverage, exhibiting greater variation compared to the CSMFs. Nevertheless, the overall conclusions for the DSMFs are very similar to the CSMFs shown in the top-panel plot. Though the power spectra are much lower from the lensing results than the U-Net predictions, the abundance of subhalos in the intermediate mass range is higher for clusters: MACS J1149+2223, MACS J1206−0847 and RXJ 2248.7−4431. This is because these clusters have systematically higher mass maps, which yield relatively larger subhalo masses to push the DSMFs towards the right-hand side. Therefore, their DSMFs can be higher than those from the U-Net results.

It is interesting to verify these results with theoretical predictions from numerical simulations (Giocoli et al. [34]; Gao et al. [29]; De Lucia et al. [20]) in the lower panel of Figure 11. The DSMFs from both methods follow a clear power-law trend, with a mean logarithmic slope of ⟨α⟩=−0.91\langle\alpha\rangle=-0.91 and a standard deviation of 0.13 across the five CLASH clusters with spectroscopic catalogs. Similar values are obtained both from the LTM models maps and by using all CLASH clusters. This is in line with predictions from numerical simulations, such as Giocoli et al. [34], which report a slope of ∼0.9\sim0.9, as well as earlier theoretical results from Gao et al. [29] (α=−0.91\alpha=-0.91) and De Lucia et al. [20] (α=−0.94\alpha=-0.94), as compiled by Van Den Bosch et al. [77]. Furthermore, these lines also have a similar normalization to the literature results. Note that these subhalos are derived from a limited 500×\times500 kpc2^{2} field of view; as such, it is not surprising to see the 3D DSMF line is below the other simulation results. Therefore, the normalization agreement is possibly due to two major reasons: (1) as subhalos are mostly concentrated in the cluster central region, and the large simulation depth along the line of sight (10×R500c10\times R_{500c}) compensates for the

@references”】【 small projected area; (2)as presented in the previous paragraph – these observed clusters tend to be more massive and subhalo-rich compared with the median from the simulations. While the normalization and abundance exhibit some variation across the observed clusters, the subhalo mass functions show broad consistency with predictions from numerical simulations, particularly in their power-law behaviour. These results provide encouraging observational evidence supporting the power-law form of the subhalo mass function in galaxy clusters.

Conclusions

In this work, we apply—and, for the first time, validate on real data—the deep-learning technique proposed in de Andres et al. [19] as an alternative to gravitational–lensing–based reconstructions of the projected total mass in galaxy clusters. Using U-Net–based architectures trained on mock HST-like observations generated from The Three Hundred (The300) simulation suite, we reconstruct mass maps for 21 CLASH clusters spanning a broad range of masses and redshifts. These predicted maps not only reproduce the observed mass distributions and morphologies, but also agree quantitatively with independent gravitational-lensing and X-ray analysis of density profiles and power spectra. This consistency indicates that the models learn robust correlations between the observed luminosity fields and the underlying projected total mass of the clusters.

Beyond global mass reconstruction, the predicted maps enable a systematic study of cluster substructure. Although subhalos are a well-established prediction of structure-formation simulations, confirming their abundance and internal properties observationally remains challenging. From the subhalo mass functions of the observed clusters derived using both methods, we find that the observed distributions broadly follow the power-law behaviour predicted by numerical simulations. Although some differences in normalization and cluster-to-cluster variation remain, the agreement in their overall slopes shows that the reconstructed mass maps can recover the expected statistical properties of cluster subhalos.

Using galaxy–galaxy lensing, Meneghetti et al. [52] reported a significant discrepancy between simulated and observed subhalo properties. This is further verified by Natarajan et al. [58], which found that the inner density profiles and radial distributions of subhalos are strongly discrepant with CDM by nearly an order of magnitude. Our approach provides an independent, image-based route to identify subhalos directly from observations and, in particular, increases sensitivity to lower-mass subhalos relative to standard lensing reconstructions, which will allow us to address these questions statistically for different subhalo masses.

Beyond subhalos characterization, the reconstructed cluster mass maps may also provide an opportunity to investigate the asphericity of galaxy clusters. Galaxy clusters generally exhibit triaxiality rather than spherical mass distributions, and their projected shapes depend on their orientation relative to the line of sight ([14, 48]). This is particularly relevant for gravitational lensing, since the orientation of a cluster along the line of sight can affect its projected mass distribution and introduce biases in lensing-based mass estimates ([32]). In particular, the reconstructed two-dimensional mass maps could also be possibly used to investigate the projected shapes of clusters and potentially constrain their three-dimensional geometry and line-of-sight elongation. While these investigations are beyond the scope of the present work, they represent a promising direction for future applications of our deep learning mass reconstruction framework.

We also acknowledge the potential systematic differences introduced by domain shift, as our U-Net is trained exclusively on mock observations of The300 clusters and then applied to real HST data. These differences can arise from several sources: (a) the stellar populations, as mocks are based on a single SSP model with a Chabrier IMF applied to Simba star particles, whereas real galaxies may have different star formation histories; (b) the baryonic physics in the Simba model, as also indicated by the TNG test in Appendix B, particularly in the central regions; (c) instrumental modelling, since the adopted PSF models and noise maps may not fully capture the systematics of the real HST observations; and (d) imperfect non-member masking, particularly for the 16 clusters with only photometric redshifts. Another main source of systematic uncertainty is the line-of-sight depth used to build the training data. Both the mock HST maps and the target mass maps integrate over a depth of ±5R500c\pm5R_{500c}, which is shorter than the line-of-sight distance corresponding to the velocity cut of 3000 km s−13000\ \mathrm{km\,s^{-1}} (approximately ±40 Mpc\pm40\ \mathrm{Mpc} at low redshift). This difference may lead to the exclusion of foreground and background structures that would contribute to the projected mass distribution in real observations. These effects may bias the reconstructed masses, mainly at large radii. Future work should investigate both sources of systematics using different simulation suites, alternative stellar and baryonic models, larger or variable projection depths, and domain-adaptation techniques.

This study is a first step toward applying simulation-based inference to observational imaging at scale. Beyond speed and scale, our framework offers several practical advantages. It delivers non-parametric mass reconstructions that capture complex, merger-driven morphologies without adopting fixed halo profiles, and it can operate with photometry alone, providing useful mass proxies even where shear measurements are unavailable or low-S/N. The framework can be easily extended to forthcoming surveys (e.g., Euclid, CSST, LSST) and deployed to process large datasets with near-real-time inference, offering a powerful complement to traditional lensing pipelines. The approach can also naturally extended to multi-wavelength fusion (optical/IR, X-ray, SZ), as has been done in de Andres et al. [19], providing complementary constraints with distinct systematics. Consequently, it enables the probing of more detailed information at smaller scales than traditional methods allow.

Acknowledgements. AS, WC, DdA and GY thank financial support by the Agencia Estatal de Investigación (AEI, Spain) under project PID2024-156100NB-C21, funded by MCIN/AEI/10.13039/501100011033. AS and WC are also supported by the Atracción de Talento Contract no. 2020-T1/TIC-19882 granted by the Comunidad de Madrid in Spain. WC would like to further thank Agencia Estatal de Investigación (AEI) for the Consolidación Investigadora Grant CNS2024-154838. MM was supported by INAF Grants “The Big-Data era of cluster lensing” and “Probing Dark Matter and Galaxy Formation in Galaxy Clusters through Strong Gravitational Lensing”, and ASI Grant n. 2024-10-HH.0 “Attività scientifiche per la missione Euclid – fase E”. The work presented here emerged out of the The300 collaboration, partially funded by the ’Ayuda para la Organización de Jornadas Científicas en la UAM en el Marco del Programa Propio de Investigación y con el Apoyo del Consejo Social de la UAM’. The authors acknowledge the Red Española de Supercomputación for granting computing time for running the hydrodynamic simulations of The300 galaxy cluster project in the Marenostrum supercomputer at the Barcelona Supercomputing Centre.

Preprocessing of CLASH HST observations and convergence maps

In Table A.1, we give all the CLASH clusters with their corresponding redshift and mass M500cM_{500c}5 based on Merten et al. [55]. These masses were derived with the SaWLens (Merten et al. [54]) code, which consistently combines weak and strong lensing in a non-parametric fashion on adaptively refined grids. We analyzed 21 clusters out of the 25 CLASH clusters for mass maps prediction using different U-Net models, see Table A.1 for details. For five of these CLASH clusters—namely Abell 209, MACS J0416−2403, MACS J1149+2223, MACS J1206−0847, and RXJ 2248.7−4431—the corresponding CLASH-VLT spectroscopic catalogs are available and are used to identify cluster membership based on spectroscopic redshifts. This identification step is required before applying the U-Net models to real CLASH HST observations, in order to replace the pixel values of point sources and non-cluster members with a background estimate.

IDCluster NameRedshift (zz)M500cM_{500c} (1014 M⊙/h10^{14}\,M_\odot/h)Used
1Abell 2090.2066.27✓
2Abell 3830.1886.12✓
3Abell 14230.213–×
4Abell 6110.2885.70✓
5Abell 22610.2259.48✓
6MACS J0329−020.4505.05✓
7MACS J0416−24030.4204.33✓
8MACS J0429−020.3995.32✓
9MACS J0647+700.5846.42✓
10MACS J0717+370.5489.68✓
11MACS J1115+010.3525.43✓
12MACS J1149+22230.5447.06✓
13MACS J1206−08470.4396.05✓
14MACS J1311−030.4943.20✓
15MACS J2129−070.570–×
16MACS J1423+240.5454.09✓
17MACS J1720+350.3915.29✓
18MACS J1931−260.3524.50✓
19MACS J0744+390.6864.88×
20MS 2137.3−23530.3136.79✓
21RXJ 1347−11450.4517.97✓
22RXJ 1532.9+30210.3453.44✓
23RXJ 2129+00050.2344.30✓
24RXJ 2248.7−44310.3487.66✓
25CL J1226+33320.89010.80×

Table A.1. The CLASH cluster sample with their redshifts and M500cM_{500c} masses estimated from lensing (Merten et al. [55]). We excluded four clusters (MACS J2129−07, Abell 1423, MACS J0744+39, and CL J1226+3332) due to limited analysis data or redshifts falling outside our restricted range (0.152<z<0.6070.152 < z < 0.607). Bold entries indicate clusters with spectroscopic redshift catalogs discussed in Section Results.

Membership for CLASH clusters with spectroscopic redshift catalog was assigned using a velocity-based selection criterion,

Δv=c∣zspec−zcl1+zcl∣≤3000 km s−1,(4)\Delta v = c \left|\frac{z_{\mathrm{spec}} - z_{\mathrm{cl}}}{1+z_{\mathrm{cl}}}\right| \leq3000\ \mathrm{km\,s^{-1}}, \tag*{(4)}

where zspecz_{\mathrm{spec}} is the spectroscopic redshift from the catalog and zclz_{\mathrm{cl}} is the cluster redshift. The identified cluster non-members (i.e. those satisfying Δv>3000 km s−1\Delta v > 3000\ \mathrm{km\,s^{-1}}) were cross-matched with the CLASH HST photometric-redshift (BPZ) catalog. Point sources were also identified using the same CLASH HST photometric-redshift catalog, for which we required a stellarity index ≥0.1\geq0.1. The circular aperture for each cluster non-member and point source was determined from the catalog isophotal aperture area.

Bright foreground sources with strong diffraction spikes that were not captured by the catalog were added manually. We generated a circular-region record file containing the pixel coordinates and masking radii corresponding to each identified cluster non-member, foreground contamination and point source. This region file was then used to mask these regions and replace the overlapping pixels with a synthetic background estimate. During masking, each radius was scaled by a factor of 1.5 to remove extended faint light and diffraction features.

We used Photutils (Bradley et al. [10]) to construct a two-dimensional background model for each HST image. A 2.5σ2.5\sigma iterative sigma-clipping procedure with a 50×5050 \times50 pixel box size was employed to estimate the local median background and the corresponding background RMS. After estimating the background statistics, we iterated over each object in the region file and replaced the pixel values within its masking aperture with the local background-model value at that pixel position plus Gaussian noise drawn from the local background RMS.

For the remaining 16 clusters, for which CLASH-VLT spectroscopic catalogs are not available, we rely on just using the CLASH HST photometric-redshift (BPZ) catalog. For these clusters, cluster membership is assigned to objects whose photometric redshifts lie within 3σ3\sigma of the cluster redshift, where the 1σ1\sigma photometric-redshift uncertainty is given by 0.04(1+zobject)0.04(1+z_{\mathrm{object}}) (Jouvel et al. [40]; Burke et al. [12]). This corresponds to the condition ∣zb−zc∣<3×0.04(1+zb)\lvert z_b-z_c\rvert< 3 \times0.04(1+z_b), where zcz_c is the cluster redshift and zbz_b is the photometric redshift of the object. The point-source identification criteria for these clusters are the same as for the five clusters with spectroscopic coverage. The masking and background-replacement procedure also remains unchanged.

The U-Net models were trained on mock HST observations of the 3000 simulated clusters as inputs, with the corresponding projected mass maps as targets. To apply these models to real CLASH observations, the HST data must be converted into units consistent with those used in the simulations. The CLASH images, originally provided in count rates, were converted into observer-frame luminosities (in erg s−1\mathrm{erg\,s^{-1}}) using PHOTFLAM—the inverse-sensitivity calibration factor for each instrument/filter—together with the corresponding filter bandwidth and the luminosity distance computed at the cluster redshift assuming a Planck cosmology. These luminosity maps were then cropped to a 500×500 kpc2500 \times500\ \mathrm{kpc}^{2} field of view centered on the cluster’s optical center and down-sampled to 128×128128 \times128 pixels, matching the format of the simulated HST maps used during training.

To compare the projected mass maps inferred using our U-Net models with an independent observational estimate, we used lensing and X-ray-based mass measurements of the CLASH clusters. For lensing-based mass estimates, the CLASH survey provides convergence (κ\kappa) maps derived from joint strong and weak lensing analysis based on Zitrin et al. [86]. They provide two different mass-model parametrization: (i) a light-traces-mass (LTM) model and (ii) a pseudo-isothermal elliptical mass distribution combined with an elliptical NFW halo (PIEMD+eNFW). We adopt the LTM models for comparison, as their underlying assumption—that the total matter distribution traces the observed light—is more closely aligned with ours. For further details between the two models, as well as their latest result, [7], we refer interested readers to their papers.

In the LTM framework, each cluster galaxy is assigned a power-law surface density profile scaled by its luminosity; these are summed and smoothed with a Gaussian kernel to represent the diffuse dark-matter component. The galaxy and dark-matter components are then combined with a relative weighting factor to generate a continuous projected mass distribution. To compare the LTM outputs with our U-Net predictions, we converted the κ\kappa maps into physical projected mass maps using

Σ [M⊙]=κ×Σcrit×Apix,(5)\Sigma\ [M_{\odot}] = \kappa\times\Sigma_{\mathrm{crit}} \times A_{\mathrm{pix}}, \tag*{(5)}

where Σcrit\Sigma_{\mathrm{crit}} is the critical surface density,

Σcrit=c24πGDSDLDLS,(6)\Sigma_{\mathrm{crit}} = \frac{c^2}{4\pi G}\frac{D_{\mathrm{S}}}{D_{\mathrm{L}}D_{\mathrm{LS}}}, \tag*{(6)}

expressed in M⊙ Mpc−2M_{\odot}\ \mathrm{Mpc}^{-2}, with angular-diameter distances DLD_{\mathrm{L}}, DSD_{\mathrm{S}}, and DLSD_{\mathrm{LS}} computed for the lens and source redshifts. Finally, the pixel area ApixA_{\mathrm{pix}} is obtained by converting the HST pixel scale of 0.0650.065 arcsec pixel−1^{-1} into physical units using the cluster redshift and Planck cosmology, yielding Mpc2\mathrm{Mpc}^{2} per pixel.

Performance validation with TNG-Clusters

We further evaluate the U-Net models by applying them to an independent set of simulated galaxy clusters drawn from the TNG-Cluster simulation suite ([60]), which differs from The300 in terms of numerical implementation, resolution, and baryonic physics model. This provides a test of the U-Nets’ ability to generalize the prediction of projected mass maps across different simulations, and as such, it can be applicable to real observations. TNG-Cluster consists of 352 high-resolution zoom-in simulations of massive galaxy clusters (M200c≳1014.5 M⊙M_{200\mathrm{c}} \gtrsim10^{14.5}\ M_{\odot}), selected from a 1 Gpc31\ \mathrm{Gpc}^{3} parent volume and evolved with the AREPO code (Springel [75]). The simulations adopt the IllustrisTNG galaxy formation model (Pillepich et al. [65]) and a Planck-consistent Λ\LambdaCDM cosmology (Planck Collaboration 2016), same as The300, with mass and spatial resolutions comparable to the highest-resolution TNG300 realization. Specifically, the baryonic and dark-matter particle masses are mbar≃1.1×107M⊙m_{\mathrm{bar}} \simeq1.1 \times10^{7}M_{\odot} and mDM≃6.1×107M⊙m_{\mathrm{DM}} \simeq6.1 \times10^{7}M_{\odot}, respectively, with a gravitational softening length of ∼1.5\sim1.5 kpc at z=0z = 0 for collisionless components. From the TNG-clusters simulation dataset, we select a subset of 42 clusters covering z≃0.2z \simeq0.2–0.50.5 and M200c∼(3M_{200\mathrm{c}} \sim(3–10)×1014 M⊙10) \times10^{14}\ M_{\odot}, matching the mass and redshift range of the CLASH sample. For each cluster, mock observations in different HST filters and the corresponding projected total mass maps were generated along a single line of sight and a field of view of 500×500 kpc2500 \times500\ \mathrm{kpc}^{2} using the same pipeline adopted for The300 clusters (see, § 3). As the TNG clusters were not used during training, this sample enables a direct assessment of the U-Net models’ ability to generalize across simulations when reconstructing projected mass maps.

In Fig. B.1, we show a typical example cluster from the TNG simulation suite. Top panel of Fig. B.1 presents the true projected mass map together with the corresponding HST-like luminosity maps in different filters, while the middle panel Fig. B.1 shows the projected mass reconstructions obtained with the U-Net models trained on the The300 simulations. The models successfully recover the overall morphology of the cluster and many of the small-scale features of the projected mass distribution. The corresponding residual maps are shown in bottom panel of Fig. B.1.

Figure B.1. Cross-simulation generalization to TNG clusters. Example reconstruction for a TNG cluster omitted from the training phase. The top panel displays the true projected mass distribution alongside the corresponding mock HST luminosity maps across multiple filters. The middle panel shows the projected mass maps predicted by U-Net models trained exclusively on The300 simulations, and the bottom panel displays the corresponding pixel-wise relative error residuals. All subplots share an identical field of view.

Although the models recover the small-scale features, the residual plots indicate that the amplitudes (or masses) associated with these features are either overestimated or underestimated, implying a bias in the reconstructed projected mass maps.

We compare the surface mass density radial profiles and power spectra in Fig. B.2 to quantify the performance of the projected mass maps across all 42 clusters in the TNG sample. The median predicted surface mass density profiles agree well with the true profiles at intermediate and large radii, but show noticeable discrepancies in the innermost regions. These central differences likely reflect variations in the modeling of central galaxies between the two simulation suites, the The300 and TNG. Since the U-Net models are trained on The300, they are naturally better tuned to reproduce the properties of central galaxies as represented in that simulation framework. Outside the central regions, however, the azimuthally averaged projected mass profiles are in significantly better agreement and remain robust across the two simulations. The scatter, quantified by the 16th–84th percentile range, is comparable to that of the ground-truth profiles, indicating stable performance and minimal bias introduced by applying the model across simulations. A similar trend is seen in the power spectra shown in Fig. B.2, consistent with the results found for the The300 test sample. For the TNG clusters, the power spectra of the ground-truth and U-Net reconstructed mass maps are consistent on large scales across all U-Net models, as also seen for the The300 test set. On smaller scales, however, the reconstructed power spectra decline more rapidly and diverge from the ground truth. Overall, we can again infer that the multi-encoder U-Net model performs the best compared to the single filter and multi-channel models.

Generalization performance of U-Net models trained on The300 simulations when applied to TNG cluster mass maps

Figure B.2. Generalization performance of U-Net models trained on The300 simulations when applied to TNG cluster mass maps. The top panel displays the surface mass density radial profiles, and the bottom panel shows the mass map power spectra. In both panels, black lines correspond to the true median, red lines indicate predicted median values, and shaded areas represent the 16th–84th percentile scatter across the TNG cluster sample. Sub-plots compare individual U-Net architectures. In the radial profile plots, the vertical red and black dotted lines indicate the spatial resolutions of the TNG (≈1.48\approx1.48 kpc) and The300 (≈6.5\approx6.5 kpc) simulations, respectively. In the power spectrum plots, the vertical black dotted line at k≈0.8k \approx0.8 kpc−1^{-1} (λ≈7.85\lambda\approx7.85 kpc) denotes the Nyquist limit imposed by the 128×128128 \times128 pixel grids.

Figure B.3. Overall mass map reconstruction accuracy for TNG clusters. The top panel compares the total projected mass predicted by the U-Net models against the true values across the full TNG test dataset; the dashed line indicates the ideal 1:1 relation, and contours represent the kernel density estimation (KDE). The bottom panel displays the distribution of pixel-wise relative errors for the same sample, with the legend indicating the mean relative error and ±1σ\pm1\sigma standard deviation for each model.

In Fig. B.3, we assess the global reconstruction accuracy of the U-Net models when applied to the TNG cluster sample. Fig. B.3 upper panel compares the total projected mass within the field of view predicted by each model with the corresponding true values from the TNG simulations. Overall, the predictions follow the ideal one-to-one relation with slightly larger scatter compared to the The300 test set results, possibly due to domain shift. To further quantify the reconstruction quality, we perform a pixel-wise statistical analysis of the relative residuals, shown in

Fig. B.3 lower panel. The resulting distributions indicate a ±1σ\pm1\sigma scatter in the ∼19\sim19–22%22\% level, comparable to that obtained in the The300 simulation test set analysis. These results demonstrate that the U-Net models retain robust predictive performance when applied to an independent simulation suite with different underlying physics and galaxy populations.

Impact of Preprocessing on Model Performance

For the main text analysis, we apply a signed logarithmic transform (Eq. 2) to the luminosity maps and a standard logarithmic transform (Eq. 3) to the mass maps, followed by standardization using training set statistics. To assess the impact of these preprocessing schemes on model performance, we also explored two other alternative methods and compare all three using the multi-encoder model.

In the second strategy, negative luminosity values are discarded rather than sign-transformed. The luminosity maps are log-transformed only where the signal is positive,

x~={log⁡10(x)x>0,0x≤0,(7)\tilde{x} = \begin{cases} \log_{10}(x) & x > 0, \\ 0 & x \leq0, \end{cases} \tag*{(7)}

and a binary mask describing the locations of valid pixels,

M={1x>0,0x≤0,(8)\mathcal{M} = \begin{cases} 1 & x > 0, \\ 0 & x \leq0, \end{cases} \tag*{(8)}

is concatenated as a second input channel with the luminosity map. Since invalid pixels are already set to zero in the log-transformed map, it provides a direct binary signal of pixel validity rather than requiring the network to infer invalid regions. The mass maps are transformed identically to the main text. No standardization is applied for this method.

In the third method, rather than zeroing invalid pixels, non-positive values are assigned a fixed very low negative value in log space,

x~={log⁡10(x)x>0,−10x≤0,(9)\tilde{x} = \begin{cases} \log_{10}(x) & x > 0, \\ -10 & x \le0, \end{cases} \tag*{(9)}

with the same transform applied to both luminosity and mass maps. The floor value of −10-10 lies well below the typical range of the log-transformed observed luminosity signal. Again, no standardization is applied for this method.

The three schemes therefore differ in two key respects: how much information they preserve about negative pixels, and how they signal pixel validity to the network. The signed logarithm is the only method that retains the magnitude of negative luminosity values as physically meaningful signal, while the masked and floor-clipped variants treat them as missing data. The additional standardization applied in the first method further distinguishes it from the two methods explored here.

Fig. C.1 compares the performance of the multi-encoder U-Net trained with the three luminosity map preprocessing schemes, evaluated on the full test set. The comparison is based on three metrics: the relative error between the true and predicted surface mass density, the azimuthally averaged surface mass density profile, and the power spectrum. While all three preprocessing methods yield broadly consistent results in terms of the relative error and the surface mass density profile, the signed logarithmic transform produces power spectra that are most consistent with the test set median and its percentile distribution, recovering small-scale structure more faithfully than the masked or floor-clipped variants. This motivates our choice of the signed logarithmic transform as the default preprocessing scheme in the main analysis.

Figure C.1. Comparison of the three luminosity map preprocessing schemes-signed logarithmic transform (main text), masked logarithm, and floor-clipped logarithm — evaluated on the full test set using the multi-encoder U-Net. First Panel: relative error between the true and predicted surface mass density maps Second Panel: azimuthally averaged surface mass density profile. Third Panel: power spectrum of the predicted maps compared to the ground truth.

Substructures identification and mass estimation

For the subhalo statistics study using mass maps derived from lensing and U-Net models for the CLASH clusters, we developed a subhalo identification and mass estimation algorithm. The aim is to identify subhalos directly from the mass maps and to define a criterion for assigning an adaptive aperture for their two-dimensional mass estimation.

We begin by first addressing the problem of aperture estimation for subhalos when their locations are known a priori. For this, we used the available AHF halo catalog from the The300 simulation. We considered the training-set mass maps constructed with the line of sight along the ZZ-axis, and applied the same selection to the AHF catalog used in generating the projected mass maps along this direction, in order to identify the corresponding subhalos in the maps. We selected all subhalos gravitationally bound to the main host halo within the field of view, along with any additional objects falling within the same projected mass field of view and line-of-sight depth, in order to account for projected structures along the line of sight.

Adaptive Aperture algorithm for Substructures

For an identified subhalo with peak position pi=(xi,yi)p_i=(x_i,y_i) in the two-dimensional mass map, we define an adaptive aperture radius Ri,apR_{i,\mathrm{ap}} centered on the peak. The aperture is calculated to scale with the relative prominence of the peak while also account for both local background variations and spatial distribution of neighboring subhalos.

We define a reference surface density at each peak as a weighted combination of a local background estimate and a global mean over all peaks,

Mi,ref=wMi,local+(1−w)Mˉsub,(10)M_{i,\mathrm{ref}} = wM_{i,\mathrm{local}} + (1-w)\bar{M}_{\mathrm{sub}}, \tag*{(10)}

where Mi,localM_{i,\mathrm{local}} is the local background surface density around the peak, Mˉsub\bar{M}_{\mathrm{sub}} is the mean surface density evaluated at all peak locations, and we adopt a fixed weight w=0.5w=0.5. The aperture scale is defined as

Ri,phys=α(Mi,peakMi,ref)γdnn2,(11)R_{i,\mathrm{phys}} = \alpha\left(\frac{M_{i,\mathrm{peak}}}{M_{i,\mathrm{ref}}}\right)^\gamma\frac{d_{\mathrm{nn}}}{2}, \tag*{(11)}

where Mi,peakM_{i,\mathrm{peak}} is the projected surface density at the peak and dnnd_{\mathrm{nn}} is the distance to the nearest neighboring peak. To avoid non-physical small apertures, we introduce a smooth minimum scale RβR_{\beta}, such that the final aperture radius is given by

Ri,ap={Ri,phys2+Rβ2,if Ri,phys<Rβ,Ri,phys,otherwise.(12)R_{i,\mathrm{ap}} = \begin{cases} \sqrt{R_{i,\mathrm{phys}}^{2}+R_{\beta}^{2}}, & \text{if } R_{i,\mathrm{phys}} < R_{\beta},\\ R_{i,\mathrm{phys}}, & \text{otherwise.} \end{cases} \tag*{(12)}

The above procedure that subhalos in dense environments are assigned apertures relative to their local background, while also controlling excessive overlap through the dependence on the nearest-neighbor distance. The parameter γ\gamma controls the sensitivity of the aperture size to the peak contrast, and RβR_{\beta} acts as a regularizer. The enclosed mass is computed by integrating the surface density within a circular aperture of radius Ri,apR_{i,\mathrm{ap}}. To achieve subpixel accuracy, the mass map is interpolated onto a high-resolution grid within the aperture using interpolation, and the integral is evaluated numerically over the selected pixels. The free parameters {α,γ,Rβ}\{\alpha,\gamma,R_{\beta}\} are calibrated on a training set of 500 simulated cluster mass maps drawn from the full sample of 3273 clusters. We employ a Bayesian optimization scheme to determine the parameter combination that best reproduces the known three-dimensional subhalo masses M500cM_{500c} from the AHF catalog, by jointly matching the differential and cumulative subhalo mass functions. This procedure yields the parameters values α=0.21\alpha= 0.21, γ=1.2\gamma= 1.2, and Rβ=0.95R_{\beta} = 0.95.

The performance of the adaptive aperture algorithm is illustrated in Fig. D.1, where we validate the method using a subset of 1200 cluster mass maps drawn from the The300 simulation, under the assumption that the true subhalo positions are known a priori from the AHF catalog. In the top panels, we present a visual representation of the method, showing two representative projected mass maps with the corresponding adaptive apertures overlaid. In the lower panels, we compare the subhalo mass functions derived from the two-dimensional aperture masses with those obtained from the three-dimensional AHF catalog. The cumulative and differential subhalo mass functions are shown, with shaded regions indicating the 16th–84th percentile range across the full sample, and solid lines representing the median relations. We find good agreement between the two mass functions, particularly at the massive end, in both shape and normalization. This demonstrates that the calibrated aperture prescription successfully recovers the underlying subhalo mass function, indicating that the algorithm is well tuned.

Substructures Identification from Mass Maps

To identify substructures directly from projected mass maps, we developed a multistage substructure detection algorithm designed to robustly extract density peaks across range of spatial scales. The algorithm mainly uses the following three steps for making detection:

  1. Background estimation and standardization: We construct a radially varying background for each mass map in order to isolate local density fluctuations associated with potential substructures by removing the overall smooth cluster component. This is achieved using a combination of median filtering and Gaussian smoothing at different spatial scales. Specifically, we first apply two median filters: a fine-scale filter with a kernel size proportional to the base smoothing scale σ0\sigma_0, and a coarse-scale filter with twice this kernel size. Each of these maps is then smoothed with Gaussian kernels of widths σ0\sigma_0 and 1.5σ01.5\sigma_0, respectively. To account for radial variations in the cluster profile, the two background estimates are smoothly blended using a sigmoid weighting function, defined as wouter=1/(1+exp⁡[−(r−rmid)/rwidth])w_{\mathrm{outer}} = 1/(1+\exp[-(r-r_{\mathrm{mid}})/r_{\mathrm{width}}]). The spatial

Figure D.1. Validation of the adaptive aperture algorithm. Top: Projected mass maps with adaptive apertures (black circles) overlaid using a priori subhalo positions. Bottom-left: Cumulative subhalo mass function N(>M)N(>M) from 2D aperture masses (grey) and 3D AHF catalog masses (red). Bottom-right: Corresponding differential subhalo mass function. Envelopes and lines indicate the 16th–84th percentile range and medians across 3,273 simulated clusters.

radial scale rmidr_{\mathrm{mid}} and rwidthr_{\mathrm{width}} controls the transition from fine background near the center to a much coarser background at the outskirts for the mass map of the cluster. The final background is then given by Mbkg=(1−wouter)Minner+wouterMouterM_{\mathrm{bkg}} = (1-w_{\mathrm{outer}})M_{\mathrm{inner}} + w_{\mathrm{outer}}M_{\mathrm{outer}}. The resulting background is subtracted from the original mass map to produce a residual map that highlights local over-densities. This residual map is subsequently standardized by subtracting its mean and dividing by its 1σ1\sigma standard deviation, and is used as input for the peak detection stage.

  1. Multi-scale peak detection: For the next step, we employ a multiscale detection scheme on the background-subtracted and standardized map. The standardized map is smoothed at different spatial scales using a sequence of logarithmically spaced Gaussian kernels, defined as σs=σ0{s\sigma_s = \sigma_0\{s, where {=1.25\{ = 1.25 is the scale factor and ss denotes the smoothing step, ranging from 0 to 5. This results in a total of six smoothing scales used for substructure detection. Peaks are initially detected at the finest smoothing scale, i.e. at σ0\sigma_0, using a local maximum finder from skimage, with a minimum separation proportional to σ0\sigma_0 and an absolute detection threshold αdet\alpha_{\mathrm{det}}. The identified candidate peaks are then validated using the multiscale scheme. At each smoothing scale, the maximum value within a small neighborhood around each candidate peak is evaluated, allowing for slight positional drift. A peak is considered persistent at a given scale if its value remains above a fraction η\eta of its base-scale amplitude. We assign a score of +1+1 whenever this condition is satisfied. A candidate is accepted as a genuine detection only if it persists in at least 50% of the smoothing scales. The motivation for this multi-scale scheme is to retain genuine detections while rejecting spurious noise fluctuations, as true subhalo peaks persist across multiple smoothing scales, whereas noisy peaks

are washed out. The free parameters smoothing scale σ0\sigma_0, the detection threshold αdet\alpha_{\mathrm{det}}, and the persistence threshold η\eta, are constrained through calibration with the AHF catalog.

  1. Signal-to-noise (SNR) filtering: To further suppress spurious detections, we compute a local SNR ratio for each candidate peak. The noise is estimated from an annular region centered on the peak, with inner and outer radii adapted to the distance to the nearest neighboring peak in order to avoid contamination from nearby structures. Specifically, the noise is estimated as 1.4826 × the median absolute deviation within the annulus, and the SNR was computed using this noise, mass at the peak value and mass within the annular region. A potential substructure is retained if it satisfies the aforementioned persistence criterion and minimum SNR threshold of αsnr\alpha_{\mathrm{snr}}. The final output of the algorithm is the set of detected substructures position in the two-dimensional mass map.

The hyperparameters {σ0,αdet,η,αsnr}\{\sigma_0, \alpha_{\mathrm{det}}, \eta, \alpha_{\mathrm{snr}}\} are optimized using simulated cluster mass maps, where the true substructures (halos) are taken from the AHF catalog. We use Hyperopt with Bayesian optimization (TPE algorithm) to explore the parameter space. For each set of parameters, the detection algorithm is run on the small sample of pre-selected mass maps, and the predicted subhalos are compared with the AHF halos. The performance is evaluated using a combined loss that includes agreement with the true mass function (dN/dlog⁡MdN/d\log M), along with precision and recall. The optimizer then tries new parameter values, focusing more on those that give lower loss. In this way, the algorithm is tuned to recover both the correct number of subhalos and their positions as given by AHF. The Bayesian optimization constrained these hyper-parameters values to σ0=0.75\sigma_0 = 0.75, αdet=1.01\alpha_{\mathrm{det}} = 1.01, η=0.32\eta= 0.32, and αsnr=1.90..\alpha_{\mathrm{snr}} = 1.90..These parameters balance completeness and precision in the detected subhalo population.

When this hyper-parameter peak detection algorithm is evaluated on 2000 randomly selected maps from the The300 sample, it results in a median recall of 0.750 ± 0.149 and a median precision of 0.881 ± 0.102. The recall measures the fraction of true AHF subhalo peaks that are successfully recovered, while precision quantifies the fraction of detected peaks that correspond to genuine subhalos. This implies that approximately 25 per cent of the true subhalo peaks are missed by the algorithm, while about 12 per cent of the detections are false positives. Restricting to subhalos above the resolution limit of 1011 M⊙10^{11}\,M_{\odot}, the algorithm achieves an average completeness of 0.952 ± 0.060, requiring detections to lie within 2 pixels (≈ 8 kpc) of the true AHF positions. Overall, this demonstrates that the calibrated peak detection algorithm reliably recovers the underlying subhalo population, particularly at the high-mass end, and supports its application to both simulated data and observed CLASH cluster mass maps.

Fig. D.2 presents the performance of the calibrated peak detection algorithm evaluated on the full The300 simulation sample. The top panels show two representative projected mass maps, with the true AHF subhalo positions and the algorithm-detected peaks overlaid. The algorithm successfully recovers the majority of true subhalo locations, with only a small number of missed detections and false positives, mainly in the dense central regions. The bottom panels show the cumulative and differential subhalo mass functions derived from the aperture masses of the detected peaks (Algo-2D) and the true AHF peaks (AHF-2D), shown as the median and 16th–84th percentile range across the full sample. The two mass functions are in good agreement in both shape and normalization, with the median line lying within

Figure D.2. Subhalo peak detection algorithm performance. Top: Projected mass maps with true AHF subhalo positions (black circles) and algorithm-detected peaks (gold stars). The algorithm recovers most true subhalos, including outskirt substructures, with minimal false positives or missed detections. Bottom-left: Cumulative subhalo mass function from aperture masses of algorithm-detected peaks (black, Algo-2D) and true AHF peaks (red, AHF-2D). Bottom-right: Corresponding differential subhalo mass function. Envelopes and lines indicate the 16th–84th percentile range and medians across the full sample.

Substructures in CLASH sample

Figure D.3. Substructures in CLASH sample. Projected mass maps of the five CLASH clusters with spectroscopic redshift catalogs, with identified subhalo peaks and their adaptive apertures overlaid as white circles. The upper panels show the lensing-derived mass maps and the lower panels show the corresponding U-Net-predicted mass maps. The radius of each identified substructure is given by (Eq. D.3).

scatter over the full subhalos mass range. In Fig. D.3, we show the identified substructures and their apertures in the lensing maps (top panel) and the multi-encoder U-Net predicted maps (bottom panel) for the five main CLASH clusters discussed in Section 6 of the main manuscript.

References

  1. [1]Adam, R., Comis, B., Macías-Pérez, J.-F., et al. 2015, Astronomy & Astrophysics, 576, A12
  2. [2]Ade, P., Aghanim, N., Arnaud, M., et al. 2016, Astronomy & Astrophysics, 594, A24
  3. [3]Aguado-Barahona, A., Rubiño-Martín, J., Ferragamo, A., et al. 2022, Astronomy & Astrophysics, 659, A126
  4. [4]Ait Ouahmed, R., Arnouts, S., Pasquet, J., Treyer, M., & Bertin, E. 2024, Astronomy & Astrophysics, 683, A26
  5. [5]Bahé, Y. M., McCarthy, I. G., & King, L. J. 2012, Monthly Notices of the Royal Astronomical Society, 421, 1073
  6. [6]Bartelmann, M. & Schneider, P. 2001, Physics Reports, 340, 291
  7. [7]Bergamini, P., Acebron, A., Grillo, C., et al. 2023, The Astrophysical Journal, 952, 84
  8. [8]Biffi, V., Borgani, S., Murante, G., et al. 2016, The Astrophysical Journal, 827, 112
  9. [9]Biviano, A. & Girardi, M. 2003, The Astrophysical Journal, 585, 205
  10. [10]Bradley, L., Sipocz, B., Robitaille, T., et al. 2016, Astrophysics Source Code Library, ascl
  11. [11]Bruzual, G. & Charlot, S. 2003, Monthly Notices of the Royal Astronomical Society, 344, 1000
  12. [12]Burke, C., Hilton, M., & Collins, C. 2015, Monthly Notices of the Royal Astronomical Society, 449, 2353
  13. [13]Chabrier, G. 2003, Publications of the Astronomical Society of the Pacific, 115, 763
  14. [14]Clowe, D., De Lucia, G., & King, L. 2004, Monthly Notices of the Royal Astronomical Society, 350, 1038
  15. [15]Cui, W., Dave, R., Knebe, A., et al. 2022, MNRAS, 514, 977
  16. [16]Cui, W., Knebe, A., Yepes, G., et al. 2018, Monthly Notices of the Royal Astronomical Society, 480, 2898
  17. [17]Davé, R., Anglés-Alcázar, D., Narayanan, D., et al. 2019, MNRAS, 486, 2827
  18. [18]de Andres, D., Cui, W., Ruppin, F., et al. 2022, Nature Astronomy, 6, 1325
  19. [19]de Andres, D., Cui, W., Yepes, G., et al. 2024, Monthly Notices of the Royal Astronomical Society, 528, 1517
  20. [20]De Lucia, G., Kauffmann, G., Springel, V., et al. 2004, Monthly Notices of the Royal Astronomical Society, 348, 333
  21. [21]Despali, G., Vegetti, S., White, S. D., et al. 2022, Monthly Notices of the Royal Astronomical Society, 510, 2480
  22. [22]Donahue, M., Voit, G. M., Mahdavi, A., et al. 2014, The Astrophysical Journal, 794, 136
  23. [23]Dumoulin, V., Perez, E., Schucher, N., et al. 2018, Distill, https://distill.pub/2018/feature-wise-transformations
  24. [24]Eckert, D., Ettori, S., Pointecouteau, E., van der Burg, R., & Loubser, S. 2022, Astronomy & Astrophysics, 662, A123
  25. [25]Ettori, S., Donnarumma, A., Pointecouteau, E., et al. 2013, Space Science Reviews, 177, 119
  26. [26]Ferragamo, A., de Andres, D., Sbriglio, A., et al. 2023, Monthly Notices of the Royal Astronomical Society, 520, 4000
  27. [27]Ferragamo, A., Rubiño-Martín, J., Betancort-Rijo, J., et al. 2020, Astronomy & Astrophysics, 641, A41
  28. [28]Fukugita, M., Hogan, C. J., & Peebles, P. J. E. 1998, The Astrophysical Journal, 503, 518
  29. [29]Gao, L., White, S. D., Jenkins, A., Stoehr, F., & Springel, V. 2004, Monthly Notices of the Royal Astronomical Society, 355, 819
  30. [30]Gianfagna, G., De Petris, M., Yepes, G., et al. 2021, Monthly Notices of the Royal Astronomical Society, 502, 5115
  31. [31]Giocoli, C., Despali, G., Meneghetti, M., et al. 2025, Astronomy & Astrophysics, 697, A184
  32. [32]Giocoli, C., Meneghetti, M., Metcalf, R. B., Ettori, S., & Moscadini, L. 2014, Monthly Notices of the Royal Astronomical Society, 440, 1899
  33. [33]Giocoli, C., Pieri, L., & Tormen, G. 2008, Monthly Notices of the Royal Astronomical Society, 387, 689
  34. [34]Giocoli, C., Tormen, G., Sheth, R. K., & Van Den Bosch, F. C. 2010, Monthly Notices of the Royal Astronomical Society, 404, 502
  35. [35]Herbonnet, R., Crawford, A., Avestruz, C., et al. 2022, Monthly Notices of the Royal Astronomical Society, 513, 2178
  36. [36]Hong, S. E., Park, S., Jee, M. J., Bak, D., & Cha, S. 2021, The Astrophysical Journal, 923, 266
  37. [37]Hsu, A., Ho, M., Lin, J., et al. 2025, The Open Journal of Astrophysics, 8, 92DOI
  38. [38]Ioffe, S. & Szegedy, C. 2015, in International conference on machine learning, pmlr, 448–456
  39. [39]Janulewicz, P. & Cui, W. 2025, RAS Techniques and Instruments, 4, rzaf027
  40. [40]Jouvel, S., Host, O., Lahav, O., et al. 2014, Astronomy & Astrophysics, 562, A86
  41. [41]Kaiser, N., Squires, G., & Broadhurst, T. 1994, arXiv preprint astro-ph/9411005
  42. [42]Kingma, D. P. & Ba, J. 2014, arXiv preprint arXiv:1412.6980
  43. [43]Klypin, A., Yepes, G., Gottlöber, S., Prada, F., & Hess, S. 2016, Monthly Notices of the Royal Astronomical Society, 457, 4340
  44. [44]Kneib, J.-P. & Natarajan, P. 2011, The Astronomy and Astrophysics Review, 19, 47
  45. [45]Knollmann, S. R. & Knebe, A. 2009, The Astrophysical Journal Supplement Series, 182, 608
  46. [46]Kodi Ramanah, D., Wojtak, R., Ansari, Z., Gall, C., & Hjorth, J. 2020, Monthly Notices of the Royal Astronomical Society, 499, 1985
  47. [47]Kravtsov, A. V. & Borgani, S. 2012, Annual Review of Astronomy and Astrophysics, 50, 353
  48. [48]Limousin, M., Morandi, A., Sereno, M., et al. 2013, Space Science Reviews, 177, 155
  49. [49]Mahdavi, A., Hoekstra, H., Babul, A., et al. 2007, The Astrophysical Journal, 664, 162
  50. [50]Mancone, C. L. & Gonzalez, A. H. 2012, Publications of the Astronomical Society of the Pacific, 124, 606
  51. [51]Mehrtens, N., Romer, A. K., Hilton, M., et al. 2012, Monthly Notices of the Royal Astronomical Society, 423, 1024
  52. [52]Meneghetti, M., Davoli, G., Bergamini, P., et al. 2020, Science, 369, 1347
  53. [53]Meneghetti, M., Rasia, E., Merten, J., et al. 2010, Astronomy & Astrophysics, 514, A93
  54. [54]Merten, J., Cacciato, M., Meneghetti, M., Mignone, C., & Bartelmann, M. 2009, Astronomy & Astrophysics, 500, 681
  55. [55]Merten, J., Meneghetti, M., Postman, M., et al. 2015, The Astrophysical Journal, 806, 4
  56. [56]Muñoz-Echeverría, M., Macías-Pérez, J., Artis, E., et al. 2024, Astronomy & Astrophysics, 682, A124
  57. [57]Nair, V. & Hinton, G. E. 2010, in Proceedings of the 27th international conference on machine learning (ICML-10), 807–814
  58. [58]Natarajan, P., Chiang, B. T., & Dutra, I. 2026, The Astrophysical Journal, 1001, L12
  59. [59]Nde, T. N., Wu, H.-Y., Cao, S., et al. 2025, arXiv preprint arXiv:2510.00753
  60. [60]Nelson, D., Pillepich, A., Ayromlou, M., et al. 2024, Astronomy & Astrophysics, 686, A157
  61. [61]Ntampaka, M., ZuHone, J., Eisenstein, D., et al. 2019, The Astrophysical Journal, 876, 82
  62. [62]Okabe, N. & Smith, G. P. 2016, Monthly Notices of the Royal Astronomical Society, 461, 3794
  63. [63]Old, L., Wojtak, R., Pearce, F., et al. 2018, Monthly Notices of the Royal Astronomical Society, 475, 853
  64. [64]Piffaretti, R. & Valdarnini, R. 2008, Astronomy & Astrophysics, 491, 71
  65. [65]Pillepich, A., Nelson, D., Hernquist, L., et al. 2018, Monthly Notices of the Royal Astronomical Society, 475, 648
  66. [68]Postman, M., Coe, D., Benitez, N., et al. 2012, The Astrophysical Journal Supplement Series, 199, 25
  67. [69]Pratt, G., Arnaud, M., Biviano, A., et al. 2019, Space Science Reviews, 215, 25
  68. [70]Ragagnin, A., Saro, A., Singh, P., & Dolag, K. 2021, Monthly Notices of the Royal Astronomical Society, 500, 5056
  69. [71]Rasia, E., Tormen, G., & Moscardini, L. 2004, Monthly Notices of the Royal Astronomical Society, 351, 237
  70. [72]Ronneberger, O., Fischer, P., & Brox, T. 2015, in International Conference on Medical image computing and computer-assisted intervention, Springer, 234–241
  71. [73]Rowe, B. T., Jarvis, M., Mandelbaum, R., et al. 2015, Astronomy and Computing, 10, 121
  72. [74]Saro, A., Mohr, J. J., Bazin, G., & Dolag, K. 2013, The Astrophysical Journal, 772, 47
  73. [75]Springel, V. 2010, Monthly Notices of the Royal Astronomical Society, 401, 791
  74. [76]Umetsu, K., Zitrin, A., Gruen, D., et al. 2016, The Astrophysical Journal, 821, 116
  75. [77]Van Den Bosch, F. C., Tormen, G., & Giocoli, C. 2005, Monthly Notices of the Royal Astronomical Society, 359, 1029
  76. [78]Vegetti, S., Koopmans, L., Bolton, A., Treu, T., & Gavazzi, R. 2010, Monthly Notices of the Royal Astronomical Society, 408, 1969
  77. [79]Vikhlinin, A., Kravtsov, A., Burenin, R., et al. 2009, The Astrophysical Journal, 692, 1060
  78. [80]Vikhlinin, A., Kravtsov, A., Forman, W., et al. 2006, The Astrophysical Journal, 640, 691
  79. [81]Villaescusa-Navarro, F. 2018, Pyllians: Python libraries for the analysis of numerical simulations, Astrophysics Source Code Library, record ascl:1811.008
  80. [82]White, S. D. M., Navarro, J. F., Evrard, A. E., & Frenk, C. S. 1993, Nature, 366, 429
  81. [84]Zhang, Z., Wu, H.-Y., Zhang, Y., et al. 2023, Monthly Notices of the Royal Astronomical Society, 523, 1994
  82. [85]Zitrin, A. & Broadhurst, T. 2016, The Astrophysical Journal, 833, 25
  83. [86]Zitrin, A., Fabris, A., Merten, J., et al. 2015, The Astrophysical Journal, 801, 44

Paper details

vlnc:W_qt23ynyk
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Physics and Astronomy

Not recorded for this paper

View statement
Looking for related papers…
Contents