예제 #1
0
 def cone(self, obj, alpha, *args, **kwargs):
     """Draw small circle"""
     assert obj.type is Lin, "Only Lin instance could be used as cone axis."
     if "zorder" not in kwargs:
         kwargs["zorder"] = 5
     animate = kwargs.pop("animate", False)
     if isinstance(obj, Group):
         x = []
         y = []
         for azi, inc in obj.dd.T:
             xx, yy = self._cone(
                 l2v(azi, inc),
                 l2v(azi, inc - alpha),
                 limit=180,
                 res=sind(alpha) * 358 + 3,
                 split=True,
             )
             x = np.hstack((x, xx, np.nan))
             y = np.hstack((y, yy, np.nan))
         x = x[:-1]
         y = y[:-1]
     else:
         azi, inc = obj.dd
         x, y = self._cone(
             l2v(azi, inc),
             l2v(azi, inc - alpha),
             limit=180,
             res=sind(alpha) * 358 + 3,
             split=True,
         )
     h = self.fig.axes[self.active].plot(x, y, *args, **kwargs)
     if animate:
         self.artists.append(tuple(h))
     self.draw()
예제 #2
0
 def cone(self, obj, alpha, *args, **kwargs):
     """Draw small circle."""
     assert issubclass(
         obj.type,
         Vec3), "Only Vec3-like instance could be used as cone axis."
     if "zorder" not in kwargs:
         kwargs["zorder"] = 5
     animate = kwargs.pop("animate", False)
     upper_style = False
     if isinstance(obj, Group):
         obj = obj.R
     azi, inc = obj.dd
     if obj.upper:
         inc = -inc
         upper_style = True
     x, y = self._cone(
         l2v(azi, inc),
         l2v(azi, inc - alpha),
         limit=180,
         res=int(sind(alpha) * 358 + 3),
         split=True,
     )
     h = self.fig.axes[self.active].plot(x, y, *args, **kwargs)
     if upper_style:
         for hl in h:
             hl.set_linestyle('--')
     if animate:
         self.artists.append(tuple(h))
     self.draw()
예제 #3
0
 def plane(self, obj, *args, **kwargs):
     """Draw Fol as great circle"""
     assert obj.type is Fol, "Only Fol instance could be plotted as plane."
     if "zorder" not in kwargs:
         kwargs["zorder"] = 5
     animate = kwargs.pop("animate", False)
     if isinstance(obj, Group):
         x = []
         y = []
         for azi, inc in obj.dd.T:
             xx, yy = self._cone(
                 p2v(azi, inc), l2v(azi, inc), limit=89.9999, res=cosd(inc) * 179 + 2
             )
             x = np.hstack((x, xx, np.nan))
             y = np.hstack((y, yy, np.nan))
         x = x[:-1]
         y = y[:-1]
     else:
         azi, inc = obj.dd
         x, y = self._cone(
             p2v(azi, inc), l2v(azi, inc), limit=89.9999, res=cosd(inc) * 179 + 2
         )
     h = self.fig.axes[self.active].plot(x, y, *args, **kwargs)
     if animate:
         self.artists.append(tuple(h))
     self.draw()
예제 #4
0
파일: plotting.py 프로젝트: ondrolexa/apsg
 def cone(self, obj, alpha, *args, **kwargs):
     """Draw small circle"""
     assert obj.type is Lin, "Only Lin instance could be used as cone axis."
     if "zorder" not in kwargs:
         kwargs["zorder"] = 5
     animate = kwargs.pop("animate", False)
     if isinstance(obj, Group):
         x = []
         y = []
         for azi, inc in obj.dd.T:
             xx, yy = self._cone(
                 l2v(azi, inc),
                 l2v(azi, inc - alpha),
                 limit=180,
                 res=int(sind(alpha) * 358 + 3),
                 split=True,
             )
             x = np.hstack((x, xx, np.nan))
             y = np.hstack((y, yy, np.nan))
         x = x[:-1]
         y = y[:-1]
     else:
         azi, inc = obj.dd
         x, y = self._cone(
             l2v(azi, inc),
             l2v(azi, inc - alpha),
             limit=180,
             res=int(sind(alpha) * 358 + 3),
             split=True,
         )
     h = self.fig.axes[self.active].plot(x, y, *args, **kwargs)
     if animate:
         self.artists.append(tuple(h))
     self.draw()
예제 #5
0
파일: plotting.py 프로젝트: ondrolexa/apsg
 def plane(self, obj, *args, **kwargs):
     """Draw Fol as great circle"""
     assert obj.type is Fol, "Only Fol instance could be plotted as plane."
     if "zorder" not in kwargs:
         kwargs["zorder"] = 5
     animate = kwargs.pop("animate", False)
     if isinstance(obj, Group):
         x = []
         y = []
         for azi, inc in obj.dd.T:
             xx, yy = self._cone(
                 p2v(azi, inc), l2v(azi, inc), limit=89.9999, res=int(cosd(inc) * 179 + 2)
             )
             x = np.hstack((x, xx, np.nan))
             y = np.hstack((y, yy, np.nan))
         x = x[:-1]
         y = y[:-1]
     else:
         azi, inc = obj.dd
         x, y = self._cone(
             p2v(azi, inc), l2v(azi, inc), limit=89.9999, res=int(cosd(inc) * 179 + 2)
         )
     h = self.fig.axes[self.active].plot(x, y, *args, **kwargs)
     if animate:
         self.artists.append(tuple(h))
     self.draw()
예제 #6
0
 def initgrid(self, **kwargs):
     # parse options
     grid = kwargs.get("grid", "radial")
     if grid == "radial":
         ctn_points = int(
             np.round(np.sqrt(kwargs.get("npoints", 1800)) / 0.280269786))
         # calc grid
         self.xg = 0
         self.yg = 0
         for rho in np.linspace(0, 1,
                                int(np.round(ctn_points / 2 / np.pi))):
             theta = np.linspace(0, 360,
                                 int(np.round(ctn_points * rho + 1)))[:-1]
             self.xg = np.hstack((self.xg, rho * sind(theta)))
             self.yg = np.hstack((self.yg, rho * cosd(theta)))
     elif grid == "ortho":
         n = int(
             np.round(
                 np.sqrt(kwargs.get("npoints", 1800) - 4) / 0.8685725142))
         x, y = np.meshgrid(np.linspace(-1, 1, n), np.linspace(-1, 1, n))
         d2 = (x**2 + y**2) <= 1
         self.xg = np.hstack((0, 1, 0, -1, x[d2]))
         self.yg = np.hstack((1, 0, -1, 0, y[d2]))
     else:
         raise TypeError("Wrong grid type!")
     self.dcgrid = l2v(*getldd(self.xg, self.yg)).T
     self.n = self.dcgrid.shape[0]
     self.values = np.zeros(self.n, dtype=np.float)
     self.triang = self._buildtrig_workaround(self.xg, self.yg)
예제 #7
0
 def lon(a, theta):
     return self._cone(p2v(a, theta), l2v(a, theta), limit=80, res=91)
예제 #8
0
 def lat(a, phi):
     return self._cone(l2v(a, 0), l2v(a, phi), limit=89.9999, res=91)
예제 #9
0
파일: plotting.py 프로젝트: ondrolexa/apsg
 def lon(a, theta):
     return self._cone(p2v(a, theta), l2v(a, theta), limit=80, res=91)
예제 #10
0
파일: plotting.py 프로젝트: ondrolexa/apsg
 def lat(a, phi):
     return self._cone(l2v(a, 0), l2v(a, phi), limit=89.9999, res=91)