GCVSPL was implemented based on the following article:
H.J. Woltring (1986), A FORTRAN package for generalized, cross-validatory spline smoothing and differentiation. Advances in Engineering Software 8(2):104-113 (U.K.).
The command is used like all other filter commands in Visual3D.
For example, to filter all TARGET signals in the ACTIVE FILES.
GCVSPL /SIGNAL_TYPES=TARGET ! /SIGNAL_NAMES= ! /SIGNAL_FOLDER=ORIGINAL ! /SIGNAL_COMPONENTS= ! /RESULT_FOLDER=PROCESSED ! /EVENT_SEQUENCE= ! /EXCLUDE_EVENTS= ! /NUM_SPLINE_ORDER=2 ! /ERROR_VARIANCE=0.01 ! /OPTIMIZATION_MODE=3 ! /DERIVATIVE_ORDER=0 ! /MAX_GAP=0 ! /FILL_GAPS=FALSE ;
1 = linear 2 = cubic 3 = quintic 4 = heptic splines.
0 = an interpolating spline is calculated. <0 & Optimization Mode= 2 the smoothing parameter is determined by minimizing the Generalized Cross-Validation function >0 & Optimization Mode= 1 the smoothing parameter is specified by the variance >0 & Optimization Mode= 3 the smoothing parameter is determined so as to minimize an estimate of the true mean squared error, which depends on the variance. Woltring's optimization mode= 4 has not been implemented.
The default value of the error variance is 0.01
This default value was set many years ago and in retrospect was not the ideal choice. In order to maintain backwards compatibility, we cannot modify the default. The recommended value of the error variance is 0.0001 m^2
The relationship between the variance and the cutoff frequency was declared here:
Isbweb.org and further described here: From Biomch-L
First account for a pass butterworth filter (e.g. a fourth order butterworth filter) Modified_cut_off_freq= cut_off_freq / 0.802 Variance = sampling_freq/(2*PI*Modified_cut_off_freq)^(2*order)
Create a SIN wave
Filter the SIN wave with a cutoff frequency equal to the SIN wave frequency
The resulting signal should have a magnitude (1/sqrt(2)) times the original magnitude.
And should yield the same result as a LOWPASS filter with a 12 Hz cutoff
An example test script in Visual3D
! create a 12 Hz SIN wave at the ANALOG frequency of the file opened in the Visual3D workspace. Set_Pipeline_Parameter_From_Expression /PARAMETER_NAME=CUTOFF /EXPRESSION= 12/0.802 /AS_INTEGER=FALSE ; Set_Pipeline_Parameter_From_Expression /PARAMETER_NAME=VARIANCE /EXPRESSION=PARAMETERS::ANALOG::RATE/(2*pi()*&::CUTOFF&)^4 /AS_INTEGER=FALSE ; Evaluate_Expression /EXPRESSION=SIN(2*PI()*12*FRAME_NUMBERS::ORIGINAL::ANALOGTIME) ! /SIGNAL_TYPES= ! /SIGNAL_FOLDER=ORIGINAL ! /SIGNAL_NAMES= /RESULT_TYPES=DERIVED /RESULT_FOLDERS=PROCESSED /RESULT_NAME=SCOTT ! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE ; GCVSPL /SIGNAL_TYPES=DERIVED /SIGNAL_FOLDER=PROCESSED /SIGNAL_NAMES=SCOTT ! /SIGNAL_COMPONENTS= /RESULT_FOLDERS=FILTERED ! /EVENT_SEQUENCE= ! /EXCLUDE_EVENTS= ! /NUM_SPLINE_ORDER=2 /ERROR_VARIANCE=::VARIANCE ! /OPTIMIZATION_MODE=1 ! /DERIVATIVE_ORDER=0 ! /MAX_GAP=0 ! /FILL_GAPS=FALSE ; Lowpass_Filter /SIGNAL_TYPES=DERIVED /SIGNAL_FOLDER=PROCESSED /SIGNAL_NAMES=SCOTT /RESULT_FOLDER=LOWPASS ! /RESULT_SUFFIX= ! /FILTER_CLASS=BUTTERWORTH /FREQUENCY_CUTOFF=12 /NUM_REFLECTED=0 ! /NUM_EXTRAPOLATED=0 /TOTAL_BUFFER_SIZE=0 ! /NUM_BIDIRECTIONAL_PASSES=1 ;
The ISB website contains the following information on the algorithm
For large datasets (N ยป 0) and negligible boundary artefacts, the behaviour of a natural spline approximates that of a periodic spline. For the latter case, the frequency characteristic in the equidistantly sampled, uniformly weighted case is that of a double, phase-symmetric Butterworth filter, with transfer function H(w) = [1 + (w/wo)^2M]^-1, where w is the frequency, wo = (p*T)^(-0.5/M) the filter's cut-off frequency, p the smoothing parameter, T the sampling interval, and 2M the order of the spline. If T is expressed in seconds, the frequen- cies are expressed in radians/second.
It has been found empirically, that the effective number of estimated spline parameters Np is related to the Butterworth cut-off frequency wo as Np ~ M/2 + KM * wo * N * T, where Np ranges between M and N, and where KM is the integral over x from 0 to infinity of (1 + x^2M)^-1 divided by PI. For large M, KM approaches 1/PI from above; values for small M are: K1 = 1/2, K2 = 1/V8, K3 = 1/3. This relation has also been found to apply for uniformly weighted data which are sampled slightly anequidistantly, with T taken as the average sampling inter- val. For large Np, the relation with wo * N * T becomes nonlinear.