API Reference

Experiment control functions

This is the classes and functions reference of expyfun. Functions are grouped by hardware control type.

Experiment control

expyfun:

Classes:

ExperimentController(exp_name[, …]) Interface for hardware control (audio, buttonbox, eye tracker, etc.)
EyelinkController(ec[, link, fs, verbose]) Eyelink communication and control methods
TDTController(tdt_params) Interface for TDT audio output, stamping, and responses

Functions:

assert_version(version) Assert that a specific version of expyfun is imported
binary_to_decimals(binary, n_bits) Convert a sequence of binary numbers to a sequence of decimal numbers
decimals_to_binary(decimals, n_bits) Convert a sequence of decimal numbers to a sequence of binary numbers
download_version([version, dest_dir]) Download specific expyfun version
get_keyboard_input(prompt[, default, …]) Get keyboard input of a specific type
wait_secs(secs[, ec]) Wait a specified number of seconds.

Stimulus design

expyfun.stimuli:

Classes:

CRMPreload(fs[, ref_rms, ramp_dur, stereo, path]) Store the CRM corpus in memory for fast access.
TrackerBinom(callback, alpha, chance, max_trials) Binomial hypothesis testing tracker
TrackerDealer(callback, trackers[, max_lag, …]) Class for selecting and pacing independent simultaneous trackers
TrackerUD(callback, up, down, step_size_up, …) Up-down adaptive tracker

Functions:

convolve_hrtf(data, fs, angle[, source, interp]) Convolve a signal with a head-related transfer function
compute_mls_impulse_response(response, mls, …) Compute the impulse response from data obtained using MLS
crm_info() Get allowable options for CRM stimuli.
crm_prepare_corpus(fs[, path_out, …]) Prepare the CRM corpus for a given sampling rate and convert to wav
crm_response_menu(ec[, colors, numbers, …]) Create a mouse-driven CRM response menu.
crm_sentence(fs, sex, talker_num, callsign, …) Get a specific sentence from the hard drive.
play_sound(sound[, fs, norm, wait]) Play a sound
repeated_mls(n_samp, n_repeats) Generate a repeated MLS 0/1 signal for finding an impulse response
rms(data[, axis, keepdims]) Calculate the RMS of a signal
texture_ERB([n_freqs, n_coh, rho, seq, fs, …]) Create ERB texture stimulus
vocode(data, fs[, n_bands, freq_lims, …]) Vocode stimuli using a variety of methods
window_edges(sig, fs[, dur, axis, window, edges]) Window the edges of a signal (e.g., to prevent “pops”)

expyfun.io:

Functions:

read_hdf5(fname) Read python object from HDF5 format using h5io/h5py
read_tab_raw(fname[, return_params]) Read .tab file from expyfun output without segmenting into trials.
read_tab(fname[, group_start, group_end, …]) Read .tab file from expyfun output and segment into trials.
read_wav(fname[, verbose]) Read in a WAV file
write_hdf5(fname, data[, overwrite, compression]) Write python object to HDF5 format using h5io/h5py
write_wav(fname, data, fs[, dtype, …]) Write a WAV file
reconstruct_tracker(fname) Reconstruct TrackerUD and TrackerBinom objects from .tab files.
reconstruct_dealer(fname) Reconstruct TrackerDealer object from .tab files.

expyfun.visual:

Classes:

Circle(ec[, radius, pos, units, n_edges, …]) A circle or ellipse
ConcentricCircles(ec[, radii, pos, units, …]) A set of filled concentric circles drawn without edges
Diamond(ec, pos[, units, fill_color, …]) A diamond
FixationDot(ec[, colors]) A reasonable centered fixation dot
Line(ec, coords[, units, line_color, …]) A connected set of line segments
RawImage(ec, image_buffer[, pos, scale, units]) Create image from array for on-screen display
Rectangle(ec, pos[, units, fill_color, …]) A rectangle
Text(ec, text[, pos, color, font_name, …]) A text object

Code blocks

expyfun.codeblocks:

Functions:

find_pupil_dynamic_range(ec, el[, prompt, …]) Find pupil dynamic range
find_pupil_tone_impulse_response(ec, el, …) Find pupil impulse response using responses to tones

Analysis

expyfun.analyze:

Functions:

barplot(h[, axis, ylim, err_bars, lines, …]) Makes barplots w/ optional line overlays, grouping, & signif.
box_off(ax) Remove the top and right edges of a plot frame, and point ticks outward.
dprime(hmfc[, zero_correction]) Estimates d-prime, with optional correction factor to avoid infinites.
dprime_2afc(hm[, zero_correction]) Estimates d-prime for two-alternative forced-choice paradigms.
fit_sigmoid(x, y[, p0, fixed]) Fit a sigmoid to summary data
format_pval(pval[, latex, scheme]) Format a p-value using one of several schemes.
logit(prop[, max_events]) Convert proportion (expressed in the range [0, 1]) to logit.
plot_screen(screen[, ax]) Plot a captured screenshot
press_times_to_hmfc(presses, targets, foils, …) Convert press times to hits/misses/FA/CR and reaction times
restore_values(correct, other, idx) Restore missing values from one sequence using another
rt_chisq(x[, axis, warn]) Chi square fit for reaction times (a better summary statistic than mean)
sigmoid(x[, lower, upper, midpt, slope]) Calculate sigmoidal values along the x-axis

Logging and configuration

expyfun:

Functions:

set_log_level([verbose, return_old_level]) Convenience function for setting the logging level
set_config(key, value) Set expyfun preference in config