d-krupke / AlgBench

Experiment execution and result management for empirical evaluations of algorithms in Python.
https://algbench.readthedocs.io/
MIT License
4 stars 1 forks source link

JSON-support for daytime and np.arrays #16

Open Racopokemon opened 10 months ago

Racopokemon commented 10 months ago

Suggestion from Michael: Extend the json compatibility to daytime objects and np.arrays. Might be easily realized by providing a decoder and functionality to the json converter. Would this make for a useful addition?

d-krupke commented 10 months ago

Has my support. You may need to add an artificial entry with {"__type__": "Array"} or something similar for reading the data. Otherwise, you could of course just make a somehow easily readable type out of it. Currently, everything not in the right format will be converted to str.

I would recommend to implement this as a plugin in system, either with a register(type, DeEndcoder) or @encoder decorator. Do not just to a simple switch-case. This would also allow custom extensions. Custom extensions could also automatically be stored in a Python-file in the benchmark folder. E.g., allow the folder to contain a magic file that will be loaded when the benchmark is loaded and potentially registers the extensions.