From 5a29865248d3580846582d5ab54c1c9ce3b83e71 Mon Sep 17 00:00:00 2001 From: AlQuemist <alquemist@Lyriks> Date: Mon, 19 Aug 2024 13:53:49 +0200 Subject: [PATCH] fx rawEx/fit/specular/Honeycomb_fit.py --- rawEx/fit/specular/Honeycomb_fit.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/rawEx/fit/specular/Honeycomb_fit.py b/rawEx/fit/specular/Honeycomb_fit.py index c9d542e1d91..598aadf8726 100755 --- a/rawEx/fit/specular/Honeycomb_fit.py +++ b/rawEx/fit/specular/Honeycomb_fit.py @@ -9,6 +9,7 @@ data without spin-flip for performance reasons. import bornagain as ba, numpy as np, os, matplotlib.pyplot as plt, scipy from bornagain import angstrom, sample_tools as st +from bornagain.numpyutil import Arrayf64Converter as dac datadir = os.getenv('BA_DATA_DIR', '') @@ -49,13 +50,13 @@ def get_sample(P, sign, T): l_Si = ba.Layer(material_Si) interlayer_model = ba.ErfInterlayer() - + rPyOx_autocorr = ba.K_CorrelationModel(P["rPyOx"]*angstrom) rPy2_autocorr = ba.K_CorrelationModel(P["rPy2"]*angstrom) rPy1_autocorr = ba.K_CorrelationModel(P["rPy1"]*angstrom) rSiO2_autocorr = ba.K_CorrelationModel(P["rSiO2"]*angstrom) rSi_autocorr = ba.K_CorrelationModel(P["rSi"]*angstrom) - + rPyOx = ba.LayerRoughness(rPyOx_autocorr, interlayer_model) rPy2 = ba.LayerRoughness(rPy2_autocorr, interlayer_model) rPy1 = ba.LayerRoughness(rPy1_autocorr, interlayer_model) @@ -87,7 +88,7 @@ def run_simulation(qaxis, P, *, sign, T): simulation = ba.SpecularSimulation(scan, sample) simulation.setBackground(ba.ConstantBackground(5e-7)) - return simulation.simulate().npArray() + return dac.npArray(simulation.simulate().dataArray()) #################################################################### # Experimental data @@ -113,9 +114,9 @@ def plot(q, rs, data, shifts, labels): for r, exp, shift, l in zip(rs, data, shifts, labels): - ax.errorbar(exp.npXcenters(), - exp.npArray()/shift, - yerr=exp.npErrors()/shift, + ax.errorbar(dac.npArray(exp.xCenters()), + dac.asNpArray(exp.dataArray()) / shift, + yerr=dac.asNpArray(exp.errors()) / shift, fmt='.', markersize=0.75, linewidth=0.5) @@ -230,8 +231,8 @@ if __name__ == '__main__': # Fit - qaxes = [d.npXcenters() for d in data] - rdata = [d.npArray() for d in data] + qaxes = [dac.npArray(d.xCenters()) for d in data] + rdata = [dac.asNpArray(d.dataArray()) for d in data] def par_dict(*args): return {name: value for name, value in zip(freeParNames, *args)} | fixedP -- GitLab