# Quick calibration hack to adjust channel gain and offset

Hey all, one of our top requested features is to apply a gain and offset to channels in the software. We do plan to get to this, but we’re heads down on other projects at the moment, and a proper implementation is a long way off. I’d like to share a workaround for users who really could use an analog gain & offset feature in the meantime.

The exact analog voltage range of the device is stored in the device’s calibration file. We’ve suggested here and there in the past that this calibration file could be modified in a pinch to effectively create a gain and offset.

Here is a quick python script that makes this a bit easier. Sorry we don’t have a proper feature for this yet! Our plan is to add a feature directly into the application where you can set a gain, offset, and unit for any channel in the app, and have it take effect instantly.

Usage notes are in the top of the file. To use this, make sure you have a recent version of python installed (likely 3.7+) and download the script using that link.

You can run this script while the Logic 2 software is running, but you will need to restart the software each time you want to make a change. The modified file won’t be read until the software has been restarted, and will need to be restarted again for every change.

Usage:
First locate the calibration file for your device. Calibration files are stored here: C:\Users<your user folder>\AppData\Roaming\Logic\calibrations
The first part of the file name is the base 10 version of the device ID.
If there is more than one .cal file, you can copy the hex device ID shown in the device information dialog into a hex to decimal converter online, to locate the correct cal file.
Copy the absolute path to the calibration file, then run the following command:
python saleae_cal_editor.py "c:\path\to\calibration\file.cal" --ch0-gain 1.001 --ch1-offset 0.12 --ch2-gain 5.002 --ch6-offset -1.3
Use arguments --ch0-gain and --ch0-offset through --ch15-gain and --ch15-offset to optionally edit each analog channel.
The displayed voltage will first be multiplied by the gain, then subtracted by the offset.

1 Like

Super Mark !

Somewhat limited as the graph display doesn’t scale along but definitely a very good workaround!!!

Appreciate the effort for providing this

Thanks

1 Like