Repository navigation
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_bandcurve_a - curve_bnow return newCurveobjectsarray_a + array_bandarray_a - array_bnow return newDataArrayobjects.array * valuenow multiplies by that scalar value and returns newDataArrayobjects.
New methods
DataArray.normalize: return a newDataArraywith values scaled to the0–1range.Curve.concat: append another curve's x/yDataArrayvalues onto this curve and returns a newCurve.
Exceptions submodule
PyPalmSens specific exceptions can now be accessed via pypalmsens.exceptions submodule.
What's changed
- Add curve/array arithmetic operators (
+,-,*) (#483) - Add
DataArray.normalizeandCurve.concatmethods (#484) - Add constructors for
DataArray,Curve,DataSetandMeasurementobjects (#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