You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cell In[40], line 8
5 bmin = 14 * u.arcsec
6 bpa = 0.0 * u.deg
----> 8 beam = Beam(major=bmaj, minor=bmin, pa=bpa)
File ~/code/python_code/radio_beam/radio_beam/beam.py:86, in Beam.__new__(cls, major, minor, pa, area, default_unit, meta)
84 minor = minor * u.deg
85 if pa is not None:
---> 86 if u.deg.is_equivalent(pa):
87 pa = pa
88 else:
File ~/miniconda3/envs/astro/lib/python3.11/site-packages/astropy/units/core.py:1013, in UnitBase.is_equivalent(self, other, equivalencies)
1009 return any(self.is_equivalent(u, equivalencies) for u in other)
1011 other = Unit(other, parse_strict="silent")
-> 1013 return self._is_equivalent(other, equivalencies)
File ~/miniconda3/envs/astro/lib/python3.11/site-packages/astropy/units/core.py:1024, in UnitBase._is_equivalent(self, other, equivalencies)
1021 if isinstance(other, UnrecognizedUnit):
1022 return False
-> 1024 if self._get_physical_type_id() == other._get_physical_type_id():
1025 return True
1026 elif len(equivalencies):
File ~/miniconda3/envs/astro/lib/python3.11/site-packages/astropy/units/core.py:695, in UnitBase._get_physical_type_id(self)
688 """
689 Returns an identifier that uniquely identifies the physical
690 type of this unit. It is comprised of the bases and powers of
691 this unit, without the scale. Since it is hashable, it is
692 useful as a dictionary key.
693 """
694 if self._type_id is None:
--> 695 unit = self.decompose()
696 self._type_id = tuple(zip((base.name for base in unit.bases), unit.powers))
698 return self._type_id
File ~/miniconda3/envs/astro/lib/python3.11/site-packages/astropy/units/core.py:2485, in CompositeUnit.decompose(self, bases)
2482 self._decomposed_cache = self
2483 return self
-> 2485 x = CompositeUnit(
2486 self.scale, self.bases, self.powers, decompose=True, decompose_bases=bases
2487 )
2488 if len(bases) == 0:
2489 self._decomposed_cache = x
File ~/miniconda3/envs/astro/lib/python3.11/site-packages/astropy/units/core.py:2358, in CompositeUnit.__init__(self, scale, bases, powers, decompose, decompose_bases, _error_check)
2356 if _error_check:
2357 if scale == 0:
-> 2358 raise UnitScaleError("cannot create a unit with a scale of 0.")
2359 for base in bases:
2360 if not isinstance(base, UnitBase):
UnitScaleError: cannot create a unit with a scale of 0.
In [41]:
It all gets solved if I use a PA different from 0
In [41]: importastropy.unitsasu
...: fromradio_beamimportBeam
...:
...: bmaj=14*u.arcsec
...: bmin=14*u.arcsec
...: bpa=1.0*u.deg
...:
...: beam=Beam(major=bmaj, minor=bmin, pa=bpa)
In [42]:
Is there something wrong with what I am doing?
The text was updated successfully, but these errors were encountered:
I am using the latest version:
radio-beam-0.3.8.dev12+g325cad3
I am trying to generate a simple circular beam as this:
but I get the following error message
It all gets solved if I use a PA different from 0
Is there something wrong with what I am doing?
The text was updated successfully, but these errors were encountered: