epraya.Briggs#

Briggs(Hamer, Exp, Vary, expr, maximal=2000, eps=1e-11, mode='p')#

Fitting function for the experimental data using the ADAM Algorithm. Uses the Optax (part of the Deepmind proyect) ADAM algorithm implementation with a learning rate of 0.1. The parameters are changed and evaluated using a normalized sigmoid function in the range from the Vary container.

It’s recommended to use the function in VS code, Jupyter or Colab, because the process can be stop at any moment using the stop process button of the notebook.

Parameters:
  • Hamer (Class) – Container for the hamiltonian parameters.

  • Exp (Class) – Container for the experimental conditions.

  • Vary (Class) – Container for the range and parameters to vary.

  • exper (np.array) – Experimental spectrum data to fit.

  • maximal (int) – Max. number of iterations to evalue the function.

  • eps (float) – Tolerance value for the error. Default is 1e-11

  • mode (str) – Defines the sample type, ‘p’ for powder and ‘c’ for monocristal.

Returns:

espc (np.array) – Best adjusted spectrum.

Example

>>> import matplotlib.pyplot as plt
>>> import epraya as epr
>>> import numpy as np
>>> #epr.Sload('ZCr5600-300K.dat',4096,[2,3])
>>> B,spc=epr.Seek()
>>> Ham,Exp,Vary=epr.Jstart()
>>> Ham.S=3/2
>>> Ham.I=0
>>> Ham.Hpp=[0, 30.0]
>>> Exp.Freq=9.43
>>> Exp.Points=len(B)
>>> Exp.Frange=[B[0],B[-1]]
>>> Exp.Temperature = 300
>>> Ham.g=np.array([2.2,2,2])
>>> Ham.D=np.array([500,200])
>>> Vary.g=[1.5,2.5,1.5,2.5,1.5,2.5]
>>> Vary.D=[200,1000,0.5,1000]
>>> Vary.Hpp=[0.0, 100.0, 2.0, 100.0]
>>> de=epr.Briggs(Ham,Exp,Vary,spc,maximal=700,mode='p')
Step   1 | Error: 1.01390e-01 |
| gx: 2.1947 | gy: 1.9938 | gz: 1.9938 |
| D: 504.7 | E: 204.0 |
| Hppg: 0.0 | Hppl: 30.5 |
Step  11 | Error: 5.21379e-02 |
| gx: 2.1397 | gy: 1.9335 | gz: 1.9335 |
| D: 552.9 | E: 248.4 |
| Hppg: 0.0 | Hppl: 35.8 |
Step  21 | Error: 3.03045e-02 |
| gx: 2.0897 | gy: 1.8884 | gz: 1.8880 |
| D: 605.4 | E: 301.9 |
| Hppg: 0.0 | Hppl: 41.0 |
.
.
.
Step 101 | Error: 8.07586e-03 |
| gx: 2.1491 | gy: 1.9043 | gz: 1.8446 |
| D: 816.8 | E: 576.9 |
| Hppg: 0.0 | Hppl: 59.1 |
Step 111 | Error: 7.54648e-03 |
| gx: 2.1452 | gy: 1.9161 | gz: 1.8336 |
| D: 818.1 | E: 586.4 |
| Hppg: 0.0 | Hppl: 60.1 |
Step 121 | Error: 6.97381e-03 |
| gx: 2.1429 | gy: 1.9301 | gz: 1.8228 |
| D: 819.6 | E: 597.9 |
| Hppg: 0.0 | Hppl: 60.8 |
Step 131 | Error: 6.41336e-03 |
| gx: 2.1424 | gy: 1.9453 | gz: 1.8139 |
| D: 821.3 | E: 611.3 |
| Hppg: 0.0 | Hppl: 61.3 |

Process stopped at iteration:140

Step 141 | Error: 5.93200e-03 | | gx: 2.1404 | gy: 1.9589 | gz: 1.8065 | | D: 822.2 | E: 628.8 | | Hppg: 0.0 | Hppl: 61.6 |

Plot of the briggs function