Data
The main entry point for the data is the Measurement class. These
can be loaded from a .pssession file or directly returned as a result
from an expirement.
These classes are wrappers for the underlying .NET code. Each Python
wrapper in this module holds a reference to the underlying .NET SDK
object in an attribute named ._inner (e.g. Measurement._inner).
These .NET classes are instantiated by the measurement or data loading
code. These wrappers are intended to be used for data processing and
exploration and not to be directly instantiated.
The raw data is stored in a DataSet under Measurement.dataset. A
dataset in turn consist of a series of DataArray's. These would
be analogous to the ’Data' tab in the PSTrace software. A data array
would be the equivalent of a column, with a title, array type, and
units.
The Curve objects (retrieved via Measurement.curves) are
interpretations of the data, much like the plots in the PSTrace
software. These can be used for plots or data processing like smoothing
the data and peak finding.
pypalmsens.data
Define classes for interfacing with measurement data.
Classes:
-
CallbackData–Data returned by the new data callback.
-
CallbackDataEIS–Data returned by the EIS new data callback.
-
CurrentArray–Array of current values in μA.
-
CurrentReading–Current reading data class.
-
Curve–Curve class with X and Y data of a single curve.
-
DataArray–Array of data values.
-
DataSet–Dataset containing multiple data arrays.
-
DeviceInfo–Dataclass for device information.
-
EISData–Dataset containing impedance measurement results.
-
Measurement–Measurement class containing method parameters, curves, and raw data.
-
Peak–Contains the peak data of one peak in a curve.
-
PotentialArray–Array of potential values in V.
-
PotentialReading–Potential reading data class.
-
Status–Device Status class.
CallbackData
dataclass
Data returned by the new data callback.
Methods:
-
last_datapoint–Return last measured data point.
-
new_datapoints–Return new data points since last callback.
Attributes:
-
id(int) –Curve identifier.
-
index(int) –Index of last point.
-
last_x(float) –Return last measured x value.
-
last_y(float) –Return last measured y value.
-
start(int) –Start index for the new data.
-
x_array(DataArray) –Data array for the x variable.
-
y_array(DataArray) –Data array for the y variable.
last_datapoint
Return last measured data point.
Source code in src/pypalmsens/_instruments/callback.py
48 49 50 51 52 53 54 | |
new_datapoints
Return new data points since last callback.
Source code in src/pypalmsens/_instruments/callback.py
66 67 68 69 70 71 72 73 | |
CallbackDataEIS
dataclass
Data returned by the EIS new data callback.
Methods:
-
last_datapoint–Return last measured data point.
-
new_datapoints–Return new data points since last callback.
Attributes:
-
data(DataSet) –EIS dataset.
-
id(int) –EIS Data object id.
-
index(int) –Index of last point.
-
start(int) –Start index for the new data.
last_datapoint
Return last measured data point.
Source code in src/pypalmsens/_instruments/callback.py
101 102 103 104 105 106 107 108 109 | |
new_datapoints
Return new data points since last callback.
Source code in src/pypalmsens/_instruments/callback.py
111 112 113 114 115 116 | |
CurrentArray
Array of current values in μA.
Note that for (m)iDC in EIS measurements the array value
is 'in range' instead of µA for backwards compatibility reasons.
current() and current_in_range() return the correct values.
Parameters:
-
(valuesIterable[float]) –Values to store in the array. Any iterable (list, tuple, generator, etc.) of floats is accepted.
-
(namestr, default:None) –Name of the array. Defaults to the value of
array_typewhen not given. The name is used in__repr__and for identification.
Methods:
-
copy–Return a copy of the array.
-
current–Current in µA.
-
current_in_range–Raw current value expressed in the active current range.
-
current_range–Return current range as list of strings.
-
current_reading–Return as list of potential reading objects.
-
max–Return max value.
-
min–Return min value.
-
normalize–Normalize values in array to the 0 - 1 range.
-
reading_status–Return reading status as list of strings.
-
savitsky_golay–Smooth the array using a Savitsky-Golay filter with the window size.
-
timing_status–Return timing status as list of strings.
-
to_dataframe–Return array as pandas DataFrome.
-
to_dict–Return array as key/value mapping.
-
to_list–Export data array to list.
-
to_numpy–Export data array to numpy.
-
update–Update all values in-place.
Attributes:
-
is_derived(bool) –Return True for derived data arrays.
-
name(str) –Name of the array.
-
ocp_value(float) –OCP Value.
-
quantity(str) –Quantity for array.
-
type(AllowedArrayTypes) –Array type as str.
-
unit(str) –Unit for array.
Source code in src/pypalmsens/_data/data_array.py
372 373 374 375 376 377 378 | |
copy
copy() -> DataArray
Return a copy of the array.
Source code in src/pypalmsens/_data/data_array.py
256 257 258 | |
current
Current in µA.
Source code in src/pypalmsens/_data/data_array.py
380 381 382 383 384 385 | |
current_in_range
Raw current value expressed in the active current range.
current = current_in_range * CR, e.g. 0.2 * 100uA = 2.0 uA
Source code in src/pypalmsens/_data/data_array.py
387 388 389 390 391 392 | |
current_range
current_range() -> list[AllowedCurrentRanges]
Return current range as list of strings.
Source code in src/pypalmsens/_data/data_array.py
398 399 400 | |
current_reading
current_reading() -> list[CurrentReading]
Return as list of potential reading objects.
Source code in src/pypalmsens/_data/data_array.py
394 395 396 | |
max
max() -> float
Return max value.
Source code in src/pypalmsens/_data/data_array.py
264 265 266 | |
min
min() -> float
Return min value.
Source code in src/pypalmsens/_data/data_array.py
260 261 262 | |
normalize
normalize() -> DataArray
Normalize values in array to the 0 - 1 range.
Values are scaled with (value - min) / (max - min),
where min and max are the min and max values.
The unit of the returned array is inherited from the source array.
Returns:
-
new_array(DataArray) –Data array with normalized values.
Source code in src/pypalmsens/_data/data_array.py
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | |
reading_status
reading_status() -> list[AllowedReadingStatus]
Return reading status as list of strings.
Source code in src/pypalmsens/_data/data_array.py
402 403 404 | |
savitsky_golay
savitsky_golay(window_size: int = 3) -> DataArray
Smooth the array using a Savitsky-Golay filter with the window size.
(i.e. window size 2 will filter points based on the values of the next/previous 2 points)
Parameters:
-
(window_sizeint, default:3) –Size of the window
Returns:
-
new_array(DataArray) –Smoothed DataArray
Source code in src/pypalmsens/_data/data_array.py
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | |
timing_status
timing_status() -> list[AllowedTimingStatus]
Return timing status as list of strings.
Source code in src/pypalmsens/_data/data_array.py
406 407 408 | |
to_dataframe
to_dataframe() -> DataFrame
Return array as pandas DataFrome.
Requires pandas to be installed.
Returns:
-
df(DataFrame) –Dataframe with current readings
Source code in src/pypalmsens/_data/data_array.py
433 434 435 436 437 438 439 440 441 442 443 444 445 | |
to_dict
Return array as key/value mapping.
The mapping can be used to create a pandas or polars dataframe.
For example:
array = measurement.dataset['Current']
df = pd.DataFrame(array.to_dict())
Returns:
-
dict[str, list[float | str]–Dictionary with current readings
Source code in src/pypalmsens/_data/data_array.py
410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 | |
to_list
Export data array to list.
Source code in src/pypalmsens/_data/data_array.py
320 321 322 | |
to_numpy
to_numpy() -> ndarray
Export data array to numpy.
Source code in src/pypalmsens/_data/data_array.py
316 317 318 | |
update
Update all values in-place.
Parameters:
Raises:
-
ValueError:–If
datalength differs from current length.
Source code in src/pypalmsens/_data/data_array.py
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 | |
CurrentReading
dataclass
CurrentReading(current_range: AllowedCurrentRanges, current: float, current_in_range: float, timing_status: AllowedTimingStatus, reading_status: AllowedReadingStatus)
Current reading data class.
Attributes:
-
current(float) –Current in μA.
-
current_in_range(float) –Raw current value expressed in the active current range.
-
current_range(AllowedCurrentRanges) –Active current range (CR) for this data point.
-
reading_status(AllowedReadingStatus) –Status of the current reading.
-
timing_status(AllowedTimingStatus) –Status of the current timing.
current_in_range
instance-attribute
current_in_range: float
Raw current value expressed in the active current range.
current = current_in_range * CR, e.g. 0.2 * 100uA = 2.0 uA
current_range
instance-attribute
current_range: AllowedCurrentRanges
Active current range (CR) for this data point.
reading_status
instance-attribute
reading_status: AllowedReadingStatus
Status of the current reading.
Curve
Curve class with X and Y data of a single curve.
Parameters:
-
(xDataArray) –Data values for the x axis
-
(yDataArray) –Data values for the y axis
-
(titlestr, default:'Curve') –Title for the curve
Notes
Supports arithmetic between curves. curve_a + curve_b and
curve_a - curve_b return new curves.
Methods:
-
clear_peaks–Clear peaks stored on object.
-
concat–Concatenate the x and y arrays of this curve with another curve.
-
copy–Return a copy of this curve.
-
find_peaks–Find peaks in a curve in all directions.
-
find_peaks_semiderivative–Find peaks in a curve using the semi-derivative algorithm.
-
linear_slope–Calculate linear line parameters for this curve between two indexes.
-
metadata–Generate curve metadata as dataclass.
-
metadata_json–Generate curve metadata as json.
-
plot–Generate simple plot for this curve using matplotlib.
-
remove_baseline–Perform the moving average baseline correction on a curve.
-
savitsky_golay–Smooth the .y_array using a Savitsky-Golay filter with the specified window
-
smooth–Smooth the .y_array using a Savitsky-Golay filter with the specified smooth
Attributes:
-
id(int) –Unique identifier for curve object.
-
max_x(float) –Maximum X value found in this curve.
-
max_y(float) –Maximum Y value found in this curve.
-
min_x(float) –Minimum X value found in this curve.
-
min_y(float) –Minimum Y value found in this curve.
-
mux_channel(int) –The corresponding MUX channel number with the curve starting at 0.
-
n_points(int) –Number of points for this curve.
-
ocp_value(float) –OCP value for curve.
-
peaks(list[Peak]) –Return peaks stored on object.
-
title(str) –Title for the curve.
-
x_array(DataArray) –Y data for the curve.
-
x_label(str) –Label for X dimension.
-
x_unit(str) –Units for X dimension.
-
y_array(DataArray) –Y data for the curve.
-
y_label(str) –Label for Y dimension.
-
y_unit(str) –Units for Y dimension.
-
z_label(None | str) –Units for Z dimension. Returns None if not set.
-
z_unit(None | str) –Units for Z dimension. Returns None if not set.
Source code in src/pypalmsens/_data/curve.py
57 58 | |
mux_channel
property
mux_channel: int
The corresponding MUX channel number with the curve starting at 0. Return -1 when no MUX channel used.
clear_peaks
clear_peaks()
Clear peaks stored on object.
Source code in src/pypalmsens/_data/curve.py
387 388 389 | |
concat
Concatenate the x and y arrays of this curve with another curve.
Parameters:
-
(otherCurve) –Curve whose points are appended after this curve's points.
Returns:
-
Curve–New curve with the concatenated x and y arrays.
Source code in src/pypalmsens/_data/curve.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | |
copy
copy() -> Curve
Return a copy of this curve.
Source code in src/pypalmsens/_data/curve.py
116 117 118 | |
find_peaks
find_peaks(min_peak_width: float = 0.1, min_peak_height: float = 0.0, peak_shoulders: bool = False, merge_overlapping_peaks: bool = True) -> list[Peak]
Find peaks in a curve in all directions.
CV can have 1 or 2 direction changes.
Parameters:
-
(min_peak_widthfloat, default:0.1) –Minimum width of the peak in V
-
(min_peak_heightfloat, default:0.0) –Minimum height of the peak in uA
-
(peak_shouldersbool, default:False) –Use alternative peak search algorithm optimized for finding peaks on slopes
-
(merge_overlapping_peaksbool, default:True) –Two or more peaks that overlap will be identified as a single base peak and as shoulder peaks on the base peak.
Returns:
Source code in src/pypalmsens/_data/curve.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | |
find_peaks_semiderivative
find_peaks_semiderivative(min_peak_height: float = 0.0) -> list[Peak]
Find peaks in a curve using the semi-derivative algorithm.
Used for detecting non-overlapping peaks in LSV and CV curves.
The peaks are also assigned to the curve, updating Curve.peaks.
Existing peaks are overwritten.
For more info, see this Wikipedia page.
Parameters:
-
(min_peak_heightfloat, default:0.0) –Minimum height of the peak in uA
Returns:
Source code in src/pypalmsens/_data/curve.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | |
linear_slope
Calculate linear line parameters for this curve between two indexes.
current = a + b * x
Parameters:
Returns:
Source code in src/pypalmsens/_data/curve.py
401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 | |
metadata
metadata() -> CurveMetadata
Generate curve metadata as dataclass.
Source code in src/pypalmsens/_data/curve.py
364 365 366 367 368 369 370 371 372 | |
metadata_json
metadata_json() -> bytes
Generate curve metadata as json.
Source code in src/pypalmsens/_data/curve.py
374 375 376 | |
plot
Generate simple plot for this curve using matplotlib.
Parameters:
-
(axOptional[Axes], default:None) –Add plot to this ax if specified.
-
(legendbool, default:True) –If True, add legend.
-
–plot_kwargsThese keyword arguments are passed to
ax.plot.
Returns:
-
fig(Figure) –Matplotlib figure. Use
fig.show()to render plot.
Source code in src/pypalmsens/_data/curve.py
427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 | |
remove_baseline
remove_baseline(max_sweeps: int = 1001, window_size: int = 2, mode: Literal['moving-average'] = 'moving-average') -> tuple[Curve, Curve]
Perform the moving average baseline correction on a curve.
This method calculates and applies a baseline correction using a specified moving average window size and a maximum number of sweeps allowed.
Parameters:
-
(max_sweepsint, default:1001) –The maximum number of sweeps allowed during the baseline correction process. Defaults to 1001.
-
(window_sizeint, default:2) –The size of the moving average window used for calculating the baseline. Defaults to 2.
-
(modestr, default:'moving-average') –The method used for baseline correction (e.g., 'moving-average'). Defaults to 'moving-average'.
Returns:
-
BaselineResult–A named tuple containing:
corrected: The baseline-corrected curve.baseline: The calculated baseline curve that was subtracted.
Examples:
Unpacking as a tuple:
>>> corrected, baseline = curve.remove_baseline(max_sweeps=500, window_size=2)
Attribute access:
>>> result = curve.remove_baseline(max_sweeps=500, window_size=2)
>>> result.corrected, result.baseline
Source code in src/pypalmsens/_data/curve.py
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | |
savitsky_golay
savitsky_golay(window_size: int = 3)
Smooth the .y_array using a Savitsky-Golay filter with the specified window size.
(i.e. window size 2 will filter points based on the values of the next/previous 2 points)
Parameters:
-
(window_sizeint, default:3) –Size of the window
Source code in src/pypalmsens/_data/curve.py
134 135 136 137 138 139 140 141 142 143 144 145 | |
smooth
smooth(smooth_level: int = 0)
Smooth the .y_array using a Savitsky-Golay filter with the specified smooth level.
Parameters:
-
(smooth_levelint, default:0) –The smooth level to be used. -1 = none, 0 = no smooth (spike rejection only), 1 = 5 points, 2 = 9 points, 3 = 15 points, 4 = 25 points
Source code in src/pypalmsens/_data/curve.py
120 121 122 123 124 125 126 127 128 129 130 131 132 | |
DataArray
DataArray(values: Iterable[float], *, array_type: AllowedArrayTypes = 'Generic', name: str | None = None)
Array of data values.
A data array can be created from an iterable of values, or wrapped from an
existing PSDataArray (see _wrap).
Parameters:
-
(valuesIterable[float]) –Values to store in the array. Any iterable (list, tuple, generator, etc.) of floats is accepted.
-
(array_typeAllowedArrayTypes, default:'Generic') –Type of the array. Defaults to
'Generic'. Use e.g.'Current'or'Potential'when constructing arrays that represent measured quantities. -
(namestr, default:None) –Name of the array. Defaults to the value of
array_typewhen not given. The name is used in__repr__and for identification.
Notes
Supports arithmetic between arrays of the same type.
array_a + array_b, array_a - array_b and
array_a * factor return new arrays.
Methods:
-
copy–Return a copy of the array.
-
max–Return max value.
-
min–Return min value.
-
normalize–Normalize values in array to the 0 - 1 range.
-
savitsky_golay–Smooth the array using a Savitsky-Golay filter with the window size.
-
to_list–Export data array to list.
-
to_numpy–Export data array to numpy.
-
update–Update all values in-place.
Attributes:
-
is_derived(bool) –Return True for derived data arrays.
-
name(str) –Name of the array.
-
ocp_value(float) –OCP Value.
-
quantity(str) –Quantity for array.
-
type(AllowedArrayTypes) –Array type as str.
-
unit(str) –Unit for array.
Source code in src/pypalmsens/_data/data_array.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
copy
copy() -> DataArray
Return a copy of the array.
Source code in src/pypalmsens/_data/data_array.py
256 257 258 | |
max
max() -> float
Return max value.
Source code in src/pypalmsens/_data/data_array.py
264 265 266 | |
min
min() -> float
Return min value.
Source code in src/pypalmsens/_data/data_array.py
260 261 262 | |
normalize
normalize() -> DataArray
Normalize values in array to the 0 - 1 range.
Values are scaled with (value - min) / (max - min),
where min and max are the min and max values.
The unit of the returned array is inherited from the source array.
Returns:
-
new_array(DataArray) –Data array with normalized values.
Source code in src/pypalmsens/_data/data_array.py
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | |
savitsky_golay
savitsky_golay(window_size: int = 3) -> DataArray
Smooth the array using a Savitsky-Golay filter with the window size.
(i.e. window size 2 will filter points based on the values of the next/previous 2 points)
Parameters:
-
(window_sizeint, default:3) –Size of the window
Returns:
-
new_array(DataArray) –Smoothed DataArray
Source code in src/pypalmsens/_data/data_array.py
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | |
to_list
Export data array to list.
Source code in src/pypalmsens/_data/data_array.py
320 321 322 | |
to_numpy
to_numpy() -> ndarray
Export data array to numpy.
Source code in src/pypalmsens/_data/data_array.py
316 317 318 | |
update
Update all values in-place.
Parameters:
Raises:
-
ValueError:–If
datalength differs from current length.
Source code in src/pypalmsens/_data/data_array.py
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 | |
DataSet
Dataset containing multiple data arrays.
All values are related by means of their indices. DataArrays in a DataSet should always have an equal amount of entries.
Parameters:
Methods:
-
arrays–Return list of all arrays.
-
curve–Construct a custom curve from x and y keys.
-
to_dataframe–Return dataset as pandas DataFrame.
-
to_dict–Return dataset as key/value mapping.
Attributes:
-
array_names(set[str]) –Return unique set of names for arrays in dataset.
-
array_quantities(set[str]) –Return unique set of quantities for arrays in dataset.
-
array_types(set[AllowedArrayTypes]) –Return unique set of array types for arrays in dataset.
-
n_points(int) –Number of points in arrays.
Source code in src/pypalmsens/_data/dataset.py
60 61 62 63 64 65 66 | |
array_quantities
property
Return unique set of quantities for arrays in dataset.
array_types
property
array_types: set[AllowedArrayTypes]
Return unique set of array types for arrays in dataset.
arrays
arrays(type: AllowedArrayTypes | None = None, name: str | None = None, quantity: str | None = None, hidden: bool = False) -> Sequence[DataArray]
Return list of all arrays.
By default, return all arrays. Only one filter can be active at the time.
Parameters:
-
(typestr, default:None) –Get arrays by type of the array, e.g. 'Current', 'Frequency', 'AuxInput'. Use
.array_types()to get a list of possible values. -
(namestr, default:None) –Get arrays with given name, e.g. 'scan1', 'time'. Use
.array_names()to get a list of possible values. -
(quantitystr, default:None) –Get arrays by quantity, e.g. 'Charge', '-Phase'. Use
.array_quantities()to get a list of possible values. -
(hiddenbool, default:False) –Return hidden arrays used for debugging.
Returns:
Source code in src/pypalmsens/_data/dataset.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | |
curve
Construct a custom curve from x and y keys.
Parameters:
-
(xstr) –Key identifying the x array
-
(ystr) –Key identifying the y array
-
(titlestr, default:None) –Set the title. If None, use the $x-$y as title
Returns:
-
curve(Curve) –New Curve with plotting x against y
Source code in src/pypalmsens/_data/dataset.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | |
to_dataframe
to_dataframe() -> DataFrame
Return dataset as pandas DataFrame. Requires pandas to be installed.
Returns:
-
df(DataFrame) –Dataframe with all arrays in dataset.
Source code in src/pypalmsens/_data/dataset.py
212 213 214 215 216 217 218 219 220 221 222 223 224 | |
to_dict
Return dataset as key/value mapping.
The mapping can be used to create a pandas or polars dataframe.
For example:
df = pd.DataFrame(dataset.to_dict())
Returns:
Source code in src/pypalmsens/_data/dataset.py
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | |
DeviceInfo
dataclass
Dataclass for device information.
Attributes:
EISData
EISData()
Dataset containing impedance measurement results.
EISData cannot be instantiated directly. Obtain instances through measurements or io methods.
Methods:
-
arrays–Complete list of data arrays.
-
current_range–Current ranges for the measurement.
-
get_data_for_frequency–Returns dictionary with data per frequency.
-
metadata–Return eis data metadata as dataclass
-
metadata_json–Generate eis data metadata as json.
Attributes:
-
cdc(str) –Gets the CDC circuit for fitting.
-
cdc_values(list[float]) –Return values for circuit description code (CDC).
-
dataset(DataSet) –Dataset which contains multiple arrays of values.
-
frequency_type(AllowedFrequencyTypes) –Frequency type.
-
has_subscans(bool) –Return True if data contains subscans.
-
id(int) –Unique identifier for curve object.
-
mux_channel(int) –Mux channel.
-
n_frequencies(int) –Number of frequencies.
-
n_points(int) –Number of points (including subscans).
-
n_subscans(int) –Number of subscans.
-
ocp_value(float) –OCP Value.
-
scan_type(AllowedScanTypes) –Scan type.
-
subscans(list[EISData]) –Get list of subscans.
-
title(str) –Tite for EIS data.
-
x_quantity(str) –Quantity for array.
-
x_unit(str) –Unit for array.
Source code in src/pypalmsens/_data/eisdata.py
51 52 53 54 55 | |
arrays
Complete list of data arrays.
Source code in src/pypalmsens/_data/eisdata.py
164 165 166 | |
current_range
current_range() -> list[AllowedCurrentRanges]
Current ranges for the measurement.
Source code in src/pypalmsens/_data/eisdata.py
168 169 170 171 172 | |
get_data_for_frequency
Returns dictionary with data per frequency.
Parameters:
-
(frequencyint) –Index of the frequency to retrieve the data for.
Returns:
Source code in src/pypalmsens/_data/eisdata.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | |
metadata
metadata() -> EISDataMetadata
Return eis data metadata as dataclass
Source code in src/pypalmsens/_data/eisdata.py
189 190 191 192 193 194 195 196 197 198 199 200 201 | |
metadata_json
metadata_json() -> bytes
Generate eis data metadata as json.
Source code in src/pypalmsens/_data/eisdata.py
203 204 205 206 | |
Measurement
Measurement(method: MethodTypeCompatible | None = None, dataset: DataSet | None = None)
Measurement class containing method parameters, curves, and raw data.
Instantiation via the constructor is limited. Obtain instances through measurements or io methods.
Parameters:
-
(methodMethodTypeCompatible, default:None) –The electrochemical method associated with this measurement. Defaults to None.
-
(datasetDataSet, default:None) –The DataSet containing the raw data associated with this measurement. Defaults to None.
Methods:
-
metadata–Return measurement metadata as dataclass
-
metadata_json–Generate measurement metadata as json.
Attributes:
-
blank_curve(Curve | None) –Blank curve.
-
channel(float) –Get the channel that the measurement was measured on.
-
curves(list[Curve]) –Get all curves in measurement.
-
dataset(DataSet) –Dataset containing multiple arrays of values.
-
device(DeviceInfo) –Return dataclass with measurement device information.
-
eis_data(list[EISData]) –EIS data in measurement.
-
eis_fit(list[FitResult]) –Get all EIS fits from measurement
-
has_blank_subtracted_curves(bool) –Return True if the curve collection contains a blank subtracted curve.
-
has_eis_data(bool) –Return True if EIS data are is available.
-
method(MethodTypeCompatible) –Method related with this Measurement.
-
n_curves(int) –Number of curves that are part of the Measurement class.
-
n_eis_data(int) –Number of EISdata curves (channels) that are part of the Measurement class.
-
ocp_value(float) –First OCP Value from either curves or EISData.
-
peaks(list[Peak]) –Get peaks from all curves.
-
timestamp(datetime) –Date and time of the start of this measurement.
-
title(str) –Title for the measurement.
Source code in src/pypalmsens/_data/measurement.py
84 85 86 87 88 89 90 91 92 93 94 | |
blank_curve
property
blank_curve: Curve | None
Blank curve.
If the 'Use Blank' curve function was used in PSTrace, a new curve will be added after each measurement containing the result of the measured curve subtracted with the blank curve.
curves
property
dataset
property
dataset: DataSet
Dataset containing multiple arrays of values.
All values are related by means of their indices. Data arrays in a dataset should always have an equal amount of entries.
eis_fit
property
Get all EIS fits from measurement
Returns:
-
eis_fits(list[EISFitResults]) –Return list of EIS fits
has_blank_subtracted_curves
property
has_blank_subtracted_curves: bool
Return True if the curve collection contains a blank subtracted curve.
method
property
method: MethodTypeCompatible
Method related with this Measurement.
The information from the Method is used when saving Curves.
n_eis_data
property
n_eis_data: int
Number of EISdata curves (channels) that are part of the Measurement class.
peaks
property
timestamp
property
timestamp: datetime
Date and time of the start of this measurement.
Returns a timezone-naive datetime in local time, matching the format
used by the SDK (e.g. 2017-07-12 14:28:58).
metadata
metadata() -> MeasurementMetadata
Return measurement metadata as dataclass
Source code in src/pypalmsens/_data/measurement.py
128 129 130 131 132 133 134 135 | |
metadata_json
metadata_json() -> bytes
Generate measurement metadata as json.
Source code in src/pypalmsens/_data/measurement.py
137 138 139 | |
Peak
Peak()
Contains the peak data of one peak in a curve.
Attributes:
-
analyte_name(str) –Name of analyte.
-
area(float) –Area of the peak.
-
curve(Curve) –Parent curve associated with Peak.
-
index(int) –Location of the peak as index number of the curve.
-
label(str) –Formatted label for the peak value.
-
left_index(int) –Left side of the peaks baseline as index number of the curve.
-
left_x(float) –X of the left side of the peak baseline.
-
left_y(float) –Y of the left side of the peak baseline.
-
maximum_of_derivative_neg(float) –Maximum derivative of the negative slope of the peak.
-
maximum_of_derivative_pos(float) –Maximum derivative of the positive slope of the peak.
-
maximum_of_derivative_sum(float) –Sum of the absolute values for both the positive and negative maximum derivative.
-
notes(str) –User notes stored on this peak.
-
right_index(int) –Left side of the peaks baseline as index number of the curve.
-
right_x(float) –X of the right side of the peak baseline.
-
right_y(float) –Returns the Y of the right side of the peak baseline.
-
type(str) –Used to determine if a peak is auto found.
-
value(float) –Value of the peak in units of the curve.
-
width(float) –Full width at half-height of the peak.
-
x(float) –X value of the peak.
-
y(float) –Y value of the peak.
-
y_offset(float) –Offset of Y.
Source code in src/pypalmsens/_data/peak.py
22 23 24 25 | |
maximum_of_derivative_neg
property
maximum_of_derivative_neg: float
Maximum derivative of the negative slope of the peak.
maximum_of_derivative_pos
property
maximum_of_derivative_pos: float
Maximum derivative of the positive slope of the peak.
maximum_of_derivative_sum
property
maximum_of_derivative_sum: float
Sum of the absolute values for both the positive and negative maximum derivative.
value
property
value: float
Value of the peak in units of the curve. This is the value of the peak height relative to the baseline of the peak.
PotentialArray
Array of potential values in V.
Parameters:
-
(valuesIterable[float]) –Values to store in the array. Any iterable (list, tuple, generator, etc.) of floats is accepted.
-
(namestr, default:None) –Name of the array. Defaults to the value of
array_typewhen not given. The name is used in__repr__and for identification.
Methods:
-
copy–Return a copy of the array.
-
max–Return max value.
-
min–Return min value.
-
normalize–Normalize values in array to the 0 - 1 range.
-
potential–Return list of potential values in V.
-
potential_in_range–Return list of raw potential values expressed in the active potential range.
-
potential_range–Return potential range as list of strings.
-
potential_reading–Return as list of potential reading objects.
-
reading_status–Return reading status as list of strings.
-
savitsky_golay–Smooth the array using a Savitsky-Golay filter with the window size.
-
timing_status–Return timing status as list of strings.
-
to_dataframe–Return array as pandas DataFrome.
-
to_dict–Return array as key/value mapping.
-
to_list–Export data array to list.
-
to_numpy–Export data array to numpy.
-
update–Update all values in-place.
Attributes:
-
is_derived(bool) –Return True for derived data arrays.
-
name(str) –Name of the array.
-
ocp_value(float) –OCP Value.
-
quantity(str) –Quantity for array.
-
type(AllowedArrayTypes) –Array type as str.
-
unit(str) –Unit for array.
Source code in src/pypalmsens/_data/data_array.py
466 467 468 469 470 471 472 | |
copy
copy() -> DataArray
Return a copy of the array.
Source code in src/pypalmsens/_data/data_array.py
256 257 258 | |
max
max() -> float
Return max value.
Source code in src/pypalmsens/_data/data_array.py
264 265 266 | |
min
min() -> float
Return min value.
Source code in src/pypalmsens/_data/data_array.py
260 261 262 | |
normalize
normalize() -> DataArray
Normalize values in array to the 0 - 1 range.
Values are scaled with (value - min) / (max - min),
where min and max are the min and max values.
The unit of the returned array is inherited from the source array.
Returns:
-
new_array(DataArray) –Data array with normalized values.
Source code in src/pypalmsens/_data/data_array.py
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | |
potential
Return list of potential values in V.
Source code in src/pypalmsens/_data/data_array.py
474 475 476 | |
potential_in_range
Return list of raw potential values expressed in the active potential range.
potential = potential_in_range * PR, e.g. 2.0 * 100mV = 0.2V
Source code in src/pypalmsens/_data/data_array.py
478 479 480 481 482 483 | |
potential_range
potential_range() -> list[AllowedPotentialRanges]
Return potential range as list of strings.
Source code in src/pypalmsens/_data/data_array.py
489 490 491 | |
potential_reading
potential_reading() -> list[PotentialReading]
Return as list of potential reading objects.
Source code in src/pypalmsens/_data/data_array.py
485 486 487 | |
reading_status
reading_status() -> list[AllowedReadingStatus]
Return reading status as list of strings.
Source code in src/pypalmsens/_data/data_array.py
493 494 495 | |
savitsky_golay
savitsky_golay(window_size: int = 3) -> DataArray
Smooth the array using a Savitsky-Golay filter with the window size.
(i.e. window size 2 will filter points based on the values of the next/previous 2 points)
Parameters:
-
(window_sizeint, default:3) –Size of the window
Returns:
-
new_array(DataArray) –Smoothed DataArray
Source code in src/pypalmsens/_data/data_array.py
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | |
timing_status
timing_status() -> list[AllowedTimingStatus]
Return timing status as list of strings.
Source code in src/pypalmsens/_data/data_array.py
497 498 499 | |
to_dataframe
to_dataframe() -> DataFrame
Return array as pandas DataFrome.
Requires pandas to be installed.
Returns:
-
df(DataFrame) –Dataframe with potential readings
Source code in src/pypalmsens/_data/data_array.py
524 525 526 527 528 529 530 531 532 533 534 535 536 | |
to_dict
Return array as key/value mapping.
The mapping can be used to create a pandas or polars dataframe.
For example:
array = measurement.dataset['Potential']
df = pd.DataFrame(array.to_dict())
Returns:
-
dict[str, list[float | str]–Dictionary with potential readings
Source code in src/pypalmsens/_data/data_array.py
501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 | |
to_list
Export data array to list.
Source code in src/pypalmsens/_data/data_array.py
320 321 322 | |
to_numpy
to_numpy() -> ndarray
Export data array to numpy.
Source code in src/pypalmsens/_data/data_array.py
316 317 318 | |
update
Update all values in-place.
Parameters:
Raises:
-
ValueError:–If
datalength differs from current length.
Source code in src/pypalmsens/_data/data_array.py
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 | |
PotentialReading
dataclass
PotentialReading(potential_range: AllowedPotentialRanges, potential: float, potential_in_range: float, timing_status: AllowedTimingStatus, reading_status: AllowedReadingStatus)
Potential reading data class.
Attributes:
-
potential(float) –Potential in V.
-
potential_in_range(float) –Raw potential value expressed in the active potential range.
-
potential_range(AllowedPotentialRanges) –Active potential range (PR) for this data point.
-
reading_status(AllowedReadingStatus) –Status of the potential reading.
-
timing_status(AllowedTimingStatus) –Status of the potential timing.
potential_in_range
instance-attribute
potential_in_range: float
Raw potential value expressed in the active potential range.
potential = potential_in_range * PR, e.g. 2.0 * 100mV = 0.2V
potential_range
instance-attribute
potential_range: AllowedPotentialRanges
Active potential range (PR) for this data point.
reading_status
instance-attribute
reading_status: AllowedReadingStatus
Status of the potential reading.
Status
dataclass
Status(_status: Status, device_state: AllowedDeviceState = 'Unknown')
Device Status class.
Attributes:
-
aux_input(float) –Raw aux input.
-
aux_input_as_voltage(float) –Aux input as V.
-
corrected_bipot_current(float) –Corrected bipot current in the current range.
-
current(float) –Current value in µA.
-
current_reading(CurrentReading) –Current reading dataclass.
-
current_reading_we2(CurrentReading) –Current reading dataclass for WE2.
-
current_we2(float) –Current WE2 value.
-
device_state(AllowedDeviceState) –Device state.
-
noise(float) –Measured
-
potential(float) –Potential in V
-
potential_reading(PotentialReading) –Potential reading dataclass.
-
pretreatment_phase(Literal['None', 'Conditioning', 'Depositing', 'Equilibrating']) –Pretreatment phase.
corrected_bipot_current
property
corrected_bipot_current: float
Corrected bipot current in the current range.
device_state
class-attribute
instance-attribute
device_state: AllowedDeviceState = 'Unknown'
Device state.
pretreatment_phase
property
pretreatment_phase: Literal['None', 'Conditioning', 'Depositing', 'Equilibrating']
Pretreatment phase.