diff --git a/radio_beam/beam.py b/radio_beam/beam.py index 423f7c6..9955236 100644 --- a/radio_beam/beam.py +++ b/radio_beam/beam.py @@ -27,11 +27,11 @@ def _to_area(major,minor): u.arcmin: "'"} -def _with_default_unit(type_str, value, unit, equiv_unit=u.deg): +def _with_default_unit(type_str, value, unit): if not hasattr(value, 'unit'): return value * unit - if value.unit.is_equivalent(equiv_unit): + if value.unit.is_equivalent(unit): return value else: raise u.UnitsError(f"{value.unit} for {type_str} is not equivalent to {equiv_unit}") @@ -83,10 +83,10 @@ def __new__(cls, major=None, minor=None, pa=None, area=None, # give specified values priority if major is not None: - major = _with_default_unit("major", major, default_unit, equiv_unit=u.deg) + major = _with_default_unit("major", major, default_unit) if pa is not None: - pa = _with_default_unit("pa", pa, u.deg, equiv_unit=u.deg) + pa = _with_default_unit("pa", pa, u.deg) else: pa = 0 * u.deg @@ -94,7 +94,7 @@ def __new__(cls, major=None, minor=None, pa=None, area=None, if minor is None: minor = major else: - minor = _with_default_unit("minor", minor, default_unit, equiv_unit=u.deg) + minor = _with_default_unit("minor", minor, default_unit) if minor > major: raise ValueError("Minor axis greater than major axis.") diff --git a/radio_beam/multiple_beams.py b/radio_beam/multiple_beams.py index 45e7080..6561162 100644 --- a/radio_beam/multiple_beams.py +++ b/radio_beam/multiple_beams.py @@ -61,13 +61,13 @@ def __new__(cls, major=None, minor=None, pa=None, # give specified values priority if major is not None: - major = _with_default_unit("major", major, default_unit, equiv_unit=u.deg) + major = _with_default_unit("major", major, default_unit) if pa is not None: if len(pa) != len(major): raise ValueError("Number of position angles must match number of major axis lengths") - pa = _with_default_unit("pa", pa, u.deg, equiv_unit=u.deg) + pa = _with_default_unit("pa", pa, u.deg) else: pa = np.zeros(major.shape) * u.deg @@ -77,7 +77,7 @@ def __new__(cls, major=None, minor=None, pa=None, elif len(minor) != len(major): raise ValueError("Minor and major axes must have same number of values") else: - minor = _with_default_unit("minor", minor, default_unit, equiv_unit=u.deg) + minor = _with_default_unit("minor", minor, default_unit) if np.any(minor > major): raise ValueError("Minor axis greater than major axis.")