Skip to content

Commit

Permalink
Update warning
Browse files Browse the repository at this point in the history
  • Loading branch information
wfondrie committed Apr 29, 2024
1 parent bd8a432 commit 946c729
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed
- Partially revert length changes to `SpectrumDataset` and `AnnotatedSpectrumDataset`. We removed `__len__` from both due to problems with PyTorch Lightning compatibility.
- Simplify dataset code by removing redudancy with `lance.pytorch.LanceDatset`.
- Simplify dataset code by removing redundancy with `lance.pytorch.LanceDatset`.
- Improved warning message for skipped spectra.

## [v0.4.3]

Expand Down
7 changes: 4 additions & 3 deletions depthcharge/data/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from __future__ import annotations

import logging
import warnings
from abc import ABC, abstractmethod
from collections.abc import Callable, Iterable
from os import PathLike
Expand Down Expand Up @@ -223,10 +224,10 @@ def iter_batches(self, batch_size: int | None) -> pa.RecordBatch:
yield self._yield_batch()

if n_skipped:
LOGGER.warning(
"Skipped %d spectra with invalid information", n_skipped
warnings.warning(
f"Skipped {n_skipped} spectra with invalid information."
f"Last error was: \n {str(last_exc)}"
)
LOGGER.debug("Last error: %s", str(last_exc))

def _update_batch(self, entry: dict) -> None:
"""Update the batch.
Expand Down

0 comments on commit 946c729

Please sign in to comment.