-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from lincc-frameworks/more_complex_model
Allow PhysicalModels to inherit key properties from their host
- Loading branch information
Showing
4 changed files
with
75 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import numpy as np | ||
from tdastro.sources.static_source import StaticSource | ||
|
||
|
||
def test_static_source() -> None: | ||
"""Test that we can sample and create a StaticSource object.""" | ||
model = StaticSource(brightness=10.0) | ||
assert model.brightness == 10.0 | ||
assert model.ra is None | ||
assert model.dec is None | ||
assert model.distance is None | ||
|
||
values = model.evaluate(np.array([1, 2, 3, 4, 5, 10])) | ||
assert len(values) == 6 | ||
assert np.all(values == 10.0) | ||
|
||
|
||
def test_static_source_host() -> None: | ||
"""Test that we can sample and create a StaticSource object with properties | ||
derived from the host object.""" | ||
host = StaticSource(brightness=15.0, ra=1.0, dec=2.0, distance=3.0) | ||
model = StaticSource(brightness=10.0, host=host) | ||
assert model.brightness == 10.0 | ||
assert model.ra == 1.0 | ||
assert model.dec == 2.0 | ||
assert model.distance == 3.0 |