-
Notifications
You must be signed in to change notification settings - Fork 174
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
Added initial y0 to WhiteSignal process #1064
Conversation
def shift(x): | ||
offset = np.argmin(abs(self.y0 - x)) | ||
return np.roll(x, -offset+1) # +1 since t starts at dt | ||
signal = np.apply_along_axis(shift, 0, signal) |
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.
Note: roll
here takes an axis argument, but it doesn't help prevent the apply_along_axis
because offset
could be different per dimension in shape[1:]
.
This LGTM, just needs a second review and a changelog entry. |
Added changelog entry and shortened test simulation time. |
LGTM 🍰 |
What do you mean by this? |
|
||
assert np.allclose(values[0, :], y0, atol=1e-3) | ||
assert ((y0 - error <= values[0, :]) & (values[0, :] <= y0 + error)).all() |
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.
How is this more careful / reliable than allclose
? Would adjusting the tolerance be sufficient?
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.
That part of the message was referring to the error
calculation. For short signals with high frequencies there is no strict guarantee that we'll get anything close to y0
. This checks that we at least got as close as we possibly could, by making sure it matches the available minimum (note each dimension will match either the lower or upper bound).
The initial state of all the signals are 0, and then suddenly at |
Ahh, I see what you're saying. Your system is underdamped, so that essentially high-frequency change creates problems. Personally, I would use |
I ran into a subtle issue with using
WhiteSignal
without a lowpass; you sometimes get a large infinite frequency at the start of the simulation. This can be problematic in some situations with principle 3 (can give details if needed). Settingy0=0
helps prevent this problem.