Пример #1
0
  def __init__(self, parent, phil=None, *args, **kwargs):
    BaseDialog.__init__(self, parent, *args, **kwargs)

    self.pparams = phil.extract()
    self.pref_phil = None

    main_sizer = wx.BoxSizer(wx.VERTICAL)

    main_box = wx.StaticBox(self, label='PRIME Preferences')
    vbox = wx.StaticBoxSizer(main_box, wx.VERTICAL)

    self.SetSizer(main_sizer)

    q_choices = ['psanaq', 'psnehq', 'psfehq'] + ['custom']
    self.queues = ct.ChoiceCtrl(self,
                                label='Queue:',
                                label_size=(120, -1),
                                label_style='bold',
                                ctrl_size=wx.DefaultSize,
                                choices=q_choices)
    vbox.Add(self.queues, flag=wx.ALL, border=10)

    self.custom_queue = ct.OptionCtrl(self,
                                      items=[('cqueue', '')],
                                      label='Custom Queue:',
                                      label_size=(120, -1),
                                      label_style='normal',
                                      ctrl_size=(150, -1))
    self.custom_queue.Disable()
    vbox.Add(self.custom_queue, flag=wx.ALL, border=10)

    self.nodes = ct.SpinCtrl(self,
                             label='No. of nodes',
                             label_size=(120, -1),
                             ctrl_value=12,
                             ctrl_size=(80, -1),
                             ctrl_min=1,
                             ctrl_max=5000)
    self.nodes.Disable()
    vbox.Add(self.nodes, flag=wx.ALL, border=10)

    mp_choices = ['multiprocessing', 'bsub']
    self.mp_methods = ct.ChoiceCtrl(self,
                                    label='Method:',
                                    label_size=(120, -1),
                                    label_style='bold',
                                    ctrl_size=wx.DefaultSize,
                                    choices=mp_choices)
    vbox.Add(self.mp_methods, flag=wx.ALL, border=10)

    main_sizer.Add(vbox, flag=wx.EXPAND | wx.ALL, border=10)

    # Dialog control
    dialog_box = self.CreateSeparatedButtonSizer(wx.OK | wx.CANCEL)
    main_sizer.Add(dialog_box,
                   flag=wx.EXPAND | wx.ALIGN_RIGHT | wx.ALL,
                   border=10)

    self.Bind(wx.EVT_CHOICE, self.onQueue, self.queues.ctr)
    self.Bind(wx.EVT_CHOICE, self.onMethod, self.mp_methods.ctr)
    self.Bind(wx.EVT_BUTTON, self.onOK, id=wx.ID_OK)

    self.set_choices()
Пример #2
0
  def __init__(self, parent, phil=None, *args, **kwargs):
    PRIMEBaseBackendDialog.__init__(self, parent,
                                    backend_name='PRIME',
                                    phil=phil,
                                    phil_size=(500, 500),
                                    opt_size=(500, 500),
                                    *args, **kwargs)

    self.prime_phil = phil
    self.new_prime_phil = None
    self.pparams = self.prime_phil.extract()

    self.splitter.SplitVertically(self.options, self.phil_panel)

    # Target file input
    self.phil = ct.PHILBox(self.phil_panel,
                           btn_import=True,
                           btn_import_label='Import PHIL',
                           btn_export=False,
                           btn_default=False,
                           btn_pos='bottom',
                           ctr_size=(-1, 300),
                           ctr_value='')
    self.phil_sizer.Add(self.phil, 1, flag=wx.EXPAND | wx.ALL, border=5)

    # PRIME Options (there is some redundancy with the PHIL textbox)
    self.prm_options = wx.Panel(self.options)
    opt_box = wx.StaticBox(self.prm_options, label='Advanced Options')
    opt_box_sizer = wx.StaticBoxSizer(opt_box, wx.VERTICAL)
    self.prm_options.SetSizer(opt_box_sizer)

    # Resolution
    self.scale_res = ct.OptionCtrl(self.prm_options,
                                   label='Scale Resolution: ',
                                   label_size=(120, -1),
                                   label_style='normal',
                                   ctrl_size=wx.DefaultSize,
                                   items=[('low', 50),
                                          ('high', 1.5)])
    opt_box_sizer.Add(self.scale_res, flag=f.stack, border=10)

    self.merge_res = ct.OptionCtrl(self.prm_options,
                                   label='Merge Resolution: ',
                                   label_size=(120, -1),
                                   label_style='normal',
                                   ctrl_size=wx.DefaultSize,
                                   items=[('low', 50),
                                          ('high', 1.5)])
    opt_box_sizer.Add(self.merge_res, flag=f.stack, border=10)

    self.p_scale_res = ct.OptionCtrl(self.prm_options,
                                     label='Postref Scale Res.: ',
                                     label_size=(120, -1),
                                     label_style='normal',
                                     ctrl_size=wx.DefaultSize,
                                     items=[('low', 50),
                                            ('high', 1.5)])
    opt_box_sizer.Add(self.p_scale_res, flag=f.stack, border=10)

    self.p_cryst_res = ct.OptionCtrl(self.prm_options,
                                     checkbox=True,
                                     checkbox_label='Crystal Orientation: ',
                                     label_size=(120, -1),
                                     label_style='normal',
                                     ctrl_size=wx.DefaultSize,
                                     items=[('low', 50),
                                            ('high', 1.5)])
    opt_box_sizer.Add(self.p_cryst_res, flag=f.stack, border=10)

    self.p_rrange_res = ct.OptionCtrl(self.prm_options,
                                      checkbox=True,
                                      checkbox_label='Reflecting Range: ',
                                      label_size=(120, -1),
                                      label_style='normal',
                                      ctrl_size=wx.DefaultSize,
                                      items=[('low', 50),
                                             ('high', 1.5)])
    opt_box_sizer.Add(self.p_rrange_res, flag=f.stack, border=10)

    self.p_uc_res = ct.OptionCtrl(self.prm_options,
                                  checkbox=True,
                                  checkbox_label='Unit Cell: ',
                                  label_size=(120, -1),
                                  label_style='normal',
                                  ctrl_size=wx.DefaultSize,
                                  items=[('low', 50),
                                         ('high', 1.5)])
    opt_box_sizer.Add(self.p_uc_res, flag=f.stack, border=10)

    self.p_all_res = ct.OptionCtrl(self.prm_options,
                                   checkbox=True,
                                   checkbox_label='All Parameters: ',
                                   label_size=(120, -1),
                                   label_style='normal',
                                   ctrl_size=wx.DefaultSize,
                                   items=[('low', 50),
                                          ('high', 1.5)])
    opt_box_sizer.Add(self.p_all_res, flag=f.stack, border=10)

    self.btn_synch_res = wx.Button(self.prm_options,
                                   label="Set Res. Limits to Postref. Scale")
    opt_box_sizer.Add(self.btn_synch_res, flag=f.stack, border=10)


    # Target space group
    self.sg = ct.OptionCtrl(self.prm_options,
                            label='Space Group: ',
                            label_size=(120, -1),
                            label_style='normal',
                            ctrl_size=(100, -1),
                            items=[('spacegroup','P212121')])
    opt_box_sizer.Add(self.sg, flag=f.stack, border=10)

    # Target unit cell
    self.uc = ct.OptionCtrl(self.prm_options,
                            label='Unit Cell: ',
                            label_size=(120, -1),
                            label_style='normal',
                            ctrl_size=(300, -1),
                            items=[('unit_cell', '72 120 134 90 90 90')])
    self.anom = wx.CheckBox(self.prm_options, label='Anomalous')
    self.anom.SetValue(False)
    opt_box_sizer.Add(self.uc, flag=f.stack, border=10)
    opt_box_sizer.Add(self.anom, flag=f.stack, border=10)

    # CC cutoff
    self.cc = ct.OptionCtrl(self.prm_options,
                            label='CC cutoff: ',
                            label_size=(120, -1),
                            label_style='normal',
                            ctrl_size=(100, -1),
                            items=[('cc_cutoff', 0.25)])
    opt_box_sizer.Add(self.cc, flag=f.stack, border=10)

    # Pixel size
    self.pix = ct.OptionCtrl(self.prm_options,
                             label='Pixel size: ',
                             label_size=(120, -1),
                             label_style='normal',
                             ctrl_size=(100, -1),
                             items=[('pixel_size', 0.172)])
    opt_box_sizer.Add(self.pix, flag=wx.RIGHT | wx.LEFT | wx.TOP, border=10)

    self.cycles = ct.SpinCtrl(self.prm_options,
                              label='No. of Cycles:',
                              label_size=(120, -1),
                              label_style='normal',
                              ctrl_size=(60, -1))
    opt_box_sizer.Add(self.cycles, flag=wx.ALL, border=10)

    # self.options_sizer.Add(self.phil_sizer, 1, flag=wx.EXPAND | wx.ALL, border=10)
    self.options_sizer.Add(self.prm_options, 1, flag=wx.EXPAND | wx.ALL, border=10)

    # Button bindings
    self.Bind(wx.EVT_BUTTON, self.onImportPHIL, self.phil.btn_import)
    self.Bind(wx.EVT_BUTTON, self.onOK, id=wx.ID_OK)
    self.Bind(wx.EVT_BUTTON, self.onHideScript, self.btn_hide_script)
    self.Bind(wx.EVT_BUTTON, self.onResSynchronize, self.btn_synch_res)
    self.Bind(wx.EVT_CHOICE, self.onAdvanced, self.dlg_ctr.choice)

    self.show_hide_script()
    self.show_hide_advanced(show=False)
    self.Layout()
    self.options.SetupScrolling()
    self.read_param_phil()
Пример #3
0
    def __init__(self, parent, phil=None, *args, **kwargs):
        IOTABaseDialog.__init__(self, parent, *args, **kwargs)

        self.pparams = phil.extract()
        self.pref_phil = None

        main_sizer = wx.BoxSizer(wx.VERTICAL)

        main_box = wx.StaticBox(self, label="PRIME Preferences")
        vbox = wx.StaticBoxSizer(main_box, wx.VERTICAL)

        self.SetSizer(main_sizer)

        q_choices = ["psanaq", "psnehq", "psfehq"] + ["custom"]
        self.queues = ct.ChoiceCtrl(
            self,
            label="Queue:",
            label_size=(120, -1),
            label_style="bold",
            ctrl_size=wx.DefaultSize,
            choices=q_choices,
        )
        vbox.Add(self.queues, flag=wx.ALL, border=10)

        self.custom_queue = ct.OptionCtrl(
            self,
            items=[("cqueue", "")],
            label="Custom Queue:",
            label_size=(120, -1),
            label_style="normal",
            ctrl_size=(150, -1),
        )
        self.custom_queue.Disable()
        vbox.Add(self.custom_queue, flag=wx.ALL, border=10)

        self.nodes = ct.SpinCtrl(
            self,
            label="No. of nodes",
            label_size=(120, -1),
            ctrl_value=12,
            ctrl_size=(80, -1),
            ctrl_min=1,
            ctrl_max=5000,
        )
        self.nodes.Disable()
        vbox.Add(self.nodes, flag=wx.ALL, border=10)

        mp_choices = ["multiprocessing", "bsub"]
        self.mp_methods = ct.ChoiceCtrl(
            self,
            label="Method:",
            label_size=(120, -1),
            label_style="bold",
            ctrl_size=wx.DefaultSize,
            choices=mp_choices,
        )
        vbox.Add(self.mp_methods, flag=wx.ALL, border=10)

        main_sizer.Add(vbox, flag=wx.EXPAND | wx.ALL, border=10)

        # Dialog control
        dialog_box = self.CreateSeparatedButtonSizer(wx.OK | wx.CANCEL)
        main_sizer.Add(dialog_box, flag=wx.EXPAND | wx.ALIGN_RIGHT | wx.ALL, border=10)

        self.Bind(wx.EVT_CHOICE, self.onQueue, self.queues.ctr)
        self.Bind(wx.EVT_CHOICE, self.onMethod, self.mp_methods.ctr)
        self.Bind(wx.EVT_BUTTON, self.onOK, id=wx.ID_OK)

        self.set_choices()