def test_createCCD(self): logger.info('== {} =='.format(self._testMethodName)) fts = CreateFilters(debug=False, rt=self.rt, logger=logger).create() foc = CreateFocuser(debug=False, rt=self.rt, logger=logger).create(focDef=0) CreateFilterWheels(debug=False, rt=self.rt, logger=logger, filters=fts, foc=foc) cccd = CreateCCD(debug=False, rt=self.rt, logger=logger, ftws=fts) ccd = cccd.create() self.assertEqual(ccd.name, 'C0')
def test_createFTWs(self): logger.info('== {} =='.format(self._testMethodName)) fts = CreateFilters(debug=False, rt=self.rt, logger=logger).create() foc = CreateFocuser(debug=False, rt=self.rt, logger=logger).create(focDef=0) # no connection to real device foc.focDef = 0 cftw = CreateFilterWheels(debug=False, rt=self.rt, logger=logger, filters=fts, foc=foc) ftw = cftw.create() self.assertEqual(ftw[0].name, 'FAKE_FTW')
try: proxy.refresh() except Exception, e: logger.error( 'rts2saf_focus: no JSON connection for: {0}, {1}, {2}'.format( rt.cfg['URL'], rt.cfg['USERNAME'], rt.cfg['PASSWORD'])) sys.exit(1) # create all devices # attention: .create() at the end # filters are not yet devices # check always True, we need to set limits either from device or from configuration foc = CreateFocuser(debug=args.debug, proxy=proxy, check=True, rangeFocToff=args.focRange, blind=args.blind, verbose=args.verbose, rt=rt, logger=logger).create() if foc == None or not isinstance(foc, Focuser): logger.error( 'rts2saf_focus: could not create object for focuser: {}, exiting'. format(rt.cfg['FOCUSER_NAME'])) sys.exit(1) if args.focDef: foc.writeFocDef(proxy=proxy, focDef=args.focDef) logger.info('rts2saf_focus: {0} FOC_DEF: {1} set'.format( foc.name, args.focDef)) filters = CreateFilters(debug=args.debug,
def test_createFOC(self): logger.info('== {} =='.format(self._testMethodName)) cfoc = CreateFocuser(debug=False, rt=self.rt, logger=logger) foc = cfoc.create(focDef=0) self.assertEqual(foc.name, 'F0')
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)