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

Reintroduce pandas pin and update code for numpy 1.24+ #925

Merged
merged 12 commits into from
Mar 26, 2024
4 changes: 3 additions & 1 deletion .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Please submit help issues to:
https://discuss.matsci.org/c/matminer/automatminer
https://matsci.org/c/matminer/16

The Github issues is no longer used except for internal development purposes.

If you are unable to use the Discourse forum, you may submit an issue here, but you must **clearly** state the reason you are unable to use the Discourse forum in your ticket. Otherwise, your issue will be **closed** without response.

Please search both the forums and former GitHub issues before raising a ticket to avoid duplicating discussions.
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
# The ext package is also only tested in this workflow. Coverage is also computed based on this platform.
name: Testing

env:
PYTEST_ADDOPTS: "--color=yes"

on:
push:
branches:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ matminer is a library for performing data mining in the field of materials scien
- **[Help/Support Forum](https://matsci.org/c/matminer/16)**
- **[Source Repository](https://github.com/hackingmaterials/matminer)**

matminer supports Python 3.8+.
matminer supports Python 3.9+.

#### Related packages:

Expand Down
14 changes: 10 additions & 4 deletions docs_rst/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
Installing matminer
===================

Matminer requires Python 3.6+.
Matminer requires Python 3.9+.

It is strongly recommend that you install it in a virtual environment (using e.g., conda, Python's venv, or related tools) to avoid conflicts with other packages.

There are a couple of quick and easy ways to install matminer (see also some **tips** below):

Expand All @@ -28,6 +30,9 @@ or, to install matminer in your user home folder, run the command:

To update matminer, simply type ``pip install --upgrade matminer``.

This will install the latest version of all of matminer's dependencies.
In cases of future incompatibility, you can install the specific versions used for testing matminer by following the development instructions below.

Install in development mode
-----------------------------

Expand All @@ -42,15 +47,16 @@ and then enter the cloned repository/folder to install in developer mode:
.. code-block:: bash

$ cd matminer
$ python setup.py develop
$ pip install -r requirements/requirements-ubuntu_py3.11.txt # or corresponding file for your platform
$ pip install -e .

To update matminer, enter your cloned folder and type ``git pull`` followed by ``python setup.py develop``.
To update matminer, simply enter your cloned folder and type ``git pull``g


Tips
----

* Make sure you are using Python 3.6 or higher
* Make sure you are using a compatible Python version (3.9+ at time of writing).
* If you have trouble with the installation of a component library (sympy, pymatgen, mdf-forge, etc.), you can try to run ``pip install <<component>>`` or (if you are using `Anaconda <https://www.anaconda.com/distribution/>`_) ``conda install <<component>>`` first, and then re-try the installation.

- For example, installing pymatgen on a Windows platform is easiest with Anaconda via ``conda install -c conda-forge pymatgen``.
Expand Down
2 changes: 1 addition & 1 deletion matminer/featurizers/composition/tests/test_alloy.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def test_WenAlloys(self):
"Shear modulus mean": 79.48600137832061,
"Shear modulus strength model": -0.009636621848440554,
"Total weight": 57.243028243301005,
"VEC mean": 8.447250438374748,
"VEC mean": 8.395723406331793,
"Weight Fraction": "Fe0.6048579375087819 C0.00019995792415715736 "
"Mn0.0005000210911858884 Si0.0005004488909678273 "
"Cr9.991733798026916e-05 Ni0.19686472127404955 "
Expand Down
2 changes: 1 addition & 1 deletion matminer/featurizers/site/external.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def from_preset(cls, preset):
"""
valid_presets = ["formation_energy"]
if preset == "formation_energy":
return cls(6, 8, 8, 0.4, True, "gto", True)
return cls(rcut=6, nmax=8, lmax=8, sigma=0.4, periodic=True, rbf="gto", crossover=True, compression=False)
else:
raise ValueError(f"'{preset}' is not a valid preset. Choose from {valid_presets}")

Expand Down
2 changes: 1 addition & 1 deletion matminer/featurizers/site/rdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ def featurize(self, struct, idx):
# Generate cos(theta) between neighbor pairs for each central site.
# Also, retain data on neighbor distances for each pair
# process with matrix algebra, we really need the speed here
data = np.array(list(neighbor_tuples))
data = np.array(list(neighbor_tuples), dtype=object)
v1, v2 = np.vstack(data[:, 0, 0]), np.vstack(data[:, 1, 0])
distances = data[:, :, 1]
neighbor_pairs = np.concatenate(
Expand Down
1 change: 0 additions & 1 deletion matminer/featurizers/site/tests/test_rdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ def test_grdf(self):
[f"Gaussian center={i} width=1.0" for i in np.arange(10.0)],
)

@unittest.skip("Test does not pass with latest deps")
def test_afs(self):
f1 = Gaussian(1, 0)
f2 = Gaussian(1, 1)
Expand Down
2 changes: 1 addition & 1 deletion matminer/featurizers/structure/bonding.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ def fit(self, X, y=None):
"""
unpadded_bobs = [self.bag(s, return_baglens=True) for s in X]
bonds = [list(bob.keys()) for bob in unpadded_bobs]
bonds = np.unique(sum(bonds, []))
bonds = np.unique(np.array(sum(bonds, []), dtype=object))
baglens = [0] * len(bonds)

for i, bond in enumerate(bonds):
Expand Down
1 change: 0 additions & 1 deletion matminer/featurizers/structure/tests/test_bonding.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ def test_bondfractions(self):
np.testing.assert_array_equal(df["Al - Al bond frac."].to_numpy(), [0.0, 0.0])
np.testing.assert_array_equal(df["Ni - Ni bond frac."].to_numpy(), [0.0, 0.5])

@unittest.skip("Test does not pass with latest deps")
def test_bob(self):
# Test a single fit and featurization
scm = SineCoulombMatrix(flatten=False)
Expand Down
1 change: 0 additions & 1 deletion matminer/featurizers/structure/tests/test_sites.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@


class StructureSitesFeaturesTest(StructureFeaturesTest):
@unittest.skip("Test does not pass with latest deps")
def test_sitestatsfingerprint(self):
# Test matrix.
op_struct_fp = SiteStatsFingerprint.from_preset("OPSiteFingerprint", stats=None)
Expand Down
1 change: 0 additions & 1 deletion matminer/featurizers/utils/grdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ def __call__(self, r_ij):
return np.logical_and(
np.greater_equal(r_ij, self.start),
np.less(r_ij, self.start + self.width),
dtype=np.float64,
)

def volume(self, cutoff):
Expand Down
1 change: 0 additions & 1 deletion matminer/featurizers/utils/tests/test_grdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def test_gaussian(self):
self.assertIn("width=4", name)
self.assertIn("center=4", name)

@unittest.skip("Test does not pass with latest deps")
def test_histogram(self):
h = Histogram(1, 4)
np.testing.assert_array_almost_equal([0, 1, 0], h([0.5, 2, 5]))
Expand Down
19 changes: 9 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,15 @@ def local_version(version):
include_package_data=True,
zip_safe=False,
install_requires=[
"numpy>=1.20.1,<2",
"requests",
"pandas",
"tqdm",
"pymongo",
"future",
"scikit_learn",
"sympy",
"monty",
"pymatgen",
"numpy >= 1.23, < 2",
"requests ~= 2.31",
"pandas ~= 1.5",
"tqdm ~= 4.66",
"pymongo ~= 4.5",
"scikit_learn ~= 1.3",
"sympy ~= 1.11",
"monty >= 2023",
"pymatgen >= 2023",
],
extras_require=extras_require,
classifiers=[
Expand Down