Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix check for fixed params when fixed_params is None #107

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Loading