llnl / llnl/SSAPy

Particles.fuse reports negligible weights after successful reweighting

Open Beginner friendly
#141 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
75
Forks
17
Avg merge
1h 51m
Merged PRs (30d)
4

Description

## Summary

`Particles.fuse(verbose=True)` reports "All weights are negligible" when `reweight()` succeeds.

## Problem

`Particles.reweight()` documents and returns `True` for success and `False` when all particle weights are negligible. `Particles.fuse()` currently checks:

```python
if status > 0 and verbose:
print("All weights are negligible in Particles class")
```

Because `True > 0`, the warning is emitted on successful reweighting and suppressed on the failure condition it is intended to report.

An existing regression test also encodes the inverted behaviour by monkeypatching `reweight()` to return `True` and asserting that the warning is printed.

## Expected behaviour

The warning should be emitted only when `reweight()` returns `False` and `verbose=True`.

## Proposed change

- Change the condition to `if not status and verbose:`.
- Update the regression test to assert no warning on success and a warning on failure.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Particles.fuse() and its call to reweight(), then locate the existing regression test that monkeypatches reweight(). Run that test first; completion means the warning appears only for a False status with verbose=True, while successful reweighting produces no warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, testing
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
90/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.