-
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.
- Loading branch information
1 parent
8ef802c
commit fefd0f1
Showing
9 changed files
with
40 additions
and
35 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
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,25 @@ | ||
"""A simple node used for testing.""" | ||
|
||
from tdastro.base_models import ParameterizedNode | ||
|
||
|
||
class SingleVariableNode(ParameterizedNode): | ||
"""A ParameterizedNode holding a single pre-defined variable. | ||
Notes | ||
----- | ||
Often used for testing, but can be used to make graph dependencies clearer. | ||
Parameters | ||
---------- | ||
name : `str` | ||
The parameter name. | ||
value : any | ||
The parameter value. | ||
**kwargs : `dict`, optional | ||
Any additional keyword arguments. | ||
""" | ||
|
||
def __init__(self, name, value, **kwargs): | ||
super().__init__(**kwargs) | ||
self.add_parameter(name, value, **kwargs) |
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.
File renamed without changes.
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,10 @@ | ||
from tdastro.math_nodes.single_value_node import SingleVariableNode | ||
|
||
|
||
def test_single_variable_node(): | ||
"""Test that we can create and query a SingleVariableNode.""" | ||
node = SingleVariableNode("A", 10.0) | ||
assert str(node) == "SingleVariableNode" | ||
|
||
state = node.sample_parameters() | ||
assert node.get_param(state, "A") == 10 |
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