-
Notifications
You must be signed in to change notification settings - Fork 7
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 #276 from gyorilab/regnet_fix
Improvements to regnet export
- Loading branch information
Showing
2 changed files
with
58 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from mira.sources import amr | ||
from mira.modeling import Model | ||
from mira.metamodel.ops import stratify | ||
|
||
from mira.modeling.amr.regnet import AMRRegNetModel, \ | ||
template_model_to_regnet_json | ||
|
||
|
||
def test_regnet_end_to_end(): | ||
url = 'https://raw.githubusercontent.com/DARPA-ASKEM/' \ | ||
'Model-Representations/main/regnet/examples/lotka_volterra.json' | ||
|
||
model = amr.regnet.model_from_url(url) | ||
|
||
model_2_city = stratify( | ||
model, | ||
key="city", | ||
strata=[ | ||
"Toronto", | ||
"Montreal", | ||
], | ||
) | ||
|
||
# Smoke tests to make sure exports work | ||
ex1 = AMRRegNetModel(Model(model)).to_json() | ||
ex2 = AMRRegNetModel(Model(model_2_city)).to_json() | ||
assert ex1 == template_model_to_regnet_json(model) | ||
assert ex2 == template_model_to_regnet_json(model_2_city) |