GISANS comparison

We compare QuickNXS v1 to QuickNXS v2 for the same data sets and parameters.

The goal is not to be complete but to reproduce the output of QuickNXS v1 to replace it.

We divided the data in two wavelength bands.

We also show projections on both axes.


In [4]:
import os
import numpy as np
import scipy.stats
import plotly.offline as py
import plotly.graph_objs as go
py.init_notebook_mode(connected=True)

import warnings
warnings.filterwarnings('ignore', module='numpy')
warnings.filterwarnings('ignore')



In [2]:
import sys
sys.path.append("/SNS/users/m2d/git/reflectivity_ui/test/notebooks")
from plot_utils import plot1d, plot_heatmap



In [33]:
def load_data(file_path, ncols=3):
    offspec_data = np.loadtxt(file_path)

    unique_qy = np.unique(offspec_data.T[0])
    qybins = len(unique_qy)
    
    unique_qz = np.unique(offspec_data.T[1])
    qzbins = len(unique_qz)

    print("\n\nFile: %s" % file_path)
    print("Binning: %s %s [%s]" %(qybins, qzbins, qybins*qzbins))
    fd = open(file_path, 'r')
    first_list = fd.readlines()
    print(first_list[0]+first_list[1]+first_list[2])
    fd.close()
    
    off = np.reshape(offspec_data, (qybins, qzbins, ncols))

    qz = (off.T[1]).T[0]
    qy = (off.T[0])[0]
    #print "Qy [%s] %s - %s" % (len(qy), np.min(qy), np.max(qy))
    #print "Qz [%s] %s - %s" % (len(qz), np.min(qz), np.max(qz))

    quick_intensity = off.T[2].T
    
    scale = 1
    quick_intensity /= scale
    quick_intensity[quick_intensity<1.0e-9] = 1.0e-9

    return qy, qz, quick_intensity

Wavelength band: 3 - 5.5 A

Old QuickNXS v1 version


In [55]:
filepath = '/SNS/users/m2d/git/reflectivity_ui/test/comparison/v1/REF_M_30806+30807+30808_GISANS_3.000-5.500_Off_Off_set_1.dat'
qy, qz, off_spec_band1_v1 = load_data(filepath, ncols=4)

plot_heatmap(qy, qz, np.log(off_spec_band1_v1).T, x_title='Qy', y_title='Qz', surface=False,
                 x_log=False, y_log=False)



File: /SNS/users/m2d/git/reflectivity_ui/test/comparison/v1/REF_M_30806+30807+30808_GISANS_3.000-5.500_Off_Off_set_1.dat
Binning: 51 76 [3876]
# Datafile created by QuickNXS 1.1.6
# Date: 2019-01-09 13:30:14
# Type: GISANS_3.000-5.500

QuickNXS v2 output


In [56]:
filepath = '/SNS/users/m2d/git/reflectivity_ui/test/comparison/v2/REF_M_30806+30807+30808_GISANS_3.000-5.500_Off-Off_set_1.dat'
qy_v2, qz_v2, off_spec_band1_v2 = load_data(filepath, ncols=4)

plot_heatmap(qy_v2, qz_v2, np.log(off_spec_band1_v2).T, x_title='Qy', y_title='Qz', surface=False,
                 x_log=False, y_log=False)



File: /SNS/users/m2d/git/reflectivity_ui/test/comparison/v2/REF_M_30806+30807+30808_GISANS_3.000-5.500_Off-Off_set_1.dat
Binning: 51 76 [3876]
# Datafile created by QuickNXS 2.0.31
# Datafile created using Mantid 3.13.20190108.2020
# Date: 2019-01-09 14:31:00


In [58]:
cut_v1 = [qz, off_spec_band1_v1.sum(0)]
cut_v2 = [qz_v2, off_spec_band1_v2.sum(0)]

cut_y_v1 = [qy, off_spec_band1_v1.sum(1)]
cut_y_v2 = [qy_v2, off_spec_band1_v2.sum(1)]

plot1d([cut_v1,cut_v2, cut_y_v1, cut_y_v2],
       data_names=['qz v1', 'qz v2', 'qy v1', 'qy v2'], y_log=True, x_title='Q axis (see legend)', y_title='Total signal')


Wavelength band: 5.5 - 8.0 A

Old QuickNXS v1 version


In [60]:
filepath = '/SNS/users/m2d/git/reflectivity_ui/test/comparison/v1/REF_M_30806+30807+30808_GISANS_5.500-8.000_Off_Off_set_1.dat'

qy_band2_v1, qz_band2_v1, off_spec_band2_v1 = load_data(filepath, ncols=4)

plot_heatmap(qy_band2_v1, qz_band2_v1, np.log(off_spec_band2_v1).T, x_title='Qy', y_title='Qz', surface=False,
                 x_log=False, y_log=False)



File: /SNS/users/m2d/git/reflectivity_ui/test/comparison/v1/REF_M_30806+30807+30808_GISANS_5.500-8.000_Off_Off_set_1.dat
Binning: 51 76 [3876]
# Datafile created by QuickNXS 1.1.6
# Date: 2019-01-09 13:30:14
# Type: GISANS_5.500-8.000

QuickNXS v2 version


In [66]:
filepath = '/SNS/users/m2d/git/reflectivity_ui/test/comparison/v2/REF_M_30806+30807+30808_GISANS_5.500-8.000_Off-Off_set_1.dat'
qy_band2_v2, qz_band2_v2, off_spec_band2_v2 = load_data(filepath, ncols=4)

plot_heatmap(qy_band2_v2, qz_band2_v2, np.log(off_spec_band2_v2).T, x_title='Qy', y_title='Qz', surface=False,
                 x_log=False, y_log=False)



File: /SNS/users/m2d/git/reflectivity_ui/test/comparison/v2/REF_M_30806+30807+30808_GISANS_5.500-8.000_Off-Off_set_1.dat
Binning: 51 76 [3876]
# Datafile created by QuickNXS 2.0.31
# Datafile created using Mantid 3.13.20190108.2020
# Date: 2019-01-09 14:31:00


In [67]:
cut_v1 = [qz_band2_v1, off_spec_band2_v1.sum(0)]
cut_v2 = [qz_band2_v2, off_spec_band2_v1.sum(0)]

cut_y_v1 = [qy_band2_v1, off_spec_band2_v1.sum(1)]
cut_y_v2 = [qy_band2_v2, off_spec_band2_v1.sum(1)]

plot1d([cut_v1,cut_v2, cut_y_v1, cut_y_v2],
       data_names=['qz v1', 'qz v2', 'qy v1', 'qy v2'], y_log=True, x_title='Q axis (see legend)', y_title='Total signal')