GNU Astronomy Utilities

2.8.1 Preparing input and generating exposure map

As mentioned in Pointing pattern design, the assumed goal here is to plan an observations strategy for M94. Let’s assume that after some searching, you decide to write a proposal for the JAST80 telescope at the Observatorio Astrof√≠sico de Javalambre, OAJ73, in Teruel (Spain). The field of view of this telescope’s camera is almost 1.4 degrees wide, nicely fitting M94! It also has these two filters that you need74.

Before we start, as described in Pointing pattern simulation, it is just important to remember that the ideal pointing pattern depends primarily on your scientific objective, as well as the limitations of the instrument you are observing with. Therefore, there is no single pointing pattern for all purposes. However, the tools, methods, criteria or logic to check if your pointing pattern satisfies your scientific requirement are similar. Therefore, you can use the same methods, tools or logic here to simulate or verify that your pointing pattern will produce the products you expect after the observation.

To start simulating a pointing pattern for a certain telescope, you just need a single-exposure image of that telescope with WCS information. In other words, after astrometry, but before warping into any other pixel grid (to combine into a deeper stack). The image will give us the default number of the camera’s pixels, its pixel scale (width of pixel in arcseconds) and the camera distortion. These are reference parameters that are independent of the position of the image on the sky.

Because the actual position of the reference image is irrelevant, let’s assume that in a previous project, presumably on NGC 4395, you already had the download command of the following single exposure image. With the last command, please take a look at this image before continuing and explore it.

$ mkdir pointing-tutorial
$ cd pointing-tutorial
$ mkdir input
$ siapurl=
$ wget $siapurl/jplus-dr3/reduced/get_fits?id=1050345 \
       -O input/jplus-1050345.fits.fz

$ astscript-fits-view input/jplus-1050345.fits.fz

This is the first time I am using an instrument: In case you haven’t already used images from your desired instrument (to use as reference), you can find such images from their public archives; or contacting them. A single exposure images is rarely of any scientific value (post-processing and stacking is necessary to make high-level and science-ready products). Therefore, they become publicly available very soon after the observation date; furthermore, calibration images are usually public immediately.

As you see from the image above, the T80Cam images are large (9216 by 9232 pixels). Therefore, to speed up the pointing testing, let’s down-sample the image by a factor of 10. This step is optional and you can safely use the full resolution, which will give you a more precise stack. But it will be much slower (maybe good after you have an almost final solution on the down-sampled image). We will call the output ref.fits (since it is the “reference” for our test). We are putting these two “input” files (to the script) in a dedicated directory to keep the running directory clean (and be able to easily delete temporary/test files for a fresh start with a ‘rm *.fits’).

$ astwarp input/jplus-1050345.fits.fz --scale=1/10 -oinput/ref.fits

For a first trial, let’s create a cross-shaped pointing pattern with 5 points around M94, which is centered at its center on the RA and Dec of 192.721250, 41.120556. We’ll center one exposure on the center of the galaxy, and include 4 more exposures that are each 1 arc-minute away along the RA and Dec axes. To simplify the actual command later75, let’s also include the column names in pointing.txt through two lines of metadata. Also note that the pointing.txt file can be made in any manner you like, for example, by writing the coordinates manually on your favorite text editor, or through another programming language or logic, or etc. Here, we are using AWK because it is sufficiently powerful for this job, and it is a very small program that is available on any Unix-based operating system (allowing you to easily run your programs on any computer).

$ step_arcmin=1
$ center_ra=192.721250
$ center_dec=41.120556

$ echo "# Column 1: RA  [deg, f64] Right Ascension"  > pointing.txt
$ echo "# Column 2: Dec [deg, f64] Declination"     >> pointing.txt

$ echo $center_ra $center_dec \
       | awk '{s='$step_arcmin'/60; fmt="%-10.6f %-10.6f\n"; \
               printf fmt, $1,   $2; \
               printf fmt, $1+s, $2; \
               printf fmt, $1,   $2+s; \
               printf fmt, $1-s, $2; \
               printf fmt, $1,   $2-s}' \
       >> pointing.txt

With the commands below, let’s have a look at the produced file, first as plain-text, then with TOPCAT (which needs conversion to FITS). After TOPCAT is opened, in the “Graphics” menu, select “Plane plot” to see the five points in a flat RA, Dec plot.

$ cat pointing.txt
# Column 1: RA  [deg, f64] Right Ascension
# Column 2: Dec [deg, f64] Declination
192.721250 41.120556
192.737917 41.120556
192.721250 41.137223
192.704583 41.120556
192.721250 41.103889

$ asttable pointing.txt -opointing.fits
$ astscript-fits-view pointing.fits
$ rm pointing.fits

We are now ready to generate the exposure map of the pointing pattern above using the reference image that we downloaded before. Let’s put the center of our final stack to be on the center of the galaxy, and we’ll assume the stack has a size of 2 degrees. With the second command, you can see the exposure map of the final stack. Recall that in this image, each pixel shows the number of input images that went into it.

$ astscript-pointing-simulate pointing.txt --output=stack.fits \
           --img=input/ref.fits --center=$center_ra,$center_dec \

$ astscript-fits-view stack.fits

You will see that except for a thin boundary, we have a depth of 5 exposures over the area of the single exposure. Let’s see what the width of the deepest part of the image is. First, we’ll use Arithmetic to set all pixels that contain less than 5 exposures (the outer pixels) to NaN (Not a Number). In the same Arithmetic command, let’s trim all the blank rows and columns, so the output only contains the pixels that are exposed 5 times. With the next command, let’s view the deep region and with the last command below, let’s use the --skycoverage option of the Fits program to see the coverage of deep part on the sky.

$ deep_thresh=5
$ astarithmetic stack.fits set-s s s $deep_thresh lt nan where trim \

$ astscript-fits-view deep.fits

$ astfits deep.fits --skycoverage
Input file: deep.fits (hdu: 1)

Sky coverage by center and (full) width:
  Center: 192.72125      41.120556
  Width:  1.880835157    1.392461166

Sky coverage by range along dimensions:
  RA       191.7808324    193.6616676
  DEC      40.42058203    41.81304319

As we see, in declination, the width of this deep field is about 1.4 degrees. Recall that RA is only defined on the equator and actual coverage in RA depends on the declination due to the spherical nature of the sky. This area therefore nicely covers the expected outer parts of M94. On first thought, it may seem that we are now finished, but that is not the case unfortunately!

There is a problem: with a step size of 1 arc-minute, the brighter central parts of this large galaxy will always be on very similar pixels; making it hard to calibrate those pixels properly. If you are interested in the low surface brightness parts of this galaxy, it is even worse: the outer parts of the galaxy will always cover similar parts of the detector in all the exposures; and they cover a large area on your image. To be able to accurately calibrate the image (in particular to estimate the flat field pattern and subtract the sky), you do not want this to happen! You want each exposure to cover very different sources of astrophysical signal, so you can accurately calibrate the artifacts created by the instrument or environment (for example flat field) or of natural causes (for example the Sky).

For an example of how these calibration issues can ruin low surface brightness science, please see the image of M94 in the Legacy Survey interactive viewer. After it is loaded, at the bottom-left corner of the window, write “M94” in the box of “Jump to object” and press ENTER. At first, M94 looks good with a black background, but as you increase the “Brightness” (by scrolling it to the right and seeing what is under the originally black pixels), you will see the calibration artifacts clearly.



For full disclosure, Gnuastro is being developed at CEFCA (Centro de Estudios de Física del Cosmos de Aragón); which also hosts OAJ.


For the full list of available filters, see the T80Cam description.


Instead of this, later, when you called astscript-pointing-simulate, you could pass the --racol=1 and --deccol=2 options. But having metadata is always preferred (will avoid many bugs/frustrations in the long-run!).