Skip to content

Commit

Permalink
fix np.loadtxt warning
Browse files Browse the repository at this point in the history
```
DeprecationWarning: loadtxt(): Parsing an integer via a float is deprecated.  To avoid this warning, you can:
    * make sure the original data is stored as integers.
    * use the `converters=` keyword argument.  If you only use
      NumPy 1.23 or later, `converters=float` will normally work.
    * Use `np.loadtxt(...).astype(np.int64)` parsing the file as
      floating point and then convert it.  (On all NumPy versions.)
  (Deprecated NumPy 1.23)
  return np.loadtxt(str(self.path), **kwargs)
```

Signed-off-by: Jinzhe Zeng <[email protected]>
  • Loading branch information
njzjz authored Sep 11, 2023
1 parent 6e306fa commit e1280c4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion deepmd/utils/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ def _load_data(
return np.float32(0.0), data

def _load_type(self, sys_path: DPPath):
atom_type = (sys_path / "type.raw").load_txt(dtype=np.int32, ndmin=1)
atom_type = (sys_path / "type.raw").load_txt(ndmin=1).astype(np.int32)
return atom_type

def _load_type_mix(self, set_name: DPPath):
Expand Down

0 comments on commit e1280c4

Please sign in to comment.