Table Of Contents

Previous topic

psychopy.microphone - Capture and analyze sound

Next topic

psychopy.monitors - for those that don’t like Monitor Center

This Page

Quick links

psychopy.misc - miscellaneous routines for converting units etc

Wrapper for all miscellaneous functions and classes from psychopy.tools

psychopy.misc has gradually grown very large and the underlying code for its functions are distributed in multiple files. You can still (at least for now) import the functions here using from psychopy import misc but you can also import them from the tools sub-modules.

From psychopy.tools.filetools

toFile(filename, data) Save data (of any sort) as a pickle file.
fromFile(filename) Load data (of any sort) from a pickle file.
mergeFolder(src, dst[, pattern]) Merge a folder into another.

From psychopy.tools.colorspacetools

dkl2rgb(dkl[, conversionMatrix]) Convert from DKL color space (Derrington, Krauskopf & Lennie) to RGB.
dklCart2rgb(LUM, LM, S[, conversionMatrix]) Like dkl2rgb except that it uses cartesian coords (LM,S,LUM) rather than spherical coords for DKL (elev, azim, contr).
rgb2dklCart(picture[, conversionMatrix]) Convert an RGB image into Cartesian DKL space.
hsv2rgb(hsv_Nx3) Convert from HSV color space to RGB gun values.
lms2rgb(lms_Nx3[, conversionMatrix]) Convert from cone space (Long, Medium, Short) to RGB.
rgb2lms(rgb_Nx3[, conversionMatrix]) Convert from RGB to cone space (LMS).
dkl2rgb(dkl[, conversionMatrix]) Convert from DKL color space (Derrington, Krauskopf & Lennie) to RGB.

From psychopy.tools.coordinatetools

cart2pol(x, y[, units]) Convert from cartesian to polar coordinates.
cart2sph(z, y, x) Convert from cartesian coordinates (x,y,z) to spherical (elevation, azimuth, radius).
pol2cart(theta, radius[, units]) Convert from polar to cartesian coordinates.
sph2cart(*args) Convert from spherical coordinates (elevation, azimuth, radius) to cartesian (x,y,z).

From psychopy.tools.monitorunittools

convertToPix(vertices, pos, units, win) Takes vertices and position, combines and converts to pixels
cm2pix(cm, monitor) Convert size in degrees to size in pixels for a given Monitor object
cm2deg(cm, monitor[, correctFlat]) Convert size in cm to size in degrees for a given Monitor object
deg2cm(degrees, monitor[, correctFlat]) Convert size in degrees to size in pixels for a given Monitor object.
deg2pix(degrees, monitor[, correctFlat]) Convert size in degrees to size in pixels for a given Monitor object
pix2cm(pixels, monitor) Convert size in pixels to size in cm for a given Monitor object
pix2deg(pixels, monitor[, correctFlat]) Convert size in pixels to size in degrees for a given Monitor object

From psychopy.tools.imagetools

array2image(a) Takes an array and returns an image object (PIL)
image2array(im) Takes an image object (PIL) and returns a numpy array
makeImageAuto(inarray) Combines float_uint8 and image2array operations ie.

From psychopy.tools.plottools

plotFrameIntervals(intervals) Plot a histogram of the frame intervals.

From psychopy.tools.typetools

float_uint8(inarray) Converts arrays, lists, tuples and floats ranging -1:1
uint8_float(inarray) Converts arrays, lists, tuples and UINTs ranging 0:255
float_uint16(inarray) Converts arrays, lists, tuples and floats ranging -1:1

From psychopy.tools.unittools

radians radians(x, /, out=None, *, where=True, casting=’same_kind’, order=’K’, dtype=None, subok=True[, signature, extobj])
degrees degrees(x, /, out=None, *, where=True, casting=’same_kind’, order=’K’, dtype=None, subok=True[, signature, extobj])