File = ~/sas/p/downws.f Instructions for compilations see below.
Processes a "down-weight block" on *.INS file (unit iuins)
A down-weight block consists of records comprising a
header
and a number
of instructions. The header is used to identify an
instruction
set,
matching its name with the target parameter.
The header must start with "Downweig" at column
1
followed
by the
name of the block. The name can be an asterisk as a
wild-card.
The instructions tell how to down-weight data, incl.
application
of a
data window on the whole length of the records. The data
may include
the signal model array.
Down-weighting of sections of bad data may be combined
with
a smooth
transition of weights (cosine-type).
Target - char** -
to
locate the instruction section. If empty, a lonely
"Downweig" is searched for.
Keep
string short, six to eight chars.
IUINS - integer -
instruction
file unit
Display - char** - If 'W'
and file data, call display_ts weights
B(M,N) -
real*8
- signal model (design matrix)
Y(M) -
real*8 - data
N
-
integer - 0: no down-weight on B, down-weight on Y;
no
window on B nor Y; overrules Block instruction.
<0:
down-weight on Y, optional window on Y.
>0:
down-weight (and window) on N columns of B and
on Y.
MU
-
integer - signal length
EFFW -
real*8
- returned: factor to be applied on RMS(Y_returned)
to
achieve unity gain of weighting process.
wrk(nwrk) - real*8 - work
space
Line#
Instruction
Explanation
-------------------------------------------------------------------------
1 Down-weight [name]
[; comment]
Code
from column 1, spell exactly this way!
(DOWNWEIG or downweig or Downweig)
name - Optional instruction block identifier
A
named block will be processed iff
Target
is found in name.
name=* to suppress name search.
[ 2.1 [ ?DT | !DT ] [ RDC ] F[=operator]: lu,trg,recmrs,fmt,khms,itz,lddf
Sampling
interval, file unit, read and
filter
options.
File
is processed with Proc_f_on_rec
(cf.
~hgs/sas/p/urtapu13.f),
weighting
is carried out with Mult_ts_ts
(cf.
~hgs/sas/p/sasu061.f).
?DT - check compatible sampling rate
!DT - impose data's DT on weight series.
RDC - remove DC-level in residual series
before
downweighting.
Is
often necessary !
F= - codeword
operator - operator is passed to mult_ts_ts:
/ - divide (else: multiply).
Q - take square root of
file
value.
0 - return weighted data with
zero
DC level.
Additional
instruction records might be
needed
due to filter options (due to lddf)
[ 2.2... SPEC cmd p=value [p=value...]
Optionally
under 2.1, modification commands can be added. They
are
interpreted and processed in subroutine modify_weights
at
the end of downws.f The weight series read in under 2.1 is
modified.
SPEC (codeword) must appear in column 1.
Commands cmd under SPEC:
MOD: P=period T=residual_time W=factor
Modulus
function. Applies factor on weight(i) if
mod(
t0+i*dt, period ) = residual_time
(test
accuracy is period/10).
Thus,
every midnight value can be downweighted with
a
factor of 10:
SPEC MOD: P=24.d0 T=0.d0 W=10.d0
..............................................................................................2.2] 2.1]
3.1 nw [RDC ][..W=type [..P=window params] [..Normal..]] [..T=length] [..[1/]V[=weight] [WS!]]
nw - number of records following.
RDC - remove DC-level codeword.
If
given, DC-bias is removed from
data
array before window is applied.
W= - window codeword.
type - window type-code (e.g. HANQ).
P= - parameter codeword; design
parameters
for KAIS, DOCH and
delayed-taper
windows.
Normal - codeword. Designates that window is
applied
in Normal Equations only.
Else:
window is applied also on
residuals.
If
windows and residuals are to be
weighted
differently, the instruction
block
for the residuals must appear
last.
T= - taper codeword
length - cosine taper of down-weighted
section,
transition length.
Taper
is within the limits indicated
on
the record lines 3...
V= - Weight value codeword
weight - weight value
1/V - Inverse weights (sigma) codeword;
applies
to weight values on this
record
line or on record lines 3..
WS! - Codeword, request to compensate the weight
sum.
If not given, the weight value
has
direct bearing on the Chi^2
as
is usually desired.
WS! does not have any effect on
the
weight sum of record lines 3..
.. - any text. Total length of
instruction:
80 chars.
3.2...
nw
weight records. Individual down-weighting of outliers or sections
of
input
record with different variance.
One
of three types of downweight records selections:
3.2.1 yyyy mm dd hh mm ss l w
3.2.2 ... From yyyy
mm
dd
hh mm ss [ff] To yyyy
mm
dd
hh mm ss [ff] V=w
or
...
All V=w
3.2.3 # p l w
yyyy..ss ff - date, time, fraction of second
p - sample position
l - length (number of samples).
w - weight value.
For linking the following order of references is needed:
-L~/sas/p -lsas -l[no]grasas
-lsas