aurora.transfer_function.plot package

Submodules

aurora.transfer_function.plot.comparison_plots module

This module contains a function to for comparing legacy “z-file”

transfer function files.

aurora.transfer_function.plot.comparison_plots.compare_two_z_files(z_path1: Path | str, z_path2: Path | str, angle1: float | None = 0.0, angle2: float | None = 0.0, label1: str | None = '', label2: str | None = '', scale_factor1: float | None = 1.0, scale_factor2: float | None = 1.0, out_file: str | Path | None = '', show_plot: bool | None = True, use_ylims: bool | None = True, use_xlims: bool | None = True, rho_ax_label_size: float | None = 16, phi_ax_label_size: float | None = 16, markersize: float | None = 3, rho_ylims: tuple | None = (1, 1000.0), phi_ylims: tuple | None = (0, 90), xlims: tuple | None = (0.001, 1000.0), title_string: str | None = '', subtitle_string: str | None = '')[source]

Takes as input two z-files and plots them both on the same axis

TODO: Replace with a method from MTpy

Parameters:
  • z_path1 (Union[pathlib.Path, str]) – The first z-file to compare

  • z_path2 (Union[pathlib.Path, str]) – The second z-file to compare

  • angle1 (Optional[float] = 0.0) – The angle to rotate the first TF

  • angle2 (Optional[float] = 0.0) – The angle to rotate the second TF

  • label1 (Optional[str] = "",) – A legend label for the first TF

  • label2 (Optional[str] = "",) – A legend label for the second TF

  • scale_factor1 (Optional[float] = 1.0) – A scale factor to shift rho of TF1

  • scale_factor2 (Optional[float] =1.0) – A scale factor to shift rho of TF2

  • out_file (Optional[Union[pathlib.Path, str]] = "") – A file to save the plot

  • show_plot (Optional[bool] = True) – If True, show an interactive plot

  • use_ylims (Optional[bool] = True) – If True, explicitly set y-axis limits to rho_ylims

  • use_xlims (Optional[bool] = True) – If True, explicitly set x-axis limits to xlims

  • rho_ax_label_size (Optional[float] = 16) – Set the y-axis label size for rho

  • phi_ax_label_size (Optional[float] = 16,) – Set the y-axis label size for phi

  • markersize (Optional[float] = 3) – Set the markersize (for both rho and phi)

  • rho_ylims (Optional[tuple] = (1, 1e3)) – The Y-axis limits to apply on rho (if use_ylims is True)

  • phi_ylims (Optional[tuple] = (0, 90),) – The Y-axis limits to apply on phi

  • xlims (Optional[tuple] = (1e-3, 1e3)) – The Z-axis limits to apply (if use_xlims is True)

aurora.transfer_function.plot.error_bar_helpers module

This module contains a method for defining error bar plotting scheme. The function was adapted from matlab EMTF.

aurora.transfer_function.plot.error_bar_helpers.err_log(x: ndarray, y: ndarray, yerr: ndarray, x_axis_limits: list, log_x_axis: bool | None = True, barsize: float = 0.0075)[source]

Returns the coordinates for the line segments that make up the error bars.

Development Notes:

This function returns 6 numbers per data point. There is no documentation for what it does. A reasonable guess would be that the six numbers define 3 line segments. One line segment for the error bar, and one line segment at the top of the error bar, and one at the bottom. The vectors xb and yb each have six elements per data point assigned as follows xb = [x-dx, x+dx, x, x, x-dx, x+dx,] yb = [y-dy, y-dy, y-dy, y+dy, y+dy, y+dy,] and if log_x_axis is True [log(x)-dx, log(x)+dx, log(x), log(x), log(x)-dx, log(x)+dx,]

Matlab Documentation err_log : used for plotting error bars with a y-axis log scale takes VECTORS x and y and outputs matrices (one row per data point) for plotting error bars ll = ‘XLOG’ for log X axis

Parameters:
  • x (np.ndarray) – The x-axis values. Usually these are periods with units of seconds

  • y (np.ndarray) – The x-axis values. Usually apparent resistivity or phase

  • yerr (np.ndarray) – A value associated with the error in the y measurement. It seems that this is the “half height” of the error bar.

  • log_x_axis (bool) – If True the xaxis is logarithmic Not tested for False

  • x_axis_limits (list) – The lower and upper limits for the xaxis in position 0, 1 respectively.

  • barsize (float) – The width of the top and bottom horizontal error bar lines.

Returns:

xb, yb – Each is np.ndarray, 6 rows and one column per data point These are the six points needed to draw the error bars.

Return type:

tuple

aurora.transfer_function.plot.rho_phi_helpers module

This module contains functions for plotting appararent resistivity and phase.

They are based on the original matlab codes. They support multiple plots on a single axis.

TODO: replace these with calls to MTpy

aurora.transfer_function.plot.rho_phi_helpers.plot_phi(ax, periods, phi, marker='o', color='k', linestyle='None', label='', markersize=10, ax_label_size=16)[source]

Plots the phase on the given axis.

Parameters:
  • ax

  • periods

  • phi

  • marker

  • color

  • linestyle

  • label

  • markersize

  • ax_label_size

aurora.transfer_function.plot.rho_phi_helpers.plot_rho(ax, periods, rho, marker='o', color='k', linestyle='None', label='', markersize=10, ax_label_size=16)[source]

Plots apparent resistivity on the given axis

Parameters:
  • ax

  • periods

  • rho

  • marker

  • color

  • linestyle

  • label

  • markersize

  • ax_label_size

aurora.transfer_function.plot.rho_plot module

This module contains functions for plotting apparent resistivity and phase.

This is based on Gary’s RhoPlot.m in the matlab EMTF version. iris_mt_scratch/egbert_codes-20210121T193218Z-001/egbert_codes/matlabPrototype_10-13-20/TF/classes

TODO: replace with calls to mtpy

class aurora.transfer_function.plot.rho_plot.RhoPlot(tf_obj)[source]

Bases: object

TF plotting object class; some methods are only relevant to specific types of TFs (or for derived parameters such as rho/phi)

Development Notes:

This should be deprecated and replaced with MTpy The only place this class is used is in aurora/sandbox/plot_helpers.py in the plot_tf_obj method.

Methods

phase_sub_plot(ax[, ttl_str, pred, linewidth])

place a phase subplot on given figure axis

rho_sub_plot(ax[, ttl_str, pred])

Makes an apparent resistivity plot on the input axis.

set_lims()

Set limits for the plotting axes

set_period_limits()

Returns a set of limits for the x-axis of plots based on periods to display.

set_rho_limits()

Returns a set of limits for the x-axis of plots based on periods to display.

phase_sub_plot(ax, ttl_str='', pred=None, linewidth=2)[source]

place a phase subplot on given figure axis

Development notes:

Originally this took an optional input argument axRect but it was never used. It looks as it it was intended to be able to set the position of the figure. There was also some hardcoded control of linewidth and markersize which has been removed for readability.

Parameters:
  • ax

  • pred

rho_sub_plot(ax, ttl_str='', pred=None)[source]

Makes an apparent resistivity plot on the input axis.

Matlab Documentation: Calls plotrhom, standard plotting routine; uses some other routines in EMTF/matlab/Zplt; this version is for putting multiple curves on the same plot … set plotting limits now that rho is known

Parameters:
set_lims() list[source]

Set limits for the plotting axes

TODO: Add doc or start using MTpy

Matlab Notes: set default limits for plotting; QD, derived from ZPLT use max/min limits of periods, rho to set limits

function[lims, orient] = set_lims(obj) Returns

lims : list x_max, x_min, y_max, y_min, 0, 90 orient: 0

Returns:

lims – The plotting limits for period, rho and phi.

Return type:

list

set_period_limits()[source]

Returns a set of limits for the x-axis of plots based on periods to display.

Original Matlab Notes:

“set nicer period limits for logartihmic period scale plots”

Returns:

Tmin, Tmax – The minimum and maximum periods for the x-axis

Return type:

tuple

set_rho_limits()[source]

Returns a set of limits for the x-axis of plots based on periods to display.

Original Matlab Notes:

“set nicer period limits for logartihmic period scale plots”

Returns:

Tmin, Tmax – The minimum and maximum periods for the x-axis

Return type:

tuple

Module contents