예제 #1
0
 def test_accessRoot(self):
     logger.info('== {} =='.format(self._testMethodName))
     args = Args()
     args.toPath = '/'
     args.logfile = 'rts2-debug'
     args.level = 'INFO'
     args.toconsole = False
     lg = Logger(debug=False, args=args)
     # it is a weak assertion since Logger is not yet really unittestable (for developemnt purposes only)
     self.assertIsInstance(
         obj=lg,
         cls=Logger,
         msg='returned object: {} is not of type Logger'.format(type(lg)))
#!/usr/bin/python

from rts2saf.log import Logger
from rts2saf.rts2exec import Rts2Exec
from rts2.json import JSONProxy


class Args(object):
    def __init__(self):
        pass


args = Args()
args.toPath = '/var/log'
args.logfile = 'rts2-debug'
args.level = 'DEBUG'

debug = False
logger = Logger(debug=debug, args=args).logger

proxy = JSONProxy()
ex = Rts2Exec(debug=debug, proxy=proxy, logger=logger)
ex.reeanableEXEC()
logger.info('rts2saf_reenable_exec.py:  reenabled EXEC')
예제 #3
0
#!/usr/bin/python

from rts2saf.log import Logger
from rts2saf.rts2exec import Rts2Exec
from rts2.json import JSONProxy

class Args(object):
    def __init__(self):
        pass

args=Args()
args.toPath='/var/log'
args.logfile= 'rts2-debug'
args.level='DEBUG'

debug=False
logger= Logger(debug=debug, args=args ).logger 


proxy=JSONProxy()
ex= Rts2Exec(debug=debug, proxy=proxy, logger=logger)
ex.reeanableEXEC()
logger.info('rts2saf_reenable_exec.py:  reenabled EXEC')
예제 #4
0
    # used for test the whole process
    # there is no environment, specify your absolute path
    # if you need it
    #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)
예제 #5
0
파일: rts2saf_focus.py 프로젝트: RTS2/rts2
    # used for test the whole process
    # there is no environment, specify your absolute path
    # if you need it
    #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
예제 #6
0
파일: rts2saf_fwhm.py 프로젝트: RTS2/rts2
    parser= argparse.ArgumentParser(prog=prg, description='rts2saf calculate fwhm')
    parser.add_argument('--debug', dest='debug', action='store_true', default=False, help=': %(default)s,add more output')
    parser.add_argument('--sxdebug', dest = 'sxDebug', action = 'store_true', default = False, help = ': %(default)s,add more output on SExtract')
    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 always to write somwhere
    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)
예제 #7
0
    from rts2saf.config import Configuration
    from rts2saf.log import Logger

    script=os.path.basename(__file__)
    parser= argparse.ArgumentParser(prog=script, description='rts2asaf online image processing')
    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)
예제 #8
0
    # ToDo    parser.add_argument('--display-failures', dest = 'display_failures', action = 'store_true', default = False, help = ': %(default)s, display focus run where the fit failed')
    parser.add_argument('--means',
                        dest='means',
                        action='store_true',
                        default=False,
                        help=': %(default)s, calculate weighted means')

    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)
예제 #9
0
                        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)
예제 #10
0
    parser.add_argument('--flux', dest = 'flux', action = 'store_true', default = False, help = ': %(default)s, do flux analysis')
    parser.add_argument('--model', dest = 'model', action = 'store_true', default = False, help = ': %(default)s, fit temperature model')
    parser.add_argument('--fraction', dest = 'fractObjs', action = 'store', default = 0.5, type = float, help = ': %(default)s, fraction of objects which must be present on each image, base: object number on reference image, this option is used only together with --associate')
    parser.add_argument('--emptySlots', dest = 'emptySlots', action = 'store', default = None, type = str, nargs = '+', help = ': %(default)s, list of SPACE separated names of the empty slots')
    parser.add_argument('--focuser-interval', dest = 'focuserInterval', action = 'store', default = list(), type = int, nargs = '+', help = ': %(default)s, focuser position interval, positions out side this interval will be ignored')
# ToDo    parser.add_argument('--display-failures', dest = 'display_failures', action = 'store_true', default = False, help = ': %(default)s, display focus run where the fit failed')
    parser.add_argument('--means', dest = 'means', action = 'store_true', default = False, help = ': %(default)s, calculate weighted means')

    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