Misc.

field.js

This module provides infrastructure for storing and manipulating 3D fields. By standardizing how field data is stored, marching cubes (or other surface computing algorithms) are easier to work with.

Field

Base class for dealing with scalar and vector field data

Args:
dimensions: {‘ox’: ox, ‘nx’: nx, ‘dxi’: dxi, ‘dxj’: dxj, ‘dxk’: dxk,
‘oy’: oy, ‘ny’: ny, ‘dyi’: dyi, ‘dyj’: dyj, ‘dyk’: dyk, ‘oz’: oz, ‘nz’: nz, ‘dzi’: dzi, ‘dzj’: dzj, ‘dzk’: dzk}
Note:
The dimensions argument can alternatively be {‘x’: xarray, ‘y’: yarray, ‘z’: zarray} if they have already been constructed but in this case the arrays should form cubic discrete points

update

Updates the field after establishing new x, y, z arrays

ScalarField

Representation of a scalar field.

num.js

Numerical utilities

fac2

hstack

Horizontally concatenate a list of arrays.

minspace

Creates a linearly spaced array with knowledge of the length, origin and spacing of the array.

Args:
min (number): origin space (number): spacing n (number): length of array

linspace

Create a linearly spaced array of the form [min, max] with n linearly spaced elements.

Args:
min (number): Starting number max (number): Ending number (inclusive) n (number): Number of elements
Returns:
array (array): Array of values

arange

meshgrid3d

From three discrete dimensions, create a set of 3d gridpoints

ellipsoid

sphere

torus

compute_field

gen_array

Generates discrete spatial points in space. Used to generate x, y, z spatial values for the cube field. In most cases, for the x basis vector, dy and dz are zero (“cube-like”).

================ utility.js ================ Helper functions used by custom notebook JS.

flatten_to_array ================== Flattens an array-like object into a 1-D Float32Array object.

Args:
obj (object): Array like object to be flattened

create_float_array_xyz ========================== Create a 1D array from 3D data.

repeat_float ================== Repeat a value n times.

repeat_float ================== Repeat a value n times.

repeat_object ============== Repeat an object n time.

mapper ——–