Flux calibration

J-band continuum emission (1250 nm) in the planetary nebula M1-92.

program names, file names
variable names
prompts, commands, program code


Contents:


The Big Picture

If everything went well at the telescope, the observation of the object whose data you are reducing was immediately preceded and/or followed by the observation at the same wavelengths of a standard star. Lists of these standard stars exist in the group's Orange Book. There are CVF standards for observations made with the narrowband filters, and there are faint standards ("Elias standards", from Elias et al. 1982, Astronomical Journal vol. 87, pp. 1029-1034) for broadband observations. These lists give coordinates and infrared magnitudes for these stars. Using this information, you can interpolate to get the brightness in magnitudes at the wavelengths of your observations (see the section about fitmags below).

You'll also need to know the airmasses of the object and of the standard star(s) at the times of their observations. We'll discuss this in detail later, so you may need to skip ahead to that chapter. Or, if you're lucky, someone wrote down the airmasses in the log books in which we make notes during the observations.

After having determined the airmasses of the observations and the brightness in magnitudes of the standard stars, you need to perform photometry on images of the standard star. Basically, we need to determine how bright the camera thinks the standard star is. Then, knowing how bright the standard star actually is, we can apply that information to the images of the object, which was observed at about the same time, and so we'll know how bright the object is in physical units. We'll initially be expressing the data in Janskys, where the Jansky is a unit of flux density.

The images of the standard star will need to be reduced just like images of the object. However, you can probably get away with skipping a couple of steps, like eliminating bad pixels and background normalization. But the images of the standard stars must be linearized, flatfielded, and background-subtracted. If it's MLOF data, it's a toss-up as to whether or not to distortion-correct the images: it shouldn't be necessary, as that process conserves flux. You might try doing photometry on a test image before and after a distortion correction, and then compare the two results. They should agree within 1-2%.


fitmags

The fitmags procedure can be used to fit curves to magnitude v. wavelength data. Rather than command-line input, fitmags takes most of its input from a file called ~/idlpro/fitmags.txt, which looks something like the following:

ALTER ONLY THE NUMBERS IN THIS FILE, NOT THE FORMAT!!!!!
Number of wavelengths for which you have magnitudes:
5
Enter the wavelengths in microns in the left-hand column below, and the 
magnitudes in the right-hand column.  Wavelengths of the standard filters 
are 1250 nm (J), 1650 nm (H), 2230 nm (K), 3500 nm (L), and 4800 nm (M).
1.250   3.870
1.650   3.825
2.230	3.795
3.500   3.710
4.800   3.680
Number of wavelengths for which magnitudes are to be determined:
4
Enter these wavelents, one per line, in microns:
3.150
3.290
3.400
3.600

Make sure that you only alter the numbers in this file, and not the overall format. The program expects two lines of text, a number, three lines of text, etc. Just enter the information as the text indicates. The above example has data for sigma Cygnus, and the user wants the program to interpolate magnitudes at 3.15, 3.29, 3.40, and 3.60 microns (make sure that all wavelengths are in microns). The program may be run without arguments:
IDLprompt> fitmags
fitmags will make first-, second-, and third-order fits (using the least-squares method) to the input data, and will print (to the command window) the interpolated magnitudes at the requested wavelengths. fitmags can also take two positional parameters to specify the ordinate limits on the generated plot. For example, the following command will limit the magnitude (vertical axis) values on the plot to being between 3.65 and 3.9:
IDLprompt> fitmags, 3.65, 3.9
If this command is used with the above data in the ~/idlpro/fitmags.txt file, then the output printed to the command window will look like this:
order    LSval    linestyle      3.150     3.290     3.400     3.600
  1    3.87e-04     solid        3.751     3.744     3.738     3.727
  2    7.20e-05    dotted        3.730     3.723     3.718     3.710
  3    1.52e-04    dashed        3.727     3.720     3.714     3.705
This table indicates that of the three fits, the second-order fit has the best least-squares value with fit magnitudes of 3.730, 3.723, 3.718, and 3.710 magnitudes for 3.150, 3.290, 3.400, and 3.600 microns, respectively.

The output plot of fitmags sent to the display window will look like this:

[Polynomial fits to the
magnitude v. wavelength data]
Magnitudes and wavelengths (in microns) are plotted vertically and horizontally, respectively. The vertical lines indicate the wavelenths at which magnitudes are being interpolated. The different fits are represented by the different line styles (see the table above).

Now that we know the intrinsic brightness of the calibration star for the wavelengths at which we have made our observations, we can move on to doing the photometry.


cuts

The cuts procecure is quite useful when dealing with images of point sources (stars). cuts takes profiles (in two directions) through the point source and plots them on the display. cuts can also give high-precision coordinates for the position of the point source and fit a Gaussian function to the profile. Many of cuts's arguments are like that of v. Here's an example:
IDLprompt> cuts, impackname, sig=5, /help
This will cause cuts to display the image in impackname via the v procedure (so we could have also set the display parameters using mm or min and max). Setting the help keyword will cause a series of GUIs to appear to guide you in running the program. After you've gotten used to running cuts, you can run it without /help. As you run cuts, it will plot profiles of the star. That will look something like the following:

[A stellar
profile]

After cuts plots profiles in both directions through the star, it will print (to the command window) the star's coordinates, as calculated by a centroiding algorithm. We'll use these coordinates in the photometry program. Before we go on to that, however, let's look at one more feature of cuts, the gauss keyword:
IDLprompt> cuts, impackname, sig=5, /gauss, /help
This will run cuts as before, but with a couple of extra plots. These plots show Gaussian fits to the profiles, and they'll look something like this:

[Gaussian fit to a stellar
profile]
The solid line is the star's profile, and the points are the Gaussian fit. The vertical bars through the fit points indicate the least-squares value of the fit: smaller bars correspond to a better fit. As the extra plots say, just click on the display window to continue. At the end of runtime, cuts will print the star's coordinates as determined from the Gaussian fit, in addition to the coordinates from the centroiding algorithm. These two results typically agree within a fraction of a pixel (for high-signal, well-behaved profiles).


phot

At this point we have x- and y-coordinates for the star in the image of the calibration star, we have the stellar magnitude of the calibration star at the wavelength in question, and (by looking at the image header) we know the integration time in milliseconds. We're now ready to find the counts for zeroeth magnitude (CFZMs) for the star at the airmass of the calibration star's observation. CFZMs are the counts (in ADU) we would get from a zeroeth magnitude star at the airmass of the calibration star's observation. The CFZM of the calibration star in the image may be computed with the phot function:
IDLprompt> result = phot( impackname , [ x_coord , y_coord ] , $ IDLprompt> starmag , itime = itime , /usewt )
In the above example, impackname is the impack which contains the image of the calibration star, x_coord and y_coord are (respectively) the x- and y-coordinates of the star in impackname, starmag is the stellar magnitude of the calibration star at the wavelength in question, and itime is the integration time (in milliseconds). The square brackets above are necessary, as phot expects a two-element array as its second positional parameter. So if, for example, the coordinates were x=69.3 and y=172.7, the magnitude were 6.899, and the itime were 200 milliseconds, the following command, typed precisely as given here, would assign the CFZM to result:
IDLprompt> result = phot( impackname , [ 69.3 , 172.7 ] , $ IDLprompt> 6.899 , itime = 200 , /usewt )
(Setting the usewt keyword is generally a good idea -- it instruct phot to apply impackname's weight plane to the image plane before performing the photometry. This can eliminate problems that might result from bad pixels, but make sure that the weight plane contains only ones and zeroes, as it very likely does at this point).

The way phot does its photometry is to basically draw larger and larger circular apertures around the star and to calculate the total flux (in ADU) through those apertures. It then makes a plot of flux v. radius and finds the radius at which the flux increases by less than 2%. This radius is the optimum radius for the photometry aperture. phot then computes the average value in an annulus around the star (the annulus is bigger than the photometry aperture), subtracts this average from the image (much like the way bkgnorm works), and then computes the flux through a photometry aperture with the optimum radius. This number is used, along with the integration time and stellar magnitude, to find the CFZM.

The radii of the above-described annulus may be set with the r2 and r3 keywords to phot---they default to 25 and 35 pixels. The detector gain may also be set with the gain keyword---this defaults to 20, the gain of the Rochester 3rd Generation Infrared Camera. Finally, the interval of radii in which phot looks for the optimum photometry radius may also be specified to differ from the default---see the documentation of phot and fluxvrad for details.

During runtime, phot will present a plot which will look something like this:

[Weird plot from
phot.pro]
The vertical axis is in ADU, and corresponds to the unconnected points on the plot. The points are cuts extending radially outward from the star in the four directions. The solid line has an arbitrary normalization and does not correspond to the scale on the vertical axis. This solid line is the integrated flux as a function of radius. The solid line in the example linked here has a characteristic shape: it increases steeply for around ten pixels, and then levels out. Indeed, this one turns over a bit, indicating that the background value in this image is slightly less than zero. The dashed vertical line indicates the value of the optimum photometry radius found by phot---radius=12 pixels in this case. The solid vertical lines indicate the inner and outer edges of the annulus used to find the background value---25 and 35 in this example. When you look at this plot, you should make sure that the integrated flux curve is fairly smooth through the annulus. Any discontinuity, which might be experienced if another star happened to be within the annulus, will throw off the background value. In this case, you should run phot again, but with new values for r2 and r3, values which will avoid the discontinuity in the integrated flux curve.

When we take images of calibration stars, we tend to "nod on chip", meaning that when we nod the telescope to take the background image, we move the `scope by an angle which is small enough that the star is still on the detector array. This means that we get two measurements of the star for a single background-subtracted image pair. As a result, the background-subtracted image will have one image of the star in the foreground (positive pixels) and one image in the background (negative pixels). Just set the neg keyword in cuts and in phot to find the coordinates and CFZM of the background star.

When dealing with calibration star images which were nodded on chip, a significant shortcut in this process is found in the docfzms procedure. docfzms runs cuts (to find the coordinates) and phot on one or both images (foreground and/or background). The positions of the stars and there CFZMs are printed to the screen. See the documentation for docfzms to see how to run it.


jyperadu

At this point it's important to remember that we have now found the CFZMs at the airmass of the calibration star. During the observation of the object, we were observing at a different airmass, and thus through a different amount of atmosphere. We need to make a geometric correction for this as we apply the CFZMs to calibrate the images of the object. For the next step we'll need to know the airmass of the object at the time of its observation, and we'll need to know the value of a parameter with the catchy name magnitudes per airmass. Let's abbreviate that to MPA. We'll also need to know the integration time of the images of the object.

For wavelengths less than 3 microns, use MPA=0.1   . For the longer wavelengths, it's a bit more complicated. Before the summer 1998, we usually just used 0.15 for wavelengths longer than 3 microns. Matthew Barczys, a graduate of this lab, undertook a study of MPA as a function for wavelength. He found the following results:

wavelength
(microns)
measured
MPA
adopted
MPA
2.23 0.27 0.10
3.00 0.71 0.40
3.08 0.86 0.50
3.15 0.14 0.14
3.29 0.21 0.21
3.40 0.28 0.28
3.60 -0.12 0.00

Now it's time to determine the calibration factor to convert from ADUs to flux density units. This is done by editing the file ~/idlpro/jyperadu.txt. This file will look something like the following:

airmass difference (airmass of standard star - airmass of object):
-0.06
magnitude per airmass:
0.1
number of wavelengths:
3
wavelength (microns)    cfzm (not airmass-corrected)    object itime (msec):
1.556                             2006                        50000
1.644                             2015                        50000
1.780                             1623                        50000
When editing this file, make sure you don't delete any of the lines of text---only edit the numerical values in the file. In the example above, the airmass difference is -0.06, MPA=0.1, and images at three wavelengths are being calibrated: 1.556, 1.644, and 1.780 microns. The images of the object at these wavelengths were all taken with integration times of 50000 milliseconds, and the CFZMs, as determined by phot and/or docfzms, are given in the middle column. The above file is read by the program jyperadu, which uses the CFZMs, etc., to find the calibration factors. The program is run with no arguments:
IDLprompt> jyperadu
The results will be printed to the command window. jyperadu will print the airmass-corrected CFZMs and the calibration factor (expressed in Jy/ADU) for each wavelength. While or after tessellating the images of the object, the images will be multiplied by these conversion factors, expressing the images in flux density units. For now, just write down these conversion factors, and we'll apply them to the images soon.


Carl Welch