Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "jabs-postprocess"
version = "0.5.1"
version = "0.5.2"
description = "A python library for JABS postprocessing utilities."
readme = "README.md"
license = "LicenseRef-PLATFORM-LICENSE-AGREEMENT-FOR-NON-COMMERCIAL-USE"
Expand All @@ -25,7 +25,7 @@ dependencies = [
"Pillow>=10.0.1",
"scikit-learn>=1.6.1",
"scipy>=1.15.2",
"typer>=0.15.4",
"typer>=0.20.0",
]

[project.urls]
Expand Down
10 changes: 8 additions & 2 deletions src/jabs_postprocess/utils/project_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -923,11 +923,17 @@ def bouts_to_bins(
# Get the range that the experiment spans
try:
# TODO: Add support for different sized experiment blocks (re-use block below to make an end time that is adjusted per-video)
min_time = min(event_df["time"])
max_time = max(event_df["time"])
if min_time == max_time:
raise ValueError(
"All timestamps are identical, using frame-based calculation"
)
start_time = BoutTable.round_hour(
datetime.strptime(min(event_df["time"]), "%Y-%m-%d %H:%M:%S")
datetime.strptime(min_time, "%Y-%m-%d %H:%M:%S")
)
end_time = BoutTable.round_hour(
datetime.strptime(max(event_df["time"]), "%Y-%m-%d %H:%M:%S"), up=True
datetime.strptime(max_time, "%Y-%m-%d %H:%M:%S"), up=True
)
# Timestamp doesn't exist. Make up some. This assumes only 1 video exists and just makes up timestamps based on the available bout data.
except (KeyError, ValueError, TypeError):
Expand Down
2 changes: 1 addition & 1 deletion tests/cli/test_add_bout_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def test_add_bout_statistics_no_input_tables(self, runner):

# Assert - Typer will error before reaching our code due to missing required option
assert result.exit_code != 0
assert "Missing option" in result.stdout
assert "Missing option" in result.stderr

@patch("jabs_postprocess.cli.main.BoutTable")
def test_add_bout_statistics_output_messages(
Expand Down
4 changes: 2 additions & 2 deletions tests/cli/test_generate_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ def test_generate_tables_missing_required_args(self, runner):

# Assert
assert result.exit_code != 0
assert "Missing option" in result.stdout
assert "Missing option" in result.stderr

@patch("jabs_postprocess.cli.main.generate_behavior_tables")
def test_generate_tables_no_behaviors(
Expand All @@ -371,5 +371,5 @@ def test_generate_tables_no_behaviors(
assert result.exit_code == 1
assert (
"Must provide either --behavior-config or --behavior options"
in result.stdout
in result.stderr
)
Loading