From 007af24b5b64a7540abc3759eaf90473bc0b658f Mon Sep 17 00:00:00 2001 From: Anastasios Gratsakis Date: Tue, 5 May 2026 15:11:19 +0300 Subject: [PATCH 1/2] add: Tones_Panda stimuli --- stimuli/Tones_Panda.py | 47 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 stimuli/Tones_Panda.py diff --git a/stimuli/Tones_Panda.py b/stimuli/Tones_Panda.py new file mode 100644 index 0000000..5449b90 --- /dev/null +++ b/stimuli/Tones_Panda.py @@ -0,0 +1,47 @@ +from ethopy.stimuli.panda import Objects, Panda +import numpy as np + + +class TonesPanda(Panda): + def __init__(self): + super().__init__() + # self.sound_in_operation = False + + """ This class handles the presentation of Objects (Panda) and tone stimuli""" + self.cond_tables = ['Tones','Panda', 'Panda.Object', 'Panda.Environment', 'Panda.Light', 'Panda.Movie'] + self.required_fields = ['tone_duration', 'tone_frequency','obj_id', 'obj_dur', 'tone_pulse_freq', 'tone_volume'] + self.defalut_key = { + 'background_color' : (0, 0, 0), + 'ambient_color' : (0.1, 0.1, 0.1, 1), + 'light_idx' : (1, 2), + 'tone_ulse_freq' : 0, + 'light_volume' : 50, + 'tone_pcolor' : (np.array([0.7, 0.7, 0.7, 1]), np.array([0.2, 0.2, 0.2, 1])), + 'light_dir' : (np.array([0, -20, 0]), np.array([180, -20, 0])), + 'obj_pos_x' : 0, + 'obj_pos_y' : 0, + 'obj_mag' : .5, + 'obj_rot' : 0, + 'obj_tilt' : 0, + 'obj_yaw' : 0, + 'obj_delay' : 0, + 'obj_occluder' : 0, + 'perspective' : 0 + } + + + def start(self): + tone_frequency = self.curr_cond['tone_frequency'] + tone_volume = self.curr_cond['tone_volume'] + tone_pulse_freq = self.curr_cond['tone_pulse_freq'] + if 0 < self.curr_cond['tone_pulse_freq'] < 10: + raise ValueError('Tone pulse frequency cannot be between zero and 10Hz (not including)') + self.exp.interface.give_sound(tone_frequency, tone_volume, tone_pulse_freq) + super().start() + + def stop(self): + self.log_stop() + self.in_operation = False + self.exp.interface.stop_sound() + super().stop() + From 422a6222ebfae596e4fc538efe3fb83a871d8730 Mon Sep 17 00:00:00 2001 From: Anastasios Gratsakis <143262163+GratsakisA@users.noreply.github.com> Date: Tue, 5 May 2026 16:42:42 +0300 Subject: [PATCH 2/2] Rename Tones_Panda.py to tones_panda.py --- stimuli/{Tones_Panda.py => tones_panda.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename stimuli/{Tones_Panda.py => tones_panda.py} (100%) diff --git a/stimuli/Tones_Panda.py b/stimuli/tones_panda.py similarity index 100% rename from stimuli/Tones_Panda.py rename to stimuli/tones_panda.py