How to use the ert.util.BoolVector function in ert

To help you get started, we’ve selected a few ert examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Ensembles / ert / devel / python / python / ert / enkf / enkf_simulation_runner.py View on Github external
def runEnsembleExperiment(self, active_realization_mask=None):
        """ @rtype: bool """
        if active_realization_mask is None:
            count = self.ert.getEnsembleSize()
            active_realization_mask = BoolVector(default_value=True, initial_size=count)

        iter_nr = 0
        return self.runSimpleStep(active_realization_mask, EnkfInitModeEnum.INIT_CONDITIONAL, iter_nr)
github Ensembles / ert / devel / python / python / ert / enkf / state_map.py View on Github external
def selectMatching(self, select_target, select_mask):
        """
        @type select_target: BoolVector
        @type select_mask: RealizationStateEnum
        """
        assert isinstance(select_target, BoolVector)
        assert isinstance(select_mask, RealizationStateEnum)

        StateMap.cNamespace().select_matching(self, select_target, select_mask)
github Ensembles / ert / python / python / ert / enkf / plot_data / ensemble_plot_gen_data.py View on Github external
def __load(self, file_system, report_step, input_mask=None):
        assert isinstance(file_system, EnkfFs)
        if not input_mask is None:
            assert isinstance(input_mask, BoolVector)

        self._load(file_system, report_step, input_mask)
github OPM / ResInsight / ThirdParty / Ert / devel / python / python / ert / enkf / plot_data / plot_block_data_loader.py View on Github external
def load(self, fs, report_step, input_mask=None):
        """
         @type fs: EnkfFs
         @type report_step: int
         @type input_mask: BoolVector
         @rtype: PlotBlockData
        """

        state_map = fs.getStateMap()
        ensemble_size = len(state_map)

        if not input_mask is None:
            mask = BoolVector.copy(input_mask)
        else:
            mask = BoolVector(False, ensemble_size)

        state_map.selectMatching(mask, RealizationStateEnum.STATE_HAS_DATA)

        depth = self.getDepthValues(report_step)

        self.__permutation_vector = depth.permutationSort()
        depth.permute(self.__permutation_vector)

        plot_block_data = PlotBlockData(depth)

        thread_pool = ThreadPool()
        for index in range(ensemble_size):
            if mask[index]:
                thread_pool.addTask(self.loadVector, plot_block_data, fs, report_step, index)

        thread_pool.nonBlockingStart()
github Ensembles / ert / devel / python / python / ert / enkf / plot_data / ensemble_plot_gen_data.py View on Github external
def __load(self, file_system, report_step, input_mask=None):
        assert isinstance(file_system, EnkfFs)
        if not input_mask is None:
            assert isinstance(input_mask, BoolVector)

        EnsemblePlotGenData.cNamespace().load(self, file_system, report_step, input_mask)
github Ensembles / ert / devel / python / python / ert / enkf / plot / pca_fetcher.py View on Github external
def calculatePrincipalComponent(self, fs, local_obsdata, truncation_or_ncomp=3):
        pc = Matrix(1, 1)
        pc_obs = Matrix(1, 1)
        singular_values = DoubleVector()

        state_map = fs.getStateMap()
        ens_mask = BoolVector(False, self.ert().getEnsembleSize())
        state_map.selectMatching(ens_mask, RealizationStateEnum.STATE_HAS_DATA)
        active_list = ens_mask.createActiveList( )

        if len(ens_mask) > 0:
            meas_data = MeasData(ens_mask)
            obs_data = ObsData()

            self.ert().getObservations().getObservationAndMeasureData(fs, local_obsdata, active_list, meas_data, obs_data)

            meas_data.deactivateZeroStdSamples(obs_data)

            active_size = len(obs_data)

            if active_size > 0:
                S = meas_data.createS()
                D_obs = obs_data.createDObs()
github Ensembles / ert / devel / python / python / ert / enkf / export / gen_kw_collector.py View on Github external
def createActiveList(ert, fs):
        state_map = fs.getStateMap()
        ens_mask = BoolVector(False, ert.getEnsembleSize())
        state_map.selectMatching(ens_mask, RealizationStateEnum.STATE_INITIALIZED | RealizationStateEnum.STATE_HAS_DATA)
        active_list = BoolVector.createActiveList(ens_mask)

        return [iens for iens in active_list]
github Ensembles / ert / devel / python / python / ert / enkf / state_map.py View on Github external
def realizationList(self , state_value):
        """
        Will create a list of all realisations with state equal to @state_value.
        @type select_mask: RealizationStateEnum
        @rtype: IntVector
        """
        mask = BoolVector(False, len(self))
        self.selectMatching(mask, state_value )
        return BoolVector.createActiveList( mask )
github Ensembles / ert / devel / python / python / ert_gui / ertwidgets / models / activerealizationsmodel.py View on Github external
def getActiveRealizationsMask(self):
        count = getRealizationCount()

        mask = BoolVector.createActiveMask(self.getValue())

        if mask is None:
            raise ValueError("Error while parsing range string!")

        if len(mask) > count:
            raise ValueError("Mask size changed %d != %d!" % (count, len(mask)))

        return mask