-
Notifications
You must be signed in to change notification settings - Fork 44
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
Correlation and indexing vectors when evaluating objective functions #1970
Comments
I think we can add both a subvector function and a time shift function to HCOM. Perhaps |
If possible, stealing some well known syntaxt would be nice. Such as matlab A(13:25) or numpy B[13:25]. |
Hmm, for time shifting, I think that this should already work, in plots you can add time shifts, that then affect all plot variables using that time vector in the same generation. But maybe its not possible to do so from HCOM, or maybe it only affects the plots. The following (needlessly complicated) command would shift the time vector by 5, for all time-domain variables with that particular Time variable. But I am not sure if that what was desired, or only to shift time for one particular variable ? @robbr48 oddly, the expression |
Implementing new operators such as () and [] will take some time, parenthesis are used in functions so brackets would be better. @robbr48 When you say tshift(vector, dt) does that mean to shift the data left or right or change the underlying time data. |
I think a time shift operator would need some consideration. When starting
to change time sync for individual signals it is easy to screw things up,
so I think manual indexing of vectors is sufficient for now. Time vectors
can be created manually anyway.
Den tis 18 aug. 2020 kl 21:46 skrev Peter Nordin <notifications@github.com>:
… Implementing new operators such as () and [] will take some time,
parenthesis are used in functions so brackets would be better.
Quicker to do subvec solution first. In this case for time-domain and
frequency-domain, a new subvec of the time or frequency vector would also
have to be created.
@robbr48 <https://github.com/robbr48> When you say tshift(vector, dt)
does that mean to shift the data left or right or change the underlying
time data.
I assume its the former, so that we do not affect all variables using that
time vector?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1970 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABRS3W6RBECJI4UB77PBECTSBLK7RANCNFSM4QBQFM2A>
.
|
@peterNordin Yes, we must of course not modify the time vector variable. Only the specified variable must be changed. I think a positive value of dt means shift to the right, but I'm not sure. @mrejster Operators would be nice, but is very non-HCOM. Compare e.g. with |
Is your improvement request related to a problem? Please describe.
When optimizing model with cyclical output, such as rockdrills, it is often useful to time-shift signals before comparing / matching. For example if I want to calculate an objective function based on the similarity of two piston location vectors. This could be done using Matlab etc by locating the time shfit using correlation, and then index the vectors appropriately. An (currently unsolvable?) issue arises when one wants to include such time shifts in an optimization in Hopsan.
Describe the solution you'd like
Either HCOM functionality to enable indexing of vectors, generating new vector based on indeces (such as A= B[10342:82739]). Or possibly by re-enabling the Python scripting environment, which I believe had such capabilities?
Describe alternatives you've considered
Currently, my best option is to add a time-shift parameter as an optimization parameter, letting it move the compared generation using a lookup table, and hoping for the best that Hopsan finds a good time shift value. This is much more computationally heavy than simply matching the signals before obj-function evaluation, and complicates the optimization.
Additional context
The text was updated successfully, but these errors were encountered: