The tutorial 3rd

Contents

The tutorial 3rd#

Provides a tutorial on analyzing amorphous signals.

coding#

1. Save your diffraction data to the root directory and rename the file to intensity.csv.

# import PyXplore package
from PyXplore import WPEM
import pandas as pd
██╗    ██╗██████╗ ███████╗███╗   ███╗
██║    ██║██╔══██╗██╔════╝████╗ ████║
██║ █╗ ██║██████╔╝█████╗  ██╔████╔██║
██║███╗██║██╔═══╝ ██╔══╝  ██║╚██╔╝██║
╚███╔███╔╝██║     ███████╗██║ ╚═╝ ██║
 ╚══╝╚══╝ ╚═╝     ╚══════╝╚═╝     ╚═╝                                                  

A Diffraction Refinement Software : WPEM
Bin Cao, Advanced Materials Thrust, Hong Kong University of Science and Technology (Guangzhou)
URL : https://github.com/Bin-Cao/WPEM
Executed on : 2025-07-22 11:02:25  | Have a great day.
====================================================================================================

2. Parse your diffraction data (, intensity) and perform background processing.

intensity_csv = pd.read_csv(r'intensity.csv',header=None )
var = WPEM.BackgroundFit(intensity_csv,lowAngleRange=3.8,poly_n=12,bac_split=8,bac_num=100)
../../_images/198d89c1fe0df80d28e64e7923407a7eb6146420ede030df63e4b1aedb412ff3.png ../../_images/dbd9c98931627aa94f2069845881a0af95176ac30003dd4c430e879b7ca9568b.png ../../_images/a6584bddb6d21fbca1a7ebf77fa2722fae6ff7f8bb01397a52a7cb0d23d80ce6.png ../../_images/0b58998ae7da7745fd267485168fd0ece51a94fae597333c80783818f2e0a50c.png
================================
<Figure size 640x480 with 0 Axes>

3. After running the code, a new folder named ConvertedDocuments will be created in the root directory. This folder contains the background information.

Copy the two important files — bac.csv and no_bac_intensity.csv — from ConvertedDocuments into the root directory, as they are required for the next steps.

Parse the .cif file as demonstrated in the crystal fitting section, and generate the peak0.csv file.

# The wavelength is set according to the actual light source
wavelength = [1.03]
# The file name of non-background data (2theta-intensity data)
no_bac_intensity_file = "no_bac_intensity.csv" 
# The file name of raw/original data (2theta-intensity data)
original_file = "intensity.csv"  
# The file name of background data (2theta-intensity data)
bacground_file = "bac.csv"  


# Input the initial lattice constants {a, b, c, α, β, γ}, whose values need to be assumed at initialization.
Lattice_constants = [[17.53,17.53,6.47,90,90,120],]

# Execute the model

WPEM.XRDfit(
    wavelength, var, Lattice_constants,no_bac_intensity_file, original_file, bacground_file, 
    subset_number=3,low_bound=6,up_bound=16,bta = 0.78,iter_max = 50, asy_C = 0,InitializationEpoch=0, 
    )
Started at Tue Jul 22 11:02:30 2025 

Initialization
--------------------------------------------------------------------------------
Diffraction indexs have been obtained by WPEM


The input crystal system is: Hexagonal  |  The initial lattice constants : 17.53 17.53 6.47 90 90 120
—————————— Initilize the parameters by WPEM ——————————
Parameter initialization has been completed 
  0%|                                                    | 0/50 [00:00<?, ?it/s]
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
  2%|▉                                           | 1/50 [00:05<04:19,  5.29s/it]
WPEM 1-th iteration
[array([ 17.5303 ,  17.5303 ,   6.46268,  90.     ,  90.     , 120.     ])]
Rp:6.705 | Rwp:8.563 | Rsquare:2.703
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
  4%|█▊                                          | 2/50 [00:10<04:00,  5.00s/it]
WPEM 2-th iteration
[array([ 17.52878,  17.52878,   6.45665,  90.     ,  90.     , 120.     ])]
Rp:5.644 | Rwp:7.336 | Rsquare:1.867
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
  6%|██▋                                         | 3/50 [00:14<03:45,  4.81s/it]
WPEM 3-th iteration
[array([ 17.52798,  17.52798,   6.45154,  90.     ,  90.     , 120.     ])]
Rp:5.279 | Rwp:6.809 | Rsquare:1.619
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
  8%|███▌                                        | 4/50 [00:19<03:36,  4.72s/it]
WPEM 4-th iteration
[array([ 17.52969,  17.52969,   6.44637,  90.     ,  90.     , 120.     ])]
Rp:5.010 | Rwp:6.429 | Rsquare:1.455
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 10%|████▍                                       | 5/50 [00:23<03:30,  4.67s/it]
WPEM 5-th iteration
[array([ 17.53209,  17.53209,   6.44193,  90.     ,  90.     , 120.     ])]
Rp:4.769 | Rwp:6.121 | Rsquare:1.324
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 12%|█████▎                                      | 6/50 [00:28<03:24,  4.64s/it]
WPEM 6-th iteration
[array([ 17.53448,  17.53448,   6.43842,  90.     ,  90.     , 120.     ])]
Rp:4.553 | Rwp:5.868 | Rsquare:1.221
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 14%|██████▏                                     | 7/50 [00:32<03:17,  4.59s/it]
WPEM 7-th iteration
[array([ 17.53661,  17.53661,   6.43579,  90.     ,  90.     , 120.     ])]
Rp:4.375 | Rwp:5.656 | Rsquare:1.138
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 16%|███████                                     | 8/50 [00:37<03:11,  4.57s/it]
WPEM 8-th iteration
[array([ 17.53843,  17.53843,   6.43389,  90.     ,  90.     , 120.     ])]
Rp:4.227 | Rwp:5.475 | Rsquare:1.067
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 18%|███████▉                                    | 9/50 [00:41<03:07,  4.57s/it]
WPEM 9-th iteration
[array([ 17.53994,  17.53994,   6.43257,  90.     ,  90.     , 120.     ])]
Rp:4.103 | Rwp:5.316 | Rsquare:1.007
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 20%|████████▌                                  | 10/50 [00:46<03:01,  4.55s/it]
WPEM 10-th iteration
[array([ 17.54114,  17.54114,   6.43171,  90.     ,  90.     , 120.     ])]
Rp:3.993 | Rwp:5.173 | Rsquare:0.953
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 22%|█████████▍                                 | 11/50 [00:51<02:57,  4.55s/it]
WPEM 11-th iteration
[array([ 17.54207,  17.54207,   6.43121,  90.     ,  90.     , 120.     ])]
Rp:3.893 | Rwp:5.044 | Rsquare:0.905
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 24%|██████████▎                                | 12/50 [00:55<02:52,  4.53s/it]
WPEM 12-th iteration
[array([ 17.54274,  17.54274,   6.431  ,  90.     ,  90.     , 120.     ])]
Rp:3.800 | Rwp:4.926 | Rsquare:0.862
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 26%|███████████▏                               | 13/50 [01:00<02:47,  4.54s/it]
WPEM 13-th iteration
[array([ 17.54317,  17.54317,   6.43102,  90.     ,  90.     , 120.     ])]
Rp:3.715 | Rwp:4.817 | Rsquare:0.823
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 28%|████████████                               | 14/50 [01:04<02:42,  4.53s/it]
WPEM 14-th iteration
[array([ 17.54341,  17.54341,   6.43122,  90.     ,  90.     , 120.     ])]
Rp:3.638 | Rwp:4.716 | Rsquare:0.786
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 30%|████████████▉                              | 15/50 [01:09<02:40,  4.58s/it]
WPEM 15-th iteration
[array([ 17.54347,  17.54347,   6.43157,  90.     ,  90.     , 120.     ])]
Rp:3.567 | Rwp:4.621 | Rsquare:0.752
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 32%|█████████████▊                             | 16/50 [01:13<02:35,  4.57s/it]
WPEM 16-th iteration
[array([ 17.5434 ,  17.5434 ,   6.43203,  90.     ,  90.     , 120.     ])]
Rp:3.499 | Rwp:4.533 | Rsquare:0.721
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 34%|██████████████▌                            | 17/50 [01:18<02:33,  4.65s/it]
WPEM 17-th iteration
[array([ 17.54321,  17.54321,   6.43256,  90.     ,  90.     , 120.     ])]
Rp:3.434 | Rwp:4.451 | Rsquare:0.691
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 36%|███████████████▍                           | 18/50 [01:23<02:29,  4.66s/it]
WPEM 18-th iteration
[array([ 17.54295,  17.54295,   6.43315,  90.     ,  90.     , 120.     ])]
Rp:3.374 | Rwp:4.374 | Rsquare:0.663
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 38%|████████████████▎                          | 19/50 [01:27<02:23,  4.63s/it]
WPEM 19-th iteration
[array([ 17.54264,  17.54264,   6.43376,  90.     ,  90.     , 120.     ])]
Rp:3.318 | Rwp:4.302 | Rsquare:0.637
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 40%|█████████████████▏                         | 20/50 [01:32<02:19,  4.65s/it]
WPEM 20-th iteration
[array([ 17.5423 ,  17.5423 ,   6.43439,  90.     ,  90.     , 120.     ])]
Rp:3.265 | Rwp:4.235 | Rsquare:0.612
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 42%|██████████████████                         | 21/50 [01:37<02:13,  4.62s/it]
WPEM 21-th iteration
[array([ 17.54195,  17.54195,   6.435  ,  90.     ,  90.     , 120.     ])]
Rp:3.215 | Rwp:4.173 | Rsquare:0.589
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 44%|██████████████████▉                        | 22/50 [01:41<02:08,  4.59s/it]
WPEM 22-th iteration
[array([ 17.54161,  17.54161,   6.4356 ,  90.     ,  90.     , 120.     ])]
Rp:3.168 | Rwp:4.114 | Rsquare:0.568
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 46%|███████████████████▊                       | 23/50 [01:46<02:03,  4.59s/it]
WPEM 23-th iteration
[array([ 17.54128,  17.54128,   6.43617,  90.     ,  90.     , 120.     ])]
Rp:3.124 | Rwp:4.060 | Rsquare:0.548
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 48%|████████████████████▋                      | 24/50 [01:50<01:59,  4.58s/it]
WPEM 24-th iteration
[array([ 17.54098,  17.54098,   6.43672,  90.     ,  90.     , 120.     ])]
Rp:3.083 | Rwp:4.010 | Rsquare:0.529
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 50%|█████████████████████▌                     | 25/50 [01:55<01:54,  4.59s/it]
WPEM 25-th iteration
[array([ 17.5407 ,  17.5407 ,   6.43722,  90.     ,  90.     , 120.     ])]
Rp:3.044 | Rwp:3.963 | Rsquare:0.511
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 52%|██████████████████████▎                    | 26/50 [01:59<01:49,  4.56s/it]
WPEM 26-th iteration
[array([ 17.54045,  17.54045,   6.43769,  90.     ,  90.     , 120.     ])]
Rp:3.008 | Rwp:3.920 | Rsquare:0.495
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 54%|███████████████████████▏                   | 27/50 [02:04<01:45,  4.57s/it]
WPEM 27-th iteration
[array([ 17.54023,  17.54023,   6.43812,  90.     ,  90.     , 120.     ])]
Rp:2.974 | Rwp:3.880 | Rsquare:0.480
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 56%|████████████████████████                   | 28/50 [02:09<01:40,  4.55s/it]
WPEM 28-th iteration
[array([ 17.54003,  17.54003,   6.43852,  90.     ,  90.     , 120.     ])]
Rp:2.942 | Rwp:3.842 | Rsquare:0.466
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 58%|████████████████████████▉                  | 29/50 [02:13<01:36,  4.57s/it]
WPEM 29-th iteration
[array([ 17.53987,  17.53987,   6.43888,  90.     ,  90.     , 120.     ])]
Rp:2.912 | Rwp:3.808 | Rsquare:0.453
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 60%|█████████████████████████▊                 | 30/50 [02:18<01:31,  4.57s/it]
WPEM 30-th iteration
[array([ 17.53973,  17.53973,   6.43921,  90.     ,  90.     , 120.     ])]
Rp:2.885 | Rwp:3.775 | Rsquare:0.440
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 62%|██████████████████████████▋                | 31/50 [02:22<01:27,  4.59s/it]
WPEM 31-th iteration
[array([ 17.53961,  17.53961,   6.43951,  90.     ,  90.     , 120.     ])]
Rp:2.858 | Rwp:3.745 | Rsquare:0.429
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 64%|███████████████████████████▌               | 32/50 [02:27<01:22,  4.58s/it]
WPEM 32-th iteration
[array([ 17.53951,  17.53951,   6.43978,  90.     ,  90.     , 120.     ])]
Rp:2.834 | Rwp:3.717 | Rsquare:0.418
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 66%|████████████████████████████▍              | 33/50 [02:31<01:17,  4.57s/it]
WPEM 33-th iteration
[array([ 17.53942,  17.53942,   6.44003,  90.     ,  90.     , 120.     ])]
Rp:2.811 | Rwp:3.692 | Rsquare:0.408
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 68%|█████████████████████████████▏             | 34/50 [02:36<01:13,  4.57s/it]
WPEM 34-th iteration
[array([ 17.53936,  17.53936,   6.44025,  90.     ,  90.     , 120.     ])]
Rp:2.789 | Rwp:3.668 | Rsquare:0.399
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 70%|██████████████████████████████             | 35/50 [02:41<01:09,  4.64s/it]
WPEM 35-th iteration
[array([ 17.5393 ,  17.5393 ,   6.44045,  90.     ,  90.     , 120.     ])]
Rp:2.768 | Rwp:3.645 | Rsquare:0.390
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 72%|██████████████████████████████▉            | 36/50 [02:45<01:04,  4.61s/it]
WPEM 36-th iteration
[array([ 17.53926,  17.53926,   6.44064,  90.     ,  90.     , 120.     ])]
Rp:2.749 | Rwp:3.624 | Rsquare:0.382
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 74%|███████████████████████████████▊           | 37/50 [02:50<00:59,  4.61s/it]
WPEM 37-th iteration
[array([ 17.53922,  17.53922,   6.4408 ,  90.     ,  90.     , 120.     ])]
Rp:2.730 | Rwp:3.605 | Rsquare:0.375
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 76%|████████████████████████████████▋          | 38/50 [02:55<00:55,  4.62s/it]
WPEM 38-th iteration
[array([ 17.5392 ,  17.5392 ,   6.44095,  90.     ,  90.     , 120.     ])]
Rp:2.713 | Rwp:3.586 | Rsquare:0.368
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 78%|█████████████████████████████████▌         | 39/50 [02:59<00:50,  4.61s/it]
WPEM 39-th iteration
[array([ 17.53918,  17.53918,   6.44109,  90.     ,  90.     , 120.     ])]
Rp:2.696 | Rwp:3.569 | Rsquare:0.361
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 80%|██████████████████████████████████▍        | 40/50 [03:04<00:46,  4.64s/it]
WPEM 40-th iteration
[array([ 17.53917,  17.53917,   6.44122,  90.     ,  90.     , 120.     ])]
Rp:2.681 | Rwp:3.553 | Rsquare:0.355
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 82%|███████████████████████████████████▎       | 41/50 [03:09<00:41,  4.65s/it]
WPEM 41-th iteration
[array([ 17.53916,  17.53916,   6.44133,  90.     ,  90.     , 120.     ])]
Rp:2.666 | Rwp:3.538 | Rsquare:0.349
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 84%|████████████████████████████████████       | 42/50 [03:13<00:37,  4.65s/it]
WPEM 42-th iteration
[array([ 17.53915,  17.53915,   6.44143,  90.     ,  90.     , 120.     ])]
Rp:2.652 | Rwp:3.524 | Rsquare:0.344
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 86%|████████████████████████████████████▉      | 43/50 [03:18<00:32,  4.61s/it]
WPEM 43-th iteration
[array([ 17.53915,  17.53915,   6.44152,  90.     ,  90.     , 120.     ])]
Rp:2.638 | Rwp:3.511 | Rsquare:0.338
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 88%|█████████████████████████████████████▊     | 44/50 [03:22<00:27,  4.59s/it]
WPEM 44-th iteration
[array([ 17.53915,  17.53915,   6.44161,  90.     ,  90.     , 120.     ])]
Rp:2.626 | Rwp:3.499 | Rsquare:0.334
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 90%|██████████████████████████████████████▋    | 45/50 [03:27<00:22,  4.57s/it]
WPEM 45-th iteration
[array([ 17.53916,  17.53916,   6.44169,  90.     ,  90.     , 120.     ])]
Rp:2.613 | Rwp:3.487 | Rsquare:0.329
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 92%|███████████████████████████████████████▌   | 46/50 [03:31<00:18,  4.53s/it]
WPEM 46-th iteration
[array([ 17.53916,  17.53916,   6.44176,  90.     ,  90.     , 120.     ])]
Rp:2.602 | Rwp:3.476 | Rsquare:0.325
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 94%|████████████████████████████████████████▍  | 47/50 [03:36<00:13,  4.48s/it]
WPEM 47-th iteration
[array([ 17.53916,  17.53916,   6.44182,  90.     ,  90.     , 120.     ])]
Rp:2.590 | Rwp:3.466 | Rsquare:0.321
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 96%|█████████████████████████████████████████▎ | 48/50 [03:40<00:08,  4.47s/it]
WPEM 48-th iteration
[array([ 17.53917,  17.53917,   6.44188,  90.     ,  90.     , 120.     ])]
Rp:2.580 | Rwp:3.456 | Rsquare:0.317
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
 98%|██████████████████████████████████████████▏| 49/50 [03:44<00:04,  4.45s/it]
WPEM 49-th iteration
[array([ 17.53918,  17.53918,   6.44194,  90.     ,  90.     , 120.     ])]
Rp:2.570 | Rwp:3.447 | Rsquare:0.313
WARNING:tensorflow:From /Users/jacob/miniconda3/lib/python3.9/site-packages/tensorflow/python/util/deprecation.py:576: calling function (from tensorflow.python.eager.polymorphic_function.polymorphic_function) with experimental_relax_shapes is deprecated and will be removed in a future version.
Instructions for updating:
experimental_relax_shapes is deprecated, use reduce_retracing instead
100%|███████████████████████████████████████████| 50/50 [03:49<00:00,  4.42s/it]
100%|███████████████████████████████████████████| 50/50 [03:49<00:00,  4.59s/it]
WPEM 50-th iteration
[array([ 17.53918,  17.53918,   6.44198,  90.     ,  90.     , 120.     ])]
Rp:2.561 | Rwp:3.439 | Rsquare:0.310
After update the background :   Rp = 2.375 | Rwp = 3.429 | Rsquare = 0.296

../../_images/d0140e8788bf50ee84a5949d208a9c8f5738506a8d1fac12dc089967d739a6b6.png ../../_images/e9cf87a46b39dd7eacdbf48da1e434b299dd03916c167b0b3befb74334a06440.png ../../_images/07a15745c6aff3461fc516acad9ce399c4a64731d4a272a67ccafa84695c1b77.png
Mass fraction without structure factor estimate in % : [100.0] 
 Saved at the result documents
50-th iterations, reach the maximum number of iteration steps.
 Rp: 2.375
Rwp: 3.429 


WPEM program running time :  0 hours 3 minute  53 second  
('0 hours 3 minute  53 second  ',
 [array([ 17.53918,  17.53918,   6.44198,  90.     ,  90.     , 120.     ])])
<Figure size 640x480 with 0 Axes>

After coverage, the amorphous components (referred to as “holes”) are derived. You can visualize each amorphous hole using the provided plotting functions. The results are saved in the DecomposedComponents folder.

WPEM.Plot_Components(lowboundary = 4, upboundary = 19, wavelength = wavelength, Macromolecule = True,phase = 1)
../../_images/2cb49ef4b8b9a858a1a81b076fe09541932a4afc096dbc111d46a8d2a674837c.png
Relative bulk crystallinity % (calculated by integral area): 39.83147026233813 
 Saved at the WPEMFittingResults

See also

For demonstration purposes, the code uses iter_max = 5 to reduce computational cost. However, for practical applications, it is recommended to set iter_max to at least 50 for more reliable results.