1 from paraview.simple import *
2 from vtk.util import numpy_support
5 paraview.simple._DisableFirstRenderCameraReset()
7 # Normal single precision file
8 reader = SerafinReader(FileName='geo_sp.slf')
9 reader.UpdatePipeline()
10 reader_ds = servermanager.Fetch(reader)
11 # Checking that fields THING X THING Y are merged into THING *
12 list_var = [reader_ds.GetPointData().GetArrayName(i).strip() for i in range(reader_ds.GetPointData().GetNumberOfArrays())]
13 assert("THING *" in list_var)
14 assert("THING X" not in list_var)
15 assert("THING OTHER" in list_var)
16 # Checking that fields VELOCITY U, VELOCITY V are merged into VELOCITY *
17 assert("VELOCITY *" in list_var)
18 assert("VELOCITY U" not in list_var)
19 assert("VELOCITY STUFF" in list_var)
20 # Checking that VELOCITY has 3 components shoulb be on 0
21 assert(reader_ds.GetPointData().GetArray(0).GetNumberOfComponents() == 3)
23 # Simple read of Litte Endian file (Would crash if issue in the plugin)
24 reader = SerafinReader(FileName='geo_sp_le.slf')
25 # Simple read of Litte Endian file (Would crash if issue in the plugin)
26 reader = SerafinReader(FileName='geo_dp_le.slf')
28 # Normal double precision file
29 reader = SerafinReader(FileName='geo_dp.slf')
30 reader.UpdatePipeline()
31 reader_ds = servermanager.Fetch(reader)
32 # Checking that values are properly read
33 data = numpy_support.vtk_to_numpy(reader_ds.GetPointData().GetArray(0))
34 assert(np.all(data <= 1e-8))
37 reader = SerafinReader(FileName='geo_3d_dp.slf')
38 reader.UpdatePipeline()
39 reader_ds = servermanager.Fetch(reader)