feat: custom source time in modeler #2914
Merged
+103
−3
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.
Greptile Overview
Updated On: 2025-10-21 00:00:39 UTC
Greptile Summary
This PR adds the ability to specify custom source time dependence in component modelers (
ModalComponentModelerandTerminalComponentModeler) through a new optionalcustom_source_timeparameter in theAbstractComponentModelerbase class. When provided, the custom source time overrides the defaultGaussianPulsebehavior that was previously constructed automatically from frequency and bandwidth parameters. The feature integrates with the existing component modeler framework by checkingif self.custom_source_time is not Nonein theto_sourcemethods and using the custom value when present. This change maintains backward compatibility since the parameter defaults toNone, preserving existing behavior for all code that doesn't explicitly provide a custom source time. The JSON schema forTerminalComponentModelerhas been updated to reflect the three supported source time types:ContinuousWave,CustomSourceTime, andGaussianPulse.Important Files Changed
Changed Files
custom_source_timeoptional field to base class with proper type hints and documentationto_sourcemethod using conditional checkcustom_source_timefield with three source time type optionsContinuousWavewith non-zerofwidth, which violates source constraintsContinuousWavewithfwidth=1e8instead of requiredfwidth=0Confidence score: 2/5
ContinuousWavesources with non-zerofwidthvalues (test_component_modeler.py usesfwidth=1e13, test_terminal_component_modeler.py usesfwidth=1e8), butContinuousWavesources are monochromatic by design and should havefwidth=0; the core feature implementation in base.py and modal.py appears sound, but terminal.py is missing from context so cannot be verified; tests should useGaussianPulseinstead or setfwidth=0forContinuousWave