File tree Expand file tree Collapse file tree 3 files changed +5
-41
lines changed
autoarray/structures/triangles Expand file tree Collapse file tree 3 files changed +5
-41
lines changed Original file line number Diff line number Diff line change 33import numpy as np
44
55from autoarray import Grid2D
6- from autoarray .structures .triangles .shape import Shape
76
87HEIGHT_FACTOR = 3 ** 0.5 / 2
98
Original file line number Diff line number Diff line change 1212
1313
1414@register_pytree_node_class
15- class ArrayTriangles :
15+ class ArrayTriangles ( AbstractTriangles ) :
1616 def __init__ (
1717 self ,
1818 indices ,
@@ -118,44 +118,6 @@ def add_vertex(v):
118118 max_containing_size = max_containing_size ,
119119 )
120120
121- @classmethod
122- def for_grid (
123- cls ,
124- grid : Grid2D ,
125- ** kwargs ,
126- ) -> "AbstractTriangles" :
127- """
128- Create a grid of equilateral triangles from a regular grid.
129-
130- Parameters
131- ----------
132- grid
133- The regular grid to convert to a grid of triangles.
134-
135- Returns
136- -------
137- The grid of triangles.
138- """
139-
140- scale = grid .pixel_scale
141-
142- y = grid [:, 0 ]
143- x = grid [:, 1 ]
144-
145- y_min = y .min ()
146- y_max = y .max ()
147- x_min = x .min ()
148- x_max = x .max ()
149-
150- return cls .for_limits_and_scale (
151- y_min ,
152- y_max ,
153- x_min ,
154- x_max ,
155- scale ,
156- ** kwargs ,
157- )
158-
159121 @property
160122 def indices (self ):
161123 return self ._indices
Original file line number Diff line number Diff line change 1+ from abc import ABC
2+
13import numpy as np
24import jax .numpy as jnp
35import jax
46
57from autoarray .structures .triangles .abstract import HEIGHT_FACTOR
8+ from autoarray .structures .triangles .abstract import AbstractTriangles
69from autoarray .structures .triangles .array import ArrayTriangles
710from autoarray .numpy_wrapper import register_pytree_node_class
811from autoconf import cached_property
1114
1215
1316@register_pytree_node_class
14- class CoordinateArrayTriangles :
17+ class CoordinateArrayTriangles ( AbstractTriangles , ABC ) :
1518
1619 def __init__ (
1720 self ,
You can’t perform that action at this time.
0 commit comments