Beispiel #1
0
def ncmark(inputs, idir='', odir='./', oprefix='m', port=5137, logfile='', clobber=False, verbose=False):
    """
    Mark by hand the mask center and update the input header
    with (xcen,ycen) on the output file.
    The SAOIMAGE/ds9 display must be up. If the default port is busy, then it will
    use port 5199, so make sure you start "ds9 -port 5199".
    """

    log = glog.getLogger(name='ncmark',verbose=verbose,logfile=logfile,
          debug=True)
    log.info("\n START NICI Ncprepare +++++++++++++++++++++++++")
    #log.info(command)
    log.info( 'inputs_list_len: '+str(len(inputs)))
    log.info( 'inputdir: '+idir)
    log.info( 'outdir: '+odir)

    try:
        odir = check_dir(odir,os.W_OK)
        idir = check_dir(idir,os.R_OK)
    except IOError, strerror:
        log.warning('(%s)' % strerror)
        #sys.exit(0)
        return
Beispiel #2
0
def ncprepare (inputs, oprefix='n', idir='', odir='', fdir='', fsuffix='',
              dobadpix=True, clobber=False, logfile='', verbose=False):

    """
        inputs =               Input Fits files on a list
        (oprefix = 'n')        Prefix for output image(s)
        (idir = '')            Path for input raw files
        (odir = '')            Output directory name
        (fdir = '')            Path for calibration files
        (fsuffix = '')         Suffix used in calibration files 
        (dobadpix = True)      Correct bad pixels the best we can 
        (clobber = False)      Replace output file if exits
        (logfile = '')         Logfile name
        (verbose = False)      Display details on terminal?


         DESCRIPTION:
         Prepare science files in 'inputs' list for further analysis 
         with the ncscience script.
         - Shift the mask to frame center  
         - Map blue frame coordinates to the red frame's.

     EXAMPLES:
        PYRAF:
           ncprepare *.fits odir=/tmp

        Python_shell: 
           nicip.ncprepare(flis,idir='/data1/data/tmp',odir='/tmp')
      
        Unix_shell:
           ncprepare.py /data1/data/tmp/*.fits --odir='/tmp'

    """
    global command

    def xy_tran(out):
        """
          Function to transform blue coordinates to red frame coordinates
        """
        xref = out[1] - 990.5897
        yref = out[0] - 37.82109
        x = -0.9985259*xref - 0.0178984*yref
        y = -0.0181331*xref + 0.9991414*yref
        # if we want to recenter as well. Need to think about this.
        #x = x + (512 -409.81)
        #y = y - (512 -650.23)
        return y,x
    
    log = glog.getLogger(name='ncprepare',verbose=verbose,logfile=logfile,
          debug=True)
    log.info("\n START NICI Ncprepare +++++++++++++++++++++++++")
    log.info(command)
    log.info( 'inputs_list_len: '+str(len(inputs)))
    log.info( 'inputdir: '+idir)
    log.info( 'outdir: '+odir)
    log.info( 'flatsdir: '+fdir)

    try:
        odir = nt.check_dir(odir,os.W_OK)
        idir = nt.check_dir(idir,os.R_OK)
        fdir = nt.check_dir(fdir,os.R_OK)
    except IOError, strerror:
        log.warning('(%s)' % strerror)
        #sys.exit(0)
        return