fusion-flap/flap

merging features from non-equidist slice branch

Closed this issue · 2 comments

Some time ago I have made a branch of flap that had a few of features/small bug corrections. I have not yet merged them to the development branch, as I wanted to make sure that they are OK. Iwill try to merge this into the flap development branch. The changes are:

  • config.py: I added an 'evaluate' keyword to the get() function. If this is turned on then one can add e.g. dictionaries to the flap_defaults.cfg configs. They will be evaluated when the configuration is read and the get() function would return a dictionary (or whatever datatype they have) in this case.
  • dataobject.py There was a small issue with slicing as the coord_obj variable was not always defined in some off cases when I was slicing with dataobjects
  • dataobject.py The error approximation had a small error when using 'Mean' summing

I am currently running some final tests again and will upload it to the development branch if everything works

The changes in dataobject.py are fine.

In config.py the evaluation was actually in the code in a primitive way, interpret_config_value() was doing a subset of this, I was not aware that I can do it simply with the eval() function. I would just replace interpret_config_value() with eval(). I don't think we need the evaluate keyword as one can put a any sting in quotes if it should be interpreted as a string.

Please comment.

I did not think that having the "evaluation" keyword would cause confusion, as I expected the user to know whether the string they are reading from the config file should correspond to an interpretable command or not. But if we remove this keyword, I think it would be reasonable to just omit this feature from flap as I do not see the benefit for defining our own function that does the same as eval(). (In my opinion, the only benefit of having the "evaluation" keyword was being easy to remember and helping codes using flap to stay compact/readable. But I am not so sure anymore if this was actually needed.)