Skip to content

Commit

Permalink
Merge pull request #107 from pberkes/refix-2afc-gamma
Browse files Browse the repository at this point in the history
Fix check for fixed params when `fixed_params` is None
  • Loading branch information
pberkes authored Sep 20, 2024
2 parents 0751494 + 717c4e9 commit e5dea94
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
2 changes: 1 addition & 1 deletion psignifit/_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def check_fixed_parameters(self, value):

def check_experiment_type_matches_fixed_parameters(self, fixed_params, experiment_type):
if experiment_type == ExperimentType.N_AFC.value:
if 'gamma' in fixed_params:
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 must be fixed to 1/n. Ignoring fixed gamma.')

Expand Down
11 changes: 2 additions & 9 deletions psignifit/tests/test_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from unittest.mock import patch

import pytest
import numpy as np

from psignifit._configuration import Configuration
from psignifit._utils import PsignifitException
Expand Down Expand Up @@ -104,13 +103,10 @@ def test_set_width_min_wrong_type():

def test_warning_for_2afc_and_wrong_gamma():
sigmoid = "norm"
width = 0.3
stim_range = [0.001, 0.001 + width * 1.1]
threshold = stim_range[1]/3
stim_range = [0.001, 0.2]
lambda_ = 0.0232
gamma = 0.1


options = {}
options['sigmoid'] = sigmoid # choose a cumulative Gauss as the sigmoid
options['experiment_type'] = '2AFC'
Expand All @@ -119,7 +115,4 @@ def test_warning_for_2afc_and_wrong_gamma():
options["stimulus_range"] = stim_range

with pytest.warns(UserWarning, match='gamma was fixed'):
conf = Configuration(**options)



Configuration(**options)

0 comments on commit e5dea94

Please sign in to comment.