Fix #116 and #129: label import bug and matplotlib backend conflict#176
Conversation
…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 finished @jbohnslav's task in 1s —— View job I'll analyze this and get back to you. |
There was a problem hiding this comment.
💡 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".
|
Temporarily closing and reopening to trigger the new owner-approval-policy required check after updating the ruleset. |
|
@codex review |
There was a problem hiding this comment.
💡 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".
| if first_col == "" or str(first_col).startswith("Unnamed"): | ||
| df = df.drop(columns=[first_col]) |
There was a problem hiding this comment.
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 👍 / 👎.
Fixes
Fix #116:
add_label_to_project()silently deletes first behavior columnThe 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_coland 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 inflow_generator/train.py,feature_extractor/train.py, andsequence/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
aggbackend; 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.