Gunnstein / Gunnstein/fatpack

find_reversal_racetrack_filtered returning the original datapoint and not the bin datapoint

Open
#28 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
157
Forks
29
PR merge metrics
No merged PRs in 30d

Description

I believe the find_reversal_racetrack_filtered is returning the wrong vector.
It should return rev[ix[ixr]], ix[ixr] and not y[ix[ixr]], ix[ixr]

Here is the piece of code I was playing with to understand the behaviour of racetrack_filter:
```
y = np.random.normal(size=50)*10
fig = go.Figure()
time = x=[i for i, val in enumerate(y)]
fig.add_trace(go.Scatter(x=time,y=y, mode='markers', marker_size=10, name='Raw Data'))
binsDataFiltering = 6
reversal, indInit = fatpack.find_reversals(y, k=binsDataFiltering)
fig.add_trace((go.Scatter(x=indInit, y=reversal, name='find_reversal')))
reversal, indInit = fatpack.find_reversals_racetrack_filtered(y, h=0, k=binsDataFiltering)
fig.add_trace((go.Scatter(x=indInit, y=reversal, name='find_reversals_racetrack_filtered h=0')))

bound = fatpack.rainflow.get_load_class_boundaries(y, k=binsDataFiltering)
boundCouple = zip(bound[:-1], bound[1:])

for boundaryCouple in boundCouple:
fig.add_hline(y=(boundaryCouple[1]+boundaryCouple[0])/2, line_dash='dash', line_color='green')
fig.update_layout(title=dict(text="Rainflow counting with FatPack test"),xaxis=dict(title=dict(text="Time")),yaxis=dict(title=dict(text="physical value")))
fig.show()
```

Thanks for this great package !

![image](https://github.com/user-attachments/assets/471a97e7-0f08-4b8d-a67a-249f47c750ad)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the find_reversals_racetrack_filtered entry point and compare its returned vector with the issue's expected rev[ix[ixr]], ix[ixr] result. Reproduce the behavior using the provided NumPy example and verify that the function returns the bin datapoint rather than the original datapoint.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.