<commit_before>"""
===========================
Run a very basic experiment
===========================

This example demonstrates an (almost) minimum working example of the
ExperimentController class.
"""
# Author: <NAME> <<EMAIL>>
#
# License: BSD (3-clause)

print(__doc__)

import numpy as np

from expyfun import ExperimentController, analyze
from expyfun.visual import FixationDot


# set configuration
fs = 24414.  # default for ExperimentController
dur = 1.0
tone = np.sin(2 * np.pi * 1000 * np.arange(int(fs * dur)) / float(fs))
tone *= 0.01 * np.sqrt(2)  # Set RMS to 0.01

with ExperimentController('testExp', participant='foo', session='001',
                          output_dir=None) as ec:
    ec.screen_prompt('Press a button to hear the tone')

    dot = FixationDot(ec)
    ec.clear_buffer()
    ec.load_buffer(tone)
    dot.draw()
    screenshot = ec.screenshot()  # only because we want to show it in the docs

    ec.identify_trial(ec_id='tone', ttl_id=[0, 0])
    ec.start_stimulus()
    presses = ec.wait_for_presses(dur)
    ec.stop()
    ec.trial_ok()
    print('Presses:\n%s' % presses)

<commit_msg>change %s to .format(), change instructions<commit_after>"""
===========================
Run a very basic experiment
===========================

This example demonstrates an (almost) minimum working example of the
ExperimentController class.
"""
# Author: <NAME> <<EMAIL>>
#
# License: BSD (3-clause)

print(__doc__)

import numpy as np

from expyfun import ExperimentController, analyze
from expyfun.visual import FixationDot


# set configuration
fs = 24414.  # default for ExperimentController
dur = 1.0
tone = np.sin(2 * np.pi * 1000 * np.arange(int(fs * dur)) / float(fs))
tone *= 0.01 * np.sqrt(2)  # Set RMS to 0.01

with ExperimentController('testExp', participant='foo', session='001',
                          output_dir=None) as ec:
    ec.screen_prompt('Press a button when you hear the tone', max_wait=1)

    dot = FixationDot(ec)
    ec.clear_buffer()
    ec.load_buffer(tone)
    dot.draw()
    screenshot = ec.screenshot()  # only because we want to show it in the docs

    ec.identify_trial(ec_id='tone', ttl_id=[0, 0])
    ec.start_stimulus()
    presses = ec.wait_for_presses(dur)
    ec.stop()
    ec.trial_ok()
    print('Presses:\n{}'.format(presses))


{'fraction_non_alphanumeric': 0.16493055555555555, 'fraction_numerical': 0.022135416666666668, 'mean_word_length': 3.8020833333333335, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1978031', 'n_tokens_mistral': 810, 'n_tokens_neox': 731, 'n_words': 210}