Add mode settings to hashed parameters#683
Open
gronniger wants to merge 1 commit intogdsfactory:mainfrom
Open
Conversation
Contributor
Reviewer's guide (collapsed on small PRs)Reviewer's GuideEnsure Meep S-parameter simulation caching accounts for port source/mode configuration by initializing port-related parameters early and including them in the hashed simulation settings, while removing an unnecessary dummy Component/port-extraction block. Sequence diagram for updated Meep S-parameter caching with port modessequenceDiagram
participant Caller
participant write_sparameters_meep
participant Component
participant Cache
Caller->>write_sparameters_meep: call write_sparameters_meep(component, port_source_names, port_source_modes, port_modes, ...)
activate write_sparameters_meep
write_sparameters_meep->>Component: read ports from component.ports
Component-->>write_sparameters_meep: list of Port
write_sparameters_meep->>write_sparameters_meep: derive port_names from component.ports
write_sparameters_meep->>write_sparameters_meep: initialize port_source_names (fallback to port_names)
write_sparameters_meep->>write_sparameters_meep: initialize port_source_modes (fallback {name: [0]})
write_sparameters_meep->>write_sparameters_meep: initialize port_modes (fallback [0])
write_sparameters_meep->>write_sparameters_meep: build sim_settings including port_source_names, port_source_modes, port_modes, resolution, port_symmetries, wavelength_start, wavelength_stop, ...
write_sparameters_meep->>Cache: compute hash(sim_settings)
Cache-->>write_sparameters_meep: cache_key
write_sparameters_meep->>Cache: check cached_results[cache_key]
alt cache hit
Cache-->>write_sparameters_meep: cached S-parameters
write_sparameters_meep-->>Caller: return cached S-parameters
else cache miss
write_sparameters_meep->>write_sparameters_meep: run Meep simulations (respecting port_source_names, port_source_modes, port_modes)
write_sparameters_meep->>Cache: store results under cache_key
Cache-->>write_sparameters_meep: ack
write_sparameters_meep-->>Caller: return new S-parameters
end
deactivate write_sparameters_meep
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, the different input / output modes given in
port_source_names,port_source_modesandport_modesare not considered in hashing the simulation settings duringwrite_sparameters_meep().Therefore, e.g. running a TM simulation after a TE simulation would load the wrong cached simulation results instead of performing a new simulation.
Summary by Sourcery
Ensure Meep S-parameter simulations account for port mode settings when hashing simulation configurations to select cached results.
Bug Fixes:
Enhancements: