stimupy.utils#

Modules#

stimupy.utils.color_conversions

stimupy.utils.contrast_conversions

stimupy.utils.export

stimupy.utils.filters

stimupy.utils.masks

stimupy.utils.pad

stimupy.utils.plotting

stimupy.utils.resolution

stimupy.utils.utils

Functions#

adapt_intensity_range

Adapt intensity range of image

adapt_intensity_range_dict

Adapt intensity range of image

adapt_michelson_contrast

Adapt Michelson contrast of image

adapt_michelson_contrast_dict

Adapt Michelson contrast of image in dict

adapt_normalized_rms_contrast

Adapt normalized rms contrast of image (std divided by mean)

adapt_normalized_rms_contrast_dict

Adapt normalized rms contrast of image (std divided by mean)

adapt_rms_contrast

Adapt rms contrast of image (std)

adapt_rms_contrast_dict

Adapt rms contrast of image (std)

add_padding

Remove padding by c

all_img_values

Isolate all image values/pixels, per target region specified in integer mask

apply_bessel

Bessel function of the first kind of real order and complex argument.

array_to_checksum

Hash (md5) array values, and return hex-checksum

array_to_image

Save a 2D numpy array as a grayscale image file.

array_to_mat

Save a numpy array to a mat-file.

array_to_npy

Save a numpy array to npy-file.

array_to_pickle

Save a numpy array to a pickle-file.

arrays_to_checksum

Hash (md5) values of arrays specified in keys, and save only the hex

avg_img_values

Average values of pixels in image, per target region in integer mask

avg_target_values

Average pixel value in each target region of stimulus

bandpass

Function to create a 2d bandpass filter in the frequency domain

compute_ppd

Compute the pixels per degree in a presentation setup i.e., the number of pixels in the central one degree of visual angle

convolve

Convolve two N-dimensional arrays using FFT

create_stimspace_stimuli

flip_dict

Return a dict with key-arrays rotated by nrots*90 degrees.

get_function_argument_names

Get all argument names for a given function

img_values

Isolate only image pixels specified by a binary mask

int_factorize

All integer factors of integer n

length_from_visual_angle_ppd

Calculate length (pixels) from visual angle (degrees) and pixels-per-degree

lengths_from_visual_angles_ppd

Calculate lengths (pixels) from visual angles (degrees) and pixels-per-degree

luminance2munsell

Transform luminance values into Munsell values.

make_two_sided

Create two-sided version of a stimulus function

munsell2luminance

Transform Munsell values to luminance values.

pad_by_shape

Pad image by specified amount(s) of pixels

pad_by_visual_size

Pad image by specified degrees of visual angle

pad_dict_by_shape

Pad images in dictionary by specified amount(s) of pixels Can specify different amount (before, after) each axis.

pad_dict_by_visual_size

Pad images in dictionary by specified degrees of visual angle

pad_dict_to_shape

Pad images in dictionary to a resulting specified shape in pixels

pad_dict_to_visual_size

Pad images in dictionary to specified visual size in degrees visual angle

pad_to_shape

Pad image to a resulting specified shape in pixels

pad_to_visual_size

Pad image to specified visual size in degrees visual angle

permutate_params

plot_comparison

Plots visual comparison of two image-arrays

plot_stim

Plot a stimulus

plot_stimuli

Plot multiple stimuli

ppd_from_length_visual_angle

Calculate pixels-per-degree from length (pixels) and visual angle (degrees)

ppd_from_shape_visual_size

Calculate resolution (ppd) from given shape (pixels) and visual size (degrees)

remove_padding

Remove padding by c

resize_array

Return a copy of an array, resized by the given factor.

resize_dict

Return a copy of an array, resized by the given factor.

resolve

Resolves the full resolution, for 2 givens and 1 unknown

resolve_1D

Resolves the full resolution, for 2 givens and 1 unknown

resolve_dict

Resolves the full resolution ("shape", "ppd", "visual_size"), for 2 givens and 1 unknown in the input dictionary

roll_dict

Return a dict with key-arrays rolled by shift in axes.

rotate_dict

Return a dict with key-arrays rotated by nrots*90 degrees.

round_to_vals

Round array to provided values (vals)

shape_from_visual_size_ppd

Calculate shape (pixels) from given visual size (degrees) and pixels-per-degree

stack_dicts

Return a dict with resized key-arrays by the given factor.

strip_dict

Create a dictionary by stripping it from all keys that are not also an argument to the provided function

to_json

Save stimulus-dict(s) as (pretty) JSON

to_mat

Save stimulus-dict(s) as mat-file

to_pickle

Save stimulus-dict(s) as pickle-file

transparency

Applies a transparency to image at specified (mask) location if provided

valid_1D

Asserts that the combined specification of resolution is geometrically valid.

valid_dict

Asserts that the combined specification of resolution in dict is geometrically valid.

valid_resolution

Asserts that the combined specification of resolution is geometrically valid.

validate_ppd

Put specification of ppd in canonical form, if possible

validate_shape

Put specification of shape (in pixels) in canonical form, if possible

validate_visual_size

Put specification of visual size in canonical form, if possible

visual_angle_from_length_ppd

Calculate visual angle (degrees) from length (pixels) and pixels-per-degree

visual_angles_from_lengths_ppd

Calculate visual sizes (degrees) from given shapes (pixels) and pixels-per-degree

visual_size_from_shape_ppd

Calculate visual size (degrees) from given shape (pixels) and pixels-per-degree