If you are using GitLab outside of the ILL, then you will need to use HTTPS and not SSH for clone/push/pull operations. SSH will work normally if you are using the VPN.

Commit a85ed0d1 authored by Tobias WEBER's avatar Tobias WEBER

ta phonon convo demo

parent fd4c1a2f
<?xml version="1.0" encoding="utf-8"?>
<taz>
<meta>
<comment/>
<info>Created with Takin/Reso.</info>
<timestamp>1574407722.900769</timestamp>
<user>tw</user>
<version>1.6.5</version>
</meta>
<reso>
<E>0</E>
<Q>1.06667</Q>
<algo>3</algo>
<ana_d>3.355000e+00</ana_d>
<ana_effic>1.000000e+00</ana_effic>
<ana_effic_file/>
<ana_mosaic>3.000000e+01</ana_mosaic>
<ana_scatter_sense>0</ana_scatter_sense>
<eck_ana_mosaic_v>3.000000e+01</eck_ana_mosaic_v>
<eck_mono_mosaic_v>3.000000e+01</eck_mono_mosaic_v>
<eck_sample_pos_x>0.000000e+00</eck_sample_pos_x>
<eck_sample_pos_y>0.000000e+00</eck_sample_pos_y>
<eck_sample_pos_z>0.000000e+00</eck_sample_pos_z>
<h_coll_after_sample>9.999000e+03</h_coll_after_sample>
<h_coll_ana>9.999000e+03</h_coll_ana>
<h_coll_before_sample>9.999000e+03</h_coll_before_sample>
<h_coll_mono>9.999000e+03</h_coll_mono>
<kf>1.13333</kf>
<ki>1.13333</ki>
<mc_live_neutrons>0</mc_live_neutrons>
<mc_live_sample_neutrons>1</mc_live_sample_neutrons>
<mono_d>3.355000e+00</mono_d>
<mono_mosaic>3.000000e+01</mono_mosaic>
<mono_refl>1.000000e+00</mono_refl>
<mono_refl_file/>
<mono_scatter_sense>0</mono_scatter_sense>
<pop_ana_curvh>0.000000e+00</pop_ana_curvh>
<pop_ana_curvv>1.400000e+02</pop_ana_curvv>
<pop_ana_h>2.500000e+01</pop_ana_h>
<pop_ana_thick>4.000000e-01</pop_ana_thick>
<pop_ana_use_curvh>0</pop_ana_use_curvh>
<pop_ana_use_curvv>1</pop_ana_use_curvv>
<pop_ana_w>2.500000e+01</pop_ana_w>
<pop_det_h>5.000000e+00</pop_det_h>
<pop_det_rect>1</pop_det_rect>
<pop_det_w>1.500000e+00</pop_det_w>
<pop_dist_ana_det>6.400000e+01</pop_dist_ana_det>
<pop_dist_mono_sample>1.000000e+02</pop_dist_mono_sample>
<pop_dist_sample_ana>1.000000e+02</pop_dist_sample_ana>
<pop_dist_src_mono>1.000000e+02</pop_dist_src_mono>
<pop_guide_divh>1.500000e+01</pop_guide_divh>
<pop_guide_divv>1.500000e+01</pop_guide_divv>
<pop_mono_curvh>0.000000e+00</pop_mono_curvh>
<pop_mono_curvv>1.400000e+02</pop_mono_curvv>
<pop_mono_h>2.500000e+01</pop_mono_h>
<pop_mono_thick>4.000000e-01</pop_mono_thick>
<pop_mono_use_curvh>0</pop_mono_use_curvh>
<pop_mono_use_curvv>1</pop_mono_use_curvv>
<pop_mono_w>2.500000e+01</pop_mono_w>
<pop_sampe_wperpq>1.000000e+00</pop_sampe_wperpq>
<pop_sample_cuboid>0</pop_sample_cuboid>
<pop_sample_h>3.000000e+00</pop_sample_h>
<pop_sample_wq>1.000000e+00</pop_sample_wq>
<pop_source_rect>1</pop_source_rect>
<pop_src_h>3.000000e+00</pop_src_h>
<pop_src_w>3.000000e+00</pop_src_w>
<sample_mosaic>5.000000e+00</sample_mosaic>
<sample_scatter_sense>1</sample_scatter_sense>
<use_R0>1</use_R0>
<use_general_R0>0</use_general_R0>
<use_guide>0</use_guide>
<use_kf3>0</use_kf3>
<use_kfki>0</use_kfki>
<use_ki3>0</use_ki3>
<v_coll_after_sample>9.999000e+03</v_coll_after_sample>
<v_coll_ana>9.999000e+03</v_coll_ana>
<v_coll_before_sample>9.999000e+03</v_coll_before_sample>
<v_coll_mono>9.999000e+03</v_coll_mono>
</reso>
</taz>
<?xml version="1.0" encoding="utf-8"?>
<taz>
<convofit>
<counter/>
<field_override/>
<flip_coords>1</flip_coords>
<max_calls>250</max_calls>
<minimiser>0</minimiser>
<monitor/>
<normalise>1</normalise>
<recycle_neutrons>1</recycle_neutrons>
<scanaxis>4</scanaxis>
<scanaxis2>0</scanaxis2>
<strategy>1</strategy>
<temp_override/>
<tolerance>2.500000e+01</tolerance>
</convofit>
<meta>
<info>Created with Takin/Monteconvo.</info>
<timestamp>1574407799.015072</timestamp>
<user>tw</user>
<version>1.6.5</version>
</meta>
<monteconvo>
<E_from>-9.804000e-01</E_from>
<E_to>8.094300e+00</E_to>
<E_to_2>-3.000000e-01</E_to_2>
<S_offs>0</S_offs>
<S_scale>7e4</S_scale>
<S_slope>0</S_slope>
<algo>1</algo>
<ana_foc>1</ana_foc>
<crys/>
<fixedk>1</fixedk>
<h_from>4.200300e+00</h_from>
<h_to>4.198700e+00</h_to>
<h_to_2>9.300000e-01</h_to_2>
<has_scanfile>1</has_scanfile>
<instr>instr.taz</instr>
<k_from>3.798700e+00</k_from>
<k_to>3.798300e+00</k_to>
<k_to_2>1.070000e+00</k_to_2>
<kfix>2.662000e+00</kfix>
<l_from>0.000000e+00</l_from>
<l_to>0.000000e+00</l_to>
<l_to_2>0.000000e+00</l_to_2>
<mono_foc>1</mono_foc>
<neutron_count>5000</neutron_count>
<sample_step_count>1</sample_step_count>
<scan_2d>0</scan_2d>
<scanfile>test.dat</scanfile>
<sqw>phonon_single</sqw>
<sqw_conf/>
<sqw_errors>
<E_HWHM>0</E_HWHM>
<G>0</G>
<amp>0</amp>
<inc_amp>0</inc_amp>
<inc_sig>0</inc_sig>
</sqw_errors>
<sqw_fitvar>
<E_HWHM>0</E_HWHM>
<G>0</G>
<amp>0</amp>
<inc_amp>0</inc_amp>
<inc_sig>0</inc_sig>
</sqw_fitvar>
<sqw_params>
<E_HWHM>0.4</E_HWHM>
<G>4 4 0 </G>
<S0>1</S0>
<T>100</T>
<amp>11.9</amp>
<freq>1.570796326794897</freq>
<inc_amp>0.6</inc_amp>
<inc_sig>0.01</inc_sig>
</sqw_params>
<step_count>128</step_count>
</monteconvo>
</taz>
<?xml version="1.0" encoding="utf-8"?>
<taz>
<convofit>
<counter/>
<field_override/>
<flip_coords>1</flip_coords>
<max_calls>250</max_calls>
<minimiser>0</minimiser>
<monitor/>
<normalise>1</normalise>
<recycle_neutrons>1</recycle_neutrons>
<scanaxis>4</scanaxis>
<scanaxis2>0</scanaxis2>
<strategy>1</strategy>
<temp_override/>
<tolerance>2.500000e+01</tolerance>
</convofit>
<meta>
<info>Created with Takin/Monteconvo.</info>
<timestamp>1574410715.067371</timestamp>
<user>ubuntu</user>
<version>1.6.5</version>
</meta>
<monteconvo>
<E_from>-9.804000e-01</E_from>
<E_to>8.094300e+00</E_to>
<E_to_2>-3.000000e-01</E_to_2>
<S_offs>0</S_offs>
<S_scale>7e4</S_scale>
<S_slope>0</S_slope>
<algo>1</algo>
<ana_foc>1</ana_foc>
<crys/>
<fixedk>1</fixedk>
<h_from>4.200300e+00</h_from>
<h_to>4.198700e+00</h_to>
<h_to_2>9.300000e-01</h_to_2>
<has_scanfile>1</has_scanfile>
<instr>instr.taz</instr>
<k_from>3.798700e+00</k_from>
<k_to>3.798300e+00</k_to>
<k_to_2>1.070000e+00</k_to_2>
<kfix>2.660780e+00</kfix>
<l_from>0.000000e+00</l_from>
<l_to>0.000000e+00</l_to>
<l_to_2>0.000000e+00</l_to_2>
<mono_foc>1</mono_foc>
<neutron_count>1000</neutron_count>
<sample_step_count>1</sample_step_count>
<scan_2d>0</scan_2d>
<scanfile>test.dat</scanfile>
<sqw>py</sqw>
<sqw_conf>sqw_phonon.py</sqw_conf>
<sqw_errors>
<g_G>0</g_G>
<g_HWHM>0</g_HWHM>
<g_S0>0</g_S0>
<g_T>0</g_T>
<g_amp>0</g_amp>
<g_bose_cut>0</g_bose_cut>
<g_freq>0</g_freq>
<g_inc_amp>0</g_inc_amp>
<g_inc_sig>0</g_inc_sig>
<g_offs>0</g_offs>
</sqw_errors>
<sqw_fitvar>
<g_G>0</g_G>
<g_HWHM>0</g_HWHM>
<g_S0>0</g_S0>
<g_T>0</g_T>
<g_amp>0</g_amp>
<g_bose_cut>0</g_bose_cut>
<g_freq>0</g_freq>
<g_inc_amp>0</g_inc_amp>
<g_inc_sig>0</g_inc_sig>
<g_offs>0</g_offs>
</sqw_fitvar>
<sqw_params>
<g_G>array([ 4., 4., 0.])</g_G>
<g_HWHM>0.4</g_HWHM>
<g_S0>1.0</g_S0>
<g_T>100</g_T>
<g_amp>11.9</g_amp>
<g_bose_cut>0.01</g_bose_cut>
<g_freq>1.5707963267948966</g_freq>
<g_inc_amp>0.6</g_inc_amp>
<g_inc_sig>0.01</g_inc_sig>
<g_offs>0.0</g_offs>
</sqw_params>
<step_count>128</step_count>
</monteconvo>
</taz>
#
# Sample Python S(q,w) module for simple acoustic phonons
#
# @author Tobias Weber <tweber@ill.fr>
# @license GPLv2
# @date nov-2019
#
import math as m
import numpy as np
import numpy.linalg as la
from numpy import array # in global namespace so that Takin can access it
import scipy as sp
import scipy.constants as const
# -----------------------------------------------------------------------------
# dispersion
# -----------------------------------------------------------------------------
# kB in meV/K
kB = const.k / const.e * 1e3
# dispersion relations
def disp_phonon(q, amp, freq, offs):
return np.abs(amp*np.sin(freq*q)) + offs
# Bose factor
def bose(E, T):
n = 1./(m.exp(abs(E)/(kB*T)) - 1.)
if E >= 0.:
n += 1.
return n
# Bose factor which is cut off below Ecut
def bose_cutoff(E, T, Ecut=0.02):
Ecut = abs(Ecut)
if abs(E) < Ecut:
b = bose(np.sign(E)*Ecut, T)
else:
b = bose(E, T)
return b
# Gaussian peak
def gauss(x, x0, sig, amp):
norm = (np.sqrt(2.*m.pi) * sig)
return amp * np.exp(-0.5*((x-x0)/sig)**2.) / norm
#
# peak shape of a damped harmonic oscillator
# see: B. Fak, B. Dorner, Physica B 234-236 (1997) pp. 1107-1108
#
def DHO(E, T, E0, hwhm, amp):
return np.abs(bose(E, T)*amp/(E0*np.pi) *
(hwhm/((E-E0)**2. + hwhm**2.) - hwhm/((E+E0)**2. + hwhm**2.)))
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# Takin interface
# -----------------------------------------------------------------------------
# global variables which can be accessed / changed by Takin
g_G = np.array([4., 4., 0.]) # Bragg peak
g_amp = 20. # amplitude of sinusoidal dispersion
g_freq = np.pi/2. # frequency of sinusoidal dispersion
g_offs = 0. # energy gap
g_HWHM = 0.02 # linewidth
g_S0 = 1. # intensity
g_inc_sig = 0.02 # incoherent width
g_inc_amp = 1. # incoherent intensity
g_T = 300. # temperature
g_bose_cut = 0.02 # cutoff energy for Bose factor
#
# the init function is called after Takin has changed a global variable (optional)
#
def TakinInit():
print("Init: G=" + repr(g_G) + ", T=" + repr(g_T))
#
# dispersion E(Q) and weight factor (optional)
#
def TakinDisp(h, k, l):
E_peak = 0. # energy
w_peak = 1. # weight
try:
Q = np.array([h,k,l])
q = la.norm(Q - g_G)
E_peak = disp_phonon(q, g_amp, g_freq, g_offs)
except ZeroDivisionError:
return [0., 0.]
return [[E_peak, -E_peak], [w_peak, w_peak]]
#
# S(Q,E) function, called for every Monte-Carlo point
#
def TakinSqw(h, k, l, E):
try:
# print("h={0}, k={1}, l={2}, E={3}".format(h,k,l,E))
[Ep_peak, Em_peak], [wp_peak, wm_peak] = TakinDisp(h,k,l)
# S_p = DHO(E, g_T, Ep_peak, g_HWHM, g_S0*wp_peak)
# S_m = DHO(E, g_T, Em_peak, g_HWHM, g_S0*wm_peak)
#
# S = (S_p + S_m)*bose_cutoff(E, g_T, g_bose_cut) + incoh
S = np.abs(DHO(E, g_T, Ep_peak, g_HWHM, g_S0*wp_peak))
incoh = gauss(E, 0., g_inc_sig, g_inc_amp)
S = S + incoh
# print("S={0}".format(S))
return S
except ZeroDivisionError:
return 0.
# -----------------------------------------------------------------------------
import os
print("Script working directory: " + os.getcwd())
# test
#print(TakinSqw(4.1, 3.9, 0., 0.4))
RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
109943 2 0
ILL TAS data in the new ASCII format follow after the line VV..V
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
80
IN3 tweber 10-Oct-19 18:01:55
VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
INSTR: IN3
USER_: tweber
LOCAL: tweber
FILE_: 109943
DATE_: 10-Oct-19 18:01:55
TITLE: Internal use
TYPE_: tas
COMND: bs qh 4.2 3.8 0 -1 dqh 0 0 0 0.35 np 27 mn 4000
POSQE: QH= 4.2003, QK= 3.7987, QL= 0.0000, EN= -0.9804, UN=meV
CURVE: MONO= auto, ANA= manu
STEPS: EN= 0.3500
PARAM: GONIO= 0
PARAM: DM= 3.35500, DA= 3.35500, KFIX= 2.66078
PARAM: SM= -1, SS= -1, SA= 1, FX= 2
PARAM: ALF1= 600.00, ALF2= 40.00, ALF3= 40.00, ALF4= 600.00
PARAM: BET1= 600.00, BET2= 600.00, BET3= 600.00, BET4= 600.00
PARAM: ETAM= 35.00, ETAA= 35.00
PARAM: AS= 8.37100, BS= 8.37100, CS= 8.37100
PARAM: AA= 90.00000, BB= 90.00000, CC= 90.00000, ETAS= 30.00000
PARAM: AX= 1.000, AY= 0.000, AZ= 0.000
PARAM: BX= 0.000, BY= 1.000, BZ= 0.000
VARIA: I1 = 0.00, I2 = 0.00, I3 = 0.00, I4 = 0.00
VARIA: A1 = -21.36, A2 = -42.73, A3 =-185.76, A4 =-108.69
VARIA: A5 = 20.61, A6 = 41.21, RM = 5.91, GM = 64.02
VARIA: TM = 6.94, RAV = 2.00, RAH = 8.86, GU = -0.27
VARIA: GL = 3.03, TU = -26.66, TL = -22.48
VARIA: A3P =-1941960.25, D1T = 18.75, D1B = 8.75
VARIA: D1R = 9.56, D1L = 4.62, D2T = 23.12, D2B = 8.75
VARIA: D2R = 11.98, D2L = 1.65
ZEROS: A1 = 1.77, A2 = 2.87, A3 =-297.03, A4 = 0.52
ZEROS: A5 = -1.57, A6 = 0.20, RM = 0.00, GM = 0.00
ZEROS: TM = 0.00, RAV = 0.00, RAH = 0.00, GU = 0.00
ZEROS: GL = 0.00, TU = 0.00, TL = 0.00, A3P = 0.00
ZEROS: D1T = 0.00, D1B = 0.00, D1R = 0.00, D1L = 0.00
ZEROS: D2T = 0.00, D2B = 0.00, D2R = 0.00, D2L = 0.00
PARAM: MN= 4000
PARAM: TT= 99.41, RT= 100.00
PARAM: REACTOR=55.35
FORMT:
DATA_:
PNT QH QK QL EN M1 M2 TIME CNTS TT A1 A2 A3 A4 A5 A6
1 4.2003 3.7987 0.0000 -0.9804 4000 0 31.56 51 99.413 -21.360 -42.730 -185.760 -108.690 20.610 41.210
2 4.1993 3.7983 0.0000 -0.6442 4000 0 31.57 144 99.419 -21.100 -42.190 -185.520 -107.720 20.610 41.210
3 4.1990 3.7983 0.0000 -0.2949 4000 0 31.63 141 99.413 -20.830 -41.650 -185.300 -106.770 20.610 41.210
4 4.1993 3.7983 0.0000 0.0546 4000 0 32.42 139 99.410 -20.560 -41.130 -185.100 -105.860 20.610 41.210
5 4.1988 3.7981 0.0000 0.4035 4000 0 33.95 103 99.405 -20.320 -40.630 -184.910 -104.960 20.610 41.210
6 4.2001 3.7980 0.0000 0.7581 4000 0 35.59 68 99.473 -20.070 -40.140 -184.740 -104.110 20.610 41.210
7 4.1990 3.7985 0.0000 1.1030 4000 0 36.05 47 99.405 -19.840 -39.680 -184.590 -103.270 20.610 41.210
8 4.1991 3.7980 0.0000 1.4523 4000 0 35.50 17 99.407 -19.620 -39.230 -184.440 -102.450 20.610 41.210
9 4.2006 3.7982 0.0000 1.8138 4000 0 34.89 10 99.406 -19.400 -38.780 -184.310 -101.660 20.610 41.210
10 4.1991 3.7988 0.0000 2.1543 4000 0 34.33 13 99.406 -19.190 -38.370 -184.200 -100.890 20.610 41.210
11 4.2003 3.7980 0.0000 2.5059 4000 0 33.93 9 99.403 -18.980 -37.960 -184.080 -100.140 20.610 41.210
12 4.2003 3.7972 0.0000 2.8512 4000 0 33.53 6 99.401 -18.790 -37.570 -183.970 -99.400 20.610 41.210
13 4.2003 3.7980 0.0000 3.2073 4000 0 33.18 8 99.399 -18.600 -37.180 -183.890 -98.680 20.610 41.210
14 4.1997 3.7981 0.0000 3.5557 4000 0 33.01 8 99.398 -18.410 -36.810 -183.810 -97.970 20.610 41.210
15 4.1993 3.7990 0.0000 3.9050 4000 0 32.81 14 99.397 -18.230 -36.450 -183.750 -97.290 20.610 41.210
16 4.2016 3.7980 0.0000 4.2648 4000 0 32.85 30 99.401 -18.060 -36.090 -183.670 -96.620 20.610 41.210
17 4.2000 3.7978 0.0000 4.6041 4000 0 32.80 54 99.403 -17.880 -35.760 -183.610 -95.950 20.610 41.210
18 4.1990 3.7986 0.0000 4.9531 4000 0 32.82 69 99.402 -17.720 -35.430 -183.570 -95.300 20.610 41.210
19 4.2013 3.7975 0.0000 5.3119 4000 0 32.71 64 99.397 -17.560 -35.100 -183.510 -94.670 20.610 41.210
20 4.1987 3.7987 0.0000 5.6470 4000 0 32.61 41 99.399 -17.400 -34.800 -183.490 -94.050 20.610 41.210
21 4.2006 3.7974 0.0000 6.0025 4000 0 32.50 30 99.397 -17.250 -34.490 -183.440 -93.440 20.610 41.210
22 4.1992 3.7994 0.0000 6.3558 4000 0 32.30 27 99.396 -17.090 -34.190 -183.440 -92.840 20.610 41.210
23 4.2024 3.7973 0.0000 6.7185 4000 0 32.36 8 99.395 -16.960 -33.890 -183.390 -92.250 20.610 41.210
24 4.2017 3.7985 0.0000 7.0659 4000 0 32.59 8 99.389 -16.820 -33.610 -183.390 -91.680 20.610 41.210
25 4.1984 3.7992 0.0000 7.3963 4000 0 32.90 9 99.390 -16.680 -33.350 -183.390 -91.100 20.610 41.210
26 4.2015 3.7983 0.0000 7.7609 4000 0 33.38 2 99.399 -16.540 -33.070 -183.370 -90.550 20.610 41.210
27 4.1987 3.7983 0.0000 8.0943 4000 0 34.16 3 99.395 -16.410 -32.820 -183.370 -89.980 20.610 41.210
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment