#### Absolute Photometry using APT and Aladin

In the lecture, we learnt the theory behind precise calibration of photometry, enabling us to put photometric observations onto a standard scale with precisions of better than 1%. In this practical we are going to learn how to produce calibrated photometry using a simplified method. This method does not yield the same accuracy as an analysis using observations of primary or secondary standard stars, combined with the use of colour terms. On the other hand, it is much simpler to apply, and even works to produce calibrated photometry through thin cloud. If you are happy to accept accuracies on the order of a few percent, I recommend using the method described below whenever you need to produce calibrated photometry.

In this practical, we will produce a colour-magnitude diagram of the young open cluster NGC 869, using readily available software. First, I describe the method which will enable us to obtain calibrated magnitudes.

#### Method

In the lecture we saw that, for any star, the difference between the calibrated magnitude, $$m$$ and the above-atmosphere instrumental magnitude $$m_{0,i}$$ is given by:
$m = m_{0,i} + m_{\rm zp},$
where $$m_{\rm zp}$$ is known as the zero point. The above-atmosphere instrumental magnitude is given by:
$m_{0,i} = m_i - kX,$
where $$m_i = -2.5 \log_{10} \left( N_t/t_{\rm exp} \right)$$ is the instrumental magnitude, $$k$$ is the extinction coefficient, and $$X$$ is the airmass. Therefore:
$m = m_i - kX + m_{\rm zp}.$
In other words, if we were to plot the calibrated magnitude $$m$$ against instrumental magnitude $$m_i$$ for all the stars in our image, we would expect a straight line, with a gradient of one, and an intercept equal to $$kX + m_{\rm zp}$$. This intercept could then be added to all of our instrumental magnitudes to produce calibrated magnitudes.

What makes this technique possible, is the existence of large sky surveys, which have provided calibrated magnitudes for many, relatively bright stars over a very wide areas of the sky. If your data is covered by one of these surveys, and it provides calibrated magnitudes in the same filter as your data, you can apply this technique relatively quickly.

Accuracy
The accuracy this technique can achieve is limited by two factors. First of all we are not taking into account any secondary effects, such as 2nd-order extinction, or colour terms. Secondly, our photometry cannot be any more accurate than that in the sky survey we use. Typically, large sky surveys achieve accuracies of a few percent. Ignoring the secondary effects will probably introduce errors on a similar level. If you need calibrated photometry to better than a few percent, you will have to observe standard stars, and apply the rigorous method described in the lecture.

Steps
Applying this method requires the application of four steps. These steps are:

1. astrometric solution of the image - so we know the RA and Dec of all the stars we measure in our image;
2. finding the stars in our image, and calculating instrumental magnitudes;
3. matching our stars against a sky-survey, so we know instrumental and calibrated magnitude for many stars;
4. calculating the offset between instrumental and calibrated magnitudes, and applying to all stars in our image.

We will need to use several software packages to perform these steps and achieve our goal. Following the guide below will show you how to achieve this with readily available, cross-platform software packages.

#### The Data

You will need a copy of the data. The data files are located in a folder on your USB stick called NGC869\Images.

You don't need to copy the data from this location to work on it, but if you wish you can copy them to your U: or M: drives.

#### Astrometric Calibration

Eventually we are going to match our instrumental magnitudes for each star, against calibrated magnitudes from a catalog which comprises of RA, Dec and magnitude. Thus we will need to know the RA and Dec of every star we calculate an instrumental magnitude. We do this by ensuring the image file has an astrometric solution - a piece of metadata which allows software to convert between pixel positions (x, y) and sky coordinates (RA, Dec).

For the data in today's practical, this step has already been carried out, and the image has an astrometric solution already. This section is included for reference if you use these notes to reduce your open cluster data. If you are just working through the practical, skip ahead to the section on aperture photometry.

You can create an astrometric solution for your images using AstroImageJ, which we encountered in the previous practical. AstroImageJ has a tool to automatically find the RA and Dec of an astronomical image, using an online web tool called Astrometry.net. To use this service, you will need to sign up for an account at http://nova.astrometry.net. Once you have logged in, go to "Profile" and make a note of the API key listed there - you will need it to use astrometry.net from within AstroImageJ.

Task 1: Open AstroImageJ. Load the B-band image by choosing File > Open. The astrometry solution can be controlled by choosing WCS > Plate Solve Using Astronometry.net (with options). A window like the one shown in figure 1 will appear.

There are lots of options. The options for Median Filter and Peak Find Options control how stars are detected in the image. You probably want to uncheck these to start with, but if your images are very noisy, Median Filter can prevent the spurious identification of noise as stars. Peak Find Options can be used to prevent the use of saturated stars, whose positions are unreliable.

The option SIP Distortion Correction will enable a more complex transformation between pixel position and RA, Dec which can correct for aberrations introduced by the telescope optics. You should usually check this box.

Astrometry.net can usually find a solution for many images without an initial guess of the RA and Dec of the image. Try this by entering your astrometry.net API Key into the User Key box and clicking Start. Check the output log to see if the astrometric solution was successful.

If it wasn't, you may need to give Astrometry.net some constraints on the image location. To do so we need to know the rough position the telescope was pointed at and the image scale (in arc seconds per pixel). In our case, the RA was roughly 02:18:57 and the Dec was roughly +57 08 46. The image was taken with 2x2 binning, and so the pixel scale is 1 arc second per pixel (image scales for the Hicks Observatory can be found here). You can make Astrometry.net search only around these values by ticking the Constrain Plate Scale and the Constrain Sky Location checkboxes, and entering appropriate values in the relevant text boxes.

Figure 1: The astrometry window in AstroImageJ. You must put your astrometry.net API key in the User Key box. If the Auto Save checkbox is ticked, your image will automatically be overwritten by one with an astrometric solution.

Once we have a successful astrometric solution, we can move onto the aperture photometry. In figure 2 I show the B-band image of NGC 869 displayed using the software Aladin. Also shown is data from an all-sky catalog. The fact that the catalog objects line up with the stars in the image show that the astrometric solution is accurate.

Figure 2: A well-calibrated image of NGC 869. Notice how the stars and catalog objects line up. This tells us the conversion between pixel coordinates and sky coordinates is accurate.

#### Aperture Photometry

We have done aperture photometry before, using AstroImageJ. Whilst this tool is excellent for relative photometry, and producing light curves, each aperture must be placed by hand, which makes it onerous to use when we want to measure every star in an image. For this reason I will introduce a new software tool, the Aperture Photometry Tool, or APT for short.

APT can be installed on Windows, Linux or Mac machines. There is excellent documentation here, and a 35-minute long video tutorial here. Should you need to perform aperture photometry on a large number of stars in your course, APT is a good place to start. If it doesn’t meet your needs, or you want to practice your Python - there is always the Python library mentioned in the previous session.

APT is installed on your USB sticks under APT_v2.6.9. Double click on the APT.exe application in this folder to run APT.

Start APT and click Open Image to load your astrometrically calibrated image. Click on More Settings and make sure the source algorithm is set to model 0 (this is straightforward aperture photometry), and the sky algorithm is set to model B (this will use a sky annulus to measure and subtract the sky background). Click Apply Settings and then Close Window.

Now we need to set our aperture settings, but we'll need to find the FWHM so we know roughly what settings to use. Click on an isolated star in the image to place an aperture around it. Then click on Aperture Slice. You will see a plot with two cross sections across your star, one horizontal, one vertical (see, for example, figure 3). You can use this plot to estimate the FWHM of stars in your image.

Once you know the FWHM, use it to set the values for your photometry apertures. You should have some experience in this from the relative photometry practicals, but decent starting values are an object aperture radius of 1.5xFWHM, an inner sky radius of 2xFWHM and an outer sky radius of 3xFWHM.

Click on the big button in the GUI (labelled something like 5/5/0 -> Alter) to set the aperture parameters. Two windows should appear. The Major radius in the larger window is where you enter the object aperture. Click Apply. The sky annulus radii are entered in the smaller window. Set these values and click Apply. Close both windows.

Figure 3: An aperture slice plot from APT, showing horizontal and vertical slices across the image. In this example, the peak of the star is around 2500 counts above the background, and the FWHM is roughly 3 pixels. Using these numbers, reasonable values for the aperture sizes have been set, and are shown on the plot.

##### Source Detection

With your apertures set, you can perform aperture photometry on any single star by clicking on it. Have a go at this, and look at the values reported in the Aperture Photometry Results area of the APT window. However, we want to detect all the stars in the image, and perform aperture photometry on all of them at once.

Click on the Source List button at the bottom of the APT screen. The source list tool will appear (figure 4). Click Create Source List to get the source list creation tool, also shown in figure 4. Make sure the settings are as in figure 4. The important settings are the detection threshold, which sets how bright an object must be to be detected, and the Radial-profile sigma which gives APT an idea how large the stars in the image will be. This last value wants to be at least twice the FWHM.

When the settings are correct, click Create Source List, and close the window once processing is complete. You can view the detected sources by ticking the "Check box to overlay sources on image" checkbox in the source list tool.

If you're not happy with the detected sources, you can tweak the parameters and try again.

##### Photometry

Now we have a list of detected sources, and we have set our apertures, we can go ahead and perform aperture photometry on all the sources.

In the source list tool, click Automatically Process Source List, to perform aperture photometry with the current aperture settings on all stars in the source list. Close the source list tool window when complete.

You can view your results by clicking List Results at the bottom of the APT window. Click on Export Contents to save your results to a text file that can be used by other programs. In the window that appears click Reset CSV Filename to set the filename to something useful (in this practical, use NGC869_B.csv) and click Create CSV File. You might want to save this file to your USB stick, so it is available later.

It is important to note that the results file is not cleared each time you load a new image, or restart APT. Unless you clear it manually, the old results will still be present. Before you close the results window, click Clear Contents to empty the current results.

Figure 4 - Top: The APT source list window. Bottom: The APT create source list window, with reasonable settings for the images in this practical.

Figure 4 - Left: The APT source list window. Right: The APT create source list window, with reasonable settings for the images in this practical.

#### Photometric Calibration

Now you should have a CSV file, called NGC869_B.csv, with your instrumental magnitudes (and much besides) in it. The next step is photometric calibration. As a reminder, this involves fitting a straight line to a graph of instrumental magnitude against calibrated magnitude, to find the offset between the two. Equivalently, we can find the average value of the difference between the calibrated and instrumental magnitudes for all our stars.

Since we have instrumental magnitudes and sky positions (RA, Dec) for a number of stars, we must find the matching stars in an online catalog of calibrated magnitudes. We will use the UCAC4 catalog; a catalog which combines several other sky surveys to provide data in many filters across much of the sky. Crucially, in this case it includes B and V magnitudes, the two filters used for NGC 869.

To do this, we will introduce a new tool - Topcat.

Topcat is an amazing tool for manipulating tables of astronomical data, and for accessing the wealth of data available over the web. Like all the software used in this practical it is cross-platform and freely available. It's rich functionality is described in detailed documentation. Topcat is installed on your USB stick in the folder called topcat.

Start Topcat and load your instrumental magnitude file by choosing File > Load Table. The load table dialog is used to load data from a wide range of sources, including web-based catalog data, so it is slightly complex. You will need to set the Format drop-down box to CSV and navigate to your file (NGC869_B.csv) using the System Browser.

Now we must cross-match our stars with an online catalog, by looking for stars with closely matching RA and Dec. To do this, choose VO > CDS Upload X-Match. Choose the UCAC4 catalog from the VizieR Table ID/Alias box in the Remote Table section (see Figure 5).

In the Local Table section, select your catalog of instrumental magnitudes (NGC869_B.csv) as the Input Table. Select ApertureRA and ApertureDec as the RA and Dec columns, respectively.

In the Match Parameters section, choose a Radius of 1 arc second - this sets how close a match is needed between the two catalogs. Now click Go. A new catalog will appear in the Topcat main window containing the information from both catalogs for matched sources.

Close the CDS Upload X-Match window.

Figure 5: The CDS X-match window in Topcat. The settings shown here will download the UCAC4 catalog data around NGC 869, and match our catalog of instrumental magnitudes.

Figure 6: The Topcat main window. Loaded tables are shown in the list on the left. The active table is highlighted. On the right you can change the sort order of the table, and select the active subset.

Now we have a table, called “1xUCAC4” or similar, which has both our instrumental magnitudes and calibrated $$B$$-magnitudes from UCAC4. As a reminder, plotting the calibrated magnitudes $$m$$ against the instrumental magnitudes $$m_i$$ should yield a straight line of slope 1 and interception equal to $$- kX + m_{\rm zp}$$:
$m = m_i - kX + m_{\rm zp}.$

Let’s check this using the plotting tools in Topcat.

In Topcat, make sure the 1xUCAC4 catalog is selected and select Graphics > Plane Plot from the menu. In the bottom right is a panel with a Position tab and two drop down boxes. Select Magnitudes for the X box (these are your instrumental magnitudes from APT) and Bmag for the Y box (these are calibrated magnitudes from UCAC4).

If all goes well, you should have a plot somewhat similar to figure 7.

Figure 7: Instrumental B-band magnitudes vs calibrated UCAC 4 magnitudes.

Note the linear relationship between the two. Note also the larger scatter at faint magnitudes due to poor signal-to-noise ratios, and the presence of outliers which are probably caused by spurious matches between the two catalogs.

Now we must calculate the offset between calibrated and instrumental mags $$- kX + m_{\rm zp}$$. From here on I’ll refer to this offset as the zeropoint, for brevity. We can add a new column containing the difference between the calibrated and instrumental magnitudes. Make sure the table containing the cross-matches is highlighted in the main topcat window. Choose Views > Column Info. With the column info window active, choose Columns > New Synthetic Column. Call the column “deltaMag” and in the expression box, type “Bmag - Magnitude”. Click OK.

Now we can calculate the mean, median and standard deviation of deltaMag. Choose Views > Column Statistics. A window containing some statistics is displayed. You can choose which statistics are displayed by choosing Display from the menu. Select Name, Mean, SD, nGood and Median. Given the presence of outliers in your data, you should probably choose the Median of the deltaMag column as the best estimate of the zeropoint.

The uncertainty in your zero point is important. Changing the zero point will change the location of all of the stars in a colour-magnitude diagram. Therefore, the uncertainty in your zero point should not be combined with the measurement uncertainties in your instrumental magnitude. It will, however, act as a systematic error on the position of stars in your CMD and would affect, for example, distances and ages derived from isochrone fitting.

We can make our final, calibrated catalog in topcat. Make sure the table containing only the instrumental magnitudes is highlighted. Choose Views > Column Info. With the column info window active, choose Columns > New Synthetic Column. Call the column "Bmag” and in the expression box, type "Magnitude + 24.24", where 24.24 should be replaced with the zero point you found in your data.

At this point, it’s a good idea to save your table containing your final magnitudes in CSV format. Make sure the correct table is highlighted in the main window and choose File > Save Table(s)/Session. Select CSV as the Output Format and use the System Browser to choose an appropriate save location and filename.

#### Constructing a Colour-Magnitude Diagram

To make a colour magnitude diagram, we need data in a different filter. I have produced a calibrated V-band catalog from another image, following exactly the steps in this tutorial. The catalog is located at NGC869\Cats.