Skip to content

Add unit tests for _default_stack_from_rotation_angle heuristics #54

@coderabbitai

Description

@coderabbitai

Context

The _default_stack_from_rotation_angle function in mdx2/data.py (lines 758-791) implements complex modulo-arithmetic heuristics across 8+ conditional branches to compute a reasonable image stack size given the rotation angle per frame.

Requirements

Add unit tests to validate the heuristics covering:

  • Documented rotation angles: 0.1°, 0.025°, 1/3°, 0.04°, 0°
  • Edge cases: very small angles (>0), very large angles (e.g., >6°)
  • Specific modulo branches:
    • 5*denom%numer==0
    • 6*denom%numer==0
    • 2*50*numer%denom==0
    • 2*40*numer%denom==0
    • 2*45*numer%denom==0
    • 4*50*numer%denom==0
    • 4*45*numer%denom==0
    • Default fallback cases

Suggested Approach

Create a pytest file (e.g., tests/test_data_stack_size.py) with parametrized tests that:

  1. Call _default_stack_from_rotation_angle with each test case
  2. Assert the expected integer result for each input
  3. Ensure all conditional branches are covered

Related

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions