IMACS-IFU Acquisition IDL Software
Adam S. Bolton, CfA
Overview
Preliminary Setup
On-Air Usage
Flat-fielding (for the assiduous)
Final Items
NEW: Comprehensive Commands Reference
Overview
This page documents a set of IDL routines made
to facilitate IMACS-IFU target acquisition at the Baade
6.5-m (Magellan I) Telescope at Las Campanas Observatory.
They serve the same purpose as the
ifu-image task of the COSMOS package.
The routines perform the following tasks:
- Stitch together and display a bias-subtracted cutout of
an undispersed IFU (pseudo)slit image.
- Read in and plot assumed IFU fiber image-spot positions
on the slit image.
- Tweak these positions with appropriate stretch, tilt, and
shifts so as to align them with the actual spot positions.
- Extract spot fluxes and reconstruct an undispersed
hexagonal-array IFU image in the focal plane.
NOTE: This software currently supports the f/2 and f/4
nod-and-shuffle configurations.
Considering the new LCO "always nod-and-shuffle" policy,
this should be sufficient for everyone's needs.
If for some strange reason you will be taking
data with the dewar in the "normal" orientation,
you can either (1) try to hack the software
yourself, or (2) contact Adam Bolton at CfA
(abolton at cfa dot harvard dot edu)
with sufficient lead time, and
somehow provide him with an undispersed flat image
taken through the IFU in your camera mode. The
mode-to-mode differences are in
(1) which CCD subregions
need to be stitched together to make the IFU slit image
and (2) different "initial guess" files for the
spot positions.
This software is a spinoff of the nascent kungifu
package of IMACS/GMOS IFU reduction software.
Stay tuned for more.
Top of page
Preliminary Setup
Obviously you'll need IDL. IDL is currently available
on burro.lco.cl, but not on llama.lco.cl. This is a bit
of a nuisance, since IMACS
data frames are written to llama. Therefore observers
must copy IFU acquisition frames from llama to
burro (via scp, ftp, or whatever) when using this software.
Also make sure that the IDL license is free (i.e. that no one
else is running IDL remotely on burro).
You will also need to have the Princeton-SDSS IDL
routines installed and accessible. These routines
and instructions for their installation are available
from David Schlegel's website:
http://spectro.princeton.edu/idlspec2d_install.html.
You will need the idlutils and idlspec2d packages, and
you will need to set paths as described in
the install instructions. Hopefully
these packages can be installed permanently to the observing
computers someday.
You also need the IFU acquisition software itself. The author
recommends downloading the demo-data as well, so you can
test-drive the software at your leisure:
Un-tar these in your working IDL directory.
Finally, you may want to take your own undispersed image,
a flat of sorts,
through the IFU during the afternoon (ambient daytime dome light
works, or you can use the flat lamp). This is so that you can
verify that the IFU slit image is indeed falling on the detector
as expected, and so that you can start tweaking up the spot positions
(although you will almost certainly have to tweak them again
during the night for photons coming from infinity).
The "afternoon" section of the official LCO
IFU observing cookbook has some helpful pointers
for taking this type of exposure.
You do not need any of the COSMOS routines.
Top of page
On-Air Usage
The two IFU bundles are to leading order
identical (but see below),
and their fields of view are rather
small: 5x7 arcsec in f/2 and 5x4 in f/4. To get your
target in the neighborhood of one of the bundles,
you should follow the instructions in the "night"
section of the official LCO
IFU observing cookbook up to but not including
running the COSMOS ifu-image task. Also be sure to do
cordinated offsets for all offsets after you have set
up with guide stars following the "toifu" IRAF task.
Also note that
the LCO IFU bundle designations "obj" and "bkg" are flipped relative
to the "object" and "background" bundle designations
given in the
Durham IMACS-IFU Fieldmapping diagram.
(The two broken fibers and the interchanged blocks
are the keys!) This software currently observes
the Durham naming convention. The LCO object a.k.a.
Durham background bundle seems to fall more favorably
onto the IMACS detector, and is the preferred
target bundle of the author.
The last stage from the cookbook is to take an
undispersed image of your target through the IFU fibers.
When you take this image,
make sure you use 1x1 binning. Also be sure to
use a broadband filter of some sort (at least until the
atmospheric dispersion corrector is atmospheric
dispersion correctin'), or your target image will be
made oblong by differential refraction.
Once you have taken this image (and transferred it
to burro), you can use the IDL
software to have a look at a focal-plane reconstruction
of it to see if you are lined up properly, and
apply offsets to the telescope if needed.
Here's how you do it. You can play along with the
'ccd0305' fits files from the demo data, or with
your own acquisition image (the name of which should
be substituted in, of course):
Once during your IDL session, you will need to
initialize the IFU "state information", which you
do by executing
IDL> ifu_set, camera='f2nods'
IDL> ; ** OR **
IDL> ifu_set, camera='f4nods'
The choice of "camera=" depends upon whether you are
using f/2 or f/4. (If you are using f/2, you can
skip this step, since it is the default and will be initialized
automatically when you display your first slit image.)
ifu_set can take other optional keywords to control
the details of slit-image creation and spot extraction; see its
internal comments for details.
The first acquisition step is to display a slit image:
IDL> ifu_slit, frame='ccd0305'
That should throw up a horizontally-oriented slit image
created from bias-subtracted images. A 50-fiber block
containing flux from a well-centered target looks like
this (in f/2):
One target shows up as two peaks within the block because
each 50-fiber block runs down and back across the FOV.
Now look at where the routine thinks the fiber spots are
along the slit:
IDL> ifu_spot
This overplots points where the assumed spot positions are.
Check both the left end and right end of the slit image.
The originally plotted positions are read from a "first-guess"
file by the name of "spot_f2nods.txt" (for the f/2
nod-and-shuffle setup), which must be present
in the working directory.
If the points are off, then you will need to tweak
the positions. For instance, our demo-data slit image
with positions overplotted looks like this on the very
leftmost block:
and like this on the very rightmost:
So we need to adjust the positions before we
extract spot fluxes and reconstruct an image.
We need to specify, for two well-separated x-positions,
what x-shifts and y-shifts need to be applied
to the assumed spot positions at thos x-values in order
to line things up. This specifies a unique stretch, tilt,
and shift that is calculated and applied by the ifu_tweak
routine. Calling ifu_tweak with no arguments gives
details of how to tweak it:
IDL> ifu_tweak
ifu_tweak usage:
IDL> ifu_tweak, [x1, dx1, dy1, x2, dx2, dy2]
where x1 and x2 are x-pixel locations along the
pseudo-slit image where shifts are specified,
and dx1, dy1, dx2, dy2 are the x- and y-shifts
that need to be applied to the assumed IFU spot
positions at those locations in order to bring
assumed positions to the correct positions.
Figuring out the needed shifts is non-tivial, because the
50-fiber block ends are what you really need to line up on,
but many blocks have bad-to-dead fibers on the end.
In many fibers only sky flux will be detected, but
this is good enough for spot positioning if you have counts.
When you think you have a feel for how the spots need to move,
call ifu_tweak with the proper values.
For our demo data, the following seems approximately correct:
IDL> ifu_tweak, [1290., 5., 0.7, 6770., -5., 0.5]
Now check the new spot positions:
IDL> ifu_spot
If the points are falling on the spots all along the
slit, you are in good shape. If not, you can iterate,
or reset to the previous spot positions using the
ifu_set routine -- see its internal comments for
more details. (Why not do all this automatically with some
sort of optimization routine?
Because I haven't written it, and because I think you would still
need to get within one fiber along the whole slit
manually before turning it loose.) If you are observing
in f/4 mode, you will probably find it necessary
to adjust the spot positions again for new targets
more so than you would with f/2 observing. This
is presumably because the position of the f/4 imaging
mirror changes a bit with removal and replacement.
Finally, to display the focal-plane image that results from
extracting apertures about the spot positions, execute the following:
IDL> ifu_im ; (if target in Durham "object" bundle)
IDL> ; -- OR --
IDL> ifu_im, /bg ; (if target in Durham "background" bundle)