Skip to content

Adding Function Generator Example in NI-FGEN - #2246

Closed
divakar-selvam07 wants to merge 7 commits into
ni:masterfrom
NI-velmurugan:users/diva/add-nifgen-function-generator-example
Closed

divakar-selvam07 wants to merge 7 commits into
ni:masterfrom
NI-velmurugan:users/diva/add-nifgen-function-generator-example

Conversation

@divakar-selvam07

Copy link
Copy Markdown
Contributor
  • 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?

  • Adds nifgen_function_generator.py, a Python equivalent of the NI-FGEN LabVIEW “Fgen Function Generator” example, with configurable waveform settings.
  • Adds the example to the NI-FGEN documentation and includes simulated tests.

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

None.

What testing has been done?

Manually validated with a simulated instrument and an actual hardware instrument.

@codecov-commenter

codecov-commenter commented Oct 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.12%. Comparing base (2c18797) to head (5ef93fc).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2246   +/-   ##
=======================================
  Coverage   88.12%   88.12%           
=======================================
  Files          88       88           
  Lines       22830    22830           
=======================================
+ Hits        20118    20119    +1     
+ Misses       2712     2711    -1     
Flag Coverage Δ
codegenunittests 84.78% <ø> (ø)
nidcpowersystemtests 94.40% <ø> (+0.04%) ⬆️
nidcpowerunittests 89.53% <ø> (ø)
nidigitalsystemtests 92.04% <ø> (ø)
nidigitalunittests 68.43% <ø> (ø)
nidmmsystemtests 92.33% <ø> (ø)
nifakeunittests 86.08% <ø> (ø)
nifgensystemtests 94.34% <ø> (ø)
nimodinstsystemtests 73.85% <ø> (ø)
nimodinstunittests 94.20% <ø> (ø)
nirfsasystemtests 82.71% <ø> (ø)
nirfsaunittests 63.37% <ø> (ø)
nirfsgsystemtests 81.22% <ø> (ø)
niscopesystemtests 89.99% <ø> (ø)
niscopeunittests 43.20% <ø> (ø)
nisesystemtests 91.50% <ø> (ø)
niswitchsystemtests 81.66% <ø> (ø)
nitclksystemtests 94.87% <ø> (ø)
nitclkunittests 98.26% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@divakar-selvam07

Copy link
Copy Markdown
Contributor Author

@jarnoldNI, the PR is ready for your review.

@divakar-selvam07
divakar-selvam07 marked this pull request as ready for review October 28, 2026 15:19

@ni-jfitzger ni-jfitzger left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What does this example give us that nifgen_standard_function.py doesn't?
I don't see the value.

@divakar-selvam07

Copy link
Copy Markdown
Contributor Author

What does this example give us that nifgen_standard_function.py doesn't? I don't see the value.

@ni-jfitzger, Agreed, the core flow is the same as nifgen_standard_function.py, and the only functional difference is an explicit output_enabled = True, which is already the default on this device.

Would it make sense to drop this new example and make those small changes in the existing one instead?
That would be the explicit output enable, the printed settings, and the explicit channel and values, with the tests set to a shorter run time. I'm happy to go either way.

@ni-jfitzger

Copy link
Copy Markdown
Collaborator

What does this example give us that nifgen_standard_function.py doesn't? I don't see the value.

@ni-jfitzger, Agreed, the core flow is the same as nifgen_standard_function.py, and the only functional difference is an explicit output_enabled = True, which is already the default on this device.

Would it make sense to drop this new example and make those small changes in the existing one instead? That would be the explicit output enable, the printed settings, and the explicit channel and values, with the tests set to a shorter run time. I'm happy to go either way.

Definitely drop this PR.
As to whether those other changes are worth making? The explicit channel change may be worth making. The rest probably isn't. I could see someone being confused when they initialize with default settings, then try to use channel 1, only for the driver to return an error because it's not part of the session.

Other things that we may want to demonstrate:

  • The ability to change settings on the fly
    • Those properties appear to be excluded from the API, so I guess you have to call configure_standard_waveform while generating. I'm assuming that works, but I haven't tried it.
    • This feels awkward to demonstrate in a Python example, so maybe we would just leave a comment about it.
  • The ability to initialize with channels and have 2 separate sessions for the same Function Generator.

@ni-jfitzger

Copy link
Copy Markdown
Collaborator

What does this example give us that nifgen_standard_function.py doesn't? I don't see the value.

@ni-jfitzger, Agreed, the core flow is the same as nifgen_standard_function.py, and the only functional difference is an explicit output_enabled = True, which is already the default on this device.
Would it make sense to drop this new example and make those small changes in the existing one instead? That would be the explicit output enable, the printed settings, and the explicit channel and values, with the tests set to a shorter run time. I'm happy to go either way.

Definitely drop this PR. As to whether those other changes are worth making? The explicit channel change may be worth making. The rest probably isn't. I could see someone being confused when they initialize with default settings, then try to use channel 1, only for the driver to return an error because it's not part of the session.

Other things that we may want to demonstrate:

  • The ability to change settings on the fly

    • Those properties appear to be excluded from the API, so I guess you have to call configure_standard_waveform while generating. I'm assuming that works, but I haven't tried it.
    • This feels awkward to demonstrate in a Python example, so maybe we would just leave a comment about it.
  • The ability to initialize with channels and have 2 separate sessions for the same Function Generator.

We may want @marcoskirsch to weigh in, before you go off and do this work.

@divakar-selvam07

divakar-selvam07 commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor Author

What does this example give us that nifgen_standard_function.py doesn't? I don't see the value.

@ni-jfitzger, Agreed, the core flow is the same as nifgen_standard_function.py, and the only functional difference is an explicit output_enabled = True, which is already the default on this device.
Would it make sense to drop this new example and make those small changes in the existing one instead? That would be the explicit output enable, the printed settings, and the explicit channel and values, with the tests set to a shorter run time. I'm happy to go either way.

Definitely drop this PR. As to whether those other changes are worth making? The explicit channel change may be worth making. The rest probably isn't. I could see someone being confused when they initialize with default settings, then try to use channel 1, only for the driver to return an error because it's not part of the session.
Other things that we may want to demonstrate:

  • The ability to change settings on the fly

    • Those properties appear to be excluded from the API, so I guess you have to call configure_standard_waveform while generating. I'm assuming that works, but I haven't tried it.
    • This feels awkward to demonstrate in a Python example, so maybe we would just leave a comment about it.
  • The ability to initialize with channels and have 2 separate sessions for the same Function Generator.

We may want @marcoskirsch to weigh in, before you go off and do this work.

@ni-jfitzger, Understood. Just to confirm: should I close this PR now and open a new one against nifgen_standard_function.py once @marcoskirsch weighs in on the follow-ups? Or would you rather I repurpose this PR for those changes?

@ni-jfitzger

Copy link
Copy Markdown
Collaborator

I'd prefer a fresh PR over a repurposed one.

@divakar-selvam07

Copy link
Copy Markdown
Contributor Author

What does this example give us that nifgen_standard_function.py doesn't? I don't see the value.

@ni-jfitzger, Agreed, the core flow is the same as nifgen_standard_function.py, and the only functional difference is an explicit output_enabled = True, which is already the default on this device.
Would it make sense to drop this new example and make those small changes in the existing one instead? That would be the explicit output enable, the printed settings, and the explicit channel and values, with the tests set to a shorter run time. I'm happy to go either way.

Definitely drop this PR. As to whether those other changes are worth making? The explicit channel change may be worth making. The rest probably isn't. I could see someone being confused when they initialize with default settings, then try to use channel 1, only for the driver to return an error because it's not part of the session.
Other things that we may want to demonstrate:

  • The ability to change settings on the fly

    • Those properties appear to be excluded from the API, so I guess you have to call configure_standard_waveform while generating. I'm assuming that works, but I haven't tried it.
    • This feels awkward to demonstrate in a Python example, so maybe we would just leave a comment about it.
  • The ability to initialize with channels and have 2 separate sessions for the same Function Generator.

We may want @marcoskirsch to weigh in, before you go off and do this work.

@ni-jfitzger, Understood. Just to confirm: should I close this PR now and open a new one against nifgen_standard_function.py once @marcoskirsch weighs in on the follow-ups? Or would you rather I repurpose this PR for those changes?

Sure, I'll close this PR. If @marcoskirsch wants the changes to nifgen_standard_function.py (the explicit channel and the on-the-fly comment), I'll raise a fresh PR for them.

@divakar-selvam07
divakar-selvam07 deleted the users/diva/add-nifgen-function-generator-example branch November 11, 2026 06:17
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.

6 participants