Skip to content

Commit 3ab266a

Browse files
authored
Merge pull request #101 from AllenNeuralDynamics/fip_plot_updates
Allow multiple FIP channels in plot axis of session scroller
2 parents 39ced41 + a01f0ab commit 3ab266a

1 file changed

Lines changed: 17 additions & 6 deletions

File tree

src/aind_dynamic_foraging_basic_analysis/plot/plot_session_scroller.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -513,14 +513,25 @@ def plot_fip(fip_df, channel, ax):
513513
if fip_df is None:
514514
raise Exception("Cannot plot FIP, no FIP data")
515515

516-
if channel not in fip_df["event"].unique():
517-
raise Exception("Cannot plot {}, no data".format(channel))
516+
if isinstance(channel, list):
517+
for sub_channel in channel:
518+
if sub_channel not in fip_df["event"].unique():
519+
raise Exception("Cannot plot {}, no data".format(sub_channel))
520+
521+
color = get_fip_color(sub_channel)
522+
C = fip_df.query("event == @sub_channel")
523+
ax.plot(C.timestamps.values, C.data.values, color, label=sub_channel)
524+
ax.set_ylabel("multiple", fontsize=12)
525+
ax.legend()
526+
else:
527+
if channel not in fip_df["event"].unique():
528+
raise Exception("Cannot plot {}, no data".format(channel))
518529

519-
color = get_fip_color(channel)
520-
C = fip_df.query("event == @channel")
521-
ax.plot(C.timestamps.values, C.data.values, color)
530+
color = get_fip_color(channel)
531+
C = fip_df.query("event == @channel")
532+
ax.plot(C.timestamps.values, C.data.values, color)
533+
ax.set_ylabel(channel, fontsize=12)
522534
ax.axhline(0, color="k", linewidth=0.5, alpha=0.25)
523-
ax.set_ylabel(channel, fontsize=12)
524535

525536

526537
def get_fip_color(channel):

0 commit comments

Comments
 (0)