Repository navigation
MNT: v1.14.0 final review fixes #1243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
94abad4
3b4c7ad
f42149a
d3e7bc7
60258f7
45f3508
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,28 +9,6 @@ | |
| from ..prints.parachute_prints import _ParachutePrints | ||
|
|
||
|
|
||
| def _is_a_height_trigger(trigger): | ||
| """Whether ``trigger`` is a number this class will read as a height. | ||
|
|
||
| ``numbers.Real`` rather than ``(int, float)`` so that NumPy scalars are | ||
| accepted: ``numpy.float64`` happens to subclass ``float``, but | ||
| ``numpy.int64`` and ``numpy.float32`` subclass neither and were refused | ||
| even though every arithmetic use of them here works. | ||
|
|
||
| What that spelling leaves out is what should be left out. ``numpy.bool_`` | ||
| and the complex types are not ``Real``, so they still fall through to the | ||
| error. ``bool`` is excluded by hand because it *is* an ``int``, and ``True`` | ||
| would otherwise be taken as a height of one metre. | ||
|
|
||
| This is the single definition of the numeric boundary. The height form and | ||
| the delay of a ``("time", t_deploy)`` trigger both use it, and | ||
| ``StochasticParachute`` validates the same triggers before a ``Parachute`` | ||
| is ever built and calls this rather than restating it, because the two | ||
| spellings drifted apart once already. | ||
| """ | ||
| return isinstance(trigger, Real) and not isinstance(trigger, bool) | ||
|
|
||
|
|
||
| class Parachute: | ||
| """Keeps information of the parachute, which is modeled as a hemispheroid. | ||
|
|
||
|
|
@@ -409,8 +387,8 @@ def wrapper(p, h, y, sensors, u_dot): | |
| self.triggerfunc = _make_wrapper(trigger) | ||
| return | ||
|
|
||
| # Numeric altitude trigger | ||
| if _is_a_height_trigger(trigger): | ||
| # Numeric altitude trigger. Real accepts NumPy numbers, bool is an int | ||
| if isinstance(trigger, Real) and not isinstance(trigger, bool): | ||
| self._trigger_falling_only = True | ||
|
|
||
| def triggerfunc(p, h, y, sensors, u_dot): # pylint: disable=unused-argument | ||
|
|
@@ -442,11 +420,8 @@ def triggerfunc(p, h, y, sensors, u_dot): # pylint: disable=unused-argument | |
| and isinstance(trigger[0], str) | ||
| and trigger[0].lower() == "time" | ||
| ): | ||
| # Same numeric boundary as a height, so the two forms cannot | ||
| # disagree about what counts as a number. Notably this refuses a | ||
| # string delay rather than quietly coercing it: float("3.0") would | ||
| # otherwise make ("time", "3.0") work by accident. | ||
| if not _is_a_height_trigger(trigger[1]): | ||
| # A number, as for a height. A string delay is refused, not converted. | ||
| if not isinstance(trigger[1], Real) or isinstance(trigger[1], bool): | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit (optional): The numeric test is now written twice with opposite polarity ( Scenario: someone widens one site (for example to accept another numeric type) and |
||
| raise ValueError( | ||
| f"Unable to set the trigger function for parachute '{self.name}'. " | ||
| + "Time trigger delay must be a positive number of seconds, " | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -763,19 +763,6 @@ def static_margin(self): | |
| self.evaluate_static_margin() | ||
| return self._static_margin | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Important: Removing the Scenario: a script that does |
||
|
|
||
| @static_margin.setter | ||
| @deprecated( | ||
| reason=( | ||
| "Assigning `static_margin` is deprecated and will be removed in a " | ||
| "future version, because the static margin is computed from the " | ||
| "rocket's geometry" | ||
| ) | ||
| ) | ||
| def static_margin(self, value): | ||
| # Kept until the next geometry/mass/surface change marks it dirty. | ||
| self._static_margin = value | ||
| self._static_margin_dirty = False | ||
|
|
||
| def evaluate_static_margin(self): | ||
| """Calculates the static margin of the rocket as a function of time. | ||
|
|
||
|
|
@@ -786,11 +773,6 @@ def evaluate_static_margin(self): | |
| Static margin is defined as the distance between the center of | ||
| pressure and the center of mass, divided by the rocket's diameter. | ||
| """ | ||
| # An assigned non-Function value (e.g. a float) cannot be updated in place. | ||
| if not isinstance(self._static_margin, Function): | ||
| self._static_margin = Function( | ||
| lambda time: 0, inputs="Time (s)", outputs="Static Margin (c)" | ||
| ) | ||
| # Calculate static margin; fold _csys into the source so we do not | ||
| # rebind a property when multiplying. | ||
| self._static_margin.set_source( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit (optional): Dropping the
python_version < '3.14'marker turns thebackgroundmap on for Python 3.14, but CHANGELOG.md has no entry for it. I checked that rasterio ships cp314 wheels and that CI already runs 3.14, so no packaging change is needed. Fix: add a changelog line for the 3.14 support ofcontextily.Scenario: users on 3.14 who read the old notebook note (now removed) or the changelog have no record of when the feature became available.