Skip to content

Conversation

@fred3m
Copy link
Collaborator

@fred3m fred3m commented Dec 5, 2025

Checklist

  • ran Jenkins
  • added a release note for user-visible changes to doc/changes

@codecov
Copy link

codecov bot commented Dec 5, 2025

Codecov Report

❌ Patch coverage is 93.71429% with 44 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.81%. Comparing base (00274db) to head (de53ac2).
⚠️ Report is 4 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
python/lsst/scarlet/lite/models/parametric.py 31.57% 13 Missing ⚠️
python/lsst/scarlet/lite/models/free_form.py 40.00% 12 Missing ⚠️
python/lsst/scarlet/lite/component.py 90.76% 6 Missing ⚠️
tests/test_component.py 97.50% 3 Missing ⚠️
python/lsst/scarlet/lite/image.py 86.66% 2 Missing ⚠️
python/lsst/scarlet/lite/parameters.py 91.66% 2 Missing ⚠️
python/lsst/scarlet/lite/bbox.py 88.88% 1 Missing ⚠️
python/lsst/scarlet/lite/blend.py 96.15% 1 Missing ⚠️
python/lsst/scarlet/lite/io/cube_component.py 88.88% 1 Missing ⚠️
python/lsst/scarlet/lite/observation.py 95.65% 1 Missing ⚠️
... and 2 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #23      +/-   ##
==========================================
+ Coverage   92.41%   92.81%   +0.40%     
==========================================
  Files          49       49              
  Lines        5432     6013     +581     
==========================================
+ Hits         5020     5581     +561     
- Misses        412      432      +20     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fred3m fred3m force-pushed the tickets/DM-53388 branch 4 times, most recently from cb4a3d4 to 5954b92 Compare December 9, 2025 14:30

def __deepcopy__(self, memo: dict[int, Any]) -> Box:
"""Deep copy of the box"""
if id(self) in memo:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this is not performance-critical but you can do if (item := memo.get(id(self))) is not None: return item.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it's not a big deal but I did define my_id = id(self) since it is used multiple times in this method both inside and outside of the if block.

"""Implementation of unused abstract method"""

def parameterize(self, parameterization: Callable) -> None:
"""Implementation of unused abstract method"""
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this at least warn, if not raise NotImplementedError, rather than silently do nothing?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a logger warning. There is nothing wrong with having a component that does not update but I agree with your point that the user should at least be warned if they are using it in fitting code.

return self._model

def resize(self, model_box: Box) -> bool:
"""Test whether or not the component needs to be resized"""
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I probably reviewed this ages ago but I think it's more clear to say something like "Resize the component if needed and return whether it was resized".

This maybe should also warn if it can't ever be resized and if that could be surprising to users.

with self.assertRaises(AssertionError):
assert_array_equal(param.x, param_deepcopy.x)

assert_array_equal(param.helpers["m"], param_deepcopy.helpers["m"])
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is repetitive enough to warrant a loop.

self.assertIsNot(source, source_copy)
self.assertEqual(source.n_components, 2)
self.assertEqual(source.n_components, source_copy.n_components)
self.assertFactorizedComponentEqual(source.components[0], source_copy.components[0])
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't you check both components?

@fred3m fred3m merged commit e1c02a5 into main Jan 21, 2026
18 checks passed
@fred3m fred3m deleted the tickets/DM-53388 branch January 21, 2026 01:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants