Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Apr 15, 2022
1 parent 049acc0 commit 3581142
Show file tree
Hide file tree
Showing 21 changed files with 97 additions and 34 deletions.
2 changes: 1 addition & 1 deletion maml/apps/bowsr/model/cgcnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from cgcnn.data import AtomCustomJSONInitializer, GaussianDistance
from cgcnn.model import CrystalGraphConvNet
from torch import Tensor
except ImportError as error:
except ImportError:
torch = None # type: ignore
cgcnn = None # type: ignore
Tensor = None # type: ignore
Expand Down
2 changes: 1 addition & 1 deletion maml/apps/bowsr/model/megnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from megnet.data.crystal import CrystalGraph
from megnet.data.graph import GaussianDistance
from megnet.models import MEGNetModel
except Exception as error:
except Exception:
megnet = None
MEGNetModel = None
CrystalGraph = None
Expand Down
2 changes: 1 addition & 1 deletion maml/apps/bowsr/model/tests/test_cgcnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

try:
import cgcnn
except ImportError as e:
except ImportError:
cgcnn = None

module_dir = os.path.dirname(__file__)
Expand Down
12 changes: 10 additions & 2 deletions maml/apps/bowsr/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,17 @@
from sklearn.gaussian_process import GaussianProcessRegressor
from sklearn.gaussian_process.kernels import RationalQuadratic

from maml.apps.bowsr.acquisition import AcquisitionFunction, ensure_rng, propose_query_point
from maml.apps.bowsr.acquisition import (
AcquisitionFunction,
ensure_rng,
propose_query_point,
)
from maml.apps.bowsr.model import EnergyModel
from maml.apps.bowsr.perturbation import LatticePerturbation, WyckoffPerturbation, get_standardized_structure
from maml.apps.bowsr.perturbation import (
LatticePerturbation,
WyckoffPerturbation,
get_standardized_structure,
)
from maml.apps.bowsr.preprocessing import DummyScaler, StandardScaler
from maml.apps.bowsr.target_space import TargetSpace

Expand Down
7 changes: 6 additions & 1 deletion maml/apps/bowsr/tests/test_acquisition.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
from sklearn.gaussian_process import GaussianProcessRegressor
from sklearn.gaussian_process.kernels import Matern, RationalQuadratic

from maml.apps.bowsr.acquisition import AcquisitionFunction, ensure_rng, predict_mean_std, propose_query_point
from maml.apps.bowsr.acquisition import (
AcquisitionFunction,
ensure_rng,
predict_mean_std,
propose_query_point,
)
from maml.apps.bowsr.preprocessing import DummyScaler, StandardScaler


Expand Down
9 changes: 4 additions & 5 deletions maml/apps/bowsr/tests/test_target_space.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from pymatgen.core.structure import Structure

from maml.apps.bowsr.acquisition import ensure_rng
from maml.apps.bowsr.optimizer import struct2perturbation
from maml.apps.bowsr.perturbation import WyckoffPerturbation
from maml.apps.bowsr.preprocessing import DummyScaler, StandardScaler
from maml.apps.bowsr.target_space import TargetSpace
Expand Down Expand Up @@ -226,28 +225,28 @@ def test_set_empty(self):

for i in range(10):
sample = self.space1.uniform_sample()
target1 = self.space1.probe(sample)
self.space1.probe(sample)
self.assertEqual(len(self.space1), i + 1)
self.space1.set_empty()
self.assertEqual(len(self.space1), 0)

for i in range(20):
sample = self.space2.uniform_sample()
target1 = self.space2.probe(sample)
self.space2.probe(sample)
self.assertEqual(len(self.space2), i + 1)
self.space2.set_empty()
self.assertEqual(len(self.space2), 0)

for i in range(15):
sample = self.space3.uniform_sample()
target1 = self.space3.probe(sample)
self.space3.probe(sample)
self.assertEqual(len(self.space3), i + 1)
self.space3.set_empty()
self.assertEqual(len(self.space3), 0)

for i in range(10):
sample = self.space4.uniform_sample()
target1 = self.space4.probe(sample)
self.space4.probe(sample)
self.assertEqual(len(self.space4), i + 1)
self.space4.set_empty()
self.assertEqual(len(self.space4), 0)
Expand Down
3 changes: 0 additions & 3 deletions maml/apps/pes/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ def predict_efs(self, structure):
Returns:
energy, forces, stress
"""
pass

@abc.abstractmethod
def write_param(self):
Expand All @@ -84,5 +83,3 @@ class Potential(PotentialMixin, BaseModel): # type: ignore
Potential models that can be used to fit structure-[energy, force, stress]
pairs
"""

pass
6 changes: 5 additions & 1 deletion maml/apps/pes/_lammps.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@
from pymatgen.io.lammps.data import LammpsData

from maml.apps.pes._base import Potential
from maml.utils import get_lammps_lattice_and_rotation, stress_list_to_matrix, stress_matrix_to_list
from maml.utils import (
get_lammps_lattice_and_rotation,
stress_list_to_matrix,
stress_matrix_to_list,
)

logging.basicConfig()
logger = logging.getLogger(__name__)
Expand Down
7 changes: 6 additions & 1 deletion maml/apps/pes/_snap.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@

from maml.base import SKLModel
from maml.describers import BispectrumCoefficients
from maml.utils import check_structures_forces_stresses, convert_docs, pool_from, stress_format_change
from maml.utils import (
check_structures_forces_stresses,
convert_docs,
pool_from,
stress_format_change,
)

from ._lammps import LammpsPotential

Expand Down
15 changes: 13 additions & 2 deletions maml/apps/symbolic/tests/test_selectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,23 @@
try:
import cvxpy as cp

from maml.apps.symbolic._selectors_cvxpy import AdaptiveLassoCP, DantzigSelectorCP, LassoCP, cp
from maml.apps.symbolic._selectors_cvxpy import (
AdaptiveLassoCP,
DantzigSelectorCP,
LassoCP,
cp,
)

except ImportError:
cp = None # noqa

from maml.apps.symbolic._selectors import SCAD, AdaptiveLasso, DantzigSelector, L0BrutalForce, Lasso
from maml.apps.symbolic._selectors import (
SCAD,
AdaptiveLasso,
DantzigSelector,
L0BrutalForce,
Lasso,
)

CWD = os.path.abspath(os.path.dirname(__file__))

Expand Down
15 changes: 13 additions & 2 deletions maml/base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,21 @@
Define abstract base classes.
"""
from ._data import BaseDataSource # noqa
from ._describer import BaseDescriber, DummyDescriber, SequentialDescriber, describer_type # noqa
from ._describer import ( # noqa
BaseDescriber,
DummyDescriber,
SequentialDescriber,
describer_type,
)
from ._feature_batch import get_feature_batch
from ._mixin import TargetScalerMixin
from ._model import BaseModel, KerasModel, SKLModel, is_keras_model, is_sklearn_model # noqa
from ._model import ( # noqa
BaseModel,
KerasModel,
SKLModel,
is_keras_model,
is_sklearn_model,
)

__all__ = [
"BaseDataSource",
Expand Down
1 change: 0 additions & 1 deletion maml/base/_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@ def get(self, *args, **kwargs) -> pd.DataFrame:
"""
Get data from sources
"""
pass
14 changes: 12 additions & 2 deletions maml/describers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,20 @@

from ._composition import ElementProperty, ElementStats # noqa
from ._site import SmoothOverlapAtomicPosition # noqa
from ._site import BispectrumCoefficients, BPSymmetryFunctions, MEGNetSite, SiteElementProperty # noqa
from ._site import ( # noqa
BispectrumCoefficients,
BPSymmetryFunctions,
MEGNetSite,
SiteElementProperty,
)
from ._structure import CoulombMatrix # noqa
from ._structure import SortedCoulombMatrix # noqa
from ._structure import CoulombEigenSpectrum, DistinctSiteProperty, MEGNetStructure, RandomizedCoulombMatrix
from ._structure import (
CoulombEigenSpectrum,
DistinctSiteProperty,
MEGNetStructure,
RandomizedCoulombMatrix,
)

__all__ = [
"BispectrumCoefficients",
Expand Down
4 changes: 3 additions & 1 deletion maml/describers/_composition.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@


try:
from matminer.featurizers.composition import ElementProperty as MatminerElementProperty # noqa
from matminer.featurizers.composition import ( # noqa
ElementProperty as MatminerElementProperty,
)

ElementProperty = wrap_matminer_describer(
"ElementProperty", MatminerElementProperty, to_composition, describer_type="composition"
Expand Down
2 changes: 1 addition & 1 deletion maml/models/dl/tests/test_atomsets.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Test models
"""
from unittest import TestCase, main, skip
from unittest import TestCase, main

import numpy as np

Expand Down
21 changes: 18 additions & 3 deletions maml/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,26 @@
from ._lammps import stress_format_change # noqa
from ._lammps import stress_list_to_matrix # noqa
from ._lammps import write_data_from_structure # noqa
from ._lammps import check_structures_forces_stresses, get_lammps_lattice_and_rotation, stress_matrix_to_list # noqa
from ._lammps import ( # noqa
check_structures_forces_stresses,
get_lammps_lattice_and_rotation,
stress_matrix_to_list,
)
from ._material import to_composition # noqa
from ._preprocessing import DummyScaler, Scaler, StandardScaler # noqa
from ._signal_processing import cwt, fft_magnitude, get_sp_method, spectrogram, wvd # noqa
from ._stats import STATS_KWARGS, Stats, get_full_stats_and_funcs, stats_list_conversion # noqa
from ._signal_processing import ( # noqa
cwt,
fft_magnitude,
get_sp_method,
spectrogram,
wvd,
)
from ._stats import ( # noqa
STATS_KWARGS,
Stats,
get_full_stats_and_funcs,
stats_list_conversion,
)
from ._tempfile import MultiScratchDir # noqa
from ._value_profile import ConstantValue, LinearProfile, ValueProfile # noqa

Expand Down
1 change: 0 additions & 1 deletion maml/utils/_data_split.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ def split(self, mat_ids, **kwargs):
Returns: (train_ids, val_ids, test_ids) or
(train_ids, test_ids)
"""
pass


class ShuffleSplitter(DataSplitter):
Expand Down
2 changes: 1 addition & 1 deletion requirements-ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ mypy==0.941
pydocstyle==6.1.1
pylint==2.12.2
black==22.1.0
flake8==4.0.1
flake8==4.0.1
2 changes: 1 addition & 1 deletion requirements-dl.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
tensorflow==2.8.0
torch==1.11.0
torch==1.11.0
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ scikit-learn==1.0.2
h5py==3.6.0
joblib==1.1.0
tqdm==4.63.0
pymongo==4.0.1
pymongo==4.0.1
2 changes: 0 additions & 2 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
import json
import os
import re
import subprocess
import webbrowser

import requests
from invoke import task
Expand Down

0 comments on commit 3581142

Please sign in to comment.