Returns the continuous symmetry measures of the current local geometry in a dictionary.
        :return: the continuous symmetry measures of the current local geometry in a dictionary.
175866
def get_coordination_symmetry_measures_optim(self, only_minimum=True,
                                                 all_csms=True, nb_set=None, optimization=None):
        
        cn = len(self.local_geometry.coords)
        test_geometries = self.allcg.get_implemented_geometries(cn)
        if all([cg.algorithms[0].algorithm_type == EXPLICIT_PERMUTATIONS for cg in test_geometries]):
            return self.get_coordination_symmetry_measures(only_minimum=only_minimum, all_csms=all_csms,
                                                           optimization=optimization)
        if not all([all([algo.algorithm_type == SEPARATION_PLANE
                         for algo in cg.algorithms]) for cg in test_geometries]):
            raise ValueError('All algorithms should be EXPLICIT_PERMUTATIONS or SEPARATION_PLANE')

        result_dict = {}
        for geometry in test_geometries:
            self.perfect_geometry = AbstractGeometry.from_cg(cg=geometry,
                                                             centering_type=self.centering_type,
                                                             include_central_site_in_centroid=
                                                             self.include_central_site_in_centroid)
            points_perfect = self.perfect_geometry.points_wcs_ctwcc()
            cgsm = self.coordination_geometry_symmetry_measures_sepplane_optim(geometry,
                                                                               points_perfect=points_perfect,
                                                                               nb_set=nb_set,
                                                                               optimization=optimization)
            result, permutations, algos, local2perfect_maps, perfect2local_maps = cgsm
            if only_minimum:
                if len(result) > 0:
                    imin = np.argmin([rr['symmetry_measure'] for rr in result])
                    if geometry.algorithms is not None:
                        algo = algos[imin]
                    else:
                        algo = algos
                    result_dict[geometry.mp_symbol] = {'csm': result[imin]['symmetry_measure'],
                                                       'indices': permutations[
                                                           imin],
                                                       'algo': algo,
                                                       'local2perfect_map':
                                                           local2perfect_maps[
                                                               imin],
                                                       'perfect2local_map':
                                                           perfect2local_maps[
                                                               imin],
                                                       'scaling_factor': 1.0 / result[imin]['scaling_factor'],
                                                       'rotation_matrix':
                                                           np.linalg.inv(result[imin]['rotation_matrix']),
                                                       'translation_vector': result[imin]['translation_vector']}
                    if all_csms:
                        self._update_results_all_csms(result_dict, permutations, imin, geometry)
        return result_dict
214439
def hull(self):
        
        from scipy.spatial import ConvexHull
        if len(self.coordinates) >= 4:
            inds = ConvexHull(self.coordinates).vertices
            return self.coordinates[inds]
        else:
            return self.coordinates
188201
def covariance(self):
        

        mu = self.moments_central
        if mu[0, 0] != 0:
            m = mu / mu[0, 0]
            covariance = self._check_covariance(
                np.array([[m[0, 2], m[1, 1]], [m[1, 1], m[2, 0]]]))
            return covariance * u.pix**2
        else:
            return np.empty((2, 2)) * np.nan * u.pix**2
865336
def as_dict(self):
        
        bson_nb_voro_list2 = self.to_bson_voronoi_list2()
        return {"@module": self.__class__.__module__,
                "@class": self.__class__.__name__,
                "bson_nb_voro_list2": bson_nb_voro_list2,
                # "neighbors_lists": self.neighbors_lists,
                "structure": self.structure.as_dict(),
                "normalized_angle_tolerance": self.normalized_angle_tolerance,
                "normalized_distance_tolerance": self.normalized_distance_tolerance,
                "additional_conditions": self.additional_conditions,
                "valences": self.valences,
                "maximum_distance_factor": self.maximum_distance_factor,
                "minimum_angle_factor": self.minimum_angle_factor}
1043649
def measurements(self):
        
        if 'measurements' in self._values:
            return self._values['measurements']
        self._values['measurements'] = copy.deepcopy(self._defaults['measurements'])
        return self._values['measurements']
359229
def setup_local_geometry(self, isite, coords, optimization=None):
        
        self.local_geometry = AbstractGeometry(
            central_site=self.structure.cart_coords[isite],
            bare_coords=coords,
            centering_type=self.centering_type,
            include_central_site_in_centroid=
            self.include_central_site_in_centroid,
            optimization=optimization)
643134
def points(self):
        
        x = vtk_to_numpy(self.GetXCoordinates())
        y = vtk_to_numpy(self.GetYCoordinates())
        z = vtk_to_numpy(self.GetZCoordinates())
        xx, yy, zz = np.meshgrid(x,y,z, indexing='ij')
        return np.c_[xx.ravel(), yy.ravel(), zz.ravel()]
1074996
def get_rotations(self):
        """"""
        if self.centrosymmetric:
            return np.vstack((self.rotations, -self.rotations))
        else:
            return self.rotations
1273852
def get_continuous_dims(self):
        
        continuous_dims = []
        for i in range(self.dimensionality):
            if self.space_expanded[i].type == 'continuous':
                continuous_dims += [i]
        return continuous_dims
1167725
def get_geometries(self, coordination=None, returned='cg'):
        
        geom = list()
        if coordination is None:
            for gg in self.cg_list:
                if returned == 'cg':
                    geom.append(gg)
                elif returned == 'mp_symbol':
                    geom.append(gg.mp_symbol)
        else:
            for gg in self.cg_list:
                if gg.get_coordination_number() == coordination:
                    if returned == 'cg':
                        geom.append(gg)
                    elif returned == 'mp_symbol':
                        geom.append(gg.mp_symbol)
        return geom
305939
def faces(self):
        

        if self._faces is None:
            if self._vertices is None:
                return None
            self.triangulate()
        return self._faces
161035
def convex_hull(self):
        
        if self._faces is None:
            if self._vertices is None:
                return None
            self.triangulate()
        return self._convex_hull
1223617
def _sampleFromVertices(self):
    
    coordinates = [
      self.dimensions[0] / 2. * random.choice([-1, 1]),
      self.dimensions[1] / 2. * random.choice([-1, 1]),
      self.dimensions[2] / 2. * random.choice([-1, 1]),
    ]
    return coordinates
282871
def geometry(self):
        

        if self.coord is None:
            return None
        ra = self.coord.ra.degree
        dec = self.coord.dec.degree
        ccds = []

        for geo in self._geometry[self.camera]:
            ycen = geo["dec"] + dec
            xcen = geo["ra"] / math.cos(math.radians(ycen)) + ra
            try:
                dy = geo["ddec"]
                dx = geo["dra"] / math.cos(math.radians(ycen))
                ccds.append([xcen - dx / 2.0, ycen - dy / 2.0, xcen + dx / 2.0, ycen + dy / 2.0])
            except:
                rad = geo["rad"]
                ccds.append([xcen, ycen, rad])
        return ccds
52364
def snapshot(self):
        
        return dict((category, dict((name, metric.value())
                                    for name, metric in list(metrics.items())))
                    for category, metrics in
                    list(self._store.items()))
1168296
def symmetrize(self, method=None, copy=False):
    ''''''
    if copy:
      return SymmEdgePairGraph(self._pairs.copy(),
                               num_vertices=self._num_vertices)
    shape = (self._num_vertices, self._num_vertices)
    flat_inds = np.union1d(np.ravel_multi_index(self._pairs.T, shape),
                           np.ravel_multi_index(self._pairs.T[::-1], shape))
    self._pairs = np.transpose(np.unravel_index(flat_inds, shape))
    return self
865660
def units(self):
        
        existing = [i.units for i in self.geometry.values()]

        if any(existing[0] != e for e in existing):
            # if all of our geometry doesn't have the same units already
            # this function will only do some hot nonsense
            raise ValueError('models in scene have inconsistent units!')

        return existing[0]