Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TTL support to SF #1822

Merged
merged 18 commits into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
9e85429
Util: Add GetUsedHWDACFromLNB helper function to retrieve hardware ty…
MichaelHuth Jul 20, 2023
5dda065
Util: Introduce variable for channel type in CreateTiledChannelGraph
MichaelHuth Jul 15, 2023
31e201b
Util: Add GUI channel number to TUD in CreateTiledChannelGraph
MichaelHuth Jul 15, 2023
978a987
BSP: Use GUI channel number only in BSP_AddTracesForEpochs
MichaelHuth Jul 15, 2023
37f9f5c
BSP: fix splitTTL epochs dependent control not properly toggled by Vi…
MichaelHuth Jul 15, 2023
015c7a7
BSP: Always set axis range for TTL channels to 0 - 1 with 2 ticks
MichaelHuth Jul 15, 2023
79b3c4d
Util: Use GUI channel number for axis names in CreateTiledChannelGraph
MichaelHuth Jul 15, 2023
d404f13
SF: Add TTL channel support to select operation and unassoc DA support
MichaelHuth Jul 17, 2023
e346d7f
Util: Add GetDAQDataSingleColumnWaveNG as more generic function
MichaelHuth Jul 18, 2023
7566572
SF: Adapt SFH_GetSweepsForFormula to support epochs for TTL channels
MichaelHuth Jul 18, 2023
bcd6d88
SF: Use EP_FetchEpochs in SF_OperationEpochsImpl instead of direct re…
MichaelHuth Jul 18, 2023
466bc5c
Tests: Adapt FillFakeDatabrowserWindow to not setup invalid channel n…
MichaelHuth Jul 18, 2023
5187b52
SFH: Remove trailing ; in old epoch name fallback in SFH_GetEpochName…
MichaelHuth Jul 20, 2023
6cedbf0
EP: Remove unnecessary code in EP_GetEpochs
MichaelHuth Jul 26, 2023
790b03b
EP: Move AD to DA channel conversion into EP_FetchEpochs
MichaelHuth Jul 26, 2023
fb0b682
Util: Adapt TTL specific API of GetHeadstageColor, bugfix TTL colors
MichaelHuth Jul 28, 2023
186dc0c
SF: Add support for correct colors of TTL traces
MichaelHuth Jul 28, 2023
7da5363
DB: Set "sep. TTL" checkbox by default to checked on DB/SB open
MichaelHuth Jul 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 5 additions & 26 deletions Packages/MIES/MIES_BrowserSettingsPanel.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -1274,9 +1274,9 @@ Function BSP_CheckProc_ChangedSetting(cba) : CheckBoxControl
endif
break
case "check_BrowserSettings_VisEpochs":
AdaptDependentControls(bsPanel, "check_BrowserSettings_splitTTL", CHECKBOX_UNSELECTED, checked, DEP_CTRLS_SAME)
if(checked)
DisableControls(bsPanel, "check_Display_EqualYrange;check_Display_EqualYignore")
AdaptDependentControls(bsPanel, "check_BrowserSettings_splitTTL", CHECKBOX_SELECTED, CHECKBOX_SELECTED, DEP_CTRLS_SAME)
else
EnableControls(bsPanel, "check_Display_EqualYrange;check_Display_EqualYignore")
endif
Expand Down Expand Up @@ -1608,7 +1608,7 @@ Function BSP_AddTracesForEpochs(string win)

variable i, j, start_x, start_y, end_x, end_y, yOffset
variable headstage, yLevelOffset, level, idx, numTraces, numEpochs
variable sweepNumber, traceIndex, channelType, hwChannelNumber, guiChannelNumber, ttlBit, fetchChanType
variable sweepNumber, traceIndex, channelType, channelNumber
STRUCT RGBColor c
string xaxis, yaxis, axes, axis, levels_x_name, levels_y_name, name, idPart, level_x_trace

Expand Down Expand Up @@ -1663,41 +1663,20 @@ Function BSP_AddTracesForEpochs(string win)
headstage = str2num(traceInfos[i][%headstage])
sweepNumber = str2num(traceInfos[i][%sweepNumber])
channelType = WhichListItem(traceInfos[i][%channelType], XOP_CHANNEL_NAMES)
hwChannelNumber = str2num(traceInfos[i][%channelNumber])
channelNumber = str2num(traceInfos[i][%GUIChannelNumber])

WAVE/Z/T numericalValues = BSP_GetLogbookWave(win, LBT_LABNOTEBOOK, LBN_NUMERICAL_VALUES, sweepNumber = sweepNumber)
ASSERT(WaveExists(numericalValues), "Numerical LabNotebook not found.")
WAVE/Z/T textualValues = BSP_GetLogbookWave(win, LBT_LABNOTEBOOK, LBN_TEXTUAL_VALUES, sweepNumber = sweepNumber)
ASSERT(WaveExists(textualValues), "Textual LabNotebook not found.")

fetchChanType = channelType
switch(channelType)
case XOP_CHANNEL_TYPE_ADC:
guiChannelNumber = hwChannelNumber
guiChannelNumber = SFH_GetDAChannel(win, sweepNumber, channelType, guiChannelNumber)
fetchChanType = XOP_CHANNEL_TYPE_DAC
break
case XOP_CHANNEL_TYPE_DAC:
guiChannelNumber = hwChannelNumber
break
case XOP_CHANNEL_TYPE_TTL:
ttlBit = str2num(traceInfos[i][%TTLBit])
WAVE/Z channelMapHWToGUI = GetActiveChannels(numericalValues, textualValues, sweepNumber, XOP_CHANNEL_TYPE_TTL, TTLmode = TTL_HWTOGUI_CHANNEL)
ASSERT(WaveExists(channelMapHWToGUI), "Expected TTL channel(s) for sweep " + num2istr(sweepNumber) + " in LNB, but none found.")
guiChannelNumber = channelMapHWToGUI[hwChannelNumber][IsNaN(ttlBit) ? 0 : ttlBit]
ASSERT(IsFinite(guiChannelNumber), "Could not retrieve GUI channel number for TTL hardware channel/ttlBits")
break
default:
ASSERT(0, "Unsupported channelType")
endswitch

// present since a2172f03 (Added generations of epoch information wave, 2019-05-22)
WAVE/T/Z epochsFromLBN = EP_FetchEpochs(numericalValues, textualValues, sweepNumber, guiChannelNumber, fetchChanType)
WAVE/T/Z epochsFromLBN = EP_FetchEpochs(numericalValues, textualValues, sweepNumber, channelNumber, channelType)
if(!WaveExists(epochsFromLBN))
continue
endif

sprintf idPart, "_sweep%d_chan%d_type%d_HS%.0g", sweepNumber, guiChannelNumber, channelType, headstage
sprintf idPart, "_sweep%d_chan%d_type%d_HS%.0g", sweepNumber, channelNumber, channelType, headstage
sprintf name, "epochs_%s", idPart
Duplicate/O/T epochsFromLBN, dfr:$name/Wave=epochs

Expand Down
2 changes: 1 addition & 1 deletion Packages/MIES/MIES_Constants.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Constant DAQ_CONFIG_WAVE_VERSION = 2

/// Used to upgrade the GuiStateWave as well as the DA Ephys panel
Constant DA_EPHYS_PANEL_VERSION = 62
Constant DATA_SWEEP_BROWSER_PANEL_VERSION = 46
Constant DATA_SWEEP_BROWSER_PANEL_VERSION = 47
Constant WAVEBUILDER_PANEL_VERSION = 14
Constant ANALYSISBROWSER_PANEL_VERSION = 3

Expand Down
1 change: 1 addition & 0 deletions Packages/MIES/MIES_DataBrowser.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ Function DB_ResetAndStoreCurrentDBPanel()
PGC_SetAndActivateControl(bsPanel, "Settings", val = 0)
CheckBox check_overlaySweeps_disableHS, WIN = $bsPanel, value= 0
CheckBox check_overlaySweeps_non_commula, WIN = $bsPanel, value= 0
CheckBox check_BrowserSettings_splitTTL, WIN = $bsPanel, value= 1
PopupMenu popup_overlaySweeps_select, WIN = $bsPanel, mode=1
SetVariable setvar_overlaySweeps_offset, WIN = $bsPanel, value= _NUM:0
SetVariable setvar_overlaySweeps_step, WIN = $bsPanel, value= _NUM:1
Expand Down
2 changes: 1 addition & 1 deletion Packages/MIES/MIES_DataBrowser_Macro.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@ Window DataBrowser() : Graph
CheckBox check_BrowserSettings_splitTTL,userdata(ResizeControlsInfo)+=A"zzzzzzzzzzzz!!#u:Du]k<zzzzzzzzzzz"
CheckBox check_BrowserSettings_splitTTL,userdata(ResizeControlsInfo)+=A"zzz!!#u:Du]k<zzzzzzzzzzzzzz!!!"
CheckBox check_BrowserSettings_splitTTL,userdata(Config_RestorePriority)="20"
CheckBox check_BrowserSettings_splitTTL,value=0
CheckBox check_BrowserSettings_splitTTL,value=1
PopupMenu popup_DB_lockedDevices,pos={54.00,301.00},size={205.00,19.00},bodyWidth=100,proc=DB_PopMenuProc_LockDBtoDevice
PopupMenu popup_DB_lockedDevices,title="Device assignment:"
PopupMenu popup_DB_lockedDevices,help={"Select a data acquistion device to display data"}
Expand Down
24 changes: 16 additions & 8 deletions Packages/MIES/MIES_Epochs.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,7 @@ Function/WAVE EP_GetEpochs(WAVE numericalValues, WAVE textualValues, variable sw
variable index, epochCnt, midSweep
string regexp

ASSERT(channelType == XOP_CHANNEL_TYPE_DAC || channelType == XOP_CHANNEL_TYPE_TTL, "Only channelType XOP_CHANNEL_TYPE_DAC and XOP_CHANNEL_TYPE_TTL is supported")
ASSERT(channelType == XOP_CHANNEL_TYPE_DAC || channelType == XOP_CHANNEL_TYPE_ADC || channelType == XOP_CHANNEL_TYPE_TTL, "Unsupported channel type")
treelevel = ParamIsDefault(treelevel) ? NaN : treelevel

if(ParamIsDefault(epochsWave) || !WaveExists(epochsWave))
Expand All @@ -926,14 +926,12 @@ Function/WAVE EP_GetEpochs(WAVE numericalValues, WAVE textualValues, variable sw
endif

if(!midsweep)
WAVE/T/Z epochInfo = EP_FetchEpochs(numericalValues, textualValues, sweepNo, channelNumber, channelType)

if(!WaveExists(epochInfo))
WAVE/T/Z epochInfoChannel = EP_FetchEpochs(numericalValues, textualValues, sweepNo, channelNumber, channelType)
if(!WaveExists(epochInfoChannel))
return $""
endif

Duplicate/FREE/T/RMD=[][][][channelType] epochInfo, epochInfoChannel
epochCnt = DimSize(epochInfo, ROWS)
epochCnt = DimSize(epochInfoChannel, ROWS)
else
epochCnt = EP_GetEpochCount(epochsWave, channelNumber, channelType)

Expand Down Expand Up @@ -992,10 +990,20 @@ End
///
/// See GetEpochsWave() for the wave layout.
threadsafe Function/WAVE EP_FetchEpochs(WAVE numericalValues, WAVE/T/Z textualValues, variable sweep, variable channelNumber, variable channelType)

variable index

if(channelType != XOP_CHANNEL_TYPE_DAC && channelType != XOP_CHANNEL_TYPE_TTL)
return $""
ASSERT_TS(channelType == XOP_CHANNEL_TYPE_DAC || channelType == XOP_CHANNEL_TYPE_ADC || channelType == XOP_CHANNEL_TYPE_TTL, "Unsupported channel type")
if(channelType == XOP_CHANNEL_TYPE_ADC)
[WAVE setting, index] = GetLastSettingChannel(numericalValues, $"", sweep, "DAC", channelNumber, XOP_CHANNEL_TYPE_ADC, DATA_ACQUISITION_MODE)
if(!WaveExists(setting))
return $""
endif
channelType = XOP_CHANNEL_TYPE_DAC
channelNumber = setting[index]
if(!(IsFinite(channelNumber) && index < NUM_HEADSTAGES))
return $""
endif
endif

[WAVE setting, index] = GetLastSettingChannel(numericalValues, textualValues, sweep, EPOCHS_ENTRY_KEY, channelNumber, channelType, DATA_ACQUISITION_MODE)
Expand Down
Loading