tslite-og 2.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tslite_og-2.1.0/CHANGELOG.md +298 -0
- tslite_og-2.1.0/LICENSE +202 -0
- tslite_og-2.1.0/MANIFEST.in +10 -0
- tslite_og-2.1.0/PKG-INFO +215 -0
- tslite_og-2.1.0/README.md +189 -0
- tslite_og-2.1.0/doc/tslite.md +775 -0
- tslite_og-2.1.0/pyproject.toml +39 -0
- tslite_og-2.1.0/pytest.ini +5 -0
- tslite_og-2.1.0/scripts/migrate_sqlite_milliseconds.py +73 -0
- tslite_og-2.1.0/setup.cfg +4 -0
- tslite_og-2.1.0/test/TScull.tsv +18 -0
- tslite_og-2.1.0/test/cull.tsv +23 -0
- tslite_og-2.1.0/test/inflow.tsv +49 -0
- tslite_og-2.1.0/test/movingSTDDEV.tsv +33 -0
- tslite_og-2.1.0/test/round.tsv +33 -0
- tslite_og-2.1.0/test/runningTotal.tsv +49 -0
- tslite_og-2.1.0/test/source.dat +0 -0
- tslite_og-2.1.0/test/test.db +0 -0
- tslite_og-2.1.0/test/test.json +35 -0
- tslite_og-2.1.0/test/truncate.tsv +33 -0
- tslite_og-2.1.0/tests/test_average_wy.py +66 -0
- tslite_og-2.1.0/tests/test_baseline.py +192 -0
- tslite_og-2.1.0/tests/test_binary_precision.py +80 -0
- tslite_og-2.1.0/tests/test_centered_average.py +42 -0
- tslite_og-2.1.0/tests/test_closest_index.py +43 -0
- tslite_og-2.1.0/tests/test_comparison.py +126 -0
- tslite_og-2.1.0/tests/test_constructor_missing.py +38 -0
- tslite_og-2.1.0/tests/test_create_regular.py +109 -0
- tslite_og-2.1.0/tests/test_cull_equal.py +23 -0
- tslite_og-2.1.0/tests/test_diff_precision.py +51 -0
- tslite_og-2.1.0/tests/test_fill_missing.py +69 -0
- tslite_og-2.1.0/tests/test_filldown.py +89 -0
- tslite_og-2.1.0/tests/test_fiscal_year.py +55 -0
- tslite_og-2.1.0/tests/test_historical.py +199 -0
- tslite_og-2.1.0/tests/test_insert.py +27 -0
- tslite_og-2.1.0/tests/test_interpolate.py +101 -0
- tslite_og-2.1.0/tests/test_interval_aggregation.py +66 -0
- tslite_og-2.1.0/tests/test_interval_extrema.py +82 -0
- tslite_og-2.1.0/tests/test_intervals.py +132 -0
- tslite_og-2.1.0/tests/test_json.py +60 -0
- tslite_og-2.1.0/tests/test_manual.py +33 -0
- tslite_og-2.1.0/tests/test_merge_missing.py +71 -0
- tslite_og-2.1.0/tests/test_missing_arithmetic.py +84 -0
- tslite_og-2.1.0/tests/test_missing_extrema.py +47 -0
- tslite_og-2.1.0/tests/test_missing_statistics.py +74 -0
- tslite_og-2.1.0/tests/test_missing_totals.py +79 -0
- tslite_og-2.1.0/tests/test_optional_dependencies.py +53 -0
- tslite_og-2.1.0/tests/test_percent.py +58 -0
- tslite_og-2.1.0/tests/test_quality_cleanup.py +73 -0
- tslite_og-2.1.0/tests/test_ratings.py +49 -0
- tslite_og-2.1.0/tests/test_readme_examples.py +18 -0
- tslite_og-2.1.0/tests/test_regression.py +68 -0
- tslite_og-2.1.0/tests/test_running_total.py +43 -0
- tslite_og-2.1.0/tests/test_sequence.py +63 -0
- tslite_og-2.1.0/tests/test_snap.py +61 -0
- tslite_og-2.1.0/tests/test_sqlite_migration.py +102 -0
- tslite_og-2.1.0/tests/test_sqlite_precision.py +48 -0
- tslite_og-2.1.0/tests/test_sqlite_ranges.py +105 -0
- tslite_og-2.1.0/tests/test_sqlite_writes.py +253 -0
- tslite_og-2.1.0/tests/test_statistics.py +80 -0
- tslite_og-2.1.0/tests/test_storage_missing.py +68 -0
- tslite_og-2.1.0/tests/test_storage_timezones.py +39 -0
- tslite_og-2.1.0/tests/test_subslice.py +42 -0
- tslite_og-2.1.0/tests/test_timezone_independence.py +101 -0
- tslite_og-2.1.0/tests/test_truncate.py +56 -0
- tslite_og-2.1.0/tests/test_water_year.py +118 -0
- tslite_og-2.1.0/tests/test_window_operations.py +179 -0
- tslite_og-2.1.0/tslite.py +1953 -0
- tslite_og-2.1.0/tslite_og.egg-info/PKG-INFO +215 -0
- tslite_og-2.1.0/tslite_og.egg-info/SOURCES.txt +71 -0
- tslite_og-2.1.0/tslite_og.egg-info/dependency_links.txt +1 -0
- tslite_og-2.1.0/tslite_og.egg-info/requires.txt +4 -0
- tslite_og-2.1.0/tslite_og.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 2.1.0 — Unreleased
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- `interpolate(interval, anchor=None)` accepts an optional datetime alignment
|
|
8
|
+
anchor. Only aligned regular time steps within the observed range are emitted;
|
|
9
|
+
anchors before or after the data work without extrapolation.
|
|
10
|
+
|
|
11
|
+
- `getFiscalYear(start_date)` selects available observations from an arbitrary
|
|
12
|
+
start date through (but excluding) its next calendar-year anniversary. Accepts
|
|
13
|
+
date strings, dates, and datetimes; partial years are allowed. `getWY(year)`
|
|
14
|
+
delegates to it with October 1 of the previous year.
|
|
15
|
+
|
|
16
|
+
- Temporary `scripts/migrate_sqlite_milliseconds.py OLD.db NEW.db TABLE ...`
|
|
17
|
+
utility copies a database and converts explicitly selected integer timestamp
|
|
18
|
+
keys from milliseconds to microseconds. It preserves the original, other
|
|
19
|
+
columns, and indexes; run once and verify before switching files.
|
|
20
|
+
|
|
21
|
+
- PyPI packaging prepared as `tslite-og` (branding `tslite-OG`), retaining
|
|
22
|
+
`import tslite` and the single-module layout. Python 3.11+ support, uv tooling,
|
|
23
|
+
optional NumPy extra, runnable README examples, and local multi-version
|
|
24
|
+
test/build verification without a hosted CI dependency.
|
|
25
|
+
Release artifacts are local only; publication awaits correctness review.
|
|
26
|
+
|
|
27
|
+
- `timeseries.createRegular(start, end, interval, value=0)` creates a new
|
|
28
|
+
constant-valued series on a regular time grid. Start is included; end is
|
|
29
|
+
included when on-grid. Intervals must be positive.
|
|
30
|
+
- Explicit comparisons: `same_data()` ignores timestamps with configurable
|
|
31
|
+
decimal precision; `is_close()` accepts timestamp, absolute-value, and
|
|
32
|
+
relative-value tolerances.
|
|
33
|
+
- Pytest regression/characterization tests and a maintained Markdown manual with
|
|
34
|
+
public-method coverage and executable examples.
|
|
35
|
+
|
|
36
|
+
### Changed
|
|
37
|
+
|
|
38
|
+
- Documentation now consists of the README introduction and a rewritten
|
|
39
|
+
`doc/tslite.md` manual with public-method explanations and examples. Removed
|
|
40
|
+
MkDocs configuration, generated-reference guides, and documentation-only
|
|
41
|
+
dependencies. Manual examples and method coverage run in pytest; the source
|
|
42
|
+
distribution includes the manual. No documentation server is required.
|
|
43
|
+
|
|
44
|
+
- `diff(other, precision=6)` exposes its existing fixed-decimal comparison
|
|
45
|
+
precision, retaining incoming-only change semantics and unrounded output values.
|
|
46
|
+
None comparisons are safe; matching None/NaN and same-sign infinities are
|
|
47
|
+
unchanged. Decimal formatting rounds rather than truncates, as before.
|
|
48
|
+
|
|
49
|
+
- `merge()` prefers finite observations over missing/nonfinite values at matching
|
|
50
|
+
timestamps, regardless of side. Incoming/right values win when both are usable
|
|
51
|
+
or both unusable. Unmatched missing records are retained. A linear two-pointer
|
|
52
|
+
traversal returns independent records; insert replacement rules are unchanged.
|
|
53
|
+
|
|
54
|
+
- Construction and safe insertion preserve explicit None-valued records rather
|
|
55
|
+
than dropping their timestamps. JSON null imports now retain those records.
|
|
56
|
+
Duplicate timestamps still use the last supplied value, including None.
|
|
57
|
+
|
|
58
|
+
- **Compatibility change:** `average()` and standalone `accumulate()` label
|
|
59
|
+
half-open interval buckets at their beginning, not their end. Values are
|
|
60
|
+
unchanged for finite input, but timestamps shift back one interval. Final
|
|
61
|
+
partial buckets remain included; empty buckets remain omitted. `accumulateWY()`
|
|
62
|
+
already uses beginning labels and is unchanged by this label change.
|
|
63
|
+
- `average()` excludes missing/nonfinite values, yields NaN for all-invalid
|
|
64
|
+
observed buckets, and records skipped-data warnings in source status. It groups
|
|
65
|
+
observed buckets directly rather than walking through long empty gaps.
|
|
66
|
+
|
|
67
|
+
- Totals skip missing/nonfinite increments and report skipped counts plus an
|
|
68
|
+
incomplete-total warning in the source series' status. Running and water-year
|
|
69
|
+
totals carry known subtotals; independent all-invalid accumulation buckets
|
|
70
|
+
yield NaN. Water-year resets remain intact; invalid seeds use zero for new
|
|
71
|
+
extension only, with a warning and existing records preserved. Successful
|
|
72
|
+
operations without skips reset status to OK.
|
|
73
|
+
- `accumulate()` excludes observations before an explicit bucket start and
|
|
74
|
+
groups observed buckets directly, avoiding iteration through long empty gaps.
|
|
75
|
+
|
|
76
|
+
- Pointwise add/subtract/multiply/divide retain usable results when another
|
|
77
|
+
matched pair is missing, nonfinite, zero-dividing, or overflowing. Bad pairs
|
|
78
|
+
produce NaN at their timestamps. Series alignment remains exact-match-only;
|
|
79
|
+
a matched None is preserved as NaN rather than mistaken for an absent record.
|
|
80
|
+
|
|
81
|
+
- Global mean/variance/stddev and moving averages/stddev exclude missing and
|
|
82
|
+
nonfinite values, using the usable observation count. All-invalid nonempty
|
|
83
|
+
windows produce NaN at their normal labels; empty global statistics still
|
|
84
|
+
return None. Centered moving averages recover after invalid values leave a
|
|
85
|
+
window instead of retaining a poisoned running sum.
|
|
86
|
+
|
|
87
|
+
- `toJSON(timefmt=None, decimals=None, strict=False)` now uses valid JSON encoding,
|
|
88
|
+
ISO timestamps with subseconds, and full float precision by default. Existing
|
|
89
|
+
`timefmt` overrides remain supported; `decimals` optionally rounds values.
|
|
90
|
+
Missing/nonfinite values export as null, retaining timestamps for plotting
|
|
91
|
+
gaps. `strict=True` rejects NaN/infinity instead. `toJS()` remains a variable-
|
|
92
|
+
declaration wrapper with the same options. The importer preserves null-valued
|
|
93
|
+
observations as None; NaN/infinity distinctions are lost when exported as null.
|
|
94
|
+
|
|
95
|
+
- SQLite timestamps now use **integer epoch microseconds**, preserving all
|
|
96
|
+
datetime fractional digits without float epoch multiplication. Existing
|
|
97
|
+
millisecond tables must be explicitly converted before loading or writing;
|
|
98
|
+
no unit guessing or automatic migration is performed. Older library versions
|
|
99
|
+
must not read the new units. Storage is now machine-timezone independent.
|
|
100
|
+
SQLite and binary methods accept `tz=None` (naive clock readings) or an explicit
|
|
101
|
+
IANA zone name (convert between local clock readings and UTC stored instants).
|
|
102
|
+
Returned timestamps remain naive. Load old local-encoded files with the original
|
|
103
|
+
writer's zone. Ambiguous/nonexistent local write times are rejected.
|
|
104
|
+
|
|
105
|
+
- Ordinary SQLite saves use change-aware `ON CONFLICT(timestamp)` upserts:
|
|
106
|
+
insert new timestamps, update only different values, and leave identical rows
|
|
107
|
+
untouched. Updates preserve other columns and referencing rows rather than
|
|
108
|
+
deleting/reinserting records. Explicit table replacement remains available.
|
|
109
|
+
|
|
110
|
+
- SQLite saves use a savepoint instead of committing unrelated caller work.
|
|
111
|
+
With an existing transaction, the caller now owns commit/rollback; otherwise
|
|
112
|
+
successful saves commit as before. Success resets the series status to OK.
|
|
113
|
+
|
|
114
|
+
- Forward/backward averages now average available observations in partial edge
|
|
115
|
+
windows by default. Pass `require_full_window=True` to retain the prior
|
|
116
|
+
omission of incomplete windows. Forward results keep the requested window-end
|
|
117
|
+
label, even beyond the last observation; backward labels are unchanged.
|
|
118
|
+
|
|
119
|
+
- `TD()` and `parseTimedelta()` accept `positive=True` to require forward steps.
|
|
120
|
+
General parsing retains signed/zero durations, fractions, whitespace, and
|
|
121
|
+
365-day years. Malformed/out-of-range strings now raise ValueError rather
|
|
122
|
+
than returning a partial duration; unsupported types raise TypeError.
|
|
123
|
+
- Resampling, aggregation, moving windows, snap, fill operations, and regular
|
|
124
|
+
creation reject nonpositive intervals before processing even empty input.
|
|
125
|
+
Snap buffers may be zero but not negative.
|
|
126
|
+
|
|
127
|
+
- Series equality now requires exact timestamp and numerical-value matches.
|
|
128
|
+
Use `same_data(precision=...)` for the old value-only comparison or `is_close()`
|
|
129
|
+
for explicit tolerances. The precision argument to `__eq__` is removed.
|
|
130
|
+
|
|
131
|
+
- Out-of-range integer indexing now raises IndexError instead of returning
|
|
132
|
+
`[None, None]`. Negative indices and list slices follow Python list semantics.
|
|
133
|
+
Explicit iteration terminates normally; records remain mutable references.
|
|
134
|
+
|
|
135
|
+
### Removed
|
|
136
|
+
|
|
137
|
+
- Deprecated `cullValues()`. Use `cullEqual(value)`; convert numeric strings
|
|
138
|
+
explicitly with `float(value)` before passing them.
|
|
139
|
+
|
|
140
|
+
- Unused `runningTotal(override_startTime=...)` argument. Use subslicing to
|
|
141
|
+
restrict the summed range. `accumulate()` retains its functional bucket-start
|
|
142
|
+
override for explicit interval alignment.
|
|
143
|
+
|
|
144
|
+
- Ignored `quality` argument to `insert()`. Variance and standard deviation now
|
|
145
|
+
return `[timestamp, value]` without the obsolete quality placeholder.
|
|
146
|
+
|
|
147
|
+
- Compatibility aliases `timeSeries`, `rdb.rate2()`, and `rdb.rateTS2()`.
|
|
148
|
+
Use `timeseries`, `rdb.reverseRate()`, and `rdb.reverseRateTS()` respectively.
|
|
149
|
+
`firstdifference()` remains as the statistical name for `simpledelta()`;
|
|
150
|
+
`parseTimedelta()` and `TD()` are also retained.
|
|
151
|
+
|
|
152
|
+
- Old-format readers `loadSQLITE3v1()`, `loadBinaryV1()`, and `fromBinaryV1()`.
|
|
153
|
+
Convert old stores with an earlier library version before upgrading.
|
|
154
|
+
The binary double/double layout is unchanged. Current SQLite now uses
|
|
155
|
+
microseconds as described above; the temporary utility migrates milliseconds.
|
|
156
|
+
- Replaced `test/testv1.dat` with converted `test/source.dat`, verifying all
|
|
157
|
+
45,661 epoch timestamps and values exactly before removing the old reader.
|
|
158
|
+
|
|
159
|
+
### Fixed
|
|
160
|
+
|
|
161
|
+
- Binary writes encode None values as NaN in the unchanged double/double layout.
|
|
162
|
+
Reads retain complete records from truncated input and report incomplete
|
|
163
|
+
trailing bytes in status instead of silently ignoring short files or raising
|
|
164
|
+
after partial loading. SQLite NaN-to-NULL behavior is documented and tested;
|
|
165
|
+
TSV remains unchanged as human-readable reporting output.
|
|
166
|
+
|
|
167
|
+
- `percent()` shares the pointwise arithmetic implementation: exact timestamp
|
|
168
|
+
matches are retained as NaN for missing/nonfinite values, zero denominators,
|
|
169
|
+
or overflow, instead of dropping zero-denominator timestamps or discarding
|
|
170
|
+
otherwise valid results. Unmatched timestamps remain omitted.
|
|
171
|
+
|
|
172
|
+
- `averageWY()` matches complete calendar positions including seconds and
|
|
173
|
+
microseconds, retaining latest-water-year timestamps and averaging available
|
|
174
|
+
matches including that year. Leap days match only leap days. Invalid matching
|
|
175
|
+
values are skipped with warnings; all-invalid positions yield NaN. Broad
|
|
176
|
+
exception suppression and iteration over absent years are removed.
|
|
177
|
+
|
|
178
|
+
- Global min/max skip missing/nonfinite observations with source-status warnings,
|
|
179
|
+
retaining the actual extremum timestamp and earliest ties. Empty or all-invalid
|
|
180
|
+
input returns None rather than order-dependent NaN or comparison errors.
|
|
181
|
+
|
|
182
|
+
- `maxmin()` no longer fills empty buckets from future observations. Interval
|
|
183
|
+
extrema now use beginning-labeled half-open buckets, matching means and sums.
|
|
184
|
+
Missing/nonfinite observations are skipped with a source-status warning;
|
|
185
|
+
all-invalid observed buckets yield NaN and empty buckets are omitted.
|
|
186
|
+
|
|
187
|
+
- Regression fits use relative timestamps and centered, normalized sums instead
|
|
188
|
+
of subtracting large epoch products. `linreg()` retains its epoch-intercept
|
|
189
|
+
return contract; `trendline()` evaluates the stable relative fit directly.
|
|
190
|
+
Missing/nonfinite values are excluded from fitting, with predictions retained
|
|
191
|
+
at every original timestamp. Singleton/constant fits are horizontal with zero
|
|
192
|
+
correlation by convention; no usable values yield a zero fit.
|
|
193
|
+
|
|
194
|
+
- `fillMissing()` now merges existing observations with missing regular steps
|
|
195
|
+
within inclusive bounds. Off-step observations are preserved, outside records
|
|
196
|
+
excluded, exact matches never overwritten, and singleton inputs retained.
|
|
197
|
+
Empty input with explicit bounds generates fills including an aligned endpoint.
|
|
198
|
+
Records remain independent; broad inner exception suppression is removed.
|
|
199
|
+
|
|
200
|
+
- `filldown()` omits unsupported leading steps rather than inventing zero values,
|
|
201
|
+
preserving explicit start alignment. Trailing carry-forward no longer emits
|
|
202
|
+
a step beyond an unaligned requested end time. Offset boundaries compare full
|
|
203
|
+
timestamps and stop when already aligned, rather than extending another day.
|
|
204
|
+
|
|
205
|
+
- `interpolate()` now uses regular time steps anchored at the first observation,
|
|
206
|
+
including valid interior steps for non-divisible gaps and the final timestamp
|
|
207
|
+
when aligned. Exact timestamp matches copy source values without recalculation.
|
|
208
|
+
Singleton/short-span inputs return the first observation; no extrapolation is
|
|
209
|
+
performed. Previously stepping restarted per segment and dropped endpoints.
|
|
210
|
+
|
|
211
|
+
- `subSlice()` uses bisect boundaries and direct independent record copies,
|
|
212
|
+
retaining inclusive endpoints and empty results for reversed/nonoverlapping
|
|
213
|
+
ranges without the old nearby-index scan.
|
|
214
|
+
|
|
215
|
+
- `findClosestIndex()` now returns the genuinely nearest observation rather than
|
|
216
|
+
the final binary-search midpoint. Equal-distance ties choose the earlier
|
|
217
|
+
observation; out-of-range requests choose the nearest endpoint and empty
|
|
218
|
+
series return -1.
|
|
219
|
+
|
|
220
|
+
- `snap()` uses binary search and full timedelta distances, retaining days and
|
|
221
|
+
microseconds. Each grid point independently selects its nearest observation;
|
|
222
|
+
ties choose the earlier one. Oversized buffers are honored with a warning in
|
|
223
|
+
the source series' status rather than silently clamped. Observations may be
|
|
224
|
+
reused across grid points; no averaging or interpolation occurs.
|
|
225
|
+
- `insert()` uses standard-library bisect for sorted insertion and exact-match
|
|
226
|
+
replacement, retaining the fast append path.
|
|
227
|
+
|
|
228
|
+
- `getWY()` includes the entire final September 30, not just midnight.
|
|
229
|
+
- `accumulateWY()` preserves existing cumulative records and appends totals for
|
|
230
|
+
beginning-labeled, half-open interval buckets after the last completed period.
|
|
231
|
+
Empty bases start from zero, counting the first increment once. Resets follow
|
|
232
|
+
bucket-start water years, including across gaps and multi-day intervals;
|
|
233
|
+
offsets retain whole days. Buckets crossing a reset are not split. Neither
|
|
234
|
+
input is mutated or aliased; empty increments return an independent copy.
|
|
235
|
+
|
|
236
|
+
- Legacy binary writes include fractional epoch seconds instead of discarding
|
|
237
|
+
subseconds. The native double/double layout and whole-second bytes are unchanged.
|
|
238
|
+
Double precision still limits timestamp resolution far from the epoch.
|
|
239
|
+
|
|
240
|
+
- SQLite writes quote literal table names, bulk-insert observations, and roll
|
|
241
|
+
back partial writes or table replacement on failure. Interrupts also clean
|
|
242
|
+
up before propagating. Existing timestamp/storage and upsert rules remain.
|
|
243
|
+
|
|
244
|
+
- Moving standard deviation inserts normal two-field observations and skips
|
|
245
|
+
empty windows instead of appending None. Inclusive windows and last-observation
|
|
246
|
+
labels remain; duplicate output labels use normal last-insert-wins semantics.
|
|
247
|
+
|
|
248
|
+
- SQLite date-range loading converts bounds to the correct epoch units instead
|
|
249
|
+
of repeating a timetuple. The current loader supports either or both
|
|
250
|
+
inclusive bounds, preserves fractional seconds in bounds, parameterizes values,
|
|
251
|
+
quote literal table names, and explicitly order rows by timestamp. Legacy
|
|
252
|
+
loader-owned status errors are unchanged; timezone conversion is explicit.
|
|
253
|
+
|
|
254
|
+
- Global min/max include all observations and handle singleton/empty input.
|
|
255
|
+
Results are independent records labeled with the actual observation's
|
|
256
|
+
timestamp; ties select the earliest observation.
|
|
257
|
+
- Moving standard deviation now uses interval validation instead of comparing
|
|
258
|
+
the uncalled `total_seconds` method to zero.
|
|
259
|
+
|
|
260
|
+
- Global average includes every observation and handles singleton input;
|
|
261
|
+
variance and standard deviation consequently use the complete mean.
|
|
262
|
+
- Centered moving averages include preceding as well as following observations.
|
|
263
|
+
- Truncation discards digits toward zero instead of rounding.
|
|
264
|
+
- Empty filldown returns a new empty series rather than raising TypeError.
|
|
265
|
+
- Savitzky-Golay filtering works with modern NumPy and retains all observations.
|
|
266
|
+
|
|
267
|
+
### Maintenance
|
|
268
|
+
|
|
269
|
+
- Removed dead HEC/Jython scaffolding and unreachable code; bare exception
|
|
270
|
+
handlers no longer swallow interrupts.
|
|
271
|
+
|
|
272
|
+
### Regular-grid selection workflow
|
|
273
|
+
|
|
274
|
+
Create a regular series as a timestamp mask, then select observations from
|
|
275
|
+
another series using `cut()`:
|
|
276
|
+
|
|
277
|
+
```python
|
|
278
|
+
from datetime import datetime
|
|
279
|
+
from tslite import timeseries
|
|
280
|
+
|
|
281
|
+
source = timeseries([
|
|
282
|
+
(datetime(2024, 1, 1, 0), 10),
|
|
283
|
+
(datetime(2024, 1, 1, 1, 30), 15),
|
|
284
|
+
(datetime(2024, 1, 1, 2), 20),
|
|
285
|
+
])
|
|
286
|
+
grid = timeseries.createRegular(
|
|
287
|
+
start=datetime(2024, 1, 1, 0),
|
|
288
|
+
end=datetime(2024, 1, 1, 3),
|
|
289
|
+
interval="1h",
|
|
290
|
+
)
|
|
291
|
+
selected = grid.cut(source)
|
|
292
|
+
# 00:00 -> 10, 02:00 -> 20
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
**Operand order matters:** `grid.cut(source)` keeps source values at timestamps
|
|
296
|
+
present in the grid. `source.cut(grid)` would instead keep the grid's values.
|
|
297
|
+
Matching is exact: this selects observations, without interpolating, snapping,
|
|
298
|
+
or filling grid timestamps absent from the source.
|
tslite_og-2.1.0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2009-2026 Gunnar Leffler
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
include LICENSE README.md CHANGELOG.md pyproject.toml pytest.ini
|
|
2
|
+
recursive-include tests *.py
|
|
3
|
+
include scripts/migrate_sqlite_milliseconds.py
|
|
4
|
+
include test/source.dat test/test.db
|
|
5
|
+
recursive-include test *.tsv *.json
|
|
6
|
+
prune docs
|
|
7
|
+
include doc/tslite.md
|
|
8
|
+
prune site
|
|
9
|
+
prune .github
|
|
10
|
+
global-exclude __pycache__ *.py[cod]
|