From 9c013949ee948805cbc0b4b5dc1523da059fd69e Mon Sep 17 00:00:00 2001 From: Tiziano Zito Date: Mon, 23 Sep 2024 11:24:13 +0200 Subject: [PATCH] Revert "remove wrong warning" Re-introduce a check for gamma and lambda fixed to different values in case of equal asymptote experiments, but turning it into an Exception. There's no way in this case to know what the user meant, so it safer to bail out instead of guessing which parameter is to be trusted. This reverts commit ec4e71629b9974f90343a2fcd7ae8ab0046681ce. --- psignifit/_configuration.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/psignifit/_configuration.py b/psignifit/_configuration.py index fbb2950..ddc8c07 100644 --- a/psignifit/_configuration.py +++ b/psignifit/_configuration.py @@ -139,6 +139,18 @@ def check_experiment_type_matches_fixed_parameters(self, fixed_params, experimen if fixed_params is not None and 'gamma' in fixed_params: warnings.warn( f'The parameter gamma was fixed to {fixed_params["gamma"]}. In {ExperimentType.N_AFC.value} experiments gamma is automatically fixed to 1/n. Ignoring fixed gamma.') + if experiment_type == ExperimentType.EQ_ASYMPTOTE.value: + if fixed_params is not None: + if 'gamma' in fixed_params: + pass # we assume the user knows what they are doing + if 'lambda' in fixed_params: + pass # we assume the user knows what they are doing + if 'lambda' in fixed_params and 'gamma' in fixed_params: + if fixed_params['gamma'] != fixed_params['lambda']: + raise PsignifitException( + f'The parameters lambda {fixed_params["lambda"]} and' + f' gamma {fixed_params["gamma"]} were fixed to different values.' + f' In {experiment_type} experiments gamma and lambda need to be equal. ') def check_experiment_type(self, value):