Skip to content

Commit 163ccab

Browse files
committed
updated example.json for mabe as several things change in the codebase
1 parent e7fb749 commit 163ccab

File tree

4 files changed

+66
-5
lines changed

4 files changed

+66
-5
lines changed

amadeusgpt/app_utils.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,6 @@ def render(self):
217217
filename = save_figure_to_tempfile(fig)
218218
st.image(filename, width=600)
219219
elif render_key == "out_videos":
220-
print ('out_videos')
221-
print (render_value)
222220
for video_path in render_value:
223221
if os.path.exists(video_path):
224222
st.video(video_path)

amadeusgpt/managers/event_manager.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ def get_events_from_relationship(
233233

234234
mask = relationship.query_relationship(relation_query)
235235

236+
#print ('mask', mask)
236237
# determine whether the mask is a numpy of float or numpy of boolean
237238

238239
if mask.dtype != bool:
@@ -323,7 +324,7 @@ def get_animals_animals_events(
323324
_comparison = comparison_operator + "".join(
324325
query.split(comparison_operator)[1:]
325326
)
326-
327+
327328
events = self.get_events_from_relationship(
328329
relationship, _query, _comparison, smooth_window_size
329330
)

amadeusgpt/programs/sandbox.py

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,4 +549,66 @@ def render_temp_message(query, sandbox):
549549
amadeus = create_amadeus(config)
550550
sandbox = amadeus.sandbox
551551

552-
render_temp_message('random', sandbox)
552+
def get_chases_events(config: Config):
553+
'''
554+
Parameters:
555+
----------
556+
config: Config
557+
'''
558+
# create_analysis returns an instance of AnimalBehaviorAnalysis
559+
analysis = create_analysis(config)
560+
561+
# Get events where the closest distance between animals is less than 40 pixels
562+
closest_distance_events = analysis.get_animals_animals_events(
563+
cross_animal_query_list=['closest_distance<40'],
564+
bodypart_names=None,
565+
otheranimal_bodypart_names=None,
566+
min_window=1,
567+
max_window=100000
568+
)
569+
570+
# Get events where the angle between animals is less than 30 degrees
571+
angle_events = analysis.get_animals_animals_events(
572+
cross_animal_query_list=['relative_angle<30'],
573+
bodypart_names=None,
574+
otheranimal_bodypart_names=None,
575+
min_window=1,
576+
max_window=100000
577+
)
578+
579+
print ('angle_events')
580+
for event in angle_events:
581+
print (event)
582+
return angle_events
583+
584+
# Get events where the animal's speed is greater than 0.2
585+
speed_events = analysis.get_animals_state_events(
586+
query='speed>0.2',
587+
bodypart_names=None,
588+
min_window=1,
589+
max_window=100000
590+
)
591+
592+
# Combine the closest distance and angle events using logical AND
593+
distance_angle_events = analysis.get_composite_events(
594+
events_A=closest_distance_events,
595+
events_B=angle_events,
596+
composition_type='logical_and',
597+
max_interval_between_sequential_events=0,
598+
min_window=1,
599+
max_window=100000
600+
)
601+
602+
# Combine the result with the speed events using logical AND
603+
chases_events = analysis.get_composite_events(
604+
events_A=distance_angle_events,
605+
events_B=speed_events,
606+
composition_type='logical_and',
607+
max_interval_between_sequential_events=0,
608+
min_window=1,
609+
max_window=100000
610+
)
611+
612+
return chases_events
613+
614+
get_chases_events(config)

examples/MABe/example.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{
33
"role": "human",
44
"error": NaN,
5-
"query": "Define <|chases|> as a social behavior where closest distance between this animal and other animals is less than 40 pixels and the angle between this and other animals have to be less than 30 and this animal has to travel faster than 0.2."
5+
"query": "Define chases as a social behavior where closest distance between this animal and other animals is less than 40 pixels and the head angle between this and other animals have to be less than 30 and this animal has to travel faster than 0.1."
66
},
77
{
88
"role": "human",

0 commit comments

Comments
 (0)