Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up API documentation #559

Merged
merged 7 commits into from
Jul 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,16 @@ and localization linkages, and tools for discretizing the microstructure. In add
PyMKS has modules for generating synthetic data sets using conventional numerical
simulations.

To learn about PyMKS start with the [PyMKS examples](./index.ipynb),
especially the [introductory example](notebooks/intro.ipynb).
To learn more about the methods consult the
[technical overview](http://pymks.org/en/stable/rst/notebooks/tech_overview.html)
To learn about PyMKS start with the [PyMKS
examples](http://pymks.org/en/stable/EXAMPLES.rst), especially the
[introductory example](notebooks/intro.ipynb). To learn more about the
methods consult the [technical overview](notebooks/tech_overview.html)
for an introduction.


The two principle objects that PyMKS provides are the
`TwoPointCorrelation` transformer and the `LocalizationRegressor`
[`TwoPointCorrelation`](http://pymks.org/en/stable/API.html#pymks.TwoPointCorrelation)
transformer and the
[`LocalizationRegressor`](http://pymks.org/en/stable/API.html#pymks.LocalizationRegressor)
which provide the homogenization and localization functionality. The
objects provided by PyMKS all work as either transformers or
regressors in a Scikit-Learn pipeline and use both Numpy and Dask
Expand Down
1 change: 1 addition & 0 deletions doc/EXAMPLES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Homogenization

rst/notebooks/stress.ipynb
rst/notebooks/fiber.ipynb
rst/notebooks/graph-descriptors.ipynb

Localization
------------
Expand Down
Binary file added doc/cahn-hilliard.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 added doc/plot_microstructures.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 added doc/strain.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions notebooks/cahn_hilliard.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@
}
],
"source": [
"plot_microstructures(x_data[0], y_data[0], titles=(\"Input Concentration\", \"Output Concentration\"))"
"plot_microstructures(x_data[0], y_data[0], titles=(\"Input Concentration\", \"Output Concentration\"));"
]
},
{
Expand Down Expand Up @@ -579,7 +579,7 @@
" coeff.real[..., 2],\n",
" coeff.real[..., 3],\n",
" titles=['Influence Coeff {0}'.format(i) for i in range(4)]\n",
")"
");"
]
},
{
Expand Down Expand Up @@ -654,7 +654,7 @@
}
],
"source": [
"plot_microstructures(y_test[0], y_predict.reshape((1, 41, 41))[0], titles=('Simulation', 'MKS Prediction'))"
"plot_microstructures(y_test[0], y_predict.reshape((1, 41, 41))[0], titles=('Simulation', 'MKS Prediction'));"
]
},
{
Expand Down Expand Up @@ -752,7 +752,7 @@
}
],
"source": [
"plot_microstructures(y_large[0], y_large_predict.reshape(shape)[0], titles=('Simulation', 'MKS Prediction'))"
"plot_microstructures(y_large[0], y_large_predict.reshape(shape)[0], titles=('Simulation', 'MKS Prediction'));"
]
},
{
Expand Down Expand Up @@ -780,7 +780,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.6"
"version": "3.8.5"
}
},
"nbformat": 4,
Expand Down
14 changes: 7 additions & 7 deletions notebooks/cahn_hilliard_legendre.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
}
],
"source": [
"plot_microstructures(x_data[0], y_data[0], titles=(\"Input Concentration\", \"Output Concentration\"))"
"plot_microstructures(x_data[0], y_data[0], titles=(\"Input Concentration\", \"Output Concentration\"));"
]
},
{
Expand Down Expand Up @@ -335,7 +335,7 @@
}
],
"source": [
"plot_microstructures(*(primitive_coeff[:, :, i] for i in range(4)))"
"plot_microstructures(*(primitive_coeff[:, :, i] for i in range(4)));"
]
},
{
Expand Down Expand Up @@ -364,7 +364,7 @@
}
],
"source": [
"plot_microstructures(*(legendre_coeff[:, :, i] for i in range(4)))"
"plot_microstructures(*(legendre_coeff[:, :, i] for i in range(4)));"
]
},
{
Expand Down Expand Up @@ -436,7 +436,7 @@
" y_primitive[0],\n",
" y_test1[0],\n",
" titles=('Legendre', 'Primitive', 'Simulation')\n",
")"
");"
]
},
{
Expand Down Expand Up @@ -553,7 +553,7 @@
}
],
"source": [
"plot_microstructures(x_large[0], y_large[0], titles=['Initial Concentration', 'Final Concentration'])"
"plot_microstructures(x_large[0], y_large[0], titles=['Initial Concentration', 'Final Concentration']);"
]
},
{
Expand Down Expand Up @@ -597,7 +597,7 @@
" y_primitive_large[0],\n",
" y_legendre_large[0],\n",
" titles=('Simulation', 'Primitive', 'Legendre')\n",
")"
");"
]
},
{
Expand Down Expand Up @@ -671,7 +671,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.6"
"version": "3.8.5"
}
},
"nbformat": 4,
Expand Down
8 changes: 4 additions & 4 deletions notebooks/checkerboard.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
}
],
"source": [
"plot_microstructures(x_stats[0, :, :, 0], x_stats[0, :, :, 1], titles=['0 -> 0', '1 -> 1'], cmap='bwr')"
"plot_microstructures(x_stats[0, :, :, 0], x_stats[0, :, :, 1], titles=['0 -> 0', '1 -> 1'], cmap='bwr');"
]
},
{
Expand Down Expand Up @@ -204,7 +204,7 @@
}
],
"source": [
"plot_microstructures(x_stats[0, :, :, 2], titles=['0 -> 1'], cmap='bwr')"
"plot_microstructures(x_stats[0, :, :, 2], titles=['0 -> 1'], cmap='bwr');"
]
},
{
Expand Down Expand Up @@ -297,7 +297,7 @@
}
],
"source": [
"plot_microstructures(x_stats[0, :, :, 0], x_stats[0, :, :, 1], titles=['0 -> 0', '1 -> 1'], cmap='bwr')"
"plot_microstructures(x_stats[0, :, :, 0], x_stats[0, :, :, 1], titles=['0 -> 0', '1 -> 1'], cmap='bwr');"
]
},
{
Expand All @@ -319,7 +319,7 @@
}
],
"source": [
"plot_microstructures(x_stats[0, :, :, 2], titles=['0 -> 1'], cmap='bwr')"
"plot_microstructures(x_stats[0, :, :, 2], titles=['0 -> 1'], cmap='bwr');"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion notebooks/derivation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.6"
"version": "3.8.5"
}
},
"nbformat": 4,
Expand Down
22 changes: 11 additions & 11 deletions notebooks/elasticity.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
],
"source": [
"x_delta = generate_delta(n_phases=2, shape=(21, 21)).persist()\n",
"plot_microstructures(x_delta[0], x_delta[1], titles=(\"X[0]\", \"X[1]\"), cmap='gray')"
"plot_microstructures(x_delta[0], x_delta[1], titles=(\"X[0]\", \"X[1]\"), cmap='gray');"
]
},
{
Expand Down Expand Up @@ -208,7 +208,7 @@
" y_delta[0],\n",
" y_delta[1],\n",
" titles=(r'$\\mathbf{\\varepsilon_{xx}}$ [0]', r'$\\mathbf{\\varepsilon_{xx}}$ [1]')\n",
")"
");"
]
},
{
Expand Down Expand Up @@ -277,7 +277,7 @@
"to_real = lambda x: coeff_to_real(x.steps[1][1].coeff).real\n",
"\n",
"coeff = to_real(model)\n",
"plot_microstructures(coeff[...,0], coeff[...,1], titles=['Influence coeff [0]', 'Influence coeff [1]'])"
"plot_microstructures(coeff[...,0], coeff[...,1], titles=['Influence coeff [0]', 'Influence coeff [1]']);"
]
},
{
Expand Down Expand Up @@ -327,7 +327,7 @@
}
],
"source": [
"plot_microstructures(y_data[0], titles=[r'$\\mathbf{\\varepsilon_{xx}}$'])"
"plot_microstructures(y_data[0], titles=[r'$\\mathbf{\\varepsilon_{xx}}$']);"
]
},
{
Expand Down Expand Up @@ -374,7 +374,7 @@
}
],
"source": [
"plot_microstructures(y_data[0], y_predict[0], titles=['Actual', 'Predicted'])"
"plot_microstructures(y_data[0], y_predict[0], titles=['Actual', 'Predicted']);"
]
},
{
Expand Down Expand Up @@ -403,7 +403,7 @@
}
],
"source": [
"plot_microstructures(y_data[0] - y_predict[0], titles=['Finite Element - MKS'])"
"plot_microstructures(y_data[0] - y_predict[0], titles=['Finite Element - MKS']);"
]
},
{
Expand Down Expand Up @@ -452,7 +452,7 @@
}
],
"source": [
"plot_microstructures(y_large[0], titles=[r'$\\mathbf{\\varepsilon_{xx}}$'])"
"plot_microstructures(y_large[0], titles=[r'$\\mathbf{\\varepsilon_{xx}}$']);"
]
},
{
Expand Down Expand Up @@ -498,7 +498,7 @@
],
"source": [
"coeff = to_real(model)\n",
"plot_microstructures(coeff[...,0], coeff[...,1], titles=['Influence coeff [0]', 'Influence coeff [1]'])"
"plot_microstructures(coeff[...,0], coeff[...,1], titles=['Influence coeff [0]', 'Influence coeff [1]']);"
]
},
{
Expand Down Expand Up @@ -536,7 +536,7 @@
}
],
"source": [
"plot_microstructures(y_large[0], y_predict_large[0], titles=['Actual', 'Predicted'])"
"plot_microstructures(y_large[0], y_predict_large[0], titles=['Actual', 'Predicted']);"
]
},
{
Expand Down Expand Up @@ -565,7 +565,7 @@
}
],
"source": [
"plot_microstructures(y_large[0] - y_predict_large[0], titles=['Finite Element - MKS'])"
"plot_microstructures(y_large[0] - y_predict_large[0], titles=['Finite Element - MKS']);"
]
},
{
Expand Down Expand Up @@ -620,7 +620,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.6"
"version": "3.8.5"
}
},
"nbformat": 4,
Expand Down
18 changes: 9 additions & 9 deletions notebooks/elasticity3d.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
" x_delta[1, x_delta.shape[1] // 2],\n",
" titles=['[0]', '[1]'],\n",
" cmap='gray'\n",
")"
");"
]
},
{
Expand Down Expand Up @@ -168,7 +168,7 @@
"plot_microstructures(\n",
" y_delta[0, x_delta.shape[1] // 2, :, :],\n",
" titles=[r'$\\mathbf{\\varepsilon_{xx}}$']\n",
")"
");"
]
},
{
Expand Down Expand Up @@ -234,7 +234,7 @@
" coeff[x_delta.shape[1] // 2, :, :, 0],\n",
" coeff[x_delta.shape[1] // 2, :, :, 1],\n",
" titles=['Influence coeff [0]', 'Influence coeff [1]']\n",
")"
");"
]
},
{
Expand Down Expand Up @@ -297,7 +297,7 @@
"plot_microstructures(\n",
" x_data[0, x_delta.shape[1] // 2, :, :],\n",
" titles=['Microstructure']\n",
")"
");"
]
},
{
Expand All @@ -322,7 +322,7 @@
"plot_microstructures(\n",
" y_data[0, x_delta.shape[1] // 2, :, :],\n",
" titles=[r'$\\mathbf{\\varepsilon_{xx}}$']\n",
")"
");"
]
},
{
Expand Down Expand Up @@ -387,7 +387,7 @@
" r'$\\mathbf{\\varepsilon_{xx}}$ - FE',\n",
" r'$\\mathbf{\\varepsilon_{xx}}$ - MKS'\n",
" ]\n",
")"
");"
]
},
{
Expand Down Expand Up @@ -421,7 +421,7 @@
"plot_microstructures(\n",
" (y_data - y_predict)[0, x_delta.shape[1] // 2, :, :],\n",
" titles=['FE - MKS']\n",
")"
");"
]
},
{
Expand Down Expand Up @@ -512,7 +512,7 @@
}
],
"source": [
"plot_microstructures(y_large[0, x_delta.shape[1] // 2], titles=[r'$\\mathbf{\\varepsilon_{xx}}$'])"
"plot_microstructures(y_large[0, x_delta.shape[1] // 2], titles=[r'$\\mathbf{\\varepsilon_{xx}}$']);"
]
},
{
Expand Down Expand Up @@ -557,7 +557,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.6"
"version": "3.8.5"
}
},
"nbformat": 4,
Expand Down
4 changes: 2 additions & 2 deletions notebooks/fiber.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@
}
],
"source": [
"plot_microstructures(*x_data[::100], cmap='gray', colorbar=False)"
"plot_microstructures(*x_data[::100], cmap='gray', colorbar=False);"
]
},
{
Expand Down Expand Up @@ -351,7 +351,7 @@
}
],
"source": [
"plot_microstructures(*y_stress[::100])"
"plot_microstructures(*y_stress[::100]);"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion notebooks/filter.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.6"
"version": "3.8.5"
}
},
"nbformat": 4,
Expand Down
Loading