Skip to content

Commit

Permalink
Merge pull request #152 from lincc-frameworks/rename_evaluate
Browse files Browse the repository at this point in the history
Rename _evaluate to compute_flux()
  • Loading branch information
jeremykubica authored Oct 8, 2024
2 parents 9d08676 + ec183ba commit 61bd167
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/tdastro/sources/galaxy_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __init__(self, brightness, radius, **kwargs):
self.add_parameter("galaxy_radius_std", radius, **kwargs)
self.add_parameter("brightness", brightness, **kwargs)

def _evaluate(self, times, wavelengths, graph_state, ra=None, dec=None, **kwargs):
def compute_flux(self, times, wavelengths, graph_state, ra=None, dec=None, **kwargs):
"""Draw effect-free observations for this object.
Parameters
Expand Down
2 changes: 1 addition & 1 deletion src/tdastro/sources/periodic_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def _evaluate_phases(self, phases, wavelengths, graph_state, **kwargs):
"""
raise NotImplementedError()

def _evaluate(self, times, wavelengths, graph_state, **kwargs):
def compute_flux(self, times, wavelengths, graph_state, **kwargs):
"""Draw effect-free observations for this object.
Parameters
Expand Down
7 changes: 3 additions & 4 deletions src/tdastro/sources/physical_model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""The base PhysicalModel used for all sources."""


import numpy as np

from tdastro.astro_utils.passbands import Passband
Expand Down Expand Up @@ -99,7 +98,7 @@ def set_apply_redshift(self, apply_redshift):
"""
self.apply_redshift = apply_redshift

def _evaluate(self, times, wavelengths, graph_state):
def compute_flux(self, times, wavelengths, graph_state):
"""Draw effect-free rest frame flux densities.
The rest-frame flux is defined as F_nu = L_nu / 4*pi*D_L**2,
where D_L is the luminosity distance.
Expand Down Expand Up @@ -167,9 +166,9 @@ def evaluate(self, times, wavelengths, graph_state=None, given_args=None, rng_in

# Compute the flux density for both the current object and add in anything
# behind it, such as a host galaxy.
flux_density = self._evaluate(times, wavelengths, graph_state, **kwargs)
flux_density = self.compute_flux(times, wavelengths, graph_state, **kwargs)
if self.background is not None:
flux_density += self.background._evaluate(
flux_density += self.background.compute_flux(
times,
wavelengths,
graph_state,
Expand Down
2 changes: 1 addition & 1 deletion src/tdastro/sources/sncomso_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def _sample_helper(self, graph_state, seen_nodes, num_samples=1, rng_info=None):
super()._sample_helper(graph_state, seen_nodes, rng_info)
self._update_sncosmo_model_parameters(graph_state)

def _evaluate(self, times, wavelengths, graph_state=None, **kwargs):
def compute_flux(self, times, wavelengths, graph_state=None, **kwargs):
"""Draw effect-free observations for this object.
Parameters
Expand Down
2 changes: 1 addition & 1 deletion src/tdastro/sources/spline_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def __init__(
self._wavelengths = wavelengths
self._spline = RectBivariateSpline(times, wavelengths, flux, kx=time_degree, ky=wave_degree)

def _evaluate(self, times, wavelengths, graph_state, **kwargs):
def compute_flux(self, times, wavelengths, graph_state, **kwargs):
"""Draw effect-free observations for this object.
Parameters
Expand Down
2 changes: 1 addition & 1 deletion src/tdastro/sources/static_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(self, brightness, **kwargs):
super().__init__(**kwargs)
self.add_parameter("brightness", brightness, **kwargs)

def _evaluate(self, times, wavelengths, graph_state, **kwargs):
def compute_flux(self, times, wavelengths, graph_state, **kwargs):
"""Draw effect-free observations for this object.
Parameters
Expand Down
2 changes: 1 addition & 1 deletion src/tdastro/sources/step_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __init__(self, brightness, t0, t1, **kwargs):
self.add_parameter("t0", t0, **kwargs)
self.add_parameter("t1", t1, **kwargs)

def _evaluate(self, times, wavelengths, graph_state, **kwargs):
def compute_flux(self, times, wavelengths, graph_state, **kwargs):
"""Draw effect-free observations for this object.
Parameters
Expand Down

0 comments on commit 61bd167

Please sign in to comment.