From 575110dc4209b013502ee59b0e181d668d0908c4 Mon Sep 17 00:00:00 2001 From: Nikhil Sarin Date: Fri, 7 Jul 2023 14:23:57 +0200 Subject: [PATCH 1/9] Gaussianrise tde model can now stitch on at a multiple of tfb. --- redback/transient_models/tde_models.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/redback/transient_models/tde_models.py b/redback/transient_models/tde_models.py index 25dcd84ea..e692570e2 100644 --- a/redback/transient_models/tde_models.py +++ b/redback/transient_models/tde_models.py @@ -283,11 +283,12 @@ def gaussianrise_metzger_tde_bolometric(time, peak_time, sigma_t, mbh_6, stellar lbol_func = interp1d(full_time, y=full_lbol, fill_value='extrapolate') return lbol_func(time*cc.day_to_s) + @citation_wrapper('Sarin and Metzger in prep,https://ui.adsabs.harvard.edu/abs/2022arXiv220707136M/abstract') def gaussianrise_metzger_tde(time, redshift, peak_time, sigma_t, mbh_6, stellar_mass, eta, alpha, beta, **kwargs): """ Full lightcurve, with gaussian rise till fallback time and then the metzger tde model, - photometric version where each band is fit/joint separately + photometric version where each band is fit/joined separately :param time: time in observer frame in days :param redshift: redshift @@ -297,6 +298,8 @@ def gaussianrise_metzger_tde(time, redshift, peak_time, sigma_t, mbh_6, stellar_ :param alpha: disk viscosity :param beta: TDE penetration factor (typical range: 1 - beta_max) :param kwargs: Additional parameters + :param xi: Optional argument (default set to one) to change the point where lightcurve switches from Gaussian rise to cooling envelope. + stitching_point = xi * tfb (where tfb is fallback time). So a xi=1 means the stitching point is at fallback time. :param frequency: Required if output_format is 'flux_density'. frequency to calculate - Must be same length as time array or a single number). :param bands: Required if output_format is 'magnitude' or 'flux'. @@ -307,11 +310,13 @@ def gaussianrise_metzger_tde(time, redshift, peak_time, sigma_t, mbh_6, stellar_ binding_energy_const = kwargs.get('binding_energy_const', 0.8) tfb_sf = calc_tfb(binding_energy_const, mbh_6, stellar_mass) # source frame tfb_obf = tfb_sf * (1. + redshift) # observer frame + xi = kwargs.get('xi', 1.) output = _metzger_tde(mbh_6, stellar_mass, eta, alpha, beta, **kwargs) dl = cosmo.luminosity_distance(redshift).cgs.value + stitching_point = xi * tfb_obf # normalisation term in observer frame - f1 = pm.gaussian_rise(time=tfb_obf, a_1=1, peak_time=peak_time * cc.day_to_s, sigma_t=sigma_t * cc.day_to_s) + f1 = pm.gaussian_rise(time=stitching_point, a_1=1., peak_time=peak_time * cc.day_to_s, sigma_t=sigma_t * cc.day_to_s) if kwargs['output_format'] == 'flux_density': frequency = kwargs['frequency'] @@ -332,8 +337,8 @@ def gaussianrise_metzger_tde(time, redshift, peak_time, sigma_t, mbh_6, stellar_ # build flux density function for each frequency flux_den_interp_func = {} for freq in unique_frequency: - tt_pre_fb = np.linspace(0, tfb_obf / cc.day_to_s, 200) * cc.day_to_s - tt_post_fb = output.time_temp * (1 + redshift) + tt_pre_fb = np.linspace(0, stitching_point / cc.day_to_s, 200) * cc.day_to_s + tt_post_fb = xi * (output.time_temp * (1 + redshift)) total_time = np.concatenate([tt_pre_fb, tt_post_fb]) f1 = pm.gaussian_rise(time=tt_pre_fb, a_1=norm_dict[freq], peak_time=peak_time * cc.day_to_s, sigma_t=sigma_t * cc.day_to_s) @@ -358,8 +363,8 @@ def gaussianrise_metzger_tde(time, redshift, peak_time, sigma_t, mbh_6, stellar_ temp_kwargs = kwargs.copy() temp_kwargs['bands'] = unique_bands f2 = metzger_tde(time=0., redshift=redshift, - mbh_6=mbh_6, stellar_mass=stellar_mass, eta=eta, alpha=alpha, beta=beta, - **temp_kwargs) + mbh_6=mbh_6, stellar_mass=stellar_mass, eta=eta, alpha=alpha, beta=beta, + **temp_kwargs) if kwargs['output_format'] == 'magnitude': # make the normalisation in fmjy to avoid magnitude normalisation problems _f2mjy = calc_flux_density_from_ABmag(f2).value @@ -373,7 +378,7 @@ def gaussianrise_metzger_tde(time, redshift, peak_time, sigma_t, mbh_6, stellar_ flux_den_interp_func = {} for band in unique_bands: - tt_pre_fb = np.linspace(0, tfb_obf / cc.day_to_s, 100) * cc.day_to_s + tt_pre_fb = np.linspace(0, stitching_point / cc.day_to_s, 100) * cc.day_to_s tt_post_fb = output.time_temp * (1 + redshift) total_time = np.concatenate([tt_pre_fb, tt_post_fb]) f1 = pm.gaussian_rise(time=tt_pre_fb, a_1=norm_dict[band], @@ -382,9 +387,9 @@ def gaussianrise_metzger_tde(time, redshift, peak_time, sigma_t, mbh_6, stellar_ f1 = calc_ABmag_from_flux_density(f1).value temp_kwargs = kwargs.copy() temp_kwargs['bands'] = band - f2 = metzger_tde(time=output.time_since_fb/cc.day_to_s, redshift=redshift, - mbh_6=mbh_6, stellar_mass=stellar_mass, eta=eta, alpha=alpha, beta=beta, - **temp_kwargs) + f2 = metzger_tde(time=output.time_since_fb / cc.day_to_s, redshift=redshift, + mbh_6=mbh_6, stellar_mass=stellar_mass, eta=eta, alpha=alpha, beta=beta, + **temp_kwargs) flux_den = np.concatenate([f1, f2]) flux_den_interp_func[band] = interp1d(total_time, flux_den, fill_value='extrapolate') From e7e27a495e32f23645bca5e69c388d2679ffb5c6 Mon Sep 17 00:00:00 2001 From: Nikhil Sarin Date: Fri, 7 Jul 2023 14:58:28 +0200 Subject: [PATCH 2/9] Catch when envelope does not terminate and gracefully handle the error --- redback/transient_models/tde_models.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/redback/transient_models/tde_models.py b/redback/transient_models/tde_models.py index e692570e2..8d2f41d53 100644 --- a/redback/transient_models/tde_models.py +++ b/redback/transient_models/tde_models.py @@ -153,11 +153,13 @@ def _metzger_tde(mbh_6, stellar_mass, eta, alpha, beta, **kwargs): 'SMBH_accretion_rate', 'time_temp', 'nulnu', 'time_since_fb','tfb', 'lnu', 'envelope_radius', 'envelope_mass', 'rtidal', 'rcirc', 'termination_time', 'termination_time_id']) - # constraint_1 = np.min(np.where(Rv < Rcirc/2.)) - constraint_1 = len(time_temp) - constraint_2 = np.min(np.where(Me < 0.0)) + try: + constraint_1 = np.min(np.where(Rv < Rcirc/2.)) + constraint_2 = np.min(np.where(Me < 0.0)) + except ValueError: + constraint_1 = len(time_temp) + constraint_2 = len(time_temp) constraint = np.min([constraint_1, constraint_2]) - constraint_1 = np.min(np.where(Rv < Rcirc/2.)) termination_time_id = np.min([constraint_1, constraint_2]) nu = 6.0e14 expon = 1. / (np.exp(cc.planck * nu / (cc.boltzmann_constant * Teff)) - 1.0) From 15dd93e95e571f118605e4e2431b88b453833cd9 Mon Sep 17 00:00:00 2001 From: Nikhil Sarin Date: Fri, 7 Jul 2023 15:48:00 +0200 Subject: [PATCH 3/9] Try and except --- redback/transient_models/tde_models.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/redback/transient_models/tde_models.py b/redback/transient_models/tde_models.py index 8d2f41d53..95b5fe9bc 100644 --- a/redback/transient_models/tde_models.py +++ b/redback/transient_models/tde_models.py @@ -161,6 +161,12 @@ def _metzger_tde(mbh_6, stellar_mass, eta, alpha, beta, **kwargs): constraint_2 = len(time_temp) constraint = np.min([constraint_1, constraint_2]) termination_time_id = np.min([constraint_1, constraint_2]) + # constraint_1 = np.min(np.where(Rv < Rcirc/2.)) + # constraint_1 = len(time_temp) + # constraint_2 = np.min(np.where(Me < 0.0)) + # constraint = np.min([constraint_1, constraint_2]) + # constraint_1 = np.min(np.where(Rv < Rcirc / 2.)) + # termination_time_id = np.min([constraint_1, constraint_2]) nu = 6.0e14 expon = 1. / (np.exp(cc.planck * nu / (cc.boltzmann_constant * Teff)) - 1.0) nuLnu40 = (8.0*np.pi ** (2.0) * Rph ** (2.0) / cc.speed_of_light ** (2.0)) @@ -180,7 +186,10 @@ def _metzger_tde(mbh_6, stellar_mass, eta, alpha, beta, **kwargs): output.SMBH_accretion_rate = MdotBH[:constraint] output.time_temp = time_temp[:constraint] output.time_since_fb = output.time_temp - output.time_temp[0] - output.termination_time = time_temp[termination_time_id] - tfb + if constraint == len(time_temp): + output.termination_time = time_temp[-1] - tfb + else: + output.termination_time = time_temp[termination_time_id] - tfb output.termination_time_id = termination_time_id output.tfb = tfb output.nulnu = nuLnu40[:constraint] * 1e40 From ab4b73ed79d320760324bc6863d4a099793955f8 Mon Sep 17 00:00:00 2001 From: Nikhil Sarin Date: Mon, 10 Jul 2023 11:19:50 +0200 Subject: [PATCH 4/9] update to small caps --- docs/acknowledgements.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/acknowledgements.txt b/docs/acknowledgements.txt index d2ca45709..cab205eb1 100644 --- a/docs/acknowledgements.txt +++ b/docs/acknowledgements.txt @@ -57,14 +57,14 @@ We recommend the following text for citing :code:`redback` in a scientific publi For using :code:`redback` to fit transients: -- We fit the transient using the open source software package \texttt{Redback}~\cite{sarin_redback}, +- We fit the transient using the open source software package {\sc Redback}~\cite{sarin_redback}, with the {model_name}~\citep{model reference} model using the {sampler} sampler~\citep{sampler reference} wrapped with bilby~\citep{Ashton+2019}. For using :code:`redback` to simulate transients: -- We simulate transients using the open source software package \texttt{Redback}~\cite{sarin_redback}, with the {model_name}~\citep{model reference} model. +- We simulate transients using the open source software package {\sc Redback}~\cite{sarin_redback}, with the {model_name}~\citep{model reference} model. For using :code:`redback` to download transient data: -- We download and process this data using the API provided by the open source software package \texttt{Redback}~\cite{sarin_redback}. +- We download and process this data using the API provided by the open source software package {\sc Redback}~\cite{sarin_redback}. From 4d8687e292187e94cb101ddb3b5fcd3d7478e407 Mon Sep 17 00:00:00 2001 From: Nikhil Sarin Date: Tue, 11 Jul 2023 16:41:40 +0200 Subject: [PATCH 5/9] SNcosmo was listed as both a requirement and an optional requirement --- optional_requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/optional_requirements.txt b/optional_requirements.txt index 69d365a57..2b3657954 100644 --- a/optional_requirements.txt +++ b/optional_requirements.txt @@ -1,5 +1,4 @@ gwemlightcurves -sncosmo nestle sherpa PyQt5 From 18ace267a2a114774dd118ee80d99f050ff04c6c Mon Sep 17 00:00:00 2001 From: Nikhil Sarin Date: Wed, 19 Jul 2023 16:04:58 +0200 Subject: [PATCH 6/9] nan to num in likelihoods --- redback/likelihoods.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/redback/likelihoods.py b/redback/likelihoods.py index 10e0d0613..8a1d8e11c 100644 --- a/redback/likelihoods.py +++ b/redback/likelihoods.py @@ -176,7 +176,7 @@ def log_likelihood(self) -> float: :return: The log-likelihood. :rtype: float """ - return self.log_likelihood_x() + self.log_likelihood_y() + return np.nan_to_num(self.log_likelihood_x() + self.log_likelihood_y()) class GaussianLikelihoodQuadratureNoise(GaussianLikelihood): @@ -228,7 +228,7 @@ def log_likelihood(self) -> float: :return: The log-likelihood. :rtype: float """ - return self._gaussian_log_likelihood(res=self.residual, sigma=self.full_sigma) + return np.nan_to_num(self._gaussian_log_likelihood(res=self.residual, sigma=self.full_sigma)) class GaussianLikelihoodWithSystematicNoise(GaussianLikelihood): def __init__( @@ -280,7 +280,7 @@ def log_likelihood(self) -> float: :return: The log-likelihood. :rtype: float """ - return self._gaussian_log_likelihood(res=self.residual, sigma=self.full_sigma) + return np.nan_to_num(self._gaussian_log_likelihood(res=self.residual, sigma=self.full_sigma)) class GaussianLikelihoodQuadratureNoiseNonDetections(GaussianLikelihoodQuadratureNoise): def __init__( @@ -337,7 +337,7 @@ def log_likelihood(self) -> float: :return: The log-likelihood. :rtype: float """ - return self.log_likelihood_y() + self.log_likelihood_upper_limit() + return np.nan_to_num(self.log_likelihood_y() + self.log_likelihood_upper_limit()) class GRBGaussianLikelihood(GaussianLikelihood): From 0cdbdc4d063a471bfe7259fc341dd532d00047f7 Mon Sep 17 00:00:00 2001 From: Nikhil Sarin Date: Thu, 27 Jul 2023 15:37:38 +0200 Subject: [PATCH 7/9] Clean up for model --- redback/transient_models/tde_models.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/redback/transient_models/tde_models.py b/redback/transient_models/tde_models.py index 95b5fe9bc..a4523e4db 100644 --- a/redback/transient_models/tde_models.py +++ b/redback/transient_models/tde_models.py @@ -161,12 +161,6 @@ def _metzger_tde(mbh_6, stellar_mass, eta, alpha, beta, **kwargs): constraint_2 = len(time_temp) constraint = np.min([constraint_1, constraint_2]) termination_time_id = np.min([constraint_1, constraint_2]) - # constraint_1 = np.min(np.where(Rv < Rcirc/2.)) - # constraint_1 = len(time_temp) - # constraint_2 = np.min(np.where(Me < 0.0)) - # constraint = np.min([constraint_1, constraint_2]) - # constraint_1 = np.min(np.where(Rv < Rcirc / 2.)) - # termination_time_id = np.min([constraint_1, constraint_2]) nu = 6.0e14 expon = 1. / (np.exp(cc.planck * nu / (cc.boltzmann_constant * Teff)) - 1.0) nuLnu40 = (8.0*np.pi ** (2.0) * Rph ** (2.0) / cc.speed_of_light ** (2.0)) From 84b35c81f62d4ada3fbca1491ac8ef6d304522b1 Mon Sep 17 00:00:00 2001 From: Nikhil Sarin Date: Mon, 31 Jul 2023 10:21:47 +0200 Subject: [PATCH 8/9] Add references --- redback/transient_models/tde_models.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/redback/transient_models/tde_models.py b/redback/transient_models/tde_models.py index a4523e4db..33ddb7e29 100644 --- a/redback/transient_models/tde_models.py +++ b/redback/transient_models/tde_models.py @@ -189,7 +189,7 @@ def _metzger_tde(mbh_6, stellar_mass, eta, alpha, beta, **kwargs): output.nulnu = nuLnu40[:constraint] * 1e40 return output -@citation_wrapper('https://ui.adsabs.harvard.edu/abs/2022arXiv220707136M/abstract') +@citation_wrapper('https://arxiv.org/abs/2307.15121, https://ui.adsabs.harvard.edu/abs/2022arXiv220707136M/abstract') def metzger_tde(time, redshift, mbh_6, stellar_mass, eta, alpha, beta, **kwargs): """ This model is only valid for time after circulation. Use the gaussianrise_metzgertde model for the full lightcurve @@ -253,7 +253,7 @@ def metzger_tde(time, redshift, mbh_6, stellar_mass, eta, alpha, beta, **kwargs spectra=spectra, lambda_array=lambda_observer_frame, **kwargs) -@citation_wrapper('Sarin and Metzger in prep,https://ui.adsabs.harvard.edu/abs/2022arXiv220707136M/abstract') +@citation_wrapper('https://arxiv.org/abs/2307.15121,https://ui.adsabs.harvard.edu/abs/2022arXiv220707136M/abstract') def gaussianrise_metzger_tde_bolometric(time, peak_time, sigma_t, mbh_6, stellar_mass, eta, alpha, beta, **kwargs): """ Full lightcurve, with gaussian rise till fallback time and then the metzger tde model, @@ -289,7 +289,7 @@ def gaussianrise_metzger_tde_bolometric(time, peak_time, sigma_t, mbh_6, stellar return lbol_func(time*cc.day_to_s) -@citation_wrapper('Sarin and Metzger in prep,https://ui.adsabs.harvard.edu/abs/2022arXiv220707136M/abstract') +@citation_wrapper('https://arxiv.org/abs/2307.15121,https://ui.adsabs.harvard.edu/abs/2022arXiv220707136M/abstract') def gaussianrise_metzger_tde(time, redshift, peak_time, sigma_t, mbh_6, stellar_mass, eta, alpha, beta, **kwargs): """ Full lightcurve, with gaussian rise till fallback time and then the metzger tde model, From dc3a7bf33328cc9bded3d320a2a47b30585f4f42 Mon Sep 17 00:00:00 2001 From: Nikhil Sarin Date: Mon, 31 Jul 2023 12:11:48 +0200 Subject: [PATCH 9/9] References and model refractoring --- ...tzger_tde.prior => cooling_envelope.prior} | 0 ...or => gaussianrise_cooling_envelope.prior} | 0 ...ianrise_cooling_envelope_bolometric.prior} | 0 redback/transient_models/tde_models.py | 32 +++++++++---------- 4 files changed, 16 insertions(+), 16 deletions(-) rename redback/priors/{metzger_tde.prior => cooling_envelope.prior} (100%) rename redback/priors/{gaussianrise_metzger_tde.prior => gaussianrise_cooling_envelope.prior} (100%) rename redback/priors/{gaussianrise_metzger_tde_bolometric.prior => gaussianrise_cooling_envelope_bolometric.prior} (100%) diff --git a/redback/priors/metzger_tde.prior b/redback/priors/cooling_envelope.prior similarity index 100% rename from redback/priors/metzger_tde.prior rename to redback/priors/cooling_envelope.prior diff --git a/redback/priors/gaussianrise_metzger_tde.prior b/redback/priors/gaussianrise_cooling_envelope.prior similarity index 100% rename from redback/priors/gaussianrise_metzger_tde.prior rename to redback/priors/gaussianrise_cooling_envelope.prior diff --git a/redback/priors/gaussianrise_metzger_tde_bolometric.prior b/redback/priors/gaussianrise_cooling_envelope_bolometric.prior similarity index 100% rename from redback/priors/gaussianrise_metzger_tde_bolometric.prior rename to redback/priors/gaussianrise_cooling_envelope_bolometric.prior diff --git a/redback/transient_models/tde_models.py b/redback/transient_models/tde_models.py index a4523e4db..c7c479e1a 100644 --- a/redback/transient_models/tde_models.py +++ b/redback/transient_models/tde_models.py @@ -28,7 +28,7 @@ def _analytic_fallback(time, l0, t_0): def _semianalytical_fallback(): pass -def _metzger_tde(mbh_6, stellar_mass, eta, alpha, beta, **kwargs): +def _cooling_envelope(mbh_6, stellar_mass, eta, alpha, beta, **kwargs): """ :param mbh_6: mass of supermassive black hole in units of 10^6 solar mass :param stellar_mass: stellar mass in units of solar masses @@ -189,8 +189,8 @@ def _metzger_tde(mbh_6, stellar_mass, eta, alpha, beta, **kwargs): output.nulnu = nuLnu40[:constraint] * 1e40 return output -@citation_wrapper('https://ui.adsabs.harvard.edu/abs/2022arXiv220707136M/abstract') -def metzger_tde(time, redshift, mbh_6, stellar_mass, eta, alpha, beta, **kwargs): +@citation_wrapper('https://arxiv.org/abs/2307.15121,https://ui.adsabs.harvard.edu/abs/2022arXiv220707136M/abstract') +def cooling_envelope(time, redshift, mbh_6, stellar_mass, eta, alpha, beta, **kwargs): """ This model is only valid for time after circulation. Use the gaussianrise_metzgertde model for the full lightcurve @@ -209,7 +209,7 @@ def metzger_tde(time, redshift, mbh_6, stellar_mass, eta, alpha, beta, **kwargs :param lambda_array: Optional argument to set your desired wavelength array (in Angstroms) to evaluate the SED on. :return: set by output format - 'flux_density', 'magnitude', 'spectra', 'flux', 'sncosmo_source' """ - output = _metzger_tde(mbh_6, stellar_mass, eta, alpha, beta, **kwargs) + output = _cooling_envelope(mbh_6, stellar_mass, eta, alpha, beta, **kwargs) dl = cosmo.luminosity_distance(redshift).cgs.value time_obs = time @@ -253,8 +253,8 @@ def metzger_tde(time, redshift, mbh_6, stellar_mass, eta, alpha, beta, **kwargs spectra=spectra, lambda_array=lambda_observer_frame, **kwargs) -@citation_wrapper('Sarin and Metzger in prep,https://ui.adsabs.harvard.edu/abs/2022arXiv220707136M/abstract') -def gaussianrise_metzger_tde_bolometric(time, peak_time, sigma_t, mbh_6, stellar_mass, eta, alpha, beta, **kwargs): +@citation_wrapper('https://arxiv.org/abs/2307.15121,https://ui.adsabs.harvard.edu/abs/2022arXiv220707136M/abstract') +def gaussianrise_cooling_envelope_bolometric(time, peak_time, sigma_t, mbh_6, stellar_mass, eta, alpha, beta, **kwargs): """ Full lightcurve, with gaussian rise till fallback time and then the metzger tde model, bolometric version for fitting the bolometric lightcurve @@ -268,7 +268,7 @@ def gaussianrise_metzger_tde_bolometric(time, peak_time, sigma_t, mbh_6, stellar :param kwargs: Additional parameters :return luminosity in ergs/s """ - output = _metzger_tde(mbh_6, stellar_mass, eta, alpha, beta, **kwargs) + output = _cooling_envelope(mbh_6, stellar_mass, eta, alpha, beta, **kwargs) kwargs['binding_energy_const'] = kwargs.get('binding_energy_const', 0.8) tfb_sf = calc_tfb(kwargs['binding_energy_const'], mbh_6, stellar_mass) # source frame f1 = pm.gaussian_rise(time=tfb_sf, a_1=1, peak_time=peak_time * cc.day_to_s, sigma_t=sigma_t * cc.day_to_s) @@ -289,8 +289,8 @@ def gaussianrise_metzger_tde_bolometric(time, peak_time, sigma_t, mbh_6, stellar return lbol_func(time*cc.day_to_s) -@citation_wrapper('Sarin and Metzger in prep,https://ui.adsabs.harvard.edu/abs/2022arXiv220707136M/abstract') -def gaussianrise_metzger_tde(time, redshift, peak_time, sigma_t, mbh_6, stellar_mass, eta, alpha, beta, **kwargs): +@citation_wrapper('https://arxiv.org/abs/2307.15121,https://ui.adsabs.harvard.edu/abs/2022arXiv220707136M/abstract') +def gaussianrise_cooling_envelope(time, redshift, peak_time, sigma_t, mbh_6, stellar_mass, eta, alpha, beta, **kwargs): """ Full lightcurve, with gaussian rise till fallback time and then the metzger tde model, photometric version where each band is fit/joined separately @@ -316,7 +316,7 @@ def gaussianrise_metzger_tde(time, redshift, peak_time, sigma_t, mbh_6, stellar_ tfb_sf = calc_tfb(binding_energy_const, mbh_6, stellar_mass) # source frame tfb_obf = tfb_sf * (1. + redshift) # observer frame xi = kwargs.get('xi', 1.) - output = _metzger_tde(mbh_6, stellar_mass, eta, alpha, beta, **kwargs) + output = _cooling_envelope(mbh_6, stellar_mass, eta, alpha, beta, **kwargs) dl = cosmo.luminosity_distance(redshift).cgs.value stitching_point = xi * tfb_obf @@ -367,9 +367,9 @@ def gaussianrise_metzger_tde(time, redshift, peak_time, sigma_t, mbh_6, stellar_ unique_bands = np.unique(bands) temp_kwargs = kwargs.copy() temp_kwargs['bands'] = unique_bands - f2 = metzger_tde(time=0., redshift=redshift, - mbh_6=mbh_6, stellar_mass=stellar_mass, eta=eta, alpha=alpha, beta=beta, - **temp_kwargs) + f2 = cooling_envelope(time=0., redshift=redshift, + mbh_6=mbh_6, stellar_mass=stellar_mass, eta=eta, alpha=alpha, beta=beta, + **temp_kwargs) if kwargs['output_format'] == 'magnitude': # make the normalisation in fmjy to avoid magnitude normalisation problems _f2mjy = calc_flux_density_from_ABmag(f2).value @@ -392,9 +392,9 @@ def gaussianrise_metzger_tde(time, redshift, peak_time, sigma_t, mbh_6, stellar_ f1 = calc_ABmag_from_flux_density(f1).value temp_kwargs = kwargs.copy() temp_kwargs['bands'] = band - f2 = metzger_tde(time=output.time_since_fb / cc.day_to_s, redshift=redshift, - mbh_6=mbh_6, stellar_mass=stellar_mass, eta=eta, alpha=alpha, beta=beta, - **temp_kwargs) + f2 = cooling_envelope(time=output.time_since_fb / cc.day_to_s, redshift=redshift, + mbh_6=mbh_6, stellar_mass=stellar_mass, eta=eta, alpha=alpha, beta=beta, + **temp_kwargs) flux_den = np.concatenate([f1, f2]) flux_den_interp_func[band] = interp1d(total_time, flux_den, fill_value='extrapolate')