Documentation
Class: Dic2d, file: dic2d.py
Main class of the 2D Digitial Image Correlation algoritm.
- __init__(log=None)
Constructor
log - object of the class Log()
- compute()
Start the computation.
- set_frames(frames=None)
Set frames.
frames - object of the class Frames()
- set_lib(path=None)
Set manualy path to dll library 'libdic2d.dll'
Use this function if there is a problem with loading
path - path to library
- set_odb(odb=None)
Set output database file.
odb - object of the class HdfOdb()
- set_region(region=None)
Set region of intrest.
region - object of the class PointRegion2d()
- set_settings(settings=None)
Set settings of the dic algorithm
settings - object of the class Settings()
- show()
Show the image and region of Dic2d analysis with use of
matplotlib packagae
Class: Grd2d, file: grd2d.py
Compute the gradinet of the field grad(F)
- __init__(log=None)
Constructor
log - object of the class Log()
- set_field_from_array(nodes=None, data=None)
Set array for gradient analysiss
nodes - 2d numpy array (n,2) n is the number of points
data - 3d numpy arrary (m,n,v), m is the number of time step
- set_field_from_odb(odb=None, name=None)
Set output database file which contains the file needed for gradient analysis
odb - object of the class HdfOdb()
name - name of the field which will be used to compute gradinet
- set_lib(path=None)
Set manualy path to dll library 'libgrd2d.dll'
Use this function if there is a problem with loading
path - path to library
- set_odb(odb=None, name=None)
Set output data file
odb - object of the class HdfOdb()
name - name of the gradinet field
- set_settings(settings=None)
Set settings of the dic algorithm
settings - object of the class Settings()
Class: Cpf2d, file: cpf2d.py
2d Coupled field algorithm
- __init__(log=None)
Constructor
log - object of the class Log()
- compute()
Start the computation.
- set_dic_field_from_odb(odb=None)
Set output database file which contains dic2d results
(computed displacemnt field).
odb - object of the class HdfOdb()
- set_lib(path=None)
Set manualy path to dll library 'libcpf2d.dll'
Use this function if there is a problem with loading
path - path to library
- set_log(log=None)
Set log object for error handling.
log - object of the class Log()
- set_odb(odb=None)
Set output database file.
odb - object of the class HdfOdb()
- set_settings(settings=None)
Set settings of the dic algorithm
settings - object of the class Settings()
Class: PointRegion2d, file: point_region_2d.py
A collections of points in two-dimensional space
- __init__(distribution=grid, n=100, point_step=1.0, log=None)
Constructor
distribution - "grid" or "random" (string)
n - number of points, valid only for distribution = "random", (int)
point_step - grid size, valid only for distribution = "grid", (float)
log - object of class Log()
- add_circural_hole(xc=0.0, yc=0.0, r=1.0)
Add circural hole to the region
xc, yc - coordinates of the center of the hole (float)
r - radius (float)
- add_rectangular_hole(xc=0.0, yc=0.0, a=1.0, b=2.0)
Add rectangular hole to the region
xc, yc - coordinates of the center of the hole (float)
a, b - side of the rectangle, horizintal and vertical (float)
- circle(xc=0.0, yc=0.0, r=1.0)
Set a circle as the boundary of points.
xc, yc - coordinates of the center of the circle (float)
r - radius (float)
- get_nodes()
Retrun the poinst of the region as a 2d numpy array
- image_based(path=None, offsets=[0, 0, 0, 0], sr=10, th=0.5)
Create points base on the image.
path - path to the image file (str)
offsets - python list [left, right, top, bottom]
sr - subset size used to compute standard deviation
th - thereshold value from 0 to 1 (float)
- polygon(vertices=None)
Set a polygon as the boundary of points.
vertices - list of coordinates [[x1, y1],[ x2, y2], ..., [xn yn]]
- rectangle(x0=None, y0=None, xc=None, yc=None, d=0.05, a=1.0, b=1.0)
Set a rectangle as the boundary of points.
x0, y0 - coordinates of the upper left corner (float), optional
xc, yc - coordinates of the center of the rectangle (float), optional
a - length of horizontal side of the rectangle
b - length of vertical side of the rectangle
Example: p = PointRegion2d()
p.rectangle(x0=0, y0=0, a=5, b=2)
p.rectangle(xc=2, y3=0, a=3, b=1)
Class: Frames, file: frames.py
Import images and arrays from files
- __init__(log=None)
Constructor
- add_from_file(path=None, time=None)
Add data from file
path - path to the file(str)
time - time associated with the frame (float)
- load_from_directory(path=None, start=1, end=-1, step=1, frequency=None, last=False)
Load the data from directory
path - path to the direcgory (string)
start - index of the first frame (int)
end - index of the last frame (int), minus one means the last frame
step - spacing between frames (int)
frequnecy - frequency of data recording (float)
last - end is the last value (bool)
- open_image(index=0, path=None)
Return the frame from file by index (2d numpy array)
The file is opened using Image class fromm PIL library
The rgb image is convert to gray scale
index - index of the frame e.g 0, 1, 2 (int)
path - path to the image (string)
- open_txt(index=0, path=None)
Return the frame data from file by index
The file is opened using numpy function 'loadtxt'
index - index of the frame e.g 0, 1, 2 (int)
path - path to the image (string)
Class: HdfOdb, file: hdfodb.py
Output database file based on h5py package
- __init__(path=None, log=None, mode=r+, copy_from=None)
Constructor
log - object of the class Log()
- close()
Close the file.
- get_time_array(name=None, step=None)
Return the array for given name and step (time).
name - array name (string)
step - number of time step (int)
- get_time_value(base=None, name=None, step=None)
Return the value associated with the array
base - name of the array (string)
name - name of the attribute (string)
step - number of time step (int)
- get_valid_points(data=None)
This method returns the valid indices of the array.
get_valid_points(data=[a,b, ..., c]) where a, b, c are 2d numpy array.
data - python list object
- open(mode=None)
Open the file.
mode - string ('a': append, 'r':read, 'w':, write)
Class: Settings, file: settings.py
Set the settings and check if they are correct.
- __init__(log=None)
Constructor
log - object of the class Log()
- edit()
Edit the settings.
- load(path=None)
Load the settins from the user file.
path - path to the json file (string)
- load_default(name=None)
Load the default settings.
name - name of the settings (string)