Skip to content

162 write trim class#163

Merged
adcalpa merged 22 commits intomainfrom
162-write-trim-class
Mar 17, 2026
Merged

162 write trim class#163
adcalpa merged 22 commits intomainfrom
162-write-trim-class

Conversation

@adcalpa
Copy link
Copy Markdown
Contributor

@adcalpa adcalpa commented Feb 10, 2026

No description provided.

@adcalpa adcalpa linked an issue Feb 10, 2026 that may be closed by this pull request
Comment thread src/quends/base/history.py Outdated
import numpy as np


def to_native_types(obj):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What's this for? Do we really need this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This converts the NumPy specific values to Python types which makes outputs easier to compare in tests and avoids weird type issues when users consume returned dicts. It also helps avoid type-based failures for our unit tests.

Comment thread src/quends/base/history.py Outdated
Comment thread src/quends/base/operations.py Outdated
Comment thread src/quends/base/data_stream.py Outdated
Comment thread src/quends/base/data_stream.py Outdated
self._history = history or DataStreamHistory()

def _append_history_entry(self, entry: DataStreamHistoryEntry) -> None:
"""Append history entry while supporting both legacy and new history formats."""
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We might consider just supporting the new format from here on and make a breaking release.

"""
Stub for compatibility with legacy test. Returns dummy value.
"""
# We could implement a real one if needed; for now, return 0 for all columns.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Was this in the original code?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, it was. Should I remove this function or keep it?

Comment thread src/quends/base/data_stream.py Outdated
{column: True if stationary (p<0.05), else False or error message}
"""
# Add to history
entry = DataStreamHistoryEntry(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same comment about history

@@ -1152,148 +1832,198 @@ def _process_column(self, column_data, estimated_window, method):
else:
raise ValueError("Invalid method. Choose 'sliding' or 'non-overlapping'.")

def is_stationary(self, columns):
# ----------- ESS (classic and robust) ----------------
def effective_sample_size(self, column_names=None, alpha=0.05):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This function is very complex, can you refactor it?

Comment thread src/quends/base/stationary.py Outdated
Comment thread src/quends/base/stationary.py
@adcalpa adcalpa merged commit aaed5f8 into main Mar 17, 2026
3 checks passed
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.

Write Trim Class

2 participants