simulariumio/trajectory_converter.py
def _check_agent_ids_are_unique_per_frame(buffer_data: Dict[str, Any]) -> bool:
        """
        For each frame, check that none of the unique agent IDs overlap
        """
        bundle_data = buffer_data["spatialData"]["bundleData"]
        for time_index in range(len(bundle_data)):
            data = bundle_data[time_index]["data"]
            agent_index = 1
            uids = []
            get_n_subpoints = False
            while agent_index < len(data):
                # get the number of subpoints
                # in order to correctly increment index
                if get_n_subpoints:
                    agent_index += int(
                        data[agent_index]
                        + (
                            V1_SPATIAL_BUFFER_STRUCT.VALUES_PER_AGENT
                            - V1_SPATIAL_BUFFER_STRUCT.NSP_INDEX
                        )
                    )
                    get_n_subpoints = False
                    continue
                # there should be a unique ID at this index, check for duplicate
                uid = data[agent_index]
                if uid in uids:
                    raise Exception(
                        f"found duplicate ID {uid} in frame {time_index} "
                        f"at index {agent_index}"
                    )
                uids.append(uid)
                agent_index += V1_SPATIAL_BUFFER_STRUCT.NSP_INDEX - 1
                get_n_subpoints = True
        return True

        For each frame, check that none of the unique agent IDs overlap
        
For each frame, check that none of the unique agent IDs overlap
For each frame check that none of the unique agent IDs overlap
def _check_agent_ids_are_unique_per_frame(buffer_data: Dict[str, Any]) -> bool:
        bundle_data = buffer_data["spatialData"]["bundleData"]
        for time_index in range(len(bundle_data)):
            data = bundle_data[time_index]["data"]
            agent_index = 1
            uids = []
            get_n_subpoints = False
            while agent_index < len(data):
                if get_n_subpoints:
                    agent_index += int(
                        data[agent_index]
                        + (
                            V1_SPATIAL_BUFFER_STRUCT.VALUES_PER_AGENT
                            - V1_SPATIAL_BUFFER_STRUCT.NSP_INDEX
                        )
                    )
                    get_n_subpoints = False
                    continue
                uid = data[agent_index]
                if uid in uids:
                    raise Exception(
                        f"found duplicate ID {uid} in frame {time_index} "
                        f"at index {agent_index}"
                    )
                uids.append(uid)
                agent_index += V1_SPATIAL_BUFFER_STRUCT.NSP_INDEX - 1
                get_n_subpoints = True
        return True
def _check_agent_ids_are_unique_per_frame ( buffer_data : Dict [ str , Any ] ) -> bool : bundle_data = buffer_data [ "spatialData" ] [ "bundleData" ] for time_index in range ( len ( bundle_data ) ) : data = bundle_data [ time_index ] [ "data" ] agent_index = 1 uids = [ ] get_n_subpoints = False while agent_index < len ( data ) : if get_n_subpoints : agent_index += int ( data [ agent_index ] + ( V1_SPATIAL_BUFFER_STRUCT . VALUES_PER_AGENT - V1_SPATIAL_BUFFER_STRUCT . NSP_INDEX ) ) get_n_subpoints = False continue uid = data [ agent_index ] if uid in uids : raise Exception ( f"found duplicate ID {uid} in frame {time_index} " f"at index {agent_index}" ) uids . append ( uid ) agent_index += V1_SPATIAL_BUFFER_STRUCT . NSP_INDEX - 1 get_n_subpoints = True return True
For each frame, check that none of the unique agent IDs overlap
For each frame check that none of the unique agent IDs overlap
"""
        For each frame, check that none of the unique agent IDs overlap
        """ # get the number of subpoints # in order to correctly increment index # there should be a unique ID at this index, check for duplicate
buffer_data
Dict[str, Any]