Skip to content

Commit

Permalink
rename abort command -> off
Browse files Browse the repository at this point in the history
  • Loading branch information
amitschang committed Oct 23, 2024
1 parent 1ee5082 commit 3ff558a
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion evolver/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion evolver/hardware/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ def __init__(self, *args, **kwargs):
def commit(self):
self.comitted = copy(self.proposal)

def abort(self):
def off(self):
pass
8 changes: 7 additions & 1 deletion evolver/hardware/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Up @@ -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
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Up @@ -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
Expand Up @@ -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
Expand Up @@ -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
Expand Up @@ -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()
Expand Down

0 comments on commit 3ff558a

Please sign in to comment.