Skip to content

Commit

Permalink
fix: added points argument to faultframe builder
Browse files Browse the repository at this point in the history
points flags whether to use value data or a scaled vector to define the
fault frame geometry
  • Loading branch information
Lachlan Grose committed Nov 9, 2021
1 parent 08473c3 commit 4588d3c
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions LoopStructural/modelling/fault/fault_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ def create_data_from_geometry(self,
minor_axis = None,
major_axis = None,
intermediate_axis = None,
w=1.):
w=1.
points=True):
"""Generate the required data for building a fault frame for a fault with the
specified parameters
Expand Down Expand Up @@ -93,17 +94,22 @@ def create_data_from_geometry(self,
data.reset_index(inplace=True)
if fault_center is not None:
if minor_axis is not None:
# fault_edges[0,:] = fault_center[:3]+normal_vector*minor_axis
# fault_edges[1,:] = fault_center[:3]-normal_vector*minor_axis
fault_edges[0,:] = fault_center[:3]+normal_vector*minor_axis
fault_edges[1,:] = fault_center[:3]-normal_vector*minor_axis
self.update_geometry(fault_edges)
# data.loc[len(data),['X','Y','Z','feature_name','val','coord','w']] = \
# [fault_edges[0,0],fault_edges[0,1],fault_edges[0,2],self.name,1,0,w]
# data.loc[len(data),['X','Y','Z','feature_name','val','coord','w']] = \
# [fault_edges[1,0],fault_edges[1,1],fault_edges[1,2],self.name,-1,0,w]
mask = np.logical_and(data['coord'] == 0,~np.isnan(data['gx']))
data.loc[mask,['gx','gy','gz']] /= np.linalg.norm(data.loc[mask,['gx','gy','gz']],axis=1)[:,None]
# scale vector so that the distance between -1 and 1 is the minor axis length
data.loc[mask,['gx','gy','gz']] /=minor_axis*0.5

# choose whether to add points -1,1 to constrain fault frame or a scaled
# vector
if points == True:
data.loc[len(data),['X','Y','Z','feature_name','val','coord','w']] = \
[fault_edges[0,0],fault_edges[0,1],fault_edges[0,2],self.name,1,0,w]
data.loc[len(data),['X','Y','Z','feature_name','val','coord','w']] = \
[fault_edges[1,0],fault_edges[1,1],fault_edges[1,2],self.name,-1,0,w]
if points == False:
mask = np.logical_and(data['coord'] == 0,~np.isnan(data['gx']))
data.loc[mask,['gx','gy','gz']] /= np.linalg.norm(data.loc[mask,['gx','gy','gz']],axis=1)[:,None]
# scale vector so that the distance between -1 and 1 is the minor axis length
data.loc[mask,['gx','gy','gz']] /=minor_axis*0.5
if major_axis is not None:
fault_tips[0,:] = fault_center[:3]+strike_vector*0.5*major_axis
fault_tips[1,:] = fault_center[:3]-strike_vector*0.5*major_axis
Expand Down

0 comments on commit 4588d3c

Please sign in to comment.