from holypipette.controller.base import TaskController
all = ['Amplifier', 'FakeAmplifier']
[docs]class Amplifier(TaskController):
"""
Base class for amplifiers.
"""
[docs] def start_patch(self, pulse_amplitude=1e-2,
pulse_frequency=1e-2): # Not clear what the units are for frequency
'''
Initialize the patch clamp procedure (in bath)
'''
pass
[docs] def resistance(self):
'''
Returns resistance
'''
pass
[docs] def stop_patch(self):
'''
Stops patch clamp procedure
'''
pass
[docs] def voltage_clamp(self):
'''
Switch to voltage clamp mode
'''
pass
[docs] def current_clamp(self):
'''
Switch to current clamp mode
'''
pass
[docs] def set_holding(self, value): # Voltage-clamp value
'''
Set voltage clamp value
Parameters
----------
value : float
Voltage clamp value
'''
pass
[docs] def zap(self):
'''
"Zap" the cell to break the membrane
'''
pass
[docs] def set_zap_duration(self, duration):
'''
Set the duration for the `zap`.
Parameters
----------
duration : float
Duration of the zap in seconds.
'''
pass
[docs] def auto_pipette_offset(self):
'''
Trigger the feature to automatically zero the membrane current.
'''
pass
[docs] def close(self):
'''
Shut down the connection to th eamplifier.
'''
pass
[docs]class FakeAmplifier(Amplifier):
"""
"Fake" amplifier that only notes down changes/commands
"""
def __init__(self):
self._mode = 'voltage clamp'
self._resistance = 10*1e6
self._holding = -70 # holding potential for voltage clamp, holding current for current clamp
self._patching = False
self._zap_duration = 0.1
[docs] def start_patch(self, pulse_amplitude=1e-2,
pulse_frequency=1e-2): # Not clear what the units are for frequency
'''
Initialize the patch clamp procedure (in bath)
'''
self._patching = True
self.debug('Starting patch')
[docs] def resistance(self):
'''
Returns resistance
'''
return self._resistance
[docs] def stop_patch(self):
'''
Stops patch clamp procedure
'''
self._patching = False
self.debug('Stopping patch')
[docs] def voltage_clamp(self):
'''
Switch to voltage clamp mode
'''
self.mode = 'voltage clamp'
self.debug('Switching to voltage clamp mode')
[docs] def current_clamp(self):
'''
Switch to current clamp mode
'''
self.mode = 'current clamp'
self.debug('Switching to current clamp mode')
[docs] def set_holding(self, value):
'''
Set holding voltage or current
Parameters
----------
value : float
Holding voltage or current
'''
self._holding = value
if self.mode == 'voltage clamp':
holding_what = 'potential'
unit = 'mV'
else:
holding_what = 'current'
unit = 'pA'
self.debug('Setting holding {} to {:.2f}{}'.format(holding_what,
value,
unit))
[docs] def zap(self):
'''
"Zap" the cell to break the membrane
'''
self.debug('Zapping the cell')
[docs] def set_zap_duration(self, duration):
'''
Set the duration for the `zap`.
Parameters
----------
duration : float
Duration of the zap in seconds.
'''
self._zap_duration = duration
self.debug('Setting zap duration to {:.0f}ms'.format(self._zap_duration*1000))
[docs] def auto_pipette_offset(self):
'''
Trigger the feature to automatically zero the membrane current.
'''
self.debug('Triggering automatic pipette offset')
[docs] def close(self):
'''
Shut down the connection to th eamplifier.
'''
self.debug('Shutting down the amplifier')
#TODO: How to best expose Multiclamp's acquire command?