@@ -13,8 +13,14 @@ You can install ``uv`` with your favorite package manager,
1313or by one of the other methods described at
1414https://docs.astral.sh/uv/getting-started/installation/.
1515
16+ If you don't like ``uv ``, no problem!
17+ You can also use Python's official packaging tool pip _ or any other third-party tool,
18+ as long as it can install `the SFS package `_.
19+
1620.. _Python : https://www.python.org/
1721.. _uv : https://docs.astral.sh/uv/
22+ .. _pip : https://packaging.python.org/en/latest/tutorials/installing-packages/
23+ .. _the SFS package : https://pypi.org/project/sfs/
1824.. _NumPy : http://www.numpy.org/
1925.. _SciPy : https://www.scipy.org/scipylib/
2026.. _Matplotlib : https://matplotlib.org/
@@ -24,32 +30,74 @@ Installation
2430
2531First, create a new directory wherever you want, change into it, then run::
2632
27- uv venv
28-
29- This will print instructions for how to `activate the environment `__.
30- You should do that now!
33+ uv init --bare
3134
32- __ https://docs.astral.sh/uv/pip/environments/#using-a-virtual-environment
35+ This will create a file named ``pyproject.toml `` for you.
36+ Use the ``--help `` flag to see other options.
3337
34- The Sound Field Synthesis Toolbox can be installed with::
38+ The Sound Field Synthesis Toolbox can now be installed with::
3539
36- uv pip install sfs
40+ uv add sfs
3741
3842This will automatically install the NumPy _ and SciPy _ libraries as well,
3943which are needed by the SFS Toolbox.
44+ It will also create a file named ``uv.lock ``, which tracks the exact versions
45+ of all installed packages.
4046
4147If you want to use the provided functions for plotting sound fields, you'll need
4248Matplotlib _::
4349
44- uv pip install matplotlib
50+ uv add matplotlib
4551
4652However, since all results are provided as plain NumPy _ arrays, you should also
4753be able to use any other plotting library of your choice to visualize the sound
4854fields.
4955
50- The steps above need to be executed only once.
51- Whenever you come back to this directory at a later time,
52- you just need to activate the environment again.
56+ You might also want to install some other Python-related tools,
57+ e.g. JupyterLab _::
58+
59+ uv add jupyterlab
60+
61+ .. _JupyterLab : https://jupyter.org/
62+
63+ You get the gist: whatever you need, just ``uv add ... `` it!
64+
65+ Once everything is installed, you can start working with the tool of your choice
66+ by simply prefixing it with ``uv run ``, for example::
67+
68+ uv run jupyter lab
69+
70+ Similarly, you can launch any other tool, like a text editor, an IDE etc.
71+
72+ You can also simply create a Python file, let's say ``my_script.py ``:
73+
74+ .. code :: python
75+
76+ import matplotlib.pyplot as plt
77+ import numpy as np
78+ import sfs
79+
80+ npw = sfs.util.direction_vector(np.radians(- 45 ))
81+ f = 300 # Hz
82+ omega = 2 * np.pi * f
83+
84+ grid = sfs.util.xyz_grid([- 2 , 2 ], [- 2 , 2 ], 0 , spacing = 0.02 )
85+ array = sfs.array.circular(N = 32 , R = 1.5 )
86+
87+ d, selection, secondary_source = sfs.fd.wfs.plane_25d(
88+ omega, array.x, array.n, npw)
89+
90+ p = sfs.fd.synthesize(d, selection, array, secondary_source, grid = grid)
91+ sfs.plot2d.amplitude(p, grid)
92+ sfs.plot2d.loudspeakers(array.x, array.n, selection * array.a, size = 0.15 )
93+
94+ plt.show()
95+
96+ You can then run this script (assuming you installed ``matplotlib `` before) with::
97+
98+ uv run my_script.py
99+
100+ In a similar way, you can run the :doc: `example-python-scripts `.
53101
54102If you want to install the latest development version of the SFS Toolbox, have a
55103look at :doc: `contributing `.
0 commit comments