Commit 03e2359b authored by Médéric Boquien's avatar Médéric Boquien

Switch the implementation to a suggestion made by Yannick. The speed is...

Switch the implementation to a suggestion made by Yannick. The speed is similar for small catalogues but it is substantially faster for large catalogues.
parent 262eefc2
Pipeline #2106 skipped with stage
......@@ -97,13 +97,13 @@ class ObservationsManagerPassbands(object):
exception as it may cause issues down the road.
"""
seen_set = set()
dup_set = set(i for i in self.table['id']
if i in seen_set or seen_set.add(i))
values, counts = np.unique(self.table['id'], return_counts=True)
duplicates = values[counts > 1].data
if len(dup_set) > 0:
if duplicates.size > 0:
raise Exception("The input file has the following duplicated id: " +
", ".join(dup_set) + ". The id must be unique.")
", ".join(duplicates.astype(str)) +
". The id must be unique.")
def _check_filters(self):
"""Check whether the list of filters and poperties makes sense.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment