y_data = calculator.fit_func(x_data)

plt.plot(x_data, y_data, label="CrysPy")
plt.show()

sample.parameters.wavelength = 2.5
y_data = calculator.fit_func(x_data)
plt.plot(x_data, y_data, label="CrysPy")
plt.show()

sample.phases[0].cell.length_a = 10
y_data = calculator.fit_func(x_data)
plt.plot(x_data, y_data, label="CrysPY")
plt.show()

calculator.switch('CrysFML')
params = sample.parameters
sample = Sample(phases=phase, parameters=params, interface=calculator)

sample.phases[0].cell.length_a = 9.0
sample.parameters.wavelength = 1.25
# print(S)
x_data = np.linspace(5, 150, 100)
y_data = calculator.fit_func(x_data)

plt.plot(x_data, y_data, label="CFL")
plt.show()

sample.parameters.wavelength = 2.5
y_data = calculator.fit_func(x_data)
plt.plot(x_data, y_data, label="CFL")
from easyDiffractionLib.interface import InterfaceFactory
from easyDiffractionLib.Profiles.P1D import Instrument1DCWParameters

import matplotlib.pyplot as plt


i = InterfaceFactory()

c = Phases.from_cif_file('tests/SrTiO3.cif')

S = Sample(phases=c, parameters=Instrument1DCWParameters.default(), interface=i)

x_data = np.linspace(5, 150, 10000)
y_data = i.fit_func(x_data)

i.switch('CrysPy')
S._updateInterface()

y_data2 = np.array(i.fit_func(x_data))

fig = plt.figure()
axprops = dict()
ax1 = fig.add_axes([0.1, 0.5, 0.8, 0.4], **axprops)
ax1.plot(x_data, y_data, label="CrysFML")
ax1.legend()
axprops['sharex'] = ax1
# axprops['sharey'] = ax1
# force x axes to remain in register, even with toolbar navigation
ax2 = fig.add_axes([0.1, 0.1, 0.8, 0.4], **axprops)
ax2.plot(x_data, y_data2, label="Cryspy")
ax2.legend()
Beispiel #3
0
from easyCore import np

from easyDiffractionLib.sample import Sample
from easyDiffractionLib import Site, Phases, Phase
from easyDiffractionLib.interface import InterfaceFactory as Calculator
from easyDiffractionLib.Profiles.P1D import Instrument1DCWParameters as CWParams
from easyDiffractionLib.Profiles.P1D import Instrument1DTOFParameters as TOFParams
from easyDiffractionLib.Profiles.P1D import Powder1DParameters

import matplotlib.pyplot as plt

calculator = Calculator()
calculator.switch('CrysPy')

atom = Site.from_pars(label="Cl1",
                      specie='Cl',
                      fract_x=0.1250,
                      fract_y=0.1670,
                      fract_z=0.1070)
atom.add_adp('Uiso', Uiso=0.0)

phase = Phase(name="p1")
phase.spacegroup.space_group_HM_name = "P 42/n c m"
phase.add_atom(atom)

phases = Phases()
phases.append(phase)

parameters = CWParams.default()
parameters.length_a = 8.56
parameters.length_c = 6.12