Skip to main content

Python package for communication with InspectionViewer app

GitHub Workflow Status GitHub Workflow Status GitHub Workflow Status Codacy Badge Codacy Badge

The 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 be

  • mirrored
  • glued together from several CSV files
  • stretched/compressed along the distance according to a given set of intermediate points
  • interpreted as an iterable sequence of pipes with geodata

Install

pip install oeg-iv

Usage

Construct new csv file from scratch.

import os

from oeg_iv import TypeHorWeld, TypeDefekt, DefektSide
from oeg_iv.orientation import Orientation
from oeg_iv.csvfile import File
from oeg_iv.csvfile.row import Row

# create empty csv
csv_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 minutes
csv_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 file
csv_file.to_file('example.csv')
assert os.path.getsize('example.csv') > 0

Reversing the data.

# create copy from saved file
csv_copy = File.from_file('example.csv')

# check distance of the last object in copy
assert csv_copy.total_length == 12000
assert len(csv_copy.data) == 5

# check defect orientation
defect_row = csv_copy.data[3]
assert defect_row.is_defect
assert defect_row.orient_td == '4,00'
assert defect_row.orient_bd == '5,00'

# reverse copy
csv_copy.reverse()

# relative position of defekt must change
defect_row = csv_copy.data[2]
assert defect_row.is_defect

# defect orientation must be mirrored
assert defect_row.orient_td == '7,00'
assert defect_row.orient_bd == '8,00'

# save reversed copy to file
csv_file.to_file('reversed.csv')
assert os.path.getsize('reversed.csv') > 0

Append to initial CSV empty pipe with length = 10.0 m and reversed copy from the file.

csv_file.join([10000, 'reversed.csv'])
assert csv_file.total_length == 28000
assert len(csv_file.data) == 11

Compress 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],
])
assert csv_file.total_length == 14000

# save file with compress distances
csv_file.to_file('transformed.csv')
assert os.path.getsize('transformed.csv') > 0

Iterate by pipes and modify data.

csv_trans = File.from_file('transformed.csv')
warnings = []
current_dist = 0
for i in csv_trans.get_tubes(warnings):
    assert i.dist >= current_dist
    current_dist = i.dist
    tube = i

assert not warnings

# set geodata for tube
assert tube.latitude == ''
assert tube.longtitude == ''
assert tube.altitude == ''

tube.set_geo(10, 11, 12)

assert tube.latitude == 10
assert tube.longtitude == 11
assert tube.altitude == 12

csv_trans.to_file('geo.csv')
assert os.path.getsize('geo.csv') > 0

# load from saved file and check geodata from last pipe
csv_geo = File.from_file('geo.csv')
last_tube = list(csv_geo.get_tubes(warnings))[-1]

assert last_tube.latitude == '10'
assert last_tube.longtitude == '11'
assert last_tube.altitude == '12'

Development

git clone git@github.com:vb64/oeg.iv.git
cd oeg.iv

With Python3

make setup PYTHON_BIN=/path/to/python3/executable
make tests

With Python2

make setup2 PYTHON_BIN=/path/to/python27/executable
make tests2

Metadata

Release files for oeg-iv 1.9.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for oeg-iv 1.9.3
File Size Uploaded
oeg_iv-1.9.3.tar.gz 28.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for oeg-iv 1.9.3
File Interpreter ABI Platform
oeg_iv-1.9.3-py3-none-any.whl Python 3 none any Details

Total release size: 55.9 kB

Release files / oeg_iv-1.9.3.tar.gz

Download URL oeg_iv-1.9.3.tar.gz
Size 28.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b3f0c977ec229be26a1c70d49fd01bd2899ef97386dbf7f67d0019ee38dbc93f
BLAKE2b-256 checksum
How to use checksums
d56d045eb6fad599483589cbc330cb3a7d2e64ae58f38cbfd8d05478117998b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Release files / oeg_iv-1.9.3-py3-none-any.whl

Download URL oeg_iv-1.9.3-py3-none-any.whl
Size 27.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
48659e91b8b896e6b0b6dd13cdbecabffded9e7faeefd92c4f4228eae6872ffb
BLAKE2b-256 checksum
How to use checksums
f494cf7aac1afad843705c736241ceb21b090f48db66206159e4b488a13274de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Release history Release notifications | RSS feed

This release

1.9.3 This release

2 release files

1.9.2

2 release files

1.9.1

2 release files

1.9

2 release files

1.8

2 release files

1.7

2 release files

1.6

2 release files

1.5

2 release files

1.4

2 release files

1.3

2 release files

1.2

2 release files

1.1

2 release files

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page