Hi Thomas,
I'm not sure OriginC's fft_bandpass() function is fully implemented in Origin 7.5 but the following approach seems to work in SR5...
1. Open CodeBuilder and select File > New.
2. Select C File on the list at left.
3. Check the Add to Workspace and Fill with Default Contents options.
4. Enter a filename and path, then click OK.
5. Insert #Include <fft_utils.h> under the line #Include <Origin.h> near the top of the new file.
6. Scroll to the bottom, enter a new line and paste the following bandpass filter function to the file.
7. Select File > Open, check the Add to Workspace option at the bottom of the dialog and open the file fft_utils.c in the OriginC\OriginLab subfolder on Origin's program path.
8. Select Tools > Rebuild All to compile. If you get a compiler error apply the SR5 patch and try again.
9. Close CodeBuilder and execute by typing run_fft_bandpass(dFLow, dFHigh) in the script window and pressing Enter. (dFLow and dFHigh are the low and high cutoff frequencies.) The function will filter all Y columns in the active worksheet.// Bandpass filter for LabTalk
int run_fft_bandpass(double dFLow, double dFHigh)
{
Worksheet wks = Project.ActiveLayer();
if( !wks )
{
out_str("A worksheet must be active.");
return 1;
}
int iErr;
for(int i=1;i<wks.GetNumCols();i++)
{
if(wks.Columns(i).GetType()==OKDATAOBJ_DESIGNATION_Y)
{
Curve crv(wks,i);
iErr = fft_bandpass(crv, dFLow, dFHigh);
if(iErr<0) break;
}
}
switch(iErr)
{
case -3:
out_str("Invalid cutoff frequency.");
break;
case -2:
out_str("Invalid curve.");
break;
case -1:
out_str("Curve does not meet time resolution criterion.");
default:
break;
}
return iErr;
}
Mike Buess
Origin WebRing Member
Edited by - Mike Buess on 11/30/2005 1:49:39 PM