Skip to content

Conversation

damiano-flex
Copy link
Contributor

@damiano-flex damiano-flex commented Oct 3, 2025

Greptile Overview

Updated On: 2025-10-03 10:54:12 UTC

Summary

This PR adds logarithmic and symmetric logarithmic scaling support to Tidy3D's plotting functionality. The changes enhance the visualization capabilities by expanding the available scale options from just linear ('lin') and decibel ('dB') to include logarithmic ('log') and symmetric logarithmic ('symlog') scales.

The implementation involves two main components: First, the PlotScale type definition in tidy3d/components/types/base.py is updated to include the new scale options. Second, the plotting infrastructure in tidy3d/components/scene.py is modified to handle these new scales using matplotlib's normalization objects (LogNorm and SymLogNorm).

The core plotting methods like plot_structures_eps and plot_structures_property now accept a scale parameter and use appropriate matplotlib normalizations instead of simple vmin/vmax parameters. For symmetric logarithmic scaling, the implementation includes sophisticated logic to calculate appropriate linear threshold (linthresh) values, particularly for doping concentration data where values can span many orders of magnitude and include both positive and negative values.

This enhancement integrates seamlessly with Tidy3D's existing plotting architecture and follows matplotlib's standard conventions. The change is particularly valuable for electromagnetic simulations where field data, power quantities, and material properties often span wide dynamic ranges that benefit from logarithmic visualization.

Important Files Changed

Changed Files
Filename Score Overview
tidy3d/components/types/base.py 5/5 Added 'log' and 'symlog' options to PlotScale type definition
tidy3d/components/scene.py 4/5 Implemented log/symlog scaling in plotting methods with normalization logic and linthresh calculation

Confidence score: 4/5

  • This PR is safe to merge with minimal risk of breaking existing functionality
  • Score reflects well-structured implementation following matplotlib conventions, though the complex linthresh calculation logic needs attention
  • Pay close attention to the symlog threshold calculation methods in scene.py

greptile-apps[bot]

This comment was marked as resolved.

@damiano-flex damiano-flex changed the title feat: Add log and symlog scale chore: Add log and symlog scale Oct 7, 2025
@damiano-flex damiano-flex changed the title chore: Add log and symlog scale feat(FXC-3536): Add log and symlog scale Oct 7, 2025

This comment was marked as resolved.

@damiano-flex

This comment was marked as resolved.

greptile-apps[bot]

This comment was marked as resolved.

@damiano-flex damiano-flex force-pushed the damiano/symlogscale branch 2 times, most recently from d45f4ee to a8b50fc Compare October 8, 2025 08:06
yaugenst-flex

This comment was marked as resolved.

yaugenst-flex

This comment was marked as resolved.

@damiano-flex damiano-flex force-pushed the damiano/symlogscale branch 2 times, most recently from 5114878 to 5f98371 Compare October 8, 2025 12:02
@damiano-flex damiano-flex changed the title feat(FXC-3536): Add log and symlog scale feat(FXC-3536): add log and symlog plot scale Oct 8, 2025
@damiano-flex damiano-flex enabled auto-merge October 8, 2025 12:03
@damiano-flex damiano-flex disabled auto-merge October 8, 2025 12:37
@damiano-flex damiano-flex enabled auto-merge October 8, 2025 12:42
@damiano-flex damiano-flex added this pull request to the merge queue Oct 8, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 8, 2025
@damiano-flex damiano-flex enabled auto-merge October 8, 2025 17:28
@damiano-flex damiano-flex added this pull request to the merge queue Oct 8, 2025
Merged via the queue into develop with commit 98be21e Oct 8, 2025
25 checks passed
@damiano-flex damiano-flex deleted the damiano/symlogscale branch October 8, 2025 18:51
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.

4 participants