aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpux <pux@pux.dom>2021-03-22 01:14:18 +0100
committerpux <pux@pux.dom>2021-03-22 01:14:18 +0100
commit08ff952636ea40303e0aed293d5724ba0349a359 (patch)
tree5842a6dbe3382d37d507725254402778c8a71074
parent15ba647b6e61c6d132c76f98fef217c9a954f7bd (diff)
downloadcalctenna-08ff952636ea40303e0aed293d5724ba0349a359.tar.gz
calctenna-08ff952636ea40303e0aed293d5724ba0349a359.tar.bz2
calctenna-08ff952636ea40303e0aed293d5724ba0349a359.zip
units in src
-rwxr-xr-xcalctenna.py28
1 files changed, 14 insertions, 14 deletions
diff --git a/calctenna.py b/calctenna.py
index 0ca70d2..c8668d0 100755
--- a/calctenna.py
+++ b/calctenna.py
@@ -17,13 +17,13 @@ class Tests(unittest.TestCase):
class AntennaData():
def __init__(self, frequency, velocity_factor):
- self.frequency = frequency
+ self.frequency_hz = frequency
self.velocity_factor = velocity_factor
# fill me
- self.wavelength = 0
- self.wavelength_2 = 0
- self.wavelength_4 = 0
- self.dipole_leg_length = 0
+ self.wavelength_m = 0
+ self.wavelength_2_m = 0
+ self.wavelength_4_m = 0
+ self.dipole_leg_length_m = 0
def run_argparse():
argparser = argparse.ArgumentParser()
@@ -86,10 +86,10 @@ def check_input(frequency, velocity_factor):
# fill struct
def calc(antenna_data):
c = 299792458.0 # speed of light
- antenna_data.wavelength = c / antenna_data.frequency
- antenna_data.wavelength_2 = antenna_data.wavelength/2
- antenna_data.wavelength_4 = antenna_data.wavelength/4
- antenna_data.dipole_leg_length = antenna_data.wavelength_4 \
+ antenna_data.wavelength_m = c / antenna_data.frequency_hz
+ antenna_data.wavelength_2_m = antenna_data.wavelength_m/2
+ antenna_data.wavelength_4_m = antenna_data.wavelength_m/4
+ antenna_data.dipole_leg_length_m = antenna_data.wavelength_4_m \
* antenna_data.velocity_factor
if __name__ == '__main__':
@@ -107,10 +107,10 @@ if __name__ == '__main__':
calc(antenna_data)
if not args.quiet:
- print("Desired Frequency: " + str(antenna_data.frequency) + " Hz")
- print("Wavelength: %.3f m" % antenna_data.wavelength)
- print("Wavelength / 2: %.3f cm" % (antenna_data.wavelength_2*100))
- print("Wavelength / 4: %.3f cm" % (antenna_data.wavelength_4*100))
+ print("Desired Frequency: " + str(antenna_data.frequency_hz) + " Hz")
+ print("Wavelength: %.3f m" % antenna_data.wavelength_m)
+ print("Wavelength / 2: %.3f cm" % (antenna_data.wavelength_2_m*100))
+ print("Wavelength / 4: %.3f cm" % (antenna_data.wavelength_4_m*100))
print("Velocity factor: " + str(antenna_data.velocity_factor))
print("-> Dipole leg length (lambda/4): ", end='')
- print("%.3f cm" % (antenna_data.dipole_leg_length*100))
+ print("%.3f cm" % (antenna_data.dipole_leg_length_m*100))
in each repos: see "about"-tab (if existing) for more details / README.
mailto contact at omeckman dot net
all timestamps in UTC (German winter time: UTC+01:00, summer time: UTC+02:00)
dark theme is a modded version of: https://gist.github.com/Yoplitein/f4b671a2ec70c9e743fa