Exemplo n.º 1
0
def createMod512LookupTable(encoding):
	table = LookupTable()

	points = generatePointsMatrix(24)
	baseBitStrings = generateBaseBitStringMatrixMod512()
	
	if encoding == LINEAR:
		linearList = BG.generateBitList(9)
		index = 0
		for i in range(0, 24):
			for j in range(0, 24):
				if baseBitStrings[i][j] != None:
					baseBitStrings[i][j] = BSH.charListToString(linearList[index])
					index += 1

	else:
		fillInBitStringMatrixMod512(baseBitStrings)
		replaceWithGrayCodeBinary(baseBitStrings, 9)
		mirrorTopLeftQuadrant(baseBitStrings)
		
	for i in range(0, 24):
		for j in range(0, 24):
			if baseBitStrings[i][j] != None:
				table.add(baseBitStrings[i][j], points[i][j])	 

	return table
Exemplo n.º 2
0
def createMod1024LookupTable(encoding):
	table = LookupTable()

	points = generatePointsMatrix(32)
	bitMatrix = generateSquareMatrix(10, encoding)

	for i in range(0, 32):
		for j in range(0, 32):
			table.add(bitMatrix[i][j], points[i][j])

	return table
Exemplo n.º 3
0
def createMod4GrayLookupTable():
	table = LookupTable()
	values = BG.generateBitList(2)

	stringValues = []
	for value in values: 
		stringValues.append(BSH.charListToString(Encoder.convertToGray(value)))

	points = generatePointsMatrix(2)
	nextString = 0
	for i in range(0, 2):
		for j in range(0, 2):
			table.add(stringValues[nextString], points[i][j])
			nextString += 1

	return table
Exemplo n.º 4
0
def createMod32LookupTable(encoding):
	table = LookupTable()

	points = generatePointsMatrix(6)
	baseBitStrings = generateBaseBitStringMatrixMod32()
	
	if encoding == LINEAR:
		linearList = BG.generateBitList(5)
		index = 0
		for i in range(0, 6):
			for j in range(0, 6):
				if baseBitStrings[i][j] != None:
					baseBitStrings[i][j] = BSH.charListToString(linearList[index])
					index += 1

	else:
		linearList = BG.generateBitList(3)
		grayList = []
		for value in linearList:
			grayList.append(BSH.charListToString(Encoder.convertToGray(value)))

		baseBitStrings[0][0] = None
		baseBitStrings[0][1] = grayList[4]
		baseBitStrings[0][2] = grayList[3]
		baseBitStrings[1][0] = grayList[5]
		baseBitStrings[1][1] = grayList[6]
		baseBitStrings[1][2] = grayList[7]
		baseBitStrings[2][0] = grayList[2]
		baseBitStrings[2][1] = grayList[1]
		baseBitStrings[2][2] = grayList[0]

		# With QAM levels that are an odd power of 2 it is no longer possible
		# to arrange the values such that no 2 differ by more than 1 bit. The 
		# above pattern is the best that can be done. It gives 8 adjacent pairs
		# that differ by more than 1 bit. This pattern is scaled up to be used 
		# in 128 and 512 QAM. 
		mirrorTopLeftQuadrant(baseBitStrings)

	for i in range(0, 6):
		for j in range(0, 6):
			if baseBitStrings[i][j] != None:
				table.add(baseBitStrings[i][j], points[i][j])	 

	return table
Exemplo n.º 5
0
def createMod4GrayLookupTable():
	table = LookupTable()
	table.add("00", Point(1,0))
	table.add("01", Point(0,1))
	table.add("11", Point(-1,0))
	table.add("10",Point(0,-1))
	return table
Exemplo n.º 6
0
def createMod8LookupTable(encoding):
	table = LookupTable()
	values = BG.generateBitList(3)

	stringValues = []
	for value in values: 
		if encoding == LINEAR:
			stringValues.append(BSH.charListToString(value))
		else:
			stringValues.append(BSH.charListToString(Encoder.convertToGray(value)))

	bitMatrix = []

	nextRow = []
	nextRow.append(stringValues[0])
	nextRow.append(stringValues[1])
	nextRow.append(stringValues[2])
	bitMatrix.append(nextRow)

	nextRow = []
	nextRow.insert(0, stringValues[3])
	nextRow.insert(0, None)
	nextRow.insert(0, stringValues[7])
	bitMatrix.append(nextRow)

	nextRow = []
	nextRow.append(stringValues[6])
	nextRow.append(stringValues[5])
	nextRow.append(stringValues[4])
	bitMatrix.append(nextRow)

	points = generatePointsMatrix(3)

	for i in range(0,3):
		for j in range(0,3):
			table.add(bitMatrix[i][j], points[i][j])
			
	return table
Exemplo n.º 7
0
def createMod2LookupTable():
	table = LookupTable()
	table.add('0', Point(-1,0))
	table.add('1', Point(1,0))
	return table
Exemplo n.º 8
0
def createMod8GrayLookupTable():
	table = LookupTable()
	table.add("000", Point(1,0))
	table.add("001", Point(0.7071, 0.7071))
	table.add("101", Point(0, 1))
	table.add("100", Point(-0.7071, 0.7071))
	table.add("110", Point(-1, 0))
	table.add("111", Point(-0.7071, -0.7071))
	table.add("011", Point(0,-1))
	table.add("010", Point(0.7071, -0.7071))
	return table
Exemplo n.º 9
0
def createMod8LinearLookupTable():
	table = LookupTable()
	table.add('000', Point(1,0))
	table.add('001', Point(0.7071, 0.7071))
	table.add('010', Point(0, 1))
	table.add('011', Point(-0.7071, 0.7071))
	table.add('100', Point(-1, 0))
	table.add('101', Point(-0.7071, -0.7071))
	table.add('110', Point(0, -1))
	table.add('111', Point(0.7071, -0.7071))
	return table
Exemplo n.º 10
0
def createMod16GrayLookupTable():
	table = LookupTable()
	table.add('0000', Point(1,0))
	table.add('0001', Point(0.9239,0.3827))
	table.add('0011', Point(0.7071,0.7071))
	table.add('0010', Point(0.3827,0.9239))
	table.add('0110', Point(0,1))
	table.add('0111', Point(-0.3827,0.9239))
	table.add('0101', Point(-0.7071,0.7071))
	table.add('0100', Point(-0.9239,0.3827))
	table.add('1100', Point(-1,0))
	table.add('1101', Point(-0.9239,-0.3827))
	table.add('1111', Point(-0.7071,-0.7071))
	table.add('1110', Point(-0.3827,-0.9239))
	table.add('1010', Point(0,-1))
	table.add('1011', Point(0.3827,-0.9239))
	table.add('1001', Point(0.7071,-0.7071))
	table.add('1000', Point(0.9239,-0.3827))
	return table