Skip to content

Commit e69ebdf

Browse files
committed
Some updates and fixes from bench testing
1 parent 109154b commit e69ebdf

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

src/pythonequipmentdrivers/sink/_kikusui_plz1004wh.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ def configure_sequence(
464464
continue
465465
step_idx = first_step_idx + offset
466466
# store the current of the step
467-
curr = self.query_resource(f"prog:fsp:edit? {step_idx}")
467+
curr = self.query_resource(f"prog:fsp:edit? {step_idx}").split(",")[0]
468468
# write the step with a trigger
469469
self.write_resource(f"prog:fsp:edit {step_idx},{curr},1")
470470

@@ -483,6 +483,7 @@ def configure_pulse_seqeunce(
483483
initial_idle_time: float = 10e-3,
484484
idle_current: float = 0.0,
485485
current_range: str = "HIGH",
486+
keep_load_on: bool = False,
486487
) -> None:
487488
"""
488489
Configure the load to produce a single pulse sequence consisting of an initial
@@ -507,25 +508,27 @@ def configure_pulse_seqeunce(
507508
current_range (str, optional): Range setting to use (LOW, MED, HIGH). Refer
508509
to manual for the maximum current that each range is capable of.
509510
Typically LOW = 1.32A, MED = 13.2A, and HIGH = 132A. Defaults to "HIGH".
511+
keep_load_on (bool, optional): Keep the load at the specified idle_current
512+
after the sequence completes. Defaults to False.
510513
"""
511514
END_IDLE_TIME = 1e-3
512515
seq_len = initial_idle_time + pulse_width + END_IDLE_TIME
513516
if trig_delay + initial_idle_time > seq_len:
514517
ValueError(f"{trig_delay=} not valid for {seq_len=}")
515518
steps = list(
516519
itertools.chain(
517-
itertools.repeat(
518-
SequenceStep(idle_current), round(initial_idle_time / step_size)
519-
),
520-
itertools.repeat(
521-
SequenceStep(pulse_current), round(pulse_width / step_size)
522-
),
523-
itertools.repeat(
524-
SequenceStep(idle_current), round(END_IDLE_TIME / step_size)
525-
),
520+
521+
(SequenceStep(idle_current) for _ in range(round(initial_idle_time / step_size))),
522+
523+
(SequenceStep(pulse_current) for _ in range(round(pulse_width / step_size))),
524+
525+
(SequenceStep(idle_current) for _ in range(round(END_IDLE_TIME / step_size))),
526526
)
527527
)
528528
# +1 since trigger occurs at the beginning of a step
529529
trigger_idx = round((initial_idle_time + trig_delay) / step_size + 1)
530530
steps[trigger_idx].trigger = True
531531
self.configure_sequence(steps, current_range, step_size)
532+
if keep_load_on:
533+
self.write_resource(f"prog:linp {1 if idle_current else 0}")
534+
self.write_resource(f"prog:lval {idle_current}")

0 commit comments

Comments
 (0)