Rename PriorAsProposal to DynamicsProposal, and KFasProposal to KalmanProposal#1131
Rename PriorAsProposal to DynamicsProposal, and KFasProposal to KalmanProposal#1131sdhiscocks merged 2 commits intodstl:mainfrom
Conversation
e7ceb1f to
4ac7654
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1131 +/- ##
==========================================
- Coverage 93.72% 93.72% -0.01%
==========================================
Files 217 217
Lines 14430 14441 +11
Branches 1963 1965 +2
==========================================
+ Hits 13525 13535 +10
Misses 644 644
- Partials 261 262 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
|
Would it be worth to add backwards compatibility with a deprecation warning message for uses of import warnings
__all__ = ["DynamicsProposal", "KalmanProposal"]
DEPRECATED_NAMES = [("PriorAsProposal", "DynamicsProposal"), ("KFasProposal", "KalmanProposal")]
def __getattr__(name):
for old_name, new_name in DEPRECATED_NAMES:
if name == old_name:
warnings.warn(f"The '{old_name}' class or function has been renamed to '{new_name}' and will be removed in a future release.",
DeprecationWarning,
stacklevel=2)
return globals()[new_name]
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
def __dir__():
return sorted(__all__ + [names[0] for names in DEPRECATED_NAMES])Doing so would allow use of the deprecated class names, but will raise a >>> from stonesoup.proposal.simple import PriorAsProposal
<input>:1: DeprecationWarning: The 'PriorAsProposal' class or function has been renamed to 'DynamicsProposal' and will be removed in a future release.
>>> print(a := PriorAsProposal(None))
DynamicsProposal(
transition_model=None) |
Yeah, I think that'd be a good idea. And we'll remove it in the following release afterwards. |
098a456 to
3dc4602
Compare
…al and KFasProposal classes
This PR renames the proposals introduced in #1080 to make them more intuitive and representative of their purpose. Specifically:
PriorAsProposalhas been renamed toDynamicsProposalKFasProposalhas been renamed toKalmanProposal.This is also an attempt to make the names of the classes consistent with the names that will be used in the paper we aim to publish to Fusion 2025.
Note: This PR introduces breaking changes for code that references the proposals directly. Any legacy code, or more generally code that does not explicitly specify a proposal, should run without errors.