Skip to main content

This package provides functions for analyzing and plotting the time-dependent frequency and amplitude of a sinusoidally oscillating signal.

Project description

Introduction to the FreqDemod Package

This package provides functions for analyzing and plotting the time-dependent frequency and amplitude of a sinusoidally oscillating signal. Additional functions are provided for analyzing fluctuations in oscillator amplitude, phase, or frequency. The provided functions should work equally well for any oscillating signal, although the included data-fitting and -plotting functions have been written with an oscillating atomic force microscope cantilever in mind. The main frequency-demodulation algorithm’s only assumption is that the oscillating signal contains a single frequency component (the carrier, in FM-radio terminology).


This package requires the following packages. If you use the Enthought Canopy Distribution, then you should install these packages first using Enthought’s package manager. If you do not install them first, then pip will install them for you

  • numpy 1.8.1
  • scipy 0.14.1
  • matplotlib 1.4.2
  • h5py 2.4.0

To install the package

pip install FreqDemod

To test that the installation worked, run

python -c "from freqdemod.demodulate import Signal"

Documentation and source code is available at

Install the development version

To test the package, edit it, and compile the documentation, you will need

  • fabric 1.10.1
  • Sphinx 1.2.3
  • nose 1.3.4
  • ipython 2.3.1

To install the development version, first clone the package

git clone
cd FreqDemod

To confirm that everything is working, in the FreqDemod directory run



or nosetest -s -v


python test

If you make modifications to the code, and want to try test drive your modifications, then run

python develop

Your modified code should now load when you import FreqDemod in your code. To recreate the documentation, switch to the docs subdirectory, and run

fab html
fab open

If successful, you should see the documentation appear in your webbrowser. The documentation is created in the directory FreqDemod/docs/_build/html.

There is an example ipython notebook in the FreqDemod/freqdemod/docs directory. Running the following command will convert the notebook to html and copy it to the documentation directory

fab html_full


The full documentation is at

Development History


Release the package into the wild.


The file has undergone a major rewrite!

  • The “quickstart” files are essentially all broken. You may instead see how the new code works by running, at the command line, from the home directory of the package

    python freqdemod/ --no-LaTeX --testsignal=sine
    python freqdemod/ --no-LaTeX --testsignal=sinefm
    python freqdemod/ --no-LaTeX --testsignal=sineexp

    Running these commands will bring up a number of windows. You will have to click each window closed before the program will proceed and show you the next window. Each window should have a pretty self-explanatory title I hope. You can try the --LaTeX option to see all the plots in fancy LaTeX typesetting.

  • All the data is stored as an HDF5 file. If you have the h5py package installed correctly, you should have available the h5ls command line program which is useful for inspecting the contents of HDF5 files. Each of the above programs saves its data to a hidden HDF5 file. You can see the files by running at the command line

    ls -ha | grep h5

    or simply looking for the files that start with a dot, ., and end with .h5. To examine the contents of the HDF5 files produced by running

    h5ls -rv .temp_sine.h5
    h5ls -rv .temp_sine_fm.h5
    h5ls -rv .temp_sine_exp.h5
  • The code is only lightly documented. To get an idea of how things work, start by looking at the functions


    in the program.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
FreqDemod-0.2.tar.gz (21.3 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page