# How can I calculate upper limits at a given source position?

Generally you can download a given image from the archive and use ROSAT data reduction software (PROS, EXSAS or XSELECT). Probably the quickest way to determine upper limits is to use the " SOSTA" (source statistics) tool available in the XIMAGE image processing package.

Note: if you are trying to calculate an upper limit from ROSAT all sky survey images, you should delete the DTCOR keyword from the image header before calculating the upper limit in XIMAGE, otherwise you'll get a spurious (negative) result. You can delete the DTCOR keyword using fthedit. For example:

```% fthedit rs931557n00_im1.fits DTCOR delete
```
To calculate an upper limit:
1. start XIMAGE and read in the image and exposure maps
```

% ximage
******************************************************************************
*                              Welcome to XIMAGE                             *
******************************************************************************

Type "help" for help

VERSION 4.5.1  13:28:15 19-Oct-2011

No of detectors read in:   30
[XIMAGE>
Enter file name:rp200108n00_im1.fits.Z
Telescope ROSAT PSPCB
WARNING:  assuming DRPIX based on mission info
Image size = 512 x 512 pixels
Image rebin = 30.00
Image center = 7680.5, 7680.5
Image level, min = 0.0000000 max = 48.000000
Copied MAP1 to MAP9
Enter file name:rp200108n00_mex.fits.Z
Telescope ROSAT PSPCB
WARNING:  assuming DRPIX based on mission info
Image size = 512 x 512 pixels
Image rebin = 30.00
Image center = 7680.5, 7680.5
Image level, min = 0.0000000 max = 1601.5461
```
2. Next, display the image using the "xtk" device
```[XIMAGE> cpd /xtk
[XIMAGE> display
Plotting image
Min =   0.0000000      Max =    48.000000
```

Display of zoomed in region of rp200108n00_im1.fits. Boxes show the regions used for SOSTA, chosen interactively via the cursor.

3. Then use SOSTA to interactively select the region for which you want to calculate the upper limit
```[XIMAGE> sosta
Using MAP1
Using a locally computed background
Select the center of source box (Right button exits)
```
4. And here's the output from SOSTA, including the 3-sigma upper limit:
```                    X = 5568.6411    Y = 8672.2266
Using average energy for PSF:    1.0000000
Source half-box for 0.66 EEF is  103.1 pixels
Half-box for 0.90 EEF is  170.1 pixels
Total # of counts 6.0000000 (in 37800 elemental sq pixels)
Innerbox counts 19.000000 in 129600 sq or pixels
Outerbox counts 63.000000 in 455400 sq or pixels
Background counts 44.000000 in 325800 sq pixels
Vignetting is part of exposure map
Background/elemental sq pixel :                1.351E-04 +/- 2.0E-05
Background/elemental sq pixel/sec :            1.725E-07 +/- 2.6E-08

Source counts :                                8.950E-01 +/- 2.6E+00
s.c. corrected for PSF + sampling dead time
+ vignetting    1.328E+00 +/- 3.8E+00
Source intensity :                             1.143E-03 +/- 3.3E-03 c/sec
s.i. corrected for PSF + sampling dead time
+ vignetting -> 1.696E-03 +/- 4.9E-03 c/sec
Signal to Noise Ratio             :            3.486E-01
Poisson    Gauss
Pr. that source is a fluctuation of back. :    4.02E-01   3.46E-01

Vignetting corrected exposure :        782.847 s
Sampling dead time correction :      0.968
PSF correction                :      1.532

Three sigma upper limit : 2.37E-02 cts/s
Optimum half box size is      : 106.50000 orig pixels