mirror of
https://github.com/Schrolli91/BOSWatch.git
synced 2026-04-05 06:25:10 +00:00
rename includes/converter.py -> includes/helper/freqConverter.py
This commit is contained in:
parent
e7b5bffdd3
commit
e26fc45313
2 changed files with 5 additions and 5 deletions
29
includes/helper/freqConverter.py
Normal file
29
includes/helper/freqConverter.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: UTF-8 -*-
|
||||
#
|
||||
|
||||
"""
|
||||
convert frequency to Hz
|
||||
|
||||
@author: Bastian Schroll
|
||||
"""
|
||||
|
||||
import logging
|
||||
|
||||
def freqToHz(freq):
|
||||
"""
|
||||
gets a frequency and resolve it in Hz
|
||||
|
||||
@type freq: string
|
||||
@param freq: frequency of the SDR Stick
|
||||
|
||||
@return: frequency in Hz
|
||||
@exception: Exception if Error by recalc
|
||||
"""
|
||||
try:
|
||||
freq = freq.replace("k","e3").replace("M","e6")
|
||||
# freq has to be interpreted as float first...
|
||||
# otherwise you will get the error: an invalid literal for int() with base 10
|
||||
return int(float(freq))
|
||||
except:
|
||||
logging.exception("Error in freqToHz()")
|
||||
Loading…
Add table
Add a link
Reference in a new issue