Last modified: June 2019

URL: https://cxc.cfa.harvard.edu/ciao/ahelp/check_caldb_version.html
Jump to: Description · Examples · See Also


AHELP for CIAO 4.17

check_caldb_version

Context: contrib

Synopsis

Check whether the locally-installed version of the Chandra Calibration DataBase (CALDB) is up to date

Syntax

check_caldb_version(version=None)

The return value is None or a tuple of (version checked against,
latest-version).

Description

The check_caldb_version() checks that the locally-installed version of the Chandra CALDB is up to date. If it is, then the routine returns None, otherwise a tuple is returned, containing the version checked against and the latest version (both as strings).

The version argument

The version argument is used to define the version of the CALDB to check against. A value of None means that the version of the locally-installed Chandra CALDB is used, otherwise it should be a string such as "4.2.2". An error will be thrown if the version number is not recognized.

The routine requires that the computer is on-line and able to access the CALDB web site.

What is checked

The routine only checks the main Chandra CALDB package; it does not look for updates to any additional packages that may be installed, such as the background or PSF files.

CALDB downloads

The CALDB web site can be used to download newer versions of the Chandra CALDB, as can the ciao_install tool.

Loading the routine

The routine can be loaded into Python by saying:

from ciao_contrib.caldb import *

Examples

Example 1

>>> check_caldb_version()

If the CALDB installation is up to date then v will be None, so there will be no screen output above, otherwise you will see something like the following

         ('4.2.0', '4.2.2')

which says that the installed version if 4.2.0, but that the latest release is version 4.2.2.

Example 2

>>> check_caldb_version("4.2.1")

Here we check whether version 4.2.1 is the latest version available.

Example 3

The following fragment shows how the routine can be used in a script to check whether the CALDB is up to date:

from ciao_contrib.caldb import *
v = check_caldb_version()
if v == None:
    print("CALDB is up to date")
else:
    print("The installed CALDB version of {0} needs updating to {1}".format(v))

See Also

contrib
ciao_caldb, get_caldb