def _remove_disconnected_clusters(self):
        bad_pores = sp.array([], dtype=int)
        self._pore_map = self.pores()
        self._throat_map = self.throats()
        health = self.check_network_health()
        if health['disconnected_clusters'] == []:
            self._throat_map = self.throats()
            self._pore_map = self.pores()
        else:
            Np = self.num_pores()
            Nt = self.num_throats()
            cluster_sizes = [sp.shape(x)[0] for x in health['disconnected_clusters']]
            # 50 or less, if it's a really small network.
            acceptable_size = min([min([50, Np/2]), max(cluster_sizes)])
            # Step through each cluster of pores. If its a small cluster,
            # add it to the list
            for cluster in health['disconnected_clusters']:
                if sp.shape(cluster)[0] < acceptable_size:
                    bad_pores = sp.append(bad_pores, sp.ravel(cluster))
            bad_throats = sp.unique(self.find_neighbor_throats(bad_pores))
            # Create map for pores
            if sp.shape(bad_pores)[0] > 0:
                i = 0
                self._pore_map = sp.zeros((Np-sp.shape(bad_pores)[0],), dtype=int)
                for pore in self.pores():
                    if pore not in bad_pores:
                        self._pore_map[i] = pore
                        i += 1
            # Create map for throats
            if sp.shape(bad_throats)[0] > 0:
                i = 0
                self._throat_map = sp.zeros((Nt - sp.shape(bad_throats)[0],),
                                            dtype=int)
                for throat in self.throats():
                    if throat not in bad_throats:
                        self._throat_map[i] = throat
                        i += 1
            # Fix the pore transformer
            try:
                if sp.shape(bad_pores)[0] > 0:
                    i = 0
                    old_transform = self._dictionary['pname_transform']
                    self._dictionary['pname_transform'] = \
                        sp.zeros((Np-sp.shape(bad_pores)[0],), dtype=int)
                    for pore in self.pores():
                        if pore not in bad_pores:
                            self._dictionary['pname_transform'][i] = \
                                old_transform[pore]
                            i += 1
            except:
                logger.info('Could not update pname_transform. Imported network \
                             may not have had it.')
                pass
            self.trim(pores=bad_pores)
dataset/ETHPy150Open PMEAL/OpenPNM/OpenPNM/Network/__MatFile__.py/MatFile._remove_disconnected_clusters/original