NICI Python Data Reduction
Nelson Zarate(1), Etienne Artigau(2), Markus Hartung(1) & Kathleen Labrie(1)(1) Gemini Observatory, La Serena, Chile(2) Université de Montréal, CanadaABSTRACTNICI, the new adaptive-optics supported Near Infrared Coronagraphic Imager ofthe Gemini Observatory (South), has recently been commissioned and offered tothe astronomical community.
We describe its reduction package and design of the different modules. The
software has been written in Python using numerical routines from Numpy, Scipyand Ndimage, as well as the Gemini module Astrodata dealing with Gemini's fitsfile structure.
In this example the selected
semitransparent coronagraphic
mask dampens the flux of thecenter star by approximately
6.5 magnitudes.

We discuss science data preparation, and basic reduction steps as well as theimplementation of the Angular and Spectral Differential Imaging (ADI/SDI)
reduction algorithm, and the LOCI method (Locally Optimized Combination ofImages) producing the final set of reduced science FITS files for high-contrast
imaging.
Original
RawRedRedFrame
Frame(flat-fielded)

Original Blue Frame (flat-fielded)

NICI INSTRUMENT

To demonstrate the fieldrotation and contrast gain
three artificial objects are
introduced (0.5", 1.0", 1.5"
from the central star under
the semi-transparentmask) . The exposure time
(60 sec) is small enough tokeep smearing of potential
objects closer than 2”
negligible. The shown
frames are taken 5
minutes apart.

NICI (Ref. 3) combines an 85-element curvature adaptive optics system, adedicated Lyot coronagraph, and a specialized dual-channel camera into a single
instrument optimized to detect large Jovian-type planets around nearby stars.
Sensitivity is enhanced by spectrally differencing two images taken simultaneously
inside and outside the strong near-infrared methane absorption features found in
substellar objects cooler than 1400 K. Integrating the three major subsystems intoa single instrument keeps non-common path aberrations small, limited only by theresidual atmospheric wavefront and scattering. Optical scattering and ghosts areminimized by using off-axis paraboloids of lenses. Both channels are equipped witha 1024x1024 ALADDIN InSb array (1 -5 μm), with an imaging scale of 18 mas/pix
and field of view of 18x18 arcsec. A variety of broad- and narrow-band filters areavailable, including AO-quality filters to sample the methane absorption band at 1.6μm.

NICI SCIENCE DATA PRODUCTSNICI Reduction
Pure Python (v2.5) code. Runs where Python runs (in principle) . The external
public modules needed are scipy, matplotlib and numpy.
The reduction sequence is:ncqlook-- Quick look statistics for an observation sequence. It creates lists ofcalibration files, science files and logs. Useful for the next scripts.

ncprepare -- Find mask center and update header of science data.
ncmkflats -- Produces calibration fits files flats_red, flats_blue, sky_red andsky_blue.
ncscience -- Analysis of the science dataset.

The Median of the frames of one cube ( flatfielded) observed with the instrument
rotator fixed. The radius fromthe center tothe outside simulated source is 1.5 arcsec.

After rotating each frame of the cube to
a common angle the median across thecube shows smearing due to rotation.
Small scale features (static speckles) areaveraged out, while the object signal
is enhanced.

cube_[red,blue].fits
Flat fielded cube. Each slice is 1024x1024. Input for
next steps.
medcrunchp[red,blue].fits
Median reduce thru the slices of the input cube.
sumcrunch[red,blue].fits
Sum reduce thru the slices of the input cube.
cube_rotate[red,blue].fits
Rotated cube using the parallactic angles to acommon angle.
medcrunch_rotate[red.blue].fits
Median reduced of the cube_rotate.
sumcrunch_rotate[red,blue].fits
Sum reduced of the cube_rotate.
cube_medfilter[red,blue].fits
Median filtering of cube slices. This image is
the initial cube minus the median-smoothed image.
This is sort-of-an-unsharp-mask but we use a medianinstead of boxcar smooth.
medfilter_medcrunch_rotate[red,blue].fits
Rotated median reduced of cube_medfilter.
cube_shift_medfilter[red,blue].fits
Scales the two channels to a common 'speckle'size. This is done using the ratio of the central
wavelengths of the filter bandpasses.
cube_sdi.fits
Differential imaging result or plainly is red-blue cubes.
sdi_medcrunch.fits
Median reduced of cube_sdi.
cube_loci_sdi.fits
LOCI subtraction of cube_sdi.
loci_sdi_medcrunch.fits
Median reduced of the cube_loci_sdi.
loci_sdi_sumcrunch.fits
Sum reduced of the cube_loci_sdi.
loci_medfilter_medcrunch[red,blue].fits
Median reduced of cube_loci_medfilter.
loci_medfilter_sumcrunch[red,blue].fits
Sum reduced of cube_loci_medfilter.
cube_loci_medfilter[red,blue].fits
Median filtering of the cube_medfilter.
cube_asdi.fits'Super' Loci subtraction using the red channel as acube and the blue channel as an additional sampleof images.
asdi_medcrunch.fits
Rotation and median reduced of the cube_asdi.
asdi_counter_medcrunch.fits
Counter rotation and median reduced of the cube_asdi.

High-pass filtering of all frames in theinitial cube to remove low frequency
components leaving spatial scales similar
to those of points sources.

After doing the steps described above for bothchannels, the contrast for methane containing
objects can be further improved bydifferencing the red & blue channel pipeline
output frames (SDI technique, see Ref. 1 & 2).
Therefore, the frames are aligned with sub-pix
accuracy and scaled according the wavelength
difference to match the static speckles.

Taking the high-pass filtered output frameand applying the LOCI algorithm (Ref. 4)
will even further increase the contrast. After
reduction the innermost object (0.5”) caneasily be identified.

References:(1) Artigau et al. , 2008, SPIE, “NICI: combining coronagraphy, ADI and SDI”
(2) Biller et al., 2008, SPIE, “Observing strategies for the NICI campaigne to directly imageextrasolar planets”(3) Toomey et al., 2003, SPIE, “Near Infrared Coronagraphic Imager for Gemini South”(4) Lafreniere et al., 2007, Astroph. Journal, “A New Algorithm for Point-Spread Function Subtractionin High-Contrast Imaging: A Demonstration with Angular Differential Imaging”