def model_changed(self, dynamic_gid, name):
     """
     Resets the phase plane and returns the ui model for the slider area.
     """
     dynamic = self.get_cached_dynamic(dynamic_gid)
     dynamic.model = self.available_models[name]()
     dynamic.model.configure()
     dynamic.phase_plane = phase_space_d3(dynamic.model, dynamic.integrator)
     mp_params = DynamicModelController._get_model_parameters_ui_model(dynamic.model)
     graph_params = DynamicModelController._get_graph_ui_model(dynamic)
     return {'params' : mp_params, 'graph_params':graph_params, 'sliders_fragment': self._sliders_fragment(dynamic_gid)}
    def __init__(self, model=None, integrator=None):
        if model is None:
            model = models.Generic2dOscillator()
        if integrator is None:
            integrator = integrators.HeunDeterministic()

        model.configure()
        self.model = model
        self.integrator = integrator

        # Only one instance should exist for a browser page.
        # To achieve something close to that we store it here
        self.phase_plane = phase_space_d3(model, integrator)
    def __init__(self, model=None, integrator=None):
        if model is None:
            model = models.Generic2dOscillator()
        if integrator is None:
            integrator = integrators.HeunDeterministic()

        model.configure()
        self.model = model
        self.integrator = integrator

        # Only one instance should exist for a browser page.
        # To achieve something close to that we store it here
        self.phase_plane = phase_space_d3(model, integrator)
    def integrator_changed(self, dynamic_gid, **kwargs):
        adapter = _IntegratorFragmentAdapter()
        tree = adapter.convert_ui_inputs(kwargs, validation_required=False)
        integrator_name = tree['integrator']
        integrator_parameters = tree['integrator_parameters']

        noise_framework.build_noise(integrator_parameters)
        integrator = self.available_integrators[integrator_name](**integrator_parameters)

        dynamic = self.get_cached_dynamic(dynamic_gid)
        dynamic.integrator = integrator
        dynamic.model.integrator = integrator
        dynamic.model.configure()
        self._configure_integrator_noise(integrator, dynamic.model)

        dynamic.phase_plane = phase_space_d3(dynamic.model, dynamic.integrator)
 def model_changed(self, dynamic_gid, name):
     """
     Resets the phase plane and returns the ui model for the slider area.
     """
     dynamic = self.get_cached_dynamic(dynamic_gid)
     dynamic.model = self.available_models[name]()
     dynamic.model.configure()
     self._configure_integrator_noise(dynamic.integrator, dynamic.model)
     dynamic.phase_plane = phase_space_d3(dynamic.model, dynamic.integrator)
     mp_params = DynamicModelController._get_model_parameters_ui_model(dynamic.model)
     graph_params = DynamicModelController._get_graph_ui_model(dynamic)
     return {
         'params': mp_params, 'graph_params': graph_params,
         'model_param_sliders_fragment': self._model_param_sliders_fragment(dynamic_gid),
         'axis_sliders_fragment': self._axis_sliders_fragment(dynamic_gid)
     }
    def integrator_changed(self, dynamic_gid, **kwargs):
        adapter = _IntegratorFragmentAdapter()
        tree = adapter.convert_ui_inputs(kwargs, validation_required=False)
        integrator_name = tree['integrator']
        integrator_parameters = tree['integrator_parameters']

        noise_framework.build_noise(integrator_parameters)
        integrator = self.available_integrators[integrator_name](
            **integrator_parameters)

        dynamic = self.get_cached_dynamic(dynamic_gid)
        dynamic.integrator = integrator
        dynamic.model.integrator = integrator
        dynamic.model.configure()
        self._configure_integrator_noise(integrator, dynamic.model)

        dynamic.phase_plane = phase_space_d3(dynamic.model, dynamic.integrator)
 def _update_integrator(self, dynamic, integrator):
     dynamic.integrator = integrator
     dynamic.model.integrator = integrator
     dynamic.model.configure()
     self._configure_integrator_noise(integrator, dynamic.model)
     dynamic.phase_plane = phase_space_d3(dynamic.model, dynamic.integrator)