simulariumio/filters/multiply_time_filter.py
def apply(self, data: TrajectoryData) -> TrajectoryData:
        """
        Multiply time values in the data
        """
        print(f"Filtering: multiplying time by {self.multiplier} -------------")
        # plot data
        if self.apply_to_plots:
            for plot in range(len(data.plots)):
                x_title = data.plots[plot]["layout"]["xaxis"]["title"]
                if "time" not in x_title.lower():
                    continue
                for tr in range(len(data.plots[plot]["data"])):
                    trace = data.plots[plot]["data"][tr]
                    trace["x"] = (self.multiplier * np.array(trace["x"])).tolist()
        # spatial data
        data.agent_data.times = self.multiplier * data.agent_data.times
        return data

        Multiply time values in the data
        
Multiply time values in the data
Multiply time values in the data
def apply(self, data: TrajectoryData) -> TrajectoryData:
        print(f"Filtering: multiplying time by {self.multiplier} -------------")
        if self.apply_to_plots:
            for plot in range(len(data.plots)):
                x_title = data.plots[plot]["layout"]["xaxis"]["title"]
                if "time" not in x_title.lower():
                    continue
                for tr in range(len(data.plots[plot]["data"])):
                    trace = data.plots[plot]["data"][tr]
                    trace["x"] = (self.multiplier * np.array(trace["x"])).tolist()
        data.agent_data.times = self.multiplier * data.agent_data.times
        return data
def apply ( self , data : TrajectoryData ) -> TrajectoryData : print ( f"Filtering: multiplying time by {self.multiplier} -------------" ) if self . apply_to_plots : for plot in range ( len ( data . plots ) ) : x_title = data . plots [ plot ] [ "layout" ] [ "xaxis" ] [ "title" ] if "time" not in x_title . lower ( ) : continue for tr in range ( len ( data . plots [ plot ] [ "data" ] ) ) : trace = data . plots [ plot ] [ "data" ] [ tr ] trace [ "x" ] = ( self . multiplier * np . array ( trace [ "x" ] ) ) . tolist ( ) data . agent_data . times = self . multiplier * data . agent_data . times return data
Multiply time values in the data
Multiply time values in the data
"""
        Multiply time values in the data
        """ # plot data # spatial data
self
data
TrajectoryData