Difference between revisions of "Xmm"

From Remeis-Wiki
Jump to navigation Jump to search
(Created page with " ====== XMM Data Extraction ====== After the system got updated from Ubuntu 11 to Ubuntu 12 a problem occured with the function "dssetattr" inside the "epchain". This functio...")
 
Line 5: Line 5:
 
This function can set/add an attribute to the HDU (Header/Data Unit).
 
This function can set/add an attribute to the HDU (Header/Data Unit).
 
The solution is to call  
 
The solution is to call  
**'source $SOFTDIR/sas_init.csh'**
+
''''source $SOFTDIR/sas_init.csh''''
 
at the beginning of each script in order to initialize SAS inside your script.
 
at the beginning of each script in order to initialize SAS inside your script.
  
Line 29: Line 29:
 
There were some problems occuring with the XMM-data extraction. Joern has implemented a workaround in the xmmscripts that has to be called as shown in the example below.
 
There were some problems occuring with the XMM-data extraction. Joern has implemented a workaround in the xmmscripts that has to be called as shown in the example below.
 
Here the issues:
 
Here the issues:
  - If your observation includes sub-observations, choose one of them. Do this with "onlyexp=1" not "onlyexp=PNU001" for example.
+
# If your observation includes sub-observations, choose one of them. Do this with "onlyexp=1" not "onlyexp=PNU001" for example.
  - Since our Calibration database gets updated frequently, we ran into the problem that new calibration files only like the latest SAS. As it is very problematic to just install the new SAS, there is a workaround. You have to address the calibration files that are working with our SAS version until the new SAS is installed (we must be patient as this is not trivial). The following, however, works perfectly:
+
# Since our Calibration database gets updated frequently, we ran into the problem that new calibration files only like the latest SAS. As it is very problematic to just install the new SAS, there is a workaround. You have to address the calibration files that are working with our SAS version until the new SAS is installed (we must be patient as this is not trivial). The following, however, works perfectly:
  
 
example:
 
example:
Line 44: Line 44:
  
 
For extracting the data of the Optical Monitor (OM) onboard XMM, there exist three tools which do this automatically: ''omichain'', ''omfchain'' and ''omgchain''.
 
For extracting the data of the Optical Monitor (OM) onboard XMM, there exist three tools which do this automatically: ''omichain'', ''omfchain'' and ''omgchain''.
"i" stands for image mode, "f" for fast mode and "g" for grism mode. Which mode you have can be found on the XMM log browse site: [[http://xmm2.esac.esa.int/external/xmm_obs_info/obs_view_frame.shtml]].
+
"i" stands for image mode, "f" for fast mode and "g" for grism mode. Which mode you have can be found on the XMM log browse site: http://xmm2.esac.esa.int/external/xmm_obs_info/obs_view_frame.shtml.
 
If you want to extract your images you first have to set some paths:
 
If you want to extract your images you first have to set some paths:
  
Line 58: Line 58:
 
     $omichain  #or omfchain, omgchain
 
     $omichain  #or omfchain, omgchain
 
      
 
      
You can also do the extraction step-by-step. For a description see [[http://xmm.esac.esa.int/sas/current/documentation/threads/omi_stepbystep.shtml]].
+
You can also do the extraction step-by-step. For a description see http://xmm.esac.esa.int/sas/current/documentation/threads/omi_stepbystep.shtml.
At the end you should have several images (''*IMAGE*''), region files (''*REGION*'') and source lists (''*SWSRLI*'') for the OM exposures and filters. The nomenclatur for the files are:   
+
At the end you should have several images (<code>*IMAGE*</code>), region files (<code>*REGION*</code>) and source lists (<code>*SWSRLI*</code>) for the OM exposures and filters. The nomenclatur for the files are:   
  
  * IOOOOOOOOOODDUEEETTTTTTSXXX.FFF or POOOOOOOOOODDUEEETTTTTTSXXX.FFF (for PPS product files)
+
* IOOOOOOOOOODDUEEETTTTTTSXXX.FFF or POOOOOOOOOODDUEEETTTTTTSXXX.FFF (for PPS product files)
  * OOOOOOOOOO = XMM-ObsID (10 characters)
+
* OOOOOOOOOO = XMM-ObsID (10 characters)
  * DD = Data source idetifier (here OM)
+
* DD = Data source idetifier (here OM)
  * U = exposure flag (S = sched, U = unsched, X = not aplicable)
+
* U = exposure flag (S = sched, U = unsched, X = not aplicable)
  * EEE = exposure number within the instrument observation (3 characters)
+
* EEE = exposure number within the instrument observation (3 characters)
  * TTTTTT = product type (6 characters)
+
* TTTTTT = product type (6 characters)
  * S = 0 or data subset number/character
+
* S = 0 or data subset number/character
  * XXX = source number or slew step number (3 characters)
+
* XXX = source number or slew step number (3 characters)
  * FFF = file format (3 characters)
+
* FFF = file format (3 characters)
  
From all exposures for one filter a mosaiced sky image is produced which contains ''*SIMAG?.FIT''. The ? stands for the filter: L = UVW1, M = UVM2, S = UVW2, B = B, U = U, V = V.  
+
From all exposures for one filter a mosaiced sky image is produced which contains *SIMAG?.FIT. The ? stands for the filter: L = UVW1, M = UVM2, S = UVW2, B = B, U = U, V = V.  
 
Open the image with ds9 and have a look if your source is seen and where it is. You can check this by loading a region file, produced e.g. by simbad2ds9, into the image.  
 
Open the image with ds9 and have a look if your source is seen and where it is. You can check this by loading a region file, produced e.g. by simbad2ds9, into the image.  
  
Then check the detector images (''P*IMAGE_*000.FIT'') for your source (it can be, that some detector images don't contain your source because the window was off). Load the region file which belongs to the detector image (''*REGION*000.ASC'', e.g. ''P0090050801OMS006IMAGE_0000.FIT'' -> ''I0090050801OMS006REGION0000.ASC'') and identify the number of your source.  
+
Then check the detector images (<code>P*IMAGE_*000.FIT</code>) for your source (it can be, that some detector images don't contain your source because the window was off). Load the region file which belongs to the detector image (<code>*REGION*000.ASC</code>, e.g. <code>P0090050801OMS006IMAGE_0000.FIT</code> -> ''I0090050801OMS006REGION0000.ASC</code>) and identify the number of your source.  
  
{{:satext:image_region.jpeg?200|}}
+
[[File:image_region.jpeg|thumb]]
  
Look into the source list for your exposure (''P*SWSRLI*.FIT'') and note the SRC_ID in the last column. Open the combined source list (''*COMBO*'') and search for your SRC_ID. Here you can find all the magnitudes and fluxes of your source for the different filters.
+
Look into the source list for your exposure (<code>P*SWSRLI*.FIT</code>) and note the SRC_ID in the last column. Open the combined source list (<code>*COMBO*</code>) and search for your SRC_ID. Here you can find all the magnitudes and fluxes of your source for the different filters.
  
  
Line 119: Line 119:
 
by magnitude, e.g.,
 
by magnitude, e.g.,
  
cat GS1826USNO | grep -v '#' | awk '{print $7 "  " $12}' | sort -g >  starlist_sortB
+
cat GS1826USNO | grep -v '#' | awk '{print $7 "  " $12}' | sort -g >  starlist_sortB
 
+
cat GS1826USNO | grep -v '#' | awk '{print $8 "  " $12}' | sort -g >  starlist_sortR
cat GS1826USNO | grep -v '#' | awk '{print $8 "  " $12}' | sort -g >  starlist_sortR
 
  
 
since the B and R magnitudes are columns 7 and 8, and distance from the center
 
since the B and R magnitudes are columns 7 and 8, and distance from the center

Revision as of 15:14, 11 April 2018

XMM Data Extraction

After the system got updated from Ubuntu 11 to Ubuntu 12 a problem occured with the function "dssetattr" inside the "epchain". This function can set/add an attribute to the HDU (Header/Data Unit). The solution is to call 'source $SOFTDIR/sas_init.csh' at the beginning of each script in order to initialize SAS inside your script.

A little example script:


    #!/bin/csh                                        
    source $SOFTDIR/sas_init.csh     # initialize the SAS software 
    set xmmscripts = ${XMMTOOLS}    # make sure the proper xmmscripts are loaded
    
    set obsid = '0147190101'
    set datadir = /eu/X-ray/XMM/data/????/$obsid/odf
    
    ${xmmscripts}/xmmprepare --datadir=$datadir --prepdir=$obsid --pn                     # prepare the data
    ${xmmscripts}/xmmextract --prepdir=$obsid --pn --full                                 # full extraction of the chip
    ${xmmscripts}/xmmextract --prepdir=$obsid --pn --srcreg=src.fits --bkgreg=bkg.fits    # source and background extraction of the chip
    

note that it is usually better to have the data preparation and the extraction in separate scripts (since one usually prepares once and then tries several extractions with different settings). The xmmscripts need the region files to be fits files. You can convert them via

    ds9tocxc outset=outfilename.fits < infilename.reg

Workaround for the xmmscripts

There were some problems occuring with the XMM-data extraction. Joern has implemented a workaround in the xmmscripts that has to be called as shown in the example below. Here the issues:

  1. If your observation includes sub-observations, choose one of them. Do this with "onlyexp=1" not "onlyexp=PNU001" for example.
  2. Since our Calibration database gets updated frequently, we ran into the problem that new calibration files only like the latest SAS. As it is very problematic to just install the new SAS, there is a workaround. You have to address the calibration files that are working with our SAS version until the new SAS is installed (we must be patient as this is not trivial). The following, however, works perfectly:

example:

    #!/bin/csh
    setenv XMMTOOLS /home/wilms/xmmscripts
    source ~wilms/progmapper15/progmapper.csh
    ${XMMTOOLS}/xmmprepare --datadir=/eu/X-ray/XMM/data/2290/0679780201/odf/ 
    --prepdir=./test --pn --analysisdate=2014-01-11T01:05:00.000


XMM OM Data Extraction

For extracting the data of the Optical Monitor (OM) onboard XMM, there exist three tools which do this automatically: omichain, omfchain and omgchain. "i" stands for image mode, "f" for fast mode and "g" for grism mode. Which mode you have can be found on the XMM log browse site: http://xmm2.esac.esa.int/external/xmm_obs_info/obs_view_frame.shtml. If you want to extract your images you first have to set some paths:

    $source $SOFTDIR/sas_init.csh 
    $setenv SAS_ODF path_to_your_data   #normally /eu/X-ray/XMM/data/rev/ObsID/odf/
    $cifbuild
    $setenv SAS_CCF ccf.cif
    $odfingest
    $setenv SAS_ODF `ls -1 *SUM.SAS`

After this you can run

    $omichain   #or omfchain, omgchain
    

You can also do the extraction step-by-step. For a description see http://xmm.esac.esa.int/sas/current/documentation/threads/omi_stepbystep.shtml. At the end you should have several images (*IMAGE*), region files (*REGION*) and source lists (*SWSRLI*) for the OM exposures and filters. The nomenclatur for the files are:

  • IOOOOOOOOOODDUEEETTTTTTSXXX.FFF or POOOOOOOOOODDUEEETTTTTTSXXX.FFF (for PPS product files)
  • OOOOOOOOOO = XMM-ObsID (10 characters)
  • DD = Data source idetifier (here OM)
  • U = exposure flag (S = sched, U = unsched, X = not aplicable)
  • EEE = exposure number within the instrument observation (3 characters)
  • TTTTTT = product type (6 characters)
  • S = 0 or data subset number/character
  • XXX = source number or slew step number (3 characters)
  • FFF = file format (3 characters)

From all exposures for one filter a mosaiced sky image is produced which contains *SIMAG?.FIT. The ? stands for the filter: L = UVW1, M = UVM2, S = UVW2, B = B, U = U, V = V. Open the image with ds9 and have a look if your source is seen and where it is. You can check this by loading a region file, produced e.g. by simbad2ds9, into the image.

Then check the detector images (P*IMAGE_*000.FIT) for your source (it can be, that some detector images don't contain your source because the window was off). Load the region file which belongs to the detector image (*REGION*000.ASC, e.g. P0090050801OMS006IMAGE_0000.FIT -> I0090050801OMS006REGION0000.ASC) and identify the number of your source.

Image region.jpeg

Look into the source list for your exposure (P*SWSRLI*.FIT) and note the SRC_ID in the last column. Open the combined source list (*COMBO*) and search for your SRC_ID. Here you can find all the magnitudes and fluxes of your source for the different filters.


Choosing correct XMM-EPIC filter

Choosing the correct EPIC filter for your observation depends on the visual magnitudes of the other objects (usually stars) in the EPIC field of view.

The XMM user's handbook (sect. 3.3.6; http://xmm.esac.esa.int/external/xmm_user_support/documentation/uhb/epicfilters.html) recommends:

Thick filter: suppress up to magnitudes of -2 to -1 (pn), or +1 to +4 (mos)

Medium filter: if there is nothing above magnitude ~ 6 to 9

Thin filter: for point sources that are 12 mag fainter than thick filter limitations

The UHB notes that these magnitudes apply when you use the full frame mode; if you use a partial window mode, then sources up to 2-3 magnitudes brighter than these values should be okay.

Use the United States Naval Observatory catalog at http://www.nofs.navy.mil/data/fchpix/ to find the stars within a 9' radius.

At that website, enter your R.A. and Decl., and for the output file options in the left column, unclick everything except RA,DEC, magnitude, and offset from center. Then click 'retrieve data' in the right column.

Next window: Click on "USNO B1.0 Star List" to download a gzipped ASCII file with typically hundreds of rows/stars for lines of sight away from the Galactic Plane (or many thousands of rows/stars for lines of sight in the Galactic Plane).

Example file: See /home/markowitz/proposals/xmm2014/GS1826USNO for a Galactic XRB, GS1826, located in the Galactic Bulge (optically-crowded fields).

The star list is ordered by R.A., and but you can then re-order the ASCII list by magnitude, e.g.,

cat GS1826USNO | grep -v '#' | awk '{print $7 "  " $12}' | sort -g >   starlist_sortB
cat GS1826USNO | grep -v '#' | awk '{print $8 "  " $12}' | sort -g >   starlist_sortR

since the B and R magnitudes are columns 7 and 8, and distance from the center of f.o.v. (in arcsec) is column 12

Ignore the rows with zero magnitudes; a zero means unmeasured flux.

For these example files, e.g., /home/markowitz/proposals/xmm2014/starlist_sortB we see that the brightest B- and R-band magnitudes are 10.0-10.3, including some objects that are only 3-5' from the center, and at least one that's only 1.2' from the center, so one cannot use the thin epic filter; one must use the MEDIUM filter for all three EPIC cameras.