comparison.py

comparison.norm(x, y, z)

The norm function calculates the magnitude of a vector in three-dimensional space.

Parameters:
  • x – The parameter “x” represents the value of the x-coordinate in a three-dimensional space

  • y – The parameter “y” represents the y-coordinate of a point in a three-dimensional space

  • z – The parameter “z” represents the value of the z-coordinate in a three-dimensional space

Returns:

the square root of the sum of the squares of the three input values (x, y, and z).

comparison.update_args_init(args)

The function update_args_init generates random initial conditions for a given set of arguments, ensuring that the generated values are within a certain range.

Parameters:

args – The args parameter is an object of type argparse.Namespace that contains various attributes representing the initial conditions for a simulation. These attributes include:

Returns:

an updated version of the args object with randomly generated initial conditions for init_mx, init_my, init_mz, init_rx, init_ry, and init_rz.

comparison.simulate_normal(args)

The function simulate_normal calls the simulate function with the method parameter set to “normal”.

Parameters:

args – The args parameter is a dictionary that contains the necessary arguments for the simulation. The specific contents of the args dictionary will depend on the requirements of the simulate function

Returns:

The function simulate_normal is returning the result of calling the simulate function with the given arguments and the method set to “normal”.

comparison.simulate_implicit(args)

The function simulate_implicit calls the simulate function with the method parameter set to “implicit”.

Parameters:

args – The args parameter is a dictionary that contains the necessary arguments for the simulation. The specific contents of the args dictionary will depend on the requirements of the simulate function

Returns:

The function simulate_implicit is returning the result of calling the simulate function with the given arguments and the method set to “implicit”.

comparison.simulate_without(args)

The function “simulate_without” calls the “simulate” function with the argument “method” set to “without”.

Parameters:

args – The args parameter is a placeholder for any additional arguments that need to be passed to the simulate function. These arguments can vary depending on the specific requirements of the simulate function

Returns:

The function simulate_without is returning the result of calling the simulate function with the provided arguments and the method set to “without”.

comparison.simulate_soft(args)

The function simulate_soft calls the simulate function with the argument method set to “soft”.

Parameters:

args – The args parameter is a dictionary or a list of arguments that will be passed to the simulate function. The specific arguments required will depend on the implementation of the simulate function

Returns:

The function simulate_soft is returning the result of calling the simulate function with the given arguments and the method set to “soft”.

comparison.generate_trajectories(args)

The function generate_trajectories generates and saves trajectories based on the given arguments, either using a deterministic approach or simulating with learned models.

Parameters:

args – The args parameter is a dictionary or object that contains various arguments or parameters for the generate_trajectories function. These arguments control the behavior of the function and determine what kind of trajectories are generated or simulated

comparison.add_plot(ax, x=None, y=None, name='')

The function add_plot adds a line plot to a given matplotlib axes object, with the option to specify x and y data and a label for the plot.

Parameters:
  • ax – The ax parameter is a matplotlib Axes object. It represents the subplot or axes on which the plot will be drawn

  • x – The x-axis values for the plot. If provided, the plot will be a line plot with x and y values. If not provided, the plot will be a line plot with only y values

  • y – The y parameter is a list or array of values that represent the y-coordinates of the data points to be plotted

  • name – The name parameter is a string that represents the label for the plot. It is used to identify the plot in the legend of the graph

comparison.plot_training_errors(args)

The function plot_training_errors reads error data from CSV files and plots the training and validation errors for different scenarios.

Parameters:

args – The args parameter is an object that contains the following attributes:

comparison.resolve_automatic_dt(args)

The function resolve_automatic_dt calculates the time step dt based on the given model and parameters.

Parameters:

args – args is a dictionary or object that contains the following parameters:

Returns:

the value of dt, which is the time step for the simulation.