Skip to content

fix: preserve illumination_channel when applying confocal override#511

Merged
Alpaca233 merged 3 commits intoCephla-Lab:masterfrom
Alpaca233:fix/confocal-override-illumination-channel
Mar 8, 2026
Merged

fix: preserve illumination_channel when applying confocal override#511
Alpaca233 merged 3 commits intoCephla-Lab:masterfrom
Alpaca233:fix/confocal-override-illumination-channel

Conversation

@Alpaca233
Copy link
Collaborator

Summary

  • Bug: Toggling to confocal mode caused no light output. get_effective_settings() replaced the entire illumination_settings with the confocal override's copy, which has illumination_channel=None (objective files don't store it). This meant turn_on_illumination() couldn't look up which laser/LED to activate.
  • Fix: Merge only intensity from the override into the base illumination_settings, preserving illumination_channel from the base channel.
  • Test: Added test_effective_settings_preserves_illumination_channel to verify the fix.

Test plan

  • All 70 acquisition config model tests pass
  • Toggle confocal mode and verify illumination turns on

🤖 Generated with Claude Code

Alpaca233 and others added 3 commits March 7, 2026 23:40
get_effective_settings() was replacing the entire illumination_settings
with the confocal override's copy. The override has illumination_channel=None
(objective files don't store it), so the laser/LED identity was lost —
turn_on_illumination() couldn't look up which source to activate.

Now merges only intensity from the override, preserving illumination_channel
from the base channel.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Rewrite comment to accurately describe both merge strategies
  (field-level for illumination, full replacement for camera)
- Add illumination_channel assertion to combined-override test
- Add test for confocal_mode=True with no confocal_override

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +259 to +266
# Merge illumination: take only intensity from the override, preserving
# illumination_channel from the base (the override has it as None since
# it is only set in the base config).
# Merge camera: full replacement (all camera fields are tunable).
if self.confocal_override.illumination_settings:
merged_illumination = self.confocal_override.illumination_settings.model_copy()
merged_illumination = self.illumination_settings.model_copy(
update={"intensity": self.confocal_override.illumination_settings.intensity}
)
Copy link

Copilot AI Mar 8, 2026

Choose a reason for hiding this comment

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

The comment claims the confocal override "has [illumination_channel] as None", but IlluminationSettings allows a non-None illumination_channel (and some tests/fixtures set it). With the new merge logic, any explicitly provided override illumination_channel would be ignored. Either clarify that overrides must not set illumination_channel (and consider validating/enforcing that), or update the merge to use the override illumination_channel when it is explicitly non-None.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

[Claude Code] Skipped - illumination_channel is an identity field set only in general.yaml. The confocal override is always created without it (objective files and auto-create in repository.py both leave it as None). Silently ignoring a non-None value here is the correct behavior since confocal/widefield mode should never change which light source is used.

@Alpaca233 Alpaca233 merged commit 07ac6e5 into Cephla-Lab:master Mar 8, 2026
10 checks passed
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.

2 participants