Eomys/SciDataTool

[NF] Time axis to RPM axis conversion with RPM profile or tacho signal

mglesser opened this issue · 6 comments

When dealing with time signals measured on an accelerating motor or vehicle, it could be usefull to be able to plot data versus speed (RPM or km/h) instead of time. This could be achieved by adding a speed_profile argument to the DataTime object, containing the speed over time vector or the tacho signal over time. I can provide the function to go from the tacho signal to the speed profile.

I was thinking of a syntax using axis_data, which is a dict:
Field.get_along("time->rpm", axis_data={"rpm": convert_vector})

It would be a nice feature, if 'convert_vector' could also be a DataND obj. with respective axis and data.

I like you proposal. It would even be a dream if convert_vector could eventually be convert_function.

I'm thinking, for instance, about the acoustic Loudness that is computed over critical bands in Bark. Bark scale can be converted to frequency scale by using Bark=[(26.81f)/(1960+f)]-0.53. Using a function could avoid to store a second vector.

Functions should also be possible, adapting pyleecans 'lambda' - functions approach.

In the end I extended normalizations to deal with arrays instead of just floats, because axis_data would not have been practical for plots. So the conversion vector should be indicating in normalizations:
Time.normalizations = {"rpm": convert_vector}
before using get_along or a plot method:
Field.plot_2D_Data("time->rpm")

Concerning functions, it would be a very interesting feature. If the conversion function is always the same for a unit, as seems to be the case for Barks, I suggest implementing the function directly into the conversions function.

I leave the issue open for functions and Data objects.

A new family of Normalization objects has been defined in PR #56, which should solve this issue: now a normalization vector can be defined (Norm_vector), or a function (Norm_func).