Exemple #1
0
mfiles  = []

nnoread   = 0
nnopos    = 0
nnowave   = 0
tspec     = 0
nbadeq    = 0
nnojd     = 0
nnoexp    = 0
nnoobject = 0
ntcalc    = 0
nnorec    = 0

for mfile in mflist:
    try:
        for (nspec,mspec) in molly.grmolly(mfile):

            tspec += 1

            # Set all items first. A value is always set although
            # some will be bad as in -1 for RA

            # object name
            if 'Object' in mspec:
                object = mspec['Object']
            else:
                nnoobject += 1
                object = 'UNKNOWN'

            # position
            if 'RA' in mspec and 'Dec' in mspec and 'Equinox' in mspec:
Exemple #2
0
if root.endswith('.mol'):
    root = root[:-4]

mname = root + '.mol'
if not os.path.exists(mname):
    print 'Cannot fine file =',mname
    exit(1)

fname = root + '.fits'
if os.path.exists(fname):
    print 'File =',fname,'already exists.'
    exit(1)

# Read in spectra
specs = []
for nspec, mspec in molly.grmolly(mname):
    specs.append(mspec)

def update_header(mspec, thead):
    """
    Tries to convert as much of a standard molly header as it can into more standard
    FITS (note that molly headers are stored in FITS headers in trm.dnl but mostly
    by using HIERARCH
    """

    mhead = mspec.head

    # Modify the molly header for a few special cases to allow the more
    # generic changes to be nicely ordered,
    if 'Day' in mhead and 'Month' in mhead and 'Year' in mhead:
        mhead['DATE-OBS'] = '{0:4d}-{1:02d}-{2:02d}'.format(mhead['Year'],mhead['Month'],mhead['Day'])