I've been exploring the SignalIntegrityApp in python 3.13 over the past few days, and I encountered an error evaluating equations.
I made a super simple schematic as a sanity check to view the S-param effects of transmission line with Z0 != 50 Ohms. I expect to see ripples in S11 with maxima every 1/(2*td) Hz.
Here are some photos of my project:
When I calculate the schematic, I get an error saying "Equations are invalid".
I installed SignalIntegrity for development, and solved my issue by updating EvaluateSafely in App/ProjectFile.py to the following:
def EvaluateSafely(equations,sendargs,returnargs):
_globals = {**sendargs, **returnargs} # We will pass this as the globals namespace used in the exec function
exec(equations, _globals) # Since __builtins__ isn't defined, the equation will be run with __builtins__ from this process
return {key:_globals[key] for key in returnargs.keys()}
The official documentation for exec states that if neither globals or locals is passed, the code will run in the current scope. However, while debugging, variables loaded in the previous exec calls were not accessible during exec(equations). Either way, I think this solution should function the same and be marginally safer, because the call to exec(equations) has more restricted scope containing sendargs, returnargs and __builtins__ only.
I've been exploring the SignalIntegrityApp in python 3.13 over the past few days, and I encountered an error evaluating equations.
I made a super simple schematic as a sanity check to view the S-param effects of transmission line with Z0 != 50 Ohms. I expect to see ripples in S11 with maxima every 1/(2*td) Hz.
Here are some photos of my project:
When I calculate the schematic, I get an error saying "Equations are invalid".
I installed SignalIntegrity for development, and solved my issue by updating EvaluateSafely in App/ProjectFile.py to the following:
The official documentation for exec states that if neither globals or locals is passed, the code will run in the current scope. However, while debugging, variables loaded in the previous exec calls were not accessible during exec(equations). Either way, I think this solution should function the same and be marginally safer, because the call to exec(equations) has more restricted scope containing sendargs, returnargs and __builtins__ only.