Пример #1
0
 def __init__(self,
              min_sum = None,
              **kwds):
     super().__init__(**kwds)
     self.tcp_message = tcpMessage.TCPMessage(message_type = "Find Sum",
                                              message_data = {"min_sum" : min_sum},
                                              test_mode = self.test_mode)
Пример #2
0
    def __init__(self,
                 directory=None,
                 length=None,
                 name=None,
                 overwrite=True,
                 parameters=None,
                 **kwds):
        super().__init__(**kwds)
        self.directory = directory
        self.length = length
        self.name = name
        self.parameters = parameters

        data_dict = {
            "directory": self.directory,
            "length": self.length,
            "name": self.name,
            "overwrite": overwrite
        }
        if parameters is not None:
            data_dict["parameters"] = parameters

        self.tcp_message = tcpMessage.TCPMessage(message_type="Take Movie",
                                                 message_data=data_dict,
                                                 test_mode=self.test_mode)
Пример #3
0
def moveStageMessage(stagex, stagey, is_other=False):
    return tcpMessage.TCPMessage(message_type="Move Stage",
                                 message_data={
                                     "stage_x": stagex,
                                     "stage_y": stagey,
                                     "is_other": is_other
                                 })
Пример #4
0
 def setup(self, node):
     # Create message and add delay time for accurate dave time estimates
     self.message = tcpMessage.TCPMessage(message_type = "Pause");
     
     # Define pause behaviors
     self.should_pause = True
     self.should_pause_default = True
Пример #5
0
 def __init__(self, x=None, y=None, **kwds):
     super().__init__(**kwds)
     self.tcp_message = tcpMessage.TCPMessage(message_type="Move Stage",
                                              message_data={
                                                  "stage_x": x,
                                                  "stage_y": y
                                              },
                                              test_mode=self.test_mode)
Пример #6
0
    def __init__(self, stage_x=0.0, stage_y=0.0, **kwds):
        super().__init__(**kwds)

        self.tcp_message = tcpMessage.TCPMessage(message_type="Move Stage",
                                                 message_data={
                                                     "stage_x": stage_x,
                                                     "stage_y": stage_y
                                                 })
Пример #7
0
    def setup(self, node):
        self.directory = node.find("directory").text
        self.message = tcpMessage.TCPMessage(
            message_type="Set Directory",
            message_data={"directory": self.directory})

        # Require validation
        self.id = self.message.getType() + " "
        self.id += self.directory
Пример #8
0
 def __init__(self, mode_name=None, locked=None, **kwds):
     super().__init__(**kwds)
     self.tcp_message = tcpMessage.TCPMessage(
         message_type="Set Focus Lock Mode",
         message_data={
             "mode_name": mode_name,
             "locked": locked
         },
         test_mode=self.test_mode)
Пример #9
0
 def __init__(self, filename=None, prog_type=None, **kwds):
     super().__init__(**kwds)
     self.tcp_message = tcpMessage.TCPMessage(
         message_type="Set Progression",
         message_data={
             "filename": filename,
             "type": prog_type
         },
         test_mode=self.test_mode)
Пример #10
0
    def __init__(self, directory="", filename="", length=1, **kwds):
        super().__init__(**kwds)

        self.tcp_message = tcpMessage.TCPMessage(message_type="Take Movie",
                                                 message_data={
                                                     "name": filename,
                                                     "directory": directory,
                                                     "length": length
                                                 })
Пример #11
0
    def setup(self, node):
        self.directory = node.find("directory").text
        import os
        if not os.path.exists(self.directory):
            os.makedirs(self.directory)
        self.message = tcpMessage.TCPMessage(message_type = "Set Directory",
                                             message_data = {"directory": self.directory})

        # Require validation
        self.id = self.message.getType() + " "
        self.id += self.directory
Пример #12
0
    def setup(self, node):
        self.stage_x = float(node.find("stage_x").text)
        self.stage_y = float(node.find("stage_y").text)
        self.message = tcpMessage.TCPMessage(message_type = "Move Stage",
                                             message_data = {"stage_x" : self.stage_x,
                                                             "stage_y" : self.stage_y})

        # Create id to indicate required validation
        self.id = self.message.getType() + " "
        self.id += "stage_x: " + str(self.stage_x) + " "
        self.id += "stage_y: " + str(self.stage_y)
Пример #13
0
    def setup(self, node):

        # Prepare delay timer
        self.delay_timer = QtCore.QTimer(self)
        self.delay_timer.setSingleShot(True)
        self.delay_timer.timeout.connect(self.handleTimerComplete)
        self.delay = int(node.find("wakeup").text)
        
        # Create message and add delay time for accurate dave time estimates
        self.message = tcpMessage.TCPMessage(message_type = "Delay",
                                             message_data = {"delay": self.delay});
        self.message.addResponse("duration", self.delay)
Пример #14
0
    def setup(self, node):
        p_node = node.find("parameters")
        if (p_node.attrib["type"] == "int"):
            self.parameters = int(node.find("parameters").text)
        else:
            self.parameters = node.find("parameters").text
        self.message = tcpMessage.TCPMessage(message_type = "Set Parameters",
                                             message_data = {"parameters" : self.parameters})

        # Require validation
        self.id = self.message.getType() + " "
        self.id += str(self.parameters)
Пример #15
0
    def setup(self, node):
        self.protocol_name = node.text
        self.protocol_is_running = False

        self.message = tcpMessage.TCPMessage(message_type = "Kilroy Protocol",
                                             message_data = {"name": self.protocol_name})

        # Require validation.
        #
        # FIXME: This should be '+=' not '='?
        #
        self.id = self.message.getType() + " "
        self.id = self.protocol_name        
Пример #16
0
    def setup(self, node):

        # Look for message data
        if node.find("subject") is not None:
            self.email_subject = node.find("subject").text
        if node.find("body") is not None:
            self.email_body = node.find("body").text

        # Create message data
        message_data = {"subject": self.email_subject, "body": self.email_body}

        self.message = tcpMessage.TCPMessage(message_type="Dave Email",
                                             message_data=message_data)
Пример #17
0
 def __init__(self,
              focus_scan = None,
              num_focus_checks = None,
              scan_range = None,
              z_center = None,
              **kwds):
     super().__init__(**kwds)
     self.tcp_message = tcpMessage.TCPMessage(message_type = "Check Focus Lock",
                                              message_data = {"focus_scan" : focus_scan,
                                                              "num_focus_checks" : num_focus_checks,
                                                              "scan_range" : scan_range,
                                                              "z_center" : z_center},
                                              test_mode = self.test_mode)
Пример #18
0
    def sendTestMessage(self):
        """
        Send test messages.
        """
        if (self.message_ID == 1):
            # Create Test message
            message = tcpMessage.TCPMessage(message_type="Stage Position",
                                            message_data={
                                                "Stage_X": 100.00,
                                                "Stage_Y": 0.00
                                            })
        elif (self.message_ID == 2):
            message = tcpMessage.TCPMessage(message_type="Movie",
                                            message_data={
                                                "Name": "Test_Movie_01",
                                                "Parameters": 1
                                            })

        else:
            message = tcpMessage.TCPMessage(message_type="Done")

        self.message_ID += 1
        self.sent_message = message
        self.client.sendMessage(message)
Пример #19
0
def movieMessage(filename, directory):
    """
    Creates a movie message for communication via TCPClient.

    filename - The name of the movie.
    directory - Where to save the movie.
    """
    #
    # Note - We don't use 'overwrite' = True as the captureStart() method
    #        is supposed to take care of removing the previous film.
    #
    return tcpMessage.TCPMessage(message_type="Take Movie",
                                 message_data={
                                     "name": filename,
                                     "directory": directory,
                                     "length": 1
                                 })
Пример #20
0
    def setup(self, node):        
        # Determine the number of focus checks
        if node.find("num_focus_checks") is not None:
            self.num_focus_checks = int(node.find("num_focus_checks").text)
        
        # Add focus_scan flag if provided
        if node.find("focus_scan") is not None:
            self.focus_scan = True

        # Add range if provided
        if node.find("scan_range") is not None:
            self.scan_range = float(node.find("scan_range").text)

        message_data = {"num_focus_checks": self.num_focus_checks,
                        "focus_scan": self.focus_scan,
                        "scan_range": self.scan_range}
        
        self.message = tcpMessage.TCPMessage(message_type = "Check Focus Lock",
                                             message_data = message_data)
Пример #21
0
    def setup(self, node):

        # Prepare source and target paths and decide wheter to delete the source after
        self.source_path = node.find("source_path").text
        self.target_path = node.find("target_path").text
        self.delete_source = eval(node.find("delete_source").text)

        # Create message and add delay time for accurate dave time estimates
        self.message = tcpMessage.TCPMessage(message_type="Copy",
                                             message_data={
                                                 "source_path":
                                                 self.source_path,
                                                 "target_path":
                                                 self.target_path,
                                                 "delete_source":
                                                 self.delete_source
                                             })
        self.message.addResponse(
            "duration", 1000
        )  #assume 1 second for getting the subproccess of copying going
Пример #22
0
    def setup(self, node):
        self.name = node.find("name").text
        self.length = int(node.find("length").text)

        self.min_spots = 0
        if node.find("min_spots") is not None:
            self.min_spots = int(node.find("min_spots").text)

        message_data = {
            "name": self.name,
            "length": self.length,
            "min_spots": self.min_spots,
            "parameters": None
        }

        if node.find("parameters") is not None:
            message_data["parameters"] = node.find("parameters").text

        if node.find("directory") is not None:
            message_data["directory"] = node.find("directory").text

        if node.find("overwrite") is not None:
            message_data["overwrite"] = True  # Default is to overwrite

            boolean_text = node.find("overwrite").text
            if (boolean_text.lower() == "false"):
                message_data["overwrite"] = False

        self.message = tcpMessage.TCPMessage(message_type="Take Movie",
                                             message_data=message_data)

        # Require validation.
        #
        # FIXME: This should be '+=' not '='?
        #
        self.id = self.message.getType() + " "
        self.id = str(self.length) + " "
        if message_data["parameters"] is not None:
            self.id = str(message_data["parameters"])
Пример #23
0
    def setup(self, node):

        self.type = node.find("type").text
        message_data = {"type" : self.type}

        # File progression.
        if node.find("filename") is not None:
            message_data["filename"] = node.find("filename").text

        # Math progression.
        elif node.find("channel") is not None:
            channels = []
            for ch_node in [x for x in node if (x.tag == "channel")]:
                channel = int(ch_node.text)
                start = float(ch_node.attrib["start"])

                if "frames" in ch_node.attrib:
                    frames = int(ch_node.attrib["frames"])
                else:
                    frames = 100

                if "inc" in ch_node.attrib:
                    inc = float(ch_node.attrib["inc"])
                else:
                    inc = 0.0
    
                channels.append([channel, start, frames, inc])

            message_data["channels"] = channels
        
        self.message = tcpMessage.TCPMessage(message_type = "Set Progression",
                                             message_data = message_data)

        # Require validation only for provided filenames
        if node.find("filename") is not None:
            self.id = self.message.getType() + " "
            self.id += node.find("filename").text   
Пример #24
0
 def __init__(self, **kwds):
     super().__init__(**kwds)
     self.tcp_message = tcpMessage.TCPMessage(
         message_type="Get Stage Position", test_mode=self.test_mode)
Пример #25
0
 def __init__(self, **kwds):
     super().__init__(**kwds)
     self.tcp_message = tcpMessage.TCPMessage(message_type="Get Objective",
                                              test_mode=self.test_mode)
Пример #26
0
 def __init__(self, **kwds):
     super().__init__(**kwds)
     self.tcp_message = tcpMessage.TCPMessage(
         message_type="Get Mosaic Settings", test_mode=self.test_mode)
Пример #27
0
 def __init__(self, name_or_index=None, **kwds):
     super().__init__(**kwds)
     self.tcp_message = tcpMessage.TCPMessage(
         message_type="Set Parameters",
         message_data={"parameters": name_or_index},
         test_mode=self.test_mode)
Пример #28
0
 def __init__(self, lock_target=None, **kwds):
     super().__init__(**kwds)
     self.tcp_message = tcpMessage.TCPMessage(
         message_type="Set Lock Target",
         message_data={"lock_target": lock_target},
         test_mode=self.test_mode)
Пример #29
0
 def __init__(self, **kwds):
     super().__init__(**kwds)
     self.tcp_message = tcpMessage.TCPMessage(
         message_type="No Such Message", test_mode=self.test_mode)
Пример #30
0
 def setup(self, node):
     self.message = tcpMessage.TCPMessage(message_type = "Recenter Piezo")