04.07., 9:00 - 11:00: Due to updates GitLab will be unavailable for some minutes between 09:00 and 11:00.

Commit d2173c31 authored by hm-striegle's avatar hm-striegle

bits_debruijn

parent 4d8c8fdf
......@@ -51,7 +51,14 @@ class pypho_bits(object):
self.bits = np.ones(self.nob, dtype=np.int)
elif self.pattern == "random":
self.bits = self.rndm()
self.bits = self.rndm()
elif self.pattern == "debruijn":
self.dbl = int(np.log2(self.nob))
self.a = [0] * self.dbl * 2
self.bits = []
self.db(1, 1)
else:
print ("ERROR: No valid pattern specified!")
sys.exit("PyPho stopped!")
......@@ -71,17 +78,21 @@ class pypho_bits(object):
self.bits = np.array(self.value_rndn)
return self.value_rndn
### Get and set parameters #############################################
# nos: Number of Bits
@property
def nos(self):
"""Get number of bits"""
return self.bits.size
### Create De Bruijn Sequence #########################################
def db(self, t, p):
if t > self.dbl:
if self.dbl % p == 0:
for j in range(1, p + 1):
self.bits.append(self.a[j])
else:
self.a[t] = self.a[t - p]
self.db(t + 1, p)
for j in range(self.a[t - p] + 1, 2):
self.a[t] = j
self.db(t + 1, t)
########################################################################
def set(self, nob = None, pattern = None):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment