-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests.py
More file actions
65 lines (55 loc) · 2.56 KB
/
Copy pathtests.py
File metadata and controls
65 lines (55 loc) · 2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#from dec.rs_prime_decoder import RSPrimeDecoder
from common.rs_trial import RSTrial
from common.prime_field import prime_field
from enc.encoder import Encoder
from common.channel import Channel
from dec.decoder import Decoder
import copy
#from dec.decoder import Decoder
def next_move(word):
print("\t\t|")
print("\t\tV")
print("--------------------------------------------------------------------------------------------------------------------------------------")
input("|\t\t"+word)
def report_welcome(rs_trial):
print("___________________________________\nWELCOME TO A LITTLE DEMO!","\nOur initial setup is\n"+"---------------------------------------------\n"+
"message is: ",rs_trial.message,"\n"+
"locators: ",rs_trial.locators,"\n"+
"multipliers: ",rs_trial.multipliers,"\n---------------------------------------------\n")
def report_after_encoding(rs_trial):
print("|codeword:",rs_trial.word,"\n--------------------------------------------------------------------------------------------------------------------------------------")
def report_after_channel(rs_trial):
print(
"|message after channel: ",rs_trial.message,"\n"+
"|modified word:",rs_trial.word,
"\n--------------------------------------------------------------------------------------------------------------------------------------\n"
)
def report_after_decoding(rs_trial):
print(
"|message estimate is: ",rs_trial.message,"\n","--------------------------------------------------------------------------------------------------------------------------------------")
#initial setup
#--------------------------------------------------------------------------------------------------------------------
gf11=prime_field(11) #prime field 11
locators = [1,2,3,4,5,6,7,8,9,10] #locators
multipliers = [1,1,1,1,1,1,1,1,1,1] #multipliers
k=5 # msg length
n=10 #code length
message = [3,5,3,4,1] #message
rs_trial_one = RSTrial(gf11,k,n,locators,multipliers,message=message)
#-----------------------------------------------------------------------
report_welcome(rs_trial_one)
#instantiation of generic classes
#---------------------------------
encoder = Encoder()
channel = Channel()
decoder = Decoder()
#---------------------------------
next_move("ENCODER")
encoder.apply_RS_Prime_Encoder(rs_trial_one)
report_after_encoding(rs_trial_one)
next_move("CHANNEL")
channel.apply_DMC_channel(rs_trial_one,0.25)
report_after_channel(rs_trial_one)
next_move("DECODE")
decoder.apply_RS_prime_field_decoder(rs_trial_one)
report_after_decoding(rs_trial_one)