Commit 5593a00d authored by Peterson, Peter's avatar Peterson, Peter
Browse files

Merge branch 'tranpose_plot2d_mask' into 'next'

Transpose ROI if I(Q2D) is transposed in plot_IQazimuthal method

Closes #838

See merge request sns-hfir-scse/sans/sans-backend!932
parents 2ebc7842 46071894
Pipeline #178875 failed with stages
in 28 minutes and 58 seconds
......@@ -176,7 +176,10 @@ def plot_IQazimuthal(workspace, filename, backend='d3',
symmetric_wedges: bool = True,
imshow_kwargs: Dict = {}, **kwargs):
'''Save a plot representative of the supplied workspace
'''Save a plot of I(Qx, Qy).
If qmin is specified, all I(Q) with Q less than qmin will be masked in output plot.
If qmax is specified, all I(Q) with Q greater than qmax will be masked in output plot.
If wedges are specified, all I(Q) out side of wedges will be masked in output plot.
......@@ -259,6 +262,8 @@ def plot_IQazimuthal(workspace, filename, backend='d3',
# Determine whether intensity matrix shall be inverted or not
qx2d = workspace.qx
qy2d = workspace.qy
# set up the flag to transpose ROI if I(Qx, Qy) is to be tranposed
transpose_flag = False
if qx2d.shape[0] > 1 and np.sum(qx2d[0] == qx2d[1]) == qx2d.shape[1]:
# I(Qx, Qy) is of same order as meshgrid(Qx, Qy)
# Qx have identical among rows:
......@@ -269,13 +274,17 @@ def plot_IQazimuthal(workspace, filename, backend='d3',
# I(Qx, Qy) is tranposed to meshgrid(Qx, Qy)
intensity = workspace.intensity.T
transpose_flag = True
pcm = ax.imshow(intensity, extent=(qxmin, qxmax, qymin, qymax),
origin='lower', aspect='auto', **imshow_kwargs)
# add calculated region of interest
if roi is not None:
roi =, roi.astype(int)) # This is a fix.transpose()
roi =, roi.astype(int))
# transpose ROI
if transpose_flag:
roi = roi.T
ax.imshow(roi, alpha=mask_alpha, extent=(qxmin, qxmax, qymin, qymax),
cmap='gray', vmax=roi.max(),
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment