GenerateKernelFile125New.m 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. % Surendra Prajapati 2014
  2. % This code creates kernel provided the EGS output file --> "... .KeV"
  3. % and provided text files that provides fluence(spectrum of source), mu/rho and mu-en/rho
  4. close all;
  5. clear all;
  6. cd('E:\UW MADISON\Wisc Fall 2014\Kernels for 125keV and 250 keV\KERNEL_125_keV\keVoutput')
  7. rad= [0.01,0.03,0.05,0.08,0.11,0.15,0.2,0.3,0.4,0.6,0.8,1.1,1.5,2.0,3.0,4.0,6.0,8.0,10.0,15.0,20.0,30.0,45.0,60.0];
  8. ang = [3.75:3.75:180];
  9. energyarr = [5:5:125];
  10. Kernels.radii = rad;
  11. Kernels.angles = ang;
  12. Kernels.energies = energyarr/1000;
  13. for count = 1:length(energyarr)
  14. str = strcat(num2str(energyarr(count)),'keV_XCOM_HighRes.keV');
  15. %C(count) = texscan(str,'%f %f');
  16. [val stdev] = textread(str, '%f %f');
  17. Data(:,:,:,count) = reshape(val,5,24,48);
  18. end
  19. for count = 1:5
  20. k = Data(count,:,:,:);
  21. temp(:,:,:,count) = reshape(k,24,48,length(energyarr));
  22. end
  23. Kernels.primary = temp(:,:,:,1);
  24. Kernels.first_scatter = temp(:,:,:,2);
  25. Kernels.second_scatter = temp(:,:,:,3);
  26. Kernels.multiple_scatter = temp(:,:,:,4);
  27. Kernels.brem_annih = temp(:,:,:,5);
  28. Kernels.total = Kernels.primary + Kernels.first_scatter + Kernels.second_scatter + Kernels.multiple_scatter + Kernels.brem_annih;
  29. A = textread('125keVfluence.txt');
  30. B = textread('125keVmu_mu-en.txt');
  31. Kernels.fluence = A(:,2)';
  32. Kernels.mu = B(:,2)';
  33. Kernels.mu_en = B(:,3)';
  34. save Kernels.mat
  35. % for count = 1:5
  36. % k = test_data(count,:,:,:);
  37. % temp(:,:,:,count) = reshape(k,24,48,length(energyarr));
  38. % end