magni.imaging.measurements._spiral module¶
Module providing public functions for the magni.imaging.measurements subpackage.
Routine listings¶
 spiral_sample_image(h, w, scan_length, num_points, rect_area=False)
 Function for spiral sampling an image.
 spiral_sample_surface(l, w, speed, sample_rate, time, rect_area=False)
 Function for spiral sampling a surface.

magni.imaging.measurements._spiral.
spiral_sample_image
(h, w, scan_length, num_points, rect_area=False)[source]¶ Sample an image using an archimedean spiral pattern.
The coordinates (in units of pixels) resulting from sampling an image of size h times w using an archimedean spiral pattern are determined. The scan_length determines the length of the path scanned whereas num_points indicates the number of samples taken on that path.
Parameters:  h (int) – The height of the area to scan in units of pixels.
 w (int) – The width of the area to scan in units of pixels.
 scan_length (float) – The length of the path to scan in units of pixels.
 num_points (int) – The number of samples to take on the scanned path.
 rect_area (bool) – A flag indicating whether or not the full rectangular area is sampled (the default value is False which implies that the “corners” of the rectangular area are not sampled).
Returns: coords (ndarray) – The coordinates of the samples arranged into a 2D array, such that each row is a coordinate pair (x, y).
Notes
The orientation of the coordinate system is such that the width w is measured along the xaxis whereas the height h is measured along the yaxis. The width must equal the height for an archimedian spiral to make sense.
If the rect_area flag is True, then it is assumed that the sampling continues outside of the rectangular area specified by h and w such that the “corners” of the rectangular area are also sampled. The sample points outside of the rectangular area are discarded and, hence, not returned.
Examples
For example,
>>> import numpy as np >>> from magni.imaging.measurements import spiral_sample_image >>> h = 10 >>> w = 10 >>> scan_length = 50.0 >>> num_points = 12 >>> np.set_printoptions(suppress=True) >>> spiral_sample_image(h, w, scan_length, num_points) array([[ 6.28776846, 5.17074073], [ 3.13304898, 5.24133767], [ 6.07293751, 2.93873701], [ 6.99638041, 6.80851189], [ 2.89868434, 7.16724999], [ 2.35773914, 3.00320067], [ 6.41495385, 1.71018152], [ 8.82168896, 5.27557847], [ 6.34932919, 8.83624957], [ 2.04885699, 8.11199373], [ 0.6196052 , 3.96939755]])

magni.imaging.measurements._spiral.
spiral_sample_surface
(l, w, speed, sample_rate, time, rect_area=False)[source]¶ Sample a surface area using an archimedean spiral pattern.
The coordinates (in units of meters) resulting from sampling an area of size l times w using an archimedean spiral pattern are determined. The scanned path is determined from the probe speed and the scan
time
.Parameters:  l (float) – The length of the area to scan in units of meters.
 w (float) – The width of the area to scan in units of meters.
 speed (float) – The probe speed in units of meters/second.
 sample_rate (float) – The sample rate in units of Hertz.
 time (float) – The scan time in units of seconds.
 rect_area (bool) – A flag indicating whether or not the full rectangular area is sampled (the default value is False which implies that the “corners” of the rectangular area are not sampled).
Returns: coords (ndarray) – The coordinates of the samples arranged into a 2D array, such that each row is a coordinate pair (x, y).
Notes
The orientation of the coordinate system is such that the width w is measured along the xaxis whereas the length l is measured along the yaxis. The width must equal the length for an archimedian sprial to make sense.
If the rect_area flag is True, then it is assumed that the sampling continues outside of the rectangular area specified by l and w such that the “corners” of the rectangular area are also sampled. The sample points outside of the rectangular area are discarded and, hence, not returned.
Examples
For example,
>>> import numpy as np >>> from magni.imaging.measurements import spiral_sample_surface >>> l = 1e6 >>> w = 1e6 >>> speed = 7e7 >>> sample_rate = 1.0 >>> time = 12.0 >>> np.set_printoptions(suppress=True) >>> spiral_sample_surface(l, w, speed, sample_rate, time) array([[ 0.00000036, 0.00000046], [ 0.00000052, 0.00000071], [ 0.00000052, 0.00000024], [ 0.00000059, 0.00000079], [ 0.00000021, 0.00000033], [ 0.00000084, 0.00000036], [ 0.00000049, 0.0000009 ], [ 0.0000001 , 0.00000036], [ 0.00000072, 0.00000011], [ 0.00000089, 0.00000077], [ 0.00000021, 0.00000091]])