Package: oeg-iv
Python package for communication with InspectionViewer appThe library provides a set of high-level operations with export/import CSV file of the InspectionViewer, the Win32 app for analyzing in-line flaw detection data.Data can bemirroredglued together from several CSV filesstretched/compressed along the distance according to a given set of intermediate pointsinterpreted as an iterable sequence of pipes with geodataInstallpipinstalloeg-ivUsageConstruct new csv file from scratch.importosfromoeg_ivimportTypeHorWeld,TypeDefekt,DefektSidefromoeg_iv.orientationimportOrientationfromoeg_iv.csvfileimportFilefromoeg_iv.csvfile.rowimportRow# create empty csvcsv_file=File()# define tube at distance 1.0 m# length = 11.0 m, thick = 10.5 mm# with one seam with orientation 3 hour 00 minutescsv_file.data=[Row.as_weld(1000),Row.as_thick(1010,105),Row.as_seam(1020,TypeHorWeld.HORIZONTAL,Orientation(3,0),None),Row.as_weld(12000),]# add defect to tube at distance 5.0 m from left tube weld# length = 20 mm, width = 10 mm, depth = 30% tube wall thickness# orientation from 4 hours 00 minutes to 5 hours 00 minutes# maximum depth point at distance 5.01 m from left tube weld,# orientation 4 hours 30 minutes# with comment 'metal loss'csv_file.data.append(Row.as_defekt(6000,TypeDefekt.CORROZ,DefektSide.OUTSIDE'20','10','30',Orientation(4,0),Orientation(5,0),6010,Orientation(4,30),'metal loss'))# save csv to filecsv_file.to_file('example.csv')assertos.path.getsize('example.csv')>0Reversing the data.# create copy from saved filecsv_copy=File.from_file('example.csv')# check distance of the last object in copyassertcsv_copy.total_length==12000assertlen(csv_copy.data)==5# check defect orientationdefect_row=csv_copy.data[3]assertdefect_row.is_defectassertdefect_row.orient_td=='4,00'assertdefect_row.orient_bd=='5,00'# reverse copycsv_copy.reverse()# relative position of defekt must changedefect_row=csv_copy.data[2]assertdefect_row.is_defect# defect orientation must be mirroredassertdefect_row.orient_td=='7,00'assertdefect_row.orient_bd=='8,00'# save reversed copy to filecsv_file.to_file('reversed.csv')assertos.path.getsize('reversed.csv')>0Append to initial CSV empty pipe with length = 10.0 m and reversed copy from the file.csv_file.join([10000,'reversed.csv'])assertcsv_file.total_length==28000assertlen(csv_file.data)==11Compress distances and length of all objects in half.csv_file.dist_modify(# table of corrections# each node define as pair 'existing distance', 'new distance'[[0,0],[28000,14000],])assertcsv_file.total_length==14000# save file with compress distancescsv_file.to_file('transformed.csv')assertos.path.getsize('transformed.csv')>0Iterate by pipes and modify data.csv_trans=File.from_file('transformed.csv')warnings=[]current_dist=0foriincsv_trans.get_tubes(warnings):asserti.dist>=current_distcurrent_dist=i.disttube=iassertnotwarnings# set geodata for tubeasserttube.latitude==''asserttube.longtitude==''asserttube.altitude==''tube.set_geo(10,11,12)asserttube.latitude==10asserttube.longtitude==11asserttube.altitude==12csv_trans.to_file('geo.csv')assertos.path.getsize('geo.csv')>0# load from saved file and check geodata from last pipecsv_geo=File.from_file('geo.csv')last_tube=list(csv_geo.get_tubes(warnings))[-1]assertlast_tube.latitude=='10'assertlast_tube.longtitude=='11'assertlast_tube.altitude=='12'Developmentgitclonegit@github.com:vb64/oeg.iv.gitcdoeg.ivWith Python3makesetupPYTHON_BIN=/path/to/python3/executable
maketestsWith Python2makesetup2PYTHON_BIN=/path/to/python27/executable
maketests2