references:band_plan_with_swr
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
blog:2021-01-16:band_plan_with_swr [2021/01/16 20:54] – va7fi | references:band_plan_with_swr [2021/11/19 20:11] (current) – va7fi | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ~~NOTOC~~ | ||
====== Band Plan With SWR ====== | ====== Band Plan With SWR ====== | ||
- | {{ | + | {{ bandplanwithswr.png? |
- | A few weeks ago my external tuner kicked | + | This python script does two things: |
+ | - It reads all .asd output files from the Rig Expert that are placed in the same folder as this script | ||
+ | - It recreates | ||
- | After a few days of reading about '' | + | The HF band plan information was taken from \\ |
+ | https:// | ||
+ | |||
+ | The VHF and UHF band plan information is for British-Columbia | ||
+ | |||
+ | Here's the {{canbandplan.pdf |output of my G5RV and GP9}} so far: | ||
* The top of the band plan graph corresponds to SWR = 1:1, where the first dotted horizontal line is. | * The top of the band plan graph corresponds to SWR = 1:1, where the first dotted horizontal line is. | ||
* For HF, I also added a horizontal line at SWR = 3:1, which is where my internal tuner can reach. | * For HF, I also added a horizontal line at SWR = 3:1, which is where my internal tuner can reach. | ||
* And the top of the graph is at SWR = 10:1, which is where most external tuners can reach. | * And the top of the graph is at SWR = 10:1, which is where most external tuners can reach. | ||
+ | * The red graph is the SWR curve. | ||
+ | |||
+ | <fc # | ||
+ | |||
+ | <hidden Python Code> | ||
+ | <code python> | ||
+ | # | ||
+ | # -*- coding: utf-8 -*- | ||
+ | """ | ||
+ | Created on Fri Jan 29 16:40:41 2021 | ||
+ | |||
+ | License: | ||
+ | This script by Patrick Truchon < | ||
+ | under a Creative Commons Creative Commons Attribution-Share Alike 4.0 | ||
+ | | ||
+ | |||
+ | You are free to: | ||
+ | * Run the scripts for any purpose. | ||
+ | * Study and modify the scripts. | ||
+ | * Copy the scripts to help others. | ||
+ | * Improve the scripts, and release the improvements to the public, so | ||
+ | that the whole community benefits. | ||
+ | |||
+ | | ||
+ | * Attribute the work to me by linking to | ||
+ | < | ||
+ | * Distribute any derivative work under the same license. | ||
+ | |||
+ | This script does two things: | ||
+ | 1) It reads all .asd output files from the Rig Expert that are placed | ||
+ | in the same folder as this script and calculates the VSWR as a function | ||
+ | of the frequency. | ||
+ | 2) It recreates the band plan for all bands from 2200m to 70cm and adds | ||
+ | VSWR graphs on top of it. | ||
+ | |||
+ | For HF, the band plan information was taken from: | ||
+ | | ||
+ | |||
+ | For VHF and UHF, the band plan information is for British-Columbia and | ||
+ | was taken from: | ||
+ | | ||
+ | """ | ||
+ | |||
+ | import numpy as np | ||
+ | import matplotlib.pyplot as plt | ||
+ | import matplotlib.ticker as mtick | ||
+ | from matplotlib.backends.backend_pdf import PdfPages | ||
+ | import json | ||
+ | import os | ||
+ | |||
+ | # The output will be a multipage PDF document: | ||
+ | pdf_pages = PdfPages(' | ||
+ | TITLE = ' | ||
+ | |||
+ | #### Import SWR Data from Rig Expert .asd files #### | ||
+ | # Make a list of the .asd files in current folder and sort them by name. | ||
+ | PATH = r" | ||
+ | DIR = os.listdir( PATH ) | ||
+ | FILES = [] | ||
+ | for file in DIR: | ||
+ | if file.endswith(" | ||
+ | FILES = FILES + [file] | ||
+ | FILES.sort() | ||
+ | |||
+ | # Read FILES list and create lists for Frequencies, | ||
+ | FREQ = [] | ||
+ | RESISTANCE = [] | ||
+ | REACTANCE = [] | ||
+ | for file in FILES: | ||
+ | with open (file, " | ||
+ | SIZE = len(raw[' | ||
+ | FREQ = [raw[' | ||
+ | | ||
+ | + RESISTANCE | ||
+ | | ||
+ | + REACTANCE | ||
+ | |||
+ | # Convert lists to Numpy arrays | ||
+ | FREQ = np.array(FREQ, | ||
+ | RESISTANCE = np.array(RESISTANCE, | ||
+ | REACTANCE = np.array(REACTANCE, | ||
+ | |||
+ | ## Two steps to calculate the VSWR from the Resistance and Reactance: | ||
+ | # 1) Rho = sqrt( ((R - 50)^2 + X^2)/(R + 50)^2 + X^2) ) | ||
+ | RHO = np.sqrt(np.divide(np.square(RESISTANCE - 50) + np.square(REACTANCE), | ||
+ | | ||
+ | |||
+ | # 2) VSWR = (1 + Rho) / (1 - Rho) | ||
+ | VSWR = np.divide(1 + RHO, 1 - RHO) | ||
+ | |||
+ | # Sort the Frequencies and VSWR by Frequencies | ||
+ | VSWR = VSWR[np.argsort(FREQ)] | ||
+ | FREQ = FREQ[np.argsort(FREQ)] | ||
+ | |||
+ | # Create Horizontal lines at 1, 3, and 10 | ||
+ | VSWR1 = len(FREQ)*[1] | ||
+ | VSWR3 = len(FREQ)*[3] | ||
+ | VSWR10 = len(FREQ)*[10] | ||
+ | |||
+ | #### Common Graphing Parameters | ||
+ | # Colours: | ||
+ | CW = ' | ||
+ | DIGI = ' | ||
+ | PHONE = ' | ||
+ | TV = ' | ||
+ | BEACON = ' | ||
+ | MISC = ' | ||
+ | OVERVIEW = ' | ||
+ | SWRCOLOUR = ' | ||
+ | |||
+ | # Vertical coordinates of labels | ||
+ | label1_y = -0.81 # Lower label | ||
+ | label2_y = -0.4 # Centre label | ||
+ | label3_y = 0.1 # Top label | ||
+ | label4_y = 8.5 # Very top band name | ||
+ | |||
+ | # Vertical Axis Marks | ||
+ | y_ticks = [1, 3, 5, 10] | ||
+ | |||
+ | |||
+ | #### FIRST PAGE: 2200m to 20m | ||
+ | # Axes: 7 graphs in a 8.5x11 page. | ||
+ | fig, ax = plt.subplots(nrows=7, | ||
+ | |||
+ | # Title on first [0] graph only | ||
+ | ax[0].set(title=TITLE) | ||
+ | |||
+ | # Axis labels | ||
+ | for i in range(0,7): | ||
+ | | ||
+ | # SWR Data | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | |||
+ | ### 2200m | ||
+ | i = 0 # First graph | ||
+ | left = 0.1355 | ||
+ | right = 0.138 # Right edge | ||
+ | ax[i].set_xlim(left, | ||
+ | ax[i].set_ylim(-1, | ||
+ | |||
+ | # Frequency labels: | ||
+ | x1 = 0.1357 | ||
+ | x2 = 0.1374 | ||
+ | x3 = 0.1376 | ||
+ | x4 = 0.1378 | ||
+ | xlabels = [x1, x2, x3, x4] | ||
+ | |||
+ | # Bar Graphs | ||
+ | ax[i].broken_barh([(x1, | ||
+ | ax[i].broken_barh([(x2, | ||
+ | ax[i].broken_barh([(x3, | ||
+ | |||
+ | # Labels | ||
+ | ax[i].text(left, | ||
+ | ax[i].text(0.13655, | ||
+ | ax[i].text(0.13747, | ||
+ | ax[i].text(0.13765, | ||
+ | |||
+ | # Axis | ||
+ | ax[i].set_xlim((left, | ||
+ | ax[i].set_xticks(xlabels) | ||
+ | ax[i].set_ylim((-1, | ||
+ | ax[i].set_yticks(y_ticks) | ||
+ | ax[i].set_xticklabels(xlabels, | ||
+ | |||
+ | |||
+ | ### 160m | ||
+ | i = 1 | ||
+ | left = 1.775 | ||
+ | right = 2.025 | ||
+ | ax[i].set_xlim(left, | ||
+ | ax[i].set_ylim(-1, | ||
+ | |||
+ | # Frequency labels: | ||
+ | x1 = 1.800 | ||
+ | x2 = 1.810 | ||
+ | x3 = 1.840 | ||
+ | x4 = 2.000 | ||
+ | xlabels = [x1, x2, x3, x4] | ||
+ | |||
+ | # Bar Graphs | ||
+ | ax[i].broken_barh([(x1, | ||
+ | ax[i].broken_barh([(x1, | ||
+ | ax[i].broken_barh([(x3, | ||
+ | |||
+ | # Labels | ||
+ | ax[i].text(left, | ||
+ | ax[i].text(1.817, | ||
+ | ax[i].text(1.915, | ||
+ | ax[i].text(1.801, | ||
+ | |||
+ | # Axis | ||
+ | ax[i].set_xlim((left, | ||
+ | ax[i].set_xticks(xlabels) | ||
+ | ax[i].set_ylim((-1, | ||
+ | ax[i].set_yticks(y_ticks) | ||
+ | ax[i].set_xticklabels(xlabels, | ||
+ | ax[i].xaxis.set_major_formatter(mtick.FormatStrFormatter(' | ||
+ | |||
+ | |||
+ | #### 80m | ||
+ | i = 2 | ||
+ | left = 3.450 | ||
+ | right = 4.050 | ||
+ | ax[i].set_xlim(left, | ||
+ | ax[i].set_ylim(-1, | ||
+ | |||
+ | # Frequency labels: | ||
+ | x1 = 3.5 | ||
+ | x2 = 3.58 | ||
+ | x3 = 3.589 | ||
+ | x4 = 3.6 | ||
+ | x5 = 3.842 | ||
+ | x6 = 3.845 | ||
+ | x7 = 4 | ||
+ | xlabels = [x1, x2, x4, x5, x7] | ||
+ | |||
+ | # Bar Graphs | ||
+ | ax[i].broken_barh([(x1, | ||
+ | ax[i].broken_barh([(x2, | ||
+ | ax[i].broken_barh([(x3, | ||
+ | ax[i].broken_barh([(x4, | ||
+ | ax[i].broken_barh([(x5, | ||
+ | |||
+ | # Labels | ||
+ | ax[i].text(left, | ||
+ | ax[i].text(3.536, | ||
+ | ax[i].text(3.592, | ||
+ | ax[i].text(3.725, | ||
+ | ax[i].text(3.839, | ||
+ | ax[i].text(3.91, | ||
+ | |||
+ | # Axis | ||
+ | ax[i].set_xlim((left, | ||
+ | ax[i].set_xticks(xlabels) | ||
+ | ax[i].set_ylim((-1, | ||
+ | ax[i].set_yticks(y_ticks) | ||
+ | ax[i].set_xticklabels(xlabels, | ||
+ | ax[i].xaxis.set_major_formatter(mtick.FormatStrFormatter(' | ||
+ | |||
+ | |||
+ | # 60m | ||
+ | i = 3 | ||
+ | left = 5.325 | ||
+ | right = 5.411 | ||
+ | ax[i].set_xlim(left, | ||
+ | ax[i].set_ylim(-1, | ||
+ | |||
+ | # Frequency labels: | ||
+ | x1 = 5.3306 | ||
+ | x2 = 5.3466 | ||
+ | x3 = 5.3571 | ||
+ | x4 = 5.3716 | ||
+ | x5 = 5.4036 | ||
+ | xlabels = [x1, x1 + 0.0028, x2, x2 + 0.0028, x3, x3 + 0.0028, | ||
+ | x4, x4 + 0.0028, x5, x5 + 0.0028] | ||
+ | |||
+ | # Bar Graphs | ||
+ | ax[i].broken_barh([(x1, | ||
+ | ax[i].broken_barh([(x1, | ||
+ | ax[i].broken_barh([(x1, | ||
+ | ax[i].broken_barh([(x2, | ||
+ | ax[i].broken_barh([(x2, | ||
+ | ax[i].broken_barh([(x2, | ||
+ | ax[i].broken_barh([(x3, | ||
+ | ax[i].broken_barh([(x3, | ||
+ | ax[i].broken_barh([(x3, | ||
+ | ax[i].broken_barh([(x4, | ||
+ | ax[i].broken_barh([(x4, | ||
+ | ax[i].broken_barh([(x4, | ||
+ | ax[i].broken_barh([(x5, | ||
+ | ax[i].broken_barh([(x5, | ||
+ | ax[i].broken_barh([(x5, | ||
+ | |||
+ | # Labels | ||
+ | ax[i].text(left, | ||
+ | ax[i].text(5.331, | ||
+ | ax[i].text(5.331, | ||
+ | ax[i].text(5.331, | ||
+ | |||
+ | # Axis | ||
+ | ax[i].set_xlim((left, | ||
+ | ax[i].set_xticks(xlabels) | ||
+ | ax[i].set_ylim((-1, | ||
+ | ax[i].set_yticks(y_ticks) | ||
+ | ax[i].set_xticklabels(xlabels, | ||
+ | ax[i].xaxis.set_major_formatter(mtick.FormatStrFormatter(' | ||
+ | |||
+ | |||
+ | # 40m | ||
+ | i = 4 | ||
+ | left = 6.975 | ||
+ | right = 7.325 | ||
+ | ax[i].set_xlim(left, | ||
+ | ax[i].set_ylim(-1, | ||
+ | |||
+ | # Frequency labels: | ||
+ | x1 = 7 | ||
+ | x2 = 7.035 | ||
+ | x3 = 7.04 | ||
+ | x4 = 7.07 | ||
+ | x5 = 7.125 | ||
+ | x6 = 7.165 | ||
+ | x7 = 7.175 | ||
+ | x8 = 7.3 | ||
+ | xlabels = [x1, x3, x4, x5, x6, x7, x8] | ||
+ | |||
+ | # Bar Graphs | ||
+ | ax[i].broken_barh([(x1, | ||
+ | ax[i].broken_barh([(x2, | ||
+ | ax[i].broken_barh([(x3, | ||
+ | ax[i].broken_barh([(x4, | ||
+ | ax[i].broken_barh([(x6, | ||
+ | |||
+ | # Labels | ||
+ | ax[i].text(left, | ||
+ | ax[i].text(7.015, | ||
+ | ax[i].text(7.0355, | ||
+ | ax[i].text(7.093, | ||
+ | ax[i].text(7.105, | ||
+ | ax[i].text(7.167, | ||
+ | ax[i].text(7.23, | ||
+ | |||
+ | # Axis | ||
+ | ax[i].set_xlim((left, | ||
+ | ax[i].set_xticks(xlabels) | ||
+ | ax[i].set_ylim((-1, | ||
+ | ax[i].set_yticks(y_ticks) | ||
+ | ax[i].set_xticklabels(xlabels, | ||
+ | ax[i].xaxis.set_major_formatter(mtick.FormatStrFormatter(' | ||
+ | |||
+ | |||
+ | # 30m | ||
+ | i = 5 | ||
+ | left = 10.095 | ||
+ | right = 10.155 | ||
+ | ax[i].set_xlim(left, | ||
+ | ax[i].set_ylim(-1, | ||
+ | |||
+ | # Frequency labels: | ||
+ | x1 = 10.1 | ||
+ | x2 = 10.13 | ||
+ | x3 = 10.14 | ||
+ | x4 = 10.15 | ||
+ | xlabels = [x1, x2, x3, x4] | ||
+ | |||
+ | # Bar Graphs | ||
+ | ax[i].broken_barh([(x1, | ||
+ | ax[i].broken_barh([(x2, | ||
+ | ax[i].broken_barh([(x3, | ||
+ | |||
+ | # Labels | ||
+ | ax[i].text(left, | ||
+ | ax[i].text(10.115, | ||
+ | ax[i].text(10.1345, | ||
+ | ax[i].text(10.1445, | ||
+ | |||
+ | # Axis | ||
+ | ax[i].set_xlim((left, | ||
+ | ax[i].set_xticks(xlabels) | ||
+ | ax[i].set_ylim((-1, | ||
+ | ax[i].set_yticks(y_ticks) | ||
+ | ax[i].set_xticklabels(xlabels, | ||
+ | ax[i].xaxis.set_major_formatter(mtick.FormatStrFormatter(' | ||
+ | |||
+ | |||
+ | # 20m | ||
+ | i = 6 | ||
+ | left = 13.97 | ||
+ | right = 14.38 | ||
+ | ax[i].set_xlim(left, | ||
+ | ax[i].set_ylim(-1, | ||
+ | |||
+ | # Frequency labels: | ||
+ | x1 = 14 | ||
+ | x2 = 14.07 | ||
+ | x3 = 14.073 | ||
+ | x4 = 14.1005 | ||
+ | x5 = 14.112 | ||
+ | x6 = 14.230 | ||
+ | x7 = 14.236 | ||
+ | x8 = 14.350 | ||
+ | xlabels = [x1, x2, x5, x6, x8] | ||
+ | |||
+ | # Bar Graphs | ||
+ | ax[i].broken_barh([(x1, | ||
+ | ax[i].broken_barh([(x2, | ||
+ | ax[i].broken_barh([(x3, | ||
+ | ax[i].broken_barh([(x5, | ||
+ | ax[i].broken_barh([(x6, | ||
+ | |||
+ | # Labels | ||
+ | ax[i].text(left, | ||
+ | ax[i].text(14.033, | ||
+ | ax[i].text(14.082, | ||
+ | ax[i].text(14.087, | ||
+ | ax[i].text(14.17, | ||
+ | ax[i].text(14.229, | ||
+ | ax[i].text(14.28, | ||
+ | |||
+ | # Axis | ||
+ | ax[i].set_xlim((left, | ||
+ | ax[i].set_xticks(xlabels) | ||
+ | ax[i].set_ylim((-1, | ||
+ | ax[i].set_yticks(y_ticks) | ||
+ | ax[i].set_xticklabels(xlabels, | ||
+ | ax[i].xaxis.set_major_formatter(mtick.FormatStrFormatter(' | ||
+ | |||
+ | |||
+ | ### Print First Page | ||
+ | fig.tight_layout() | ||
+ | pdf_pages.savefig(fig) | ||
+ | # | ||
+ | |||
+ | |||
+ | |||
+ | #### SECOND PAGE: 17m - 70cm | ||
+ | # Axes | ||
+ | fig2, ax = plt.subplots(nrows=7, | ||
+ | |||
+ | # Axis labels | ||
+ | for i in range(0,7): | ||
+ | | ||
+ | # SWR Data | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | |||
+ | # 17m | ||
+ | i = 0 | ||
+ | left = 18.06 | ||
+ | right = 18.18 | ||
+ | ax[i].set_xlim(left, | ||
+ | ax[i].set_ylim(-1, | ||
+ | |||
+ | # Frequency labels: | ||
+ | x1 = 18.068 | ||
+ | x2 = 18.095 | ||
+ | x3 = 18.1 | ||
+ | x4 = 18.11 | ||
+ | x5 = 18.168 | ||
+ | xlabels = [x1, x2, x3, x4, x5] | ||
+ | |||
+ | # Bar Graphs | ||
+ | ax[i].broken_barh([(x1, | ||
+ | ax[i].broken_barh([(x2, | ||
+ | ax[i].broken_barh([(x3, | ||
+ | ax[i].broken_barh([(x4, | ||
+ | |||
+ | # Labels | ||
+ | ax[i].text(left, | ||
+ | ax[i].text(18.082, | ||
+ | ax[i].text(18.102, | ||
+ | ax[i].text(18.135, | ||
+ | |||
+ | # Axis | ||
+ | ax[i].set_xlim((left, | ||
+ | ax[i].set_xticks(xlabels) | ||
+ | ax[i].set_ylim((-1, | ||
+ | ax[i].set_yticks(y_ticks) | ||
+ | ax[i].set_xticklabels(xlabels, | ||
+ | ax[i].xaxis.set_major_formatter(mtick.FormatStrFormatter(' | ||
+ | |||
+ | |||
+ | # 15m | ||
+ | i = 1 | ||
+ | left = 20.97 | ||
+ | right = 21.48 | ||
+ | ax[i].set_xlim(left, | ||
+ | ax[i].set_ylim(-1, | ||
+ | |||
+ | # Frequency labels: | ||
+ | x1 = 21 | ||
+ | x2 = 21.07 | ||
+ | x3 = 21.08 | ||
+ | x4 = 21.083 | ||
+ | x5 = 21.09 | ||
+ | x6 = 21.125 | ||
+ | x7 = 21.150 | ||
+ | x8 = 21.340 | ||
+ | x9 = 21.343 | ||
+ | x10 = 21.450 | ||
+ | xlabels = [x1, x2, x6, x7, x8, x10] | ||
+ | |||
+ | # Bar Graphs | ||
+ | ax[i].broken_barh([(x1, | ||
+ | ax[i].broken_barh([(x2, | ||
+ | ax[i].broken_barh([(x2-.01, | ||
+ | ax[i].broken_barh([(x4, | ||
+ | ax[i].broken_barh([(x6, | ||
+ | ax[i].broken_barh([(x7, | ||
+ | ax[i].broken_barh([(x8, | ||
+ | |||
+ | # Labels | ||
+ | ax[i].text(left, | ||
+ | ax[i].text(21.03, | ||
+ | ax[i].text(21.095, | ||
+ | ax[i].text(21.13, | ||
+ | ax[i].text(21.24, | ||
+ | ax[i].text(21.337, | ||
+ | ax[i].text(21.39, | ||
+ | |||
+ | # Axis | ||
+ | ax[i].set_xlim((left, | ||
+ | ax[i].set_xticks(xlabels) | ||
+ | ax[i].set_ylim((-1, | ||
+ | ax[i].set_yticks(y_ticks) | ||
+ | ax[i].set_xticklabels(xlabels, | ||
+ | ax[i].xaxis.set_major_formatter(mtick.FormatStrFormatter(' | ||
+ | |||
+ | |||
+ | # 12m | ||
+ | i = 2 | ||
+ | left = 24.88 | ||
+ | right = 25 | ||
+ | ax[i].set_xlim(left, | ||
+ | ax[i].set_ylim(-1, | ||
+ | |||
+ | # Frequency labels: | ||
+ | x1 = 24.89 | ||
+ | x2 = 24.92 | ||
+ | x3 = 24.925 | ||
+ | x4 = 24.94 | ||
+ | x5 = 24.975 | ||
+ | x6 = 24.978 | ||
+ | x7 = 24.990 | ||
+ | xlabels = [x1, x2, x3, x4, x5, x7] | ||
+ | |||
+ | # Bar Graphs | ||
+ | ax[i].broken_barh([(x1, | ||
+ | ax[i].broken_barh([(x2, | ||
+ | ax[i].broken_barh([(x3, | ||
+ | ax[i].broken_barh([(x4, | ||
+ | ax[i].broken_barh([(x5, | ||
+ | |||
+ | # Labels | ||
+ | ax[i].text(left, | ||
+ | ax[i].text(24.904, | ||
+ | ax[i].text(24.9205, | ||
+ | ax[i].text(24.93, | ||
+ | ax[i].text(24.956, | ||
+ | ax[i].text(24.9755, | ||
+ | ax[i].text(24.982, | ||
+ | |||
+ | # Axis | ||
+ | ax[i].set_xlim((left, | ||
+ | ax[i].set_xticks(xlabels) | ||
+ | ax[i].set_ylim((-1, | ||
+ | ax[i].set_yticks(y_ticks) | ||
+ | ax[i].set_xticklabels(xlabels, | ||
+ | ax[i].xaxis.set_major_formatter(mtick.FormatStrFormatter(' | ||
+ | |||
+ | |||
+ | # 10m | ||
+ | i = 3 | ||
+ | left = 27.9 | ||
+ | right = 29.8 | ||
+ | ax[i].set_xlim(left, | ||
+ | ax[i].set_ylim(-1, | ||
+ | |||
+ | # Frequency labels: | ||
+ | x1 = 28 | ||
+ | x2 = 28.07 | ||
+ | x3 = 28.1895 | ||
+ | x4 = 28.2005 | ||
+ | x5 = 28.3 | ||
+ | x6 = 28.32 | ||
+ | x7 = 28.68 | ||
+ | x8 = 28.683 | ||
+ | x9 = 29.3 | ||
+ | x10 = 29.52 | ||
+ | x11 = 29.7 | ||
+ | xlabels = [x1, x2, x3, x6, x7, x9, x10, x11] | ||
+ | |||
+ | # Bar Graphs | ||
+ | ax[i].broken_barh([(x1, | ||
+ | ax[i].broken_barh([(x2, | ||
+ | ax[i].broken_barh([(x3, | ||
+ | ax[i].broken_barh([(x3, | ||
+ | ax[i].broken_barh([(x6, | ||
+ | ax[i].broken_barh([(x7, | ||
+ | ax[i].broken_barh([(x9, | ||
+ | |||
+ | # Labels | ||
+ | ax[i].text(left, | ||
+ | ax[i].text(28.015, | ||
+ | ax[i].text(28.1, | ||
+ | ax[i].text(28.24, | ||
+ | ax[i].text(28.2, | ||
+ | ax[i].text(28.301, | ||
+ | ax[i].text(28.47, | ||
+ | ax[i].text(28.665, | ||
+ | ax[i].text(28.95, | ||
+ | ax[i].text(29.39, | ||
+ | ax[i].text(29.59, | ||
+ | |||
+ | # Axis | ||
+ | ax[i].set_xlim((left, | ||
+ | ax[i].set_xticks(xlabels) | ||
+ | ax[i].set_ylim((-1, | ||
+ | ax[i].set_yticks(y_ticks) | ||
+ | ax[i].set_xticklabels(xlabels, | ||
+ | ax[i].xaxis.set_major_formatter(mtick.FormatStrFormatter(' | ||
+ | |||
+ | |||
+ | # 6m | ||
+ | i = 4 | ||
+ | left = 49.7 | ||
+ | right = 54.3 | ||
+ | ax[i].set_xlim(left, | ||
+ | ax[i].set_ylim(-1, | ||
+ | |||
+ | # Frequency labels: | ||
+ | x1 = 50 | ||
+ | x2 = 50.1 | ||
+ | x3 = 50.6 | ||
+ | x4 = 51 | ||
+ | x5 = 51.1 | ||
+ | x6 = 52 | ||
+ | x7 = 53 | ||
+ | x8 = 54 | ||
+ | xlabels = [x1, x3, x5, x6, x7, x8] | ||
+ | |||
+ | # Bar Graphs | ||
+ | ax[i].broken_barh([(x1, | ||
+ | ax[i].broken_barh([(x1, | ||
+ | ax[i].broken_barh([(x1, | ||
+ | ax[i].broken_barh([(x3, | ||
+ | ax[i].broken_barh([(x4, | ||
+ | ax[i].broken_barh([(x5, | ||
+ | ax[i].broken_barh([(x5-0.003, | ||
+ | ax[i].broken_barh([(x6-0.003, | ||
+ | ax[i].broken_barh([(x7-0.003, | ||
+ | |||
+ | # Label | ||
+ | ax[i].text(left, | ||
+ | ax[i].text(50.25, | ||
+ | ax[i].text(50, | ||
+ | ax[i].text(50, | ||
+ | ax[i].text(50.63, | ||
+ | ax[i].text(51, | ||
+ | ax[i].text(51, | ||
+ | ax[i].text(51.35, | ||
+ | ax[i].text(51.43, | ||
+ | ax[i].text(52.2, | ||
+ | ax[i].text(53.2, | ||
+ | |||
+ | # Axis | ||
+ | ax[i].set_xlim((left, | ||
+ | ax[i].set_xticks(xlabels) | ||
+ | ax[i].set_ylim((-1, | ||
+ | ax[i].set_yticks(y_ticks) | ||
+ | ax[i].set_xticklabels(xlabels, | ||
+ | ax[i].xaxis.set_major_formatter(mtick.FormatStrFormatter(' | ||
+ | |||
+ | |||
+ | # Re-define vertical coordinates of labels for 2m and 70cm | ||
+ | label1_y = 0.73 # Lower label | ||
+ | label2_y = 0.79 # Centre label | ||
+ | label3_y = 0.88 # Top label | ||
+ | label4_y = 1.92 # Very top band name | ||
+ | |||
+ | # 2m https:// | ||
+ | i = 5 | ||
+ | left = 143.9 | ||
+ | right = 148.1 | ||
+ | ax[i].set_xlim(left, | ||
+ | ax[i].set_ylim(0.7, | ||
+ | |||
+ | # Frequency labels: | ||
+ | ax[i].text(left, | ||
+ | xlabels= [144, 148] | ||
+ | |||
+ | # Misc | ||
+ | ax[i].broken_barh([(144, | ||
+ | ax[i].text(144.13, | ||
+ | |||
+ | # Digital Group 1 | ||
+ | xlabels= xlabels + [144.370] | ||
+ | ax[i].broken_barh([(144.37, | ||
+ | ax[i].text(144.37, | ||
+ | |||
+ | # Repeater Group 1 and 2 | ||
+ | xlabels= xlabels + [144.51, 145.11] | ||
+ | ax[i].broken_barh([(144.51, | ||
+ | ax[i].broken_barh([(145.11, | ||
+ | ax[i].text(145.115, | ||
+ | ax[i].text(145.115, | ||
+ | ax[i].text(144.515, | ||
+ | ax[i].text(144.515, | ||
+ | ax[i].text(145.27, | ||
+ | ax[i].text(144.67, | ||
+ | ax[i].broken_barh([(144.59, | ||
+ | ax[i].broken_barh([(145.19, | ||
+ | |||
+ | # Digital Repeater Group 1 and 2 | ||
+ | xlabels= xlabels + [144.91, 145.51] | ||
+ | ax[i].broken_barh([(144.91, | ||
+ | ax[i].broken_barh([(145.51, | ||
+ | ax[i].text(144.91, | ||
+ | ax[i].text(144.91, | ||
+ | ax[i].text(145.51, | ||
+ | ax[i].text(145.51, | ||
+ | ax[i].text(145.01, | ||
+ | ax[i].text(145.01, | ||
+ | ax[i].text(145.61, | ||
+ | ax[i].text(145.61, | ||
+ | |||
+ | # Repeater Group 3 | ||
+ | xlabels= xlabels + [146.02, 146.62] | ||
+ | ax[i].broken_barh([(146.02, | ||
+ | ax[i].broken_barh([(146.62, | ||
+ | ax[i].text(146.1, | ||
+ | ax[i].text(146.7, | ||
+ | |||
+ | # Repeater Group 4 | ||
+ | xlabels= xlabels + [147, 147.6] | ||
+ | ax[i].broken_barh([(147, | ||
+ | ax[i].broken_barh([(147.6, | ||
+ | ax[i].text(147.1, | ||
+ | ax[i].text(147.7, | ||
+ | |||
+ | # Digital Simplex | ||
+ | xlabels= xlabels + [145.71] | ||
+ | ax[i].broken_barh([(145.71, | ||
+ | ax[i].text(145.71, | ||
+ | |||
+ | # Satellite | ||
+ | xlabels= xlabels + [145.8] | ||
+ | ax[i].broken_barh([(145.8, | ||
+ | ax[i].text(145.85, | ||
+ | |||
+ | # FM Simplex | ||
+ | xlabels= xlabels + [146.415] | ||
+ | ax[i].broken_barh([(146.415, | ||
+ | ax[i].broken_barh([(147.6, | ||
+ | ax[i].text(146.415, | ||
+ | ax[i].text(147.7, | ||
+ | |||
+ | # Internet Linked Simplex | ||
+ | xlabels= xlabels + [147.42] | ||
+ | ax[i].broken_barh([(147.42, | ||
+ | ax[i].text(147.42, | ||
+ | ax[i].text(147.42, | ||
+ | |||
+ | # Axis | ||
+ | ax[i].set_xlim((left, | ||
+ | ax[i].set_xticks(xlabels) | ||
+ | ax[i].set_xticklabels(xlabels, | ||
+ | ax[i].xaxis.set_major_formatter(mtick.FormatStrFormatter(' | ||
+ | |||
+ | |||
+ | # 70cm https:// | ||
+ | i = 6 | ||
+ | left = 429.5 | ||
+ | right = 450.5 | ||
+ | ax[i].set_xlim(left, | ||
+ | ax[i].set_ylim(0.7, | ||
+ | |||
+ | # Frequency labels: | ||
+ | ax[i].text(left, | ||
+ | xlabels= [430, 450] | ||
+ | |||
+ | # Packet Trunked Repeaters | ||
+ | xlabels= xlabels + [439.05] | ||
+ | ax[i].broken_barh([(430.05, | ||
+ | ax[i].text(430.05, | ||
+ | ax[i].text(430.05, | ||
+ | ax[i].broken_barh([(439.05, | ||
+ | ax[i].text(439.05, | ||
+ | ax[i].text(439.05, | ||
+ | |||
+ | # Not allocated | ||
+ | xlabels= xlabels + [431] | ||
+ | ax[i].broken_barh([(431, | ||
+ | |||
+ | # Misc | ||
+ | xlabels= xlabels + [431.5] | ||
+ | ax[i].broken_barh([(431.5, | ||
+ | ax[i].text(432, | ||
+ | |||
+ | # Digi Output | ||
+ | xlabels= xlabels + [433.025] | ||
+ | ax[i].broken_barh([(433.025, | ||
+ | ax[i].text(433.025, | ||
+ | ax[i].text(433.025, | ||
+ | |||
+ | # Digi Input | ||
+ | xlabels= xlabels + [438.025] | ||
+ | ax[i].broken_barh([(438.025, | ||
+ | ax[i].text(438.025, | ||
+ | ax[i].text(438.025, | ||
+ | |||
+ | # Repeater Output | ||
+ | xlabels= xlabels + [434.025] | ||
+ | ax[i].broken_barh([(434.025, | ||
+ | ax[i].text(434.025, | ||
+ | ax[i].text(434.025, | ||
+ | |||
+ | # Repeater Input FIXME | ||
+ | #xlabels= xlabels + [439.025] | ||
+ | ax[i].broken_barh([(439.025, | ||
+ | # | ||
+ | # | ||
+ | |||
+ | # Sat | ||
+ | xlabels= xlabels + [435] | ||
+ | ax[i].broken_barh([(435, | ||
+ | ax[i].text(436.3, | ||
+ | |||
+ | # Digital and link repeaters, except where used by IC Output | ||
+ | xlabels= xlabels + [440.025] | ||
+ | ax[i].broken_barh([(440.025, | ||
+ | ax[i].text(440.025, | ||
+ | ax[i].text(440.025, | ||
+ | |||
+ | # Digital and link repeaters, except where used by IC Input | ||
+ | xlabels= xlabels + [445.025] | ||
+ | ax[i].broken_barh([(445.025, | ||
+ | ax[i].text(445.025, | ||
+ | ax[i].text(445.025, | ||
+ | |||
+ | # Simplex Point-to-Point links | ||
+ | xlabels= xlabels + [441] | ||
+ | ax[i].broken_barh([(441, | ||
+ | ax[i].text(440.9, | ||
+ | ax[i].text(441, | ||
+ | |||
+ | # FM Repeaters Output | ||
+ | xlabels= xlabels + [442] | ||
+ | ax[i].broken_barh([(442, | ||
+ | ax[i].text(442, | ||
+ | ax[i].text(442, | ||
+ | |||
+ | # FM Repeaters Input | ||
+ | xlabels= xlabels + [447] | ||
+ | ax[i].broken_barh([(447, | ||
+ | ax[i].text(447, | ||
+ | ax[i].text(447, | ||
+ | |||
+ | # FM Repeaters Output | ||
+ | xlabels= xlabels + [443.025] | ||
+ | ax[i].broken_barh([(443.025, | ||
+ | ax[i].text(443.025, | ||
+ | ax[i].text(443.025, | ||
+ | |||
+ | # FM Repeaters Input | ||
+ | xlabels= xlabels + [448.025] | ||
+ | ax[i].broken_barh([(448.025, | ||
+ | ax[i].text(448.025, | ||
+ | ax[i].text(448.025, | ||
+ | |||
+ | # FM Simplex | ||
+ | xlabels= xlabels + [446] | ||
+ | ax[i].broken_barh([(446, | ||
+ | ax[i].text(446, | ||
+ | |||
+ | |||
+ | # Axis | ||
+ | ax[i].set_xlim((left, | ||
+ | ax[i].set_xticks(xlabels) | ||
+ | ax[i].set_xticklabels(xlabels, | ||
+ | ax[i].xaxis.set_major_formatter(mtick.FormatStrFormatter(' | ||
+ | |||
+ | |||
+ | # Print second page | ||
+ | fig2.tight_layout() | ||
+ | pdf_pages.savefig(fig2) | ||
+ | # | ||
+ | # | ||
+ | |||
+ | |||
+ | ## Third Page | ||
+ | |||
+ | # Axis: 2 graphs on a 11x8.5 sheet (landscape) | ||
+ | fig3, ax = plt.subplots(nrows=2, | ||
+ | |||
+ | |||
+ | # HF | ||
+ | i = 0 | ||
+ | ax[i].set(title=' | ||
+ | left = 0 | ||
+ | right = 55 | ||
+ | y_ticks = [1, 3, 5, 10, 15, 20, 25] | ||
+ | |||
+ | # Axis | ||
+ | ax[i].set_xlim((left, | ||
+ | ax[i].set_ylim(-0.3, | ||
+ | ax[i].set_yticks(y_ticks) | ||
+ | |||
+ | # 160m | ||
+ | ax[i].broken_barh([(1.8, | ||
+ | ax[i].text(1.6, | ||
+ | |||
+ | # 80m | ||
+ | ax[i].broken_barh([(3.5, | ||
+ | ax[i].text(3.6, | ||
+ | |||
+ | # 40m | ||
+ | ax[i].broken_barh([(7, | ||
+ | ax[i].text(7.0, | ||
+ | |||
+ | # 30m | ||
+ | ax[i].broken_barh([(10.1, | ||
+ | ax[i].text(10.15, | ||
+ | |||
+ | # 20m | ||
+ | ax[i].broken_barh([(14, | ||
+ | ax[i].text(14, | ||
+ | |||
+ | # 17m | ||
+ | ax[i].broken_barh([(18.068, | ||
+ | ax[i].text(18.05, | ||
+ | |||
+ | # 15m | ||
+ | ax[i].broken_barh([(21, | ||
+ | ax[i].text(21, | ||
+ | |||
+ | # 12m | ||
+ | ax[i].broken_barh([(24.89, | ||
+ | ax[i].text(24.8, | ||
+ | |||
+ | # 10m | ||
+ | ax[i].broken_barh([(28, | ||
+ | ax[i].text(28, | ||
+ | |||
+ | # 50m | ||
+ | ax[i].broken_barh([(50, | ||
+ | ax[i].text(51.5, | ||
+ | |||
+ | |||
+ | # SWR Data | ||
+ | ax[i].plot(FREQ, | ||
+ | ax[i].plot(FREQ, | ||
+ | ax[i].plot(FREQ, | ||
+ | ax[i].plot(FREQ, | ||
+ | ax[i].set(ylabel=' | ||
+ | |||
+ | |||
+ | # VHF / UHF | ||
+ | i = 1 | ||
+ | ax[i].set(title=' | ||
+ | left = 100 | ||
+ | right = 500 | ||
+ | y_ticks = [1, 1.5, 2, 3, 5] | ||
+ | ax[i].set_xlim(left, | ||
+ | ax[i].set_ylim(0.8, | ||
+ | ax[i].set_yticks(y_ticks) | ||
+ | |||
+ | # 2m | ||
+ | ax[i].broken_barh([(144, | ||
+ | ax[i].text(138, | ||
+ | |||
+ | # 135cm | ||
+ | ax[i].broken_barh([(222, | ||
+ | ax[i].text(220, | ||
+ | |||
+ | # 70cm | ||
+ | ax[i].broken_barh([(430, | ||
+ | ax[i].text(430, | ||
+ | |||
+ | # SWR Data | ||
+ | ax[i].plot(FREQ, | ||
+ | ax[i].plot(FREQ, | ||
+ | ax[i].plot(FREQ, | ||
+ | ax[i].set(ylabel=' | ||
+ | |||
+ | |||
+ | # Print Third page | ||
+ | fig3.tight_layout() | ||
+ | pdf_pages.savefig(fig3) | ||
+ | pdf_pages.close() | ||
- | I'll post an update and publish the code when it's done. | + | </code> |
+ | </ |
references/band_plan_with_swr.txt · Last modified: 2021/11/19 20:11 by va7fi