#pragma rtGlobals=2 // Use modern global access method. #include Function GetInputWave() // This function pops up an "Open File" dialog for a single wave. // In the context of this program it's used to select the IRF data file. // Declares some variables, slaps a title on the box. Variable refNum String message = "Select the IRF data file" String outputPath String fileFilters = "Data Files (*.txt,*.dat,*.csv):.txt,.dat,.csv;" fileFilters += "All Files:.*;" // This is the actual dialog box here. Open /D /R /F=fileFilters /M=message refNum outputPath = S_fileName // Checks to see if the operation was cancelled. // Otherwise, this uses the LoadWave function on the input file. // The output will be wave(# of regular waves) due to the order in which this is called. // In this case for example this will name the wave "wave2". if (strlen(outputPath) == 0) Print "Cancelled" return 0 else LoadWave/G/M/D/N=waveIRF outputPath return 1 endif End Function GetInputWaves(rWave1) // This function pops up an "Open File" dialog for multiple waves. // At this point this function is built to handle as many input files as you want. // The program, however, is built to deal with two waves and an IRF wave, so don't exceed that. // In the context of this program it's used to select the two actual data files. // Declares some variables. Wave/WAVE rWave1 Variable refNum String message = "Select two electron scatter data files:" String outputPaths String fileFilters = "Data Files (*.txt,*.dat,*.csv):.txt,.dat,.csv;" fileFilters += "All Files:.*;" // Here's the dialog box again. The filename output is a delimted list of the chosen files. Open /D /R /MULT=1 /F=fileFilters /M=message refNum outputPaths = S_fileName // Checks to see if it was cancelled, otherwise performs a LoadWave function per file. // The output will be wave0, wave1, wave2, ..., wave(n-1). // In this case the output waves will be wave0 and wave1. if (strlen(outputPaths) == 0) Print "Cancelled" return 0 else Variable numFilesSelected = ItemsInList(outputPaths, "\r") Variable i for(i=0; i j) j = V_Max endif endfor SetAxis/W=Convolutions left (j/100),(j+10) // Convolution curve fits. for (i=0;i