コード例 #1
0
 def _arrow(self, pos_lin, dir_lin=None, sense=1):
     x, y = l2xy(*pos_lin.dd)
     if dir_lin is None:
         dx, dy = -x, -y
     else:
         ax, ay = l2xy(*dir_lin.dd)
         dx, dy = -ax, -ay
     mag = np.hypot(dx, dy)
     u, v = sense * dx / mag, sense * dy / mag
     return x, y, u, v
コード例 #2
0
ファイル: plotting.py プロジェクト: ondrolexa/apsg
 def _arrow(self, pos_lin, dir_lin=None, sense=1):
     x, y = l2xy(*pos_lin.dd)
     if dir_lin is None:
         dx, dy = -x, -y
     else:
         ax, ay = l2xy(*dir_lin.dd)
         dx, dy = -ax, -ay
     mag = np.hypot(dx, dy)
     u, v = sense * dx / mag, sense * dy / mag
     return x, y, u, v
コード例 #3
0
 def _cone(self, axis, vector, limit=180, res=361, split=False):
     a = np.linspace(-limit, limit, res)
     x, y = l2xy(*v2l(rodrigues(axis, vector, a)))
     if split:
         dist = np.hypot(np.diff(x), np.diff(y))
         ix = np.nonzero(dist > 1)[0]
         x = np.insert(x, ix + 1, np.nan)
         y = np.insert(y, ix + 1, np.nan)
     return x, y
コード例 #4
0
ファイル: plotting.py プロジェクト: ondrolexa/apsg
 def _cone(self, axis, vector, limit=180, res=361, split=False):
     a = np.linspace(-limit, limit, res)
     x, y = l2xy(*v2l(rodrigues(axis, vector, a)))
     if split:
         dist = np.hypot(np.diff(x), np.diff(y))
         ix = np.nonzero(dist > 1)[0]
         x = np.insert(x, ix + 1, np.nan)
         y = np.insert(y, ix + 1, np.nan)
     return x, y
コード例 #5
0
 def pair(self, obj, *arg, **kwargs):
     """Draw  Pair as great circle with small point"""
     assert obj.type is Pair, "Only Pair instance could be used."
     animate = kwargs.pop("animate", False)
     h1 = self.plane(obj.fol, *arg, **kwargs)
     x, y = l2xy(*obj.lin.dd)
     h2 = self.fig.axes[self.active].scatter(x, y, color="k", s=5, zorder=6)
     if animate:
         self.artists.append(tuple(h1 + h2))
     self.draw()
コード例 #6
0
 def vector(self, obj, *args, **kwargs):
     """ This mimics plotting on lower and upper hemisphere using
     full and hollow symbols"""
     assert issubclass(
         obj.type, Vec3
     ), "Only Vec3-like instance could be plotted as line."
     if "zorder" not in kwargs:
         kwargs["zorder"] = 5
     animate = kwargs.pop("animate", False)
     # ensure point plot
     if "ls" not in kwargs and "linestyle" not in kwargs:
         kwargs["linestyle"] = "none"
     if not args:
         if "marker" not in kwargs:
             kwargs["marker"] = "o"
     if isinstance(obj, Group):
         uh = obj.upper
         if np.any(~uh):
             x, y = l2xy(*obj[~uh].dd)
             h1 = self.fig.axes[self.active].plot(x, y, *args, **kwargs)
             kwargs.pop("label", None)
             cc = h1[0].get_color()
         else:
             cc = None
         if np.any(uh):
             kwargs["fillstyle"] = "none"
             x, y = l2xy(*obj[uh].flip.dd)
             h2 = self.fig.axes[self.active].plot(x, y, *args, **kwargs)
             if cc is not None:
                 h2[0].set_color(cc)
         if animate:
             self.artists.append(tuple(h1 + h2))
     else:
         if obj.upper:
             kwargs["fillstyle"] = "none"
             x, y = l2xy(*obj.flip.dd)
             h = self.fig.axes[self.active].plot(x, y, *args, **kwargs)
         else:
             x, y = l2xy(*obj.dd)
             h = self.fig.axes[self.active].plot(x, y, *args, **kwargs)
         if animate:
             self.artists.append(tuple(h))
     self.draw()
コード例 #7
0
ファイル: plotting.py プロジェクト: ondrolexa/apsg
 def pair(self, obj, *arg, **kwargs):
     """Draw  Pair as great circle with small point"""
     assert obj.type is Pair, "Only Pair instance could be used."
     animate = kwargs.pop("animate", False)
     h1 = self.plane(obj.fol, *arg, **kwargs)
     x, y = l2xy(*obj.lin.dd)
     h2 = self.fig.axes[self.active].scatter(x, y, color="k", s=5, zorder=6)
     if animate:
         self.artists.append(tuple(h1 + h2))
     self.draw()
コード例 #8
0
ファイル: plotting.py プロジェクト: ondrolexa/apsg
 def vector(self, obj, *args, **kwargs):
     """ This mimics plotting on lower and upper hemisphere using
     full and hollow symbols"""
     assert issubclass(
         obj.type, Vec3
     ), "Only Vec3-like instance could be plotted as line."
     if "zorder" not in kwargs:
         kwargs["zorder"] = 5
     animate = kwargs.pop("animate", False)
     # ensure point plot
     if "ls" not in kwargs and "linestyle" not in kwargs:
         kwargs["linestyle"] = "none"
     if not args:
         if "marker" not in kwargs:
             kwargs["marker"] = "o"
     if isinstance(obj, Group):
         uh = obj.upper
         if np.any(~uh):
             x, y = l2xy(*obj[~uh].dd)
             h1 = self.fig.axes[self.active].plot(x, y, *args, **kwargs)
             kwargs.pop("label", None)
             cc = h1[0].get_color()
         else:
             cc = None
         if np.any(uh):
             kwargs["fillstyle"] = "none"
             x, y = l2xy(*obj[uh].flip.dd)
             h2 = self.fig.axes[self.active].plot(x, y, *args, **kwargs)
             if cc is not None:
                 h2[0].set_color(cc)
         if animate:
             self.artists.append(tuple(h1 + h2))
     else:
         if obj.upper:
             kwargs["fillstyle"] = "none"
             x, y = l2xy(*obj.flip.dd)
             h = self.fig.axes[self.active].plot(x, y, *args, **kwargs)
         else:
             x, y = l2xy(*obj.dd)
             h = self.fig.axes[self.active].plot(x, y, *args, **kwargs)
         if animate:
             self.artists.append(tuple(h))
     self.draw()
コード例 #9
0
ファイル: plotting.py プロジェクト: Alexragomes/apsg
 def arc(self, f1, f2, *args, **kwargs):
     """Draw great circle segment between two points"""
     assert issubclass(type(f1), Vec3) and issubclass(
         type(f2), Vec3), "Arguments mustr be subclass of Vec3"
     animate = kwargs.pop("animate", False)
     p = f1**f2
     a = f1.angle(f2)
     st = np.linspace(0, a, 2 + int(2 * a))
     rv = [f1.rotate(p, ang) for ang in st]
     lh = [vv.flip if vv.upper else vv for vv in rv]
     x, y = l2xy(*np.array([v.dd for v in lh]).T)
     h = self.fig.axes[self.active].plot(x, y, *args, **kwargs)
     if animate:
         self.artists.append(tuple(h))
     self.draw()
コード例 #10
0
ファイル: plotting.py プロジェクト: ondrolexa/apsg
 def arc(self, f1, f2, *args, **kwargs):
     """Draw great circle segment between two points"""
     assert issubclass(type(f1), Vec3) and issubclass(
         type(f2), Vec3
     ), "Arguments mustr be subclass of Vec3"
     animate = kwargs.pop("animate", False)
     p = f1 ** f2
     a = f1.angle(f2)
     st = np.linspace(0, a, 2 + int(2 * a))
     rv = [f1.rotate(p, ang) for ang in st]
     lh = [vv.flip if vv.upper else vv for vv in rv]
     x, y = l2xy(*np.array([v.dd for v in lh]).T)
     h = self.fig.axes[self.active].plot(x, y, *args, **kwargs)
     if animate:
         self.artists.append(tuple(h))
     self.draw()
コード例 #11
0
 def pole(self, obj, *args, **kwargs):
     """Draw Fol as pole"""
     assert obj.type is Fol, "Only Fol instance could be plotted as poles."
     if "zorder" not in kwargs:
         kwargs["zorder"] = 5
     animate = kwargs.pop("animate", False)
     # ensure point plot
     if "ls" not in kwargs and "linestyle" not in kwargs:
         kwargs["linestyle"] = "none"
     if not args:
         if "marker" not in kwargs:
             kwargs["marker"] = "s"
     x, y = l2xy(*obj.aslin.dd)
     h = self.fig.axes[self.active].plot(x, y, *args, **kwargs)
     if animate:
         self.artists.append(tuple(h))
     self.draw()
コード例 #12
0
ファイル: plotting.py プロジェクト: ondrolexa/apsg
 def pole(self, obj, *args, **kwargs):
     """Draw Fol as pole"""
     assert obj.type is Fol, "Only Fol instance could be plotted as poles."
     if "zorder" not in kwargs:
         kwargs["zorder"] = 5
     animate = kwargs.pop("animate", False)
     # ensure point plot
     if "ls" not in kwargs and "linestyle" not in kwargs:
         kwargs["linestyle"] = "none"
     if not args:
         if "marker" not in kwargs:
             kwargs["marker"] = "s"
     x, y = l2xy(*obj.aslin.dd)
     h = self.fig.axes[self.active].plot(x, y, *args, **kwargs)
     if animate:
         self.artists.append(tuple(h))
     self.draw()
コード例 #13
0
 def scatter(self, obj, *args, **kwargs):
     """Draw Lin as point with varying marker size and/or color."""
     assert obj.type is Lin, "Only Lin type instance could be plotted with scatter."
     if "zorder" not in kwargs:
         kwargs["zorder"] = 5
     if "legend" in kwargs:
         legend = kwargs.pop("legend")
     else:
         legend = False
     animate = kwargs.pop("animate", False)
     if not args:
         if "marker" not in kwargs:
             kwargs["marker"] = "o"
     x, y = l2xy(*obj.dd)
     h = self.fig.axes[self.active].scatter(x, y, *args, **kwargs)
     if legend:
         self.fig.colorbar(h)
     if animate:
         self.artists.append(tuple(h))
     self.draw()