Exemplo n.º 1
0
    def recursive_node(self, root_node, item_in):

        for child_node in root_node.children:

            if (str(child_node.name) == "reindex"):
                tmp_dat = update_all_data(
                    experiments_path=str(child_node.experiments))
                sp_grp = tmp_dat.spg_group
                child_node_name = "reindex { " + sp_grp + " }"

            else:
                child_node_name = str(child_node.name)

            new_item = QStandardItem(child_node_name)

            new_item.idials_node = child_node
            new_item.success = child_node.success

            if new_item.idials_node.index == self.lst_idx[-1]:
                new_item.setBackground(Qt.blue)
                new_item.setForeground(Qt.white)
                nxt_cmd_str = self.my_parent.controller.get_mode()
                next_cmd = ">> { " + nxt_cmd_str + " }"

                nxt_new_item = QStandardItem(str(next_cmd))
                nxt_new_item.setBackground(Qt.gray)
                nxt_new_item.setForeground(Qt.black)
                nxt_new_item.idials_node = None

                new_item.appendRow(nxt_new_item)

            elif new_item.idials_node.index in self.lst_idx:
                new_item.setBackground(Qt.white)
                new_item.setForeground(Qt.blue)

            elif new_item.idials_node.success == True:
                new_item.setBackground(Qt.white)
                new_item.setForeground(Qt.black)

            else:
                new_item.setBackground(Qt.white)
                new_item.setForeground(Qt.gray)

            new_item.setEditable(False)  # not letting the user edit it

            self.recursive_node(child_node, new_item)
            item_in.appendRow(new_item)
Exemplo n.º 2
0
    def update_data(self, exp_json_path=None, refl_pikl_path=None):
        # TODO: Change interface of function to not recieve list including
        #       predicted reflections, as long as it doesn't need it

        logger.debug("\n\nrefl_pikl_path = %s", refl_pikl_path)
        logger.debug("exp_json_path = %s %s", exp_json_path, "\n")

        try:
            try:
                pickle_to_read = refl_pikl_path[0]

            except ValueError:
                pickle_to_read = None

            logger.debug("experiments_path=", exp_json_path,
                         "reflections_path=", pickle_to_read)

            self.all_data = update_all_data(experiments_path=exp_json_path,
                                            reflections_path=pickle_to_read)
        except InvalidExperimentListError:
            # Probably an invalid json file - we sometimes try to parse these
            self.all_data = update_all_data(experiments_path=None,
                                            reflections_path=None)
        except BaseException as e:
            # We don't want to catch bare exceptions but don't know
            # what this was supposed to catch. Log it.
            logger.debug("Caught unknown exception type %s: %s",
                         type(e).__name__, e)
            logger.debug("unable to update data panel")
            self.all_data = update_all_data(experiments_path=None,
                                            reflections_path=None)

        update_data_label(self.a_data, self.all_data.a)
        update_data_label(self.b_data, self.all_data.b)
        update_data_label(self.c_data, self.all_data.c)

        update_data_label(self.alpha_data, self.all_data.alpha)
        update_data_label(self.beta_data, self.all_data.beta)
        update_data_label(self.gamma_data, self.all_data.gamma)

        update_data_label(self.r1_data, self.all_data.r1)
        update_data_label(self.r2_data, self.all_data.r2)
        update_data_label(self.r3_data, self.all_data.r3)

        update_data_label(self.img_ran1_data, self.all_data.img_ran1)
        update_data_label(self.img_ran2_data, self.all_data.img_ran2)
        # update_data_label(self.oscil1_data,   self.all_data.oscil1)
        update_data_label(self.oscil2_data, self.all_data.oscil2)
        update_data_label(self.e_time_data, self.all_data.e_time)

        update_data_label(self.n_pans_data, self.all_data.n_pans)

        update_data_label(data_label=self.x_px_size_data,
                          data_info=self.all_data.x_px_size,
                          n_dec=3)

        update_data_label(data_label=self.y_px_size_data,
                          data_info=self.all_data.y_px_size,
                          n_dec=3)

        update_data_label(self.gain_data, self.all_data.gain)
        update_data_label(self.max_res_data, self.all_data.max_res)

        update_data_label(self.xb_data, self.all_data.xb)

        try:
            det_mov = float(
                self.all_data.n_pan_xb_yb) * 213.0 * self.all_data.y_px_size
            update_data_label(self.yb_data, self.all_data.yb + det_mov)

        except TypeError:
            logger.debug(
                "trying to add incompatible types for a label in data panel")
            update_data_label(self.yb_data, self.all_data.yb)

        update_data_label(data_label=self.w_lambda_data,
                          data_info=self.all_data.w_lambda,
                          n_dec=6)

        # update_data_label(self.w_lambda_data,  self.all_data.w_lambda)

        update_data_label(self.d_dist_data, self.all_data.dd)

        update_data_label(self.strn_sp_data, self.all_data.n_strng)
        update_data_label(self.indx_sp_data, self.all_data.n_index)
        update_data_label(self.refn_sp_data, self.all_data.n_refnd)
        update_data_label(self.itgr_sum_data, self.all_data.n_integ_sum)
        update_data_label(self.itgr_prf_data, self.all_data.n_integ_prf)

        update_data_label(self.spgrp_data, self.all_data.spg_group)
Exemplo n.º 3
0
    def update_data(self,
                    dblock_json_path=None,
                    exp_json_path=None,
                    refl_pikl_path=None):

        print "\nrefl_pikl_path =", refl_pikl_path, "\n"

        if (dblock_json_path != None):
            exp_json_path = dblock_json_path

        self.all_data = update_all_data(experiments_path=exp_json_path,
                                        reflections_path=refl_pikl_path)

        update_data_label(self.a_data, self.all_data.a)
        update_data_label(self.b_data, self.all_data.b)
        update_data_label(self.c_data, self.all_data.c)

        update_data_label(self.alpha_data, self.all_data.alpha)
        update_data_label(self.beta_data, self.all_data.beta)
        update_data_label(self.gamma_data, self.all_data.gamma)

        update_data_label(self.r1_data, self.all_data.r1)
        update_data_label(self.r2_data, self.all_data.r2)
        update_data_label(self.r3_data, self.all_data.r3)

        update_data_label(self.img_ran1_data, self.all_data.img_ran1)
        update_data_label(self.img_ran2_data, self.all_data.img_ran2)
        #update_data_label(self.oscil1_data,   self.all_data.oscil1)
        update_data_label(self.oscil2_data, self.all_data.oscil2)
        update_data_label(self.e_time_data, self.all_data.e_time)

        update_data_label(self.n_pans_data, self.all_data.n_pans)

        update_data_label(data_label=self.x_px_size_data,
                          data_info=self.all_data.x_px_size,
                          n_dec=3)

        update_data_label(data_label=self.y_px_size_data,
                          data_info=self.all_data.y_px_size,
                          n_dec=3)

        update_data_label(self.gain_data, self.all_data.gain)
        update_data_label(self.max_res_data, self.all_data.max_res)

        update_data_label(self.xb_data, self.all_data.xb)
        update_data_label(self.yb_data, self.all_data.yb)

        update_data_label(data_label=self.w_lambda_data,
                          data_info=self.all_data.w_lambda,
                          n_dec=6)

        #update_data_label(self.w_lambda_data,  self.all_data.w_lambda)

        update_data_label(self.d_dist_data, self.all_data.dd)

        update_data_label(self.strn_sp_data, self.all_data.n_strng)
        update_data_label(self.indx_sp_data, self.all_data.n_index)
        update_data_label(self.refn_sp_data, self.all_data.n_refnd)
        update_data_label(self.itgr_sum_data, self.all_data.n_integ_sum)
        update_data_label(self.itgr_prf_data, self.all_data.n_integ_prf)

        update_data_label(self.spgrp_data, self.all_data.spg_group)