pycsamt.emtools.strike#

Functions

estimate_strike_consensus(sites, *[, band, ...])

estimate_strike_phase_tensor(sites, *[, ...])

estimate_strike_sweep(sites, *[, angles, ...])

plot_strike_analysis(sites, *[, style, ...])

Three-panel rose diagram: Strike (Z), PT Azimuth, and Tipper Strike.

plot_strike_mapsticks(sites, *[, method, ...])

plot_strike_profile(sites, *[, method, ...])

plot_strike_ribbon(sites, *[, method, win, ...])

plot_strike_rose(sites, *[, style, groups, ...])

Publication-quality rose diagram of geoelectric strike direction.

plot_strike_rose_by_line(sites, *[, groups, ...])

rotate_to_strike(sites, *[, method, band, ...])

strike_curve_sweep(sites, *[, angles, ...])

pycsamt.emtools.strike.estimate_strike_sweep(sites, *, angles=array([-90., -89., -88., -87., -86., -85., -84., -83., -82., -81., -80., -79., -78., -77., -76., -75., -74., -73., -72., -71., -70., -69., -68., -67., -66., -65., -64., -63., -62., -61., -60., -59., -58., -57., -56., -55., -54., -53., -52., -51., -50., -49., -48., -47., -46., -45., -44., -43., -42., -41., -40., -39., -38., -37., -36., -35., -34., -33., -32., -31., -30., -29., -28., -27., -26., -25., -24., -23., -22., -21., -20., -19., -18., -17., -16., -15., -14., -13., -12., -11., -10., -9., -8., -7., -6., -5., -4., -3., -2., -1., 0., 1., 2., 3., 4., 5., 6., 7., 8., 9., 10., 11., 12., 13., 14., 15., 16., 17., 18., 19., 20., 21., 22., 23., 24., 25., 26., 27., 28., 29., 30., 31., 32., 33., 34., 35., 36., 37., 38., 39., 40., 41., 42., 43., 44., 45., 46., 47., 48., 49., 50., 51., 52., 53., 54., 55., 56., 57., 58., 59., 60., 61., 62., 63., 64., 65., 66., 67., 68., 69., 70., 71., 72., 73., 74., 75., 76., 77., 78., 79., 80., 81., 82., 83., 84., 85., 86., 87., 88., 89., 90.]), metric='diag_ratio', band=None, recursive=True, on_dup='replace', strict=False, verbose=0)[source]#
Parameters:
Return type:

DataFrame

pycsamt.emtools.strike.estimate_strike_phase_tensor(sites, *, band=None, robust=True, recursive=True, on_dup='replace', strict=False, verbose=0)[source]#
Parameters:
Return type:

DataFrame

pycsamt.emtools.strike.estimate_strike_consensus(sites, *, band=None, w_sweep=0.5, w_pt=0.5, angles=array([-90., -89., -88., -87., -86., -85., -84., -83., -82., -81., -80., -79., -78., -77., -76., -75., -74., -73., -72., -71., -70., -69., -68., -67., -66., -65., -64., -63., -62., -61., -60., -59., -58., -57., -56., -55., -54., -53., -52., -51., -50., -49., -48., -47., -46., -45., -44., -43., -42., -41., -40., -39., -38., -37., -36., -35., -34., -33., -32., -31., -30., -29., -28., -27., -26., -25., -24., -23., -22., -21., -20., -19., -18., -17., -16., -15., -14., -13., -12., -11., -10., -9., -8., -7., -6., -5., -4., -3., -2., -1., 0., 1., 2., 3., 4., 5., 6., 7., 8., 9., 10., 11., 12., 13., 14., 15., 16., 17., 18., 19., 20., 21., 22., 23., 24., 25., 26., 27., 28., 29., 30., 31., 32., 33., 34., 35., 36., 37., 38., 39., 40., 41., 42., 43., 44., 45., 46., 47., 48., 49., 50., 51., 52., 53., 54., 55., 56., 57., 58., 59., 60., 61., 62., 63., 64., 65., 66., 67., 68., 69., 70., 71., 72., 73., 74., 75., 76., 77., 78., 79., 80., 81., 82., 83., 84., 85., 86., 87., 88., 89., 90.]), metric='diag_ratio', recursive=True, on_dup='replace', strict=False, verbose=0)[source]#
Parameters:
Return type:

DataFrame

pycsamt.emtools.strike.rotate_to_strike(sites, *, method='consensus', band=None, angles=array([-90., -89., -88., -87., -86., -85., -84., -83., -82., -81., -80., -79., -78., -77., -76., -75., -74., -73., -72., -71., -70., -69., -68., -67., -66., -65., -64., -63., -62., -61., -60., -59., -58., -57., -56., -55., -54., -53., -52., -51., -50., -49., -48., -47., -46., -45., -44., -43., -42., -41., -40., -39., -38., -37., -36., -35., -34., -33., -32., -31., -30., -29., -28., -27., -26., -25., -24., -23., -22., -21., -20., -19., -18., -17., -16., -15., -14., -13., -12., -11., -10., -9., -8., -7., -6., -5., -4., -3., -2., -1., 0., 1., 2., 3., 4., 5., 6., 7., 8., 9., 10., 11., 12., 13., 14., 15., 16., 17., 18., 19., 20., 21., 22., 23., 24., 25., 26., 27., 28., 29., 30., 31., 32., 33., 34., 35., 36., 37., 38., 39., 40., 41., 42., 43., 44., 45., 46., 47., 48., 49., 50., 51., 52., 53., 54., 55., 56., 57., 58., 59., 60., 61., 62., 63., 64., 65., 66., 67., 68., 69., 70., 71., 72., 73., 74., 75., 76., 77., 78., 79., 80., 81., 82., 83., 84., 85., 86., 87., 88., 89., 90.]), metric='diag_ratio', inplace=False, recursive=True, on_dup='replace', strict=False, verbose=0)[source]#
Parameters:
pycsamt.emtools.strike.strike_curve_sweep(sites, *, angles=array([-90., -89., -88., -87., -86., -85., -84., -83., -82., -81., -80., -79., -78., -77., -76., -75., -74., -73., -72., -71., -70., -69., -68., -67., -66., -65., -64., -63., -62., -61., -60., -59., -58., -57., -56., -55., -54., -53., -52., -51., -50., -49., -48., -47., -46., -45., -44., -43., -42., -41., -40., -39., -38., -37., -36., -35., -34., -33., -32., -31., -30., -29., -28., -27., -26., -25., -24., -23., -22., -21., -20., -19., -18., -17., -16., -15., -14., -13., -12., -11., -10., -9., -8., -7., -6., -5., -4., -3., -2., -1., 0., 1., 2., 3., 4., 5., 6., 7., 8., 9., 10., 11., 12., 13., 14., 15., 16., 17., 18., 19., 20., 21., 22., 23., 24., 25., 26., 27., 28., 29., 30., 31., 32., 33., 34., 35., 36., 37., 38., 39., 40., 41., 42., 43., 44., 45., 46., 47., 48., 49., 50., 51., 52., 53., 54., 55., 56., 57., 58., 59., 60., 61., 62., 63., 64., 65., 66., 67., 68., 69., 70., 71., 72., 73., 74., 75., 76., 77., 78., 79., 80., 81., 82., 83., 84., 85., 86., 87., 88., 89., 90.]), metric='diag_ratio', smooth=5, recursive=True, on_dup='replace', strict=False, verbose=0)[source]#
Parameters:
Return type:

DataFrame

pycsamt.emtools.strike.plot_strike_rose_by_line(sites, *, groups=None, group_key=None, band=None, method='consensus', bins=36, weight='inv_iqr', axes=None, figsize=(8.6, 4.6), recursive=True, on_dup='replace', strict=False, verbose=0)[source]#
Parameters:
pycsamt.emtools.strike.plot_strike_rose(sites, *, style='pycsamt', groups=None, group_key=None, band=None, freq_bands=None, band_labels=None, band_colors=None, method='consensus', bins=36, weight='inv_iqr', bar_style=<object object>, bar_color=<object object>, bar_alpha=<object object>, bar_edgecolor=<object object>, bar_edgelw=<object object>, cmap=<object object>, outer_ring_lw=<object object>, outer_ring_color=<object object>, n_rings=<object object>, ring_color=<object object>, ring_ls=<object object>, ring_lw=<object object>, ring_labels=<object object>, ring_label_angle=<object object>, ring_label_fontsize=<object object>, ring_label_color=<object object>, ring_label_fmt=<object object>, spoke_every=<object object>, spoke_color=<object object>, spoke_ls=<object object>, spoke_lw=<object object>, compass_labels=<object object>, compass_fontsize=<object object>, compass_color=<object object>, compass_fontweight=<object object>, show_mean=<object object>, mean_color=<object object>, mean_lw=<object object>, mean_ls=<object object>, show_secondary=<object object>, secondary_color=<object object>, secondary_ls=<object object>, secondary_lw=<object object>, show_annotation=<object object>, annotation_pos=<object object>, annotation_fontsize=<object object>, annotation_bg=<object object>, annotation_ec=<object object>, show_n_stations=<object object>, subplot_size=3.2, n_cols=None, axes=None, figsize=None, suptitle='', suptitle_fontsize=10.0, tight_layout=True, recursive=True, on_dup='replace', strict=False, verbose=0)[source]#

Publication-quality rose diagram of geoelectric strike direction.

Each subplot shows the angular distribution of the estimated MT geoelectric strike for one station group (profile line). Bars are drawn with axial symmetry — 0–180° mirrored to 180–360° — to reflect the inherent 180° ambiguity of geoelectric strike.

Parameters:
  • sites (any) – EDI paths, EDI objects, or SitesCollection accepted by ensure_sites().

  • groups (dict[str, list[str]], optional) – Explicit map {group_label: [station_name, ...], ...}. If None, stations are auto-grouped by profile prefix (e.g. "E1S01" → group "E1").

  • group_key (str, optional) – EDI attribute to read as group label when groups is None.

  • band ((float, float), optional) – Period band (lo_s, hi_s) in seconds for strike estimation. None uses all available frequencies.

  • freq_bands (list of (float, float), optional) – Period sub-bands used for bar_style="bands". Each tuple is (lo_s, hi_s); one histogram per band is stacked.

  • band_labels (list[str], optional) – Legend labels matching freq_bands (one per band).

  • band_colors (list, optional) – Bar colours for each freq_bands entry (any matplotlib colour spec). Defaults to tab10 palette.

  • method ({"consensus", "sweep", "pt"}) – Strike estimation method — see estimate_strike_consensus().

  • bins (int) – Number of histogram bins over 0–180°, mirrored to 360°.

  • weight ({"inv_iqr", "uniform"}) – Weighting scheme. "inv_iqr" down-weights unstable sites.

  • bar_style ({"gradient", "bands", "solid"}) – "gradient" — bars coloured by height via cmap (paper style); "bands" — stacked per-band bars with distinct colours; "solid" — uniform bar_color.

  • bar_color (str) – Bar fill colour for bar_style="solid".

  • bar_edgecolor (str) – Bar edge colour ("none" → no edge).

  • bar_edgelw (float) – Bar edge line-width.

  • cmap (str) – Colormap name for bar_style="gradient".

  • outer_ring_lw (float) – Line-width of the bold outer circle.

  • outer_ring_color (str) – Colour of the outer circle.

  • n_rings (int) – Number of concentric reference rings inside the plot.

  • ring_color (str) – Colour of grid rings and radial spokes.

  • ring_ls (str) – Line-style of grid rings and radial spokes.

  • spoke_every (float) – Angular spacing (degrees) of radial spokes / tick marks.

  • compass_labels ({"NESW", "degrees", "none"}) – Labels around the polar perimeter. "NESW" shows cardinal directions; "degrees" shows degree values; "none" suppresses all labels.

  • compass_fontsize (float) – Font size for compass / degree labels.

  • compass_color (str) – Colour of compass labels.

  • mean_color (str) – Colour of the mean-direction line.

  • mean_lw (float) – Line-width of the mean-direction line.

  • mean_ls (str) – Line-style of the mean-direction line.

  • show_secondary (bool) – Draw the 180°-conjugate mean line (axial symmetry axis).

  • secondary_color (str, optional) – Colour for the conjugate line; defaults to mean_color.

  • secondary_ls (str) – Line-style for the conjugate line.

  • secondary_lw (float, optional) – Line-width for the conjugate line; defaults to mean_lw.

  • annotation_pos ((float, float)) – Axes-fraction (x, y) of the strike angle annotation box.

  • annotation_fontsize (float) – Font size of the annotation text.

  • annotation_bg (str) – Background colour of the annotation box.

  • annotation_ec (str) – Edge colour of the annotation box.

  • show_n_stations (bool) – Append the station count n = N to the annotation text.

  • subplot_size (float) – Side length (inches) of each polar subplot.

  • n_cols (int, optional) – Number of subplot columns. Defaults to len(groups).

  • figsize ((float, float), optional) – Override the auto-computed figure size.

  • suptitle (str) – Figure-level super-title.

  • suptitle_fontsize (float) – Font size of the super-title.

  • tight_layout (bool) – Call fig.tight_layout() before returning.

  • recursive (bool) – Passed to ensure_sites().

  • on_dup (str) – Duplicate-handling strategy for ensure_sites().

  • strict (bool) – Strict mode for ensure_sites().

  • verbose (int) – Verbosity level.

  • style (str | RoseStyle | None)

Returns:

Figure with one polar axes per station group.

Return type:

matplotlib.figure.Figure

Examples

Basic usage — one rose per profile line, gradient style:

>>> from pycsamt.emtools import plot_strike_rose
>>> fig = plot_strike_rose("path/to/edis/")

Frequency-band decomposition (short / long period stacked):

>>> fig = plot_strike_rose(
...     sites,
...     bar_style="bands",
...     freq_bands=[(0.001, 0.1), (0.1, 100.0)],
...     band_labels=["Short period", "Long period"],
... )
pycsamt.emtools.strike.plot_strike_ribbon(sites, *, method='sweep', win=5, show_colorbar=True, cbar_ticks=None, figsize=(9.0, 4.2), recursive=True, on_dup='replace', strict=False, verbose=0, ax=None)[source]#
Parameters:
Return type:

Axes

pycsamt.emtools.strike.plot_strike_profile(sites, *, method='consensus', band=None, sort_by='auto', figsize=(8.6, 3.8), recursive=True, on_dup='replace', strict=False, verbose=0, ax=None)[source]#
Parameters:
Return type:

Axes

pycsamt.emtools.strike.plot_strike_mapsticks(sites, *, method='consensus', band=None, len_deg=0.02, alpha_scale=0.9, figsize=(7.8, 6.0), recursive=True, on_dup='replace', strict=False, verbose=0, ax=None)[source]#
Parameters:
Return type:

Axes

pycsamt.emtools.strike.plot_strike_analysis(sites, *, style='pycsamt', band=None, bins=36, method='sweep', cmap_z=None, cmap_pt=None, cmap_tipper=None, title_fc_z='#ffe0e0', title_fc_pt='#ffffd0', title_fc_tipper='#d5e8ff', title_ec='0.35', axes=None, figsize=None, subplot_size=3.8, suptitle='', tight_layout=True, recursive=True, on_dup='replace', strict=False, verbose=0)[source]#

Three-panel rose diagram: Strike (Z), PT Azimuth, and Tipper Strike.

Produces a publication-quality figure with one polar rose per analysis type, analogous to the MTPy StrikeAnalysis plot. All three panels share the same RoseStyle so colours remain visually consistent. Each panel carries a coloured title box to distinguish the three quantities at a glance.

Parameters:
  • sites (any) – EDI paths, EDI objects, or SitesCollection accepted by ensure_sites().

  • style (str, RoseStyle, or None) – Named style preset or RoseStyle instance. Default "pycsamt" uses the YlOrRd-gradient, crimson-mean-line paper style.

  • band ((lo_s, hi_s) or None) – Period window in seconds applied to all three panels. None uses all available periods / frequencies.

  • bins (int) – Number of histogram bins over 0–180°, mirrored to 0–360°. Default 36 → 5° bins.

  • method ({"sweep", "pt", "consensus"}) –

    Strike estimation algorithm for the Strike (Z) panel.

    "sweep" — impedance-tensor rotation sweep (calls estimate_strike_sweep()); "pt" — phase-tensor θ median per station (calls estimate_strike_phase_tensor()); "consensus" — weighted blend of sweep and PT (calls estimate_strike_consensus()).

  • cmap_z (str or None) – Colormap name for each panel when bar_style="gradient". None falls back to the colormap in style.

  • cmap_pt (str or None) – Colormap name for each panel when bar_style="gradient". None falls back to the colormap in style.

  • cmap_tipper (str or None) – Colormap name for each panel when bar_style="gradient". None falls back to the colormap in style.

  • title_fc_z (str) – Facecolour of the title annotation box for each panel.

  • title_fc_pt (str) – Facecolour of the title annotation box for each panel.

  • title_fc_tipper (str) – Facecolour of the title annotation box for each panel.

  • title_ec (str) – Edge colour shared by all title boxes.

  • figsize ((float, float) or None) – Figure size. Auto-derived from subplot_size when None.

  • subplot_size (float) – Side length (inches) of each polar panel when figsize is auto.

  • suptitle (str) – Figure-level super-title.

  • tight_layout (bool) – Call fig.tight_layout() before returning.

  • recursive (bool) – Passed to ensure_sites().

  • on_dup (str) – Passed to ensure_sites().

  • strict (bool) – Passed to ensure_sites().

  • verbose (int) – Passed to ensure_sites().

Returns:

Figure with three polar axes: Strike (Z), PT Azimuth, Tipper Strike.

Return type:

matplotlib.figure.Figure

Examples

Default style, all periods:

>>> from pycsamt.emtools import plot_strike_analysis
>>> fig = plot_strike_analysis("path/to/edis/")
>>> fig.savefig("strike_analysis.png", dpi=150, bbox_inches="tight")

Short-period band, publication style:

>>> fig = plot_strike_analysis(
...     sites,
...     band=(0.01, 1.0),
...     style="publication",
...     suptitle="WILLY AMT — short-period band",
... )