Exemplo n.º 1
0
    def __init__(self):

        ChimeraObject.__init__(self)

        # debug log
        # self._debugLog = None
        self._debuglog = logging.getLogger("_tpldebug_")
        logfile = os.path.join(SYSTEM_CONFIG_DIRECTORY, "tpl.log")
        if os.path.exists(logfile):
            shutil.move(logfile, os.path.join(SYSTEM_CONFIG_DIRECTORY, "tpl.log_%s" % time.strftime("%Y%m%d-%H%M%S")))

        _log_handler = logging.FileHandler(logfile)
        _log_handler.setFormatter(
            logging.Formatter(
                fmt="%(asctime)s[%(levelname)s:%(threadName)s]-%(name)s-(%(filename)s:%(lineno)d):: %(message)s"
            )
        )
        # _log_handler.setLevel(logging.DEBUG)
        self._debuglog.setLevel(logging.DEBUG)
        self._debuglog.addHandler(_log_handler)
        self.log.setLevel(logging.INFO)

        # Command counter
        self.next_command_id = 1
        self.last_cmd_deleted = 0

        # Store received objects
        self.commands_sent = {}

        self._expect = [
            "(?P<CMDID>\d+) DATA INLINE (?P<OBJECT>\S+)=(?P<VALUE>.+)",
            "(?P<CMDID>\d+) DATA OK (?P<OBJECT>\S+)",
            "(?P<CMDID>\d+) COMMAND (?P<STATUS>\S+)",
            "(?P<CMDID>\d+) EVENT ERROR (?P<OBJECT>\S+):(?P<ENCM>(.*?)\s*)",
        ]
Exemplo n.º 2
0
    def __init__(self):
        ChimeraObject.__init__(self)

        self._position = 0
        self._slewing = False
        self._slitOpen = False
        self._abort = threading.Event()
Exemplo n.º 3
0
    def __init__(self):

        ChimeraObject.__init__(self)

        self._tty = None
        self._slewRate = None
        self._abort = threading.Event()
        self._slewing = False

        self._errorNo = 0
        self._errorString = ""

        self._lastAlignMode = None
        self._parked = False

        self._target_az = None
        self._target_alt = None

        # how much arcseconds / second for every slew rate
        # and direction
        self._calibration = {}
        self._calibration_time = 3.0
        self._calibrationFile = os.path.expandvars(
            "$HOME/.chimera/move_calibration.bin")

        for rate in SlewRate:
            self._calibration[rate] = {}
            for direction in Direction:
                self._calibration[rate][direction] = 1

        self._calibrated = False
Exemplo n.º 4
0
    def __init__(self):
        '''
		Constructor.
		'''

        ChimeraObject.__init__(self)

        #
        # Reading in configuration parameters
        #
        config = ConfigParser.RawConfigParser()

        if os.path.exists(
                os.path.join(os.path.expanduser('~/.chimera'), 'tao.cfg')):
            config.read(
                os.path.join(os.path.expanduser('~/.chimera'), 'tao.cfg'))
        else:
            log.warning(
                'No user defined configuration found at %s. Using default values.'
                % (os.path.join(os.path.expanduser('~/.chimera'), 'tao.cfg')))
            config.read(os.path.join(os.path.join(cfgpath, '../../tao.cfg')))

        #
        # Setting configuration parameters
        #
        self.stdFlag = config.get('TargetsInfo', 'Standard')
        self.sciFlag = config.get('TargetsInfo', 'Science')
        self.stdUser = config.get('TargetsInfo', 'stdUser')
        self.sciUser = config.get('TargetsInfo', 'sciUser')
        self.stdFile = config.get('TargetsInfo', 'stdFile')
        self.sciFile = config.get('TargetsInfo', 'sciFile')
        self.PATH = os.path.expanduser(config.get('Local', 'PATH'))

        self.sitelat = float(config.get('Site', 'sitelat'))
        self.sitelong = float(config.get('Site', 'sitelong'))
        self.sunMaxAlt = float(config.get('Site', 'sunMaxAlt'))

        self.filters = [
            i.replace(' ', '')
            for i in config.get('Instrument', 'Filters').split(',')
        ]
        self.nfilters = len(self.filters)
        self.stdExpTime = [
            float(i)
            for i in config.get('TargetsInfo', 'stdExpTime').split(',')
        ]
        self.sciExpTime = [
            float(i)
            for i in config.get('TargetsInfo', 'sciExpTime').split(',')
        ]

        self.stdMaxAirmass = float(config.get('TargetsInfo', 'stdMaxAirmass'))

        #
        # These are time bins, which breaks the night in timely intervals. Bins is the time at the begining of the bin
        # and Mask is percent full.
        self.obsTimeBins = []
        self.obsTimeMask = []

        self.isJD = False
Exemplo n.º 5
0
    def __init__(self):
        ChimeraObject.__init__(self)

        self.abort = threading.Event()
        self.abort.clear()

        self.__isExposing = threading.Event()
Exemplo n.º 6
0
    def __init__(self):
        ChimeraObject.__init__(self)

        self.telescope = None
        self.server = None

        self.error = False
Exemplo n.º 7
0
    def __init__(self):
        ChimeraObject.__init__(self)

        self._srv = None
        self._dispatcher = None
        self._srvThread = None
        self.host = None
Exemplo n.º 8
0
    def __init__(self):
        ChimeraObject.__init__(self)

        self.abort = threading.Event()
        self.abort.clear()

        self.__isExposing = threading.Event()
Exemplo n.º 9
0
    def __init__(self):
        ChimeraObject.__init__(self)

        self._srv = None
        self._dispatcher = None
        self._srvThread = None
        self.host = None
Exemplo n.º 10
0
    def __init__(self):
        ChimeraObject.__init__(self)


        self._base_instrument_list = ["site", "telescope", "camera", "dome", "scheduler", "robobs",
                                      "domefan", "weatherstations"]
        self._instrument_list = {}

        self._operationStatus = OrderedDict()

        # self._operationStatus = {
        #                          "site":            [ InstrumentOperationFlag.UNSET, ] ,
        #                          "telescope":       [ InstrumentOperationFlag.UNSET, ] ,
        #                          "camera":          [ InstrumentOperationFlag.UNSET, ] ,
        #                          "dome":            [ InstrumentOperationFlag.UNSET, ] ,
        #                          "scheduler":       [ InstrumentOperationFlag.UNSET, ] ,
        #                          "domefan":         [ InstrumentOperationFlag.UNSET, ] ,
        #                          "weatherstation":  [ InstrumentOperationFlag.UNSET, ] ,
        #                          }

        self._telegramBroadcast = False
        self._telegramSocket = None
        self._testIP = '8.8.8.8' # Use google's dns IP as beacon to network connectivity

        self._log_handler = None

        self.checklist = None
        self.machine = None
        self.bot = None
Exemplo n.º 11
0
 def __init__(self):
     ChimeraObject.__init__(self)
     self.rob_state = RobState.OFF
     self._current_program = None
     self._current_program_condition = threading.Condition()
     self._no_program_on_queue = False
     self._debuglog = None
     self.machine = None
Exemplo n.º 12
0
    def __init__(self):
        ChimeraObject.__init__(self)

        self.abort = threading.Event()
        self.abort.clear()

        self.__isExposing = threading.Event()

        self.extra_header_info = dict()
Exemplo n.º 13
0
    def __init__(self):
        ChimeraObject.__init__(self)

        self.tty = None
        self.abort = threading.Event()

        self._slewing = False
        self._slitOpen = False

        self._az_shift = 0
Exemplo n.º 14
0
	def __init__(self):
		'''
		Constructor.
		'''
        
		ChimeraObject.__init__(self)
		self.sunMaxAlt = -18.
		self.isJD = False
		self.tbin = 1./60./24. # Default time bin is 1 minute.
		self.tolairmass = 0.01
Exemplo n.º 15
0
    def __init__(self):
        ChimeraObject.__init__(self)

        self.queue = Queue.Queue()
        self._mode = None

        # to reuse telescope proxy on control method
        self._controlTel = None
        self._controlDrv = None
        # to cache for az_resolution of the dome
        self.controlAzRes = None
Exemplo n.º 16
0
    def __init__ (self):
        ChimeraObject.__init__ (self)

        self.tty = None

        self._directions = {Direction.IN : "FI",
                            Direction.OUT: "FO"}

        self._modes = {Mode.Manual: "M",
                       Mode.Free  : "F",
                       Mode.Auto_A: "A",
                       Mode.Auto_B: "B"}
Exemplo n.º 17
0
    def __init__(self):
        ChimeraObject.__init__(self)

        self.imageRequest = None
        self.filter = None

        self.currentRun = None

        self.best_fit = None

        self._debugging = False
        self._debug_images = []
        self._debug_image = 0

        self._log_handler = None
Exemplo n.º 18
0
    def __init__(self):
        ChimeraObject.__init__(self)

        self.imageRequest = None
        self.filter = None

        self.currentRun = None

        self.best_fit = None

        self._debugging = False
        self._debug_images = []
        self._debug_image = 0

        self._log_handler = None
Exemplo n.º 19
0
    def __init__(self):

        ChimeraObject.__init__(self)

        # Command counter
        self.next_command_id = 1
        self.last_cmd_deleted = 0

        # Store received objects
        self.commands_sent = {}

        self._expect = [ '(?P<CMDID>\d+) DATA INLINE (?P<OBJECT>\S+)=(?P<VALUE>.+)',
                         '(?P<CMDID>\d+) DATA OK (?P<OBJECT>\S+)',
                         '(?P<CMDID>\d+) COMMAND (?P<STATUS>\S+)',
                         '(?P<CMDID>\d+) EVENT ERROR (?P<OBJECT>\S+):(?P<ENCM>(.*?)\s*)']
Exemplo n.º 20
0
    def __init__(self):
        ChimeraObject.__init__(self)

        self._thesky = None
        self._telescope = None
        self._term = threading.Event()
        self._idle_time = 0.2
        self._target = None

        try:
            self._site = self.getManager().getProxy(self['site'])
            self._gotSite = True
        except:
            self._site = Site()
            self._gotSite = False
Exemplo n.º 21
0
    def __init__(self):
        ChimeraObject.__init__(self)

        self.queue = Queue.Queue()
        self._mode = None

        # to reuse telescope proxy on control method
        self._tel = None
        self._telChanged = False

        # to cache for az_resolution of the dome
        self.controlAzRes = None

        self._waitAfterSlew = threading.Event()
        self._waitAfterSlew.clear()
Exemplo n.º 22
0
    def __init__(self):
        ChimeraObject.__init__(self)

        self.queue = Queue.Queue()
        self._mode = None

        # to reuse telescope proxy on control method
        self._tel = None
        self._telChanged = False

        # to cache for az_resolution of the dome
        self.controlAzRes = None

        self._waitAfterSlew = threading.Event()
        self._waitAfterSlew.clear()
Exemplo n.º 23
0
	def __init__(self):
		'''
		Constructor.
		'''
        
		ChimeraObject.__init__(self)
		
		#
		# Reading in configuration parameters
		#
		config = ConfigParser.RawConfigParser()
		
		if os.path.exists(os.path.join(os.path.expanduser('~/.chimera'),'tao.cfg')):
			config.read(os.path.join(os.path.expanduser('~/.chimera'),'tao.cfg'))
		else:
			log.warning('No user defined configuration found at %s. Using default values.'%(os.path.join(os.path.expanduser('~/.chimera'),'tao.cfg')))
			config.read(os.path.join(os.path.join(cfgpath,'../../tao.cfg')))

		#
		# Setting configuration parameters
		#
		self.stdFlag = config.get('TargetsInfo', 'Standard')
		self.sciFlag = config.get('TargetsInfo', 'Science')
		self.stdUser = config.get('TargetsInfo', 'stdUser')
		self.sciUser = config.get('TargetsInfo', 'sciUser')
		self.stdFile = config.get('TargetsInfo', 'stdFile')
		self.sciFile = config.get('TargetsInfo', 'sciFile')
		self.PATH = os.path.expanduser(config.get('Local', 'PATH'))
		
		self.sitelat = float(config.get('Site','sitelat'))
		self.sitelong = float(config.get('Site','sitelong'))
		self.sunMaxAlt = float(config.get('Site','sunMaxAlt'))
		
		self.filters = [i.replace(' ', '') for i in config.get('Instrument', 'Filters').split(',')]
		self.nfilters = len(self.filters)
		self.stdExpTime = [float(i) for i in config.get('TargetsInfo', 'stdExpTime').split(',')]
		self.sciExpTime = [float(i) for i in config.get('TargetsInfo', 'sciExpTime').split(',')]

		self.stdMaxAirmass = float(config.get('TargetsInfo','stdMaxAirmass'))

		#
		# These are time bins, which breaks the night in timely intervals. Bins is the time at the begining of the bin
		# and Mask is percent full. 
		self.obsTimeBins = []
		self.obsTimeMask = []

		self.isJD = False
Exemplo n.º 24
0
    def __init__(self):
        ChimeraObject.__init__(self)

        self.__exposing = False
        self.__cooling = False

        self.__abort = threading.Event()
        self.__lastFilter = 0
        self.__temperature = 20.0
        self.__setpoint = 0
        self.__lastFrameStart = 0

        self._adcs = {"12 bits": 0}

        self._binnings = {"1x1": 0, "2x2": 1, "3x3": 2, "9x9": 9}

        self._binning_factors = {"1x1": 1, "2x2": 2, "3x3": 3, "4x4": 4}
Exemplo n.º 25
0
    def __init__(self):
        ChimeraObject.__init__(self)

        self.imageRequest = None
        self.filter = None

        self.currentRun = None

        self._debugging = False
        self._debug_images = []
        self._debug_image = 0

        self._log_handler = None

        self._state = GuiderStatus.OFF

        self.abort = threading.Event()
        self.abort.clear()
Exemplo n.º 26
0
    def __init__(self):
        ChimeraObject.__init__(self)
        self._abort = threading.Event()
        self._abort.clear()

        self.imageRequest = None
        self.filter = None

        self.currentRun = None

        self.best_fit = None

        self._debugging = False
        self._debug_images = []
        self._debug_image = 0

        self._log_handler = None

        self._start = 0
        self._end = 0
Exemplo n.º 27
0
    def __init__(self):
        ChimeraObject.__init__(self)

        self.__slewing = False
        self._az = Coord.fromDMS(0)
        self._alt = Coord.fromDMS(70)

        self._slewing = False
        self._tracking = True
        self._parked = False

        self._abort = threading.Event()

        try:
            self._site = self.getManager().getProxy(self['site'])
            self._gotSite = True
        except:
            self._site = Site()
            self._gotSite = False

        self._setRaDecFromAltAz()
Exemplo n.º 28
0
    def __init__(self):
        ChimeraObject.__init__(self)

        self._operationStatus = {
                                 "site":            InstrumentOperationFlag.UNSET,
                                 "telescope":       InstrumentOperationFlag.UNSET,
                                 "camera":          InstrumentOperationFlag.UNSET,
                                 "dome":            InstrumentOperationFlag.UNSET,
                                 "scheduler":       InstrumentOperationFlag.UNSET,
                                 "domefan":         InstrumentOperationFlag.UNSET,
                                 "weatherstation":  InstrumentOperationFlag.UNSET,
                                 }

        self._telegramBroadcast = False
        self._telegramSocket = None
        self._testIP = '8.8.8.8' # Use google's dns IP as beacon to network connectivity

        self._log_handler = None

        self.checklist = None
        self.machine = None
        self.bot = None
Exemplo n.º 29
0
    def __init__(self):
        ChimeraObject.__init__(self)

        self.drv = SBIGDrv()
        self.ccd = SBIGDrv.imaging
        self.dev = SBIGDrv.usb

        self.lastTemp = 0
        self.lastFilter = None

        self.lastFrameStartTime = 0
        self.lastFrameTemp = None
        self.lastFrameFilename = ""

        self.term = threading.Event()

        self.setHz(1.0 / 5)

        self._supports = {
            CameraFeature.TEMPERATURE_CONTROL: True,
            CameraFeature.PROGRAMMABLE_GAIN: False,
            CameraFeature.PROGRAMMABLE_OVERSCAN: False,
            CameraFeature.PROGRAMMABLE_FAN: False,
            CameraFeature.PROGRAMMABLE_LEDS: True,
            CameraFeature.PROGRAMMABLE_BIAS_LEVEL: False
        }

        self._ccds = {
            CCD.IMAGING: SBIGDrv.imaging,
            CCD.TRACKING: SBIGDrv.tracking
        }

        self._adcs = {"12 bits": 0}

        self._binnings = {"1x1": 0, "2x2": 1, "3x3": 2, "9x9": 9}

        self._binning_factors = {"1x1": 1, "2x2": 2, "3x3": 3, "4x4": 4}
Exemplo n.º 30
0
    def __init__(self):
        ChimeraObject.__init__(self)

        self._supports = {}
Exemplo n.º 31
0
    def __init__(self):
        ChimeraObject.__init__(self)

        self._sun = ephem.Sun()
        self._moon = ephem.Moon()
Exemplo n.º 32
0
 def __init__(self):
     ChimeraObject.__init__(self)
     self.target = None
     self.last_update = datetime.datetime.now()
Exemplo n.º 33
0
    def __init__(self):
        ChimeraObject.__init__(self)

        self._supports = {}
Exemplo n.º 34
0
    def __init__(self):
        ChimeraObject.__init__(self)

        self.imagesByID = OrderedDict()
        self.imagesByPath = OrderedDict()
Exemplo n.º 35
0
 def __init__ (self):
     ChimeraObject.__init__ (self)
     self.ntrials = 0             # number times we try to center on a field
     self.nfields = 0             # number of fields we try to center on 
     self.checkedpointing = False # True = Standard field is verified
     self.currentField = 0        # counts fields tried to verify
Exemplo n.º 36
0
    def __init__(self):
        ChimeraObject.__init__(self)

        self.imageRequest = None
        self.filter = None
        self.currentRun = None
Exemplo n.º 37
0
    def __init__ (self):
        ChimeraObject.__init__(self)

        raise Exception("oops in __init__")
Exemplo n.º 38
0
    def __init__(self):
        ChimeraObject.__init__(self)

        self._park_position = None
Exemplo n.º 39
0
 def __init__(self):
     ChimeraObject.__init__ (self)
     self.answer = 42
Exemplo n.º 40
0
 def __init__(self):
     ChimeraObject.__init__(self)
     self.counter = 0
     self.results = []
Exemplo n.º 41
0
 def __init__ (self):
     ChimeraObject.__init__(self)
     self.counter = 0
     self.results = []
Exemplo n.º 42
0
 def __init__ (self):
     ChimeraObject.__init__(self)
Exemplo n.º 43
0
 def __init__ (self):
     ChimeraObject.__init__(self)
     self.counter = 0
Exemplo n.º 44
0
 def __init__(self):
     ChimeraObject.__init__(self)
     self.ntrials = 0  # number times we try to center on a field
     self.nfields = 0  # number of fields we try to center on
     self.checkedpointing = False  # True = Standard field is verified
     self.currentField = 0  # counts fields tried to verify
Exemplo n.º 45
0
    def __init__(self):
        ChimeraObject.__init__(self)

        self._sun = ephem.Sun()
        self._moon = ephem.Moon()
Exemplo n.º 46
0
 def __init__(self):
     ChimeraObject.__init__(self)
     self.answer = 42
Exemplo n.º 47
0
            def __init__(self):
                ChimeraObject.__init__(self)

                self.counter = 0
Exemplo n.º 48
0
 def __init__(self):
     ChimeraObject.__init__(self)
     
     self.imagesByID   = {}
     self.imagesByPath = {}
Exemplo n.º 49
0
 def __init__(self):
     ChimeraObject.__init__(self)
     
     self.imagesByID   = {}
     self.imagesByPath = {}
Exemplo n.º 50
0
 def __init__(self):
     ChimeraObject.__init__(self)
     self.machine = Machine(SequentialScheduler(), self)
     self.proxies = {}
     self.hostPort = ''
    def __init__(self):
        ChimeraObject.__init__(self)

        raise Exception("oops in __init__")
Exemplo n.º 52
0
    def __init__(self):
        ChimeraObject.__init__(self)

        self.console = None
Exemplo n.º 53
0
 def __init__(self):
     ChimeraObject.__init__(self)
     
     self.executor = None
     self.scheduler = None
     self.machine = None
Exemplo n.º 54
0
            def __init__(self):
                ChimeraObject.__init__(self)

                self.t0 = time.time()
 def __init__(self):
     ChimeraObject.__init__(self)
Exemplo n.º 56
0
    def __init__(self):
        ChimeraObject.__init__(self)

        self._in_fifo = None
        self._out_fifo = None