From 681073e6bcafc46d38bcb46b189f77d18d6ba434 Mon Sep 17 00:00:00 2001 From: Thomas Lemon Date: Mon, 13 Apr 2026 10:12:01 -0700 Subject: [PATCH 1/3] Add calibration due date to Keithley save_calibration util func --- src/qcodes/calibrations/keithley.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/qcodes/calibrations/keithley.py b/src/qcodes/calibrations/keithley.py index d981d13e1e95..a86cf9f852a3 100644 --- a/src/qcodes/calibrations/keithley.py +++ b/src/qcodes/calibrations/keithley.py @@ -28,8 +28,14 @@ def setup_dmm(dmm: Instrument) -> None: def save_calibration(smu: Keithley26xx) -> None: calibration_date = int(time.time()) + one_year_in_seconds = 31536000 + for smu_channel in smu.channels: smu.write(f"{smu_channel.channel}.cal.adjustdate = {calibration_date}") + smu.write(f"{smu_channel.channel}.cal.date = {calibration_date}") + smu.write( + f"{smu_channel.channel}.cal.due = {calibration_date + one_year_in_seconds}" + ) smu.write(f"{smu_channel.channel}.cal.save()") From 1588c2da946fbd461dd91b913f0ca9f4c6265df0 Mon Sep 17 00:00:00 2001 From: Thomas Lemon Date: Mon, 13 Apr 2026 10:50:52 -0700 Subject: [PATCH 2/3] Add feature for setting calibration due date --- src/qcodes/calibrations/keithley.py | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/qcodes/calibrations/keithley.py b/src/qcodes/calibrations/keithley.py index a86cf9f852a3..e165b3b4b470 100644 --- a/src/qcodes/calibrations/keithley.py +++ b/src/qcodes/calibrations/keithley.py @@ -26,15 +26,28 @@ def setup_dmm(dmm: Instrument) -> None: dmm.autorange("OFF") -def save_calibration(smu: Keithley26xx) -> None: +def save_calibration( + smu: Keithley26xx, calibration_due_in_years_from_today: float = 1.0 +) -> None: + """Saves calibration for Keithley 2600 SMUs and sets a calibration due date + based on years. + + Args: + smu: Keithley 2600 SMU + calibration_due_in_years_from_today: Period added to current date, used to set due date. Defaults to 1.0. + + """ calibration_date = int(time.time()) - one_year_in_seconds = 31536000 + ONE_YEAR_IN_SECONDS = 31536000 + recalibration_due_period = int( + ONE_YEAR_IN_SECONDS * calibration_due_in_years_from_today + ) for smu_channel in smu.channels: smu.write(f"{smu_channel.channel}.cal.adjustdate = {calibration_date}") smu.write(f"{smu_channel.channel}.cal.date = {calibration_date}") smu.write( - f"{smu_channel.channel}.cal.due = {calibration_date + one_year_in_seconds}" + f"{smu_channel.channel}.cal.due = {calibration_date + recalibration_due_period}" ) smu.write(f"{smu_channel.channel}.cal.save()") @@ -45,6 +58,7 @@ def calibrate_keithley_smu_v( src_Z: float = 1e-30, time_delay: float = 3.0, save_calibrations: bool = False, + calibration_due_in_years_from_today: float = 1.0, dmm_range_per_smu_range_mapping: dict[str, float] | None = None, ) -> None: if dmm_range_per_smu_range_mapping is None: @@ -76,7 +90,9 @@ def calibrate_keithley_smu_v( ) if save_calibrations: - save_calibration(smu) + save_calibration( + smu, calibration_due_in_years_from_today=calibration_due_in_years_from_today + ) def calibrate_keithley_smu_v_single( From eb3a11feb24562467b23bf170fe6b7a25f0f6e4a Mon Sep 17 00:00:00 2001 From: Thomas Lemon Date: Tue, 14 Apr 2026 10:28:09 -0700 Subject: [PATCH 3/3] Add newsfragment for keithley calibration improvment --- docs/changes/newsfragments/8040.improved | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/changes/newsfragments/8040.improved diff --git a/docs/changes/newsfragments/8040.improved b/docs/changes/newsfragments/8040.improved new file mode 100644 index 000000000000..90f354177166 --- /dev/null +++ b/docs/changes/newsfragments/8040.improved @@ -0,0 +1 @@ +Added calibration due date to Keithley calibration utility functions.