Skip to content

Commit e29e3d3

Browse files
authored
Merge pull request #1050 from AllenInstitute/feature/1050-add-more-ttl-entries
Add "Set cycle count" LBN entry for TTL channels
2 parents 52e53d9 + ac8ff84 commit e29e3d3

File tree

3 files changed

+33
-4
lines changed

3 files changed

+33
-4
lines changed

Packages/MIES/MIES_DataConfigurator.ipf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1751,6 +1751,7 @@ static Function DC_ITC_MakeTTLWave(panelTitle, rackNo)
17511751
string stimSetWaveNote = ""
17521752
string stimSetchecksum = ""
17531753
string stimSetLength = ""
1754+
string setCycleCounts = ""
17541755

17551756
WAVE statusTTLFiltered = DC_GetFilteredChannelState(panelTitle, DATA_ACQUISITION_MODE, CHANNEL_TYPE_TTL)
17561757

@@ -1786,6 +1787,7 @@ static Function DC_ITC_MakeTTLWave(panelTitle, rackNo)
17861787
if(!statusTTLFiltered[i])
17871788
if(i >= first && i <= last)
17881789
setSweepCounts = AddListItem("", setSweepCounts, ";", inf)
1790+
setCycleCounts = AddListItem("", setCycleCounts, ";", inf)
17891791
endif
17901792

17911793
indexingEndStimset = AddListItem("", indexingEndStimset, ";", inf)
@@ -1814,17 +1816,20 @@ static Function DC_ITC_MakeTTLWave(panelTitle, rackNo)
18141816
bit = 2^(i - first)
18151817
MultiThread TTLWave[0, lastIdx] += bit * TTLStimSet[p][col]
18161818
setSweepCounts = AddListItem(num2str(col), setSweepCounts, ";", inf)
1819+
setCycleCounts = AddListItem(num2str(setCycleCount), setCycleCounts, ";", inf)
18171820
endif
18181821
endfor
18191822

18201823
if(rackNo == RACK_ZERO)
18211824
sweepDataLNB[0][%$"TTL rack zero bits"][INDEP_HEADSTAGE] = bits
18221825
sweepDataTxTLNB[0][%$"TTL rack zero stim sets"][INDEP_HEADSTAGE] = listOfSets
18231826
sweepDataTxTLNB[0][%$"TTL rack zero set sweep counts"][INDEP_HEADSTAGE] = setSweepCounts
1827+
sweepDataTxTLNB[0][%$"TTL rack zero set cycle counts"][INDEP_HEADSTAGE] = setCycleCounts
18241828
else
18251829
sweepDataLNB[0][%$"TTL rack one bits"][INDEP_HEADSTAGE] = bits
18261830
sweepDataTxTLNB[0][%$"TTL rack one stim sets"][INDEP_HEADSTAGE] = listOfSets
18271831
sweepDataTxTLNB[0][%$"TTL rack one set sweep counts"][INDEP_HEADSTAGE] = setSweepCounts
1832+
sweepDataTxTLNB[0][%$"TTL rack one set cycle counts"][INDEP_HEADSTAGE] = setCycleCounts
18281833
endif
18291834

18301835
sweepDataTxTLNB[0][%$"TTL Indexing End stimset"][INDEP_HEADSTAGE] = indexingEndStimset
@@ -1845,6 +1850,7 @@ static Function DC_NI_MakeTTLWave(panelTitle)
18451850
string stimSetWaveNote = ""
18461851
string stimSetChecksum = ""
18471852
string stimSetLength = ""
1853+
string setCycleCounts = ""
18481854

18491855
WAVE statusTTLFiltered = DC_GetFilteredChannelState(panelTitle, DATA_ACQUISITION_MODE, CHANNEL_TYPE_TTL)
18501856
WAVE/T allSetNames = DAG_GetChannelTextual(panelTitle, CHANNEL_TYPE_TTL, CHANNEL_CONTROL_WAVE)
@@ -1858,6 +1864,7 @@ static Function DC_NI_MakeTTLWave(panelTitle)
18581864
if(!statusTTLFiltered[i])
18591865
listOfSets = AddListItem("", listOfSets, ";", inf)
18601866
setSweepCounts = AddListItem("", setSweepCounts, ";", inf)
1867+
setCycleCounts = AddListItem("", setCycleCounts, ";", inf)
18611868
channels = AddListItem("", channels, ";", inf)
18621869
indexingEndStimset = AddListItem("", indexingEndStimset, ";", inf)
18631870
stimSetWaveNote = AddListItem("", stimSetWaveNote, ";", inf)
@@ -1875,6 +1882,7 @@ static Function DC_NI_MakeTTLWave(panelTitle)
18751882

18761883
listOfSets = AddListItem(set, listOfSets, ";", inf)
18771884
setSweepCounts = AddListItem(num2str(col), setSweepCounts, ";", inf)
1885+
setCycleCounts = AddListItem(num2str(setCycleCount), setCycleCounts, ";", inf)
18781886
channels = AddListItem(num2str(i), channels, ";", inf)
18791887
indexingEndStimset = AddListItem(allSetNamesIndexingEnd[i], indexingEndStimset, ";", inf)
18801888
stimSetWaveNote = AddListItem(URLEncode(note(TTLStimSet)), stimSetWaveNote, ";", inf)
@@ -1889,6 +1897,7 @@ static Function DC_NI_MakeTTLWave(panelTitle)
18891897
sweepDataTxTLNB[0][%$"TTL channels"][INDEP_HEADSTAGE] = channels
18901898
sweepDataTxTLNB[0][%$"TTL stim sets"][INDEP_HEADSTAGE] = listOfSets
18911899
sweepDataTxTLNB[0][%$"TTL set sweep counts"][INDEP_HEADSTAGE] = setSweepCounts
1900+
sweepDataTxTLNB[0][%$"TTL set cycle counts"][INDEP_HEADSTAGE] = setCycleCounts
18921901
sweepDataTxTLNB[0][%$"TTL Indexing End stimset"][INDEP_HEADSTAGE] = indexingEndStimset
18931902
sweepDataTxTLNB[0][%$"TTL Stimset wave note"][INDEP_HEADSTAGE] = stimSetWaveNote
18941903
sweepDataTxTLNB[0][%$"TTL Stim Wave Checksum"][INDEP_HEADSTAGE] = stimSetChecksum

Packages/MIES/MIES_WaveDataFolderGetters.ipf

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2223,6 +2223,9 @@ End
22232223
/// - 36: TTL Stim Wave Checksum (hardware agnostic) URL-encoded payload, see [URL-encoding](https://en.wikipedia.org/wiki/Percent-encoding)
22242224
/// for background information, same string list formatting
22252225
/// - 37: TTL Stim set length (hardware agnostic), same string list formatting
2226+
/// - 38: TTL rack zero set cycle counts (ITC hardware)
2227+
/// - 39: TTL rack one set cycle counts (ITC hardware)
2228+
/// - 40: TTL set cycle counts (NI hardware), string list in `INDEP_HEADSTAGE` layer with empty entries indexed by [0, NUM_DA_TTL_CHANNELS[
22262229
Function/Wave GetSweepSettingsTextKeyWave(panelTitle)
22272230
string panelTitle
22282231

@@ -2241,9 +2244,9 @@ Function/Wave GetSweepSettingsTextKeyWave(panelTitle)
22412244
if(ExistsWithCorrectLayoutVersion(wv, versionOfNewWave))
22422245
return wv
22432246
elseif(WaveExists(wv))
2244-
Redimension/N=(-1, 38, 0) wv
2247+
Redimension/N=(-1, 41, 0) wv
22452248
else
2246-
Make/T/N=(1, 38) newDFR:$newName/Wave=wv
2249+
Make/T/N=(1, 41) newDFR:$newName/Wave=wv
22472250
endif
22482251

22492252
SetDimLabel ROWS, 0, Parameter, wv
@@ -2288,6 +2291,9 @@ Function/Wave GetSweepSettingsTextKeyWave(panelTitle)
22882291
wv[0][35] = "TTL Stimset wave note"
22892292
wv[0][36] = "TTL Stim Wave Checksum"
22902293
wv[0][37] = "TTL Stim set length"
2294+
wv[0][38] = "TTL rack zero set cycle counts"
2295+
wv[0][39] = "TTL rack one set cycle counts"
2296+
wv[0][40] = "TTL set cycle counts"
22912297

22922298
SetSweepSettingsDimLabels(wv, wv)
22932299
SetWaveVersion(wv, versionOfNewWave)

Packages/Testing-MIES/UTF_BasicHardwareTests.ipf

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2467,15 +2467,15 @@ End
24672467

24682468
// Using unassociated channels works
24692469
// UTF_TD_GENERATOR HardwareMain#DeviceNameGeneratorMD1
2470-
Function UnassociatedChannels([str])
2470+
Function UnassociatedChannelsAndTTLs([str])
24712471
string str
24722472

24732473
STRUCT DAQSettings s
24742474
InitDAQSettingsFromString(s, "MD1_RA0_I0_L0_BKG_1_RES_1")
24752475
AcquireData(s, str, preAcquireFunc = EnableUnassocChannels_IGNORE)
24762476
End
24772477

2478-
Function UnassociatedChannels_REENTRY([str])
2478+
Function UnassociatedChannelsAndTTLs_REENTRY([str])
24792479
string str
24802480

24812481
string device, sweeps, configs, unit, expectedStr
@@ -2596,6 +2596,17 @@ Function UnassociatedChannels_REENTRY([str])
25962596
else
25972597
CHECK_WAVE(sweepCounts, NULL_WAVE)
25982598
endif
2599+
2600+
// set cycle count
2601+
WAVE/T/Z cycleCounts = GetLastSetting(textualValues, j, "TTL rack zero set cycle counts", DATA_ACQUISITION_MODE)
2602+
CHECK_EQUAL_TEXTWAVES(cycleCounts, {"", "", "", "", "", "", "", "", ";0;;0;"})
2603+
WAVE/T/Z cycleCounts = GetLastSetting(textualValues, j, "TTL rack one set cycle counts", DATA_ACQUISITION_MODE)
2604+
if(HW_ITC_GetNumberOfRacks(device) > 1)
2605+
CHECK_EQUAL_TEXTWAVES(cycleCounts, {"", "", "", "", "", "", "", "", ";0;;0;"})
2606+
else
2607+
CHECK_WAVE(cycleCounts, NULL_WAVE)
2608+
endif
2609+
25992610
break
26002611
case HARDWARE_NI_DAC:
26012612
CHECK_EQUAL_WAVES(TTLs, {1, 3}, mode = WAVE_DATA)
@@ -2609,6 +2620,9 @@ Function UnassociatedChannels_REENTRY([str])
26092620
WAVE/T/Z sweepCounts = GetLastSetting(textualValues, j, "TTL set sweep counts", DATA_ACQUISITION_MODE)
26102621
CHECK_EQUAL_TEXTWAVES(sweepCounts, {"", "", "", "", "", "", "", "", ";0;;0;;;;;"})
26112622

2623+
WAVE/T/Z cycleCounts = GetLastSetting(textualValues, j, "TTL set cycle counts", DATA_ACQUISITION_MODE)
2624+
CHECK_EQUAL_TEXTWAVES(cycleCounts, {"", "", "", "", "", "", "", "", ";0;;0;;;;;"})
2625+
26122626
break
26132627
endswitch
26142628

0 commit comments

Comments
 (0)