-
Notifications
You must be signed in to change notification settings - Fork 2
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
Use numpy arrays in time series #55
Conversation
"""Check time series data.""" | ||
if len(data) < 2: | ||
msg = f"SingleTimeSeries length must be at least 2: {len(data)}" | ||
raise ValueError(msg) | ||
|
||
if isinstance(data, pint.Quantity): | ||
if not isinstance(data.magnitude, np.ndarray): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please confirm that this is correct. Previously, if the user passed a range object inside a pint Quantity, pint would leave it alone. This guarantees that SingleTimeSeries will always have numpy array.
@@ -341,7 +352,7 @@ def from_data(cls, time_series: SingleTimeSeries, **user_attributes) -> Any: | |||
quantity_type=type(time_series.data), | |||
units=str(time_series.data.units), | |||
) | |||
if isinstance(time_series.data, BaseQuantity) | |||
if isinstance(time_series.data, pint.Quantity) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pesap This fixes the Quantity vs BaseQuantity issue.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #55 +/- ##
==========================================
- Coverage 95.24% 95.04% -0.21%
==========================================
Files 33 33
Lines 2778 2807 +29
==========================================
+ Hits 2646 2668 +22
- Misses 132 139 +7 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
Use numpy arrays in time series
We were previously storing time series arrays as pyarrow arrays. That was causing complexity because users often need numpy arrays. The team decided to convert them to numpy arrays straightaway instead.
I also upgraded mypy and fixed some errors caused by that upgrade.
Fixes #54