sread

Name

swrite -- Write spectrum contents to file.

Synopsis

swrite -format fmt file spec1 ?spec2 ... ?

DESCRIPTION

Writes one or more spectra either to a file specified by name or a file opened with the Tcl open command.

Writes the spectra specified by spec1... specn to file. The spectra are written in the order they are specified. The optional -format switch indicates that the next parameter specifies the file format. The file parameter specifies the file to which the spectrum will be written. The file parameter can be:

OPTIONS

The -format option describes how the file will be written. See the sread command for more information about the file formats. THere are two formats (each has two names):

ascii, nsclascii

An ASCII format. Each spectrum consists of a header and a set of lines containing channel coordinate/value pairs for all nonzero channels in the spectrum.

binary nsclbinary

SMAUG binary format. This format is not recommended unless you have old SMAUG analysis tools you intend to use on the files.

EXAMPLES

Example 1. Writing spectra to file by filename


swrite -format ascii somespectra.spc  raw.00 raw.01 raw02                
            

Three psectra are written to file into the file somespectra.spc.

Example 2. Writing to a file descriptor


set fd [open "|gzip  > somespectra.gz" w]
swrite -format ascii $fd raw.00 raw.01 raw.02
            

The spectra are written to a pipeline created by the Tcl open command that compresses them using gzip into a file name somepsectra.gz. Note that the open command will require the spaces before and after the output redirection character (>) unlike bash.

SEE ALSO