Skip to content

Adding tdqm for inverse kinematics #156

@ANaaim

Description

@ANaaim

Does using tdqm here could be a solution to see how the optim is going ?

https://github.com/Ipuch/bioNC/blob/11808682841958a210e850a3e4312a3e3e05e2f2/bionc/bionc_numpy/inverse_kinematics.py#L346C1-L365C20

from tqdm import tqdm

def _solve_frame_per_frame(
    self,
    Q_init,
    initial_guess_mode,
    method,
    options,
):
    Qopt = np.zeros((12 * self.model.nb_segments, self.nb_frames))
    nlp = self._setup_nlp()
    self.objective_function = np.zeros(self.nb_frames)

    # Wrap your loop with tqdm
    for f in tqdm(range(self.nb_frames), desc="Processing frames"):
        nlp["f"] = self._get_objective_for_frame(f)
        r, success = self._solve_single_frame(method, nlp, Q_init[:, f], options)
        Qopt[:, f : f + 1] = r["x"].toarray()
        self.objective_function[f] = r["f"]
        Q_init = self._update_initial_guess(Q_init, Qopt, initial_guess_mode, f)

    return Qop

Tell me if good idea ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions