Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit 4b68a5a3 authored by Edward Andò's avatar Edward Andò
Browse files

updated from master, test_mergeRegistrationAndDiscreteFields is commented for now

parents 5cdc8913 2480c2de
Pipeline #64382 failed with stages
in 5 minutes
......@@ -11,6 +11,9 @@ exclude_lines =
elif mpi:
def create2Patche*
def create8Patche*
raise InputError
if verbose:
[run]
omit =
......@@ -20,6 +23,7 @@ omit =
*/plotting/*
*optionsParser.py
*/visual/*
tools/tests/errors.py
source =
spam
......
......@@ -8,6 +8,7 @@
.ipynb_checkpoints/
.~notebook.ipynb
.coverage
.coverage.*
coverage
build/
......
......@@ -15,6 +15,7 @@ build:
test:
stage: test
script:
- pip install -r requirements.txt
- pip install -r requirements-dev.txt
- python setup.py install
- python setup.py test
......@@ -33,6 +34,7 @@ pages:
GIT_SUBMODULE_STRATEGY: normal
stage: pages
script:
- pip install -r requirements.txt
- pip install -r requirements-dev.txt
- python setup.py install
- python setup.py build_sphinx
......
This diff is collapsed.
DIC package
===========
Submodules
----------
DIC.correlate module
--------------------
.. automodule:: DIC.correlate
:members:
:undoc-members:
:show-inheritance:
DIC.correlateGM module
----------------------
.. automodule:: DIC.correlateGM
:members:
:undoc-members:
:show-inheritance:
DIC.deform module
-----------------
.. automodule:: DIC.deform
:members:
:undoc-members:
:show-inheritance:
DIC.grid module
---------------
.. automodule:: DIC.grid
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: DIC
:members:
:undoc-members:
:show-inheritance:
{% extends "!layout.html" %}
{% block menu %}
{{ super() }}
<a href="/spam/py-modindex.html">Module Index</a>
{% endblock %}
deformation package
===================
Submodules
----------
deformation.deformationFunction module
--------------------------------------
.. automodule:: deformation.deformationFunction
:members:
:undoc-members:
:show-inheritance:
deformation.deformationField module
--------------------------------------
.. automodule:: deformation.deformationField
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: deformation
:members:
:undoc-members:
:show-inheritance:
excursions package
==================
Submodules
----------
excursions.elkc module
----------------------
.. automodule:: excursions.elkc
:members:
:undoc-members:
:show-inheritance:
excursions.randomFields module
------------------------------
.. automodule:: excursions.randomFields
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: excursions
:members:
:undoc-members:
:show-inheritance:
filters package
===============
Submodules
----------
filters.morphologicalOperations module
--------------------------------------
.. automodule:: filters.morphologicalOperations
:members:
:undoc-members:
:show-inheritance:
filters.movingFilters module
----------------------------
.. automodule:: filters.movingFilters
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: filters
:members:
:undoc-members:
:show-inheritance:
helpers package
===============
Submodules
----------
helpers.histogramTools module
--------------------------------
.. automodule:: helpers.histogramTools
:members:
:undoc-members:
:show-inheritance:
helpers.imageManipulation module
--------------------------------
.. automodule:: helpers.imageManipulation
:members:
:undoc-members:
:show-inheritance:
helpers.optionsParser module
----------------------------
.. automodule:: helpers.optionsParser
:members:
:undoc-members:
:show-inheritance:
helpers.tsvio module
--------------------
.. automodule:: helpers.tsvio
:members:
:undoc-members:
:show-inheritance:
helpers.vtkio module
--------------------
.. automodule:: helpers.vtkio
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: helpers
:members:
:undoc-members:
:show-inheritance:
......@@ -8,15 +8,38 @@ kalisphera.kalisphera module
----------------------------
.. automodule:: kalisphera.kalisphera
:members:
:undoc-members:
:show-inheritance:
:members:
:undoc-members:
:show-inheritance:
kalisphera.kalispheraToolkit module
-----------------------------------
.. automodule:: kalisphera.kalispheraToolkit
:members:
:undoc-members:
:show-inheritance:
kalisphera.kalispheraToolkit module
-----------------------------------
.. automodule:: kalisphera.kalispheraToolkit
:members:
:undoc-members:
:show-inheritance:
kalisphera.spheroid module
--------------------------
.. automodule:: kalisphera.spheroid
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: kalisphera
:members:
:undoc-members:
:show-inheritance:
:members:
:undoc-members:
:show-inheritance:
label package
=============
Submodules
----------
label.ITKwatershed module
-------------------------
.. automodule:: label.ITKwatershed
:members:
:undoc-members:
:show-inheritance:
label.contacts module
---------------------
.. automodule:: label.contacts
:members:
:undoc-members:
:show-inheritance:
label.label module
------------------
.. automodule:: label.label
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: label
:members:
:undoc-members:
:show-inheritance:
measurements package
====================
Submodules
----------
measurements.covariance module
------------------------------
.. automodule:: measurements.covariance
:members:
:undoc-members:
:show-inheritance:
measurements.globalDescriptors module
-------------------------------------
.. automodule:: measurements.globalDescriptors
:members:
:undoc-members:
:show-inheritance:
measurements.porosityField module
---------------------------------
.. automodule:: measurements.porosityField
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: measurements
:members:
:undoc-members:
:show-inheritance:
mesh package
============
Submodules
----------
mesh.projection module
----------------------
.. automodule:: mesh.projection
:members:
:undoc-members:
:show-inheritance:
mesh.structured module
----------------------
.. automodule:: mesh.structured
:members:
:undoc-members:
:show-inheritance:
mesh.unstructured module
------------------------
.. automodule:: mesh.unstructured
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: mesh
:members:
:undoc-members:
:show-inheritance:
plotting package
================
Submodules
----------
plotting.greyLevelHistogram module
----------------------------------
.. automodule:: plotting.greyLevelHistogram
:members:
:undoc-members:
:show-inheritance:
plotting.multivariateGaussians module
-------------------------------------
.. automodule:: plotting.multivariateGaussians
:members:
:undoc-members:
:show-inheritance:
plotting.orientationPlotter module
----------------------------------
.. automodule:: plotting.orientationPlotter
:members:
:undoc-members:
:show-inheritance:
plotting.particleSizeDistribution module
----------------------------------------
.. automodule:: plotting.particleSizeDistribution
:members:
:undoc-members:
:show-inheritance:
plotting.tetrahedraPlotter module
---------------------------------
.. automodule:: plotting.tetrahedraPlotter
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: plotting
:members:
:undoc-members:
:show-inheritance:
......@@ -125,6 +125,7 @@ For this reason the threshold is made on the image after the application of a va
Please note that it's also possible to use the variance filter in scipy through the *generic* interface as follows::
import scipy
standardDev = numpy.sqrt(scipy.ndimage.generic_filter(im.astype(float), numpy.var, footprint=structEl))
but it's more than 100 times slower!
......@@ -140,8 +141,8 @@ Then the aggregates are dilated 2 times in order to retrieve their original size
# now aggregates are dilated 2 times
for i in range(2):
aggregates = sfilters.binaryDilation(aggregates)
aggregates = spam.filters.binaryDilation(aggregates)
plt.imshow(aggregates[aggregates.shape[0]//2], cmap="Greys"); plt.title("Horizontal slice of the identified aggregates"); plt.show()
.. figure:: images/tutorial/06-projection/aggregates.png
......@@ -157,7 +158,7 @@ An array with all the phases can now be created where the value of each voxel wi
# mortar -> 1
# pores -> 2
# aggregates -> 3
phases = numpy.ones_like(im).astype('<u1')*sfilters.binaryErosion(mask)
phases = numpy.ones_like(im).astype('<u1')*spam.filters.binaryErosion(mask)
phases[pores==1] = 2
phases[aggregates==1] = 3
......@@ -217,7 +218,7 @@ Step 2.2: Create the Finite Element Mesh
For the projection we need an unstructured 3D mesh made of 4-node tetrahedra.
At this stage we have to consider the physical dimensions to the FE mesh.
We use the module `mesh.unstructured` which is a wrapper of `pygmsh` and `meshio` to create the needed `.msh` file
We use the module `mesh.unstructured` which is a wrapper of `meshio` to create the needed `.msh` file
and a vtk for visualisation::
# specimen dimensions in mm
......@@ -229,10 +230,10 @@ and a vtk for visualisation::
# create the gmsh file needed for the projection
points, connectivity = spam.mesh.createCylinder(centre, radius, height, lcar, gmshFile="cylinder")
# create the vtk file (the mesh can be visualised in paraview for example)
import spam.helpers
spam.helpers.writeUnstructuredVTK(points, connectivity, fileName="cylinder.vtk")
# Number of nodes: 124487
# Number of elements: 716525
......@@ -248,6 +249,8 @@ We can now do the projection from the distance field files (pores and aggregates
spam.mesh.projectField("cylinder.msh", ["aggregatesDist.dat", "poresDist.dat"], vtkMesh=True)
Note that ``projectField`` can directly take numpy arrays as arguments which avoids the files output (`projection tutorial <https://ttk.gricad-pages.univ-grenoble-alpes.fr/spam/spam_examples/mesh/plot_projectField.html#sphx-glr-spam-examples-mesh-plot-projectfield-py>`_).
The output should look like this (where the coordinates order is **x, y, z**)::
<projmoprho::set_mesh
......@@ -376,5 +379,5 @@ References
.. [Stamati2018a] Stamati, O., Roubin, E., And, E. et Malecot, Y. (2018). Phase segmentation of concrete x-ray tomographic images at meso-scale: Validation with neutron tomography. Cement and Concrete Composites, 88:8 – 16.
https://doi.org/10.1016/j.cemconcomp.2017.12.011
.. .. [Stamati2018b] Stamati, O., Roubin, E., Andò, E., & Malecot, Y. (2018). Tensile failure of micro-concrete: from mechanical tests to FE meso-model with the help of X-ray tomography. Meccanica, 1-16.
.. https://doi.org/10.1007/s11012-018-0917-0
.. [Stamati2018b] Stamati, O., Roubin, E., Andò, E., & Malecot, Y. (2018). Tensile failure of micro-concrete: from mechanical tests to FE meso-model with the help of X-ray tomography. Meccanica, 1-16.
https://doi.org/10.1007/s11012-018-0917-0
# -*- coding: utf-8 -*-
"""
Geodesic reconstruction
========================
This example shows how to use the geodesic reconstruction
"""
# sphinx_gallery_thumbnail_number = 1
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy
import spam.excursions
import spam.filters
############################################
# Generate a morphology
############################################
# Generation and excrusion of a realisation of a correlated random field
covariance = {'type': 'stable', 'alpha': 2.0, 'correlation_length': 0.005}
realisation = spam.excursions.simulateRandomField(nNodes=500, covariance=covariance, nRea=1, dim=2, vtkFile="morpho")
excursion = realisation > 0.05
############################################
# Geodesic reconstruction
############################################
# Direct definition of the marker (cube in the center)
marker = numpy.zeros(excursion.shape, dtype=bool)
marker[230:270, 230:270] = excursion[230:270, 230:270]
recA = spam.filters.binaryGeodesicReconstruction(excursion, marker)
##############################################
# Definition of the marker with a list of plans
marker = numpy.zeros(excursion.shape, dtype=bool)
marker = [0, 0] # direction 0 distance 0 (top side)
recB = spam.filters.binaryGeodesicReconstruction(excursion, marker)
marker = [1, 0, 0, -1] # direction 1 distance 0 (left side) and direction 0 distance max (bottom side)
recC = spam.filters.binaryGeodesicReconstruction(excursion, marker)
######################
# Plots
plot_image = numpy.zeros(excursion.shape, dtype=int)
plot_image[numpy.where(excursion)] = -1 # set 1 for morpho
plot_image[numpy.where(recA)] = -2 # set 2 for center
plot_image[numpy.where(recB)] = 1 # set 3 for top
plot_image[numpy.where(recC)] = 2 # set 4 for left bottom
plt.figure()
plt.imshow(plot_image, cmap='coolwarm')
plt.axis('off')
plt.show()
############################################
# Notes
############################################
# The geodesic reconstruction is implemented for 2D and 3D binary morphologies
# -*- coding: utf-8 -*-
"""
Project a scalar field onto an unstructured mesh
================================================
This example shows how to generate a correlated random field project it onto an unstructured mesh
"""
# sphinx_gallery_thumbnail_number = 1
import spam.excursions
import spam.mesh
import matplotlib.pyplot as plt
#####################################
# Create the random field
#####################################
# Generate a realisation of the correlated (Gaussian centered) Random Field in a cube of size 1x1x1
covariance = {'type': 'stable', 'alpha': 2.0, 'variance': 1.0, 'correlation_length': 0.5}
nNodes = 100 # discretisation of the field
realisation = spam.excursions.simulateRandomField(nNodes=nNodes, covariance=covariance, dim=3)
plt.figure()
plt.imshow(realisation[0, :, :])
plt.title("2D Slice of the field")
plt.show()
#####################################
# Generate a cylindrical mesh
#####################################
# Set the geometrical properties of the mesh
centre = [0.5, 0.5]
radius = 0.5
height = 1.
lcar = 0.1 # average distance between nodes
points, connectivity = spam.mesh.createCylinder(centre, radius, height, lcar, vtkFile="cylinder")
# points, connectivity = spam.mesh.createCuboid([1, 1, 1], lcar, vtkFile="cube")
#######################################
# Projection
#######################################
# Set the geometrical properties of the mesh
field = {
"origin": [0, 0, 0],
"lengths": [1, 1, 1],
"nCells": [99, 99, 99],
"values": [realisation]