simulariumio/filters/transform_spatial_axes_filter.py
def apply(self, data: TrajectoryData) -> TrajectoryData:
        """
        Transform spatial coordinates to rotate and/or reflect the scene
        """
        print(f"Filtering: transform spatial axes {self.axes_mapping} -------------")
        # box size
        data.meta_data.box_size = self._transform_coordinate(
            data.meta_data.box_size, False
        )
        # get dimensions
        start_dimensions = data.agent_data.get_dimensions()
        max_subpoints = int(np.amax(data.agent_data.n_subpoints))
        if max_subpoints > 0:
            subpoints = np.zeros(
                (
                    start_dimensions.total_steps,
                    start_dimensions.max_agents,
                    max_subpoints,
                    3,
                )
            )
        positions = np.zeros(
            (start_dimensions.total_steps, start_dimensions.max_agents, 3)
        )
        # get filtered data
        for time_index in range(start_dimensions.total_steps):
            for agent_index in range(int(data.agent_data.n_agents[time_index])):
                positions[time_index][agent_index] = self._transform_coordinate(
                    data.agent_data.positions[time_index][agent_index]
                )
                if (
                    max_subpoints > 0
                    and data.agent_data.n_subpoints[time_index][agent_index] > 0
                ):
                    for subpoint_index in range(
                        int(data.agent_data.n_subpoints[time_index][agent_index])
                    ):
                        subpoints[time_index][agent_index][
                            subpoint_index
                        ] = self._transform_coordinate(
                            data.agent_data.subpoints[time_index][agent_index][
                                subpoint_index
                            ]
                        )
        data.agent_data.positions = positions
        if max_subpoints > 0:
            data.agent_data.subpoints = subpoints
        return data

        Transform spatial coordinates to rotate and/or reflect the scene
        
Transform spatial coordinates to rotate and/or reflect the scene
Transform spatial coordinates to rotate and / or reflect the scene
def apply(self, data: TrajectoryData) -> TrajectoryData:
        print(f"Filtering: transform spatial axes {self.axes_mapping} -------------")
        data.meta_data.box_size = self._transform_coordinate(
            data.meta_data.box_size, False
        )
        start_dimensions = data.agent_data.get_dimensions()
        max_subpoints = int(np.amax(data.agent_data.n_subpoints))
        if max_subpoints > 0:
            subpoints = np.zeros(
                (
                    start_dimensions.total_steps,
                    start_dimensions.max_agents,
                    max_subpoints,
                    3,
                )
            )
        positions = np.zeros(
            (start_dimensions.total_steps, start_dimensions.max_agents, 3)
        )
        for time_index in range(start_dimensions.total_steps):
            for agent_index in range(int(data.agent_data.n_agents[time_index])):
                positions[time_index][agent_index] = self._transform_coordinate(
                    data.agent_data.positions[time_index][agent_index]
                )
                if (
                    max_subpoints > 0
                    and data.agent_data.n_subpoints[time_index][agent_index] > 0
                ):
                    for subpoint_index in range(
                        int(data.agent_data.n_subpoints[time_index][agent_index])
                    ):
                        subpoints[time_index][agent_index][
                            subpoint_index
                        ] = self._transform_coordinate(
                            data.agent_data.subpoints[time_index][agent_index][
                                subpoint_index
                            ]
                        )
        data.agent_data.positions = positions
        if max_subpoints > 0:
            data.agent_data.subpoints = subpoints
        return data
def apply ( self , data : TrajectoryData ) -> TrajectoryData : print ( f"Filtering: transform spatial axes {self.axes_mapping} -------------" ) data . meta_data . box_size = self . _transform_coordinate ( data . meta_data . box_size , False ) start_dimensions = data . agent_data . get_dimensions ( ) max_subpoints = int ( np . amax ( data . agent_data . n_subpoints ) ) if max_subpoints > 0 : subpoints = np . zeros ( ( start_dimensions . total_steps , start_dimensions . max_agents , max_subpoints , 3 , ) ) positions = np . zeros ( ( start_dimensions . total_steps , start_dimensions . max_agents , 3 ) ) for time_index in range ( start_dimensions . total_steps ) : for agent_index in range ( int ( data . agent_data . n_agents [ time_index ] ) ) : positions [ time_index ] [ agent_index ] = self . _transform_coordinate ( data . agent_data . positions [ time_index ] [ agent_index ] ) if ( max_subpoints > 0 and data . agent_data . n_subpoints [ time_index ] [ agent_index ] > 0 ) : for subpoint_index in range ( int ( data . agent_data . n_subpoints [ time_index ] [ agent_index ] ) ) : subpoints [ time_index ] [ agent_index ] [ subpoint_index ] = self . _transform_coordinate ( data . agent_data . subpoints [ time_index ] [ agent_index ] [ subpoint_index ] ) data . agent_data . positions = positions if max_subpoints > 0 : data . agent_data . subpoints = subpoints return data
Transform spatial coordinates to rotate and/or reflect the scene
Transform spatial coordinates to rotate and / or reflect the scene
"""
        Transform spatial coordinates to rotate and/or reflect the scene
        """ # box size # get dimensions # get filtered data
self
data
TrajectoryData