Last modified: 2 April 2024

URL: https://cxc.cfa.harvard.edu/csc/download/scripts.html

CIAO scripts Guide

The CIAO contributed-script package contains the search_csc and obsid_search_csc tools for searching the CSC. These scripts provide common "command-line" access services, but do not replicate all the functionality provided by CSCview.

The scripts default to search release 2.1, but can be changed to search release 2.0 or 1.1 with the catalog parameter

[NOTE]
Check the script version

Please make sure you are using the latest version of CIAO, with the latest script package (at least version 4.16.1). This can be checked by calling

% pget search_csc catalog.p_min
csc2.1|csc2|csc1|current

If it does not include csc2.1 then you must update your CIAO installation.

Search around a position

Data products can be downloaded based on master source coordinates using the search_csc command. Options allow you to select what columns or data products are returned.

The following example returns basic information—the master-source name, position, and observation id—for all sources within one arcminute of Polaris, with output to the screen and no download of associated data products:

unix% search_csc polaris 1 outfile=
search_csc
             pos = polaris
          radius = 1
         outfile = 
         radunit = arcmin
         columns = INDEF
     sensitivity = no
        download = none
            root = ./
           bands = broad,wide
       filetypes = regevt,pha,arf,rmf,lc,psf,regexp
         catalog = csc2.1
         verbose = 1
         clobber = no
            mode = ql


6 rows returned by query
3 Different Master Source(s).
2 Different Observation(s).

name                	ra          	dec         	sepn	obsid	
 2CXO J023149.6+891550	3.796720e+01	8.926406e+01	0.01'	18928	
 2CXO J023149.6+891550	3.796720e+01	8.926406e+01	0.01'	 6431	
 2CXO J023226.1+891537	3.810889e+01	8.926038e+01	0.25'	 6431	
 2CXO J023226.1+891537	3.810889e+01	8.926038e+01	0.25'	18928	
 2CXO J023432.2+891529	3.864368e+01	8.925806e+01	0.65'	 6431	
 2CXO J023432.2+891529	3.864368e+01	8.925806e+01	0.65'	18928	

The script can be run from Python, using the CIAO ciao_contrib.runtool module. The following example finds all sources within 1 arcsecond of RA=38.94521969459174 degrees and Dec=34.68734478897538 degrees, returning the master-source catalog properties in the file srcs.tsv (in a tab-separated form) and also the assocuiated light curve, PHA, RMF, and ARF files:

from ciao_contrib.runtool import search_csc

search_csc('38.94521969459174, 34.68734478897538', 1, 'srcs.tsv',
           radunit='arcsec', download='all', bands='broad',
           filetypes='lc,pha,rmf,arf', catalog='csc2.1')

The default setting for the root parameter means the files are stored in the current directory, using the master-source name:

unix%  tree 2CXOJ023546.8+344115/
2CXOJ023546.8+344115/
├── 01870_000
│   └── hrcf01870_000N030_r0001_arf3.fits.gz
└── 26201_000
    ├── acisf26201_000N030_r0004_arf3.fits.gz
    ├── acisf26201_000N030_r0004b_lc3.fits.gz
    ├── acisf26201_000N030_r0004_pha3.fits.gz
    └── acisf26201_000N030_r0004_rmf3.fits.gz

2 directories, 5 files

The output file can be read with the dmlist tool, using the in-built ASCII support:

unix% dmlist "srcs.tsv[opt kernel=text/tsv]" cols
 
--------------------------------------------------------------------------------
Columns for Table Block srcs.tsv
--------------------------------------------------------------------------------
 
ColNo  Name                 Unit        Type             Range
   1   sepn                              Real4          -Inf:+Inf            
   2   name                              String[22]                          Source name in the format '2CXO Jhhmmss.s{+|-}ddmmss[X]'
   3   ra                   deg          Real4          -Inf:+Inf            Source position, ICRS right ascension
   4   dec                  deg          Real4          -Inf:+Inf            Source position, ICRS declination
...
  62   var_index_b                       Int4           -                    Intra-observation Gregory-Loredo variability index in the range [0, 10]: indicat
  63   var_index_w                       Int4           -                    Intra-observation Gregory-Loredo variability index in the range [0, 10]: indicat
  64   detect_stack_id                   String[24]                          Detect stack identifier (designation of observation stack used for source detect

Search by Observation

The obsid_search_csc script returns a summary and not all the comments —both columns and files—for one or more observation identifiers in the catalog.

unix% obsid_search_csc 6431 sources.6431.tsv catalog=current
obsid_search_csc
           obsid = 6431
         outfile = sources.6431.tsv
         columns = INDEF
        download = none
            root = ./
           bands = broad,wide
       filetypes = regevt,pha,arf,rmf,lc,psf,regexp
         catalog = csc2.1
         verbose = 1
         clobber = no
            mode = ql


77 rows returned by query
77 Different Master Source(s).
1 Different Observation(s).

name                	ra          	dec         	obsid	
 2CXO J014518.9+891732	2.633029e+01	8.929224e+01	 6431	
 2CXO J014614.3+891102	2.658675e+01	8.918401e+01	 6431	
 2CXO J014804.8+891233	2.702188e+01	8.920940e+01	 6431	
...

 2CXO J033006.4+890752	5.252755e+01	8.913115e+01	 6431	
 2CXO J033910.1+892223	5.479243e+01	8.937323e+01	 6431	

The screen output only shows a minimal amount of information. The output file - in this case sources.6431.tsv - contains many-more columns:

unix% dmlist "sources.6431.tsv[opt kernel=text/tsv]" cols
 
--------------------------------------------------------------------------------
Columns for Table Block sources.6431.tsv
--------------------------------------------------------------------------------
 
ColNo  Name                 Unit        Type             Range
   1   name                              String[22]                          Source name in the format '2CXO Jhhmmss.s{+|-}ddmmss[X]'
   2   ra                   deg          Real4          -Inf:+Inf            Source position, ICRS right ascension
   3   dec                  deg          Real4          -Inf:+Inf            Source position, ICRS declination
...
  61   var_index_b                       Int4           -                    Intra-observation Gregory-Loredo variability index in the range [0, 10]: indicat
  62   var_index_w                       Int4           -                    Intra-observation Gregory-Loredo variability index in the range [0, 10]: indicat
  63   detect_stack_id                   String[24]                          Detect stack identifier (designation of observation stack used for source detect