def buildasn_iraf(asnroot,
                  suffix=None,
                  shiftfile=None,
                  verbose=no,
                  product="",
                  version=None):
    # Transform IRAF empty parameters to Python None when
    # PyDrizzle expects it.
    if suffix == '':
        suffix = "*crj.fits"
    else:
        suffix = "*" + suffix

    if shiftfile == '': shiftfile = None
    input = glob.glob(suffix)
    if verbose:
        print('Running asnutil version ', asnutil.__version__)

    #dthprod =buildasn.buildAsnTable(asnroot,suffix=suffix,shiftfile=shiftfile,verbose=verbose)
    print('input, asnroot, ', input, asnroot)
    asndict = asnutil.ASNTable(input, output=asnroot, shiftfile=shiftfile)
    asndict.create()
    if shiftfile:
        asndict.update(shiftfile=shiftfile)
    asndict.write()

    iraf.buildasn.product = asndict['output']
Exemplo n.º 2
0
def process_input(input,
                  output=None,
                  ivmlist=None,
                  updatewcs=True,
                  prodonly=False,
                  wcskey=None,
                  **workinplace):
    """
    Create the full input list of filenames after verifying and converting
    files as needed.
    """

    newfilelist, ivmlist, output, oldasndict, origflist = buildFileListOrig(
        input,
        output=output,
        ivmlist=ivmlist,
        wcskey=wcskey,
        updatewcs=updatewcs,
        **workinplace)

    if not newfilelist:
        buildEmptyDRZ(input, output)
        return None, None, output

    # run all WCS updating -- Now done in buildFileList
    #pydr_input = _process_input_wcs(newfilelist, wcskey, updatewcs)
    pydr_input = newfilelist

    # AsnTable will handle the case when output==None
    if not oldasndict:  # and output is not None:
        oldasndict = asnutil.ASNTable(pydr_input, output=output)
        oldasndict.create()

    asndict = update_member_names(oldasndict, pydr_input)
    asndict['original_file_names'] = origflist

    # Build output filename
    drz_extn = '_drz.fits'
    for img in newfilelist:
        # special case logic to automatically recognize when _flc.fits files
        # are provided as input and produce a _drc.fits file instead
        if '_flc.fits' in img:
            drz_extn = '_drc.fits'
            break

    if output in [None, '']:
        output = fileutil.buildNewRootname(asndict['output'], extn=drz_extn)
    else:
        if '.fits' in output.lower():
            pass
        elif drz_extn[:4] not in output.lower():
            output = fileutil.buildNewRootname(output, extn=drz_extn)

    log.info('Setting up output name: %s' % output)

    return asndict, ivmlist, output