Skip to content

Commit b0833fc

Browse files
committed
(VISUALISATION) added orientation disks instead of vectors
for orientation data. Vectors can be used by specifying vectors=True, and disks can be turned off disks=False when using .add_data(feature,disks,vectors)
1 parent d02b2f8 commit b0833fc

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

LoopStructural/modelling/core/geological_model.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ def __init__(self, origin, maximum, rescale=True, nsteps=(40, 40, 40),
112112
113113
114114
"""
115+
# print('tet')
115116
if logfile:
116117
self.logfile = logfile
117118
log_to_file(logfile,loglevel)

LoopStructural/visualisation/model_visualisation.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ def add_vector_field(self, geological_feature, **kwargs):
629629
vectorfield.vectors(vector[mask, :])
630630
return
631631

632-
def add_data(self, feature, **kwargs):
632+
def add_data(self, feature, disks=True, vectors = False,**kwargs):
633633
"""
634634
635635
Plot the data linked to the feature, can choose whether to plot all data types
@@ -667,12 +667,20 @@ def add_data(self, feature, **kwargs):
667667
interface = feature.builder.get_interface_constraints()
668668

669669
if grad.shape[0] > 0 and add_grad:
670-
self.add_vector_data(self.model.rescale(grad[:, :3],inplace=False), grad[:, 3:6], name + "_grad_cp",
670+
if disks:
671+
self.add_orientation_disks(self.model.rescale(grad[:, :3],inplace=False), grad[:, 3:6], name + "_grad_cp",
671672
**kwargs)
673+
if vectors:
674+
self.add_vector_data(self.model.rescale(grad[:, :3],inplace=False), grad[:, 3:6], name + "_grad_cp",
675+
**kwargs)
672676

673677
if norm.shape[0] > 0 and add_grad:
674-
self.add_vector_data(self.model.rescale(norm[:, :3],inplace=False), norm[:, 3:6], name + "_norm_cp",
678+
if disks:
679+
self.add_orientation_disks(self.model.rescale(norm[:, :3],inplace=False), norm[:, 3:6], name + "_norm_cp",
675680
**kwargs)
681+
if vectors:
682+
self.add_vector_data(self.model.rescale(norm[:, :3],inplace=False), norm[:, 3:6], name + "_norm_cp",
683+
**kwargs)
676684
if value.shape[0] > 0 and add_value:
677685
kwargs['range'] = [feature.min(), feature.max()]
678686
self.add_value_data(self.model.rescale(value[:, :3],inplace=False), value[:, 3], name + "_value_cp",
@@ -744,6 +752,18 @@ def add_vector_data(self, position, vector, name, **kwargs):
744752
vectorfield.vertices(position)
745753
vectorfield.vectors(vector)
746754
return
755+
def add_orientation_disks(self,position,vector,name,symb_scale=1.,scaleshapes=None,shapelength=0,**kwargs):
756+
if 'colour' not in kwargs:
757+
kwargs['colour'] = 'black'
758+
# normalise
759+
if scaleshapes is None:
760+
scaleshapes = np.max(self.model.maximum-self.model.origin)*0.014*symb_scale
761+
if position.shape[0] > 0:
762+
vector /= np.linalg.norm(vector, axis=1)[:, None]
763+
vectorfield = self.lv.shapes(name, scaleshapes=scaleshapes,shapelength=shapelength,**kwargs)
764+
vectorfield.vertices(position)
765+
vectorfield.vectors(vector)
766+
return
747767

748768
def add_value_data(self, position, value, name, **kwargs):
749769
"""

0 commit comments

Comments
 (0)