add_col(crate, cratedata);
- crate - input crate
- cratedata - CrateData object to be added
The add_col command adds the column to the crate. If the
column already exists in the crate, it is replaced.
The command returns a "1" if the column is successfully added.
The column is only added to the crate. The write_file
("ahelp write_file")
command can be used to save the modified crate to a file.
slsh> cr = read_file("evt2.fits");
slsh> print (get_col_names(cr));
['CHANNEL' 'E_MIN' 'E_MAX']
slsh> emin = copy_colvals(cr, "E_MIN");
slsh> emax = copy_colvals(cr, "E_MAX");
slsh> emid = 0.5 * (emin + emax);
slsh> col = CrateData();
slsh> col.name = "E_MID";
slsh> py_call(col.load, emid, 1);
1
slsh> add_col(cr, col);
1
slsh> print (get_col_names(cr));
['CHANNEL' 'E_MIN' 'E_MAX' 'E_MID']
Here we create a column called E_MID, whose values are the
mid-points of the E_MIN and E_MAX columns, and then add it
to the crate.
The syntax for adding data to a column - namely
py_call(col.load, <values>, 1)
- will be improved in a later release.
See the
bug pages
on the CIAO website for an up-to-date listing of known bugs.
- sl.crates
-
add_image,
add_key,
col_exists,
copy_colvals,
delete_col,
delete_image,
delete_key,
get_col,
get_col_names,
get_colvals,
get_number_cols,
is_virtual,
print_col_names,
read_arf,
read_file,
read_pha,
read_rmf,
set_colvals,
write_arf,
write_file,
write_pha,
write_rmf
- sl.crates_contrib
-
make_table_crate,
write_columns
|