Skip to main content

PANDA (Python Automating Numerical Dot Algorithm)

PANDA Icon

PANDA is a Python library, dedicated to the precise generation and controlled parameterization of multi-element dot arrays for cognitive and psychophysiological tasks and studies.

Main features

  • Control of spatial and size parameters.
  • PsychoPy integration.
  • Automatic scaling and geometric calculations.

Quick start

Installation

You can install the package directly from PyPI:

pip install panda-generator

Basic Usage

The following example demonstrates how to initialize PANDA, generate stimulus images for different conditions, and save the metadata to a CSV file:

import os
from psychopy import core, visual
from panda.generator import PANDA

WINDOW_RES = [700, 700]
OUTPUT_BASE = 'output_path'

CONDITIONS = [('ID', 'TA'), ('ID', 'TP')]
N_COUNTS = {2: 4, 3: 6, 4: 2, 5: 4}

win = visual.Window(
    WINDOW_RES, color='black', units='pix', multiSample=True, numSamples=8
)

gen = PANDA(
    win, n_anchor=3, base_ta=30000, base_cha=120000, color='white', seed=42
)

for spatial_type, size_type in CONDITIONS:
    condition_name = f'{spatial_type}_{size_type}'
    out_dir = os.path.join(OUTPUT_BASE, condition_name)
    os.makedirs(out_dir, exist_ok=True)

    print(f'Generating: {condition_name}')

    for n_val, count in N_COUNTS.items():
        for i in range(1, count + 1):
            img_path = os.path.join(
                out_dir, f'dot_N{n_val:02d}_{i:03d}_{condition_name}.png'
            )
            try:
                gen.generate_and_save(
                    num_elements=n_val,
                    spatial_type=spatial_type,
                    size_type=size_type,
                    output_filepath=img_path,
                    sd_ratio=0.2,
                    save_results=True,
                    pause_time=0
                )
            except Exception as e:
                print(f'Error [N={n_val}, attempt {i}]: {e}')

    gen.save_csv(os.path.join(out_dir, f'results_{condition_name}.csv'))

win.close()
core.quit()

LICENSE

MIT License

Copyright (c) 2026 Yehor Horin, Uniwersytet Warszawski

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Metadata

Release files for panda-generator 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for panda-generator 0.1.2
File Size Uploaded Provenance Actions
panda_generator-0.1.2.tar.gz 21.2 kB Without provenance Details for panda_generator-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for panda-generator 0.1.2
File Interpreter ABI Platform Actions
panda_generator-0.1.2-py3-none-any.whl Python 3 none any Details for panda_generator-0.1.2-py3-none-any.whl

Total release size: 41.9 kB

Release files / panda_generator-0.1.2.tar.gz

Download URL panda_generator-0.1.2.tar.gz
Size 21.2 kB
Tags Source
SHA-256 checksum
How to use checksums
04a5f0880157b3f9513e6931385e3f89d787ca1e3ad9cb4ef2a3fa26c8bc2bca
BLAKE2b-256 checksum
How to use checksums
41577b141803ca8931e4d794b380813c36d2b30302705f1049620973e8593940
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Release files / panda_generator-0.1.2-py3-none-any.whl

Download URL panda_generator-0.1.2-py3-none-any.whl
Size 20.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3b3e83ea6be1ba7414e8b5796dfdd5229855ede76e2f7b674c9de132f88600f4
BLAKE2b-256 checksum
How to use checksums
f62ee5c9e14d9c1e82c50b68a049a96fb31d5d4e18053580f2f3678ff5e8854d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Security for panda-generator 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page