Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rename abort command -> off
Browse files Browse the repository at this point in the history
amitschang committed Oct 23, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent bf0ee8b commit fdebb69
Showing 8 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion evolver/device.py
Original file line number Diff line number Diff line change
@@ -97,7 +97,7 @@ def abort(self):
self.enable_control = False
self.enable_commit = False
for device in self.effectors.values():
device.abort()
device.off()

def __enter__(self):
return self
8 changes: 7 additions & 1 deletion evolver/hardware/interface.py
Original file line number Diff line number Diff line change
@@ -83,5 +83,11 @@ def commit(self):
pass

@abstractmethod
def abort(self):
def off(self):
"""Immediately turn device into off state.
Used by framework in aborting an experiment. Implementations should
define off condition and implement in such a way that a commit call is
not necessary (i.e. the device turns off upon calling this method).
"""
pass
2 changes: 1 addition & 1 deletion evolver/hardware/standard/led.py
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ def from_brightness(brightness):
comm.communicate(SerialData(addr=self.addr, data=cmd))
self.committed = inputs

def abort(self):
def off(self):
cmd = [b"0"] * self.slots
with self.serial as comm:
comm.communicate(SerialData(addr=self.addr, data=cmd))
6 changes: 3 additions & 3 deletions evolver/hardware/standard/pump.py
Original file line number Diff line number Diff line change
@@ -95,7 +95,7 @@ def commit(self):
comm.communicate(SerialData(addr=self.addr, data=cmd))
self.committed = inputs

def abort(self):
def off(self):
cmd = [b"0"] * self.slots
for pump in self.ipp_pumps:
for solenoid in range(3):
@@ -164,5 +164,5 @@ def commit(self):
self._generic_pump.commit()
self.committed = copy(self.proposal)

def abort(self):
self._generic_pump.abort()
def off(self):
self._generic_pump.off()
2 changes: 1 addition & 1 deletion evolver/hardware/standard/stir.py
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ def commit(self):
comm.communicate(SerialData(addr=self.addr, data=cmd))
self.committed = inputs

def abort(self):
def off(self):
cmd = [b"0"] * self.slots
with self.serial as comm:
comm.communicate(SerialData(addr=self.addr, data=cmd))
2 changes: 1 addition & 1 deletion evolver/hardware/standard/temperature.py
Original file line number Diff line number Diff line change
@@ -71,7 +71,7 @@ def read(self):
def commit(self):
self._do_serial(from_proposal=True)

def abort(self):
def off(self):
cmd = [self.HEAT_OFF] * self.slots
with self.serial as comm:
comm.communicate(SerialData(addr=self.addr, data=cmd))
2 changes: 1 addition & 1 deletion evolver/hardware/test_utils.py
Original file line number Diff line number Diff line change
@@ -125,5 +125,5 @@ def test_abort(self, config_params, values, serial_out):
return
config, command = self.abort_command
hw = _from_config_desc(self.driver, config, {})
hw.abort()
hw.off()
assert hw.evolver.serial.backend.hits_map[command] == 1
4 changes: 2 additions & 2 deletions evolver/tests/test_device.py
Original file line number Diff line number Diff line change
@@ -151,8 +151,8 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.aborted = False

def abort(self):
super().abort()
def off(self):
super().off()
self.aborted = True

demo_evolver.hardware["testeffector"] = AbortEffector()

0 comments on commit fdebb69

Please sign in to comment.