Skip to content

Commit

Permalink
Merge pull request #1958 from AllenInstitute/bugfix/1958-returned-swe…
Browse files Browse the repository at this point in the history
…ep-list-backport

DB: fix DB_GetPlainSweepList return sweeps sorted
  • Loading branch information
t-b authored Dec 13, 2023
2 parents fc56d88 + da1f53f commit f85d45e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 24 deletions.
34 changes: 21 additions & 13 deletions Packages/MIES/MIES_AnalysisFunctionHelpers.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -180,23 +180,31 @@ End
Function AFH_GetLastSweepAcquired(device)
string device

string list, name
variable numItems, i, sweep
WAVE/Z sweeps = AFH_GetSweeps(device)

list = GetListOfObjects(GetDeviceDataPath(device), DATA_SWEEP_REGEXP)
list = SortList(list, ";", 1 + 16) // descending and case-insensitive alphanumeric
if(!WaveExists(sweeps))
return NaN
endif

numItems = ItemsInList(list)
for(i = 0; i < numItems; i += 1)
name = StringFromList(i, list)
sweep = ExtractSweepNumber(name)
return sweeps[inf]
End

if(WaveExists(GetSweepWave(device, sweep)))
return sweep
endif
endfor
/// @brief Return a numeric wave with all acquired sweep numbers, $"" if there is none
Function/WAVE AFH_GetSweeps(string device)
string list

return NaN
DFREF dfr = GetDeviceDataPath(device)

list = GetListOfObjects(dfr, DATA_SWEEP_REGEXP)

if(IsEmpty(list))
return $""
endif

Make/FREE/R/N=(ItemsInList(list)) sweeps = ExtractSweepNumber(StringFromList(p, list))
Sort sweeps, sweeps

return sweeps
End

/// @brief Return the sweep wave of the last acquired sweep
Expand Down
13 changes: 2 additions & 11 deletions Packages/MIES/MIES_DataBrowser.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -333,24 +333,15 @@ End
Function/WAVE DB_GetPlainSweepList(win)
string win

string device, list
DFREF dfr
string device

if(!BSP_HasBoundDevice(win))
return $""
endif

device = BSP_GetDevice(win)
dfr = GetDeviceDataPath(device)
list = GetListOfObjects(dfr, DATA_SWEEP_REGEXP)

if(IsEmpty(list))
return $""
endif

Make/FREE/R/N=(ItemsInList(list)) sweeps = ExtractSweepNumber(StringFromList(p, list))

return sweeps
return AFH_GetSweeps(device)
End

Function DB_UpdateLastSweepControls(win, first, last)
Expand Down

0 comments on commit f85d45e

Please sign in to comment.