Skip to content

Commit

Permalink
add test parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
enigne committed Mar 29, 2024
1 parent 9dc5c13 commit 4bebdfb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions PINNICLE/parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,11 @@ def __str__(self):
return ("\n".join(["\t\t\t" + k + ":\t" + str(self.__dict__[k]) for k in self.__dict__ if k != "param_dict"]))+"\n"

def update(self):
# TODO: update name_map according to data_size
pass
""" update name_map according to data_size
"""
for k in self.data_size:
if k not in self.name_map:
self.name_map[k] = k


class NNParameter(ParameterBase):
Expand Down
7 changes: 5 additions & 2 deletions tests/test_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ def test_domain_parameter():
assert d.has_keys(newat)

def test_data_parameter():
d = SingleDataParameter({"dataname":['u', 'v'], "datasize":[4000, 4000]})
issm = {"data_path":"./", "data_size":{"u":4000, "v":4000}}
d = SingleDataParameter(issm)
assert hasattr(d, "param_dict"), "Default attribute 'param_dict' not found"
issm = {"dataname":['u', 'v'], "datasize":[4000, 4000]}
assert d.name_map["u"] == "u"
assert d.name_map["v"] == "v"

d = DataParameter({"ISSM":issm})
assert hasattr(d, "param_dict"), "Default attribute 'param_dict' not found"
assert hasattr(d, "data"), "attribute 'data' not found"
Expand Down

0 comments on commit 4bebdfb

Please sign in to comment.