Skip to content

Commit 1c1ae60

Browse files
initial
0 parents  commit 1c1ae60

138 files changed

Lines changed: 51878 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
.DS_Store
3+
test/__pycache__/test_aggregate_mean_var.cpython-310-pytest-7.1.3.pyc
4+
test/__pycache__/test_build_Psi.cpython-310-pytest-7.1.3.pyc
5+
test/__pycache__/test_build_psi_vec.cpython-310-pytest-7.1.3.pyc
6+
test/__pycache__/test_build_U.cpython-310-pytest-7.1.3.pyc
7+
test/__pycache__/test_evaluate_new_solutions.cpython-310-pytest-7.1.3.pyc
8+
test/__pycache__/test_evaluate_new_X.cpython-310-pytest-7.1.3.pyc
9+
test/__pycache__/test_extract_from_bounds.cpython-310-pytest-7.1.3.pyc
10+
test/__pycache__/test_generate_design.cpython-310-pytest-7.1.3.pyc
11+
test/__pycache__/test_infill.cpython-310-pytest-7.1.3.pyc
12+
test/__pycache__/test_nat_to_cod.cpython-310-pytest-7.1.3.pyc
13+
test/__pycache__/test_nat_to_cod_init.cpython-310-pytest-7.1.3.pyc
14+
test/__pycache__/test_ocba.cpython-310-pytest-7.1.3.pyc
15+
test/__pycache__/test_repair_non_numeric.cpython-310-pytest-7.1.3.pyc
16+
test/__pycache__/test_set_de_bounds.cpython-310-pytest-7.1.3.pyc
17+
test/__pycache__/test_show_progress.cpython-310-pytest-7.1.3.pyc
18+
test/__pycache__/test_suggest_new_X.cpython-310-pytest-7.1.3.pyc
19+
test/__pycache__/test_update_surrogate.cpython-310-pytest-7.1.3.pyc

LICENSE.txt

Lines changed: 661 additions & 0 deletions
Large diffs are not rendered by default.

MANIFEST.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
include src/spotPython/data/*.rst
2+
include src/spotPython/data/*.tar
3+
include src/spotPython/data/*.c
4+
include src/spotPython/data/*.csv
5+
6+

README.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# spotPython
2+
3+
# Development
4+
5+
6+
## Styleguide
7+
8+
Follow the Google Python Style Guide from [https://google.github.io/styleguide/pyguide.html]([https://google.github.io/styleguide/pyguide.html).
9+
10+
## Pre commit checks
11+
12+
Before you commit your code, please check that it is "clean".
13+
To do so, first run [`black`](https://github.com/psf/black) from the projects root directory:
14+
15+
```
16+
$ black .
17+
```
18+
19+
Next, check if [`flake8`](https://flake8.pycqa.org/en/latest/) shows any errors:
20+
21+
```
22+
$ flake8
23+
```
24+
25+
Fix any shown errors before you commit.
26+
27+
# Installation
28+
29+
`pip install spotPython`
30+
31+
32+
## Python
33+
34+
* Mac Users: Install [brew](https://brew.sh/index_de)
35+
* `brew install python` and `brew install graphviz` etc.
36+
37+
* Generate and activate a virtual environment, see [venv](https://docs.python.org/3/library/venv.html), e.g.,
38+
* `cd ~; python3 -m venv .venv`
39+
* `source ~/.venv/bin/activate`
40+
41+
### Python mkdocs
42+
43+
* `python -m pip install mkdocs mkdocs-gen-files mkdocs-literate-nav mkdocs-section-index mkdocs-material`
44+
* `mkdocs build`
45+
* `mkdocs serve`
46+
* `http://127.0.0.1:8000/`
47+
48+
49+
### Optimizing/Profiling Code
50+
51+
* [scipy lecture notes: optimizing code](https://scipy-lectures.org/advanced/optimizing/index.html)
52+
53+
https://scipy-lectures.org/advanced/optimizing/index.html
54+
55+
## Editor/IDE
56+
57+
* Optional: Install [visualstudio](https://code.visualstudio.com)
58+
* Optional: Install [quarto](https://quarto.org)
59+
60+
61+
## Package Installation
62+
63+
### Configuration Files
64+
65+
* This information is based on [https://packaging.python.org/en/latest/tutorials/packaging-projects/](https://packaging.python.org/en/latest/tutorials/packaging-projects/)
66+
* Information is stored in `pyproject.toml` (`setup.py` is not used anymore.)
67+
* A `src` folder is used for the package sources.
68+
* The following files are used for the package building:
69+
* `pyproject.toml`: see [pyproject.toml](./pyproject.toml).
70+
* Important: Follow the instructions from [https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html](https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html) for including data files (like *.csv, *.tar, etc.). These files can be specified in the following `MANIFEST` file:
71+
* `MANIFEST`: see [MANIFEST](MANIFEST.in). It describes the data files to be included, e.g.:
72+
* `include src/spotPython/data/*.rst`
73+
* `LICENSE`: see [LICENSE](./LICENSE)
74+
75+
### Installation
76+
77+
* Perform the following steps to install the package:
78+
* Make sure you have the latest version of PyPA’s build installed:
79+
* `python3 -m pip install --upgrade build`
80+
* Start the package building process via: `python3 -m build`
81+
* This command should output a lot of text and once completed should generate two files in the `dist` directory.
82+
* You can use the local `spotPython*.tar.gz` file from the `dist` folder for your package installation with `pip`, e.g.;
83+
* `python3 -m pip install ./dist/spotPython-0.0.1.tar.gz`
84+
85+
39.3 KB
Binary file not shown.

dist/spotPython-0.0.1.tar.gz

43.2 KB
Binary file not shown.

docs/about.md

Lines changed: 308 additions & 0 deletions
Large diffs are not rendered by default.

docs/download.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Install spotPython
2+
3+
pip install spotPython

docs/examples.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# SPOT Examples
2+
3+
## Simple spotPython run
4+
5+
import numpy as np
6+
from spotPython.fun.objectivefunctions import analytical
7+
from spotPython.spot import spot
8+
import numpy as np
9+
from math import inf
10+
# number of initial points:
11+
ni = 7
12+
# number of points
13+
n = 10
14+
15+
fun = analytical().fun_sphere
16+
lower = np.array([-1])
17+
upper = np.array([1])
18+
design_control={"init_size": ni}
19+
20+
spot_1 = spot.Spot(fun=fun,
21+
lower = lower,
22+
upper= upper,
23+
fun_evals = n,
24+
show_progress=True,
25+
design_control=design_control,)
26+
spot_1.run()

docs/gen_ref_pages.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
"""Generate the code reference pages and navigation."""
2+
3+
from pathlib import Path
4+
5+
import mkdocs_gen_files
6+
7+
nav = mkdocs_gen_files.Nav()
8+
9+
for path in sorted(Path("src").rglob("*.py")):
10+
module_path = path.relative_to("src").with_suffix("")
11+
doc_path = path.relative_to("src").with_suffix(".md")
12+
full_doc_path = Path("reference", doc_path)
13+
14+
parts = tuple(module_path.parts)
15+
16+
if parts[-1] == "__init__":
17+
parts = parts[:-1]
18+
doc_path = doc_path.with_name("index.md")
19+
full_doc_path = full_doc_path.with_name("index.md")
20+
elif parts[-1] == "__main__":
21+
continue
22+
23+
nav[parts] = doc_path.as_posix()
24+
25+
with mkdocs_gen_files.open(full_doc_path, "w") as fd:
26+
ident = ".".join(parts)
27+
fd.write(f"::: {ident}")
28+
29+
mkdocs_gen_files.set_edit_path(full_doc_path, path)
30+
31+
with mkdocs_gen_files.open("reference/SUMMARY.md", "w") as nav_file:
32+
nav_file.writelines(nav.build_literate_nav())

0 commit comments

Comments
 (0)