|
61 | 61 | strike_dip_vector, |
62 | 62 | get_vectors, |
63 | 63 | ) |
| 64 | +from ...utils import BoundingBox |
64 | 65 |
|
65 | 66 | from ...modelling.intrusions import IntrusionBuilder |
66 | 67 |
|
@@ -165,16 +166,19 @@ def __init__( |
165 | 166 |
|
166 | 167 | lengths = self.maximum - self.origin |
167 | 168 | self.scale_factor = 1.0 |
168 | | - self.bounding_box = np.zeros((2, 3)) |
169 | | - self.bounding_box[1, :] = self.maximum - self.origin |
170 | | - self.bounding_box[1, :] = self.maximum - self.origin |
171 | | - if rescale: |
172 | | - self.scale_factor = float(np.max(lengths)) |
173 | | - logger.info( |
174 | | - "Rescaling model using scale factor {}".format(self.scale_factor) |
175 | | - ) |
176 | 169 |
|
177 | | - self.bounding_box /= self.scale_factor |
| 170 | + self.bounding_box = BoundingBox( |
| 171 | + dimensions=3, origin=np.zeros(3), maximum=self.maximum - self.origin |
| 172 | + ) # np.zeros((2, 3)) |
| 173 | + # self.bounding_box[1, :] = self.maximum - self.origin |
| 174 | + # self.bounding_box[1, :] = self.maximum - self.origin |
| 175 | + # if rescale: |
| 176 | + # self.scale_factor = float(np.max(lengths)) |
| 177 | + # logger.info( |
| 178 | + # "Rescaling model using scale factor {}".format(self.scale_factor) |
| 179 | + # ) |
| 180 | + |
| 181 | + # self.bounding_box /= self.scale_factor |
178 | 182 | self.support = {} |
179 | 183 | self.reuse_supports = reuse_supports |
180 | 184 | if self.reuse_supports: |
@@ -890,7 +894,13 @@ def get_interpolator( |
890 | 894 | raise InterpolatorError("Could not create interpolator") |
891 | 895 |
|
892 | 896 | def create_and_add_foliation( |
893 | | - self, series_surface_data:str, interpolatortype:str='FDI',nelements:int=1000, tol=None, faults=None, **kwargs |
| 897 | + self, |
| 898 | + series_surface_data: str, |
| 899 | + interpolatortype: str = "FDI", |
| 900 | + nelements: int = 1000, |
| 901 | + tol=None, |
| 902 | + faults=None, |
| 903 | + **kwargs, |
894 | 904 | ): |
895 | 905 | """ |
896 | 906 | Parameters |
@@ -924,7 +934,11 @@ def create_and_add_foliation( |
924 | 934 | tol = self.tol |
925 | 935 |
|
926 | 936 | series_builder = GeologicalFeatureBuilder( |
927 | | - bounding_box=self.bounding_box, interpolatortype=interpolatortype,nelements=nelements, name=series_surface_data, **kwargs |
| 937 | + bounding_box=self.bounding_box, |
| 938 | + interpolatortype=interpolatortype, |
| 939 | + nelements=nelements, |
| 940 | + name=series_surface_data, |
| 941 | + **kwargs, |
928 | 942 | ) |
929 | 943 | # add data |
930 | 944 | series_data = self.data[self.data["feature_name"] == series_surface_data] |
@@ -1731,21 +1745,24 @@ def regular_grid(self, nsteps=None, shuffle=True, rescale=False, order="C"): |
1731 | 1745 | xyz : np.array((N,3),dtype=float) |
1732 | 1746 | locations of points in regular grid |
1733 | 1747 | """ |
1734 | | - if nsteps is None: |
1735 | | - nsteps = self.nsteps |
1736 | | - x = np.linspace(self.bounding_box[0, 0], self.bounding_box[1, 0], nsteps[0]) |
1737 | | - y = np.linspace(self.bounding_box[0, 1], self.bounding_box[1, 1], nsteps[1]) |
1738 | | - z = np.linspace(self.bounding_box[1, 2], self.bounding_box[0, 2], nsteps[2]) |
1739 | | - xx, yy, zz = np.meshgrid(x, y, z, indexing="ij") |
1740 | | - locs = np.array( |
1741 | | - [xx.flatten(order=order), yy.flatten(order=order), zz.flatten(order=order)] |
1742 | | - ).T |
1743 | | - if shuffle: |
1744 | | - logger.info("Shuffling points") |
1745 | | - np.random.shuffle(locs) |
1746 | | - if rescale: |
1747 | | - locs = self.rescale(locs) |
1748 | | - return locs |
| 1748 | + return self.bounding_box.regular_grid( |
| 1749 | + nsteps=nsteps, shuffle=shuffle, order=order |
| 1750 | + ) |
| 1751 | + # if nsteps is None: |
| 1752 | + # nsteps = self.nsteps |
| 1753 | + # x = np.linspace(self.bounding_box[0, 0], self.bounding_box[1, 0], nsteps[0]) |
| 1754 | + # y = np.linspace(self.bounding_box[0, 1], self.bounding_box[1, 1], nsteps[1]) |
| 1755 | + # z = np.linspace(self.bounding_box[1, 2], self.bounding_box[0, 2], nsteps[2]) |
| 1756 | + # xx, yy, zz = np.meshgrid(x, y, z, indexing="ij") |
| 1757 | + # locs = np.array( |
| 1758 | + # [xx.flatten(order=order), yy.flatten(order=order), zz.flatten(order=order)] |
| 1759 | + # ).T |
| 1760 | + # if shuffle: |
| 1761 | + # logger.info("Shuffling points") |
| 1762 | + # np.random.shuffle(locs) |
| 1763 | + # if rescale: |
| 1764 | + # locs = self.rescale(locs) |
| 1765 | + # return locs |
1749 | 1766 |
|
1750 | 1767 | def evaluate_model(self, xyz, scale=True): |
1751 | 1768 | """Evaluate the stratigraphic id at each location |
|
0 commit comments