Configure

The middleware can be used locally if you only need to access cached calibration files. However, to retrieve new calibrations from the Keck Observatory Archive (KOA), you will need to connect to the remote KOA calibration database. For now, this is hosted at Keck Observatory.

See the KOA Middleware documentation for details on setting up authentication to access KOA/Keck remotely.

Calibration Cache

The local calibration cache must have the directory structure below. Any sub-folders will be created if they do not exist. The default local SQLite database is named <instrument_name>_calibrations.db where instrument_name is currently either parvi or hispec and be located in the database/ subdirectory. The calibration files are located in the calibrations/<instrument_name> subdirectory.

/koa_calibration_cache/
├── calibrations/
│   └── hispec/
│       ├── hispec_cal1.fits
│       ├── hispec_cal2.fits
│       └── ...
└── database/
    └── hispec_calibrations.db

Environment Variables

The following environment variables can be set to configure the calibration data management:

  • KOA_CALIBRATION_CACHE (Required) Path to cached calibrations directory.

  • KOA_LOCAL_DATABASE_FILENAME (Optional) Local SQLite database filename. Default: <instrument_name>_calibrations.db. Full path is determined by this and the KOA_CALIBRATION_CACHE environment variable.

  • KOA_USE_CACHED_CALIBRATIONS (Optional) Use cached files (‘true’ or ‘false’). Default: ‘true’.

  • KOA_CALDB_SYNC_INTERVAL (Optional) Minimum number of seconds between automatic syncs of the local calibration database from the remote KOA database when a calibration store is opened. 0 syncs every time; a negative value disables automatic syncing. Default: 3600. Each successful sync is logged in the remote_syncs table of the local calibration database, so the interval is shared across processes.

  • KOA_LOCAL_DATABASE_TABLE_NAME (Optional) Local database table name. Default: <instrument_name>

  • KOA_CALIBRATIONS_URL (Optional) Remote database URL. Default: Keck Observer API URL. Default is “https://www3.keck.hawaii.edu/api/calibrations”, and will be replaced with the appropriate KOA URL in the future.

  • KOA_CALIBRATION_ORIGIN (Optional) BEHAVIOR SUBJECT TO CHANGE Behavior for selecting calibrations for processing, and for registering new calibrations to the local database. Options are: “KECK”, “LOCAL”.