Open mlincett opened 1 year ago
OK, the actual problem arises when something else than a scalar (for example a numpy array) is passed as scale
value.
I guess nobody would do that on purpose, but somehow this behaviour is triggered in our "LLH workshop" notebook, that requires very much a revision.
I guess this is now less urgent as a "bug", but a adding sanity check on the input will be beneficial.
P.S.: also, the construction of scale_range
should rather use np.zeros
and np.hstack
rather than converting array to lists back and forth.
I'm not sure how useful this is as a comment, but if I was starting flarestack from scratch, I would definitely replace the mh_dict/rh_dicts with pydantic models (https://docs.pydantic.dev/latest/). That would be a great way to enforce typing, validate the fields carefully to avoid cases like this, and generally ensure that the user is warned before executing code if the config is bad.
I also agree that the converting of lists <-> arrays is not good.
I'm not sure how useful this is as a comment, but if I was starting flarestack from scratch, I would definitely replace the mh_dict/rh_dicts with pydantic models (https://docs.pydantic.dev/latest/). That would be a great way to enforce typing, validate the fields carefully to avoid cases like this, and generally ensure that the user is warned before executing code if the config is bad.
I also agree that the converting of lists <-> arrays is not good.
I had the idea of converting the mh_dict
to something like a YAML configuration and handling transparently the generation of the analysis name/path.
I had heard (but also forgot, in the meantime) about pydantic
, it seems really cool so thanks for the heads up. Not sure if/when it will come to flarestack
but definitely something to have in the toolbox.
Under certain circumstances, flarestack is unable to build the array with scale ranges. For example with
n_steps=2
this happens:I suspect that when
linspace
returns a single element then the thing breaks. It may be argued thatn_steps=2
is not a very useful setting, but the UX here is far from being optimal. I will try to add some sanity checks here.