createField() produces misleading error if simextent=True
stetie opened this issue · comments
I'm using the current postpic master 69fbf8c
I've loaded a simulation with particles and ms
is a MultiSpecies
object on a particle species.
If I run
x = ms.createField('px', 'py')
everything works as expected. But
x = ms.createField('px', 'py', simextent=True)
gives a error message
postpic/datareader/epochsdf.py in simextent(self, axis)
168 extents = m.extents
169 dims = len(m.dims)
--> 170 axid = helper.axesidentify[axis]
171 return np.array([extents[axid], extents[axid + dims]])
172KeyError: 'px'
which is totally misleading. It took me 1.5h and a hint from @Ablinne to figure out that the simextent
option is incompatible with the new interface.
I strongly suggest that either simextent
is ignored if it's used with incompatible options, or at the very least a sensible error message should be provided to the user.
Thanks for the report! I will need to investigate and fix or remove it, but not during the next few weeks.
I was just looking into this and realizing, that the simextent
option does not make any sense for px
nor py
. simextent
shall force the created field to match the extent of the simulationbox. But within a PIC only x
, y
, and z
actually have a properly bound domain which is the simulationbox. px
, py
or pz
are unbound. Therefore simextent=True
fails to retrieve the min and max values for px
. So it actually does what it should.
But I agree that the error message is not helpful at all. I need to figure out how to deal with that best. Ideas are welcome!
@skuschel Yes, that seems like a good solution. Thanks!