## GNU Astronomy Utilities

Next: , Previous: , Up: Arithmetic operators   [Contents][Index]

#### 6.2.3.4 Unit conversion operators

It often happens that you have data in one unit (for example, magnitudes to measure the brightness of a galaxy), but would like to convert it into another (for example, electron counts on your CCD). While the equations for the unit conversions can be easily found on the internet, the operators in this section are designed to simplify the process and let you do it easily.

counts-to-mag

Convert counts (usually CCD outputs) to magnitudes using the given zero point. The zero point is the first popped operand and the count image or value is the second popped operand.

for example, assume you have measured the standard deviation of the noise in an image to be 0.1 counts, and the image’s zero point is 22.5 and you want to measure the per-pixel surface brightness limit of the dataset133. To apply this operator on an image, simply replace 0.1 with the image name, as described below.

$astarithmetic 0.1 22.5 counts-to-mag --quiet  Of course, you can also convert every pixel in an image (or table column in Table’s Column arithmetic) with this operator if you replace the second popped operand with an image/column name. For an example of applying this operator on an image, see the description of surface brightness in Brightness, Flux, Magnitude and Surface brightness, where we will convert an image’s pixel values to surface brightness. mag-to-counts Convert magnitudes to counts (usually CCD outputs) using the given zero point. The zero point is the first popped operand and the magnitude value is the second. for example, if an object has a magnitude of 20, you can estimate the counts corresponding to it (when the image has a zero point of 24.8) with this command: Note that because the output is a single number, we are using --quiet to avoid printing extra information. $ astarithmetic 20 24.8 mag-to-counts --quiet

counts-to-sb

Convert counts to surface brightness using the zero point and area (in units of arcsec$$^2$$). The first popped operand is the area (in arcsec$$^2$$), the second popped operand is the zero point and the third are the count values. Estimating the surface brightness involves taking the logarithm. Therefore this operator will produce NaN for counts with a negative value.

for example, with the commands below, we read the zero point from the image headers (assuming it is in the ZPOINT keyword), we calculate the pixel area from the image itself, and we call this operator to convert the image pixels (in counts) to surface brightness (mag/arcsec$$^2$$).

$zero point=$(astfits image.fits --keyvalue=ZPOINT -q)
$pixarea=$(astfits image.fits --pixelareaarcsec2)
$astarithmetic image.fits$zero point $pixarea counts-to-sb \ --output=image-sb.fits  For more on the definition of surface brightness see Brightness, Flux, Magnitude and Surface brightness, and for a fully tutorial on optimal usage of this, see FITS images in a publication. sb-to-counts Convert surface brightness using the zero point and area (in units of arcsec$$^2$$) to counts. The first popped operand is the area (in arcsec$$^2$$), the second popped operand is the zero point and the third are the surface brightness values. See the description of counts-to-sb for more. mag-to-sb Convert magnitudes to surface brightness over a certain area (in units of arcsec$$^2$$). The first popped operand is the area and the second is the magnitude. For example, let’s assume you have a table with the two columns of magnitude (called MAG) and area (called AREAARCSEC2). In the command below, we will use Column arithmetic to return the surface brightness. $ asttable table.fits -c'arith MAG AREAARCSEC2 mag-to-sb'

sb-to-mag

Convert surface brightness to magnitudes over a certain area (in units of arcsec$$^2$$). The first popped operand is the area and the second is the magnitude. See the description of mag-to-sb for more.

counts-to-jy

Convert counts (usually CCD outputs) to Janskys through an AB-magnitude based zero point. The top-popped operand is assumed to be the AB-magnitude zero point and the second-popped operand is assumed to be a dataset in units of counts (an image in Arithmetic, and a column in Table’s Column arithmetic). For the full equation and basic definitions, see Brightness, Flux, Magnitude and Surface brightness.

for example, SDSS images are calibrated in units of nanomaggies, with a fixed zero point magnitude of 22.5. Therefore you can convert the units of SDSS image pixels to Janskys with the command below:

$astarithmetic sdss-image.fits 22.5 counts-to-jy  jy-to-counts Convert Janskys to counts (usually CCD outputs) through an AB-magnitude based zero point. This is the inverse operation of the counts-to-jy, see there for usage example. mag-to-jy Convert AB magnitudes to Janskys, see Brightness, Flux, Magnitude and Surface brightness. jy-to-mag Convert Janskys to AB magnitude, see Brightness, Flux, Magnitude and Surface brightness. au-to-pc Convert Astronomical Units (AUs) to Parsecs (PCs). This operator takes a single argument which is interpreted to be the input AUs. The conversion is based on the definition of Parsecs: $$1 \rm{PC} = 1/tan(1^{\prime\prime}) \rm{AU}$$, where $$1^{\prime\prime}$$ is one arcseconds. In other words, $$1 (\rm{PC}) = 648000/\pi (\rm{AU})$$. For example, if we take Pluto’s average distance to the Sun to be 40 AUs, we can obtain its distance in Parsecs using this command: echo 40 | asttable -c'arith$1 au-to-pc'

pc-to-au

Convert Parsecs (PCs) to Astronomical Units (AUs). This operator takes a single argument which is interpreted to be the input PCs. For more on the conversion equation, see description of au-to-pc. For example, Proxima Centauri (the nearest star to the Solar system) is 1.3020 Parsecs from the Sun, we can calculate this distance in units of AUs with the command below:

echo 1.3020 | asttable -c'arith $1 pc-to-au'  ly-to-pc Convert Light-years (LY) to Parsecs (PCs). This operator takes a single argument which is interpreted to be the input LYs. The conversion is done from IAU’s definition of the light-year (9460730472580800 m $$\approx$$ 63241.077 AU = 0.306601 PC, for the conversion of AU to PC, see the description of au-to-pc). for example, the distance of Andromeda galaxy to our galaxy is 2.5 million light-years, so its distance in kilo-Parsecs can be calculated with the command below (note that we want the output in kilo-parsecs, so we are dividing the output of this operator by 1000): echo 2.5e6 | asttable -c'arith$1 ly-to-pc 1000 /'

pc-to-ly

Convert Parsecs (PCs) to Light-years (LY). This operator takes a single argument which is interpreted to be the input PCs. For the conversion and an example of the inverse of this operator, see the description of ly-to-pc.

ly-to-au

Convert Light-years (LY) to Astronomical Units (AUs). This operator takes a single argument which is interpreted to be the input LYs. For the conversion and a similar example, see the description of ly-to-pc.

au-to-ly

Convert Astronomical Units (AUs) to Light-years (LY). This operator takes a single argument which is interpreted to be the input AUs. For the conversion and a similar example, see the description of ly-to-pc.

#### Footnotes

##### (133)

The per-pixel surface brightness limit is the magnitude of the noise standard deviation. For more on surface brightness see Brightness, Flux, Magnitude and Surface brightness. In the example command, because the output is a single number, we are using --quiet to avoid printing extra information.

Next: Statistical operators, Previous: Constants, Up: Arithmetic operators   [Contents][Index]