Esempio n. 1
0
    def onAdvancedOptions(self, e):
        self.input_window.update_settings()
        self.prime_phil = self.prime_phil.fetch(self.input_window.prime_phil)
        advanced = dlg.PRIMEAdvancedOptions(
            self,
            phil=self.prime_phil,
            title='Advanced PRIME Options',
            style=wx.DEFAULT_DIALOG_STYLE | wx.STAY_ON_TOP | wx.RESIZE_BORDER)
        advanced.SetMinSize((600, -1))
        advanced.Fit()

        if advanced.ShowModal() == wx.ID_OK:
            self.prime_phil = self.prime_phil.fetch(advanced.phil_script)
            self.prime_phil = self.prime_phil.fetch(advanced.new_prime_phil)
            self.input_window.regenerate_params(self.prime_phil)

        advanced.Destroy()
Esempio n. 2
0
    def onAdvancedOptions(self, e):
        advanced = dlg.PRIMEAdvancedOptions(self,
                                            title='Advanced PRIME Options',
                                            style=wx.DEFAULT_DIALOG_STYLE
                                            | wx.RESIZE_BORDER)
        advanced.Fit()

        # Populate the PHIL textbox
        advanced.phil.ctr.SetValue(self.phil_string)

        # Set values to default parameters
        advanced.res.high.SetValue('{:4.2f}'.format(
            self.pparams.postref.allparams.d_max))
        advanced.res.low.SetValue('{:4.2f}'.format(
            self.pparams.postref.allparams.d_min))
        advanced.sg.spacegroup.SetValue(str(self.pparams.target_space_group))
        if str(self.pparams.target_unit_cell).lower() != 'none':
            uc = ' '.join(
                list(map(str, self.pparams.target_unit_cell.parameters())))
            advanced.uc.unit_cell.SetValue(uc)
        else:
            advanced.uc.unit_cell.SetValue(str(self.pparams.target_unit_cell))
        advanced.anom.SetValue(self.pparams.target_anomalous_flag)
        advanced.cc.cc_cutoff.SetValue(str(self.pparams.frame_accept_min_cc))
        advanced.pix.pixel_size.SetValue(str(self.pparams.pixel_size_mm))
        advanced.cycles.ctr.SetValue(int(self.pparams.n_postref_cycle))

        if advanced.ShowModal() == wx.ID_OK:
            # Read PHIL string from window, convert to params
            self.phil_string = advanced.phil.ctr.GetValue()
            new_phil = ip.parse(self.phil_string)
            self.pparams = master_phil.fetch(sources=[new_phil]).extract()

            # Param controls will override the PHIL string (clunky, but for now)
            if advanced.res_override.GetValue():
                self.pparams.scale.d_max = float(advanced.res.high.GetValue())
                self.pparams.scale.d_min = float(advanced.res.low.GetValue())
                self.pparams.merge.d_max = float(advanced.res.high.GetValue())
                self.pparams.merge.d_min = float(advanced.res.low.GetValue())
                self.pparams.postref.scale.d_max = float(
                    advanced.res.high.GetValue())
                self.pparams.postref.scale.d_min = float(
                    advanced.res.low.GetValue())
                self.pparams.postref.crystal_orientation.d_max = float(
                    advanced.res.high.GetValue())
                self.pparams.postref.crystal_orientation.d_min = float(
                    advanced.res.low.GetValue())
                self.pparams.postref.reflecting_range.d_max = float(
                    advanced.res.high.GetValue())
                self.pparams.postref.reflecting_range.d_min = float(
                    advanced.res.low.GetValue())
                self.pparams.postref.unit_cell.d_max = float(
                    advanced.res.high.GetValue())
                self.pparams.postref.unit_cell.d_min = float(
                    advanced.res.low.GetValue())
                self.pparams.postref.allparams.d_max = float(
                    advanced.res.high.GetValue())
                self.pparams.postref.allparams.d_min = float(
                    advanced.res.low.GetValue())
            self.pparams.target_space_group = advanced.sg.spacegroup.GetValue()
            if advanced.uc.unit_cell.GetValue().lower() != 'none':
                uc = str_split(advanced.uc.unit_cell.GetValue())
                self.pparams.target_unit_cell = unit_cell(list(map(float, uc)))
            else:
                self.pparams.target_unit_cell = None
            self.pparams.target_anomalous_flag = advanced.anom.GetValue()
            if advanced.cc.cc_cutoff.GetValue().lower() != 'none':
                self.pparams.frame_accept_min_cc = float(
                    advanced.cc.cc_cutoff.GetValue())
            else:
                self.pparams.frame_accept_min_cc = None
            if advanced.pix.pixel_size.GetValue().lower() != 'none':
                self.pparams.pixel_size_mm = float(
                    advanced.pix.pixel_size.GetValue())
            else:
                self.pparams.pixel_size_mm = None
            self.pparams.n_postref_cycle = int(advanced.cycles.ctr.GetValue())

            self.regenerate_params(self.pparams)

        advanced.Destroy()
        e.Skip()