Exemplo n.º 1
0
    def processCommand(self, string):
        #print "Command:", string

        command = immp.parse(string.__str__())

        if command.name() == 'mount_status':
            self.statusLabel.setText((string.__str__())[13:])
            self.updateStatus(int(command.kwargs.get('status', '-1')))

            self.ui.raLabel.setText(
                degtostring(float(command.kwargs.get('ra', '0')) / 15.0))
            self.ui.raLabel.setToolTip(command.kwargs.get('ra', 'unknown'))

            self.ui.decLabel.setText(
                degtostring(float(command.kwargs.get('dec', '0')), True))
            self.ui.decLabel.setToolTip(command.kwargs.get('dec', 'unknown'))

            self.ui.nextRALabel.setText(
                degtostring(float(command.kwargs.get('next_ra', '0')) / 15.0))
            self.ui.nextRALabel.setToolTip(
                command.kwargs.get('next_ra', 'unknown'))

            self.ui.nextDecLabel.setText(
                degtostring(float(command.kwargs.get('next_dec', '0')), True))
            self.ui.nextDecLabel.setToolTip(
                command.kwargs.get('next_dec', 'unknown'))
        else:
            self.ui.logTextEdit.append(string)
Exemplo n.º 2
0
    def processCommand(self, string):
        #print "Command:", string

        command = immp.parse(string.__str__())

        if command.name() == 'fast_status':
            self.updateStatus(command.kwargs)

        elif command.name() in ['current_frame', 'total_frame', 'running_frame']:
            self.binaryType = command.name()
            self.binaryMode = True
            self.binaryLength = int(command.kwargs.get('length', 0))

            if command.name() == 'current_frame':
                self.currentImage.setStatus('mean = %g' % float(command.kwargs.get('mean', 0)))
        elif command.name() in ['current_frame_timeout', 'total_frame_timeout', 'running_frame_timeout']:
            self.timerImage.start(1000)
        elif command.name() == 'current_flux':
            time = float(command.kwargs.get('time', -1))
            flux = float(command.kwargs.get('flux', 0.0))

            self.fluxPlot.setText("time = " + str(time) + "\t flux=" + str(flux))
            self.fluxPlot.append(time, flux)

        elif command.name() == 'accumulated_flux':
            time = float(command.kwargs.get('time', -1))
            flux = float(command.kwargs.get('flux', 0.0))

            self.totalPlot.setText("time = " + str(time) + "\t flux=" + str(flux))
            self.totalPlot.append(time, flux)
Exemplo n.º 3
0
    def processMessage(self, string):
        command = immp.parse(string)

        if command.name() == 'current_frame':
            self.wait_current = False
            self.is_binary = True
            self.binary_length = int(command.kwargs.get('length', 0))
            self.image_format = command.kwargs.get('format', '')
            if self.factory.object.fast_status:
                self.factory.object.fast_status['image_mean'] = float(
                    command.kwargs.get('mean', 0))
            self.image_type = 'current'

        elif command.name() == 'current_frame_timeout':
            self.wait_current = False

        elif command.name() == 'total_frame':
            self.wait_total = False
            self.is_binary = True
            self.binary_length = int(command.kwargs.get('length', 0))
            self.image_format = command.kwargs.get('format', '')
            self.image_type = 'total'

        elif command.name() == 'total_frame_timeout':
            self.wait_total = False

        elif command.name() == 'fast_status' or command.name() == 'status':
            self.factory.object.fast_status = command.kwargs
            if command.kwargs.get('acquisition') == '0':
                self.factory.object.time = []
                self.factory.object.flux = []
                self.factory.object.mean = []

        elif command.name() == 'current_flux':
            if self.factory.object.time and len(
                    self.factory.object.time) > 100000:
                self.factory.object.time = []
                self.factory.object.flux = []
                self.factory.object.mean = []

            self.factory.object.time.append(
                float(command.kwargs.get('time', 0)))
            self.factory.object.flux.append(
                float(command.kwargs.get('flux', 0)))
            self.factory.object.mean.append(
                float(command.kwargs.get('mean', 0)))
Exemplo n.º 4
0
    def processCommand(self, string):
        #print "Command:", string

        command = immp.parse(string.__str__())

        if command.name() == 'channel_status':
            self.statusLabel.setText((string.__str__())[15:])
        elif command.name() == 'current_frame':
            self.binaryMode = True
            self.binaryLength = int(command.kwargs.get('length', 0))
            self.image.message('mean = ' +
                               command.kwargs.get('mean', 'unknown'))
        elif command.name() == 'get_current_frame_timeout' or command.name(
        ) == 'get_current_frame_error':
            self.slotTimerImageEvent()
        elif command.name() == 'get_current_frame_done':
            pass
        else:
            self.ui.logTextEdit.append(string)
Exemplo n.º 5
0
        else:
            name, ra, dec = simbadResolve(string)

    return name, ra, dec


if __name__ == '__main__':
    import sys
    import signal
    import argparse

    signal.signal(signal.SIGINT, signal.SIG_DFL)

    app = QApplication(sys.argv)

    args = immp.parse(' '.join(sys.argv))

    print 'Connecting to ' + args.kwargs.get(
        'host', 'localhost') + ':' + args.kwargs.get('port', '5562')

    client = MountGUI()
    client.show()

    client.setHost(args.kwargs.get('host', 'localhost'),
                   int(args.kwargs.get('port', '5562')))
    client.setAttribute(Qt.WA_DeleteOnClose)

    client.connect(client, SIGNAL("closed()"), app.quit)

    if sys.platform == 'darwin':
        client.raise_()