Skip to content

Commit

Permalink
Update error correction
Browse files Browse the repository at this point in the history
  • Loading branch information
kam17049 authored Nov 8, 2018
1 parent cff7f8b commit 96807ef
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions .gitignore/error correction
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ def segmentString(string, fill):
s1.append(s2)
return s1


def printFrames(frames):
frameN = 0
for frame in frames:
charN = 0
for bin in frame:
char = e.bin2char(bin)
print(f"{charN:2}", bin, char)
b = bin
b = [int(n) for n in b]
print(f"{charN:2}", b, char)
charN += 1
frameN += 1
print()
Expand Down Expand Up @@ -82,3 +83,27 @@ def appendParityToFrames(frames, parity):
newFrame = appendParityToFrame(frame, parity)
newFrames.append(newFrame)
return newFrames

def transmitFrames(frames, error):
noisyFrames = []
newFrames = []
for frame in frames:
for row in frame:
row = [int(n) for n in row]
(newFrame, bitsFlipped) = e.addNoise(row, error)
newFrames.append(newFrame)
noisyFrames.append(newFrames)
print('The number of bits flipped', bitsFlipped)
return noisyFrames

def splitFrame(frame):
payload = []
parityColumn = []
for row in frame[0:8]:
payload.append(row[0:8])
parityColumn.append(row[8:])
parityRow = frame[8:]
return payload, parityColumn, parityRow



0 comments on commit 96807ef

Please sign in to comment.