@@ -415,7 +415,8 @@ For this tutorial, we will go through two examples. One simple one
415415involving shifting a function in the ``x `` and ``y `` directions, and
416416another involving a Fourier transform.
417417
418- 1. Let's start by taking a simple ``sine `` function:
418+ 1. Let's start by taking a simple ``sine `` function.
419+
419420 .. code-block :: python
420421
421422 import numpy as np
@@ -424,7 +425,8 @@ another involving a Fourier transform.
424425 morph_table = np.array([morph_x, morph_y]).T
425426
426427 2. Then, let our target function be that same ``sine `` function shifted
427- to the right by ``0.3 `` and up by ``0.7 ``:
428+ to the right by ``0.3 `` and up by ``0.7 ``.
429+
428430 .. code-block :: python
429431
430432 target_x = morph_x + 0.3
@@ -435,20 +437,23 @@ another involving a Fourier transform.
435437 this would require us to refine over two separate morph
436438 operations. We can instead perform these morphs simultaneously
437439 by defining a function:
440+
438441 .. code-block :: python
439442
440443 def shift (x , y , hshift , vshift ):
441444 return x + hshift, y + vshift
442445
443446 4. Now, let's try finding the optimal shift parameters using the ``MorphFuncxy `` morph.
444- We can try an initial guess of ``hshift=0.0 `` and ``vshift=0.0 ``:
447+ We can try an initial guess of ``hshift=0.0 `` and ``vshift=0.0 ``.
448+
445449 .. code-block :: python
446450
447451 from diffpy.morph.morphpy import morph_arrays
448452 initial_guesses = {" hshift" : 0.0 , " vshift" : 0.0 }
449453 info, table = morph_arrays(morph_table, target_table, funcxy = (shift, initial_guesses))
450454
451- 5. Finally, to see the refined ``hshift `` and ``vshift `` parameters, we extract them from ``info ``:
455+ 5. Finally, to see the refined ``hshift `` and ``vshift `` parameters, we extract them from ``info ``.
456+
452457 .. code-block :: python
453458
454459 print (f " Refined hshift: { info[" funcxy" ][" hshift" ]} " )
@@ -458,8 +463,9 @@ Now for an example involving a Fourier transform.
458463
459464 1. Let's say you measured a signal of the form :math: `f(x)=\exp \{\cos (\pi x)\}`.
460465 Unfortunately, your measurement was taken against a noisy sinusoidal
461- background of the form :math: `n(x)=A\sin (Bx)`, where ``A, B `` are unknown.
466+ background of the form :math: `n(x)=A\sin (Bx)`, where ``A ``, `` B `` are unknown.
462467 For our example, let's say (unknown to us) that ``A=2 `` and ``B=1.7 ``.
468+
463469 .. code-block :: python
464470
465471 import numpy as np
@@ -478,6 +484,7 @@ Now for an example involving a Fourier transform.
478484
479485 2. Your colleague remembers they previously computed the Fourier transform
480486 of the function and has sent that to you.
487+
481488 .. code-block :: python
482489
483490 # We only consider the region where the grid is positive for simplicity
@@ -486,8 +493,9 @@ Now for an example involving a Fourier transform.
486493 target_table = np.array([target_x, target_f]).T
487494
488495 3. We can now write a noise subtraction function that takes in our measured
489- signal and guesses for parameters ``A, B ``, and computes the Fourier
496+ signal and guesses for parameters ``A ``, `` B ``, and computes the Fourier
490497 transform post-noise-subtraction.
498+
491499 .. code-block :: python
492500
493501 def noise_subtracted_ft (x , y , A , B ):
@@ -502,6 +510,7 @@ Now for an example involving a Fourier transform.
502510
503511 4. Finally, we can provide initial guesses of ``A=0 `` and ``B=1 `` to the
504512 ``MorphFuncxy `` morph and see what refined values we get.
513+
505514 .. code-block :: python
506515
507516 from diffpy.morph.morphpy import morph_arrays
@@ -510,6 +519,7 @@ Now for an example involving a Fourier transform.
510519
511520 5. Print these values to see if they match with the true values of
512521 of ``A=2.0 `` and ``B=1.7 ``!
522+
513523 .. code-block :: python
514524
515525 print (f " Refined A: { info[" funcxy" ][" A" ]} " )
@@ -520,7 +530,7 @@ You can also use this morph to help find optimal parameters
520530PDFs of materials with known structures.
521531One does this by setting the ``MorphFuncxy `` function to a PDF
522532computing function such as
523- `` ` PDFgetx3`` <https://www.diffpy.org/products/pdfgetx.html>`_.
533+ `PDFgetx3 <https://www.diffpy.org/products/pdfgetx.html >`_.
524534The input (morphed) 1D function should be the 1D diffraction data
525535one wishes to compute the PDF of and the target 1D function
526536can be the PDF of a target material with similar geometry.
0 commit comments