Skip to content

Commit

Permalink
Merge pull request #220 from materialsinnovation/develop
Browse files Browse the repository at this point in the history
version 0.2.3
  • Loading branch information
davidbrough1 committed Aug 21, 2015
2 parents 9c941d3 + 8597b77 commit 275643c
Show file tree
Hide file tree
Showing 32 changed files with 13,888 additions and 13,796 deletions.
15 changes: 11 additions & 4 deletions INSTALLATION.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Installation
The following steps outline the necessary requirements for a successful installation of PyMKS.

Use pip,

Expand Down Expand Up @@ -54,16 +55,22 @@ See the [PyFFTW installation instructions](https://github.com/hgomersall/pyFFTW#

## Installation on Windows

We recommend you download and install [Anaconda Python Distribution](http://continuum.io/downloads)
for Python 2.7 and then download and install PyMKS using the [windows installer](https://www.dropbox.com/s/ja251y4f5ss2y44/PyMKS-x64-anaconda27.exe?dl=1).
We recommend you download and install the [Anaconda Python Distribution](http://continuum.io/downloads)
for Python 2.7 (x64) and then download and install PyMKS using the [windows installer](https://github.com/materialsinnovation/pymks/releases/download/version-0_2_1/PyMKS-x64-anaconda27.exe).

## Installation on Mac OS X

We recommend you download and install the [Anaconda Python Distibution](http://continuum.io/downloads)
for Python 2.7 (x64). Once Anaconda has been installed, follow the above procedures to install SfePy.
Finally, install PyMKS using `pip` as described above.

## Installation with Anaconda

The [Anaconda Python Distributionn](https://store.continuum.io/cshop/anaconda/)
contains all of the required packages outside of [SfePy][sfepy] and
works on multiple platforms. [Download][conda] and
[install](http://docs.continuum.io/anaconda/install.html) Anaconda, and
use the Anaconda Command Prompt to install PyMKS using pip.
use your terminal or shell to install PyMKS using pip.

## Requirements

Expand All @@ -82,4 +89,4 @@ list.
[MKL]: https://software.intel.com/en-us/articles/numpyscipy-with-intel-mkl
[pyfftw]: http://hgomersall.github.io/pyFFTW/
[chris]: http://www.lfd.uci.edu/~gohlke/pythonlibs/#scikit-learn
[conda]: http://continuum.io/downloads
[conda]: http://continuum.io/downloads
Empty file added doc/.nojekyll
Empty file.
2 changes: 2 additions & 0 deletions doc/API.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:orphan:

===
API
===
Expand Down
2 changes: 2 additions & 0 deletions doc/EXAMPLES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:orphan:

Examples
========

Expand Down
2 changes: 1 addition & 1 deletion doc/MKSmodels.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ MKS Models
==========

MKSHomogenizationModel
--------------------
----------------------
.. autoclass:: pymks.mks_homogenization_model.MKSHomogenizationModel
:members:

Expand Down
20 changes: 10 additions & 10 deletions doc/_static/pymks.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,36 @@ body {
.navbar .nav > li > a, .navbar .nav > li > a:first-letter,
.navbar .nav > li.current-menu-item > a,
.navbar .nav > li.current-menu-ancestor > a {
font-size: 20px;
padding-top: 35px;
padding-bottom: 35px;
font-size: 18px;
padding-top: 20px;
padding-bottom: 20px;
font-weight: bold;
}

/* Version Number */
.navbar-default .navbar-text {
font-size: 20px;
padding-top: 16px;
padding-bottom: 16px;
font-size: 18px;
padding-top: 2px;
padding-bottom: 2px;
}

/* Logo and project title */
.navbar-default .navbar-brand {
color: #FFF;
font-size: 25px;
padding-top: 14px;
padding-bottom: 14px;
padding-top: 3px;
padding-bottom: 3px;
}

/* Dropdown menu */
.dropdown-menu > li > a {
font-size: 20px;
font-size: 18px;
}

/* Dropdown hover */
/* Dropdown menu */
.dropdown-menu > li > a:hover {
font-size: 20px;
font-size: 18px;
background: #f46d43;
}

Expand Down
4 changes: 2 additions & 2 deletions doc/bases.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ DiscreteIndicatorBasis
:members:

ContinuousIndicatorBasis
----------------------
------------------------
.. autoclass:: pymks.bases.ContinuousIndicatorBasis
:members:

LegendreBasis
----------------------
-------------
.. autoclass:: pymks.bases.LegendreBasis
:members:
8 changes: 4 additions & 4 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'extremefill.tex', u'Extreme Fill Documentation',
('index', 'pymks.tex', u'PyMKS Documentation',
u'David Brough', 'manual'),
]

Expand Down Expand Up @@ -235,7 +235,7 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'extremefill', u'Extreme Fill Documentation',
('index', 'pymks', u'PyMKS Documentation',
[u'David Brough'], 1)
]

Expand All @@ -249,8 +249,8 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'extremefill', u'Extreme Fill Documentation',
u'David Brough', 'extremefill', 'Reproduce Extreme fill Paper.',
('index', 'pymks', u'PyMKS Documentation',
u'David Brough', 'pymks', 'Materials Knowledge Systems in Python',
'Miscellaneous'),
]

Expand Down
10 changes: 5 additions & 5 deletions doc/datageneration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@ make_elastic_FE_strain_delta
.. autofunction:: pymks.datasets.make_elastic_FE_strain_delta

make_elastic_FE_strain_random
----------------------------
-----------------------------
.. autofunction:: pymks.datasets.make_elastic_FE_strain_random

make_cahn_hilliard
----------------------------
------------------
.. autofunction:: pymks.datasets.make_cahn_hilliard

make_microstructure
----------------------------
-------------------
.. autofunction:: pymks.datasets.make_microstructure

make_checkerboard_microstructure
----------------------------
--------------------------------
.. autofunction:: pymks.datasets.make_checkerboard_microstructure

make_elastic_stress_random
----------------------------
--------------------------
.. autofunction:: pymks.datasets.make_elastic_stress_random

Simulations
Expand Down
2 changes: 2 additions & 0 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Materials Knowledge Systems in Python

.. include:: intro.rst

.. include:: support.rst

.. toctree::
:hidden:

Expand Down
24 changes: 22 additions & 2 deletions doc/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ section <THEORY.html>`__.
import numpy as np
import matplotlib.pyplot as plt
Quantify Microstructures using 2-Point Statistics
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand All @@ -30,6 +31,7 @@ Lets make two dual phase microstructures with different morphologies.
X_2 = make_microstructure(n_samples=1, grain_size=(15, 95))
X = np.concatenate((X_1, X_2))
Throughout PyMKS ``X`` is used to represent microstructures. Now that we
have made the two microstructures, lets take a look at them.

Expand All @@ -40,6 +42,7 @@ have made the two microstructures, lets take a look at them.
draw_microstructures(X)
.. image:: intro_files/intro_5_0.png


Expand All @@ -58,6 +61,7 @@ function.
prim_basis = PrimitiveBasis(n_states=2, domain=[0, 1])
X_ = prim_basis.discretize(X)
X_corr = correlate(X_, periodic_axes=[0, 1])
Let's take a look at the two autocorrelations and the cross-correlation
for these two microstructures.

Expand All @@ -69,6 +73,7 @@ for these two microstructures.
draw_correlations(X_corr[0])
.. parsed-literal::
(101, 101, 3)
Expand All @@ -83,6 +88,7 @@ for these two microstructures.
draw_correlations(X_corr[1])
.. image:: intro_files/intro_10_0.png


Expand Down Expand Up @@ -110,6 +116,7 @@ types of microstructures, totaling to 600 microstructures.
X_train, y_train = make_elastic_stress_random(n_samples=n_samples, size=(51, 51),
grain_size=grain_size, seed=0)
Once again, ``X_train`` is our microstructures. Throughout PyMKS ``y``
is used as either the prpoerty or the field we would like to predict. In
this case ``y_train`` is the effective stress values for ``X_train``.
Expand All @@ -121,6 +128,7 @@ microstructures.
draw_microstructures(X_train[::200])
.. image:: intro_files/intro_16_0.png


Expand All @@ -135,24 +143,28 @@ basis function. We will also specify which correlations we want.
prim_basis = PrimitiveBasis(n_states=2, domain=[0, 1])
homogenize_model = MKSHomogenizationModel(basis=prim_basis,
correlations=[(0, 0), (1, 1), (0, 1)])
Let's fit our model with the data we created.

.. code:: python
homogenize_model.fit(X_train, y_train, periodic_axes=[0, 1])
Now let's make some new data to see how good our model is.

.. code:: python
n_samples = [10, 10, 10]
X_test, y_test = make_elastic_stress_random(n_samples=n_samples, size=(51, 51),
grain_size=grain_size, seed=100)
We will try and predict the effective stress of our ``X_test``
microstructures.

.. code:: python
y_pred = homogenize_model.predict(X_test, periodic_axes=[0, 1])
The ``MKSHomogenizationModel`` generates low dimensional representations
of microstructures and regression methods to predict effective
properties. Take a look at the low dimensional representations.
Expand All @@ -161,8 +173,9 @@ properties. Take a look at the low dimensional representations.
from pymks.tools import draw_components
draw_components(homogenize_model.fit_data, homogenize_model.predict_data,
label_1='Training Data', label_2='Testing Data')
draw_components([homogenize_model.reduced_fit_data, homogenize_model.reduced_predict_data],
['Training Data', 'Testing Data'])
.. image:: intro_files/intro_26_0.png
Expand All @@ -182,6 +195,7 @@ Now let's look at a goodness of fit plot for our
draw_goodness_of_fit(fit_data, pred_data, ['Training Data', 'Testing Data'])
.. image:: intro_files/intro_28_0.png


Expand All @@ -204,6 +218,7 @@ First we need some data, so let's make some.
from pymks.datasets import make_elastic_FE_strain_delta
X_delta, y_delta = make_elastic_FE_strain_delta()
Once again, ``X_delta`` is our microstructures and ``y_delta`` is our
local strain fields. We need to discretize the microstructure again so
we will also use the same basis function.
Expand All @@ -214,11 +229,13 @@ we will also use the same basis function.
prim_basis = PrimitiveBasis(n_states=2)
localize_model = MKSLocalizationModel(basis=prim_basis)
Let's use the data to fit our ``MKSLocalizationModel``.

.. code:: python
localize_model.fit(X_delta, y_delta)
Now that we have fit our model, we will create a random microstructure
and compute its local strain field using finite element analysis. We
will then try and reproduce the same strain field with our model.
Expand All @@ -228,6 +245,7 @@ will then try and reproduce the same strain field with our model.
from pymks.datasets import make_elastic_FE_strain_random
X_test, y_test = make_elastic_FE_strain_random()
Let's look at the microstructure and its local strain field.

.. code:: python
Expand All @@ -237,6 +255,7 @@ Let's look at the microstructure and its local strain field.
draw_microstructure_strain(X_test[0], y_test[0])
.. image:: intro_files/intro_40_0.png


Expand All @@ -252,6 +271,7 @@ and compare the predicted and computed local strain field.
draw_strains_compare(y_test[0], y_pred[0])
.. image:: intro_files/intro_42_0.png


Expand Down
Binary file modified doc/intro_files/intro_10_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/intro_files/intro_26_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/intro_files/intro_28_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/intro_files/intro_9_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/pymks_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions doc/support.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Support
=======

Financial support for the development of PyMKS the MKS framework was
provided by the
`Georgia Tech Institute of Materials`_, the
`National Institute of Standards and Technology`_, the
`Air Force Office of Scientific Research`_, the `Office of Naval Research`_, and the
`National Science Foundation`_.

.. _`Georgia Tech Institute of Materials`: http://materials.gatech.edu/
.. _`National Institute of Standards and Technology`: http://www.nist.gov/mml/msed/index.cfm
.. _`Air Force Office of Scientific Research`: http://www.wpafb.af.mil/AFRL/afosr/
.. _`Office of Naval Research`: http://www.onr.navy.mil/
.. _`National Science Foundation`: http://www.nsf.gov/
Loading

0 comments on commit 275643c

Please sign in to comment.