Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: user specified timeseries #285

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

gunnarstaff
Copy link
Contributor

Description

Allow the user to provide a timeseries as input

Motivation and Context

Many users want to overlay a timeseries on the plots in Charts. It can be a measurement that is not in cdf, or a separate model/curvefit that cannot be performed in Charts.
This is a common request.
It is a crude workaround, but it will solve the clients problem until we have a better solution

How Has This Been Tested?

Win11, python 3.10.7

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Refactor (non-breaking change which improves implementation)
  • Performance (non-breaking change which improves performance. Please add associated performance test and results)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Non-functional change (xml comments/documentation/etc)

Contributor Checklist:

  • My code follows the code style of this project.
  • I have added an example of my new feature and included it in the documentation.
  • My change requires a change to the documentation.
  • [] I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • My Pull Request name follows the naming convention fix: <description>, feat: <description>, etc.

Reviewer Checklist for Charts compliant functions:

  • The docstrings of the new function follow the contributing guidelines.
  • The new function is professionally documented
  • The new function and associated scripts are covered by one or more unit tests and code coverage did not decrease.
  • The new function is accompanied by an example and it is included in the Gallery of Charts.
  • The new function is reviewed in Chromatic. Access the storybook build results url and comment, approve or deny.
  • All function inputs, arguments, and outputs have a supported data type and have human readable names.
  • No code language is included in the description of the function or parameters (e.g use "polynomial order" instead of "poly_order")

@gunnarstaff gunnarstaff requested review from a team and neringaalt August 7, 2024 09:21
Copy link

codecov bot commented Aug 7, 2024

Codecov Report

Attention: Patch coverage is 61.11111% with 7 lines in your changes missing coverage. Please review.

Project coverage is 91.11%. Comparing base (e242cfa) to head (811154c).
Report is 30 commits behind head on main.

Files with missing lines Patch % Lines
indsl/signals/user_specified_timeseries.py 58.82% 4 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #285      +/-   ##
==========================================
- Coverage   91.25%   91.11%   -0.14%     
==========================================
  Files         106      107       +1     
  Lines        3863     3881      +18     
  Branches      839      844       +5     
==========================================
+ Hits         3525     3536      +11     
- Misses        208      212       +4     
- Partials      130      133       +3     
Files with missing lines Coverage Δ
indsl/signals/__init__.py 100.00% <100.00%> (ø)
indsl/signals/user_specified_timeseries.py 58.82% <58.82%> (ø)

Copy link

github-actions bot commented Aug 7, 2024

Unit Test Results

    15 files  ± 0      15 suites  ±0   26m 58s ⏱️ +40s
 1 118 tests + 4   1 118 ✅ + 4  0 💤 ±0  0 ❌ ±0 
11 046 runs  +51  11 038 ✅ +52  8 💤  - 1  0 ❌ ±0 

Results for commit 811154c. ± Comparison against base commit dee07c2.

# from indsl.validations import validate_series_is_not_empty


# @check_types
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check types is required for functions that should be exposed in the UI. Thin function checks that the provided types are matching expected types.

input_time = np.array([time_.timestamp() for time_ in input_time_pd])
input_y = np.sin((input_time - input_time[0]) / (input_time[-1] - input_time[0]) * 2 * np.pi)

ts_series = user_specified_timeseries(input_time_str, input_y.tolist())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume here check_types fails because input_time_str is a [str], but in the function definition the input is specified as a [float]

def user_specified_timeseries(
input_time: List[float] = [0.0, 1.0], input_values: List[float] = [0.0, 1.0]
) -> pd.Series:
"""Convert input to a timeseries.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would this work in the UI? user manually copy pastes all the values into the parameters of the nodes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants