topologicpy 0.4.7__py3-none-any.whl → 0.4.9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
topologicpy/DGL.py CHANGED
@@ -1567,10 +1567,11 @@ class DGL:
1567
1567
 
1568
1568
  """
1569
1569
  from sklearn import metrics
1570
+ import numpy
1570
1571
  if normalize:
1571
- cm = metrics.confusion_matrix(y_true=actual, y_pred=predicted, normalize="true")
1572
+ cm = numpy.transpose(metrics.confusion_matrix(y_true=actual, y_pred=predicted, normalize="true"))
1572
1573
  else:
1573
- cm = metrics.confusion_matrix(y_true=actual, y_pred=predicted)
1574
+ cm = numpy.transpose(metrics.confusion_matrix(y_true=actual, y_pred=predicted))
1574
1575
  return cm
1575
1576
 
1576
1577
  @staticmethod
@@ -2048,6 +2049,7 @@ class DGL:
2048
2049
  for item in tqdm(dataset, desc='Predicting', leave=False):
2049
2050
  graph = item[0]
2050
2051
  pred = model(graph, graph.ndata[node_attr_key].float())
2052
+ print(pred)
2051
2053
  values.append(round(pred.item(), 3))
2052
2054
  return values
2053
2055
 
topologicpy/Plotly.py CHANGED
@@ -1032,7 +1032,10 @@ class Plotly:
1032
1032
  new_row = []
1033
1033
  maxRow = sum(row)
1034
1034
  for j in range(len(row)):
1035
- new_row.append(round(float(row[j])/float(maxRow), 3))
1035
+ if maxRow == 0:
1036
+ new_row.append(round(0, 3))
1037
+ else:
1038
+ new_row.append(round(float(row[j])/float(maxRow), 3))
1036
1039
  new_matrix.append(new_row)
1037
1040
  data = go.Heatmap(z=new_matrix, y=yCategories, x=xCategories, zmin=minValue, zmax=maxValue, showscale=showScale, colorscale=colors)
1038
1041
 
topologicpy/Topology.py CHANGED
@@ -1771,8 +1771,8 @@ class Topology():
1771
1771
 
1772
1772
  Parameters
1773
1773
  ----------
1774
- path : str
1775
- The file path to the OBJ file.
1774
+ file : file object
1775
+ The input OBJ file.
1776
1776
  transposeAxes : bool , optional
1777
1777
  If set to True the Z and Y coordinates are transposed so that Y points "up"
1778
1778
  tolerance : float , optional
@@ -1827,7 +1827,9 @@ class Topology():
1827
1827
 
1828
1828
  if not file:
1829
1829
  return None
1830
- lines = file.readlines()
1830
+ lines = []
1831
+ for lineo, line in enumerate(file):
1832
+ lines.append(line)
1831
1833
  if lines:
1832
1834
  if progressBar:
1833
1835
  if renderer.lower() == "notebook":
@@ -1934,6 +1936,134 @@ class Topology():
1934
1936
  returnTopology = None
1935
1937
  return returnTopology
1936
1938
 
1939
+ @staticmethod
1940
+ def ByXYZFile(file, frameIdKey="id", vertexIdKey="id"):
1941
+ """
1942
+ Imports the topology from an XYZ file path. This is a very experimental method. While variants of the format exist, topologicpy reads XYZ files that conform to the following:
1943
+ An XYZ file can be made out of one or more frames. Each frame will be stored in a sepatate topologic cluster.
1944
+ First line: total number of vertices in the frame. This must be an integer. No other words or characters are allowed on this line.
1945
+ Second line: frame label. This is free text and will be stored in the dictionary of each frame (topologic.Cluster)
1946
+ All other lines: vertex_label, x, y, and z coordinates, separated by spaces, tabs, or commas. The vertex label must be one word with no spaces. It is stored in the dictionary of each vertex.
1947
+
1948
+ Example:
1949
+ 3
1950
+ Frame 1
1951
+ A 5.67 -3.45 2.61
1952
+ B 3.91 -1.91 4
1953
+ A 3.2 1.2 -12.3
1954
+ 4
1955
+ Frame 2
1956
+ B 5.47 -3.45 2.61
1957
+ B 3.91 -1.93 3.1
1958
+ A 3.2 1.2 -22.4
1959
+ A 3.2 1.2 -12.3
1960
+ 3
1961
+ Frame 3
1962
+ A 5.67 -3.45 2.61
1963
+ B 3.91 -1.91 4
1964
+ C 3.2 1.2 -12.3
1965
+
1966
+ Parameters
1967
+ ----------
1968
+ file : file object
1969
+ The input XYZ file.
1970
+ frameIdKey : str , optional
1971
+ The desired id key to use to store the ID of each frame in its dictionary. The default is "id".
1972
+ vertexIdKey : str , optional
1973
+ The desired id key to use to store the ID of each point in its dictionary. The default is "id".
1974
+
1975
+ Returns
1976
+ -------
1977
+ list
1978
+ The list of frames (topologic.Cluster).
1979
+
1980
+ """
1981
+ from topologicpy.Vertex import Vertex
1982
+ from topologicpy.Cluster import Cluster
1983
+ from topologicpy.Dictionary import Dictionary
1984
+
1985
+ def parse(lines):
1986
+ frames = []
1987
+ line_index = 0
1988
+ while line_index < len(lines):
1989
+ try:
1990
+ n_vertices = int(lines[line_index])
1991
+ except:
1992
+ return frames
1993
+ frame_label = lines[line_index+1][:-1]
1994
+ vertices = []
1995
+ for i in range(n_vertices):
1996
+ one_line = lines[line_index+2+i]
1997
+ s = one_line.split()
1998
+ vertex_label = s[0]
1999
+ v = Vertex.ByCoordinates(float(s[1]), float(s[2]), float(s[3]))
2000
+ vertex_dict = Dictionary.ByKeysValues([vertexIdKey], [vertex_label])
2001
+ v = Topology.SetDictionary(v, vertex_dict)
2002
+ vertices.append(v)
2003
+ frame = Cluster.ByTopologies(vertices)
2004
+ frame_dict = Dictionary.ByKeysValues([frameIdKey], [frame_label])
2005
+ frame = Topology.SetDictionary(frame, frame_dict)
2006
+ frames.append(frame)
2007
+ line_index = line_index + 2 + n_vertices
2008
+ return frames
2009
+
2010
+ if not file:
2011
+ return None
2012
+ lines = []
2013
+ for lineo, line in enumerate(file):
2014
+ lines.append(line)
2015
+ if len(lines) > 0:
2016
+ frames = parse(lines)
2017
+ file.close()
2018
+ return frames
2019
+
2020
+ @staticmethod
2021
+ def ByXYZPath(path, frameIdKey="id", vertexIdKey="id"):
2022
+ """
2023
+ Imports the topology from an XYZ file path. This is a very experimental method. While variants of the format exist, topologicpy reads XYZ files that conform to the following:
2024
+ An XYZ file can be made out of one or more frames. Each frame will be stored in a sepatate topologic cluster.
2025
+ First line: total number of vertices in the frame. This must be an integer. No other words or characters are allowed on this line.
2026
+ Second line: frame label. This is free text and will be stored in the dictionary of each frame (topologic.Cluster)
2027
+ All other lines: vertex_label, x, y, and z coordinates, separated by spaces, tabs, or commas. The vertex label must be one word with no spaces. It is stored in the dictionary of each vertex.
2028
+
2029
+ Example:
2030
+ 3
2031
+ Frame 1
2032
+ A 5.67 -3.45 2.61
2033
+ B 3.91 -1.91 4
2034
+ A 3.2 1.2 -12.3
2035
+ 4
2036
+ Frame 2
2037
+ B 5.47 -3.45 2.61
2038
+ B 3.91 -1.93 3.1
2039
+ A 3.2 1.2 -22.4
2040
+ A 3.2 1.2 -12.3
2041
+ 3
2042
+ Frame 3
2043
+ A 5.67 -3.45 2.61
2044
+ B 3.91 -1.91 4
2045
+ C 3.2 1.2 -12.3
2046
+
2047
+ Parameters
2048
+ ----------
2049
+ path : str
2050
+ The input XYZ file path.
2051
+ frameIdKey : str , optional
2052
+ The desired id key to use to store the ID of each frame in its dictionary. The default is "id".
2053
+ vertexIdKey : str , optional
2054
+ The desired id key to use to store the ID of each point in its dictionary. The default is "id".
2055
+
2056
+ Returns
2057
+ -------
2058
+ list
2059
+ The list of frames (topologic.Cluster).
2060
+
2061
+ """
2062
+ if not path:
2063
+ return None
2064
+ file = open(path)
2065
+ return Topology.ByXYZFile(file, frameIdKey=frameIdKey, vertexIdKey=frameIdKey)
2066
+
1937
2067
  @staticmethod
1938
2068
  def CenterOfMass(topology):
1939
2069
  """
topologicpy/Vector.py CHANGED
@@ -32,7 +32,46 @@ class Vector(list):
32
32
  cosang = np.dot(vectorA, vectorB)
33
33
  sinang = la.norm(np.cross(vectorA, vectorB))
34
34
  return round(math.degrees(np.arctan2(sinang, cosang)), mantissa)
35
+
36
+ @staticmethod
37
+ def AzimuthAltitude(vector, mantissa=4):
38
+ """
39
+ Returns a dictionary of azimuth and altitude angles in degrees for the input vector. North is assumed to be the positive Y axis [0,1,0]. Up is assumed to be the positive Z axis [0,0,1].
40
+ Azimuth is calculated in a counter-clockwise fashion from North where 0 is North, 90 is East, 180 is South, and 270 is West. Altitude is calculated in a counter-clockwise fashing where -90 is straight down (negative Z axis), 0 is in the XY plane, and 90 is straight up (positive Z axis).
41
+ If the altitude is -90 or 90, the azimuth is assumed to be 0.
42
+
43
+ Parameters
44
+ ----------
45
+ vectorA : list
46
+ The input vector.
47
+ mantissa : int, optional
48
+ The length of the desired mantissa. The default is 4.
35
49
 
50
+ Returns
51
+ -------
52
+ dict
53
+ The dictionary containing the azimuth and altitude angles in degrees. The keys in the dictionary are 'azimuth' and 'altitude'.
54
+
55
+ """
56
+ x, y, z = vector
57
+ if x == 0 and y == 0:
58
+ if z > 0:
59
+ return {"azimuth":0, "altitude":90}
60
+ elif z < 0:
61
+ return {"azimuth":0, "altitude":-90}
62
+ else:
63
+ # undefined
64
+ return None
65
+ else:
66
+ azimuth = math.degrees(math.atan2(y, x))
67
+ if azimuth > 90:
68
+ azimuth -= 360
69
+ azimuth = round(90-azimuth, mantissa)
70
+ xy_distance = math.sqrt(x**2 + y**2)
71
+ altitude = math.degrees(math.atan2(z, xy_distance))
72
+ altitude = round(altitude, mantissa)
73
+ return {"azimuth":azimuth, "altitude":altitude}
74
+
36
75
  @staticmethod
37
76
  def ByAzimuthAltitude(azimuth, altitude, north=0, reverse=False):
38
77
  """
topologicpy/__init__.py CHANGED
@@ -2,7 +2,7 @@ import sys
2
2
  import os, re
3
3
  from sys import platform
4
4
 
5
- __version__ = '0.4.7'
5
+ __version__ = '0.4.9'
6
6
  __version_info__ = tuple([ int(num) for num in __version__.split('.')])
7
7
 
8
8
  if platform == 'win32':
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: topologicpy
3
- Version: 0.4.7
3
+ Version: 0.4.9
4
4
  Summary: An Advanced Spatial Modelling and Analysis Software Library for Architecture, Engineering, and Construction.
5
5
  Author-email: Wassim Jabi <wassim.jabi@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/wassimj/TopologicPy
@@ -4,7 +4,7 @@ topologicpy/CellComplex.py,sha256=b-JBSWJhIEvtxaT8JYj4DnHmJwt4EiqLFe2SpufYmFg,29
4
4
  topologicpy/Cluster.py,sha256=X95HSYD6Vgd1KMlbgH2SYMtzmzl7rRESgDcgVux1ALE,20198
5
5
  topologicpy/Color.py,sha256=gTusJtB_PRSS6p7dkF8Eockbf7d3GA6VYXSVxsn0iY4,6585
6
6
  topologicpy/Context.py,sha256=cPxfxUScXcJVafSTnCTCNpRzBGSbu90D5i6uu26S5us,1643
7
- topologicpy/DGL.py,sha256=qcqQ2RpbykhWaV0cS8npny8egaPh2-GcSu-QeoF2xeY,116875
7
+ topologicpy/DGL.py,sha256=dn68mVYP61NsZBX0CEtv5xeK0T_fLgAkrkBUYz3YVLQ,116956
8
8
  topologicpy/Dictionary.py,sha256=SMM0wQPySr1AvUX97AQpn1tca5mkkicRN-sUMSR7c_M,17016
9
9
  topologicpy/Edge.py,sha256=Q3Y6VsptyRl99pENBiy2uzVQpoqP59JbS1rdxqhgwUE,30629
10
10
  topologicpy/EnergyModel.py,sha256=Tah75zLnvvKKEjCbjH-A9ynp6xh8wFBVobSiWPgL9tY,46784
@@ -16,18 +16,18 @@ topologicpy/Helper.py,sha256=51sDsc_bIXa90JKG58yUDl0ocdOmJOtsanS4txMeQiQ,5243
16
16
  topologicpy/Honeybee.py,sha256=jeU9PjGjYhVlF8hC8ChjE8Tey53bIQ1uQTS-rac1LYo,18869
17
17
  topologicpy/Matrix.py,sha256=GHd_o714eEWbTOhRM5X-fXcgsV5yYJJSj6xFdnkwC14,7625
18
18
  topologicpy/Neo4jGraph.py,sha256=_5Mqnwx98EWDA_gfGD93SlivdELSXUhcQ7WjqXLVi_I,10771
19
- topologicpy/Plotly.py,sha256=erMZDCVzNRD2a6EQPSWbtaslrLvQMfQ1a1fTR01dtdw,64801
19
+ topologicpy/Plotly.py,sha256=dIjhXCqhI6wGeK5g0S8RDcM0nJO3EeCn8gbTElZgLFQ,64910
20
20
  topologicpy/Polyskel.py,sha256=jz5k5H6p4QRWe3bbMnyYbP9Iji6EQ1wdk3qQvcnbg08,15156
21
21
  topologicpy/Process.py,sha256=YyPYq9HdzIwyEMog7gF_jIBskD_vVWAzTrVS8mcEwOc,53710
22
22
  topologicpy/SQL.py,sha256=6pdbdBAkpNi0VbIat996Swna-qQ-Osm31Kq6YCTEOH8,1892
23
23
  topologicpy/Shell.py,sha256=yU69Wj6Z-lzgGn8-tbkvWtWOg6SJez3kPWwdDNX-lbY,56757
24
24
  topologicpy/Speckle.py,sha256=65IHXjuNhHAusy4kPp70wlPF8QueSPJ-85v6dPc0uo4,11548
25
- topologicpy/Topology.py,sha256=9w4kZP7K5u26UuT5mqQn0cEqTy3eBBIz8GmcCBGcN0w,232595
25
+ topologicpy/Topology.py,sha256=KkRYZanK3_GH5oa1vQ1iFEnYkvsxZqXOEHoFaOv6cPs,237855
26
26
  topologicpy/UnitTest.py,sha256=JBgLkWaJQd4Ee1XSyLVojEbRJKcxj-DbeVSxoeHmiOs,1380
27
- topologicpy/Vector.py,sha256=7FE_CYn0ja2ABWNHfT7ark4_kixyFeJnlpQOR_1w7Jo,16236
27
+ topologicpy/Vector.py,sha256=TE0Rt7SZ4NQD0YR3ty3crhb7BYbRws_UJ-lj2ihxPXU,17988
28
28
  topologicpy/Vertex.py,sha256=sO-CqyiZj_7h9hr-1s5IcRer_uT_FZvg8dozBsVZcEY,26627
29
29
  topologicpy/Wire.py,sha256=Xo0F0bXtxJsT1cTVX-pG0-eDlpnOqwSY99pRhpNdKNI,99555
30
- topologicpy/__init__.py,sha256=Dty3UXMV_C1ZdBArXjEAVQz7ho1YdqnMlzHx7o1w8bA,641
30
+ topologicpy/__init__.py,sha256=IEx4Csm3tHgOLaJn2sDsqPr4iiJHHvMNYwNSPJFrOjQ,641
31
31
  topologicpy/bin/linux/topologic/__init__.py,sha256=qdj8gyp_GtYre27ZdFiVdLzLViOgX62woBZLTy9K91c,58
32
32
  topologicpy/bin/linux/topologic/topologic.cpython-310-x86_64-linux-gnu.so,sha256=uvar01STZ8qu1c8fRmtYdVnK8evxBv305QScASXY9go,1852112
33
33
  topologicpy/bin/linux/topologic/topologic.cpython-311-x86_64-linux-gnu.so,sha256=42yjVWetFu_qn6-eZcDxgd_A8SQN_wHqkdw91txKt9U,1852112
@@ -70,8 +70,8 @@ topologicpy/bin/windows/topologic/topologic.cp310-win_amd64.pyd,sha256=F0sPLuMpD
70
70
  topologicpy/bin/windows/topologic/topologic.cp311-win_amd64.pyd,sha256=aBAJQj3OmJ58MOAF1ZIFybL_5fFK7FNR9hrIps6b6pc,1551872
71
71
  topologicpy/bin/windows/topologic/topologic.cp38-win_amd64.pyd,sha256=aLgNf54nbJmGc7Tdmkuy-V0m6B9zLxabIbpRwAy7cBA,1551360
72
72
  topologicpy/bin/windows/topologic/topologic.cp39-win_amd64.pyd,sha256=_8cp205hiRxkFHtzQQOweA4DhCPk8caH4kTVLWGQeVw,1411584
73
- topologicpy-0.4.7.dist-info/LICENSE,sha256=RUmXeeqj63bBySLJjEfhwb9OE7M8h9K6HuOBF3ASVyI,35697
74
- topologicpy-0.4.7.dist-info/METADATA,sha256=D27FzxyAN9gtkVwxbd85pm9i1CHKML62hFp7QTHBLjw,6994
75
- topologicpy-0.4.7.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
76
- topologicpy-0.4.7.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
77
- topologicpy-0.4.7.dist-info/RECORD,,
73
+ topologicpy-0.4.9.dist-info/LICENSE,sha256=RUmXeeqj63bBySLJjEfhwb9OE7M8h9K6HuOBF3ASVyI,35697
74
+ topologicpy-0.4.9.dist-info/METADATA,sha256=u2bxV0MM92XQAAZuj-Fqww88Ul8O6PFvq36Jw_fr8ac,6994
75
+ topologicpy-0.4.9.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
76
+ topologicpy-0.4.9.dist-info/top_level.txt,sha256=J30bDzW92Ob7hw3zA8V34Jlp-vvsfIkGzkr8sqvb4Uw,12
77
+ topologicpy-0.4.9.dist-info/RECORD,,