Skip to content

Commit

Permalink
Updated Examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Quinticx committed Mar 28, 2022
1 parent deb4cd1 commit 4fd6a14
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/iq_to_audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import nimbus.transformers
from pathlib import Path

iq_source = nimbus.sources.IQ(Path("examples/test_iq.iq"))
iq_source = nimbus.sources.IQ(Path("examples/test_tee_iq.iq"))
audio_sink = nimbus.sinks.Audio()
console_sink = nimbus.sinks.Console()

Expand Down
27 changes: 27 additions & 0 deletions examples/iq_to_tee_to_wave.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import nimbus
import nimbus.sources
import nimbus.sinks
import nimbus.transformers
from pathlib import Path
import numpy as np

sdr_source = nimbus.sources.SDR(sample_rate=2.56e5, frequency=9.91e7)
audio_sink = nimbus.sinks.Audio()
iq_sink = nimbus.sinks.IQ(Path("examples/test_tee_iq.iq"))
wave_sink = nimbus.sinks.Wave("examples/test_tee_wave.wav")

pipeline = nimbus.Pipeline(
sdr_source,
[
nimbus.transformers.Caster(np.complex64),
nimbus.transformers.Tee(iq_sink),
nimbus.transformers.FM_Demod(),
nimbus.transformers.Caster(np.int16),
nimbus.transformers.Tee(wave_sink),
nimbus.transformers.Resample(44700),
nimbus.transformers.Gain(2),
nimbus.transformers.Caster(np.float32),
],
audio_sink,
)
pipeline.run()
27 changes: 27 additions & 0 deletions examples/sdr_to_tee_to_image.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import nimbus
import nimbus.sources
import nimbus.sinks
import nimbus.transformers
from pathlib import Path
import numpy as np

sdr_source = nimbus.sources.SDR(sample_rate=2.56e5, frequency=137.62e6)
image_sink = nimbus.sinks.Image("examples/noaa.png")
iq_sink = nimbus.sinks.IQ(Path("examples/noaa.iq"))
wave_sink = nimbus.sinks.Wave("examples/noaa.wav")

pipeline = nimbus.Pipeline(
sdr_source,
[
nimbus.transformers.Caster(np.complex64),
nimbus.transformers.Tee(iq_sink),
nimbus.transformers.FM_Demod(),
nimbus.transformers.Caster(np.int16),
nimbus.transformers.Tee(wave_sink),
nimbus.transformers.Resample(sample_rate=4160),
nimbus.transformers.Apt_Sync(sync_frame),
nimbus.transformers.Caster(np.uint8),
],
image_sink,
)
pipeline.run()
1 change: 1 addition & 0 deletions examples/test_tee_iq.iq

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/test_tee_iq.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"sample_rate": 256000}
6 changes: 3 additions & 3 deletions examples/wave_to_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@
pipeline = nimbus.Pipeline(
wave_source,
[
nimbus.transformers.Caster(np.float32),
nimbus.transformers.Hilbert(),
nimbus.transformers.Gain(1 / 32768),
nimbus.transformers.Tee(console_sink),
nimbus.transformers.Resample(sample_rate=4160),
nimbus.transformers.Apt_Sync(sync_frame),
nimbus.transformers.Gain(255),
nimbus.transformers.Gain(1.8),
nimbus.transformers.Caster(np.uint8),
],
image_sink,
)
Expand Down

0 comments on commit 4fd6a14

Please sign in to comment.