Skip to content

Commit

Permalink
connecting cosmological time dilation to signals generated with agn o…
Browse files Browse the repository at this point in the history
…bject
  • Loading branch information
Henry-Best-01 committed Sep 21, 2024
1 parent 455af87 commit 6c7eada
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
24 changes: 21 additions & 3 deletions slsim/Sources/SourceVariability/accretion_disk_reprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Check warning on line 73 in slsim/Sources/SourceVariability/accretion_disk_reprocessing.py

View check run for this annotation

Codecov / codecov/patch

slsim/Sources/SourceVariability/accretion_disk_reprocessing.py#L73

Added line #L73 was not covered by tests
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
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion slsim/Sources/SourceVariability/variability.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions slsim/Sources/agn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 6c7eada

Please sign in to comment.