kaira.utils.PlottingUtils

Inheritance diagram for PlottingUtils
- class kaira.utils.PlottingUtils[source]
Bases:
objectA comprehensive plotting utility class with static methods for visualization.
This class provides a centralized collection of plotting functions for various communication system analysis tasks including LDPC codes, modulation schemes, error rate analysis, signal processing, and more.
All methods are static to allow easy access without instantiation:
Example
fig = PlottingUtils.plot_ber_performance(snr_range, ber_values, labels)
Methods
Close all matplotlib figures to free memory.
Plot belief propagation iteration state.
Plot BER vs SNR performance curves.
Visualize bit errors in transmission.
Plot BLER vs SNR analysis.
Visualize block errors.
Plot blockwise operation visualization.
Plot channel capacity analysis for different channel types.
Plot the effects of a channel on transmitted signals.
Plot comparison of different code structures.
Plot coding gain vs SNR.
Plot complexity comparison charts.
Plot constellation diagram with optional received symbols.
Compare different error rate metrics.
Plot Hamming code structure visualization.
Plot latency distribution and statistics.
Plot comparison of LDPC code matrix structures.
Plot BER performance for multiple QAM orders.
Plot comparison of multiple error rate metrics.
Plot parity check syndrome and error pattern visualization.
Plot QAM constellation showing transmitted and received symbols.
Plot comprehensive signal analysis including time and frequency domain.
Plot spectral efficiency vs SNR for different modulation schemes.
Analyze symbol errors.
Create enhanced Tanner graph visualization.
Plot throughput comparison across different configurations.
Set up consistent plotting style for all examples.
Attributes
- BELIEF_CMAP = <matplotlib.colors.LinearSegmentedColormap object>
- MODERN_PALETTE = ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd']
- MATRIX_CMAP = <matplotlib.colors.LinearSegmentedColormap object>
- static plot_ldpc_matrix_comparison(H_matrices: List[Tensor], titles: List[str], main_title: str = 'LDPC Matrix Comparison') Figure[source]
Plot comparison of LDPC code matrix structures.
- Parameters:
H_matrices (List[torch.Tensor]) – List of parity check matrices to compare
titles (List[str]) – Titles for each matrix
main_title (str) – Overall plot title
- Returns:
The created figure
- Return type:
plt.Figure
- static plot_ber_performance(snr_range: ndarray, ber_values: List[ndarray], labels: List[str], title: str = 'BER vs SNR Performance', ylabel: str = 'Bit Error Rate') Figure[source]
Plot BER vs SNR performance curves.
- static plot_complexity_comparison(code_types: List[str], metrics: Dict[str, List[float]], title: str = 'Complexity Comparison') Figure[source]
Plot complexity comparison charts.
- static plot_tanner_graph(H: Tensor, title: str = 'LDPC Tanner Graph') Figure[source]
Create enhanced Tanner graph visualization.
- Parameters:
H (torch.Tensor) – Parity check matrix
title (str) – Plot title
- Returns:
The created figure
- Return type:
plt.Figure
- static plot_constellation(constellation: Tensor, received_symbols: Tensor | None = None, title: str = 'Constellation Diagram') Figure[source]
Plot constellation diagram with optional received symbols.
- Parameters:
constellation (torch.Tensor) – Ideal constellation points
received_symbols (Optional[torch.Tensor]) – Optional received symbols to overlay
title (str) – Plot title
- Returns:
The created figure
- Return type:
plt.Figure
- static plot_throughput_comparison(throughput_data: Dict[str, Any], title: str = 'Throughput Comparison') Figure[source]
Plot throughput comparison across different configurations.
- static plot_latency_distribution(latency_data: Dict[str, Any], title: str = 'Latency Distribution') Figure[source]
Plot latency distribution and statistics.
- static plot_coding_gain(snr_range: ndarray, coding_gain: ndarray, code_type: str = 'Unknown', title: str = 'Coding Gain') Figure[source]
Plot coding gain vs SNR.
- static plot_spectral_efficiency(snr_range: ndarray, spectral_efficiency: ndarray, modulation_types: List[str], title: str = 'Spectral Efficiency') Figure[source]
Plot spectral efficiency vs SNR for different modulation schemes.
- static plot_channel_effects(original_signal: Tensor, received_signal: Tensor, channel_name: str = 'Channel', title: str = 'Channel Effects') Figure[source]
Plot the effects of a channel on transmitted signals.
- Parameters:
original_signal (torch.Tensor) – Original transmitted signal
received_signal (torch.Tensor) – Signal after passing through channel
channel_name (str) – Name of the channel
title (str) – Plot title
- Returns:
The created figure
- Return type:
plt.Figure
- static plot_signal_analysis(signal: Tensor, signal_name: str = 'Signal', title: str = 'Signal Analysis') Figure[source]
Plot comprehensive signal analysis including time and frequency domain.
- Parameters:
signal (torch.Tensor) – Input signal to analyze
signal_name (str) – Name of the signal
title (str) – Plot title
- Returns:
The created figure
- Return type:
plt.Figure
- static plot_capacity_analysis(snr_range: ndarray, capacity_data: Dict[str, ndarray], title: str = 'Channel Capacity Analysis') Figure[source]
Plot channel capacity analysis for different channel types.
- static plot_belief_propagation_iteration(H: Tensor, beliefs: Tensor, iteration: int, title: str = 'Belief Propagation Iteration') Figure[source]
Plot belief propagation iteration state.
- Parameters:
H (torch.Tensor) – Parity check matrix
beliefs (torch.Tensor) – Current belief values
iteration (int) – Current iteration number
title (str) – Plot title
- Returns:
The created figure
- Return type:
plt.Figure
- static plot_blockwise_operation(input_blocks: List[Tensor], output_blocks: List[Tensor], operation_name: str = 'Blockwise Operation') Figure[source]
Plot blockwise operation visualization.
- Parameters:
input_blocks (List[torch.Tensor]) – Input blocks
output_blocks (List[torch.Tensor]) – Output blocks after operation
operation_name (str) – Name of the operation
- Returns:
The created figure
- Return type:
plt.Figure
- static plot_hamming_code_visualization(generator_matrix: Tensor, parity_check_matrix: Tensor, title: str = 'Hamming Code Structure') Figure[source]
Plot Hamming code structure visualization.
- Parameters:
generator_matrix (torch.Tensor) – Generator matrix
parity_check_matrix (torch.Tensor) – Parity check matrix
title (str) – Plot title
- Returns:
The created figure
- Return type:
plt.Figure
- static plot_parity_check_visualization(syndrome: Tensor, error_pattern: Tensor, title: str = 'Parity Check Analysis') Figure[source]
Plot parity check syndrome and error pattern visualization.
- Parameters:
syndrome (torch.Tensor) – Syndrome vector
error_pattern (torch.Tensor) – Error pattern
title (str) – Plot title
- Returns:
The created figure
- Return type:
plt.Figure
- static plot_code_structure_comparison(codes_data: Dict[str, Dict[str, Any]], title: str = 'Code Structure Comparison') Figure[source]
Plot comparison of different code structures.
- static plot_bit_error_visualization(original_bits: Tensor, errors: Tensor, received_bits: Tensor, title: str = 'Bit Error Analysis') Figure[source]
Visualize bit errors in transmission.
- Parameters:
original_bits (torch.Tensor) – Original transmitted bits
errors (torch.Tensor) – Error positions
received_bits (torch.Tensor) – Received bits
title (str) – Plot title
- Returns:
The created figure
- Return type:
plt.Figure
- static plot_error_rate_comparison(metrics: Dict[str, float], title: str = 'Error Rate Comparison') Figure[source]
Compare different error rate metrics.
- static plot_block_error_visualization(blocks_with_errors: Tensor, block_error_rate: float, title: str = 'Block Error Visualization') Figure[source]
Visualize block errors.
- Parameters:
blocks_with_errors (torch.Tensor) – Indicator of which blocks have errors
block_error_rate (float) – Overall block error rate
title (str) – Plot title
- Returns:
The created figure
- Return type:
plt.Figure
- static plot_qam_constellation_with_errors(transmitted: Tensor, received: Tensor, title: str = 'QAM Constellation with Errors') Figure[source]
Plot QAM constellation showing transmitted and received symbols.
- Parameters:
transmitted (torch.Tensor) – Transmitted constellation points
received (torch.Tensor) – Received constellation points
title (str) – Plot title
- Returns:
The created figure
- Return type:
plt.Figure
- static plot_symbol_error_analysis(error_mask: Tensor, ber: float, ser: float, title: str = 'Symbol Error Analysis') Figure[source]
Analyze symbol errors.
- Parameters:
error_mask (torch.Tensor) – Mask indicating which symbols have errors
ber (float) – Bit error rate
ser (float) – Symbol error rate
title (str) – Plot title
- Returns:
The created figure
- Return type:
plt.Figure
- static plot_multi_qam_ber_performance(snr_range: ndarray, ber_results: Dict[str, ndarray], ser_results: Dict[str, ndarray], qam_orders: Sequence[int]) Figure[source]
Plot BER performance for multiple QAM orders.
- static plot_bler_vs_snr_analysis(snr_range: ndarray, bler_data: Dict[str, ndarray], block_sizes: List[int]) Figure[source]
Plot BLER vs SNR analysis.
- static plot_multiple_metrics_comparison(snr_range: ndarray, metrics: Dict[str, ndarray], title: str = 'Multiple Metrics Comparison') Figure[source]
Plot comparison of multiple error rate metrics.
- __init__()