Skip to content

Commit 3447add

Browse files
authored
Merge branch 'main' into fix_ylabel
2 parents 83dbede + b53fcb9 commit 3447add

6 files changed

Lines changed: 26 additions & 25 deletions

File tree

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ dependencies = [
2727
'pathlib',
2828
'numpy',
2929
'pydantic',
30-
'hdmf_zarr'
30+
'hdmf_zarr',
31+
'aind-dynamic-foraging-data-utils >= 0.1.25'
3132
]
3233

3334
[project.optional-dependencies]

src/aind_dynamic_foraging_basic_analysis/licks/annotation.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def annotate_licks(nwb):
3232
nwb is an object that has df_events as an attribute
3333
"""
3434
if not hasattr(nwb, "df_events"):
35-
print("You need to compute df_events: nwb_utils.create_events_df(nwb)")
35+
print("You need to compute df_events: nwb_utils.create_df_events(nwb)")
3636
return
3737
nwb.df_licks = annotate_lick_bouts(nwb)
3838
nwb.df_licks = annotate_artifacts(nwb)
@@ -57,7 +57,7 @@ def annotate_lick_bouts(nwb):
5757
"""
5858

5959
if not hasattr(nwb, "df_events"):
60-
print("You need to compute df_events: nwb_utils.create_events_df(nwb)")
60+
print("You need to compute df_events: nwb_utils.create_df_events(nwb)")
6161
return
6262
df_licks = nwb.df_events.query('event in ["right_lick_time","left_lick_time"]').copy()
6363
df_licks.reset_index(drop=True, inplace=True)
@@ -90,7 +90,7 @@ def annotate_artifacts(nwb):
9090
nwb, an object with attributes: df_licks, df_events
9191
"""
9292
if not hasattr(nwb, "df_events"):
93-
print("You need to compute df_events: nwb_utils.create_events_df(nwb)")
93+
print("You need to compute df_events: nwb_utils.create_df_events(nwb)")
9494
return
9595

9696
if not hasattr(nwb, "df_licks"):
@@ -122,7 +122,7 @@ def annotate_rewards(nwb):
122122
"""
123123

124124
if not hasattr(nwb, "df_events"):
125-
print("You need to compute df_events: nwb_utils.create_events_df(nwb)")
125+
print("You need to compute df_events: nwb_utils.create_df_events(nwb)")
126126
return
127127

128128
# ensure we have df_licks
@@ -183,7 +183,7 @@ def annotate_cue_response(nwb):
183183
"""
184184

185185
if not hasattr(nwb, "df_events"):
186-
print("You need to compute df_events: nwb_utils.create_events_df(nwb)")
186+
print("You need to compute df_events: nwb_utils.create_df_events(nwb)")
187187
return
188188

189189
# ensure we have df_licks
@@ -232,7 +232,7 @@ def annotate_intertrial_choices(nwb):
232232
"""
233233
# Add lick_bout annotation, and cue_response if not already added
234234
if not hasattr(nwb, "df_events"):
235-
print("You need to compute df_events: nwb_utils.create_events_df(nwb)")
235+
print("You need to compute df_events: nwb_utils.create_df_events(nwb)")
236236
return
237237
if not hasattr(nwb, "df_licks"):
238238
nwb.df_licks = annotate_lick_bouts(nwb)
@@ -267,7 +267,7 @@ def annotate_switches(nwb):
267267
"""
268268
# Add lick_bout annotation, and cue_response if not already added
269269
if not hasattr(nwb, "df_events"):
270-
print("You need to compute df_events: nwb_utils.create_events_df(nwb)")
270+
print("You need to compute df_events: nwb_utils.create_df_events(nwb)")
271271
return
272272
if not hasattr(nwb, "df_licks"):
273273
nwb.df_licks = annotate_lick_bouts(nwb)
@@ -337,7 +337,7 @@ def annotate_within_session(nwb):
337337
"""
338338

339339
if not hasattr(nwb, "df_events"):
340-
print("You need to compute df_events: nwb_utils.create_events_df(nwb)")
340+
print("You need to compute df_events: nwb_utils.create_df_events(nwb)")
341341
return
342342

343343
# ensure we have df_licks

src/aind_dynamic_foraging_basic_analysis/metrics/trial_metrics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def compute_trial_metrics(nwb):
3535
"""
3636
if not hasattr(nwb, "df_events"):
3737
print("computing df_events first")
38-
nwb.df_events = nu.create_events_df(nwb)
38+
nwb.df_events = nu.create_df_events(nwb)
3939

4040
if not hasattr(nwb, "df_trials"):
4141
print("computing df_trials")
@@ -340,7 +340,7 @@ def get_average_signal_window(
340340
raise ValueError("You need to compute df_trials: nwb_utils.create_trials_df(nwb)")
341341

342342
if not hasattr(nwb, "df_fip"):
343-
raise ValueError("You need to compute df_fip: nwb_utils.create_fib_df(nwb)")
343+
raise ValueError("You need to compute df_fip: nwb_utils.create_df_fip(nwb)")
344344

345345
# Check alignment_event is in df_trials columns
346346
if alignment_event not in nwb.df_trials.columns:

src/aind_dynamic_foraging_basic_analysis/plot/plot_fip.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ def plot_fip_psth_compare_alignments( # NOQA C901
5656
for nwb_i in nwb_list:
5757
if not hasattr(nwb_i, "df_fip"):
5858
print("You need to compute the df_fip first")
59-
print("running `nwb.df_fip = create_fib_df(nwb,tidy=True)`")
60-
nwb_i.df_fip = nu.create_fib_df(nwb_i, tidy=True)
59+
print("running `nwb.df_fip = create_df_fip(nwb,tidy=True)`")
60+
nwb_i.df_fip = nu.create_df_fip(nwb_i, tidy=True)
6161
if not hasattr(nwb_i, "df_events"):
6262
print("You need to compute the df_events first")
63-
print("run `nwb.df_events = create_events_df(nwb)`")
64-
nwb_i.df_events = nu.create_events_df(nwb_i)
63+
print("run `nwb.df_events = create_df_events(nwb)`")
64+
nwb_i.df_events = nu.create_df_events(nwb_i)
6565
if channel not in nwb_i.df_fip["event"].values:
6666
print("channel {} not in df_fip".format(channel))
6767

@@ -222,12 +222,12 @@ def plot_fip_psth_compare_channels( # NOQA C901
222222
for nwb_i in nwb_list:
223223
if not hasattr(nwb_i, "df_fip"):
224224
print("You need to compute the df_fip first")
225-
print("running `nwb.df_fip = create_fib_df(nwb,tidy=True)`")
226-
nwb_i.df_fip = nu.create_fib_df(nwb_i, tidy=True)
225+
print("running `nwb.df_fip = create_df_fip(nwb,tidy=True)`")
226+
nwb_i.df_fip = nu.create_df_fip(nwb_i, tidy=True)
227227
if not hasattr(nwb_i, "df_events"):
228228
print("You need to compute the df_events first")
229-
print("run `nwb.df_events = create_events_df(nwb)`")
230-
nwb_i.df_events = nu.create_events_df(nwb_i)
229+
print("run `nwb.df_events = create_df_events(nwb)`")
230+
nwb_i.df_events = nu.create_df_events(nwb_i)
231231

232232
# Add warning if channels are missing
233233
missing_channels = [c for c in channels if c not in nwb_i.df_fip["event"].values]
@@ -434,8 +434,8 @@ def plot_histogram(nwb, preprocessed=True, edge_percentile=2, data_column="data"
434434
"""
435435
if not hasattr(nwb, "df_fip"):
436436
print("You need to compute the df_fip first")
437-
print("running `nwb.df_fip = create_fib_df(nwb,tidy=True)`")
438-
nwb.df_fip = nu.create_fib_df(nwb, tidy=True)
437+
print("running `nwb.df_fip = create_df_fip(nwb,tidy=True)`")
438+
nwb.df_fip = nu.create_df_fip(nwb, tidy=True)
439439
return
440440

441441
fig, ax = plt.subplots(3, 2, sharex=True)

src/aind_dynamic_foraging_basic_analysis/plot/plot_foraging_session_plotly.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ def plot_session_in_time_plotly( # noqa: C901 pragma: no cover
1616
df_events: A tidy dataframe of session events.
1717
1818
fip_df is a tidy dataframe of FIP measurements generated by
19-
aind_dynamic_foraging_data_utils.nwb_utils.create_fib_df(tidy=True)
19+
aind_dynamic_foraging_data_utils.nwb_utils.create_df_fip(tidy=True)
2020
2121
adjust_time (bool): If True, resets time=0 to the first event of the session.
2222
2323
EXAMPLE:
24-
df_events = nwb_utils.create_events_df(nwb_object)
25-
fip_df = nwb_utils.create_fib_df(nwb_object, tidy=True)
24+
df_events = nwb_utils.create_df_events(nwb_object)
25+
fip_df = nwb_utils.create_df_fip(nwb_object, tidy=True)
2626
plot_foraging_session_plotly.plot_session_events_plotly(df_events)
2727
"""
2828

src/aind_dynamic_foraging_basic_analysis/plot/plot_session_scroller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def plot_session_scroller( # noqa: C901 pragma: no cover
8484

8585
if not hasattr(nwb, "df_events"):
8686
print("computing df_events first")
87-
nwb.df_events = nu.create_events_df(nwb)
87+
nwb.df_events = nu.create_df_events(nwb)
8888
df_events = nwb.df_events
8989
else:
9090
df_events = nwb.df_events

0 commit comments

Comments
 (0)