wrsamp - write WFDB signal files
wrsamp [ options ... ] column
...
wrsamp reads text-format input and writes the specified columns
in WFDB signal file format 16 (see signal(5)
), either to the standard output
or to a disk file (see the -o option below).
Normally, wrsamp's input is line-
and column-oriented, with line separator characters (usually ASCII linefeeds)
separating input lines, and field separator characters (usually spaces
or tabs) separating columns within each line. Columns need not be of constant
width; the only requirement is that one or more field separator characters
appear between adjacent columns. The output of rdsamp(1)
is an example of
an acceptable input format.
Lines are identified by line number. The first
line of input is line 0. Similarly, columns are identified by column number,
and the leftmost column is column 0. Columns may be selected in any order,
and any given column may be selected more than once, or omitted. The order
of column arguments determines the order of the signals in the output (data
from the first column specified are written as signal 0, etc.) If an entry
in a specified column is missing or improperly formatted, wrsamp produces
a warning message identifying the line and column numbers, and inserts
a zero in the output in place of the missing or improperly formatted sample.
Options include:
- -c
- Check that each input line contains the same number
of fields. (This test is normally disabled, to allow for input files containing
preambles, trailers, or occasional extra fields not intended to be read
as samples.)
- -f n
- Start copying with line n. By default, wrsamp starts at
the beginning of its standard input (line 0).
- -F n
- Specify the sampling frequency
(in samples per second per signal) for the output signals (default: 250).
This option is useful only in conjunction with -o, since it affects the
output header file only. This option has no effect on the output signal
file, which contains one sample per signal for each line of input. If you
wish to change the sampling frequency in the signal file, see xform(1)
.
- -G n
- Specify the gain (in A/D units per millivolt) for the output signals
(default: 200). This option is useful only in conjunction with -o, since
it affects the output header file only. This option has no effect on the
output signal file. If you wish to rescale samples in the signal file,
use -x.
- -h
- Print a usage summary.
- -i file
- Read input from the specified file
(default: standard input).
- -l n
- Read up to n characters in each line (default:
1024). Longer lines are truncated (with a warning message identifying the
line number of the offending line).
- -o record
- Write the signal file in the
current directory as record.dat, and create a header file in the current
directory for the specified record. By default, wrsamp writes the signal
file to its standard output in format 16 (see signal(5)
), and does not
create a header file.
- -r c
- Interpret c as the input line separator (default:
\n, the ASCII linefeed character). This option may be useful, for example,
to read Macintosh files containing carriage-return delimited lines. Note
that no special treatment is required for files containing both carriage
returns and linefeeds.
- -s c
- Interpret c as the input field separator (default:
both spaces and tabs are treated as input field separators). If this option
is used, c is the only character treated as a field separator.
- -t n
- Stop
copying at line n (line n is not processed). By default, wrsamp stops when
it reaches the end of file on its standard input.
- -x n
- Multiply all input
samples by n (default: 1) before writing them to the output signal file.
It may be necessary to set and export the shell variable WFDB
(see setwfdb(1)
).
rdsamp -r 100s | wrsamp -o 100w -F 360 1 2
This command creates a record named `100w' that is a copy of record `100s'
(although the signal file format is different). If the -F 360 option were
omitted, the output signal file (`100w.dat') would be unchanged, but the header
file for record `100w' would indicate that the sampling frequency was (the
default) 250 Hz, rather than 360 Hz as in record 100s; this is because
wrsamp has no other way of determining the sampling frequency of its input.
Note that columns 1 and 2 of wrsamp's input correspond to signals 0 and
1 respectively; column 0 is the sample number, not useful to wrsamp.
rdsamp(1)
, setwfdb(1)
, xform(1)
, signal(5)
George B. Moody (george@mit.edu)
http://www.physionet.org/physiotools/wfdb/app/wrsamp.c
Table of Contents
Up: WFDB Applications Guide
Please e-mail your comments and suggestions to webmaster@physionet.org, or post them to:
PhysioNet
MIT Room E25-505A
77 Massachusetts Avenue
Cambridge, MA 02139 USA
Updated 17 October 2003