Chandra X-Ray Observatory
	(CXC)
Skip to the navigation links
Last modified: 13 March 2017

Why is the column moved to the end of the table when I try to update it in place?


Columns that existed in the input file that are modified in the output file are treated like new columns by dmtcalc and new columns are added by default at the end of the file. For example:

unix% dmlist input.fits cols
...
  10   energy               eV           Real4          0:  1000000.0        nominal energy of event (eV)
  11   pi                   chan         Int4           1:1024               pulse invariant energy of event
  12   fltgrade                          Int2           0:255                event grade, flight system
  13   grade                             Int2           0:7                  binned event grade
  14   status[4]                         Bit(4)                              event status bits
...

unix% dmtcalc infile="input.fits" outfile="output.fits" expression="energy=((float)pha)*0.1"

unix% dmlist output.fits cols
...
  10   pi                   chan         Int4           1:1024               pulse invariant energy of event
  11   fltgrade                          Int2           0:255                event grade, flight system
  12   grade                             Int2           0:7                  binned event grade
  13   status[4]                         Bit(4)                              event status bits
  14   ENERGY                            Real8          -Inf:+Inf            User defined column
...

The name of the energy column in the output file is in upper case (no matter what its case is in the input file) since its values have been changed.

If you would like to reorder the columns after running the tool, dmcopy the file with a list of columns in the desired order (note that this method will only copy the specified columns):

unix% dmcopy "output.fits[cols time,pha,energy,pi]" reordered.fits

unix% dmlist reordered.fits cols
 
--------------------------------------------------------------------------------
Columns for Table Block EVENTS
--------------------------------------------------------------------------------
 
ColNo  Name                 Unit        Type             Range
   1   time                 s            Real8          84244214.7546979934: 84253882.0425609946 S/C TT corresponding to mid-exposure
   2   pha                  adu          Int4           0:36855              total pulse height of event
   3   ENERGY                            Real8          -Inf:+Inf            User defined column
   4   pi                   chan         Int4           1:1024               pulse invariant energy of event

Note that FITS files and the software that reads them generally do not care about the order of the columns.



Last modified: 13 March 2017
Smithsonian Institute Smithsonian Institute

The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory. 60 Garden Street, Cambridge, MA 02138 USA.   Email:   cxchelp@head.cfa.harvard.edu Smithsonian Institution, Copyright © 1998-2017. All rights reserved.