# Difference between revisions of "Calculating the number APT needs"

Spitzer and some Herschel images arrive to most users in units of MJy/sr. This is not the same units as most optical images use. If you are doing photometry on Spitzer or Herschel images, you need to take this into account. If you are using APT, you need to tell APT this information, in the form of a scaling factor that you can enter into APT. This page describes how to do it for Spitzer, but can be adapted for Herschel.

# Cookbook for image conversion (or calculating the number APT needs): Method One

## Step zero. What do you have and what do you need?

You have an image in MJy/sr(/px). You have the number of degrees per pixel.

You need to convert the image to MJy(/px), a.k.a "get rid of the steradians." This is also the number that APT needs to do the conversion to MJy.

The things that make this hard are:

• The pixel size of the mosaic changes depending on wavelength and where you got the mosaic, so I can't just give you one number to work for all mosaics every time.
• The "pixels" in the above are kind of a funny, hidden unit and the accounting of it works in some unexpected ways, which is why it's in parentheses above (and below).

## Step one. Find out what the size of the pixels are in your images

For the IRAC-1 mosaic I created for you in July 2006, CDELT1=-0.000339 degrees per pixel, and CDELT2=0.000339 degrees per pixel. (ignore the minus sign; it has something to do with a fits convention.) You can find this out for any given mosaic by looking in the fits header.

## Step two. Find out what the size of the pixels are in square degrees per pixel

```          degrees             degrees              square degrees
0.000339 ------- *  0.000339 ------- = 1.14921e-7 ---------------
pixel               pixel               (square) pixel
```

## Step three. Find out what the conversion is between square degrees and sr.

There are 60 arcminutes in a degree. There are 60 arcseconds in an arcminute.

```60 arcminutes   60 arcseconds     3600 arcseconds
------------- * -------------- =  ---------------
1 degree        1 arcminutes        1 degree
```

Square it!

```  (1 degree)^2 = 1 square degree = (3600 arcsec)^2 = 1.296e7 square arcsec
```

We look up that 1 square arcsec is 2.3504x10^(-11) sr.

```  1.296e7 square arcsec    2.3504e-11 sr                       sr
------------- * ---------------- = 0.0003046118 ------------
square degree    1 square arcsec                square degree
```

## Step four. Find out what the size of the pixels are in sr.

```           square degrees                        sr                       sr
1.14921e-7 ---------------  *  0.0003046118 ------------ = 3.500629e-11  ----
(square) pixel                   square degree                 px
```

## Step five. Convert the units of the image.

```    MJy                       sr    MJy
---------   *  3.500629e-11 ---- = ---
sr                        px    px
```

So you or APT needs to multiply this whole image by 3.500629e-11. This is what APT does with the number that you type into the "More settings" window -- it multiplies the result by the number we enter. The number that you need to enter, then is the number that we just calculated. BUT look at the units of that number. The units of the image (and consequently the photometry you get out) are then in MJy (MegaJanskys). None of the sources will be that bright. If you want to get it in Janskys:

``` 1e6  Jy
----
MJy
```

so then multiply the image (a.k.a. the number above) by 1e6 to get the image (e.g., the result of the photometry) into Jy (or multiply the number you get above by 1e6 before entering it into APT):

``` MJy   1e6  Jy     Jy
--- *     ---- = ----
px         MJy     px
```

For the specific example we're working through, 3.500629e-11 * 1e6 = 3.500629e-5. If you enter that number into APT, the result of its calculation will be in Jy. But, most sources will be even fainter. MOPEX returns results in MICROJANSKYS. If you want to have your results produced in microJy, there are 1e6 uJy in a Jy, and I'll let you do that one.

# Method 2: Alternative but completely equivalent and possibly more straightforward solution

## Step zero. What do you have and what do you need?

You have an image in MJy/sr(/px). You have the number of degrees per pixel.

You need to convert the image to uJy(/px), a.k.a "get rid of the steradians" AND convert to microJanskys to get the numbers to still be reasonable and not very tiny or very large.

The things that make this hard are:

• The pixel size of the mosaic changes depending on wavelength and where you got the mosaic, so I can't just give you one number to work for all mosaics every time.
• The "pixels" in the above are kind of a funny, hidden unit and the accounting of it works in some unexpected ways.

## Step one. Find out what the size of the pixels are in your images

For the IRAC-1 mosaic I created for you in July 2006, CDELT1=-0.000339 degrees per pixel, and CDELT2=0.000339 degrees per pixel. (ignore the minus sign; it has something to do with a fits convention.) For any given mosaic, you can find out these values by looking in the fits header.

## Step two. Convert your image from MJy/sr to uJy/square arcsec

We look up that there are :

```          [uJy/sq. arcsec]
23.5045 -----------------
[MJy/sr]
```

So the first factor to multiply the image by is 23.5045 to get it into uJy/square arcsec. If you are attempting to get the number for APT, this is the first factor to write down on a piece of scrap paper.

## Step three. Find out what the size of the pixels are in square degrees per pixel

```          degrees             degrees              square degrees
0.000339 ------- *  0.000339 ------- = 1.14921e-7 ---------------
pixel               pixel               (square) pixel
```

## Step four. Find out how many square arcsec there are in a pixel.

There are 60 arcminutes in a degree. There are 60 arcseconds in an arcminute.

```60 arcminutes   60 arcseconds     3600 arcseconds
------------- * -------------- =  ---------------
1 degree        1 arcminutes        1 degree
```

Square it!

```  (1 degree)^2 = 1 square degree = (3600 arcsec)^2 = 1.296e7 square arcsec
```

Convert the pixel size.

```            square degrees            square arcsec             square arcsec
1.14921e-7 --------------- * 1.296e7 -------------- = 1.48938 ---------------
(square) pixel            square degree             (square) px
```

## Step five. Convert the image

```     uJy            1.48938  square arcsec      uJy
-----------    *           --------------- = ------
sq arcsec (*px)              (square) px        (px)
```

So multiply the image by another factor of 1.48938 to get it into uJy/px. (If you are trying to get the number for APT, get the factor from way up above, 23.5045, and multiply it by 1.48938 [for this example] to get the number you want to put into APT so that it can do the multiplication for you.) Note that the output of APT will then be in microJanskys.