Skip to content
Snippets Groups Projects
Commit f1c26c9d authored by Yessica Dominguez's avatar Yessica Dominguez
Browse files

Replace EspectroUranos.py

parent 2a7eb39c
No related branches found
No related tags found
No related merge requests found
# Este programa Grafica el espectro de energias de los neutrones
# generados durante una simulacion hecha en URANOS.
import pandas as pd import pandas as pd
import numpy as np import numpy as np
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
#Guardamos en un dataframe los datos
dlayer= pd.read_table('detectorLayer300000.dat') dlayer= pd.read_table('detectorLayer300000.dat')
df1 = dlayer[dlayer['Soil_contact'] == 1] # contacto con el suelo #los filtramos para identificar de donde provienen
df5 = df1[df1['previous_Depth_[m]'] > 0.0] # espero que vengan del suelo # las particulas
dfinal=pd.DataFrame()
dfback = df5[df5['z_[m]'] == -2.0] # espero que vengan del suelo (Back scattering)
dfin = dlayer.drop_duplicates(['Neutron_Number'], keep = 'first') # espero que sean solo los incoming df1 = dlayer[dlayer['Soil_contact'] == 1] #neutrones que tuvieron contacto con el suelo
df5 = df1[df1['previous_Depth_[m]'] > 0.0] # neutrones que rebotaron con suelo y volvieron a la superficie (Backscattering)
dfback = df5[df5['z_[m]'] == -2.0] # otro filtro para asegurarnos que son neutrones Backscattering
dfinal['E'] = pd.concat([dfin['Energy_at_Interface_[MeV]'], dfback['Energy_[MeV]']], axis = 0) #TOTAL dfin + dfback dfin = dlayer.drop_duplicates(['Neutron_Number'], keep = 'first') # Neutrones generados en la atmosfera(fuente de neutrones o Incoming)
dfinal=pd.DataFrame()
dfinal['E'] = pd.concat([dfin['Energy_at_Interface_[MeV]'], dfback['Energy_[MeV]']], axis = 0) #TOTAL dfin + dfback, es decir el espetro completo.
#LOG para todos #Creamos un dataframe para cada espectro (Backscattered, incoming y total) en escala logaritmica
dlayer = dfinal.assign(energy=np.log(dfinal['E'])) #azul (TOTAL) dlayer = dfinal.assign(energy=np.log(dfinal['E'])) #azul (TOTAL)
dback = dfback.assign(energy=np.log(dfback['Energy_[MeV]'])) # Green (Back Scattered) dback = dfback.assign(energy=np.log(dfback['Energy_[MeV]'])) # Green (Back Scattered)
din = dfin.assign(energy=np.log(dfin['Energy_at_Interface_[MeV]'])) # naranja (INCOMING) din = dfin.assign(energy=np.log(dfin['Energy_at_Interface_[MeV]'])) # naranja (INCOMING)
#############
#Contamos el total de particulas ('La Integral' de la curva del espectro de energias)
print(len(dfin.index)) print(len(dfin.index))
print(len(dfback.index)) print(len(dfback.index))
a = 780 a = 780
#Graficamos los histogramas del espectro de energias
dlayer['energy'].hist(bins=int(a*1.17),histtype='step',label='Total',linewidth=1) #azul dlayer['energy'].hist(bins=int(a*1.17),histtype='step',label='Total',linewidth=1) #azul
din['energy'].hist(bins=a,histtype='step', label = 'Incoming Spectrum',linewidth=1) #Naranja din['energy'].hist(bins=a,histtype='step', label = 'Incoming Spectrum',linewidth=1) #Naranja
dback['energy'].hist(bins=a, histtype='step', label = 'Backscattered Spectrum',linewidth=1) #verde dback['energy'].hist(bins=a, histtype='step', label = 'Backscattered Spectrum',linewidth=1) #verde
############################
#cambiamos las estiquetas del eje x (energias)
x = [-np.log(100000000),-np.log(1000000),-np.log(10000),-np.log(100),np.log(1),np.log(100)] x = [-np.log(100000000),-np.log(1000000),-np.log(10000),-np.log(100),np.log(1),np.log(100)]
val = ['1e-8','1e-6','1e-4','0.01','1','100'] val = ['1e-8','1e-6','1e-4','0.01','1','100']# los nuevos valores en MeV
#############################
plt.title('URANOS Neutron Spectra', loc='center') plt.title('URANOS Neutron Spectra', loc='center')
plt.xlabel('Energy(MeV)', size=13) plt.xlabel('Energy(MeV)', size=13)
plt.ylabel('Counts', size = 13) plt.ylabel('Counts', size = 13)
...@@ -39,7 +50,4 @@ plt.legend(loc='upper left') ...@@ -39,7 +50,4 @@ plt.legend(loc='upper left')
plt.show() plt.show()
#y = [500,1000,1500,2000,2500,3000]
#valy = ['0.5','1','1.5','2.0','2.5','3.0']
#plt.title('e+3', loc = 'left')
#plt.yticks(y,valy)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment