Skip to content
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

Bug1070/nidigital remove redundant size param #1104

Merged
merged 7 commits into from
Nov 12, 2019

Conversation

sbethur
Copy link
Contributor

@sbethur sbethur commented Nov 8, 2019

  • This contribution adheres to CONTRIBUTING.md.
  • I've updated CHANGELOG.md if applicable.
  • I've added tests applicable for this pull request

What does this Pull Request accomplish?

Remove array-size parameter from apply_tdr_offsets and write_source_waveform_broadcast_u32 methods.

List issues fixed by this Pull Request below, if any.

What testing has been done?

Added system tests

@codecov
Copy link

codecov bot commented Nov 9, 2019

Codecov Report

Merging #1104 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1104   +/-   ##
=======================================
  Coverage   89.99%   89.99%           
=======================================
  Files          20       20           
  Lines        3679     3679           
=======================================
  Hits         3311     3311           
  Misses        368      368

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 004c7ae...d7bb02a. Read the comment docs.

src/nidigital/metadata/functions.py Show resolved Hide resolved
src/nidigital/system_tests/test_system_nidigital.py Outdated Show resolved Hide resolved
@sbethur sbethur requested a review from marcoskirsch November 11, 2019 20:51
@sbethur sbethur dismissed marcoskirsch’s stale review November 11, 2019 20:58

made the requested changes

@@ -664,11 +664,9 @@ def apply_tdr_offsets(self, num_offsets, offsets):
You can specify a subset of repeated capabilities using the Python index notation on an
nidigital.Session repeated capabilities container, and calling this method on the result.:

session.channels[0,1].apply_tdr_offsets(num_offsets, offsets)
session.channels[0,1].apply_tdr_offsets(offsets)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty confused why this is only a documentation change.
If you look at the old code to teh left, on line 677:

        num_offsets_ctype = _visatype.ViInt32(0 if offsets is None else len(offsets))  # case S160		

is the same as the right hand side.

Why was parameter num_offsets not being used?
Was the generator generating valid yet "incorrect" code?
Or more likely, should the generator have caught a mistake in metadata and broken at codegen time?

@texasaggie97

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{
    'direction': 'in',
    'name': 'offsets',
    'size': {
        'mechanism': 'passed-in',
        'value': 'numOffsets'
    },
    'type': 'ViReal64[]'
}

This is how metadata looked like before my fix, which was to change mechanism to len. Generated code used passed in list to figure out the size that needs to be passed to C DLL, but also added numOffsets as API method parameter.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The public method has a parameter num_offsets.
Metadata says 'size': {'mechanism': 'passed-in', 'value': 'numOffsets'}
But the generated code never uses numOffsets. In line 677 (left), variable num_offsets_ctype is initialized with the length of offsets.

@marcoskirsch marcoskirsch merged commit 6b55bdf into master Nov 12, 2019
@marcoskirsch marcoskirsch deleted the bug1070/nidigital_remove_redundant_size_param branch November 12, 2019 04:47
sbethur added a commit that referenced this pull request Nov 12, 2019
* Remove size param from apply_tdr_offsets() and write_source_waveform_broadcast_u32()

* Add test support files

* Updated Changelog

* Remove size param from apply_tdr_offsets() and write_source_waveform_broadcast_u32()

* Updated the os.path.join() call.

* Revert "Add test support files"

This reverts commit fd1c5b6

* Remove newly added system tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

In nidigital API, remove size argument from methods that take in an array
3 participants