-
Notifications
You must be signed in to change notification settings - Fork 102
nirfsg: Refactor get_deembedding_sparameters to match the interpreter interfaces #2167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
6a11ce3
initial version
rahur-NI 018ac04
Resolving System tests
rahur-NI e4e13c3
Need to update doc changes
rahur-NI d1f7ef1
Updated with private function
rahur-NI 5079c88
Removing the doc template.
rahur-NI 8ed649e
Updated functions.py to remove non mandate changes
rahur-NI 0b80b51
Updating session.py template for get_deembedding_sparameters function
rahur-NI e03f722
Updated test case as needed for gRPC system tests
rahur-NI f643b29
Updated gRPC enum to resolve 'TypeError: 'float' object cannot be int…
rahur-NI f31521c
Removed SetAttributeVi to include in a new PR
rahur-NI 64fd4a3
Matching get_deembedding_sparameters to the gRPCs interpreter
rahur-NI 265b3a1
Updated as the code review comments
rahur-NI f898cc0
Remvoing unwanted files
rahur-NI 1a54268
Updated code review comments
rahur-NI File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
15 changes: 15 additions & 0 deletions
15
src/nirfsg/templates/_grpc_stub_interpreter.py/get_deembedding_sparameter.py.mako
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| <%page args="f, config, method_template"/>\ | ||
| <% | ||
| '''Retrieves S-parameters from the gRPC call response and converts them to a reshaped numpy array.''' | ||
| import build.helper as helper | ||
| %>\ | ||
| def ${f['interpreter_name']}(self): | ||
| import numpy as np | ||
| response = self._invoke( | ||
| self._client.GetDeembeddingSparameters, | ||
| grpc_types.GetDeembeddingSparametersRequest(vi=self._vi), | ||
| ) | ||
| number_of_ports = response.number_of_ports | ||
| sparameters = np.array([c.real + 1j * c.imaginary for c in response.sparameters], dtype=np.complex128) | ||
| sparameters = sparameters.reshape((number_of_ports, number_of_ports)) | ||
| return sparameters |
20 changes: 20 additions & 0 deletions
20
src/nirfsg/templates/_library_interpreter.py/get_deembedding_sparameter.py.mako
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| <%page args="f, config, method_template"/>\ | ||
| <% | ||
| '''Gets S-parameters from the driver. Queries the number of ports, retrieves the S-parameter data into a pre-allocated buffer, and reshapes it.''' | ||
| import build.helper as helper | ||
| %>\ | ||
|
|
||
| def ${f['interpreter_name']}(self): | ||
| import numpy as np | ||
| number_of_ports = self.get_deembedding_table_number_of_ports() | ||
| sparameters_array_size = number_of_ports ** 2 | ||
| sparameters = np.full((number_of_ports, number_of_ports), 0 + 0j, dtype=np.complex128) | ||
| vi_ctype = _visatype.ViSession(self._vi) # case S110 | ||
| sparameters_ctype = _get_ctypes_pointer_for_buffer(value=sparameters, library_type=_complextype.NIComplexNumber) # case B510 | ||
| sparameters_array_size_ctype = _visatype.ViInt32(sparameters_array_size) # case S150 | ||
| number_of_sparameters_ctype = _visatype.ViInt32() # case S220 | ||
| number_of_ports_ctype = _visatype.ViInt32() # case S220 | ||
rahur-NI marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| error_code = self._library.niRFSG_GetDeembeddingSparameters(vi_ctype, sparameters_ctype, sparameters_array_size_ctype, None if number_of_sparameters_ctype is None else (ctypes.pointer(number_of_sparameters_ctype)), None if number_of_ports_ctype is None else (ctypes.pointer(number_of_ports_ctype))) | ||
| errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) | ||
| sparameters = sparameters.reshape((int(number_of_ports_ctype.value), int(number_of_ports_ctype.value))) | ||
| return sparameters | ||
17 changes: 0 additions & 17 deletions
17
src/nirfsg/templates/session.py/get_deembedding_sparameter.py.mako
This file was deleted.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.