MAGIC: M use gAlaxy Groups In C osmos - A survey to probe the impact of environment on galaxy evolution over the last 8 Gyr ⋆ , ⋆⋆

Context. Galaxies migrate along filaments of the cosmic web from small groups to clusters, which creates the appearance that the evolution of their properties speeds up as environments get denser. Aims. We introduce the M use gAlaxy Groups in C osmos (MAGIC) survey, which was built to study the impact of environment on galaxy evolution down to low stellar masses over the last 8 Gyr. Methods. The MAGIC survey consists of 17 Multi-Unit Spectrocopic Exporer (MUSE) fields targeting 14 massive, known structures at intermediate redshift (0 . 3 < z < 0 . 8) in the COSMOS area, with a total on-source exposure of 67h. We securely measured the redshifts for 1419 sources and identified 76 galaxy pairs and 67 groups of at least three members using a friends-of-friends algorithm. The environment of galaxies is quantified from group properties, as well as from global and local density estimators. Results. The MAGIC survey has increased the number of objects with a secure spectroscopic redshift over its footprint by a factor of about 5 compared to previous extensive spectroscopic campaigns on the COSMOS field. Most of the new redshifts have apparent magnitudes in the z ++ band z ++ app > 21 . 5. The spectroscopic redshift completeness is high: in the redshift range of [O ii ] emitters (0 . 25 ≤ z < 1 . 5), where most of the groups are found, it globally reaches a maximum of 80% down to z ++ app = 25 . 9, and locally decreases from ∼ 100% to ∼ 50% in magnitude bins from z ++ app = 23 − 24 to z ++ app = 25 . 5. We find that the fraction of quiescent galaxies increases with local density and with the time spent in groups. A morphological dichotomy is also found between bulge-dominated quiescent and disk-dominated star-forming galaxies. As environment gets denser, the peak of the stellar mass distribution shifts towards M ⋆ > 10 10 M ⊙ , and the fraction of galaxies with M ⋆ < 10 9 M ⊙ decreases significantly, even for star-forming galaxies. We also highlight peculiar features such as close groups, extended nebulae, and a gravitational arc. Conclusions. Our results suggest that galaxies are preprocessed in groups of increasing mass before entering rich groups and clusters. We publicly release two catalogs containing the properties of galaxies and groups, respectively.


Introduction
In the paradigm of the ΛCDM cosmological model, as the Universe evolves, the dark-matter skeleton forms from initial density fluctuations and is composed of voids, walls, filaments, and nodes.Galaxies are distributed in those large-scale structures, most of which constitute groups and clusters that populate nodes connected by filaments (Bond et al. 1996).Galaxy environment shapes many galaxy properties, such as their mass, color, starformation rate, and morphology.Over-dense environments, such as clusters and groups, have a large fraction of elliptical, massive, and red galaxies with a low star-formation activity (e.g., Dressler 1980;Hashimoto et al. 1998;Weinmann et al. 2006).
Several physical processes have been proposed to explain these changes in galaxy properties seen in local galaxy clusters thanks to mechanisms that act on the gas content and depletion time, such as ram-pressure stripping (Gunn & Gott 1972), galaxy-galaxy interactions and mergers (Toomre 1977), galaxycluster interactions inducing tidal stripping (Byrd & Valtonen 1990), gas starvation or strangulation (Larson et al. 1980), harassment (Moore et al. 1996), or thermal evaporation (Cowie & Songaila 1977).These processes may occur once galaxies start their infall onto those structures (as reviewed in Boselli & Gavazzi 2006).
According to hierarchical models, the elevated fraction of quenched galaxies in over-dense environments is mainly due to the assembly bias, because galaxies formed earlier in clusters and had more time to interact with their surrounding medium during long-term evolution of proto-clusters into massive clusters.It has also been suggested that galaxies may be preprocessed before entering the densest structures (Fujita 2004), and some observations support this scenario, such as that of Werner et al. (2022), who report that massive quiescent galaxies at the outskirts of clusters are already quenched at z ∼ 1. Numerical simulations seem to indicate that preprocessing is more prevalent in low-mass galaxies (De Lucia et al. 2012) and that the halos of former group-like hosts can affect galaxies before their accretion onto a cluster (e.g., Taranu et al. 2014).Other simulations propose that this process may even start in the walls and filaments of the cosmic web (e.g., Kuchner et al. 2020;Codis et al. 2018), which is consistent with some observations that find some evolution in galaxy properties with respect to the distance to filaments (e.g., Kraljic et al. 2018;Winkel et al. 2021;Castignani et al. 2022).
In the low-redshift Universe (z ≲ 0.3), large spectroscopic surveys, such as the Sloan Digitial Sky Survey (SDSS, Stoughton et al. 2002) and the Galaxy And Mass Assembly (GAMA Driver et al. 2011), provide large statistics over wide areas, which provide the means to infer the environment and properties of galaxies down to relatively low mass across a large variety of environments (e.g., Peng et al. 2010).At higher redshifts, photometric surveys such as COSMOS (Scoville et al. 2007) and CANDELS (Grogin et al. 2011), are relatively efficient thanks to their large-number statistics.Nevertheless, spectroscopic surveys are necessary in order to robustly assess galaxy environments.Large spectroscopic surveys have been undertaken, such as the VVDS (Le Fèvre et al. 2005) and zCOSMOS (Lilly et al. 2007(Lilly et al. , 2009) ) surveys, from which group catalogs have been produced (Cucciati et al. 2010;Knobel et al. 2009Knobel et al. , 2012)).A largescale structure at z ∼ 0.7 with voids, filaments, groups, and clusters was even found in COSMOS (COSMOS Wall, Iovino et al. 2016).Other spectroscopic surveys have targeted fields around a few massive clusters, such as the GOGREEN and GCLASS surveys used in Werner et al. (2022), or the ORELSE survey (Lubin et al. 2009), and around groups of smaller mass, such as the GEEC2 survey with GMOS (Balogh et al. 2014).All these spectroscopic surveys are nevertheless only representative of the population of galaxies more massive than M ⋆ ∼ 10 10 M ⊙ , owing to their selection functions.
The intermediate redshift range, from z ∼ 0.5 to z ∼ 1, is of particular interest for investigating the impact of environment on galaxy evolution, because at z ≳ 0.5, groups and clusters still contain a large fraction of star-forming galaxies (e.g., Muzzin et al. 2012), which is due to the long timescale of the processes that turn off star formation (e.g., Cibinel et al. 2013;Wetzel et al. 2013), including preprocessing; it also corresponds to the epoch when groups and clusters start their dynamical relaxation.
To make progress in our understanding of galaxy evolution, it is necessary to elucidate spatially resolved properties, such as metallicity and kinematics, inferred from spectral features.In particular, the kinematics can be used to relate galaxy integrated and morphological properties to their dynamical mass and angular momentum.Currently, the main samples for which such resolved properties are observed at intermediate to high redshifts are drawn from integral field spectrographs.Recently, the K-band multi-objet spectrograph (KMOS) has provided samples containing thousands of galaxies (KMOS 3D , Wisnioski et al. 2015; and the KMOS redshift one spectroscopic survey, KROSS, Stott et al. 2016).However, despite their large statistics, those samples are not well suited to study the impact of environment on galaxy properties.Instead, dedicated surveys are necessary.Some have been achieved, mostly around massive clusters at intermediate redshift with KMOS (Böhm et al. 2020;Demarco et al. 2015;K-CLASH, Tiley et al. 2020; KMOS cluster survey, KCS, and the Virial survey Wilman et al. 2015;Beifiori et al. 2017;Chan et al. 2018), but also with long-slit spectrographs such as VIMOS and DEIMOS (Pelliccia et al. 2019), or FORS2 (Pérez-Martínez et al. 2017).These surveys are either focused on passive galaxies or are limited to relatively massive galaxies due to the necessary preselection of targets, similarly to the spectroscopic surveys mentioned above.Only widefield integral field spectrographs alleviate the need for preselection.This is the case, for instance, for the study of clusters at z ∼ 0.25 − 0.55 with SITELLE at the Canada-France-Hawaii Telescope (Liu et al. 2021;Edwards et al. 2021) and of a cluster at z ∼ 0.9 with OSIRIS on the Gran Telescopio Canarias (Pérez-Martínez et al. 2021).In principle, such instruments can also unveil the intracluster or intragroup medium in emission.Nevertheless, these scanning instruments are of limited sensitivity.Recently, using the Multi-Unit Spectroscopic Explorer (MUSE, Bacon et al. 2010), the Middle Ages Galaxy Properties with Integral field spectroscopy (MAGPI, Foster et al. 2021) survey observed 56 fields around massive galaxies at 0.25 < z < 0.35 from the GAMA survey in a range of environments.Richard et al. (2021) also observed 12 massive lensing clusters with MUSE at redshifts 0.2 < z < 0.6, some of which host ionized gas nebulae related to ram-pressure-stripping events (Moretti et al. 2022).
While observing clusters of galaxies is of major importance given that they are the most massive virialized structures in the Universe, targeting lower-density environments is also crucial, because galaxy evolution and morphological transformation may start before galaxies enter into clusters, especially in the lowmass regime.Therefore, the study of the impact of environment on galaxy evolution needs three key elements: (i) environment diversity, given that preprocessing should first occur in walls, filaments, or groups therein; (ii) the low-mass galaxy population, which is the most numerous and may be the population that un-dergoes the most drastic transformations; and (iii) spatially resolved properties, such as metallicity and kinematics.
Since MUSE has been operating on the Very Large Telescope (VLT), deep fields have proven fruitful for the discovery of groups at intermediate redshifts (0.3 < z < 1.5, e.g., Bacon et al. 2015Bacon et al. , 2017;;Fossati et al. 2019;Leclercq et al. 2022;Johnson et al. 2022;Cherrey et al. 2024).This is thanks to the sensitivity of this instruments, and to its one square arcminute field of view (FoV), which represents from 250 to 500 kpc from z ∼ 0.3 to z ∼ 1.5.In this redshift range, MUSE is also quite efficient in unambiguously identifying faint and low-mass galaxies (e.g., Boogaard et al. 2018;Bacon et al. 2023) and in deriving spatially resolved physical properties from the emission of their ionized gas (e.g., Contini et al. 2016;Bouché et al. 2021Bouché et al. , 2022)), but also from their stellar kinematics in the most massive cases (Guérou et al. 2017).
Taking advantage of all these unique instrumental capabilities, the Muse gAlaxy Groups In Cosmos (MAGIC), a guaranteed-time-observations large program, was built to investigate how environment has affected galaxy evolution over the last 8 Gyr, by observing 14 massive groups at intermediate redshift (0.3 < z < 0.8).Several studies have already used MAGIC data.Abril-Melgarejo et al. (2021), Mercier et al. (2022), and Mercier et al. (2023) investigated the impact of environment on galaxy scaling relations using spatially resolved kinematics of the ionized gas, which was one of the main goals of the survey.The MAGIC dataset also serendipitously revealed large ionized gas nebulae (Epinat et al. 2018;Boselli et al. 2019), and was used to study the evolution of the galaxy merger fraction since z ∼ 6 (Ventou et al. 2019); to investigate metallicity gradients of the gas-phase (Carton et al. 2018); to optimally extract spectra of blended sources (Schmidt et al. 2019); and to explore He iiλ1640 line properties in high-redshift galaxies (Nanayakkara et al. 2019).
In Sect. 2 of the present paper, we first present the MAGIC target selection, observing strategy, and data reduction, as well properties inferred from ancillary data.In Sect.3, we explain how redshifts were determined and how MAGIC compares to previous spectroscopic campaigns, and assess its spectroscopic redshifts completeness.Section 4 is devoted to the identification of structures, to the investigation of their properties, and to the description of MAGIC group and galaxy catalogs.In Sect.5, we present an analysis of galaxy population properties as a function of environment, including the red fraction, stellar mass, star formation rate, color, and morphology distributions.Finally, we highlight noticeable features found in MAGIC datacubes in Sect.6, before summarizing and presenting our conclusions in Sect.7. Throughout the paper, we assume a ΛCDM cosmology with H 0 = 70 km s −1 , Ω M = 0.7, and Ω Λ = 0.3, and all physical distances mentioned in the paper are proper distances.

Target selection
Observing groups efficiently with MUSE requires to know a priori the position of structures.The goal of our observing program is to observe dense groups at intermediate redshift so that the impact of environment and the size of the sample of galaxies in groups are both maximized.The knowledge of physical properties of those galaxies such as their mass, their star-formation rate or their morphology is necessary to analyze the impact of environment on galaxy evolution.We therefore focused our ob-servations on the COSMOS field (Scoville et al. 2007), one of the most explored regions of the sky containing extensive ancillary data and spectroscopic redshifts as complete as possible (see Sect. 3.2).Fourteen structures in the redshift range 0.3 < z < 0.8 were chosen from the zCOSMOS 20k group catalog (Knobel et al. 2009(Knobel et al. , 2012) ) 1 .We first used this catalog to select groups containing at least five spectroscopic members within one single MUSE field, and further put emphasis on the richest groups including the largest number of emission line galaxies, with at least one emission line with a flux > 10 −17 erg s −1 cm −2 .Ten groups were chosen with this strategy, among which, four groups were observed from P94 to P96, with exposures ranging from about 2 to 10 hours.After these periods, we refined our strategy to prepare for adaptive optics (AO) assisted observations: in P97 to P99, we only observed 1 hour snapshots on fields with suitable tip-tilt stars to further select the most promising candidates for subsequent AO observations.With this aim, we searched for additional fields, by allowing for mosaicking around large overdensities identified from the zCOSMOS 20k group catalog (Knobel et al. 2012) and COSMOS2015 photometric catalog (Laigle et al. 2016).This added four new fields on two main structures, including a new one (CGr32).After this snapshot campaign, we decided to discard four groups from further AO assisted observations, starting in P100.We finally decided to add three more groups from the COSMOS Wall group catalog (Iovino et al. 2016) for the last P102 and P103 periods.We selected the richest groups that could be observed with AO and that had X-ray counterparts (Gozaliasl et al. 2019) 2 , since the densest groups we previously observed were fulfilling these criteria.

Observations
MUSE observations for the seventeen MAGIC fields were obtained as part of a Guaranteed Time Observations (GTO) program (PI: T. Contini) and were spread over ten observing periods (see Sect. 2.1 and Table 1).Their location within the COSMOS field is shown in Fig. 1.For this program, dark nights and good seeing conditions were requested.For each field, observations were split into observing blocks (OBs) of about 1 hour execution time.OBs consist in four 900s (or 600s) individual exposures with a small spatial dithering pattern (< 0.3 ′′ ) and a 90 • rotation of the field between each individual exposure in order to reduce the systematics induced by the integral field unit (IFU) image slicer.The central coordinates of the fields, their rotation angle with respect to the North, and their total on-source exposure time are summarized in Table 1.All data were acquired in Wide Field Mode, using either standard seeing-limited or AO assisted observations with the GALACSI AO facility (La Penna et al. 2016;Madec et al. 2018).Note that with the laser-assisted AO mode, MUSE spectra have a gap in the 5800 − 5980Å wavelength range due to the AO notch filter.
Standard calibrations, including day-time instrument calibrations as well as standard star observations, were used for this program.All science exposures include single internal flat-field exposures taken as night calibrations.These short exposures, taken after each OB or whenever there is a sudden temperature change in the instrument, are used for an illumination correction.These calibrations are important to correct for time and temperature dependence on the flat-field calibration between each slitlet throughout the night.In addition, twilight exposures are taken every few days and are used to produce an on-sky illumination correction between the 24 MUSE channels.The total exposure time devoted to the program reached 91 hours including overheads and 66.7 hours on-source 3 .Half the observations (35 hours on source) have used the AO.Twelve fields have been exposed more than 4 hours and among those, only three did not benefit from AO.

Data reduction
Each science OB was processed through the MUSE standard pipeline (Weilbacher et al. 2020).Observations with AO were reduced with the v2.4 version of the pipeline, whereas seeinglimited observations used v1.6, except for the CGr30 field which used v1.2.There are only minor changes between these versions which does not impact the quality of the resulting data cubes.
Data reduction includes all the common steps to process raw data such as bad pixel tables, bias and dark removals, flatfielding, wavelength/flux calibration, and sky subtraction.Raw calibration exposures are combined to produce a master bias, master flat and trace table which locates the edges of the slices on the detectors, as well as the wavelength solution for each observing night.These calibrations are then applied on all the raw science exposures to produce a pixel table without any interpolation.A bad pixel map is used to reject known detector defects, and we make use of the geometry table created once for each 3 95 hours in total and 68.9 hours on-source when including the VVDS field.
observing run to precisely locate the slices from the 24 detectors over the MUSE FoV.Twilight exposures and night-time internal flat calibrations are used for additional illumination correction.Pixel tables are then flux-calibrated and telluric-corrected using standard star exposures taken at the beginning/end of the night.In the case of AO-assisted observations laser-induced Raman lines are also subtracted.Sky subtraction was applied on each individual exposure.The offsets of each single datacube were computed using stars located in the FoV in order to combine the individual pixel tables into the final datacube.Sky subtraction was further improved by applying the Zurich Atmosphere Purge (ZAP) software (Soto et al. 2016) on the final data cube.ZAP performs a subtraction of remaining sky residuals based on a Principal Component Analysis of the spectra in the background regions of the data cube which has been shown to remove most of the systematics, in particular towards the redder wavelengths.Data reduction produces science-ready data and variance cubes with spatial and spectral sampling of 0.2 ′′ and 1.25 Å, respectively, in the spectral range 4750 − 9350Å.Astrometry for all the fields was matched to the Hubble Space Telescope (HST) Advanced Camera for Surveys (ACS) image coordinates from the COSMOS2015 catalog (Laigle et al. 2016).Average offsets between the MUSE and HST coordinates were computed in the final combined data cube.The data release is explained in Appendix A.
The MUSE line spread function (LSF) is modeled using the results of Bacon et al. (2017) for the MUSE Hubble Ultra Deep Field (MUSE-HUDF) and of Guérou et al. (2017) for the MUSE Hubble Deep Field South: where FWHM LSF is the LSF full width at half-maximum, and λ is the wavelength, both in Å.Following the prescription used for the MUSE-HUDF (Bacon et al. 2017(Bacon et al. , 2023)), we use a Moffat function rather than the Gaussian function used in Abril-Melgarejo et al. (2021) and Mercier et al. (2022) to determine the point spread function (PSF).We report in Table 1 the PSF parameters that have been computed using objects identified as stars from the spectra in each field.For field CGr87, one bright unresolved object at z ∼ 2.67 was used in addition to three potential stellar sources having z = 0 with a poor redshift confidence due to a very low brightness.We collapse the reduced datacube over 100 Å to create 6 ′′ × 6 ′′ images around each star every 100 Å, and model them using a flat background and a 2D circular Moffat function.A linear fit is then performed through all measurements after excluding the strongest outliers to determine the variation of the PSF FWHM with wavelength, whereas the Moffat index β, that does not vary much with wavelength (e.g., Husser et al. 2016), is determined as the mean across wavelengths of the measurements that converged, weighted by the inverse of their uncertainty.An example is provided for the field of CGr35 in Fig. 2.

Galaxy physical parameters from ancillary data
The COSMOS field has been widely observed across a large range of wavelengths, leading to useful ancillary data to infer galaxy properties through photometry and morphology analyses.We hereafter detail how we use these data for the MAGIC sample.
Physical parameters, such as stellar mass, star formation rate (SFR) and rest-frame magnitudes, are estimated through spectral energy distribution (SED) modeling using the Code Investigating GALaxy Emission (Cigale4 , Boquien et al. 2019).Cigale takes into account the energy balance between the ultraviolet (UV) and optical emission absorbed by dust and re-emitted in the infrared and provides a Bayesian-like analysis on the output parameters by building their probability distribution function (PDF).For each output parameter, the resulting measurement and error are the mean and standard deviation of the PDF.Single stellar populations (SSPs) of (Bruzual & Charlot 2003) are used with a Salpeter (1955) initial mass function (IMF) and a fixed metallicity of 0.02 dex.The star formation history (SFH) is a delayed exponential law with flexibility in the most recent period of the SFH as described in Ciesla et al. (2017) and Ciesla et al. (2021).This SFH allows for a burst or quenching in the recent SFH with an age and amplitude provided as input parameters.Ciesla et al. (2017) showed that this parametrization yields better stellar mass and SFR measurements than a normal delayed exponential law.A recent truncation or burst in the SFH is perfectly suited to reproduce the variation of the SFR expected and often observed in galaxies located in high density regions and produced by the interaction with the hostile surrounding environment (Boselli et al. 2016).The attenuation law is a modified  (Calzetti et al. 2000) law with a fixed total to selective extinction ratio R V = 3.1, leading to five free parameters described in Table 2.The dust template model used is that of Dale et al. (2014).
Nebular and dust templates have default values.
We run Cigale on all galaxies with a tentative or secure redshift (confidence flag larger than or equal to unity, see Sect.3.1) in the MAGIC sample.We fix the redshift of each source to that inferred from MUSE data, and take advantage of 32 bands (from UV to radio centrimetric) measured in 3 ′′ diameter apertures from the latest COSMOS2020 photometric catalog (Weaver et al. 2022), when available, or from the COSMOS2015 catalog (Laigle et al. 2016) otherwise.We use instantaneous SFR that are provided as output of the SED modeling by Cigale.Properties derived from this SED modeling and used hereafter are provided in the MAGIC galaxy catalog (see Appendix A, Table A.2).
A morphology analysis was performed in Mercier et al. (2022) for 808 galaxies with secure spectroscopic redshifts in the range 0.25 ≤ z < 1.5 (see Sect. 3.1).A bulge-disk decomposition was done with Galfit (Peng et al. 2002) in order to infer disk inclinations, disk, bulge and galaxy global effective radii, as well as bulge-to-disk ratio (B/D) within the galaxy effective radius.Galaxies for which the fit did not converge were discarded.We refer to Mercier et al. (2022) for the detailed definitions of morphology outputs and to Mercier et al. (2023) for the last updated morphological models.In addition, updated kinematics parameters of [O ii] emitters obtained from MUSE data using the Moffat PSF are detailed in Mercier et al. (2023).
Last, the COSMOS field has also been covered in X-ray by XMM-Newton and Chandra observatories, leading to the detection of groups (Finoguenov et al. 2007;George et al. 2011;Gozaliasl et al. 2019).The XMM-Newton coverage is quite homogeneous over the 14 MAGIC fields from 0.6 × 10 5 s to 2.3 × 10 5 s, whereas Chandra data were mostly used to refine the center of groups in Gozaliasl et al. (2019) thanks to their higher spatial resolution.

Redshifts determination
For each source in the COSMOS2015 catalog (Laigle et al. 2016)  weighted spectrum as described in Inami et al. (2017).The redshift estimated from these spectra rely on various spectral signatures such as (i) emission lines including Balmer series (mainly Hαλ6563 and Hβλ4861 lines, but also higher order Balmer lines when Hβ leaves the MUSE spectral window above z ∼ 0.9), the  λ2374, λ2382, λ2586, λ2600), and (iii) continuum features such as D4000, Balmer (3645 Å), and Lyman (912 Å) breaks at intermediate and high redshifts, respectively (see Fig. 3).
Redshifts were estimated with a MUSE customized version of the redshift-finding algorithm MARZ (Hinton et al. 2016;Inami et al. 2017) using both absorption and emission features.Redshift precision depends on (i) the nature (emission lines, absorption lines or continuum) and number of spectral features used for redshift determination, (ii) the spectral resolution at the wavelength of those features, (iii) the signal-to-noise ratio (S/N), (iv) the object internal kinematics within the aperture used for redshift determination since it may bias the systemic redshift estimate.Indeed, the absorption lines positions are biased towards the brightest regions, usually at the center of galaxies, whereas emission lines can be dominated by off-center starforming clumps.We therefore expect a larger uncertainty for massive galaxies with asymmetric, clumpy and off-centered flux distributions in emission lines, at the exception of those seen nearly face-on.To minimize this effect, we correct the redshift of each spatially resolved galaxy for the systemic redshift derived from the best-fit model of the [O ii] kinematics performed in Mercier et al. (2023), when available.Given the typical S/N and spectral resolution of MUSE (R ∼ 3000), the redshift accuracy at 1-σ is about δz/(1 + z) ∼ 0.0001, corresponding to a 1-σ velocity accuracy of ∼ 30 km s −1 .
Following other works on deep fields (e.g., Bacon et al. 2015Bacon et al. , 2017Bacon et al. , 2023)), for each redshift estimate, we assign a confidence level (from 1 to 3) according to its reliability: - Examples of spectra with various confidence levels are provided in Fig. 4.
During redshift determination, we visually inspected integrated spectra, especially those for which MARZ was not able to provide a clear unique solution.This allowed us to identify two sets of spectral features in some spectra due to blended sources.For four spectra, the two sources were both identified in the COSMOS2015 catalog and a further investigation allowed us to determine the redshift of each source accordingly.For fifteen other cases of blending, the secondary source was not in the COSMOS2015 catalog.We therefore added this source to the MAGIC galaxy catalog either with new coordinates when we were able to disentangle sources in the HST images, or with the exact same coordinates as the main object when this was not possible.
We also searched for objects that were not previously identified in the COSMOS2015 catalog (see e.g., Epinat et al. 2018) in eight MUSE fields (CGr30, CGr32 mosaic, CGr34, CGr84 mosaic, and CGr114).We have ran the ORIGIN emission-line source finding algorithms (Inami et al. 2017) on the deepest field (CGr30).For the other fields, we attempted a visual identification of emission lines emitters by scanning throughout the spectral dimension of the continuum subtracted datacubes.This work was not systematically done on all fields because those additional objects do not have photometric measurements necessary for the main analyses MAGIC was built for.
We ended up with a total of 1683 redshifts with a confidence of at least 1, including 211 galaxies found from blind search or deblending.The redshifts and their associated confidence levels are given in the MAGIC galaxy catalog (see Appendix A, Table A.2). Figure 5 shows the redshift distribution of galaxies in the MAGIC sample with redshift confidence flags of 1, 2 and 3, whereas Table 3 summarizes the number of objects in each of the following categories: stars (z ∼ 0), nearby galaxies (0.0005 ≤ z < 0.25), [O ii] galaxies (0.25 ≤ z < 1.5), redshift desert galaxies (1.5 ≤ z < 2.9) and Lyα galaxies (z ≥ 2.9)5 .Around 80% of galaxies with secure redshifts (confidence 2 and 3) are in the [O ii] emitters redshift range.The sharp drop after z = 1.5 is due to the [O ii] doublet falling beyond the red limit of MUSE spectral range (9350 Å).Beyond z = 2.9, there is a rise of secure redshifts due to Lyα entering the MUSE wavelength Flux density [10 range (4750 Å) with 40% of those galaxies not being part of the COSMOS2015 catalog.The distribution of redshifts differs from that of the MUSE-HUDF (Bacon et al. 2023) for several reasons.First, the MAGIC survey is shallower, since the median (longest) exposure for MAGIC is 4.33 (9.75) hours (see Table 1), whereas the minimum exposure for the MUSE-HUDF (Mosaic) is 10 hours.Deeper exposures lead to better spectroscopic redshift confidence levels, especially for [O ii] emitters.
Secondly, the depth of the COSMOS2015 parent catalog used for source extraction is shallower than that used for the MUSE-HUDF which is based on eXtreme Deep Field (XDF) images (Illingworth et al. 2013).This leads to a limited number of galaxies, especially in the range of Lyα emitters.In addition, many galaxies in the MUSE-HUDF were detected blindly and had no corresponding source in the Hubble XDF photometric catalog, whereas for MAGIC, as stated above, such a blind search was not systematically done for all the fields, which also mostly reduces the number of Lyα emitters.Last, MAGIC targeted dense groups within the redshift range 0.3 < z < 0.8, which explains   112) 759 ( 60) 1683 (211) 100% Notes.The first four columns indicate the number of objects, whereas the last column indicates the fraction of objects for each class.All sources are included, except those having defects (usually at the edge of MUSE fields) with CONFID equal to unity.Numbers into parentheses correspond to sources found from blind search and deblending.Stars all have z < 0.0005, nearby galaxies have 0.0005 ≤ z < 0.25, potential [O ii] emitters have 0.25 ≤ z < 1.5, redshift desert corresponds to 1.5 ≤ z < 2.9 and potential Lyα emitters have z ≥ 2.9.
its quite high fraction of galaxies in this range, especially around z ∼ 0.7.
We have identified 448 sources having one redshift estimate with a COSMOS-z spec confidence flag of at least 1 in this master catalog6 within the footprint of MAGIC fields.Galaxies too close to the edges of MUSE fields to infer a robust redshift were excluded here.Two galaxies from the COSMOS-z spec catalog that are not in the COSMOS2015 catalog are missing in the MAGIC catalog7 .They both have redshift estimates within the optical redshift desert and are not in any COSMOS photometric survey (Ilbert et al. 2009;Laigle et al. 2016;Weaver et al. 2022).
Among the 446 remaining sources, 394 (88%) have at least one likely COSMOS-z spec redshift estimate (COSMOS-z spec confidence flag of 2), whereas 428 (96%) of them have one from MAGIC (confidence defined in Sect.3.1 larger than or equal to one).Similarly, 294 (66%) sources have a secure COSMOS-z spec redshift estimate (COSMOS-z spec confidence flag larger than or equal to 3), while 416 (93%) have such a redshift within MAGIC (confidence of at least 2).If we restrict our analysis to the 294 objects with secure COSMOS-z spec redshifts, only twelve do not have a secure spectroscopic redshift from MUSE data, including nine galaxies in the optical redshift desert.The last three galaxies are faint and have no visible emission line in the MUSE datacube matching the COSMOS-z spec (DEIMOS or VUDS) redshifts.When both COSMOS-z spec and MAGIC redshifts are secure, the scaled redshift agreement ∆z = (z MAGIC − z prev )/(1 + z MAGIC ) has a standard deviation σ ∆z = 0.0005 after iteratively clipping nine sources at 10σ.The redshift of one of those sources is that of a blended object that we identified in the MUSE data.We have checked the MUSE spectra of the eight other sources and are confident that we provide the correct redshift solution for all of them.
Over its footprint, the MAGIC survey increases the density of objects with a likely redshift by a factor of 4.3 (from 394 to 1683), and with secure redshifts by factor of 4.8 (from 294 to 1419).To further investigate the strengths of MAGIC in terms of redshift determination, we display in Fig. 6 each object with new redshifts (blue) and previously secure (red) or likely (orange) redshifts in a redshift-magnitude (z ++ band) diagram.This figure also shows the corresponding fraction of new MUSE spectroscopic redshifts as a function of magnitude and redshift.Stars are excluded from this figure.Indeed, adding them shows that bright stars were not much targeted in previous spectroscopic campaigns, probably because they are easily identifiable from images.
For bright galaxies, the fraction of new secure redshifts increases from ∼ 0% at z ++ app ∼ 19 to ∼ 15% at z ++ app = 21.0 (red curve on the right panel of Fig. 6).For fainter galaxies, the proportion of new spectroscopic redshifts gets larger than 75% within 1.5 dex and asymptotically reaches 100%.Most of galaxies with likely COSMOS-z spec redshifts (orange dots) have z ++ app magnitudes between 21.5 and 22.5.The fraction of new secure redshifts reaches a local minimum of about 69% in the redshift bin 0.69 < z < 0.79 because this redshift range was extensively targeted for the study of the COSMOS Wall (Iovino et al. 2016).It may also be that dense environments host galaxies that are forming less stars, with fainter emission lines, and therefore more difficult to attribute a secure spectroscopic redshifts in the low-mass regime (see Sect. 5.2).Apart from this redshift range, the fraction of new galaxies increases linearly with redshift from about 65% at z = 0.25 to nearly 93% at z = 1.5.This is mainly due to the fact that the fraction of bright galaxies decreases with redshift.The higher spectral resolution of MUSE could also contribute to this trend by better identifying the [O ii] doublet when it is the only available feature, and by slightly reducing night sky lines contamination in the red part of the spectrum.The fraction of new redshifts in the redshift desert is above 75%, and around 90% beyond z = 2.9.Running automatic source finding algorithms such as ORIGIN would further increase the number of new redshifts in these redshift ranges.These findings highlight that, owing to their selection functions, the sampling rate of previous spectroscopic campaigns was quite high for galaxies brighter than z ++ app = 22.5, and demonstrate the strength of wide spectral range integral field spectroscopy to determine robust redshifts for faint sources without any magnitude-limited selection.

Spectroscopic completeness
To further assess how the MAGIC sample is representative of the population of galaxies at various redshifts, we analyze the spectroscopic completeness of the survey by measuring the fraction of galaxies with a secure spectroscopic redshift (confidence 2 and 3) with respect to the actual number of galaxies within given redshift and magnitude bins.We estimate the latter thanks to the COSMOS2015 photometric catalog (Laigle et al. 2016) that uses z ++ band images with a magnitude limit of 25.9 in 3 ′′ diameter apertures for source detection, ensuring a completeness close to unity up to this limit.
Figure 7 shows the local spectroscopic redshift completeness as a function of both photometric redshift and z ++ band appar- ent magnitude, in bins of width ∆z = 0.1 and ∆z ++ = 0.25, respectively.Before computing the completeness, we first replace photometric redshifts by MAGIC spectroscopic redshifts, when available and secure.Indeed, as underlined in Laigle et al. (2016), the photometric redshift error inferred from ∆z = (z − z phot )/(1 + z), with z and z phot being the actual and photometric redshifts, respectively, increases when galaxies become fainter and gets as large as 0.05 at 1σ for the faintest magnitudes (i AB > 25).Doing such a correction is particularly important to avoid smoothing out artificially completeness around redshift bins where spectral signatures leave or enter the MUSE spectral range (see Fig. 3), especially at z ∼ 1.5 and z ∼ 2.9.There might nevertheless remain boundary effects around those redshifts.Indeed, while the above correction adds galaxies with a photometric redshift z > 1.5 (z < 2.9) to the bin below z = 1.5 (above z = 2.9), it does not remove from this bin galaxies that actually have z > 1.5 (z < 2.9) but do not have strong spectral signatures to infer a secure spectroscopic redshift.Therefore, the parent population in the bin below z = 1.5 (above z = 2.9) may be slightly overestimated and the completeness underestimated.Those effects are nevertheless negligible compared to not performing the correction, especially where completeness is high.
The main result is that completeness is globally close to 80% below z = 1.5, considering all galaxies with z ++ app ≤ 25.9, and drops sharply down to around 10% beyond this redshift.This is due to the [O ii] doublet leaving MUSE spectral range, and to the C iii] doublet being fainter and more difficult to unambiguously identify.Beyond z ∼ 2.9, completeness increases to roughly 40%, due to Lyα entering the MUSE spectral domain.The redshift bin 0 ≤ z < 0.1 contains 60 and 45 sources with photometric and secure spectroscopic redshifts respectively, 41 among the latter being stars.Spectral signatures of stars are identified unambiguously down to z ++ app = 23 as shown in Fig. 7 by the transition from a null to 100% completeness around that magnitude.More generally, completeness is close to unity for objects with an apparent magnitude lower than 23, whatever the redshift, since such sources have either (i) strong emission lines or (ii) detectable signatures in the continuum for the brightest ones.Indeed, the continuum spectra of objects brighter than z ++ app = 22 have a S/N > 5 per angstrom for a typical depth of 5h.For galaxies with redshift 0.25 ≤ z < 1.5, the completeness remains lo-cally higher than 50% down to an apparent magnitude of roughly 25.5 since most galaxies are star-forming in this regime, though SFR decreases at low mass, leading to the detection of potentially strong emission lines within the MUSE wavelength range (see Sect. 3.1).The completeness at low apparent magnitudes is slightly increasing with redshift below z = 1.5.This is due to the fact that galaxies probed in this magnitude regime have increasing stellar masses, hence increasing SFR and ionized gas line fluxes with redshift.This is probably stepped up by the increase in cosmic SFR with redshift (Hopkins & Beacom 2006).Spectroscopic completeness is also slightly lower at low mass at z ∼ 0.6 − 0.8.This may be related to the MAGIC observing strategy, targeting many dense structures in this redshift range.Galaxies in these massive groups are expected to have a reduced star-formation rate at a given mass, hence reducing the strength of emission lines below the detection limit for the least massive ones, as shown in Mercier et al. (2022).
We are further able to estimate spectroscopic redshift completeness as a function of stellar mass, based on masses inferred from SED fitting, either from the COSMOS2015 catalog when no redshift can be derived from the MUSE data, or from our Cigale estimates otherwise.One drawback for our analysis is that Laigle et al. (2016) only provide the whole stellar mass completeness of the photometric sample, and not in bins of stellar mass.They showed that the 90% completeness is obtained for stellar masses increasing from ∼ 10 8.5 M ⊙ to ∼ 10 9.5 M ⊙ in the redshift range between z = 0 and z = 1.5.The parent photometric sample therefore lacks secure constraints down to low masses reached within MAGIC.Nevertheless, using a cut in z ++ app < 25.9, we can state that the parent sample has a completeness close to unity from z = 0.25 to z = 1.5 at least down to a stellar mass limit increasing from 10 8 M ⊙ to ∼ 10 9 M ⊙ .Within bins of stellar mass as low as these values, the spectroscopic redshift completeness in the whole redshift range is larger than 60% and 70% respectively, and is up to 90% for galaxies within bins of stellar mass above 10 10 M ⊙ .
The effect of depth on completeness was also investigated by analyzing the 1 hour exposure fields only (cf.Table 1).Despite lower statistics, results are quite similar to those obtained for the full sample, at least within the z < 1.5 range.The difference in magnitude where a spectroscopic completeness of 50% is reached is of the order 0.25 dex.The main consequence of exposing more than 4h is to increase completeness for objects fainter the COSMOS2015 limiting magnitude z++ = 25.9, and in the redshift range between 1.5 and 2.9.
The results we obtain for MAGIC are comparable to those obtained by Bacon et al. (2023) in the MUSE-HUDF on the Mosaic (10h exposure).We have computed the completeness in the MUSE-HUDF Mosaic using only galaxies brighter than an apparent magnitudes F775W = 25.8, similar to the limit of the COSMOS2015 catalog.The main differences are that the completeness in MAGIC is higher than in the MUSE-HUDF in the redshift range of [O ii] emitters (∼ 75% vs ∼ 55%), and that it is lower in the redshift desert (∼ 15% vs ∼ 35%) and for Lyα emitters (∼ 40% vs ∼ 70%).The latter is mainly due to the overall lower depth of MAGIC data associated to the systematic use of blind searching algorithms for the MUSE-HUDF, since most galaxies above z = 1.5 have low magnitudes.The higher completeness in MAGIC for [O ii] emitters is related to the selection of groups in this redshift range that biases the luminosity function towards bright galaxies.Excluding galaxies in groups with more than 8 members leads to more comparable results, though completeness remains slightly higher.

Structures identification and density estimators
The quantification of environment and the identification of structures can be done in many ways.These methods include Voronoi tesselations and Delaunay triangulation (e.g., Marinoni et al. 2002), weighted adaptive kernel smoothing, density at the radius of the n th neighbor (e.g., Wang et al. 2020), friends-of-friends (FoF) algorithms, and are based either on spectroscopic or photometric redshifts or the combination of both.Each method has advantages, such as the possibility to combine both photometric and spectroscopic measurements (e.g., the Voronoi tesselations Monte-Carlo mapping -VMC-developed in Lemaux et al. 2017Lemaux et al. , 2022;;Hung et al. 2020Hung et al. , 2021)), or an easy implementation (e.g., the FoF algorithm used in Knobel et al. 2012;Iovino et al. 2016), but most of those remain sensitive to the underlying completeness of redshift measurements and need extensive sets of simulations to tune the algorithm parameters.They also depend on the size of the underlying studied field.Darvish et al. (2015) describe and compare several methods within the COSMOS field using photometric redshifts and show an overall agreement between those methods.The goal of the present paper is not to further develop these methods but to have various estimates of environment and density.The methods used to quantify environment are described hereafter.

Identification of structures using a FoF algorithm
In order to identify structures within our MUSE data, we run a FoF algorithm, as done for the MUSE Hubble Deep Field South (HDFS, Bacon et al. 2015).FoF algorithms basically rely on two parameters that define in which volume friends are searched, one of which is the maximum transverse separation, based on angular separation measurements, and the other one is the maximum longitudinal separation, orthogonally to the plane of the sky, based on redshift measurements.For the HDFS, no constraint was set on the transverse separation owing to the relatively narrow MUSE FoV.Since some fields are made of mosaics in the MAGIC sample, we use both transverse and longitudinal separations in our algorithm, as it is usually done for large scale spectroscopic surveys (e.g., Knobel et al. 2009Knobel et al. , 2012;;Iovino et al. 2016).Various definitions can be used for those separations.For MAGIC, we use the transverse proper distance ∆d drawn from for the angular separation between sources and the angular diameter distance at the redshift z of each source.On the other hand, redshift differences combine expansion and actual relative motions between galaxies (see discussion in Sect.6.2).In order to quantify how galaxies are dynamically bound to given underlying large scale structures and dark matter halos, we use the velocity difference ∆v to constrain the longitudinal separation.This velocity difference is inferred from redshift differences ∆z between sources at the redshift z of each source as ∆v = c∆z/(1 + z).
In Knobel et al. (2012) and Iovino et al. (2016), the parameters of the algorithm were tuned with simulations to mimic their target selection based on photometric measurements, and their spectroscopic redshift success rate.Our dataset does not suffer any pre-selection and has a good and homogeneous spectroscopic redshift completeness over the whole 0.2 to 1.5 redshift range (see Sect. 3.3).In addition, the redshift uncertainty in our sample is low, ≲ 30 km s −1 in terms of velocity for both emission and absorption line objects (see Sect. 3.1).We therefore use a simpler scheme and run the FoF algorithm using all galaxies in the MAGIC catalog with a secure redshift (confidence flag larger than or equal to 2), without any magni-tude restriction.This choice allows us to infer group membership for both high-mass and low-mass galaxies.Including the latter in the group finding algorithm also helps in refining the group parameters (Sect.4.2) thanks to better statistics.For each source, transverse proper distances and velocity differences to all other galaxies are computed.Following Iovino et al. (2016) prescriptions, we use an iterative approach with FoF parameters depending on the number of galaxies in the groups and use maximum physical and velocity separations ∆d = 375 kpc and ∆v = 500 km s −1 for groups of seven or more members, ∆d = 375 kpc and ∆v = 470 km s −1 for groups of six members, ∆d = 350 kpc and ∆v = 440 km s −1 for groups of five members, ∆d = 300 kpc and ∆v = 350 km s −1 for groups of four members, ∆d = 275 kpc and ∆v = 325 km s −1 for groups of three members, and ∆d = 225 kpc and ∆v = 300 km s −1 for pairs.The velocity separations are inferred from Iovino et al. (2016) FoF parameters at z = 0.1, providing more stringent limits than considering higher redshifts.Friends of a source are those within the maximum transverse and longitudinal separations.All friends of a friend are then considered as members of the same structure.
A refined analysis about groups statistics is provided in Sect.4.6.Our goal here is to show how robust are the most massive groups with respect to FoF parameters and galaxies magnitude.We find 26 groups with at least eight members, all having 0.3 < z < 1.4.Using more relaxed constraints (by 30%) on both transverse and longitudinal separations only adds one or two galaxies for 20% of those groups.Conversely, using more stringent constraints (by 30%) slightly reduces the number of galaxies in some of those groups, and splits three of them in smaller sub-groups.We also run the FoF algorithm using a magnitude limit of 24.5 in the z ++ band on 3 ′′ diameter apertures, where spectroscopic redshifts completeness in MAGIC is higher than 70% per magnitude bin.This reduces the number of groups with at least eight members to 18. Nevertheless, 21 out the 26 aforementioned groups are identified with at least five members, and the five remaining groups have either three or four members (all at z > 0.8).We also do the same exercise using only galaxies brighter than K s = 22.6, to mimic the pre-selection done in Iovino et al. (2016) and only find 13 groups with eight or more members.However, similarly to the previous test, 18 out the 26 groups found with the whole galaxy catalog are identified with at least five members within this K s band limited catalog, six have either three or four members (all at z > 0.8), and two are not found at all (previously identified as having eight and nine members).We are therefore quite confident that our FoF algorithm finds actual groups.

Deriving group properties
Once groups are identified thanks to the previously described FoF algorithm, we derive their properties.First, group richness is estimated as the number of galaxies it has within MAGIC fields.This is done despite the fact that structures may extend beyond those fields.The richness we compute is thus a lower limit.Groups centered at the edges of MUSE FoV may be more impacted, but this should not be the case for the massive targeted groups.The group redshift z g is also computed as the mean redshift of those members.
The line-of-sight velocity dispersion of group members is an important property to determine a reliable group mass.Following Cucciati et al. (2010) prescription, we estimate this velocity dispersion using the gapper method (Beers et al. 1990) since it is a robust estimator, in particular when the number of group members is as low as five, as is the case for some of the groups found in our dataset.The velocity dispersion is therefore computed as: where the velocities along the line-of-sight of each member ∆v i are sorted in ascending order.Those velocities are inferred in the frame of the group from the difference in redshift between each member (z i ) and the group (z g ) as: As a sanity check, we also compute the velocity dispersion as the standard deviation of the velocity distribution in each group.As expected, we find that the gapper method gives larger estimates than standard deviation.The difference decreases from 20% to 10% when the richness increases from three to ten galaxies, with no noticeable difference for groups with more than 20 members and no trend with redshift.The estimate of the velocity dispersion may be overestimated if several sub-components are considered.However, we do not expect this to happen given that the MUSE FoV typically covers half the size of massive groups (see Sect. 4.6).
The velocity dispersion is a good proxy for the mass content of groups and is also used to infer their radius.We follow the prescriptions of Lemaux et al. (2012), based on earlier works (Carlberg et al. 1997;Biviano et al. 2006;Poggianti et al. 2009), to compute R 200 , the radius at which the group density is equal to 200 times the Universe critical density and M Vir , the Viral mass at the Virial radius R Vir = R 200 /1.14, as: , and (4) where H(z g ) is the Hubble parameter at the redshift z g of the group, and G is the Newton's gravitational constant.These prescriptions assume that groups are virialized.We also estimate the position of the group center as the unweighted barycenter of all members within the MUSE fields.This position is biased by the position of MUSE fields and may be offset with respect to the real center position.Other estimates of group center positions are provided for groups also identified (i) in the zCOSMOS 20k group catalog (Knobel et al. 2012), (ii) in the COSMOS Wall (Iovino et al. 2016) 8 , and (iii) in the latest COSMOS X-ray catalog (Gozaliasl et al. 2019).The corresponding zCOSMOS 20k group is the one with the largest number of members within each MAGIC group, if any.For both COSMOS Wall and X-ray group catalogs, we match each MAGIC group to the closest group in those catalogs having a good agreement on redshift (∆z/(1 + z) < 0.005).For the COSMOS Wall, we further impose a center separation smaller than 2 ′ , since we expect that our fields are centered on such groups but want to ensure that no possible match is missed.In practice, all six matching groups between MAGIC and COSMOS Wall catalogs are separated by less than 25 ′′ , corresponding to less than 170 kpc.The separation between the X-ray peak and our center is lower than ∼ 1 ′ except for one group (MGr15, CGr239 ) for which the separation is close to 3 ′ , corresponding to ∼ 880 kpc.The Virial radius determined by Knobel et al. (2012) for this group is 876 kpc while their center is at ∼ 150 ′′ (∼ 750 kpc) from the X-ray position, which makes this association plausible.There remains however a possibility that some matched X-ray groups do not correspond to MAGIC groups, especially when separations are large.
Once the center is determined, we further compute for each group member the projected distance ∆r to the group center from the on-sky projected angular separation and the angular diameter distance at the redshift z g of the group.

Local density estimator using the VMC method
In order to have a local density estimate which is not biased by the oversampling of spectroscopic redshifts inside the MAGIC fields observed with MUSE, we apply the VMC method detailed in Lemaux et al. (2018)  All objects with IRAC1 magnitudes lower than 24.8 are used to generate the maps, in order to ensure that the sample used is roughly stellar mass limited.The VMC method assigns a redshift to each galaxy within this magnitude limit in order to constitute one Monte-Carlo iteration.Photometric redshifts are used for all galaxies with either no spectroscopic redshift or with an insecure spectroscopic redshift (confidence flag < 2).For each source having a secure spectroscopic redshift (confidence flag ≥ 2), for each iteration, a number is drawn from an uniform distribution ranging from 0 to 1.If this number is below a likelihood threshold that depends on the spectroscopic redshift confidence flag, the spectroscopic redshift value is retained (details about the method and these thresholds are provided in Appendix A of Lemaux et al. 2022).Otherwise, the photometric redshift information is used.For each source for which the photometric redshift is used, the redshift is randomly assigned by sampling its photometric redshift probability distribution function which is treated independently from that of neighboring galaxies.
For a given iteration, ±3.75 Mpc deep slices with respect to the fiducial redshift center with a step of 0.75 Mpc (proper distances) are produced from 0.2 ≤ z ≤ 1.5.For each slice, a Delaunay triangulation is performed to generate Voronoi tessellations using the positions of objects that are within the velocity/redshift range of the slice.The density is inversely proportional to the area of each Voronoi tile.A grid of 75 kpc wide pixels is produced with the value of the density for each slice.One hundred Monte-Carlo iterations are performed and, for each pixel of the grid, the final density is computed as the median over the iterations.
In order to avoid edge effects where the data begin to fall off, a mask is applied to each slice to mask out all pixels where the density is less than 0.1 galaxy per Mpc 2 .The median density per slice is then calculated from the unmasked region of each slice.Since the sampling might differ with redshift due (i) to the source density falling off naturally in an apparent magnitude limited sample to higher redshifts, and (ii) to variations of spectro- Projected density [Mpc −2 ] Fig. 9. Map of the local density estimated from Voronoi tessellations for CGr32.Each galaxy is allotted a density equal to the inverse of the area of the associated Voronoi cell.Black dots correspond to galaxies of CGr32 that have a secure spectroscopic redshift in the MAGIC catalog, whereas gray dots correspond to galaxies from the COSMOS-z spec catalog in the redshift range of CGr32.
scopic redshifts completeness, we compute the overdensity with respect to the median density Σ median over the COSMOS field computed as 1 + δ = Σ/Σ median at each redshift slice, rather than the density Σ.Using the overdensity mitigates these effects to a large degree.Still, both density and overdensity are provided in our final catalog.Each galaxy in our sample is thus attributed the density and overdensity of the closest pixel in the corresponding redshift slice (middle of the slice redshift range).An example of the overdensity map at the redshift of CGr32 is provided in Fig. 8.

Local density estimator in structures using Voronoi tessellations
In order to take advantage of our MUSE dataset and of its high spectroscopic redshifts completeness (see Sect. 3.3), we compute an additional local density for each galaxy in any identi-fied structure based on a similar but simpler approach than the above VMC method (Sect.4.3).For each group, we perform a triangulation from the position of all galaxies with a secure spectroscopic redshift.Then Voronoi cells are allotted to each galaxy.Since each cell contains only one galaxy, the corresponding galaxy is attributed a density per unit area equals to the inverse of the Voronoi cell proper area in Mpc 2 at the redshift z g of the group.This method suffers however from edge effects since tiles for galaxies at the edge of the group or of the MUSE FoV have undefined boundaries.To partially overcome this, we use the COSMOS-z spec catalog (Khostovan et al. in prep, see Sect.3.2) outside the MUSE FoV to add constraints on those 'edge' galaxies.We add all galaxies with a secure (confidence flag at least 2) spectroscopic redshift in the COSMOS-z spec catalog within the total redshift range of the group, which boundaries are defined as the minimum and maximum redshifts of members identified in MUSE data.An example of such a density map is shown for CGr32 in Fig. 9.The overall density pattern displays a good qualitative match with respect to that of the VMC method in Fig. 8.The advantage of this method is that the density is computed using all secure group members rather than using redshift slices.However, apart from the edge limitation, it also only applies to galaxies in groups, even though it is still possible to infer upper limits for other galaxies.Last, we emphasize that we do not use any weighting scheme, which makes this density estimate sensitive to low-mass galaxies in the same way as for massive ones.

Global density estimator in structures
For any galaxy in a structure, we determine a global density estimator with the dimensionless parameter (Noble et al. 2013): where ∆v is the velocity of the galaxy within the group (see Eq. 3) and ∆r is the projected distance to the center of the group.This phase-space parametrization quantifies how galaxies are tied to the group they belong to, based on their normalized position and kinematics.Using this parameter, galaxies can be separated between galaxies that recently started their infall onto the groups (0.4 < η < 2), backsplash galaxies that already passed once the pericenter of their orbits (0.1 < η < 0.4), and galaxies that have been accreted earlier (η < 0.1).The limitation of this parameter is that it can only be defined in groups with well-defined centers, dispersion and size.It is therefore more reliable for groups with more than ten members.

Analysis of MAGIC groups
The MAGIC survey contains 76 pairs of galaxies and 67 groups, spread in 30 groups of three or four members, 18 groups of five to nine members, 13 groups of ten to 19 members, two groups of 20 to 29 members, three groups of 30 to 50 members, and one group of more than 50 members that can be considered as a cluster (CGr32) owing to both its richness and mass.Depending on how defining the limit between groups and clusters, other groups, mostly those that were initially targeted, may be considered as low mass clusters.Overall, the MAGIC sample covers a wide range of structure mass, from small groups of ∼ 10 12 M ⊙ to clusters of a few 10 14 M ⊙ .For the sake of simplicity, we refer hereafter to a group any structure with at least three members.Fig. 10.Histograms of the number of as a function of group richness in logarithmic scale for three redshift ranges.The height of the dark bins indicates the number of galaxies in groups of a given richness, whereas the height of the bins of dark and lighter colors corresponds to the number of galaxies in groups richer than the bin richness.The first bin corresponds to field galaxies and therefore contains all galaxies.
We match 23, 6, and 11 groups over the 67 groups with three or more members to groups previously identified in the zCOS-MOS 20k (Knobel et al. 2012), in the COSMOS Wall (Iovino et al. 2016) and in the X-ray (Gozaliasl et al. 2019) group catalogs, respectively (see Sect. 4.2).The 11 groups with an X-ray counterpart are among the 14 targeted massive groups.The three targeted groups with no X-ray detection all have XMM-Newton depths of about 10 5 s, though they have similar redshifts and dynamical masses as other groups with an associated X-ray signal.These non-detections are likely due to an intrinsically weaker Xray emission probably induced by less hot gas in those systems.None of the other groups found in MAGIC have an X-ray counterpart, except eventually MGr55 (see Sect. 6.2).Indeed, they are less massive and their X-ray emission, if any, would be embedded in the emission of the most massive group in those fields, and would thus be difficult to disentangle.
The global group properties described in the previous sections are released in the MAGIC group catalog described in Appendix A (Table A.1), for all identified groups, including pairs.A version of this catalog for groups of more than five members is provided in Table 4.The local and global density estimates computed for each galaxy, as well as group membership, are provided in Appendix A (Table A.2).The MUSE FoV corresponds to about 400 to 450 kpc between 0.6 < z < 0.8, where most of the massive groups in MAGIC lie.Thus, the massive groups in MAGIC are typically twice as large as the MUSE field coverage, which means that we mostly survey the inner parts of groups within R 200 /2.This may slightly underestimate their measured velocity dispersion, and may also increase the global fraction of quiescent galaxies in groups.We indeed expect galaxies infalling onto groups from their outer parts statistically have trajectories oriented close to the sky plane, hence with lower projected velocities within the group, and to be mostly star-forming.
Figure 10 displays the number of galaxies in groups richer than a given number of members.Most groups and galaxies therein are in the redshift range of [O ii] emitters10 , whereas a    7) and ( 8 Fraction of quiescent galaxies Fig. 12. Maximum of the VMC overdensity as a function of Virial mass for MAGIC groups with five or more members with 0.25 ≤ z < 1.5.Initially targeted groups have gray contours, and groups with X-ray counterparts are identified as colored squares.The color of the symbols refers to the fraction of quiescent galaxies within each group. non negligible fraction of field galaxies are at redshifts above z = 1.5.If we restrict to the 1154 galaxies with redshifts between 0.25 and 1.5, where the spectroscopic redshift completeness is the highest, we find that 778 galaxies belong to groups of two (galaxy pairs) or more members.We further find that 32.6% are in the field, 28.7% are in groups of nine or less members, 19.4% are in groups of ten to 29 members, and 19.3% are in groups of more than 30 members.
There is a clear correlation between the richness of groups and their Virial mass estimated from dispersion (Eq.5), as illustrated in Fig. 11.This figure also shows that groups above redshift z ∼ 1 are mostly low-mass and low-richness.It may be that their richness is underestimated due to their lowest completeness at low mass compared to groups at z < 1.We further investigate the link between the group mass, the fraction of quiescent galaxies and the density.The population of quiescent galaxies is inferred from a color-color diagram as detailed hereafter in Sect.5.1.The density can be estimated either from the VMC method, e.g., using the largest overdensity in the group, from the Voronoi tessellations method, e.g., using the 90 th percentile of the Voronoi density in the group, or Σ 5 , the projected galaxy number density within a circle of radius equal to the distance to the fifth closest member to the group center (similar to the definition of Wang et al. 2020).Those three density estimators provide fairly comparable results, and we show the results obtained with the VMC method in Fig. 12.This figure shows that massive groups are also those with the densest regions, though the most massive structure is not the one with the highest density.Over the 15 most massive groups (Virial mass log (M Vir /[M ⊙ ]) > 13.5), 13 are the main groups we targeted, and one among the two groups that were not targeted has only five members, making the estimate of its dynamical mass less robust.Only one targeted group (CGr23, z = 0.355) has a lower dynamical mass.This may be due to the fact that this field was slightly off-centered with respect to the actual center of the group owing to our initial observing strategy that aimed at optimizing the density of star-forming galaxies within one MUSE field (see Sect. 2.1).Indeed, the center determined by Knobel et al. (2012) is ∼ 30 ′′ (∼ 150 kpc) away from the center derived from the MAGIC dataset.Knobel et al. (2012) further inferred a velocity dispersion of 367 km s −1 and a dynamical mass of log (M Vir /[M ⊙ ]) > 14 for this group.The velocity dispersion we measure (σ g = 129 km s −1 ) may thus be that of a sub-group of star-forming galaxies, and may underestimate both the radius and dynamical mass of the whole group, which could be the reason for the position of this group in Fig. 12.The fraction of quiescent galaxies is also clearly larger for groups more massive than log (M Vir /[M ⊙ ]) > 13.5, where the local density is the highest (see further discussion in Sect.5.1).The distribution of groups in these diagrams is due to combination of targeting massive groups and of searching blindly other structures within the MUSE FoV.Indeed, blind searches lead to a higher probability to find structures with less than ten members than massive groups.We also find a trend (not shown here) that the mass of a group is correlated to the mass of its most massive members.

Galaxy properties in the MAGIC sample
The MAGIC sample is an ideal laboratory to study the impact of environment on galaxy properties thanks to its high spectroscopic completeness, its ability to estimate accurately the environment of galaxies down to low stellar masses, and the diversity of environments probed.Our goal here is to explore how the general properties of galaxies change for populations in various environments.In this section, we focus the analysis in the redshift range 0.25 ≤ z < 1.5 and restrict the analysis to galaxies with z ++ app < 25.5 to ensure a completeness of at least 50% locally (see Sect. 3.3).

Red sequence and environment
We identify 177 galaxies in the red sequence based on the (NUV − r + ) − (r + − J) two-color criterion defined in Ilbert et al. (2013) to select the quiescent population: NUV − r + > 3.1 and NUV − r + > 3(r + − J) + 1. Rest-frame colors are estimated from absolute magnitudes inferred from the Cigale run (see Sect. 2.4).This method has the advantage that it minimizes the effect of extinction and that it is less prone to evolution with redshift compared to a selection based on the specific star formation rate ])

Quiescent
Star-forming Fig. 13.Location of galaxies with redshift 0.25 ≤ z < 1.5 in the SFR vs M ⋆ diagram (within 3 ′′ apertures).Blue and red dots correspond to star-forming and quiescent galaxies, respectively.The black dashed line corresponds to galaxies with log (sS FR) = −11.
Table 5. Fraction of red sequence galaxies.Numbers in parentheses correspond to the total number of galaxies in each class.
(sSFR, estimated in yr −1 ).As a sanity check, we display in Fig. 13 the position of quiescent galaxies in log (M ⋆ ) − log (S FR) diagram showing that red-sequence galaxies have, as expected, lower SFR compared to galaxies on the main sequence, and that most quiescent galaxies have their sSFR lower than 10 −11 yr −1 .The fraction of quiescent galaxies is 81% among galaxies with log (sS FR) < −11 and only 1% with log (sS FR) ≥ −11.Most of these galaxies have stellar masses above 10 9 M ⊙ , where completeness is above 70% in MAGIC (Sect.3.3).We further compute the fraction of galaxies in the red sequence as a function of environment in the redshift range of [O ii] emitters (0.25 ≤ z < 1.5).We split the sample in four classes as a function of galaxy environment inferred from various estimators, namely VMC overdentity, Voronoi tessellations, richness, group velocity dispersion and the phase-space parameter η. Results are summarized in Table 5, and we show in Fig. 14 the fraction of galaxies in the (NUV − r + ) − (r + − J) diagram for the four VMC overdensity 1 + δ classes.In this figure, we see that the fraction of quiescent galaxies gradually increases with overdensity and that galaxies also get redder on average for both colors.Similar trends are observed for other density estimators.Class 1 contains most of field galaxies for the VMC overdensity.It contains galaxies for which it was not possible to infer a density from the Voronoi tessellations method, including all galaxies in the field as well as some galaxies in groups with a low richness or at the edges of the fields.For all other estimators, class 1 corresponds to field galaxies.Considering the group richness, we see that the fraction of quiescent galaxies in groups of less than ten members remains relatively close to that of field galaxies.For this reason and because σ g and η parameters are less reliable for groups with fewer galaxies, we further exclude galaxies in groups of nine or less members for those density estimators.For the two classes of more than ten members, the fraction is similar.Among those two classes, we further see that groups with increasing velocity dispersion σ g host more quiescent galaxies.The position in the phase-space diagram as inferred from the η parameter is independent of the group richness or velocity dispersion.This estimator shows that the fraction of quiescent galaxies for recently accreted galaxies (η ≥ 0.4, class 2) is low and only twice as large as for field galaxies and that it increases with the time spent in the structures, i.e. for backsplash galaxies (class 3) and galaxies that have been accreted earlier (class 4).This is further illustrated in Fig. 15 that displays the fraction of quiescent galaxies as a function of the position in the phase-space diagram (|∆v|/σ g vs ∆r/R 200 ) for all groups of five and more members.Some bins at either high |∆v|/σ g or high ∆r/R 200 show a fraction of 1, but this is due to low number statistics.Apart from those bins, the fraction of quiescent galaxies clearly peaks at both low |∆v|/σ g and ∆r/R 200 values, and then decreases when those parameters increase.Our sample lacks galaxies at large group distances due to the limited MUSE FoV, except for the two mosaic fields (CGr32 and CGr84).
We also observe a clear dichotomy in morphology between quiescent and star-forming galaxies among the 732 galaxies that were modeled with a bulge-disk decomposition within the magnitude limit of z ++ ≤ 25.5 in the [O ii] emitters redshift range.Star-forming galaxies are mostly disk-dominated (85% with log B/D < 0), with 50% being pure disks (log B/D < −1), whereas 75% of quiescent galaxies are bulge-dominated, as shown in Fig. 16.This is in line with quiescent galaxies being mostly elliptical galaxies, as observed in the nearby Universe.

Other galaxy properties
In order to estimate the impact of environment on galaxy properties such as stellar mass, color, SFR, and morphology, we split galaxies in the same four classes of increasing density as defined in Sect.5.1 (see Table 5).We observe that galaxies get more massive, redder, less star-forming and more bulge dominated when the density increases, as illustrated in Fig. 17 by the histograms of those four quantities in four density bins using the VMC overdensity estimator.These findings are partly due to the red sequence being more prominent in dense environments, as shown previously in Sect.5.1.In Fig. 18, we show stellar mass (left panel) and B/D (right panel) histograms after further removing quiescent galaxies, which mostly reduces the fraction of galaxies in the highest stellar mass bins and with the highest B/D in the densest environments, compared to Fig. 17 where all galaxies are included.Nevertheless, we still observe that the fraction of massive galaxies increases in dense environments (Fig. 18, left panel).It results that star-forming galaxies appear both redder and slightly more star-forming in dense environments, owing to the color-mass and to SFR-mass relations for the main sequence of star-forming galaxies.The latter is observed at large SFR when quiescent galaxies are also included, quiescent galaxies populating mostly the low SFR bins in Fig. 17.Last, the B/D distributions become quite similar whatever the environment when quiescent galaxies are discarded (Fig. 18, right panel), galaxies in dense environments having slightly more prominent bulges, probably related to the mass segregation.This result, associated to the clear morphological dichotomy observed between diskdominated star-forming galaxies and bulge-dominated quiescent galaxies and discussed in Sect.5.1, implies that the transition between the main sequence of star-forming galaxies and the red sequence must occur via a fast mechanism that makes galaxies redder by quenching star-formation and induces a change in the morphology at the same time.Ram pressure stripping is a compelling mechanism since it is able to rapidly quench the activity of star formation of the perturbed galaxies on relatively short timescales (≲ 1 Gyr; e.g., Boselli et al. 2016Boselli et al. , 2022)).However, being an hydrodynamic process, it can hardly affect the stellar component and produce the prominent bulges observed in high density environments.It is thus likely that gravitational perturbations also contribute to the morphological transformation of these objects (e.g., Boselli & Gavazzi 2006).Our results are in line we previous results obtained from spectroscopic surveys at similar redshifts (e.g., Tomczak et al. 2017, who studied stellar mass functions as a function of a comparable local over-density estimator as the one used in our analysis).Similar results are obtained with any other density parameters (richness, group velocity dispersion σ g , Voronoi tessellations density, and phase-space parameter η).
It is clear that galaxy properties continuously change as environment gets denser, and the fact that the population of low-mass galaxies in groups is almost nonexistent may be due either (i) to the merger history, with low mass being merged before entering massive groups (e.g., during transit along the cosmic web, walls, and filaments) or (ii) to the dense environment itself, quenching star-formation of low-mass galaxies, and limiting our ability to assign a secure spectroscopic redshift for those galaxies without any emission line.The impact of environment on the main sequence in the MAGIC sample has already been investigated in Mercier et al. (2022) who showed that at a given mass, the SFR is reduced by up to 0.15 dex in dense environments, which is too low to justify the drastic changes in galaxy properties we observe.There may however still exist a population of undetected intermediate to low-mass quiescent galaxies with no emission lines or low-mass galaxies on the main sequence with reduced star formation.5).For each class in each histogram, the leftmost and rightmost bins contain all objects with values below and above the corresponding limits, respectively.

Peculiar features found in MAGIC groups
Apart from the galaxy and group catalogs, the MAGIC datacubes contain unique features.Our goal here is not to be exhaustive but rather to highlight the most noticeable findings.
CGr32, CGR34 and CGr35 fields are spatially close to each others and have their main identified group in the COSMOS Wall at z = 0.7304, z = 0.7324, and z = 0.7312, respectively (see Fig. 1 and Tables 1 and 4).On the one hand, the angular separation between CGr32 (MGr65) and CGr34 (MGr67) and between CGr32 and CGr35 (MGr66) is only of 4.2 ′ (∼ 1.8 Mpc at z = 0.730) and 6.4 ′ (∼ 2.8 Mpc at z = 0.730) respectively, which is less than about twice the radius R 200 ∼ 1.5 Mpc of CGr32.On the other hand, the scaled redshift separation between those groups is ∆z/(1 + z) = 0.00116, corresponding to only ∼ 350km s −1 , and ∆z/(1 + z) = 0.00046, corresponding to only ∼ 140km s −1 , respectively.The redshift distribution of galaxies in CGr32 includes those of both CGr34 and CGr35.In the 20k zCOSMOS group catalog of Knobel et al. (2012), some galaxies, mainly those with photometric redshifts only, have non null probabilities to be part of several of these groups, due to the method used to assign these galaxies to groups and to the large uncertainty on their actual redshift.Thanks to our MUSE data, we are able to assign a secure spectroscopic redshift to a significant fraction of these galaxies in the MAGIC fields.We find no photometric candidate of CGr32 in the CGr34 or CGr35 fields, no candidate of CGr35 in the CGr32 or CGr34 fields, and no candidate of CGr34 in the CGr35 field.But several photometric candidates of CGr34 are in the CGr32 field.All of these have a higher probability to be part of CGr32.This raises the question about CGr32, CGr34 and CGr35 being one unique structure.CGr34 and CGr35 could also be either off-centered overdensities of the CGr32 cluster or groups infalling along filaments onto the CGr32 cluster, which seems to be supported by the filamentary structure of the COS-MOS Wall (Iovino et al. 2016;Darragh Ford et al. 2019).A wider field coverage with MUSE would be needed to clearly distinguish those options.

Close groups in CGr84
The CGr84 mosaic exhibits two groups, MGr55 and MGr58 (CGr84) close in redshift space (see Fig. 19 and Table 4) at z = 0.68031 and z = 0.69711 respectively and both quite rich (39 and 33 members respectively).To assess whether those two groups may be gravitationally linked, we estimate on the one  Colored circle correspond to galaxies with MUSE secure spectroscopic redshifts (confidence ≥ 2) in the range of 0.67 < z < 0.71.The redshift distribution is shown on the bottom histograms.Two structures in blue (MGr55, 39 members) and red (MGr58 or CGr84, 33 members) are identified and clearly separated in redshift space, though they overlap in their spatial distribution.Their respective centers from MUSE data are displayed as blue and red crosses.hand that their velocity difference is ∼ 2980 km s −1 based on their scaled redshift difference ∆z/(1 + z) = 0.00995, and on the other hand that their proper longitudinal separation is ∼ 29 Mpc if the redshift difference is only due to expansion.The velocity dispersions of both structures are similar and slightly lower than 500 km s −1 , which corresponds to a Virial radius of about 1 Mpc and a halo mass of about 10 14 M ⊙ .Assuming that the velocity difference is not due to expansion, having the two groups gravitationally bound would require their actual separation to be lower than about 120 kpc so that their velocity difference gets lower than the escape velocity.This is much smaller than both their Virial radii and their transverse extent and is thus unlikely.On the other hand, structures with such masses and proper longitudinal separation cannot be bound because the Universe expands faster than the escape speed at a distance of 29 Mpc, which is lower than 200 km s −1 .Another alternative would be that the two groups are located within a unique dark matter halo of much larger mass and scale, but such a scenario is unlikely.These groups are therefore most likely two distinct structures along the line-of-sight.Interestingly, MGr55 was not found in the zCOSMOS 20k group catalog Knobel et al. (2012), due to galaxies in this group being not observed in spectroscopy with VIMOS probably due to a combination of the a priori selection and of the moderate spatial sampling rate of the zCOSMOS 20k survey.This group also felt just outside the redshift range investigated by the COS-MOS Wall survey (Iovino et al. 2016).An X-ray counterpart is also identified in Gozaliasl et al. (2019), but due to the spatial and redshift proximity of the two groups, it could be associated to either one or the other group.For this reason, we have associated this X-ray group named W11 to both MUSE groups in Table 4.
We further searched for those structures in the VMC mapping.Overdensities are found at the redshift of both groups and their spatial distribution is consistent with the offset we observe.However, whereas these maps are in practice good indicators of (over)density as shown in previous sections, the overdensity does not drop sharply between the redshift of the two groups MGr55 and MGr58, but rather smoothly evolves, whereas our MUSE data show that the structures are clearly separated in redshift space.This highlights the advantages of using no a priori selection function, of making no assumption based on photometric redshifts, and of having a high spectrocopic redshifts completeness.

Extended ionized gas nebulae in CGr172
As part of the MAGIC survey, two large ionized gas nebulae associated to massive groups have been investigated in detail.
In the dense group CGr30 (M Vir ∼ 5 − 7 × 10 13 M ⊙ ), a gigantic (∼ 100 kpc wide) nebula associated to interactions between galaxies, including one with an active galactic nucleus (AGN), and intragroup gas was found at z ∼ 0.7.Epinat et al. (2018) suggested that a large disk may be reforming around a massive galaxy and the gas is ionized by a combination of electro-magnetic radiations from young stars, AGN and shocks.On the other hand, Boselli et al. (2019) showed the first evidence for ram-pressure stripping at z ∼ 0.7 in two galaxies with ∼ 100 kpc long tails of [O ii]-bright ionized gas, crossing CGr32, the most massive group of MAGIC (M Vir ∼ 2 − 8 × 10 14 M ⊙ ).These nebulae resemble the jellyfish galaxies identified in the GASP survey within local massive clusters (e.g., Poggianti et al. 2017) or perturbed systems in clusters at intermediate redshifts (0.3 < z < 0.5) observed with MUSE by Moretti et al. (2022), where the availability of a comprehensive set of emission lines allowed the identification of photo-ionization as the dominant ionizing mechanism.
We report here the finding of a ∼ 100 kpc bridge of ionized gas seen in [O ii] between two members of the group CGr172 (MGr57) at z ∼ 0.69648.This group contains 22 members and has a mass of M Vir ∼ 2 − 5 × 10 13 M ⊙ .We show in Fig. 20 the F814W HST-ACS image as well as the contours of the [O ii] doublet emission at the redshift of the group.This ionized gas nebula has a tail shape that connects galaxies 104_CGr172 on the eastern side, to 84_CGr172 on the western side, separated by a distance of 93 kpc and having a velocity difference of about 126 km s −1 .The latter is a diffuse low-mass (M ⋆ = 8 × 10 8 M ⊙ ) and star-forming (S FR = 1.5 M ⊙ yr −1 ) galaxy, composed of several clumps in the HST image.It is characterized by a high activity of star formation for its stellar mass which puts it above the main sequence relation.It seems that more small clumps are embedded in the tail between the two objects.Interestingly, 104_CGr172 appears to be in pair with 99_CGr172, with a projected proper separation of 24 kpc and a velocity difference of about 154 km s −1 .These two galaxies are both on the red sequence and are the third and fourth most massive galaxies of the group, with stellar masses of M ⋆ = 1.3 × 10 11 M ⊙ (104_CGr172) and M ⋆ = 1.1 × 10 11 M ⊙ (99_CGr172).The group center is close to 104_CGr172, both using the barycenter and the X-ray estimates.
At a first glance, the ionized gas tail might suggest gas removed during a ram-pressure stripping event from the massive galaxy 104_CGr172, especially because the tail occurs close to the group center where hot intragroup gas is expected from the X-ray detection.However, the presence of star-forming clumps far out in the tail, close and within 84_CGr172, may indicate that the tail is the result of tidal interactions.Using the formalism of Henriksen & Byrd (1996) as suggested in Boselli et al. (2022), we can quantify the acceleration exerted by 104_CGr172 on 84_CGr172 and compare it to the one keeping matter linked to the gravitational potential well of 84_CGr172.Assuming a radius of 4.9 kpc (0.5 ′′ ) for 84_CGr172, corresponding to twice its effective radius, we estimate that the radial acceleration exerted by 104_CGr172 on 84_CGr172 is 20 times smaller than the acceleration keeping matter anchored to the gravitational potential well of 84_CGr172.Assuming that the gas extent within 84_CGr172 is four times its effective radius (1 ′′ , 9.8 kpc), the ratio between the accelerations reduces to only one third.We can thus not exclude that the observed extended tail associated to 104_CGr172 is composed of ionized gas and stars removed from the very active object 84_CGr172, especially if those two objects were closer at an earlier stage of the interaction.During this kind of interaction, the different components of the baryonic matter can be removed from the perturbed system outside a truncation radius, while the one located in the inner regions can infall within the nucleus, sometimes boosting locally the activity of star formation.The clumps observed close to 84_CGr172 can thus result from the turbulent stripped material, while the central ionized gas of 104_CGr172 can be due to gas infalling onto the inner regions.We made the same computations to quantify the tidal perturbation of 99_CGr172 on 104_CGr172 and found that such a tidal perturbation is unlikely, with a ratio of acceleration lower than 1/30, owing to the high mass and compact size (effective radius of about 2 kpc) of 104_CGr172, unless those two galaxies were closer in the past.In that case, the groups of clumps could be viewed as a group of tidal dwarf galaxies.Another scenario is that, rather than 104_CGr172, 84_CGr172 is suffering rampressure stripping by crossing the halo of 104_CGr172 close to the group center, with stripped gas infalling on 104_CGr172 and inducing a burst in its central regions.There could also be a combined effect of ram-pressure and tidal stripping exerted by the halo of 104_CGr172 on 84_CGr172, such as what happens to local group dwarfs in the halo of the Milky-Way (Mayer et al. 2006).There is no evidence for AGN activity in the spectrum of 104_CGr172, which rules out a priori the possibility of this feature to be an ejecta induced by nucleus activity.
Our goal here is only to highlight one of the most impressive nebulae found within the MAGIC dataset.A further analysis would consist in performing a systematic search of galaxies with either ram-pressure stripping or tidal stripping tails in MAGIC datacubes.This would allow one to draw statistics on the mechanisms at play to efficiently remove gas in galaxies, from an emission line flux-limited survey spanning a variety of groups.

Quasar illuminated nebula in CGr84
A quasi stellar object (QSO) is located within field CGr84-M1 at a redshift z = 0.7002, in group CGr84 (MGr58, z = 0.69711), corresponding to the source 231_CGr84.This QSO was previously reported in Prescott et al. (2006) as SDSS J100012.91+023522, and in Heintz et al. (2016) as Q 100012.9+023522.8.This galaxy has a stellar mass inferred from SED fitting of 2.6 × 10 10 M ⊙ , and it appears star-forming though strongly bulge-dominated.However, these properties are not reliable because the QSO source biases both the morphology and the spectrum of the host galaxy.It has a velocity of 545 km s −1 within the group, larger than the dispersion of CGr84 (σ g = 437 km s −1 ), and is located at a distance of 336 kpc from the center of the group, which is about half R 200 = 735 kpc of CGr84.The probability for this galaxy to be the brightest central galaxy of the group is thus low.The QSO spectrum displays bright and broad emission lines and is much brighter in [O iii], Hβ, or Mg ii than in [O ii].It is surrounded by an ionized gas nebula shining in [O ii], but brighter and more extended in [O iii]λ5007 (see Fig. 21), which suggests that the surrounding gas is ionized by the QSO.The nebula covers almost 10 ′′ from South to North (∼ 70 kpc in proper distance at the redshift of the QSO).It mostly extends to the North-East11 , while there is a gap between the southernmost part of the nebula and the QSO.This gap may be due to 213_CGr84, a bright and massive foreground galaxy at a redshift z = 0.66824 bridging this gap, that is thus not a member of CGr84.Indeed, this galaxy may induce noise in the data and partially screen the nebula behind it.The nebula is therefore not associated to any bright galaxy except the QSO itself.The corresponding X-ray group W11 (Gozaliasl et al. 2019) may actually be partly associated to this QSO.
Owing to its velocity within the group, this galaxy is likely traveling at high speed within the hot intragroup medium, detected in X-ray.The elongated and asymmetric shape of the northern part of the nebula might therefore be formed by the external pressure acting on the ionized gas.Indeed, the orientation of the nebula is in relative agreement with the direction of the group center (red cross in top panel of Fig. 19, where the QSO is the southernmost galaxy circled in red).It has been claimed that a nuclear activity can be triggered during a ram pressure stripping process (Poggianti et al. 2017;Peluso et al. 2022), and such an association has also been observed around QSO at intermediate redshifts (Johnson et al. 2018;Helton et al. 2021).This result, however, has been recently questioned by Boselli et al. (2022) and Cattorini et al. (2023) who did not find any increase in the nuclear activity in local galaxies suffering a ram pressure stripping event.Large nebulae associated to ram pressure stripping are also observed in the most massive structure of MAGIC, CGr32, but not associated to nuclear activity (Boselli et al. 2019).On the other hand, in CGr30, an extended nebula is associated to an AGN, but in this case, interactions between galaxies seems more probable (Epinat et al. 2018), though ram pressure stripping could also be acting.It is also possible that the gas seen in emission around the QSO in CGr84 originates from the circum-galactic or from the intragroup media.
We estimate the monochromatic luminosity at 5100 Å by fitting the Hβ line in the QSO spectrum, following the method described in Shen et al. (2011).We further apply a bolometric correction (Richards et al. 2006) to infer a bolometric luminosity of log (L bol /[erg s −1 ]) = 45.9.The Hβ FWHM based on a joint narrow plus broad line fit including a power-law continuum and iron complex template from Boroson & Green (1992) is FWHM Hβ = 2200 km s −1 .Using the single-epoch virial estimator from Shen et al. (2011), this results in an estimated super massive black hole mass (SMBH) mass of log (M BH /[M ⊙ ]) = 8.0 which would mean that the QSO is accreting at a rate of L = 0.6L Eddington .
The giant, optically emitting nebula presented here is found around a QSO that is lower in both bolometric and NUV luminosities, and in SMBH mass by a factor of about ten relative to other QSO at intermediate redshifts with published nebulae on similar scales (Johnson et al. 2018;Helton et al. 2021; Johnson  Chen et al. 2023;Liu et al. 2024).This suggests that such giant nebulae might be quite common around more typical quasars.

Gravitational arc in CGr32
A gravitational arc (514_CGr32) is clearly detected in the field CGr32-M3 around the galaxy 152_CGr32 at z = 0.72519.This galaxy is passive and is the most massive of cluster CGr32 (MGr65) with a stellar mass of 2.57 ± 0.13 × 10 11 M ⊙ .This arc was already identified by Faure et al. (2008) as COS-MOS5939+3044 and is composed of two elongated images of the same galaxy North of 152_CGr32.Thanks to the unambiguous detection of the asymmetric Lyα line with MUSE, we are able to determine that the arc source is at z = 4.0973, and to find two other images of this galaxy at the same redshift (513_CGr32 and 530_CGr32) on the other side of the lens, as illustrated in Fig. 22.The large angular separation between the lensed images indicates the presence of massive structure in addition to the lens.We model the lensing configuration of this system using a single isothermal elliptical potential at the location of 152_CGr32 (parameterized by its velocity dispersion σ, ellipticity e and angle θ), together with an external shear (parameterized with an amplitude γ ext and shear angle θ ext ).We are able to recover the locations of the four lensed images with an rms of 0.04 ′′ .The velocity dispersion of the main lens is 290 ± 15 km s −1 , and we find a significant shear γ ext = 0.27 ± 0.08 and θ ext = −81 ± 8 • .
The value of σ found can be compared with the one inferred from the MUSE spectrum.We run the penalized pixel-fitting (pPXF) code12 (Cappellari & Emsellem 2004) on the lens integrated spectrum to fit its stellar continuum and infer its velocity dispersion.The spectrum is extracted over a 6 ′′ wide square aperture.We use the MILES stellar population synthesis library (Sánchez-Blázquez et al. 2006;Vazdekis et al. 2010;Falcón-Barroso et al. 2011) and take into account the lower spectral resolution (FWHM = 2.5 Å) of this stellar library, compared to MUSE, taking advantage of the intrinsically large dispersion of the galaxy, to estimate that the velocity dispersion of the lens is about 250 km s −1 .This value shows a good agreement with the results from our lens model.The orientation of the shear hints to the presence of a very massive structure at a position angle of ∼ 9 ± 8 • (blue wedge in Fig. 22).This direction is in fair agreement of about ∼ 20 − 25 • at 1-σ with the direction of CGr32 center found in X-ray and from MUSE spectroscopic redshifts (39 • and 44 • respectively, green wedge in Fig. 22).This global agreement seems to indicate that the shear is dominated by CGr32, and the small offset may be due to a nearby less massive sub-structure or to some asymmetry in CGr32 producing a local tilt of the external shear at the location of the lens.We also determine that the velocity dispersion of this massive structure is between 800 km s −1 and 1200 km s −1 , which is consistent with the velocity dispersion of CGr32 of 928 km s −1 .

Summary and conclusions
We present the Muse gAlaxy Groups In Cosmos (MAGIC) survey, which was designed to investigate the impact of environment on galaxy evolution at intermediate redshift.It targets 14 known massive groups at 0.3 < z < 0.8 in the COSMOS field, but its strength lies in the use of any galaxy in the 17 MUSE fields to span various environments, such as isolated galaxies, pairs, small groups, massive groups, and clusters.Thanks to medium-deep exposures of 1-10 hours, and no a priori target selection, spectroscopic redshifts were computed for 1683 objects, including 1419 with secure redshifts, of which 1154 are galaxies in the redshift range of [O ii] emitters (0.25 ≤ z < 1.5).The MAGIC survey increases the number of galaxies with known secure spectroscopic redshifts on the MAGIC fields by a factor of five thanks to its ability to derive redshifts for objects with apparent magnitudes fainter than z ++ app > 21.5; previous spectroscopic campaigns missed these either because of selection or a lack of sensitivity.The spectroscopic redshift completeness of the MAGIC sample is globally above 80% in the redshift range 0.25 ≤ z < 1.5 down to an apparent magnitude of z ++ app = 25.9, and is locally close to unity down to z ++ app = 23−24 and above 50% down to z ++ app = 25.5 in bins of redshift and apparent magnitude over the same redshift range.
With this paper, we release the MAGIC group and galaxy catalogs.Groups were identified through a FoF algorithm.Group Viral mass and radius were inferred from the velocity dispersion of the group members.For each galaxy, we determined the overdensity thanks to the VMC method on large-scale spectrophotometric surveys in COSMOS.For galaxies in groups, we further determined (i) another local density estimator using the Voronoi tessellations method based on MUSE spectroscopic redshifts at higher spatial resolution than the VMC method, and (ii) a global density using a phase-space parametrization based on the velocities of galaxies within groups and on their distance to the group center relative to group velocity dispersion and size.
The MAGIC group catalog contains 76 pairs of galaxies and 67 groups of at least three members, including 19 groups of ten or more members.The catalog stores all the global information about the groups.Most of the groups are in the redshift range 0.25 ≤ z < 1.5, where MUSE can detect the [O ii] doublet.The galaxy catalog contains all 1683 objects with spectroscopic redshifts inferred from MUSE data.This catalog stores the redshift and position information as well as the identification of groups and the density estimators at the position of the galaxy.It further contains galaxy properties and rest-frame colors inferred from SED fitting with the Cigale software on the COSMOS photometry.
Owing to its observing strategy, MAGIC contains galaxies in dense, massive, and rich groups as well as galaxies in field and low-richness groups.We showed that the fraction of quiescent galaxies is low -namely of about ∼ 5%-in regions of low overdensity, in groups of ten or less members, and in the outskirts of massive groups, where it is similar to that of the population of field galaxies.This fraction significantly increases with local density and with group mass.For groups richer than ten members, the fraction is stable, but it clearly increases with the time spent by galaxies within the groups.We also find that the mass distribution of quiescent galaxies is shifted towards systems more massive than M ⋆ = 10 10 M ⊙ , and that the fraction of both quiescent and star-forming galaxies more massive than M ⋆ = 10 10 M ⊙ gets larger as density increases.Moreover, the fact that the fraction of galaxies less massive than M ⋆ = 10 9 M ⊙ decreases with environment density seems to indicate that those galaxies merged to form more massive ones as environments became denser.Our results also point toward a clear morphological dichotomy between disk-dominated star-forming galaxies and bulge-dominated quiescent galaxies.The impact of environment on bulge and disk contributions of star-forming galaxies is not large and could be due to the larger stellar mass of such galaxies in dense environments.These findings suggest that galaxies are preprocessed in groups of increasing mass before entering massive groups and clusters.
Several peculiar features found in groups were also highlighted.Two groups and one cluster at a similar redshift (z ∼ 0.73) and with relatively small transverse separations are observed and may be connected, the two groups being either subgroups of the cluster or infalling groups along cosmic web filaments.We also found two massive groups along the same line of sight with a scaled redshift separation of ∆z = 0.01, which is too large for the two groups to be connected.Surprisingly, only one of those groups was previously identified in the zCOS-MOS 20k group survey.The MAGIC dataset also enabled us to serendipitously find new ionized gas nebulae within massive groups, probably associated to interaction between galaxies or between galaxies and the intragroup medium.In addition, one of the MAGIC fields contains a quasar that is surrounded by an extended ionized gas nebula that resembles other quasarilluminated nebulae, except that the quasar in MAGIC is about ten times fainter, with a SMBH that is ten times less massive than other such quasars.Finally, a gravitational arc is also present in one MAGIC field and the MUSE data allowed us to find four images of a Lyα emitter at z ∼ 4 lensed by a massive galaxy at z ∼ 0.725.
All these findings show that the large monolithic FoV of the MUSE spectrograph is well suited to identifying associations between galaxies down to low mass and large-scale structures, and to studying the interconnection between galaxies and their environment.In the evolving context of galaxy evolution with environment, integral field spectrographs with larger FoVs would be necessary to map the cosmic web filaments in order to better explore the connections between groups.

Fig. 1 .
Fig. 1.F814W HST-ACS mosaic over the COSMOS field footprint in logarithmic scale (arbitrary unit), with MAGIC fields displayed as squares color-coded according to their depth: blue (1h), purple (2.67h), green (4.11h to 5.25h), and red (9.75h).The scale corresponding to a proper distance of 1 Mpc is indicated for various redshifts in the top-left corner.
Confidence 1: tentative redshift, based on a single emission line or several absorption features with a S/N lower than ∼ 3−5 per spectral element, either on the emission line maximum intensity or on the continuum.-Confidence 2: secure redshift based on a single emission line (such as the [O ii] doublet) with a S/N above ∼ 5 without additional information, or several absorption features with intermediate S/N (∼ 5 − 10) -Confidence 3: secure redshift based on multiple high S/N spectral features or on a single recognizable emission line, such as a well resolved [O ii] doublet, or an asymmetric Lyα line.

Fig. 4 .
Fig. 4. Examples of sources with various redshifts and associated confidence levels.From top to bottom, we show spectra (in black) and associated 1σ noise (in gray) with (i) confidence 1, with tentatively [O ii] at low S/N, (ii) confidence 2 with the [O ii] doublet spectrally resolved with a correct S/N, (iii) confidence 3 with multiple emission lines at high S/N, (iv) confidence 3 with strong continuum features, and (v) confidence 3 with the [O ii] doublet with a high S/N and Fe ii and Mg ii absorption lines.The main spectral features expected in either absorption or emission are indicated by red and blue vertical lines, respectively.Zoom-in of the normalized rest-frame spectrum around the [O ii] doublet is shown to the right of each spectrum, as well as the MUSE [O ii] narrow band image obtained from collapsing the continuum-free cube over ±5 Å at rest-frame, and the HST-ACS image in the F814W band.Displayed spectra have been extracted on 1 ′′ diameter apertures and smoothed using a two-spectral-element FWHM Gaussian kernel.Images are 2 ′′ wide.

Fig. 5 .
Fig. 5. Redshift distribution in the MAGIC sample with redshift confidence flags of 1 (orange), 2 (blue), and 3 (red).Stars are shown in the negative bin.

Fig. 6 .
Fig.6.Distribution of galaxies within the MAGIC footprint in the apparent z ++ band magnitude-redshift plane for COSMOS-z spec sources with secure (red) and likely (orange) redshifts and new MAGIC sources with secure redshifts (blue).The fraction of galaxies with new secure MUSE redshifts is provided as a function of magnitude (right panel) and redshift (top panel), with respect to either COSMOS-z spec secure (red) or both secure and likely (orange) redshifts.

Fig. 7 .
Fig.7.Spectroscopic redshift completeness as a function of redshift and z ++ band apparent AB magnitude measured in 3 ′′ diameter circular apertures.The black vertical dotted lines show the redshifts z = 0.25, 1.5, and 2.9, whereas the orange dashed line corresponds to the limiting magnitude z ++ = 25.9 of COSMOS2015 measured within 3 ′′ .Contours correspond to the number of galaxies per bin with photometric redshifts at levels 2, 4, 8, and 16 (from black to white).Beyond z = 1.5, only a few discrete completeness values are computed due to the limited statistics within each bin.
and Hung et al. (2020), using the probabilistic model defined inLemaux et al. (2022), to estimate the local density from both photometric and spectroscopic redshifts catalogs.The photometric redshift catalog is COSMOS2015(Laigle et al. 2016), and we include both zCOSMOS(Lilly et al. 2007) and VIMOSUltra-Deep Survey (VUDS, Le Fèvre et al.  2015)  full spectroscopic catalogs that provide a fairly homogeneous sampling over the COSMOS field.

Fig. 8 .
Fig. 8. Map of the overdensity for CGr32 obtained with the VMC method.The displayed slice is at the mean redshift of CGr32 and covers the three fields mosaic.
Fig. 11.Group richness as a function of their Virial mass for groups with five or more members with 0.25 ≤ z < 1.5.Initially targeted groups have gray contours, and groups with X-ray counterparts are identified as colored squares.The color of the symbols refers to the redshift of each group.

Fig. 15 .
Fig. 14.NUV − r + vs r + − J histograms for the VMC overdensity classes.The gray lines show the region of the diagram used to identify quiescent galaxies.The global fraction of quiescent and star-forming galaxies is provided in each quadrant.

Fig. 16 .
Fig. 16.Normalized histograms of the bulge-to-disk ratio within the galaxy effective radius for star-forming and quiescent galaxies.The first and last bins contain all galaxies with B/D below 0.1 and above 10, respectively.

FractionFig. 17 .
Fig. 17.Histograms of stellar mass (top left panel), bulge-to-disc ratio within the galaxy effective radius (top right panel), color (bottom left panel), and SFR (bottom right panel) using the four VMC overdensity classes (see Sect. 5.1 and Table5).For each class in each histogram, the leftmost and rightmost bins contain all objects with values below and above the corresponding limits, respectively.

Fig. 20 .
Fig.20.F814W HST-ACS image of the filamentary structure found in CGr172 at z ∼ 0.696 in logarithmic scale (arbitrary unit).The circles correspond to galaxies in the COSMOS2015 catalog within the field with secure redshifts, either within the same group as the extended emission (black), in the foreground (blue), or in the background (red).The green star marks a foreground star and the emission around it is an artifact.The black plus symbol and cross show the position of the group barycenter and X-ray center, respectively.The IDs of galaxies within CGr172 are indicated.The blue contours represent the [O ii] doublet in emission, at levels 0.25, 0.5, 1, and 2×10 −17 erg s −1 cm −2 arcsec −2 , after a Gaussian spatial smoothing of two pixels FWHM.Contours are estimated by collapsing the MUSE cube over 20 Å at the observed wavelength of both lines, and by subtracting the continuum using 50 Å wide adjacent wavelength ranges on both sides of the lines.

Fig. 21 .
Fig.21.F814W HST-ACS image of the surroundings of the QSO 231_CGr84 at z = 0.7002, centered on the QSO (identified with a white cross), in logarithmic scale (arbitrary unit).The circles correspond to galaxies in the COSMOS2015 catalog within the field with secure redshifts, either in the foreground (blue) or in the background (red).The green and blue contours represent the [O iii]λ5007 and [O ii] emission lines respectively, at levels 0.25, 0.5, 1, and 2 × 10 −17 erg s −1 cm −2 arcsec −2 after a Gaussian spatial smoothing of two pixels FWHM.Contours are estimated by collapsing the MUSE cube over 20 Å at the observed wavelength of both lines, and by subtracting the continuum using 50 Å wide adjacent wavelength ranges on both sides of the lines.

Fig. 22 .
Fig. 22. F814W HST-ACS image centered on the lensing source, 152_CGr32, at z = 0.72519 in logarithmic scale (arbitrary unit).The red contours represent the Lyα emission of the lensed source at z = 4.0973 at levels 1, 2, and 4 × 10 −17 erg s −1 cm −2 arcsec −2 .It is estimated by collapsing the MUSE cube over 20 Å at the observed wavelength of the Lyα line, and by subtracting the continuum using 50 Å wide adjacent wavelength ranges on both sides of the Lyα range.The four images are identified with black crosses, the lens model critical lines are displayed in purple, and the blue wedge indicates the range in the directions to the massive structure responsible for the shear in the lens model, at 1σ.The green wedge represents the center directions between the barycenter of CGr32 members inferred from MUSE data and the X-ray center.

Table 1 .
Log of observations for all observed fields.
Knobel et al. (2012) observed field, the field identifier corresponds to the targeted group ID inKnobel et al. (2012), for CGr32 and CGr84, -Mi suffixes correspond to sub-fields of the mosaic.(2),(3)EquatorialJ2000rightascension and declination of the field center.(4)MUSEfieldorientationmeasured from North to East.(5)Total on-source exposure time, the value in parentheses with bold fonts corresponds to the exposure time obtained using the adaptive optics mode, if any.(6) ESO periods of observations, bold fonts correspond to AO observations.(7)Image quality at 7000 Å for a Moffat PSF.(8) Image quality variation with wavelength for a Moffat PSF.(9) β parameter of the Moffat PSF.

Table 2 .
Grid of free parameters for Cigale SED models.
within each targeted MUSE FoV, we extracted a PSF-

Table 3 .
Statistics for each class of objects as a function of redshift confidence level (CONFID) in the MAGIC survey.

Table 4 .
MAGIC catalog of groups with more than 5 members.