Skip to content

Commit 88f5fe8

Browse files
committed
modify datetime.now and add control for sessions without behavior for the generate-report function
1 parent ab1647b commit 88f5fe8

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/ethopy_analysis/cli.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import click
66
import sys
77
import os
8+
from datetime import datetime
89

910
from .plots.animal import (
1011
plot_session_date,
@@ -146,11 +147,20 @@ def generate_report(animal_id: int, output_dir: str):
146147
with open(report_file, "w") as f:
147148
f.write("ETHOPY ANALYSIS REPORT\n")
148149
f.write(f"Animal ID: {animal_id}\n")
149-
f.write("Generated: {}\n".format(click.DateTime().now()))
150+
f.write("Generated: {}\n".format(datetime.now()))
150151
f.write("=" * 50 + "\n\n")
151152

152153
f.write("SESSION SUMMARY\n")
153154
f.write(f"Total sessions: {len(sessions)}\n")
155+
if get_performance(animal_id, session_row['session']) is None:
156+
f.write(
157+
f" Performance: no behavior in this session\n"
158+
)
159+
else:
160+
f.write(
161+
f" Performance: {get_performance(animal_id, session_row['session']):.3f}\n"
162+
)
163+
154164
f.write(
155165
f"Session range: {sessions['session'].min()} - {sessions['session'].max()}\n\n"
156166
)

0 commit comments

Comments
 (0)