Skip to content

Commit f18fe00

Browse files
authored
Merge pull request #2376 from AllenInstitute/bugfix/2376-psx-support-multiple-selections-only-that
PSX multiple selections (only that)
2 parents 405cb7d + 5941ef4 commit f18fe00

File tree

5 files changed

+300
-102
lines changed

5 files changed

+300
-102
lines changed

Packages/MIES/MIES_Cache.ipf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,8 @@ static Function/S CA_WaveCRCs(WAVE/WAVE waveRefs, [variable crcMode, variable in
308308

309309
variable rows
310310

311+
ASSERT(IsWaveRefWave(waveRefs), "Expected a wave reference wave")
312+
311313
if(ParamIsDefault(crcMode))
312314
crcMode = 0
313315
endif

Packages/MIES/MIES_SweepFormula_Helpers.ipf

Lines changed: 48 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,8 +1122,8 @@ Function/WAVE SFH_NewSelectDataWave(variable numSweeps, variable numChannels)
11221122
return selectData
11231123
End
11241124

1125-
/// @brief Recreate a **single** select data wave and range stored in the JSON wavenote from SFH_GetSweepsForFormula()
1126-
Function [WAVE selectData, WAVE range] SFH_ParseToSelectDataWaveAndRange(WAVE sweepData)
1125+
/// @brief Parse the range stored in the JSON wavenote from SFH_GetSweepsForFormula()
1126+
Function/WAVE SFH_ParseSweepDataRange(WAVE sweepData)
11271127

11281128
WAVE/Z range = JWN_GetNumericWaveFromWaveNote(sweepData, SF_META_RANGE)
11291129

@@ -1132,6 +1132,18 @@ Function [WAVE selectData, WAVE range] SFH_ParseToSelectDataWaveAndRange(WAVE sw
11321132
endif
11331133

11341134
if(!WaveExists(range) || !HasOneValidEntry(range))
1135+
return $""
1136+
endif
1137+
1138+
return range
1139+
End
1140+
1141+
/// @brief Recreate a **single** select data wave and range stored in the JSON wavenote from SFH_GetSweepsForFormula()
1142+
Function [WAVE selectData, WAVE range] SFH_ParseToSelectDataWaveAndRange(WAVE sweepData)
1143+
1144+
WAVE/Z range = SFH_ParseSweepDataRange(sweepData)
1145+
1146+
if(!WaveExists(range))
11351147
return [$"", $""]
11361148
endif
11371149

@@ -1478,6 +1490,24 @@ Function/WAVE SFH_GetStimsetRange(string graph, WAVE data, WAVE selectData)
14781490
return range
14791491
End
14801492

1493+
Function [WAVE adaptedRange, WAVE/T epochRangeNames] SFH_GetNumericRangeFromEpochFromSingleSelect(string graph, WAVE singleSelectData, WAVE range)
1494+
1495+
variable sweepNo, chanNr, chanType, mapIndex
1496+
1497+
sweepNo = singleSelectData[0][%SWEEP]
1498+
chanNr = singleSelectData[0][%CHANNELNUMBER]
1499+
chanType = singleSelectData[0][%CHANNELTYPE]
1500+
mapIndex = singleSelectData[0][%SWEEPMAPINDEX]
1501+
1502+
WAVE/Z numericalValues = SFH_GetLabNoteBookForSweep(graph, sweepNo, mapIndex, LBN_NUMERICAL_VALUES)
1503+
WAVE/Z textualValues = SFH_GetLabNoteBookForSweep(graph, sweepNo, mapIndex, LBN_TEXTUAL_VALUES)
1504+
SFH_ASSERT(WaveExists(textualValues) && WaveExists(numericalValues), "LBN not found for sweep " + num2istr(sweepNo))
1505+
1506+
[WAVE resolvedRanges, WAVE/T epochRangeNames] = SFH_GetNumericRangeFromEpoch(graph, numericalValues, textualValues, range, sweepNo, chanType, chanNr, mapIndex)
1507+
1508+
return [resolvedRanges, epochRangeNames]
1509+
End
1510+
14811511
/// @brief From a single numeric/textual range wave we return a 2xN numeric range
14821512
///
14831513
/// Supports numeric ranges, epochs, and epochs with wildcards.
@@ -1691,27 +1721,34 @@ Function/WAVE SFH_MoveDatasetHigherIfCompatible(WAVE/WAVE data)
16911721
return data
16921722
End
16931723

1694-
Function/WAVE SFH_GetSingleSelect(string graph, string opShort, variable sweepNo, variable channelType, variable channelNumber, variable mapIndex)
1695-
1696-
WAVE/WAVE range = SFH_AsDataSet(SFH_GetFullRange())
1697-
WAVE singleSelect = SFH_NewSelectDataWave(1, 1)
1698-
singleSelect[0][%SWEEP] = sweepNo
1699-
singleSelect[0][%CHANNELTYPE] = channelType
1700-
singleSelect[0][%CHANNELNUMBER] = channelNumber
1701-
singleSelect[0][%SWEEPMAPINDEX] = mapIndex
1724+
Function/WAVE SFH_CreateSelectDataComp(string graph, string opShort, WAVE singleSelect, WAVE range)
17021725

17031726
WAVE/WAVE selectDataComp = GetSFSelectDataComp(graph, opShort)
17041727
JWN_SetStringInWaveNote(selectDataComp, SF_META_DATATYPE, SF_DATATYPE_SELECTCOMP)
17051728
JWN_SetStringInWaveNote(singleSelect, SF_META_DATATYPE, SF_DATATYPE_SELECT)
17061729
JWN_SetStringInWaveNote(range, SF_META_DATATYPE, SF_DATATYPE_SELECTRANGE)
17071730
selectDataComp[%SELECTION] = singleSelect
1708-
selectDataComp[%RANGE] = range
1731+
selectDataComp[%RANGE] = SFH_AsDataSet(range)
17091732

17101733
Make/FREE/WAVE selectDataArray = {selectDataComp}
17111734

17121735
return selectDataArray
17131736
End
17141737

1738+
Function/WAVE SFH_GetSingleSelect(string graph, string opShort, variable sweepNo, variable channelType, variable channelNumber, variable mapIndex)
1739+
1740+
WAVE range = SFH_GetFullRange()
1741+
WAVE singleSelect = SFH_NewSelectDataWave(1, 1)
1742+
singleSelect[0][%SWEEP] = sweepNo
1743+
singleSelect[0][%CHANNELTYPE] = channelType
1744+
singleSelect[0][%CHANNELNUMBER] = channelNumber
1745+
singleSelect[0][%SWEEPMAPINDEX] = mapIndex
1746+
1747+
WAVE selectDataArray = SFH_CreateSelectDataComp(graph, opShort, singleSelect, range)
1748+
1749+
return selectDataArray
1750+
End
1751+
17151752
Function/S SFH_GetStimsetName(WAVE numericalValues, WAVE textualValues, variable sweepNo, variable channelNumber, variable channelType)
17161753

17171754
variable index

0 commit comments

Comments
 (0)