1 Introduction

In 1998, the evidence of the accelerating expansion of the Universe was first revealed by the unexpected dimming of the type Ia supernovae (SNIa) [1, 2]. In the frame of the General Relativity, a cosmic distribution of an exotic component with negative pressure, dubbed as dark energy, has been suggested to explain the present acceleration. On the other hand, a cosmological distribution of dust has been proposed to be an alternative explanation for this dimming phenomenon [3]. Indeed, the photons may be absorbed or scattered by dust in the Milky Way, intervening galaxies, the intergalactic medium, and their host galaxies [4]. However, it has always been a controversial topic that whether the extinction effect of SNIa has a great impact on the conclusion of cosmic accelerating expansion [4,5,6,7,8]. In addition, some other plausible mechanisms attempt to explain cosmic opacity, such as scalar fields coupled nonminimally with the electromagnetic (EM) Lagrangian [3, 9,10,11] or oscillation of photons propagating in extragalactic magnetic fields into light axions [12,13,14,15]. Exotic mechanisms for cosmic opacity are not fully understood yet. Any changes in the photon flux during propagation towards the Earth will affect the luminosity distance (LD) measurements of light sources. As the cosmic acceleration rate and the cosmological parameters determined by the LD measurements are highly dependent on the dimming effect, cosmic opacity still needs to be investigated accurately in the era of precision cosmology.

The general tests on cosmic opacity have been performed by using the cosmic distance-duality relation (CDDR), which connects the LD \(D_\mathrm{L}\) with the angular diameter distance (ADD) \(D_\mathrm{A}\) at the same redshift z through the identity [16, 17]: \({D_\mathrm{L}}{(1+z)}^{-2}/{D_\mathrm{A}}=1\). Provided that light travels always along null geodesics in a Riemannian geometry and the number of photons is conserved, this reciprocal relation holds true in whatever cosmology [18,19,20]. If Riemannian geometry is used as the tool to describe the spacetime of the Universe and a photon traveling along null geodesic is more fundamental than the conservation of the photon number [21, 22], any violations of the CDDR likely indicate the opacity of the Universe. Many works have been devoted to probe cosmic opacity with the SNIa, baryon acoustic oscillation (BAO), the galaxy cluster samples, the Hubble data, the old passive galaxies, and the gas mass fraction of galaxy clusters [12, 13, 23,24,25,26,27,28,29]. No significant cosmic opacity is obtained in these studies.

It should be noted that most of the measurements are using EM radiation, although the cosmological parameters can be measured precisely from various astronomical observations. Schuts first proposed that [34], using the fact that the waveform signals of GWs from inspiraling and merging compact binaries encode distance information, the Hubble constant can be determined from GW observations. So, this type of GW sources can be considered as standard sirens in astronomy, analogous to SNIa standard candles. Compared with the distance estimation from SNIa measurements, the LDs can be obtained directly from the GW signals without the need of a cosmic distance ladder since stand sirens are self-calibrating. It is more important that GWs are able to propagate freely through a perfect fluid without any absorption and dissipation in the Friedman–Lemaître–Robertson–Walker metric. Therefore, most objects (e.g. the Earth) are nearly transparent to GWs [35] and the standard siren can be considered as an opacity-free distance indicator. Generally speaking, it is hard to obtain the redshift of the GW source. But the source redshift might be obtained from the observation of EM counterparts that occur coincidentally with the GW events [36,37,38,39], if compact binaries are neutron star (NS)-NS or black hole (BH)-NS binaries. Recently, the joint detection of GW event GW170817 with EM counterpart (GRB 170817A) from the merger of binary NSs [30,31,32,33] opened a new era of multi-messenger cosmology. Thus, the LD-redshift relation can be constructed by a cosmological model-independent way, and it can be used to make constraints on the parameters of cosmology.

The Einstein Telescope (ET), which is the third generation of the ground-based detector, will be able to detect GW signals ten times more sensitive in amplitude than the advanced ground-based detectors, and it can cover a wide range of frequency \(1\sim 10^4\) Hz up to redshift \(z\sim 2\) for the NS-NS and \(z>2\) for the BH–NS mergers systems. So, the measurements from ET will provide us with an opportunity to make constraint on the parameters of cosmology at relative higher redshifts. Up to now, the simulated GW data have been used to measure the cosmological parameters [40,41,42,43,44,45,46,47,48,49,50], determine the total mass of neutrino [51], investigate the anisotropy of the Universe [52, 53], constrain the evolving Newton’s constant G [54], discuss the estimation of the Hubble parameter with the actual background expansion model of the universe [55, 56], and test the CDDR [57,58,59].

More recently, confronting the LD from Joint Light Analysis (JLA) SNIa or Pantheon compilation with the opacity-free LD from future observational GW data, Wei [60], Qi et al. [61], and Zhou et al. [62] performed successively unbiased tests on the cosmic opacity with different methods. The results showed that future GW measurements would be at least competitive with current tests on cosmic opacity. However, regarding the tests referred above, it is important to note that due to the limitation of the redshift distribution observed by SNIa, the tests are only limited to the redshift range \(0<z<2.0\). The cosmic opacity in the redshift region between the SNIa and cosmic microwave background (CMB) observations remains to be explored. On the other hand, since current astronomical observation involving SNIa and other available data cannot yet confirm whether the density of dark energy is constant or time-varying, the LDs of gamma-ray bursts (GRBs) have been used to constrain cosmological parameters to determine the behaviors of dark energy at higher redshifts \(2<z<8\). The measurements of GRBs can be considered as a new means to make constraint on the property of dark energy, once phenomenological relations are adopted to make the sources of bursts to be standardized candles [63,64,65,66,67]. Thus, to have confidence in the analyses with the GRBs observations, it is important to test cosmic opacity in the high redshift region as well. Holanda et al. tried to probe the cosmic opacity with the LDs of SNIa, Hubble parameter H(z) , and GRBs data at high redshifts (\(z>1.4\)) for a flat cosmological constant and cold dark matter (\(\Lambda \)CDM) model [68], and found that the observational data were compatible with a transparent universe at \(1\sigma \) confidence level (CL). However, it should be noted that the analyses in Ref. [68] are model-dependent, thus some bias might result from some particular cosmological models. To draw firm and robust conclusion on the behaves of dark energy, one needs to employ new observational data and methods to probe the cosmic opacity by creasing the redshift depth. Therefore, future GW measurement and GRB observation at high redshifts will be reliable candidates for this task, which is also the motivation of this paper.

In this work, we explore the potentiality of future GW measurements to probe the cosmic opacity at high redshifts through comparing its opacity-free luminosity distance (LD) with the opacity-dependent one from the combination of SNIa and GRBs data. GW data points are simulated from the ET, the SNIa data are simulated from the Pantheon compilation [69], and GRB data are simulated from the latest catalogue which are obtained with a cosmological model-independent technique to overcome the circularity problem [70]. To match the GW data with the combination of SNIa and GRB data at the same redhsift, we employ the Gaussian process [71, 72] to reconstruct the continuous LD function from the mock GW measurements or the combination of SNIa and GRB data. In our analysis, we first probe the spatial homogeneity of the cosmic transparency by using non-parametric method. Then, we test the cosmic opacity by adopting two types of parameterizations for the optical depth. Compared to previous results, our analyses show that future measurements of GW will be an important tool to probe cosmic opacity at high redshifts.

2 Data and the Gaussian process

To dodge the impacts of any systematics from the combination of SNIa and GRB datasets, we compare the opacity-free LD from the mocked measurements of future GW events with the observed one obtained from the combination of ‘Pantheon-like’ SNIa and ‘GRBs-like’ compilations.

2.1 Pantheon SNIa and GRB data

The Pantheon SNIa compilation is released by the Pan-STARRS1 Medium Deep Survey, which consists of 1048 data points up to redshift \(z\sim 2.26\). The LDs of the Pantheon compilation are calibrated from the SALT2 light-curve fitter through applying the Bayesian Estimation Applied to Multiple Species with Bias Corrections method to determine the nuisance parameters and taking account of the distance bias corrections. The distance modulus and its uncertainty can be obtained from \(\mu =m_\mathrm{B}-M_\mathrm{B}\) and \(\sigma _{\mu }=\sigma _{m_\mathrm{B}}\), where \(m_\mathrm{B}\) and \(M_\mathrm{B}\) is the rest-frame peak magnitude in the B band and the absolute magnitude of SNIa, respectively. Then the LD (\(D_\mathrm{L}\)) can be derived from the relation

$$\begin{aligned} \mu (z)=5\log _{10}[D_\mathrm{L}(z)]+25, \end{aligned}$$
(1)

and its uncertainty \(\sigma _{D_\mathrm{L}}={\ln {10}}~\sigma _\mu D_\mathrm{L}\)/5.

The GRBs can be observed up to redshift \(z\sim 10\) due to the intense explosions in the Universe. An important observational aspect of long GRB is the several correlation between the spectral and intensity properties, which suggests that the GRB measurement can be used as a complementary cosmic probe to the standard candles [63,64,65, 77,78,79,80,81,82,83,84,85,86,87,88,89,90], although the mechanism behind GRBs explosions is not completely known yet. One of the most successful proposals is the Amati relation (\(E_\mathrm{p}\)\(E_\mathrm{iso}\) relation) [64, 65], which relates the rest frame spectral peak energy \(E_\mathrm{p}\) and the bolometric isotropic-equivalent radiated energy \(E_\mathrm{iso}\). However, the application of GRB observations for cosmology is also affected by the so-called circularity problem [64, 65, 84, 89, 90], which arises from the fact that, given the lack of low redshift measurements of GRBs, the \(E_\mathrm{p}\)\(E_\mathrm{iso}\) correlation is obtained through assuming a background cosmology. For example, using the standard \(\Lambda \)CDM model to calibrate the GRB measurements, it will inevitably return an overall agreement with the concordance model to make constraints on cosmological parameters of any dark energy framework. Thus, calibrating the Amati relation is a challenge if one dodges the problem of circularity. Recently, Amati et al. proposed a model-independent technique to overcome the circularity problem with the Amati relation [70], and built up a compilation consisting of 193 GRB data points. To calibrate this relation, they fitted the most recent Hubble data with a B\(\acute{\mathrm{e}}\)zier parametric curve, and employed the Hubble data to approximate the cosmic evolution. Then, with the combination of this GRB data set and SNIa JLA compilation, they made observational constraints on the flat \(\Lambda \)CDM model, and obtained that \((\Omega _\mathrm{m}, \alpha , \beta , \mathrm{M}_\mathrm{B})=(0.397\pm _{0.039}^{0.040},0.126\pm _{0.012}^{0.011}, 2.610\pm 0.130,19.090\pm 0.037)\) at \(2\sigma \) CL. Here, \(\Omega _\mathrm{m}\) denotes the present dark matter density parameter. The constraints on the cosmological parameters are obviously different from the results of current observations [69, 73].

It should be noted that, due to the little knowledge of the physical processes driving the explosion, GRB observations, as the cosmological probing tools, are not considered as important as the other astronomical measurements, such as SNIa, BAO, and CMB. There is a strong debate in Ref. [91] concerning whether the Amati relation is an intrinsic property of GRBs or merely a combination of selection effects. Moreover, Ref. [92] studied the strong evolution in the LD function of GRB, and the results showed that GRBs might be intrinsically more luminous at high redshifts. If the Amati relation is used to calibrate the high-redshift GRB with the low-redshift ones, a smaller distance to GRB would be obtained.

Since the main purpose of this work is to probe the potentiality of future GW measurements, it can be assumed that the problems of the GRB explosion will be solved in the next few decades, and the GRBs observation can be used as a complementary tool for SNIa measurements. In this work, in order to doge any systematic impact while combining the SNIa data with the GRB data, SNIa and GRB data are simulated from a flat \(\Lambda \)CDM. 137 deta points from the GRB compilation in the redshift range \(1<z<5\) are added to Pantheon SNIa data to test cosmic opacity. The redshifts and uncertainties are taken from the actual Pantheon [69] and GRBs compilation [70]. The fiducial LDs (\(D_\mathrm{L}^\mathrm{fid}\)) of the mock data are obtained from a known flat \(\Lambda \)CDM with the most recent Planck results [93],

$$\begin{aligned} h_0=0.678,~~~\Omega _\mathrm{m}=0.308, \end{aligned}$$
(2)

where \(H_0=100 h_0\,\mathrm{km s^{-1}\,Mpc^{-1}}\) denotes the present Hubble constant. The measurements of LD (\(D_\mathrm{L}\)) can be derived from the random normal distribution through the equation \(D_\mathrm{L}=\mathcal {N}(D_\mathrm{L}^\mathrm{fid}, \sigma _{D_\mathrm{L}})\). The mock SNIa and GRB data refer to ‘SNIa-like’ and ‘GRB-like’ data, respectively. The simulated method has been applied in discussing the estimation of the Hubble parameter with different background expansion model [56]. Our simulated results are presented in the left panel of Fig. 1.

2.2 Simulated GW data

We simulate the GW data based on the ET which is the third-generation of ground-based GW detector. The ET will be able to detect GW signals to be ten times more sensitive in amplitude than the advanced ground-based detectors. It can cover a wide range of frequency \(1\sim 10^4\) Hz up to redshift \(z \sim 5\). The strategy implemented with the future GW detectors has been discussed in Refs. [94,95,96,97,98,99]. In the following of this subsection, we will summarize the process of mocked GW data for simplification.

Given that the effect, which is from the spin of the binary system and the change of orbital frequency over a single period, is negligible, for the waveform of GW, one can apply the stationary phase approximation to compute the Fourier transform \(\mathcal {H}(f)\) of the time domain waveform h(t),

$$\begin{aligned} \mathcal {H}(f)=\mathcal {A}f^{-7/6}\exp [i(2\pi ft_0-\pi /4+2\psi (f/2)-\varphi _{(2.0)})], \end{aligned}$$
(3)

where \(\psi \) denotes the polarization angle, \(\varphi _{(2.0)}\) denotes the phase parameter, and the Fourier amplitude \(\mathcal {A}\) is given by

$$\begin{aligned} \mathcal {A}= & {} \frac{1}{D_\mathrm{L}}\sqrt{F_+^2(1+\cos ^2(\iota ))^2+4F_\times ^2\cos ^2(\iota )}\nonumber \\&\quad \times \sqrt{5\pi /96}\pi ^{-7/6}\mathcal {M}_\mathrm{c}^{5/6}\,. \end{aligned}$$
(4)

Here, \(\mathcal {M}_\mathrm{c}\) presents the chirp mass, \(F_{+,\times }\) denotes the beam pattern functions, \({D_\mathrm{L}}\) is the LD from GW signals, \(t_0\) presents the epoch of the merger, and \(\iota \) responds to the angle of inclination. For the simulation estimation of LD, we use the flat \(\Lambda \)CDM as the fiducial cosmological model with the model parameters in Eq. 2.

The signal-to-noise ratio (SNR) for the network from the three independent ET interferometers can be written as

$$\begin{aligned} \rho =\sqrt{\sum _{i=1}^{3}\langle \mathcal {H}^{(i)},\mathcal {H}^{(i)}\rangle }\,. \end{aligned}$$
(5)

Here, the inner product indicates the following equation

$$\begin{aligned} \langle a,b\rangle =4\int _{f_\mathrm{lower}}^{f_\mathrm{upper}}{\widetilde{a}(f)\widetilde{b}^{*}(f)+\widetilde{a}^{*}(f)\widetilde{b}(f)\over {2}}{df\over {S_h(f)}}\,, \end{aligned}$$
(6)

here \({S_h(f)}\) represents the one-side noise power spectral density characterizing the performance of a GW detector. \(f_\mathrm{lower}\) represents the lower cutoff frequency which is fixed at 1 Hz, and \(f_\mathrm{upper}\) does the upper cutoff one decided by the last stable orbit (LSO), and \(f_\mathrm{upper}=2f_\mathrm{LSO} \), where \(f_\mathrm{LSO}=1/(6^{3/2}2\pi M_\mathrm{obs})\) is the orbit frequency at the last stable orbit. In this work, the masses of NS and BH are simulated with uniform distribution in the intervals \([1,2] M_\odot \) and \([3,10] M_\odot \), respectfully, where \(M_\odot \) denotes the solar mass. The ratio between BH–NS and NS–NS binary systems is taken to be nearly 0.03 [53, 100]. As presented in the Advanced LIGO-Virgo network [36, 100], the observational signal might be identified as a GW events, only if the interferometers have a network SNR of \(\rho >8.0\).

Using the Fisher information matrix, one can obtain the instrumental uncertainty of the measurement of GW LD. It is assumed that the LD (\(D_\mathrm{L}\)) is uncorrelated with the errors on the remaining GW parameters (the inclination angle \(\iota =0\)), \(\mathcal {H}\propto D_\mathrm{L}^{-1}\), and the corresponding instrumental uncertainty can be written as, \(\sigma _{D_\mathrm{L}}^\mathrm{inst}\simeq {2D_\mathrm{L}/ {\rho }}\,\). Furthermore, the LD is also affected by the effect of the weak lensing, and the lensing uncertainty can be assumed as \(\sigma _{D_\mathrm{L}}^\mathrm{lens}=0.05z D_\mathrm{L}\) [36, 39, 46]. Thus, the total uncertainty of GW LD measurements is taken to be,

$$\begin{aligned} \sigma _{D_\mathrm{L}}= & {} \sqrt{(\sigma _{D_\mathrm{L}}^\mathrm{inst})^2+(\sigma _{D_\mathrm{L}}^\mathrm{lens})^2}\nonumber \\= & {} \sqrt{\bigg ({2D_\mathrm{L}\over {\rho }}\bigg )^2+(0.05zD_\mathrm{L})^2}\,. \end{aligned}$$
(7)

It is expected that the source redshift can be obtained from the identified EM counterparts from the NS–NS and BH–NS binary systems. The redshift distribution of GW sources is taken from the form of [36, 101]

$$\begin{aligned} P(z)\propto {4\pi d^2_\mathrm{C}(z)R(z)\over {H(z)(1+z)}}\,, \end{aligned}$$
(8)

where H(z) represents the Hubble parameter from the fiducial cosmological model, \(d_\mathrm{C}\) is comoving distance, and R(z) is the merger rate of binary systems with following expression [36, 39],

$$\begin{aligned} R(z)= \left\{ \begin{array}{ll} 1+2z, &{} (z\le 1) \\ \frac{3}{4}(5-z), &{} (1<z<5) \\ 0, &{} (z\ge 5). \end{array}\right. \end{aligned}$$
(9)

It is expected for the ET that the rates of NS–NS and BH–NS binary detections per year are about the order \(10^3-10^7\) [37]. However, this prediction about the rate is very uncertain. Then, Cai and Yang [39, 57] predicted that about \(10^2\) GW measurements with EM counterparts will be observed per year, if the middle detection rate around \(10^5\) is viable and the efficiency of EM counterparts are around \(10^{-3}\) of the total number of binary coalescence. In this paper, following the process from Refs. [36, 39, 57], we simulate 1000 data points in the redshift range \(0<z<5\), and show the results in the right panel of Fig. 1.

2.3 Gaussian process

In this work, we reconstruct the continuous function of LD from the mock GW or EM observational data with the Gaussian process. The advantages of the Gaussian process method are nonparametric and cosmological model-independent smoothing technique used to reconstruct a continuous function from the observed data. The reconstructed function, at each redshift point z, is related to a Gaussian distribution with a mean value and Gaussian error bands. The results from observational data points at any two redshifts \(z_i\) and \(z_j\) are correlated through a covariance function \(\kappa (z_i,z_j)\) due to their nearness to each other. There is a wide range of possible candidates for this function, and it depends on a set of hyperparameters. The different choices of the covariance function may affect the reconstruction to some extent. The detailed description and analysis of the Gaussian process can be found in Refs. [72, 102,103,104]. This method has been widely used to reconstruct the equation of state of dark energy [39, 72], and test cosmography [105, 106] and the CDDR [57, 58]. The simplest covariance function usually takes the squared exponential as

$$\begin{aligned} \kappa (z_i,z_j)=\sigma ^2_f \exp \bigg [-{(z_i-z_j)^2\over {2 l^2}}\bigg ], \end{aligned}$$
(10)

to implement the reconstructing process. Here, \(\sigma _f\) and l are two hyperparameters. \(\sigma _f\) denotes the output variance and fixes the overall amplitude of the correction in the y direction, and l gives the measure of the coherence length scale of the correlation in the x direction. As discussed in Ref. [56], the hyperparameters play important role in determining the error bars of observation data. Both of the hyperparameters are optimized by the GP with the observed data set. In this work, we use the simplest squared exponential covariance function. In order to avoid bias caused by different initial values, we change the initial value of the super parameter. After being optimized by the program, the returned values are about \(\sigma _f\sim 34.48\) and \(l\sim 2.49\). The continuous functions of the LD from the mock data are shown in Fig. 1. It can be seen from this figure that, in the redshift region \(2<z<5\), due to the small amount of GRB observation data (only 71 data points) and its large error bar, the uncertainty of LDs reconstructed from the GRB data is greater than that of LDs reconstructed from the GW measurements.

3 Method

The LDs from future detectable GW sources are expected to be opacity-free. The LDs from the electromagnetic observations, i.e. SNIa and GRB, are assumed to be systematically influenced by the cosmic opacity, as pointed out by Ref. [12]. The straightforward method to probe the cosmic opacity is to compare the observed LDs with the corresponding ones of GW measurements at the same redshifts. The observed LD can be expressed as [107, 108],

$$\begin{aligned} {D_\mathrm{L,obs}}(z)={D_\mathrm{L,true}}(z)e^{\tau (z)/2}, \end{aligned}$$
(11)

if the photon flux received by the observers will be reduced by the factor \(e^{-\tau (z)}\). Here \(\tau (z)\) represents the optical depth related to the cosmic absorption.

Fig. 1
figure 1

The sample catalogs of the ‘pantheon-like’ data and ‘GRBs-like’ data (left panel) , and 1000 mock GW events of redshifts (right panel). The corresponding smoothed function of LD obtained from the Gaussian process method is also presented

Then the function of cosmic optical depth at any redshifts can be obtained through the following equation

$$\begin{aligned} {\tau (z)}= 2\ln {D_\mathrm{L,GW}(z) \over {D_\mathrm{L,\,EM}(z)}} \end{aligned}$$
(12)

by comparing the continuous function of LD \(D_\mathrm{L}(z)\) reconstructed from the mock GW data with that from the EM observational data. Here and latter, the subscript “EM” represents the observed variable obtained from the electromagnetic wave measurements, such as the SNIa and GRB observations. Deviations from a transparent universe at any redshifts will be encoded in the function \(\tau {(z)}\). The uncertainties of the optical depth from the observations, \(\sigma _{\tau _\mathrm{obs}}\), can be obtained from following equation,

$$\begin{aligned} \sigma _{\tau _\mathrm{obs}}=2\sqrt{\left[ \left( {\sigma _{D_\mathrm{L,\,EM}(z)}\over {D_\mathrm{L,\,EM}(z)}}\right) ^2+\left( \sigma _{D_\mathrm{L, GW}(z)} \over {D_\mathrm{L, GW}(z)}\right) ^2\right] }\, . \end{aligned}$$
(13)

The results are shown in the left panel of Fig. 2. It should be noted that the constraint on cosmic opacity is independent of any parametrization.

Fig. 2
figure 2

The cosmic optical depth function \(\tau (z)\) (left panel) and the likelihood distribution functions (right panel) obtained from the combination of ‘Pantheon-like’ and ‘GRB-like’ data with \(\Lambda \)CDM

In addtion, we employ two typical parameterizations for the optical depth \(\tau {(z)}\), i.e. \(\tau (z)=2\epsilon z\) (P1) and \(\tau (z)=(1+z)^{2\epsilon }-1\) (P2), to detect cosmic opacity in the redshift region \(0<z<5\). While \(\epsilon =0\), the Universe is transparent. Here, the observational data of opacity-free LD is from the simulated GW observation. To match the GW measurement with the EM observation at the same redshift and employ all GW data to test the cosmic opacity, the opacity-dependent one is from the function of LD reconstructed from EM measurements with Gaussian process. The probability density of \(\epsilon \) can be obtained with the expression \(P(\epsilon )=A\,\mathrm{exp}[-\chi ^2(\epsilon )/2]\), where, A is a normalized coefficient and \(\chi ^2(\epsilon )\) has the form

$$\begin{aligned} \chi ^{2}(\epsilon ) = \sum \frac{{\left[ \tau (z,\epsilon )- \tau _\mathrm{obs}\right] }^{2}}{\sigma ^2_{\tau _\mathrm{obs}}}\,. \end{aligned}$$
(14)

The results are shown in the right panel of Fig. 2.

Furthermore, in order to verify the effectiveness of this method, we also simulated SNIa data and GRB data by assuming that the universe is opaque in the case of optical depth function \(\tau (z)=2\epsilon z\). The values of \(\epsilon \) are set to \(\epsilon =0.01\) and 0.02, respectively. Then, the cosmic opacity are tested, and the results from the tests are shown in Fig. 3.

Fig. 3
figure 3

The cosmic optical depth function \(\tau (z)\) (left panel) and the likelihood distribution functions (right panel) obtained from the combination of ‘Pantheon-like’ and ‘GRB-like’ data with a certain model of opacity in parametrization \(\tau (z)=2\epsilon z\) with \(\epsilon =0.01\) (top panel) and \(\epsilon =0.02\) (bottom panel), respectively

4 Results and analyses

For the test on the spatial homogeneity of cosmic transparency in Fig. 2, it can be seen that the best-fit value of cosmic optical depth \(\tau (z)\) evolves with the increase of the redshift. No deviation from a transparent universe is found at \(1\sigma \) CL. Our results are similar to those obtained in Refs. [62, 109] in the range of SNIa measurement redshifts, in which the best fit value of cosmic opacity varies with the increase of the redshift. In addition, the value of cosmic optical depth \(\tau (z)\) is constrained between \(-0.09\) and 0.05 at \(1\sigma \) CL in the redshift region \(0.1<z<2.0\), and it is constrained between \(-0.14\) and 0.60 in the redshift region \(2.0<z<5.0\). It suggests that the potentiality of observational data is relatively weak to probe the spatial homogeneity of cosmic opacity at the high redshift. As presented in Sect. 3, due to a small number and large uncertainty of GRB observations in this redshift region, the uncertainty of LDs reconstructed from the GRB data is greater than that of LDs reconstructed from the GW measurements. Therefore, the improvements of electromagnetic observations in the high redshift region, including the improvements of data quantity and quality, will impose more stringent constraints on the test of cosmic opacity. The figure also shows that the cosmic optical depth \(\tau (z)\) is divergent in the redshift range \(z<0.1\), and this bias might result from the absence of the mock GW data in this redshift region.

For the case of tests on cosmic opacity with parameterizations, as shown in Table 1, we also present a comparison between our forecast results and the previous ones. Compared the error bars of the constraint on cosmic opacity with the previous ones from the SNIa data in the lower redshift range \(0<z<2\), our results are at least 50% less than those obtained from the simulated ET GW data and the JLA SNIa data in Refs. [60,61,62], and they are at least 30% less than those from the simulated ET GW data and Pantheon SNIa compilation in Ref. [62]. Therefore, the future GW measurements can be considered as an important tool to probe cosmic opacity. For the results obtained from parameterizations for the optical depth \(\tau (z)\), it is easy to see that parametrization P1 may offer more stringent constraint on cosmic opacity than P2.

Table 1 Constraints on \(\epsilon \) represented by the best fit value at \(1\sigma \) or \(2\sigma \) CL for each data set. The superscripts ‘\(*\)’ represent the results obtained from the Gaussian process in this work, the symbol ‘\(\lozenge \)’ refers to the results obtained from a certain model of opacity, A and B represent the cosmological model-dependent method and the model-independent method, respectively, and the triangle symbols ‘\(\triangle \)’ denote the parametrization is adopted in the form \(\tau (z)=\epsilon z\)

For the test on the spatial homogeneity of the optical depth \(\tau (z)\) from a certain model of cosmic opacity while \(\epsilon =0.01\), an opaque universe can be found at \(2\sigma \) CL in the redshift region \(0.46<z<0.82\), as shown in the left-top panel of Fig. 3. It is worth mentioning that the test on cosmic opacity obtained directly from the observational data is independent of any parametrization. For the test from the parametrization of the optical depth \(\tau (z)\), an opaque universe can be marginally found at \(3\sigma \) CL for the parametrization of P1, as shown in the right-top panel of this figure. While \(\epsilon =0.02\), it can be seen from bottom panel of Fig. 3 that an opaque universe can be found at \(3\sigma \) CL. It suggests that future gravitational wave data can be used as an effective tool to identify an opaque universe.

5 Conclusion

In the past few years, some astronomical observations, such as the luminosity distance (LD) of SNIa, baryon acoustic oscillations, gas mass fraction, angular diameter distances from galaxy clusters, and Hubble parameter measurements have been used to probe cosmic opacity. As a gravitational wave propagates freely in a perfect fluid without any absorption and dissipation, the measurement of the luminosity distance to a GW source provides us with the opacity-free distance to probe cosmic opacity. More recently, confronting the mock GW measurements to the SNIa compilations, some tests on cosmic opacity have been performed to explore the potentiality of future GW measurements. However, due to the limitation from the redshift distributions of observational data, most of the tests are limited in the redshift region \(0<z<2\), and the cosmic opacity in the redshift region beyond the SNIa observations remains unexplored.

The third-generation GW detector, i.e., the Einstein Telescope (ET), is expected to detect GW signals up to redshift range \(z\sim 5\). Thus, future GW measurements will provide us with an opportunity to probe cosmic opacity at high redshifts. In this work, using the Gaussian process, we explore the potentiality of future gravitational wave measurements to probe the cosmic opacity at high redshift through comparing LD from GW with that from the combination of the SNIa and GRBs compilations. One thousand GW data points are simulated from the future ET. To dodge any impacts of systematics while combining the SNIa and GRB data sets, the ‘SNIa-like’ and ‘GRBs-like’ data are simulated from the actual Pantheon SNIa compilation and the latest GRB catalogue of Ref. [70] in the \(\Lambda \)CDM cosmological model. 137 GRB data points in the redshift region \(1<z<5\) are added to the Pantheon compilation. The purpose of using the Gaussian process is to reconstruct the continuous function of LD from the future GW data or the combination of SNIa and GRB data sets. A non-parametric method are proposed to probe the spatial homogeneity of the cosmic transparency at any redshifts through comparing the LD reconstructed from GW measurements with that reconstructed from SNIa and GRB data. Furthermore, using the simulated GW data and the continuous function of LDs reconstructed from the combination of SNIa data and GRB data, the cosmic opacity is tested with two types of parameterizations for the optical depth. All of the available GW data points can be used to test cosmic opacity. To test the effectiveness of the method in this work, SNIa data and GRB data are also simulated with a certain cosmic opacity model to probe the cosmic spatial homogeneity and the cosmic opacity.

For the test on the spatial homogeneity of cosmic opacity, the results show that the best fit value of cosmic opacity varies as the redshift increases, and no deviation from a transparent universe is found at \(1\sigma \) CL. Due to the large uncertainty of the GRB observation in the high redshift region and the small amount of data, the potentiality of astronomical observation to test cosmic opacity in high redshift region is relatively weaker than that in the low redshift region dominated by the SNIa observations. It suggests that improvements from the electromagnetic observations at high reshifts, including the improvements of data quantity and quality, would lead to more stringent constraints on the cosmic opacity. Results, obtained from the test with parameterizations for the optical depth, show that the error bar of constraint on cosmic opacity can be reduced to \(\sigma _{\epsilon }\sim 0.004\) at \(1\sigma \) CL. The uncertainty of the constraint is less than the previous results obtained from the simulated GW data, JLA SNIa data, and Pantheon SNIa data. The tests from a certain model of opacity show that the GW measurements in the future may be used as an effective tool to probe cosmic opacity. Therefore, it can be concluded that, given the GW detector can be carried out as expected by the programme of the ET, future measurements of GW may not only provide us with an opportunity to investigate the spatial homogeneity of the cosmic transparency at high redshifts, but also play an important role in probing cosmic opacity.