Commit 3b8e1b65 authored by Tammo Jan Dijkema's avatar Tammo Jan Dijkema
Browse files

Improve filename logic

parent 956c7996
......@@ -37,7 +37,7 @@ def make_sigmf(metadatafilename, no_rename=False):
else:
datatype = "unknown"
newfilename = metadatafilename.replace(".metadata", "") + "_" + \
newfilename = metadatafilename.rstrip(".metadata").rstrip(".iq") + "_" + \
f"{frequency/1e6:.3f}MHz" + \
f"_{rate/1e6:.1f}Msps" + \
"_" + datatype + \
......
......@@ -4,12 +4,13 @@ from argparse import ArgumentParser
import subprocess
import os
from make_sigmf import make_sigmf
from datetime import datetime
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="")
parser.add_argument("--file", help="name of the file to write binary samples to", default="usrp_samples.dat")
parser.add_argument("--file", help="name of the file to write binary samples to (default deduced from date)")
parser.add_argument("--type", help="sample type", choices=["double", "float", "short"], default="short")
parser.add_argument("--nsamps", help="total number of samples to receive", default=0)
parser.add_argument("--duration", help="total number of seconds to receive", default=0)
......@@ -35,6 +36,9 @@ if __name__ == "__main__":
args = parser.parse_args()
if args.file is None:
args.file = f"camras-{datetime.utcnow():%Y_%m_%d_%H_%M_%S}.iq"
args_dict = vars(args)
bool_args = [key for key, value in args_dict.items() if value == True and isinstance(value, bool)]
......
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