MCPcopy Create free account
hub / github.com/NSLS2/PyXRF / _get_range

Function _get_range

pyxrf/core/utils.py:75–107  ·  view source on GitHub ↗

Returns the range of the data coordinates along X or Y axis. Coordinate data for a single axis is represented as a 2D array ``vv``. The array will have all rows or all columns identical or almost identical. The range is returned as ``vv_min`` (leftmost or topmost val

(vv)

Source from the content-addressed store, hash-verified

73 return data, xx, yy
74
75 def _get_range(vv):
76 """
77 Returns the range of the data coordinates along X or Y axis. Coordinate
78 data for a single axis is represented as a 2D array ``vv``. The array
79 will have all rows or all columns identical or almost identical.
80 The range is returned as ``vv_min`` (leftmost or topmost value)
81 and ``vv_max`` (rightmost or bottommost value). Note, that ``vv_min`` may
82 be greater than ``vv_max``
83
84 Parameters
85 ----------
86 vv : ndarray
87 2-d array of coordinates
88
89 Returns
90 -------
91 vv_min : float
92 starting point of the range
93 vv_max : float
94 end of the range
95 """
96 # The assumption is that X values are mostly changing along the dimension 1 and
97 # Y values change along the dimension 0 of the 2D array and only slightly change
98 # along the alternative dimension. Determine, if the range is for X or Y
99 # axis based on the dimension in which value change is the largest.
100 if abs(vv[0, 0] - vv[0, -1]) > abs(vv[0, 0] - vv[-1, 0]):
101 vv_min = np.median(vv[:, 0])
102 vv_max = np.median(vv[:, -1])
103 else:
104 vv_min = np.median(vv[0, :])
105 vv_max = np.median(vv[-1, :])
106
107 return vv_min, vv_max
108
109 if xx_uniform is None or yy_uniform is None:
110 # Find the range of axes

Callers 1

grid_interpolateFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected