Skip to content

Commit

Permalink
removing small issues with linting and formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
m-julian committed May 9, 2024
1 parent ddb68fe commit a13eb41
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ jobs:
pip install -e ichor_cli
- name: Run example notebooks
run: |
git ls-files -- '*.ipynb' | xargs pytest --nbval-lax --current-env
git ls-files -- '*.ipynb' | xargs pytest --nbval-lax --nbval-current-env
8 changes: 4 additions & 4 deletions ichor_core/ichor/core/atoms/list_of_atoms.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,12 @@ def features_to_csv(
:param feature_calculator: Calculator function to be used to calculate features
:param fname: A string to be appended to the default csv file names.
A .csv file is written out for every atom with default name \``atom_name\``_features.csv
If an fname is given, the name becomes \``fname\``_\``atom_name\``_features.csv
A .csv file is written out for every atom with default name ``atom_name_features.csv``
If an fname is given, the name becomes ``fname_atom_name_features.csv``
:param atom_names: A list of atom names for which to write csv files.
If None, then write out the features for every atom in the system.
:param \*args: positional arguments to pass to calculator function
:param \**kwargs: key word arguments to be passed to the feature calculator function
:param args: positional arguments to pass to calculator function
:param kwargs: key word arguments to be passed to the feature calculator function
"""
import pandas as pd

Expand Down
2 changes: 1 addition & 1 deletion ichor_core/ichor/core/atoms/list_of_atoms_atom_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def features(self, feature_calculator: Callable, *args, **kwargs) -> np.ndarray:
:param alf: A list of integers or a numpy array corresponding to the alf of one atom
The atom which the atom view is for.
:return: The array has shape \`n_timesteps\` x \`n_features\`.
:return: The array has shape ``n_timesteps`` x ``n_features``.
"""

return np.array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@

def spherical_to_cartesian(r, theta, phi) -> List[float]:
"""
Spherical to cartesian transformation, where r in [0, \inf), \theta in [0, \pi], \phi in [-\pi, \pi).
Spherical to cartesian transformation
.. math::
r \in [0, \inf)
\theta in [0, \pi]
\phi in [-\pi, \pi)
x = r sin \theta cos\phi
y = r sin \phi sin\theta
z = r cos\theta
Expand Down
3 changes: 1 addition & 2 deletions ichor_core/ichor/core/database/sql/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
from typing import Union

from sqlalchemy import Column, create_engine, Float, ForeignKey, Integer, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
from sqlalchemy.orm import declarative_base, relationship

Base = declarative_base()

Expand Down
4 changes: 1 addition & 3 deletions ichor_core/ichor/core/files/file_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ def center_geometry_on_atom_and_write_xyz(
central_atom_alf: ALF,
central_atom_name: str,
fname: Optional[Union[str, Path]] = None,
**kwargs,
):
"""Centers all geometries (from a Trajectory of PointsDirectory instance)
onto a central atom and then writes out a new xyz file with all geometries centered on that atom.
Expand All @@ -119,8 +118,7 @@ def center_geometry_on_atom_and_write_xyz(
:param feature_calculator: Function which calculates features
:param central_atom_name: the name of the central atom to center all geometries on. Eg. `O1`
:param fname: Optional file name in which to save the rotated geometries.
:param \*args: Positional arguments to pass to calculator function
:param \**kwargs: Key word arguments to pass to calculator function
:param kwargs: Key word arguments to pass to calculator function
"""

from ichor.core.atoms import Atoms
Expand Down
8 changes: 4 additions & 4 deletions ichor_core/ichor/core/files/points_directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ def alf(self, alf_calculator: Callable[..., ALF], *args, **kwargs) -> List[ALF]:
Returns the Atomic Local Frame (ALF) for all Atom instances that are held in Atoms
e.g. ``[[0,1,2],[1,0,2], [2,0,1]]``.
:param \*args: positional arguments to pass to alf calculator
:param \**kwargs: key word arguments to pass to alf calculator
:param args: positional arguments to pass to alf calculator
:param kwargs: key word arguments to pass to alf calculator
"""
return [
alf_calculator(atom_instance, *args, **kwargs)
Expand Down Expand Up @@ -527,8 +527,8 @@ def features_with_properties_to_csv(
If None, then writes out files for all atoms in the system, defaults to None
:param property_types: A list of property names (iqa, multipole names) for which to write columns.
If None, then writes out columns for all properties, defaults to None
:param \*args: positional arguments to pass to calculator function
:param \**kwargs: key word arguments to be passed to the feature calculator function
:param args: positional arguments to pass to calculator function
:param kwargs: key word arguments to be passed to the feature calculator function
:raises TypeError: This method only works for PointsDirectory instances because it
needs access to AIMALL information. Does not work for Trajectory instances.
"""
Expand Down
4 changes: 2 additions & 2 deletions ichor_core/ichor/core/files/xyz/trajectory.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ def alf(self, alf_calculator: Callable[..., ALF], *args, **kwargs) -> List[ALF]:
Returns the Atomic Local Frame (ALF) for all Atom instances that are held in Atoms.
e.g. ``[[0,1,2],[1,0,2], [2,0,1]]``
:param \*args: positional arguments to pass to alf calculator
:param \**kwargs: key word arguments to pass to alf calculator
:param args: positional arguments to pass to alf calculator
:param kwargs: key word arguments to pass to alf calculator
"""
return [
alf_calculator(atom_instance, *args, **kwargs) for atom_instance in self[0]
Expand Down
38 changes: 17 additions & 21 deletions ichor_core/ichor/core/models/kernels/periodic_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,23 @@


class PeriodicKernel(Kernel):
"""Implemtation of the Periodic Kernel."""
"""Implemtation of the Periodic Kernel.
:param lengthscale: np.ndarray of n_features array of lengthscales
:param period: np.ndarray of n_features array of period lengths
.. note::
Lengthscales is typically n_features long because we want a separate lengthscale for each dimension.
The periodic kernel is going to be used for phi features
because these are the features we know can be cyclic.
The period of the phi angle is always :math:`2\pi`,
however this period can change if there is normalization
or standardization applied to features. The new period then becomes
the distance between where :math:`\pi` and :math:`-\pi`
land after the features are scaled. Because the period can vary
for individual phi angles for standardization, it is
still passed in as an array that is n_features long.
"""

def __init__(
self,
Expand All @@ -14,26 +30,6 @@ def __init__(
period_length: np.ndarray,
active_dims: Optional[np.ndarray] = None,
):
"""
Args:
:param: `lengthscale` np.ndarray of n_features:
array of lengthscales
:param: `period` np.ndarray of n_features:
array of period lengths
.. note::
Lengthscales is typically n_features long because we want a separate lengthscale for each dimension.
The periodic kernel is going to be used for phi features
because these are the features we know can be cyclic.
The period of the phi angle is always :math:`2\pi`,
however this period can change if there is normalization
or standardization applied to features. The new period then becomes
the distance between where :math:`\pi` and :math:`-\pi`
land after the features are scaled. Because the period can vary
for individual phi angles for standardization, it is
still passed in as an array that is n_features long.
"""
super().__init__(name, active_dims)
self._thetas = thetas
self._period_length = period_length
Expand Down

0 comments on commit a13eb41

Please sign in to comment.