Skip to content

Commit

Permalink
Fix small errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremykubica committed Jul 8, 2024
1 parent d69e026 commit 6952f99
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/tdastro/base_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ def __init__(self, **kwargs):
**kwargs : `dict`, optional
Any additional keyword arguments.
"""
self.model_name = "ParameterizedModel"
self.setters = {}
self.sample_iteration = 0

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 @@ -76,7 +76,7 @@ def __init__(

def __str__(self):
"""Return the string representation of the model."""
return f"SplineSource{self.name}"
return f"SplineModel({self.name})"

def _evaluate(self, times, wavelengths, **kwargs):
"""Draw effect-free observations for this object.
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 @@ -27,7 +27,7 @@ def __init__(self, brightness, **kwargs):

def __str__(self):
"""Return the string representation of the model."""
return "StaticSource(self.brightness)"
return f"StaticSource({self.brightness})"

def _evaluate(self, times, wavelengths, **kwargs):
"""Draw effect-free observations for this object.
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 @@ -36,7 +36,7 @@ def __init__(self, brightness, t_start, t_end, **kwargs):

def __str__(self):
"""Return the string representation of the model."""
return f"StepSource(self.brightness)_{self.t_start}_to_{self.t_end}"
return f"StepSource({self.brightness})_{self.t_start}_to_{self.t_end}"

def _evaluate(self, times, wavelengths, **kwargs):
"""Draw effect-free observations for this object.
Expand Down
5 changes: 4 additions & 1 deletion tests/tdastro/sources/test_spline_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def test_spline_model_flat() -> None:
wavelengths = np.linspace(100.0, 500.0, 25)
fluxes = np.full((len(times), len(wavelengths)), 1.0)
model = SplineModel(times, wavelengths, fluxes)
assert str(model) == "SplineModel(None)"

test_times = np.array([0.0, 1.0, 2.0, 3.0, 10.0])
test_waves = np.array([0.0, 100.0, 200.0, 1000.0])
Expand All @@ -17,7 +18,9 @@ def test_spline_model_flat() -> None:
expected = np.full_like(values, 1.0)
np.testing.assert_array_almost_equal(values, expected)

model2 = SplineModel(times, wavelengths, fluxes, amplitude=5.0)
model2 = SplineModel(times, wavelengths, fluxes, amplitude=5.0, name="test")
assert str(model2) == "SplineModel(test)"

values2 = model2.evaluate(test_times, test_waves)
assert values2.shape == (5, 4)
expected2 = np.full_like(values2, 5.0)
Expand Down
1 change: 1 addition & 0 deletions tests/tdastro/sources/test_static_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def test_static_source() -> None:
assert model.ra is None
assert model.dec is None
assert model.distance is None
assert str(model) == "StaticSource(10.0)"

times = np.array([1, 2, 3, 4, 5, 10])
wavelengths = np.array([100.0, 200.0, 300.0])
Expand Down
1 change: 1 addition & 0 deletions tests/tdastro/sources/test_step_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def test_step_source() -> None:
assert model.ra == 1.0
assert model.dec == 2.0
assert model.distance == 3.0
assert str(model) == "StepSource(15.0)_1.0_to_2.0"

times = np.array([0.0, 1.0, 2.0, 3.0])
wavelengths = np.array([100.0, 200.0])
Expand Down

0 comments on commit 6952f99

Please sign in to comment.