Loads a tensor fields given on a Cartesian grid stored in .jcm format.
- file_name (filepath) – path to a Cartesian fieldbag in .jcm format.
- format (str) –
format of the table after load.
Allowed values are: ‘squeeze’ (default) and ‘full’. For details the “Results”.
Dictionary with the following entries:
- ’X’, ‘Y’, ‘Z’ (numpy arrays):
x, y, z-coordinates of the Cartesian grid. Each
Zhas the shape
[nx, ny, nz], where
nzare the number of grid points in each direction.
X[ix, iy, iz]is the value of sampling vector in x-direction at position
0<=ix<nx, irrespective of
iz. Accordingly, we have
Y[ix, iy, iz]=y[iy]and
Z[ix, iy, iz]=z[iz]. For a Cartesian field in polar coordinates, XYZ arrays are changed to R, Theta and Phi holding the corresponding coordinate values.
- ’field’ (list of numpy arrays):
Fj=['field'][j]contains the field values of the (j+1)’th field of the fieldbag.
Fj[ix, iy, iz, k]gives the k’th field component at the point with coordinates
[x(ix), y(iy), z(iz)]of the (j+1)’th field.
- When ‘format’ is ‘squeeze’, singleton dimensions are removed accordingly to the commands
>>> X = X.squeeze() >>> Y = Y.squeeze() >>> Z = Z.squeeze() >>> Fj = Fj.squeeze()
Plot Cartesian fieldbag on xy-mesh. Real part of the z-component of the first field is plotted. (matplotlib required): >>> cfb = jcmwave.loadcartesianfields('./project_results/cartesian_xy.jcm'); >>> pcolormesh(cfb['X'], cfb['Y'], cfb['field'][:, :, 2].real, shading='gouraud')