ubermag / help

Repository for raising issues and requesting help on Ubermag
BSD 2-Clause "Simplified" License
11 stars 3 forks source link

Viewing layers of a simulation with z in pixels not metres. #258

Closed jcl25 closed 11 months ago

jcl25 commented 11 months ago

If I want to view the result of a simulation in a layer 100 nm from the bottom, I type

system.m.z.plane(z = 100e-9).mpl.scalar()

But how do I view the plane 10 pixels from the bottom?

I could type something like

system.m.z.plane(z = mesh.index2point((0,0,10))[2]).mpl.scalar()

but it seems silly to convert a number of pixels into metres and then back into pixels. Is there a better way?

Also what happens if z is not a whole number of pixels? Does it interpolate between neighbouring planes?

samjrholt commented 11 months ago

The plane method only accepts a coordinate rather than an index so I think your suggestion is an appropriate solution.

In micromagnetics, the magnetisation value belongs to the whole cell (voxel) rather than just existing at the centre point of the cell. So by definition any point you select within a single cell will have the same value. Hence, no interpolation is needed and the value of whatever cell you are in is returned.