Skip to content

Commit

Permalink
factory: tweak salt and reso tests to be more resilient to device-spe…
Browse files Browse the repository at this point in the history
…cific quirks
  • Loading branch information
theacodes committed Feb 1, 2024
1 parent b3f1aaf commit 5f3abbb
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 11 deletions.
39 changes: 29 additions & 10 deletions factory/factory_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from pathlib import Path
import time

import numpy as np
from wintertools import reportcard, thermalprinter, oscilloscope, waveform
from wintertools.print import print
from hubble import Hubble
Expand Down Expand Up @@ -116,13 +117,15 @@ def run_tests(*, hubble: Hubble, report: reportcard.Report):
tests_section.append(test_dc_offset(scope=scope))

if not tests_section.succeeded:
report.ulid = "failed"
return False

print("# Checking reso & salt")
reso_section = test_reso_and_salt(scope=scope, lens=lens)
report.sections.insert(1, reso_section)

if not reso_section.succeeded:
report.ulid = "failed"
return False

print("# Checking waveforms")
Expand Down Expand Up @@ -209,7 +212,7 @@ def test_reso_and_salt(
# Check basic self-oscillation
lens.cv_tests_self_oscillation()

time.sleep(0.4)
time.sleep(1)
wf = scope.get_waveform("c1", WAVEFORM_STEP)

section.append(reportcard.LineGraphItem.from_waveform(wf, label="Self-oscillation"))
Expand Down Expand Up @@ -240,17 +243,22 @@ def test_reso_and_salt(
# Check salt's impact on resonance and self-oscillation. First with CV
# alone and then with the knob.

lens.salt_cv = 4

time.sleep(0.2)
salt_cv_ampl = scope.get_peak_to_peak("c1")
salt_cv_ampl = 0
salt_cv_passed = False
for n in np.linspace(2, 4, num=8):
print(f"Trying {n:0.2f} V...")
lens.salt_cv = n
time.sleep(0.3)
salt_cv_ampl = scope.get_peak_to_peak("c1")
if salt_cv_ampl > 1 and salt_cv_ampl < wf.voltage_span * SELF_OSC_SALT_MIN_ATTENUATION:
salt_cv_passed = True
break

print(
section.append(
reportcard.PassFailItem(
label="Salt CV attenutation",
value=salt_cv_ampl > 1
and salt_cv_ampl < wf.voltage_span * SELF_OSC_SALT_MIN_ATTENUATION,
value=salt_cv_passed,
details=f"{salt_cv_ampl:0.2f}V",
)
)
Expand All @@ -265,15 +273,26 @@ def test_reso_and_salt(
lens.salt_cv = -4
lens.salt_knob = CW

time.sleep(0.2)
time.sleep(1)
salt_knob_ampl = scope.get_peak_to_peak("c1")


salt_knob_ampl = 0
salt_knob_passed = False
for n in np.linspace(-4, -2, num=8):
print(f"Trying {n:0.2f} V...")
lens.salt_cv = n
time.sleep(0.3)
salt_knob_ampl = scope.get_peak_to_peak("c1")
if salt_knob_ampl > 1 and salt_knob_ampl < wf.voltage_span * SELF_OSC_SALT_MIN_ATTENUATION:
salt_knob_passed = True
break

print(
section.append(
reportcard.PassFailItem(
label="Salt knob attenutation",
value=salt_knob_ampl > 1
and salt_knob_ampl < wf.voltage_span * SELF_OSC_SALT_MIN_ATTENUATION,
value=salt_knob_passed,
details=f"{salt_knob_ampl:0.2f}V",
)
)
Expand Down
2 changes: 1 addition & 1 deletion factory/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
lens = NeptuneLens(hubble)
scope = oscilloscope.Oscilloscope()

lens.reset()
# lens.reset()
IPython.embed()

0 comments on commit 5f3abbb

Please sign in to comment.