Ejemplo n.º 1
0
    def setupDevices(self, blind=False):
        # setup rts2saf
        # fake arguments
        self.args=Args()
        self.args.sxDebug=False
        self.args.blind=blind
        self.args.verbose=False
        self.args.check=True
        self.args.fetchOffsets=True
        self.args.exposure= 1.887
        self.args.catalogAnalysis=False
        self.args.Ds9Display=False
        self.args.FitDisplay=False
        self.args.flux=True
        self.args.dryFitsFiles='../samples_bootes2'
        # JSON
        self.proxy=JSONProxy(url=self.rt.cfg['URL'],username=self.rt.cfg['USERNAME'],password=self.rt.cfg['PASSWORD'])
        # create Focuser 
        self.foc= CreateFocuser(debug=False, proxy=self.proxy, check=self.args.check, rt=self.rt, logger=logger).create()
        # create filters
        fts=CreateFilters(debug=False, proxy=self.proxy, check=self.args.check, rt=self.rt, logger=logger).create()
        # create filter wheels
        ftwc= CreateFilterWheels(debug=False, proxy=self.proxy, check=self.args.check, rt=self.rt, logger=logger, filters=fts, foc=self.foc)
        ftws=ftwc.create()
        if not ftwc.checkBounds():
            logger.error('setupDevice: filter focus ranges out of bounds, exiting')
            sys.exit(1)

        # create ccd
        ccd= CreateCCD(debug=False, proxy=self.proxy, check=self.args.check, rt=self.rt, logger=logger, ftws=ftws, fetchOffsets=self.args.fetchOffsets).create()
        
        cdv= CheckDevices(debug=False, proxy=self.proxy, blind=self.args.blind, verbose=self.args.verbose, ccd=ccd, ftws=ftws, foc=self.foc, logger=logger)
        cdv.summaryDevices()
        cdv.printProperties()
        cdv.deviceWriteAccess()
        dryFitsFiles=None
        if self.args.dryFitsFiles:
            dryFitsFiles=glob.glob('{0}/{1}'.format(self.args.dryFitsFiles, self.rt.cfg['FILE_GLOB']))
            if len(dryFitsFiles)==0:
                logger.error('setupDevice: no FITS files found in:{}'.format(self.args.dryFitsFiles))
                logger.info('setupDevice: download a sample from wget http://azug.minpet.unibas.ch/~wildi/rts2saf-test-focus-2013-09-14.tgz')
                sys.exit(1)

        # ok evrything is there
        self.rts2safFoc= Focus(debug=False, proxy=self.proxy, args=self.args, dryFitsFiles=dryFitsFiles, ccd=ccd, foc=self.foc, ftws=ftws, rt=self.rt, ev=self.ev, logger=logger)
Ejemplo n.º 2
0
    def setupDevices(self, blind=False):
        # setup rts2saf
        # fake arguments
        self.args = Args()
        self.args.sxDebug = False
        self.args.blind = blind
        self.args.verbose = False
        self.args.check = True
        self.args.fetchOffsets = True
        self.args.exposure = 1.887
        self.args.catalogAnalysis = False
        self.args.Ds9Display = False
        self.args.FitDisplay = False
        self.args.flux = True
        self.args.dryFitsFiles = '../samples_bootes2'
        # JSON
        self.proxy = JSONProxy(url=self.rt.cfg['URL'],
                               username=self.rt.cfg['USERNAME'],
                               password=self.rt.cfg['PASSWORD'])
        # create Focuser
        self.foc = CreateFocuser(debug=False,
                                 proxy=self.proxy,
                                 check=self.args.check,
                                 rt=self.rt,
                                 logger=logger).create()
        # create filters
        fts = CreateFilters(debug=False,
                            proxy=self.proxy,
                            check=self.args.check,
                            rt=self.rt,
                            logger=logger).create()
        # create filter wheels
        ftwc = CreateFilterWheels(debug=False,
                                  proxy=self.proxy,
                                  check=self.args.check,
                                  rt=self.rt,
                                  logger=logger,
                                  filters=fts,
                                  foc=self.foc)
        ftws = ftwc.create()
        if not ftwc.checkBounds():
            logger.error(
                'setupDevice: filter focus ranges out of bounds, exiting')
            sys.exit(1)

        # create ccd
        ccd = CreateCCD(debug=False,
                        proxy=self.proxy,
                        check=self.args.check,
                        rt=self.rt,
                        logger=logger,
                        ftws=ftws,
                        fetchOffsets=self.args.fetchOffsets).create()

        cdv = CheckDevices(debug=False,
                           proxy=self.proxy,
                           blind=self.args.blind,
                           verbose=self.args.verbose,
                           ccd=ccd,
                           ftws=ftws,
                           foc=self.foc,
                           logger=logger)
        cdv.summaryDevices()
        cdv.printProperties()
        cdv.deviceWriteAccess()
        dryFitsFiles = None
        if self.args.dryFitsFiles:
            dryFitsFiles = glob.glob('{0}/{1}'.format(
                self.args.dryFitsFiles, self.rt.cfg['FILE_GLOB']))
            if len(dryFitsFiles) == 0:
                logger.error('setupDevice: no FITS files found in:{}'.format(
                    self.args.dryFitsFiles))
                logger.info(
                    'setupDevice: download a sample from wget http://azug.minpet.unibas.ch/~wildi/rts2saf-test-focus-2013-09-14.tgz'
                )
                sys.exit(1)

        # ok evrything is there
        self.rts2safFoc = Focus(debug=False,
                                proxy=self.proxy,
                                args=self.args,
                                dryFitsFiles=dryFitsFiles,
                                ccd=ccd,
                                foc=self.foc,
                                ftws=ftws,
                                rt=self.rt,
                                ev=self.ev,
                                logger=logger)
Ejemplo n.º 3
0
    ccd = CreateCCD(debug=args.debug,
                    proxy=proxy,
                    ftws=ftws,
                    check=args.checkConfig,
                    fetchOffsets=True,
                    verbose=args.verbose,
                    rt=rt,
                    logger=logger).create()
    if ccd == None or not isinstance(ccd, CCD):
        logger.error(
            'rts2saf_focus: could not create object for CCD: {}, exiting'.
            format(rt.cfg['CCD_NAME']))
        sys.exit(1)

    # filter wheel offsets are at this point read back from CCD
    if not ftwc.checkBounds():
        logger.error(
            'rts2saf_focus: filter focus ranges out of bounds, exiting')
        sys.exit(1)

    # check the presence of the devices and if there is an empty slot on each wheel
    cdv = CheckDevices(debug=args.debug,
                       proxy=proxy,
                       blind=args.blind,
                       verbose=args.verbose,
                       ccd=ccd,
                       ftws=ftws,
                       foc=foc,
                       logger=logger)
    cdv.summaryDevices()
    # while called from IMGP hopefully every device is there
Ejemplo n.º 4
0
    filters= CreateFilters(debug=args.debug, proxy=proxy, check=args.checkConfig, verbose=args.verbose, rt=rt, logger=logger).create()
    ftwc = CreateFilterWheels(filters=filters, foc=foc, debug=args.debug, proxy=proxy, check=args.checkConfig, blind=args.blind, verbose=args.verbose, rt=rt, logger=logger)
    ftws = ftwc.create()
    # at least one even if it is FAKE_FTW
    if ftws==None or not isinstance(ftws[0], FilterWheel):
        logger.error('rts2saf_focus: could not create object for filter wheel: {}, exiting'.format(rt.cfg['FILTER WHEELS INUSE']))
        sys.exit(1)
    # offsets must be fetched at this point, but not in unittest
    ccd= CreateCCD(debug=args.debug, proxy=proxy, ftws=ftws, check=args.checkConfig, fetchOffsets=True, verbose=args.verbose, rt=rt, logger=logger).create()
    if ccd==None or not isinstance(ccd, CCD):
        logger.error('rts2saf_focus: could not create object for CCD: {}, exiting'.format(rt.cfg['CCD_NAME']))
        sys.exit(1)

    # filter wheel offsets are at this point read back from CCD
    if not ftwc.checkBounds():
        logger.error('rts2saf_focus: filter focus ranges out of bounds, exiting')
        sys.exit(1)

    # check the presence of the devices and if there is an empty slot on each wheel
    cdv= CheckDevices(debug=args.debug, proxy=proxy, blind=args.blind, verbose=args.verbose, ccd=ccd, ftws=ftws, foc=foc, logger=logger)
    cdv.summaryDevices()
    # while called from IMGP hopefully every device is there
    if args.checkConfig:

        # are devices writable
        if not cdv.deviceWriteAccess():
            logger.error('rts2saf_focus: exiting')
            logger.info('rts2saf_focus: run {0} --verbose'.format(script))
            sys.exit(1)