diff --git a/benchmark/pytest/analysis/test_optimization_group.py b/benchmark/pytest/analysis/test_optimization_group.py index f7c9a5c2e..15ff699e3 100644 --- a/benchmark/pytest/analysis/test_optimization_group.py +++ b/benchmark/pytest/analysis/test_optimization_group.py @@ -32,7 +32,7 @@ np.ones((TEST_AXIS_GLOBAL_SIZE, TEST_AXIS_MODEL_SIZE)), coords=(("global", TEST_AXIS_GLOBAL.data), ("test", TEST_AXIS_MODEL.data)), ) -TEST_PARAMETER = ParameterGroup.from_list([]) +TEST_PARAMETERS = ParameterGroup.from_list([]) @megacomplex(dimension="test", properties={"is_index_dependent": bool}) @@ -74,7 +74,7 @@ def setup_model(index_dependent, link_clp): def setup_scheme(model): return Scheme( model=model, - parameters=TEST_PARAMETER, + parameters=TEST_PARAMETERS, data={ "dataset1": TEST_DATA, "dataset2": TEST_DATA, diff --git a/glotaran/builtin/io/yml/test/test_save_scheme.py b/glotaran/builtin/io/yml/test/test_save_scheme.py index 21ca1f4a6..573a78481 100644 --- a/glotaran/builtin/io/yml/test/test_save_scheme.py +++ b/glotaran/builtin/io/yml/test/test_save_scheme.py @@ -12,7 +12,7 @@ from glotaran.project import Scheme from glotaran.testing.simulated_data.sequential_spectral_decay import DATASET from glotaran.testing.simulated_data.sequential_spectral_decay import MODEL -from glotaran.testing.simulated_data.sequential_spectral_decay import PARAMETER +from glotaran.testing.simulated_data.sequential_spectral_decay import PARAMETERS if TYPE_CHECKING: from pathlib import Path @@ -36,11 +36,11 @@ def test_save_scheme(tmp_path: Path): save_model(MODEL, tmp_path / "m.yml") - save_parameters(PARAMETER, tmp_path / "p.csv") + save_parameters(PARAMETERS, tmp_path / "p.csv") save_dataset(DATASET, tmp_path / "d.nc") scheme = Scheme( MODEL, - PARAMETER, + PARAMETERS, {"dataset_1": DATASET}, ) scheme_path = tmp_path / "testscheme.yml" diff --git a/glotaran/deprecation/deprecation_utils.py b/glotaran/deprecation/deprecation_utils.py index 2c0d49deb..0d8bbfb0a 100644 --- a/glotaran/deprecation/deprecation_utils.py +++ b/glotaran/deprecation/deprecation_utils.py @@ -611,9 +611,8 @@ def deprecate_module_attribute( Version the support for this usage will be removed. module_load_overwrite : str Overwrite the location the functionality will be set from. - This allows preserving functionality without polluting new - module with code just for the sake of it. - , by default '' + This allows preserving functionality without polluting a new + module with code just for the sake of it. By default '' Returns ------- @@ -703,9 +702,8 @@ def deprecate_submodule( Version the support for this usage will be removed. module_load_overwrite : str Overwrite the location for the new module the deprecated functionality is loaded from. - This allows preserving functionality without polluting new - module with code just for the sake of it. - , by default '' + This allows preserving functionality without polluting a new + module with code just for the sake of it. By default '' Returns ------- diff --git a/glotaran/deprecation/modules/examples/sequential.py b/glotaran/deprecation/modules/examples/sequential.py index 80507747b..d7e99bd6d 100644 --- a/glotaran/deprecation/modules/examples/sequential.py +++ b/glotaran/deprecation/modules/examples/sequential.py @@ -7,8 +7,8 @@ "scheme": "SCHEME", } shared_deprecation_mapping = { - "wanted_parameter": "SIMULATION_PARAMETER", - "parameter": "PARAMETER", + "wanted_parameter": "SIMULATION_PARAMETERS", + "parameter": "PARAMETERS", "_time": "TIME_AXIS", "_spectral": "SPECTRAL_AXIS", } diff --git a/glotaran/deprecation/modules/test/test_changed_imports.py b/glotaran/deprecation/modules/test/test_changed_imports.py index 44c5fd221..c58a63819 100644 --- a/glotaran/deprecation/modules/test/test_changed_imports.py +++ b/glotaran/deprecation/modules/test/test_changed_imports.py @@ -136,7 +136,7 @@ def test_io_read_data_file(recwarn: WarningsRecorder): "attribute_name", ("sim_model", "dataset", "model", "scheme", "wanted_parameter", "parameter") ) def test_examples_sequential(recwarn: WarningsRecorder, attribute_name: str): - """glotaran.examples.sequential exported addributes""" + """glotaran.examples.sequential exported attributes""" from glotaran.examples import sequential # noqa: F401 recwarn.clear() diff --git a/glotaran/deprecation/modules/test/test_parameter_parameter_group.py b/glotaran/deprecation/modules/test/test_parameter_parameter_group.py index 994d4676c..3794c9be5 100644 --- a/glotaran/deprecation/modules/test/test_parameter_parameter_group.py +++ b/glotaran/deprecation/modules/test/test_parameter_parameter_group.py @@ -3,14 +3,14 @@ from textwrap import dedent from glotaran.deprecation.modules.test import deprecation_warning_on_call_test_helper -from glotaran.testing.simulated_data.sequential_spectral_decay import PARAMETER +from glotaran.testing.simulated_data.sequential_spectral_decay import PARAMETERS def test_parameter_group_to_csv_no_stderr(tmp_path: Path): """``ParameterGroup.to_csv`` raises deprecation warning and saves file.""" parameter_path = tmp_path / "test_parameter.csv" deprecation_warning_on_call_test_helper( - PARAMETER.to_csv, args=[parameter_path.as_posix()], raise_exception=True + PARAMETERS.to_csv, args=[parameter_path.as_posix()], raise_exception=True ) expected = dedent( """\ diff --git a/glotaran/deprecation/modules/test/test_project_scheme.py b/glotaran/deprecation/modules/test/test_project_scheme.py index 9ae30fedf..76b162621 100644 --- a/glotaran/deprecation/modules/test/test_project_scheme.py +++ b/glotaran/deprecation/modules/test/test_project_scheme.py @@ -10,7 +10,7 @@ from glotaran.project.scheme import Scheme from glotaran.testing.simulated_data.parallel_spectral_decay import DATASET from glotaran.testing.simulated_data.parallel_spectral_decay import MODEL -from glotaran.testing.simulated_data.parallel_spectral_decay import PARAMETER +from glotaran.testing.simulated_data.parallel_spectral_decay import PARAMETERS if TYPE_CHECKING: from pathlib import Path @@ -58,7 +58,7 @@ def test_scheme_from_yaml_file_method(tmp_path: Path): def test_scheme_group_tolerance(): """Argument ``group_tolerance`` raises deprecation and maps to ``clp_link_tolerance``.""" - model, parameters, dataset = MODEL, PARAMETER, DATASET + model, parameters, dataset = MODEL, PARAMETERS, DATASET warnings, result = deprecation_warning_on_call_test_helper( Scheme, @@ -78,7 +78,7 @@ def test_scheme_group_tolerance(): ) def test_scheme_group(group: bool): """Argument ``group`` raises deprecation and maps to ``dataset_groups.default.link_clp``.""" - model, parameters, dataset = MODEL, PARAMETER, DATASET + model, parameters, dataset = MODEL, PARAMETERS, DATASET warnings, result = deprecation_warning_on_call_test_helper( Scheme, @@ -100,7 +100,7 @@ def test_scheme_non_negative_least_squares(non_negative_least_squares: bool, exp """Argument ``non_negative_least_squares`` raises deprecation and maps to ``dataset_groups.default.residual_function``. """ - model, parameters, dataset = MODEL, PARAMETER, DATASET + model, parameters, dataset = MODEL, PARAMETERS, DATASET warnings, result = deprecation_warning_on_call_test_helper( Scheme, diff --git a/glotaran/parameter/parameter.py b/glotaran/parameter/parameter.py index 59f635ca5..96d8e0153 100644 --- a/glotaran/parameter/parameter.py +++ b/glotaran/parameter/parameter.py @@ -31,10 +31,10 @@ class Keys: VARY = "vary" -PARAMETER_EXPRESION_REGEX = re.compile(r"\$(?P[\w\d\.]+)((?![\w\d\.]+)|$)") -"""A regexpression to find and replace parameter names in expressions.""" +PARAMETER_EXPRESSION_REGEX = re.compile(r"\$(?P[\w\d\.]+)((?![\w\d\.]+)|$)") +"""A regular expression to find and replace parameter names in expressions.""" VALID_LABEL_REGEX = re.compile(r"\W", flags=re.ASCII) -"""A regexpression to validate labels.""" +"""A regular expression to validate labels.""" class Parameter(_SupportsArray): @@ -394,7 +394,7 @@ def transformed_expression(self) -> str | None: The transformed expression. """ if self.expression is not None and self._transformed_expression is None: - self._transformed_expression = PARAMETER_EXPRESION_REGEX.sub( + self._transformed_expression = PARAMETER_EXPRESSION_REGEX.sub( r"group.get('\g').value", self.expression ) return self._transformed_expression @@ -500,7 +500,7 @@ def markdown( elif parameter.expression is not None: expression = parameter.expression if all_parameters is not None: - for match in PARAMETER_EXPRESION_REGEX.findall(expression): + for match in PARAMETER_EXPRESSION_REGEX.findall(expression): label = match[0] parameter = all_parameters.get(label) expression = expression.replace( diff --git a/glotaran/testing/simulated_data/parallel_spectral_decay.py b/glotaran/testing/simulated_data/parallel_spectral_decay.py index fb0874a06..7d9451170 100644 --- a/glotaran/testing/simulated_data/parallel_spectral_decay.py +++ b/glotaran/testing/simulated_data/parallel_spectral_decay.py @@ -4,10 +4,9 @@ from glotaran.io import load_model from glotaran.project import Scheme from glotaran.project.generators import generate_model_yml -from glotaran.testing.simulated_data.shared_decay import PARAMETER +from glotaran.testing.simulated_data.shared_decay import PARAMETERS from glotaran.testing.simulated_data.shared_decay import SIMULATION_COORDINATES -from glotaran.testing.simulated_data.shared_decay import SIMULATION_PARAMETER -from glotaran.testing.simulated_data.shared_decay import * # noqa F403 +from glotaran.testing.simulated_data.shared_decay import SIMULATION_PARAMETERS SIMULATION_MODEL_YML = generate_model_yml( generator_name="spectral_decay_parallel", @@ -24,10 +23,10 @@ DATASET = simulate( SIMULATION_MODEL, "dataset_1", - SIMULATION_PARAMETER, + SIMULATION_PARAMETERS, SIMULATION_COORDINATES, noise=True, noise_std_dev=1e-2, ) -SCHEME = Scheme(model=MODEL, parameters=PARAMETER, data={"dataset_1": DATASET}) +SCHEME = Scheme(model=MODEL, parameters=PARAMETERS, data={"dataset_1": DATASET}) diff --git a/glotaran/testing/simulated_data/sequential_spectral_decay.py b/glotaran/testing/simulated_data/sequential_spectral_decay.py index 0a75ba917..9ea113bac 100644 --- a/glotaran/testing/simulated_data/sequential_spectral_decay.py +++ b/glotaran/testing/simulated_data/sequential_spectral_decay.py @@ -4,10 +4,9 @@ from glotaran.io import load_model from glotaran.project import Scheme from glotaran.project.generators import generate_model_yml -from glotaran.testing.simulated_data.shared_decay import PARAMETER +from glotaran.testing.simulated_data.shared_decay import PARAMETERS from glotaran.testing.simulated_data.shared_decay import SIMULATION_COORDINATES -from glotaran.testing.simulated_data.shared_decay import SIMULATION_PARAMETER -from glotaran.testing.simulated_data.shared_decay import * # noqa F403 +from glotaran.testing.simulated_data.shared_decay import SIMULATION_PARAMETERS SIMULATION_MODEL_YML = generate_model_yml( generator_name="spectral_decay_sequential", @@ -25,10 +24,10 @@ DATASET = simulate( SIMULATION_MODEL, "dataset_1", - SIMULATION_PARAMETER, + SIMULATION_PARAMETERS, SIMULATION_COORDINATES, noise=True, noise_std_dev=1e-2, ) -SCHEME = Scheme(model=MODEL, parameters=PARAMETER, data={"dataset_1": DATASET}) +SCHEME = Scheme(model=MODEL, parameters=PARAMETERS, data={"dataset_1": DATASET}) diff --git a/glotaran/testing/simulated_data/shared_decay.py b/glotaran/testing/simulated_data/shared_decay.py index 89e28ae94..a5e454f2a 100644 --- a/glotaran/testing/simulated_data/shared_decay.py +++ b/glotaran/testing/simulated_data/shared_decay.py @@ -3,7 +3,7 @@ from glotaran.io import load_parameters -SIMULATION_PARAMETER_YML = """ +SIMULATION_PARAMETERS_YML = """ rates: - [species_1, 0.5] - [species_2, 0.3] @@ -27,9 +27,9 @@ - [location, 650] - [width, 60] """ -SIMULATION_PARAMETER = load_parameters(SIMULATION_PARAMETER_YML, format_name="yml_str") +SIMULATION_PARAMETERS = load_parameters(SIMULATION_PARAMETERS_YML, format_name="yml_str") -PARAMETER_YML = """ +PARAMETERS_YML = """ rates: - [species_1, 0.5] - [species_2, 0.3] @@ -39,7 +39,7 @@ - [center, 0.3] - [width, 0.1] """ -PARAMETER = load_parameters(PARAMETER_YML, format_name="yml_str") +PARAMETERS = load_parameters(PARAMETERS_YML, format_name="yml_str") TIME_AXIS = np.arange(-1, 20, 0.01) SPECTRAL_AXIS = np.arange(600, 700, 1.4)