예제 #1
0
파일: rts2saf_focus.py 프로젝트: RTS2/rts2
    #args.dryFitsFiles='YOUR/HOME/rts-2/scripts/rts2saf/samples'
    #
    if args.verbose:
        args.debug=True
        args.level='DEBUG'
        args.toconsole=True
        
    if args.checkConfig:
        args.toconsole=True

    # logger
    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('rts2saf_focus: exiting, check the configuration file: {0}'.format(args.config))
        sys.exit(1)

    # overwrite config defaults
    rt.cfg['ANALYZE_FLUX'] = args.flux  
    rt.cfg['ANALYZE_ASSOC'] = args.associate
    rt.cfg['ANALYZE_ASSOC_FRACTION'] = args.fractObjs

    if args.FitDisplay:
        rt.cfg['WITH_MATHPLOTLIB'] = True

    # get the environment
예제 #2
0
        args.debug = True
        args.level = 'DEBUG'
        args.toconsole = True

    if args.checkConfig:
        args.toconsole = True

    # logger
    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(
            'rts2saf_focus: exiting, check the configuration file: {0}'.format(
                args.config))
        sys.exit(1)

    # overwrite config defaults
    rt.cfg['ANALYZE_FLUX'] = args.flux
    rt.cfg['ANALYZE_ASSOC'] = args.associate
    rt.cfg['ANALYZE_ASSOC_FRACTION'] = args.fractObjs

    if args.FitDisplay:
예제 #3
0
파일: rts2saf_fwhm.py 프로젝트: RTS2/rts2
    parser.add_argument('--logfile',dest='logfile', default='rts2-debug'.format(prg), help=': %(default)s, logfile name')
    parser.add_argument('--toconsole', dest='toconsole', action='store_true', default=False, help=': %(default)s, log to console')
    parser.add_argument('--config', dest='config', action='store', default='/usr/local/etc/rts2/rts2saf/rts2saf.cfg', help=': %(default)s, configuration file path')
    parser.add_argument('--queue', dest='queue', action='store', default='focusing', help=': %(default)s, queue where to set a focus run')
    parser.add_argument('--tarid', dest='tarId', action='store', default=5, help=': %(default)s, target id of OnTargetFocus')
    parser.add_argument('--fwhmthreshold', dest='fwhmThreshold', action='store', type=float, default=None, help=': %(default)s, threshold to trigger a focus run')
    parser.add_argument('--fitsFn', dest='fitsFn', action='store', default=None, help=': %(default)s, fits file to process')
    parser.add_argument('--ds9display', dest='Ds9Display', action='store_true', default=False, help=': %(default)s, display fits images and region files')
    args=parser.parse_args()
    # logger
    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('rts2saf_focus: exiting, check the configuration file: {0}'.format(args.config))
        sys.exit(1)

    sex= Sextract(debug=args.debug, rt=rt, logger=logger)
    if args.fitsFn==None:
        logger.error('rts2af_fwhm: no --fitsFn specified, exiting'.format(args.fitsFn))
        sys.exit(1)

    elif not os.path.exists(args.fitsFn):
        logger.error('rts2af_fwhm: file: {0}, does not exist, exiting'.format(args.fitsFn))
        sys.exit(1)
예제 #4
0
    parser.add_argument('--debug', dest='debug', action='store_true', default=False, help=': %(default)s,add more output')
    parser.add_argument('--level', dest='level', default='INFO', help=': %(default)s, debug level')
    parser.add_argument('--topath', dest='toPath', metavar='PATH', action='store', default='/var/log', help=': %(default)s, write log file to path') # needs a path where it can always write
    parser.add_argument('--logfile',dest='logfile', default='rts2-debug', help=': %(default)s, logfile name')
    parser.add_argument('--toconsole', dest='toconsole', action='store_true', default=False, help=': %(default)s, log to console')
    parser.add_argument('--config', dest='config', action='store', default='/usr/local/etc/rts2/rts2saf/rts2saf.cfg', help=': %(default)s, configuration file path')
    parser.add_argument( metavar='FITS FN', dest='fitsFn', nargs=1, default=None, help=': %(default)s, FITS file name')

    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)
예제 #5
0
    # logger
    logger = Logger(
        debug=args.debug,
        args=args).logger  # if you need to chage the log format do it here
    # hint to the user
    if defaultCfg in args.config:
        logger.info(
            'rts2saf_focus: using default configuration file: {0}'.format(
                args.config))

    # config
    rtc = Configuration(logger=logger)
    if not rtc.readConfiguration(fileName=args.config):
        logger.error(
            'rts2saf_focus: exiting, wrong syntax, check the configuration file: {0}'
            .format(args.config))
        sys.exit(1)

    # overwrite config defaults
    rtc.cfg['ANALYZE_FLUX'] = args.flux
    rtc.cfg['ANALYZE_ASSOC'] = args.associate
    rtc.cfg['ANALYZE_ASSOC_FRACTION'] = args.fractObjs
    rtc.cfg['FOCUSER_INTERVAL'] = args.focuserInterval
    rtc.cfg['WEIGHTED_MEANS'] = args.means

    if args.FitDisplay:
        rtc.cfg['WITH_MATHPLOTLIB'] = True

    if args.emptySlots is not None:
        rtc.cfg['EMPTY_SLOT_NAMES'] = [x.strip() for x in args.emptySlots]
예제 #6
0
        '--ds9display',
        dest='Ds9Display',
        action='store_true',
        default=False,
        help=': %(default)s, display fits images and region files')
    args = parser.parse_args()
    # logger
    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(
            'rts2saf_focus: exiting, check the configuration file: {0}'.format(
                args.config))
        sys.exit(1)

    sex = Sextract(debug=args.debug, rt=rt, logger=logger)
    if args.fitsFn == None:
        logger.error('rts2af_fwhm: no --fitsFn specified, exiting'.format(
            args.fitsFn))
        sys.exit(1)
예제 #7
0
    args = parser.parse_args()

    if args.debug:
        args.level =  'DEBUG'
        args.toconsole = True

    # logger
    logger =  Logger(debug = args.debug, args = args).logger # if you need to chage the log format do it here
    # hint to the user
    if defaultCfg in args.config:
        logger.info('rts2saf_focus: using default configuration file: {0}'.format(args.config))

    # config
    rtc = Configuration(logger = logger)
    if not rtc.readConfiguration(fileName=args.config):
        logger.error('rts2saf_focus: exiting, wrong syntax, check the configuration file: {0}'.format(args.config))
        sys.exit(1)

    # overwrite config defaults
    rtc.cfg['ANALYZE_FLUX'] = args.flux  
    rtc.cfg['ANALYZE_ASSOC'] = args.associate
    rtc.cfg['ANALYZE_ASSOC_FRACTION'] = args.fractObjs
    rtc.cfg['FOCUSER_INTERVAL'] = args.focuserInterval
    rtc.cfg['WEIGHTED_MEANS'] = args.means


    if args.FitDisplay:
        rtc.cfg['WITH_MATHPLOTLIB'] = True

    if args.emptySlots is not None:
        rtc.cfg['EMPTY_SLOT_NAMES'] = [ x.strip() for x in  args.emptySlots ]