File MIES_AmplifierInteraction.ipf

AI Interface with the headstage amplifiers

Functions

static variable AI_UpdateDependentSettings(string device, variable headStage, variable func, variable clampMode)

Update the settings which the amplifier changed as a side effect of writing func

Parameters:
  • device – device

  • headStage – MIES headstage number, must be in the range [0, NUM_HEADSTAGES[

  • func – Function which was written, see AI_SendToAmpConstants

  • clampMode – clamp mode of func

static variable AI_UpdateAmpModel(string device, variable headStage, string ctrl = defaultValue, variable value = defaultValue, variable sendToAll = defaultValue, variable checkBeforeWrite = defaultValue, variable selectAmp = defaultValue, variable func = defaultValue, variable clampMode = defaultValue, variable GUIWrite = defaultValue)

Update the AmpStorageWave entry and send the value to the amplifier.

One of either ctrl or func plus clampMode is required.

Parameters:
  • device – device

  • ctrl – [optional] name of the amplifier control

  • headStage – MIES headstage number, must be in the range [0, NUM_HEADSTAGES[

  • value – [optional: defaults to the controls value] value to set. values is in MIES units, see AI_SendToAmp() and there the description of usePrefixes.

  • sendToAll – [optional: defaults to the state of the checkbox] should the value be send to all active headstages (true) or just to the given one (false)

  • checkBeforeWrite – [optional, defaults to false] (ignored for getter functions) check the current value and do nothing if it is equal within some tolerance to the one written

  • selectAmp – [optional, defaults to true] Select the amplifier before use, some callers might save time in doing that once themselves.

  • func – [optional] Function to call, see AI_SendToAmpConstants

  • clampMode – [optional] One of V_CLAMP_MODE, I_CLAMP_MODE or I_EQUAL_ZERO_MODE

  • GUIWrite – [optional, defaults to false] Should the amplifier control, if available, be updated with the value

Returns:

0 on success, 1 otherwise

variable AI_SyncAmpStorageToGUI(string device, variable headstage)

Convenience wrapper for AI_UpdateAmpView.

Disallows setting single controls for outside callers as AI_UpdateAmpModel should be used for that.

variable AI_SyncGUIToAmpStorageAndMCCApp(string device, variable headStage, variable clampMode, variable force = defaultValue)

Sync the settings from the GUI to the amp storage wave and the MCC application.

variable AI_UpdateAmpView(string device, variable headStage, variable func = defaultValue, variable clampMode = defaultValue)

Synchronizes the AmpStorageWave to the amplifier GUI control.

Only intended to be called from the amplifier specific implementations, outside callers should use AI_SyncAmpStorageToGUI() or AI_WriteToAmplifier().

Parameters:
static variable AI_SetMIESHeadstage(string device, variable headstage = defaultValue, variable increment = defaultValue)
variable AI_ZeroAmps(string device, variable headStage = defaultValue)

Executes MCC auto zero command if the baseline current exceeds ZERO_TOLERANCE.

Parameters:
  • device – device

  • headStage – [optional: defaults to all active headstages]

static variable AI_MIESAutoPipetteOffset(string device, variable headStage)

Auto pipette zeroing Quicker than MCC auto pipette offset.

Parameters:
  • device – device

  • headStage – MIES headstage number, must be in the range [0, NUM_HEADSTAGES]

std::tuple<variable, variable, string, string> AI_QueryGainsUnitsForClampMode(string device, variable headstage, variable clampMode)

Query the amplifier for the gains and units of the given clamp mode.

Assumes that the correct amplifier is already selected!

string AI_GetAmplifierList(string device = defaultValue)

Return a nicely layouted list of the amplifiers available for the device.

Used as popup menu value function.

Parameters:

device – [optional, defaults to none] device, for unlocked panels the device is not yet known

string AI_GetAmplifierDef(string device, variable headstage)

Return the amplifier list entry of the amplifier associated with the headstage.

Parameters:
  • device – device

  • headstage – MIES headstage number, must be in the range [0, NUM_HEADSTAGES[

Returns:

list entry as returned by AI_GetAmplifierList() or NONE

string AI_GetFixedAmplifierDef(string device, variable headstage)

Return the amplifier list entry of the amplifier fixed to the headstage.

Only devices with integrated amplifiers have fixed amplifiers.

Parameters:
  • device – device

  • headstage – MIES headstage number, must be in the range [0, NUM_HEADSTAGES[

Returns:

list entry as returned by AI_GetAmplifierList(), NONE if the headstage has no fixed amplifier or an empty string if the device has no fixed amplifiers

std::tuple<variable, variable, variable> AI_ParseAmplifierDef(string device, string amplifierDef)

Parse the entries which AI_GetAmplifierList() created.

Parameters:
  • device – [in] device

  • amplifierDef – [in] amplifier list entry

Return values:
  • ampType – amplifier type, one of AmplifierTypes

  • ampSerial – amplifier serial number

  • ampChannelID – amplifier channel

variable AI_GetAmplifierTypeOfDevice(string device)

Return the amplifier type the device supports.

Each device supports only amplifiers of one type, besides headstages without amplifier. Sutter devices have integrated amplifiers, all other devices use MCC amplifiers.

Parameters:

device – device, can be empty if not yet known

Returns:

one of AmplifierTypes, never AMPLIFIER_TYPE_NONE

variable AI_InitializeAmplifiers(string device)

Initialize the amplifiers of the device.

Called when locking the device.

Returns:

0 on success, 1 on error

variable AI_ShutdownAmplifiers(string device)

Shutdown the amplifiers of the device.

Called when unlocking the device.

variable AI_IsClampModeSupported(string device, variable clampMode)

Return true if the clamp mode is supported by the amplifiers of the device.

I=0 is not supported for Sutter amplifiers.

Parameters:
wave AI_GetAllowedAmplifierTypes(string device)

Return the amplifier types headstages with associated channels of the device can have.

Sutter devices have fixed integrated amplifiers for all their headstages. Headstages without associated channels have no amplifier.

Parameters:

device – device, can be empty if not yet known

Returns:

numeric wave with entries from AmplifierTypes

variable AI_IsAllowedAmplifierType(string device, variable ampType)

Return true if headstages of the device can have the given amplifier type.

Parameters:
  • device – device, can be empty if not yet known

  • ampType – one of AmplifierTypes

variable AI_GetAmplifierType(string device, variable headstage)

Return the amplifier type of the given headstage.

Parameters:
  • device – device

  • headstage – MIES headstage number, must be in the range [0, NUM_HEADSTAGES[

Returns:

one of AmplifierTypes

variable AI_HasAmplifier(string device, variable headstage)

Return true if the given headstage has an amplifier associated.

Parameters:
  • device – device

  • headstage – MIES headstage number, must be in the range [0, NUM_HEADSTAGES[

variable AI_UpdateChanAmpAssign(string device, variable headStage, variable clampMode, variable DAGain, variable ADGain, string DAUnit, string ADUnit)

Update the ChanAmpAssign and ChanAmpAssignUnit waves according to the passed clamp mode with the gains and units.

variable AI_AssertOnInvalidClampMode(variable clampMode)

Assert on invalid clamp modes, does nothing otherwise.

variable AI_IsValidClampMode(variable clampMode)

Return true if the given clamp mode is valid.

variable AI_OpenMCCs(string device, string ampSerialNumList, string ampTitleList = defaultValue)

Opens Multi-clamp commander software.

Parameters:
  • device – device

  • ampSerialNumList – A text list of amplifier serial numbers without leading zeroes Ex. “834001;435003;836059”, “0;” starts the MCC in Demo mode Duplicate serial numbers are ignored as well as amplifier titles for the duplicates. For each unique serial number one MCC is opened.

  • ampTitleList – [optional, defaults to blank] MCC gui window title

Returns:

1 if all unique MCCs specified in ampSerialNumList were opened, 0 if one or more MCCs specified in ampSerialNumList were not able to be opened

std::tuple<variable, variable> AI_MapControlNameToFunctionConstant(string ctrl)

Map from amplifier control names to AI_SendToAmpConstants constants and clamp mode.

string AI_MapFunctionConstantToControl(variable func, variable clampMode)

Map from AI_SendToAmpConstants constants and clamp mode to control names.

string AI_MapFunctionConstantToName(variable func, variable clampMode)

Map constants from AI_SendToAmpConstants to human readable names.

static variable AI_MapNameToFunctionConstant(string name)

Map human readable names to functions constants from AI_SendToAmpConstants.

variable AI_IsControlFromClampMode(string ctrl, variable clampMode)

Return the truthness that the ctrl belongs to the clamp mode.

string AI_AmpStorageControlToRowLabel(string ctrl)

Convert amplifier controls to row labels for AmpStorageWave

string AI_GetUnitForFunctionConstant(variable func, variable clampMode)

Return the unit with prefix of the given function constant and clampMode.

This uses the MIES internal units i.e. with prefixes.

wave AI_GetFunctionConstantForClampMode(variable clampMode)

Return a wave with all function constants for the given clamp mode.

variable AI_GetHoldingCommand(string device, variable headstage)

Returns the holding command of the amplifier.

variable AI_GetMode(string device, variable headstage)

Return the clamp mode of the headstage as returned by the amplifier.

Should only be used during the setup phase when you don’t know if the clamp mode in MIES matches already. It is always better to prefer DAP_ChangeHeadStageMode() if possible.

One of AmplifierClampModes or NaN if no amplifier is connected

variable AI_SelectMultiClamp(string device, variable headStage)

Select the amplifier of the given headstage.

Parameters:
  • device – device

  • headStage – MIES headstage number, must be in the range [0, NUM_HEADSTAGES]

Returns:

one of AISelectMultiClampReturnValues

variable AI_SetClampMode(string device, variable headStage, variable mode, variable zeroStep = defaultValue, variable selectAmp = defaultValue)

Set the clamp mode of the amplifier based on the headstage number.

Parameters:
  • device – device

  • headStage – MIES headstage number, must be in the range [0, NUM_HEADSTAGES[

  • mode – clamp mode to set

  • zeroStep – [optional, defaults to false] switch via I=0 to the target clamp mode

  • selectAmp – [optional, defaults to true] Select the amplifier before use, some callers might save time in doing that once themselves.

variable AI_EnsureCorrectMode(string device, variable headStage, variable selectAmp = defaultValue)

Set the clamp mode in the amplifier to the same clamp mode as MIES has stored.

Parameters:
  • device – device

  • headStage – headstage

  • selectAmp – [optional, defaults to false] selects the amplifier before using, some callers might be able to skip it.

Returns:

0 on success, 1 when the headstage does not have an amplifier connected or it could not be selected

variable AI_FillAndSendAmpliferSettings(string device, variable sweepNo)

Fill the amplifier settings wave by querying the amplifier and send the data to ED_AddEntriesToLabnotebook.

Parameters:
  • device – device

  • sweepNo – data wave sweep number

variable AI_QueryGainsFromMCC(string device)

Auto fills the units and gains for all headstages connected to amplifiers by querying the amplifier.

The data is inserted into ChanAmpAssign and ChanAmpAssignUnit

Returns:

number of connected amplifiers

variable AI_FindConnectedAmps(string device, variable rescanHardware = defaultValue)

Return the number of connected amplifiers.

Parameters:
  • device – device, can be empty if not yet known

  • rescanHardware – [optional, defaults to false] rescan the hardware instead of using cached results

variable AI_SendToAmp(string device, variable headStage, variable mode, variable func, variable accessType, variable checkBeforeWrite = defaultValue, variable usePrefixes = defaultValue, variable selectAmp = defaultValue, variable value = defaultValue)

Generic interface to call amplifier functions.

Dispatches to the implementation of the amplifier type of the headstage.

Parameters:
  • device – device

  • headStage – MIES headstage number, must be in the range [0, NUM_HEADSTAGES[

  • mode – one of V_CLAMP_MODE, I_CLAMP_MODE or I_EQUAL_ZERO_MODE

  • func – Function to call, see AI_SendToAmpConstants

  • accessType – One of MCCAccessType

  • checkBeforeWrite – [optional, defaults to false] (ignored for getter functions) check the current value and do nothing if it is equal within some tolerance to the one written

  • usePrefixes – [optional, defaults to true] Use SI-prefixes common in MIES for the passed and returned values, e.g. mV instead of V

  • selectAmp – [optional, defaults to true] Select the amplifier before use, some callers might save time in doing that once themselves.

  • value – [optional] Required for writers, must be left out for readers

Returns:

return value (for getters, respects usePrefixes), success (0) or error (NaN).

variable AI_WriteToAmplifier(string device, variable headStage, variable mode, variable func, variable value, variable sendToAll = defaultValue, variable checkBeforeWrite = defaultValue, variable selectAmp = defaultValue, variable GUIWrite = defaultValue)

Write to the amplifier.

Parameters:
  • device – device

  • headStage – MIES headstage number, must be in the range [0, NUM_HEADSTAGES[

  • mode – One of V_CLAMP_MODE, I_CLAMP_MODE or I_EQUAL_ZERO_MODE

  • func – Function to call, see AI_SendToAmpConstants

  • value – value to set. values is in MIES units, see AI_SendToAmp() and there the description of usePrefixes

  • sendToAll – [optional: defaults to the state of the checkbox] should the value be send to all active headstages (true) or just to the given one (false)

  • checkBeforeWrite – [optional, defaults to false] (ignored for getter functions) check the current value and do nothing if it is equal within some tolerance to the one written

  • selectAmp – [optional, defaults to true] Select the amplifier before use, some callers might save time in doing that once themselves.

  • GUIWrite – [optional, defaults to false] Should the amplifier control, if available, be updated with the value

Returns:

0 on success, 1 otherwise

variable AI_ReadFromAmplifier(string device, variable headStage, variable mode, variable func, variable usePrefixes = defaultValue, variable selectAmp = defaultValue)

Read from amplifier.

Parameters:
  • device – device

  • headStage – MIES headstage number, must be in the range [0, NUM_HEADSTAGES[

  • mode – One of V_CLAMP_MODE, I_CLAMP_MODE or I_EQUAL_ZERO_MODE

  • func – Function to call, see AI_SendToAmpConstants

  • usePrefixes – [optional, defaults to true] Use SI-prefixes common in MIES for the passed and returned values, e.g. mV instead of V

  • selectAmp – [optional, defaults to true] Select the amplifier before use, some callers might save time in doing that once themselves.

Returns:

0 on success, 1 otherwise

Variables

static const double ZERO_TOLERANCE = 100
static const string AMPLIFIER_CONTROLS_VC = "setvar_DataAcq_Hold_VC;check_DataAcq_Amp_Chain;check_DatAcq_HoldEnableVC;setvar_DataAcq_WCC;setvar_DataAcq_WCR;check_DatAcq_WholeCellEnable;setvar_DataAcq_RsCorr;setvar_DataAcq_RsPred;check_DatAcq_RsCompEnable;setvar_DataAcq_PipetteOffset_VC;button_DataAcq_FastComp_VC;button_DataAcq_SlowComp_VC;button_DataAcq_AutoPipOffset_VC;button_DataAcq_WCAuto"
static const string AMPLIFIER_CONTROLS_IC = "setvar_DataAcq_Hold_IC;check_DatAcq_HoldEnable;setvar_DataAcq_BB;check_DatAcq_BBEnable;setvar_DataAcq_CN;check_DatAcq_CNEnable;setvar_DataAcq_AutoBiasV;setvar_DataAcq_AutoBiasVrange;setvar_DataAcq_IbiasMax;check_DataAcq_AutoBias;setvar_DataAcq_PipetteOffset_IC;button_DataAcq_AutoBridgeBal_IC;button_DataAcq_AutoPipOffset_IC"
static const double MAX_PIPETTEOFFSET = 150
static const double MIN_PIPETTEOFFSET = -150