Skip to content

Commit ea24492

Browse files
committed
needed to add in flag for rotating inplace.
1 parent 392a56b commit ea24492

File tree

2 files changed

+45
-36
lines changed

2 files changed

+45
-36
lines changed

mtpy/imaging/plot_mt_response.py

Lines changed: 40 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -34,35 +34,35 @@
3434
class PlotMTResponse(PlotBase):
3535
"""Plots Resistivity and phase for the different modes of the MT response.
3636
37-
At
38-
the moment it supports the input of an .edi file. Other formats that will
39-
be supported are the impedance tensor and errors with an array of periods
40-
and .j format.
41-
42-
The normal use is to input an .edi file, however it would seem that not
43-
everyone uses this format, so you can input the data and put it into
44-
arrays or objects like class mtpy.core.z.Z. Or if the data is in
45-
resistivity and phase format they can be input as arrays or a class
46-
mtpy.imaging.mtplot.ResPhase. Or you can put it into a class
47-
mtpy.imaging.mtplot.MTplot.
48-
49-
The plot places the apparent resistivity in log scale in the top panel(s),
50-
depending on the plot_num. The phase is below this, note that 180 degrees
51-
has been added to the yx phase so the xy and yx phases plot in the same
52-
quadrant. Both the resistivity and phase share the same x-axis which is in
53-
log period, short periods on the left to long periods on the right. So
54-
if you zoom in on the plot both plots will zoom in to the same
55-
x-coordinates. If there is tipper information, you can plot the tipper
56-
as a third panel at the bottom, and also shares the x-axis. The arrows are
57-
in the convention of pointing towards a conductor. The xx and yy
58-
components can be plotted as well, this adds two panels on the right.
59-
Here the phase is left unwrapped. Other parameters can be added as
60-
subplots such as strike, skew and phase tensor ellipses.
61-
62-
To manipulate the plot you can change any of the attributes listed below
63-
and call redraw_plot(). If you know more aout matplotlib and want to
64-
change axes parameters, that can be done by changing the parameters in the
65-
axes attributes and then call update_plot(), note the plot must be open.
37+
At
38+
the moment it supports the input of an .edi file. Other formats that will
39+
be supported are the impedance tensor and errors with an array of periods
40+
and .j format.
41+
42+
The normal use is to input an .edi file, however it would seem that not
43+
everyone uses this format, so you can input the data and put it into
44+
arrays or objects like class mtpy.core.z.Z. Or if the data is in
45+
resistivity and phase format they can be input as arrays or a class
46+
mtpy.imaging.mtplot.ResPhase. Or you can put it into a class
47+
mtpy.imaging.mtplot.MTplot.
48+
49+
The plot places the apparent resistivity in log scale in the top panel(s),
50+
depending on the plot_num. The phase is below this, note that 180 degrees
51+
has been added to the yx phase so the xy and yx phases plot in the same
52+
quadrant. Both the resistivity and phase share the same x-axis which is in
53+
log period, short periods on the left to long periods on the right. So
54+
if you zoom in on the plot both plots will zoom in to the same
55+
x-coordinates. If there is tipper information, you can plot the tipper
56+
as a third panel at the bottom, and also shares the x-axis. The arrows are
57+
in the convention of pointing towards a conductor. The xx and yy
58+
components can be plotted as well, this adds two panels on the right.
59+
Here the phase is left unwrapped. Other parameters can be added as
60+
subplots such as strike, skew and phase tensor ellipses.
61+
62+
To manipulate the plot you can change any of the attributes listed below
63+
and call redraw_plot(). If you know more aout matplotlib and want to
64+
change axes parameters, that can be done by changing the parameters in the
65+
axes attributes and then call update_plot(), note the plot must be open.
6666
"""
6767

6868
def __init__(
@@ -152,9 +152,9 @@ def rotation_angle(self):
152152
def rotation_angle(self, theta_r):
153153
"""Only a single value is allowed."""
154154
if not theta_r == 0:
155-
self.Z.rotate(theta_r)
156-
self.Tipper.rotate(theta_r)
157-
self.pt.rotate(theta_r)
155+
self.Z.rotate(theta_r, inplace=True)
156+
self.Tipper.rotate(theta_r, inplace=True)
157+
self.pt.rotate(theta_r, inplace=True)
158158

159159
self._rotation_angle += theta_r
160160
else:
@@ -163,7 +163,11 @@ def rotation_angle(self, theta_r):
163163
def _has_z(self):
164164
"""Has z."""
165165
if self.plot_z:
166-
if self.Z is None or self.Z.z is None or (self.Z.z == 0 + 0j).all():
166+
if (
167+
self.Z is None
168+
or self.Z.z is None
169+
or (self.Z.z == 0 + 0j).all()
170+
):
167171
self.logger.info(f"No Z data for station {self.station}")
168172
return False
169173
return self.plot_z
@@ -598,7 +602,9 @@ def plot(self):
598602

599603
# ===Plot the xx, yy components if desired==========================
600604
if self.plot_num == 2:
601-
self._plot_resistivity(self.axr2, self.period, self.Z, mode="d")
605+
self._plot_resistivity(
606+
self.axr2, self.period, self.Z, mode="d"
607+
)
602608
self._plot_phase(self.axp2, self.period, self.Z, mode="d")
603609

604610
# ===Plot the Determinant if desired================================

mtpy/imaging/plot_pt.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def rotation_angle(self, theta_r):
6262
self._rotation_angle = theta_r
6363
if not theta_r == 0:
6464

65-
self.pt.rotate(theta_r)
65+
self.pt.rotate(theta_r, inplace=True)
6666

6767
def _rotate_pt(self, rotation_angle):
6868
"""Rotate pt.
@@ -99,7 +99,10 @@ def plot(self, rotation_angle=None):
9999
color_array = self.get_pt_color_array(self.pt)
100100

101101
# -------------plotPhaseTensor-----------------------------------
102-
self.cbax, self.cbpt, = plot_pt_lateral(
102+
(
103+
self.cbax,
104+
self.cbpt,
105+
) = plot_pt_lateral(
103106
self.ax_pt,
104107
self.pt,
105108
color_array,

0 commit comments

Comments
 (0)