Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions mosaic/cli/findomp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
2 changes: 2 additions & 0 deletions stride/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__':
Expand Down
2 changes: 2 additions & 0 deletions stride/optimisation/pipelines/default_pipelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down
2 changes: 2 additions & 0 deletions stride/optimisation/pipelines/steps/clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
34 changes: 34 additions & 0 deletions stride/plotting/plot_points.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

import os
import numpy as np
import matplotlib.pyplot as plt


__all__ = ['plot_points', 'plot_points_2d', 'plot_points_3d']
Expand Down Expand Up @@ -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):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you change the name to plot_points_3d_matplotlib?

"""
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.
"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check other matplotlib functions to add display test at top

fig = plt.figure(figsize=(10, 8))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check how other matplotlib functions are written, where we let the user provide some external figure/axes and, if not, we create create ones

ax = fig.add_subplot(111, projection='3d')
ax.set_title('3D View: Tangent Points with Out-of-Plane Displacement')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

title should be provided externally as parameter, as done in other functions like this


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()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in all of these functions, we return the axis instead of plotting inside the function - remove these last two lines and change to return ax



def plot_points_3d_mayavi(coordinates, axis=None, colour='red', size=15, title=None, **kwargs):
"""
Utility function to plot 3D scattered points using MayaVi.

Expand Down
2 changes: 1 addition & 1 deletion stride/plotting/plot_traces.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion stride/problem/acquisitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 4 additions & 3 deletions stride/problem/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)

Expand Down