Skip to content

Commit

Permalink
Merge pull request #3 from asvela/dev/v0.5.0
Browse files Browse the repository at this point in the history
Releasing v0.5.0
  • Loading branch information
asvela authored Feb 1, 2021
2 parents f6e61b4 + 057f568 commit 1bb4909
Show file tree
Hide file tree
Showing 5 changed files with 1,996 additions and 2,019 deletions.
75 changes: 54 additions & 21 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,62 @@
v0.4.0
- Ensuring compatibility with `pyvisa v11.1`: ([issue #2](https://github.com/asvela/tektronix-func-gen/issues/2))
- PYVISAs `write()` does not return the status code anymore, so the module is modified accordingly
- not necessary to have an empty query after `write_binary_values()` in `set_custom_waveform()`
- Added `check_pyvisa_status()`, now checking status for both queries and writes
- Bug fixes for `set_frequency()` and `set_offset()` that were previously not taking into account the unit when calculating if it was within the limits
v0.5
- Adding `_` suggesting private methods and functions:
- `FuncGen` methods
- `_check_pyvisa_status()`
- `_initialise_model_properties()`
- `_normalise_to_waveform()`
- `_verify_waveform()`
- `_check_arb_waveform_length()`
- `_check_arb_waveform_type_and_range()`
- `_impedance_dependent_limit()`
- `_spawn_channel()`
- `FuncGen` attributes
- `_id`
- `_inst`
- `address` -> `_visa_address`
- `_arbitrary_waveform_length`
- `_arbitrary_waveform_resolution`
- `_override_compatibility`
- `_timeout`
- `_maker`
- `_serial`
- `_model`
- `FuncGenChannel`
- `_source`
- `state_str` -> `_state_to_str`
- Moving `SI_prefix_to_factor()` out of the class, now a private module function
- Moving to `f""`-strings from `"".format()`

v0.4
- Ensuring compatibility with `pyvisa v11.1`: ([issue #2](https://github.com/asvela/tektronix-func-gen/issues/2))
- PYVISAs `write()` does not return the status code anymore, so the module
is modified accordingly
- not necessary to have an empty query after `write_binary_values()`
in `set_custom_waveform()`
- Added `check_pyvisa_status()`, now checking status for both queries and writes
- Bug fixes for `set_frequency()` and `set_offset()` that were previously
not taking into account the unit when calculating if it was within the limits

v0.3.1
- Added note about known issue with TekVISA
- Added more details about flat waveform offset through custom waveform workaround
- Added note about known issue with TekVISA
- Added more details about flat waveform offset through custom waveform workaround

v0.3.0
- Made SI_prefix_to_factor a staticmethod in FuncGen rather than module-level function
- Added note about constant/flat function
- Made SI_prefix_to_factor a staticmethod in FuncGen rather than module-level function
- Added note about constant/flat function

v0.2
- More PEP8 compliant:
- `func_gen()` -> `FuncGen()`
- `func_gen_channel()` -> `FuncGenChannel()`
- All lines < 100 characters (mostly < 80)
- No more `enable`/`disable_frequency_lock()`, now `set_frequency_lock()`
- Settings dictionary now contains tuples of value and unit, e.g. `settings = {"amplitude": (3, "Vpp"), ..}`
- Implemented `set_settings()` in both `FuncGen` and `FuncGenChannel` that takes a settings dictionary as input
- `get`/`set_output()` links to `get`/`set_output_state()`
- More examples
- Expanded README
- More PEP8 compliant:
- `func_gen()` -> `FuncGen()`
- `func_gen_channel()` -> `FuncGenChannel()`
- All lines < 100 characters (mostly < 80)
- No more `enable`/`disable_frequency_lock()`, now `set_frequency_lock()`
- Settings dictionary now contains tuples of value and unit, e.g.
`settings = {"amplitude": (3, "Vpp"), ..}`
- Implemented `set_settings()` in both `FuncGen` and `FuncGenChannel` that
takes a settings dictionary as input
- `get`/`set_output()` links to `get`/`set_output_state()`
- More examples
- Expanded README

v0.1
- First release
- First release
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2020 Andreas Svela
Copyright 2021 Andreas Svela

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
70 changes: 47 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,40 @@
# Tektronix arbitrary function generator control through PyVISA
## Tektronix arbitrary function generator control

v0.4.0 // Nov 2020
[![CodeFactor Grade](https://img.shields.io/codefactor/grade/github/asvela/tektronix-func-gen?style=flat-square)](https://www.codefactor.io/repository/github/asvela/tektronix-func-gen)
[![MIT License](https://img.shields.io/github/license/asvela/dlc-control?style=flat-square)](https://github.com/asvela/dlc-control/blob/main/LICENSE)

API documentation can be found at [GitHub pages](https://asvela.github.io/tektronix-func-gen/) or in the repository [docs/index.html](docs/index.html). (To build the documentation yourself use [pdoc3](https://pdoc3.github.io/pdoc/) and run `$ pdoc --html tektronix_func_gen`.)
API documentation available [here](https://asvela.github.io/tektronix-func-gen/),
or in the repository [docs/index.html](docs/index.html). (To build the documentation
yourself use [pdoc3](https://pdoc3.github.io/pdoc/) and run
`$ python3 pdoc --html -o ./docs/ tektronix_func_gen`.)

Tested on Win10 with NI-VISA and PyVISA v1.11 (if using PyVISA <v1.11 use <v0.4 of this module).
Tested on Win10 with NI-VISA and PyVISA v1.11 (if using PyVISA <v1.11 use <v0.4
of this module).


## Known issues
### Known issues

- **For TekVISA users:** a `pyvisa.errors.VI_ERROR_IO` is raised unless the Call Monitor application that comes with TekVISA is open and capturing (see issue [#1](https://github.com/asvela/tektronix-func-gen/issues/1)). NI-VISA does not have this issue.
- There is no VISA command to control the built-in DC (flat) function. A workaround is to transfer a flat custom waveform to a memory location, see [Flat function offset control](#flat-function-offset-control) in this readme.
- **For TekVISA users:** a `pyvisa.errors.VI_ERROR_IO` is raised unless the
Call Monitor application that comes with TekVISA is open and capturing
(see issue [#1](https://github.com/asvela/tektronix-func-gen/issues/1)).
NI-VISA does not have this issue.
- The offset of the built-in DC (flat) function cannot be controlled. A
workaround is to transfer a flat custom waveform to a memory location,
see [Flat function offset control](#flat-function-offset-control) in this readme.

## Installation
### Installation

Put the module file in the folder wherein the python file you will import it from resides.
Put the module file in the folder wherein the Python file you will import it
from resides.

**Dependencies:**
- The package needs VISA to be installed. It is tested with NI-VISA, *TekVISA might not work*, see known issues
- The Python packages `numpy` and `pyvisa` (>=v1.11) are required

- The package needs VISA to be installed. It is tested with NI-VISA,
*TekVISA might not work*, see `Known issues`
- The Python packages `numpy` and `pyvisa` (>=v1.11) are required

## Usage (through examples)

### Usage (through examples)

An example of basic control

Expand Down Expand Up @@ -75,9 +88,10 @@ with tfg.FuncGen('VISA ADDRESS OF YOUR INSTRUMENT') as fgen:
```


### Syncronisation and frequency lock
#### Syncronisation and frequency lock

The phase of the two channels can be syncronised with `syncronise_waveforms()`. Frequency lock can also be enabled/disabled with `set_frequency_lock()`:
The phase of the two channels can be syncronised with `syncronise_waveforms()`.
Frequency lock can also be enabled/disabled with `set_frequency_lock()`:

```python
"""Example showing the frequency being set to 10Hz and then the frequency
Expand All @@ -89,9 +103,10 @@ with tfg.FuncGen('VISA ADDRESS OF YOUR INSTRUMENT', verbose=False) as fgen:
```


### Arbitrary waveforms
#### Arbitrary waveforms

14 bit vertical resolution arbitrary waveforms can be transferred to the 256 available user defined functions on the function generator.
14 bit vertical resolution arbitrary waveforms can be transferred to the 256
available user defined functions on the function generator.
The length of the waveform must be between 2 and 8192 points.

```python
Expand All @@ -115,9 +130,12 @@ with tfg.FuncGen('VISA ADDRESS OF YOUR INSTRUMENT') as fgen:
fgen.print_settings()
```

#### Flat function offset control
##### Flat function offset control

The offset of the built-in DC function cannot be controlled (the offset command simply does not work, an issue from Tektronix). A workaround is to transfer a flat custom waveform (two or more points of half the vertical range (`arbitrary_waveform_resolution`)) to a memory location:
The offset of the built-in DC function cannot be controlled (the offset command
simply does not work, an issue from Tektronix). A workaround is to transfer a
flat custom waveform (two or more points of half the vertical range
(`arbitrary_waveform_resolution`)) to a memory location:

```python
with tfg.FuncGen('VISA ADDRESS OF YOUR INSTRUMENT') as fgen:
Expand All @@ -130,9 +148,11 @@ with tfg.FuncGen('VISA ADDRESS OF YOUR INSTRUMENT') as fgen:
Note the `normalise=False` argument.


### Set voltage and frequency limits
#### Set voltage and frequency limits

Limits for amplitude, voltage and frequency for each channel are kept in a dictionary `FuncGenChannel.channel_limits` (these are the standard limits for AFG1022)
Limits for amplitude, voltage and frequency for each channel are kept in a
dictionary `FuncGenChannel.channel_limits` (these are the standard limits
for AFG1022)

```python
channel_limits = {
Expand All @@ -143,7 +163,8 @@ channel_limits = {
"highZ": {"min": 0.002, "max": 20}}, "Vpp")}
```

They chan be changed by `FuncGenChannel.set_limit()`, or by using the `FuncGenChannel.set_stricter_limits()` for a series of prompts.
They chan be changed by `FuncGenChannel.set_limit()`, or by using the
`FuncGenChannel.set_stricter_limits()` for a series of prompts.

```python
import tektronix_func_gen as tfg
Expand All @@ -163,6 +184,9 @@ with tfg.FuncGen('VISA ADDRESS OF YOUR INSTRUMENT') as fgen:
```


### Impedance
#### Impedance

Unfortunately the impedance (50Ω or high Z) cannot be controlled or read remotely. Which setting is in use affects the limits of the output voltage. Use the optional impedance keyword in the initialisation of the func_gen object to make the object aware what limits applies: `FuncGen('VISA ADDRESS OF YOUR INSTRUMENT', impedance=("highZ", "50ohm"))`.
Unfortunately the impedance (50Ω or high Z) cannot be controlled or read remotely.
Which setting is in use affects the limits of the output voltage. Use the optional
impedance keyword in the initialisation of the `FuncGen` object to make the object
aware what limits applies: `FuncGen('VISA ADDRESS OF YOUR INSTRUMENT', impedance=("highZ", "50ohm"))`.
Loading

0 comments on commit 1bb4909

Please sign in to comment.