Utils package#

Utils functions#

CFSVM.Utils.cycles_per_pixel2cycles_per_deg(cycles_per_pix, display_width_cm, display_width_pixels, viewing_distance_cm)#

Converts spatial frequency from cycles per pixel unit to cycles per degree unit.

Parameters:
  • cycles_per_pix (float) – Spatial frequency in cycles per pixel.

  • display_width_cm (float) – Display width in centimeters.

  • display_width_pixels (int) – Display width in pixels.

  • viewing_distance_cm (float) – Distance from eyes to center of the stimulus.

Returns:

Spatial frequency in cycles per degree.

Return type:

float

CFSVM.Utils.deg2pix(img_aspect_degree, display_aspect_cm, display_aspect_pixels, viewing_distance_cm)#

Converts image aspect length from degrees of visual angle to pixels.

Parameters:
  • img_aspect_degree (float) – Image aspect length in degrees of visual angle.

  • display_width_cm (float) – Display width in centimeters.

  • display_width_pixels (int) – Display width in pixels.

  • viewing_distance_cm (float) – Distance from eyes to center of the image.

Returns:

Image aspect length in pixels.

Return type:

int

CFSVM.Utils.display_diag2aspects(display_diagonal_inches, display_ratio_width, display_ratio_height)#

Calculated display width and height in centimeters given diagonal in inches and aspect ratio.

Parameters:
  • display_diagonal_inches (float) – Display diagonal in inches.

  • display_ratio_width (int) – Display width aspect, e.g., 16 if ratio is 16:9

  • display_ratio_height (int) – Display height aspect, e.g., 9 if ratio is 16:9

Returns:

array containing:

display_width_cm (float): Display width in centimeters. display_height_cm (float): Display height in centimeters.

Return type:

array

CFSVM.Utils.extract_from_raw_cfs(path_to_raw_trials, subject_code)#

Extracts timings and durations from the raw trial bCFS/VPCFS records.

Saves timings and a histogram of interframe intervals in Extracted folder and durations in Processed folder.

Parameters:
  • path_to_raw_trials (str) – path to the RawTrials folder.

  • subject_code (str) – Subject code for directory to extract the data from.

CFSVM.Utils.extract_from_raw_vm(path_to_raw_trials, subject_code)#

Extracts timings and durations from the raw trial VSM/VTM records.

Saves timings and in Extracted folder and durations in Processed folder.

Parameters:
  • path_to_raw_trials (str) – Path to the RawTrials folder.

  • subject_code (str) – Subject code for directory to extract the data from.

CFSVM.Utils.hex2rgb(hex)#

Transforms hexadecimal color code to MATLAB RGB color code.

Parameters:

hex (str) – Color described by hexadecimal code, e.g., #123ABC

Returns:

Color described by [R,G,B] array, where R,G,B from 0 to 1.

Return type:

array

CFSVM.Utils.pix2deg(img_aspect_pixels, display_aspect_cm, display_aspect_pixels, viewing_distance_cm)#

Converts image aspect length from pixels to degrees of visual angle.

Parameters:
  • img_aspect_pixels (int) – Image aspect length in pixels.

  • display_width_cm (float) – Display width in centimeters.

  • display_width_pixels (int) – Display width in pixels.

  • viewing_distance_cm (float) – Distance from eyes to center of the image.

Returns:

Image aspect length in degrees of visual angle.

Return type:

float