Skip to content

Commit

Permalink
turns out the datatype is called np.ndarray, not np.array
Browse files Browse the repository at this point in the history
  • Loading branch information
corinwagen committed Mar 27, 2020
1 parent 06c0189 commit c7f6ba1
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 15 deletions.
2 changes: 1 addition & 1 deletion cctk/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class OneIndexedArray(np.ndarray):
"""
Wrapper for ``np.array`` that's indexed from one, not zero, to store atomic numbers and geometries.
Wrapper for ``np.ndarray`` that's indexed from one, not zero, to store atomic numbers and geometries.
This only works on 1D or 2D arrays. Additionally, only the first index of a 2D array will be 1-indexed.
Note that ``enumerate(one_indexed_array)`` will throw ``IndexError`` -- instead, use ``enumerate(one_indexed_array, start=1)``.
Expand Down
4 changes: 2 additions & 2 deletions cctk/ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ class Ensemble:
Attributes:
name (str): name, for identification
molecules (np.array): list of `Molecule` objects
energies (np.array): list of energies
molecules (np.ndarray): list of `Molecule` objects
energies (np.ndarray): list of energies
"""

def __init__(self, name=None, **kwargs):
Expand Down
11 changes: 9 additions & 2 deletions cctk/helper_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def compute_rotation_matrix(axis, theta):
Adapted from user "unutbu" on StackExchange.
Args:
axis (vector): the vector to rotate about
axis (np.ndarray): the vector to rotate about
theta (float): how much to rotate (in degrees)
Returns:
Expand Down Expand Up @@ -270,7 +270,14 @@ def compute_RMSD(geometry1, geometry2):

def get_isotopic_distribution(z):
"""
For an element with number ``z``, returns two ``np.array`` objects containing that element's weights and relative abundances.
For an element with number ``z``, returns two ``np.ndarray`` objects containing that element's weights and relative abundances.
Args:
z (int): atomic number
Returns:
masses (np.ndarray): list of isotope masses
weights (np.ndarray): list of weights (relative to 1.00 for largest)
"""
z = str(z)
masses = list(ISOTOPE_DICTIONARY[z].keys())
Expand Down
4 changes: 2 additions & 2 deletions cctk/mae_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ def _read_mae(
print_status_messages (Bool):
Returns:
geometries (np.array): array of 3-tuples of geometries
symbols (np.array): array of atom symbols (str)
geometries (np.ndarray): array of 3-tuples of geometries
symbols (np.ndarray): array of atom symbols (str)
bonds (nx.Graph): ``NetworkX`` graph of bond information
property_names:
property_values:
Expand Down
10 changes: 5 additions & 5 deletions cctk/mol2_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,17 @@ def _read_mol2(
save_memory_for_conformers (bool): if True, the first dimension (geometry number) will be
dropped from the symbols and bonds to prevent
the storage of redundant information. Thus,
symbols will be a one-dimensional :obj:`np.array` of
:obj:`str` and bonds will be a single :obj:`nx.Graph`.
symbols will be a one-dimensional ``np.ndarray`` of
``str`` and bonds will be a single ``nx.Graph``.
print_status_messages (bool): if True, update the progerss of the parsing operation to stdout.
Returns:
all_geometries, all_clean_symbols, all_symbols, all_bonds, contains_conformers
all_geometries: np.array(geometry number, atom number, xyz) -> position (float)
all_clean_symbols: np.array(geometry number, atom number) -> atom symbol (:obj:`str`)
all_symbols: np.array(geometry number, atom number) -> atom symbol (:obj:`str`)
all_geometries: np.ndarray(geometry number, atom number, xyz) -> position (float)
all_clean_symbols: np.ndarray(geometry number, atom number) -> atom symbol (:obj:`str`)
all_symbols: np.ndarray(geometry number, atom number) -> atom symbol (:obj:`str`)
all_bonds: list(geometry_number) -> bond connectivity (:obj:`nx.Graph`)
contains_conformers: bool (True if the geometries correspond to conformers.)
"""
Expand Down
6 changes: 3 additions & 3 deletions cctk/molecule.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,9 +631,9 @@ def _recurse_through_formula(self, formula, masses, weights, cutoff=0.0000001, m
The default values should work nicely for low-res MS applications.
Args:
formula (np.array, dtype=np.int8): vector containing atoms left to incorporate
masses (np.array): list of mass fragments at current iteration
weights (np.array): relative weights at current iteration
formula (np.ndarray, dtype=np.int8): vector containing atoms left to incorporate
masses (np.ndarray): list of mass fragments at current iteration
weights (np.ndarray): relative weights at current iteration
cutoff (float): cutoff for similarity (masses within ``cutoff`` will be combined)
mass_precision (int): number of decimal places to store for mass
weight_precision (int): number of decimal places to store for weight
Expand Down

0 comments on commit c7f6ba1

Please sign in to comment.