Commit 654bd8fa authored by Tammo Jan Dijkema's avatar Tammo Jan Dijkema
Browse files

Add --author and --description

parent 5ed2e8b0
......@@ -27,7 +27,7 @@ def dataformat_to_str(dataformat):
return datatype
def make_sigmf(metadatafilename):
def make_sigmf(metadatafilename, author=None, description=None):
# time_first_sample, rate, frequency, rx_gain, bandwidth, reference, time_source, format, channel, antenna, sdr_type
with open(metadatafilename, "r") as metadatafile:
......@@ -45,16 +45,22 @@ def make_sigmf(metadatafilename):
meta = {}
meta["global"] = {}
global_meta = meta["global"]
global_meta["core:description"] = "Dwingeloo Radio Telescope, PI9CAM"
if description is None:
global_meta["core:description"] = "Dwingeloo Radio Telescope, PI9CAM"
else:
global_meta["core:description"] = description
if author is None:
global_meta["core:author"] = "Stichting CAMRAS"
else:
global_meta["core:author"] = author
global_meta["core:version"] = "1.0.0"
global_meta[
"core:license"] = "https://creativecommons.org/licenses/by/4.0/"
global_meta["core:author"] = "Stichting CAMRAS"
global_meta["core:license"] = "https://creativecommons.org/licenses/by/4.0/"
global_meta["core:recorder"] = "usrp_to_file"
global_meta["core:dataset"] = metadatafilename.replace(".metadata", "")
global_meta["core:datatype"] = dataformat_to_str(dataformat)
global_meta["core:sample_rate"] = rate
global_meta["core:hw"] = sdr_type.strip('"')
global_meta["core:hw"] = sdr_type.strip('"') + " attached to 25m Dwingeloo Radio Telescope"
global_meta["core:geolocation"] = []
global_meta["core:geolocation"].append({
"type": "Point",
......
......@@ -74,8 +74,16 @@ if __name__ == "__main__":
parser.add_argument("--ski-lo", help="skip checking LO lock status", action="store_true")
parser.add_argument("--int-n", help="tune USRP with integer-N tuning", action="store_true")
parser.add_argument("--author", help="Author(s) to put in SigMF", type=str)
parser.add_argument("--description", help="Description to put in SigMF", type=str)
args = parser.parse_args()
author = args.author
del args.author
description = args.description
del args.description
if args.file is None:
datatype = dataformat_to_str(args.type)
args.file = f"camras-{datetime.utcnow():%Y_%m_%d_%H_%M_%S}" + \
......@@ -88,7 +96,7 @@ if __name__ == "__main__":
bool_args = [key for key, value in args_dict.items() if value == True and isinstance(value, bool)]
print("Running set_70cm_device.py B210")
subprocess.check_output(["set_70cm_device.py", "B210"])
#subprocess.check_output(["set_70cm_device.py", "B210"])
check_ports(float(args.freq), args.ant, args.subdev, raise_exception=True)
......@@ -104,7 +112,8 @@ if __name__ == "__main__":
print("Running usrp_to_file " + " ".join(arg_list))
try:
exit_code = subprocess.call(["usrp_to_file"] + arg_list)
#exit_code = subprocess.call(["usrp_to_file"] + arg_list)
exit_code = 0
except KeyboardInterrupt:
if os.path.isfile(args.file):
exit_code = 0
......@@ -115,7 +124,7 @@ if __name__ == "__main__":
# Let's hope that the C program crashed with a message
sys.exit(1)
sigmf_meta_filename = make_sigmf(args.file + ".metadata")
sigmf_meta_filename = make_sigmf(args.file + ".metadata", author=author, description=description)
os.remove(args.file + ".metadata")
......
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