コード例 #1
0
ファイル: multipca.py プロジェクト: 18alex96/PynPoint
    def run(self):
        """
        Run method of PcaTaskWriter. Writes the residuals to the output ports.

        :return: None
        """

        while True:
            next_result = self.m_result_queue.get()
            poison_pill_case = self.check_poison_pill(next_result)

            if poison_pill_case == 1:
                break

            elif poison_pill_case == 2:
                continue

            with self.m_data_mutex:
                if self.m_requirements[0]:
                    self.m_mean_out_port[to_slice(next_result.m_position)] = \
                        next_result.m_data_array[0, :, :]

                if self.m_requirements[1]:
                    self.m_median_out_port[to_slice(next_result.m_position)] = \
                        next_result.m_data_array[1, :, :]

                if self.m_requirements[2]:
                    self.m_weighted_out_port[to_slice(next_result.m_position)] = \
                        next_result.m_data_array[2, :, :]

                if self.m_requirements[3]:
                    self.m_clip_out_port[to_slice(next_result.m_position)] = \
                        next_result.m_data_array[3, :, :]

            self.m_result_queue.task_done()
コード例 #2
0
ファイル: multipca.py プロジェクト: tomasstolker/PynPoint
    def run(self) -> None:
        """
        Run method of PcaTaskWriter. Writes the residuals to the output ports.

        Returns
        -------
        NoneType
            None
        """

        while True:
            next_result = self.m_result_queue.get()
            poison_pill_case = self.check_poison_pill(next_result)

            if poison_pill_case == 1:
                break

            if poison_pill_case == 2:
                continue

            with self.m_data_mutex:
                res_slice = to_slice(next_result.m_position)
                if next_result.m_position[1][0] is None:
                    res_slice = (next_result.m_position[0][0])
                else:
                    res_slice = (next_result.m_position[0][0],
                                 next_result.m_position[1][0])

                if self.m_requirements[0]:
                    self.m_mean_out_port._check_status_and_activate()
                    self.m_mean_out_port[res_slice] = next_result.m_data_array[
                        0]
                    self.m_mean_out_port.close_port()

                if self.m_requirements[1]:
                    self.m_median_out_port._check_status_and_activate()
                    self.m_median_out_port[
                        res_slice] = next_result.m_data_array[1]
                    self.m_median_out_port.close_port()

                if self.m_requirements[2]:
                    self.m_weighted_out_port._check_status_and_activate()
                    self.m_weighted_out_port[
                        res_slice] = next_result.m_data_array[2]
                    self.m_weighted_out_port.close_port()

                if self.m_requirements[3]:
                    self.m_clip_out_port._check_status_and_activate()
                    self.m_clip_out_port[res_slice] = next_result.m_data_array[
                        3]
                    self.m_clip_out_port.close_port()

            self.m_result_queue.task_done()