diff --git a/pyvo/dal/params.py b/pyvo/dal/params.py index fce246dc..b6ebbca2 100644 --- a/pyvo/dal/params.py +++ b/pyvo/dal/params.py @@ -367,18 +367,12 @@ def _validate_pos(self, pos): self._validate_ra(m) def _validate_ra(self, ra): - if isinstance(ra, str): - ra = Unit(ra) - if not isinstance(ra, Quantity): - ra = ra * u.deg + ra = Quantity(ra, u.deg) if ra.to(u.deg).value < 0 or ra.to(u.deg).value > 360.0: raise ValueError('Invalid ra: {}'.format(ra)) def _validate_dec(self, dec): - if isinstance(dec, str): - dec = Unit(dec) - if not isinstance(dec, Quantity): - dec = dec * u.deg + dec = Quantity(dec, u.deg) if dec.to(u.deg).value < -90.0 or dec.to(u.deg).value > 90.0: raise ValueError('Invalid dec: {}'.format(dec)) @@ -418,15 +412,12 @@ def get_dal_format(self, val): raise ValueError('Invalid interval: min({}) > max({})'.format( low, high)) if self._unit: - if isinstance(low, str): - low = Unit(low) if not isinstance(low, Quantity): - low = low * self._unit + low = u.Quantity(low, self._unit) low = low.to(self._unit, equivalencies=self._equivalencies).value - if isinstance(high, str): - high = Unit(high) + if not isinstance(high, Quantity): - high = high * self._unit + high = Quantity(high, self._unit) high = high.to(self._unit, equivalencies=self._equivalencies).value if low > high: