marta-marta commited on
Commit
e533a14
·
1 Parent(s): 4b69d10

Found error in reading of output files. Need to edit how to output the files

Browse files
Data_Generation/Dataset_Generation_Functions.py CHANGED
@@ -1,5 +1,6 @@
1
  import numpy as np
2
-
 
3
  # from Data_Generation.Shape_Generation_Functions import basic_box, diagonal_box_split, horizontal_vertical_box_split, \
4
  # back_slash_box, forward_slash_box, back_slash_plus_box, forward_slash_plus_box, hot_dog_box, hamburger_box, \
5
  # x_hamburger_box, x_hot_dog_box, x_plus_box
@@ -70,4 +71,34 @@ def make_boxes(image_size, densities):
70
 
71
 
72
  ########################################################################################################################
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
 
 
 
 
 
 
1
  import numpy as np
2
+ import pandas as pd
3
+ import json
4
  # from Data_Generation.Shape_Generation_Functions import basic_box, diagonal_box_split, horizontal_vertical_box_split, \
5
  # back_slash_box, forward_slash_box, back_slash_plus_box, forward_slash_plus_box, hot_dog_box, hamburger_box, \
6
  # x_hamburger_box, x_hot_dog_box, x_plus_box
 
71
 
72
 
73
  ########################################################################################################################
74
+ image_size = 9
75
+ densities = [0.2, 0.4, 0.6, 0.8, 1]
76
+ boxes = make_boxes(image_size, densities)
77
+
78
+ box_arrays, box_density, basic_box_thickness, forward_slash_box_thickness, back_slash_box_thickness,hot_dog_box_thickness, hamburger_box_thickness\
79
+ = list(zip(*boxes))[0], list(zip(*boxes))[1], list(zip(*boxes))[2], list(zip(*boxes))[3], list(zip(*boxes))[4], list(zip(*boxes))[5], list(zip(*boxes))[6]
80
+
81
+
82
+
83
+ # Create a dataframe to convert the data to a csv file
84
+ dataframe = (pd.DataFrame((box_arrays, box_density, basic_box_thickness, forward_slash_box_thickness, back_slash_box_thickness,hot_dog_box_thickness, hamburger_box_thickness)).T).astype(str)
85
+
86
+ # Rename the columns to the desired outputs
87
+ dataframe = dataframe.rename(columns={0: "Array", 1: "Density", 2:"Basic Box Thickness", 3:"Forward Slash Strut Thickness", 4:"Back Slash Strut Thickness", 5:"Vertical Strut Thickness", 6:"Horizontal Strut Thickness"})
88
+
89
+ csv = dataframe.to_csv('2D_Lattice')
90
+
91
+
92
+
93
+ df = pd.read_csv('2D_Lattice')
94
+ # print(df)
95
+ row = 0
96
+ box = df.iloc[row, 1]
97
+ print(box)
98
+ array = np.array(json.loads(box))
99
+
100
 
101
+ # import matplotlib.pyplot as plt
102
+ # plt.imshow(np.array(box))
103
+ # plt.show()
104
+ # print(df)