Ejemplo n.º 1
0
 def contains_structures(self, structures):
     structures_in_population = set(
         utils.hash_structure(sample.structure) for sample in self.samples)
     return [
         utils.hash_structure(structure) in structures_in_population
         for structure in structures
     ]
Ejemplo n.º 2
0
 def _get_unique(self, samples):
     unique_population = data.Population()
     unique_structures = set()
     for sample in samples:
         hashed_structure = utils.hash_structure(sample.structure)
         if hashed_structure in unique_structures:
             continue
         unique_structures.add(hashed_structure)
         unique_population.add_samples([sample])
     return unique_population
Ejemplo n.º 3
0
 def _filter(self, samples, blacklist):
     blacklist = set(
         utils.hash_structure(structure) for structure in blacklist)
     return Population(
         sample for sample in samples
         if utils.hash_structure(sample.structure) not in blacklist)