# Activity analysis


<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

## Tile ground area

------------------------------------------------------------------------

<a
href="https://github.com/michaelaye/p4tools/blob/main/p4tools/activity.py#L58"
target="_blank" style="float:right; font-size:smaller">source</a>

### tile_ground_area_m2

``` python

def tile_ground_area_m2(
    obsids:NoneType=None, # If given, restrict to this iterable of obsid strings; otherwise
return for all obsids in the catalog version.
    version:str='v3.1'
)->Series:

```

*Tile ground area in m² per obsid.*

Each P4 tile is 840×648 pixels; ground area =
`840 * 648 * map_scale**2`. For v3.1 `map_scale` is one of {0.25, 0.5,
1.0} m/px, giving tile ground areas of {34 020, 136 080, 544 320} m²
respectively.

## Per-tile marking density

------------------------------------------------------------------------

<a
href="https://github.com/michaelaye/p4tools/blob/main/p4tools/activity.py#L82"
target="_blank" style="float:right; font-size:smaller">source</a>

### per_tile_marking_density

``` python

def per_tile_marking_density(
    version:str='v3.1',
    kind:str='all', # Which markings to count for ``density_per_m2``. ``"all"`` (default)
is fan + blotch, the recommended activity proxy. The per-kind counts
``n_fans`` / ``n_blotches`` are always present.
)->DataFrame:

```

*Per-tile counts and marking density (markings per m² of ground area).*

Returned columns:
`[obsid, tile_id, n_fans, n_blotches, n_markings, map_scale,    tile_ground_area_m2, density_per_m2]`.

## Per-marking ground area

------------------------------------------------------------------------

<a
href="https://github.com/michaelaye/p4tools/blob/main/p4tools/activity.py#L143"
target="_blank" style="float:right; font-size:smaller">source</a>

### per_marking_ground_area

``` python

def per_marking_ground_area(
    version:str='v3.1', kind:str='both', # Which catalog(s) to process. Default ``"both"``.
    cache:bool=True, cache_dir:pathlib.Path | None=None
)->DataFrame:

```

*Per-marking polygon area in m².*

Computes Shapely polygons for every fan / blotch using
`markings.{Fan,Blotch}.to_shapely` (HiRISE pixel scope), takes
`polygon.area` in pixel², and converts to m² via per-obsid `map_scale`.
Result is cached as parquet next to the coverage cache.
