Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions docs/source/api/diffpy.diffchooser.example_package.rst

This file was deleted.

26 changes: 12 additions & 14 deletions docs/source/api/diffpy.diffchooser.rst
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
:tocdepth: -1

|title|
=======

.. |title| replace:: diffpy.diffchooser package
diffpy.diffchooser package
==========================

.. automodule:: diffpy.diffchooser
:members:
:undoc-members:
:show-inheritance:

Subpackages
-----------

.. toctree::
diffpy.diffchooser.example_package

Submodules
----------

|module|
--------
diffpy.diffchooser.functions module
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. automodule:: diffpy.diffchooser.functions
:members:
:undoc-members:
:show-inheritance:

.. |module| replace:: diffpy.diffchooser.example_submodule module
diffpy.diffchooser.diffchooser_app module
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. automodule:: diffpy.diffchooser.example_submodule
.. automodule:: diffpy.diffchooser.diffchooser_app
:members:
:undoc-members:
:show-inheritance:
23 changes: 23 additions & 0 deletions news/in-1-3-remove-template.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**Added:**

* <news item>

**Changed:**

* <news item>

**Deprecated:**

* <news item>

**Removed:**

* The ``dot_product`` example and its tests from the scikit-package template. ``functions.py`` and ``test_functions.py`` are kept for later use.

**Fixed:**

* <news item>

**Security:**

* <news item>
32 changes: 1 addition & 31 deletions src/diffpy/diffchooser/functions.py
Original file line number Diff line number Diff line change
@@ -1,31 +1 @@
import numpy as np


def dot_product(a, b):
"""Compute the dot product of two vectors of any size.

Ensure that the inputs, a and b, are of the same size.
The supported types are "array_like" objects, which can
be converted to a NumPy array. Examples include lists and tuples.

Parameters
----------
a : array_like
The first input vector.
b : array_like
The second input vector.

Returns
-------
float
The dot product of the two vectors.

Examples
--------
Compute the dot product of two lists:
>>> a = [1, 2, 3]
>>> b = [4, 5, 6]
>>> dot_product(a, b)
32.0
"""
return float(np.dot(a, b))
import numpy as np # noqa: F401

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't noqa things please. If you don't need this module any more, just delete it. Well, you don't need it. If in the future you want a functions.py you can remake it at zero cost.

40 changes: 2 additions & 38 deletions tests/test_functions.py
Original file line number Diff line number Diff line change
@@ -1,40 +1,4 @@
import numpy as np
import pytest
import numpy as np # noqa: F401
import pytest # noqa: F401

from diffpy.diffchooser import functions # noqa


def test_dot_product_2D_list():
a = [1, 2]
b = [3, 4]
expected = 11.0
actual = functions.dot_product(a, b)
assert actual == expected


def test_dot_product_3D_list():
a = [1, 2, 3]
b = [4, 5, 6]
expected = 32.0
actual = functions.dot_product(a, b)
assert actual == expected


@pytest.mark.parametrize(
"a, b, expected",
[
# Test whether the dot product function works with 2D and 3D vectors
# C1: lists, expect correct float output
([1, 2], [3, 4], 11.0),
([1, 2, 3], [4, 5, 6], 32.0),
# C2: tuples, expect correct float output
((1, 2), (3, 4), 11.0),
((1, 2, 3), (4, 5, 6), 32.0),
# C3: numpy arrays, expect correct float output
(np.array([1, 2]), np.array([3, 4]), 11.0),
(np.array([1, 2, 3]), np.array([4, 5, 6]), 32.0),
],
)
def test_dot_product(a, b, expected):
actual = functions.dot_product(a, b)
assert actual == expected
Loading