Skip to content

Commit

Permalink
Merge pull request #24 from IQTLabs/defname
Browse files Browse the repository at this point in the history
Make broadly compatible with gamutrf style default filenames.
  • Loading branch information
anarkiwi authored Apr 2, 2024
2 parents 714c909 + bf93f57 commit 097d9eb
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions lib/uhd_sample_recorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,7 @@ int parse_args(int argc, char *argv[]) {
desc.add_options()("help", "help message")(
"args", po::value<std::string>(&uhd_args)->default_value(""),
"multi uhd device address args")(
"file",
po::value<std::string>(&file)->default_value("usrp_samples.dat.zst"),
"file", po::value<std::string>(&file)->default_value(""),
"name of the file to write binary samples to")(
"type", po::value<std::string>(&type)->default_value("short"),
"sample type: double, float, or short")(
Expand All @@ -233,8 +232,9 @@ int parse_args(int argc, char *argv[]) {
"RF center frequency in Hz")(
"lo-offset", po::value<double>(&lo_offset)->default_value(0.0),
"Offset for frontend LO in Hz (optional)")(
"gain", po::value<double>(&gain), "gain for the RF chain")(
"ant", po::value<std::string>(&ant), "antenna selection")(
"gain", po::value<double>(&gain)->default_value(0.0),
"gain for the RF chain")("ant", po::value<std::string>(&ant),
"antenna selection")(
"subdev", po::value<std::string>(&subdev), "subdevice specification")(
"channel", po::value<size_t>(&channel)->default_value(0),
"which channel to use")("bw", po::value<double>(&bw),
Expand Down Expand Up @@ -296,6 +296,21 @@ int parse_args(int argc, char *argv[]) {
std::cerr << "defaulting spb to rate (" << spb << ")" << std::endl;
}

if (!file.size()) {
std::stringstream ss;
ss << "gamutrf_recording_gain" << std::fixed << std::setprecision(1) << gain
<< std::setprecision(0) << "_" << std::time(0) << "_" << uint64_t(freq)
<< "Hz"
<< "_" << uint64_t(rate) << "sps";
if (type == "short") {
ss << ".s16";
} else {
ss << ".raw";
}
ss << ".zst";
file = ss.str();
}

if (!fft_file.size()) {
fft_file = get_prefix_file(file, "fft_");
}
Expand Down

0 comments on commit 097d9eb

Please sign in to comment.