Skip to content

Commit 965b535

Browse files
committed
Doc formatting check
1 parent d7f2cfb commit 965b535

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

docs/source/morphpy.rst

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,8 @@ For this tutorial, we will go through two examples. One simple one
414414
involving shifting a function in the ``x`` and ``y`` directions, and
415415
another involving a Fourier transform.
416416

417-
1. Let's start by taking a simple ``sine`` function:
417+
1. Let's start by taking a simple ``sine`` function.
418+
418419
.. code-block:: python
419420
420421
import numpy as np
@@ -423,7 +424,8 @@ another involving a Fourier transform.
423424
morph_table = np.array([morph_x, morph_y]).T
424425
425426
2. Then, let our target function be that same ``sine`` function shifted
426-
to the right by ``0.3`` and up by ``0.7``:
427+
to the right by ``0.3`` and up by ``0.7``.
428+
427429
.. code-block:: python
428430
429431
target_x = morph_x + 0.3
@@ -434,20 +436,23 @@ another involving a Fourier transform.
434436
this would require us to refine over two separate morph
435437
operations. We can instead perform these morphs simultaneously
436438
by defining a function:
439+
437440
.. code-block:: python
438441
439442
def shift(x, y, hshift, vshift):
440443
return x + hshift, y + vshift
441444
442445
4. Now, let's try finding the optimal shift parameters using the ``MorphFuncxy`` morph.
443-
We can try an initial guess of ``hshift=0.0`` and ``vshift=0.0``:
446+
We can try an initial guess of ``hshift=0.0`` and ``vshift=0.0``.
447+
444448
.. code-block:: python
445449
446450
from diffpy.morph.morphpy import morph_arrays
447451
initial_guesses = {"hshift": 0.0, "vshift": 0.0}
448452
info, table = morph_arrays(morph_table, target_table, funcxy=(shift, initial_guesses))
449453
450-
5. Finally, to see the refined ``hshift`` and ``vshift`` parameters, we extract them from ``info``:
454+
5. Finally, to see the refined ``hshift`` and ``vshift`` parameters, we extract them from ``info``.
455+
451456
.. code-block:: python
452457
453458
print(f"Refined hshift: {info["funcxy"]["hshift"]}")
@@ -457,8 +462,9 @@ Now for an example involving a Fourier transform.
457462

458463
1. Let's say you measured a signal of the form :math:`f(x)=\exp\{\cos(\pi x)\}`.
459464
Unfortunately, your measurement was taken against a noisy sinusoidal
460-
background of the form :math:`n(x)=A\sin(Bx)`, where ``A,B`` are unknown.
465+
background of the form :math:`n(x)=A\sin(Bx)`, where ``A``, ``B`` are unknown.
461466
For our example, let's say (unknown to us) that ``A=2`` and ``B=1.7``.
467+
462468
.. code-block:: python
463469
464470
import numpy as np
@@ -477,6 +483,7 @@ Now for an example involving a Fourier transform.
477483
478484
2. Your colleague remembers they previously computed the Fourier transform
479485
of the function and has sent that to you.
486+
480487
.. code-block:: python
481488
482489
# We only consider the region where the grid is positive for simplicity
@@ -485,8 +492,9 @@ Now for an example involving a Fourier transform.
485492
target_table = np.array([target_x, target_f]).T
486493
487494
3. We can now write a noise subtraction function that takes in our measured
488-
signal and guesses for parameters ``A,B``, and computes the Fourier
495+
signal and guesses for parameters ``A``, ``B``, and computes the Fourier
489496
transform post-noise-subtraction.
497+
490498
.. code-block:: python
491499
492500
def noise_subtracted_ft(x, y, A, B):
@@ -501,6 +509,7 @@ Now for an example involving a Fourier transform.
501509
502510
4. Finally, we can provide initial guesses of ``A=0`` and ``B=1`` to the
503511
``MorphFuncxy`` morph and see what refined values we get.
512+
504513
.. code-block:: python
505514
506515
from diffpy.morph.morphpy import morph_arrays
@@ -509,6 +518,7 @@ Now for an example involving a Fourier transform.
509518
510519
5. Print these values to see if they match with the true values of
511520
of ``A=2.0`` and ``B=1.7``!
521+
512522
.. code-block:: python
513523
514524
print(f"Refined A: {info["funcxy"]["A"]}")
@@ -519,7 +529,7 @@ You can also use this morph to help find optimal parameters
519529
PDFs of materials with known structures.
520530
One does this by setting the ``MorphFuncxy`` function to a PDF
521531
computing function such as
522-
```PDFgetx3`` <https://www.diffpy.org/products/pdfgetx.html>`_.
532+
`PDFgetx3 <https://www.diffpy.org/products/pdfgetx.html>`_.
523533
The input (morphed) 1D function should be the 1D diffraction data
524534
one wishes to compute the PDF of and the target 1D function
525535
can be the PDF of a target material with similar geometry.

0 commit comments

Comments
 (0)