Skip to content

Commit

Permalink
Merge pull request #17 from enigne/change_to_lower_case_package_name
Browse files Browse the repository at this point in the history
Change to lower case package name
  • Loading branch information
Cheng Gong authored Apr 10, 2024
2 parents d65ad00 + 33c3f14 commit 32d335b
Show file tree
Hide file tree
Showing 44 changed files with 229 additions and 67 deletions.
2 changes: 2 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ build:
python:
install:
- requirements: docs/requirements.txt
- method: pip
path: .

sphinx:
configuration: docs/conf.py
10 changes: 7 additions & 3 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,21 @@

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SOURCEDIR = .
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)


.PHONY: help Makefile

html: Makefile
@DDE_BACKEND=tensorflow $(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
Expand Down
10 changes: 10 additions & 0 deletions docs/api/pinnicle.domain.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
pinnicle.domain
===============

pinnicle.domain.domain module
-----------------------------

.. automodule:: pinnicle.domain.domain
:members:
:undoc-members:
:show-inheritance:
26 changes: 26 additions & 0 deletions docs/api/pinnicle.modeldata.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
pinnicle.modeldata
==================

pinnicle.modeldata.data module
------------------------------

.. automodule:: pinnicle.modeldata.data
:members:
:undoc-members:
:show-inheritance:

pinnicle.modeldata.general_mat_data module
------------------------------------------

.. automodule:: pinnicle.modeldata.general_mat_data
:members:
:undoc-members:
:show-inheritance:

pinnicle.modeldata.issm_data module
-----------------------------------

.. automodule:: pinnicle.modeldata.issm_data
:members:
:undoc-members:
:show-inheritance:
18 changes: 18 additions & 0 deletions docs/api/pinnicle.nn.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
pinnicle.nn
===========

pinnicle.nn.nn module
---------------------

.. automodule:: pinnicle.nn.nn
:members:
:undoc-members:
:show-inheritance:

pinnicle.nn.helper module
-------------------------

.. automodule:: pinnicle.nn.helper
:members:
:undoc-members:
:show-inheritance:
42 changes: 42 additions & 0 deletions docs/api/pinnicle.physics.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
pinnicle.physics
================

pinnicle.physics.constants module
---------------------------------

.. automodule:: pinnicle.physics.constants
:members:
:undoc-members:
:show-inheritance:

pinnicle.physics.physics module
-------------------------------

.. automodule:: pinnicle.physics.physics
:members:
:undoc-members:
:show-inheritance:

pinnicle.physics.equationbase module
------------------------------------

.. automodule:: pinnicle.physics.equationbase
:members:
:undoc-members:
:show-inheritance:

pinnicle.physics.continuity module
----------------------------------

.. automodule:: pinnicle.physics.continuity
:members:
:undoc-members:
:show-inheritance:

pinnicle.physics.stressbalance module
-------------------------------------

.. automodule:: pinnicle.physics.stressbalance
:members:
:undoc-members:
:show-inheritance:
37 changes: 7 additions & 30 deletions docs/api/pinnicle.rst
Original file line number Diff line number Diff line change
@@ -1,42 +1,19 @@
pinnicle
=======
========

pinnicle.domain module
------------------------

.. automodule:: pinnicle.domain
:members:
:undoc-members:
:show-inheritance:

pinnicle.modeldata module
---------------------

.. automodule:: pinnicle.modeldata
:members:
:undoc-members:
:show-inheritance:

pinnicle.nn module
---------------------
pinnicle.pinn module
--------------------

.. automodule:: pinnicle.nn
.. automodule:: pinnicle.pinn
:members:
:undoc-members:
:show-inheritance:

pinnicle.physics module
----------------------

.. automodule:: pinnicle.physics
:members:
:undoc-members:
:show-inheritance:

pinnicle.utils module
--------------------
pinnicle.parameter module
-------------------------

.. automodule:: pinnicle.utils
.. automodule:: pinnicle.parameter
:members:
:undoc-members:
:show-inheritance:
Expand Down
34 changes: 34 additions & 0 deletions docs/api/pinnicle.utils.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
pinnicle.utils
==============

pinnicle.utils.data_misfit module
---------------------------------

.. automodule:: pinnicle.utils.data_misfit
:members:
:undoc-members:
:show-inheritance:

pinnicle.utils.history module
-----------------------------

.. automodule:: pinnicle.utils.history
:members:
:undoc-members:
:show-inheritance:

pinnicle.utils.plotting module
------------------------------

.. automodule:: pinnicle.utils.plotting
:members:
:undoc-members:
:show-inheritance:

pinnicle.utils.helper module
----------------------------

.. automodule:: pinnicle.utils.helper
:members:
:undoc-members:
:show-inheritance:
19 changes: 16 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Configuration file for the Sphinx documentation builder.
#from importlib.metadata import version
from importlib.metadata import version

# -- Project information

Expand All @@ -8,19 +8,22 @@
author = 'Cheng Gong'

# The short X.Y version
#version = version("PINNICLE")
version = version("pinnicle")
version = '0.1'
# The full version, including alpha/beta/rc tags
release = version

# -- General configuration

extensions = [
'sphinx.ext.duration',
'sphinx.ext.doctest',
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.intersphinx',
'sphinx.ext.mathjax',
'sphinx.ext.viewcode',
'sphinx.ext.napoleon',
'sphinx_copybutton',
]

intersphinx_mapping = {
Expand All @@ -37,3 +40,13 @@
# -- Options for HTML output
html_theme = 'sphinx_rtd_theme'

# The suffix(es) of source filenames.
source_suffix = ".rst"

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path .
exclude_patterns = ["build", "Thumbs.db", ".DS_Store"]

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = "sphinx"
13 changes: 9 additions & 4 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PINNICLE
===================================
========

`PINNICLE<https://github.com/enigne/PINNICLE>` is a Python library for solving ice sheet modeling problems using a unified framework with Physics Informed Neural Networks
`PINNICLE <https://github.com/enigne/PINNICLE>`_ is a Python library for solving ice sheet modeling problems using a unified framework with Physics Informed Neural Networks


Check out the :doc:`usage` section for further information, including
Expand All @@ -12,20 +12,25 @@ how to :ref:`installation` the project.
This project is under active development.

User guide
--------
----------

.. toctree::
:maxdepth: 2


API reference
--------
-------------

.. toctree::
:maxdepth: 2
:caption: API

api/pinnicle
api/pinnicle.domain
api/pinnicle.modeldata
api/pinnicle.nn
api/pinnicle.physics
api/pinnicle.utils


Indices and tables
Expand Down
2 changes: 1 addition & 1 deletion docs/make.bat
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set SOURCEDIR=.
set BUILDDIR=build

if "%1" == "" goto help
Expand Down
22 changes: 22 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,24 @@
numpy
scipy
scikit-learn
matplotlib
pandas
mat73
deepxde

# TensorFlow 1.x
tensorflow>=2.7.0
# TensorFlow 2.x
tensorflow-probability>=0.10.0
# PyTorch
torch<2.0.0 # build fails on RTD with torch 2.0.0
# PaddlePaddle
# https://paddle-wheel.bj.bcebos.com/develop/linux/linux-cpu-mkl-avx/paddlepaddle-0.0.0-cp38-cp38-linux_x86_64.whl
paddlepaddle==2.6.0
# JAX
jax
flax
optax

sphinx-copybutton
sphinx-rtd-theme
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def load_data(self):

def plot(self, data_names=[], vranges={}, axs=None, resolution=200, **kwargs):
""" use `utils.plot_dict_data` to plot the ISSM data
Args:
data_names (list): Names of the variables. if not specified, plot all variables in data_dict
vranges (dict): range of the data
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def pdes(self, nn_input_var, nn_output_var):

def vel_mag(self, nn_input_var, nn_output_var, X):
""" a wrapper for PointSetOperatorBC func call
Args:
nn_input_var: input tensor to the nn
nn_output_var: output tensor from the nn
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ def __init__(self, parameters=EquationParameter()):

def pde(self, nn_input_var, nn_output_var):
""" residual of MOLHO 2D PDEs
Args:
nn_input_var: global input to the nn
nn_output_var: global output from the nn
Expand Down
1 change: 1 addition & 0 deletions PINNICLE/pinn.py → pinnicle/pinn.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ def plot_history(self, path=""):

def plot_predictions(self, path="", **kwargs):
""" plot model predictions
Args:
path (Path, str): Path to save the figures
X_ref (dict): Coordinates of the reference solutions, if None, then just plot the predicted solutions
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@


def surface_log_vel_misfit(v_true, v_pred):
"""Compute SurfaceLogVelMisfit:
This function can only work with tensorflow backend for now, since we use tf.math.log()
[ vel + eps ] 2
J = | log ( ----------- ) |
[ vel + eps ]
obs
"""Compute SurfaceLogVelMisfit: This function can only work with tensorflow backend for now, since we use tf.math.log()
"""
epsvel=2.220446049250313e-16
return bkd.reduce_mean(bkd.square((tf.math.log((tf.abs(v_pred)+epsvel)/(tf.abs(v_true)+epsvel)))))
Expand Down
Loading

0 comments on commit 32d335b

Please sign in to comment.