Ejemplo n.º 1
0
    def fetchSummaryData(self, observation_data_fetcher, key, cases):
        plot_data = PlotData(key)

        observation_data = observation_data_fetcher.fetchData(key)
        observation_plot_data = ObservationPlotData(key)
        observation_plot_data.setObservationData(observation_data["x"], observation_data["y"], observation_data["std"], observation_data["continuous"])
        observation_plot_data.updateBoundaries(observation_data["min_x"], observation_data["max_x"], observation_data["min_y"], observation_data["max_y"])
        plot_data.setObservationData(observation_plot_data)

        refcase_data = RefcaseDataFetcher(self.ert()).fetchData(key)
        refcase_plot_data = RefcasePlotData(key)
        refcase_plot_data.setRefcaseData(refcase_data["x"], refcase_data["y"])
        refcase_plot_data.updateBoundaries(refcase_data["min_x"], refcase_data["max_x"], refcase_data["min_y"], refcase_data["max_y"])

        plot_data.setRefcaseData(refcase_plot_data)

        for case in cases:
            ensemble_data = EnsembleDataFetcher(self.ert()).fetchData(key, case)

            ensemble_plot_data = EnsemblePlotData(key, case)
            ensemble_plot_data.setEnsembleData(ensemble_data["x"], ensemble_data["y"], ensemble_data["min_y_values"], ensemble_data["max_y_values"])
            ensemble_plot_data.updateBoundaries(ensemble_data["min_x"], ensemble_data["max_x"], ensemble_data["min_y"], ensemble_data["max_y"])
            plot_data.addEnsembleData(ensemble_plot_data)

        return plot_data
Ejemplo n.º 2
0
    def fetchPcaData(self, key, cases):
        """ @rtype: PlotData """
        if key.startswith("PCA:"):
            pca_name = key
        else:
            pca_name ="PCA:%s" % key

        pca_data_fetcher = PcaDataFetcher(self.ert())
        pca_plot_data = PlotData(pca_name)

        if DataTypeKeysModel().isCustomPcaKey(key):
            obs_keys = DataTypeKeysModel().getCustomPcaKeyObsKeys(key)
        else:
            obs_keys = pca_data_fetcher.getObsKeys(key)

        for case in cases:

            pca_data = pca_data_fetcher.fetchData(obs_keys, case)

            if pca_data["x"] is not None:

                if not pca_plot_data.hasObservationData():
                    pca_observation_plot_data = ObservationPlotData(pca_name)
                    pca_observation_plot_data.setObservationData(pca_data["x"], pca_data["obs_y"], [0.0 for x in pca_data["x"]], False)
                    pca_observation_plot_data.updateBoundaries(pca_data["min_x"], pca_data["max_x"], pca_data["min_y"], pca_data["max_y"])
                    pca_plot_data.setObservationData(pca_observation_plot_data)

                pca_ensemble_plot_data = EnsemblePlotData(key, case)
                pca_ensemble_plot_data.setEnsembleData(pca_data["x"], pca_data["y"], [], [])
                pca_ensemble_plot_data.updateBoundaries(pca_data["min_x"], pca_data["max_x"], pca_data["min_y"], pca_data["max_y"])
                pca_plot_data.addEnsembleData(pca_ensemble_plot_data)

        return pca_plot_data
Ejemplo n.º 3
0
    def fetchBlockObservationData(self, block_observation_data_fetcher, key, cases):
        plot_data = PlotData(key)

        data = block_observation_data_fetcher.fetchData(key)
        block_observation_plot_data = ObservationPlotData(key)
        selected_report_step_index = 0

        if len(data) > 0:
            data = data[selected_report_step_index]
            block_observation_plot_data.setObservationData(data["x"], data["y"], data["std"], False, histogram_support=False)
            block_observation_plot_data.updateBoundaries(data["min_x"], data["max_x"], data["min_y"], data["max_y"])

            plot_data.setObservationData(block_observation_plot_data)

            for case in cases:
                ensemble_data = EnsembleBlockDataFetcher(self.ert()).fetchData(key, case)

                if len(ensemble_data) > 0:
                    ensemble_data = ensemble_data[selected_report_step_index]
                    ensemble_plot_data = EnsemblePlotData(key, case)
                    ensemble_plot_data.setEnsembleData(ensemble_data["x"], ensemble_data["y"], ensemble_data["min_x_values"], ensemble_data["max_x_values"], histogram_support=False)
                    ensemble_plot_data.updateBoundaries(ensemble_data["min_x"], ensemble_data["max_x"], ensemble_data["min_y"], ensemble_data["max_y"])
                    plot_data.addEnsembleData(ensemble_plot_data)

        return plot_data
Ejemplo n.º 4
0
    def addObservationData(self, plot_data, key, fetcher, histogram_factory=None):
        observation_data = fetcher.fetchData(key)

        observation_plot_data = ObservationPlotData(key)
        observation_plot_data.setObservationData(observation_data["x"], observation_data["y"], observation_data["std"], observation_data["continuous"])
        observation_plot_data.updateBoundaries(observation_data["min_x"], observation_data["max_x"], observation_data["min_y"], observation_data["max_y"])

        plot_data.setObservationData(observation_plot_data)

        if histogram_factory is not None:
            histogram_factory.setObservations(observation_data["x"], observation_data["y"], observation_data["std"], observation_data["min_y"], observation_data["max_y"])
Ejemplo n.º 5
0
    def fetchGenData(self, gen_data_fetcher, key, cases):
        plot_data = PlotData(key)

        ensemble_data = ObservationGenDataFetcher(self.ert()).fetchData(key, cases)

        if len(ensemble_data) > 0:
            observation_plot_data = ObservationPlotData(key)

            observation_plot_data.setObservationData(ensemble_data["x"], ensemble_data["y"], ensemble_data["std"], ensemble_data["continuous"])
            observation_plot_data.updateBoundaries(ensemble_data["min_x"], ensemble_data["max_x"], ensemble_data["min_y"], ensemble_data["max_y"])
            plot_data.setObservationData(observation_plot_data)

            for case in cases:
                ensemble_data = gen_data_fetcher.fetchData(key, case)

                if len(ensemble_data) > 0:
                    ensemble_plot_data = EnsemblePlotData(key, case)
                    ensemble_plot_data.setEnsembleData(ensemble_data["x"], ensemble_data["y"], ensemble_data["min_y_values"], ensemble_data["max_y_values"])
                    ensemble_plot_data.updateBoundaries(ensemble_data["min_x"], ensemble_data["max_x"], ensemble_data["min_y"], ensemble_data["max_y"])
                    plot_data.addEnsembleData(ensemble_plot_data)

        return plot_data
Ejemplo n.º 6
0
    def fetchPcaData(self, key, cases):
        """ @rtype: PlotData """
        if key.startswith("PCA:"):
            pca_name = key
        else:
            pca_name = "PCA:%s" % key

        pca_data_fetcher = PcaDataFetcher(self.ert())
        pca_plot_data = PlotData(pca_name)

        if DataTypeKeysModel().isCustomPcaKey(key):
            obs_keys = DataTypeKeysModel().getCustomPcaKeyObsKeys(key)
        else:
            obs_keys = pca_data_fetcher.getObsKeys(key)

        for case in cases:

            pca_data = pca_data_fetcher.fetchData(obs_keys, case)

            if pca_data["x"] is not None:

                if not pca_plot_data.hasObservationData():
                    pca_observation_plot_data = ObservationPlotData(pca_name)
                    pca_observation_plot_data.setObservationData(
                        pca_data["x"], pca_data["obs_y"],
                        [0.0 for x in pca_data["x"]], False)
                    pca_observation_plot_data.updateBoundaries(
                        pca_data["min_x"], pca_data["max_x"],
                        pca_data["min_y"], pca_data["max_y"])
                    pca_plot_data.setObservationData(pca_observation_plot_data)

                pca_ensemble_plot_data = EnsemblePlotData(key, case)
                pca_ensemble_plot_data.setEnsembleData(pca_data["x"],
                                                       pca_data["y"], [], [])
                pca_ensemble_plot_data.updateBoundaries(
                    pca_data["min_x"], pca_data["max_x"], pca_data["min_y"],
                    pca_data["max_y"])
                pca_plot_data.addEnsembleData(pca_ensemble_plot_data)

        return pca_plot_data
Ejemplo n.º 7
0
    def addObservationData(self,
                           plot_data,
                           key,
                           fetcher,
                           histogram_factory=None):
        observation_data = fetcher.fetchData(key)

        observation_plot_data = ObservationPlotData(key)
        observation_plot_data.setObservationData(
            observation_data["x"], observation_data["y"],
            observation_data["std"], observation_data["continuous"])
        observation_plot_data.updateBoundaries(observation_data["min_x"],
                                               observation_data["max_x"],
                                               observation_data["min_y"],
                                               observation_data["max_y"])

        plot_data.setObservationData(observation_plot_data)

        if histogram_factory is not None:
            histogram_factory.setObservations(observation_data["x"],
                                              observation_data["y"],
                                              observation_data["std"],
                                              observation_data["min_y"],
                                              observation_data["max_y"])