Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "pythonequipmentdrivers"
version = "2.12.0"
version = "2.12.1"
authors = [
{ name="Anna Giasson", email="AnnaGraceGiasson@GMail.com" },
]
Expand Down
41 changes: 23 additions & 18 deletions src/pythonequipmentdrivers/sink/_kikusui_plz1004wh.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ def measure_power(self) -> float:

def configure_sequence(
self,
steps: list["Kikusui_PLZ1004WH.SequenceStep"],
steps: list[SequenceStep | float],
current_range: str = "HIGH",
step_size: float = 1e-3,
initialize: bool = True,
Expand All @@ -399,11 +399,12 @@ def configure_sequence(
includes a current value and whether or not a trigger pulse should be emitted.

Args:
steps (list[Kikusui_PLZ1004WH.SequenceStep]): A list of SequenceSteps
describing the sequence to be executed. Each step has a load setting and
the option to emit a trigger pulse. A maximum of 1024 steps can be used
but note that transmitting a large number of steps takes significant
time.
steps (list[Kikusui_PLZ1004WH.SequenceStep | float]): A list of SequenceSteps
or floats describing the sequence to be executed. Each step has a load
setting and the option to emit a trigger pulse. A maximum of 1024 steps
can be used but note that transmitting a large number of steps takes
significant time. If floats are supplied then there is assumed to be
no trigger pulse.
current_range (str, optional): Range setting to use (LOW, MED, HIGH). Refer
to manual for the maximum current that each range is capable of.
Typically LOW = 1.32A, MED = 13.2A, and HIGH = 132A. Defaults to "HIGH".
Expand All @@ -419,6 +420,8 @@ def configure_sequence(
MAX_SEQ_LENGTH = 1024

sequence_len = len(steps)
if not isinstance(steps[0], SequenceStep):
steps = [SequenceStep(current) for current in steps]

# validate the inputs
if sequence_len > MAX_SEQ_LENGTH:
Expand Down Expand Up @@ -518,23 +521,25 @@ def configure_pulse_seqeunce(
steps = list(
itertools.chain(
(
SequenceStep(idle_current)
for _ in range(round(initial_idle_time / step_size))
itertools.repeat(
SequenceStep(idle_current), round(initial_idle_time / step_size)
)
),
(
SequenceStep(pulse_current)
for _ in range(round(pulse_width / step_size))
itertools.repeat(
SequenceStep(pulse_current), round(pulse_width / step_size)
)
),
(
SequenceStep(idle_current)
for _ in range(round(END_IDLE_TIME / step_size))
itertools.repeat(
SequenceStep(idle_current), round(END_IDLE_TIME / step_size)
)
),
)
)
# +1 since trigger occurs at the beginning of a step
trigger_idx = round((initial_idle_time + trig_delay) / step_size + 1)
steps[trigger_idx].trigger = True
# replace regular step with a step that emits a trigger pulse
trigger_idx = round((initial_idle_time + trig_delay) / step_size)
steps[trigger_idx] = SequenceStep(steps[trigger_idx].current, trigger=True)
self.configure_sequence(steps, current_range, step_size)
if keep_load_on:
self.write_resource(f"prog:linp {1 if idle_current else 0}")
self.write_resource(f"prog:lval {idle_current}")
self.write_resource(f"prog:linp {1 if idle_current and keep_load_on else 0}")
self.write_resource(f"prog:lval {idle_current}")
2 changes: 1 addition & 1 deletion tests/sink_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,6 @@ def test_configure_pulse_sequence(self, configure_seq_mock: MagicMock):
(self.inst.SequenceStep(0) for _ in range(1)),
)
)
steps[13].trigger = True
steps[12].trigger = True

configure_seq_mock.assert_called_once_with(steps, "HIGH", 1e-3)