#pragma rtGlobals=1 // Use modern global access method. Menu "Single Spectrum" "Load Plot smooth single File...", LoadAndGraphXYa("", "") End Function LoadAndGraphXYa(fileName, pathName) String fileName // Name of file to load or "" to get dialog String pathName // Name of path or "" to get dialog // Load the waves and set the globals LoadWave/G/A/E=1/D/O/P=$pathName fileName if (V_flag==0) // No waves loaded. Perhaps user canceled. return -1 endif Display // Create a new graph String sxw, syw, szw Variable index=0 Variable tt, dtt, lamda, alpha lamda= 803.506 //3508.61 is theoritical value of peak.. alpha =652.3 // 652.3 is practical value of peak taken from spectrum tt = 1/(1/3508.61 + 1/lamda) dtt = tt-alpha do // Now append waves to graph sxw=StringFromList(index, S_waveNames) // Next name if (strlen(sxw) == 0) // No more? break // break out of loop endif syw=StringFromList(index+1, S_waveNames)// Next name Wave xw = $sxw // Create wave references. Wave yw = $syw SetScale d 0, 0, "", xw // Set x wave's units SetScale d 0, 0, "", yw // Set y wave's units String newName = NameOfWave(yw) + "_out" // Compute output wave name Duplicate/O yw, $newName // Create output wave Wave wOut = $newName // Create wave reference for output wave //wOut += 1 AppendToTable wOut AppendToGraph yw vs xw xw = xw + dtt xw = 10^7/xw -10^7/803.506 // Smooth/M=20 5, yw;DelayUpdate WMMedianXYIM#MedianXY(xw,yw,20,"medianWave",threshold=10);DelayUpdate String newName1 = NameOfWave(yw) + "_medianWave" // Compute output wave name Duplicate/O medianWave, $newName1 // Create output wave Wave wOutsmooth = $newName1 // Create wave reference for output wave AppendToTable wOutsmooth Display wOutsmooth vs wave0;Delayupdate index += 2 while (1) // Unconditionally loop back up to “do” // Annotate graph Textbox/A=LT "File: " + S_fileName return 0 // Signifies success. End