Ejemplo n.º 1
0
        sph.stop_sound()
    elif data == 1:
        sph.play_tone()
    elif data == 3:
        sph.start_camera_recording()


# =============================================================================
# CONNECT TO BPOD
# =============================================================================
bpod = Bpod()
# Soft code handler function can run arbitrary code from within state machine
bpod.softcode_handler_function = softcode_handler
# TODO: Put inside SPH remove @property or organize sequence of var definition
# Bpod message creator
msg = BpodMessageCreator(bpod)
bonsai_hide_stim = msg.bonsai_hide_stim()
bonsai_show_stim = msg.bonsai_show_stim()
sc_play_tone = msg.sound_card_play_idx(sph.GO_TONE_IDX)
sph.GO_TONE_SM_TRIGGER = sc_play_tone
bpod = msg.return_bpod()

# =============================================================================
# TRIAL PARAMETERS AND STATE MACHINE
# =============================================================================
global tph
tph = TrialParamHandler(sph)

bad_stim_count = 0
bad_tone_count = 0
Ejemplo n.º 2
0
PARAMS = params.load_params_file()
# start sph
sph = SessionParamHandler(task_settings, user_settings)
# frame2TTL seg thresholds
if frame2TTL.get_and_set_thresholds() == 0:
    sph.F2TTL_GET_AND_SET_THRESHOLDS = True
# Rotary encoder
re = MyRotaryEncoder(sph.ALL_THRESHOLDS, sph.STIM_GAIN,
                     sph.PARAMS["COM_ROTARY_ENCODER"])
sph.ROTARY_ENCODER = re

# get bpod
bpod = Bpod()
# Build messages
msg = BpodMessageCreator(bpod)
sc_play_tone = msg.sound_card_play_idx(sph.GO_TONE_IDX)
sc_play_noise = msg.sound_card_play_idx(sph.WHITE_NOISE_IDX)
bpod = msg.return_bpod()

# get soundcard
card = usb.core.find(idVendor=0x04D8, idProduct=0xEE6A)
card_play_tone = bytes(np.array([2, 6, 32, 255, 2, 2, 0, 43], dtype=np.int8))
card_play_noise = bytes(np.array([2, 6, 32, 255, 2, 3, 0, 44], dtype=np.int8))


def do_gabor(osc_client, pcs_idx, pos, cont, phase):
    # send pcs to Bonsai
    bonsai.send_stim_info(
        osc_client,
        pcs_idx,
Ejemplo n.º 3
0
    elif data == 3:
        sph.start_camera_recording()
    # sph.OSC_CLIENT.send_message("/e", data)


# =============================================================================
# CONNECT TO BPOD
# =============================================================================
bpod = Bpod()

# Loop handler function is used to flush events for the online plotting
bpod.loop_handler = bpod_loop_handler
# Soft code handler function can run arbitrary code from within state machine
bpod.softcode_handler_function = softcode_handler
# Bpod message creator
msg = BpodMessageCreator(bpod)
re_reset = msg.rotary_encoder_reset()
bonsai_hide_stim = msg.bonsai_hide_stim()
bonsai_show_stim = msg.bonsai_show_stim()
bonsai_close_loop = msg.bonsai_close_loop()
bonsai_freeze_stim = msg.bonsai_freeze_stim()
sc_play_tone = msg.sound_card_play_idx(sph.GO_TONE_IDX)
sc_play_noise = msg.sound_card_play_idx(sph.WHITE_NOISE_IDX)
bpod = msg.return_bpod()
# =============================================================================
# TRIAL PARAMETERS AND STATE MACHINE
# =============================================================================
global tph
tph = TrialParamHandler(sph)

f, axes = op.make_fig(sph)
Ejemplo n.º 4
0
    if data == 0:
        sph.stop_sound()
    elif data == 1:
        sph.play_tone()
    elif data == 3:
        sph.start_camera_recording()


# =============================================================================
# CONNECT TO BPOD
# =============================================================================
bpod = Bpod()
# Soft code handler function can run arbitrary code from within state machine
bpod.softcode_handler_function = softcode_handler
# Create messages
msg = BpodMessageCreator(bpod)
rotary_encoder_reset = msg.rotary_encoder_reset()
bonsai_hide_stim = msg.bonsai_hide_stim()
bonsai_show_stim = msg.bonsai_show_stim()
bonsai_show_center = msg.bonsai_show_center()
sc_play_tone = msg.sound_card_play_idx(sph.GO_TONE_IDX)
bpod = msg.return_bpod()

# =============================================================================
# TRIAL PARAMETERS AND STATE MACHINE
# =============================================================================
global tph
tph = TrialParamHandler(sph)
# =====================================================================
# RUN VISUAL STIM
# =====================================================================