Exemple #1
0
    def __init__(self, opts):
        # type: (Dict[str, Any]) -> None
        from bumps.cli import config_matplotlib  # type: ignore
        from . import bumps_model
        config_matplotlib()
        self.opts = opts
        p1, p2 = opts['pars']
        m1, m2 = opts['def']
        self.fix_p2 = m1 != m2 or p1 != p2
        model_info = m1
        pars, pd_types = bumps_model.create_parameters(model_info, **p1)
        # Initialize parameter ranges, fixing the 2D parameters for 1D data.
        if not opts['is2d']:
            for p in model_info.parameters.user_parameters({}, is2d=False):
                for ext in ['', '_pd', '_pd_n', '_pd_nsigma']:
                    k = p.name + ext
                    v = pars.get(k, None)
                    if v is not None:
                        v.range(*parameter_range(k, v.value))
        else:
            for k, v in pars.items():
                v.range(*parameter_range(k, v.value))

        self.pars = pars
        self.starting_values = dict((k, v.value) for k, v in pars.items())
        self.pd_types = pd_types
        self.limits = None
Exemple #2
0
    def OnInit(self):
        # Determine the position and size of the splash screen based on the
        # desired size and screen real estate that we have to work with.
        pos, size = self.window_placement(SPLASH_WIDTH, SPLASH_HEIGHT)
        #print "splash pos and size =", pos, size

        # Display the splash screen.  It will remain visible until the caller
        # executes app.MainLoop() AND either the splash screen timeout expires
        # or the user left clicks over the splash screen.
        if LOGTIM: log_time("Starting to display the splash screen")
        pic = resource(SPLASH_FILE)
        self.display_splash_screen(img_name=pic, pos=pos, size=size)

        # Determine the position and size of the application frame based on the
        # desired size and screen real estate that we have to work with.
        pos, size = self.window_placement(FRAME_WIDTH, FRAME_HEIGHT)
        #print "frame pos and size =", pos, size

        # Create the application frame, but it will not be shown until the
        # splash screen terminates.  Note that import of AppFrame is done here
        # while the user is viewing the splash screen.
        if LOGTIM: log_time("Starting to build the GUI application")

        # Can't delay matplotlib configuration any longer
        from bumps.cli import config_matplotlib
        config_matplotlib('WXAgg')

        from .app_frame import AppFrame
        self.frame = AppFrame(parent=None, title=APP_TITLE,
                              pos=pos, size=size)

        # Declare the application frame to be the top window.
        self.SetTopWindow(self.frame)

        # To have the frame visible behind the spash screen, comment out the
        # line below.
        #self.frame.Show(True)
        #wx.CallAfter(self.after_show)

        # To test that the splash screen will not go away until the frame
        # initialization is complete, simulate an increase in startup time
        # by taking a nap.
        #time.sleep(6)
        return True
Exemple #3
0
    def OnInit(self):
        # Determine the position and size of the splash screen based on the
        # desired size and screen real estate that we have to work with.
        pos, size = self.window_placement(SPLASH_WIDTH, SPLASH_HEIGHT)
        #print "splash pos and size =", pos, size

        # Display the splash screen.  It will remain visible until the caller
        # executes app.MainLoop() AND either the splash screen timeout expires
        # or the user left clicks over the splash screen.
        #if LOGTIM: log_time("Starting to display the splash screen")
        #pic = resource(SPLASH_FILE)
        #self.display_splash_screen(img_name=pic, pos=pos, size=size)

        # Determine the position and size of the application frame based on the
        # desired size and screen real estate that we have to work with.
        pos, size = self.window_placement(FRAME_WIDTH, FRAME_HEIGHT)
        #print "frame pos and size =", pos, size

        # Create the application frame, but it will not be shown until the
        # splash screen terminates.  Note that import of AppFrame is done here
        # while the user is viewing the splash screen.
        if LOGTIM: log_time("Starting to build the GUI application")

        # Can't delay matplotlib configuration any longer
        cli.config_matplotlib('WXAgg')

        from .app_frame import AppFrame
        self.frame = AppFrame(parent=None, title=APP_TITLE, pos=pos, size=size)

        # Declare the application frame to be the top window.
        self.SetTopWindow(self.frame)

        self._aui_mgr = wx.aui.AuiManager()
        self._aui_mgr.SetManagedWindow(self.frame)

        # To have the frame visible behind the spash screen, comment out the following
        #wx.CallAfter(self.after_show)
        self.after_show()

        # To test that the splash screen will not go away until the frame
        # initialization is complete, simulate an increase in startup time
        # by taking a nap.
        #time.sleep(6)
        return True
Exemple #4
0
    def __init__(self, opts):
        # type: (Dict[str, Any]) -> None
        from bumps.cli import config_matplotlib  # type: ignore
        from . import bumps_model
        config_matplotlib()
        self.opts = opts
        model_info = opts['def']
        pars, pd_types = bumps_model.create_parameters(model_info, **opts['pars'])
        # Initialize parameter ranges, fixing the 2D parameters for 1D data.
        if not opts['is2d']:
            for p in model_info.parameters.user_parameters(is2d=False):
                for ext in ['', '_pd', '_pd_n', '_pd_nsigma']:
                    k = p.name+ext
                    v = pars.get(k, None)
                    if v is not None:
                        v.range(*parameter_range(k, v.value))
        else:
            for k, v in pars.items():
                v.range(*parameter_range(k, v.value))

        self.pars = pars
        self.pd_types = pd_types
        self.limits = None
Exemple #5
0
    def __init__(self, opts):
        from bumps.cli import config_matplotlib
        from . import bumps_model
        config_matplotlib()
        self.opts = opts
        model_info = opts['def']
        pars, pd_types = bumps_model.create_parameters(model_info,
                                                       **opts['pars'])
        if not opts['is2d']:
            active = [
                base + ext for base in model_info['partype']['pd-1d']
                for ext in ['', '_pd', '_pd_n', '_pd_nsigma']
            ]
            active.extend(model_info['partype']['fixed-1d'])
            for k in active:
                v = pars[k]
                v.range(*parameter_range(k, v.value))
        else:
            for k, v in pars.items():
                v.range(*parameter_range(k, v.value))

        self.pars = pars
        self.pd_types = pd_types
        self.limits = None