iCon Inputs
When an iCon is attached to the Pynapse Behavioral Controller in the General Tab, an additional iCon tab appears. This gives you a unified interface that lets you configure the iCon inputs/outputs directly within Pynapse and integrates them in the Python code editor.
iCon Tab
Configure the iCon inputs/outputs in the iCon tab. See Logic Input Processor in the Synapse Manual for information on setting up the iCon inputs and pre-processing them so Pynapse can capture event changes.
iCon Tab |
Run-time Interface
The run-time interface has a button for each input and an LED indicator that shows the current state of the input. For the iMn modules, additional options that are available during design-time can also be modified during run-time.
iCon Run-time Interface |
Click on the input name to manually trigger it. Hold down CTRL and click an input name to 'mute' it. This prevents the input from triggering Pynapse events.
Slot Methods for Responding to Input States
These input slots capture status information about the inputs. They are available as method definitions inside Pynapse states for each input. Write a method with this name to react to the corresponding event.
Note
The name of each slot method ('Input1' above) gets replaced with the name of your actual input, so if you name the input 'NosePoke' then s_NosePoke_rise() is an available slot.
Example
Move through behavioral states based on status of MyInput
class PreTrial:
def s_MyInput_rise():
p_State.switch(StartTrial)
class StartTrial: # StateID = ?
def s_MyInput_active():
p_State.switch(ActiveState)
def s_MyInput_fall():
p_State.switch(PreTrial)
class ActiveState: # StateID = ?
def s_MyInput_pass():
p_State.switch(PassState)
def s_MyInput_fail():
p_State.switch(FailState)
Methods
All input methods have the form p_Rig.{INPUT_NAME}.{METHOD}
. Type p_
in the
Pynapse Code Editor and let the code completion do the work for you. The name of each
method gets replaced with the name of your actual output, so if you name the input
'NosePoke' then p_Rig.NosePoke.isOn()
is an available method.
Duration Settings
setActTime
p_Rig.MyInput.setActTime(acttime_sec)
Override the duration test 'Time to Active' setting. This is only available if 'Duration Testing' is enabled on the input.
Example
Modify the timing test based on performance.
def s_State_enter():
# if more than 5 successful trials, increase the time to active by 50 ms.
if p_Metric.success.read() > 5:
p_Metric.active_time.inc(delta=0.05)
p_Rig.MyInput.setActTime(p_Metric.active_time.read())
setPassTime
p_Rig.MyInput.setPassTime(passtime_sec)
Override the duration test 'Time to Pass' setting. This is only available if 'Duration Testing' is enabled on the input.
Example
Modify the timing test based on performance.
def s_State_enter():
# if more than 5 successful trials, increase the time to pass by 50 ms.
if p_Metric.success.read() > 5:
p_Metric.pass_time.inc(delta=0.05)
p_Rig.MyInput.setPassTime(p_Metric.pass_time.read())
setRateThresh
p_Rig.MyInput.setRateThresh(ratethr_hz)
Override the rate testing 'Rate Threshold' setting. This is only available if 'Rate Testing' is enabled on the input.
Example
Modify the rate threshold based on performance.
def s_State_enter():
# if more than 5 successful trials, increase the rate threshold by 1 Hz.
if p_Metric.success.read() > 5:
p_Metric.rate_thresh.inc()
p_Rig.MyInput.setRateThresh(p_Metric.rate_thresh.read())
Manual Control
Manual turn inputs on, off, or pulse during runtime. Useful for debugging.
manualOn
p_Rig.MyInput.manualPulse()
Manually turn on the input.
Example
Turn on the input when entering a state.
def s_State_enter():
p_Rig.MyInput.manualOn()
manualOff
p_Rig.MyInput.manualPulse()
Manually turn off the input.
Example
Turn off the input when exiting a state.
def s_State_exit():
p_Rig.MyInput.manualOff()
manualPulse
p_Rig.MyInput.manualPulse()
Manually pulse the input.
Example
Pulse the input when entering a state.
def s_State_enter():
p_Rig.MyInput.manualPulse()
setMute
p_Rig.MyInput.setMute(muted)
Mute the input so it can't trigger, or unmute it.
Status
Get information on the current state of the input.
isOn
p_Rig.MyInput.isOn()
Returns true if the input is currently true.
Example
When entering a state, check if an input is already true.
def s_state_enter():
if p_Rig.MyInput.isOn():
print('MyInput is on')
else:
print('MyInput is off')
isOff
p_Rig.MyInput.isOff()
Returns true if the input is currently false.
Example
When entering a state, check the status of the input.
def s_state_enter():
if p_Rig.MyInput.isOff():
print('MyInput is off')
else:
print('MyInput is on')
getStatusBits
p_Rig.MyInput.getStatusBits()
Read the current state of an input as a bitwise integer value. Bit order is:
Fail | Pass | Active | Fall | Rise | True
Used by the Pynapse polling loop.
iMn Input Settings
The iMn modules have analog inputs that are converted to logic signals. These functions override the analog-to-logic conversion settings at runtime. See iMn Input Processor for more information.
setProcLowPass
p_Rig.MyInput.setProcLowPass(hz)
Set the Lowpass Frequency, in Hertz. This is only available if Processing mode is Complex and 'Frequency Range' is not 'Unlimited'.
setProcHighPass
p_Rig.MyInput.setProcHighPass(hz)
Set the Highpass Frequency, in Hertz. This is only available if Processing mode is Complex and 'Frequency Range' is not 'Unlimited'.
setProcGain
p_Rig.MyInput.setProcGain(v)
Set the input gain on the signal, in dB. This is only available if Processing mode is Simple or Complex. See iMn Input Processor for more information.
setProcThresh
p_Rig.MyInput.setProcThresh(v)
Set the input gain on the signal, in dB. This is only available if Processing mode is Simple or Complex. See iMn Input Processor for more information.
setProcHistReduce
p_Rig.MyInput.setProcHistReduce(v)
Set the input gain on the signal, in dB. This is only available if Processing mode is Simple or Complex. See iMn Input Processor for more information.
setProcSmooth
p_Rig.MyInput.setProcSmooth(ms)
Change the smoothing filter applied to the input signal before it goes through the logic conversion. This is only available if Processing mode is Complex. See iMn Input Processor for more information.