continuous_timeseries.discrete_to_continuous#
Conversion of timeseries from discrete to continuous
This supports the TimeseriesDiscrete and TimeseriesContinuous APIs,
but is in more general where possible.
Modules:
| Name | Description |
|---|---|
higher_order |
Conversion of discrete to continuous data assuming higher-order interpolation |
interpolation_option |
Definition of a our interpolation options (represented by |
linear |
Conversion of discrete to continuous data assuming linear interpolation |
piecewise_constant_common |
Common functions used across our piecewise constant implementations |
piecewise_constant_next_left_closed |
Conversion of discrete to continuous data using 'next' piecewise constant steps |
piecewise_constant_next_left_open |
Conversion of discrete to continuous using 'next' piecewise constant steps |
piecewise_constant_previous_left_closed |
Conversion of discrete to continuous using 'previous' piecewise constant steps |
piecewise_constant_previous_left_open |
Conversion of discrete to continuous using 'previous' piecewise constant steps |
Classes:
| Name | Description |
|---|---|
InterpolationOption |
Interpolation options |
Functions:
| Name | Description |
|---|---|
discrete_to_continuous |
Convert a discrete timeseries to continuous |
InterpolationOption #
Bases: IntEnum
Interpolation options
Attributes:
| Name | Type | Description |
|---|---|---|
Cubic |
Cubic interpolation |
|
Linear |
Linear interpolation |
|
PiecewiseConstantNextLeftClosed |
Piecewise constant 'next' interpolation, each interval is closed on the left |
|
PiecewiseConstantNextLeftOpen |
Piecewise constant 'next' interpolation, each interval is open on the left |
|
PiecewiseConstantPreviousLeftClosed |
Piecewise constant 'previous' interpolation, each interval is closed on the left |
|
PiecewiseConstantPreviousLeftOpen |
Piecewise constant 'previous' interpolation, each interval is open on the left |
|
Quadratic |
Quadratic interpolation |
|
Quartic |
Quartic interpolation |
Source code in src/continuous_timeseries/discrete_to_continuous/interpolation_option.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 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 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | |
PiecewiseConstantNextLeftClosed
class-attribute
instance-attribute
#
Piecewise constant 'next' interpolation, each interval is closed on the left
In other words, between t(i) and t(i + 1), the value is equal to y(i + 1). At t(i), the value is equal to y(i + 1).
If helpful, we have drawn a picture of how this works below. Symbols:
- time: y-value selected for this time-value
- i: closed (i.e. inclusive) boundary
- o: open (i.e. exclusive) boundary
PiecewiseConstantNextLeftOpen
class-attribute
instance-attribute
#
Piecewise constant 'next' interpolation, each interval is open on the left
In other words, between t(i) and t(i + 1), the value is equal to y(i + 1). At t(i), the value is equal to y(i).
If helpful, we have drawn a picture of how this works below. Symbols:
- time: y-value selected for this time-value
- i: closed (i.e. inclusive) boundary
- o: open (i.e. exclusive) boundary
PiecewiseConstantPreviousLeftClosed
class-attribute
instance-attribute
#
Piecewise constant 'previous' interpolation, each interval is closed on the left
In other words, between t(i) and t(i + 1), the value is equal to y(i). At t(i + 1), the value is equal to y(i + 1).
If helpful, we have drawn a picture of how this works below. Symbols:
- time: y-value selected for this time-value
- i: closed (i.e. inclusive) boundary
- o: open (i.e. exclusive) boundary
PiecewiseConstantPreviousLeftOpen
class-attribute
instance-attribute
#
Piecewise constant 'previous' interpolation, each interval is open on the left
In other words, between t(i) and t(i + 1), the value is equal to y(i). At t(i + 1), the value is equal to y(i).
If helpful, we have drawn a picture of how this works below. Symbols:
- time: y-value selected for this time-value
- i: closed (i.e. inclusive) boundary
- o: open (i.e. exclusive) boundary
discrete_to_continuous #
discrete_to_continuous(
x: PINT_NUMPY_ARRAY,
y: PINT_NUMPY_ARRAY,
interpolation: InterpolationOption,
name: str,
) -> TimeseriesContinuous
Convert a discrete timeseries to continuous
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
PINT_NUMPY_ARRAY
|
The discrete x-values from which to convert |
required |
y
|
PINT_NUMPY_ARRAY
|
The discrete y-values from which to convert |
required |
interpolation
|
InterpolationOption
|
Interpolation type to use for converting from discrete to continuous. |
required |
name
|
str
|
The value to use to set the result's name attribute |
required |
Returns:
| Type | Description |
|---|---|
TimeseriesContinuous
|
Continuous version of |