Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
eda7e5e
Add sites as a repeated capability
texasaggie97-zz Feb 24, 2020
804b90d
Since sites are not one of the "magic" terms for repeated capabilites…
texasaggie97-zz Feb 24, 2020
e94ecfa
Update generated files
texasaggie97-zz Feb 24, 2020
b194905
Update CHANGELOG.md
texasaggie97-zz Feb 24, 2020
405158c
Missed fancy fetch capture waveform
texasaggie97-zz Feb 24, 2020
cb94b7c
write_source_waveform_site_unique also uses site
texasaggie97-zz Feb 24, 2020
a80f88a
site_list is a rep cap now so remove from parameter list
texasaggie97-zz Feb 25, 2020
12c65c5
site_list is not a param
texasaggie97-zz Feb 25, 2020
ef15749
Update for review comments
texasaggie97-zz Mar 2, 2020
f9d13b6
Merge branch 'master' into bug1111/sites_rep_cap
texasaggie97-zz Mar 3, 2020
1b6159b
Merge branch 'master' into bug1111/sites_rep_cap
texasaggie97-zz Mar 4, 2020
7dfe84d
Add nidigital specific converter for site (singular)
texasaggie97-zz Mar 4, 2020
52e9ad8
Use site converter
texasaggie97-zz Mar 4, 2020
9233c89
Add unit tests
texasaggie97-zz Mar 4, 2020
99a86af
Update generated files
texasaggie97-zz Mar 4, 2020
025bbab
Merge branch 'master' into bug1111/sites_rep_cap
texasaggie97-zz Mar 4, 2020
66bf427
Update generated files
texasaggie97-zz Mar 4, 2020
0d19816
Update test_system_nidigital.py
texasaggie97-zz Mar 4, 2020
9435805
Change comments per review
texasaggie97-zz Mar 11, 2020
b20b59b
Move nidigital converter tests to nidigital system tests, so they act…
texasaggie97-zz Mar 11, 2020
798b8ce
Fix documentation type
texasaggie97-zz Mar 11, 2020
756bafc
Update fetch_history_ram_cycle_information to properly support int sites
texasaggie97-zz Mar 11, 2020
695c7ee
Update generated files
texasaggie97-zz Mar 11, 2020
6d3d503
Wrong function name
texasaggie97-zz Mar 11, 2020
e3ad36b
Merge branch 'master' into bug1111/sites_rep_cap
texasaggie97-zz Mar 11, 2020
dff8c94
Update generated files
texasaggie97-zz Mar 11, 2020
258390d
Remove blank line
texasaggie97-zz Mar 11, 2020
3a668f3
Only use converter in the public method
texasaggie97-zz Mar 11, 2020
0527b3d
Update type_in_documentation
texasaggie97-zz Mar 12, 2020
2963ccc
Merge branch 'master' into bug1111/sites_rep_cap
texasaggie97-zz Mar 12, 2020
3ad86f2
Update generated files
texasaggie97-zz Mar 12, 2020
f709769
Merge branch 'master' into bug1111/sites_rep_cap
texasaggie97-zz Mar 19, 2020
0913c05
Update generated files
texasaggie97-zz Mar 19, 2020
e4c65ed
Updates for review comments
texasaggie97-zz Mar 19, 2020
46533cb
Update generated files
texasaggie97-zz Mar 19, 2020
12ee1dc
Update system tests
texasaggie97-zz Mar 19, 2020
fc285c0
Merge branch 'master' into bug1111/sites_rep_cap
texasaggie97-zz Mar 19, 2020
9ec17d9
Remove site_list from fancy function
texasaggie97-zz Mar 19, 2020
8aa00fa
Updates for tests
texasaggie97-zz Mar 19, 2020
e50b31e
Rely on repeated capability
texasaggie97-zz Mar 19, 2020
cfa40ad
Update generated files
texasaggie97-zz Mar 19, 2020
256b389
Make converter name correct
texasaggie97-zz Mar 19, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ All notable changes to this project will be documented in this file.
* `conditional_jump_triggers` and `pattern_opcode_events` repeated capabilities - [#1191](https://github.com/ni/nimi-python/issues/1191), [#1192](https://github.com/ni/nimi-python/issues/1192)
* #### Changed
* `write_source_waveform_site_unique()` now supports `numpy.array` and `list` as site waveform types
* sites are now a repeated capability instead of a parameter: `session.sites[1,2].fetch_capture_waveform(...)` - [#1111](https://github.com/ni/nimi-python/issues/1111)
* `fetch_history_ram_cycle_information` method now supports fetching multiple History RAM samples in a single API call - [#1071](https://github.com/ni/nimi-python/issues/1071)
* Update methods that require `pin_list` to be passed in, such that `pin_list` can be passed in via `pins` repeated capability - [#1294](https://github.com/ni/nimi-python/issues/1294)
* #### Removed
Expand Down
24 changes: 24 additions & 0 deletions build/templates/_converters.py.mako
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@ def convert_init_with_options_dictionary(values):
return init_with_options_string


<%
# Beginning of module-specific converters
%>\
<%
# nitclk is different. Only nitclk needs to be able to convert sessions like this
%>\
Expand Down Expand Up @@ -255,6 +258,26 @@ def convert_double_each_element(numbers):
return [x * 2 for x in numbers]


% endif
<%
# There are some parameters in nidigital that cannot be made into a repeated capability because the
# methods already have a repeated capability (pins), and we want the parameter to behave similarly
# to repeated capabilities.
%>\
% if config['module_name'] == 'nidigital':
def convert_site_to_string(site):
if isinstance(site, str):
if site.startswith('site'):
return site
else:
return convert_site_to_string(int(site))
else:
if type(site) != int:
# Don't use assert here since this comes from the user
raise TypeError('site must be a string or an integer. Actual: {}'.format(type(site)))
return 'site' + str(site)


% endif
# convert value to bytes
@singledispatch
Expand Down Expand Up @@ -540,3 +563,4 @@ def test_string_to_list_prefix():
def test_convert_comma_separated_string_to_list():
out_list = convert_comma_separated_string_to_list(' PinA , PinB , PinC ')
assert out_list == ['PinA', 'PinB', 'PinC']

103 changes: 39 additions & 64 deletions docs/nidigital/class.rst
Original file line number Diff line number Diff line change
Expand Up @@ -106,21 +106,19 @@ apply_levels_and_timing

.. py:currentmodule:: nidigital.Session

.. py:method:: apply_levels_and_timing(site_list, levels_sheet, timing_sheet, initial_state_high_pins="", initial_state_low_pins="", initial_state_tristate_pins="")
.. py:method:: apply_levels_and_timing(levels_sheet, timing_sheet, initial_state_high_pins="", initial_state_low_pins="", initial_state_tristate_pins="")

TBD





:param site_list:



.. tip:: This method requires repeated capabilities. If called directly on the
nidigital.Session object, then the method will use all repeated capabilities in the session.
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.


:type site_list: str
:param levels_sheet:


Expand Down Expand Up @@ -188,21 +186,19 @@ burst_pattern

.. py:currentmodule:: nidigital.Session

.. py:method:: burst_pattern(site_list, start_label, select_digital_function=True, wait_until_done=True, timeout=10.0)
.. py:method:: burst_pattern(start_label, select_digital_function=True, wait_until_done=True, timeout=10.0)

TBD





:param site_list:



.. tip:: This method requires repeated capabilities. If called directly on the
nidigital.Session object, then the method will use all repeated capabilities in the session.
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.


:type site_list: str
:param start_label:


Expand Down Expand Up @@ -387,21 +383,18 @@ configure_pattern_burst_sites

.. py:currentmodule:: nidigital.Session

.. py:method:: configure_pattern_burst_sites(site_list)
.. py:method:: configure_pattern_burst_sites()

TBD




.. tip:: This method requires repeated capabilities. If called directly on the
nidigital.Session object, then the method will use all repeated capabilities in the session.
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.

:param site_list:





:type site_list: str

configure_time_set_compare_edges_strobe
---------------------------------------
Expand Down Expand Up @@ -1048,63 +1041,55 @@ disable_sites

.. py:currentmodule:: nidigital.Session

.. py:method:: disable_sites(site_list)
.. py:method:: disable_sites()

TBD




.. tip:: This method requires repeated capabilities. If called directly on the
nidigital.Session object, then the method will use all repeated capabilities in the session.
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.

:param site_list:





:type site_list: str

enable_sites
------------

.. py:currentmodule:: nidigital.Session

.. py:method:: enable_sites(site_list)
.. py:method:: enable_sites()

TBD




.. tip:: This method requires repeated capabilities. If called directly on the
nidigital.Session object, then the method will use all repeated capabilities in the session.
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.

:param site_list:





:type site_list: str

fetch_capture_waveform
----------------------

.. py:currentmodule:: nidigital.Session

.. py:method:: fetch_capture_waveform(site_list, waveform_name, samples_to_read, timeout=datetime.timedelta(seconds=10.0))
.. py:method:: fetch_capture_waveform(waveform_name, samples_to_read, timeout=datetime.timedelta(seconds=10.0))

Returns dictionary where each key is the site number and the value is array.array of unsigned int





:param site_list:



.. tip:: This method requires repeated capabilities. If called directly on the
nidigital.Session object, then the method will use all repeated capabilities in the session.
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.


:type site_list: str
:param waveform_name:


Expand Down Expand Up @@ -1172,7 +1157,7 @@ fetch_history_ram_cycle_information



:type site: str
:type site: str or int
Copy link
Member

Choose a reason for hiding this comment

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

why didn't we make the site parameter a repeated capability?

:param position:


Expand Down Expand Up @@ -1356,7 +1341,7 @@ get_history_ram_sample_count



:type site: str
:type site: str or int
Copy link
Member

Choose a reason for hiding this comment

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

why didn't we make the site parameter a repeated capability?


:rtype: int
:return:
Expand Down Expand Up @@ -1467,22 +1452,14 @@ get_site_pass_fail

.. py:currentmodule:: nidigital.Session

.. py:method:: get_site_pass_fail(site_list)
.. py:method:: get_site_pass_fail()

Returns dictionary where each key is a site number and value is pass/fail





:param site_list:





:type site_list: str

:rtype: { int: bool, int: bool, ... }
:return:

Expand All @@ -1498,21 +1475,19 @@ get_site_results_site_numbers

.. py:currentmodule:: nidigital.Session

.. py:method:: get_site_results_site_numbers(site_list, site_result_type)
.. py:method:: get_site_results_site_numbers(site_result_type)

TBD





:param site_list:



.. tip:: This method requires repeated capabilities. If called directly on the
nidigital.Session object, then the method will use all repeated capabilities in the session.
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.


:type site_list: str
:param site_result_type:


Expand Down Expand Up @@ -1751,7 +1726,7 @@ is_site_enabled



:type site: str
:type site: str or int
Copy link
Member

Choose a reason for hiding this comment

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

why didn't we make the site parameter a repeated capability?


:rtype: bool
:return:
Expand Down
26 changes: 26 additions & 0 deletions docs/nidigital/rep_caps.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,30 @@ conditional_jump_triggers
passes a string of :python:`'conditionalJumpTrigger0, conditionalJumpTrigger1, conditionalJumpTrigger2'` to the set attribute function.


sites
-----

.. py:attribute:: nidigital.Session.sites[]

If no prefix is added to the items in the parameter, the correct prefix will be added when
the driver function call is made.

.. code:: python

session.sites['0-2'].channel_enabled = True

passes a string of :python:`'site0, site1, site2'` to the set attribute function.

If an invalid repeated capability is passed to the driver, the driver will return an error.

You can also explicitly use the prefix as part of the parameter, but it must be the correct prefix
for the specific repeated capability.

.. code:: python

session.sites['site0-site2'].channel_enabled = True

passes a string of :python:`'site0, site1, site2'` to the set attribute function.



1 change: 1 addition & 0 deletions generated/nidcpower/nidcpower/_converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,3 +488,4 @@ def test_string_to_list_prefix():
def test_convert_comma_separated_string_to_list():
out_list = convert_comma_separated_string_to_list(' PinA , PinB , PinC ')
assert out_list == ['PinA', 'PinB', 'PinC']

14 changes: 14 additions & 0 deletions generated/nidigital/nidigital/_converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,19 @@ def convert_init_with_options_dictionary(values):
return init_with_options_string


def convert_site_to_string(site):
if isinstance(site, str):
if site.startswith('site'):
return site
else:
return convert_site_to_string(int(site))
else:
if type(site) != int:
# Don't use assert here since this comes from the user
raise TypeError('site must be a string or an integer. Actual: {}'.format(type(site)))
return 'site' + str(site)


# convert value to bytes
@singledispatch
def _convert_to_bytes(value): # noqa: F811
Expand Down Expand Up @@ -488,3 +501,4 @@ def test_string_to_list_prefix():
def test_convert_comma_separated_string_to_list():
out_list = convert_comma_separated_string_to_list(' PinA , PinB , PinC ')
assert out_list == ['PinA', 'PinB', 'PinC']

Loading