jupyter notebook을 wiki에 게시하기
study python
Reference : https://jungsooyun.github.io/notebook/post-with-jupyter/
markdown test header1 A
markdown test header2 A
markdown test header2 B
In [1]:
import os
import numpy as np
import h5py
%matplotlib notebook
from matplotlib import pyplot as plt
In [2]:
print('hello ghpages')
print('Reference : https://jungsooyun.github.io/notebook/post-with-jupyter/')
hello ghpages
Reference : https://jungsooyun.github.io/notebook/post-with-jupyter/
In [3]:
def check_file_exists(file_path):
if os.path.exists(file_path) == False:
print("Error: provided file path '%s' does not exist!" % file_path)
return False
print("EXIST :", file_path)
return True
In [4]:
fpath = 'trace.h5'
if check_file_exists(fpath):
with h5py.File(fpath, 'r') as h5f:
print(list(h5f.keys()))
tr = h5f['trace'][:]
pt = h5f['plaintext'][:]
ct = h5f['ciphertext'][:]
key = h5f['key']
print(tr.shape, pt.shape, ct.shape, key.shape)
EXIST : trace.h5
['ciphertext', 'key', 'plaintext', 'trace']
(7000, 73300) (100000, 16) (100000, 16) (16,)
In [5]:
plt.plot(tr[0])
plt.show()
<IPython.core.display.Javascript object>