SRC¶
Functions written with numba, used under-the-hood by other functions in the library.
Particle to Grid¶
- fiesta.src.xgrids(xpix: ndarray, dx: int, xmin: int) ndarray¶
Returns the grid values along one axis for multiple indices.
- fiesta.src.which_pixs(x: ndarray, dx: float, xmin: float) ndarray¶
Find pixels along a defined grid for an array of points.
- fiesta.src.pix1dto2d(xpix: ndarray, ypix: ndarray, ygrid: int) ndarray¶
Maps pixels given along a single axis in x and y onto a flattened 2D grid.
- Parameters:
xpix (int array) – Pixel indices along the x-axis.
ypix (int array) – Pixel indices along the y-axis.
ygrid (int) – Length of the y-axis grid.
- Returns:
pix – Flattened 2D grid pixel indices.
- Return type:
ndarray
- fiesta.src.pix1dto3d(xpix: ndarray, ypix: ndarray, zpix: ndarray, ygrid: int, zgrid: int) ndarray¶
Maps pixels given along a single axis in x, y, and z onto a flattened 3D grid.
- Parameters:
- Returns:
pix – Flattened 3D grid pixel indices.
- Return type:
ndarray
- fiesta.src.periodic_pix(pix: ndarray, ngrid: int) ndarray¶
Applies periodic boundary conditions to pixel indices.
- Parameters:
pix (ndarray) – Pixel index array.
ngrid (int) – Grid dimensions.
- Returns:
Periodic pixel index array.
- Return type:
ndarray
- fiesta.src.tsc_pix(x: float, dx: float, xmin: float) ndarray¶
Triangular-shaped-cloud pixel indices.
- fiesta.src.weight_tsc(xp: float, xg: float, dl: float) float¶
Triangular-shaped-cloud (TSC) weights in 1D.
- fiesta.src.weight_pcs(xp: float, xg: float, dl: float) float¶
Piecewise-Cubic-Spline (PCS) weights in 1D.
- fiesta.src.part2grid_ngp_2d(x: ndarray, y: ndarray, f: ndarray, xlength: float, ylength: float, xmin: float, ymin: float, nxgrid: int, nygrid: int) ndarray¶
Nearest-grid-point assignment in 2D.
- Parameters:
x (array) – Cartesian coordinate system.
y (array) – Cartesian coordinate system.
f (array) – Field values are x & y coordinates.
xlength (float) – Length of the box along the x and y coordinates.
ylength (float) – Length of the box along the x and y coordinates.
xmin (float) – Minimum values along the x and y axis.
ymin (float) – Minimum values along the x and y axis.
nxgrid (int) – Number of grids along x and y coordinates.
nygrid (int) – Number of grids along x and y coordinates.
- Returns:
fgrid – NGP field assignments.
- Return type:
array
- fiesta.src.part2grid_cic_2d(x: ndarray, y: ndarray, f: ndarray, xlength: float, ylength: float, xmin: float, ymin: float, nxgrid: int, nygrid: int, periodx: bool, periody: bool) ndarray¶
Cloud-in-cell assignment in 2D.
- Parameters:
x (array) – Cartesian coordinate system.
y (array) – Cartesian coordinate system.
f (array) – Field values are x & y coordinates.
xlength (float) – Length of the box along the x and y coordinates.
ylength (float) – Length of the box along the x and y coordinates.
xmin (float) – Minimum values along the x and y axis.
ymin (float) – Minimum values along the x and y axis.
npart (int) – Number of x and y coordinates.
nxgrid (int) – Number of grids along x and y coordinates.
nygrid (int) – Number of grids along x and y coordinates.
periodx (bool) – Periodic boundary conditions.
periody (bool) – Periodic boundary conditions.
- Returns:
fgrid – CIC field assignments.
- Return type:
array
- fiesta.src.part2grid_tsc_2d(x: ndarray, y: ndarray, f: ndarray, xlength: float, ylength: float, xmin: float, ymin: float, nxgrid: int, nygrid: int, periodx: bool, periody: bool) ndarray¶
Triangular-shaped-cloud assignment in 2D.
- Parameters:
x (array) – Cartesian coordinate system.
y (array) – Cartesian coordinate system.
f (array) – Field values are x & y coordinates.
xlength (float) – Length of the box along the x and y coordinates.
ylength (float) – Length of the box along the x and y coordinates.
xmin (float) – Minimum values along the x and y axis.
ymin (float) – Minimum values along the x and y axis.
npart (int) – Number of x and y coordinates.
nxgrid (int) – Number of grids along x and y coordinates.
nygrid (int) – Number of grids along x and y coordinates.
periodx (bool) – Periodic boundary conditions.
periody (bool) – Periodic boundary conditions.
- Returns:
fgrid – TSC field assignments.
- Return type:
array
- fiesta.src.part2grid_pcs_2d(x: ndarray, y: ndarray, f: ndarray, xlength: float, ylength: float, xmin: float, ymin: float, nxgrid: int, nygrid: int, periodx: bool, periody: bool) ndarray¶
Piecewise-Cubic-Spline assignment in 2D.
- Parameters:
x (array) – Cartesian coordinate system.
y (array) – Cartesian coordinate system.
f (array) – Field values are x & y coordinates.
xlength (float) – Length of the box along the x and y coordinates.
ylength (float) – Length of the box along the x and y coordinates.
xmin (float) – Minimum values along the x and y axis.
ymin (float) – Minimum values along the x and y axis.
npart (int) – Number of x and y coordinates.
nxgrid (int) – Number of grids along x and y coordinates.
nygrid (int) – Number of grids along x and y coordinates.
periodx (bool) – Periodic boundary conditions.
periody (bool) – Periodic boundary conditions.
- Returns:
fgrid – TSC field assignments.
- Return type:
array
- fiesta.src.part2grid_ngp_3d(x: ndarray, y: ndarray, z: ndarray, f: ndarray, xlength: float, ylength: float, zlength: float, xmin: float, ymin: float, zmin: float, nxgrid: int, nygrid: int, nzgrid: int) ndarray¶
Nearest-grid-point assignment in 3D.
- Parameters:
x (array) – Cartesian coordinate system.
y (array) – Cartesian coordinate system.
z (array) – Cartesian coordinate system.
f (array) – Field values are x, y and z coordinates.
xlength (float) – Length of the box along the x, y and z coordinates.
ylength (float) – Length of the box along the x, y and z coordinates.
zlength (float) – Length of the box along the x, y and z coordinates.
xmin (float) – Minimum values along the x, y and z axis.
ymin (float) – Minimum values along the x, y and z axis.
zmin (float) – Minimum values along the x, y and z axis.
npart (int) – Number of x, y and z coordinates.
nxgrid (int) – Number of grids along x, y and z coordinates.
nygrid (int) – Number of grids along x, y and z coordinates.
nzgrid (int) – Number of grids along x, y and z coordinates.
- Returns:
fgrid – NGP field assignments.
- Return type:
array
- fiesta.src.part2grid_cic_3d(x: ndarray, y: ndarray, z: ndarray, f: ndarray, xlength: float, ylength: float, zlength: float, xmin: float, ymin: float, zmin: float, nxgrid: int, nygrid: int, nzgrid: int, periodx: bool, periody: bool, periodz: bool) ndarray¶
Cloud-in-cell assignment in 3D.
- Parameters:
x (array) – Cartesian coordinate system.
y (array) – Cartesian coordinate system.
z (array) – Cartesian coordinate system.
f (array) – Field values are x, y & z coordinates.
xlength (float) – Length of the box along the x, y & z coordinates.
ylength (float) – Length of the box along the x, y & z coordinates.
zlength (float) – Length of the box along the x, y & z coordinates.
xmin (float) – Minimum values along the x, y & z axis.
ymin (float) – Minimum values along the x, y & z axis.
nxgrid (int) – Number of grids along x, y & z coordinates.
nygrid (int) – Number of grids along x, y & z coordinates.
periodx (bool) – Periodic boundary conditions.
periody (bool) – Periodic boundary conditions.
periodz (bool) – Periodic boundary conditions.
- Returns:
fgrid – CIC field assignments.
- Return type:
array
- fiesta.src.part2grid_tsc_3d(x: ndarray, y: ndarray, z: ndarray, f: ndarray, xlength: float, ylength: float, zlength: float, xmin: float, ymin: float, zmin: float, nxgrid: int, nygrid: int, nzgrid: int, periodx: bool, periody: bool, periodz: bool) ndarray¶
Triangular-shaped-cloud assignment in 3D.
- Parameters:
x (array) – Cartesian coordinate system.
y (array) – Cartesian coordinate system.
z (array) – Cartesian coordinate system.
f (array) – Field values are x, y & z coordinates.
xlength (float) – Length of the box along the x, y & z coordinates.
ylength (float) – Length of the box along the x, y & z coordinates.
zlength (float) – Length of the box along the x, y & z coordinates.
xmin (float) – Minimum values along the x, y & z axis.
ymin (float) – Minimum values along the x, y & z axis.
zmin (float) – Minimum values along the x, y & z axis.
nxgrid (int) – Number of grids along x, y & z coordinates.
nygrid (int) – Number of grids along x, y & z coordinates.
nzgrid (int) – Number of grids along x, y & z coordinates.
periodx (bool) – Periodic boundary conditions.
periody (bool) – Periodic boundary conditions.
periodz (bool) – Periodic boundary conditions.
- Returns:
fgrid – TSC field assignments.
- Return type:
array
- fiesta.src.part2grid_pcs_3d(x: ndarray, y: ndarray, z: ndarray, f: ndarray, xlength: float, ylength: float, zlength: float, xmin: float, ymin: float, zmin: float, nxgrid: int, nygrid: int, nzgrid: int, periodx: bool, periody: bool, periodz: bool) ndarray¶
Piecewise-Cubic-Spline assignment in 3D.
- Parameters:
x (array) – Cartesian coordinate system.
y (array) – Cartesian coordinate system.
z (array) – Cartesian coordinate system.
f (array) – Field values are x, y & z coordinates.
xlength (float) – Length of the box along the x, y & z coordinates.
ylength (float) – Length of the box along the x, y & z coordinates.
zlength (float) – Length of the box along the x, y & z coordinates.
xmin (float) – Minimum values along the x, y & z axis.
ymin (float) – Minimum values along the x, y & z axis.
zmin (float) – Minimum values along the x, y & z axis.
nxgrid (int) – Number of grids along x, y & z coordinates.
nygrid (int) – Number of grids along x, y & z coordinates.
nzgrid (int) – Number of grids along x, y & z coordinates.
periodx (bool) – Periodic boundary conditions.
periody (bool) – Periodic boundary conditions.
periodz (bool) – Periodic boundary conditions.
- Returns:
fgrid – PCS field assignments.
- Return type:
array
Bi/Trilinear Interpolation¶
- fiesta.src.bilinear_periodic(fgrid: ndarray, x: ndarray, y: ndarray, xbox: float, ybox: float, ngridx: int, ngridy: int) ndarray¶
Bilinear interpolation of field defined on a grid.
- Parameters:
fgrid (array) – Field values on the grid.
x (array) – X coordinates where we need interpolated values.
y (array) – Y coordinates where we need interpolated values.
xbox (float) – Size of the box.
ybox (float) – Size of the box.
ngridx (int) – Size of the grid alone each axes.
ngridy (int) – Size of the grid alone each axes.
- Returns:
f – Interpolated field values.
- Return type:
array
- fiesta.src.bilinear_nonperiodic(fgrid: ndarray, x: ndarray, y: ndarray, xbox: float, ybox: float, ngridx: int, ngridy: int) ndarray¶
Bilinear interpolation of field defined on a grid.
- Parameters:
fgrid (array) – Field values on the grid.
x (array) – X coordinates where we need interpolated values.
y (array) – Y coordinates where we need interpolated values.
xbox (float) – Size of the box.
ybox (float) – Size of the box.
ngridx (int) – Size of the grid alone each axis.
ngridy (int) – Size of the grid alone each axis.
- Returns:
f – Interpolated field values.
- Return type:
array
- fiesta.src.bilinear_axisperiodic(fgrid: ndarray, x: ndarray, y: ndarray, xbox: float, ybox: float, perix: int, periy: int, ngridx: int, ngridy: int) ndarray¶
Bilinear interpolation of a field defined on a grid with axis-periodic conditions.
- Parameters:
fgrid (array) – Field values on the grid (1D flattened array).
x (arrays) – Coordinates where interpolation is needed.
y (arrays) – Coordinates where interpolation is needed.
xbox (float) – Size of the domain in x and y directions.
ybox (float) – Size of the domain in x and y directions.
perix (int) – Flags indicating periodicity along each axis (1 = periodic, 0 = non-periodic).
periy (int) – Flags indicating periodicity along each axis (1 = periodic, 0 = non-periodic).
ngridx (int) – Grid resolution along each axis.
ngridy (int) – Grid resolution along each axis.
- Returns:
f – Interpolated field values at given (x, y) locations.
- Return type:
array
- fiesta.src.trilinear_periodic(fgrid: ndarray, x: ndarray, y: ndarray, z: ndarray, xbox: float, ybox: float, zbox: float, ngridx: int, ngridy: int, ngridz: int) ndarray¶
Trilinear interpolation of field defined on a grid.
- Parameters:
fgrid (array) – Field values on the grid.
x (array) – X coordinates where we need interpolated values.
y (array) – Y coordinates where we need interpolated values.
z (array) – Z coordinates where we need interpolated values.
xbox (float) – Size of the box.
ybox (float) – Size of the box.
zbox (float) – Size of the box.
ngridx (int) – Size of the grid along each axis.
ngridy (int) – Size of the grid along each axis.
ngridz (int) – Size of the grid along each axis.
npart (int) – Number of particles.
- Returns:
f – Interpolated field values.
- Return type:
array
- fiesta.src.trilinear_nonperiodic(fgrid: ndarray, x: ndarray, y: ndarray, z: ndarray, xbox: float, ybox: float, zbox: float, ngridx: int, ngridy: int, ngridz: int) ndarray¶
Trilinear interpolation of field defined on a grid.
- Parameters:
fgrid (array) – Field values on the grid.
x (array) – X coordinates where we need interpolated values.
y (array) – Y coordinates where we need interpolated values.
z (array) – Z coordinates where we need interpolated values.
xbox (float) – Size of the box.
ybox (float) – Size of the box.
zbox (float) – Size of the box.
ngridx (int) – Size of the grid along each axis.
ngridy (int) – Size of the grid along each axis.
ngridz (int) – Size of the grid along each axis.
- Returns:
f – Interpolated field values.
- Return type:
array
- fiesta.src.trilinear_axisperiodic(fgrid: ndarray, x: ndarray, y: ndarray, z: ndarray, xbox: float, ybox: float, zbox: float, perix: int, periy: int, periz: int, ngridx: int, ngridy: int, ngridz: int) ndarray¶
Trilinear interpolation of field defined on a grid.
- Parameters:
fgrid (array) – Field values on the grid.
x (array) – X coordinates where we need interpolated values.
y (array) – Y coordinates where we need interpolated values.
z (array) – Z coordinates where we need interpolated values.
xbox (float) – Size of the box.
ybox (float) – Size of the box.
zbox (float) – Size of the box.
perix (int) – 0 = non-periodic, 1 = periodic
periy (int) – 0 = non-periodic, 1 = periodic
periz (int) – 0 = non-periodic, 1 = periodic
ngridx (int) – Size of the grid along each axis.
ngridy (int) – Size of the grid along each axis.
ngridz (int) – Size of the grid along each axis.
- Returns:
f – Interpolated field values.
- Return type:
array
Delaunay Functions¶
- fiesta.src.triangle_area(xa: float, ya: float, xb: float, yb: float, xc: float, yc: float) float¶
Determines the area of a triangle given its vertex coordinates.
- Parameters:
xa (float) – X-axis coordinate for point A of the triangle.
ya (float) – Y-axis coordinate for point A of the triangle.
xb (float) – X-axis coordinate for point B of the triangle.
yb (float) – Y-axis coordinate for point B of the triangle.
xc (float) – X-axis coordinate for point C of the triangle.
yc (float) – Y-axis coordinate for point C of the triangle.
- Yields:
Area of the triangle.
- fiesta.src.sum_triangle_area(xas: ndarray, yas: ndarray, xbs: ndarray, ybs: ndarray, xcs: ndarray, ycs: ndarray) ndarray¶
Computes the total area of multiple triangles.
- Parameters:
xas (array) – X-axis coordinates for point A of the triangles.
yas (array) – Y-axis coordinates for point A of the triangles.
xbs (array) – X-axis coordinates for point B of the triangles.
ybs (array) – Y-axis coordinates for point B of the triangles.
xcs (array) – X-axis coordinates for point C of the triangles.
ycs (array) – Y-axis coordinates for point C of the triangles.
- Returns:
total_area – Area for each triangle.
- Return type:
array
- fiesta.src.tetrahedron_volume(xa: float, ya: float, za: float, xb: float, yb: float, zb: float, xc: float, yc: float, zc: float, xd: float, yd: float, zd: float) float¶
Computes the volume of a tetrahedron from its vertices using the determinant method.
- Parameters:
xa (float) – Coordinates of point A.
ya (float) – Coordinates of point A.
za (float) – Coordinates of point A.
xb (float) – Coordinates of point B.
yb (float) – Coordinates of point B.
zb (float) – Coordinates of point B.
xc (float) – Coordinates of point C.
yc (float) – Coordinates of point C.
zc (float) – Coordinates of point C.
xd (float) – Coordinates of point D.
yd (float) – Coordinates of point D.
zd (float) – Coordinates of point D.
- Returns:
Volume of the tetrahedron.
- Return type:
- fiesta.src.voronoi_2d_area(xpoints: ndarray, ypoints: ndarray, xverts: ndarray, yverts: ndarray, ridge_point1: ndarray, ridge_point2: ndarray, ridge_vertices: ndarray, ridge_start: ndarray, ridge_end: ndarray) ndarray¶
Determines the area of the voronoi cells.
- Parameters:
xpoints (array) – X-coordinates for the points.
ypoints (array) – Y-coordinates for the points.
xverts (array) – X-coordinates for the voronoi vertices.
yverts (array) – Y-coordinates for the voronoi vertices.
ridge_points1 (array) – The points on either side of a voronoi ridge.
ridge_points2 (array) – The points on either side of a voronoi ridge.
ridge_vertices (array) – The index of the vertices on the ridge.
ridge_start (array) – Index in ridge vertex which specifies the start of vertices that make up a single ridge.
ridge_end (array) – Index in ridge vertex which specifies the end of vertices that make up a single ridge.
- Returns:
area – The area of each voronoi cell.
- Return type:
array
- fiesta.src.voronoi_3d_volume(xpoints: ndarray, ypoints: ndarray, zpoints: ndarray, xverts: ndarray, yverts: ndarray, zverts: ndarray, ridge_point1: ndarray, ridge_point2: ndarray, ridge_vertices: ndarray, ridge_start: ndarray, ridge_end: ndarray) ndarray¶
Determines the volume of the voronoi cells.
- Parameters:
xpoints (array) – X-coordinates for the points.
ypoints (array) – Y-coordinates for the points.
zpoints (array) – Z-coordinates for the points.
xverts (array) – X-coordinates for the voronoi vertices.
yverts (array) – Y-coordinates for the voronoi vertices.
zverts (array) – Z-coordinates for the voronoi vertices.
ridge_points1 (array) – The points on either side of a voronoi ridge.
ridge_points2 (array) – The points on either side of a voronoi ridge.
ridge_vertices (array) – The index of the vertices on the ridge.
ridge_start (array) – Index in ridge vertex which specifies the start of vertices that make up a single ridge.
ridge_end (array) – Index in ridge vertex which specifies the end of vertices that make up a single ridge.
- Returns:
volume – The volume of each voronoi cell.
- Return type:
array
- fiesta.src.delaunay_area_2d(x: ndarray, y: ndarray, del_vert0: ndarray, del_vert1: ndarray, del_vert2: ndarray) ndarray¶
Determines area for each simplex.
- Parameters:
x (array) – X-coordinates.
y (array) – Y-coordinates.
del_vert0 (array) – Index for vertex 0 of each simplices.
del_vert1 (array) – Index for vertex 1 of each simplices.
del_vert2 (array) – Index for vertex 2 of each simplices.
- Returns:
areas – The areas of each simplex.
- Return type:
array
- fiesta.src.sum_delaunay_area_4_points_2d(delaunay_area: ndarray, del_vert0: ndarray, del_vert1: ndarray, del_vert2: ndarray, npart: int) ndarray¶
Finds the Delaunay area for each point.
- Parameters:
delaunay_area (array) – Delaunay area.
del_vert0 (array) – Index for vertex 0 of each simplices.
del_vert1 (array) – Index for vertex 1 of each simplices.
del_vert2 (array) – Index for vertex 2 of each simplices.
npart (int) – Number of points.
- Returns:
point_area – Delaunay area for each point.
- Return type:
array
- fiesta.src.get_delf0_2d(x: ndarray, y: ndarray, f: ndarray, del_vert0: ndarray, del_vert1: ndarray, del_vert2: ndarray) ndarray¶
Determines delf0 for each simplices.
- Parameters:
x (array) – X-coordinates.
y (array) – Y-coordinates.
f (array) – Field values at these points.
del_vert0 (array) – Index for vertex 0 of each simplices.
del_vert1 (array) – Index for vertex 1 of each simplices.
del_vert2 (array) – Index for vertex 2 of each simplices.
- Returns:
delf0 – The 2D difference in each simplices.
- Return type:
array
- fiesta.src.delaunay_estimate_2d(simplices: ndarray, x: ndarray, y: ndarray, x0: ndarray, y0: ndarray, f0: ndarray, delf0: ndarray) ndarray¶
Estimates a field from Delaunay tesselation.
- Parameters:
simplices (array)
x (array) – X-coordinates for estimates.
y (array) – Y-coordinates for estimates.
x0 (array) – X-coordinate of vertex 0 of each simplices.
y0 (array) – Y-coordinate of vertex 0 of each simplices.
f0 (array) – Field values at vertex 0 of each simplices.
delf0 (array) – The 2D difference in each simplices.
- Returns:
f_est – Estimates of the field.
- Return type:
array
- fiesta.src.delaunay_volume_3d(x: ndarray, y: ndarray, z: ndarray, del_vert0: ndarray, del_vert1: ndarray, del_vert2: ndarray, del_vert3: ndarray) ndarray¶
Determines the volume for each simplex.
- Parameters:
x (array) – X-coordinates.
y (array) – Y-coordinates.
z (array) – Z-coordinates.
del_vert0 (array) – Index for vertex 0 of each simplices.
del_vert1 (array) – Index for vertex 1 of each simplices.
del_vert2 (array) – Index for vertex 2 of each simplices.
del_vert3 (array) – Index for vertex 3 of each simplices.
- Returns:
volumes – The volumes of each simplex.
- Return type:
array
- fiesta.src.sum_delaunay_vol_4_points_3d(delaunay_vol: ndarray, del_vert0: ndarray, del_vert1: ndarray, del_vert2: ndarray, del_vert3: ndarray, npart: int) ndarray¶
Finds the Delaunay volume for each point.
- Parameters:
delaunay_vol (array) – Delaunay volumes.
del_vert0 (array) – Index for vertex 0 of each simplices.
del_vert1 (array) – Index for vertex 1 of each simplices.
del_vert2 (array) – Index for vertex 2 of each simplices.
npart (int) – Number of points.
- Returns:
point_vol – Sum of delaunay value for each point.
- Return type:
array
- fiesta.src.get_delf0_3d(x: ndarray, y: ndarray, z: ndarray, f: ndarray, del_vert0: ndarray, del_vert1: ndarray, del_vert2: ndarray, del_vert3: ndarray) ndarray¶
Determines delf0 for each simplices.
- Parameters:
x (array) – X-coordinates.
y (array) – Y-coordinates.
z (array) – Z-coordinates.
f (array) – Field values at these points.
del_vert0 (array) – Index for vertex 0 of each simplices.
del_vert1 (array) – Index for vertex 1 of each simplices.
del_vert2 (array) – Index for vertex 2 of each simplices.
del_vert3 (array) – Index for vertex 3 of each simplices.
- Returns:
delf0 – The 3D difference in each simplices.
- Return type:
array
- fiesta.src.delaunay_estimate_3d(simplices: ndarray, x: ndarray, y: ndarray, z: ndarray, x0: ndarray, y0: ndarray, z0: ndarray, f0: ndarray, delf0: ndarray) ndarray¶
Estimates a field from Delaunay tesselation.
- Parameters:
x (array) – X-coordinates for estimates.
y (array) – Y-coordinates for estimates.
z (array) – Z-coordinates for estimates.
x0 (array) – X-coordinate of vertex 0 of each simplices.
y0 (array) – Y-coordinate of vertex 0 of each simplices.
z0 (array) – Z-coordinate of vertex 0 of each simplices.
f0 (array) – Field values at vertex 0 of each simplices.
delf0 (array) – The 3D difference in each simplices.
- Returns:
f_est – Estimates of the field.
- Return type:
array
Matrices¶
- fiesta.src.inv2by2(m: ndarray) ndarray¶
Invert a 2x2 matrix.
- Parameters:
m (array-like (4,)) – 2x2 matrix stored in row-major order.
- Returns:
invm – 2x2 inverse matrix.
- Return type:
array (4,)
- fiesta.src.inv3by3(m: ndarray) ndarray¶
Invert a 3x3 matrix.
- Parameters:
m (array-like (9,)) – 3x3 matrix stored in row-major order.
- Returns:
invm – 3x3 inverse matrix.
- Return type:
array (9,)
- fiesta.src.eig2by2(m: ndarray) ndarray¶
Compute the eigenvalues of a 2x2 matrix.
- Parameters:
m (array-like (4,)) – 2x2 matrix stored in row-major order.
- Returns:
eig – Eigenvalues sorted in ascending order.
- Return type:
array (2,)
- fiesta.src.symeig3by3(m: ndarray) ndarray¶
Compute the eigenvalues of a 3x3 symmetric matrix.
- Parameters:
m (array-like (9,)) – 3x3 symmetric matrix stored in row-major order.
- Returns:
eig – Eigenvalues sorted in ascending order.
- Return type:
array (3,)
Differentiation¶
- fiesta.src.dfdx_1d_periodic(f: ndarray, boxsize: float) ndarray¶
Numerical differentiation assuming a uniform grid with periodic boundaries in 1D.
- Parameters:
f (array) – Field values on the grid.
boxsize (float) – Size of the grid.
- Returns:
df – Differentiated function along x.
- Return type:
array
- fiesta.src.dfdx_2d_periodic(f: ndarray, xboxsize: float, nxgrid: int, nygrid: int) ndarray¶
Numerical differentiation in x assuming a uniform grid with periodic boundaries in 2D.
- fiesta.src.dfdy_2d_periodic(f: ndarray, yboxsize: float, nxgrid: int, nygrid: int)¶
Numerical differentiation in y assuming a uniform grid with periodic boundaries in 2D.
- fiesta.src.dfdx_3d_periodic(f: ndarray, xboxsize: float, nxgrid: int, nygrid: int, nzgrid: int) ndarray¶
Numerical differentiation in x assuming a uniform grid with periodic boundaries in 3D.
- Parameters:
- Returns:
df – Differentiated function along x.
- Return type:
array
- fiesta.src.dfdy_3d_periodic(f: ndarray, yboxsize: float, nxgrid: int, nygrid: int, nzgrid: int) ndarray¶
Numerical differentiation in x assuming a uniform grid with periodic boundaries in 3D.
- Parameters:
- Returns:
df – Differentiated function along x.
- Return type:
array
GridSPH¶
- fiesta.src.sum_from_integral_image_2D(igrid: ndarray, ixmin: int, ixmax: int, iymin: int, iymax: int, xperiodic: bool = True, yperiodic: bool = True) ndarray¶
Quick summations from an integral image in 2D.
- Parameters:
- Yields:
The sum of the integral image within a rectangle.
- fiesta.src.sum_from_integral_image_3D(igrid: ndarray, ixmin: int, ixmax: int, iymin: int, iymax: int, izmin: int, izmax: int, xperiodic: bool = True, yperiodic: bool = True, zperiodic: bool = True) ndarray¶
Quick summations from an integral image in 3D.
- Parameters:
igrid (array) – Integral image in 3D.
ixmin (int) – Minimum grid value along the x grid.
ixmax (int) – Maximum grid value along the x grid.
iymin (int) – Minimum grid value along the y grid.
iymax (int) – Maximum grid value along the y grid.
izmin (int) – Minimum grid value along the z grid.
izmax (int) – Maximum grid value along the z grid.
xperiodic (bool, optional) – Periodic boundary condition along the x grid.
yperiodic (bool, optional) – Periodic boundary condition along the y grid.
zperiodic (bool, optional) – Periodic boundary condition along the z grid.
- Yields:
The sum of the integral image within a rectangle.
- fiesta.src.get_volume_enclosing_box_2D(xboxsize: float, yboxsize: float, dgrid: ndarray, idgrid: ndarray, minpart: int, xperiodic: bool = True, yperiodic: bool = True, ifgrid: ndarray | None = None) ndarray¶
Get the volume for an enclosing box containing minpart number of particles.
- Parameters:
boxsize (float) – Size of the 2D grid.
ngrid (int) – Grid size.
dgrid (array) – The 2D density field grid.
idgrid (array) – The 2D density field integral image.
minpart (int) – Minimum number of particles.
periodic (bool, optional) – Periodic boundary condition.
ifgrid (array) – Field integral image. If not None, then the field will be estimate via the volume enclosing box method.
- Returns:
vgrid – The 2D volume enclosing box for density estimation.
- Return type:
array
- fiesta.src.get_volume_enclosing_box_3D(xboxsize: float, yboxsize: float, zboxsize: float, dgrid: ndarray, idgrid: ndarray, minpart: int, xperiodic: bool = True, yperiodic: bool = True, zperiodic: bool = True, ifgrid: ndarray | None = None) ndarray¶
Get the volume for an enclosing box containing minpart number of particles.
- Parameters:
boxsize (float) – Size of the 3D grid.
dgrid (array) – The 3D density field grid.
idgrid (array) – The 3D density field integral image.
minpart (int) – Minimum number of particles.
periodic (bool, optional) – Periodic boundary condition.
ifgrid (array) – Field integral image. If not None, then the field will be estimate via the volume enclosing box method.
- Returns:
vgrid – The 3D volume enclosing box for density estimation.
- Return type:
array