This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
# 3D Case | |
def dot3d(v, w): | |
x, y, z = v | |
X, Y, Z = w | |
return x * X + y * Y + z * Z | |
def length3d(v): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def trans(coordinates_to_go, scale, ta, tb, tc, theta, phi, gamma): | |
""" | |
:param coordinates_to_go: [x, y, z].T | |
:param scale: | |
:param ta: | |
:param tb: | |
:param tc: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scipy.spatial import Delaunay | |
import numpy as np | |
from collections import defaultdict | |
def alpha_shape_3D(pos, alpha): | |
""" | |
Compute the alpha shape (concave hull) of a set of 3D points. | |
Parameters: | |
pos - np.array of shape (n,3) points. | |
alpha - alpha value. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import re | |
if __name__ == '__main__': | |
# get GPUs status | |
processes = os.popen("nvidia-smi | grep -w 'C'").read().strip().split("\n") | |
# occupancy dict by GPU index | |
occupancy = {str(i): [] for i in range(8)} |