|AHELP for CIAO 4.2||
Check whether the locally-installed version of the Chandra Calibration DataBase (CALDB) is up to date
check_caldb_version(version=None) The return value is None or a tuple of (version checked against, latest-version).
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 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.
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.
The routine can be loaded into Sherpa by saying:
from ciao_contrib.caldb import *
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
which says that the installed version if 4.2.0, but that the latest release is version 4.2.2.
Here we check whether version 4.2.1 is the latest version available.
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 %s needs updating to %s" % v)