# Basics of UVOT Grism analysis¶

The main reason for writing this section is to help you navigate around some of the pitfalls that I have encountered when analysing the UVOT Grism spectra; some of which are not always obvious.

## Use DS9 with the grism sky image and DSS¶

Even for one used to see many grism images, locating the source spectrum can be difficult. The automated processing lines up the peaks of the zeroth orders of the sources in the image with the WCS. If everything goes perfect, we can load the grism image and DSS image in DS9, blink them, and the zeroth orders and DSS sources line up nicely. If they don’t, and there are close-by orders that make interpretation too confusing, see Problem with positions in the grism image.

Blinking the DSS and grism sky image while zooming in on the first order will allow a quick determination of contaminating zeroth orders that fall on the first order spectrum. Also, bright sources in the dispersion plane, behind the source can easily be a problem especially in the UV part of the spectrum where the target photon sensitivity is low.

The background zeroth orders that lie close to the first order have been marked.

## Problem with positions in the grism image¶

In the following steps you can either use the sky image (filename includes _sk.img), or the detector image (filename includes _dt.img). The detector image only works for blinking in later versions of DS9 when the WCS in DS9 for the image has been set to WCS-S.

First of all, we need to be sure that we have the header of the sky(det) image in the best possible form. That is, check the header keyword ASPCORR is set to "graspcorr". From the terminal command line, assuming the present working directory is the <obsid>/uvot/image directory and we have a UV Grism image:

\$ftlist sw<obsid>ugu_sk.img hk include=aspcorr


The value should be printed for each extension in the FITS file. If not set, the uvotgraspcorr script should be executed, though uvotgraspcorr fails in a few percent of cases if it cannot reach the catalog server; for some fields with not enough sources of the right brightness in the field; and for some images with large galaxies. It is very difficult to say off-hand how to change the internal parameters for the program to ensure success. This usually means that the keywords accounting for the distortion of the zeroth order positions are not added to the WCSS header keywords. The distortions are increasing to the edges of the detector, where the problem is worst.

Even when uvotgraspcorr finds a solution, there remains some error in the aspect solution larger than that when using a lenticular image for the anchor position, see anchor_error.

If the zeroth orders are clearly offset from the expected positions when blinking the grism sky image with the corresponding DSS image, the header WCS keywords in the grism image sky file can be edited “by hand” to line up the grism zeroth order coordinates. It is smartest to do that for the region close to the target source location, as that will clearly minimize the errors in the analysis.

Note that the grism extraction is not dependent on the aspect correction when the grism image was taken paired with an image in one of the lenticular filters.