Skip to main content

A QUEST+ implementation in Python.

Project description

A QUEST+ implementation in Python

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

Requirements

  • Python 3.6+
  • xarray
  • scipy

Usage

import numpy as np
import questplus as qp

# Stimulus domain.
intensities = np.arange(start=-3.5, stop=-0.5+0.25, step=0.25)
stim_domain = dict(intensity=intensities)

# Parameter domain.
thresholds = intensities.copy()
slopes = np.linspace(0.5, 15, 5)
lower_asymptotes = np.linspace(0.01, 0.5, 5)
lapse_rate = 0.01

param_domain = dict(threshold=thresholds,
                    slope=slopes,
                    lower_asymptote=lower_asymptotes,
                    lapse_rate=lapse_rate)

# Outcome (response) domain.
responses = ['Yes', 'No']
outcome_domain = dict(respose=responses)

# Further parameters.
func = 'weibull'
stim_scale = 'log10'
stim_selection_method = 'min_entropy'
param_estimation_method = 'mean'

# Initialize the QUEST+ staircase.
q = qp.QuestPlus(stim_domain=stim_domain,
                 func=func,
                 stim_scale=stim_scale,
                 param_domain=param_domain,
                 outcome_domain=outcome_domain,
                 stim_selection_method=stim_selection_method,
                 param_estimation_method=param_estimation_method)

trial_count = 20
for current_trial_number in range(1, trial_count+1):
    next_stim = q.next_stim
    print(f'Please present stimulus {next_stim}.')
    
    # Retrieve response
    # ...
    # outcome = dict(response='Yes')  or
    # outcome = dict(response='No')
    q.update(stim=next_stim, outcome=outcome)

# Print parameter estimates.
with np.printoptions(precision=3, suppress=True):
    print('f\nParameter estimates: {q.param_estimate}')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

questplus-0.0.4.tar.gz (38.9 kB view details)

Uploaded Source

File details

Details for the file questplus-0.0.4.tar.gz.

File metadata

  • Download URL: questplus-0.0.4.tar.gz
  • Upload date:
  • Size: 38.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for questplus-0.0.4.tar.gz
Algorithm Hash digest
SHA256 2c2466e5c485870869be87a3c3ba30475b0d74845e07a3b3b404c5a6e6e309c5
MD5 d35c82dbf6e7219c9fc1e6b6d1cc5b3e
BLAKE2b-256 5f0c1b73212084e97f7254195af6c8b2072d429a9b143a8bcb55987e27060e91

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page