From 8e5ec9966169bc6da03839e7b5915bba1c89678a Mon Sep 17 00:00:00 2001
From: AlQuemist <alquemist@Lyriks>
Date: Mon, 19 Aug 2024 13:54:49 +0200
Subject: [PATCH] fx rawEx/specular/PolarizedSpinAsymmetry.py

---
 rawEx/specular/PolarizedSpinAsymmetry.py | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/rawEx/specular/PolarizedSpinAsymmetry.py b/rawEx/specular/PolarizedSpinAsymmetry.py
index 5fcf9fca616..487d78cca4c 100755
--- a/rawEx/specular/PolarizedSpinAsymmetry.py
+++ b/rawEx/specular/PolarizedSpinAsymmetry.py
@@ -14,6 +14,8 @@ import numpy
 import matplotlib.pyplot as plt
 import bornagain as ba
 from bornagain import angstrom, ba_plot as bp, deg, R3
+from bornagain.numpyutil import Arrayf64Converter as dac
+
 
 # q-range on which the simulation and fitting are to be performed
 qmin = 0.05997
@@ -55,7 +57,7 @@ def get_sample(P):
 
     interlayer = ba.TanhInterlayer()
 
-    r_Mafo = ba.LayerRoughness(r_Mafo_autocorr, interlayer)   
+    r_Mafo = ba.LayerRoughness(r_Mafo_autocorr, interlayer)
     r_substrate = ba.LayerRoughness(r_sub_autocorr, interlayer)
 
     sample = ba.MultiLayer()
@@ -107,7 +109,7 @@ def qr(result):
     reflectivity from a given simulation result
     """
     q = numpy.array(result.axis(0).binCenters())
-    r = numpy.array(result.npArray())
+    r = dac.npArray(result.dataArray())
 
     return q, r
 
@@ -149,10 +151,10 @@ def plotSpinAsymmetry(data_pp, data_mm, q, r_pp, r_mm):
     Plot the simulated spin asymmetry as well its
     experimental counterpart with errorbars
     """
-    Yp = data_pp.npArray()
-    Ym = data_mm.npArray()
-    Ep = data_pp.npErrors()
-    Em = data_mm.npErrors()
+    Yp = dac.asNpArray(data_pp.dataArray())
+    Ym = dac.asNpArray(data_mm.dataArray())
+    Ep = dac.asNpArray(data_pp.errors())
+    Em = dac.asNpArray(data_mm.errors())
     # compute the errorbars of the spin asymmetry
     delta = numpy.sqrt(4 * (Yp**2 * Em**2 + Ym**2 * Ep**2 ) / ( Yp + Ym )**4 )
 
-- 
GitLab