예제 #1
0
    def passTrigger(self, trigger):
        if self.run_loop:
            if trigger:
                if trigger.interrupt:
                    self.current_new_object = 0
                    self.start_button.setEnabled(True)
                    self.setStatusMessage("")
                    self.send("Trigger", TriggerOut(new_object=False))
                elif trigger.new_object:
                    if self.current_new_object < self.number_of_new_objects:
                        self.current_new_object += 1
                        self.setStatusMessage("Running " + self.get_object_name() + " " + str(self.current_new_object) + " of " + str(self.number_of_new_objects))
                        self.start_button.setEnabled(False)
                        self.send("Trigger", TriggerOut(new_object=True))
                    else:
                        self.current_new_object = 0
                        self.start_button.setEnabled(True)
                        self.setStatusMessage("")
                        self.send("Trigger", TriggerOut(new_object=False))
        else:
            if not self.suspend_loop:
                self.current_new_object = 0
                self.start_button.setEnabled(True)

            self.send("Trigger", TriggerOut(new_object=False))
            self.setStatusMessage("")
            self.run_loop = True
            self.suspend_loop = False
예제 #2
0
    def passTrigger(self, trigger):
        if self.run_loop:
            if trigger:
                if trigger.interrupt:
                    self.current_new_object = 0
                    self.current_variable_value = None
                    self.start_button.setEnabled(True)
                    self.setStatusMessage("")
                    self.send("Trigger", TriggerOut(new_object=False))
                elif trigger.new_object:
                    if self.current_new_object == 0:
                        QMessageBox.critical(
                            self, "Error",
                            "Loop has to be started properly: press the button Start",
                            QMessageBox.Ok)
                        return

                    if self.current_new_object < self.number_of_new_objects:
                        if self.current_variable_value is None:
                            self.current_new_object = 1
                        else:
                            self.current_new_object += 1

                        self.current_variable_value = self.variable_files[
                            self.current_new_object - 1]

                        self.setStatusMessage("Running " +
                                              self.get_object_name() + " " +
                                              str(self.current_new_object) +
                                              " of " +
                                              str(self.number_of_new_objects))
                        self.start_button.setEnabled(False)
                        self.send(
                            "Trigger",
                            TriggerOut(new_object=True,
                                       additional_parameters={
                                           "variable_name": self.variable_name,
                                           "variable_display_name":
                                           self.variable_display_name,
                                           "variable_value":
                                           self.current_variable_value,
                                           "variable_um": ""
                                       }))
                    else:
                        self.current_new_object = 0
                        self.current_variable_value = None
                        self.start_button.setEnabled(True)
                        self.setStatusMessage("")
                        self.send("Trigger", TriggerOut(new_object=False))
        else:
            if not self.suspend_loop:
                self.current_new_object = 0
                self.current_variable_value = None
                self.start_button.setEnabled(True)

            self.send("Trigger", TriggerOut(new_object=False))
            self.setStatusMessage("")
            self.run_loop = True
            self.suspend_loop = False
    def passTrigger(self, trigger):
        if self.run_loop:
            if trigger:
                if trigger.interrupt:
                    self.current_new_object = 0
                    self.current_variable_value = None
                    self.variable_value_step = 0.0
                    self.start_button.setEnabled(True)
                    self.setStatusMessage("")
                    self.send("Trigger", TriggerOut(new_object=False))
                elif trigger.new_object:
                    if self.current_new_object <= self.number_of_new_objects:
                        if self.current_variable_value is None:
                            self.current_new_object = 1
                            self.calculate_step()
                            self.current_variable_value = round(
                                self.variable_value_from, 8)
                        else:
                            self.current_new_object += 1
                            self.current_variable_value = round(
                                self.current_variable_value +
                                self.variable_value_step, 8)

                        self.setStatusMessage("Running " +
                                              self.get_object_name() + " " +
                                              str(self.current_new_object) +
                                              " of " +
                                              str(self.number_of_new_objects))
                        self.start_button.setEnabled(False)
                        self.send(
                            "Trigger",
                            TriggerOut(new_object=True,
                                       additional_parameters={
                                           "variable_name": self.variable_name,
                                           "variable_display_name":
                                           self.variable_display_name,
                                           "variable_value":
                                           self.current_variable_value,
                                           "variable_um": self.variable_um
                                       }))
                    else:
                        self.current_new_object = 0
                        self.current_variable_value = None
                        self.start_button.setEnabled(True)
                        self.setStatusMessage("")
                        self.send("Trigger", TriggerOut(new_object=False))
        else:
            self.current_new_object = 0
            self.current_variable_value = None
            self.start_button.setEnabled(True)
            self.send("Trigger", TriggerOut(new_object=False))
            self.setStatusMessage("")
            self.run_loop = True
예제 #4
0
    def startLoop(self):
        self.current_new_object = 1

        do_loop = True

        if self.kind_of_loop == 0:
            self.current_variable_value = round(self.variable_value_from, 8)
            self.calculate_step()
        elif len(self.list_of_values) > 0:
            self.current_variable_value = self.list_of_values[
                self.current_new_object - 1]
        else:
            do_loop = False

        if do_loop:
            self.start_button.setEnabled(False)

            self.setStatusMessage("Running " + self.get_object_name() + " " +
                                  str(self.current_new_object) + " of " +
                                  str(self.number_of_new_objects))
            self.send(
                "Trigger",
                TriggerOut(new_object=True,
                           additional_parameters={
                               "variable_name": self.variable_name,
                               "variable_display_name":
                               self.variable_display_name,
                               "variable_value": self.current_variable_value,
                               "variable_um": self.variable_um
                           }))
예제 #5
0
    def passTrigger(self, trigger):
        if self.run_loop:
            if trigger:
                if trigger.interrupt:
                    self.current_new_object = 0
                    self.start_button.setEnabled(True)
                    self.setStatusMessage("")
                    self.send("Trigger", TriggerOut(new_object=False))
                elif trigger.new_object:
                    if self.current_new_object == 0:
                        QMessageBox.critical(
                            self, "Error",
                            "Loop has to be started properly: press the button Start",
                            QMessageBox.Ok)
                        return

                    if self.current_new_object < self.number_of_new_objects:
                        self.current_new_object += 1
                        self.setStatusMessage("Running " +
                                              self.get_object_name() + " " +
                                              str(self.current_new_object) +
                                              " of " +
                                              str(self.number_of_new_objects))
                        self.start_button.setEnabled(False)
                        self.send(
                            "Trigger",
                            TriggerOut(new_object=True,
                                       additional_parameters={
                                           "seed_increment":
                                           self.seed_increment
                                       }))
                    else:
                        self.current_new_object = 0
                        self.start_button.setEnabled(True)
                        self.setStatusMessage("")
                        self.send("Trigger", TriggerOut(new_object=False))
        else:
            if not self.suspend_loop:
                self.current_new_object = 0
                self.start_button.setEnabled(True)

            self.send("Trigger", TriggerOut(new_object=False))
            self.setStatusMessage("")
            self.run_loop = True
            self.suspend_loop = False
예제 #6
0
 def startLoop(self):
     self.current_new_object = 1
     self.start_button.setEnabled(False)
     self.setStatusMessage("Running " + self.get_object_name() + " " +
                           str(self.current_new_object) + " of " +
                           str(self.number_of_new_objects))
     self.send(
         "Trigger",
         TriggerOut(
             new_object=True,
             additional_parameters={"seed_increment": self.seed_increment}))
    def startLoop(self):

        self.current_new_object = 1
        self.current_variable_value = round(self.variable_value_from, 8)
        self.calculate_step()
        self.start_button.setEnabled(False)

        self.setStatusMessage("Running " + self.get_object_name() + " " +
                              str(self.current_new_object) + " of " +
                              str(self.number_of_new_objects))
        self.send(
            "Trigger",
            TriggerOut(new_object=True,
                       additional_parameters={
                           "variable_name": self.variable_name,
                           "variable_display_name": self.variable_display_name,
                           "variable_value": self.current_variable_value,
                           "variable_um": self.variable_um
                       }))
예제 #8
0
    def startLoop(self):
        try:
            self.calculate_energy_binnings()

            self.current_new_object = 1
            self.total_current_new_object = 1
            self.current_energy_binning = 0
            self.current_energy_value = round(
                self.energy_binnings[0].energy_value, 8)
            self.current_energy_step = round(
                self.energy_binnings[0].energy_step, 8)
            self.current_power_step = None if self.energy_binnings[
                0].power_step is None else (
                    None if self.send_power_step == 0 else round(
                        self.energy_binnings[0].power_step, 8))
            self.calculate_number_of_new_objects()

            self.start_button.setEnabled(False)
            self.text_area.setEnabled(False)
            self.setStatusMessage("Running " + self.get_object_name() + " " +
                                  str(self.total_current_new_object) + " of " +
                                  str(self.total_new_objects))
            self.send(
                "Trigger",
                TriggerOut(new_object=True,
                           additional_parameters={
                               "energy_value":
                               self.current_energy_value,
                               "energy_step":
                               self.current_energy_step,
                               "power_step":
                               -1 if self.current_power_step is None else
                               self.current_power_step,
                               "seed_increment":
                               self.seed_increment,
                               "start_event":
                               True
                           }))
        except Exception as e:
            if self.IS_DEVELOP: raise e
            else: pass
예제 #9
0
    def passTrigger(self, trigger):
        if self.run_loop:
            if trigger:
                if trigger.interrupt:
                    self.reset_values()
                    self.start_button.setEnabled(True)
                    self.text_area.setEnabled(True)
                    self.setStatusMessage("")
                    self.send("Trigger", TriggerOut(new_object=False))
                elif trigger.new_object:
                    if self.energy_binnings is None:
                        self.calculate_energy_binnings()

                    if self.current_energy_binning == -1:
                        QMessageBox.critical(
                            self, "Error",
                            "Power Loop has to be started properly: press the button Start",
                            QMessageBox.Ok)
                        return

                    if self.current_energy_binning < len(self.energy_binnings):
                        energy_binning = self.energy_binnings[
                            self.current_energy_binning]

                        self.total_current_new_object += 1

                        if self.current_new_object < self.number_of_new_objects:
                            if self.current_energy_value is None:
                                self.current_new_object = 1
                                self.calculate_number_of_new_objects()
                                self.current_energy_value = round(
                                    energy_binning.energy_value, 8)
                            else:
                                self.current_new_object += 1
                                self.current_energy_value = round(
                                    self.current_energy_value +
                                    energy_binning.energy_step, 8)

                            self.current_power_step = None if energy_binning.power_step is None else (
                                None if self.send_power_step == 0 else round(
                                    energy_binning.power_step, 8))

                            self.setStatusMessage(
                                "Running " + self.get_object_name() + " " +
                                str(self.total_current_new_object) + " of " +
                                str(self.total_new_objects))
                            self.start_button.setEnabled(False)
                            self.text_area.setEnabled(False)
                            self.send(
                                "Trigger",
                                TriggerOut(
                                    new_object=True,
                                    additional_parameters={
                                        "energy_value":
                                        self.current_energy_value,
                                        "energy_step":
                                        energy_binning.energy_step,
                                        "power_step":
                                        -1 if self.current_power_step is None
                                        else self.current_power_step,
                                        "seed_increment":
                                        self.seed_increment,
                                        "start_event":
                                        False
                                    }))
                        else:
                            self.current_energy_binning += 1

                            if self.current_energy_binning < len(
                                    self.energy_binnings):
                                energy_binning = self.energy_binnings[
                                    self.current_energy_binning]

                                self.current_new_object = 1
                                self.calculate_number_of_new_objects()
                                self.current_energy_value = round(
                                    energy_binning.energy_value, 8)
                                self.current_power_step = None if energy_binning.power_step is None else (
                                    None if self.send_power_step == 0 else
                                    round(energy_binning.power_step, 8))

                                self.setStatusMessage(
                                    "Running " + self.get_object_name() + " " +
                                    str(self.total_current_new_object) +
                                    " of " + str(self.total_new_objects))
                                self.start_button.setEnabled(False)
                                self.text_area.setEnabled(False)
                                self.send(
                                    "Trigger",
                                    TriggerOut(
                                        new_object=True,
                                        additional_parameters={
                                            "energy_value":
                                            self.current_energy_value,
                                            "energy_step":
                                            energy_binning.energy_step,
                                            "power_step":
                                            -1
                                            if self.current_power_step is None
                                            else self.current_power_step,
                                            "seed_increment":
                                            self.seed_increment,
                                            "start_event":
                                            False
                                        }))
                            else:
                                self.reset_values()
                                self.start_button.setEnabled(True)
                                self.text_area.setEnabled(True)
                                self.setStatusMessage("")
                                self.send("Trigger",
                                          TriggerOut(new_object=False))
                    else:
                        self.reset_values()
                        self.start_button.setEnabled(True)
                        self.text_area.setEnabled(True)
                        self.setStatusMessage("")
                        self.send("Trigger", TriggerOut(new_object=False))
        else:
            if not self.suspend_loop:
                self.reset_values()
                self.start_button.setEnabled(True)
                self.text_area.setEnabled(True)

            self.send("Trigger", TriggerOut(new_object=False))
            self.setStatusMessage("")
            self.suspend_loop = False
            self.run_loop = True
예제 #10
0
 def startLoop(self):
     self.current_new_object = 1
     self.start_button.setEnabled(False)
     self.setStatusMessage("Running " + self.get_object_name() + " " + str(self.current_new_object) + " of " + str(self.number_of_new_objects))
     self.send("Trigger", TriggerOut(new_object=True))