Skip to content

Conversation

@daniel-zullo-frequenz
Copy link
Contributor

Fixes #269

@daniel-zullo-frequenz daniel-zullo-frequenz requested a review from a team as a code owner March 23, 2023 08:08
@github-actions github-actions bot added part:data-pipeline Affects the data pipeline part:docs Affects the documentation part:tests Affects the unit, integration and performance (benchmarks) tests labels Mar 23, 2023
@daniel-zullo-frequenz
Copy link
Contributor Author

This is a draft which only updates the size parameter type to timedelta of the MovingWindow at the moment.
I'm working out the changes related to the resampler and I'll report here once it is done (hopefully today EOD)
fyi @matthias-wende-frequenz

@daniel-zullo-frequenz daniel-zullo-frequenz force-pushed the feature/add-resampler-moving-window branch 8 times, most recently from cca7aa2 to 8ac2f18 Compare March 23, 2023 19:08
Copy link
Contributor

@matthias-wende-frequenz matthias-wende-frequenz left a comment

Choose a reason for hiding this comment

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

This is looking quite good already. I'll have another look once the commit title doesn't say dirty any more :).

@daniel-zullo-frequenz
Copy link
Contributor Author

This is looking quite good already. I'll have another look once the commit title doesn't say dirty any more :)

Cool, good to know that! Then it will 'beautify' the current changes and add units tests. I'll let you know once it's ready to review

@daniel-zullo-frequenz daniel-zullo-frequenz added the priority:high Address this as soon as possible label Mar 30, 2023
@daniel-zullo-frequenz daniel-zullo-frequenz force-pushed the feature/add-resampler-moving-window branch 3 times, most recently from 6cdf005 to 13cf9a2 Compare March 30, 2023 16:47
@daniel-zullo-frequenz daniel-zullo-frequenz force-pushed the feature/add-resampler-moving-window branch from 13cf9a2 to 96aa37f Compare March 30, 2023 17:03
@daniel-zullo-frequenz
Copy link
Contributor Author

Rebased onto latest v0.x.x branch

Copy link
Contributor

@matthias-wende-frequenz matthias-wende-frequenz left a comment

Choose a reason for hiding this comment

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

just one last comment :)

documentation.
Resampling might be required to reduce the number of samples to store
without losing precision, and it can be set by specifying the resampler
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure what you want to say without loosing precision. We are loosing precision for when we downsample but that's acceptable in many cases.

Copy link
Contributor Author

@daniel-zullo-frequenz daniel-zullo-frequenz Apr 6, 2023

Choose a reason for hiding this comment

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

I meant that we can reduce the number of samples without losing much precision through resampling. I'd then remove without losing precision as it is confusing and it isn't generic in the sense it only applies for downsampling where it is somehow implicit an acceptable loss of precision

@daniel-zullo-frequenz daniel-zullo-frequenz force-pushed the feature/add-resampler-moving-window branch 2 times, most recently from 1cf572d to 5e073fe Compare April 6, 2023 13:15
@daniel-zullo-frequenz
Copy link
Contributor Author

Updated considering the latest comment from Matthias

Modify the MovingWindow class to accept the size parameter
as a timedelta object instead of an integer. This change
allows the size parameter to represent the time span of
the moving window over which samples will be stored,
making it more intuitive for users and consistent among
other parameters in the MovingWindow class.

Signed-off-by: Daniel Zullo <[email protected]>
There is not need at the moment to keep the
state of the flag to prevent deep copying of
the adjacent buffer in MovingWindow.

Signed-off-by: Daniel Zullo <[email protected]>
Add a resampler in the MovingWindow to control
the granularity of the samples to be stored in
the underlying buffer.

Signed-off-by: Daniel Zullo <[email protected]>
There were inconsistencies in the way the SDK set
datetime variables in the MovingWindow/RingBuffer without
tz/tzinfo and in the Resampler with tz/tzinfo.
This patch sets the timezone UTC for all datetime variables
set in the MovingWindow and RingBuffer to make them consistent
to the datetime variables set in the Resampler.

Signed-off-by: Daniel Zullo <[email protected]>
Change the way the markers are represented in RingBuffer
so that `replace()` is not called every time the markers
are assigned or compared to.

Signed-off-by: Daniel Zullo <[email protected]>
The ISO format is more precise and  might be less
confusing for the users.

Signed-off-by: Daniel Zullo <[email protected]>
@daniel-zullo-frequenz daniel-zullo-frequenz force-pushed the feature/add-resampler-moving-window branch from 5e073fe to 3bc00be Compare April 6, 2023 15:46
The test fails when it is run in the CI, increasing
the sampling won't solve the problem, just it will
fail less ofter. There are already two different open
issues to address and fix these flaky tests. See the
links below:

frequenz-floss#249
frequenz-floss#70

Signed-off-by: Daniel Zullo <[email protected]>
@daniel-zullo-frequenz daniel-zullo-frequenz force-pushed the feature/add-resampler-moving-window branch from f6ef466 to 5d37033 Compare April 6, 2023 16:25
@daniel-zullo-frequenz daniel-zullo-frequenz merged commit a3feb15 into frequenz-floss:v0.x.x Apr 11, 2023
@daniel-zullo-frequenz daniel-zullo-frequenz deleted the feature/add-resampler-moving-window branch April 11, 2023 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

part:data-pipeline Affects the data pipeline part:docs Affects the documentation part:tests Affects the unit, integration and performance (benchmarks) tests priority:high Address this as soon as possible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add resampler to MovingWindow

5 participants