Beispiel #1
0
import time
import sys, os
import datetime
import zmq
import json

#sys.path.append('C:\\Users\\mikofskyrm\\PycharmProjects\\PulsePalProject\\PulsePal\\PulsePal-master\\Python\\PulsePal')
sys.path.append(
    'C:\\Users\\GordonLabINS\\Documents\\PulsePal\\PulsePal-master\\Python')
from PulsePal import PulsePalObject  # Import PulsePalObject

myPulsePal = PulsePalObject()  # Create a new instance of a PulsePal object
myPulsePal.connect(
    serialPortName='COM10'
)  # Connect to PulsePal on port COM# (open port, handshake and receive firmware version)
print(myPulsePal.firmwareVersion)  # Print firmware version to the console

# Set these:
StimDuration = 1 * 30
aquisitionFreq = 20

if aquisitionFreq == 40:
    PhotoUpTime = 0.017
    PhotoDownTime = 0.008

elif aquisitionFreq == 20:
    PhotoUpTime = 0.035
    PhotoDownTime = 0.015

myPulsePal.programOutputChannelParam('isBiphasic', 1, 0)
myPulsePal.programOutputChannelParam('phase1Voltage', 1, 5)
Beispiel #2
0
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3.

This program is distributed  WITHOUT ANY WARRANTY and without even the 
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
'''

# Exmaple usage of PulsePal's Python API fields and functions

# Initializing PulsePal
from PulsePal import PulsePalObject # Import PulsePalObject
myPulsePal = PulsePalObject() # Create a new instance of a PulsePal object
myPulsePal.connect('COM4') # Connect to PulsePal on port COM4 (open port, handshake and receive firmware version)
print(myPulsePal.firmwareVersion) # Print firmware version to the console

# Examples of programming individual output channel parameters
myPulsePal.programOutputChannelParam('isBiphasic', 1, 1) # Program output channel 1 to use biphasic pulses
myPulsePal.programOutputChannelParam('phase1Voltage', 1, 10) # Program channel 1 to use 10V for phase 1 of its biphasic pulses
myPulsePal.programOutputChannelParam(3, 1, -10) # Parameters can be specified by their parameter code instead of their name
myPulsePal.programOutputChannelParam('phase1Duration', 1, 0.001) # Example for a 32-bit time parameter

# Programming a trigger channel parameter
myPulsePal.programTriggerChannelParam('triggerMode', 1, 2) # Set trigger channel 1 to pulse gated mode
myPulsePal.programTriggerChannelParam('triggerMode', 2, 0) # Set trigger channel 2 to normal mode

# Programming *all* parameters to match the myPulsePal object's fields
myPulsePal.isBiphasic[1] = 0 # parameter arrays are 5 elements long. Use [1] for output channel 1. (i.e. isBiphasic[0] is not used)
Beispiel #3
0
Written by Jordan Sorokin, 4/6/2017
"""

# imports
import thread, time
from PulsePal import PulsePalObject  # import PulsePalObject


# function for checking keypress
def input_thread(key):
    raw_input()
    key.append(None)


# Initializing PulsePal
pp = PulsePalObject()  # Create a new instance of a PulsePal object
pp.connect('COM3')  # <-- check this for MAC
pp.setDisplay('Connected to:', 'Python')
print('Connected to PulsePal, version ' + str(pp.firmwareVersion))
time.sleep(2)

# set up the pulse train for ch. 1
pulseFreq = float(input('pulse frequency (Hz): '))
#pulseWidth = 1 / pulseFreq / 2; # here we set the pulse width and inter-pulse width equal to one another
pulseWidth = float(input('pulse width (s): '))
interPulseWidth = 1.0 / pulseFreq - pulseWidth
pulseOn = [0.0, 1 / pulseFreq]
pulseVoltages = [5, 5]

# create the custom pulse train and set to Channel 1 of the PulsePal
pp.interPulseInterval[1] = interPulseWidth
Beispiel #4
0
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3.

This program is distributed  WITHOUT ANY WARRANTY and without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
'''

# Exmaple usage of PulsePal's Python API fields and functions

# Initializing PulsePal
from PulsePal import PulsePalObject  # Import PulsePalObject
myPulsePal = PulsePalObject()  # Create a new instance of a PulsePal object
myPulsePal.connect(
    'COM3'
)  # Connect to PulsePal on port COM3 (open port, handshake and receive firmware version)
print(myPulsePal.firmwareVersion)  # Print firmware version to the console

# Examples of programming individual output channel parameters
myPulsePal.programOutputChannelParam(
    'isBiphasic', 1, 1)  # Program output channel 1 to use biphasic pulses
myPulsePal.programOutputChannelParam(
    'phase1Voltage', 1,
    10)  # Program channel 1 to use 10V for phase 1 of its biphasic pulses
myPulsePal.programOutputChannelParam(
    3, 1, -10
)  # Parameters can be specified by their parameter code instead of their name
myPulsePal.programOutputChannelParam(
Beispiel #5
0
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3.

This program is distributed  WITHOUT ANY WARRANTY and without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
'''

# Exmaple usage of PulsePal's Python API fields and functions

# Initializing PulsePal
from PulsePal import PulsePalObject  # Import PulsePalObject
myPulsePal = PulsePalObject()  # Create a new instance of a PulsePal object
myPulsePal.connect(
    'COM4'
)  # Connect to PulsePal on port COM3 (open port, handshake and receive firmware version)

# Examples of programming individual output channel parameters
myPulsePal.programOutputChannelParam(
    'isBiphasic', 1, 0)  # Program output channel 1 not to use biphasic pulses
myPulsePal.programOutputChannelParam(
    'phase1Voltage', 1,
    2)  # Program channel 1 to use 10V for phase 1 of its biphasic pulses
myPulsePal.programOutputChannelParam(
    'phase1Duration', 1, 0.01)  # Example for a 32-bit time parameter
myPulsePal.programTriggerChannelParam(
    'triggerMode', 1, 0)  # Set trigger channel 1 to normal mode
myPulsePal.programOutputChannelParam('pulseTrainDuration', 1, 2)
Beispiel #6
0
Code adapted from justphotometry.py and Photometry_Plasticity40Hz by RMikofsky

"""

import time
import sys, os
import datetime
import zmq
import json

# ==================================  Change These For Your Computer  ===========================================

sys.path.append('C:\\Users\\GordonLabINS\\Documents\\PulsePal\\PulsePal-master\\Python')        # Path to PulsePal code
from PulsePal import PulsePalObject  # Import PulsePalObject

myPulsePal = PulsePalObject()  # Create a new instance of a PulsePal object
myPulsePal.connect(serialPortName='COM10')  # Connect to PulsePal on port COM# (open port, handshake and receive firmware version)
print(myPulsePal.firmwareVersion)  # Print firmware version to the console

# ******************* CHANGE THESE TO CALIBRATE LASER ******************************************************
laserpowerboosterMultiplier = 0.00 # range 0.025-0.05
laserpowerbooserAdditive = 0.00 # range 0.1-0.4
#***********************************************************************************************************

# ==================================  Setting up comments to Open Ephys   ===========================================
# WARNING MUST SAVE OPEN EPHYS FILES AS "Binary" TYPE

def sendtimestamp(timestamp):
    ip = '127.0.0.1'
    port = 5041     # change this number for each computer
    timeout = 1.
Beispiel #7
0
Two different tones are played...a short, high-frequency tone that signifies the start of a pulse
and a longer, lower-frequency tone that signifies the end of the pulse.

When you are finished electroplating, highlight the terminal that was used to call the script and
press "enter" on the keyboard to end the continuous pulse.

By Jordan Sorokin, 3/13/2017
"""

# imports
import thread, time, winsound
from PulsePal import PulsePalObject  # Import PulsePalObject

# Initializing PulsePal
pp = PulsePalObject()  # Create a new instance of a PulsePal object
pp.connect(
    'COM3'
)  # Connect to PulsePal on port COM3 (open port, handshake and receive firmware version)
pp.setDisplay("Connected to:", "Python")
print('Connected to PulsePal, version ' + str(pp.firmwareVersion))
winsound.PlaySound('SystemExclamation', winsound.SND_ALIAS)
time.sleep(2)

# set up the pulse train for ch. 1
pulsewidth = input("pulse width (s): ")
pp.programOutputChannelParam("phase1Voltage", 1, 5.0)  # 5V pulse
pp.programOutputChannelParam("isBiphasic", 1, 0)  # only positive, monophasic


# function for checking keypress