Skip to content

Commit 3415526

Browse files
committed
Fixed getRate and added test
1 parent 9984ea8 commit 3415526

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

RMK_support/crm_support.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ def getRate(self, transition: Union[str, Transition], moment: int = 0) -> Variab
275275
)
276276

277277
return self[
278-
"rate" + str(moment) + "index" + str(self.transitionTags.index(transitionName))
278+
"rate" + str(moment) + "index" + str(self.transitionTags.index(transitionName)+1)
279279
]
280280

281281
def addLatexToDoc(self, doc: tex.Document, **kwargs):

RMK_support/tests/test_crm_support.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ def test_crm_mbdata(grid: Grid):
7070

7171
assert mbData.getTransitionIndices(transition.name) == [1]
7272

73+
assert mbData.getRate(transition,0).name == "rate0index1"
74+
7375
assert mbData.dict() == {
7476
"modelboundDataType": "modelboundCRMData",
7577
"transitionTags": [transition.name],
@@ -300,9 +302,6 @@ def test_simple_transition(grid: Grid):
300302

301303
def test_janev_transitions(grid: Grid):
302304

303-
# TODO: Test mbData.varNames and mbData.getRate, which each return the "rate(...)index(...)" format name for a given transition
304-
# mbData.getRate needs to be changed to point to the correct dictionary key.
305-
306305
temperature = vc.Variable("T", grid)
307306
electronDistribution = vc.Variable("f", grid, isDistribution=True)
308307

0 commit comments

Comments
 (0)