Ejemplo n.º 1
0
        except Exception, e:
            logger.error('rts2af_fwhm: no queue named: {0}, doing nothing'.format(args.queue))

        if q is not None:
            q.load()
            for x in q.entries:
                if x.get_target().name and 'OnTargetFocus' in x.get_target().name:
                    q.clear()
                    logger.info('rts2af_fwhm: cleared queue: {}'.format(args.queue))
                    break
    else:
        proxy=JSONProxy(url=rt.cfg['URL'],username=rt.cfg['RTS2_HTTPD_USERNAME'],password=rt.cfg['PASSWORD'])
        try:
            proxy.refresh()
        except Exception, e:
            logger.warn('rts2af_fwhm: JSON proxy connection failed: {}, exiting'.format(e))
            sys.exit(1)

        tarType = proxy.getSingleValue('EXEC','current_type')
        tarName = proxy.getSingleValue('EXEC','current_name')
        if 'GLORIA teleoperation' in tarName: # reserved observing time
            logger.info('rts2af_fwhm: there is a ongoing GLORIA teleoperation, no focus run queued')
        elif 'G' in tarType: # it is a GRB
            logger.info('rts2af_fwhm: there is now a GRB target selected, no focus run queued')

        else:
            q = None
            rts2.createProxy(url=rt.cfg['URL'], username=rt.cfg['RTS2_HTTPD_USERNAME'], password=rt.cfg['PASSWORD'])
            try:
                q = rts2.Queue(rts2.json.getProxy(), args.queue)
            except Exception, e:
Ejemplo n.º 2
0
    args=parser.parse_args()

    logger= Logger(debug=args.debug, args=args).logger # if you need to chage the log format do it here

    # read the run time configuration
    rt=Configuration(logger=logger)
    if not rt.readConfiguration(fileName=args.config):
        logger.error('rts2saf_focus: exiting, wrong syntax, check the configuration file: {0}'.format(args.config))
        sys.exit(1)
    if not rt.checkConfiguration(args=args):
        logger.error('[0]: exiting, check the configuration file: {1}'.format(script, args.config))
        sys.exit(1)

    if not args.fitsFn:
        parser.print_help()
        logger.warn('{0}: no FITS file specified'.format(script))
        sys.exit(1)

    fitsFn=args.fitsFn[0]
    if not os.path.exists(fitsFn):
        logger.error('{0}: file: {1}, does not exist, exiting'.format(script, fitsFn))
        sys.exit(1)

    # check if there is a header element on the list
    # which excludes fitsFn from being processed, e.g. hartmann
    imgp_analysis= ImgpAnalysis(
        scriptName=script, 
        fwhmCmd=rt.cfg['SCRIPT_FWHM'], 
        astrometryCmd=rt.cfg['SCRIPT_ASTROMETRY'], 
        fitsFileName=fitsFn, 
        config=args.config,
Ejemplo n.º 3
0
            for x in q.entries:
                if x.get_target().name and 'OnTargetFocus' in x.get_target(
                ).name:
                    q.clear()
                    logger.info('rts2af_fwhm: cleared queue: {}'.format(
                        args.queue))
                    break
    else:
        proxy = JSONProxy(url=rt.cfg['URL'],
                          username=rt.cfg['USERNAME'],
                          password=rt.cfg['PASSWORD'])
        try:
            proxy.refresh()
        except Exception, e:
            logger.warn(
                'rts2af_fwhm: JSON proxy connection failed: {}, exiting'.
                format(e))
            sys.exit(1)

        tarType = proxy.getSingleValue('EXEC', 'current_type')
        tarName = proxy.getSingleValue('EXEC', 'current_name')
        if 'GLORIA teleoperation' in tarName:  # reserved observing time
            logger.info(
                'rts2af_fwhm: there is a ongoing GLORIA teleoperation, no focus run queued'
            )
        elif 'G' in tarType:  # it is a GRB
            logger.info(
                'rts2af_fwhm: there is now a GRB target selected, no focus run queued'
            )

        else:
Ejemplo n.º 4
0
    if args.emptySlots is not None:
        rtc.cfg['EMPTY_SLOT_NAMES'] = [x.strip() for x in args.emptySlots]

    # ToDo ugly
    if args.filterNames is not None:
        fts = [x.strip() for x in args.filterNames]
        args.filterNames = fts

    rtc.checkConfiguration(args=args)
    # environment
    ev = Environment(debug=args.debug, rt=rtc, logger=logger)

    if not args.basePath:
        parser.print_help()
        logger.warn('rts2saf_analyze: no --basepath specified')
        sys.exit(1)

    if not args.toconsole:
        print 'you may wish to enable logging to console --toconsole'
        print 'log file is written to: {}'.format(args.logfile)

    aRs = AnalyzeRuns(debug=args.debug,
                      basePath=args.basePath,
                      args=args,
                      rt=rtc,
                      ev=ev,
                      logger=logger,
                      xdisplay=XDISPLAY)
    aRs.aggregateRuns()
    if len(aRs.fS) == 0:
Ejemplo n.º 5
0
    if args.emptySlots is not None:
        rtc.cfg['EMPTY_SLOT_NAMES'] = [ x.strip() for x in  args.emptySlots ]

    # ToDo ugly
    if args.filterNames is not None:
        fts = [ x.strip() for x in  args.filterNames ]
        args.filterNames = fts


    rtc.checkConfiguration(args=args)
    # environment
    ev = Environment(debug = args.debug, rt = rtc, logger = logger)

    if not args.basePath:
        parser.print_help()
        logger.warn('rts2saf_analyze: no --basepath specified')
        sys.exit(1)

    if not args.toconsole:
        print 'you may wish to enable logging to console --toconsole'
        print 'log file is written to: {}'.format(args.logfile)


    aRs = AnalyzeRuns(debug = args.debug, basePath = args.basePath, args = args, rt = rtc, ev = ev, logger = logger, xdisplay = XDISPLAY)
    aRs.aggregateRuns()
    if len(aRs.fS) == 0:
        logger.warn('rts2saf_analyze: exiting, no files found in basepath: {}'.format(args.basePath))
        sys.exit(1)

    rFf = aRs.analyzeRuns()