你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-08 15:27:57 +08:00
Replace np.single with np.float32 for consistancy
这个提交包含在:
@@ -410,10 +410,10 @@ class Metadata:
|
|||||||
|
|
||||||
def srcs_rx_gv_comment(
|
def srcs_rx_gv_comment(
|
||||||
self, srcs: Union[Sequence[Source], List[Rx]]
|
self, srcs: Union[Sequence[Source], List[Rx]]
|
||||||
) -> Tuple[List[str], npt.NDArray[np.single]]:
|
) -> Tuple[List[str], npt.NDArray[np.float32]]:
|
||||||
"""Used to name sources and/or receivers."""
|
"""Used to name sources and/or receivers."""
|
||||||
names: List[str] = []
|
names: List[str] = []
|
||||||
positions: npt.NDArray[np.single] = np.empty((len(srcs), 3))
|
positions: npt.NDArray[np.float32] = np.empty((len(srcs), 3))
|
||||||
for index, src in enumerate(srcs):
|
for index, src in enumerate(srcs):
|
||||||
position = src.coord * self.grid.dl
|
position = src.coord * self.grid.dl
|
||||||
names.append(src.ID)
|
names.append(src.ID)
|
||||||
@@ -421,7 +421,7 @@ class Metadata:
|
|||||||
|
|
||||||
return names, positions
|
return names, positions
|
||||||
|
|
||||||
def dx_dy_dz_comment(self) -> npt.NDArray[np.single]:
|
def dx_dy_dz_comment(self) -> npt.NDArray[np.float32]:
|
||||||
return self.grid.dl
|
return self.grid.dl
|
||||||
|
|
||||||
def nx_ny_nz_comment(self) -> npt.NDArray[np.intc]:
|
def nx_ny_nz_comment(self) -> npt.NDArray[np.intc]:
|
||||||
|
@@ -58,21 +58,21 @@ class FDTDGrid:
|
|||||||
self.nx = 0
|
self.nx = 0
|
||||||
self.ny = 0
|
self.ny = 0
|
||||||
self.nz = 0
|
self.nz = 0
|
||||||
self.dl = np.ones(3, dtype=np.single)
|
self.dl = np.ones(3, dtype=np.float32)
|
||||||
self.dt = 0.0
|
self.dt = 0.0
|
||||||
|
|
||||||
# Field Arrays
|
# Field Arrays
|
||||||
self.Ex: npt.NDArray[np.single]
|
self.Ex: npt.NDArray[np.float32]
|
||||||
self.Ey: npt.NDArray[np.single]
|
self.Ey: npt.NDArray[np.float32]
|
||||||
self.Ez: npt.NDArray[np.single]
|
self.Ez: npt.NDArray[np.float32]
|
||||||
self.Hx: npt.NDArray[np.single]
|
self.Hx: npt.NDArray[np.float32]
|
||||||
self.Hy: npt.NDArray[np.single]
|
self.Hy: npt.NDArray[np.float32]
|
||||||
self.Hz: npt.NDArray[np.single]
|
self.Hz: npt.NDArray[np.float32]
|
||||||
|
|
||||||
# Dispersive Arrays
|
# Dispersive Arrays
|
||||||
self.Tx: npt.NDArray[np.single]
|
self.Tx: npt.NDArray[np.float32]
|
||||||
self.Ty: npt.NDArray[np.single]
|
self.Ty: npt.NDArray[np.float32]
|
||||||
self.Tz: npt.NDArray[np.single]
|
self.Tz: npt.NDArray[np.float32]
|
||||||
|
|
||||||
# Geometry Arrays
|
# Geometry Arrays
|
||||||
self.solid: npt.NDArray[np.uint32]
|
self.solid: npt.NDArray[np.uint32]
|
||||||
|
@@ -110,7 +110,7 @@ class Snapshot:
|
|||||||
filename: str,
|
filename: str,
|
||||||
fileext: str,
|
fileext: str,
|
||||||
outputs: Dict[str, bool],
|
outputs: Dict[str, bool],
|
||||||
grid_dl: npt.NDArray[np.single],
|
grid_dl: npt.NDArray[np.float32],
|
||||||
grid_dt: float,
|
grid_dt: float,
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
@@ -358,7 +358,7 @@ class MPISnapshot(Snapshot):
|
|||||||
filename: str,
|
filename: str,
|
||||||
fileext: str,
|
fileext: str,
|
||||||
outputs: Dict[str, bool],
|
outputs: Dict[str, bool],
|
||||||
grid_dl: npt.NDArray[np.single],
|
grid_dl: npt.NDArray[np.float32],
|
||||||
grid_dt: float,
|
grid_dt: float,
|
||||||
):
|
):
|
||||||
super().__init__(
|
super().__init__(
|
||||||
|
@@ -30,9 +30,9 @@ class VtkImageData(VtkHdfFile):
|
|||||||
self,
|
self,
|
||||||
filename: Union[str, PathLike],
|
filename: Union[str, PathLike],
|
||||||
shape: npt.NDArray[np.intc],
|
shape: npt.NDArray[np.intc],
|
||||||
origin: Optional[npt.NDArray[np.single]] = None,
|
origin: Optional[npt.NDArray[np.float32]] = None,
|
||||||
spacing: Optional[npt.NDArray[np.single]] = None,
|
spacing: Optional[npt.NDArray[np.float32]] = None,
|
||||||
direction: Optional[npt.NDArray[np.single]] = None,
|
direction: Optional[npt.NDArray[np.float32]] = None,
|
||||||
comm: Optional[MPI.Comm] = None,
|
comm: Optional[MPI.Comm] = None,
|
||||||
):
|
):
|
||||||
"""Create a new VtkImageData file.
|
"""Create a new VtkImageData file.
|
||||||
@@ -77,15 +77,15 @@ class VtkImageData(VtkHdfFile):
|
|||||||
self._set_root_attribute(self.WHOLE_EXTENT_ATTR, whole_extent)
|
self._set_root_attribute(self.WHOLE_EXTENT_ATTR, whole_extent)
|
||||||
|
|
||||||
if origin is None:
|
if origin is None:
|
||||||
origin = np.zeros(self.DIMENSIONS, dtype=np.single)
|
origin = np.zeros(self.DIMENSIONS, dtype=np.float32)
|
||||||
self.set_origin(origin)
|
self.set_origin(origin)
|
||||||
|
|
||||||
if spacing is None:
|
if spacing is None:
|
||||||
spacing = np.ones(self.DIMENSIONS, dtype=np.single)
|
spacing = np.ones(self.DIMENSIONS, dtype=np.float32)
|
||||||
self.set_spacing(spacing)
|
self.set_spacing(spacing)
|
||||||
|
|
||||||
if direction is None:
|
if direction is None:
|
||||||
direction = np.diag(np.ones(self.DIMENSIONS, dtype=np.single))
|
direction = np.diag(np.ones(self.DIMENSIONS, dtype=np.float32))
|
||||||
self.set_direction(direction)
|
self.set_direction(direction)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -93,18 +93,18 @@ class VtkImageData(VtkHdfFile):
|
|||||||
return self._get_root_attribute(self.WHOLE_EXTENT_ATTR)
|
return self._get_root_attribute(self.WHOLE_EXTENT_ATTR)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def origin(self) -> npt.NDArray[np.single]:
|
def origin(self) -> npt.NDArray[np.float32]:
|
||||||
return self._get_root_attribute(self.ORIGIN_ATTR)
|
return self._get_root_attribute(self.ORIGIN_ATTR)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def spacing(self) -> npt.NDArray[np.single]:
|
def spacing(self) -> npt.NDArray[np.float32]:
|
||||||
return self._get_root_attribute(self.SPACING_ATTR)
|
return self._get_root_attribute(self.SPACING_ATTR)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def direction(self) -> npt.NDArray[np.single]:
|
def direction(self) -> npt.NDArray[np.float32]:
|
||||||
return self._get_root_attribute(self.DIRECTION_ATTR)
|
return self._get_root_attribute(self.DIRECTION_ATTR)
|
||||||
|
|
||||||
def set_origin(self, origin: npt.NDArray[np.single]):
|
def set_origin(self, origin: npt.NDArray[np.float32]):
|
||||||
"""Set the origin coordinate of the image data.
|
"""Set the origin coordinate of the image data.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@@ -114,7 +114,7 @@ class VtkImageData(VtkHdfFile):
|
|||||||
raise ValueError(f"Origin attribute must have {self.DIMENSIONS} dimensions.")
|
raise ValueError(f"Origin attribute must have {self.DIMENSIONS} dimensions.")
|
||||||
self._set_root_attribute(self.ORIGIN_ATTR, origin)
|
self._set_root_attribute(self.ORIGIN_ATTR, origin)
|
||||||
|
|
||||||
def set_spacing(self, spacing: npt.NDArray[np.single]):
|
def set_spacing(self, spacing: npt.NDArray[np.float32]):
|
||||||
"""Set the discritisation of the image data.
|
"""Set the discritisation of the image data.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@@ -124,7 +124,7 @@ class VtkImageData(VtkHdfFile):
|
|||||||
raise ValueError(f"Spacing attribute must have {self.DIMENSIONS} dimensions.")
|
raise ValueError(f"Spacing attribute must have {self.DIMENSIONS} dimensions.")
|
||||||
self._set_root_attribute(self.SPACING_ATTR, spacing)
|
self._set_root_attribute(self.SPACING_ATTR, spacing)
|
||||||
|
|
||||||
def set_direction(self, direction: npt.NDArray[np.single]):
|
def set_direction(self, direction: npt.NDArray[np.float32]):
|
||||||
"""Set the coordinate system of the image data.
|
"""Set the coordinate system of the image data.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
在新工单中引用
屏蔽一个用户