Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Mesh.get_obstruction_mask_slice cuts the time axis for 3D slices

Aperta Adatta ai principianti
#125 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
1/5
Tempo stimato
Meno di un'ora
Idoneità per principianti
90/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
backend

Direzione di ricerca

Leggi fdsreader/fds_classes/mesh.py in get_obstruction_mask_slice() (intorno alla riga 80), dove viene costruito mask_indices[orientation], e confrontalo con Slice.to_global(masked=True), dove la maschera viene broadcast contro i dati della slice. Implementa il ritorno anticipato per orientation == 0 usando self.get_obstruction_mask(subslice.times, cell_centered=cell_centered). Finito significa che una slice 3D restituisce una maschera dalla forma (n_t, nx, ny, nz) corrispondente ai dati — riproduci con il caso sintetico dell'issue #124 (maschera (1,5,5,5) vs. dati (2,5,5,5)) e conferma che le slice 2D restano invariate.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Python
Stelle
75
Fork
28
Merge medio
2m
PR unite (30g)
2

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di FireDynamics/fdsreader

Tutte le issue di FireDynamics/fdsreader

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.