Skip to content

Commit e8f0572

Browse files
authored
Merge pull request #2864 from PMEAL/dev
Fixed 2 critical bugs #minor
2 parents 9e977be + 8e320be commit e8f0572

File tree

10 files changed

+52
-26
lines changed

10 files changed

+52
-26
lines changed

README.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,40 +10,41 @@
1010
1111
# Overview of OpenPNM
1212

13-
*OpenPNM* is a comprehensive framework for performing pore network simulations of porous materials.
13+
OpenPNM is a comprehensive framework for performing pore network simulations of porous materials.
1414

1515
## More Information
1616

17-
For more details about the package can be found in the [on-line documentation](https://openpnm.org)
17+
For more details about the package can be found in the [online documentation](https://openpnm.org)
1818

1919
## Installation and Requirements
2020

21-
### Preferred method
22-
The preferred way of installing OpenPNM is through [Anaconda Cloud](https://anaconda.org/conda-forge/openpnm) using:
21+
### [pip](https://pypi.org/project/openpnm/)
22+
OpenPNM can be installed using `pip` by running the following command in a terminal:
2323

24-
```
25-
conda install -c conda-forge openpnm
24+
```shell
25+
pip install openpnm
2626
```
2727

28-
### Alternative method
29-
OpenPNM can also be installed from the [Python Package Index](https://pypi.org/project/openpnm/) using:
28+
### [conda-forge](https://anaconda.org/conda-forge/openpnm)
29+
OpenPNM can also be installed from the [conda-forge](https://anaconda.org/conda-forge/openpnm) repository using:
3030

3131
```
32-
pip install openpnm
32+
conda install -c conda-forge openpnm
3333
```
3434

35-
However, we don't recommend installing using `pip` since `pypardiso`, which is a blazing fast direct solver, is not available for Windows users who use Python 3.7+.
35+
> [!WARNING]
36+
> For compatibility with ARM64 architecture, we removed `pypardiso` as a hard dependency. However, we still strongly recommend that non-macOS users (including users of older Macs with an Intel CPU) manually install `pypardiso` via `pip install pypardiso` or `conda install -c conda-forge pypardiso`, otherwise OpenPNM simulations will be very slow.
3637
3738
### For developers
38-
For developers who intend to change the source code or contribute to OpenPNM, the source code can be downloaded from [Github](https://github.com/pmeal/OpenPNM/) and installed by running:
39+
For developers who intend to change the source code or contribute to OpenPNM, the source code can be downloaded from [Github](https://github.com/PMEAL/OpenPNM/) and installed by running:
3940

4041
```
4142
pip install -e 'path/to/downloaded/files'
4243
```
4344

44-
The advantage to installing from the source code is that you can edit the files and have access to your changes each time you import *OpenPNM*.
45+
The advantage to installing from the source code is that you can edit the files and have access to your changes each time you import OpenPNM.
4546

46-
OpenPNM requires the *Scipy Stack* (Numpy, Scipy, Matplotlib, etc), which is most conveniently obtained by installing the [Anaconda Distribution](https://conda.io/docs/user-guide/install/download.html).
47+
OpenPNM requires the Scipy Stack (Numpy, Scipy, Matplotlib, etc), which is most conveniently obtained by installing the [Anaconda Distribution](https://www.anaconda.com/download/).
4748

4849
## Asking Questions and Getting Help
4950

openpnm/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '3.3.0.dev0'
1+
__version__ = '3.3.0.dev5'

openpnm/_skgraph/generators/_voronoi_delaunay_dual.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def voronoi_delaunay_dual(
6565
points=points,
6666
shape=shape,
6767
reflect=reflect,
68-
f=1,
68+
f=f,
6969
)
7070

7171
# Generate mask to remove any dims with all 0's

openpnm/_skgraph/generators/tools/_funcs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def parse_points(shape, points, reflect=False, f=1):
150150
151151
"""
152152
# Deal with input arguments
153-
shape = np.array(shape, dtype=int)
153+
shape = np.array(shape, dtype=float)
154154
if isinstance(points, int):
155155
points = generate_base_points(num_points=points,
156156
domain_size=shape,

openpnm/models/_doctxt.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
from matplotlib._docstring import Substitution
1+
try:
2+
from matplotlib._docstring import Substitution
3+
except ModuleNotFoundError:
4+
from matplotlib.docstring import Substitution
5+
26

37

48
__all__ = [

openpnm/models/geometry/_geodocs.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
from matplotlib._docstring import Substitution
1+
try:
2+
from matplotlib._docstring import Substitution
3+
except ModuleNotFoundError:
4+
from matplotlib.docstring import Substitution
25

36

47
__all__ = [

openpnm/models/misc/_neighbor_lookups.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ def from_neighbor_throats(target, prop, mode='min', ignore_nans=True):
3737
neighboring throats
3838
'mean' Returns the value of the mean property of the
3939
neighboring throats
40+
'sum' Returns the sum of the property of the neighboring
41+
throats
4042
=========== =====================================================
4143
4244
Returns
@@ -69,6 +71,11 @@ def from_neighbor_throats(target, prop, mode='min', ignore_nans=True):
6971
if ignore_nans:
7072
np.subtract.at(counts, im.row, nans[im.col])
7173
values = values/counts
74+
if mode == 'sum':
75+
if ignore_nans:
76+
data[nans] = 0
77+
values = np.zeros((network.Np, ))
78+
np.add.at(values, im.row, data[im.col])
7279
return values
7380

7481

@@ -98,6 +105,8 @@ def from_neighbor_pores(target, prop, mode='min', ignore_nans=True):
98105
neighboring pores
99106
'mean' Returns the value of the mean property of the
100107
neighboring pores
108+
'sum' Returns the sum of the property of the neighrboring
109+
pores
101110
=========== =====================================================
102111
103112
ignore_nans : bool (default is ``True``)
@@ -122,6 +131,8 @@ def from_neighbor_pores(target, prop, mode='min', ignore_nans=True):
122131
value = np.amax(pvalues, axis=1)
123132
if mode == 'mean':
124133
value = np.mean(pvalues, axis=1)
134+
if mode == 'sum':
135+
value = np.sum(pvalues, axis=1)
125136
except np.AxisError: # Handle case of empty pvalues
126137
value = []
127138
return np.array(value)

openpnm/models/phase/_phasedocs.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
from matplotlib._docstring import Substitution
1+
try:
2+
from matplotlib._docstring import Substitution
3+
except ModuleNotFoundError:
4+
from matplotlib.docstring import Substitution
5+
26

37
__all__ = [
48
'_phasedocs',

openpnm/phase/_phase.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,16 @@ def __getitem__(self, key):
9595
if element + '.' + prop in self.keys():
9696
vals = super().__getitem__(element + '.' + prop)
9797
else: # If above are not triggered then try to interpolate
98-
if self.settings['auto_interpolate']:
99-
if (element == 'pore') and ('throat.'+prop not in self.keys()):
98+
try:
99+
if self.settings['auto_interpolate']:
100+
if (element == 'pore') and ('throat.'+prop not in self.keys()):
101+
raise KeyError(key)
102+
elif (element == 'throat') and ('pore.'+prop not in self.keys()):
103+
raise KeyError(key)
104+
vals = self.interpolate_data(element + '.' + prop)
105+
else:
100106
raise KeyError(key)
101-
elif (element == 'throat') and ('pore.'+prop not in self.keys()):
102-
raise KeyError(key)
103-
vals = self.interpolate_data(element + '.' + prop)
104-
else:
107+
except AttributeError:
105108
raise KeyError(key)
106109

107110
# Finally get locs

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 3.3.0.dev0
2+
current_version = 3.3.0.dev5
33
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)\.(?P<release>\D+)(?P<build>\d+)?
44
serialize = {major}.{minor}.{patch}.{release}{build}
55

0 commit comments

Comments
 (0)