def subtractOverscan(self, rc):
     iraf.setVerbose(value=2)
     # supply extra required param in gireduce's ETI wrapper; can also
     # override DETTYPE defaults this way (the alternative is to extend
     # gireduce to support our DETTYPE)
     subtract_overscan_hardcoded_params['order'] = 1
     return GMOSPrimitives.subtractOverscan(self, rc)
Exemple #2
0
#! /usr/bin/env python

"""loadall.py: Load all the main packages in IRAF with verbose turned on
$Id: loadall.py 1032 2009-06-18 01:52:35Z sontag $
"""
from __future__ import division # confidence high

import sys, traceback
from pyraf import iraf

iraf.setVerbose()

def printcenter(s, length=70, char="-"):
    l1 = (length-len(s))//2
    l2 = length-l1-len(s)
    print l1*char, s, l2*char

ptried = {}
npass = 0
ntotal = 0
plist = iraf.getPkgList()
keepGoing = 1
while keepGoing and (ntotal<len(plist)):
    plist.sort()
    nnew = 0
    npass = npass + 1
    printcenter("pass "+`npass` + " trying " +
            `len(plist)`, char="=")
    for pkg in plist:
        if not ptried.has_key(pkg):
            ptried[pkg] = 1
Exemple #3
0
#! /usr/bin/env python
"""loadall.py: Load all the main packages in IRAF with verbose turned on
$Id$
"""
from __future__ import division  # confidence high

import sys, traceback
from pyraf import iraf

iraf.setVerbose()


def printcenter(s, length=70, char="-"):
    l1 = (length - len(s)) // 2
    l2 = length - l1 - len(s)
    print l1 * char, s, l2 * char


ptried = {}
npass = 0
ntotal = 0
plist = iraf.getPkgList()
keepGoing = 1
while keepGoing and (ntotal < len(plist)):
    plist.sort()
    nnew = 0
    npass = npass + 1
    printcenter("pass " + ` npass ` + " trying " + ` len(plist) `, char="=")
    for pkg in plist:
        if not ptried.has_key(pkg):
            ptried[pkg] = 1
Exemple #4
0
def compileall():
    """Compile all CL procedures & packages"""

    # start the timer

    t0 = time.time()

    # now do the IRAF startup

    from pyraf import iraf, cl2py, clcache, irafglobals
    from pyraf.iraftask import IrafCLTask, IrafPkg

    # close the old code cache and reopen without system cache

    cl2py.codeCache.close()
    del clcache.codeCache

    userCacheDir = os.path.join(irafglobals.userIrafHome, 'pyraf')
    if not os.path.exists(userCacheDir):
        try:
            os.mkdir(userCacheDir)
            print 'Created directory %s for cache' % userCacheDir
        except OSError:
            print 'Could not create directory %s' % userCacheDir
    dbfile = 'clcache'
    clcache.codeCache = clcache._CodeCache(
        [os.path.join(userCacheDir, dbfile)])
    cl2py.codeCache = clcache.codeCache

    iraf.setVerbose()

    pkgs_tried = {}
    tasks_tried = {}
    npkg_total = 0
    ntask_total = 0
    ntask_failed = 0

    # main loop -- keep loading packages as long as there are
    # new ones to try, and after loading each package look for
    # and initialize any CL tasks

    npass = 0
    pkg_list = iraf.getPkgList()
    keepGoing = 1
    while keepGoing and (npkg_total < len(pkg_list)):
        npass = npass + 1
        pkg_list.sort()
        npkg_new = 0
        printcenter("pass %d: %d packages (%d new)" %
                    (npass, len(pkg_list), len(pkg_list) - npkg_total),
                    char="=")
        for pkg in pkg_list:
            if not pkgs_tried.has_key(pkg):
                pkgs_tried[pkg] = 1
                npkg_new = npkg_new + 1
                printcenter(pkg)
                if pkg in ["newimred", "digiphotx"]:
                    print """
Working around bugs in newimred, digiphotx.
They screw up subsequent loading of imred/digiphot tasks.
(It happens in IRAF too.)"""
                    sys.stdout.flush()
                else:
                    try:
                        # redirect stdin in case the package tries to
                        # prompt for parameters (this aborts but keeps
                        # going)
                        iraf.load(pkg, kw={'Stdin': 'dev$null'})
                    except KeyboardInterrupt:
                        print 'Interrupt'
                        sys.stdout.flush()
                        keepGoing = 0
                        break
                    except Exception, e:
                        sys.stdout.flush()
                        traceback.print_exc()
                        if isinstance(e, MemoryError):
                            keepGoing = 0
                            break
                        print "...continuing...\n"
                        sys.stdout.flush()
                # load tasks after each package
                task_list = iraf.getTaskList()
                task_list.sort()
                for taskname in task_list:
                    if not tasks_tried.has_key(taskname):
                        tasks_tried[taskname] = 1
                        taskobj = iraf.getTask(taskname)
                        if isinstance(taskobj, IrafCLTask) and \
                                        not isinstance(taskobj,IrafPkg):
                            ntask_total = ntask_total + 1
                            print "%d: %s" % (ntask_total, taskname)
                            sys.stdout.flush()
                            try:
                                taskobj.initTask()
                            except KeyboardInterrupt:
                                print 'Interrupt'
                                sys.stdout.flush()
                                keepGoing = 0
                                break
                            except Exception, e:
                                sys.stdout.flush()
                                traceback.print_exc(10)
                                if isinstance(e, MemoryError):
                                    keepGoing = 0
                                    break
                                print "...continuing...\n"
                                sys.stdout.flush()
                                ntask_failed = ntask_failed + 1
                if not keepGoing: break
 def stackFrames(self, rc):
     # Runs the standard stackFrames, but sets the iraf logging level higher
     iraf.setVerbose(value=2)
     return StackPrimitives.stackFrames(self, rc)
def compileall():
    """Compile all CL procedures & packages"""

    # start the timer

    t0 = time.time()

    # now do the IRAF startup

    from pyraf import iraf, cl2py
    from pyraf.iraftask import IrafCLTask, IrafPkg

    iraf.setVerbose()

    pkgs_tried = {}
    tasks_tried = {}
    npkg_total = 0
    ntask_total = 0
    ntask_failed = 0

    # main loop -- keep loading packages as long as there are
    # new ones to try, and after loading each package look for
    # and initialize any CL tasks

    npass = 0
    pkg_list = iraf.getPkgList()
    keepGoing = 1
    while keepGoing and (npkg_total<len(pkg_list)):
        npass = npass + 1
        pkg_list.sort()
        npkg_new = 0
        printcenter("pass %d: %d packages (%d new)" %
                (npass,len(pkg_list),len(pkg_list)-npkg_total), char="=")
        for pkg in pkg_list:
            if not pkgs_tried.has_key(pkg):
                pkgs_tried[pkg] = 1
                npkg_new = npkg_new+1
                printcenter(pkg)
                if pkg in ["newimred","digiphotx"]:
                    print """
Working around bugs in newimred, digiphotx.
They screw up subsequent loading of imred/digiphot tasks.
(It happens in IRAF too.)"""
                    sys.stdout.flush()
                else:
                    try:
                        # redirect stdin in case the package tries to
                        # prompt for parameters (this aborts but keeps
                        # going)
                        iraf.load(pkg,kw={'Stdin': 'dev$null'})
                    except KeyboardInterrupt:
                        print 'Interrupt'
                        sys.stdout.flush()
                        keepGoing = 0
                        break
                    except Exception, e:
                        sys.stdout.flush()
                        traceback.print_exc()
                        if isinstance(e,MemoryError):
                            keepGoing = 0
                            break
                        print "...continuing...\n"
                        sys.stdout.flush()
                # load tasks after each package
                task_list = iraf.getTaskList()
                task_list.sort()
                for taskname in task_list:
                    if not tasks_tried.has_key(taskname):
                        tasks_tried[taskname] = 1
                        taskobj = iraf.getTask(taskname)
                        if isinstance(taskobj, IrafCLTask) and \
                                        not isinstance(taskobj,IrafPkg):
                            ntask_total = ntask_total+1
                            print "%d: %s" % (ntask_total, taskname)
                            sys.stdout.flush()
                            try:
                                taskobj.initTask()
                            except KeyboardInterrupt:
                                print 'Interrupt'
                                sys.stdout.flush()
                                keepGoing = 0
                                break
                            except Exception, e:
                                sys.stdout.flush()
                                traceback.print_exc(10)
                                if isinstance(e,MemoryError):
                                    keepGoing = 0
                                    break
                                print "...continuing...\n"
                                sys.stdout.flush()
                                ntask_failed = ntask_failed+1
                if not keepGoing: break