Skip to content

Commit

Permalink
fix logging bug
Browse files Browse the repository at this point in the history
  • Loading branch information
weaverba137 committed Dec 3, 2024
1 parent c6b91be commit 1b9ac62
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions py/specprodDB/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -1383,7 +1383,7 @@ def load_file(filepaths, tcls, hdu=1, row_filter=None, q3c=None, chunksize=50000
Read a data table from this HDU (default 1).
row_filter : callable, optional
If set, apply this filter to the rows to be loaded. The function
should return :class:`bool`, with ``True`` meaning a good row.
should return an array of indexes of "good" rows.
q3c : :class:`str`, optional
If set, create q3c index on the table, using the RA column
named `q3c`.
Expand Down Expand Up @@ -1414,13 +1414,13 @@ def load_file(filepaths, tcls, hdu=1, row_filter=None, q3c=None, chunksize=50000
log.error("Unrecognized data file, %s!", filepath)
return
if row_filter is None:
good_rows = np.ones((len(data),), dtype=bool)
good_rows = np.arange(len(data))
else:
good_rows = row_filter(data)
if good_rows.sum() == 0:
if len(good_rows) == 0:
log.info("Row filter removed all data rows, skipping %s.", filepath)
continue
log.info("Row filter applied on %s; %d rows remain.", tn, good_rows.sum())
log.info("Row filter applied on %s; %d rows remain.", tn, len(good_rows))
orm_objects = tcls.convert(data, row_index=good_rows)
log.info("Converted data to ORM objects on %s.", tn)
del data
Expand Down

0 comments on commit 1b9ac62

Please sign in to comment.