Skip to content

Commit

Permalink
Clarify comments on the initialization of imgcollection.
Browse files Browse the repository at this point in the history
  • Loading branch information
DinoBektesevic committed Jan 10, 2024
1 parent 22ff1c0 commit 2bbf65e
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/kbmod/image_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def _validate(self, metadata):
# check that standardizer to row lookup exists
missing_keys = [key for key in ["std_idx", "ext_idx"] if key not in cols]
if missing_keys:
return False, ("missing required standardizer-row lookup indices: " f"{missing_keys}")
return False, (f"missing required standardizer-row lookup indices: {missing_keys}")

return True, ""

Expand All @@ -143,15 +143,16 @@ def __init__(self, metadata, standardizers=None):
raise ValueError(f"Metadata is {explanation}")

# If standardizers are already instantiated, keep them. This keeps any
# resources they are holding onto alive and enables in-memory stds;
# lazy-loading skips the, in this case, impossible instantiation. Add
# "std_name" column to metadata if it doesn't exist and update the
# n_stds metadata entry. This is shared by all from* constructors so
# it's practical to just do here. If standardizers are not given,
# assume they roundtrip via row data and build an empty private list of
# stds for lazy eval. Look for the list size in table metadata or guess
# the number of unique targets from the required location (tgt) column
# in the metadata. Update table metadata if that was necessary.
# resources they are holding onto alive, and enables in-memory stds.
# These are impossible to instantiate, but since they are already
# in-memory we don't need to and lazy-loading will skip attempts to.
# Unrelated, if it doesn't exist, add "std_name" column to metadata and
# update the n_stds entry. This is shared by all from* constructors, so
# it's just practical to do here.
# Else if standardizers are not given, assume they round-trip from rows
# and build an empty private list of stds for lazy eval. The length of
# the list is determined from table metadata or guessed from the number
# of unique targets. Table metadata is updated if necessary.
if standardizers is not None:
self._standardizers = np.array(standardizers)
if "std_name" not in metadata.columns:
Expand Down

0 comments on commit 2bbf65e

Please sign in to comment.