polymerguy / mudic Goto Github PK
View Code? Open in Web Editor NEWDigital Image Correlation in Python
License: MIT License
Digital Image Correlation in Python
License: MIT License
The tests are a bit on the rough side implementation wise and should be refactored for better readability.
I am getting this error with scipy version 1.3.0
Any ideas what I may be doing wrong?
Thanks!
in the docstring says the dot size is int bounded by 0 and 1 but the default value is 4!!!
Parameters
----------
size : tuple
The image size as a tuple of integers
dot_size : int
The size of the dots [0,1]
density: float, int
How packeg with dots the speckle should be
smoothness: float, int
The degree of smoothing applied to the binary speckle
Hi!
This toolkit looks amazing!
I have seen that simmilar issues have already been reported, but to support the quicker solvation of the problem I make a new issue.
I have tried to go through the quick start guide which is super nice to have, I have encountered the following error message, which is in my knowledge is due to that the used matplotlib.widget.RectangleSelector has changed and thats why it displays a problem.
Could it be the problem?
If yes, would you please solve thees problems?
I am a bit new to DIC and have a question if it is possible to measure the displacement at a single point on a structure. The video below show the compliant mechanism that I would like to test. I want to measure the horizontal displacement at the end of the middle section. Is this possible with µDIC (of course with a better videoJ)?
In order to be able to observe the displacement of the sample out of plane (2D), I would like to use openCV to also work in the depth of the image. For that I think to proceed in 3 steps:
Until now, lack of convergence triggers a reference update and a retry. If this does not help, the solver aborts.
We should allow for lack of convergence as this might be a temporary problem and convergence can be obtained a few frames later.
Suggestion:
The "DIC challenge" from the SEM (Society of Experimental Mechanics) community should be included as a demo and a part of the test suite. This could also be included as excellent tutorials.
The datasets are found here: https://sem.org/dicchallenge
And their paper with initial results are found here: https://link.springer.com/article/10.1007/s11340-017-0349-0
Suggestion:
The test coverage is on the low side and more unit tests would be very helpfull
While plotting the analysis results with the visualizer included in the toolkit neither the field nor the component selected are shown.
It would be helpful if the code could display the plotted field and component, together with the frame number.
Hello @PolymerGuy and muDIC users !
I have written a little Python script to use muDIC's functions for my needs. I am simply following the tutorial; but I have added a way to manually define the mesh (without the GUI) and keep only desired images.
However, when I run a DICAnalysis job, it often happens that the routine stops before going through the whole image stack.
I have checked that the parameters I have given to the DICInput object are noconverge="ignore" and max_nr_im=None (default). If I understand the code correctly, when max_nr_im=None, its value should be set to the length of the image stack. So I do not understand why the DICAnalysis job stops sooner than expected.
Attached are my Python script compute_DIC.txt and its output.txt. In this example, the length of image stack was 720, but only the first 95 images were analyzed.
Note : I can not send a .py file on GitHub, so I sent a txt file. A screenshot of the first part of the script is also .
If you have any idea why the job stops, I would really appreciate your help.
Have a nice day
Hello blogger, your results are very great. Is there any relevant video tutorial or more detailed text explanation about the use of MuDIC? Looking forward to your reply, thank you.
The reference updates are rathet slow and the scaling with respect to the number of nodes is not as good as it could have been. Usually not a problem when few contol points and higher order shape functions are used
Continuing from here: #24 (comment).
For the sake of future development, we should decide on a baseline for how the strains are calculated in µDIC.
I propose the methodology found in this document: Strain_calulations_in_DIC.pdf
The plan is to later merge it into the documentation.
I am working on code which strictly follows this methodology and uses a minimum of "back and forth" calculations, but due to time constraints, it's not ready for review yet.
@illyasst and @diehlpk, I would love your feedback on this!
Subsets are very handy and could realy increase the generality of the toolkit.
Hi, I am currently trying to implement µDIC for determination of strain during large-deformation tests. I noticed that the vertical mesh size is constant for the entire measurement. Would there be a way to increase the mesh height or make it variable with each frame?
Matplotlib requires a backend to show the gui, so I think PyQT5 should be included as a dependency.
We need to have a classical Q4 finite element formulation which can handle arbitrary meshes, is very fast and easy to use.
Suggestion:
thanks u for bring this amazing DIC tools. But when I try to use the example code provided and obey all the procedures u mentioned in the tutorial, the masher GUI didn't show.
I can't interact with the GUI ,which was mentioned can use arrow-keys to add/delete the feature points .
can u please provided more guide. We will be very appreciate for u .
Hello, thanks for the contribution to this excellent tool.
I am trying to run the example code, but it can not work.
Is the reason that the version of the used python package is various? If that's true, could you share the proper version of the related python package?
LinAlgError Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_23104\955196646.py in
8 settings = dic.DICInput(mesh,images)
9 job = dic.DICAnalysis(settings)
---> 10 dic_results = job.run()
11
12 fields = dic.Fields(dic_results)
D:\software\anaconda3\envs\muDIC1\lib\site-packages\muDIC\solver\correlate.py in run(self)
373
374 """
--> 375 node_x, node_y, reference_stack, Ic_stack = self.solve()
376
377 return DICOutput(node_x, node_y, self.input, ref_stack=reference_stack, Ic_stack=Ic_stack)
D:\software\anaconda3\envs\muDIC1\lib\site-packages\muDIC\solver\correlate.py in solve(self)
388 else:
389 node_position, reference_stack, Ic_Stack = correlate(self.input, correlate_img_to_ref_q4,
--> 390 generate_reference_Q4)
391
392 # TODO: Remove the need of transposing the matrices
D:\software\anaconda3\envs\muDIC1\lib\site-packages\muDIC\solver\correlate.py in correlate(inputs, correlator, reference_gen)
182 node_position_t.append(node_coords)
183
--> 184 reference = gen_ref(node_coords, mesh, images[0], settings, image_id=0)
185
186 # Correlate the image frames
D:\software\anaconda3\envs\muDIC1\lib\site-packages\muDIC\solver\reference_q4.py in generate_reference_Q4(node_coords, mesh, im, settings, norm, image_id)
139
140
--> 141 K = np.linalg.inv(K)
142
143 # TODO: Fill in the rest
<array_function internals> in inv(*args, **kwargs)
D:\software\anaconda3\envs\muDIC1\lib\site-packages\numpy\linalg\linalg.py in inv(a)
543 signature = 'D->D' if isComplexType(t) else 'd->d'
544 extobj = get_linalg_error_extobj(_raise_linalgerror_singular)
--> 545 ainv = _umath_linalg.inv(a, signature=signature, extobj=extobj)
546 return wrap(ainv.astype(result_t, copy=False))
547
D:\software\anaconda3\envs\muDIC1\lib\site-packages\numpy\linalg\linalg.py in _raise_linalgerror_singular(err, flag)
86
87 def _raise_linalgerror_singular(err, flag):
---> 88 raise LinAlgError("Singular matrix")
89
90 def _raise_linalgerror_nonposdef(err, flag):
LinAlgError: Singular matrix
Add API documentation, preferably by using the builtins of sphinx
I tried to run the example code given for the images. But the Mesher doesnot produce any meshes.
The mesh_translator now fails if the target mesh is larger than the original mesh.
Suggestions:
Hello,
I have tried running this with multiple installations of Python, 3.7, 3.8, and 3.11. Every time I always get to the same point, where upon running mesh = mesher.mesh(image_stack)
, I get the error TypeError: __init__() got an unexpected keyword argument 'drawtype'
.
Please let me know if I am doing anything wrong, or if this is a bug!
Hello @PolymerGuy ,
First of all, thanks for the great work, this is the first global/FE DIC code that I ever found written in proper python !
I am interested in implementing the Lagrangian strain formulation to this code. I tried doing so, but I am a little bit confused by how I could do so. To determine how I could so, I have looked at the _green_strain_()
static method from the Fields class (in /post/viz.py) to try to determine how you computed the Green strain but that's where I got a little bit confused.
Could you please help me understand how the computation for the Green strain works ?
@staticmethod
def _green_strain_(F):
"""
Calculate Green strain tensor from F as G = 0.5*(F^T + F -I)
:param F: Deformation gradient tensor F_ij on the form [nEl,i,j,...]
:return: Green Lagrange strain tensor E_ij on the form [nEl,i,j,...]
"""
E11 = 0.5 * (F[:, 0, 0, :, :, :] ** 2. + F[:, 0, 1, :, :, :] ** 2. - 1.)
E12 = 0.5 * (F[:, 0, 0, :, :, :] * F[:, 1, 0, :, :, :] + F[:, 0, 1, :, :, :] * F[:, 1, 1, :, :, :])
E22 = 0.5 * (F[:, 1, 0, :, :, :] ** 2. + F[:, 1, 1, :, :, :] ** 2. - 1.)
E = np.array([[E11, E12], [E12, E22]])
E[E == np.nan] = 0.
return np.moveaxis(E, 2, 0)
Thank you,
ilyass
Making changes to colourmaps, limit values etc. should be made much easier.
Suggestion:
Include **kwargs in the method for "show data" and let them propagate directly into the call to matplotlib.
Add the settings to the visualizer object. I suspect this will be less practical in real life...
LinAlgError Traceback (most recent call last)
in <cell line: 3>()
1 import scipy.linalg as la
2 dic_job = dic.DICAnalysis(inputs)
----> 3 results = dic_job.run()
6 frames
/usr/local/lib/python3.10/dist-packages/numpy/linalg/linalg.py in _raise_linalgerror_singular(err, flag)
87
88 def _raise_linalgerror_singular(err, flag):
---> 89 raise LinAlgError("Singular matrix")
90
91 def _raise_linalgerror_nonposdef(err, flag):
LinAlgError: Singular matrix
Description
Installation of muDIC fails on Fedora 32 do to compilation errors of scipy 1.2.1. Using GCC version 10 a Rank mismatch
in Fortran code causes an error.
System
Error Message
gfortran:f77: /tmp/pip-install-sc4s_4iu/scipy_1c0e5b6a7f804c2d829fb4f592fd2acd/scipy/_build_utils/src/wrap_dummy_g77_abi.f
error: Command "/usr/bin/gfortran -Wall -g -ffixed-form -fno-second-underscore -fPIC -O3 -funroll-loops -Iscipy/sparse/linalg/eigen/arpack/ARPACK/SRC -I/home/jritter/.virtualenvs/inscomex/lib/python3.8/site-packages/numpy/core/include -Ibuild/src.linux-x86_64-3.8/numpy/distutils/include -c -c scipy/sparse/linalg/eigen/arpack/ARPACK/SRC/cnaup2.f -o build/temp.linux-x86_64-3.8/scipy/sparse/linalg/eigen/arpack/ARPACK/SRC/cnaup2.o" failed with exit status 1
This is likely thrown by following compilation erros:
Error: Rank mismatch between actual argument at (1) and actual argument at (2) (scalar and rank-1)
Possible solution
Make use of a newer scipy version (see here).
Is it possible to just update the scipy version in setup.py?
Best
Jonas
Current behaviour:
Currently, the function viz.show
is the main method provided to show contour plots of the field to the user.
Proposed behaviour:
An additional flag in viz.show
can be used to save files to a specified location. This will easily allow a used to either show (None) or save (path) results depending of the value of this flag.
I will submit a PR for this feature shortly.
The Region of Interest identification without using the GUI requires the input of the specimen edges coordinates. For this purpose the point 1 (upper left) and 2 (bottom right) coordinates have to be specified while calling the mesher. The y coordinates might be inversed, meaning that the solver can successfully complete the analysis only if the relation Yc2>Yc1 is verified. This can be verified only if Yc1 is the y coordinate of the bottom right point and consequently Yc2 identifies the top left edge.
The code should identify with Yc1 the y coordinate of the upper left point and with Yc2 the y coordinate of the bottom right edge, instead of considering Yc1 the coordinate of the bottom right edge and Yc2 the coordinate of the upper left edge.
Is it possible to use the code for .jog images?
Hi, first of all thanks for this awesome library. I found this library after reading your paper of 2020.
I have a couple of questions that I hope can be answered:
Bests
Diego
The mesher is simplistic in it current state and a more general mesher would be handy
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.