Read an SNANA ‘simlib’ (simulation library) ascii file.




Global meta data, not associated with any one LIBID. If DOCANA is present, it is stored in meta['DOCUMENTATION'].

observation_setsOrderedDict of astropy.table.Table

keys are LIBIDs, values are observation sets.


  • Anything following ‘#’ on each line is ignored as a comment.

  • Keywords are space separated strings ending wth a colon.

  • If a line starts with ‘LIBID:’, the following lines are associated with the value of LIBID, until ‘END_LIBID:’ is encountered.

  • While reading a given LIBID, lines starting with ‘S’ or ‘T’ keywords are assumed to contain 12 space-separated values after the keyword. These are (1) MJD, (2) IDEXPT, (3) FLT, (4) CCD GAIN, (5) CCD NOISE, (6) SKYSIG, (7) PSF1, (8) PSF2, (9) PSF 2/1 RATIO, (10) ZPTAVG, (11) ZPTSIG, (12) MAG.

  • Column (2) may represent co-added observations in a ‘111*1’ format. In this case, the ‘IDEXPT’ column is split at the ‘*’ into ‘IDEXPT’ and ‘NEXPOSE’

  • Other lines inside a ‘LIBID:’/’END_LIBID:’ pair are treated as metadata for that LIBID.

  • Any other keywords outside a ‘LIBID:’/’END_LIBID:’ pair are treated as global header keywords and are returned in the meta dictionary.


>>> meta, obs_sets = read_snana_simlib('filename')

The second object is a dictionary of astropy Tables indexed by LIBID:

>>> obs_sets.keys()
[0, 1, 2, 3, 4]

Each table (libid) has metadata:

>>> obs_sets[0].meta
OrderedDict([('LIBID', 0), ('RA', 52.5), ('DECL', -27.5), ('NOBS', 161),
             ('MWEBV', 0.0), ('PIXSIZE', 0.27)])

Each table has the following columns:

>>> obs_sets[0].colnames