Skip to content

PyPalmSens 2.2.0

Latest

Choose a tag to compare

@stefsmeets stefsmeets released this 09 Oct 12:22
· 5 commits to main since this release
8570577

PyPalmSens 2.2.0 is now available on PyPi.

To upgrade: pip install pypalmsens -U.

For more information, see the documentation

This release adds more methods for array and curve manipulation.

DataArray manipulation

The DataArray wrapper now supports in-place mutation via Python slice assignment, so you can overwrite values without creating a new array. Assign a sequence to a slice to replace that range. You can also assign a scalar to broadcast it across the slice.

Alternatively, use DataArray.update to replace all values at once. Both methods raise ValueError if the supplied data length does not match the DataArray.

>>> import pypalmsens as ps
>>> arr = ps.data.DataArray([0, 0, 0, 0])

# Replace the whole array in-place
>>> arr[:] = [1, 2, 3, 4]
>>> arr
[1.0, 2.0, 3.0, 4.0]

# Broadcast a scalar into a sub-range
>>> arr[1:3] = 99
>>> arr
[1.0, 99.0, 99.0, 4.0]

# Replace all values
>>> arr.update([5, 6, 7, 8])
>>> arr 
[5.0, 6.0, 7.0, 8.0]

Note if you got the data from a DataSet or Curve, the changes will propegate to the parent class as well.

DataArray arithmetic operations

  • curve_a + curve_b and curve_a - curve_b now return new Curve objects
  • array_a + array_b and array_a - array_b now return new DataArray objects.
  • array * value now multiplies by that scalar value and returns new DataArray objects.

New methods

  • DataArray.normalize: return a new DataArray with values scaled to the 0–1 range.
  • Curve.concat: append another curve's x/y DataArray values onto this curve and returns a new Curve.

Exceptions submodule

PyPalmSens specific exceptions can now be accessed via pypalmsens.exceptions submodule.

What's changed

  • Add curve/array arithmetic operators (+, -, *) (#483)
  • Add DataArray.normalize and Curve.concat methods (#484)
  • Add constructors for DataArray, Curve, DataSet and Measurement objects (#485, #486, #489, #490)
  • Add array value replace function (#488)
  • Expose exceptions to public api (#491)
  • Wrap C# Tasks to asyncio futures (#494, #495)
  • Add note for fedora users for ftdi (#498)
  • Fix trigger flags always enabled on export (#500, #501)
  • Fix peak repr (#502)
  • Add examples to method and settings docstrings (#504, #506)

Full Changelog: python-2.1.0...python-2.2.0