Commit 2a8d365c authored by Tammo Jan Dijkema's avatar Tammo Jan Dijkema
Browse files

Reuse dataformat_to_str

parent 0dab498c
......@@ -14,6 +14,19 @@ from argparse import ArgumentParser
from telescope import Telescope
def dataformat_to_str(dataformat):
if dataformat.strip('"') == "short":
datatype = "ci16_le"
elif dataformat.strip('"') == "float":
datatype = "cf32_le"
elif dataformat.strip('"') == "double":
datatype = "cf64_le"
else:
datatype = "unknown"
return datatype
def make_sigmf(metadatafilename, no_rename=False):
# time_first_sample, rate, frequency, rx_gain, bandwidth, reference, time_source, format, channel, antenna, sdr_type
......@@ -39,7 +52,7 @@ def make_sigmf(metadatafilename, no_rename=False):
global_meta["core:author"] = "Stichting CAMRAS"
global_meta["core:recorder"] = "usrp_to_file"
global_meta["core:dataset"] = metadatafilename.rstrip(".metadata")
global_meta["core:datatype"] = datatype
global_meta["core:datatype"] = dataformat_to_str(dataformat)
global_meta["core:sample_rate"] = rate
global_meta["core:hw"] = sdr_type.strip('"')
global_meta["core:geolocation"] = []
......
......@@ -3,22 +3,9 @@
from argparse import ArgumentParser
import subprocess
import os
from make_sigmf import make_sigmf
from make_sigmf import make_sigmf, dataformat_to_str
from datetime import datetime
def dataformat_to_str(dataformat):
if dataformat.strip('"') == "short":
datatype = "ci16_le"
elif dataformat.strip('"') == "float":
datatype = "cf32_le"
elif dataformat.strip('"') == "double":
datatype = "cf64_le"
else:
datatype = "unknown"
return datatype
if __name__ == "__main__":
parser = ArgumentParser(description="This application streams data from a single channel of a USRP device to a file; it wraps a C++ program")
parser.add_argument("--args", help="multi uhd device address args", default="")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment