File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -352,7 +352,8 @@ def NewContext(self):
352352 new_ctx = ffi .gc (lib .ctx_New (), lib .ctx_Dispose )
353353 new_api_util = dss_py .CffiApiUtil (ffi , lib , new_ctx )
354354 new_api_util ._allow_complex = self ._api_util ._allow_complex
355- return OpenDSSDirect (new_api_util )
355+ prefer_lists = (self ._get_complex128_array == self ._api_util .get_complex128_array2 )
356+ return OpenDSSDirect (new_api_util , prefer_lists = prefer_lists )
356357
357358 def to_dss_python (self ) -> DSSPython :
358359 """
Original file line number Diff line number Diff line change @@ -5564,6 +5564,23 @@ def test_numpy():
55645564 assert isinstance (odd_lst .Circuit .AllBusMagPu (), list )
55655565
55665566
5567+ def test_numpy_option_propagation ():
5568+ import_odd ()
5569+ from opendssdirect .OpenDSSDirect import OpenDSSDirect
5570+ from numpy import ndarray
5571+
5572+ # NOTE: this constructors ALWAYS binds to the default DSS engine.
5573+ odd_np = OpenDSSDirect (prefer_lists = False )
5574+ # Use it normally
5575+ odd_np (f"Redirect '{ PATH_TO_DSS } '" )
5576+ assert isinstance (odd_np .Circuit .AllBusMagPu (), ndarray )
5577+
5578+ odd_np2 = odd_np .NewContext ()
5579+ odd_np2 (f"Redirect '{ PATH_TO_DSS } '" )
5580+ assert isinstance (odd_np2 .Circuit .AllBusMagPu (), ndarray )
5581+
5582+
5583+
55675584def test_threading2 (dss ):
55685585 # Ported directly from DSS-Python, but using only the 13Bus circuit
55695586 from opendssdirect .OpenDSSDirect import OpenDSSDirect
You can’t perform that action at this time.
0 commit comments