diff --git a/README.md b/README.md index aec0e1ca26b3a8e00ce5c9bf4baf6f471d975d92..748d5e6d9dec16f18b5910f2e5c6bb2023f2f55a 100644 --- a/README.md +++ b/README.md @@ -120,7 +120,7 @@ Assume, we want to calculate the square root of all these numbers. We can simply use numpy's `sqrt` method do perform the same operation on all elements of the array at the same time. <!-- append np_arrays.py --> -```pyton +```python # Calculte the square root for each item in the array numbers. roots = np.sqrt(numbers) ``` @@ -128,7 +128,7 @@ roots = np.sqrt(numbers) Since the resulting variable `roots` is also a numpy array, we can perform similar operations on this variable. <!-- append np_arrays.py --> -```pyton +```python # Perform other calucaltions for each element separately. something_else = 1.5 * roots - 4 ``` @@ -439,7 +439,7 @@ free parameters of the model. The return value corresponds to the $`y`$-value, i our case the expected number of events. <!-- append decay.py --> -``` +```python def model(channel, m, s, A, y0, b): return A * np.exp(-0.5 * (channel - m)**2 / s**2) + y0 + b * channel ``` @@ -470,7 +470,7 @@ stable fit result. More information on the fitting method can be found in the [documentation](https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.curve_fit.html). <!-- append decay.py --> -``` +```python # Define the intial values of the free parameters. # Remember, that we defined our model as n(c; m, s, A, y0, b) p0 = (60, 10, 50, 20, 1) @@ -488,7 +488,7 @@ To visualize the fitted model, we need to evaluate our model with the optimized parameters `popt`. <!-- append decay.py --> -``` +```python # Evaluate the model with the optimized parameter. fit_count = model(channel, *popt)