diff --git a/mosaic/cli/findomp.py b/mosaic/cli/findomp.py index a0ccb8a..15cc7b6 100755 --- a/mosaic/cli/findomp.py +++ b/mosaic/cli/findomp.py @@ -16,13 +16,13 @@ def go(): comp_path = os.path.join(os.path.join(os.path.dirname(cuda_home), 'compilers'), 'lib') break - if comp_path is None: + if comp_path is None or not os.path.exists(comp_path): hpcsdk_home = os.environ.get('HPCSDK_HOME') if hpcsdk_home: comp_path = os.path.join(os.path.join(hpcsdk_home, 'compilers'), 'lib') # If not, try to get from LD_LIBRARY_PATH - if comp_path is None: + if comp_path is None or not os.path.exists(comp_path): library_path = os.environ.get('LD_LIBRARY_PATH', '') for path in library_path.split(':'): if re.match('.*/nvidia/hpc_sdk/.*/?compilers/lib', path) or \ diff --git a/stride/core.py b/stride/core.py index e08de56..db88190 100644 --- a/stride/core.py +++ b/stride/core.py @@ -335,6 +335,8 @@ def _dealloc(*args): parallel_returns = [] deallocs = [] for node in self.graph.toposort(self.prev_op): + print('Node') + print(node) kwargs_ = kwargs.copy() if node.method == '__noop__': diff --git a/stride/optimisation/pipelines/default_pipelines.py b/stride/optimisation/pipelines/default_pipelines.py index f7a37b8..c8e86f2 100644 --- a/stride/optimisation/pipelines/default_pipelines.py +++ b/stride/optimisation/pipelines/default_pipelines.py @@ -138,6 +138,8 @@ def __init__(self, steps=None, **kwargs): if kwargs.pop('time_weighting', True): steps.append(('time_weighting', False)) + print('Process Traces Steps') + print(steps) super().__init__(steps, **kwargs) diff --git a/stride/optimisation/pipelines/steps/clip.py b/stride/optimisation/pipelines/steps/clip.py index 7458221..075c5b1 100644 --- a/stride/optimisation/pipelines/steps/clip.py +++ b/stride/optimisation/pipelines/steps/clip.py @@ -32,6 +32,8 @@ def forward(self, field, **kwargs): out_field.extended_data[:] = np.clip(field.extended_data, self.min, self.max) + print('Clip max {} min {}'.format(self.max, self.min)) + return out_field def adjoint(self, d_field, field, **kwargs): diff --git a/stride/plotting/plot_points.py b/stride/plotting/plot_points.py index 771f1d3..93a30af 100644 --- a/stride/plotting/plot_points.py +++ b/stride/plotting/plot_points.py @@ -1,6 +1,7 @@ import os import numpy as np +import matplotlib.pyplot as plt __all__ = ['plot_points', 'plot_points_2d', 'plot_points_3d'] @@ -71,6 +72,39 @@ def plot_points_2d(coordinates, axis=None, colour='red', size=15, title=None, def plot_points_3d(coordinates, axis=None, colour='red', size=15, title=None, **kwargs): + """ + Utility function to plot 3D scattered points using matplotlib. + + Parameters + ---------- + coordinates : 2-dimensional array + Coordinates of the points to be plotted, shape should be (n_points, 3). + axis : MayaVi axis, optional + Axis in which to make the plotting, defaults to new empty one. + colour : str + Colour to apply to the points, defaults to red. + size : float + Size of the plotted points, defaults to 15. + title : str, optional + Figure title, defaults to empty title. + """ + fig = plt.figure(figsize=(10, 8)) + ax = fig.add_subplot(111, projection='3d') + ax.set_title('3D View: Tangent Points with Out-of-Plane Displacement') + + ax.plot(coordinates[:, 0], coordinates[:, 1], coordinates[:, 2], 'o') + + ax.set_xlabel('X (mm)') + ax.set_ylabel('Y (mm)') + ax.set_zlabel('Z (mm)') + ax.legend() + ax.grid(True) + ax.set_box_aspect([1, 1, 0.5]) + plt.tight_layout() + plt.show() + + +def plot_points_3d_mayavi(coordinates, axis=None, colour='red', size=15, title=None, **kwargs): """ Utility function to plot 3D scattered points using MayaVi. diff --git a/stride/plotting/plot_traces.py b/stride/plotting/plot_traces.py index 43d27f0..3f9e84a 100644 --- a/stride/plotting/plot_traces.py +++ b/stride/plotting/plot_traces.py @@ -252,7 +252,7 @@ def plot_gather(*args, skip=1, time_range=None, norm=True, norm_trace=True, axis.set_ylim(time_axis[-1, 0], time_axis[0, 0]) axis.set_xlabel('trace') - axis.set_ylabel('time') + axis.set_ylabel(r'time ($\mu$s)') if trace_axis is None: trace_axis = np.linspace(0, num_traces-1, num_under_traces, endpoint=True) diff --git a/stride/problem/acquisitions.py b/stride/problem/acquisitions.py index 058d4de..e409ea3 100644 --- a/stride/problem/acquisitions.py +++ b/stride/problem/acquisitions.py @@ -56,7 +56,7 @@ def _select_slice(selection, init_ids, class Shot(ProblemBase): """ - A Shot is an even in which one or more transducers act as sources with a given wavelet and one or more + A Shot is an event in which one or more transducers act as sources with a given wavelet and one or more transducers act as receivers and record some observed data. Therefore a shot object maintains data about the ids of the transducer locations that will act as sources, diff --git a/stride/problem/geometry.py b/stride/problem/geometry.py index 28b5cdb..78cf946 100644 --- a/stride/problem/geometry.py +++ b/stride/problem/geometry.py @@ -26,7 +26,7 @@ class TransducerLocation(GriddedSaved): Optional name for the transducer location. transducer : Transducer Transducer device to which this location refers. - coordinates : ndarray + coordinates : ndarray, units [m] Coordinates of the transducer in the space grid. orientation : ndarray, optional Orientation of the transducer with respect to its location. @@ -350,8 +350,9 @@ def plot(self, **kwargs): plot = kwargs.pop('plot', True) coordinates = self.coordinates - if self.space.dim > 2: - coordinates = coordinates / np.array(self.space.spacing) + # if self.space.dim > 2: # Note mayavi plots in cells + # coordinates = coordinates / np.array(self.space.spacing) + # coordinates = coordinates / 1e-3 # [m] to [mm] axis = plotting.plot_points(coordinates, title=title, **kwargs)