2323
2424def add_polygon_attribute_to_cube (model_id : str ) -> None :
2525 data_folder = os .path .join (os .environ ["DATA_FOLDER_PATH" ], model_id )
26- for filepath in glob .glob (os .path .join (data_folder , "**" , "Surface_*.vtp" ), recursive = True ):
26+ for filepath in glob .glob (
27+ os .path .join (data_folder , "**" , "Surface_*.vtp" ), recursive = True
28+ ):
2729 reader = vtkXMLPolyDataReader ()
2830 reader .SetFileName (filepath )
2931 reader .Update ()
3032 polydata = reader .GetOutput ()
31-
33+
3234 num_cells = polydata .GetNumberOfCells ()
3335 cell_array = vtkDoubleArray ()
3436 cell_array .SetName ("triangle_vertices" )
3537 cell_array .SetNumberOfComponents (1 )
3638 for i in range (num_cells ):
3739 cell_array .InsertNextValue (float (i ))
38-
40+
3941 polydata .GetCellData ().AddArray (cell_array )
40-
42+
4143 writer = vtkXMLPolyDataWriter ()
4244 writer .SetFileName (filepath )
4345 writer .SetInputData (polydata )
@@ -79,12 +81,18 @@ def test_surfaces_polygon_attribute(
7981 VtkModelSurfacesAttributePolygonView .model_surfaces_attribute_polygon_prefix
8082 + VtkModelSurfacesAttributePolygonView .model_surfaces_attribute_polygon_schemas_dict [
8183 "name"
82- ]["rpc" ],
83- [{"id" : model_id , "block_ids" : list (range (36 , 47 )), "name" : "triangle_vertices" }],
84- )
85- assert (
86- server .compare_image ("model/surfaces/attribute.jpeg" ) == True
84+ ][
85+ "rpc"
86+ ],
87+ [
88+ {
89+ "id" : model_id ,
90+ "block_ids" : list (range (36 , 47 )),
91+ "name" : "triangle_vertices" ,
92+ }
93+ ],
8794 )
95+ assert server .compare_image ("model/surfaces/attribute.jpeg" ) == True
8896
8997
9098def test_surfaces_polygon_color_map (
@@ -111,16 +119,26 @@ def test_surfaces_polygon_color_map(
111119 VtkModelSurfacesAttributePolygonView .model_surfaces_attribute_polygon_prefix
112120 + VtkModelSurfacesAttributePolygonView .model_surfaces_attribute_polygon_schemas_dict [
113121 "name"
114- ]["rpc" ],
115- [{"id" : model_id , "block_ids" : list (range (36 , 47 )), "name" : "triangle_vertices" }],
122+ ][
123+ "rpc"
124+ ],
125+ [
126+ {
127+ "id" : model_id ,
128+ "block_ids" : list (range (36 , 47 )),
129+ "name" : "triangle_vertices" ,
130+ }
131+ ],
116132 )
117133
118134 # Set color map: Blue to Red
119135 server .call (
120136 VtkModelSurfacesAttributePolygonView .model_surfaces_attribute_polygon_prefix
121137 + VtkModelSurfacesAttributePolygonView .model_surfaces_attribute_polygon_schemas_dict [
122138 "color_map"
123- ]["rpc" ],
139+ ][
140+ "rpc"
141+ ],
124142 [
125143 {
126144 "id" : model_id ,
@@ -141,9 +159,7 @@ def test_surfaces_polygon_color_map(
141159 ],
142160 )
143161
144- assert (
145- server .compare_image ("model/surfaces/color_map.jpeg" ) == True
146- )
162+ assert server .compare_image ("model/surfaces/color_map.jpeg" ) == True
147163
148164
149165def test_surfaces_polygon_color_map_range_update (
@@ -170,16 +186,26 @@ def test_surfaces_polygon_color_map_range_update(
170186 VtkModelSurfacesAttributePolygonView .model_surfaces_attribute_polygon_prefix
171187 + VtkModelSurfacesAttributePolygonView .model_surfaces_attribute_polygon_schemas_dict [
172188 "name"
173- ]["rpc" ],
174- [{"id" : model_id , "block_ids" : list (range (36 , 47 )), "name" : "triangle_vertices" }],
189+ ][
190+ "rpc"
191+ ],
192+ [
193+ {
194+ "id" : model_id ,
195+ "block_ids" : list (range (36 , 47 )),
196+ "name" : "triangle_vertices" ,
197+ }
198+ ],
175199 )
176200
177201 # Set Blue to Red Map
178202 server .call (
179203 VtkModelSurfacesAttributePolygonView .model_surfaces_attribute_polygon_prefix
180204 + VtkModelSurfacesAttributePolygonView .model_surfaces_attribute_polygon_schemas_dict [
181205 "color_map"
182- ]["rpc" ],
206+ ][
207+ "rpc"
208+ ],
183209 [
184210 {
185211 "id" : model_id ,
@@ -207,7 +233,9 @@ def test_surfaces_polygon_color_map_range_update(
207233 VtkModelSurfacesAttributePolygonView .model_surfaces_attribute_polygon_prefix
208234 + VtkModelSurfacesAttributePolygonView .model_surfaces_attribute_polygon_schemas_dict [
209235 "color_map"
210- ]["rpc" ],
236+ ][
237+ "rpc"
238+ ],
211239 [
212240 {
213241 "id" : model_id ,
@@ -228,10 +256,7 @@ def test_surfaces_polygon_color_map_range_update(
228256 ],
229257 )
230258
231- assert (
232- server .compare_image ("model/surfaces/updated_color_map.jpeg" )
233- == True
234- )
259+ assert server .compare_image ("model/surfaces/updated_color_map.jpeg" ) == True
235260
236261
237262def test_surfaces_polygon_color_map_red_shift (
@@ -258,16 +283,26 @@ def test_surfaces_polygon_color_map_red_shift(
258283 VtkModelSurfacesAttributePolygonView .model_surfaces_attribute_polygon_prefix
259284 + VtkModelSurfacesAttributePolygonView .model_surfaces_attribute_polygon_schemas_dict [
260285 "name"
261- ]["rpc" ],
262- [{"id" : model_id , "block_ids" : list (range (36 , 47 )), "name" : "triangle_vertices" }],
286+ ][
287+ "rpc"
288+ ],
289+ [
290+ {
291+ "id" : model_id ,
292+ "block_ids" : list (range (36 , 47 )),
293+ "name" : "triangle_vertices" ,
294+ }
295+ ],
263296 )
264297
265298 # Set Blue to Red Map on [0, 1]
266299 server .call (
267300 VtkModelSurfacesAttributePolygonView .model_surfaces_attribute_polygon_prefix
268301 + VtkModelSurfacesAttributePolygonView .model_surfaces_attribute_polygon_schemas_dict [
269302 "color_map"
270- ]["rpc" ],
303+ ][
304+ "rpc"
305+ ],
271306 [
272307 {
273308 "id" : model_id ,
@@ -295,7 +330,9 @@ def test_surfaces_polygon_color_map_red_shift(
295330 VtkModelSurfacesAttributePolygonView .model_surfaces_attribute_polygon_prefix
296331 + VtkModelSurfacesAttributePolygonView .model_surfaces_attribute_polygon_schemas_dict [
297332 "color_map"
298- ]["rpc" ],
333+ ][
334+ "rpc"
335+ ],
299336 [
300337 {
301338 "id" : model_id ,
@@ -316,9 +353,7 @@ def test_surfaces_polygon_color_map_red_shift(
316353 ],
317354 )
318355
319- assert (
320- server .compare_image ("model/surfaces/color_map_red_shift.jpeg" ) == True
321- )
356+ assert server .compare_image ("model/surfaces/color_map_red_shift.jpeg" ) == True
322357
323358
324359def test_surfaces_polygon_color_map_rainbow (
@@ -345,16 +380,26 @@ def test_surfaces_polygon_color_map_rainbow(
345380 VtkModelSurfacesAttributePolygonView .model_surfaces_attribute_polygon_prefix
346381 + VtkModelSurfacesAttributePolygonView .model_surfaces_attribute_polygon_schemas_dict [
347382 "name"
348- ]["rpc" ],
349- [{"id" : model_id , "block_ids" : list (range (36 , 47 )), "name" : "triangle_vertices" }],
383+ ][
384+ "rpc"
385+ ],
386+ [
387+ {
388+ "id" : model_id ,
389+ "block_ids" : list (range (36 , 47 )),
390+ "name" : "triangle_vertices" ,
391+ }
392+ ],
350393 )
351394
352395 # Rainbow Desaturated Map
353396 server .call (
354397 VtkModelSurfacesAttributePolygonView .model_surfaces_attribute_polygon_prefix
355398 + VtkModelSurfacesAttributePolygonView .model_surfaces_attribute_polygon_schemas_dict [
356399 "color_map"
357- ]["rpc" ],
400+ ][
401+ "rpc"
402+ ],
358403 [
359404 {
360405 "id" : model_id ,
@@ -399,17 +444,16 @@ def test_surfaces_polygon_color_map_rainbow(
399444 ],
400445 )
401446
402- assert (
403- server .compare_image ("model/surfaces/color_map_rainbow_initial.jpeg" )
404- == True
405- )
447+ assert server .compare_image ("model/surfaces/color_map_rainbow_initial.jpeg" ) == True
406448
407449 # Update rainbow range via color map
408450 server .call (
409451 VtkModelSurfacesAttributePolygonView .model_surfaces_attribute_polygon_prefix
410452 + VtkModelSurfacesAttributePolygonView .model_surfaces_attribute_polygon_schemas_dict [
411453 "color_map"
412- ]["rpc" ],
454+ ][
455+ "rpc"
456+ ],
413457 [
414458 {
415459 "id" : model_id ,
0 commit comments