18jun12 in xspec/2012/zpup_rgs/grouping/ (but older sas11 version, directory may move) the upshot is it looks like Vero's code is tuned to the structure of ciao pha files (where, e.g., there are columns for the low and high wavelengths of each bin; whereas for xmm pha files, the wavelength solution appears to be encoded analytically in the header). Aside from this, it looks like the first thing to do is to run mrdfits to read the pha file into a structure: IDL> data = mrdfits("acisf00638_000N003_repro_pha2.fits",1,head) IDL> help,data,/struct ** Structure <87a9d24>, 13 tags, length=229392, data length=229392, refs=1: SPEC_NUM INT 1 TG_M INT -3 TG_PART INT 1 TG_SRCID INT 1 X FLOAT 4070.49 Y FLOAT 4162.05 CHANNEL INT Array[8192] COUNTS INT Array[8192] STAT_ERR FLOAT Array[8192] BACKGROUND_UP INT Array[8192] BACKGROUND_DOWN INT Array[8192] BIN_LO DOUBLE Array[8192] BIN_HI DOUBLE Array[8192] IDL> data = mrdfits("r1m1_grp_min40.pha",1,head) MRDFITS: Binary table. 6 columns by 3600 rows. IDL> help,data,/struct ** Structure <87a7a7c>, 6 tags, length=20, data length=20, refs=1: CHANNEL LONG 1 COUNTS LONG 0 QUALITY INT 1 GROUPING INT 1 AREASCAL FLOAT 0.00000 BACKSCAL FLOAT 0.00000 Here the help.../struct functionality shows that chandra and xmm pha files have pretty different column structures Note also that individal variables in a structure can be accessed using structure.variable syntax: IDL> print, data.grouping 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 1 1 -1 1 1 -1 1 1 -1 1 -1 1 -1 1 1 -1 1 1 1 -1 1 -1 1 -1 1 -1 1 1 1 -1 1 1 -1 1 1 1 1 1 -1 1 -1 1 -1 1 -1 1 -1 1 1 -1 1 1 1 -1 1 -1 1 1 1 1 1 1 1 -1 1 1 1 1 1 -1 1 -1 1 1 -1 1 1 1 1 1 1 1 1 Here we see that for the RGS data file, the grouping column (made with grppha) is just 1 and -1 (showing group boundaries?)