Skip to content

Commit 04af942

Browse files
authored
Merge pull request #575 from AllenNeuralDynamics/fix-minor-bugs
Minor bug fixes
2 parents c102e32 + 0c9d75e commit 04af942

8 files changed

Lines changed: 454 additions & 419 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ dev = [
3636
"pytest-cov",
3737
'aind-behavior-vr-foraging[data]',
3838
'aind-behavior-vr-foraging[mappers]',
39-
"aind-clabe >= 0.10.5",
39+
"aind-clabe >= 0.10.7",
4040
]
4141

4242
[tool.codespell]

scripts/aind.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,18 @@ def _run_data_transfer(
9494

9595
# We run an immediate transfer first to move the behavior data off the rig,
9696
# we do not trigger the data-transfer-request yet and instead defer to later.
97-
RobocopyService(
98-
source=launcher.session_directory / "behavior",
99-
settings=RobocopySettings(
100-
delete_src=False,
101-
destination=Path(watchdog_settings.destination) / "behavior",
102-
),
103-
).transfer()
97+
try:
98+
RobocopyService(
99+
source=launcher.session_directory,
100+
settings=RobocopySettings(
101+
delete_src=False,
102+
destination=Path(watchdog_settings.destination)
103+
/ launcher.session_directory.name,
104+
exclude_dirs=["behavior-videos"],
105+
),
106+
).transfer()
107+
except Exception as e:
108+
logger.error("Initial data transfer failed: %s", e)
104109

105110
WatchdogDataTransferService(
106111
source=launcher.session_directory,

src/Extensions/HardwareChecks.bonsai

Lines changed: 75 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,24 @@
5252
<rx:Count>1</rx:Count>
5353
</Combinator>
5454
</Expression>
55+
<Expression xsi:type="Combinator">
56+
<Combinator xsi:type="StringProperty">
57+
<Value>Did not receive a single message from the Olfactometer. Could not run QA on FlowRate.</Value>
58+
</Combinator>
59+
</Expression>
60+
<Expression xsi:type="Combinator">
61+
<Combinator xsi:type="BooleanProperty">
62+
<Value>true</Value>
63+
</Combinator>
64+
</Expression>
65+
<Expression xsi:type="Combinator">
66+
<Combinator xsi:type="rx:Zip" />
67+
</Expression>
68+
<Expression xsi:type="Combinator">
69+
<Combinator xsi:type="rx:Take">
70+
<rx:Count>1</rx:Count>
71+
</Combinator>
72+
</Expression>
5573
<Expression xsi:type="SubscribeSubject">
5674
<Name>OlfactometerHubEventsGroupedBy</Name>
5775
</Expression>
@@ -81,72 +99,82 @@
8199
<Expression xsi:type="Combinator">
82100
<Combinator xsi:type="rx:Zip" />
83101
</Expression>
102+
<Expression xsi:type="MemberSelector">
103+
<Selector>Item1</Selector>
104+
</Expression>
105+
<Expression xsi:type="Format">
106+
<Format>Flow on Channel3 is lower than expected. Reading {0}.</Format>
107+
<Selector>it</Selector>
108+
</Expression>
109+
<Expression xsi:type="Combinator">
110+
<Combinator xsi:type="rx:Zip" />
111+
</Expression>
112+
<Expression xsi:type="Combinator">
113+
<Combinator xsi:type="rx:Merge" />
114+
</Expression>
84115
<Expression xsi:type="Combinator">
85116
<Combinator xsi:type="rx:WithLatestFrom" />
86117
</Expression>
87-
<Expression xsi:type="MemberSelector">
88-
<Selector>Item2</Selector>
118+
<Expression xsi:type="rx:Condition">
119+
<Workflow>
120+
<Nodes>
121+
<Expression xsi:type="WorkflowInput">
122+
<Name>Source1</Name>
123+
</Expression>
124+
<Expression xsi:type="MemberSelector">
125+
<Selector>Item2.Item2</Selector>
126+
</Expression>
127+
<Expression xsi:type="WorkflowOutput" />
128+
</Nodes>
129+
<Edges>
130+
<Edge From="0" To="1" Label="Source1" />
131+
<Edge From="1" To="2" Label="Source1" />
132+
</Edges>
133+
</Workflow>
134+
</Expression>
135+
<Expression xsi:type="Combinator">
136+
<Combinator xsi:type="rx:Take">
137+
<rx:Count>1</rx:Count>
138+
</Combinator>
89139
</Expression>
90140
<Expression xsi:type="WorkflowOutput" />
91141
</Nodes>
92142
<Edges>
93143
<Edge From="0" To="1" Label="Source1" />
94144
<Edge From="1" To="2" Label="Source1" />
95-
<Edge From="2" To="12" Label="Source1" />
96-
<Edge From="3" To="4" Label="Source1" />
97-
<Edge From="4" To="5" Label="Source1" />
145+
<Edge From="2" To="20" Label="Source1" />
146+
<Edge From="3" To="5" Label="Source1" />
147+
<Edge From="4" To="5" Label="Source2" />
98148
<Edge From="5" To="6" Label="Source1" />
99-
<Edge From="6" To="7" Label="Source1" />
149+
<Edge From="6" To="19" Label="Source1" />
100150
<Edge From="7" To="8" Label="Source1" />
101-
<Edge From="8" To="10" Label="Source1" />
102-
<Edge From="8" To="11" Label="Source2" />
103-
<Edge From="9" To="10" Label="Source2" />
151+
<Edge From="8" To="9" Label="Source1" />
152+
<Edge From="9" To="10" Label="Source1" />
104153
<Edge From="10" To="11" Label="Source1" />
105-
<Edge From="11" To="12" Label="Source2" />
106-
<Edge From="12" To="13" Label="Source1" />
107-
<Edge From="13" To="14" Label="Source1" />
108-
</Edges>
109-
</Workflow>
110-
</Expression>
111-
<Expression xsi:type="Combinator">
112-
<Combinator xsi:type="rx:First" />
113-
</Expression>
114-
<Expression xsi:type="rx:Condition">
115-
<Workflow>
116-
<Nodes>
117-
<Expression xsi:type="WorkflowInput">
118-
<Name>Source1</Name>
119-
</Expression>
120-
<Expression xsi:type="MemberSelector">
121-
<Selector>Item1</Selector>
122-
</Expression>
123-
<Expression xsi:type="WorkflowOutput" />
124-
</Nodes>
125-
<Edges>
126-
<Edge From="0" To="1" Label="Source1" />
127-
<Edge From="1" To="2" Label="Source1" />
154+
<Edge From="11" To="12" Label="Source1" />
155+
<Edge From="12" To="14" Label="Source1" />
156+
<Edge From="12" To="15" Label="Source2" />
157+
<Edge From="13" To="14" Label="Source2" />
158+
<Edge From="14" To="15" Label="Source1" />
159+
<Edge From="15" To="16" Label="Source1" />
160+
<Edge From="16" To="17" Label="Source1" />
161+
<Edge From="16" To="18" Label="Source2" />
162+
<Edge From="17" To="18" Label="Source1" />
163+
<Edge From="18" To="19" Label="Source2" />
164+
<Edge From="19" To="20" Label="Source2" />
165+
<Edge From="20" To="21" Label="Source1" />
166+
<Edge From="21" To="22" Label="Source1" />
167+
<Edge From="22" To="23" Label="Source1" />
128168
</Edges>
129169
</Workflow>
130170
</Expression>
131-
<Expression xsi:type="MemberSelector">
132-
<Selector>Item2</Selector>
133-
</Expression>
134-
<Expression xsi:type="Format">
135-
<Format>Flow on Channel3 is lower than expected. Reading {0}.</Format>
136-
<Selector>it</Selector>
137-
</Expression>
138-
<Expression xsi:type="Combinator">
139-
<Combinator xsi:type="StringProperty">
140-
<Value>Did not receive a single message from the Olfactometer. Could not run QA on FlowRate.</Value>
141-
</Combinator>
142-
</Expression>
143171
<Expression xsi:type="Combinator">
144172
<Combinator xsi:type="rx:Take">
145173
<rx:Count>1</rx:Count>
146174
</Combinator>
147175
</Expression>
148-
<Expression xsi:type="Combinator">
149-
<Combinator xsi:type="rx:OnErrorResumeNext" />
176+
<Expression xsi:type="MemberSelector">
177+
<Selector>Item2.Item1</Selector>
150178
</Expression>
151179
<Expression xsi:type="InputMapping">
152180
<PropertyMappings>
@@ -182,15 +210,10 @@
182210
<Edge From="1" To="2" Label="Source1" />
183211
<Edge From="2" To="3" Label="Source1" />
184212
<Edge From="3" To="4" Label="Source1" />
185-
<Edge From="4" To="7" Label="Source1" />
186-
<Edge From="5" To="6" Label="Source1" />
213+
<Edge From="5" To="7" Label="Source1" />
187214
<Edge From="6" To="7" Label="Source2" />
188215
<Edge From="7" To="8" Label="Source1" />
189216
<Edge From="8" To="9" Label="Source1" />
190-
<Edge From="10" To="12" Label="Source1" />
191-
<Edge From="11" To="12" Label="Source2" />
192-
<Edge From="12" To="13" Label="Source1" />
193-
<Edge From="13" To="14" Label="Source1" />
194217
</Edges>
195218
</Workflow>
196219
</Expression>

src/Extensions/Visualizers.bonsai

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2011,8 +2011,14 @@ it.Item6 as Notes)
20112011
<Expression xsi:type="ui:VisualizerWindow">
20122012
<ui:Text>VrForaging</ui:Text>
20132013
<ui:Visible>true</ui:Visible>
2014-
<ui:Location xsi:nil="true" />
2015-
<ui:Size xsi:nil="true" />
2014+
<ui:Location>
2015+
<ui:X>0</ui:X>
2016+
<ui:Y>0</ui:Y>
2017+
</ui:Location>
2018+
<ui:Size>
2019+
<ui:Width>1000</ui:Width>
2020+
<ui:Height>1000</ui:Height>
2021+
</ui:Size>
20162022
<ui:WindowState>Maximized</ui:WindowState>
20172023
</Expression>
20182024
<Expression xsi:type="WorkflowOutput" />

src/packages/aind_behavior_vr_foraging/src/aind_behavior_vr_foraging/data_contract/v1.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -385,17 +385,17 @@ def dataset(
385385
),
386386
),
387387
SoftwareEvents(
388-
name="SessionStartTime",
388+
name="StartSessionTime",
389389
description="An event emitted at the start of the session. Data contains a UTC timestamp of the session start time.",
390390
reader_params=SoftwareEvents.make_params(
391-
root_path / "behavior/SoftwareEvents/SessionStartTime.json"
391+
root_path / "behavior/SoftwareEvents/StartSessionTime.json"
392392
),
393393
),
394394
SoftwareEvents(
395-
name="SessionEndTime",
395+
name="EndSessionTime",
396396
description="An event emitted at the end of the session. Data contains a UTC timestamp of the session end time.",
397397
reader_params=SoftwareEvents.make_params(
398-
root_path / "behavior/SoftwareEvents/SessionEndTime.json"
398+
root_path / "behavior/SoftwareEvents/EndSessionTime.json"
399399
),
400400
),
401401
],

src/packages/aind_behavior_vr_foraging/src/aind_behavior_vr_foraging/data_mappers/_acquisition.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ def _map(self) -> acquisition.Acquisition:
133133
def _stream_bound_times(self) -> tuple[datetime.datetime, datetime.datetime]:
134134
"""Get the start and end times for the data stream. This is used to determine the duration of the session."""
135135

136-
stream_start_path = Path(self._data_path) / "behavior/SoftwareEvents/SessionStartTime.json"
137-
stream_end_path = Path(self._data_path) / "behavior/SoftwareEvents/SessionEndTime.json"
136+
stream_start_path = Path(self._data_path) / "behavior/SoftwareEvents/StartSessionTime.json"
137+
stream_end_path = Path(self._data_path) / "behavior/SoftwareEvents/EndSessionTime.json"
138138
stream_start_time: Optional[datetime.datetime] = None
139139
stream_end_time: Optional[datetime.datetime] = None
140140

src/packages/aind_behavior_vr_foraging/tests/test_aind_data_mapper.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,16 @@ def write_mock_software_events(
4747

4848
events_dir = data_path / "behavior" / "SoftwareEvents"
4949
_write_events(
50-
events_dir / "SessionStartTime.json",
50+
events_dir / "StartSessionTime.json",
5151
time_event,
52-
[SoftwareEvent[datetime](name="SessionStartTime", timestamp=0.0, timestamp_source="harp", data=start_time)],
52+
[SoftwareEvent[datetime](name="StartSessionTime", timestamp=0.0, timestamp_source="harp", data=start_time)],
5353
)
5454
_write_events(
55-
events_dir / "SessionEndTime.json",
55+
events_dir / "EndSessionTime.json",
5656
time_event,
5757
[
5858
SoftwareEvent[datetime](
59-
name="SessionEndTime",
59+
name="EndSessionTime",
6060
timestamp=(end_time - start_time).total_seconds(),
6161
timestamp_source="harp",
6262
data=end_time,

0 commit comments

Comments
 (0)