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
ctrlorfuncplusclampModeis 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:
device – device
headStage – MIES headstage number, must be in the range [0, NUM_HEADSTAGES]
func – Function to call, see AI_SendToAmpConstants
clampMode – one of V_CLAMP_MODE, I_CLAMP_MODE or I_EQUAL_ZERO_MODE
-
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 MCC application for the gains and units of the given clamp mode.
Assumes that the correct amplifier is already selected!
-
string AI_GetAmplifierList()¶
Return a nicely layouted list of amplifier channels.
Used as popup menu value function.
-
string AI_GetAmplifierDef(variable ampSerial, variable ampChannel)¶
Return the amplifier list entry for the given amplifier serial and channel.
-
std::tuple<variable, variable> AI_ParseAmplifierDef(string amplifierDef)¶
Parse the entries which AI_GetAmplifierDef() created.
-
variable AI_UpdateChanAmpAssign(string device, variable headStage, variable clampMode, variable DAGain, variable ADGain, string DAUnit, string ADUnit)¶
Update the
ChanAmpAssignandChanAmpAssignUnitwaves 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)¶
Wrapper for MCC_SelectMultiClamp700B.
- Parameters:
device – device
headStage – MIES headstage number, must be in the range [0, NUM_HEADSTAGES]
- Returns:
-
variable AI_SetClampMode(string device, variable headStage, variable mode, variable zeroStep = defaultValue, variable selectAmp = defaultValue)¶
Set the clamp mode of user linked MCC based on the headstage number.
-
variable AI_EnsureCorrectMode(string device, variable headStage, variable selectAmp = defaultValue)¶
Set the clamp mode in the MCC app 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 MC700B 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 MCC application.
The data is inserted into
ChanAmpAssignandChanAmpAssignUnit- 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.
- Parameters:
device – locked panel name to work on
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.
mVinstead ofVselectAmp – [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
usePrefixessendToAll – [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.
mVinstead ofVselectAmp – [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¶