コード例 #1
0
ファイル: ai_info.py プロジェクト: jdechevr/mcculw
 def supports_gain_queue(self):
     gain_queue_supported = True
     try:
         ul.a_load_queue(self._board_num, [], [], 0)
     except ULError:
         gain_queue_supported = False
     return gain_queue_supported
コード例 #2
0
ファイル: ai.py プロジェクト: jhart12/Polarization_Controller
 def _get_supports_gain_queue(self):
     try:
         ul.a_load_queue(self._board_num, [], [], 0)
     except ULError:
         return False
     return True
コード例 #3
0
ファイル: ULAI10.py プロジェクト: cullenmq/shearTest
    def toggle_load_queue(self):
        if not self.queue_loaded:
            chan_array = []
            if self.random_channels_checkbutton_var.get():
                for chan_num in range(0, self.num_elements):
                    chan_array.append(
                        random.randint(0, self.ai_props.num_ai_chans - 1))
            else:
                for chan_num in range(0, self.num_elements):
                    chan_array.append(chan_num)

            gain_array = []
            if self.random_ranges_checkbutton_var.get():
                for chan_num in range(0, self.num_elements):
                    gain_array.append(
                        random.choice(self.ai_props.available_ranges))
            else:
                range_ = self.ai_props.available_ranges[0]
                for chan_num in range(0, self.num_elements):
                    gain_array.append(range_)

            try:
                ul.a_load_queue(self.board_num, chan_array, gain_array,
                                self.num_elements)

                self.queue_loaded = True
                self.toggle_load_queue_button["text"] = "Unload Queue"
                self.instructions_label["text"] = ("Queue loaded on board " +
                                                   str(self.board_num))

                # Update the headers
                for chan_num in range(0, self.num_elements):
                    self.channel_labels[chan_num]["text"] = (
                        "Channel " + str(chan_array[chan_num]))
                for chan_num in range(0, self.num_elements):
                    self.range_labels[chan_num]["text"] = \
                        gain_array[chan_num].name
            except ULError as e:
                if e.errorcode == ErrorCode.BADADCHAN:
                    self.instructions_label["text"] = (
                        "Board " + str(self.board_num) +
                        " doesn't support random channels. Queue was not "
                        "changed.")
                else:
                    raise
        else:
            # Set Count to 0 to disable the queue
            ul.a_load_queue(self.board_num, [], [], 0)

            self.queue_loaded = False
            self.toggle_load_queue_button["text"] = "Load Queue"
            self.instructions_label["text"] = (
                "Board " + str(self.board_num) +
                " scanning contiguous channels with with Range set to " +
                str(self.ai_props.available_ranges[0]))

            # Update the headers
            for chan_num in range(0, self.num_elements):
                self.channel_labels[chan_num]["text"] = ("Channel " +
                                                         str(chan_num))
            for chan_num in range(0, self.num_elements):
                self.range_labels[chan_num]["text"] = (
                    self.ai_props.available_ranges[0].name)