original_docstring: 
          Aligns this embedding to the base frame. The frames are aligned based
          on the keys they have in common. This requires both embeddings to have
          a dimensionality of 2.
          
          Args:
              base_frame: An Embedding to use as the base.
              frame: An Embedding to transform.
              ids: Point IDs to use for alignment (default None, which results in an
                  alignment using the intersection of IDs between the two frames).
              return_transform: If true, return just the Affine object instead of the
                  rotated data.
              base_transform: If not None, an Affine object representing the
                  transformation to apply to the base frame before aligning.
              allow_flips: If true, test inversions as possible candidates for alignment.
              
          Returns:
              A new Embedding object representing the second input frame (the first
              input frame is assumed to stay the same). Or, if return_transform is
              True, returns the optimal transformation as an Affine object.
          
docstring: Aligns this embedding to the base frame. The frames are aligned based
  on the keys they have in common. This requires both embeddings to have
  a dimensionality of 2.
docstring_tokens: Aligns this embedding to the base frame . The frames are aligned based on the keys they have in common . This requires both embeddings to have a dimensionality of 2 .
code: def align_to(self, base_frame, ids=None, return_transform=False, base_transform=None, allow_flips=True):
          """
          Aligns this embedding to the base frame. The frames are aligned based
          on the keys they have in common. This requires both embeddings to have
          a dimensionality of 2.
          
          Args:
              base_frame: An Embedding to use as the base.
              frame: An Embedding to transform.
              ids: Point IDs to use for alignment (default None, which results in an
                  alignment using the intersection of IDs between the two frames).
              return_transform: If true, return just the Affine object instead of the
                  rotated data.
              base_transform: If not None, an Affine object representing the
                  transformation to apply to the base frame before aligning.
              allow_flips: If true, test inversions as possible candidates for alignment.
              
          Returns:
              A new Embedding object representing the second input frame (the first
              input frame is assumed to stay the same). Or, if return_transform is
              True, returns the optimal transformation as an Affine object.
          """
          # Determine a set of points to use for comparison
          ids_to_compare = list(ids) if ids is not None else list(set(self.ids) & set(base_frame.ids))
          
          proj_subset = self.field(Field.POSITION, ids=ids_to_compare)
          assert proj_subset.shape[1] == 2, "Alignment of embeddings with dimension > 2 not supported"
          proj_scaler = projection_standardizer(proj_subset)
          
          base_proj_subset = base_frame.field(Field.POSITION, ids=ids_to_compare)
          assert base_proj_subset.shape[1] == 2, "Alignment of embeddings with dimension > 2 not supported"
          if base_transform is not None:
              base_proj_subset = affine_transform(base_transform, base_proj_subset)    
          base_proj_scaler = projection_standardizer(base_proj_subset)
          
          proj = np.hstack([
              affine_transform(proj_scaler, proj_subset),
              np.zeros((len(proj_subset), 1))
          ])
          base_proj = np.hstack([
              affine_transform(base_proj_scaler, base_proj_subset),
              np.zeros((len(base_proj_subset), 1))
          ])
          
          # Test flips
          min_rmsd = 1e9
          best_variant = None
          for factor in (FLIP_FACTORS if allow_flips else FLIP_FACTORS[:1]):
              opt_rotation, rmsd = Rotation.align_vectors( # pylint: disable=unbalanced-tuple-unpacking
                  base_proj,
                  proj * factor)
              if rmsd < min_rmsd:
                  min_rmsd = rmsd
                  transform = ~base_proj_scaler * matrix_to_affine(opt_rotation.as_matrix()) * Affine.scale(*factor[:2]) * proj_scaler
                  if return_transform:
                      best_variant = transform
                  else:
                      best_variant = affine_transform(transform,
                          self.field(Field.POSITION))
  
          if return_transform:
              return best_variant
          return self.copy_with_fields({Field.POSITION: best_variant})
code_tokens: def align_to ( self , base_frame , ids = None , return_transform = False , base_transform = None , allow_flips = True ) : ids_to_compare = list ( ids ) if ids is not None else list ( set ( self . ids ) & set ( base_frame . ids ) ) proj_subset = self . field ( Field . POSITION , ids = ids_to_compare ) assert proj_subset . shape [ 1 ] == 2 , "Alignment of embeddings with dimension > 2 not supported" proj_scaler = projection_standardizer ( proj_subset ) base_proj_subset = base_frame . field ( Field . POSITION , ids = ids_to_compare ) assert base_proj_subset . shape [ 1 ] == 2 , "Alignment of embeddings with dimension > 2 not supported" if base_transform is not None : base_proj_subset = affine_transform ( base_transform , base_proj_subset ) base_proj_scaler = projection_standardizer ( base_proj_subset ) proj = np . hstack ( [ affine_transform ( proj_scaler , proj_subset ) , np . zeros ( ( len ( proj_subset ) , 1 ) ) ] ) base_proj = np . hstack ( [ affine_transform ( base_proj_scaler , base_proj_subset ) , np . zeros ( ( len ( base_proj_subset ) , 1 ) ) ] ) min_rmsd = 1e9 best_variant = None for factor in ( FLIP_FACTORS if allow_flips else FLIP_FACTORS [ : 1 ] ) : opt_rotation , rmsd = Rotation . align_vectors ( base_proj , proj * factor ) if rmsd < min_rmsd : min_rmsd = rmsd transform = ~ base_proj_scaler * matrix_to_affine ( opt_rotation . as_matrix ( ) ) * Affine . scale ( * factor [ : 2 ] ) * proj_scaler if return_transform : best_variant = transform else : best_variant = affine_transform ( transform , self . field ( Field . POSITION ) ) if return_transform : return best_variant return self . copy_with_fields ( { Field . POSITION : best_variant } )
short_docstring: Aligns this embedding to the base frame.
short_docstring_tokens: Aligns this embedding to the base frame .
comment: """
          Aligns this embedding to the base frame. The frames are aligned based
          on the keys they have in common. This requires both embeddings to have
          a dimensionality of 2.
          
          Args:
              base_frame: An Embedding to use as the base.
              frame: An Embedding to transform.
              ids: Point IDs to use for alignment (default None, which results in an
                  alignment using the intersection of IDs between the two frames).
              return_transform: If true, return just the Affine object instead of the
                  rotated data.
              base_transform: If not None, an Affine object representing the
                  transformation to apply to the base frame before aligning.
              allow_flips: If true, test inversions as possible candidates for alignment.
              
          Returns:
              A new Embedding object representing the second input frame (the first
              input frame is assumed to stay the same). Or, if return_transform is
              True, returns the optimal transformation as an Affine object.
          """$SEP$# Determine a set of points to use for comparison$SEP$# Test flips$SEP$# pylint: disable=unbalanced-tuple-unpacking