Repository navigation
docs(tsal): add UDF correctness rules and prefer native functionality over UDFs - #133
Merged
Merged
Conversation
…d return types Document the rules users must follow when writing TSAL UDFs that accept `SampleSeries`: handle empty planning-time inputs, return a consistent type on every branch, respect gaps via `continuous_interval_indices`, and synchronize series before element-wise numpy operations. Include a `magnitude` example using `synchronized()`. Update both the defining expressions reference and the impulse-tsal skill.
Add a "Prefer native functionality" section to the impulse and impulse-tsal skills advising users to exhaust native operators, signal methods, Intervals methods, event types, and aggregation classes before falling back to UDFs. Highlight that native operations handle empty inputs, gaps, and unaligned channels and remain optimizable by the engine.
Update the TSAL UDF empty-input guidance in both the defining expressions reference and the impulse-tsal skill to say that scalar-returning UDFs should return `np.nan` (not `SampleSeries.empty()`), and that built-in reducers already return NaN for empty series.
…ocks Update the "Prefer native functionality" guidance in the impulse-tsal skill to include calculated channels (`impulse-channels`) alongside existing native options.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #133 +/- ##
=======================================
Coverage 90.30% 90.30%
=======================================
Files 68 68
Lines 6068 6068
Branches 758 758
=======================================
Hits 5480 5480
Misses 466 466
Partials 122 122
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds guidance to help users and agents write correct UDFs, and to avoid UDFs when Impulse's native functionality is enough.
Changes
SampleSeriesinput, added to theimpulse-tsalskill and todefining_expressions.md:continuous_interval_indices.synchronized()/synchronized_all()when working on the arrays of several series.impulseandimpulse-tsalskills. Agents should first check whether a request can be built from TSAL operators and methods, event types, aggregation classes or calculated channels, and use a UDF only for the part native functionality cannot express.magnitude(x, y)UDF showing synchronization. It also works on empty inputs.