|AHELP for CIAO 4.2||
Write a crate to an output file.
- crate - input crate
- filename - name of the output file
The write_file command creates an output file for the input crate, overwriting any existing file with the same name. This command may be used with any type of crate. The command returns a "1" if the file is written successfully.
The write_arf, write_pha, and write_rmf routines can be used when the type of the dataset is known.
chips> cr = read_file("evt2.fits"); chips> delete_key(cr, "FILTER"); 1 chips> write_file(cr, "edit.fits"); 1
Delete the FILTER keyword from the crate, then write the crate to file edit.fits.
chips> cr = read_file("tbl.dat"); chips> x = copy_colvals(cr, "x"); chips> y = copy_colvals(cr, "y"); chips> z = sqrt(x^2 + y^2); chips> cd = CrateData; chips> cd.name = "z"; chips> py_call (cd.load, z, 1); 1 chips> add_col(cr, cd); 1 chips> write_file(cr, "tbl2.dat[opt kernel=text/simple]"); 1
In this example we read in the file tbl.dat, extract the x and y columns and create a new column, called z, from these values. This new column is added to the crate and then the crate is written out to the file tbl2.dat. The addition of the Data Model option "[opt kernel=text/simple]" ensures that the output is a text file (see "ahelp dmopt" and "ahelp dmascii" for more information on options and the ASCII file support in CIAO).
If the input file looked like:
unix% cat tbl.dat # x y 1 2 3 5 9 10
then the output file will look like:
unix% cat tbl2.dat #TEXT/SIMPLE # x y z 1.0 2.0 2.236067977500 3.0 5.0 5.830951894845 9.0 10.0 13.45362404707
See the bug pages on the CIAO website for an up-to-date listing of known bugs.