forked from Dollarhyde/AntennaCalculator
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmonopole.py
29 lines (22 loc) · 837 Bytes
/
monopole.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#! /usr/bin/python3
from pint import UnitRegistry
ureg = UnitRegistry()
class Monopole:
def __init__(self, args):
self.args = args
def quarter_wave_monopole(self, f):
return(3e8 / (4 * f))
def unit_print(self, name, value, unit=None):
if unit != None:
print("[*]", name, "= {:.2f}".format((value*ureg.meter).to(self.args.unit)))
else:
print("[*]", name, "= {:.2f}".format((value*ureg.meter).to_compact()))
def quarter_wave_monopole_calculator(self):
f = self.args.frequency
l = self.quarter_wave_monopole(f)
if self.args.verbose:
self.unit_print("Quarter Wave Monopole Length", l, self.args.unit)
else:
self.unit_print("L", l, self.args.unit)
if self.args.variable_return:
return l