simulariumio/trajectory_converter.py
def add_number_of_agents_plot(
        self,
        plot_title: str = "Number of agents over time",
        yaxis_title: str = "Number of agents",
    ):
        """
        Add a scatterplot of the number of each type of agent over time

        Parameters
        ----------
        agent_data: AgentData
            The data shaped as an AgentData object
            Default: None (use the currently loaded data)
        """
        n_agents = {}
        for time_index in range(self._data.agent_data.times.size):
            for agent_index in range(int(self._data.agent_data.n_agents[time_index])):
                type_name = self._data.agent_data.types[time_index][agent_index]
                if "#" in type_name:
                    type_name = type_name.split("#")[0]
                if type_name not in n_agents:
                    n_agents[type_name] = np.zeros_like(self._data.agent_data.times)
                n_agents[type_name][time_index] += 1
        self.add_plot(
            ScatterPlotData(
                title=plot_title,
                xaxis_title=f"Time ({self._data.time_units})",
                yaxis_title=yaxis_title,
                xtrace=self._data.agent_data.times,
                ytraces=n_agents,
                render_mode="lines",
            )
        )

        Add a scatterplot of the number of each type of agent over time

        Parameters
        ----------
        agent_data: AgentData
            The data shaped as an AgentData object
            Default: None (use the currently loaded data)
        
Add a scatterplot of the number of each type of agent over time
Parameters

AgentData
The data shaped as an AgentData object
Default: None (use the currently loaded data)
Add a scatterplot of the number of each type of agent over time Parameters AgentData The data shaped as an AgentData object Default : None ( use the currently loaded data )
def add_number_of_agents_plot(
        self,
        plot_title: str = "Number of agents over time",
        yaxis_title: str = "Number of agents",
    ):
        n_agents = {}
        for time_index in range(self._data.agent_data.times.size):
            for agent_index in range(int(self._data.agent_data.n_agents[time_index])):
                type_name = self._data.agent_data.types[time_index][agent_index]
                if "#" in type_name:
                    type_name = type_name.split("#")[0]
                if type_name not in n_agents:
                    n_agents[type_name] = np.zeros_like(self._data.agent_data.times)
                n_agents[type_name][time_index] += 1
        self.add_plot(
            ScatterPlotData(
                title=plot_title,
                xaxis_title=f"Time ({self._data.time_units})",
                yaxis_title=yaxis_title,
                xtrace=self._data.agent_data.times,
                ytraces=n_agents,
                render_mode="lines",
            )
        )
def add_number_of_agents_plot ( self , plot_title : str = "Number of agents over time" , yaxis_title : str = "Number of agents" , ) : n_agents = { } for time_index in range ( self . _data . agent_data . times . size ) : for agent_index in range ( int ( self . _data . agent_data . n_agents [ time_index ] ) ) : type_name = self . _data . agent_data . types [ time_index ] [ agent_index ] if "#" in type_name : type_name = type_name . split ( "#" ) [ 0 ] if type_name not in n_agents : n_agents [ type_name ] = np . zeros_like ( self . _data . agent_data . times ) n_agents [ type_name ] [ time_index ] += 1 self . add_plot ( ScatterPlotData ( title = plot_title , xaxis_title = f"Time ({self._data.time_units})" , yaxis_title = yaxis_title , xtrace = self . _data . agent_data . times , ytraces = n_agents , render_mode = "lines" , ) )
Add a scatterplot of the number of each type of agent over time
Parameters
Add a scatterplot of the number of each type of agent over time Parameters
"""
        Add a scatterplot of the number of each type of agent over time

        Parameters
        ----------
        agent_data: AgentData
            The data shaped as an AgentData object
            Default: None (use the currently loaded data)
        """
self
plot_title
str
yaxis_title
str