Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Mesh.get_obstruction_mask_slice cuts the time axis for 3D slices

Abierto Apto para principiantes
#125 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
1/5
Tiempo estimado
Menos de una hora
Aptitud para principiantes
90/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python
Área
backend

Línea de trabajo

Lee fdsreader/fds_classes/mesh.py en get_obstruction_mask_slice() (alrededor de la línea 80), donde se construye mask_indices[orientation], y compáralo con Slice.to_global(masked=True), donde la máscara se transmita contra los datos del slice. Implementa la devolución anticipada para orientation == 0 usando self.get_obstruction_mask(subslice.times, cell_centered=cell_centered). Significa que un slice 3D devuelve una máscara con forma (n_t, nx, ny, nz) que coincide con los datos: reproduce con el caso sintético del issue #124 (máscara (1,5,5,5) vs. datos (2,5,5,5)) y confirma que los slices 2D no cambian.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Python
Estrellas
75
Forks
28
Merge medio
2 min
PR fusionados (30 d)
2

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de FireDynamics/fdsreader

Todos los issues de FireDynamics/fdsreader

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.