Skip to main content

A Python class for plotting frequency overlaps.

Project description

SpectroPlot

SpectroPlot is a Python class for loading frequency assignment data from Excel files, cleaning it, and plotting frequency overlaps by category. It’s designed for radio spectrum engineers, regulators, or analysts who want to visualize how frequency assignments stack up within different categories (e.g., services, technologies, or operators).

Example Plot


Features

✅ Load frequency ranges and categories directly from Excel
✅ Exclude specified entries (e.g., rows marked with Exclude='yes')
✅ Automatically clean, validate, and prepare data
✅ Plot frequency overlap "staircase" charts per category
✅ Flexible column naming
✅ Configurable frequency bounds
✅ Handles near-identical frequencies with epsilon tolerance


Requirements

  • Python 3.7+
  • pandas
  • matplotlib
  • openpyxl (required by pandas to read .xlsx)

Installing

# From PyPl
py -m pip install spectroplot  # on Windows
python3 -m pip install spectroplot  # on Unix/macOS

# From GitHub
py -m pip install spectroplot @ git+https://github.com/murzabaevb/spectroplot.git  # on Windows 
python3 -m pip install spectroplot @ git+https://github.com/murzabaevb/spectroplot.git  # on Unix/macOS

Expected Excel Format

Your Excel sheet must contain four columns, for example:

Category Start Stop Exclude
LTE 700.0 720.0
GSM 900.0 915.0 yes
5G 3500.0 3700.0
  • Category: name of the assignment category (e.g., LTE, GSM)
  • Start: start frequency (numeric)
  • Stop: end frequency (numeric)
  • Exclude: set to "yes" (case-insensitive) to exclude the row from plotting

Note: These four columns could be named differently in Excel file. If so, it is necessary to pass these headers when instantiating the object of the class as shown in the example below. Apart from these four columns, the Excel file may contain other columns that would be ignored during reading.


Usage Example

from spectroplot import SpectroPlot

# Initialize with your Excel file, default sheet name and column headers
sp = SpectroPlot(excel_file='data.xlsx')

# Load and clean data
sp.load_data()

# Plot overlaps
sp.plot()

Default values:

  • sheet_name='Sheet1,
  • columns=['Category', 'Start', 'Stop', 'Exclude']
from spectroplot import SpectroPlot
# Initialize with your Excel file and custom sheet/columns
sp = SpectroPlot(
    excel_file='assignments.xlsx',
    sheet_name='uhf',
    columns=['system', 'f_low', 'f_hi', 'excl'],
)

# Load and clean data
sp.load_data()

# Plot overlaps of entire data read
sp.plot()

# Or specify frequency bounds as per your requirement
sp.plot(min_freq=600, max_freq=4000)

Output

  • Generates a matplotlib plot with one subplot per category
  • Each plot shows the number of overlapping frequency assignments as a staircase
  • Colors are automatically assigned from the tab20 colormap

Parameters

SpectroPlot constructor:

  • excel_file: Path to your Excel file
  • sheet_name: Name of the worksheet to read (default: 'Sheet1')
  • columns: List of four column names in order (default: ['Category', 'Start', 'Stop', 'Exclude'])
  • epsilon: Tolerance for merging events with nearly identical frequencies (default: 1e-6)

plot() method:

  • min_freq: Lower frequency bound of plotting
  • max_freq: Upper frequency bound of plotting

License

MIT License. Feel free to use, modify, and contribute!


Project Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spectroplot-0.0.1.tar.gz (52.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spectroplot-0.0.1-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file spectroplot-0.0.1.tar.gz.

File metadata

  • Download URL: spectroplot-0.0.1.tar.gz
  • Upload date:
  • Size: 52.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for spectroplot-0.0.1.tar.gz
Algorithm Hash digest
SHA256 da4fc7c2db97614261a534d814af90f2971edf7507aa869af1ff53f24ad97eb1
MD5 cbabe8d839b93d4a1038381707ae96e0
BLAKE2b-256 d306a6c896c661a6b251f0246b26386b47dc2f936fcbe629b02b05dff2c30e15

See more details on using hashes here.

File details

Details for the file spectroplot-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: spectroplot-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for spectroplot-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3ea169808038e2b8537edcae82e33eae005933c1ead9aa2272309b1554b70288
MD5 60db2fa369134097e0f5d38d712b82fd
BLAKE2b-256 7d00104288b9184ee5d30111ebdfb2e4632bf37f079dd794aaa5904b70b6b0e4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page