From 1ac7fb07ac0c5fb8b8732cc441e8aa085d543ffe Mon Sep 17 00:00:00 2001
From: Matteo Vallar <matteo.vallar@epfl.ch>
Date: Thu, 21 Oct 2021 15:07:27 +0200
Subject: [PATCH] Fixed new NB1,Nb2 names. Added reading of Nb2 with parameters
 to be verified

---
 matlab/TCV_IMAS/tcv_get_ids_nbi.m | 50 ++++++++++++++++++++-----------
 1 file changed, 32 insertions(+), 18 deletions(-)

diff --git a/matlab/TCV_IMAS/tcv_get_ids_nbi.m b/matlab/TCV_IMAS/tcv_get_ids_nbi.m
index 3542cfb7..45a1c1d0 100644
--- a/matlab/TCV_IMAS/tcv_get_ids_nbi.m
+++ b/matlab/TCV_IMAS/tcv_get_ids_nbi.m
@@ -23,45 +23,59 @@ ids_nbi_description='';
 %
 
 
-nb_units = 2; % assume 2 units: 1st NBH and DNBI
+nb_units = 3; % assume 2 units: 1st NBH and DNBI
 ids_nbi.unit(1:nb_units) = ids_nbi.unit(1); % copy empty structure for all units, then fill in
 
 % create lists of what is different for each units so that can scan through units
-unit_identifier = {'NBH1', 'DNBI'};
-unit_name = {'25keV 1st NBH source', 'diagnostic NBI'};
-results_subname = {'nbh', 'dnbi'};
-species.a = [2., 1.];
-species.z_n = [1., 1.];
-species.label = {'D', 'H'};
-beamlets_group.direction = [-1, 1];
-beamlets_group.tangency_radius = [736, 235.3]*1e-3;
-beamlets_group.angle = [0., 0.];
-beamlets_group.width_horizontal = [250, 87.2]*1e-3;
-beamlets_group.width_vertical = [250, 87.2]*1e-3;
+unit_identifier = {'NB1', 'NB2', 'DNBI'};
+unit_name = {'25keV 1st NBH source', '50keV 2nd NBH source', 'diagnostic NBI'};
+results_subname = {'nb1', 'nb2', 'dnbi'};
+if shot<70811
+  results_subname = {'nbh', 'nb2', 'dnbi'};
+end
+species.a = [2., 2., 1.];
+species.z_n = [1., 1., 1.];
+species.label = {'D', 'D','H'};
+beamlets_group.direction = [-1, 1, 1];
+beamlets_group.tangency_radius = [736, 736, 235.3]*1e-3;
+beamlets_group.angle = [0., 0., 0.];
+beamlets_group.width_horizontal = [250, 250, 87.2]*1e-3;
+beamlets_group.width_vertical = [250, 250, 87.2]*1e-3;
 
 beamlets_group.focus(1:nb_units)=struct('focal_length_horizontal',[],'focal_length_vertical',[],'width_min_horizontal',[],'width_min_vertical',[]);
 beamlets_group.focus(1).focal_length_horizontal = 3.76;
 beamlets_group.focus(1).focal_length_vertical = 3.98;
 beamlets_group.focus(1).width_min_horizontal = 21.6*1e-2;
 beamlets_group.focus(1).width_min_vertical = 9.4*1e-2;
-beamlets_group.focus(2).focal_length_horizontal = 1.8;
-beamlets_group.focus(2).focal_length_vertical = 1.8;
-beamlets_group.focus(2).width_min_horizontal = 12.1*1e-2;
-beamlets_group.focus(2).width_min_vertical = 12.1*1e-2;
+% So far NB2 parameters are merely a copy of NB1 parameters
+beamlets_group.focus(2).focal_length_horizontal = 3.76;
+beamlets_group.focus(2).focal_length_vertical = 3.98;
+beamlets_group.focus(2).width_min_horizontal = 21.6*1e-2;
+beamlets_group.focus(2).width_min_vertical = 9.4*1e-2;
+beamlets_group.focus(3).focal_length_horizontal = 1.8;
+beamlets_group.focus(3).focal_length_vertical = 1.8;
+beamlets_group.focus(3).width_min_horizontal = 12.1*1e-2;
+beamlets_group.focus(3).width_min_vertical = 12.1*1e-2;
 
 beamlets_group.divergence(1:nb_units) = struct('particle_fraction',[],'vertical',[],'horizontal',[]);
 beamlets_group.divergence(1).particle_fraction = 1.;
 beamlets_group.divergence(1).vertical = 0.59 *pi/180.;
 beamlets_group.divergence(1).horizontal = 1.4 *pi/180.;
 beamlets_group.divergence(2).particle_fraction = 1.;
-beamlets_group.divergence(2).vertical = 0.53 *pi/180.;
-beamlets_group.divergence(2).horizontal = 0.53 *pi/180.;
+beamlets_group.divergence(2).vertical = 0.59 *pi/180.;
+beamlets_group.divergence(2).horizontal = 1.4 *pi/180.;
+beamlets_group.divergence(3).particle_fraction = 1.;
+beamlets_group.divergence(3).vertical = 0.53 *pi/180.;
+beamlets_group.divergence(3).horizontal = 0.53 *pi/180.;
 
 %dcd_NBH = psitbxdcd(4.5889, 0.0, 211.9535*pi/180, 0.0, -9.2308*pi/180);
 beamlets_group.position(1:nb_units) = struct('phi',[],'r',[],'z',[]);
 beamlets_group.position(1).phi = 211.9535*pi/180.;
 beamlets_group.position(1).r = 4.5889;
 beamlets_group.position(1).z = 0.;
+beamlets_group.position(2).phi = 58.8255*pi/180.;
+beamlets_group.position(2).r = 4.5889;
+beamlets_group.position(2).z = 0.;
 beamlets_group.position(2).phi = 295.2416*pi/180.;
 beamlets_group.position(2).r = 4.9274;
 beamlets_group.position(2).z = 0.;
-- 
GitLab