pycsamt.site.report#

pycsamt.site.report#

Human-friendly display layer for Site and Sites objects.

Two classes are provided:

  • SiteReport — statistics and rich display for a single site.

  • SitesReport — statistics and rich display for a collection.

Both compute their statistics lazily at construction time so that repeated calls to report() are cheap.

Quick start#

from pycsamt.site.report import SiteReport, SitesReport

# --- single site ---
report = SiteReport(site)
report.report()                    # prints to terminal
d = report.to_dict()               # plain dict
df = report.to_dataframe()         # pandas DataFrame (resphase)

# --- collection ---
rep = SitesReport(sites)
rep.report()                       # full survey summary
rep.report(top=10)                 # first 10 stations only
df = rep.to_dataframe()            # one row per station
d  = rep.to_dict()                 # list of per-station dicts

Notes

The report() method uses rich when available and degrades to plain-text output when rich is not installed.

All statistics are computed from the arrays exposed by SiteMixin: freq, z, rho, phase, tipper. Missing arrays are handled gracefully and reported as "—" in the output.

Classes

SiteReport(site)

Statistics and display for a single Site.

SitesReport(sites)

Statistics and display for a Sites collection.

class pycsamt.site.report.SiteReport(site)[source]#

Bases: object

Statistics and display for a single Site.

Parameters:

site (Site-like) – Any object that exposes name, coords, freq, z, rho, phase, and tipper as per SiteMixin.

Examples

from pycsamt.site.report import SiteReport
rep = SiteReport(site)
rep.report()               # rich terminal output
d = rep.to_dict()          # machine-readable dict
report(*, detail=False)[source]#

Print a rich panel with site statistics.

Parameters:

detail (bool) – If True, include per-frequency Z and ρ–φ tables.

Return type:

None

summary()[source]#

Return a one-line summary string.

Return type:

str

to_dict()[source]#

Return a plain dict of all computed statistics.

Return type:

dict[str, Any]

to_dataframe(kind='resphase', *, api=None)[source]#

Export site arrays to a pandas.DataFrame.

Parameters:
  • kind (str) – Passed to to_dataframe().

  • api (bool or None, default None) – True forces API view wrapping; False returns a bare pandas dataframe; None (default) defers to the global PYCSAMT_API_VIEW setting.

Return type:

Any

class pycsamt.site.report.SitesReport(sites)[source]#

Bases: object

Statistics and display for a Sites collection.

Parameters:

sites (Sites-like) – Any iterable of Site-like objects.

Examples

from pycsamt.site.report import SitesReport
rep = SitesReport(sites)
rep.report()              # full survey panel + per-station table
rep.report(top=10)        # first 10 stations only
df = rep.to_dataframe()   # one row per station
report(*, top=None, detail=False)[source]#

Print a full survey report.

Parameters:
  • top (int, optional) – Limit the per-station table to the first top stations.

  • detail (bool) – If True, print additional per-station statistics.

Return type:

None

summary()[source]#
Return type:

str

to_dict()[source]#

Return a list of per-station stat dicts.

Return type:

list[dict[str, Any]]

to_dataframe(*, api=None)[source]#

Return a pandas.DataFrame with one row per station.

Parameters:

api (bool | None)

Return type:

Any