Alias for backward compatibility.Module Contents
Classes
DPH5Path
| The path class to data system (DeepmdData) for HDF5 files. |
DPOSPath
| The OS path class to data system (DeepmdData) for real directories. |
DPPath
| The path class to data system (DeepmdData). |
- 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
- property _keys: List[str]
Walk all groups and dataset.
- property _new_keys
New keys that haven’t been cached.
- property name: str
Name of the path.
- __file_new_keys: ClassVar[Dict[h5py.File, List[str]]]
- 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.ndarray
loaded NumPy array
- load_txt(dtype: numpy.dtype | None = None, **kwargs) → numpy.ndarray[source]
Load NumPy array from text.
- Returns:
np.ndarray
loaded 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
- 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.
- 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, mode: str = 'r')[source]
Bases: DPPath
The OS path class to data system (DeepmdData) for real directories.
- Parameters:
- path
str
path
- mode
str
, optional
mode, by default “r”
- property name: str
Name of the path.
- load_numpy() → numpy.ndarray[source]
Load NumPy array.
- Returns:
np.ndarray
loaded NumPy array
- load_txt(**kwargs) → numpy.ndarray[source]
Load NumPy array from text.
- Returns:
np.ndarray
loaded 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.
- 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 property name: str
Name of the path.
- abstract load_numpy() → numpy.ndarray[source]
Load NumPy array.
- Returns:
np.ndarray
loaded NumPy array
- abstract load_txt(**kwargs) → numpy.ndarray[source]
Load NumPy array from text.
- Returns:
np.ndarray
loaded 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]
Return repr(self).
- __eq__(other) → bool[source]
Return self==value.
- __hash__()[source]
Return hash(self).
- 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.