def persist_to_file(self, results, file_path):
     """
     Persist simulation results to a file in YAML format.
     :param results: simulation results to be persisted
     :param file_path: file to which the simulation results are written
     """
     stream = file(file_path, 'w')
     yaml.dump(util.sanitize_results(results), stream)
Exemple #2
0
 def persist_to_file(self, results, file_path):
     """
     Persist simulation results to a file in YAML format.
     :param results: simulation results to be persisted
     :param file_path: file to which the simulation results are written
     """
     stream = file(file_path, 'w')
     yaml.dump(util.sanitize_results(results), stream)
Exemple #3
0
 def plot2d_from_memory(self, results, x_param, y_param, output_filename, title="", x_label="", y_label=""):
     """
     Plot two-dimensional simulation results from a python data structure in memory.
     :param results: simulation results to be plotted
     :param x_param: parameter of the simulation results to be used on the x axis
     :param y_param: parameter of the simulation results to be used on the y axis
     :param output_filename: file to write the plot to
     :param title: title of the plot
     :param x_label: name of the plot x axis
     :param y_label: name of the y axis
     """
     params = self._get_corresponding_results(util.sanitize_results(results), x_param, y_param)
     self._plot2d(util.strip_unit(params[0]),
                  util.strip_unit(params[1]),
                  output_filename, title, x_label, y_label)
Exemple #4
0
    def run_simulations(self, tag):
        simulation_scenarios = self.generator.generate_memory()
	#print len(simulation_scenarios)

        automator_input = []
        for scenario in simulation_scenarios:
            automator_entry = {}
            automator_entry["parameters"] = scenario
            automator_entry["strategies"] = None
            automator_input.append(automator_entry)

        results, fails = self.automator.run(automator_input, tag)
        self.persistence.initialise_database_client()
        sanitized_results = sanitize_results(results)
        #print sanitized_results
        self.persistence.persist_to_database(self.config["Persistence"]["database"]["collection_name"], sanitized_results)
        return results, fails
Exemple #5
0
    def run_simulations(self, tag):
        simulation_scenarios = self.generator.generate_memory()
        #print len(simulation_scenarios)

        automator_input = []
        for scenario in simulation_scenarios:
            automator_entry = {}
            automator_entry["parameters"] = scenario
            automator_entry["strategies"] = None
            automator_input.append(automator_entry)

        results, fails = self.automator.run(automator_input, tag)
        self.persistence.initialise_database_client()
        sanitized_results = sanitize_results(results)
        #print sanitized_results
        self.persistence.persist_to_database(
            self.config["Persistence"]["database"]["collection_name"],
            sanitized_results)
        return results, fails
Exemple #6
0
 def plot2d_from_memory(self,
                        results,
                        x_param,
                        y_param,
                        output_filename,
                        title="",
                        x_label="",
                        y_label=""):
     """
     Plot two-dimensional simulation results from a python data structure in memory.
     :param results: simulation results to be plotted
     :param x_param: parameter of the simulation results to be used on the x axis
     :param y_param: parameter of the simulation results to be used on the y axis
     :param output_filename: file to write the plot to
     :param title: title of the plot
     :param x_label: name of the plot x axis
     :param y_label: name of the y axis
     """
     params = self._get_corresponding_results(
         util.sanitize_results(results), x_param, y_param)
     self._plot2d(util.strip_unit(params[0]), util.strip_unit(params[1]),
                  output_filename, title, x_label, y_label)