File MIES_DAEphys.ipf

DAP Main data acquisition panel routines

Unnamed Group

variable DAP_EphysPanelStartUpSettings()

Restores the base state of the DA_Ephys panel. Useful when adding controls to GUI. Facilitates use of auto generation of GUI code. Useful when template experiment file has been overwritten.

Functions

wave DAP_GetRadioButtonCoupling()

Creates meta information about coupled CheckBoxes (Radio Button) controls Used for saving/restoring the GUI state.

Returns:

Free text wave with lists of coupled CheckBox controls

string DAP_GetNIDeviceList()

Returns a list of DAC devices for NI devices.

Returns:

list of NI DAC devices, NONE if there are none

string DAP_GetITCDeviceList()

Returns a list of ITC devices for DAC, NONE if there are none.

string DAP_GetSUDeviceList()

Returns a list of SU devices for DAC, NONE if there are none.

string DAP_GetDACDeviceList()

Returns a list of available ITC and NI devices.

Returns:

list of DAC devices

static variable DAP_SuggestIssueForAdditionalNIHardware()
variable DAP_WindowHook(WMWinHookStruct *s)
string DAP_FormatStimSetPopupValue(variable channelType, string searchString = defaultValue)

Return a popValue string suitable for stimsets.

Todo:

rework the code to have a fixed popValue

static variable DAP_UpdateDrawElements(string device, variable tab)
variable DAP_TabControlFinalHook(WMTabControlAction *tca)

Called by ACL tab control after the tab is updated. see line 257 of ACL_TabUtilities.ipf.

variable DAP_SetVarProc_Channel_Search(WMSetVariableAction *sva)
variable DAP_DAorTTLCheckProc(WMCheckboxAction *cba)
variable DAP_CheckProc_Channel_All(WMCheckboxAction *cba)
variable DAP_IsAllControl(variable channelIndex)

Determines if the control refers to an “All” control.

variable DAP_DACHasExpectedClampMode(string device, variable controlChannelIndex, variable channelNumber, variable channelType)

Helper for “All” controls in the DA tab.

Returns:

0 if the given channel is a DA channel and not in the expected clamp mode as determined by controlChannelIndex, 1 otherwise

variable DAP_CheckProc_AD(WMCheckboxAction *cba)
variable GetHeadstageFromSettings(string device, variable channelType, variable channelNumber, variable clampMode)

Get the headstage for the given channel number and type from the amplifier settings.

This is different from what GetChannelClampMode holds as we here hold the setup information and GetChannelClampMode holds what is currently active.

static variable DAP_AdaptAssocHeadstageState(string device, string checkboxCtrl)

Adapt the state of the associated headstage on DA/AD channel change.

static variable DAP_GetRAAcquisitionCycleID(string device)

Return the repeated acquisition cycle ID for the given devide.

variable DAP_OneTimeCallBeforeDAQ(string device, variable runMode)

One time initialization before data acquisition.

Parameters:
  • device – device

  • runMode – One of DAQRunModes except DAQ_NOT_RUNNING

static variable DAP_ResetClampModeTitle(string device, string ctrl)
static variable DAP_ResetGUIAfterDAQ(string device)

Enable all controls which were disabled before DAQ by DAP_OneTimeCallBeforeDAQ.

variable DAP_OneTimeCallAfterDAQ(string device, variable stopReason, variable forcedStop = defaultValue, variable startTPAfterDAQ = defaultValue)

One time cleaning up after data acquisition.

Parameters:
  • device – device

  • stopReason – One of DAQStoppingFlags

  • forcedStop – [optional, defaults to false] if DAQ was aborted (true) or stopped by itself (false)

  • startTPAfterDAQ – [optional, defaults to true] start “TP after DAQ” if enabled at the end

static variable DAP_DocumentStopReason(string device, variable stopReason)
variable DAP_CheckProc_IndexingState(WMCheckboxAction *cba)
variable DAP_CheckProc_ShowScopeWin(WMCheckboxAction *cba)
static variable DAP_TurnOffAllChannels(string device, variable channelType)
variable DAP_ButtonProc_AllChanOff(WMButtonAction *ba)
variable DAP_UpdateITIAcrossSets(string device, variable maxITI)

Update the ITI for the given device.

variable DAP_PopMenuChkProc_StimSetList(WMPopupAction *pa)

Procedure for DA/TTL popupmenus including indexing wave popupmenus.

variable DAP_SetVarProc_DA_Scale(WMSetVariableAction *sva)
static variable DAP_UpdateSweepLimitsAndDisplay(string device)
variable DAP_GetSampInt(string device, variable dataAcqOrTP, variable channelType, variable *valid = defaultValue)

Return the sampling interval in μs with taking the mode, the multiplier and the fixed frequency selection into account.

Parameters:
  • device[in] device

  • dataAcqOrTP[in] one of DataAcqModes

  • channelType[in] channel type, one of XopChannelConstants

  • valid[out] [optional] returns if the choosen sampling interval is valid or not (DAQ only)

static variable DAP_IsSampleIntervalValid(string device, variable channelType, variable sampInt)
variable DAP_UpdateSweepSetVariables(string device)
variable DAP_SetVarProc_TotSweepCount(WMSetVariableAction *sva)
variable DAP_ButtonCtrlFindConnectedAmps(WMButtonAction *ba)
string DAP_GetNiceAmplifierChannelList()

Return a nicely layouted list of amplifier channels.

string DAP_FormatTelegraphServerList(wave telegraphServers)
static string DAP_GetAmplifierDef(variable ampSerial, variable ampChannel)
variable DAP_ParseAmplifierDef(string amplifierDef, variable *ampSerial, variable *ampChannelID)

Parse the entries which DAP_GetAmplifierDef() created.

variable DAP_SyncDeviceAssocSettToGUI(string device, variable headStage)
variable DAP_PopMenuProc_Headstage(WMPopupAction *pa)
variable DAP_PopMenuProc_CAA(WMPopupAction *pa)
variable DAP_SetVarProc_CAA(WMSetVariableAction *sva)
variable DAP_ButtonProc_ClearChanCon(WMButtonAction *ba)
static variable DAP_HasAscendingSweepOrdering(string device)

Return true if the sweep ordering is ascending, false otherwise.

static variable DAP_CheckSampleInterval(string device, variable mode)
variable DAP_CheckSettings(string device, variable mode)

Check if all settings are valid to send a test pulse or acquire data.

For invalid settings an informative message is printed into the history area.

Callers must ensure to set the acquisition state back to AS_INACTIVE when calling with DATA_ACQUISITION_MODE.

Parameters:
Returns:

0 for valid settings, 1 for invalid settings

static variable DAP_CheckAsyncSettings(string device)
static variable DAP_CheckPressureSettings(string device)
static variable DAP_CheckHeadStage(string device, variable headStage, variable mode)

Returns zero if everything is okay, 1 if a non-recoverable error was found and 2 on recoverable errors.

static variable DAP_CheckChannel(string device, variable channelType, variable channel)
static variable DAP_CheckAnalysisFunctionAndParameter(string device, string setName)
static variable DAP_CheckStimset(string device, variable channelType, variable channel, variable headstage)
static variable DAP_CheckEpochLengthsOfStimset(string device, string setName)
static variable DAP_SyncChanAmpAssignToActiveHS(string device)

Synchronizes the contents of ChanAmpAssign and ChanAmpAssignUnit to all active headstages.

static variable DAP_ApplyClmpModeSavdSettngs(string device, variable headStage, variable clampMode)

Reads the channel amp waves and inserts that info into the DA_EPHYS panel.

static variable DAP_RemoveClampModeSettings(string device, variable headStage, variable clampMode)
string DAP_GetClampModeControl(variable mode, variable headstage)

Returns the name of the checkbox control (radio button) handling the clamp mode of the given headstage or all headstages.

Parameters:
variable DAP_GetInfoFromControl(string device, string ctrl, variable *mode, variable *headStage)

Return information readout from headstage and clamp mode controls.

Users interested in the clamp mode of a known headstage should prefer DAG_GetHeadstageMode() instead.

Parameters:
  • device[in] panel

  • ctrl[in] control can be either Radio_ClampMode_* or Check_DataAcqHS_* referring to an existing control

  • mode[out] I_CLAMP_MODE, V_CLAMP_MODE or I_EQUAL_ZERO_MODE, the currently active mode for headstage controls and the clamp mode of the control for clamp mode controls

  • headStage[out] number of the headstage or one of AllHeadstageModeConstants

variable DAP_CheckProc_ClampMode(WMCheckboxAction *cba)
variable DAP_CheckProc_HedstgeChck(WMCheckboxAction *cba)
variable DAP_ChangeHeadStageMode(string device, variable clampMode, variable headstage, variable options)

Change the clamp mode of the given headstage.

Parameters:
static variable DAP_SetAmpModeControls(string device, variable headstage, variable clampMode, variable delayed = defaultValue)

Sets the control state of the radio buttons used for setting the clamp mode on the Data Acquisition Tab of the DA_Ephys panel.

Parameters:
  • device – device

  • headstage – controls associated with headstage are set

  • clampMode – clamp mode to activate

  • delayed – indicate on the control that the change is delayed

static variable DAP_SetHeadstageChanControls(string device, variable headstage, variable clampMode, variable delayed = defaultValue)

Sets the DA and AD channel settings according to the headstage mode.

Parameters:
  • device – Device (used for data acquisition)

  • headstage – Channels associated with headstage are set

  • clampMode – Clamp mode to activate

  • delayed – [optional, defaults to false] Indicate that this is a delayed clamp mode change

static variable DAP_UpdateClampmodeTabs(string device, variable headStage, variable clampMode)
static variable DAP_ChangeHeadstageState(string device, string headStageCtrl, variable enabled)
variable DAP_ToggleAcquisitionButton(string device, variable mode)

Set the acquisition button text.

Parameters:
variable DAP_ToggleTestpulseButton(string device, variable mode)

Set the testpulse button text.

Parameters:
variable DAP_ButtonProc_AutoFillGain(WMButtonAction *ba)
variable DAP_SliderProc_MIESHeadStage(WMSliderAction *sc)
variable DAP_SetVarProc_AmpCntrls(WMSetVariableAction *sva)
variable DAP_ButtonProc_AmpCntrls(WMButtonAction *ba)
variable DAP_CheckProc_AmpCntrls(WMCheckboxAction *cba)
variable DAP_CheckProc_MDEnable(WMCheckboxAction *cba)

Check box procedure for multiple device (MD) support.

variable DAP_HandleSingleDeviceDependentControls(string device)

Enable controls post DAQ/TP in single device mode.

Parameters:

device – device

variable DAP_CheckProc_InsertTP(WMCheckBoxAction *cba)

Controls TP Insertion into set sweeps before the sweep begins.

variable DAP_UpdateOnsetDelay(string device)

Update the onset delay due to the Insert TP setting.

variable DAP_SetVarProc_TestPulseSett(WMSetVariableAction *sva)
variable DAP_CheckProc_TestPulseSett(WMCheckboxAction *cba)
variable DAP_AdaptAutoTPColorAndDependent(string device)
variable DAP_UnlockAllDevices()
variable DAP_CheckProc_RepeatedAcq(WMCheckboxAction *cba)
static variable DAP_ToggleCheckBoxes(string win, string ctrl, string list, variable checked)

Allows two checkboxes to be treated as a group where only one can be checked at a time.

Write into the GUI state wave as well

variable DAP_CheckProc_SyncCtrl(WMCheckboxAction *cba)
variable DAP_SetVarProc_SyncCtrl(WMSetVariableAction *sva)
variable DAP_ButtonProc_TPDAQ(WMButtonAction *ba)
string DAP_GetCommentPanel(string device)

Return the comment panel name.

string DAP_GetCommentNotebook(string device)

Return the full window path to the comment notebook.

static variable DAP_OpenCommentPanel(string device)

Create the comment panel.

variable DAP_ButtonProc_OpenCommentNB(WMButtonAction *ba)
static string DAP_FormatCommentString(string device, string comment, variable sweepNo)
static variable DAP_AddUserComment(string device)

Add the current user comment of the previous sweep to the comment notebook and to the labnotebook.

The SetVariable for the user comment is also cleared

variable DAP_LockCommentNotebook(string device)

Make the comment notebook read-only.

variable DAP_UnlockCommentNotebook(string device)

Make the comment notebook writeable.

variable DAP_ClearCommentNotebook(string device)

Clear the comment notebook’s content and the serialized string.

variable DAP_SerializeAllCommentNBs()

Serialize all comment notebooks.

variable DAP_SerializeCommentNotebook(string device)

Copy the contents of the comment notebook to the user comment string.

variable DAP_CommentPanelHook(WMWinHookStruct *s)
string DAP_CreateDAEphysPanel()

Create a new DA_Ephys panel.

Returns:

panel name

variable DAP_CheckProc_LockedLogic(WMCheckboxAction *cba)

Sets the locked indexing logic checkbox states.

variable DAP_ParsePanelControl(string ctrl, variable *channelIndex, variable *channelType, variable *controlType)

Extracts channelType, controlType and channelIndex from ctrl

Counterpart to GetPanelControl()

UTF_NOINSTRUMENTATION

Returns:

0 if the control name could be parsed, one otherwise

variable DAP_UpdateListOfPressureDevices()

Update the list of available pressure devices on all locked device panels.

variable DAP_DeviceIsUnlocked(string device)

Query the device lock status.

Returns:

device lock status, 1 if unlocked, 0 if locked

variable DAP_AbortIfUnlocked(string device)
variable DAP_CheckProc_UpdateGuiState(WMCheckboxAction *cba)

GUI procedure which has the only purpose of storing the control state in the GUI state wave.

variable DAP_SetVar_SetScale(WMSetVariableAction *sva)
variable DAP_SetVar_UpdateGuiState(WMSetVariableAction *sva)
variable DAP_CheckProc_Settings_PUser(WMCheckboxAction *cba)
variable DAP_ButtonProc_LockDev(WMButtonAction *ba)
variable DAP_ButProc_Hrdwr_UnlckDev(WMButtonAction *ba)
static variable DAP_UpdateDataFolderDisplay(string device, variable locked)
variable DAP_LockDevice(string win)
static variable DAP_AdaptPanelForDeviceSpecifics(string device, variable forceEnable = defaultValue)
static string DAP_GetControlsForChannelIndex(variable channelIndex, variable channelType)
static variable DAP_LoadBuiltinStimsets()
static variable DAP_ClearWaveIfExists(WaveOrNull wv)
static variable DAP_UnlockDevice(string device)
static variable DAP_UpdateListOfLockedDevices()

Update the list of locked devices.

static variable DAP_UpdateChanAmpAssignStorWv(string device)
static variable DAP_UpdateChanAmpAssignPanel(string device)
variable DAP_UpdateDAQControls(string device, variable updateFlag)

Helper function to update all DAQ related controls after something changed.

Parameters:
static variable DAP_AllChanDASettings(string device, variable headStage, variable delayed = defaultValue)

Applies user settings for the clamp mode stimulus sets (DA Set and Indexing End Set) on mode switch.

Parameters:
  • device – device

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

  • delayed – [optional, defaults to false] On a delayed clamp mode change the stimulus set is not set.

variable DAP_ButtonProc_skipSweep(WMButtonAction *ba)
variable DAP_ButtonProc_skipBack(WMButtonAction *ba)
variable DAP_GetskipAhead(string device)
variable DAP_ResetskipAhead(string device)
variable DAP_getFilteredSkipAhead(string device, variable skipAhead)
variable DAP_setSkipAheadLimit(string device, variable filteredSkipAhead)
variable DAP_SetVarProc_skipAhead(WMSetVariableAction *sva)
variable DAP_CheckProc_RandomRA(WMCheckboxAction *cba)
variable DAP_CheckSkipAhead(string device)
variable DAP_PopMenuProc_UpdateGuiState(WMPopupAction *pa)
string DAP_GetSamplingMultiplier()

Return the list of available sampling multipliers.

Has no NONE element as 1 means no multiplier.

variable DAP_PopMenuProc_SampMult(WMPopupAction *pa)
variable DAP_CheckProc_RequireAmplifier(WMCheckboxAction *cba)
string DAP_GetSamplingFrequencies()

Return the list of available fixed sampling frequencies.

variable DAP_PopMenuProc_FixedSampInt(WMPopupAction *pa)
string DAP_GetOsciUpdModes()

Return the list of available Oscilloscope Update Modes.

variable DAP_PopMenuProc_OsciUpdMode(WMPopupAction *pa)
variable DAP_ApplyDelayedClampModeChange(string device)
variable DAP_ClearDelayedClampModeChange(string device)
variable ButtonProc_Hardware_rescan(WMButtonAction *ba)
variable DAP_CheckProc_PowerSpectrum(WMCheckboxAction *cba)
variable DAP_UpdateDaEphysStimulusSetPopups(string device = defaultValue)

Update the popup menus and its USER_DATA_MENU_EXP user data after stim set changes.

Parameters:

device – [optional, defaults to all locked devices] device

static variable DAP_UpdateStimulusSetPopup(string device, string ctrl, string stimsets)
variable DAP_DeleteStimulusSet(string setName, string device = defaultValue)

Delete the stimulus set in the given DAEphys.

Internal use only, outside callers should use ST_RemoveStimSet()

variable DAP_TPSettingsToWave(string device, wave TPSettings)

Write all TP settings from the data acquisition/settings tab to the settings wave.

static string DAP_TPControlToLabel(string ctrl)

Convert the control name to a dimension label for GetTPSettings()

static variable DAP_TPGUISettingToWave(string device, string ctrl, variable val)

Write a new TP setting value to the wave.

variable DAP_TPSettingsToGUI(string device, string entry = defaultValue)

Synchronize the TP settings from the wave into the GUI.

Needs to be done when the selected headstage changes or the TPsettings wave contents. This function ignores “Send To All HS” as this does not make sense to respect here.

Parameters:
  • device – device

  • entry – [optional, defaults to all] Only update one of the entries TPSettings. Accepted strings are the labels from DAP_TPControlToLabel().

Variables

static const double DATA_ACQU_TAB_NUM = 0
static const double HARDWARE_TAB_NUM = 6
static const string COMMENT_PANEL = "UserComments"
static const string COMMENT_PANEL_NOTEBOOK = "NB"
static const string AMPLIFIER_DEF_FORMAT = "AmpNo %d Chan %d"
static const string NI_DAC_PATTERNS = "AI:32;AO:4;COUNTER:4;DIOPORTS:3;LINES:32,8,8|AI:32;AO:4;COUNTER:2;DIOPORTS:3;LINES:32,8,8|AI:16;AO:2;COUNTER:4;DIOPORTS:3;LINES:8,8,8|AI:8;AO:2;COUNTER:4;DIOPORTS:3;LINES:8,8,8"
static const double DAP_WAITFORTPANALYSIS_TIMEOUT = 2
static const string SU_DISABLED_CONTROLS = "Popup_Settings_VC_DA;Popup_Settings_VC_AD;Popup_Settings_IC_DA;Popup_Settings_IC_AD;button_Hardware_ClearChanConn;"