# scope_profiler.report_data

*module*

Data behind the report charts and its scaling axes, without any HTML.

The HTML report and the Astro site generator both need the same chart payloads
(the JSON the ``plot_*`` functions export) and the same rules for what a
comparison scales over; they live here so neither depends on the other.

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

## scope_profiler.report_data.SCALING_MODES

*attribute* · *module attribute*

```python
SCALING_MODES = ('strong', 'weak', 'both')
```

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

## scope_profiler.report_data.SPEEDUP_X_CHOICES

*attribute* · *module attribute*

```python
SPEEDUP_X_CHOICES = ('auto', *SPEEDUP_X_FIELDS)
```

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

## scope_profiler.report_data.SPEEDUP_X_FIELDS

*attribute* · *module attribute*

```python
SPEEDUP_X_FIELDS = {'ranks': 'num_ranks', 'nodes': 'num_nodes', 'threads': 'omp_num_threads', 'cores': 'total_cores'}
```

[View source](https://github.com/max-models/scope-profiler/blob/devel/src/scope_profiler/report_data.py#L73-L78)

## scope_profiler.report_data.SpeedupAxisError

*class*

```python
class SpeedupAxisError(ValueError)
```

Bases: `ValueError`

The requested speedup x-axis is unknown, or some run did not record it.

[View source](https://github.com/max-models/scope-profiler/blob/devel/src/scope_profiler/report_data.py#L94-L95)

## scope_profiler.report_data.collect_chart_payloads

*function*

```python
def collect_chart_payloads(runs, include, exclude, ranks, comparison: bool = False, scaling_field: str | None = None, scaling: str = 'both', rank_charts: bool | None = None, stack_toggle: bool = False, stack_default: bool = True) -> tuple[list[tuple[str, dict, dict]], list[str]]
```

Build the chart payloads of one run or of a comparison of runs.

Returns ``(charts, failures)``: ``charts`` holds ``(title, payload,
options)`` in display order, where ``payload`` is the JSON document a
``plot_*`` function exports and ``options`` its extra view settings (the
``variants`` of a scaling chart, a layout override); ``failures`` says why
a chart is missing. Needs ``scope-profiler[pproc]`` and raises
:class:`ImportError` without it.

A comparison keeps only the charts that compare runs; each run's timeline
and rank charts belong to its own page. ``scaling`` picks the chart(s) for
runs of different sizes: "strong" the speedup, "weak" the weak-scaling
efficiency, "both" the two of them.

``rank_charts`` draws the rank imbalance and heatmap charts over the runs
(default: for a single run's report only). ``stack_toggle`` gives a single
run's durations chart the other way of drawing it, as an ``alternate``
payload, for a page whose reader can switch; ``stack_default=False`` draws the single run's
durations unstacked, in one colour, and leaves the stacked bars to that switch.

[View source](https://github.com/max-models/scope-profiler/blob/devel/src/scope_profiler/report_data.py#L149-L440)
