pypet/trajectory.py
def _merge_slowly(self, other_trajectory, rename_dict):
        """Merges trajectories by loading iteratively items of the other trajectory and
        store it into the current trajectory.

        :param rename_dict:

            Dictionary containing mappings from the old result names in the `other_trajectory`
            to the new names in the current trajectory.

        """
        for other_key in rename_dict:
            new_key = rename_dict[other_key]

            other_instance = other_trajectory.f_get(other_key)

            if other_instance.f_is_empty():
                # To suppress warnings if nothing needs to be loaded
                with self._nn_interface._disable_logging:
                    other_trajectory.f_load_item(other_instance)

            if not self.f_contains(new_key):
                class_name = other_instance.f_get_class_name()
                class_ = self._create_class(class_name)
                my_instance = self.f_add_leaf(class_, new_key)
            else:
                my_instance = self.f_get(new_key, shortcuts=False)

            if not my_instance.f_is_empty():
                raise RuntimeError('Something is wrong! Your item `%s` should be empty.' % new_key)

            load_dict = other_instance._store()
            my_instance._load(load_dict)
            my_instance.f_set_annotations(**other_instance.v_annotations.f_to_dict(copy=False))
            my_instance.v_comment = other_instance.v_comment

            self.f_store_item(my_instance)

            # We do not want to blow up the RAM Memory
            if other_instance.v_is_parameter:
                other_instance.f_unlock()
                my_instance.f_unlock()
            other_instance.f_empty()
            my_instance.f_empty()
def _merge_slowly(self, other_trajectory, rename_dict):
        for other_key in rename_dict:
            new_key = rename_dict[other_key]

            other_instance = other_trajectory.f_get(other_key)

            if other_instance.f_is_empty():
                # To suppress warnings if nothing needs to be loaded
                with self._nn_interface._disable_logging:
                    other_trajectory.f_load_item(other_instance)

            if not self.f_contains(new_key):
                class_name = other_instance.f_get_class_name()
                class_ = self._create_class(class_name)
                my_instance = self.f_add_leaf(class_, new_key)
            else:
                my_instance = self.f_get(new_key, shortcuts=False)

            if not my_instance.f_is_empty():
                raise RuntimeError('Something is wrong! Your item `%s` should be empty.' % new_key)

            load_dict = other_instance._store()
            my_instance._load(load_dict)
            my_instance.f_set_annotations(**other_instance.v_annotations.f_to_dict(copy=False))
            my_instance.v_comment = other_instance.v_comment

            self.f_store_item(my_instance)

            # We do not want to blow up the RAM Memory
            if other_instance.v_is_parameter:
                other_instance.f_unlock()
                my_instance.f_unlock()
            other_instance.f_empty()
            my_instance.f_empty()
def _merge_slowly ( self , other_trajectory , rename_dict ) : for other_key in rename_dict : new_key = rename_dict [ other_key ] other_instance = other_trajectory . f_get ( other_key ) if other_instance . f_is_empty ( ) : # To suppress warnings if nothing needs to be loaded with self . _nn_interface . _disable_logging : other_trajectory . f_load_item ( other_instance ) if not self . f_contains ( new_key ) : class_name = other_instance . f_get_class_name ( ) class_ = self . _create_class ( class_name ) my_instance = self . f_add_leaf ( class_ , new_key ) else : my_instance = self . f_get ( new_key , shortcuts = False ) if not my_instance . f_is_empty ( ) : raise RuntimeError ( 'Something is wrong! Your item `%s` should be empty.' % new_key ) load_dict = other_instance . _store ( ) my_instance . _load ( load_dict ) my_instance . f_set_annotations ( * * other_instance . v_annotations . f_to_dict ( copy = False ) ) my_instance . v_comment = other_instance . v_comment self . f_store_item ( my_instance ) # We do not want to blow up the RAM Memory if other_instance . v_is_parameter : other_instance . f_unlock ( ) my_instance . f_unlock ( ) other_instance . f_empty ( ) my_instance . f_empty ( )
Merges trajectories by loading iteratively items of the other trajectory and
        store it into the current trajectory.

        :param rename_dict:

            Dictionary containing mappings from the old result names in the `other_trajectory`
            to the new names in the current trajectory.
Merges trajectories by loading iteratively items of the other trajectory and store it into the current trajectory .