Skip to content

Commit

Permalink
move vector_2_abscissa to utils
Browse files Browse the repository at this point in the history
  • Loading branch information
ireaml committed Aug 18, 2023
1 parent 604861e commit 6b87785
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 35 deletions.
33 changes: 0 additions & 33 deletions macrodensity/density.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,39 +41,6 @@ def gradient_magnitude(gx: np.ndarray, gy: np.ndarray, gz: np.ndarray) -> np.nda
return grad_mag


def vector_2_abscissa(vector:list, magnitude: float, dx: float, dy: float, dz: float) -> np.ndarray:
"""
Convert a 3D vector to an array of abscissa values.
Parameters:
vector (list): 3D vector represented as (x, y, z).
magnitude (float): Magnitude of the vector.
dx (float): Spacing along the x-axis.
dy (float): Spacing along the y-axis.
dz (float): Spacing along the z-axis.
Returns:
np.ndarray: 1D array containing abscissa values based on the vector and spacing.
Example:
>>> vector = (1, 2, 3)
>>> magnitude = 5.0
>>> dx, dy, dz = 0.1, 0.2, 0.3
>>> abscissa_array = vector_2_abscissa(vector, magnitude, dx, dy, dz)
>>> print("Abscissa Array:")
>>> print(abscissa_array)
"""
vec_mag = np.linalg.norm([vector[0] * dx, vector[1] * dy, vector[2] * dz])
abscissa = [i * vec_mag for i in range(magnitude)]

return np.asarray(abscissa)


def number_in_field(gradients: np.ndarray, cutoff: float) -> int:
"""
Count the number of elements in a field that have a value greater than or equal to the cutoff.
Expand Down
3 changes: 1 addition & 2 deletions macrodensity/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
density_2_grid,
volume_average,
travelling_volume_average,
vector_2_abscissa,
)
from macrodensity.io import read_vasp_density, get_band_extrema
from macrodensity.utils import matrix_2_abc
from macrodensity.utils import matrix_2_abc, vector_2_abscissa


def bulk_interstitial_alignment(
Expand Down

0 comments on commit 6b87785

Please sign in to comment.