Пример #1
0
    def get_adapter_fragments(self, view_model):
        # type (SimulatorAdapterModel) -> dict
        forms = {
            None: [
                SimulatorStimulusFragment, SimulatorModelFragment,
                SimulatorIntegratorFragment, SimulatorMonitorFragment,
                SimulatorFinalFragment
            ],
            "surface": [SimulatorSurfaceFragment, SimulatorRMFragment]
        }

        current_model_class = type(view_model.model)
        all_model_forms = get_model_to_form_dict()
        forms["model"] = [all_model_forms.get(current_model_class)]

        all_monitor_forms = get_monitor_to_form_dict()
        selected_monitor_forms = []
        for monitor in view_model.monitors:
            current_monitor_class = type(monitor)
            selected_monitor_forms.append(
                all_monitor_forms.get(current_monitor_class))

        forms["monitors"] = selected_monitor_forms
        # Not sure if where we should in fact include the entire tree, or it will become too tedious.
        # For now I think it is ok if we rename this section "Summary" and filter what is shown
        return forms
Пример #2
0
    def _prepare_model_params_dict(self, model):
        model_form = get_model_to_form_dict().get(type(model))
        model_params = model_form.get_params_configurable_in_phase_plane()
        if len(model_params) == 0:
            self.logger.warning(
                "The list with configurable parameters for the current model is empty!"
            )
        model_params_dict = {}

        for param in model_params:
            model_params_dict.update({param: param})
        return model_params_dict