simularium / simulariumio

Python package that converts simulation outputs to the format consumed by the Simularium viewer website
Apache License 2.0
5 stars 3 forks source link

Issues with appending agents to TrajectoryData object #153

Open mogres opened 1 year ago

mogres commented 1 year ago

System and Software

Description

While appending new AgentData obtained from the CytosimConverter to an existing TrajectoryData object, I ran into the following issues:

  1. used_uids, new_agent_index and raw_uid are being saved as floats instead of ints, which caused issues during indexing
  2. The result.display_data dictionary was not updated during the call to append_agents, which resulted in the added agents defaulting to a sphere geometry
  3. the default buffer size used by get_copy_with_increased_buffer_size was too large (1000) for my use case. This resulted in 1000 elements being added every step even when they were not necessary.

Expected Behavior

New AgentData should be added to the existing TrajectoryData with its DisplayData carried over.

Reproduction

  1. Create a CytosimData object (fiber_data) from a cytosim output file
  2. Create a CytosimConverter object (cytosim_converter) from the CytosimData object.
  3. Repeat steps 1 and 2 with a different output file to get a new CytosimConverter object new_cytosim_converter
  4. Append new agent data to the original using:
    trajectory_data = cytosim_converter._data  # this is a TrajectoryData object
    new_agent_data = new_cytosim_converter._data.agent_data  # this is an AgentData object
    trajectory_data.append_agents(new_agent_data)

    I can share the data and a notebook with the reproduction example if needed.

More Information

Local changes I made to fix these issues are available at https://github.com/mogres/simulariumio/tree/multiple_cytosim_repeats

blairlyons commented 6 months ago

@mogres is there still work to do on this issue or was it closed by https://github.com/simularium/simulariumio/pull/155

mogres commented 6 months ago

@mogres is there still work to do on this issue or was it closed by #155

Yes, we can close this issue now.