From 3cc85a9731356078aef37f4eb1a2339f250e0c83 Mon Sep 17 00:00:00 2001 From: Phillip Tennen Date: Sat, 13 Apr 2024 22:24:11 +0100 Subject: [PATCH] Require a pre-vendored filename at the CLI --- README.md | 4 +++- gypsum-cli.py | 6 ++++-- gypsum/radio_input.py | 5 ++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 27bac0f..b1931dd 100644 --- a/README.md +++ b/README.md @@ -32,13 +32,15 @@ $ pip install -r requirements-webapp.txt # Run gypsum against the cached antenna samples # (And limit the satellite search scope for speed) -$ python3 gypsum-cli.py --only_acquire_satellite_ids 25 28 31 32 --present_web_ui +$ python3 gypsum-cli.py --file_name nov_3_time_18_48_st_ives --only_acquire_satellite_ids 25 28 31 32 --present_web_ui # (In another shell) # Launch the webserver to observe gypsum $ gunicorn -b :8080 --timeout 0 web_dashboard:application ``` +The receiver has various behaviors that can be tweaked by modifying [config.py](https://github.com/codyd51/gypsum/blob/release/gypsum/config.py). + ## License MIT diff --git a/gypsum-cli.py b/gypsum-cli.py index f8a81b6..2ed9a5f 100644 --- a/gypsum-cli.py +++ b/gypsum-cli.py @@ -5,7 +5,7 @@ from gypsum.antenna_sample_provider import AntennaSampleProviderBackedByFile from gypsum.gps_ca_prn_codes import GpsSatelliteId -from gypsum.radio_input import INPUT_SOURCES, get_input_source_by_file_name +from gypsum.radio_input import get_input_source_by_file_name from gypsum.receiver import GpsReceiver _AntennaSamplesSpanningOneMs = np.ndarray @@ -19,12 +19,14 @@ def main(): logging.basicConfig(level=logging.INFO) parser = argparse.ArgumentParser() + required_named_args_group = parser.add_argument_group('required named arguments') + required_named_args_group.add_argument('--file_name', help='File name within ./vendored_signals', required=True) parser.add_argument("--only_acquire_satellite_ids", nargs="*") parser.add_argument("--present_matplotlib_sat_tracker", action=argparse.BooleanOptionalAction) parser.add_argument("--present_web_ui", action=argparse.BooleanOptionalAction) args = parser.parse_args() - input_source = INPUT_SOURCES[7] + input_source = get_input_source_by_file_name(args.file_name) antenna_samples_provider = AntennaSampleProviderBackedByFile(input_source) _logger.info(f"Set up antenna sample stream backed by file: {input_source.path.as_posix()}") diff --git a/gypsum/radio_input.py b/gypsum/radio_input.py index 08076a6..b0600f3 100644 --- a/gypsum/radio_input.py +++ b/gypsum/radio_input.py @@ -114,7 +114,10 @@ def gnu_radio_recording_16x( def get_input_source_by_file_name(name: str) -> InputFileInfo: input_files_matching_name = [x for x in INPUT_SOURCES if x.path.name == name] if len(input_files_matching_name) == 0: - raise FileNotFoundError(f'No input file named "{name}" found.') + raise FileNotFoundError( + f'No input file named "{name}" found. ' + f'Make sure you describe this file and its signal structure in radio_input.py::INPUT_SOURCES.' + ) if len(input_files_matching_name) > 1: raise RuntimeError(f'Found more than one file named "{name}".')