-
Notifications
You must be signed in to change notification settings - Fork 38
1048 remove wait from signal w.set and replace with epics specific argument #1134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -15,7 +15,7 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| get_unique, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from ._util import EpicsSignalBackend, get_pv_basename_and_field | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from ._util import EpicsOptions, EpicsSignalBackend, get_pv_basename_and_field | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| class EpicsProtocol(Enum): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -78,14 +78,22 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def _epics_signal_backend( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| datatype: type[SignalDatatypeT] | None, read_pv: str, write_pv: str | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| datatype: type[SignalDatatypeT] | None, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| read_pv: str, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| write_pv: str, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| options: EpicsOptions | None, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) -> SignalBackend[SignalDatatypeT]: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """Create an epics signal backend.""" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| r_protocol, r_pv = split_protocol_from_pv(read_pv) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| w_protocol, w_pv = split_protocol_from_pv(write_pv) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| protocol = get_unique({read_pv: r_protocol, write_pv: w_protocol}, "protocols") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| options = options | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Check failureCode scanning / CodeQL Redundant assignment Error
This assignment assigns a variable to itself.
Copilot AutofixAI 3 days ago To fix the redundant assignment, simply remove the line
Suggested changeset
1
src/ophyd_async/epics/core/_signal.py
Copilot is powered by AI and may make mistakes. Always verify output.
Positive FeedbackNegative Feedback
Refresh and try again.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The AI is right Check noticeCode scanning / CodeQL Unused local variable Note
Variable options is not used.
Copilot AutofixAI 3 days ago To fix the detected problem, remove the line
Suggested changeset
1
src/ophyd_async/epics/core/_signal.py
Copilot is powered by AI and may make mistakes. Always verify output.
Positive FeedbackNegative Feedback
Refresh and try again.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| signal_backend_type = get_signal_backend_type(protocol) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return signal_backend_type(datatype, r_pv, w_pv) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return signal_backend_type( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| datatype, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| r_pv, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| w_pv, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def epics_signal_rw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -95,6 +103,8 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: str = "", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| timeout: float = DEFAULT_TIMEOUT, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| attempts: int = 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| wait: bool = True, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| no_wait_when_setting: set[SignalDatatypeT] | None = None, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) -> SignalRW[SignalDatatypeT]: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """Create a `SignalRW` backed by 1 or 2 EPICS PVs. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -104,7 +114,12 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| :param name: The name of the signal (defaults to empty string) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| :param timeout: A timeout to be used when reading (not connecting) this signal | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| backend = _epics_signal_backend(datatype, read_pv, write_pv or read_pv) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| backend = _epics_signal_backend( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| datatype, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| read_pv, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| write_pv or read_pv, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| EpicsOptions(wait, no_wait_when_setting or set()), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return SignalRW(backend, name=name, timeout=timeout, attempts=attempts) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -148,7 +163,7 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| :param name: The name of the signal (defaults to empty string) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| :param timeout: A timeout to be used when reading (not connecting) this signal | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| backend = _epics_signal_backend(datatype, read_pv, read_pv) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| backend = _epics_signal_backend(datatype, read_pv, read_pv, None) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return SignalR(backend, name=name, timeout=timeout) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -158,6 +173,9 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: str = "", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| timeout: float = DEFAULT_TIMEOUT, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| attempts: int = 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # no_wait_on: set[SignalDatatypeT] | bool = False | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| wait: bool = True, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| no_wait_when_setting: set[SignalDatatypeT] | None = None, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) -> SignalW[SignalDatatypeT]: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """Create a `SignalW` backed by 1 EPICS PVs. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -166,7 +184,9 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| :param name: The name of the signal (defaults to empty string) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| :param timeout: A timeout to be used when reading (not connecting) this signal | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| backend = _epics_signal_backend(datatype, write_pv, write_pv) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| backend = _epics_signal_backend( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| datatype, write_pv, write_pv, EpicsOptions(wait, no_wait_when_setting or set()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return SignalW(backend, name=name, timeout=timeout, attempts=attempts) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -179,5 +199,5 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| :param name: The name of the signal | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| :param timeout: A timeout to be used when reading (not connecting) this signal | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| backend = _epics_signal_backend(None, write_pv, write_pv) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| backend = _epics_signal_backend(None, write_pv, write_pv, None) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return SignalX(backend, name=name, timeout=timeout) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -247,7 +247,7 @@ async def set( # type: ignore | |
|
|
||
| await self.check_motor_limit(old_position, new_position) | ||
|
|
||
| move_status = self.user_setpoint.set(new_position, wait=True, timeout=timeout) | ||
| move_status = self.user_setpoint.set(new_position, timeout=timeout) | ||
| async for current_position in observe_value( | ||
| self.user_readback, done_status=move_status | ||
| ): | ||
|
|
@@ -267,7 +267,7 @@ async def stop(self, success=False): | |
| self._set_success = success | ||
| # Put with completion will never complete as we are waiting for completion on | ||
| # the move above, so need to pass wait=False | ||
| await self.motor_stop.set(1, wait=False) | ||
| await self.motor_stop.set(1) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| async def locate(self) -> Location[float]: | ||
| """Return the current setpoint and readback of the motor.""" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then can you remove all trace of the
waitargument from allSignalBackends