Skip to content

Analyzer

jitterbug.analyzer.JitterbugAnalyzer

Main analyzer class that orchestrates the entire Jitterbug analysis pipeline.

This class coordinates data loading, change point detection, jitter analysis, latency jump detection, and final congestion inference.

Parameters:

Name Type Description Default
config JitterbugConfig

Configuration object containing all analysis parameters.

required

Attributes:

Name Type Description
config JitterbugConfig

Configuration object.

data_loader DataLoader

Data loading component.

change_point_detector ChangePointDetector

Change point detection component.

jitter_analyzer JitterAnalyzer

Jitter analysis component.

latency_jump_analyzer LatencyJumpAnalyzer

Latency jump analysis component.

congestion_inference_analyzer CongestionInferenceAnalyzer

Congestion inference component.

analyze_from_file(file_path, file_format=None)

Analyze RTT data from a file.

Parameters:

Name Type Description Default
file_path Union[str, Path]

Path to the RTT data file.

required
file_format Optional[str]

Input format, one of jitterbug.io.readers.available_formats(). If None, it is inferred from the extension, then from the content.

None

Returns:

Type Description
CongestionInferenceResult

Complete analysis results including congestion inferences.

analyze_from_source(source)

Analyze RTT data read from a database query.

Parameters:

Name Type Description Default
source SourceConfig

Back end, connection settings and query; the result rows are mapped through config.input like a file's. Credentials come from environment variables.

required

Returns:

Type Description
CongestionInferenceResult

Complete analysis results including congestion inferences.

analyze_series_from_source(source)

Analyze each series of a database query result on its own; see :meth:analyze_series_from_file.

Parameters:

Name Type Description Default
source SourceConfig

Back end, connection settings and query.

required

Returns:

Type Description
MultiSeriesResult

One entry per series.

analyze_from_dataframe(df)

Analyze RTT data from a pandas DataFrame.

Parameters:

Name Type Description Default
df DataFrame

DataFrame containing RTT data, mapped through config.input (by default an epoch column in seconds and a values column in milliseconds).

required

Returns:

Type Description
CongestionInferenceResult

Complete analysis results including congestion inferences.

analyze_series_from_file(file_path, file_format=None)

Analyze each series of a file on its own (config.input.group_by).

Rows are filtered by input.series, split by input.group_by and loaded per series (DataLoader.load_series); each series is then analyzed as :meth:analyze would analyze it alone. A series that cannot be analyzed (all rows dropped, fewer than two minimum-RTT intervals, an analysis error) is reported as skipped with its reason; the others are unaffected. After the call, raw_data, min_rtt_data and change_points belong to the last series analyzed.

Parameters:

Name Type Description Default
file_path str | Path

Path to the RTT data file.

required
file_format str | None

Input format; inferred when None.

None

Returns:

Type Description
MultiSeriesResult

One entry per series: series analyzed, in order of first appearance, then series whose rows were all dropped while loading.

Raises:

Type Description
ValueError

If the file cannot be loaded, a key column is missing or a series filter matches no row.

analyze_series_from_dataframe(df)

Analyze each series of a DataFrame on its own; see :meth:analyze_series_from_file.

Parameters:

Name Type Description Default
df DataFrame

Raw rows, mapped through config.input.

required

Returns:

Type Description
MultiSeriesResult

One entry per series.

analyze(rtt_data)

Perform complete Jitterbug analysis on RTT data.

Parameters:

Name Type Description Default
rtt_data RTTDataset

RTT measurement dataset.

required

Returns:

Type Description
CongestionInferenceResult

Complete analysis results including congestion inferences.

save_results(results, output_path, format=None)

Save analysis results to file.

Parameters:

Name Type Description Default
results CongestionInferenceResult

Analysis results to save.

required
output_path Union[str, Path]

Path to save results to. JSON and CSV are compressed when it ends in .zst, .gz, .bz2 or .xz (results.json.zst).

required
format Optional[str]

Output format ('json', 'csv', 'parquet'). If None, uses config default.

None

Raises:

Type Description
ValueError

If the format is unknown, or Parquet is requested with a compressed path.

ImportError

If the path ends in .zst and no Zstandard codec is available.

save_series_results(results, output_path, format=None)

Save the results of a grouped analysis.

JSON is one document, {"group_by": [...], "series": [{"key": {...}, "result": {...}} | {"key": {...}, "skipped_reason": "..."}, ...], "metadata": {...}}, each result as :meth:save_results writes it. CSV and Parquet hold every period of every analyzed series, with the key columns first.

Parameters:

Name Type Description Default
results MultiSeriesResult

Results to save.

required
output_path str | Path

Destination; JSON and CSV are compressed for .zst, .gz, .bz2 or .xz.

required
format str | None

json, csv or parquet; None uses config.output_format.

None

Raises:

Type Description
ValueError

If the format is unknown, or Parquet is requested with a compressed path.

get_summary_statistics(results)

Get summary statistics from analysis results.

Parameters:

Name Type Description Default
results CongestionInferenceResult

Analysis results.

required

Returns:

Type Description
dict

Summary statistics.