# scope_profiler.plotting_scripts.statistics

*module*

Region-duration statistics collection (JSON export, no chart rendering).

[View source](https://github.com/max-models/scope-profiler/blob/devel/src/scope_profiler/plotting_scripts/statistics.py#L1-L1)

## scope_profiler.plotting_scripts.statistics.collect_region_statistics

*function*

```python
def collect_region_statistics(profiling_data: ProfilingResults | Sequence[ProfilingResults], ranks: list[int] | int | None = None, include: list[str] | str | None = None, exclude: list[str] | str | None = None, labels: Sequence[str] | None = None) -> dict
```

Collect aggregate region-duration statistics for one or more profiling files.

[View source](https://github.com/max-models/scope-profiler/blob/devel/src/scope_profiler/plotting_scripts/statistics.py#L206-L289)

## scope_profiler.plotting_scripts.statistics.write_region_statistics_json

*function*

```python
def write_region_statistics_json(profiling_data: ProfilingResults | Sequence[ProfilingResults], filepath: str | Path, ranks: list[int] | int | None = None, include: list[str] | str | None = None, exclude: list[str] | str | None = None, labels: Sequence[str] | None = None) -> dict
```

Write aggregate region-duration statistics to a JSON file.

[View source](https://github.com/max-models/scope-profiler/blob/devel/src/scope_profiler/plotting_scripts/statistics.py#L292-L312)
