GithubHelp home page GithubHelp logo

mlab-project / pysdr Goto Github PK

View Code? Open in Web Editor NEW
27.0 15.0 5.0 164 KB

Spectral waterfall of live signals or recordings

Python 74.92% C 24.48% Makefile 0.40% Shell 0.20%
displays-spectral-waterfall waterfall python sdr spectrogram fft-analysis

pysdr's Introduction

PySDR

PySDR displays spectral waterfall, a visualization of signal's frequency spectrum over time. It is developed for SDR-related applications, but can be fed any equidistantly-sampled complex-valued signal for which it makes sense.

stretching

A live waterfall is launched by pysdr-waterfall. It connects to the JACK audio system and takes its input from there, or, if the flag -r is passed, it expects its input on the standard input in the form of an endless stream of 32-bit interleaved floats.

$ pysdr-waterfall -h
usage: pysdr-waterfall [-h] [-b BINS] [-H HEIGHT] [-o OVERLAP] [-j NAME]
                       [-r RATE] [-d ARGS] [-p FILENAME]

Plot live spectral waterfall of a quadrature signal.

optional arguments:
  -h, --help            show this help message and exit
  -b BINS, --bins BINS  number of FFT bins (default: 4096)
  -H HEIGHT, --height HEIGHT
                        minimal height of the waterfall in seconds
                        (default corresponds to 1024 windows)
  -o OVERLAP, --overlap OVERLAP
                        overlap between consecutive windows as a
                        proportion of the number of bins (default: 0.75)
  -j NAME, --jack NAME  feed signal from JACK and use the given client
                        name (by default, with name 'pysdr')
  -r RATE, --raw RATE   feed signal from the standard input, expects 2
                        channel interleaved floats with the given sample-
                        rate
  -d ARGS, --detector ARGS
                        attach the given detector script, expects to be
                        given the script filename followed by arguments
                        for the script, all joined by spaces and passed on
                        the command-line as one quoted argument
  -p FILENAME, --persfn FILENAME
                        a file in which to preserve the visualization
                        parameters that come from interactive
                        manipulation, i.e. the visible area of the
                        waterfall and the selected magnitude range (save
                        triggered by pressing 'p')

Example usage with sox (cross-platform)

$ sox -d -e floating-point -b 32 -r 48000 -t raw --buffer 1024 - | ./pysdr-waterfall -r 48000

Example usage with ALSA

$ arecord -f FLOAT_LE -c 2 -r 44100 --buffer-size 1024 | pysdr-waterfall -r 44100

Record Viewer

There's also pysdr-reciewer, which displays spectral waterfall of short recordings. The recordings are expected to be either WAV files, or FITS files in the format produced by Radio Observer. The number of frequency bins reflects the aspect ratio of the waterfall, and so is interactive.

Usage

$ pysdr-recviewer path/to/recording

Dependencies

Ubuntu

$ sudo apt-get install python3-numpy python3-opengl python3-dev libjack-jackd2-dev python3-pil

In-place build

The package has a binary component which has to be built on the target machine. (It is not needed for pysdr-waterfall at the moment.)

For usage without installation, do an in-place build first.

$ python setup.py build_ext --inplace

Installation

$ python setup.py install

Supported designs

Radio Meteor Detection Station

PySDR is developed to be used, among others, with the RMDS designs by the MLAB project.

Technical description

Purchase from UST

License

Everything in this repository is GNU GPL v3 licensed.

pysdr's People

Contributors

kaklik avatar oploc avatar povik avatar roman-dvorak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pysdr's Issues

Fast frequency hopping

The application which uses CLKGEN01A driver for rapid frequency tunnig should not need to call recall_nvm() method. Instead of this, the recall_nvm() should be called in CLKGEN init code only.

There is an example of such a wrong use case
https://github.com/MLAB-project/pysdr/blob/dev/detectors/noise_level.py

The better approach would be a holding the NVM data in the program memory, therefore there should not be a need to call slow I2C transaction.

Real-time zoom

Větší rozlišení spektra může být dosaženo úpravou signálu, doplněním nulami. Proces lze imlementovat buď převzorkováním

image

Nebo prostým doplněním nul za úsek signálu ze kterého se spektrum počítá.

Python3 incompatibility

$ python3 3dwf.py 10.1.1.132
Traceback (most recent call last):
File "3dwf.py", line 33, in
pybuf_from_memory = ctypes.pythonapi.PyBuffer_FromReadWriteMemory
File "/usr/lib/python3.8/ctypes/init.py", line 386, in getattr
func = self.getitem(name)
File "/usr/lib/python3.8/ctypes/init.py", line 391, in getitem
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: python3: undefined symbol: PyBuffer_FromReadWriteMemory

Bus error: 10 when run on mac

Is it a bug in python or pysdr?

Nausicaa:/tmp/pysdr toxygen$ python2.7 waterfall.py 
Bus error: 10

Nausicaa:~/Downloads/pysdr toxygen$ python --version
Python 2.7.2

stack trace: http://codepad.org/hllIhq7E

pdb:

Nausicaa:/tmp/pysdr toxygen$ python -m pdb waterfall.py 
> /private/tmp/pysdr/waterfall.py(1)<module>()
-> import math
(Pdb) c
Bus error: 10
Nausicaa:/tmp/pysdr toxygen$ 

gdb (different behavior):

Traceback (most recent call last):
  File "waterfall.py", line 167, in <module>
    overlay = PlotOverlay(view, sig_input)
  File "/private/tmp/pysdr/overlay.py", line 56, in __init__
    self.font = glFreeType.font_data("font.ttf", 10)
  File "/private/tmp/pysdr/glFreeType.py", line 218, in __init__
    raise ValueError, "Unable to locate true type font '%s'" % (facename)
ValueError: Unable to locate true type font 'font.ttf'

Program exited with code 01.
(gdb) 

Record viewer expects two-channel WAV files

Feeding a standard mono-channel WAV file will make numpy extremely unhappy:

Traceback (most recent call last):
  File "./pysdr-recviewer", line 5, in <module>
    main()
  File ".../pysdr/recviewer.py", line 168, in main
    sample_rate, signal = read_file(sys.argv[1])
  File ".../pysdr/recviewer.py", line 145, in read_file
    return (sample_rate, audio[:,0] + 1j * audio[:,1])
IndexError: too many indices

And converting a mono-channel WAV to two channels will produce unreliable results depending on the tool. If both channels contain the same samples, the resulting spectrogram will be an incorrect representation of the signal.

The frequency axis has a wrong offset

Meteor reflection detected at a station which has carrier frequency precisely tuned to 10.6kHz is displayed at about 1kHz lower frequency on the screen.

Prohlížečka SDR záznamů

Už roky nám chybí nástroj, který by uměl efektivně zobrazovat sadu záznamů získaných z SDR.
Záznamy je potřeba zobrazovat v časové ose, tak aby v nich bylo možno hledat různé dlouhodobé změny i detaily. Podobné zobrazení se využívá při střihu filmu pro zobrazení celé časové osy.

Z pokusů, které si v tomhle směru pamatuji že byly provedeny, tak jsou:

  • Prohlížečka meteorů od @janousekjakub1512 (Zdrojový kód je netuším kde)
  • Prohlížečka dat ze Sluncárny od @povik
  • pysdr-recviewer

Pak ještě existují cizí řešení, nejnovější je třeba inspectrum. Což podle mého názoru není moc povedené řešení.

Řešení které ale je potřeba by mělo mít následující parametry

  • Rozumět tomu, že soubory jsou časová řada a skládat je za sebe
  • Umět plynule zoomovat na detaily spektra (zároveň podle toho upravovat rozlišení spektra doplňováním nul)
  • Mít možnost upravit parametry zobrazení spektra, tak aby bylo možné zjasnit některé detaily.

Možná je vzhledem k velikosti souborů se kterými se pracuje potřeba, aby taková prohlížečka ve skutečnosti byla serverová aplikace, podobně jako je například JS9.

Custom images in Freya window for presentation purposes

Possibility to add images under the waterfall layer.

The configuration should be done using the configuration file that will contain information about the image source file and its position in the screen.

This is useful for presentation purposes.

something like this:
20190606_123843_HDR

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.