Skip to content

Commit 50beb41

Browse files
authored
Merge pull request #1044 from AllenInstitute/feature/1044-various-things
Various things
2 parents e504a25 + cd11510 commit 50beb41

File tree

9 files changed

+63
-23
lines changed

9 files changed

+63
-23
lines changed

Packages/MIES/MIES_DataConfigurator.ipf

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -904,9 +904,6 @@ static Function DC_PrepareLBNEntries(string panelTitle, STRUCT DataConfiguration
904904
maxITIGlobal = maxITI
905905
DC_DocumentChannelProperty(panelTitle, "Inter-trial interval", INDEP_HEADSTAGE, NaN, NaN, var=maxITIGlobal)
906906

907-
WAVE/T epochWave = GetEpochsWave(panelTitle)
908-
EP_SortEpochs(panelTitle)
909-
910907
// index guide:
911908
// - numEntries: Number of active DACs
912909
// - i: Zero-based index of the active DACS
@@ -972,10 +969,6 @@ static Function DC_PrepareLBNEntries(string panelTitle, STRUCT DataConfiguration
972969
DC_DocumentChannelProperty(panelTitle, "Stim set length", headstage, channel, XOP_CHANNEL_TYPE_DAC, var=s.setLength[i])
973970
DC_DocumentChannelProperty(panelTitle, "Delay onset oodDAQ", headstage, channel, XOP_CHANNEL_TYPE_DAC, var=s.offsets[i])
974971
DC_DocumentChannelProperty(panelTitle, "oodDAQ regions", headstage, channel, XOP_CHANNEL_TYPE_DAC, str=s.regions[i])
975-
976-
Duplicate/FREE/RMD=[][][channel] epochWave, epochChannel
977-
Redimension/N=(-1, -1, 0) epochChannel
978-
DC_DocumentChannelProperty(panelTitle, EPOCHS_ENTRY_KEY, headstage, channel, XOP_CHANNEL_TYPE_DAC, str=TextWaveToList(epochChannel, ":", colSep = ",", stopOnEmpty = 1))
979972
endfor
980973

981974
DC_DocumentChannelProperty(panelTitle, "Sampling interval multiplier", INDEP_HEADSTAGE, NaN, NaN, var=str2num(DAG_GetTextualValue(panelTitle, "Popup_Settings_SampIntMult")))
@@ -1666,7 +1659,7 @@ End
16661659
/// @param channelType type of the channel
16671660
/// @param var [optional] numeric value
16681661
/// @param str [optional] string value
1669-
static Function DC_DocumentChannelProperty(panelTitle, entry, headstage, channelNumber, channelType, [var, str])
1662+
Function DC_DocumentChannelProperty(panelTitle, entry, headstage, channelNumber, channelType, [var, str])
16701663
string panelTitle, entry
16711664
variable headstage, channelNumber, channelType
16721665
variable var

Packages/MIES/MIES_EnhancedWMRoutines.ipf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#pragma TextEncoding = "UTF-8"
22
#pragma rtGlobals=1 // Use modern global access method and strict wave access.
3+
#pragma ModuleName=MIES_ENWM
34

45
/// @file MIES_EnhancedWMRoutines.ipf
56
/// @brief Routines packaged with IGOR PRO but enhanced from us

Packages/MIES/MIES_Epochs.ipf

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ End
346346

347347
/// @brief Sorts all epochs per channel in EpochsWave
348348
/// @param[in] panelTitle title of device panel
349-
Function EP_SortEpochs(panelTitle)
349+
static Function EP_SortEpochs(panelTitle)
350350
string panelTitle
351351

352352
variable channel, channelCnt, epochCnt
@@ -433,3 +433,35 @@ static Function EP_AddEpoch(panelTitle, channel, epBegin, epEnd, epName, level[,
433433
epochWave[i][%Name][channel] = epName
434434
epochWave[i][%TreeLevel][channel] = num2str(level)
435435
End
436+
437+
/// @brief Write the epoch info into the sweep settings wave
438+
///
439+
/// @param panelTitle device
440+
/// @param sweepWave sweep wave
441+
/// @param configWave config wave
442+
Function EP_WriteEpochInfoIntoSweepSettings(string panelTitle, WAVE sweepWave, WAVE configWave)
443+
variable i, numDACEntries, channel, headstage, acquiredTime
444+
string entry
445+
446+
EP_SortEpochs(panelTitle)
447+
448+
WAVE DACList = GetDACListFromConfig(configWave)
449+
numDACEntries = DimSize(DACList, ROWS)
450+
451+
WAVE channelClampMode = GetChannelClampMode(panelTitle)
452+
Make/D/FREE/N=(numDACEntries) headstageDAC = channelClampMode[DACList[p]][%DAC][%Headstage]
453+
454+
WAVE/T epochsWave = GetEpochsWave(panelTitle)
455+
456+
for(i = 0; i < numDACEntries; i += 1)
457+
channel = DACList[i]
458+
headstage = headstageDAC[i]
459+
460+
Duplicate/FREE/RMD=[][][channel] epochsWave, epochChannel
461+
Redimension/N=(-1, -1, 0) epochChannel
462+
entry = TextWaveToList(epochChannel, ":", colSep = ",", stopOnEmpty = 1)
463+
DC_DocumentChannelProperty(panelTitle, EPOCHS_ENTRY_KEY, headstage, channel, XOP_CHANNEL_TYPE_DAC, str=entry)
464+
endfor
465+
466+
DC_DocumentChannelProperty(panelTitle, "Epochs Version", INDEP_HEADSTAGE, NaN, NaN, var=SWEEP_EPOCH_VERSION)
467+
End

Packages/MIES/MIES_NeuroDataWithoutBorders.ipf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1274,7 +1274,6 @@ threadsafe static Function NWB_ClearWriteChannelParams(s)
12741274
string device
12751275
variable sweep, startingTime, samplingRate, groupIndex
12761276

1277-
// all entries except device and sweep will be cleared
12781277
if(strlen(s.device) > 0)
12791278
device = s.device
12801279
endif

Packages/MIES/MIES_PulseAveraging.ipf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3680,12 +3680,12 @@ Function PA_TraceWindowHook(s)
36803680
case 22: // mouse wheel
36813681
case 6: // resize
36823682
traceGraph = s.winName
3683-
Execute/P/Q "PA_UpdateScaleBars(\"" + traceGraph + "\", 0)"
3683+
Execute/P/Q/Z "PA_UpdateScaleBars(\"" + traceGraph + "\", 0)"
36843684
break
36853685
case 10: // menu
36863686
if(!cmpstr(s.menuName, "Graph") && !cmpstr(s.menuItem, "Autoscale Axes"))
36873687
traceGraph = s.winName
3688-
Execute/P/Q "PA_UpdateScaleBars(\"" + traceGraph + "\", 1)"
3688+
Execute/P/Q/Z "PA_UpdateScaleBars(\"" + traceGraph + "\", 1)"
36893689
endif
36903690
break
36913691
endswitch
@@ -3702,12 +3702,12 @@ Function PA_ImageWindowHook(s)
37023702
case 6: // resize
37033703
imageGraph = s.winName
37043704
PA_ResizeColorScalePanel(imageGraph)
3705-
Execute/P/Q "PA_UpdateScaleBars(\"" + imageGraph + "\", 0)"
3705+
Execute/P/Q/Z "PA_UpdateScaleBars(\"" + imageGraph + "\", 0)"
37063706
break
37073707
case 10: // menu
37083708
if(!cmpstr(s.menuName, "Graph") && !cmpstr(s.menuItem, "Autoscale Axes"))
37093709
imageGraph = s.winName
3710-
Execute/P/Q "PA_UpdateScaleBars(\"" + imageGraph + "\", 1)"
3710+
Execute/P/Q/Z "PA_UpdateScaleBars(\"" + imageGraph + "\", 1)"
37113711
endif
37123712
break
37133713
endswitch

Packages/MIES/MIES_SweepSaving.ipf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ Function SWS_SaveAcquiredData(panelTitle, [forcedStop])
5151
SetSetVariable(panelTitle, "SetVar_Sweep", sweepNo + 1)
5252
DAG_Update(panelTitle, "SetVar_Sweep", val = sweepNo + 1)
5353

54+
EP_WriteEpochInfoIntoSweepSettings(panelTitle, sweepWave, configWave)
55+
5456
// Add labnotebook entries for the acquired sweep
5557
ED_createWaveNoteTags(panelTitle, sweepNo)
5658

Packages/MIES/MIES_Utilities.ipf

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3058,7 +3058,7 @@ End
30583058
/// '_free_'[0][0][1][1]= {"","","",""}
30593059
/// '_free_'[0][0][0][2]= {"6","","",""}
30603060
/// '_free_'[0][0][1][2]= {"","","",""}
3061-
Function/WAVE ListToTextWaveMD(list, dims, [rowSep, colSep, laySep, chuSep])
3061+
threadsafe Function/WAVE ListToTextWaveMD(list, dims, [rowSep, colSep, laySep, chuSep])
30623062
string list
30633063
variable dims
30643064
string rowSep, colSep, laySep, chuSep
@@ -3067,8 +3067,8 @@ Function/WAVE ListToTextWaveMD(list, dims, [rowSep, colSep, laySep, chuSep])
30673067
variable rowMaxSize, colMaxSize, layMaxSize, chuMaxSize
30683068
variable rowNr, colNr, layNr
30693069

3070-
ASSERT(!isNull(list), "list input string is null")
3071-
ASSERT(dims > 0 && dims <= 4, "number of dimensions must be > 0 and < 5")
3070+
ASSERT_TS(!isNull(list), "list input string is null")
3071+
ASSERT_TS(dims > 0 && dims <= 4, "number of dimensions must be > 0 and < 5")
30723072

30733073
if(ParamIsDefault(rowSep))
30743074
rowSep = ";"
@@ -4815,6 +4815,8 @@ End
48154815
///
48164816
/// @param w 1D text wave
48174817
/// @param[in] entry element content to compare
4818+
///
4819+
/// @return 0 if entry was found, 1 otherwise
48184820
Function RemoveTextWaveEntry1D(w, entry)
48194821
WAVE/T w
48204822
string entry
@@ -4825,10 +4827,13 @@ Function RemoveTextWaveEntry1D(w, entry)
48254827

48264828
ASSERT(IsTextWave(w), "Input wave must be a text wave")
48274829

4828-
FindValue/TXOP=4/TEXT=entry w
4830+
FindValue/TXOP=4/TEXT=entry/RMD=[][0][0][0] w
48294831
if(V_Value >= 0)
48304832
DeletePoints V_Value, 1, w
4833+
return 0
48314834
endif
4835+
4836+
return 1
48324837
End
48334838

48344839
/// @brief Checks if a string ends with a specific suffix

Packages/MIES/MIES_WaveDataFolderGetters.ipf

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,7 +1687,7 @@ threadsafe Function/WAVE GetLBNidCache(numericalValues)
16871687
return wv
16881688
End
16891689

1690-
static Constant SWEEP_SETTINGS_WAVE_VERSION = 31
1690+
static Constant SWEEP_SETTINGS_WAVE_VERSION = 32
16911691

16921692
/// @brief Uses the parameter names from the `sourceKey` columns and
16931693
/// write them as dimension into the columns of dest.
@@ -1829,6 +1829,7 @@ End
18291829
/// - 52: Autobias % (DAEphys->Settings->Amplifier)
18301830
/// - 53: Autobias Interval (DAEphys->Settings->Amplifier)
18311831
/// - 54: TP after DAQ
1832+
/// - 55: Epochs version
18321833
Function/Wave GetSweepSettingsKeyWave(panelTitle)
18331834
string panelTitle
18341835

@@ -1847,9 +1848,9 @@ Function/Wave GetSweepSettingsKeyWave(panelTitle)
18471848
if(ExistsWithCorrectLayoutVersion(wv, versionOfNewWave))
18481849
return wv
18491850
elseif(WaveExists(wv))
1850-
Redimension/N=(-1, 55) wv
1851+
Redimension/N=(-1, 56) wv
18511852
else
1852-
Make/T/N=(3, 55) newDFR:$newName/Wave=wv
1853+
Make/T/N=(3, 56) newDFR:$newName/Wave=wv
18531854
endif
18541855

18551856
wv = ""
@@ -2078,6 +2079,10 @@ Function/Wave GetSweepSettingsKeyWave(panelTitle)
20782079
wv[%Units][54] = LABNOTEBOOK_BINARY_UNIT
20792080
wv[%Tolerance][54] = LABNOTEBOOK_NO_TOLERANCE
20802081

2082+
wv[%Parameter][55] = "Epochs version"
2083+
wv[%Units][55] = "a. u."
2084+
wv[%Tolerance][55] = "1"
2085+
20812086
SetSweepSettingsDimLabels(wv, wv)
20822087
SetWaveVersion(wv, versionOfNewWave)
20832088

Packages/Testing-MIES/UTF_Epochs.ipf

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ static Constant OTHER_EPOCHS_PRECISION = 0.050
1010
static Constant MAX_ITERATIONS = 100000
1111

1212
/// @brief Acquire data with the given DAQSettings on two headstages
13-
static Function AcquireData(s, devices, stimSetName1, stimSetName2[, dDAQ, oodDAQ, onsetDelayUser, terminationDelay])
13+
static Function AcquireData(s, devices, stimSetName1, stimSetName2[, dDAQ, oodDAQ, onsetDelayUser, terminationDelay, analysisFunction])
1414
STRUCT DAQSettings& s
1515
string devices
16-
string stimSetName1, stimSetName2
16+
string stimSetName1, stimSetName2, analysisFunction
1717
variable dDAQ, oodDAQ, onsetDelayUser, terminationDelay
1818

1919
string unlockedPanelTitle, device
@@ -76,6 +76,9 @@ static Function AcquireData(s, devices, stimSetName1, stimSetName2[, dDAQ, oodDA
7676
PASS()
7777
endfor
7878

79+
ST_SetStimsetParameter(stimsetName1, "Analysis function (Generic)", str = analysisFunction)
80+
ST_SetStimsetParameter(stimsetName2, "Analysis function (Generic)", str = analysisFunction)
81+
7982
device = devices
8083

8184
#ifdef TESTS_WITH_YOKING

0 commit comments

Comments
 (0)