|
17 | 17 | from ..utils import isiterable, check_broadcast |
18 | 18 | from ..utils.compat.funcsigs import signature |
19 | 19 |
|
| 20 | +from .. import units as u |
20 | 21 |
|
21 | 22 | __all__ = ['ExpressionTree', 'AliasDict', 'check_broadcast', |
22 | 23 | 'poly_map_domain', 'comb', 'ellipse_extent'] |
@@ -520,12 +521,13 @@ def ellipse_extent(a, b, theta): |
520 | 521 |
|
521 | 522 | Parameters |
522 | 523 | ---------- |
523 | | - a : float |
| 524 | + a : float or `~astropy.units.Quantity` |
524 | 525 | Major axis. |
525 | | - b : float |
| 526 | + b : float or `~astropy.units.Quantity` |
526 | 527 | Minor axis. |
527 | | - theta : float |
528 | | - Rotation angle in radians. |
| 528 | + theta : float or `~astropy.units.Quantity` |
| 529 | + Rotation angle. If given as a floating-point value, it is assumed to be |
| 530 | + in radians. |
529 | 531 |
|
530 | 532 | Returns |
531 | 533 | ------- |
@@ -571,7 +573,10 @@ def ellipse_extent(a, b, theta): |
571 | 573 | t = np.arctan2(b, a * np.tan(theta)) |
572 | 574 | dy = b * np.sin(t) * np.cos(theta) + a * np.cos(t) * np.sin(theta) |
573 | 575 |
|
574 | | - return np.abs([dx, dy]) |
| 576 | + if isinstance(dx, u.Quantity) or isinstance(dy, u.Quantity): |
| 577 | + return np.abs(u.Quantity([dx, dy])) |
| 578 | + else: |
| 579 | + return np.abs([dx, dy]) |
575 | 580 |
|
576 | 581 |
|
577 | 582 | def get_inputs_and_params(func): |
|
0 commit comments