def submit_model_parameters(self, node_values):
        """
        Collects the model parameters values from all the models used for the connectivity nodes.
        Assumes that the array indices are consistent with the node order.
        """
        dynamic_ids = json.loads(node_values)
        dynamics = [dao.get_dynamic(did) for did in dynamic_ids]

        for dynamic in dynamics[1:]:
            if dynamic.model_class != dynamics[0].model_class:
                raise Exception("All dynamics must have the same model type")

        model_name = dynamics[0].model_class
        burst_config = common.get_from_session(common.KEY_BURST_CONFIG)

        # update model parameters in burst config
        des = SerializationManager(burst_config)
        model_parameters = [
            dict(json.loads(d.model_parameters)) for d in dynamics
        ]
        des.write_model_parameters(model_name, model_parameters)

        # update dynamic ids in burst config
        burst_config.dynamic_ids = dynamic_ids

        # Update in session BURST configuration for burst-page.
        # todo was this needed? as the burst config in session has already been changed
        #common.add2session(common.KEY_BURST_CONFIG, burst_config.clone())
        raise cherrypy.HTTPRedirect("/burst/")
Пример #2
0
    def submit_model_parameters(self, node_values):
        """
        Collects the model parameters values from all the models used for the connectivity nodes.
        Assumes that the array indices are consistent with the node order.
        """
        dynamic_ids = json.loads(node_values)
        dynamics = [dao.get_dynamic(did) for did in dynamic_ids]

        for dynamic in dynamics[1:]:
            if dynamic.model_class != dynamics[0].model_class:
                raise Exception("All dynamics must have the same model type")

        model_name = dynamics[0].model_class
        burst_config = common.get_from_session(common.KEY_BURST_CONFIG)
        simulator_config = common.get_from_session(common.KEY_SIMULATOR_CONFIG)

        # update model parameters in burst config
        des = SerializationManager(simulator_config)
        model_parameters = [
            dict(json.loads(d.model_parameters)) for d in dynamics
        ]
        des.write_model_parameters(model_name, model_parameters)

        # update dynamic ids in burst config
        burst_config.dynamic_ids = json.dumps(dynamic_ids)

        # Update in session the simulator configuration and the current form URL in wizzard for burst-page.
        common.add2session(common.KEY_BURST_CONFIG, burst_config)
        common.add2session(common.KEY_LAST_LOADED_FORM_URL,
                           SimulatorWizzardURLs.SET_INTEGRATOR_URL)
        raise cherrypy.HTTPRedirect("/burst/")
    def submit_model_parameters(self, node_values):
        """
        Collects the model parameters values from all the models used for the connectivity nodes.
        Assumes that the array indices are consistent with the node order.
        """
        dynamic_ids = json.loads(node_values)
        dynamics = [dao.get_dynamic(did) for did in dynamic_ids]

        for dynamic in dynamics[1:]:
            if dynamic.model_class != dynamics[0].model_class:
                raise Exception("All dynamics must have the same model type")

        model_name = dynamics[0].model_class
        burst_config = common.get_from_session(common.KEY_BURST_CONFIG)

        # update model parameters in burst config
        des = SerializationManager(burst_config)
        model_parameters = [dict(json.loads(d.model_parameters)) for d in dynamics]
        des.write_model_parameters(model_name, model_parameters)

        # update dynamic ids in burst config
        burst_config.dynamic_ids = dynamic_ids

        # Update in session BURST configuration for burst-page.
        # todo was this needed? as the burst config in session has already been changed
        # common.add2session(common.KEY_BURST_CONFIG, burst_config.clone())
        raise cherrypy.HTTPRedirect("/burst/")
 def dynamic_detail(self, dynamic_id):
     dynamic = dao.get_dynamic(dynamic_id)
     model_parameters = dict(json.loads(dynamic.model_parameters))
     return {'model_parameters': model_parameters}
Пример #5
0
 def dynamic_detail(self, dynamic_id):
     dynamic = dao.get_dynamic(dynamic_id)
     model_parameters = dict(json.loads(dynamic.model_parameters))
     return {'model_parameters': model_parameters}