irrad_control/irrad_interpreter.py
def recv_data(self):
        """Main method which receives raw data and calls interpretation and data storage methods"""

        # Create subscriber for raw and XY-Stage data
        data_sub = self.context.socket(zmq.SUB)

        # Loop over all servers and connect to their respective data streams
        for server in self.server:

            if 'adc' in self.setup['server'][server]['devices']:
                data_sub.connect(self._tcp_addr(self.setup['port']['data'], ip=server))

            if 'temp' in self.setup['server'][server]['devices']:
                data_sub.connect(self._tcp_addr(self.setup['port']['temp'], ip=server))

            if 'stage' in self.setup['server'][server]['devices']:
                data_sub.connect(self._tcp_addr(self.setup['port']['stage'], ip=server))

            # Connect to servers command
            data_sub.connect(self._tcp_addr(self.setup['port']['cmd'], ip=server))

        data_sub.setsockopt(zmq.SUBSCRIBE, '')

        # While event not set receive data with 1 ms wait
        while not self.stop_recv_data.wait(1e-3):

            # Try getting data without blocking. If no data exception is raised.
            try:
                # Get data
                data = data_sub.recv_json(flags=zmq.NOBLOCK)

                # Interpret data
                self.interpret_data(data)

                server = data['meta']['name']

                # If event is not set, store data to hdf5 file
                if not self.stop_write_data[server].is_set():
                    self.store_data(server)
                else:
                    logging.debug("Data of {} is not being recorded...".format(self.setup['server'][server]['name']))

            # No data
            except zmq.Again:
                pass
Main method which receives raw data and calls interpretation and data storage methods
Main method which receives raw data and calls interpretation and data storage methods
Main method which receives raw data and calls interpretation and data storage methods
def recv_data(self):
        data_sub = self.context.socket(zmq.SUB)
        for server in self.server:
            if 'adc' in self.setup['server'][server]['devices']:
                data_sub.connect(self._tcp_addr(self.setup['port']['data'], ip=server))
            if 'temp' in self.setup['server'][server]['devices']:
                data_sub.connect(self._tcp_addr(self.setup['port']['temp'], ip=server))
            if 'stage' in self.setup['server'][server]['devices']:
                data_sub.connect(self._tcp_addr(self.setup['port']['stage'], ip=server))
            data_sub.connect(self._tcp_addr(self.setup['port']['cmd'], ip=server))
        data_sub.setsockopt(zmq.SUBSCRIBE, '')
        while not self.stop_recv_data.wait(1e-3):
            try:
                data = data_sub.recv_json(flags=zmq.NOBLOCK)
                self.interpret_data(data)
                server = data['meta']['name']
                if not self.stop_write_data[server].is_set():
                    self.store_data(server)
                else:
                    logging.debug("Data of {} is not being recorded...".format(self.setup['server'][server]['name']))
            except zmq.Again:
                pass
def recv_data ( self ) : data_sub = self . context . socket ( zmq . SUB ) for server in self . server : if 'adc' in self . setup [ 'server' ] [ server ] [ 'devices' ] : data_sub . connect ( self . _tcp_addr ( self . setup [ 'port' ] [ 'data' ] , ip = server ) ) if 'temp' in self . setup [ 'server' ] [ server ] [ 'devices' ] : data_sub . connect ( self . _tcp_addr ( self . setup [ 'port' ] [ 'temp' ] , ip = server ) ) if 'stage' in self . setup [ 'server' ] [ server ] [ 'devices' ] : data_sub . connect ( self . _tcp_addr ( self . setup [ 'port' ] [ 'stage' ] , ip = server ) ) data_sub . connect ( self . _tcp_addr ( self . setup [ 'port' ] [ 'cmd' ] , ip = server ) ) data_sub . setsockopt ( zmq . SUBSCRIBE , '' ) while not self . stop_recv_data . wait ( 1e-3 ) : try : data = data_sub . recv_json ( flags = zmq . NOBLOCK ) self . interpret_data ( data ) server = data [ 'meta' ] [ 'name' ] if not self . stop_write_data [ server ] . is_set ( ) : self . store_data ( server ) else : logging . debug ( "Data of {} is not being recorded..." . format ( self . setup [ 'server' ] [ server ] [ 'name' ] ) ) except zmq . Again : pass
Main method which receives raw data and calls interpretation and data storage methods
Main method which receives raw data and calls interpretation and data storage methods
"""Main method which receives raw data and calls interpretation and data storage methods""" # Create subscriber for raw and XY-Stage data # Loop over all servers and connect to their respective data streams # Connect to servers command # While event not set receive data with 1 ms wait # Try getting data without blocking. If no data exception is raised. # Get data # Interpret data # If event is not set, store data to hdf5 file # No data
self