Giter VIP home page Giter VIP logo

questplus's Introduction

A QUEST+ implementation in Python

Latest PyPI Release Conda Version Travis Build Status AppVeyor Build status

This is a simple implementation of the QUEST+ algorithm in Python.

Documentation

Please find the documentation at questplus.readthedocs.io.

questplus's People

Contributors

aforren1 avatar dependabot[bot] avatar hoechenberger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

questplus's Issues

Please upload the latest version of the library to PyPI.

Hello. I am using the 2019.4 version of the QUEST+ library for my psychometric experiments.

However, I am having trouble with a bug in the psychometric function (norm_pdf).

This bug seems to have been resolved in the latest commit (9e1d0b8), so I would like you to upload this version of the QUEST+ library to PyPI.

Thank you for implementing this great software.

bug: 'linear' stimScale does not work with negative numbers (xarray RuntimeWarning)

Hi, thanks for this package! I am using it in psychopy :) unfortunately the 'linear' stimScale does not behave as expected for negative intensityVals/thresholdVals as it results in a RuntimeWarning. Maybe it's just my code, but "linear" with positive values works great and using "log10" with negative intensity values also gives a good estimate.

Please let me know if you need more information to debug or decide if this is a bug. Thank you!

[/lib/python3.8/site-packages/xarray/core/computation.py:771](/lib/python3.8/site-packages/xarray/core/computation.py:771): RuntimeWarning: invalid value encountered in log result_data = func(*input_data)

Example using 'linear'-scale and negative intensity values:
image
image

Add support for inverse function

Hi, for our project we adjusted the code to use an inverse function. I think this could be helpful for some others. Please let me know if you want a reproducible example or a pull request :)

Adjust line 111 in questplus/psychometric_function.py:

- return p
+ return (1 + lower_asymptote - lapse_rate) - p

Example plot:
output

Add demos

Should include some simulations and plotting.

Turn QuestPlus class into an iterator?

Potentially transform class into an iterator, so users would be able to iterate over it e.g. using a for loop:

q = QuestPlus(...)
for stimulus in q:
    ...

Add termination criterion

Potentially after turning the class into an iterator (#8), we should add a termination criterion (e.g., number of trials, or entropy).

It looks like QuestPlus isn't working with numpy>=1.24 when setting priors

This example in psychopy code:

from questplus import QuestPlus
import numpy as np

thresholds = np.arange(-40, 0 + 1)
slope, guess, lapse = 3.5, 0.5, 0.02
contrasts = thresholds.copy()

threshold_prior_vals = np.random.randint(low=1, high=10,
                                        size=len(thresholds))
threshold_prior_vals = threshold_prior_vals / threshold_prior_vals.sum()
prior = dict(threshold=threshold_prior_vals)
q = QuestPlusHandler(
    nTrials=20,
    intensityVals=contrasts,
    thresholdVals=thresholds,
    slopeVals=slope,
    lowerAsymptoteVals=guess,
    lapseRateVals=lapse,
    prior=prior)
print (q)

results in this error with numpy 1.24 but succeeds in numpy <=1.23

Traceback (most recent call last):
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/pydevd.py", line 1483, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/Users/lpzjwp/Desktop/questplus_test.py", line 14, in <module>
    q = QuestPlusHandler(
  File "/Users/lpzjwp/code/psychopy/git/psychopy/data/staircase.py", line 1575, in __init__
    self._qp = qp.QuestPlusWeibull(
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/questplus/qp.py", line 489, in __init__
    super().__init__(stim_domain=dict(intensity=intensities),
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/questplus/qp.py", line 86, in __init__
    self.prior = self._gen_prior(prior=prior)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/questplus/qp.py", line 175, in _gen_prior
    prior_grid = np.meshgrid(*list(prior_orig.values()),
  File "<__array_function__ internals>", line 200, in prod
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/numpy/core/fromnumeric.py", line 3076, in prod
    return _wrapreduction(a, np.multiply, 'prod', axis, dtype, out,
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/numpy/core/fromnumeric.py", line 86, in _wrapreduction
    return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (4,) + inhomogeneous part.

Installing on a fresh Ubuntu18.04 using pip3

I get the following output

Collecting questplus
  Using cached https://files.pythonhosted.org/packages/ec/a4/8d47d76a484e0f7080cd43b3141063efd938a7aceb8a2bc39fe2dc08685a/questplus-0.0.5.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-llc0eh02/questplus/setup.py", line 12, in <module>
        version=versioneer.get_version(),
      File "/tmp/pip-build-llc0eh02/questplus/versioneer.py", line 1480, in get_version
        return get_versions()["version"]
      File "/tmp/pip-build-llc0eh02/questplus/versioneer.py", line 1412, in get_versions
        cfg = get_config_from_root(root)
      File "/tmp/pip-build-llc0eh02/questplus/versioneer.py", line 344, in get_config_from_root
        parser.readfp(f)
      File "/usr/lib/python3.6/configparser.py", line 763, in readfp
        self.read_file(fp, source=filename)
      File "/usr/lib/python3.6/configparser.py", line 718, in read_file
        self._read(f, source)
      File "/usr/lib/python3.6/configparser.py", line 1015, in _read
        for lineno, line in enumerate(fp, start=1):
      File "/usr/lib/python3.6/encodings/ascii.py", line 26, in decode
        return codecs.ascii_decode(input, self.errors)[0]
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 46: ordinal not in range(128)
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-llc0eh02/questplus/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.