Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.

Sometimes the instrument specialists give us new calibrations, usually just a dead strip list for TKR , 3 or three at a time for CAL (asym, MeV/DAC, peds) at a time for CAL. They These need to be put in a standard place, registered in the calibration database, and set active. This requires picking a time when validity switches from the previous set to the new one. We want this to happen between runs. The gaps between non-SAA runs are short, and CALDB doesn't do leap seconds, so you should put the transitions near the middle of an SAA passage - the first one after the last run that we have data for.


In general, it is probably better to do the updates early in the week rather than later in case there are any problems.

Database Update Scripts

There are three Python scripts created for the database updates:

  • - This is the script that actually does the database update.  Technically, it's the only one you really need.  You give it the UTC start time for the calibration to take effect and the names of the new calibration filesfile(s).  It adds a new row in the database table for the each file and changes the end time of the previous calibration file to the start time of the new file.
  • - This runs executes the exact same three database queries the L1 pipeline does when getting the each type of calibration file.  The first query gets the "ser_no", which is basically the row number in the table.  The second gets the "data_ident" (file name) and a few other parameters for that the ser_no, and the third prints out the start and end times ("vstart" and "vend") for using that calibration file.  By default, the script will show it for the current time (in UTC) but you can set it to another time.  This is useful for checking what the pipeline will choose before and after the start time you give it.
  • - You can use this script to more generally view prints the contents of the database table.  By default, it will print out the last two rows for each of the four calibration types we update (which should be the previous and current calibrations).  The script also has various options to change the rows and columns output.


The update script performs various checks and will exit with an error if any of these conditions fail:

  • It checks that The calibration files exist where they are supposed to.
  • It checks that the The time you give it is valid.  If it is It should have the correct format (YYYY-MM-DD HH:MM:SS) and cannot be in the past or more than 24 hours in the future, it will give an error.  The 24 hours is an arbitrary limit just to make sure you're got giving it a very wrong date by accident.
  • It checks if a The calibration file with the same name is not already in the database (based on the file name), so you can't accidentally enter a duplicate.
  • For tracker files, it checks that the version number in the file name is higher than the current version. 
  • For non-tracker files, it checks that the file name numbers are 6 greater than for the previous calibration file values, e.g., pedavr_658m_662m.xml should be followed by pedavr_664m_668m.xml and checks that the two numbers in the file name are 4 apart. Each file is meant to cover 6 megaseconds and are created from three 2 Ms files, so 240m-244m is made of the 240m, 242m, and 244m files.  These two checks are taken from information on the file name on the page Working Group on Calibration Issues. They can be relaxed if they end up being too strict.


  1. Send a message to and cc to ask for an account on the MySQL server with the same permissions on the calib and calib_test databases as the horner account.   They should send you a password.
  2. Create a MySQL options file in your home directory called ~/.my_cal.cnf.

    1. This file will contain the database access parameters the Python scripts will use, although you can give them .
    2. You can use a different file with the -o parameter. It can be useful to have different files for the calib and calib_test databases.
    3. Change the permissions so that you are the only one who can read it (chmod 600).

  3. Add the following lines to the file:

    Code Block
    titlecnf file
    user=<your database user name>
    password=<your database password>
    database=calib (for testing use calib_test)

    You may need to enclose your password in quotes if it contains certain special characters (like #).


You can then check the database with the script.  For example, after you run the update script but before the calibration start time, it will show the previous calibration file being selected, but you can see the vend time is set to your start time.


Further troubleshooting instructions will be added as issues come uparise.