Skip to content

Commit 7f96e7e

Browse files
Merge pull request #246 from bessagroup/pr/1.4.6
Pr/1.4.6
2 parents 7495fc4 + 506d0ae commit 7f96e7e

Some content is hidden

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

43 files changed

+1833
-674
lines changed

Diff for: VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.4.5
1+
1.4.6

Diff for: docs/requirements.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
sphinx
22
sphinx_rtd_theme
33
sphinxcontrib-bibtex
4-
sphinx_autodoc_typehints
4+
sphinx_autodoc_typehints
5+
sphinx-tabs==3.4.4

Diff for: docs/source/conf.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
project = 'f3dasm'
2626
author = 'Martin van der Schelling'
2727
copyright = '2022, Martin van der Schelling'
28-
version = '1.4.5'
29-
release = '1.4.5'
28+
version = '1.4.6'
29+
release = '1.4.6'
3030

3131

3232
# -- General configuration ----------------------------------------------------
@@ -42,7 +42,8 @@
4242
'sphinx.ext.autosummary',
4343
'sphinx.ext.intersphinx',
4444
'sphinx.ext.viewcode',
45-
'sphinx_autodoc_typehints']
45+
'sphinx_autodoc_typehints',
46+
'sphinx_tabs.tabs']
4647

4748
# Source: https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-source_suffix
4849
source_suffix = {'.rst': 'restructuredtext', }

Diff for: docs/source/rst_doc_files/classes/datageneration/datagenerator.rst

+15-16
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ Datagenerator
44
=============
55

66
The :class:`~f3dasm.datageneration.DataGenerator` class is the main class of the :mod:`~f3dasm.datageneration` module.
7-
It is used to generate :attr:`~f3dasm.design.ExperimentData.output_data` for the :class:`~f3dasm.design.ExperimentData` by taking a :class:`~f3dasm.design.ExperimentSample` object.
7+
It is used to generate :attr:`~f3dasm.ExperimentData.output_data` for the :class:`~f3dasm.ExperimentData` by taking a :class:`~f3dasm.ExperimentSample` object.
88

99
The :class:`~f3dasm.datageneration.DataGenerator` can serve as the interface between the
10-
:class:`~f3dasm.design.ExperimentData` object and any third-party simulation software.
10+
:class:`~f3dasm.ExperimentData` object and any third-party simulation software.
1111

1212
.. image:: ../../../img/f3dasm-datageneration.png
1313
:width: 70%
@@ -17,27 +17,27 @@ The :class:`~f3dasm.datageneration.DataGenerator` can serve as the interface bet
1717
|
1818
1919
Use the simulator in the data-driven process
20-
------------------------------------------
20+
--------------------------------------------
2121

22-
In order to run your simulator on each of the :class:`~f3dasm.design.ExperimentSample` of your :class:`~f3dasm.design.ExperimentData`, you follow these steps:
22+
In order to run your simulator on each of the :class:`~f3dasm.ExperimentSample` of your :class:`~f3dasm.ExperimentData`, you follow these steps:
2323
In this case, we are utilizing a one of the :ref:`benchmark-functions` to mock a simulator.
2424

25-
We provide the datagenerator to the :meth:`~f3dasm.design.ExperimentData.evaluate` function with the :class:`~f3dasm.datageneration.DataGenerator` object as an argument.
25+
We provide the datagenerator to the :meth:`~f3dasm.ExperimentData.evaluate` function with the :class:`~f3dasm.datageneration.DataGenerator` object as an argument.
2626

2727
.. code-block:: python
2828
2929
experimentdata.evaluate(data_generator="Ackley", method='sequential', kwargs={'some_additional_parameter': 1})
3030
3131
.. note::
3232

33-
Any key-word arguments that need to be passed down to the :class:`~f3dasm.datageneration.DataGenerator` can be passed in the :code:`kwargs` argument of the :meth:`~f3dasm.design.ExperimentData.evaluate` function.
33+
Any key-word arguments that need to be passed down to the :class:`~f3dasm.datageneration.DataGenerator` can be passed in the :code:`kwargs` argument of the :meth:`~f3dasm.ExperimentData.evaluate` function.
3434

3535

36-
There are three methods available of handeling the :class:`~f3dasm.design.ExperimentSample` objects:
36+
There are three methods available of handeling the :class:`~f3dasm.ExperimentSample` objects:
3737

38-
* :code:`sequential`: regular for-loop over each of the :class:`~f3dasm.design.ExperimentSample` objects in order
39-
* :code:`parallel`: utilizing the multiprocessing capabilities (with the `pathos <https://pathos.readthedocs.io/en/latest/pathos.html>`_ multiprocessing library), each :class:`~f3dasm.design.ExperimentSample` object is run in a separate core
40-
* :code:`cluster`: utilizing the multiprocessing capabilities, each :class:`~f3dasm.design.ExperimentSample` object is run in a separate node. After completion of an sample, the node will automatically pick the next available sample. More information on this mode can be found in the :ref:`cluster-mode` section.
38+
* :code:`sequential`: regular for-loop over each of the :class:`~f3dasm.ExperimentSample` objects in order
39+
* :code:`parallel`: utilizing the multiprocessing capabilities (with the `pathos <https://pathos.readthedocs.io/en/latest/pathos.html>`_ multiprocessing library), each :class:`~f3dasm.ExperimentSample` object is run in a separate core
40+
* :code:`cluster`: utilizing the multiprocessing capabilities, each :class:`~f3dasm.ExperimentSample` object is run in a separate node. After completion of an sample, the node will automatically pick the next available sample. More information on this mode can be found in the :ref:`cluster-mode` section.
4141

4242

4343
Implement your simulator
@@ -65,16 +65,16 @@ Once you have created the ``data_generator`` object, you can plug-in a pre-proc
6565

6666
pre-processing
6767
^^^^^^^^^^^^^^
68-
The preprocessing method is used to create a simulator input file from the information in the :class:`~f3dasm.design.ExperimentSample`.
68+
The preprocessing method is used to create a simulator input file from the information in the :class:`~f3dasm.ExperimentSample`.
6969

7070

7171
This method should adhere to a few things:
7272

73-
* The first argument of the function needs to be ``experiment_sample`` of type :class:`~f3dasm.design.ExperimentSample`.
73+
* The first argument of the function needs to be ``experiment_sample`` of type :class:`~f3dasm.ExperimentSample`.
7474
* The method should return None.
7575
* The method should create the input file ready for the simulator to process with the job_number as name (``experiment_sample.job_number``)
7676

77-
You can retrieve the parameters of the :class:`~f3dasm.design.ExperimentSample` object by calling the :meth:`~f3dasm.design.ExperimentSample.get` method.
77+
You can retrieve the parameters of the :class:`~f3dasm.ExperimentSample` object by calling the :meth:`~f3dasm.ExperimentSample.get` method.
7878

7979
You can add the ``pre-process-function`` to the :class:`~f3dasm.datageneration.DataGenerator` object by passing it through the :meth:`~f3dasm.datageneration.DataGenerator.add_pre_process` method:
8080

@@ -90,13 +90,12 @@ You can add the ``pre-process-function`` to the :class:`~f3dasm.datageneration.D
9090
post-processing
9191
^^^^^^^^^^^^^^^
9292

93-
* :meth:`~f3dasm.datageneration.DataGenerator.execute` - The main functon call to run the simulation. Returns None.
9493
The post-processing method converts the output of the simulator to a ``results.pkl`` `pickle <https://docs.python.org/3/library/pickle.html>`_ file.
95-
This ``results.pkl`` is then loaded into the :class:`~f3dasm.design.ExperimentData` object.
94+
This ``results.pkl`` is then loaded into the :class:`~f3dasm.ExperimentData` object.
9695

9796
This method should adhere to a few things:
9897

99-
* The first argument of the function needs to be ``experiment_sample`` of type :class:`~f3dasm.design.ExperimentSample`.
98+
* The first argument of the function needs to be ``experiment_sample`` of type :class:`~f3dasm.ExperimentSample`.
10099
* The method should return None.
101100
* The method read the output of the simulator (it's name is ``experiment_sample.job_number``) and convert it to a ``results.pkl`` file.
102101
* This pickle file is stored in the current working directory.

Diff for: docs/source/rst_doc_files/classes/datageneration/functions.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ In order to augment the benchmark functions, you can provide 4 keyword arguments
2020
* ``seed``: Seed for the random number generator for the ``noise`` and ``offset`` calculations.
2121

2222
Benchmark functions can substitute the expensive simulation in the
23-
:class:`~f3dasm.design.ExperimentData` object by providing the name of the function as the ``data_generator`` argument:
23+
:class:`~f3dasm.ExperimentData` object by providing the name of the function as the ``data_generator`` argument:
2424

2525
.. code-block:: python
2626

Diff for: docs/source/rst_doc_files/classes/design/domain.rst

+6-6
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Domain
99

1010
.. _domain:
1111

12-
The :class:`~f3dasm.design.Domain` is a set of :class:`f3dasm.design.Parameter` instances that make up the feasible search space.
12+
The :class:`~f3dasm.design.Domain` is a set of parameter instances that make up the feasible search space.
1313

1414
.. image:: ../../../img/f3dasm-domain.png
1515
:width: 100%
@@ -23,7 +23,7 @@ To start, we instantiate an empty domain object:
2323

2424
.. code-block:: python
2525
26-
from f3dasm import Domain
26+
from f3dasm.design import Domain
2727
2828
domain = Domain()
2929
@@ -108,12 +108,12 @@ and a dictionary with the parameter type (:code:`type`) and the corresponding ar
108108
domain:
109109
param_1:
110110
type: float
111-
lower_bound: -1.0
112-
upper_bound: 1.0
111+
low: -1.0
112+
high: 1.0
113113
param_2:
114114
type: int
115-
lower_bound: 1
116-
upper_bound: 10
115+
low: 1
116+
high: 10
117117
param_3:
118118
type: category
119119
categories: ['red', 'blue', 'green', 'yellow', 'purple']

Diff for: docs/source/rst_doc_files/classes/design/experimentdata.rst

+22-22
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
Experiment Data
22
===============
33

4-
The :class:`~f3dasm.design.ExperimentData` object is the main object used to store implementations of a design-of-experiments,
4+
The :class:`~f3dasm.ExperimentData` object is the main object used to store implementations of a design-of-experiments,
55
keep track of results, perform optimization and extract data for machine learning purposes.
66

77
All other processses of f3dasm use this object to manipulate and access data about your experiments.
88

9-
The :class:`~f3dasm.design.ExperimentData` object consists of the following attributes:
9+
The :class:`~f3dasm.ExperimentData` object consists of the following attributes:
1010

1111
- :ref:`domain <domain-format>`: The feasible :class:`~f3dasm.design.Domain` of the Experiment. Used for sampling and optimization.
1212
- :ref:`input_data <input-data-format>`: Tabular data containing the input variables of the experiments as column and the experiments as rows.
@@ -25,7 +25,7 @@ The :class:`~f3dasm.design.ExperimentData` object consists of the following attr
2525

2626
Users of :mod:`f3dasm` are advised to not directly manipulate the attributes of the ExperimentData object. Instead, the methods of ExperimentData should be used to manipulate the data.
2727

28-
The :class:`~f3dasm.design.ExperimentData` object can be constructed in several ways:
28+
The :class:`~f3dasm.ExperimentData` object can be constructed in several ways:
2929

3030
* :ref:`By providing your own data <experimentdata-own>`
3131
* :ref:`Reconstructed from the project directory <experimentdata-file>`
@@ -37,15 +37,15 @@ The :class:`~f3dasm.design.ExperimentData` object can be constructed in several
3737
ExperimentData from your own data
3838
---------------------------------
3939

40-
You can construct a :class:`~f3dasm.design.ExperimentData` object by providing it :ref:`input_data <input-data-format>`, :ref:`output_data <output-data-format>`, a :ref:`domain <domain-format>` object and a :ref:`filename <filename-format>`.
40+
You can construct a :class:`~f3dasm.ExperimentData` object by providing it :ref:`input_data <input-data-format>`, :ref:`output_data <output-data-format>`, a :ref:`domain <domain-format>` object and a :ref:`filename <filename-format>`.
4141

4242
.. code-block:: python
4343
4444
>>> from f3dasm import ExperimentData
4545
>>> data = ExperimentData(domain, input_data, output_data)
4646
4747
48-
The following sections will explain how to construct a :class:`~f3dasm.design.ExperimentData` object from your own data.
48+
The following sections will explain how to construct a :class:`~f3dasm.ExperimentData` object from your own data.
4949

5050
.. _domain-format:
5151

@@ -154,7 +154,7 @@ Several datatypes are supported for the ``output_data`` argument:
154154
>>> domain = Domain({'x0': ContinuousParameter(0., 1.)}, 'x1': ContinuousParameter(0., 1.)})
155155
>>> data = ExperimentData(input_data="my_experiment_data.csv", domain=domain)
156156

157-
If you don't have output data yet, you can also construct an :class:`~f3dasm.design.ExperimentData` object without providing output data.
157+
If you don't have output data yet, you can also construct an :class:`~f3dasm.ExperimentData` object without providing output data.
158158

159159

160160
.. _filename-format:
@@ -172,7 +172,7 @@ You can provide a string or a path to a directory. If the directory does not exi
172172
>>> project_dir = "folder/to/my_project_directory"
173173
>>> data = ExperimentData(project_dir=project_dir)
174174
175-
You can also set the project directoy manually after creation with the :meth:`~f3dasm.design.ExperimentData.set_project_dir` method"
175+
You can also set the project directoy manually after creation with the :meth:`~f3dasm.ExperimentData.set_project_dir` method"
176176

177177
.. code-block:: python
178178
@@ -187,7 +187,7 @@ You can also set the project directoy manually after creation with the :meth:`~f
187187
ExperimentData from project directory
188188
-------------------------------------
189189

190-
If you already have constructed the :class:`~f3dasm.design.ExperimentData` object before, you can retrieve it from disk by calling the :meth:`~f3dasm.design.ExperimentData.from_file`
190+
If you already have constructed the :class:`~f3dasm.ExperimentData` object before, you can retrieve it from disk by calling the :meth:`~f3dasm.ExperimentData.from_file`
191191
classmethod with the path of project directory:
192192

193193
.. code-block:: python
@@ -200,7 +200,7 @@ classmethod with the path of project directory:
200200
ExperimentData from a sampling
201201
------------------------------
202202

203-
You can directly construct an :class:`~f3dasm.design.ExperimentData` object from a sampling strategy by using the :meth:`~f3dasm.design.ExperimentData.from_sampling` method.
203+
You can directly construct an :class:`~f3dasm.ExperimentData` object from a sampling strategy by using the :meth:`~f3dasm.ExperimentData.from_sampling` method.
204204
You have to provide the following arguments:
205205

206206
* A sampling function. To learn more about integrating your sampling function, please refer to :ref:`this <integrating-sampling>` section.
@@ -247,9 +247,9 @@ ExperimentData from a `hydra <https://hydra.cc/>`_ configuration file
247247
---------------------------------------------------------------------
248248
249249
If you are using `hydra <https://hydra.cc/>`_ for configuring your experiments, you can use it to construct
250-
an :class:`~f3dasm.design.ExperimentData` object from the information in the :code:`config.yaml` file with the :meth:`~f3dasm.design.ExperimentData.from_yaml` method.
250+
an :class:`~f3dasm.ExperimentData` object from the information in the :code:`config.yaml` file with the :meth:`~f3dasm.ExperimentData.from_yaml` method.
251251
252-
You can create an experimentdata :class:`~f3dasm.design.ExperimentData` object in the same ways as described above, but now using the hydra configuration file.
252+
You can create an experimentdata :class:`~f3dasm.ExperimentData` object in the same ways as described above, but now using the hydra configuration file.
253253
254254
255255
.. code-block:: yaml
@@ -276,7 +276,7 @@ You can create an experimentdata :class:`~f3dasm.design.ExperimentData` object i
276276
The :class:`~f3dasm.design.Domain` object will be constructed using the :code:`domain` key in the :code:`config.yaml` file. Make sure you have the :code:`domain` key in your :code:`config.yaml`!
277277
To see how to configure the :class:`~f3dasm.design.Domain` object with hydra, see :ref:`this <domain-from-yaml>` section.
278278
279-
Inside your python script, you can then create the :class:`~f3dasm.design.ExperimentData` object with the :meth:`~f3dasm.design.ExperimentData.from_yaml` method:
279+
Inside your python script, you can then create the :class:`~f3dasm.ExperimentData` object with the :meth:`~f3dasm.ExperimentData.from_yaml` method:
280280
281281
.. code-block:: python
282282
@@ -289,9 +289,9 @@ Inside your python script, you can then create the :class:`~f3dasm.design.Experi
289289
290290
.. note::
291291
292-
Make sure to pass the full :code:`config` to the :meth:`~f3dasm.design.ExperimentData.from_yaml` constructor!
292+
Make sure to pass the full :code:`config` to the :meth:`~f3dasm.ExperimentData.from_yaml` constructor!
293293
294-
To create the :class:`~f3dasm.design.ExperimentData` object with the :meth:`~f3dasm.design.ExperimentData.from_sampling` method, you can use the following configuration:
294+
To create the :class:`~f3dasm.ExperimentData` object with the :meth:`~f3dasm.ExperimentData.from_sampling` method, you can use the following configuration:
295295
296296
.. code-block:: yaml
297297
:caption: config.yaml for from_sampling
@@ -320,7 +320,7 @@ To create the :class:`~f3dasm.design.ExperimentData` object with the :meth:`~f3d
320320
To see how to configure the :class:`~f3dasm.design.Domain` object with hydra, see :ref:`this <domain-from-yaml>` section.
321321
322322
323-
To create the :class:`~f3dasm.design.ExperimentData` object with the :meth:`~f3dasm.design.ExperimentData.from_file` method, you can use the following configuration:
323+
To create the :class:`~f3dasm.ExperimentData` object with the :meth:`~f3dasm.ExperimentData.from_file` method, you can use the following configuration:
324324
325325
.. code-block:: yaml
326326
:caption: config.yaml for from_file
@@ -331,7 +331,7 @@ To create the :class:`~f3dasm.design.ExperimentData` object with the :meth:`~f3d
331331
Adding data after construction
332332
------------------------------
333333
334-
If you have constructed your :class:`~f3dasm.design.ExperimentData` object, you can add ``input_data``, ``output_data``, a ``domain`` or the ``filename`` using the :meth:`~f3dasm.design.ExperimentData.add` method:
334+
If you have constructed your :class:`~f3dasm.ExperimentData` object, you can add ``input_data``, ``output_data``, a ``domain`` or the ``filename`` using the :meth:`~f3dasm.ExperimentData.add` method:
335335
336336
.. code-block:: python
337337
@@ -345,7 +345,7 @@ If you have constructed your :class:`~f3dasm.design.ExperimentData` object, you
345345
346346
.. warning::
347347
348-
You can only add data to an existing :class:`~f3dasm.design.ExperimentData` object if the domain is the same as the existing domain.
348+
You can only add data to an existing :class:`~f3dasm.ExperimentData` object if the domain is the same as the existing domain.
349349
350350
351351
Exporting
@@ -356,7 +356,7 @@ Exporting
356356
Storing the ExperimentData object
357357
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
358358
359-
The :class:`~f3dasm.design.ExperimentData` object can be exported to a collection of files using the :meth:`~f3dasm.design.ExperimentData.store` method.
359+
The :class:`~f3dasm.ExperimentData` object can be exported to a collection of files using the :meth:`~f3dasm.ExperimentData.store` method.
360360
361361
.. code-block:: python
362362
@@ -369,7 +369,7 @@ Inside the project directory, a subfolder `experiment_data` will be created cont
369369
- :code:`output.csv`: The :attr:`~f3dasm.design.ExperimentData.output_data` table
370370
- :code:`jobs.pkl`: The :attr:`~f3dasm.design.ExperimentData.jobs` object
371371
372-
These files are used to load the :class:`~f3dasm.design.ExperimentData` object again using the :meth:`~f3dasm.design.ExperimentData.from_file` method.
372+
These files are used to load the :class:`~f3dasm.ExperimentData` object again using the :meth:`~f3dasm.ExperimentData.from_file` method.
373373
374374
.. code-block:: python
375375
@@ -394,6 +394,6 @@ Storing to other datatypes
394394
395395
Alternatively, you can convert the input- and outputdata of your data-driven process to other well-known datatypes:
396396
397-
* :class:`~numpy.ndarray` (:meth:`~f3dasm.design.ExperimentData.to_numpy`); creates a tuple of two :class:`~numpy.ndarray` objects containing the input- and outputdata.
398-
* :class:`~xarray.Dataset` (:meth:`~f3dasm.design.ExperimentData.to_xarray`); creates a :class:`~xarray.Dataset` object containing the input- and outputdata.
399-
* :class:`~pd.DataFrame` (:meth:`~f3dasm.design.ExperimentData.to_pandas`); creates a tuple of two :class:`~pd.DataFrame` object containing the input- and outputdata.
397+
* :class:`~numpy.ndarray` (:meth:`~f3dasm.ExperimentData.to_numpy`); creates a tuple of two :class:`~numpy.ndarray` objects containing the input- and outputdata.
398+
* :class:`~xarray.Dataset` (:meth:`~f3dasm.ExperimentData.to_xarray`); creates a :class:`~xarray.Dataset` object containing the input- and outputdata.
399+
* :class:`~pd.DataFrame` (:meth:`~f3dasm.ExperimentData.to_pandas`); creates a tuple of two :class:`~pd.DataFrame` object containing the input- and outputdata.

0 commit comments

Comments
 (0)