Python library for generating sequences with uniform stimulus history

Overview

Sampling Euler tours for uniform stimulus history

Table of Contents

About

This is a Python library that implements the methods described in the article Controlling precedence in sequential stimulus presentation with Euler tours. It contains two files:

  1. euler.py: contains all functionality for generating sequences of stimuli. Add this file to your working directory and import it using import euler to use the library.
  2. sequence.py: contains examples of generating sequences of stimuli for various experimental parameters. Run it by calling python sequence.py on the command line.

Examples

The file sequence.py contains a number of examples on how to use the library to generate sequences for various experimental parameters. These example experiment setups and corresponding generated sequences are included below.

Experiment 1

Generate sequence for four stimuli with each pair occurring once, including repeated stimuli. These are the default settings, so no need to specify any parameters for this experiment.

Input:

experiment = euler.Euler()
print(experiment.get_sequence())

Output:

['3', '0', '0', '1', '2', '1', '3', '1', '1', '0', '2', '3', '3', '2', '2', '0', '3']

Experiment 2

Generate sequence for 3 stimuli without same-stimulus pairs, and with catch trials occurring on average every 1/4 stims. Force the sequence to start at stimulus 0.

Input:

experiment = euler.Euler(stimuli=3, catch_frequency=0.25, stim_repeat=False)
print(experiment.get_sequence(0))

Output:

['0', '2', '1', '0', 'C', '0', '1', 'C', '1', '2', 'C', '2', '0']

Experiment 3

Generate sequence with equal catch trial precedence, and each pair of stimuli twice.

Input:

experiment = euler.Euler(catch_to_all=True, pair_repeats=2)
print(experiment.get_sequence())

Output:

['1', '2', '0', '0', '1', '3', '3', 'C', '0', '1', '1', '2', '3', '3', 'C', '2', 'C', '1', '0', '2', '0', 'C', '0', 'C', '3', '1', 'C', '1', '0', '0', '3', '0', '2', '2', '3', '2', '2', '1', '1', 'C', '2', '1', '3', '2', 'C', '3', '0', '3', '1']

Experiment 4

Generate sequence by stitching two sequences for five stimuli together. Repeating sequences (exp. 4) is different from repeating pairs (exp. 3): it guarantees that all pairs have occurred exactly once in the first half.

Input:

experiment = euler.Euler(stimuli=5, seq_repeats=2)
print(experiment.get_sequence())

Output:

['2', '1', '0', '3', '3', '0', '2', '2', '0', '1', '2', '4', '3', '4', '4', '2', '3', '1', '4', '0', '0', '4', '1', '1', '3', '2', '2', '4', '4', '1', '3', '3', '1', '1', '4', '0', '3', '4', '3', '2', '3', '0', '0', '4', '2', '1', '0', '1', '2', '0', '2']

Experiment 5

Generate sequence for four stimuli with each triplet occurring once.

Input:

experiment = euler.Euler(triplets=True, stim_repeat=False)
print(experiment.get_sequence())

Output:

['0', '1', '2', '3', '0', '2', '3', '2', '0', '2', '0', '1', '3', '2', '1', '3', '0', '3', '2', '3', '1', '3', '1', '0', '3', '1', '2', '1', '2', '0', '3', '0', '1', '0', '2', '1', '0', '1']

Contact

Jacob Bakermans - jacob.bakermans [at] gmail.com

Project Link: https://github.com/jbakermans/stimulus-history-euler-tours

You might also like...
Intelligent Trading Bot: Automatically generating signals and trading based on machine learning and feature engineering

Intelligent Trading Bot: Automatically generating signals and trading based on machine learning and feature engineering

Telegram Bot for generating and decoding QR-codes

Telegram openqrgen_bot Telegram Bot that generates from user's messages and decodes QR-codes from photos. Also contains rickroll detection :) Just typ

A pypi package that helps in generating discord bots.

A pypi package that helps in generating discord bots.

A pypi package that helps in generating discord bots.

A pypi package that helps in generating discord bots.

A telegram bot script for generating session string using pyrogram and telethon on Telegram bot

String-session-Bot Telegram Bot to generate Pyrogram and Telethon String Session. A star ⭐ from you means a lot to us! Usage Deploy to Heroku Tap on a

🐍 Mnemonic code for generating deterministic keys, BIP39
🐍 Mnemonic code for generating deterministic keys, BIP39

python-mnemonic 🐍 Mnemonic code for generating deterministic keys, BIP39 Installation To install this library and its dependencies use: pip install m

Aio-binance-library - Async library for connecting to the Binance API on Python

aio-binance-library Async library for connecting to the Binance API on Python Th

alpaca-trade-api-python is a python library for the Alpaca Commission Free Trading API.

alpaca-trade-api-python is a python library for the Alpaca Commission Free Trading API. It allows rapid trading algo development easily, with support for both REST and streaming data interfaces

🐍 The official Python client library for Google's discovery based APIs.

Google API Client This is the Python client library for Google's discovery based APIs. To get started, please see the docs folder. These client librar

Comments
  • stim_repeat does not seem to work as intended

    stim_repeat does not seem to work as intended

    Hi, let me first thank you for creating and sharing these functions, they are super helpful! :)

    I have been using this package in R via the reticulate package (which allows using Python packages in RStudio) and I am a bit puzzled by the stim_repeat argument.

    My understanding of that argument is that it should prevent successive repetitions of the same "stimulus". For instance, executing Euler(stimuli = 4, stim_repeat = "False") should not produce sequences such as 1 2 4 2 3 4 4 1 4 3 3 2 2 1 3 1 1, which is the sequence I have just obtained... but maybe I have misunderstood the intended role of this argument?

    Here is a reproducible example (in R, sorry) below, assuming the euler.py script is in the current repository.

    library(reticulate)
    set.seed(666)
    source_python("euler.py")
    experiment <- Euler(stimuli = 4, stim_repeat = "False", pair_repeats = 1)
    as.numeric(experiment$get_sequence() )
    
     [1] 0 0 1 2 2 0 2 3 3 2 1 1 0 3 1 3 0
    
    opened by lnalborczyk 3
Owner
null
A tool for exporting Telegram group chats into static websites, preserving chat history like mailing list archives.

tg-archive is a tool for exporting Telegram group chats into static websites, preserving chat history like mailing list archives. Preview The @fossuni

Kailash Nadh 400 Dec 27, 2022
Quickly and efficiently delete your entire tweet history with the help of your Twitter archive without worrying about the pointless 3200 tweet limit imposed by Twitter.

Twitter Nuke Quickly and efficiently delete your entire tweet history with the help of your Twitter archive without worrying about the puny and pointl

Mayur Bhoi 73 Dec 12, 2022
Shred your reddit comment and post history

trasheddit Shred your reddit comment and post history (x89/Shreddit replacement) Usage Simple Example Download trasheddit: git clone https://github.co

Elly 2 Jan 5, 2022
Search all history of Chrome in terminal

Chrotry Search all history of Chrome in terminal. Demo Usages Move the Chrome history file to current directory by running move_history.sh Rename hist

Xiaoxu HU 2 Jun 13, 2022
Generate and Visualize Data Lineage from query history

Tokern Lineage Engine Tokern Lineage Engine is fast and easy to use application to collect, visualize and analyze column-level data lineage in databas

Tokern 237 Dec 29, 2022
A Python module for communicating with the Twilio API and generating TwiML.

twilio-python The default branch name for this repository has been changed to main as of 07/27/2020. Documentation The documentation for the Twilio AP

Twilio 1.6k Jan 5, 2023
A Python module for communicating with the Twilio API and generating TwiML.

twilio-python The default branch name for this repository has been changed to main as of 07/27/2020. Documentation The documentation for the Twilio AP

Twilio 1.6k Jan 5, 2023
:electric_plug: Generating short urls with python has never been easier

pyshorteners A simple URL shortening API wrapper Python library. Installing pip install pyshorteners Documentation https://pyshorteners.readthedocs.i

Ellison 351 Jan 3, 2023
Simple Telegram Bot for generating BalckPearl BBCode Templates

blackpearl-bbcode-bot Simple Telegram Bot for generating BlackPearl BBCode Templates Written in Pyrogram Features - ?? IMDB Info fetching from files -

D. Luffy 5 Oct 19, 2022