simulariumio/data_objects/agent_data.py
def _get_buffer_data_dimensions(buffer_data: Dict[str, Any]) -> DimensionData:
        """
        Get dimensions of a simularium JSON dict containing buffers
        """
        bundle_data = buffer_data["spatialData"]["bundleData"]
        result = DimensionData(total_steps=len(bundle_data), max_agents=0)
        for time_index in range(result.total_steps):
            # buffer = packed agent data as a list of numbers
            buffer = bundle_data[time_index]["data"]
            buffer_index = 0
            agents = 0
            while buffer_index < len(buffer):
                # a new agent should start at this index
                agents += 1
                buffer_index += V1_SPATIAL_BUFFER_STRUCT.NSP_INDEX
                # get the number of subpoints
                subpoints = math.floor(buffer[buffer_index] / 3.0)
                if subpoints > result.max_subpoints:
                    result.max_subpoints = subpoints
                buffer_index += int(
                    buffer[buffer_index]
                    + (
                        V1_SPATIAL_BUFFER_STRUCT.VALUES_PER_AGENT
                        - V1_SPATIAL_BUFFER_STRUCT.NSP_INDEX
                        - 1
                    )
                )
            if agents > result.max_agents:
                result.max_agents = agents
        return result

        Get dimensions of a simularium JSON dict containing buffers
        
Get dimensions of a simularium JSON dict containing buffers
Get dimensions of a simularium JSON dict containing buffers
def _get_buffer_data_dimensions(buffer_data: Dict[str, Any]) -> DimensionData:
        bundle_data = buffer_data["spatialData"]["bundleData"]
        result = DimensionData(total_steps=len(bundle_data), max_agents=0)
        for time_index in range(result.total_steps):
            buffer = bundle_data[time_index]["data"]
            buffer_index = 0
            agents = 0
            while buffer_index < len(buffer):
                agents += 1
                buffer_index += V1_SPATIAL_BUFFER_STRUCT.NSP_INDEX
                subpoints = math.floor(buffer[buffer_index] / 3.0)
                if subpoints > result.max_subpoints:
                    result.max_subpoints = subpoints
                buffer_index += int(
                    buffer[buffer_index]
                    + (
                        V1_SPATIAL_BUFFER_STRUCT.VALUES_PER_AGENT
                        - V1_SPATIAL_BUFFER_STRUCT.NSP_INDEX
                        - 1
                    )
                )
            if agents > result.max_agents:
                result.max_agents = agents
        return result
def _get_buffer_data_dimensions ( buffer_data : Dict [ str , Any ] ) -> DimensionData : bundle_data = buffer_data [ "spatialData" ] [ "bundleData" ] result = DimensionData ( total_steps = len ( bundle_data ) , max_agents = 0 ) for time_index in range ( result . total_steps ) : buffer = bundle_data [ time_index ] [ "data" ] buffer_index = 0 agents = 0 while buffer_index < len ( buffer ) : agents += 1 buffer_index += V1_SPATIAL_BUFFER_STRUCT . NSP_INDEX subpoints = math . floor ( buffer [ buffer_index ] / 3.0 ) if subpoints > result . max_subpoints : result . max_subpoints = subpoints buffer_index += int ( buffer [ buffer_index ] + ( V1_SPATIAL_BUFFER_STRUCT . VALUES_PER_AGENT - V1_SPATIAL_BUFFER_STRUCT . NSP_INDEX - 1 ) ) if agents > result . max_agents : result . max_agents = agents return result
Get dimensions of a simularium JSON dict containing buffers
Get dimensions of a simularium JSON dict containing buffers
"""
        Get dimensions of a simularium JSON dict containing buffers
        """ # buffer = packed agent data as a list of numbers # a new agent should start at this index # get the number of subpoints
buffer_data
Dict[str, Any]