Skip to content

Commit

Permalink
chore: update cmomy and module-utilities
Browse files Browse the repository at this point in the history
  • Loading branch information
wpk committed May 3, 2023
1 parent ada18df commit 1ca7cbc
Show file tree
Hide file tree
Showing 9 changed files with 86 additions and 162 deletions.
4 changes: 2 additions & 2 deletions environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ dependencies:
- scipy
- xarray
# - openmm
- cmomy>=0.1.9
- cmomy>=0.4
- custom-inherit
- attrs
- module-utilities >= 0.1
- module-utilities>=0.2
- pymbar<4.0
- pip
- pip:
Expand Down
4 changes: 2 additions & 2 deletions environment/dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ channels:
- wpk-nist
dependencies:
- attrs
- cmomy>=0.1.9
- cmomy>=0.4
- custom-inherit
- ipykernel
- ipython
- matplotlib
- module-utilities >= 0.1
- module-utilities>=0.2
- nbconvert
- numpy
- pip
Expand Down
4 changes: 2 additions & 2 deletions environment/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ channels:
- wpk-nist
dependencies:
- attrs
- cmomy>=0.1.9
- cmomy>=0.4
- custom-inherit
- ipython
- matplotlib
- module-utilities >= 0.1
- module-utilities>=0.2
- numpy
- pip
- pymbar<4.0
Expand Down
4 changes: 2 additions & 2 deletions environment/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ channels:
- wpk-nist
dependencies:
- attrs
- cmomy>=0.1.9
- cmomy>=0.4
- custom-inherit
- module-utilities >= 0.1
- module-utilities>=0.2
- mypy
- numpy
- pandas
Expand Down
4 changes: 2 additions & 2 deletions environment/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ channels:
- wpk-nist
dependencies:
- attrs
- cmomy>=0.1.9
- cmomy>=0.4
- custom-inherit
- module-utilities >= 0.1
- module-utilities>=0.2
- numpy
- pandas
- pip
Expand Down
132 changes: 70 additions & 62 deletions examples/usage/basic/Customized_Derivatives.ipynb

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ dependencies = [
"xarray >= 0.16",
"sympy",
"scipy",
"cmomy >= 0.1.9",
"cmomy >= 0.4",
"custom-inherit",
"attrs",
"module-utilities >= 0.1",
"module-utilities >= 0.2",
]

[project.urls]
Expand Down
2 changes: 2 additions & 0 deletions src/thermoextrap/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""Classes/routines to deal with thermodynamic extrapolation."""

from . import beta, lnpi, volume, volume_idealgas

# TODO: move data, idealgas, models to top level.
from .core import data, idealgas, models
from .core.data import (
DataCentralMoments,
Expand Down
90 changes: 2 additions & 88 deletions src/thermoextrap/core/_docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,97 +2,11 @@

from __future__ import annotations

from cmomy.docstrings import docfiller as DOCFILLER_CMOMY

# from .external.docfiller import DocFiller
from module_utilities.docfiller import DocFiller

# TODO: clean this up.
# There's a better way to do all this
# - import cmomy docstrings
# - use namespaces

_docstring_cmomy = """\
Parameters
----------
copy : bool, optional
If True, copy the data. If False, attempt to use view.
copy_kws : mapping, optional
extra arguments to copy
verify : bool, optional
If True, make sure data is c-contiguous
check_shape : bool, optional
If True, check that shape of resulting object is correct.
mom : int or tuple of int
Order or moments. If integer or length one tuple, then moments are for
a single variable. If length 2 tuple, then comoments of two variables
mom_ndim : {1, 2}
Value indicates if moments (``mom_ndim = 1``) or comoments (``mom_ndim=2``).
val_shape : tuple, optional
Shape of `values` part of data. That is, the non-moment dimensions.
shape : tuple, optional
Total shape. ``shape = val_shape + tuple(m+1 for m in mom)``
dtype : dtype, optional
Optional ``dtype`` for output data.
zeros_kws : mapping, optional
Optional parameters to :func:`numpy.zeros`
axis : int
Axis to reduce along.
broadcast : bool, optional
If True, and ``x=(x0, x1)``, then perform 'smart' broadcasting.
In this case, if ``x1.ndim = 1`` and ``len(x1) == x0.shape[axis]``, then
broadcast `x1` to ``x0.shape``.
freq : array of int, optional
Array of shape ``(nrep, size)`` where `nrep` is the number of replicates and
``size = self.shape[axis]``. `freq` is the weight that each sample contributes
to resamples values. See :func:`~cmomy.resample.randsamp_freq`
indices : array of int, optional
Array of shape ``(nrep, size)``. If passed, create `freq` from indices.
See :func:`~cmomy.resample.randsamp_freq`.
nrep : int, optional
Number of replicates. Create `freq` with this many replicates.
See :func:`~cmomy.resample.randsamp_freq`
pushed : same as object
Same as object, with new data pushed onto `self.data`
resample_kws : mapping
Extra arguments to :func:`~cmomy.resample.resample_vals`
full_output : bool, optional
If True, also return `freq` array
convert_kws : mapping
Extra arguments to :func:`~cmomy.convert.to_central_moments` or :func:`~cmomy.convert.to_central_comoments`
dims : hashable or sequence of hashable, optional
Dimension of resulting :class:`xarray.DataArray`.
* If ``len(dims) == self.ndim``, then dims specifies all dimensions.
* If ``len(dims) == self.val_ndim``, ``dims = dims + mom_dims``
Default to ``('dim_0', 'dim_1', ...)``
mom_dims : hashable or tuple of hashable
Name of moment dimensions. Defaults to ``('xmom', 'umom')``
attrs : mapping
Attributes of output
coords : mapping
Coordinates of output
name : hashable
Name of output
indexes : Any
indexes attribute. This is ignored.
template : DataArray
If present, output will have attributes of `template`.
Overrides other options.
dim : hashable, optional
Dimension to reduce along.
rep_dim : hashable, optional
Name of new 'replicated' dimension:
rec_dim : hashable, optional
Name of dimension for 'records', i.e., multiple observations.
"""

DOCFILLER_CMOMY = DocFiller.from_docstring(
_docstring_cmomy, combine_keys="parameters"
).assign_combined_key(
"xr_params", ["dims", "attrs", "coords", "name", "indexes", "template"]
)


# add uv_xv_array
_docstring_xtrap = """\
Parameters
Expand Down

0 comments on commit 1ca7cbc

Please sign in to comment.