Fabry-Perot Imaging in Python

https://img.shields.io/pypi/v/fpipy.svg https://img.shields.io/travis/silmae/fpipy.svg Documentation Status Updates

Tools for reading and manipulating raw data from a Fabry-Perot interferometer based hyperspectral imager.

Installation

Using PIP

For normal use, it is enough to install fpipy using pip from git:

pip install git+https://github.com/silmae/fpipy.git

Optionally, you may also specify dask as an extra dependency if you wish to enable parallel computation. Currently this is just for convenience (you will get the same result if you install dask separately):

pip install git+https://github.com/silmae/fpipy.git[dask]

If you need to access ENVI files (such as the included example hyperspectral datasets) you will need to install rasterio. Specifying ENVI as an extra dependency will install it if you have the required system libraries for GDAL:

pip install git+https://github.com/silmae/fpipy.git[ENVI]

However, due to the difficulty of installing the necessary libraries (especially on Windows) it is recommended you use Conda if you wish to access ENVI files.

Using Conda

Using conda, you can create an environment with rasterio and xarray, then install fpipy using pip:

conda create -n <env_name> rasterio xarray
pip install git+https://github.com/silmae/fpipy.git

There are also multiple ready-made environments under the fpipy/envs directory which may be used to create suitable conda environments using:

conda env create -n <env_name> --file fpipy/envs/<env_name>.yml

See Contributing for more info on using development environments.

API reference

Main package

fpipy

Top-level package for Fabry-Perot Imaging in Python.

Submodules

io

Functions for reading data from various formats.

raw

Functions for manipulating raw CFA data.

meta

Metadata parsing.

data

Test images.

conventions

Conventions for data, coordinate and attribute names.

simulate

Tools for simulating CFA data from radiance cubes.

testing

Test data generators for debugging and benchmarking.

Command line scripts

This is a list of command line utilities that are installed with fpipy.

raw2rad

Convert raw CFA data to radiances.

usage: raw2rad [-h] [-f output_format] [-o output_dir] [-p output_prefix]
               input file [input file ...]
input file

List of files to process to radiance.

-h, --help

show this help message and exit

-f {netCDF}, --format {netCDF}

Output file format for the processed radiances, default “netCDF”

-o <output_dir>, --odir <output_dir>

Directory to write output files to, default “.”

-p <output_prefix>, --prefix <output_prefix>

Filename prefix to add to output filenames, default “RAD_

Glossary

CFA

Short for Colour Filter Array.

Colour Filter Array

Array of various colour filter used to enable measurement of colour images using a monochromatic sensor by sampling different colours from neighbouring points. Usual arrangements red, green and blue pixels are referred to as Bayer filters.

DN

Short for Digital Number.

Digital Number

Values received from the sensor (after analog-to-digital conversion and possible sensor firmware modification).

Fabry-Perot interferometer

Optical component composed of two parallel mirrors with a set air gap between them. Used as a tunable bandpass filter in hyperspectral imagers. See Wikipedia for more.

Changelog

All notable changes to this project will be documented in this file.

[Unreleased]

Contributing

Contributions are welcome.

Report bugs or give feedback at https://github.com/silmae/fpipy/issues.

Get Started!

Ready to contribute? Here’s how to set up fpipy for local development.

  1. Fork the fpipy repo on GitHub.

  2. Clone your fork locally:

    $ git clone git@github.com:your_name_here/fpipy.git
    
  3. Install the dependencies using the provided conda environment file and then the package itself using pip:

    $ cd fpipy/
    $ conda env create -f envs/development.yml
    $ conda activate fpipy-dev
    $ pip install -e .
    
  4. Create a branch for local development:

    $ git checkout -b name-of-your-bugfix-or-feature
    

    Now you can make your changes locally.

  5. When you’re done making changes, check that your changes pass tests:

    $ flake8 fpipy tests
    $ make test
    
  6. Commit your changes and push your branch to GitHub:

    $ git add .
    $ git commit -m "Your detailed description of your changes."
    $ git push origin name-of-your-bugfix-or-feature
    
  7. Submit a pull request through the GitHub website.

Pull Request Guidelines

Before you submit a pull request, check that it meets these guidelines:

  1. The pull request should include tests.

  2. Put any new functionality into a function with a docstring.

  3. The pull request should work for all configurations. Check https://travis-ci.org/silmae/fpipy/pull_requests and make sure that the tests pass for all supported Python versions.

Authors

Development lead

Developed at the Spectral Imaging Laboratory of the Faculty of Information Technology in the University of Jyväskylä by

Contributors

Indices and tables