code: def _petitjean_update_barycenter(X, assign, barycenter_size, weights):
      barycenter = numpy.zeros((barycenter_size, X.shape[-1]))
      for t in range(barycenter_size):
          barycenter[t] = numpy.average(
              X[assign[0][t], assign[1][t]],
              axis=0,
              weights=weights[assign[0][t]],
          )
      return barycenter
  
imports: import numpy
  import warnings
  from scipy.interpolate import interp1d
  from sklearn.exceptions import ConvergenceWarning
  from sklearn.utils import check_random_state
  from ..metrics import dtw_path
  from ..utils import to_time_series_dataset, ts_size
  from .utils import _set_weights
label_desc: Use image node_id 3 for calling a global function with example usage: _petitjean_update_barycenter(X, assign, barycenter_size, weights) and returns: barycenter