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

Use ruff for formatting and linting #7

Merged
merged 8 commits into from
Apr 15, 2024
Merged
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
7 changes: 3 additions & 4 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ jobs:
pip install -r requirements.txt
pip install -e .

- name: Check format with black
- name: Check format with ruff
run: |
black --version
black --diff pyDOE3
black --check pyDOE3
ruff --version
ruff check
4 changes: 3 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,7 @@ jobs:

- name: Test with pytest
run: |
pytest --doctest-modules
pytest --doctest-modules pyDOE3
pytest tests


3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pyDOE3: An experimental design package for python
[![Tests](https://github.com/relf/pyDOE3/actions/workflows/tests.yml/badge.svg)](https://github.com/relf/pyDOE3/actions/workflows/tests.yml)
[![Documentation](https://readthedocs.org/projects/pydoe3/badge/?version=latest)](https://pydoe3.readthedocs.io/en/latest/?badge=latest)
[![DOI](https://zenodo.org/badge/709347557.svg)](https://zenodo.org/doi/10.5281/zenodo.10958492)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)

`pyDOE3` is a fork of the [`pyDOE2`](https://github.com/clicumu/pyDOE2) package
that is designed to help the scientist, engineer, statistician, etc., to
Expand Down Expand Up @@ -61,7 +62,7 @@ individuals for use with Scilab:

`pyDOE` was converted to Python by the following individual:

- Copyright (c) 2014, Abraham D. Lee & timsimst
- Copyright (c) 2014, Abraham D. Lee

The following individuals forked and worked on `pyDOE2`:

Expand Down
95 changes: 48 additions & 47 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@

from datetime import date

import sys, os
import sys
import os

sys.path.insert(0, os.path.abspath('..'))
sys.path.insert(0, os.path.abspath(".."))

import pyDOE3

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.append(os.path.abspath('.'))
# sys.path.append(os.path.abspath('.'))

# -- General configuration -----------------------------------------------------

Expand All @@ -31,152 +32,152 @@
extensions = []

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# The suffix of source filenames.
source_suffix = '.rst'
source_suffix = ".rst"

# The encoding of source files.
#source_encoding = 'utf-8'
# source_encoding = 'utf-8'

# The master toctree document.
master_doc = 'index_TOC'
master_doc = "index_TOC"

# General information about the project.
project = u'pyDOE3'
if date.today().year!=2013:
copyright = u'2013–%d, Abraham Lee' % date.today().year
project = "pyDOE3"
if date.today().year != 2013:
copyright = "2013–%d, Abraham Lee" % date.today().year
else:
copyright = u'2013, Abraham Lee'
copyright = "2013, Abraham Lee"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '1'
version = "1"
# The full version, including alpha/beta/rc tags.
release = pyDOE3.__version__

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# language = None

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# today_fmt = '%B %d, %Y'

# List of documents that shouldn't be included in the build.
#unused_docs = []
# unused_docs = []

# List of directories, relative to source directory, that shouldn't be searched
# for source files.
exclude_trees = ['_build']
exclude_trees = ["_build"]

# The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None
# default_role = None

# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# add_function_parentheses = True

# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# add_module_names = True

# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# show_authors = False

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"

# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# modindex_common_prefix = []


# -- Options for HTML output ---------------------------------------------------

# The theme to use for HTML and HTML Help pages. Major themes that come with
# Sphinx are currently 'default' and 'sphinxdoc'.
html_theme = 'sphinxdoc'
html_theme = "sphinxdoc"

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
# html_theme_options = {}

# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
# html_theme_path = []

# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
# html_title = None

# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# html_short_title = None

# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
# html_logo = None

# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
html_favicon = 'favicon.ico'
html_favicon = "favicon.ico"

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]

# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# html_last_updated_fmt = '%b %d, %Y'

# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# html_use_smartypants = True

# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# html_sidebars = {}

# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# html_additional_pages = {}

# If false, no module index is generated.
#html_use_modindex = True
# html_use_modindex = True

# If false, no index is generated.
#html_use_index = True
# html_use_index = True

# If true, the index is split into individual pages for each letter.
#html_split_index = False
# html_split_index = False

# If true, links to the reST sources are added to the pages.
html_show_sourcelink = False

# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# html_use_opensearch = ''

# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = ''
# html_file_suffix = ''

# Output file base name for HTML help builder.
htmlhelp_basename = 'pyDOEPythonPackagedoc'
htmlhelp_basename = "pyDOEPythonPackagedoc"


# -- Options for LaTeX output --------------------------------------------------

# The paper size ('letter' or 'a4').
#latex_paper_size = 'letter'
# latex_paper_size = 'letter'

# The font size ('10pt', '11pt' or '12pt').
#latex_font_size = '10pt'
# latex_font_size = '10pt'

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
Expand All @@ -187,17 +188,17 @@

# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# latex_logo = None

# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# latex_use_parts = False

# Additional stuff for the LaTeX preamble.
#latex_preamble = ''
# latex_preamble = ''

# Documents to append as an appendix to all manuals.
#latex_appendices = []
# latex_appendices = []

# If false, no module index is generated.
#latex_use_modindex = True
# latex_use_modindex = True
42 changes: 32 additions & 10 deletions pyDOE3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,38 @@
The following individuals forked pyDOE and works on `pyDOE2`:

- Copyright (C) 2018 - Rickard Sjoegren and Daniel Svensson

"""

from ._version import __version__

from pyDOE3.doe_box_behnken import *
from pyDOE3.doe_composite import *
from pyDOE3.doe_factorial import *
from pyDOE3.doe_lhs import *
from pyDOE3.doe_fold import *
from pyDOE3.doe_plackett_burman import *
from pyDOE3.var_regression_matrix import *
from pyDOE3.doe_box_behnken import bbdesign
from pyDOE3.doe_composite import ccdesign
from pyDOE3.doe_factorial import (
fullfact,
ff2n,
fracfact,
fracfact_by_res,
fracfact_opt,
fracfact_aliasing,
alias_vector_indices,
)
from pyDOE3.doe_lhs import lhs
from pyDOE3.doe_fold import fold
from pyDOE3.doe_plackett_burman import pbdesign
from pyDOE3.var_regression_matrix import var_regression_matrix
from pyDOE3.doe_gsd import gsd

__all__ = [
"bbdesign",
"ccdesign",
"fullfact",
"ff2n",
"fracfact",
"fracfact_by_res",
"fracfact_opt",
"fracfact_aliasing",
"alias_vector_indices",
"lhs",
"fold",
"pbdesign",
"var_regression_matrix",
"gsd",
]
4 changes: 2 additions & 2 deletions pyDOE3/build_regression_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
Copyright (C) 2010 - 2011 - INRIA - Michael Baudin
Copyright (C) 2009 - Yann Collette
Copyright (C) 2009 - CEA - Jean-Marc Martinez

website: forge.scilab.org/index.php/p/scidoe/sourcetree/master/macros

Much thanks goes to these individuals. It has been converted to Python by
Much thanks goes to these individuals. It has been converted to Python by
Abraham Lee.
"""

Expand Down
16 changes: 8 additions & 8 deletions pyDOE3/doe_box_behnken.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
Copyright (C) 2010 - 2011 - INRIA - Michael Baudin
Copyright (C) 2009 - Yann Collette
Copyright (C) 2009 - CEA - Jean-Marc Martinez

website: forge.scilab.org/index.php/p/scidoe/sourcetree/master/macros

Much thanks goes to these individuals. It has been converted to Python by
Much thanks goes to these individuals. It has been converted to Python by
Abraham Lee.
"""

Expand Down Expand Up @@ -77,12 +77,12 @@ def bbdesign(n, center=None):
for i in range(n - 1):
for j in range(i + 1, n):
Index = Index + 1
H[
max([0, (Index - 1) * H_fact.shape[0]]) : Index * H_fact.shape[0], i
] = H_fact[:, 0]
H[
max([0, (Index - 1) * H_fact.shape[0]]) : Index * H_fact.shape[0], j
] = H_fact[:, 1]
H[max([0, (Index - 1) * H_fact.shape[0]]) : Index * H_fact.shape[0], i] = (
H_fact[:, 0]
)
H[max([0, (Index - 1) * H_fact.shape[0]]) : Index * H_fact.shape[0], j] = (
H_fact[:, 1]
)

if center is None:
if n <= 16:
Expand Down
Loading
Loading