-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSNR3View.ipf
69 lines (59 loc) · 1.76 KB
/
SNR3View.ipf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68<
6F66
/div>
69
#pragma TextEncoding = "MacRoman"
#pragma rtGlobals=3 // Use modern global access method and strict wave access.
Menu "Macros"
"Load SNR txt files", SNRLoadAndDisplay()
End
Function SNRLoadAndDisplay()
SNRTXTLoader()
DisplaySNRsForAll()
End
Function SNRTXTLoader()
NewDataFolder/O/S root:data
String expDiskFolderName, expDataFolderName
String FileList, ThisFile, wavenames, wName, MTwave, wList
Variable FileLoop, nWaves, i
NewPath/O/Q/M="Please find disk folder" ExpDiskFolder
if (V_flag!=0)
DoAlert 0, "Disk folder error"
Return -1
endif
PathInfo /S ExpDiskFolder
ExpDiskFolderName=S_path
FileList = IndexedFile(expDiskFolder,-1,".txt")
Variable nFiles = ItemsInList(FileList)
for (FileLoop = 0; FileLoop < nFiles; FileLoop += 1)
ThisFile = StringFromList(FileLoop, FileList)
expDataFolderName = ReplaceString("SNR.txt",ThisFile,"") // get rid of SNR.txt
NewDataFolder/O/S $expDataFolderName
LoadWave/A/J/D/O/K=1/W/L={0,1,0,1,0}/P=expDiskFolder ThisFile
SetDataFolder root:data:
endfor
End
Function DisplaySNRsForAll()
SetDataFolder root:data: // relies on earlier load
DFREF dfr = GetDataFolderDFR()
String folderName, wName, newName, plotName
String wList = ""
Variable numDataFolders = CountObjectsDFR(dfr, 4)
DoWindow/K allPlot
Display/N=allPlot
Variable i
for(i = 0; i < numDataFolders; i += 1)
folderName = GetIndexedObjNameDFR(dfr, 4, i)
wName = ":" + folderName + ":SNR"
newName = wName + "wave"
wList += newName + ";"
Duplicate/O $wName $newName
Wave/Z w = $newName
WaveTransform zapnans w
plotName = folderName + "_plot"
DoWindow/K $plotName
Display/N=$plotName/HIDE=1 w
if(numpnts(w) > 0)
AppendToGraph/W=allPlot w
endif
endfor
Print wlist
Concatenate/O wList, allSNRwave
SetDataFolder root:
End