Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Mesh.get_obstruction_mask_slice cuts the time axis for 3D slices

Đã đóng Phù hợp với người mới
#125 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
1/5
Thời gian dự kiến
Dưới một giờ
Mức phù hợp với người mới
90/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
backend

Hướng nghiên cứu

Đọc fdsreader/fds_classes/mesh.py trong get_obstruction_mask_slice() (khoảng dòng 80), nơi mask_indices[orientation] được xây dựng, và so sánh với Slice.to_global(masked=True), nơi mask được broadcast đối với dữ liệu của slice. Triển khai lệnh trả về sớm cho orientation == 0 bằng self.get_obstruction_mask(subslice.times, cell_centered=cell_centered). Hoàn thành có nghĩa là một slice 3D trả về mask có dạng (n_t, nx, ny, nz) khớp với dữ liệu — tái hiện với trường hợp tổng hợp từ issue #124 (mask (1,5,5,5) so với dữ liệu (2,5,5,5)) và xác nhận các slice 2D không thay đổi.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Mesh.get_obstruction_mask_slice() (fdsreader/fds_classes/mesh.py, around line 80) selects the slice plane with

mask_indices = [slice(None)] * 4
mask_indices[orientation] = slice(slc_index, slc_index + 1, 1)

The mask is indexed (t, x, y, z), so for a 2D slice orientation (1, 2 or 3) hits the right spatial axis. For a 3D slice orientation == 0, so the same line cuts the time axis down to a single frame instead of leaving the mask untouched. Which frame survives is accidental: with orientation == 0, subslice.extent[0] and dimension=(0,) both wrap to z, so slc_index is the z index of the slice's lower z bound (0 when the slice starts at the mesh bottom). If that index is >= n_t, the selection is empty.

The returned mask then has shape (1, nx, ny, nz) while the data has (n_t, nx, ny, nz). In Slice.to_global(masked=True), np.where(mask, slc_data, fill) broadcasts that one frame over all time steps, so every time step is masked with the obstructions visible at that one frame (the first time step in the common case). For example, an obstruction removed after t = 0 still masks the corresponding cells, and one that appears later does not mask anything. A synthetic check during review of #124 showed mask (1, 5, 5, 5) against data (2, 5, 5, 5), with an obstructed cell at the second time step left unmasked.

Expected: for orientation == 0, return the full time-dependent mask from get_obstruction_mask(subslice.times, cell_centered=...).

Suggested fix: return early for 3D slices, e.g.

if orientation == 0:
    return self.get_obstruction_mask(subslice.times, cell_centered=cell_centered)

2D slices are not affected. Found while reviewing the fix for #123.

Ngôn ngữ chính
Python
Star
76
Fork
28
Merge trung bình
16 giờ 49 phút
Pull request đã merge (30 ngày)
28

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của FireDynamics/fdsreader

Tất cả issue của FireDynamics/fdsreader

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.