Commit f27b2d69ed1dda2dcd4c87cbdb048fcb36ba3f32

Authored by Brice Colombier
1 parent 4e19bdd7da
Exists in master

Software version working

Showing 2 changed files with 12 additions and 17 deletions

... ... @@ -86,6 +86,7 @@
86 86 if blocks_to_correct:
87 87 # Error correction step
88 88 fb.flip_bits(reference_response, indices_to_flip, indices)
  89 + print str(len(indices_to_flip)), "errors corrected before backtracking"
89 90 indices_to_flip = []
90 91 blocks_to_correct = []
91 92 if passe > 0:
... ... @@ -100,6 +101,7 @@
100 101 _, backtracked_pos = bi_par.binary_par([reference_response_block], [block_to_correct], response_on_board)
101 102 # backtracked_pos = bi.binary(reference_response_block, block_to_correct, response_on_board)
102 103 fb.flip_bits(reference_response, backtracked_pos, indices)
  104 + print "One more error corrected during backtracking"
103 105 # Move blocks from one group to the other if they contain the bit to flip
104 106 sb.swap_blocks(even_parity_blocks, odd_parity_blocks, backtracked_pos[0])
105 107 if [x for x in even_parity_blocks if x in odd_parity_blocks]:
... ... @@ -111,7 +113,7 @@
111 113 if __name__ == "__main__":
112 114 MSIZE = 256
113 115 ERROR_RATE = 0.02
114   - NB_PASSES = 6
  116 + NB_PASSES = 20
115 117 NB_ESSAIS = 1
116 118 INITIAL_BLOCK_SIZE = 4
117 119  
... ... @@ -119,7 +121,8 @@
119 121  
120 122 response_on_board = list(reversed(128*[1, 0])) #sort LSB first
121 123 response_on_server = list(reversed(8*[0, 1]+120*[1, 0])) #sort LSB first
122   -
  124 + errors_location = [0 if a == b else 1 for (a, b) in zip(response_on_board, response_on_server)]
  125 + print "Errors at positions: ", [a for (a, b) in enumerate(errors_location) if b == 1]
123 126 response_on_server = cascade(response_on_server,
124 127 ERROR_RATE,
125 128 NB_PASSES,
get_parities_from_indices.py View file @ f27b2d6
... ... @@ -17,22 +17,14 @@
17 17 [0, 1, 1, 0]
18 18 """
19 19  
20   - tclsh = Tkinter.Tcl()
21 20 parities = []
22   - tclsh.eval("source {HECTOR_data_acq.tcl}")
23   - tclsh.eval("set dev [openDevice COM3]")
24   - tclsh.eval("puts \"Resetting the board\"")
25   - tclsh.eval("softReset $dev")
26   - tclsh.eval("sendDaughterReset $dev")
27   - tclsh.eval("sendFabricReset $dev")
28   - tclsh.eval("sendFabricCommand $dev 4 4") # generate automatic response
29   - tclsh.eval("sendFabricCommand $dev 4 3") # offload response to MB
30   - tclsh.eval("set rep \"[sendFabricCommand $dev 5 3] [sendFabricCommand $dev 5 2] [sendFabricCommand $dev 5 1] [sendFabricCommand $dev 5 0]\"") # Display response block 0
31   - tclsh.eval("regsub -all { } $rep {} rep")
32   - response = tclsh.eval("exit $rep")
33   - print response
34   -
  21 + for i in indices:
  22 + parity = 0
  23 + for index in i:
  24 + parity^=response_on_board[index]
  25 + parities.append(parity)
  26 + return parities
35 27  
36 28 if __name__ == "__main__":
37   - print get_parities_from_indices([0, 1, 2, 3])
  29 + print get_parities_from_indices([[0, 1, 2, 3], [4, 5, 6, 7]], [0, 1, 0, 1, 1, 1, 0, 1])