Skip to content

Fix false "incomplete entity data" warning on time-varying populations - #16

Closed
chraibi wants to merge 1 commit into
sir306:mainfrom
PedestrianDynamics:fix-entity-coverage-false-positive
Closed

Fix false "incomplete entity data" warning on time-varying populations#16
chraibi wants to merge 1 commit into
sir306:mainfrom
PedestrianDynamics:fix-entity-coverage-false-positive

Conversation

@chraibi

@chraibi chraibi commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Loading a normal pedestrian dataset raises a user-facing error popup claiming data is missing, when nothing is missing:

LogHdf5SimulationReader: Converted Juelich to Mobius: 493 entities, 1442486 samples, duration=1198.80s, fps=5.00
LogMobiusUserFeedback: Error: Incomplete entity data: HDF5: peak entity count 386 < MaxAgents 493.
  Some entities may be missing. (AgentDataSubsystem - RunHdf5SimDataGatheringLoop)

Cause

The check compares two quantities that measure different things:

  • MaxAgents comes from ConvertJuelichToMobiusFormat as SortedIds.Num() — distinct entity IDs across the whole run.
  • PeakEntityCount is the maximum entries in NumOfAgentsPerTimeStep — agents in the busiest single timestep.

These are equal only if every agent is present for the entire simulation. In any dataset where agents enter and leave, the peak concurrent count is legitimately lower than the total, and the warning fires.

Verified against the file above by reading the HDF5 directly:

unique ids (= MaxAgents):        493
peak concurrent agents:          386
agents present for the whole run:  0 of 493
median lifespan:                3193 of 5993 frames

All 493 entities are present in the data. Not one of them spans the full run, so the condition is guaranteed to trigger. It would stay quiet only on a synthetic file where the population never changes.

The spawn path is unaffected — SpawnMaxPedestrians uses GetMaxAgents(), so 493 MASS entities are created and the ones without samples at a given timestep simply do not render. This is a spurious warning, not a sizing bug.

Change

Measure the property the check was actually after: how many declared entities have no samples at all.

TBitArray<> ObservedEntities(false, MaxAgents);
// ... mark each Sample.EntityId ...
if (ObservedEntityCount < MaxAgents)
    → "HDF5: %d of %d entities have no samples. Data may be incomplete."

That still catches genuinely truncated data — an entity declared in metadata but absent from every timestep — while staying quiet on normal pedestrian flow. PeakEntityCount and its loop are removed as they now have no other use.

One pass over Hdf5Data.Samples with a TBitArray sized to MaxAgents; negligible against the 1.4M samples already being iterated in this function.

The neighbouring timestep-truncation check is left untouched — it compares like with like and is correct as written.

Verification

macOS, UE 5.5.4. Compiles clean; the warning no longer fires for the dataset above, whose 493 entities all have samples.

RunHdf5SimDataGatheringLoop compared the peak per-timestep entity count
against MaxAgents and reported missing data when it was lower:

  Incomplete entity data: HDF5: peak entity count 386 < MaxAgents 493.
  Some entities may be missing.

Those two numbers measure different things. MaxAgents comes from
ConvertJuelichToMobiusFormat as the count of distinct entity IDs across
the whole run, while the peak is the busiest single timestep. They are
only equal when every agent is present for the entire simulation, so
the check fires on any dataset where agents enter and leave.

For the file above all 493 entities are present in the data; the busiest
frame simply holds 386 of them, and no agent spans the full run.

Replace the comparison with one that measures the intended property:
count the distinct entity indices that actually have samples and report
how many have none. That still catches genuinely truncated data without
misfiring on normal pedestrian flow.
Copilot AI lite review requested due to automatic review settings August 11, 2026 09:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a false user-facing “Incomplete entity data” warning when loading HDF5 simulations with time-varying populations (agents entering/leaving over time). It replaces an incorrect comparison of peak concurrent agents vs. total distinct entities with a coverage check that verifies each declared entity appears in at least one sample.

Changes:

  • Removed the PeakEntityCount computation based on per-timestep sample counts.
  • Added an “entity coverage” check that tracks which entity IDs appear across all samples using a TBitArray.
  • Updated the warning message to report how many declared entities have zero samples.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@chraibi

chraibi commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator Author

Superseded by #18 — same false 'incomplete entity data' warning, cleaner fix (tracks which entity IDs ever appear instead of comparing peak concurrent count).

@chraibi chraibi closed this Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants