Last modified: December 2022

AHELP for CIAO 4.16


Context: Tools::CALDB


Find calibration files in the CALDB


calquiz  infile telescope instrument product calfile [outfile] [echo]
[echo_qual] [echo_fidel] [verbose]


`calquiz' is use to query the CALDB for calibrations matching a set of conditions. It may run in two ways:

For detailed information on the structure and operation of the CALDB, see "ahelp caldb" and the Chandra CALDB webpages.


Example 1

unix% calquiz acisf00459N002_evt2.fits product=DET_GAIN calfile=CALDB
unix% pget calquiz outfile

Query the CALDB for the detector gain (DET_GAIN) for the data in acisf00459N002_evt2.fits. The pget tool is used to get the resulting filename from calquiz.par.

Example 2

unix% calquiz sources.wmap8 product=fef_pha calfile=CALDB verbose=1

Use the information in sources.wmap8 to determine which FEF file would be used to create the RMF. calquiz is run with "verbose=1", so the information is printed to the screen:

   Telescope: CHANDRA
  Instrument: ACIS
        Data: FEF_PHA
    Detector: -
  Start-Date: 2002-02-27
  Start-Time: 14:51:49
   Stop-Date: 2002-03-01
   Stop-Time: 01:38:40
  Expression: GRATING=NONE
      Config: /soft/ciao-4.2/CALDB/software/tools/caldb.config
   CXC-caldb: v4.1.0

Found 1 files:

Example 3

unix% calquiz none chandra acis lsfparm \
calfile="CALDB(grating=HETG;fidelity=0:10,quality=:5)" \
echo_qual=yes echo_fidel=yes verb=1

In this example we search for the set of grating line-spread parameter files (used by the mkgrmf tool). The query is specifically for the LSFPARM files for ACIS+HETG that have a FIDELITY value between 0 and 10, and a quality less than 5 (quality=5 are bad). The screen output will look something like:

Found 10 files:
/soft/CALDB/data/chandra/acis/lsfparm/acisheg-1D1999-07-22lsfparmN0003.fits[2] CAL_QUAL=2  FIDELITY=0.000    
/soft/CALDB/data/chandra/acis/lsfparm/acisheg-1D1999-07-22lsfparmN0004.fits[2] CAL_QUAL=0  FIDELITY=0.000    
/soft/CALDB/data/chandra/acis/lsfparm/acisheg1D1999-07-22lsfparmN0003.fits[2] CAL_QUAL=2  FIDELITY=0.000    
/soft/CALDB/data/chandra/acis/lsfparm/acisheg1D1999-07-22lsfparmN0004.fits[2] CAL_QUAL=0  FIDELITY=0.000    
/soft/CALDB/data/chandra/acis/lsfparm/acismeg-1D1999-07-22lsfparmN0003.fits[2] CAL_QUAL=2  FIDELITY=0.000    
/soft/CALDB/data/chandra/acis/lsfparm/acismeg-1D1999-07-22lsfparmN0004.fits[2] CAL_QUAL=0  FIDELITY=1.000    
/soft/CALDB/data/chandra/acis/lsfparm/acismeg-1D1999-07-22lsfparmN0005.fits[2] CAL_QUAL=0  FIDELITY=2.000    
Warning: too many files returned; outfile string will be truncated.
/soft/CALDB/data/chandra/acis/lsfparm/acismeg1D1999-07-22lsfparmN0003.fits[2] CAL_QUAL=2  FIDELITY=0.000    
/soft/CALDB/data/chandra/acis/lsfparm/acismeg1D1999-07-22lsfparmN0004.fits[2] CAL_QUAL=0  FIDELITY=1.000    
/soft/CALDB/data/chandra/acis/lsfparm/acismeg1D1999-07-22lsfparmN0005.fits[2] CAL_QUAL=0  FIDELITY=2.000    

With the echo_qual and echo_fidel parameters both set to yes, it is clear that the set of 10 files contains a mixture of quality and fidelity values for different version (N000x) of the LSFPARM files.

The warning in this case refers to the outfile parameter. With this many files located, the string-length maximum of the outfile parameter is exceeded and will be truncated.


name type ftype def min max reqd
infile file input       yes
telescope string         yes
instrument string         yes
product string         yes
calfile string   CALDB     yes
outfile string output        
echo boolean   no     no
echo_qual boolean   no     no
echo_fidel boolean   no     no
verbose integer   0 0 5  

Detailed Parameter Descriptions

Parameter=infile (file required filetype=input)

Input file name

The input file from which the metadata needed to complete the CALDB lookup is obtained. This includes things such as DATE-OBS, DATE-END, INSTRUME, TELESCOP, etc. The file can be either a datamodel file or a parameter file. It can also be left blank and users can use the `telescope' and `instrument' parameters.

Parameter=telescope (string required default=)

Telescope name

The input "telescope" is to replace the "infile" only when the file string is empty. The value of TELESCOP keyword is needed to do the CALDB lookup.

Parameter=instrument (string required default=)

Instrument name

The input "instrument", together with "telescope", is to replace the "infile" when the input file is an empty string. This parameter is optional.

Parameter=product (string required)

Calibration Database product code name

Each data type of data-product in the CALDB has a unique code-name. See the CALDB keywords page for a complete list of code names. Common examples are CTI, DET_GAIN, and P2_RESP.

Parameter=calfile (string required default=CALDB)

The CALDB directive

This parameter indicates that the CALDB should be used to lookup the calibration file and accepts optional arguments to refine the search. Arguments take the form:


The PARAMETER's above are arbitrary, so if for example the CALDB query needs a value for 'GRATTYPE' but no such header keyword exists, you can specify


There are three special directives:

Parameter=outfile (string filetype=output)

The selected file with path and extension appended. It might be also appended with 'CAL_QUAL=value' if 'echo_qual=yes' is set and or appended with 'FIDELITY=value' if 'echo_fidel=yes' is set in the run.

This field is populated after the tool has finished running. The information is also printed to the screen if verbose>0.

Parameter=echo (boolean not required default=no)

Echo value to screen?

Determines if the retrieved value is printed to the screen in addition to being stored in the parameter file.

Parameter=echo_qual (boolean not required default=no)

return quality value?

Returns CA_QUAL value(s) along with the corresponding retrieved file(s) if TRUE.

Parameter=echo_fidel (boolean not required default=no)

return fidelity value?

Returns FIDELITY value(s) along with the corresponding retrieved file(s) if TRUE.

Parameter=verbose (integer default=0 min=0 max=5)

Amount of tool output.


There are no known bugs for this tool.

See Also

ardlib, caldb
calindex, calmerge, calvalid