The Keck AO Imaging (KAI) data reduction pipeline

The Keck AO Imaging (KAI) data reduction pipeline is a tool to reduce imaging observations taken with the NIRC2 and OSIRIS near-infrared imagers at the W. M. Keck Observatory.


The latest release can be downloaded from the github repository here.


  1. Create a separate conda environment to run KAI. The pipeline uses IRAF/PyRAF, and we recommend using the environment_iraf27.yml file in this repository (available here) to create a conda environment with the necessary dependencies correctly installed:

    conda env create -f environment_iraf27.yml

The environment file will create a new conda environment called iraf27, and must be activated before running KAI using:

conda activate iraf27

Note: KAI’s IRAF / PyRAF dependency currently requires Python 2.7 and operating systems that support 32-bit software.

  1. Clone this git repository. For example:

    cd ~/software/KAI
    git clone
  2. Install KAI by going to your cloned repository and running the script. For example:

    conda activate iraf27
    cd ~/software/KAI/
    python install
  3. Test your installation by importing KAI in python. For example:

    from kai.reduce import data

After installation, try running the reduction tutorial to get up to speed with KAI.

Example Reduction Template Scripts

The reduction template scripts included in this repository provide a complete run-through of the reduction procedure for imaging data: creating darks and flats, reducing skies, cleaning science images, and combining multiple clean science images into a combo science image.

Example Dataset

An example dataset with scripts can be found at this Google Drive link. This is a great place to start to test the pipeline.