Convert .pkl calibration to new .nc format
What happened?
The new NetCDF (NC) format for calibration files addresses the fragile portability of PLK files. Changes in dependencies like xarray and NumPy often render PLK files usable only with the exact package versions they were created with. The new format eliminates this dependency issue by adopting a universal, self-contained structure, ensuring broader compatibility across different environments.
The change has been introduced in version 0.4.0 of openhsi. For now .pkl calibration are supported for backward comptability, but are converetd to .nc by default. A future version may remove this.
How to Convert
Setup A Clean Enviroment
The easiest way to convert an existing calibration file is to upgrade OpenHSI to version 0.4.0 in a working environment. When you first load the PKL file, it will automatically be converted to the NC format (unless you ask OpenHSI not too).
If starting in a fresh environment, first install OpenHSI version 0.3.2 along with its dependencies. Then, upgrade to OpenHSI version 0.4.0 without installing additional dependencies.
An example of doing this on Google Colab is avalaible below, but similar actions in a clean python enviroment should also work.
Google Colab is a simple way to make the conversion
!pip install openhsi==0.3.2
!pip install openhsi==0.4.0 --no-deps
from openhsi.data import CameraProperties
with CameraProperties(cal_path='cam_calibration.pkl') as cam:
pass