<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def assign_to_centers(data=None, centers=None, stride=1, return_dtrajs=True, metric='euclidean', n_jobs=None, chunksize=None, skip=0, **kwargs):
 r"""Assigns data to the nearest cluster centers Creates a Voronoi partition with the given cluster centers. If given trajectories as data, this function will by default discretize the trajectories and return discrete trajectories of corresponding lengths. Otherwise, an assignment object will be returned that can be used to assign data later or can serve as a pipeline stage. Parameters data : ndarray or list of arrays or reader created by source function data to be assigned centers : path to file or ndarray or a reader created by source function cluster centers to use in assignment of data stride : int, optional, default = 1 assign only every n'th frame to the centers. Usually you want to assign all the data and only use a stride during calculation the centers. return_dtrajs : bool, optional, default = True If True, it will return the discretized trajectories obtained from assigning the coordinates in the data input. This will only have effect if data is given. When data is not given or return_dtrajs is False, the :class:'AssignCenters <_AssignCenters>' object will be returned. metric : str metric to use during clustering ('euclidean', 'minRMSD') n_jobs : int or None, default None Number of threads to use during assignment of the data. If None, all available CPUs will be used. chunksize: int, default=None Number of data frames to process at once. Choose a higher value here, to optimize thread usage and gain processing speed. If None is passed, use the default value of the underlying reader/data source. Choose zero to disable chunking at all. Returns ------- assignment : list of integer arrays or an :class:`AssignCenters <pyemma.coordinates.clustering.AssignCenters>` object assigned data Examples -------- Load data to assign to clusters from 'my_data.csv' by using the cluster centers from file 'my_centers.csv' Generate some random data and choose 10 random centers: .. autoclass:: pyemma.coordinates.clustering.assign.AssignCenters :members: :undoc-members: .. rubric:: Methods .. autoautosummary:: pyemma.coordinates.clustering.assign.AssignCenters :methods: .. rubric:: Attributes .. autoautosummary:: pyemma.coordinates.clustering.assign.AssignCenters :attributes: """

    if centers is None:
        raise ValueError('You have to provide centers in form of a filename'
                         ' or NumPy array or a reader created by source function')
    from pyemma.coordinates.clustering.assign import AssignCenters
    res = AssignCenters(centers, metric=metric, n_jobs=n_jobs, skip=skip, stride=stride)
    from pyemma.util.reflection import get_default_args
    cs = _check_old_chunksize_arg(chunksize, get_default_args(assign_to_centers)['chunksize'], **kwargs)
    if data is not None:
        res.estimate(data, chunksize=cs)
        if return_dtrajs:
            return res.dtrajs
    else:
        res.chunksize = cs

    return res