Skip to main content

Generate customizable fixation targets for vision science experiments

Project description

Visual Fixation Target

A Python package to generate customizable fixation targets for eye trcking experiments.

Description

This package generates fixation target configurations as described by Thaler et al. (2013). It supports different target types:

  • A: Center dot only
  • B: Outer circle only
  • C: Cross only
  • AB, AC, BC: Combinations of two components
  • ABC: All components (center dot + outer circle + cross)

All dimensions are specified in visual angles (degrees) and automatically converted to pixels based on your screen parameters.

Target Type Examples

A
(Center dot)
B
(Outer circle)
C
(Cross)
AB
(Center + Outer)
AC
(Center + Cross)
BC
(Outer + Cross)
ABC
(All components)

Installation

From PyPI

pip install fixation-target

From source

git clone https://github.com/mh-salari/fixation-target.git
cd fixation-target
pip install -e .

Usage

Command-line Interface

Using a JSON configuration file

Create a JSON config file with your parameters:

{
  "screen_width_mm": 476.64,
  "screen_height_mm": 268.11,
  "screen_width_px": 1920,
  "screen_height_px": 1080,
  "viewing_distance_mm": 930,
  "target_type": "ABC",
  "center_diameter_in_degrees": 0.1,
  "outer_diameter_in_degrees": 0.6,
  "cross_width_in_degrees": 0.15,
  "center_color": [0, 0, 0, 255],
  "outer_color": [0, 0, 0, 255],
  "cross_color": [255, 255, 255, 255],
  "background_diameter_in_degrees": 1.0,
  "background_color": [128, 128, 128, 255]
}

Load and use it:

fixation-target --json config.json --output output/

Using command-line arguments

fixation-target \
  --output output/ \
  --target-type ABC \
  --screen-width-mm 476.64 \
  --screen-height-mm 268.11 \
  --screen-width-px 1920 \
  --screen-height-px 1080 \
  --viewing-distance-mm 930 \
  --center-diameter 0.1 \
  --outer-diameter 0.6 \
  --cross-width 0.15 \

Python API

from pathlib import Path
from fixation_target import fixation_target

# Generate an ABC target
fixation_target(
    screen_width_mm=476.64,
    screen_height_mm=268.11,
    screen_width_px=1920,
    screen_height_px=1080,
    viewing_distance_mm=930,
    save_path=Path("output"),
    target_type="ABC",
    center_diameter_in_degrees=0.1,
    outer_diameter_in_degrees=0.6,
    cross_width_in_degrees=0.15,
    center_color=(0, 0, 0, 255),      # black
    outer_color=(0, 0, 0, 255),       # black
    cross_color=(255, 255, 255, 255), # white
    background_diameter_in_degrees=1.0,
    background_color=(128, 128, 128, 255),  # gray
    show=True
)

Target Types

  • A: Center dot only - useful for minimal fixation point
  • B: Outer circle only - provides a reference boundary
  • C: Cross only - traditional fixation cross
  • AB: Center dot + outer circle
  • AC: Center dot + cross
  • BC: Outer circle + cross
  • ABC: All components (recommended for stable fixation)

Parameters

Required Screen Parameters

  • screen_width_mm: Physical width of your screen in millimeters
  • screen_height_mm: Physical height of your screen in millimeters
  • screen_width_px: Screen resolution width in pixels
  • screen_height_px: Screen resolution height in pixels
  • viewing_distance_mm: Distance from viewer to screen in millimeters

Target Parameters

  • target_type: One of "A", "B", "C", "AB", "AC", "BC", "ABC" (default: "ABC")
  • center_diameter_in_degrees: Diameter of center dot in visual degrees (default: 0.1)
  • outer_diameter_in_degrees: Diameter of outer circle in visual degrees (default: 0.6)
  • cross_width_in_degrees: Width of cross lines in visual degrees (default: 0.15)
  • center_color: RGBA color tuple for center dot (default: black)
  • outer_color: RGBA color tuple for outer circle (default: black)
  • cross_color: RGBA color tuple for cross (default: white)
  • background_diameter_in_degrees: Optional background circle diameter
  • background_color: Optional background circle color (RGBA tuple)
  • show: Whether to display the generated image (default: True)

Reference

Thaler, L., Schütz, A.C., Goodale, M.A., & Gegenfurtner, K.R. (2013). What is the best fixation target? The effect of target shape on stability of fixational eye movements. Vision Research, 76, 31-42. https://doi.org/10.1016/j.visres.2012.10.012

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

This project has received funding from the European Union's Horizon Europe research and innovation funding program under grant agreement No 101072410, Eyes4ICU project.

Funded by EU Eyes4ICU

Author

Mohammadhossein Salari Email: mohammadhossein.salari@gmail.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fixation_target-1.0.3.tar.gz (453.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fixation_target-1.0.3-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file fixation_target-1.0.3.tar.gz.

File metadata

  • Download URL: fixation_target-1.0.3.tar.gz
  • Upload date:
  • Size: 453.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for fixation_target-1.0.3.tar.gz
Algorithm Hash digest
SHA256 7adccb05fedddd0f9eadec7eaa4afdedba3078e17a45bddf29713226b33ec7a5
MD5 26bec32c763d43edc47a0928fde51540
BLAKE2b-256 c1237d9383e031b91090db700aac3a3ca47a9e6758d754ee126e711bb47d0f1b

See more details on using hashes here.

File details

Details for the file fixation_target-1.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for fixation_target-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ad8134c50a53ab3812d707a3640de57f00850b760b6bf742eef5150730a7ad45
MD5 8b00dacb0dba725695f0d7ba745eca57
BLAKE2b-256 4f25988cc5e4026fe1731ba40381de57386c3e79c4b4db82ae207ea8b501fba9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page