validate_visual_size

validate_visual_size#

stimupy.utils.validate_visual_size(visual_size)#

Put specification of visual size in canonical form, if possible

Parameters:

visual_size (Sequence of length 1 or 2; or None) – if 2 elements: interpret as (height, width) if 1 element: use as both height and width if None: return (None, None) each element has to be of type that can be cast to float, or None.

Returns:

.height: float, height in degrees visual angle .width: float, width in degrees visual angle

Return type:

Visual_size NamedTuple, with two attributes

Raises:
  • ValueError – if input does not have at least 1 element

  • TypeError – if input is not a Sequence(float, float) and cannot be cast to one

  • ValueError – if input has more than 2 elements