auto-trainer-api 0.10.3__tar.gz → 0.12.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. {auto_trainer_api-0.10.3 → auto_trainer_api-0.12.0}/PKG-INFO +1 -1
  2. {auto_trainer_api-0.10.3 → auto_trainer_api-0.12.0}/src/autotrainer/api/__init__.py +1 -0
  3. auto_trainer_api-0.12.0/src/autotrainer/api/api_emergency_stop.py +17 -0
  4. {auto_trainer_api-0.10.3 → auto_trainer_api-0.12.0}/src/autotrainer/api/api_system_status.py +15 -1
  5. auto_trainer_api-0.12.0/src/autotrainer/api/command/api_command.py +212 -0
  6. {auto_trainer_api-0.10.3 → auto_trainer_api-0.12.0}/src/autotrainer/api/event/api_event_kind.py +1 -1
  7. {auto_trainer_api-0.10.3 → auto_trainer_api-0.12.0}/src/autotrainer/api/event/api_event_payloads.py +37 -3
  8. {auto_trainer_api-0.10.3 → auto_trainer_api-0.12.0}/src/autotrainer/api/event/build_event.py +1 -1
  9. {auto_trainer_api-0.10.3 → auto_trainer_api-0.12.0}/tests/test_build_event.py +1 -1
  10. auto_trainer_api-0.10.3/src/autotrainer/api/command/api_command.py +0 -54
  11. {auto_trainer_api-0.10.3 → auto_trainer_api-0.12.0}/.gitignore +0 -0
  12. {auto_trainer_api-0.10.3 → auto_trainer_api-0.12.0}/README.md +0 -0
  13. {auto_trainer_api-0.10.3 → auto_trainer_api-0.12.0}/publish-testpypi.py +0 -0
  14. {auto_trainer_api-0.10.3 → auto_trainer_api-0.12.0}/pyproject.toml +0 -0
  15. {auto_trainer_api-0.10.3 → auto_trainer_api-0.12.0}/src/autotrainer/api/api_alarm_kind.py +0 -0
  16. {auto_trainer_api-0.10.3 → auto_trainer_api-0.12.0}/src/autotrainer/api/api_application_mode.py +0 -0
  17. {auto_trainer_api-0.10.3 → auto_trainer_api-0.12.0}/src/autotrainer/api/api_detector_kind.py +0 -0
  18. {auto_trainer_api-0.10.3 → auto_trainer_api-0.12.0}/src/autotrainer/api/api_options.py +0 -0
  19. {auto_trainer_api-0.10.3 → auto_trainer_api-0.12.0}/src/autotrainer/api/api_system_configuration.py +0 -0
  20. {auto_trainer_api-0.10.3 → auto_trainer_api-0.12.0}/src/autotrainer/api/api_training_mode.py +0 -0
  21. {auto_trainer_api-0.10.3 → auto_trainer_api-0.12.0}/src/autotrainer/api/bridge/__init__.py +0 -0
  22. {auto_trainer_api-0.10.3 → auto_trainer_api-0.12.0}/src/autotrainer/api/bridge/__main__.py +0 -0
  23. {auto_trainer_api-0.10.3 → auto_trainer_api-0.12.0}/src/autotrainer/api/bridge/bridge_app.py +0 -0
  24. {auto_trainer_api-0.10.3 → auto_trainer_api-0.12.0}/src/autotrainer/api/bridge/bridge_service.py +0 -0
  25. {auto_trainer_api-0.10.3 → auto_trainer_api-0.12.0}/src/autotrainer/api/command/__init__.py +0 -0
  26. {auto_trainer_api-0.10.3 → auto_trainer_api-0.12.0}/src/autotrainer/api/command/api_command_request.py +0 -0
  27. {auto_trainer_api-0.10.3 → auto_trainer_api-0.12.0}/src/autotrainer/api/command/api_command_request_response.py +0 -0
  28. {auto_trainer_api-0.10.3 → auto_trainer_api-0.12.0}/src/autotrainer/api/command/api_command_request_result.py +0 -0
  29. {auto_trainer_api-0.10.3 → auto_trainer_api-0.12.0}/src/autotrainer/api/command/command_request_delegate.py +0 -0
  30. {auto_trainer_api-0.10.3 → auto_trainer_api-0.12.0}/src/autotrainer/api/event/__init__.py +0 -0
  31. {auto_trainer_api-0.10.3 → auto_trainer_api-0.12.0}/src/autotrainer/api/event/api_event.py +0 -0
  32. {auto_trainer_api-0.10.3 → auto_trainer_api-0.12.0}/src/autotrainer/api/rpc_service.py +0 -0
  33. {auto_trainer_api-0.10.3 → auto_trainer_api-0.12.0}/src/autotrainer/api/telemetry/__init__.py +0 -0
  34. {auto_trainer_api-0.10.3 → auto_trainer_api-0.12.0}/src/autotrainer/api/telemetry/open_telemetry_service.py +0 -0
  35. {auto_trainer_api-0.10.3 → auto_trainer_api-0.12.0}/src/autotrainer/api/util.py +0 -0
  36. {auto_trainer_api-0.10.3 → auto_trainer_api-0.12.0}/src/autotrainer/api/zeromq/__init__.py +0 -0
  37. {auto_trainer_api-0.10.3 → auto_trainer_api-0.12.0}/src/autotrainer/api/zeromq/zeromq_api_service.py +0 -0
  38. {auto_trainer_api-0.10.3 → auto_trainer_api-0.12.0}/tests/test_api_basics.py +0 -0
  39. {auto_trainer_api-0.10.3 → auto_trainer_api-0.12.0}/tests/test_api_event.py +0 -0
  40. {auto_trainer_api-0.10.3 → auto_trainer_api-0.12.0}/tests/test_bridge_service.py +0 -0
  41. {auto_trainer_api-0.10.3 → auto_trainer_api-0.12.0}/tests/test_resolve_enum.py +0 -0
  42. {auto_trainer_api-0.10.3 → auto_trainer_api-0.12.0}/tests/test_util.py +0 -0
  43. {auto_trainer_api-0.10.3 → auto_trainer_api-0.12.0}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: auto-trainer-api
3
- Version: 0.10.3
3
+ Version: 0.12.0
4
4
  Summary: API for interfacing with the core acquisition process via platform and language agnostic message queues.
5
5
  License: AGPL-3.0-only
6
6
  Classifier: Operating System :: OS Independent
@@ -12,6 +12,7 @@ from .api_system_status import ApiSystemStatus, ApiPelletDeviceStatus, ApiTunnel
12
12
  ApiAlarmStatus, ApiProjectStatus, ApiAnimalStatus
13
13
  from .api_alarm_kind import ApiAlarmKind
14
14
  from .api_detector_kind import ApiDetectorKind
15
+ from .api_emergency_stop import ApiEmergencyStopReason, ApiEmergencyResumeReason
15
16
  from .api_system_configuration import ApiSystemConfiguration
16
17
  from .command import ApiCommand, ApiCommandRequestResponse, ApiCommandRequestResult, ApiCommandRequest
17
18
  from .rpc_service import ApiTopic, ApiCommandRequestErrorKind, RpcService
@@ -0,0 +1,17 @@
1
+ from enum import IntEnum
2
+
3
+
4
+ class ApiEmergencyStopReason(IntEnum):
5
+ unknown = 0
6
+ alarm_monitor = 101
7
+ diamond_coord_check = 201
8
+ user_button = 301
9
+ rpc_service = 401
10
+
11
+
12
+ class ApiEmergencyResumeReason(IntEnum):
13
+ unknown = 0
14
+ alarm_monitor_resume = 101
15
+ alarm_monitor_status_change = 201 # "alarm-monitor-no-valid-condition-remaining" reason
16
+ user_button = 301
17
+ rpc_service = 401
@@ -33,7 +33,6 @@ class ApiAlarmStatus:
33
33
  @dataclass(frozen=True)
34
34
  class ApiTunnelDeviceStatus:
35
35
  magnet_intensity: float
36
- gate_open: bool = False
37
36
  is_gate_open: bool = False
38
37
  is_fan_on: bool = False
39
38
 
@@ -53,6 +52,10 @@ class ApiPelletDeviceStatus:
53
52
 
54
53
  is_barrier_arm_active: bool = False
55
54
 
55
+ # Settings, each set by the like-named ApiCommand in the 1000-1099 range.
56
+ is_home_on_excessive_drift_enabled: bool = False
57
+ is_tunnel_sweep_enabled: bool = False
58
+
56
59
 
57
60
  @dataclass(frozen=True)
58
61
  class ApiReachStatus:
@@ -67,6 +70,17 @@ class ApiBehaviorStatus:
67
70
  baseline_magnet_intensity: float
68
71
  reaches: ApiReachStatus
69
72
 
73
+ # Settings, each set by the like-named ApiCommand in the 1000-1099 range. A setting keeps its value while
74
+ # whatever gates it is off, so these report what is configured rather than what is currently in force.
75
+ is_live_analysis_enabled: bool = False
76
+ is_pellet_delivery_enabled: bool = False
77
+ is_pellet_cover_enabled: bool = False
78
+ is_intertrial_pellet_shift_enabled: bool = False
79
+ is_triangle_pellet_distance_detection_enabled: bool = False
80
+ is_auto_close_gate_on_intertrial_enabled: bool = False
81
+ is_auto_clamp_enabled: bool = False
82
+ is_batch_trials_enabled: bool = False
83
+
70
84
 
71
85
  @dataclass(frozen=True)
72
86
  class ApiAnimalStatus:
@@ -0,0 +1,212 @@
1
+ from enum import IntEnum
2
+
3
+
4
+ class ApiCommand(IntEnum):
5
+ """
6
+ A command value is required for all command requests.
7
+
8
+ Each member documents its request payload (`data` on the request), its response payload (`data` on the
9
+ `ApiCommandRequestResponse`), and the `ApiCommandRequestResult` a receiver is expected to return. The
10
+ `GET_*` commands are queries: they must not change any state or publish any event. A command that changes
11
+ state is expected to publish the event that a state change of that kind normally publishes, so subscribers
12
+ see the same thing whether the change came from a command or from the application itself.
13
+
14
+ Values 1000-1099 set the behavior settings that appear as the primary toggles of the Behavior preferences.
15
+ They share one shape: `{enabled: bool}` in and out, the response carrying the state actually in effect
16
+ after the attempt. Result is SUCCESS when the setting holds the requested value (including when it
17
+ already did), UNAVAILABLE when the receiver cannot change it in its current state, and FAILED when the
18
+ payload is missing or not a boolean. A non-success response reports the unchanged current value. Most of
19
+ these settings publish no event when changed in the application, so their commands publish none either;
20
+ the exceptions say so. Each is also reported as the like-named `is_*_enabled` field of `ApiBehaviorStatus`
21
+ or `ApiPelletDeviceStatus`, so GET_STATUS reads back what these commands set. Values are spaced by ten to
22
+ leave room for the sub-settings each one gates.
23
+ """
24
+ NONE = 0
25
+ """No command. Can be used to verify connection or that the receiver is configured to receive commands.
26
+
27
+ Changes no state and publishes no event.
28
+ Response Payload: None
29
+ Result: SUCCESS
30
+ """
31
+
32
+ START_ACQUISITION = 50
33
+ """ Obsolete
34
+
35
+ Result: UNRECOGNIZED
36
+ """
37
+
38
+ STOP_ACQUISITION = 55
39
+ """ Obsolete
40
+
41
+ Result: UNRECOGNIZED
42
+ """
43
+
44
+ SET_APPLICATION_MODE = 120
45
+ """
46
+ Payload: {mode: ApiApplicationMode}
47
+ The response is application mode after attempting to set. Typically the same as the payload, but if for some reason
48
+ the mode is invalid in the current context, it should return the actual mode.
49
+ Response Payload: {mode: ApiApplicationMode}
50
+
51
+ Publishes applicationModeChanged only when the mode actually changes.
52
+
53
+ Result: SUCCESS when the mode was set (or already had that value); UNAVAILABLE when the mode is a valid
54
+ ApiApplicationMode the receiver does not support at this time; FAILED when the value is not a valid
55
+ ApiApplicationMode at all. In every case the response payload carries the mode actually in effect, so a
56
+ non-success response reports the unchanged current mode.
57
+ """
58
+
59
+ SET_TRAINING_MODE = 130
60
+ """
61
+ Payload: {mode: ApiTrainingMode}
62
+ The response is training mode after attempting to set. Typically the same as the payload, but if for some reason
63
+ the mode is invalid in the current context, it should return the actual mode.
64
+ Response Payload: {mode: ApiTrainingMode}
65
+
66
+ Publishes trainingModeChanged only when the mode actually changes.
67
+
68
+ Result: as for SET_APPLICATION_MODE, with the response payload always carrying the mode in effect.
69
+ """
70
+
71
+ EMERGENCY_STOP = 200
72
+ """Response Payload: None
73
+
74
+ Idempotent: a stop received while already stopped is still SUCCESS and still publishes emergencyStop,
75
+ carrying the alarms active at that moment. The event announces the condition rather than a transition, so
76
+ it is not suppressed on a repeat.
77
+
78
+ Result: SUCCESS
79
+ """
80
+
81
+ EMERGENCY_RESUME = 210
82
+ """Response Payload: None
83
+
84
+ Result: SUCCESS when the receiver was stopped, publishing emergencyResume; FAILED when it was not stopped,
85
+ in which case no event is published.
86
+ """
87
+
88
+ GET_CONFIGURATION = 300
89
+ """Response Payload: ApiSystemConfiguration"""
90
+
91
+ GET_STATUS = 400
92
+ """Response Payload: ApiSystemStatus"""
93
+
94
+ GET_ANIMALS = 500
95
+ """Response Payload: List[ApiAnimalStatus]
96
+
97
+ The order of the list is not defined. An empty list is a valid result: a receiver with no animal location
98
+ configured, or one whose location holds no animals, responds SUCCESS with [] rather than failing.
99
+
100
+ Result: SUCCESS
101
+ """
102
+
103
+ SET_LIVE_ANALYSIS_ENABLED = 1000
104
+ """Real-time pose inference during live trials ("Live Analysis").
105
+
106
+ Payload: {enabled: bool}
107
+ Response Payload: {enabled: bool}
108
+
109
+ The gate for most of the other behavior settings: while this is off, the settings that depend on it keep
110
+ their value but have no effect.
111
+ """
112
+
113
+ SET_PELLET_DELIVERY_ENABLED = 1010
114
+ """Pellet load-send-release cycles based on pellet detection and related factors ("Deliver Pellets").
115
+
116
+ Payload: {enabled: bool}
117
+ Response Payload: {enabled: bool}
118
+
119
+ Depends on SET_LIVE_ANALYSIS_ENABLED.
120
+ """
121
+
122
+ SET_PELLET_COVER_ENABLED = 1020
123
+ """Covering the pellet while the animal is out of the tunnel, uncovering with a tone on entry
124
+ ("Cover Pellets").
125
+
126
+ Payload: {enabled: bool}
127
+ Response Payload: {enabled: bool}
128
+
129
+ Depends on SET_PELLET_DELIVERY_ENABLED.
130
+ """
131
+
132
+ SET_INTERTRIAL_PELLET_SHIFT_ENABLED = 1030
133
+ """Adjustment of the pellet delivery position from post-trial reach analysis ("Intertrial Pellet Shift").
134
+
135
+ Payload: {enabled: bool}
136
+ Response Payload: {enabled: bool}
137
+
138
+ Depends on SET_LIVE_ANALYSIS_ENABLED. Does not affect whether intertrialPelletShift events are published:
139
+ a shift that is calculated but not applied is still reported.
140
+ """
141
+
142
+ SET_HOME_ON_EXCESSIVE_DRIFT_ENABLED = 1040
143
+ """Homing the pellet motors when measured drift exceeds the configured threshold
144
+ ("Home On Excessive Drift").
145
+
146
+ Payload: {enabled: bool}
147
+ Response Payload: {enabled: bool}
148
+
149
+ Depends on SET_LIVE_ANALYSIS_ENABLED.
150
+ """
151
+
152
+ SET_TRIANGLE_PELLET_DISTANCE_DETECTION_ENABLED = 1050
153
+ """Detection of an excessive triangle-to-pellet distance
154
+ ("Triangle-pellet distance too far detection").
155
+
156
+ Payload: {enabled: bool}
157
+ Response Payload: {enabled: bool}
158
+
159
+ Depends on SET_LIVE_ANALYSIS_ENABLED.
160
+ """
161
+
162
+ SET_AUTO_CLOSE_GATE_ON_INTERTRIAL_ENABLED = 1060
163
+ """Closing the tunnel gate for the duration of intertrial analysis
164
+ ("Auto-close gate during intertrial analysis").
165
+
166
+ Payload: {enabled: bool}
167
+ Response Payload: {enabled: bool}
168
+ """
169
+
170
+ SET_AUTO_CLAMP_ENABLED = 1070
171
+ """Automatic head-clamp engagement and release ("Auto-Clamp").
172
+
173
+ Payload: {enabled: bool}
174
+ Response Payload: {enabled: bool}
175
+
176
+ Publishes autoClampEnabledChanged only when the value actually changes.
177
+ """
178
+
179
+ SET_TUNNEL_SWEEP_ENABLED = 1080
180
+ """The monitor that sweeps a misplaced pellet out of the tunnel ("Tunnel Sweep").
181
+
182
+ Payload: {enabled: bool}
183
+ Response Payload: {enabled: bool}
184
+
185
+ Enabling starts the monitor and disabling stops it, so the change takes effect immediately rather than at
186
+ the next trial.
187
+ """
188
+
189
+ SET_BATCH_TRIALS_ENABLED = 1090
190
+ """Recording trials in a batch while the animal stays in the tunnel, deferring their analysis to the end
191
+ of the batch ("Batch trials while in tunnel").
192
+
193
+ Payload: {enabled: bool}
194
+ Response Payload: {enabled: bool}
195
+
196
+ Sessions started after this is enabled report is_analysis_deferred and produce the
197
+ batchAnalysisStarted/batchAnalysisEnded bracket; a session already under way is unaffected.
198
+ """
199
+
200
+ USER_DEFINED = 99999
201
+ """A custom command defined between a particular commander and receiver. Additional information can be
202
+ defined in the `data` field.
203
+
204
+ Also the value a request carries when its command is not a member of this enum (see
205
+ `ApiCommandRequest.parse_object`).
206
+
207
+ Result: UNRECOGNIZED unless the receiver defines handling for the specific custom command.
208
+ """
209
+
210
+ @classmethod
211
+ def is_member(cls, value):
212
+ return value in cls._value2member_map_
@@ -28,7 +28,7 @@ class ApiEventKind(IntEnum):
28
28
  emergencyStop = 101
29
29
  """Payload: EmergencyStopContext"""
30
30
  emergencyResume = 102
31
- """Payload: ReasonContext"""
31
+ """Payload: EmergencyResumeContext"""
32
32
 
33
33
  applicationLaunched = 201
34
34
  """Payload: VersionContext"""
@@ -30,6 +30,7 @@ from uuid import UUID
30
30
 
31
31
  from ..api_alarm_kind import ApiAlarmKind
32
32
  from ..api_application_mode import ApiApplicationMode
33
+ from ..api_emergency_stop import ApiEmergencyResumeReason, ApiEmergencyStopReason
33
34
  from ..api_training_mode import ApiTrainingMode
34
35
  from .api_event_kind import ApiPelletShiftSource
35
36
 
@@ -37,7 +38,8 @@ __all__ = [
37
38
  "Vector3Context", "SessionTrialContext", "AnalysisTrialContext", "TrialSeenContext", "ReasonContext",
38
39
  "CommandContext", "IsEnabledContext",
39
40
  "IsEngagedContext", "IntensityContext", "CountChangeContext", "TrainingPhaseContext",
40
- "EmergencyStopContext", "VersionContext", "ApplicationModeContext", "PropertyChangedContext",
41
+ "EmergencyStopContext", "EmergencyResumeContext",
42
+ "VersionContext", "ApplicationModeContext", "PropertyChangedContext",
41
43
  "ProjectChangedContext", "ProjectTrialChangedContext", "PelletHomeResetContext",
42
44
  "PelletDriftResetContext", "SessionStartedContext", "SessionEndedContext", "TrialStartedContext",
43
45
  "TrialEndedContext", "CaptureAnalysisResultLike", "BatchAnalysisStartedContext", "BatchAnalysisEndedContext",
@@ -173,15 +175,40 @@ class TrainingPhaseContext(TypedDict):
173
175
 
174
176
  class EmergencyStopContext(TypedDict):
175
177
  """Fields:
176
- reason: Why the stop occurred.
178
+ reason: Why the stop occurred. Free text, and unchanged: ``reason_code`` classifies the same stop,
179
+ it does not replace this.
180
+ reason_code: What stopped the run, as an :class:`ApiEmergencyStopReason` — the machine-readable
181
+ companion to ``reason``. Use ``unknown`` when the source does not match a known member.
177
182
  active_alarms: The active and enabled alarms. This can include alarms that may not be the initial
178
183
  cause of the stop, so long as they are active and enabled (must be enabled). May be empty when
179
184
  the source of the stop is the user button, rpc service, etc.
180
185
  """
181
186
  reason: str
187
+ reason_code: ApiEmergencyStopReason
182
188
  active_alarms: List[ApiAlarmKind]
183
189
 
184
190
 
191
+ class EmergencyResumeContext(ReasonContext):
192
+ """The ``emergencyResume`` payload. Extends :class:`ReasonContext` (free-text ``reason``) with the
193
+ machine-readable cause; the two are additive, not alternatives.
194
+
195
+ Fields:
196
+ reason: Why the resume occurred. Free text, and unchanged.
197
+ reason_code: What resumed the run, as an :class:`ApiEmergencyResumeReason`. Use ``unknown`` when the
198
+ source does not match a known member.
199
+ resumed_alarms: The alarms that *auto-resumed* — cleared themselves, and by clearing lifted the
200
+ emergency stop. It is not "the alarms this resume applies to": an alarm that is still engaged, or
201
+ one that a person or another subsystem resumed past, never appears here. That makes
202
+ ``alarm_monitor_resume`` the only ``reason_code`` expected to be non-empty; every other one is a
203
+ resume that happened *despite* the alarm state rather than because of it, and sends ``[]`` — a
204
+ user overriding at the button sends ``[]`` even with alarms still active (and can expect a fresh
205
+ stop shortly if they were not really cleared). Always present, so consumers can read it
206
+ unconditionally rather than defaulting a missing key.
207
+ """
208
+ reason_code: ApiEmergencyResumeReason
209
+ resumed_alarms: List[ApiAlarmKind]
210
+
211
+
185
212
  class VersionContext(TypedDict):
186
213
  """Fields:
187
214
  version: The application version string.
@@ -576,6 +603,11 @@ class IntertrialResponseDataLike(Protocol):
576
603
  """Non-hand-based events; same element type as :attr:`reach_events`."""
577
604
  ...
578
605
 
606
+ @property
607
+ def hand_events(self) -> Sequence[ReachEventLike]:
608
+ """Hand-based non-reach events; same element type as :attr:`reach_events`."""
609
+ ...
610
+
579
611
  @property
580
612
  def food_consumed(self) -> int:
581
613
  """Total pellets consumed during the trial/session."""
@@ -604,6 +636,7 @@ class IntertrialResponseDict(TypedDict):
604
636
  reach_events: Hand reaches (right and left). Each element may be an ``autotrainer.core.ReachEvent``
605
637
  (any :class:`ReachEventLike`) or a :class:`ReachEventDict`.
606
638
  other_events: Non-hand-based events; same element type as ``reach_events``.
639
+ hand_events: Hand-based non-reach events; same element type as ``reach_events``.
607
640
  food_consumed: Total pellets consumed during the trial/session.
608
641
  successful_reaches: Number of successful (right-hand) reaches.
609
642
  total_reaches: Total reaches across both hands.
@@ -615,6 +648,7 @@ class IntertrialResponseDict(TypedDict):
615
648
  rh_max_vp_list: Sequence[Optional[Sequence[float]]]
616
649
  reach_events: Sequence[Union[ReachEventLike, ReachEventDict]]
617
650
  other_events: Sequence[Union[ReachEventLike, ReachEventDict]]
651
+ hand_events: Sequence[Union[ReachEventLike, ReachEventDict]]
618
652
  food_consumed: int
619
653
  successful_reaches: int
620
654
  total_reaches: int
@@ -626,7 +660,7 @@ class IntertrialResponseContext(TypedDict):
626
660
  trial_id: The trial identifier.
627
661
  batch_id: The stringified uuid v4 of the batch that produced this event, or ``None`` when there is
628
662
  no batch (inline analysis, or analysis disabled).
629
- response_data: The trial's intertrial responses. Each element may be an
663
+ response_data: The trial's intertrial response. It may be an
630
664
  ``autotrainer.inference.analysis.IntertrialResponse`` (any :class:`IntertrialResponseDataLike`)
631
665
  or a :class:`IntertrialResponseDict`; a ``List[IntertrialResponse]`` may be passed as-is.
632
666
  ``Sequence`` (rather than ``List``) keeps it covariant so that is accepted without a type error.
@@ -59,7 +59,7 @@ def build_event(kind: Literal[ApiEventKind.unknown]) -> ApiEventDict: ...
59
59
  @overload
60
60
  def build_event(kind: Literal[ApiEventKind.emergencyStop], context: p.EmergencyStopContext) -> ApiEventDict: ...
61
61
  @overload
62
- def build_event(kind: Literal[ApiEventKind.emergencyResume], context: p.ReasonContext) -> ApiEventDict: ...
62
+ def build_event(kind: Literal[ApiEventKind.emergencyResume], context: p.EmergencyResumeContext) -> ApiEventDict: ...
63
63
  @overload
64
64
  def build_event(kind: Literal[ApiEventKind.applicationLaunched], context: p.VersionContext) -> ApiEventDict: ...
65
65
  @overload
@@ -140,7 +140,7 @@ class TestIntertrialResponse:
140
140
  # Hand-built IntertrialResponseDict with a string-enum ReachEventDict; batch_id present (deferred).
141
141
  resp = p.IntertrialResponseDict(
142
142
  rh_max_vp_list=[[1.0, 2.0, 3.0], None], reach_events=[self._reach()], other_events=[],
143
- food_consumed=1, successful_reaches=1, total_reaches=2)
143
+ hand_events=[], food_consumed=1, successful_reaches=1, total_reaches=2)
144
144
  ctx = p.IntertrialResponseContext(session_id="s1", trial_id=2, batch_id="b1", response_data=[resp])
145
145
  event = build_event(ApiEventKind.intertrialResponse, ctx)
146
146
  assert event["kind"] is ApiEventKind.intertrialResponse
@@ -1,54 +0,0 @@
1
- from enum import IntEnum
2
-
3
-
4
- class ApiCommand(IntEnum):
5
- """
6
- A command value is required for all command requests.
7
- """
8
- NONE = 0
9
- """No command. Can be used to verify connection or that the receiver is configured to receive commands."""
10
-
11
- START_ACQUISITION = 50
12
- """ Obsolete"""
13
-
14
- STOP_ACQUISITION = 55
15
- """ Obsolete"""
16
-
17
- SET_APPLICATION_MODE = 120
18
- """
19
- Payload: {mode: ApiApplicationMode}
20
- The response is application mode after attempting to set. Typically the same as the payload, but if for some reason
21
- the mode is invalid in the current context, it should return the actual mode.
22
- Response Payload: {mode: ApiApplicationMode}
23
- """
24
-
25
- SET_TRAINING_MODE = 130
26
- """
27
- Payload: {mode: ApiTrainingMode}
28
- The response is training mode after attempting to set. Typically the same as the payload, but if for some reason
29
- the mode is invalid in the current context, it should return the actual mode.
30
- Response Payload: {mode: ApiTrainingMode}
31
- """
32
-
33
- EMERGENCY_STOP = 200
34
- """Response Payload: None"""
35
-
36
- EMERGENCY_RESUME = 210
37
- """Response Payload: None"""
38
-
39
- GET_CONFIGURATION = 300
40
- """Response Payload: ApiSystemConfiguration"""
41
-
42
- GET_STATUS = 400
43
- """Response Payload: ApiSystemStatus"""
44
-
45
- GET_ANIMALS = 500
46
- """Response Payload: List[ApiAnimalStatus]"""
47
-
48
- USER_DEFINED = 99999
49
- """A custom command defined between a particular commander and receiver. Additional information can be
50
- defined in the `data` field."""
51
-
52
- @classmethod
53
- def is_member(cls, value):
54
- return value in cls._value2member_map_