Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions stimuli/openfield_panda.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,10 @@ def init(self, exp):
self.object_files, self.is_recording = dict(), False

cls = self.__class__
if "ShowBase" not in cls.__name__:
self.__class__ = cls.__class__(
cls.__name__ + "ShowBase", (cls, ShowBase), {}
)
if not getattr(cls, "_showbase_mixed", False):
new_cls = cls.__class__(cls.__name__, (cls, ShowBase), {})
new_cls._showbase_mixed = True
self.__class__ = new_cls
if self.logger.is_pi:
self.fStartDirect = True
self.windowType = None
Expand Down Expand Up @@ -168,9 +168,6 @@ def init(self, exp):
self.fill_colors.background_color = (0, 0, 0)
self.sm = SharedMemory("pose")

def name(self):
return "Panda"

def setup(self):
ShowBase.__init__(
self, fStartDirect=self.fStartDirect, windowType=self.windowType
Expand Down
14 changes: 7 additions & 7 deletions stimuli/panda.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,14 @@ def init(self, exp):
super().init(exp)
self.object_files, self.is_recording = dict(), False

# Lazily mix ShowBase into this instance's class so the Panda3D window
# only opens when the stimulus runs. Flag-guarded with _showbase_mixed
# to avoid re-wrapping on repeated init() calls.
cls = self.__class__
if "ShowBase" not in cls.__name__:
self.__class__ = cls.__class__(
cls.__name__ + "ShowBase", (cls, ShowBase), {}
)
if not getattr(cls, "_showbase_mixed", False):
new_cls = cls.__class__(cls.__name__, (cls, ShowBase), {})
new_cls._showbase_mixed = True
self.__class__ = new_cls
if self.logger.is_pi:
self.fStartDirect = True
self.windowType = None
Expand All @@ -181,9 +184,6 @@ def init(self, exp):

self.fill_colors.background_color = (0, 0, 0)

def name(self):
return "Panda"

def setup(self):
ShowBase.__init__(
self, fStartDirect=self.fStartDirect, windowType=self.windowType
Expand Down
12 changes: 4 additions & 8 deletions stimuli/tones_panda.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,15 @@ 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']
self.cond_tables = ['Tones', 'Panda', 'Panda.Object', 'Panda.Environment', 'Panda.Light', 'Panda.Movie']
self.required_fields = ['tone_duration', 'tone_frequency', 'obj_id', 'obj_dur']
self.default_key = {
'background_color' : (0, 0, 0),
'ambient_color' : (0.1, 0.1, 0.1, 1),
'light_idx' : (1, 2),
'tone_pulse_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])),
'tone_volume' : 50,
'light_color' : (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,
Expand All @@ -31,7 +28,6 @@ def __init__(self):
'perspective' : 0
}


def start(self):
tone_frequency = self.curr_cond['tone_frequency']
tone_volume = self.curr_cond['tone_volume']
Expand Down
Loading