Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Feb 28, 2024
1 parent 7fb1a7f commit 0924cb1
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 33 deletions.
30 changes: 14 additions & 16 deletions slsim/Sources/SourceVariability/accretion_disk_reprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,18 @@ def __init__(self, reprocessing_model, **kwargs_agn_model):
:param reprocessing_model: keyword for the reprocessing model to be used. Only
supports "lamppost" now.
:param kwargs_agn_model: keyword arguments for the variability model.
Note that these have default values if they are not input.
For the lamppost model, the kwargs are:
'r_out', The outer radius of the accretion disk, in gravitational radii [R_g]
'r_resolution', the resolution to calculate the disk's response function at in
[pixels / r_out]
'inclination_angle', the inclination of the accretion disk in [degrees]
'black_hole_mass_exponent', the log of the black hole mass normalized by the mass
of the sun.
'black_hole_spin', the normalized spin of the black hole, ranging from -1 to 1.
Negative values represent retrograde orbits around the black hole.
'corona_height', the height of the corona in the lamppost geometry in gravitational
radii [R_g]
'eddington_ratio', the Eddington ratio of the accretion disk
:param kwargs_agn_model: keyword arguments for the variability model. Note that
these have default values if they are not input. For the lamppost model, the
kwargs are: 'r_out', The outer radius of the accretion disk, in
gravitational radii [R_g] 'r_resolution', the resolution to calculate the
disk's response function at in [pixels / r_out] 'inclination_angle', the
inclination of the accretion disk in [degrees] 'black_hole_mass_exponent',
the log of the black hole mass normalized by the mass of the sun.
'black_hole_spin', the normalized spin of the black hole, ranging from -1 to
1. Negative values represent retrograde orbits around the black hole.
'corona_height', the height of the corona in the lamppost geometry in
gravitational radii [R_g] 'eddington_ratio', the Eddington ratio of the
accretion disk
:type kwargs_agn_model: dict
"""

Expand Down Expand Up @@ -124,8 +122,8 @@ def reprocess_signal(
at each time lag. If response_function_time_lags is None, it will assume to
have spacings [Rg / c] between values. The amplitudes may have arbitrary
units.
:return: The magnitude_array of the reprocessed signal.
Note that this is calculated in the rest frame, not the observer's frame!
:return: The magnitude_array of the reprocessed signal. Note that this is
calculated in the rest frame, not the observer's frame!
"""
if self.time_array is None or self.magnitude_array is None:
raise ValueError(
Expand Down
1 change: 0 additions & 1 deletion slsim/Sources/SourceVariability/variability.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
generate_signal_from_bending_power_law,
generate_signal_from_generic_psd,
)

"""This class aims to have realistic variability models for AGN and supernovae."""


Expand Down
32 changes: 16 additions & 16 deletions slsim/Util/astro_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ def spin_to_isco(spin):
if abs(spin) > 1:
raise ValueError("Absolute value of spin cannot exceed 1")
# Calculate intermediate values
z1 = 1 + (1 - spin**2) ** (1 / 3) * (
(1 + spin) ** (1 / 3) + (1 - spin) ** (1 / 3)
)
z1 = 1 + (1 - spin**2) ** (1 / 3) * ((1 + spin) ** (1 / 3) + (1 - spin) ** (1 / 3))
z2 = (3 * spin**2 + z1**2) ** (1 / 2)

# Return ISCO distance in gravitational radii
Expand Down Expand Up @@ -223,8 +221,8 @@ def create_phi_map(r_out, r_resolution, inclination_angle):
maximum radius is defined by r_out, and the radial resolution is defined by
r_resolution.
:param r_out: The maximum radial value in [R_g]. For an accretion disk, this can be 10^3 to
10^5.
:param r_out: The maximum radial value in [R_g]. For an accretion disk, this can be
10^3 to 10^5.
:param r_resolution: The number of points between r = 0 and r = r_out. The final map
will be shape (2 * r_resolution), (2 * r_resolution)
:param inclination_angle: The inclination of the plane of the accretion disk with
Expand Down Expand Up @@ -511,7 +509,8 @@ def define_frequencies(length_of_light_curve, time_resolution):
of [days]. This parameter defines the high frequency limit. If generating light
curves takes too long, consider increasing this parameter to generate fewer
frequencies.
:return: A numpy array of the frequencies that are probed by the light curve in [1/days].
:return: A numpy array of the frequencies that are probed by the light curve in
[1/days].
"""

length_of_generated_light_curve = 10 * length_of_light_curve
Expand All @@ -529,8 +528,8 @@ def normalize_light_curve(light_curve, new_mean_amplitude, new_standard_deviatio
:param light_curve: A time series list or array which represents a one-dimensional
light curve. This function does not require any specific units or spacings.
:param new_mean_amplitude: The new mean value of the light curve. This is done through a
simple shifting of the y-axis.
:param new_mean_amplitude: The new mean value of the light curve. This is done
through a simple shifting of the y-axis.
:param new_standard_deviation: The new standard deviation of the light curve. Note
this only makes sense for a variable signal (e.g. a constant signal cannot be
given a new standard_deviation). A negative standard deviation will invert the x
Expand Down Expand Up @@ -561,9 +560,9 @@ def generate_signal(
seed=None,
):
"""This function creates a stochastic signal to model AGN X-ray variability. By
default, it will generate a bending power law power spectrum density (PSD) which will
be used to generate the intrinsic light curve. This function may also be used to
generate a signal from any other PSD generated by the user.
default, it will generate a bending power law power spectrum density (PSD) which
will be used to generate the intrinsic light curve. This function may also be used
to generate a signal from any other PSD generated by the user.
:param length_of_light_curve: The total length of the light curve to simulate, in units
of [days]. The generated signal will be 10 times longer than this to
Expand Down Expand Up @@ -649,11 +648,12 @@ def generate_signal_from_bending_power_law(
:param time_resolution: The time spacing between observations in [days].
:param log_breakpoint_frequency: The log_{10} of the characteristic breakpoint
frequency in the bending power law. Typically between -3.5 and 1.0.
:param low_frequency_slope: The (negative) log-log slope of the power spectrum density (psd)
on the low frequency side of the breakpoint frequency. Typically between 0.0 and 2.0.
:param high_frequency_slope: The (negative) log-log slope of the psd on the high frequency side
of the breakpoint frequency. Typically between 2.0 and 4.0, and higher than the
low_frequency_slope
:param low_frequency_slope: The (negative) log-log slope of the power spectrum
density (psd) on the low frequency side of the breakpoint frequency. Typically
between 0.0 and 2.0.
:param high_frequency_slope: The (negative) log-log slope of the psd on the high
frequency side of the breakpoint frequency. Typically between 2.0 and 4.0, and
higher than the low_frequency_slope
:param new_mean_amplitude: The desired mean value of the light curve.
:param new_standard_deviation: The desired standard deviation of the light curve.
:param seed: The random seed to be input for reproducability.
Expand Down

0 comments on commit 0924cb1

Please sign in to comment.