Skip to content

Commit

Permalink
Add tclk add example (#1028)
Browse files Browse the repository at this point in the history
* Add initial metadata

* Create nitclk.mak

* Remove numpy restriction

Bug fixed

* Upgrade pip

* Remove specific version of flake8

'\' in comments now need to be escaped

* Add basepython section

* Try using pypy3.5

* Go back to pypy3 and remove basepython block

* Don't need to run build_test for all builds - only 3.6

* Remove warning from coverage

* Undo previous change

* Try disabling faulthandler

* Remove --no-faulthandler

* pypy needs an older version of pytest

See pytest-dev/pytest#5807

* Use platform_python_implementation since implementation_name is not defined on Python2

* Try to get back to the initial coverage

* Do the same thing for build_test

* Remove redundant pip

* Add codecov file to try to control limits for passing

* Enable nitclk build

* There are some files we will need to skip for now

* Add generated nitclk files

* Update generated files

* Can't skip README.rst

* Update templates

* Add new cases for buffers with a converter

* Need to handle ' []' to normalize everything

* Get the session handle name from config instead of hardcoding 'vi'

* Temp commit

* Fix syntax error

* Test new cases

* Force change

* Update generated files

* Update generated files

* Add different target for pr (project) and commit (patch)

* threshold should be number

* Renumber scaler cases to be in order used in the code

* Update generated files

* Renumber buffer cases to match order used in code

* Move and rename test to match case (C020)

* Update generated files

* Add placeholder nitclk example

* Enable example documentation build

* Add generated examples.rst

* Add empty line back (to minimize diff)

* Update generated files

* Update generated files
  • Loading branch information
texasaggie97-zz committed Sep 19, 2019
1 parent adbfebe commit a828005
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
# built documents.
#
# The full version, including alpha/beta/rc tags.
release = '0.1.0.dev0'
release = '1.1.3.dev0'
# The short X.Y version.
version = release[:3]

Expand Down
12 changes: 12 additions & 0 deletions docs/nitclk/examples.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Examples
========

nitclk_configure.py
-------------------

.. literalinclude:: ../../src/nitclk/examples/nitclk_configure.py
:language: python
:linenos:
:encoding: utf8
:caption: `(nitclk_configure.py) <https://github.com/ni/nimi-python/blob/master/src/nitclk/examples/nitclk_configure.py>`_

42 changes: 42 additions & 0 deletions src/nitclk/examples/nitclk_configure.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/python

import argparse
import nitclk
import pprint
import sys

pp = pprint.PrettyPrinter(indent=4, width=80)


def example(resource_name, channels, options, length, voltage):
pass


def _main(argsv):
parser = argparse.ArgumentParser(description='Acquires one record from the given channels.', formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('-n', '--resource-name', default='PXI1Slot2', help='Resource name of a National Instruments Digitizer')
parser.add_argument('-c', '--channels', default='0', help='Channel(s) to use')
parser.add_argument('-l', '--length', default=1000, type=int, help='Measure record length')
parser.add_argument('-v', '--voltage', default=1.0, type=float, help='Voltage range (V)')
parser.add_argument('-op', '--option-string', default='', type=str, help='Option string')
args = parser.parse_args(argsv)
example(args.resource_name, args.channels, args.option_string, args.length, args.voltage)


def main():
_main(sys.argv[1:])


def test_example():
options = {'simulate': True, 'driver_setup': {'Model': '5164', 'BoardType': 'PXIe', }, }
example('PXI1Slot2', '0', options, 1000, 1.0)


def test_main():
cmd_line = ['--option-string', 'Simulate=1, DriverSetup=Model:5164; BoardType:PXIe', ]
_main(cmd_line)


if __name__ == '__main__':
main()

4 changes: 1 addition & 3 deletions src/nitclk/nitclk.mak
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ MODULE_FILES_TO_GENERATE := $(filter-out enums.py,$(DEFAULT_PY_FILES_TO_GENERATE

MODULE_FILES_TO_COPY := $(DEFAULT_PY_FILES_TO_COPY)

# Eventually we will get back to this as we add/update more files
# RST_FILES_TO_GENERATE := $(filter-out enums.rst,$(DEFAULT_RST_FILES_TO_GENERATE))
RST_FILES_TO_GENERATE := $(filter-out examples.rst enums.rst,$(DEFAULT_RST_FILES_TO_GENERATE))
RST_FILES_TO_GENERATE := $(filter-out enums.rst,$(DEFAULT_RST_FILES_TO_GENERATE))


include $(BUILD_HELPER_DIR)/rules.mak
Expand Down

0 comments on commit a828005

Please sign in to comment.