pslab-python 2.0.0 Release Notes
pslab-python 2.0 is now available!
Large parts of pslab-python have been rewritten to improve user friendliness. pslab-python version 1.0 was written primarily as a back end for pslab-desktop. While it could be used as a standalone library, it was not designed with that use case foremost in mind.
pslab-python 2.0 still serves as the back end for pslab-desktop, but it has been rewritten to be more user-friendly when being used as a standalone library.
Also worth mentioning is pslab-python's new test suite. Although tests are not immediately useful for users, they help developers avoid accidentally introducing regressions, which in turn makes pslab-python more pleasant to use.
The rewrite touches almost every part of pslab-python and is too extensive to go into detail, so here are the most important user-facing improvements:
Highlights
General
- Package renamed from `PSL` to `pslab`.
- Simplified API.
- Improved documentation now available on [readthedocs](https://pslab-python.readthedocs.io/en/latest/index.html).
- pslab-python now has a command line interface. Type `pslab --help` in a terminal for more information.
- pslab-python can now be installed from PyPI: `pip install pslab`
- Reworked exception handling. Exceptions are now raised as soon as possible instead of being suppressed and allowed to propagate.
- Many, many bug fixes.
Oscilloscope
- Oscilloscope-related functionality can now be found in the `Oscilloscope` class.
- The many different capture methods (`capture1`, `capture2`, `capture4`, `capture_multiple`, `capture_fullspeed`, `capture_fullspeed_hr`, `capture_traces`, `capture_highres_traces`) have been combined into a single `capture` method.
- Trigger settings can optionally be configured directly in the `capture` call, without the need to call `configure_trigger` separately.
Logic Analyzer
- Logic analyzer-related functionality can now be found in the `LogicAnalyzer` class.
- The many different capture methods (`capture_edges1`, `start_one_channel_LA`, `start_two_channel_LA`, `start_three_channel_LA`, `start_four_channel_LA`, `start_one_channel_LA_backup__`) have been combined into a single `capture` method.
- The type of logic event to capture is now given as a string instead of a number (e.g. "falling" instead of 2 to capture only falling edges).
Multimeter
- Multimeter-related functionality can now be found in the `Multimeter` class.
- Several different methods for measuring capacitance (`capacitance_via_RC_dischan
rge`, `get_capacitor_range`, `get_capacitance`) have been combined into `measure_capacitance`.
- `calibrate_capacitance` method added, which allows for measurement of very small (single picofarad) capacitors.
Waveform Generator
- Analog waveform-related functionality can now be found in the `WaveformGenerator` class.
- The many different methods for generating waveforms (`set_wave`, `set_sine1`, `set_sine2`, `set_w1`, `set_w2`, `set_waves`) have been combined into a single `generate` method.
- Waveform amplitude is now set directly as part of a loaded function. For example `load_function("SI1", lambda x: np.sin(x), [0, 2*np.pi])` will have an amplitide of 1 V, while `load_function("SI1", lambda x: 2*np.sin(x), [0, 2*np.pi])` will have an amplitude of 2 V.
PWM Generator
- PWM-related functionality can now be found in the `PWMGenerator` class.
- Several different methods for generator PWM signals (`sqr1`, `sqr1_pattern`, `sqr2`, `set_sqrs`, `sqrPWM`) have been combined into a single `generate` method.
Power Supply
- Power supply-related functionality can now be found in the PowerSupply class.
- Voltage and current are now set via properties, e.g. to set the voltage on pin PV1 to 3 V, write `power_supply.pv1 = 3`.
- The load resistance limitation on PCS is now clearly documented.
I2C
- The `I2C` class has been split into the `I2CMaster` and `I2CSlave` classes.
- Primitive I2C calls (start, stop, wait, restart, etc.) are no longer available. Instead, use `read` and `write` which take care of I2C session handling under the hood.
Known issues
- Not every part of pslab-python has been rewritten. Specifically, the `external` subpackage (previously known as `SENSORS`) contains many sensor classes which remain untested.