From 6c7eada6b85ed0a3b5f6106c4484cb469f9e8083 Mon Sep 17 00:00:00 2001 From: Henry-Best-01 Date: Sat, 21 Sep 2024 12:23:08 +0200 Subject: [PATCH] connecting cosmological time dilation to signals generated with agn object --- .../accretion_disk_reprocessing.py | 24 ++++++++++++++++--- .../Sources/SourceVariability/variability.py | 2 +- slsim/Sources/agn.py | 1 + 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/slsim/Sources/SourceVariability/accretion_disk_reprocessing.py b/slsim/Sources/SourceVariability/accretion_disk_reprocessing.py index 27550cd20..2fa933b06 100644 --- a/slsim/Sources/SourceVariability/accretion_disk_reprocessing.py +++ b/slsim/Sources/SourceVariability/accretion_disk_reprocessing.py @@ -69,6 +69,10 @@ def __init__(self, reprocessing_model, **kwargs_agn_model): self.time_array = None self.magnitude_array = None + if "redshift" in self.kwargs_model: + self.redshift = self.kwargs_model["redshift"] + else: + self.redshift = 0 def define_new_response_function(self, rest_frame_wavelength_in_nanometers): """Define a response function of the agn accretion disk to the flaring corona in @@ -261,13 +265,27 @@ def reprocess_signal( interpolated_signal, (interpolated_response_function), mode="full" ) + # bring the reprocessed signal to the observer frame + interpolation_of_reprocessed_signal = interpolate.interp1d( + signal_time_axis, + reprocessed_signal[: len(signal_time_axis)], + bounds_error=False, + fill_value=0, + ) + redshifted_time_axis = signal_time_axis / (1 + self.redshift) + reprocessed_signal_in_observed_frame = interpolation_of_reprocessed_signal( + redshifted_time_axis + ) + normalization = np.nansum(interpolated_response_function) if normalization == 0: - reprocessed_signal = interpolated_signal + reprocessed_signal_in_observed_frame = intrinsic_signal.magnitude( + redshifted_time_axis + ) else: - reprocessed_signal /= normalization + reprocessed_signal_in_observed_frame /= normalization - return reprocessed_signal[: len(self.time_array)] + return reprocessed_signal_in_observed_frame[: len(self.time_array)] def determine_agn_luminosity_from_known_luminosity( self, diff --git a/slsim/Sources/SourceVariability/variability.py b/slsim/Sources/SourceVariability/variability.py index 72a86bfc3..50777e003 100644 --- a/slsim/Sources/SourceVariability/variability.py +++ b/slsim/Sources/SourceVariability/variability.py @@ -80,6 +80,7 @@ def __init__(self, variability_model, **kwargs_variability_model): self.accretion_disk_reprocessor = AccretionDiskReprocessing( "lamppost", **self.agn_kwargs ) + self.accretion_disk_reprocessor.redshift = self.redshift if ( "time_array" in self.signal_kwargs @@ -235,7 +236,6 @@ def reprocess_with_lamppost_model(variability): if "mean_magnitude" in variability.reprocessing_kwargs.keys(): reprocessed_signal -= np.mean(reprocessed_signal) reprocessed_signal += variability.reprocessing_kwargs["mean_magnitude"] - light_curve = { "MJD": variability.signal_kwargs["time_array"], "ps_mag_" + str(speclite_filter): reprocessed_signal, diff --git a/slsim/Sources/agn.py b/slsim/Sources/agn.py index 3941cf3cb..f0773c8ec 100644 --- a/slsim/Sources/agn.py +++ b/slsim/Sources/agn.py @@ -99,6 +99,7 @@ def __init__( self.kwargs_model["magnitude_array"] = driving_variability.variability_at_time( self.kwargs_model["time_array"] ) + self.kwargs_model["redshift"] = self.redshift # Create the lamppost reprocessor with a driving light curve that remains static self.variable_disk = Variability("lamppost_reprocessed", **self.kwargs_model)