readme: update for changes to ex-1, ex-2

This commit is contained in:
Michele Guerini Rocco 2020-05-24 18:18:58 +02:00
parent 7cb1c20c2b
commit f6e048496f
3 changed files with 53 additions and 26 deletions

View File

@ -27,15 +27,28 @@ The programs used to solve the exercise are written in standard C99 (with the
only exception of the `#pragma once` clause) and require the following
libraries to build:
- [GMP](https://gmplib.org/)
- [GMP] (≥ 6.2)
- [GSL](https://www.gnu.org/software/gsl/)
- [GSL] (≥ 2.6)
* [pkg-config](https://www.freedesktop.org/wiki/Software/pkg-config/)
(build-time only)
* [pkg-config] (≥ 0.29, build-time only)
Additionally, Python (version 3) with `numpy` and `matplotlib` is required to
generate plots.
To generate plots, Python (version 3) with
- [numpy] (≥ 1.18)
- [matplotlib] (≥ 2.2)
- [scipy] (≥ 1.4, optional)
is required to generate plots.
[GMP]: https://gmplib.org/
[GSL]: https://www.gnu.org/software/gsl/
[pkg-config]: https://www.freedesktop.org/wiki/Software/pkg-config/
[numpy]: https://numpy.org/
[scipy]: https://www.scipy.org/scipylib/index.html
[matplotlib]: https://matplotlib.org/
For convenience, a `shell.nix` file is provided to set up the build environment.
See this [guide](https://nixos.org/nix/manual/#chap-quick-start) if you have
@ -54,7 +67,6 @@ To clean up the build results run:
$ make clean
## Running the programs
Notes:
@ -76,6 +88,11 @@ comparing the sample mode, FWHM and median, in this order.
`ex-1/bin.pdf` prints a list of x-y points of the Landau PDF to the `stdout`.
The output can be redirected to `ex-1/pdf-plot.py` to generate a plot.
(optional) `ex-1/plots/kde.py` makes the example plot (shown in exercises.pdf,
fig. 4) of the kernel density estimation used to compute a non-parametric FWHM
from a sample of random points. To run this program you must additionally
install [scipy].
### Exercise 2
@ -95,6 +112,10 @@ take therefore the required number of decimal places as their only argument.
The exact γ digits (used in comparison) are limited to 50 and 500 places,
respectively.
`ex-2/bin/fast` is a highly optimized version of `ex-2/bin/fancier`, meant to
compute a very large number of digits and therefore doesn't come with a
verified, fixed, approximation of γ.
### Exercise 3
@ -133,12 +154,12 @@ and `-b`.
### Exercise 5
`ex-5/main` compute estimations of the integral of exp(1) between 0 and 1
`ex-5/main` compute estimations of the integral of exp(x) between 0 and 1
with the methods plain MC, MISER and VEGAS with different number of points.
It takes no arguments in input.
It prints out eight columns:
1. the number of sorted points;
1. the number of points;
2. the integral estimation with plain MC;
@ -158,6 +179,7 @@ To plot the results do:
$ ex-5/main | ex-5/plot.py
### Exercise 6
`ex-6/bin/main` simulates a Fraunhöfer diffraction experiment. The program
@ -166,8 +188,8 @@ diffraction angle. To plot a histogram do:
$ ex-6/bin/main | ex-6/plot.py
The program convolves the original signal with a Gaussian kernel (`-s` to
change the kernel σ), optionally adds a Gaussian noise (`-n` to change the
The program convolves the original signal with a gaussian kernel (`-s` to
change the kernel σ), optionally adds a gaussian noise (`-n` to change the
noise σ) and performs either a naive deconvolution by a FFT (`-m fft` mode)
or applying the Richardson-Lucy deconvolution algorithm (`-m rl` mode).
@ -176,27 +198,33 @@ deconvolved histogram counts should be printed to `stdout`. For more options
run the program with `-h` to see the usage screen.
`ex-6/bin/test` simulates a customizable number of experiments and prints
to `stdout` the histograms of the distribution of the EMD of the convolved
signal together with the deconvolved signal EMD histograms with both FFT and
Richardson-Lucy procedures. It also prints to `stderr` the average, standard
deviation and skewness of the histograms. To plot the results, do:
to `stdout` the histograms of the distribution of the EMD from the original
signal to:
1. the result of the FFT deconvolution
2. the result of the Richardson-Lucy deconvolution
3. the convolved signal (with noise if `-n` has been given)
It also prints to `stderr` the average, standard deviation and skewness of
each distribution. To plot the histograms, do:
$ ex-6/bin/test | ex-6/dist-plot.py
The program accepts some parameters to control the histogram and number of
events, run it with `-h` to see their usage.
`ex-6/plots/emd.py` plots the content of the files `ex-6/plots/emd-noisy.txt`
and `ex-6/plots/emd-noiseless.txt` depending on the argument passed to it from
stdin. Do:
(optional) `ex-6/plots/emd.py` makes the plots of the EMD statistics of the RL
deconvolution (shown in excercies.pdf, section 6.6) as a function of the number
of rounds. The programs sources its data from two files in the same directory,
these were obtained by running `ex-6/bin/test`. Do:
$ ex-6/plots/emd.py 'noisy'
$ ex-6/plots/emd.py noisy
to plot the content of the first file and do:
for the plots of the experiment with gaussian noise, and
$ ex-6/plots/emd.py 'noiseless'
$ ex-6/plots/emd.py noiseless
to plot the content of the second file.
for the experiment without noise.
### Exercise 7

View File

@ -89,7 +89,7 @@ plt.plot(x, moyal.pdf(x, loc=4), c='xkcd:gray', label='true PDF')
plt.plot(x, f, '#92182b', label='empirical PDF')
plt.plot(sample, np.zeros_like(sample),
'|', c='xkcd:navy')
#plt.axvline(x=m.mean(), c='r')
plt.axvline(x=m.mean(), c='r')
plt.axvline(x=M.mean(), c='xkcd:camel', label='mode')
plt.legend()
plt.show()

View File

@ -1,7 +1,6 @@
- riscrivere il 2
- riscrivere il readme del 1
- riscrivere il readme del 2
- riscrivere il readme del 6
- riscrivere il readme del 7
- incolonnare bene ex-5
On the lambert W function, formula 4.19 Corless
On the Lambert W function, formula 4.19 Corless