deepmd.tf.utils.path
Alias for backward compatibility.
Module Contents
- class deepmd.tf.utils.path.DPH5Path(path: str, mode: str = 'r')[source]
Bases: DPPath
The path class to data system (DeepmdData) for HDF5 files.
- Parameters:
- path
str path
- mode
str, optional mode, by default “r”
Notes
- OS - HDF5 relationship:
directory - Group file - Dataset
- mode = 'r'
- root_path
- root
- _name
- classmethod _load_h5py(path: str, mode: str = 'r') → h5py.File[source]
Load hdf5 file.
- Parameters:
- path
str path to hdf5 file
- mode
str, optional mode, by default ‘r’
- load_numpy() → numpy.ndarray[source]
Load NumPy array.
- Returns:
np.ndarrayloaded NumPy array
- load_txt(dtype: numpy.dtype | None = None, **kwargs) → numpy.ndarray[source]
Load NumPy array from text.
- Returns:
np.ndarrayloaded NumPy array
- save_numpy(arr: numpy.ndarray) → None[source]
Save NumPy array.
- Parameters:
- arr
np.ndarray NumPy array
- glob(pattern: str) → list[DPPath][source]
Search path using the glob pattern.
- Parameters:
- pattern
str glob pattern
- Returns:
list[DPPath]list of paths
- rglob(pattern: str) → list[DPPath][source]
This is like calling DPPath.glob() with **/ added in front of the given relative pattern.
- Parameters:
- pattern
str glob pattern
- Returns:
list[DPPath]list of paths
- property _keys: list[str]
Walk all groups and dataset.
- __file_new_keys: ClassVar[dict[h5py.File, list[str]]]
- property _new_keys
New keys that haven’t been cached.
- classmethod _file_keys(file: h5py.File) → list[str][source]
Walk all groups and dataset.
- is_file() → bool[source]
Check if self is file.
- is_dir() → bool[source]
Check if self is directory.
- __truediv__(key: str) → DPPath[source]
Used for / operator.
- _connect_path(path: str) → str[source]
Connect self with path.
- __lt__(other: DPH5Path) → bool[source]
Whether this DPPath is less than other for sorting.
- __str__() → str[source]
Returns path of self.
- property name: str
Name of the path.
- mkdir(parents: bool = False, exist_ok: bool = False) → None[source]
Make directory.
- Parameters:
- parentsbool,
optional If true, any missing parents of this directory are created as well.
- exist_okbool,
optional If true, no error will be raised if the target directory already exists.
- class deepmd.tf.utils.path.DPOSPath(path: str | pathlib.Path, mode: str = 'r')[source]
Bases: DPPath
The OS path class to data system (DeepmdData) for real directories.
- Parameters:
- path
Union[str, Path] path
- mode
str, optional mode, by default “r”
- mode = 'r'
- path
- load_numpy() → numpy.ndarray[source]
Load NumPy array.
- Returns:
np.ndarrayloaded NumPy array
- load_txt(**kwargs) → numpy.ndarray[source]
Load NumPy array from text.
- Returns:
np.ndarrayloaded NumPy array
- save_numpy(arr: numpy.ndarray) → None[source]
Save NumPy array.
- Parameters:
- arr
np.ndarray NumPy array
- glob(pattern: str) → list[DPPath][source]
Search path using the glob pattern.
- Parameters:
- pattern
str glob pattern
- Returns:
list[DPPath]list of paths
- rglob(pattern: str) → list[DPPath][source]
This is like calling DPPath.glob() with **/ added in front of the given relative pattern.
- Parameters:
- pattern
str glob pattern
- Returns:
list[DPPath]list of paths
- is_file() → bool[source]
Check if self is file.
- is_dir() → bool[source]
Check if self is directory.
- __truediv__(key: str) → DPPath[source]
Used for / operator.
- __lt__(other: DPOSPath) → bool[source]
Whether this DPPath is less than other for sorting.
- __str__() → str[source]
Represent string.
- property name: str
Name of the path.
- mkdir(parents: bool = False, exist_ok: bool = False) → None[source]
Make directory.
- Parameters:
- parentsbool,
optional If true, any missing parents of this directory are created as well.
- exist_okbool,
optional If true, no error will be raised if the target directory already exists.
- class deepmd.tf.utils.path.DPPath[source]
Bases: abc.ABC
The path class to data system (DeepmdData).
- Parameters:
- path
str path
- mode
str, optional mode, by default “r”
- abstract load_numpy() → numpy.ndarray[source]
Load NumPy array.
- Returns:
np.ndarrayloaded NumPy array
- abstract load_txt(**kwargs) → numpy.ndarray[source]
Load NumPy array from text.
- Returns:
np.ndarrayloaded NumPy array
- abstract save_numpy(arr: numpy.ndarray) → None[source]
Save NumPy array.
- Parameters:
- arr
np.ndarray NumPy array
- abstract glob(pattern: str) → list[DPPath][source]
Search path using the glob pattern.
- Parameters:
- pattern
str glob pattern
- Returns:
list[DPPath]list of paths
- abstract rglob(pattern: str) → list[DPPath][source]
This is like calling DPPath.glob() with **/ added in front of the given relative pattern.
- Parameters:
- pattern
str glob pattern
- Returns:
list[DPPath]list of paths
- abstract is_file() → bool[source]
Check if self is file.
- abstract is_dir() → bool[source]
Check if self is directory.
- abstract __truediv__(key: str) → DPPath[source]
Used for / operator.
- abstract __lt__(other: DPPath) → bool[source]
Whether this DPPath is less than other for sorting.
- abstract __str__() → str[source]
Represent string.
- __repr__() → str[source]
- __eq__(other) → bool[source]
- __hash__()[source]
- property name: str
- Abstractmethod:
Name of the path.
- abstract mkdir(parents: bool = False, exist_ok: bool = False) → None[source]
Make directory.
- Parameters:
- parentsbool,
optional If true, any missing parents of this directory are created as well.
- exist_okbool,
optional If true, no error will be raised if the target directory already exists.