Convert old coordinate system used for DPSX (in partokyp.m for displaytt.m) in the new one used by DKE. Only useful for Tore Supra HXR diagnostic For other tokamak, use directly the correct system of coordinate. For Tore Supra use only INPUTS - day: calibration day (1-31) [1,1] - month: calibration month (1-12) [1,1] - year: calibration year (19** or 20**) [1,1] OUTPUTS - hxr: HXR diagnostic parameter structure by J. Decker (jodecker@alum.mit.edu) and Y. Peysson (yves.peysson@cea.fr)
0001 function [hxr] = bremTSconvert_dke_yp(day,month,year); 0002 % 0003 % Convert old coordinate system used for DPSX (in partokyp.m for displaytt.m) in the new one used by DKE. Only useful for Tore Supra HXR diagnostic 0004 % For other tokamak, use directly the correct system of coordinate. For 0005 % Tore Supra use only 0006 % 0007 % INPUTS 0008 % 0009 % - day: calibration day (1-31) [1,1] 0010 % - month: calibration month (1-12) [1,1] 0011 % - year: calibration year (19** or 20**) [1,1] 0012 % 0013 % OUTPUTS 0014 % 0015 % - hxr: HXR diagnostic parameter structure 0016 % 0017 % by J. Decker (jodecker@alum.mit.edu) and Y. Peysson (yves.peysson@cea.fr) 0018 % 0019 if nargin < 3, 0020 error('Not enough arguments in bremTSconvert_dke_yp') 0021 end 0022 % 0023 [tok,Rp,ap,epsip,hp,Rm,Ri,ai,fi,nv,nv0,tv,kv,mv,sd,r1,r2,lc,lf,lfp,EG,kdiag,ef,tf,ea,ta,ec,tc,td,res,lod,lad,ed,lpm,phf,kd,Gain,Offset,pur,chordstatus] = partok_dke_yp('TS',day,month,year); 0024 % 0025 R_TS = (Ri + ai*cos(tv*pi/180))/1000;% reference major radius (m) 0026 Z_TS = ai*sin(tv*pi/180)/1000;% reference vertical position (m) 0027 % 0028 L = [-4:1:4];%Chord length 0029 R = zeros(length(mv),length(L)); 0030 Z = zeros(length(mv),length(L)); 0031 % 0032 % Display Tore Supra chamber for chord arrangement 0033 % 0034 npoints = 1000; 0035 theta = [0:(npoints-1) 0] * 2 * pi / npoints; 0036 Rc = Ri/1000; 0037 Zc = 0; 0038 radius = ai/1000; 0039 RR = (radius * cos(theta) + Rc * ones(1,npoints+1)); 0040 ZZ = (radius * sin(theta) + Zc * ones(1,npoints+1)); 0041 figure(1), plot(RR,ZZ,'r-');hold on 0042 for chord = 1:length(mv), 0043 R(chord,:) = R_TS(chord) + L*cos(mv(chord)*pi/180); 0044 Z(chord,:) = Z_TS(chord) + L*sin(mv(chord)*pi/180); 0045 end 0046 plot(R',Z'), 0047 hold off 0048 axis('equal') 0049 xlabel('R(m)');ylabel('Z(m)') 0050 % 0051 % Build 0052 % 0053 hxr.R_hxr = R_TS;% reference major radius (m) 0054 hxr.Z_hxr = Z_TS;% reference vertical position (m) 0055 % 0056 hxr.alpha_hxr = -kv*pi/180;%horizontal angle (with respect to R) [-pi...pi]. The negative sign comes from the fact that kv is defined in a direct frame, while alpha_hxr corresponds to an indirect frame 0057 hxr.beta_hxr = pi/2 - mv*pi/180;%vertical angle (with respect to Z) [0...pi] 0058 % 0059 hxr.EG_hxr = EG*1e-6;%geometrical extend (m^2) [1,nchord] 0060 % 0061 hxr.kd_hxr = kd;% reference energies for the photofraction [m,p] 0062 % 0063 hxr.phf_hxr = phf;% photofraction determined using the "MCDET.f" Monte-carlo hard x-ray absorption code at energies kd [m,p] 0064 % 0065 hxr.res_hxr = res;%fit parameters of the energy resolution of the detectors [m,2] 0066 % 0067 hxr.ef_hxr = ef;% thickness of the vacuum window (mm) [1,m] 0068 % 0069 hxr.tf_hxr = tf;% type of material for the vacuum window (Al ou Be) [1,m] 0070 % 0071 hxr.ea_hxr = ea;%thickness of the absorber (mm) [1,m] 0072 % 0073 hxr.ta_hxr = ta;%type of material for the absorber (Al,Fe,Ge,Be ou Pb) [1,m] 0074 % 0075 hxr.ec_hxr = ec;%thickness of the detector shield (mm) [1,m] 0076 % 0077 hxr.tc_hxr = tc;%type of material for the detector shield (Al ou Be) [1,m] 0078 % 0079 hxr.ed_hxr = ed;%thickness of the detector (mm) [1,m] 0080 % 0081 hxr.td_hxr = td;%type of material for the detector (BGO,CsI,NaI,Ge or CdTe) [1,m] 0082 % 0083 hxr.kdiag_hxr = kdiag;%Measured photon energy spectrum (keV) [1,k] 0084 % 0085 hxr.kphot = [20:10:240];%Photon energy in keV 0086 % 0087 hxr.kmin = 50;% standard minimum value for Tph calculation (LH : 50; EC : 35) 0088 % 0089 hxr.kmax = 110;% standard maximum value for Tph calculation (LH : 110; EC : 75) 0090 0091 0092 function [xx,yy] = circle(x,y,radius,arg4) 0093 % CIRCLE : Plot a circle. 0094 % 0095 % circle(x, y, radius,'c') plots a circle with specified center and radius, 0096 % in color 'c' (optional). 0097 % [xx,yy] = circle(x, y, radius) returns coords instead of plotting; 0098 % in this case the optional fourth argument is # of points to use. 0099 % 0100 % If x, y, and radius are vectors then one circle is plotted for each element. 0101 % 0102 % John Gilbert, Xerox PARC, 1992. 0103 % Copyright (c) 1990-1996 by Xerox Corporation. All rights reserved. 0104 % HELP COPYRIGHT for complete copyright and licensing notice. 0105 0106 c = 'r-'; 0107 npoints = 100; 0108 if nargin >= 4 0109 if nargout < 1 0110 c = arg4; 0111 else 0112 npoints = arg4; 0113 end 0114 end 0115 0116 % Make the arguments column vectors 0117 x = x(:); 0118 y = y(:); 0119 radius = radius(:); 0120 0121 theta = [0:(npoints-1) 0] * 2 * pi / npoints; 0122 xx = radius * cos(theta) + x * ones(1,npoints+1); 0123 yy = radius * sin(theta) + y * ones(1,npoints+1); 0124 xx = xx'; 0125 yy = yy'; 0126 0127 if nargout < 1 0128 plot(xx,yy,c) 0129 end 0130