Kraysent / OMTool

Modeling N-Body problem in galactic evolution application.
https://omtool.readthedocs.io/en/latest/
Apache License 2.0
0 stars 0 forks source link

Add fitting ability #84

Closed Kraysent closed 2 years ago

Kraysent commented 2 years ago

Let user fit the graph on the fly with arbitrary (or not) function.

Kraysent commented 2 years ago

It would be handy to log the parameters of the fit so this ability should probably be a part of tasks module rather than visualizer one.

Possible approaches:

  1. Make handler for this. Something like fit with parameters function_type, error and so on. The main question is what to do with the result. Handler may put it into the logger by itself but this would make it impossible to visualize immediately.
  2. The whole extra property of the task. If fit property is set, the result of task is sibstituted with the fitted function on the exact same points. This is better than previous point because it makes it possible to visualize the fit. The disadvantage of the approach is that if one wants to draw both fit and initial data, they need to recalculate task once again. Though this is the price for flexibility of approach.
  3. The generalization of the previous approach is some kind of middleware property of the task. When user wants to modify the output data of the task, they create middleware object that accepts data and outputs data in the same (or not?) format.
  4. Generalizing even more, user might want to modify the snapshot before the task (for example, take its slice), modify it after the task (for example, fit it into the function) and handle this data somewhere (for example, log and visualize it). All these processes may be done in their separate snaphot_hander, middleware, handler parts of the task.
Kraysent commented 2 years ago

Requires #104

Kraysent commented 2 years ago

Now fitting is as easy as creating action_after for fitting and modifiing the data there.