Skip to content

Commit

Permalink
test: add test for parameters with same name
Browse files Browse the repository at this point in the history
  • Loading branch information
hellkite500 committed Aug 27, 2024
1 parent 819f17c commit a9e2f50
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions python/ngen_cal/tests/test_params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from __future__ import annotations

from ngen.cal.ngen import _params_as_df
import pandas as pd

from typing import TYPE_CHECKING

if TYPE_CHECKING:
from typing import Mapping
from ngen.cal.parameter import Parameter

def test_multi_params(multi_model_shared_params: Mapping[str, list[Parameter]]):
# This is essentially the path the params go through from
# creation in model.py to update in search.py
params = _params_as_df(multi_model_shared_params)
params = pd.DataFrame(params).rename(columns={'init':'0'})
# create new iteration from old
params['1'] = params['0']
#update the parameters by index
params.loc[0, '1'] = 0.5
pa = params[ params['model'] == 'A' ]
pb = params[ params['model'] == 'B' ]

assert pa.drop('model', axis=1).equals( pb.drop('model', axis=1) )

# TODO test/document case where params have same name but different min/max/init values

0 comments on commit a9e2f50

Please sign in to comment.