# Copyright (c) 2002 Peter Guntert. All rights reserved. ## 7MACROS: window - apply commonly used window functions ## ## Usage: window cos ## window cos2 ## window exp ## window gauss ## window hamming ## window hanning ## window sin ## window sin2 ## ## window is a standard macro that applies commonly used window functions, ## i.e. the data points s(k) (k = 1,...,n) are multiplied by a function f(t): ## ## window function f(t) remarks ## ------------- ------------------ --------------------------- ## cos cos(pi/2*t) cosine window ## cos2 cos(pi/2*t)**2 cosine squared window ## exp exp(-pi*L*n*d*t) exponential line broadening ## gauss exp(-pi*L*n*d*t*(1-t/(2*G)) Gauss-Lorentz window ## hamming 0.54+0.46*cos(pi*t) Hamming window ## hanning 0.5+0.5*cos(pi*t) "Hanning" window ## sin

sin(r-(r-pi)*t) shifted sine window ## sin2

sin(r-(r-pi)*t)**2 shifted sine squared window ## ## Parameters: pi = 3.14159... ## n number of data points ## t = (k-1)/n for data point k (k = 1,...,n) ## L line broadening parameter (in Hz) ## d value of the system variable delta, which should be ## set to the time increment (in s) between data points ## G the Gauss-Lorentz window has a maximum at t = G ## p shift in degrees ## r = p*pi/180 ## ## See also: multiply if (nparam.lt.1) error "*** Error: Missing parameter." p1 := '$p1' if (p1.eq.'cos') then multiply cos(pi/(2*n)*(k-1)) else if (p1.eq.'cos2') then multiply cos(pi/(2*n)*(k-1))**2 else if (p1.eq.'exp') then p2 = -p2*pi*delta(active) multiply exp(p2*(k-1)) else if (p1.eq.'gauss') then p2 = -p2*pi*delta(active) p3 = 0.5/(p3*n) multiply exp(p2*(k-1)*(1.0-p3*(k-1))) else if (p1.eq.'hamming') then multiply 0.54+0.46*cos(pi/n*(k-1)) else if (p1.eq.'hanning') then multiply 0.5+0.5*cos(pi/n*(k-1)) else if (p1.eq.'sin') then p2 = p2*pi/180.0 multiply sin(p2-(p2-pi)/n*(k-1)) else if (p1.eq.'sin2') then p2 = p2*pi/180.0 multiply sin(p2-(p2-pi)/n*(k-1))**2 else error "*** Error: Illegal window function \"$p1\"." end if