Skip to content

Fix #116 and #129: label import bug and matplotlib backend conflict#176

Merged
jbohnslav merged 5 commits into
masterfrom
fix/label-import-and-matplotlib-backend
Jul 3, 2026
Merged

Fix #116 and #129: label import bug and matplotlib backend conflict#176
jbohnslav merged 5 commits into
masterfrom
fix/label-import-and-matplotlib-backend

Conversation

@jbohnslav

Copy link
Copy Markdown
Owner

Fixes

Fix #116: add_label_to_project() silently deletes first behavior column

The old code used pd.read_csv(path, index_col=0) which assumes every CSV has a DEG-style unnamed numeric index column. External CSVs without one had their first data column silently consumed as the index.

Fix: Read without index_col and explicitly detect/drop unnamed index columns.

Tests added: Three new test cases covering DEG-style CSVs, external CSVs without index, and external CSVs with background but no index.

Fix #129: matplotlib backend conflict when importing training modules

plt.switch_backend('agg') was called at module level in flow_generator/train.py, feature_extractor/train.py, and sequence/train.py. This killed interactive matplotlib for anyone importing these modules in notebooks or scripts.

Fix: Moved the call inside the training functions. Training still uses the agg backend; importing the module no longer overrides the user's backend.

Testing

All 28 tests pass (pytest -v -m 'not gpu'), including 3 new tests for #116.

James Robinson-Bohnslav added 2 commits March 31, 2026 07:57
…ernal CSVs

The old code used pd.read_csv(path, index_col=0) which assumes every
CSV has a DEG-style unnamed numeric index column. External CSVs without
one had their first data column silently consumed as the index.

Now reads without index_col and explicitly detects/drops unnamed index
columns. Added tests for DEG-style, external-no-index, and
external-with-background CSV formats.
…ing functions

The agg backend was set at import time in flow_generator/train.py,
feature_extractor/train.py, and sequence/train.py. This killed
interactive matplotlib for anyone importing these modules (e.g. in
notebooks or scripts that call plt.show()).

Moving the call inside the training functions preserves headless
behavior during training while allowing interactive use when importing.
@claude

claude Bot commented Mar 31, 2026

Copy link
Copy Markdown

Claude finished @jbohnslav's task in 1s —— View job


I'll analyze this and get back to you.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a1d95860d8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread deepethogram/projects.py
James Robinson-Bohnslav and others added 3 commits March 31, 2026 10:47
@jbohnslav jbohnslav self-assigned this Jul 3, 2026
@jbohnslav

Copy link
Copy Markdown
Owner Author

Temporarily closing and reopening to trigger the new owner-approval-policy required check after updating the ruleset.

@jbohnslav jbohnslav closed this Jul 3, 2026
@jbohnslav jbohnslav reopened this Jul 3, 2026
@jbohnslav

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7d8834f56f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread deepethogram/projects.py
Comment on lines +177 to +178
if first_col == "" or str(first_col).startswith("Unnamed"):
df = df.drop(columns=[first_col])

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Drop named index columns during label import

When a label CSV was written with a named pandas index, such as index_label="frame" or df.index.name = "frame", pd.read_csv returns that first column as frame rather than Unnamed: 0, so this guard keeps it as a behavior column. The old index_col=0 path ignored that column; now importing those files saves an extra class and the auto-background calculation includes frame numbers, producing labels with the wrong width and incorrect background rows.

Useful? React with 👍 / 👎.

@jbohnslav jbohnslav merged commit 895154c into master Jul 3, 2026
14 checks passed
@jbohnslav jbohnslav deleted the fix/label-import-and-matplotlib-backend branch July 3, 2026 17:22
@jbohnslav jbohnslav mentioned this pull request Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error with matplotlib backend while importing train files projects.add_label_to_project is broken

1 participant