Skip to content

Commit

Permalink
Require a pre-vendored filename at the CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
codyd51 committed Apr 13, 2024
1 parent 9ede715 commit 3cc85a9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 4 additions & 2 deletions gypsum-cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()}")

Expand Down
5 changes: 4 additions & 1 deletion gypsum/radio_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}".')
Expand Down

0 comments on commit 3cc85a9

Please sign in to comment.