Skip to content
Snippets Groups Projects
Commit fa9c1d44 authored by Carla Elena Gomez Alvarado's avatar Carla Elena Gomez Alvarado
Browse files

archivo subido desde JupyterHub

parent 388cfb77
No related branches found
No related tags found
No related merge requests found
%% Cell type:code id: tags:
``` python
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import io
from PIL import Image
import numpy as np
```
%% Cell type:code id: tags:
``` python
def plotting():
global x,y
y,x,bins = plt.hist(x=filter2[filter2<10000], bins=10)
plt.xlabel('Tiempo (ns)')
plt.ylabel('Frecuencia')
plt.title('Histograma'+i)
plt.savefig(i+'.png')
plt.close()
```
%% Cell type:code id: tags:
``` python
def globalPlot():
global x,y,plt
y,x,bins = plt.hist(x=filter2[filter2<10000], bins=10, alpha = 0.5)
print('Mean: ', x.mean())
plt.axvline(x.mean(), color='k', linestyle='dashed', linewidth=1)
```
%% Cell type:code id: tags:
``` python
files = ['18-11-12-14-25','18-11-13-13-20','18-11-16-11-23']
df = pd.DataFrame(index=files, columns=['si_decae','no_decae','x','y','corr'])
plt.xlabel('Tiempo (ns)')
plt.ylabel('Frecuencia')
plt.title('Histogramas')
plt.figure(figsize=(20,15))
plt.rcParams.update({'font.size': 22})
for i in files:
data = pd.read_table("/home/gomezc/ejercicios-clase-08-datos/data-used/"+i+".data",sep='\n', delimiter=' ', header=None, dtype=int,names =['decaimiento','time'])
print(i)
print('Mode',data.mode())
print()
print('Median',data.median())
print()
print('Mean',data.mean())
print()
filter1 = data[data['decaimiento']>40000]['decaimiento']
filter2 = data[data['decaimiento']<40000]['decaimiento']
No_decae = filter1.sum() - len(filter1)*40000 # Numero de muonoes que no decaen
Si_decae = len(filter2) # Numero de muonoes que decaen
df.loc[i,['si_decae','no_decae']] = [Si_decae,No_decae]
globalPlot()
df.loc[i,'x'] = x[1:]
df.loc[i,'y'] = y
df.loc[i,'corr'] = np.corrcoef(filter1[:len(filter1)-1],filter1[1:len(filter1)])[0][1]
```
%% Output
18-11-12-14-25
Mode decaimiento time
0 40003.0 1542119687
1 NaN 1542119703
2 NaN 1542119924
3 NaN 1542120430
4 NaN 1542120491
5 NaN 1542121481
6 NaN 1542122777
Median decaimiento 4.000300e+04
time 1.542090e+09
dtype: float64
Mean decaimiento 3.953147e+04
time 1.542090e+09
dtype: float64
Mean: 5010.0
18-11-13-13-20
Mode decaimiento time
0 40003 1542382904
Median decaimiento 4.000300e+04
time 1.542257e+09
dtype: float64
Mean decaimiento 3.973597e+04
time 1.542257e+09
dtype: float64
Mean: 4970.0
18-11-16-11-23
Mode decaimiento time
0 40002 1542384180
Median decaimiento 4.000300e+04
time 1.542420e+09
dtype: float64
Mean decaimiento 3.973363e+04
time 1.542420e+09
dtype: float64
Mean: 4930.0
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