From dbedfb7a22efcadc63e1a25b7fba226312005ad9 Mon Sep 17 00:00:00 2001 From: David-Elias Kuenstle Date: Fri, 20 Sep 2024 15:51:48 +0200 Subject: [PATCH] Expose config_from_matlab function, remove redundant Configuration.from_matlab_options --- docs/references/index.rst | 1 + psignifit/__init__.py | 1 + psignifit/_configuration.py | 5 ----- psignifit/tests/test_matlab.py | 4 +--- 4 files changed, 3 insertions(+), 8 deletions(-) diff --git a/docs/references/index.rst b/docs/references/index.rst index 3545268..4393321 100644 --- a/docs/references/index.rst +++ b/docs/references/index.rst @@ -15,6 +15,7 @@ This is the class and function reference of psignifit. psignifit pool_blocks + config_from_matlab Configuration Result diff --git a/psignifit/__init__.py b/psignifit/__init__.py index d4fac5d..ebbd6ca 100644 --- a/psignifit/__init__.py +++ b/psignifit/__init__.py @@ -12,3 +12,4 @@ from ._pooling import pool_blocks from ._configuration import Configuration from ._result import Result +from ._matlab import config_from_matlab \ No newline at end of file diff --git a/psignifit/_configuration.py b/psignifit/_configuration.py index ff5a48e..e4d0aad 100644 --- a/psignifit/_configuration.py +++ b/psignifit/_configuration.py @@ -64,11 +64,6 @@ class Configuration: def __post_init__(self): self.check_attributes() - @classmethod - def from_matlab_options(cls, option_dict: Dict[str, Any], **kwargs): - python_configs = config_from_matlab(option_dict, **kwargs) - return cls(**python_configs) - @classmethod def from_dict(cls, config_dict: Dict[str, Any]): config_dict = config_dict.copy() diff --git a/psignifit/tests/test_matlab.py b/psignifit/tests/test_matlab.py index 29d52b4..6899ddc 100644 --- a/psignifit/tests/test_matlab.py +++ b/psignifit/tests/test_matlab.py @@ -36,7 +36,7 @@ def yield_test_data(cases=yield_test_cases()): def compare_with_matlab(data, options, results): - config = psignifit.Configuration.from_matlab_options(options, raise_matlab_only=False) + config = psignifit.config_from_matlab(options, raise_matlab_only=False) pyresults = psignifit.psignifit(data, conf=config) # Testing for similarity: # allclose(actual, desired) = abs(actual - desired) <= atol + rtol * abs(desired) @@ -73,5 +73,3 @@ def test_all_matlab_cases(data, options, results): @pytest.mark.parametrize('data,options,results', yield_test_data(test_case_subset), ids=test_case_subset) def test_few_matlab_cases(data, options, results): compare_with_matlab(data, options, results) - -