amep.utils#

Utility Methods#

The AMEP module amep.utils is a collection of various utility methods.

Functions

average_func(func, data[, skip, nr, indices])

Compute the average of a certain function.

compute_parallel(func, chunks, *args[, ...])

Calls the given function for all given chunks in parallel with a given number of parallel jobs.

detect2peaks(xdata, ydata[, nav, distance, ...])

Detects the two highest peaks in the given data after smoothing it with a running average.

dimension(coords[, verbose])

Returns the spatial dimension of simulation data.

domain_length(s_fac, q[, qmin, qmax])

Calculate the domain length from the structure factor.

envelope(f[, x])

Calculates the envelope of the data f by determining all local peaks of the data.

group_jobs(joblist, nworkers)

Groups the given jobs into groups of length nworkers.

in_box(coords, box_boundary[, values, ...])

Returns all coordinates in coords that are in the given simulation box boundaries (including the boundary).

in_circle(coords, radius[, center, values, ...])

Returns the coordinates/values for only particles inside or outside a circular/spherical region of a given radius and centered around a given center position.

kpeaks(Sxy, kx, ky[, a, dk, mode])

Calculates the wave vectors that correspond to the first peaks of the 2D structure factor.

log_indices(first, last[, num])

Creates logarithmically spaced indices.

mesh_to_coords(X, Y)

Converts positions in two-dimensional space given as a meshgrid into an array of two-dimensional position vectors of shape (N,2), where N is the total number of positions in the given meshgrid.

msd_from_vacf(vacf, times)

Calculates the mean square displacement from the integral of the velocity autocorrelation function.

optimal_chunksize(data_length, ...[, ...])

Estimates an optimal chunksize for limiting the RAM usage.

profile(coords, box_boundary, values[, ...])

Calculate the profile of given values.

rfft(data[, delta])

Real fast Fourier transform.

rotate_coords(coords, theta, center)

Rotates all coordinate vectors given in coords by the angle theta around the origin of the system given by center.

rotation(theta[, axis])

Rotation matrix in 3D for rotation around a certain axis.

runningmean(data, nav[, mode])

Compute the running mean of a 1-dimensional array.

runningmean2d(data, nav[, mode])

Computes the running mean of two-dimensional data, e.g., of a 2d density field.

segmented_mean(data, n[, verbose])

Compute the mean of n adjacent data points.

segmented_mean2d(data, n[, verbose])

Compute the mean of n*n adjacent data points.

spectrum(xdata, ydata)

Calculates the spectrum of one-dimensional real data by using fft.

sq_from_gr(r, gr, q, rho[, twod])

Compute the static structure factor as fourier transform of the pair correlation function.

sq_from_sf2d(S, Qx, Qy)

Calculates the isotropic static structure factor from the two-dimensional static structure factor by making a spherical average/radial mean.

traj_slice(N, skip, nr_averages)

Slicing object to slice a trajectory.

unit_vector_2D(theta)

Generates 2D unit vectors in the x-y plane with angle theta to the x axis.

unit_vector_3D(theta, phi)

Generates 3D unit vectors with components

upper_triangle(matrix[, diagonal, indices])

Returns the upper diagonal of a quadratic matrix.

weighted_runningmean(data, nav[, kernel, ...])

Compute the weighted running mean of a 1-dimensional array.

weighted_runningmean2d(data, nav[, kernel, ...])

Compute the running mean of two-dimensional data.