Skip to content

Implementing basic RQA functionality#15

Merged
zeyus merged 14 commits intoNexusDynamic:devfrom
zubekj:dev
Mar 8, 2024
Merged

Implementing basic RQA functionality#15
zeyus merged 14 commits intoNexusDynamic:devfrom
zubekj:dev

Conversation

@zubekj
Copy link
Copy Markdown
Contributor

@zubekj zubekj commented Mar 7, 2024

This is the implementation of a basic RQA analysis fitting the Mopipe architecture.

New Segments:

  • CalcShift – calculating change of value with a time shift
  • SimpleGapFilling – linear interpolation of missing values
  • RQAStats, CrossRQAStats, WindowedCrossRQAStats – variants of RQA analysis

Bugfixes:

  • Properly reading a QTM data file with multiple EVENTs.

Copy link
Copy Markdown
Contributor

@zeyus zeyus left a comment

Choose a reason for hiding this comment

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

Minor things but this is awesome 😎

self._metadata[k] = v
else:
# Metadata entry for an existing key: append values to the list
self._metadata[k] += v
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.

Nice catch!

Comment thread src/mopipe/segment.py
v_sum = d_line_dist[lmin:].sum()
avg_vert_length = (v_line_dist[lmin:] * np.arange(msize+1)[lmin:]).sum() / v_sum if v_sum > 0 else 0

d_line_dist[lmin:] > 0
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 line can go

Comment thread src/mopipe/segment.py
d_probs /= d_probs.sum()
d_entropy = -(d_probs * np.log(d_probs)).sum()

v_line_dist[lmin:] > 0
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.

Also this one

Comment thread src/mopipe/segment.py
return x.interpolate(method="linear")


def calc_rqa(x: np.array, y: np.array, dim: int = 1, tau: int = 1, threshold: float = 0.1, lmin: int = 2):
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 could maybe go into mopipe.core somewhere?

Comment thread src/mopipe/core/common/qtm.py
Comment thread src/mopipe/segment.py
@zeyus
Copy link
Copy Markdown
Contributor

zeyus commented Mar 7, 2024

I'll have to revisit the documentation generation, now that we are getting to the meat of the code it should break it out a bit more for the API documentation (like "stuff you want to use as a user of mopipe" / " base structures and internal stuff you can build from in mopipe") but we can discuss what makes the most sense...I think it should be as automated as possible, but a bit more structured than the huge list of classes there now.

@zeyus zeyus linked an issue Mar 7, 2024 that may be closed by this pull request
@zeyus zeyus merged commit fae72a2 into NexusDynamic:dev Mar 8, 2024
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.

linear gap filling

2 participants