Rework methods taking an "axes" keyword
At the moment, there are a lot of routines which take an "axes" keyword, and in many of these, it could be avoided altogether or reduced to an integer.
Example 1: the "weight" method of DomainObject and derived classes
Here, axes
is mostly used to determine, which particular axes in a Field
belong to the space. In principle, all of this could be avoided if this method simply returned an array with one weight per pixel (or a scalar if all weights are equal), and leave all the juggling with array indices to Field.weight().
As things are, there are various alternative implementations of the re-shaping task (look for example at the weight
methods of PowerSpace
and GLSpace
).
My suggestion is to simplify DomainObject
's weight
method to:
def volfactor(self):
""" Returns an array containing the object's volume factors.
The array must be broadcastable to the space's dimensions
(useful if the volume factors are uniform in a direction, e.g. for GLSpace).
Alternatively, if all volume factors are equal, returns a scalar.
"""
... and leave all the operations involving powers, reshaping etc. to the calling Field.weight
method.
Example 2: Space.hermitianize_decomposition
():
Here the axes
variable always contains a tuple with as many entries as the space has dimensions, and the entries take the form i
, i+1
, i+2
, ... I suggest to pass a scalar integer with the name first_axis
instead, which should be less error-prone.
If there is agreement to go into this direction, there are more cases, but we can discuss them later :)