from pycrates import *
import sys
import io
import os
import unittest
import warnings 
from collections import OrderedDict
import numpy as np

warnings.simplefilter("ignore", Warning)

class TestPyCratesHeader(unittest.TestCase):

    expected0 = "OrderedDict([('ASCDSVER',    Name:   ASCDSVER\n   Value:  \n   Unit:   \n   Desc:   ASCDS version number\n   Groups: ['BASIC', 'EVENT', 'NONSI', 'C_1', 'C_B', 'C_E']\n), ('ASPTYPE',    Name:   ASPTYPE\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('BITPIX',    Name:   BITPIX\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['M_1', 'M_2', 'M_3', 'M_4']\n), ('BTIMCORR',    Name:   BTIMCORR\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_2', 'T_B', 'T_E']\n), ('BTIMDRFT',    Name:   BTIMDRFT\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_2', 'T_B', 'T_E']\n), ('BTIMNULL',    Name:   BTIMNULL\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_2', 'T_B', 'T_E']\n), ('BTIMRATE',    Name:   BTIMRATE\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_2', 'T_B', 'T_E']\n), ('CHECKSUM',    Name:   CHECKSUM\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'C_1', 'C_2', 'C_3', 'C_B', 'C_E', 'C_P']\n), ('CLOCKAPP',    Name:   CLOCKAPP\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_4', 'T_B', 'T_E', 'T_P']\n), ('CONTENT',    Name:   CONTENT\n   Value:  \n   Unit:   What data product\n   Desc:   \n   Groups: ['C_1', 'C_2']\n), ('CREATOR',    Name:   CREATOR\n   Value:  \n   Unit:   \n   Desc:   Tool that created this output\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'C_1', 'C_2', 'C_3', 'C_B', 'C_E', 'C_P']\n), ('CTI_APP',    Name:   CTI_APP\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('CTI_CORR',    Name:   CTI_CORR\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('CYCLE',    Name:   CYCLE\n   Value:  \n   Unit:   \n   Desc:   events from which exps? Prim/Second/Both\n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('DATACLAS',    Name:   DATACLAS\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('DATAMODE',    Name:   DATAMODE\n   Value:  \n   Unit:   \n   Desc:   Data mode (OBSERVING or NEXT-IN-LINE)\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('DATASUM',    Name:   DATASUM\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'C_1', 'C_2', 'C_3', 'C_B', 'C_E', 'C_P']\n), ('DATE',    Name:   DATE\n   Value:  \n   Unit:   \n   Desc:   Date and time of file creation\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_4', 'T_B', 'T_E', 'T_P']\n), ('DATE-END',    Name:   DATE-END\n   Value:  \n   Unit:   \n   Desc:   Date and time of observation stop\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_4', 'T_B', 'T_E', 'T_P']\n), ('DATE-OBS',    Name:   DATE-OBS\n   Value:  \n   Unit:   \n   Desc:   Date and time of observation start\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_4', 'T_B', 'T_E', 'T_P']\n), ('DEC_NOM',    Name:   DEC_NOM\n   Value:  0.0\n   Unit:   deg\n   Desc:   Nominal Dec\n   Groups: ['BASIC', 'EVENT', 'O_2', 'O_B', 'O_E']\n), ('DEC_PNT',    Name:   DEC_PNT\n   Value:  0.0\n   Unit:   deg\n   Desc:   Pointing Dec\n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('DEC_TARG',    Name:   DEC_TARG\n   Value:  0.0\n   Unit:   deg\n   Desc:   Target Dec\n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('DEFOCUS',    Name:   DEFOCUS\n   Value:  0.0\n   Unit:   mm\n   Desc:   Defocus\n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('DETNAM',    Name:   DETNAM\n   Value:  \n   Unit:   \n   Desc:   Detector\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('DS_IDENT',    Name:   DS_IDENT\n   Value:  \n   Unit:   \n   Desc:   dataset identifier\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'O_1', 'O_3', 'O_B', 'O_E', 'O_P']\n), ('DTCOR',    Name:   DTCOR\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('DTH_AVG',    Name:   DTH_AVG\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('DY_AVG',    Name:   DY_AVG\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('DZ_AVG',    Name:   DZ_AVG\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('END',    Name:   END\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['M_1', 'M_2', 'M_3', 'M_4']\n), ('EQUINOX',    Name:   EQUINOX\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_2', 'O_B', 'O_E']\n), ('EXPOSURE',    Name:   EXPOSURE\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('EXTEND',    Name:   EXTEND\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['M_1', 'M_2']\n), ('EXTNAME',    Name:   EXTNAME\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['M_3', 'M_4']\n), ('EXTVER',    Name:   EXTVER\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['M_3', 'M_4']\n), ('FLSHTIME',    Name:   FLSHTIME\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_B', 'T_E']\n), ('FOC_LEN',    Name:   FOC_LEN\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('FP_TEMP',    Name:   FP_TEMP\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('GCOUNT',    Name:   GCOUNT\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['M_3', 'M_4']\n), ('GRATING',    Name:   GRATING\n   Value:  NONE\n   Unit:   \n   Desc:   Grating (HETG,LETG,or NONE)\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('HDUCLAS1',    Name:   HDUCLAS1\n   Value:  \n   Unit:   \n   Desc:   \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'C_1', 'C_2', 'C_B', 'C_E']\n), ('HDUCLAS2',    Name:   HDUCLAS2\n   Value:  \n   Unit:   \n   Desc:   \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'C_1', 'C_2', 'C_B', 'C_E']\n), ('HDUCLAS3',    Name:   HDUCLAS3\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'C_1', 'C_2', 'C_B', 'C_E']\n), ('HDUCLASS',    Name:   HDUCLASS\n   Value:  \n   Unit:   \n   Desc:   \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'C_1', 'C_2', 'C_B', 'C_E']\n), ('HDUDOC',    Name:   HDUDOC\n   Value:  \n   Unit:   \n   Desc:   ASC FITS Designers Guide\n   Groups: ['C_1', 'C_2']\n), ('HDUNAME',    Name:   HDUNAME\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['C_1', 'C_2']\n), ('HDUSPEC',    Name:   HDUSPEC\n   Value:  \n   Unit:   \n   Desc:   \n   Groups: ['C_1']\n), ('HDUVERS',    Name:   HDUVERS\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['C_1', 'C_2']\n), ('INSTRUME',    Name:   INSTRUME\n   Value:  \n   Unit:   \n   Desc:   Aspect Camera\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'O_1', 'O_3', 'O_4', 'O_B', 'O_E', 'O_P']\n), ('LIVETIME',    Name:   LIVETIME\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('LONGSTRN',    Name:   LONGSTRN\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['C_1']\n), ('MISSION',    Name:   MISSION\n   Value:  AXAF\n   Unit:   \n   Desc:   Advanced X-Ray Astrophysics Facility\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'O_1', 'O_3', 'O_4', 'O_B', 'O_E', 'O_P']\n), ('MJDREF',    Name:   MJDREF\n   Value:  50814.0\n   Unit:   d\n   Desc:   1998-01-01T00:00:00 (TT) expressed in MJD\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_4', 'T_B', 'T_E', 'T_P']\n), ('MJD-OBS',    Name:   MJD-OBS\n   Value:  0.0\n   Unit:   d\n   Desc:   Modified Julian date of observation\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_4', 'T_B', 'T_E', 'T_P']\n), ('NAXIS',    Name:   NAXIS\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['M_1', 'M_2', 'M_3', 'M_4']\n), ('NAXIS1',    Name:   NAXIS1\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['M_1', 'M_3', 'M_4']\n), ('NAXIS2',    Name:   NAXIS2\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['M_1', 'M_3', 'M_4']\n), ('OBI_NUM',    Name:   OBI_NUM\n   Value:  0\n   Unit:   \n   Desc:   Obi number\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'O_B', 'O_E', 'O_P']\n), ('OBJECT',    Name:   OBJECT\n   Value:  \n   Unit:   \n   Desc:   Source name\n   Groups: ['BASIC', 'EVENT', 'O_2', 'O_B', 'O_E']\n), ('OBSERVER',    Name:   OBSERVER\n   Value:  \n   Unit:   \n   Desc:   Principal investigator\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('OBS_ID',    Name:   OBS_ID\n   Value:  \n   Unit:   \n   Desc:   Observation id\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'O_1', 'O_3', 'O_B', 'O_E', 'O_P']\n), ('OBS_MODE',    Name:   OBS_MODE\n   Value:  \n   Unit:   \n   Desc:   Observation mode (GROUND,POINTING,or SLEW)\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('ONTIME',    Name:   ONTIME\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('ORIGIN',    Name:   ORIGIN\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'C_1', 'C_2', 'C_3', 'C_B', 'C_E', 'C_P']\n), ('PCOUNT',    Name:   PCOUNT\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['M_3', 'M_4']\n), ('RADESYS',    Name:   RADESYS\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_2', 'O_B', 'O_E']\n), ('RAND_PI',    Name:   RAND_PI\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('RAND_SKY',    Name:   RAND_SKY\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('RAND_TG',    Name:   RAND_TG\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('RA_NOM',    Name:   RA_NOM\n   Value:  0.0\n   Unit:   deg\n   Desc:   Nominal RA\n   Groups: ['BASIC', 'EVENT', 'O_2', 'O_B', 'O_E']\n), ('RA_PNT',    Name:   RA_PNT\n   Value:  0.0\n   Unit:   deg\n   Desc:   Pointing RA\n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('RA_TARG',    Name:   RA_TARG\n   Value:  0.0\n   Unit:   deg\n   Desc:   Target RA\n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('READMODE',    Name:   READMODE\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('REVISION',    Name:   REVISION\n   Value:  0\n   Unit:     \n   Desc:   Processing system revision number\n   Groups: ['BASIC', 'EVENT', 'NONSI', 'C_1', 'C_B', 'C_E']\n), ('ROLL_NOM',    Name:   ROLL_NOM\n   Value:  0.0\n   Unit:   deg\n   Desc:   Nominal Roll\n   Groups: ['BASIC', 'EVENT', 'O_2', 'O_B', 'O_E']\n), ('ROLL_PNT',    Name:   ROLL_PNT\n   Value:  0.0\n   Unit:   deg\n   Desc:   Pointing Roll\n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('SEQ_NUM',    Name:   SEQ_NUM\n   Value:  \n   Unit:   \n   Desc:   Sequence number\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'O_1', 'O_3', 'O_B', 'O_E', 'O_P']\n), ('SHYMINUS',    Name:   SHYMINUS\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['EVENT', 'O_E']\n), ('SHYPLUS',    Name:   SHYPLUS\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['EVENT', 'O_E']\n), ('SIMPLE',    Name:   SIMPLE\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['M_1', 'M_2']\n), ('SIM_X',    Name:   SIM_X\n   Value:  0.0\n   Unit:   mm\n   Desc:   SIM offset\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('SIM_Y',    Name:   SIM_Y\n   Value:  0.0\n   Unit:   mm\n   Desc:   SIM offset\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('SIM_Z',    Name:   SIM_Z\n   Value:  0.0\n   Unit:   mm\n   Desc:   SIM offset\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('STARTMJF',    Name:   STARTMJF\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_B', 'T_E']\n), ('STARTMNF',    Name:   STARTMNF\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_B', 'T_E']\n), ('STARTOBT',    Name:   STARTOBT\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_B', 'T_E']\n), ('STOPMJF',    Name:   STOPMJF\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_B', 'T_E']\n), ('STOPMNF',    Name:   STOPMNF\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_B', 'T_E']\n), ('TASSIGN',    Name:   TASSIGN\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_B', 'T_E']\n), ('TELESCOP',    Name:   TELESCOP\n   Value:  CHANDRA\n   Unit:   \n   Desc:   Telescope\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'O_1', 'O_3', 'O_4', 'O_B', 'O_E', 'O_P']\n), ('TFIELDS',    Name:   TFIELDS\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['M_3']\n), ('TIERABSO',    Name:   TIERABSO\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_B', 'T_E']\n), ('TIERRELA',    Name:   TIERRELA\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_B', 'T_E']\n), ('TIMEDEL',    Name:   TIMEDEL\n   Value:  0.0\n   Unit:   s\n   Desc:   \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_B', 'T_E']\n), ('TIMEPIXR',    Name:   TIMEPIXR\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_B', 'T_E']\n), ('TIMEREF',    Name:   TIMEREF\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_B', 'T_E']\n), ('TIMESYS',    Name:   TIMESYS\n   Value:  TT\n   Unit:   \n   Desc:   AXAF time will be TT (Terrestrial Time)\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_4', 'T_B', 'T_E', 'T_P']\n), ('TIMEUNIT',    Name:   TIMEUNIT\n   Value:  s\n   Unit:   \n   Desc:   \n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_4', 'T_B', 'T_E', 'T_P']\n), ('TIMEZERO',    Name:   TIMEZERO\n   Value:  0.0\n   Unit:   s\n   Desc:   Cumulative clock correction\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_4', 'T_B', 'T_E', 'T_P']\n), ('TIMVERSN',    Name:   TIMVERSN\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_B', 'T_E']\n), ('TITLE',    Name:   TITLE\n   Value:  \n   Unit:   \n   Desc:   Proposal title\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('TLMVER',    Name:   TLMVER\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['EVENT', 'C_1', 'C_E']\n), ('TLM_FMT',    Name:   TLM_FMT\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['EVENT', 'O_E']\n), ('TSTART',    Name:   TSTART\n   Value:  0.0\n   Unit:   s\n   Desc:   As in TIME column: raw S/C clock\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_4', 'T_B', 'T_E', 'T_P']\n), ('TSTOP',    Name:   TSTOP\n   Value:  0.0\n   Unit:   s\n   Desc:   add TIMEZERO and MJDREF for absolute TT\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_4', 'T_B', 'T_E', 'T_P']\n), ('XTENSION',    Name:   XTENSION\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['M_3', 'M_4']\n)])"

    expected1 = "OrderedDict([('ASCDSVER',    Name:   ASCDSVER\n   Value:  \n   Unit:   \n   Desc:   ASCDS version number\n   Groups: ['BASIC', 'EVENT', 'NONSI', 'C_1', 'C_B', 'C_E']\n), ('ASPTYPE',    Name:   ASPTYPE\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('BTIMCORR',    Name:   BTIMCORR\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_2', 'T_B', 'T_E']\n), ('BTIMDRFT',    Name:   BTIMDRFT\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_2', 'T_B', 'T_E']\n), ('BTIMNULL',    Name:   BTIMNULL\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_2', 'T_B', 'T_E']\n), ('BTIMRATE',    Name:   BTIMRATE\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_2', 'T_B', 'T_E']\n), ('CHECKSUM',    Name:   CHECKSUM\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'C_1', 'C_2', 'C_3', 'C_B', 'C_E', 'C_P']\n), ('CLOCKAPP',    Name:   CLOCKAPP\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_4', 'T_B', 'T_E', 'T_P']\n), ('CREATOR',    Name:   CREATOR\n   Value:  \n   Unit:   \n   Desc:   Tool that created this output\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'C_1', 'C_2', 'C_3', 'C_B', 'C_E', 'C_P']\n), ('CTI_APP',    Name:   CTI_APP\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('CTI_CORR',    Name:   CTI_CORR\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('CYCLE',    Name:   CYCLE\n   Value:  \n   Unit:   \n   Desc:   events from which exps? Prim/Second/Both\n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('DATACLAS',    Name:   DATACLAS\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('DATAMODE',    Name:   DATAMODE\n   Value:  \n   Unit:   \n   Desc:   Data mode (OBSERVING or NEXT-IN-LINE)\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('DATASUM',    Name:   DATASUM\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'C_1', 'C_2', 'C_3', 'C_B', 'C_E', 'C_P']\n), ('DATE',    Name:   DATE\n   Value:  \n   Unit:   \n   Desc:   Date and time of file creation\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_4', 'T_B', 'T_E', 'T_P']\n), ('DATE-END',    Name:   DATE-END\n   Value:  \n   Unit:   \n   Desc:   Date and time of observation stop\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_4', 'T_B', 'T_E', 'T_P']\n), ('DATE-OBS',    Name:   DATE-OBS\n   Value:  \n   Unit:   \n   Desc:   Date and time of observation start\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_4', 'T_B', 'T_E', 'T_P']\n), ('DEC_NOM',    Name:   DEC_NOM\n   Value:  0.0\n   Unit:   deg\n   Desc:   Nominal Dec\n   Groups: ['BASIC', 'EVENT', 'O_2', 'O_B', 'O_E']\n), ('DEC_PNT',    Name:   DEC_PNT\n   Value:  0.0\n   Unit:   deg\n   Desc:   Pointing Dec\n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('DEC_TARG',    Name:   DEC_TARG\n   Value:  0.0\n   Unit:   deg\n   Desc:   Target Dec\n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('DEFOCUS',    Name:   DEFOCUS\n   Value:  0.0\n   Unit:   mm\n   Desc:   Defocus\n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('DETNAM',    Name:   DETNAM\n   Value:  \n   Unit:   \n   Desc:   Detector\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('DS_IDENT',    Name:   DS_IDENT\n   Value:  \n   Unit:   \n   Desc:   dataset identifier\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'O_1', 'O_3', 'O_B', 'O_E', 'O_P']\n), ('DTCOR',    Name:   DTCOR\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('DTH_AVG',    Name:   DTH_AVG\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('DY_AVG',    Name:   DY_AVG\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('DZ_AVG',    Name:   DZ_AVG\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('EQUINOX',    Name:   EQUINOX\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_2', 'O_B', 'O_E']\n), ('EXPOSURE',    Name:   EXPOSURE\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('FLSHTIME',    Name:   FLSHTIME\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_B', 'T_E']\n), ('FOC_LEN',    Name:   FOC_LEN\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('FP_TEMP',    Name:   FP_TEMP\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('GRATING',    Name:   GRATING\n   Value:  NONE\n   Unit:   \n   Desc:   Grating (HETG,LETG,or NONE)\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('HDUCLAS1',    Name:   HDUCLAS1\n   Value:  \n   Unit:   \n   Desc:   \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'C_1', 'C_2', 'C_B', 'C_E']\n), ('HDUCLAS2',    Name:   HDUCLAS2\n   Value:  \n   Unit:   \n   Desc:   \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'C_1', 'C_2', 'C_B', 'C_E']\n), ('HDUCLAS3',    Name:   HDUCLAS3\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'C_1', 'C_2', 'C_B', 'C_E']\n), ('HDUCLASS',    Name:   HDUCLASS\n   Value:  \n   Unit:   \n   Desc:   \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'C_1', 'C_2', 'C_B', 'C_E']\n), ('INSTRUME',    Name:   INSTRUME\n   Value:  \n   Unit:   \n   Desc:   Aspect Camera\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'O_1', 'O_3', 'O_4', 'O_B', 'O_E', 'O_P']\n), ('LIVETIME',    Name:   LIVETIME\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('MISSION',    Name:   MISSION\n   Value:  AXAF\n   Unit:   \n   Desc:   Advanced X-Ray Astrophysics Facility\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'O_1', 'O_3', 'O_4', 'O_B', 'O_E', 'O_P']\n), ('MJDREF',    Name:   MJDREF\n   Value:  50814.0\n   Unit:   d\n   Desc:   1998-01-01T00:00:00 (TT) expressed in MJD\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_4', 'T_B', 'T_E', 'T_P']\n), ('MJD-OBS',    Name:   MJD-OBS\n   Value:  0.0\n   Unit:   d\n   Desc:   Modified Julian date of observation\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_4', 'T_B', 'T_E', 'T_P']\n), ('OBI_NUM',    Name:   OBI_NUM\n   Value:  0\n   Unit:   \n   Desc:   Obi number\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'O_B', 'O_E', 'O_P']\n), ('OBJECT',    Name:   OBJECT\n   Value:  \n   Unit:   \n   Desc:   Source name\n   Groups: ['BASIC', 'EVENT', 'O_2', 'O_B', 'O_E']\n), ('OBSERVER',    Name:   OBSERVER\n   Value:  \n   Unit:   \n   Desc:   Principal investigator\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('OBS_ID',    Name:   OBS_ID\n   Value:  \n   Unit:   \n   Desc:   Observation id\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'O_1', 'O_3', 'O_B', 'O_E', 'O_P']\n), ('OBS_MODE',    Name:   OBS_MODE\n   Value:  \n   Unit:   \n   Desc:   Observation mode (GROUND,POINTING,or SLEW)\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('ONTIME',    Name:   ONTIME\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('ORIGIN',    Name:   ORIGIN\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'C_1', 'C_2', 'C_3', 'C_B', 'C_E', 'C_P']\n), ('RADESYS',    Name:   RADESYS\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_2', 'O_B', 'O_E']\n), ('RAND_PI',    Name:   RAND_PI\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('RAND_SKY',    Name:   RAND_SKY\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('RAND_TG',    Name:   RAND_TG\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('RA_NOM',    Name:   RA_NOM\n   Value:  0.0\n   Unit:   deg\n   Desc:   Nominal RA\n   Groups: ['BASIC', 'EVENT', 'O_2', 'O_B', 'O_E']\n), ('RA_PNT',    Name:   RA_PNT\n   Value:  0.0\n   Unit:   deg\n   Desc:   Pointing RA\n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('RA_TARG',    Name:   RA_TARG\n   Value:  0.0\n   Unit:   deg\n   Desc:   Target RA\n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('READMODE',    Name:   READMODE\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('REVISION',    Name:   REVISION\n   Value:  0\n   Unit:     \n   Desc:   Processing system revision number\n   Groups: ['BASIC', 'EVENT', 'NONSI', 'C_1', 'C_B', 'C_E']\n), ('ROLL_NOM',    Name:   ROLL_NOM\n   Value:  0.0\n   Unit:   deg\n   Desc:   Nominal Roll\n   Groups: ['BASIC', 'EVENT', 'O_2', 'O_B', 'O_E']\n), ('ROLL_PNT',    Name:   ROLL_PNT\n   Value:  0.0\n   Unit:   deg\n   Desc:   Pointing Roll\n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('SEQ_NUM',    Name:   SEQ_NUM\n   Value:  \n   Unit:   \n   Desc:   Sequence number\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'O_1', 'O_3', 'O_B', 'O_E', 'O_P']\n), ('SIM_X',    Name:   SIM_X\n   Value:  0.0\n   Unit:   mm\n   Desc:   SIM offset\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('SIM_Y',    Name:   SIM_Y\n   Value:  0.0\n   Unit:   mm\n   Desc:   SIM offset\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('SIM_Z',    Name:   SIM_Z\n   Value:  0.0\n   Unit:   mm\n   Desc:   SIM offset\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('STARTMJF',    Name:   STARTMJF\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_B', 'T_E']\n), ('STARTMNF',    Name:   STARTMNF\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_B', 'T_E']\n), ('STARTOBT',    Name:   STARTOBT\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_B', 'T_E']\n), ('STOPMJF',    Name:   STOPMJF\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_B', 'T_E']\n), ('STOPMNF',    Name:   STOPMNF\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_B', 'T_E']\n), ('TASSIGN',    Name:   TASSIGN\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_B', 'T_E']\n), ('TELESCOP',    Name:   TELESCOP\n   Value:  CHANDRA\n   Unit:   \n   Desc:   Telescope\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'O_1', 'O_3', 'O_4', 'O_B', 'O_E', 'O_P']\n), ('TIERABSO',    Name:   TIERABSO\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_B', 'T_E']\n), ('TIERRELA',    Name:   TIERRELA\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_B', 'T_E']\n), ('TIMEDEL',    Name:   TIMEDEL\n   Value:  0.0\n   Unit:   s\n   Desc:   \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_B', 'T_E']\n), ('TIMEPIXR',    Name:   TIMEPIXR\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_B', 'T_E']\n), ('TIMEREF',    Name:   TIMEREF\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_B', 'T_E']\n), ('TIMESYS',    Name:   TIMESYS\n   Value:  TT\n   Unit:   \n   Desc:   AXAF time will be TT (Terrestrial Time)\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_4', 'T_B', 'T_E', 'T_P']\n), ('TIMEUNIT',    Name:   TIMEUNIT\n   Value:  s\n   Unit:   \n   Desc:   \n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_4', 'T_B', 'T_E', 'T_P']\n), ('TIMEZERO',    Name:   TIMEZERO\n   Value:  0.0\n   Unit:   s\n   Desc:   Cumulative clock correction\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_4', 'T_B', 'T_E', 'T_P']\n), ('TIMVERSN',    Name:   TIMVERSN\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_B', 'T_E']\n), ('TITLE',    Name:   TITLE\n   Value:  \n   Unit:   \n   Desc:   Proposal title\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('TSTART',    Name:   TSTART\n   Value:  0.0\n   Unit:   s\n   Desc:   As in TIME column: raw S/C clock\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_4', 'T_B', 'T_E', 'T_P']\n), ('TSTOP',    Name:   TSTOP\n   Value:  0.0\n   Unit:   s\n   Desc:   add TIMEZERO and MJDREF for absolute TT\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_4', 'T_B', 'T_E', 'T_P']\n)])"


    expected2 = "[('ASCDSVER',    Name:   ASCDSVER\n   Value:  \n   Unit:   \n   Desc:   ASCDS version number\n   Groups: ['BASIC', 'EVENT', 'NONSI', 'C_1', 'C_B', 'C_E']\n), ('BTIMCORR',    Name:   BTIMCORR\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_2', 'T_B', 'T_E']\n), ('BTIMDRFT',    Name:   BTIMDRFT\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_2', 'T_B', 'T_E']\n), ('BTIMNULL',    Name:   BTIMNULL\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_2', 'T_B', 'T_E']\n), ('BTIMRATE',    Name:   BTIMRATE\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_2', 'T_B', 'T_E']\n), ('CHECKSUM',    Name:   CHECKSUM\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'C_1', 'C_2', 'C_3', 'C_B', 'C_E', 'C_P']\n), ('CLOCKAPP',    Name:   CLOCKAPP\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_4', 'T_B', 'T_E', 'T_P']\n), ('CREATOR',    Name:   CREATOR\n   Value:  \n   Unit:   \n   Desc:   Tool that created this output\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'C_1', 'C_2', 'C_3', 'C_B', 'C_E', 'C_P']\n), ('DATASUM',    Name:   DATASUM\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'C_1', 'C_2', 'C_3', 'C_B', 'C_E', 'C_P']\n), ('DATE',    Name:   DATE\n   Value:  \n   Unit:   \n   Desc:   Date and time of file creation\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_4', 'T_B', 'T_E', 'T_P']\n), ('DATE-END',    Name:   DATE-END\n   Value:  \n   Unit:   \n   Desc:   Date and time of observation stop\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_4', 'T_B', 'T_E', 'T_P']\n), ('DATE-OBS',    Name:   DATE-OBS\n   Value:  \n   Unit:   \n   Desc:   Date and time of observation start\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_4', 'T_B', 'T_E', 'T_P']\n), ('DS_IDENT',    Name:   DS_IDENT\n   Value:  \n   Unit:   \n   Desc:   dataset identifier\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'O_1', 'O_3', 'O_B', 'O_E', 'O_P']\n), ('FLSHTIME',    Name:   FLSHTIME\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_B', 'T_E']\n), ('HDUCLAS1',    Name:   HDUCLAS1\n   Value:  \n   Unit:   \n   Desc:   \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'C_1', 'C_2', 'C_B', 'C_E']\n), ('HDUCLAS2',    Name:   HDUCLAS2\n   Value:  \n   Unit:   \n   Desc:   \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'C_1', 'C_2', 'C_B', 'C_E']\n), ('HDUCLAS3',    Name:   HDUCLAS3\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'C_1', 'C_2', 'C_B', 'C_E']\n), ('HDUCLASS',    Name:   HDUCLASS\n   Value:  \n   Unit:   \n   Desc:   \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'C_1', 'C_2', 'C_B', 'C_E']\n), ('INSTRUME',    Name:   INSTRUME\n   Value:  \n   Unit:   \n   Desc:   Aspect Camera\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'O_1', 'O_3', 'O_4', 'O_B', 'O_E', 'O_P']\n), ('MISSION',    Name:   MISSION\n   Value:  AXAF\n   Unit:   \n   Desc:   Advanced X-Ray Astrophysics Facility\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'O_1', 'O_3', 'O_4', 'O_B', 'O_E', 'O_P']\n), ('MJD-OBS',    Name:   MJD-OBS\n   Value:  0.0\n   Unit:   d\n   Desc:   Modified Julian date of observation\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_4', 'T_B', 'T_E', 'T_P']\n), ('MJDREF',    Name:   MJDREF\n   Value:  50814.0\n   Unit:   d\n   Desc:   1998-01-01T00:00:00 (TT) expressed in MJD\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_4', 'T_B', 'T_E', 'T_P']\n), ('OBI_NUM',    Name:   OBI_NUM\n   Value:  0\n   Unit:   \n   Desc:   Obi number\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'O_B', 'O_E', 'O_P']\n), ('OBS_ID',    Name:   OBS_ID\n   Value:  \n   Unit:   \n   Desc:   Observation id\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'O_1', 'O_3', 'O_B', 'O_E', 'O_P']\n), ('ORIGIN',    Name:   ORIGIN\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'C_1', 'C_2', 'C_3', 'C_B', 'C_E', 'C_P']\n), ('REVISION',    Name:   REVISION\n   Value:  0\n   Unit:     \n   Desc:   Processing system revision number\n   Groups: ['BASIC', 'EVENT', 'NONSI', 'C_1', 'C_B', 'C_E']\n), ('SEQ_NUM',    Name:   SEQ_NUM\n   Value:  \n   Unit:   \n   Desc:   Sequence number\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'O_1', 'O_3', 'O_B', 'O_E', 'O_P']\n), ('STARTMJF',    Name:   STARTMJF\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_B', 'T_E']\n), ('STARTMNF',    Name:   STARTMNF\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_B', 'T_E']\n), ('STARTOBT',    Name:   STARTOBT\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_B', 'T_E']\n), ('STOPMJF',    Name:   STOPMJF\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_B', 'T_E']\n), ('STOPMNF',    Name:   STOPMNF\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_B', 'T_E']\n), ('TASSIGN',    Name:   TASSIGN\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_B', 'T_E']\n), ('TELESCOP',    Name:   TELESCOP\n   Value:  CHANDRA\n   Unit:   \n   Desc:   Telescope\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'O_1', 'O_3', 'O_4', 'O_B', 'O_E', 'O_P']\n), ('TIERABSO',    Name:   TIERABSO\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_B', 'T_E']\n), ('TIERRELA',    Name:   TIERRELA\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_B', 'T_E']\n), ('TIMEDEL',    Name:   TIMEDEL\n   Value:  0.0\n   Unit:   s\n   Desc:   \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_B', 'T_E']\n), ('TIMEPIXR',    Name:   TIMEPIXR\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_B', 'T_E']\n), ('TIMEREF',    Name:   TIMEREF\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_B', 'T_E']\n), ('TIMESYS',    Name:   TIMESYS\n   Value:  TT\n   Unit:   \n   Desc:   AXAF time will be TT (Terrestrial Time)\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_4', 'T_B', 'T_E', 'T_P']\n), ('TIMEUNIT',    Name:   TIMEUNIT\n   Value:  s\n   Unit:   \n   Desc:   \n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_4', 'T_B', 'T_E', 'T_P']\n), ('TIMEZERO',    Name:   TIMEZERO\n   Value:  0.0\n   Unit:   s\n   Desc:   Cumulative clock correction\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_4', 'T_B', 'T_E', 'T_P']\n), ('TIMVERSN',    Name:   TIMVERSN\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_B', 'T_E']\n), ('TSTART',    Name:   TSTART\n   Value:  0.0\n   Unit:   s\n   Desc:   As in TIME column: raw S/C clock\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_4', 'T_B', 'T_E', 'T_P']\n), ('TSTOP',    Name:   TSTOP\n   Value:  0.0\n   Unit:   s\n   Desc:   add TIMEZERO and MJDREF for absolute TT\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'T_1', 'T_2', 'T_3', 'T_4', 'T_B', 'T_E', 'T_P']\n)]"

    expected3 = "OrderedDict([('MISSION',    Name:   MISSION\n   Value:  AXAF\n   Unit:   08\n   Desc:   Advanced X-Ray Astrophysics Facility\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'O_1', 'O_3', 'O_4', 'O_B', 'O_E', 'O_P']\n), ('OBS_ID',    Name:   OBS_ID\n   Value:  0473\n   Unit:   09\n   Desc:   Observation id\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'O_1', 'O_3', 'O_B', 'O_E', 'O_P']\n)])"


    expected4 = "OrderedDict([('DATACLAS',    Name:   DATACLAS\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('DATAMODE',    Name:   DATAMODE\n   Value:  \n   Unit:   \n   Desc:   Data mode (OBSERVING or NEXT-IN-LINE)\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('DETNAM',    Name:   DETNAM\n   Value:  \n   Unit:   \n   Desc:   Detector\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('DS_IDENT',    Name:   DS_IDENT\n   Value:  \n   Unit:   \n   Desc:   dataset identifier\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'O_1', 'O_3', 'O_B', 'O_E', 'O_P']\n), ('DTCOR',    Name:   DTCOR\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('DTH_AVG',    Name:   DTH_AVG\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('DY_AVG',    Name:   DY_AVG\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('DZ_AVG',    Name:   DZ_AVG\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('EXPOSURE',    Name:   EXPOSURE\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('FOC_LEN',    Name:   FOC_LEN\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('GRATING',    Name:   GRATING\n   Value:  NONE\n   Unit:   \n   Desc:   Grating (HETG,LETG,or NONE)\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('INSTRUME',    Name:   INSTRUME\n   Value:  \n   Unit:   \n   Desc:   Aspect Camera\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'O_1', 'O_3', 'O_4', 'O_B', 'O_E', 'O_P']\n), ('LIVETIME',    Name:   LIVETIME\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('MISSION',    Name:   MISSION\n   Value:  AXAF\n   Unit:   08\n   Desc:   Advanced X-Ray Astrophysics Facility\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'O_1', 'O_3', 'O_4', 'O_B', 'O_E', 'O_P']\n), ('OBSERVER',    Name:   OBSERVER\n   Value:  \n   Unit:   \n   Desc:   Principal investigator\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('OBS_ID',    Name:   OBS_ID\n   Value:  0473\n   Unit:   09\n   Desc:   Observation id\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'O_1', 'O_3', 'O_B', 'O_E', 'O_P']\n), ('OBS_MODE',    Name:   OBS_MODE\n   Value:  \n   Unit:   \n   Desc:   Observation mode (GROUND,POINTING,or SLEW)\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('ONTIME',    Name:   ONTIME\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('SEQ_NUM',    Name:   SEQ_NUM\n   Value:  \n   Unit:   \n   Desc:   Sequence number\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'O_1', 'O_3', 'O_B', 'O_E', 'O_P']\n), ('SIM_X',    Name:   SIM_X\n   Value:  0.0\n   Unit:   mm\n   Desc:   SIM offset\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('SIM_Y',    Name:   SIM_Y\n   Value:  0.0\n   Unit:   mm\n   Desc:   SIM offset\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('SIM_Z',    Name:   SIM_Z\n   Value:  0.0\n   Unit:   mm\n   Desc:   SIM offset\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('TELESCOP',    Name:   TELESCOP\n   Value:  CHANDRA\n   Unit:   \n   Desc:   Telescope\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'O_1', 'O_3', 'O_4', 'O_B', 'O_E', 'O_P']\n), ('TITLE',    Name:   TITLE\n   Value:  \n   Unit:   \n   Desc:   Proposal title\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n)])"

    expected5 = "OrderedDict([('ASCDSVER',    Name:   ASCDSVER\n   Value:  R4CU5UPD9\n   Unit:   01\n   Desc:   ASCDS version number\n   Groups: []\n), ('OBJECT',    Name:   OBJECT\n   Value:  NGC 5044\n   Unit:   02\n   Desc:   Source name\n   Groups: []\n), ('MISSION',    Name:   MISSION\n   Value:  Chandra\n   Unit:   03\n   Desc:   Chandra X-Ray Observatory\n   Groups: []\n), ('TELESCOP',    Name:   TELESCOP\n   Value:  CHANDRA\n   Unit:   04\n   Desc:   Telescope\n   Groups: []\n), ('INSTRUME',    Name:   INSTRUME\n   Value:  ACIS\n   Unit:   05\n   Desc:   Instrument\n   Groups: []\n)])"


    expected6 = "OrderedDict([('ASCDSVER',    Name:   ASCDSVER\n   Value:  8.4.4\n   Unit:   06\n   Desc:   Processing system revision\n   Groups: ['BASIC', 'EVENT', 'NONSI', 'C_1', 'C_B', 'C_E']\n), ('OBJECT',    Name:   OBJECT\n   Value:  Jupiter\n   Unit:   07\n   Desc:   Source\n   Groups: ['BASIC', 'EVENT', 'O_2', 'O_B', 'O_E']\n), ('MISSION',    Name:   MISSION\n   Value:  AXAF\n   Unit:   08\n   Desc:   Advanced X-Ray Astrophysics Facility\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'O_1', 'O_3', 'O_4', 'O_B', 'O_E', 'O_P']\n), ('TELESCOP',    Name:   TELESCOP\n   Value:  CHANDRA\n   Unit:   04\n   Desc:   Telescope\n   Groups: []\n), ('INSTRUME',    Name:   INSTRUME\n   Value:  ACIS\n   Unit:   05\n   Desc:   Instrument\n   Groups: []\n), ('OBS_ID',    Name:   OBS_ID\n   Value:  0473\n   Unit:   09\n   Desc:   Observation id\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'O_1', 'O_3', 'O_B', 'O_E', 'O_P']\n), ('OBI_NUM',    Name:   OBI_NUM\n   Value:  001\n   Unit:   10\n   Desc:   Obi number\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'O_B', 'O_E', 'O_P']\n)])"


    expected7 = "OrderedDict([('ASCDSVER',    Name:   ASCDSVER\n   Value:  8.4.4\n   Unit:   06\n   Desc:   Processing system revision\n   Groups: ['BASIC', 'EVENT', 'NONSI', 'C_1', 'C_B', 'C_E']\n), ('OBJECT',    Name:   OBJECT\n   Value:  Jupiter\n   Unit:   07\n   Desc:   Source\n   Groups: ['BASIC', 'EVENT', 'O_2', 'O_B', 'O_E']\n), ('MISSION',    Name:   MISSION\n   Value:  AXAF\n   Unit:   08\n   Desc:   Advanced X-Ray Astrophysics Facility\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'O_1', 'O_3', 'O_4', 'O_B', 'O_E', 'O_P']\n), ('OBS_ID',    Name:   OBS_ID\n   Value:  0473\n   Unit:   09\n   Desc:   Observation id\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'O_1', 'O_3', 'O_B', 'O_E', 'O_P']\n), ('OBI_NUM',    Name:   OBI_NUM\n   Value:  001\n   Unit:   10\n   Desc:   Obi number\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'O_B', 'O_E', 'O_P']\n)])"


    expected8 = "OrderedDict([('ASCDSVER',    Name:   ASCDSVER\n   Value:  R4CU5UPD9\n   Unit:   01\n   Desc:   ASCDS version number\n   Groups: []\n), ('OBJECT',    Name:   OBJECT\n   Value:  NGC 5044\n   Unit:   02\n   Desc:   Source name\n   Groups: []\n), ('MISSION',    Name:   MISSION\n   Value:  Chandra\n   Unit:   03\n   Desc:   Chandra X-Ray Observatory\n   Groups: []\n), ('OBS_ID',    Name:   OBS_ID\n   Value:  0473\n   Unit:   09\n   Desc:   Observation id\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'O_1', 'O_3', 'O_B', 'O_E', 'O_P']\n), ('OBI_NUM',    Name:   OBI_NUM\n   Value:  001\n   Unit:   10\n   Desc:   Obi number\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'O_B', 'O_E', 'O_P']\n)])"

    expected9 = "OrderedDict([('ASCDSVER',    Name:   ASCDSVER\n   Value:  R4CU5UPD9\n   Unit:   01\n   Desc:   ASCDS version number\n   Groups: []\n), ('OBJECT',    Name:   OBJECT\n   Value:  NGC 5044\n   Unit:   02\n   Desc:   Source name\n   Groups: []\n), ('MISSION',    Name:   MISSION\n   Value:  AXAF\n   Unit:   08\n   Desc:   Advanced X-Ray Astrophysics Facility\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'O_1', 'O_3', 'O_4', 'O_B', 'O_E', 'O_P']\n), ('TELESCOP',    Name:   TELESCOP\n   Value:  CHANDRA\n   Unit:   04\n   Desc:   Telescope\n   Groups: []\n), ('INSTRUME',    Name:   INSTRUME\n   Value:  ACIS\n   Unit:   05\n   Desc:   Instrument\n   Groups: []\n)])"


    expected10 = "OrderedDict([('ASCDSVER',    Name:   ASCDSVER\n   Value:  R4CU5UPD9\n   Unit:   01\n   Desc:   ASCDS version number\n   Groups: []\n), ('OBJECT',    Name:   OBJECT\n   Value:  NGC 5044\n   Unit:   02\n   Desc:   Source name\n   Groups: []\n), ('MISSION',    Name:   MISSION\n   Value:  AXAF\n   Unit:   08\n   Desc:   Advanced X-Ray Astrophysics Facility\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'O_1', 'O_3', 'O_4', 'O_B', 'O_E', 'O_P']\n), ('TELESCOP',    Name:   TELESCOP\n   Value:  CHANDRA\n   Unit:   \n   Desc:   Telescope\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'O_1', 'O_3', 'O_4', 'O_B', 'O_E', 'O_P']\n), ('INSTRUME',    Name:   INSTRUME\n   Value:  \n   Unit:   \n   Desc:   Aspect Camera\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'O_1', 'O_3', 'O_4', 'O_B', 'O_E', 'O_P']\n), ('DATACLAS',    Name:   DATACLAS\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('DATAMODE',    Name:   DATAMODE\n   Value:  \n   Unit:   \n   Desc:   Data mode (OBSERVING or NEXT-IN-LINE)\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('DETNAM',    Name:   DETNAM\n   Value:  \n   Unit:   \n   Desc:   Detector\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('DS_IDENT',    Name:   DS_IDENT\n   Value:  \n   Unit:   \n   Desc:   dataset identifier\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'O_1', 'O_3', 'O_B', 'O_E', 'O_P']\n), ('DTCOR',    Name:   DTCOR\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('DTH_AVG',    Name:   DTH_AVG\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('DY_AVG',    Name:   DY_AVG\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('DZ_AVG',    Name:   DZ_AVG\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('EXPOSURE',    Name:   EXPOSURE\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('FOC_LEN',    Name:   FOC_LEN\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('GRATING',    Name:   GRATING\n   Value:  NONE\n   Unit:   \n   Desc:   Grating (HETG,LETG,or NONE)\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('LIVETIME',    Name:   LIVETIME\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('OBSERVER',    Name:   OBSERVER\n   Value:  \n   Unit:   \n   Desc:   Principal investigator\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('OBS_ID',    Name:   OBS_ID\n   Value:  0473\n   Unit:   09\n   Desc:   Observation id\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'O_1', 'O_3', 'O_B', 'O_E', 'O_P']\n), ('OBS_MODE',    Name:   OBS_MODE\n   Value:  \n   Unit:   \n   Desc:   Observation mode (GROUND,POINTING,or SLEW)\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('ONTIME',    Name:   ONTIME\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('SEQ_NUM',    Name:   SEQ_NUM\n   Value:  \n   Unit:   \n   Desc:   Sequence number\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'O_1', 'O_3', 'O_B', 'O_E', 'O_P']\n), ('SIM_X',    Name:   SIM_X\n   Value:  0.0\n   Unit:   mm\n   Desc:   SIM offset\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('SIM_Y',    Name:   SIM_Y\n   Value:  0.0\n   Unit:   mm\n   Desc:   SIM offset\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('SIM_Z',    Name:   SIM_Z\n   Value:  0.0\n   Unit:   mm\n   Desc:   SIM offset\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('TITLE',    Name:   TITLE\n   Value:  \n   Unit:   \n   Desc:   Proposal title\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n)])"


    expected11 = "[('ASCDSVER',    Name:   ASCDSVER\n   Value:  \n   Unit:   \n   Desc:   ASCDS version number\n   Groups: ['BASIC', 'EVENT', 'NONSI', 'C_1', 'C_B', 'C_E']\n), ('ASPTYPE',    Name:   ASPTYPE\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('CHECKSUM',    Name:   CHECKSUM\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'C_1', 'C_2', 'C_3', 'C_B', 'C_E', 'C_P']\n), ('CONTENT',    Name:   CONTENT\n   Value:  \n   Unit:   What data product\n   Desc:   \n   Groups: ['C_1', 'C_2']\n), ('CREATOR',    Name:   CREATOR\n   Value:  \n   Unit:   \n   Desc:   Tool that created this output\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'C_1', 'C_2', 'C_3', 'C_B', 'C_E', 'C_P']\n), ('CTI_APP',    Name:   CTI_APP\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('CTI_CORR',    Name:   CTI_CORR\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('CYCLE',    Name:   CYCLE\n   Value:  \n   Unit:   \n   Desc:   events from which exps? Prim/Second/Both\n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('DATACLAS',    Name:   DATACLAS\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('DATAMODE',    Name:   DATAMODE\n   Value:  \n   Unit:   \n   Desc:   Data mode (OBSERVING or NEXT-IN-LINE)\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('DATASUM',    Name:   DATASUM\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'C_1', 'C_2', 'C_3', 'C_B', 'C_E', 'C_P']\n), ('DEC_NOM',    Name:   DEC_NOM\n   Value:  -45.223\n   Unit:   deg\n   Desc:   Nominal Dec\n   Groups: ['BASIC', 'EVENT', 'O_2', 'O_B', 'O_E']\n), ('DEC_PNT',    Name:   DEC_PNT\n   Value:  0.0\n   Unit:   deg\n   Desc:   Pointing Dec\n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('DEC_TARG',    Name:   DEC_TARG\n   Value:  0.0\n   Unit:   deg\n   Desc:   Target Dec\n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('DEFOCUS',    Name:   DEFOCUS\n   Value:  0.0\n   Unit:   mm\n   Desc:   Defocus\n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('DETNAM',    Name:   DETNAM\n   Value:  \n   Unit:   \n   Desc:   Detector\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('DS_IDENT',    Name:   DS_IDENT\n   Value:  \n   Unit:   \n   Desc:   dataset identifier\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'O_1', 'O_3', 'O_B', 'O_E', 'O_P']\n), ('DTCOR',    Name:   DTCOR\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('DTH_AVG',    Name:   DTH_AVG\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('DY_AVG',    Name:   DY_AVG\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('DZ_AVG',    Name:   DZ_AVG\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('EQUINOX',    Name:   EQUINOX\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_2', 'O_B', 'O_E']\n), ('EXPOSURE',    Name:   EXPOSURE\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('FOC_LEN',    Name:   FOC_LEN\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('FP_TEMP',    Name:   FP_TEMP\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('GRATING',    Name:   GRATING\n   Value:  NONE\n   Unit:   \n   Desc:   Grating (HETG,LETG,or NONE)\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('HDUCLAS1',    Name:   HDUCLAS1\n   Value:  \n   Unit:   \n   Desc:   \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'C_1', 'C_2', 'C_B', 'C_E']\n), ('HDUCLAS2',    Name:   HDUCLAS2\n   Value:  \n   Unit:   \n   Desc:   \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'C_1', 'C_2', 'C_B', 'C_E']\n), ('HDUCLAS3',    Name:   HDUCLAS3\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'C_1', 'C_2', 'C_B', 'C_E']\n), ('HDUCLASS',    Name:   HDUCLASS\n   Value:  \n   Unit:   \n   Desc:   \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'C_1', 'C_2', 'C_B', 'C_E']\n), ('HDUDOC',    Name:   HDUDOC\n   Value:  \n   Unit:   \n   Desc:   ASC FITS Designers Guide\n   Groups: ['C_1', 'C_2']\n), ('HDUNAME',    Name:   HDUNAME\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['C_1', 'C_2']\n), ('HDUSPEC',    Name:   HDUSPEC\n   Value:  \n   Unit:   \n   Desc:   \n   Groups: ['C_1']\n), ('HDUVERS',    Name:   HDUVERS\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['C_1', 'C_2']\n), ('INSTRUME',    Name:   INSTRUME\n   Value:  \n   Unit:   \n   Desc:   Aspect Camera\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'O_1', 'O_3', 'O_4', 'O_B', 'O_E', 'O_P']\n), ('LIVETIME',    Name:   LIVETIME\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('LONGSTRN',    Name:   LONGSTRN\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['C_1']\n), ('MISSION',    Name:   MISSION\n   Value:  AXAF\n   Unit:   \n   Desc:   Advanced X-Ray Astrophysics Facility\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'O_1', 'O_3', 'O_4', 'O_B', 'O_E', 'O_P']\n), ('OBI_NUM',    Name:   OBI_NUM\n   Value:  0\n   Unit:   \n   Desc:   Obi number\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'O_B', 'O_E', 'O_P']\n), ('OBJECT',    Name:   OBJECT\n   Value:  ETA Carina\n   Unit:   \n   Desc:   Source name\n   Groups: ['BASIC', 'EVENT', 'O_2', 'O_B', 'O_E']\n), ('OBSERVER',    Name:   OBSERVER\n   Value:  \n   Unit:   \n   Desc:   Principal investigator\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('OBS_ID',    Name:   OBS_ID\n   Value:  \n   Unit:   \n   Desc:   Observation id\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'O_1', 'O_3', 'O_B', 'O_E', 'O_P']\n), ('OBS_MODE',    Name:   OBS_MODE\n   Value:  \n   Unit:   \n   Desc:   Observation mode (GROUND,POINTING,or SLEW)\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('ONTIME',    Name:   ONTIME\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('ORIGIN',    Name:   ORIGIN\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'C_1', 'C_2', 'C_3', 'C_B', 'C_E', 'C_P']\n), ('RADESYS',    Name:   RADESYS\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_2', 'O_B', 'O_E']\n), ('RAND_PI',    Name:   RAND_PI\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('RAND_SKY',    Name:   RAND_SKY\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('RAND_TG',    Name:   RAND_TG\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('RA_NOM',    Name:   RA_NOM\n   Value:  0.0\n   Unit:   deg\n   Desc:   Nominal RA\n   Groups: ['BASIC', 'EVENT', 'O_2', 'O_B', 'O_E']\n), ('RA_PNT',    Name:   RA_PNT\n   Value:  0.0\n   Unit:   deg\n   Desc:   Pointing RA\n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('RA_TARG',    Name:   RA_TARG\n   Value:  0.0\n   Unit:   deg\n   Desc:   Target RA\n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('READMODE',    Name:   READMODE\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('REVISION',    Name:   REVISION\n   Value:  2\n   Unit:     \n   Desc:   Processing system revision number\n   Groups: ['BASIC', 'EVENT', 'NONSI', 'C_1', 'C_B', 'C_E']\n), ('ROLL_NOM',    Name:   ROLL_NOM\n   Value:  0.0\n   Unit:   deg\n   Desc:   Nominal Roll\n   Groups: ['BASIC', 'EVENT', 'O_2', 'O_B', 'O_E']\n), ('ROLL_PNT',    Name:   ROLL_PNT\n   Value:  0.0\n   Unit:   deg\n   Desc:   Pointing Roll\n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('SEQ_NUM',    Name:   SEQ_NUM\n   Value:  \n   Unit:   \n   Desc:   Sequence number\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'O_1', 'O_3', 'O_B', 'O_E', 'O_P']\n), ('SIM_X',    Name:   SIM_X\n   Value:  0.0\n   Unit:   mm\n   Desc:   SIM offset\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('SIM_Y',    Name:   SIM_Y\n   Value:  0.0\n   Unit:   mm\n   Desc:   SIM offset\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('SIM_Z',    Name:   SIM_Z\n   Value:  0.0\n   Unit:   mm\n   Desc:   SIM offset\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('TELESCOP',    Name:   TELESCOP\n   Value:  CHANDRA\n   Unit:   \n   Desc:   Telescope\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'O_1', 'O_3', 'O_4', 'O_B', 'O_E', 'O_P']\n), ('TITLE',    Name:   TITLE\n   Value:  \n   Unit:   \n   Desc:   Proposal title\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('TLMVER',    Name:   TLMVER\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['EVENT', 'C_1', 'C_E']\n)]"


    expected12 = "OrderedDict([('ASPTYPE',    Name:   ASPTYPE\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('CTI_APP',    Name:   CTI_APP\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('CTI_CORR',    Name:   CTI_CORR\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('CYCLE',    Name:   CYCLE\n   Value:  \n   Unit:   \n   Desc:   events from which exps? Prim/Second/Both\n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('DATACLAS',    Name:   DATACLAS\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('DATAMODE',    Name:   DATAMODE\n   Value:  \n   Unit:   \n   Desc:   Data mode (OBSERVING or NEXT-IN-LINE)\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('DEC_NOM',    Name:   DEC_NOM\n   Value:  0.0\n   Unit:   deg\n   Desc:   Nominal Dec\n   Groups: ['BASIC', 'EVENT', 'O_2', 'O_B', 'O_E']\n), ('DEC_PNT',    Name:   DEC_PNT\n   Value:  0.0\n   Unit:   deg\n   Desc:   Pointing Dec\n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('DEC_TARG',    Name:   DEC_TARG\n   Value:  0.0\n   Unit:   deg\n   Desc:   Target Dec\n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('DEFOCUS',    Name:   DEFOCUS\n   Value:  0.0\n   Unit:   mm\n   Desc:   Defocus\n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('DETNAM',    Name:   DETNAM\n   Value:  \n   Unit:   \n   Desc:   Detector\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('DS_IDENT',    Name:   DS_IDENT\n   Value:  \n   Unit:   \n   Desc:   dataset identifier\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'O_1', 'O_3', 'O_B', 'O_E', 'O_P']\n), ('DTCOR',    Name:   DTCOR\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('DTH_AVG',    Name:   DTH_AVG\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('DY_AVG',    Name:   DY_AVG\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('DZ_AVG',    Name:   DZ_AVG\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('EQUINOX',    Name:   EQUINOX\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_2', 'O_B', 'O_E']\n), ('EXPOSURE',    Name:   EXPOSURE\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('FOC_LEN',    Name:   FOC_LEN\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('FP_TEMP',    Name:   FP_TEMP\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('GRATING',    Name:   GRATING\n   Value:  NONE\n   Unit:   \n   Desc:   Grating (HETG,LETG,or NONE)\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('INSTRUME',    Name:   INSTRUME\n   Value:  \n   Unit:   \n   Desc:   Aspect Camera\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'O_1', 'O_3', 'O_4', 'O_B', 'O_E', 'O_P']\n), ('LIVETIME',    Name:   LIVETIME\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('MISSION',    Name:   MISSION\n   Value:  AXAF\n   Unit:   \n   Desc:   Advanced X-Ray Astrophysics Facility\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'O_1', 'O_3', 'O_4', 'O_B', 'O_E', 'O_P']\n), ('OBI_NUM',    Name:   OBI_NUM\n   Value:  0\n   Unit:   \n   Desc:   Obi number\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'O_B', 'O_E', 'O_P']\n), ('OBJECT',    Name:   OBJECT\n   Value:  \n   Unit:   \n   Desc:   Source name\n   Groups: ['BASIC', 'EVENT', 'O_2', 'O_B', 'O_E']\n), ('OBSERVER',    Name:   OBSERVER\n   Value:  \n   Unit:   \n   Desc:   Principal investigator\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('OBS_ID',    Name:   OBS_ID\n   Value:  \n   Unit:   \n   Desc:   Observation id\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'O_1', 'O_3', 'O_B', 'O_E', 'O_P']\n), ('OBS_MODE',    Name:   OBS_MODE\n   Value:  \n   Unit:   \n   Desc:   Observation mode (GROUND,POINTING,or SLEW)\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('ONTIME',    Name:   ONTIME\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('RADESYS',    Name:   RADESYS\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_2', 'O_B', 'O_E']\n), ('RAND_PI',    Name:   RAND_PI\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('RAND_SKY',    Name:   RAND_SKY\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('RAND_TG',    Name:   RAND_TG\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('RA_NOM',    Name:   RA_NOM\n   Value:  0.0\n   Unit:   deg\n   Desc:   Nominal RA\n   Groups: ['BASIC', 'EVENT', 'O_2', 'O_B', 'O_E']\n), ('RA_PNT',    Name:   RA_PNT\n   Value:  0.0\n   Unit:   deg\n   Desc:   Pointing RA\n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('RA_TARG',    Name:   RA_TARG\n   Value:  0.0\n   Unit:   deg\n   Desc:   Target RA\n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('READMODE',    Name:   READMODE\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('ROLL_NOM',    Name:   ROLL_NOM\n   Value:  0.0\n   Unit:   deg\n   Desc:   Nominal Roll\n   Groups: ['BASIC', 'EVENT', 'O_2', 'O_B', 'O_E']\n), ('ROLL_PNT',    Name:   ROLL_PNT\n   Value:  0.0\n   Unit:   deg\n   Desc:   Pointing Roll\n   Groups: ['BASIC', 'EVENT', 'O_B', 'O_E']\n), ('SEQ_NUM',    Name:   SEQ_NUM\n   Value:  \n   Unit:   \n   Desc:   Sequence number\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'O_1', 'O_3', 'O_B', 'O_E', 'O_P']\n), ('SIM_X',    Name:   SIM_X\n   Value:  0.0\n   Unit:   mm\n   Desc:   SIM offset\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('SIM_Y',    Name:   SIM_Y\n   Value:  0.0\n   Unit:   mm\n   Desc:   SIM offset\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('SIM_Z',    Name:   SIM_Z\n   Value:  0.0\n   Unit:   mm\n   Desc:   SIM offset\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('TELESCOP',    Name:   TELESCOP\n   Value:  CHANDRA\n   Unit:   \n   Desc:   Telescope\n   Groups: ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'O_1', 'O_3', 'O_4', 'O_B', 'O_E', 'O_P']\n), ('TITLE',    Name:   TITLE\n   Value:  \n   Unit:   \n   Desc:   Proposal title\n   Groups: ['BASIC', 'EVENT', 'O_1', 'O_B', 'O_E']\n), ('CONTENT',    Name:   CONTENT\n   Value:  \n   Unit:   What data product\n   Desc:   \n   Groups: ['C_1', 'C_2', 'DP_SPEC']\n), ('HDUCLAS1',    Name:   HDUCLAS1\n   Value:  \n   Unit:   \n   Desc:   \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'C_1', 'C_2', 'C_B', 'C_E', 'DP_SPEC']\n), ('HDUCLAS2',    Name:   HDUCLAS2\n   Value:  \n   Unit:   \n   Desc:   \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'C_1', 'C_2', 'C_B', 'C_E', 'DP_SPEC']\n), ('HDUCLAS3',    Name:   HDUCLAS3\n   Value:   \n   Unit:    \n   Desc:    \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'C_1', 'C_2', 'C_B', 'C_E', 'DP_SPEC']\n), ('HDUCLASS',    Name:   HDUCLASS\n   Value:  \n   Unit:   \n   Desc:   \n   Groups: ['BASIC', 'EVENT', 'NONSI', 'C_1', 'C_2', 'C_B', 'C_E', 'DP_SPEC']\n)])"

    def test_01 (self):
        """
        Tests for create_stdhdr() 
          - invalid input  :  None
          - invalid input  :  ""
          - invalid input  :  [2,3]
          - invalid input  :  "FOO"
          - good input     :  "BASIC"
          - good input     :  ["C_b","O_b","T_b"]  - should match "BASIC" output
          - good input     :  "ALL"

        Tests for checking if keys generated from cxcstdhdr have the correct datatype
        """
        
        cr = TABLECrate()

        try:
            cr.create_stdhdr(None)
        except Exception as ex:
            if "Please specify header grouping(s)" not in str(ex):
                raise Exception("create_stdhdr(None) FAILED")

        try:
            cr.create_stdhdr("")
        except Exception as ex:
            if "Please specify header grouping(s)" not in str(ex):
                raise Exception("create_stdhdr('') FAILED")

        try:
            cr.create_stdhdr([2, 3])
        except Exception as ex:
            if "Input groupings must be a string or list of strings" not in str(ex):
                raise Exception("create_stdhdr([2, 3]) FAILED")

        try:
            cr.create_stdhdr("FOO")
        except Exception as ex:
            if "'FOO' is not a valid group" not in str(ex):
                raise Exception("create_stdhdr('FOO') FAILED")

        try:
            cr._set_keylist({})
            cr.create_stdhdr("BASIC")
        except Exception as ex:
            raise Exception("create_stdhdr(BASIC) FAILED")

        result = cr._get_keylist()
        self.assertIn(str(result), self.expected1, "print BASIC keys FAILED")

        try:
            cr._set_keylist({})
            cr.create_stdhdr(["C_b","O_b","T_b"])
        except Exception as ex:
            raise Exception("create_stdhdr(C_b,O_b,T_b) FAILED")

        result = cr._get_keylist()
        self.assertIn(str(result), self.expected1, "print C_b,O_b,T_b keys FAILED")

        try:
            cr._set_keylist({})
            cr.create_stdhdr("ALL")
        except Exception as ex:
            raise Exception("create_stdhdr(ALL) FAILED")

        result = cr._get_keylist()
        self.assertIn(str(result), self.expected0, "print ALL keys FAILED")

        try:
            cr._set_keylist(None)
            cr.create_stdhdr(["C_1","O_2"])

            key = cr.get_key("OBJECT")
            if not isinstance( key.value, str ):  
                raise Exception("hdrCHAR key datatype check FAILED")

            key = cr.get_key("DEC_NOM") 
            if not isinstance( key.value, np.double ):
                raise Exception("hdrDOUBLE key datatype check FAILED")

            key = cr.get_key("REVISION") 
            if not isinstance( key.value, np.int64 ): 
                raise Exception("hdrLONG key datatype check FAILED") 
                
        except:
            raise Exception("key datatype check FAILED")


    def test_02 (self):
        """
        Tests for add_stdhdr()
          - invalid input  :  []
          - good input with replace = False

          The output should be the same for the following commands:
          - good input     :  ['PRIMARY', 'NONSI']
          - good input     :  add ['PRIMARY'], followed by add "NONSI"
          - good input     :  create ['PRIMARY'], followed by add "NONSI"


        """
        cr = IMAGECrate()

        try:
            cr.add_stdhdr([])
        except Exception as ex:
            if "Please specify header grouping(s)" not in str(ex):
                raise Exception("add_stdhdr([])  FAILED")

        try:
            cr.add_stdhdr(["PRIMARY", "NONSI"])
        except Exception as ex:
            raise Exception("add_stdhdr(['PRIMARY', 'NONSI'])  FAILED")

        result = cr._get_keylist()

        sorted_result = sorted(result.items())
        self.assertIn(str(sorted_result), self.expected2, "print add ['PRIMARY', 'NONSI'] keys FAILED")
        
        try:
            cr._set_keylist({})
            cr.add_stdhdr(["PRIMARY"])
            cr.add_stdhdr("NONSI")
        except Exception as ex:
            raise Exception("add_stdhdr(['PRIMARY']), add_stdhdr('NONSI')  FAILED")

        result = cr._get_keylist()
        sorted_result = sorted(result.items())

        self.assertIn(str(sorted_result), self.expected2, "print add 'PRIMARY', add 'NONSI' keys FAILED")
        
        try:
            cr._set_keylist({})
            cr.create_stdhdr(["PRIMARY"])
            cr.add_stdhdr("NONSI")
        except Exception as ex:
            raise Exception("create_stdhdr(['PRIMARY']), add_stdhdr('NONSI')  FAILED")

        result = cr._get_keylist()
        sorted_result = sorted(result.items())

        self.assertIn(str(sorted_result), self.expected2, "print create 'PRIMARY', add 'NONSI' keys FAILED")
        
        try:
            cr._set_keylist(None)
            cr.create_stdhdr(["C_1","O_2"]) 

            cr2 = TABLECrate()

            # make a copy of the original crate with some stdhdr keys 
            cr.copy_stdhdr( "C_1, O_2", cr2, add_missing=False )

            # modify test key content 
            key = cr2.get_key("OBJECT") 
            key.value = "ETA Carina" 

            key = cr2.get_key("DEC_NOM")
            key.value = -45.223

            key = cr2.get_key("REVISION") 
            key.value = 2

            # add stdhdr set which includes a key already in the crate 
            #  - with replace=False; should not effect existing key
            cr2.add_stdhdr( "O_b", replace=False )

        except Exception as ex:
            raise Exception("copy_stdhdr('C_1,O_2') + add_stdhdr('O_b') FAILED")

        result = cr2._get_keylist()
        sorted_result = sorted(result.items())

        self.assertIn(str(sorted_result), self.expected11, "add_stdhdr('O_b', replace=False) FAILED")


    def test_03(self):
        """
        Tests for get_stdhdr()
          - invalid input  :  no args
          - invalid input  :  grouping only
          - invalid input  :  two args but empty crate
          - invalid input  :  "", False
          - invalid input  :  [], True
          - invalid input  :  [""], False
          - invalid input  :  [""], True
          - good input     : "O_1", False
          - good input     : "O_1", True
          - good input     : "ALL"

        """
        cr = TABLECrate()

        try:
            cr.get_stdhdr()
        except Exception as ex:
            if "get_stdhdr() missing 2 required positional arguments: 'groupings' and 'add_missing'" not in str(ex):
                raise Exception("get_stdhdr()  FAILED")

        try:
            cr.get_stdhdr([])
        except Exception as ex:
            if "get_stdhdr() missing 1 required positional argument: 'add_missing'" not in str(ex):
                raise Exception("get_stdhdr([]) FAILED")

        try:
            cr.get_stdhdr([], True)
        except Exception as ex:
            if "This Crate does not contain any keywords" not in str(ex):
                raise Exception("get_stdhdr([], True) FAILED")

        hdrdict = OrderedDict()
        hdrdict["ASCDSVER"] = CrateKey( ("ASCDSVER", "8.4.4", "06", "Processing system revision", ['BASIC', 'EVENT', 'NONSI', 'C_1', 'C_b', 'C_e']) ) 
        hdrdict["OBJECT"] = CrateKey( ("OBJECT", "Jupiter", "07", "Source", ['BASIC', 'EVENT', 'O_2', 'O_b', 'O_e'] ) )
        hdrdict["MISSION"] = CrateKey( ("MISSION", "AXAF", "08", "Advanced X-Ray Astrophysics Facility", ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'O_1', 'O_3', 'O_4', 'O_b', 'O_e', 'O_p']) ) 
        hdrdict["OBS_ID"] = CrateKey( ("OBS_ID", "0473", "09", "Observation id", ['BASIC', 'EVENT', 'PRIMARY', 'O_1', 'O_3', 'O_b', 'O_e', 'O_p']) ) 
        hdrdict["OBI_NUM"] = CrateKey( ("OBI_NUM", "001", "10", "Obi number", ['BASIC', 'EVENT', 'PRIMARY', 'O_b', 'O_e', 'O_p']) ) 
        cr._set_keylist(hdrdict)


        try:
            cr.get_stdhdr("", False)
        except Exception as ex:
            if "Please specify header grouping(s)" not in str(ex):
                raise Exception("get_stdhdr('', False) FAILED")

        try:
            cr.get_stdhdr([], True)
        except Exception as ex:
            if "Please specify header grouping(s)" not in str(ex):
                raise Exception("get_stdhdr([], True) FAILED")

        try:
            header = cr.get_stdhdr([""], False)
        except Exception as ex:
            raise Exception("get_stdhdr([''], False) FAILED")
        self.assertEqual(None, header, "get_stdhdr([''], False) FAILED")

        try:
            cr.get_stdhdr([""], True)
        except Exception as ex:
            if "Please specify header grouping(s)" not in str(ex):
                raise Exception("get_stdhdr([''], True) FAILED")

        try:
            hdrdict = cr.get_stdhdr("o_1", False)
        except Exception as ex:
            raise Exception("get_stdhdr(O_1, False) on empty Crate FAILED")

        self.assertIn(str(hdrdict), self.expected3, "get_stdhdr(O_1, False) FAILED")

        try:
            hdrdict = cr.get_stdhdr(["O_1"], True)
        except Exception as ex:
            raise Exception("get_stdhdr(O_1, True) FAILED")

        self.assertIn(str(hdrdict), self.expected4, "get_stdhdr(O_1, True) FAILED")


    def test_04(self):
        """
        Tests for put_stdhdr()
          - invalid input  :  dict
          - invalid input  :  OrderedDict of strings
          - good input     :  OrderedDict of CrateKeys

        """
        cr =  TABLECrate()
        cr2 = IMAGECrate()

        # try putting a regular dict
        keylist = dict()
        try:
            cr.put_stdhdr(keylist)
        except Exception as ex:
            if "Input header must be an OrderedDict" not in str(ex):
                raise Exception("put_stdhdr(<dict>) FAILED")

        # try putting an OrderedDict with strings
        keylist = OrderedDict()
        keylist["FOO1"] = 'BAR1'
        keylist["FOO2"] = 'BAR2'
        keylist["FOO3"] = 'BAR3'
        try:
            cr.put_stdhdr(keylist)
        except Exception as ex:
            if "Input header must be a OrderedDict of CrateKeys" not in (str(ex)):
                raise Exception("put_stdhdr(OrderedDict(strings)) FAILED")
        

        # try putting an OrderedDict of CrateKeys in a TABLECrate
        keylist.clear()
        keylist["ASCDSVER"] = CrateKey( ("ASCDSVER", "R4CU5UPD9", "01", "ASCDS version number", "") )
        keylist["OBJECT"] = CrateKey( ("OBJECT", "NGC 5044", "02", "Source name", "") )
        keylist["MISSION"] = CrateKey( ("MISSION", "Chandra", "03", "Chandra X-Ray Observatory", "") )
        keylist["TELESCOP"] = CrateKey( ("TELESCOP", "CHANDRA", "04", "Telescope", "") )
        keylist["INSTRUME"] = CrateKey( ("INSTRUME", "ACIS", "05", "Instrument", "") )

        cr.put_stdhdr( keylist )
        self.assertIn(str(cr._get_keylist()), self.expected5, "put_stdhdr(keylist) FAILED")

        # try integrating another OrderedDict of CrateKeys with add_missing = True
        hdrdict = OrderedDict()
        hdrdict["ASCDSVER"] = CrateKey( ("ASCDSVER", "8.4.4", "06", "Processing system revision", ['BASIC', 'EVENT', 'NONSI', 'C_1', 'C_b', 'C_e']) ) 
        hdrdict["OBJECT"] = CrateKey( ("OBJECT", "Jupiter", "07", "Source", ['BASIC', 'EVENT', 'O_2', 'O_b', 'O_e'] ) )
        hdrdict["MISSION"] = CrateKey( ("MISSION", "AXAF", "08", "Advanced X-Ray Astrophysics Facility", ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'O_1', 'O_3', 'O_4', 'O_b', 'O_e', 'O_p']) ) 
        hdrdict["OBS_ID"] = CrateKey( ("OBS_ID", "0473", "09", "Observation id", ['BASIC', 'EVENT', 'PRIMARY', 'O_1', 'O_3', 'O_b', 'O_e', 'O_p']) ) 
        hdrdict["OBI_NUM"] = CrateKey( ("OBI_NUM", "001", "10", "Obi number", ['BASIC', 'EVENT', 'PRIMARY', 'O_b', 'O_e', 'O_p']) ) 

        cr.put_stdhdr( hdrdict, True )
        self.assertIn(str(cr._get_keylist()), self.expected6, "put_stdhdr(hdrdict, True) FAILED")


        # try putting an OrderedDict of CrateKeys into an IMAGECrate
        cr2.put_stdhdr( hdrdict )
        self.assertIn(str(cr2._get_keylist()), self.expected7, "put_stdhdr(hdrdict) FAILED") 

        # try integrating another OrderedDict of CrateKeys with add_missing = False
        cr2.put_stdhdr( keylist, False )
        self.assertIn(str(cr2._get_keylist()), self.expected8, "put_stdhdr(keylist, False) FAILED") 



    def test_05(self):
        """
        Tests for copy_stdhdr()
          - invalid input  :  targetcrate=None
          - invalid input  :  copy from an empty Crate
          - invalid input  :  add_missing=0
          - invalid input  :  groupings=[]
          - good input     :  ["O_1"], cr2, True, where targetcrate has no header
          - good input     :  ["O_1"], cr2, False, where targetcrate has no header
          - good input     :  ["O_1"], cr2, True, where targetcrate contains a header
          - good input     :  ["O_1"], cr2, False, where targetcrate contains a header
          - good input     :  user-defined group 'DS_SPEC'
        """

        cr  = IMAGECrate()
        cr2 = TABLECrate()

        try:
            cr.copy_stdhdr([], None, 0)
        except Exception as ex:
            if "The 'targetcrate' argument must be a TABLECrate or an IMAGECrate" not in str(ex):
                raise Exception("copy_stdhdr([], None, 0) FAILED")

        try:
            cr.copy_stdhdr([], cr2, 0)
        except Exception as ex:
            if "This Crate does not contain any keywords" not in str(ex):
                raise Exception("copy_stdhdr([], None, 0) FAILED")

        hdrdict = OrderedDict()
        hdrdict["ASCDSVER"] = CrateKey( ("ASCDSVER", "8.4.4", "06", "Processing system revision", ['BASIC', 'EVENT', 'NONSI', 'C_1', 'C_b', 'C_e']) ) 
        hdrdict["OBJECT"] = CrateKey( ("OBJECT", "Jupiter", "07", "Source", ['BASIC', 'EVENT', 'O_2', 'O_b', 'O_e'] ) )
        hdrdict["MISSION"] = CrateKey( ("MISSION", "AXAF", "08", "Advanced X-Ray Astrophysics Facility", ['BASIC', 'EVENT', 'PRIMARY', 'NONSI', 'O_1', 'O_3', 'O_4', 'O_b', 'O_e', 'O_p']) ) 
        hdrdict["OBS_ID"] = CrateKey( ("OBS_ID", "0473", "09", "Observation id", ['BASIC', 'EVENT', 'PRIMARY', 'O_1', 'O_3', 'O_b', 'O_e', 'O_p']) ) 
        hdrdict["OBI_NUM"] = CrateKey( ("OBI_NUM", "001", "10", "Obi number", ['BASIC', 'EVENT', 'PRIMARY', 'O_b', 'O_e', 'O_p']) ) 

        cr._set_keylist(hdrdict)

        try:
            cr.copy_stdhdr([], cr2, 0)
        except Exception as ex:
            if "'add_missing' argument must be a boolean (True or False)" not in str(ex):
                raise Exception("copy_stdhdr([], cr2, 0) FAILED")

        try:
            cr.copy_stdhdr([], cr2, False)
        except Exception as ex:
            if "Please specify header grouping(s)" not in str(ex):
                raise Exception("copy_stdhdr([], cr2, 0) FAILED")

        # should be the same as hdr=cr.get_stdhdr("O_1", True) + cr2.put_stdhdr( hdr, True), 
        # where cr2 does not have a header
        cr.copy_stdhdr(["O_1"], cr2, True)
        self.assertIn(str(cr2._get_keylist()), self.expected4, "copy_stdhdr('O_1', cr2, True) FAILED") 

        cr2._set_keylist({})

        # should be the same as hdr=cr.get_stdhdr("O_1", False) + cr2.put_stdhdr( hdr, False), 
        # where cr2 does not have a header
        cr.copy_stdhdr(["O_1"], cr2, False)        
        self.assertIn(str(cr2._get_keylist()), self.expected3, "copy_stdhdr('O_1', cr2, False) FAILED") 


        keylist = OrderedDict()
        keylist["ASCDSVER"] = CrateKey( ("ASCDSVER", "R4CU5UPD9", "01", "ASCDS version number", "") )
        keylist["OBJECT"] = CrateKey( ("OBJECT", "NGC 5044", "02", "Source name", "") )
        keylist["MISSION"] = CrateKey( ("MISSION", "Chandra", "03", "Chandra X-Ray Observatory", "") )
        keylist["TELESCOP"] = CrateKey( ("TELESCOP", "CHANDRA", "04", "Telescope", "") )
        keylist["INSTRUME"] = CrateKey( ("INSTRUME", "ACIS", "05", "Instrument", "") )

        cr2._set_keylist({})
        cr2._set_keylist(keylist)

        # should be the same as hdr=cr.get_stdhdr("O_1", True) + cr2.put_stdhdr( hdr, True), where cr2 also has a header
        cr.copy_stdhdr(["O_1"], cr2, False)        
        self.assertIn(str(cr2._get_keylist()), self.expected9, "copy_stdhdr('O_1', cr2, False) FAILED") 


        cr2._set_keylist({})
        cr2._set_keylist(keylist)

        # should be the same as hdr=cr.get_stdhdr("O_1", False) + cr2.put_stdhdr( hdr, False), where cr2 also has a header
        cr.copy_stdhdr(["O_1"], cr2, True)        
        self.assertIn(str(cr2._get_keylist()), self.expected10, "copy_stdhdr('O_1', cr2, True) FAILED") 

        # add user-defined group 
        cr2._set_keylist({})   
        cr2.create_stdhdr(["C_1","O_2"])

        for keyname in ["CONTENT", "HDUCLAS1", "HDUCLAS2", "HDUCLAS3", "HDUCLASS" ]:
            key = cr2.get_key( keyname )
            key.groups.append( "DP_SPEC" )

        # copy keys to empty Crate, adding missing Observation keys
        cr3 = TABLECrate()
        cr2.copy_stdhdr( ["O_b","DP_SPEC"], cr3, add_missing=True )

        self.assertIn(str(cr3._get_keylist()), self.expected12, "user-defined group FAILED")


if __name__ == '__main__':
    unittest.main(verbosity=0)
