Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 42 additions & 47 deletions MakeWordclouds.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,40 +15,35 @@
name = sys.argv[1]
infile = sys.argv[2]



Words = []

SpWords = []
SpRGB = []
SpSize = []

readFile = open('%s/%s'%(outpath,infile),'r')
lines = readFile.read().split('\n')
for a in range (0,len(lines)):
words = []
special_words = []
special_rgb = []
special_size = []

readfile = open(f'{outpath}/{infile}', 'r')
lines = readfile.read().split('\n')
for a in range(0, len(lines)):
if 'QBYTE' in lines[a]:
xandy = lines[a].split(',')
time = int(xandy[-2])
Words.append(xandy[-1][8:])
x_and_y = lines[a].split(',')
time = int(x_and_y[-2])
words.append(x_and_y[-1][8:])
if 'color' in lines[a] and '|' not in lines[a]:
xandy = lines[a].split(',')
SpWords.append(Words[-1])
SpRGB.append('rgb(%d,%d,%d)'%(int(xandy[3]),int(xandy[4]),int(xandy[5])))
SpSize.append(int(float(xandy[6])))

x_and_y = lines[a].split(',')
special_words.append(words[-1])
special_rgb.append(f'rgb({int(x_and_y[3])},{int(x_and_y[4])},{int(x_and_y[5])})')
special_size.append(int(float(x_and_y[6])))

# make decoy words:

AllLO=[]
Readfile=open('%s/Wordbank.txt'%outpath,encoding='latin-1')
Lines=Readfile.read().split('\n')
for line in range(0,len(Lines)):
AllLO.append(Lines[line])

Decoy = []
for a in range (0,len(Words)):
DecoyIdx = np.random.randint(0,196608)
Decoy.append(AllLO[DecoyIdx])
all_words = []
readfile = open(f'{outpath}/Wordbank.txt', encoding='latin-1')
lines = readfile.read().split('\n')
for line in range(0, len(lines)):
all_words.append(lines[line])

decoy = []
for a in range(0, len(words)):
decoy_idx = np.random.randint(0, 196608)
decoy.append(all_words[decoy_idx])

"""

Expand All @@ -59,13 +54,13 @@
LabelFile = ['B','A']

outfile = open('%s/%s_Wordlist%s.txt'%(outpath,name,LabelFile[0]),'w')
for a in range (0,len(Words)):
outfile.write('%s\n'%Words[a])
for a in range (0,len(words)):
outfile.write('%s\n'%words[a])
outfile.close()

outfile = open('%s/%s_Wordlist%s.txt'%(outpath,name,LabelFile[1]),'w')
for a in range (0,len(Decoy)):
outfile.write('%s\n'%Decoy[a])
for a in range (0,len(decoy)):
outfile.write('%s\n'%decoy[a])
outfile.close()

outfile = open('%s/%s_Target.txt'%(outpath,name),'w')
Expand All @@ -88,10 +83,10 @@
DeWords = []
DeRGB = []
DeSize = []
for a in range (0,len(SpWords)):
LclDecoyIdx = np.random.randint(0,len(Decoy))
for a in range (0,len(special_words)):
LclDecoyIdx = np.random.randint(0,len(decoy))
LclRGBIdx = np.random.randint(0,len(DecoyRGB))
DeWords.append(Decoy[LclDecoyIdx])
DeWords.append(decoy[LclDecoyIdx])
DeRGB.append(DecoyRGB[LclRGBIdx])
DeSize.append(DecoySize[LclRGBIdx])

Expand All @@ -100,21 +95,21 @@

def my_color_func(word, font_size, position, orientation, random_state=None, **kwargs):
rcolor = 'rgb(255,255,255)'
for a in range (0,len(SpWords)):
if SpWords[a]==word:
rcolor = SpRGB[a]
for a in range (0,len(special_words)):
if special_words[a]==word:
rcolor = special_rgb[a]
return rcolor



stopwords = set(STOPWORDS)

my_words = []
for a in range (0,len(SpWords)):
for b in range (0,SpSize[a]):
my_words.append(SpWords[a])
for a in range (0,len(Words)):
my_words.append(Words[a])
for a in range (0,len(special_words)):
for b in range (0,special_size[a]):
my_words.append(special_words[a])
for a in range (0,len(words)):
my_words.append(words[a])
random.shuffle(my_words)
wordtext = ''
for a in range (0,len(my_words)):
Expand Down Expand Up @@ -144,8 +139,8 @@ def my_color_decoy(word, font_size, position, orientation, random_state=None, **
for a in range (0,len(DeWords)):
for b in range (0,DeSize[a]):
my_decoy.append(DeWords[a])
for a in range (0,len(Decoy)):
my_decoy.append(Decoy[a])
for a in range (0,len(decoy)):
my_decoy.append(decoy[a])
random.shuffle(my_decoy)
wordtextD = ''
for a in range (0,len(my_decoy)):
Expand Down
2 changes: 1 addition & 1 deletion QBread.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
anlzfile = [sys.argv[1]]

for a in range (0,len(anlzfile)):
readFile = open('%s\%s'%(outpath,anlzfile[a]),'r')
readFile = open(f'{outpath}/{anlzfile[a]}', 'r')
if a==0:
sepfile = readFile.read().split('\n')
else:
Expand Down
78 changes: 40 additions & 38 deletions QByte.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,30 @@

###########CONFIGURE HERE###########

ColorZ = 1.65#Z-score in the QByte bitstream where colors change
RotZ = 1.85#Z-score in the QByte bitstream where rotation occurs
ColorZ = 1.65 # Z-score in the QByte bitstream where colors change
RotZ = 1.85 # Z-score in the QByte bitstream where rotation occurs

DotSize = 4444
wordsize = 36
Default_Marker = 'o'#for a full list: https://matplotlib.org/stable/api/markers_api.html
Default_Marker = 'o' # for a full list: https://matplotlib.org/stable/api/markers_api.html

NEDspeed = 250#Number of bytes to stream from the RNG each second
RandomSrc = 'prng'#'trng' = TrueRNG hardware (https://ubld.it/truerng_v3) ... 'prng' = pseudo RNG ... 'ipfs' = interplenetary file system (REQUIRED config for ipfs mode -> NEDspeed=250, SupHALO=True, TurboUse=True. RNG hardware is NOT required as it will pull the data remotely.)
SupHALO = True#Set to 'True' for full (8 bitstream) QByte processing. Not reccomended for slower computers.
TurboUse = True#Set to 'True' only if you have a TurboRNG (https://ubld.it/products/truerngpro) or are running with RandomSrc = 'ipfs'. If set to 'True' while RandomSrc = 'prng', pseudo RNG will be used to simulate TurboRNG.
#The TurboRNG acts as a reliable high-speed data source that neuromorphically entangles together the two hemispheres (4 devices on each) of the Q-Byte processing.
#trouble may occur if using Turbo without NEDs
NEDspeed = 250 # Number of bytes to stream from the RNG each second
RandomSrc = 'prng' # 'trng' = TrueRNG hardware (https://ubld.it/truerng_v3) ... 'prng' = pseudo RNG ... 'ipfs' = interplenetary file system (REQUIRED config for ipfs mode -> NEDspeed=250, SupHALO=True, TurboUse=True. RNG hardware is NOT required as it will pull the data remotely.)
SupHALO = True # Set to 'True' for full (8 bitstream) QByte processing. Not reccomended for slower computers.
TurboUse = True # Set to 'True' only if you have a TurboRNG (https://ubld.it/products/truerngpro) or are running with RandomSrc = 'ipfs'. If set to 'True' while RandomSrc = 'prng', pseudo RNG will be used to simulate TurboRNG.
# The TurboRNG acts as a reliable high-speed data source that neuromorphically entangles together the two hemispheres (4 devices on each) of the Q-Byte processing.
# trouble may occur if using Turbo without NEDs

IPFS_Estuary = True#if RandomSrc = 'ipfs', 'True' will pull from Estuary, 'False' will pull from web3.storage
IPFS_Estuary = True # if RandomSrc = 'ipfs', 'True' will pull from Estuary, 'False' will pull from web3.storage

Genome = False#set to 'True' to XOR with genome from 23 and me data file (beta feature). Turns nucleotide information (A,G,C,T) into bits that factor in to the QByte output.
GenomeSrc = 'GenomeSample.txt'#Genome source data (this is where you can upload your DNA file from 23 and Me), ignored if Genome = 'False'
Genome = False # set to 'True' to XOR with genome from 23 and me data file (beta feature). Turns nucleotide information (A,G,C,T) into bits that factor in to the QByte output.
GenomeSrc = 'GenomeSample.txt' # Genome source data (this is where you can upload your DNA file from 23 and Me), ignored if Genome = 'False'

MaxFileTime = 600#number of seconds of data to store to an individual output file
PushEstuary = False#uploads data to Estuary at MaxFileTime interval, requires curl. REQUIRED config -> NEDspeed=250, SupHALO=True, TurboUse=True. Any RandomSrc may be used.
EstuaryCollection = 'd0e46d0d-7e4c-4bce-8401-ee1a10b89f3d'#'bfffcaab-d302-4bab-b0ed-552e450a2dc9'
MaxFileTime = 600 # number of seconds of data to store to an individual output file
PushEstuary = False # uploads data to Estuary at MaxFileTime interval, requires curl. REQUIRED config -> NEDspeed=250, SupHALO=True, TurboUse=True. Any RandomSrc may be used.
EstuaryCollection = 'd0e46d0d-7e4c-4bce-8401-ee1a10b89f3d' # 'bfffcaab-d302-4bab-b0ed-552e450a2dc9'

autofreq = 600#how often to switch view in seconds if ran in 'auto' mode
autofreq = 600 # how often to switch view in seconds if ran in 'auto' mode

OutputImgs = False#Runs stable diffusion
ImgTime = 900#frequency to run Stable Diffusion
Expand Down Expand Up @@ -612,24 +612,24 @@ def entrain(self):

for temp in ports_avaiable:
if HALO==True:
if temp[1].startswith("TrueRNG"):
if 'pro' in temp[1]:
print ('found pro')
turbocom = str(temp[0])
else:
print('Found: ' + str(temp))
rngcomports.append(str(temp[0]))
if temp[1].startswith("TrueRNG"):
if 'pro' in temp[1]:
print('found pro')
turbocom = str(temp[0])
else:
print('Found: ' + str(temp))
rngcomports.append(str(temp[0]))
else:
if temp[1].startswith("TrueRNG"):
print ('found device')
turbocom = str(temp[0])
if temp[1].startswith("TrueRNG"):
print('found device')
turbocom = str(temp[0])

if HALO==True:
ser = []
for a in range(0,len(rngcomports)):
ser.append (serial.Serial(port=rngcomports[a],timeout=10))
ser.append(serial.Serial(port=rngcomports[a],timeout=10))
if TurboUse==True:
turboser= (serial.Serial(port=turbocom,timeout=10))
turboser = (serial.Serial(port=turbocom,timeout=10))



Expand All @@ -640,11 +640,11 @@ def entrain(self):

if HALO==True:
for a in range(0,len(rngcomports)):
if(ser[a].isOpen() == False):
ser[a].open()

ser[a].setDTR(True)
ser[a].flushInput()
if ser[a].isOpen() == False:
ser[a].open()
ser[a].setDTR(True)
ser[a].flushInput()
if TurboUse==True:
if turboser.isOpen()==False:
turboser.open()
Expand Down Expand Up @@ -815,11 +815,13 @@ def Bulk():

bitct = 0
for a in range (0,len(x)):
outfile.write('%d,'%x[a])
strnode = str(bin(256+int(x[a])))[3:]
bitct += int(strnode[0])+int(strnode[1])+int(strnode[2])+int(strnode[3])+int(strnode[4])+int(strnode[5])+int(strnode[6])+int(strnode[7])
outfile.write('%d,' % x[a])
strnode = str(bin(256 + int(x[a])))[3:]
bitct += (int(strnode[0]) + int(strnode[1]) + int(strnode[2]) +
int(strnode[3]) + int(strnode[4]) + int(strnode[5]) +
int(strnode[6]) + int(strnode[7]))

outfile.write('%d,QBYTE | '%(int(time.time()*1000)))
outfile.write('%d,QBYTE | ' % (int(time.time()*1000)))



Expand Down Expand Up @@ -1299,7 +1301,7 @@ def animate(i):

QBsums.append(AC[1])
axQB.append(np.sum(QBsums)-(len(ult_t)*NEDspeed*8*0.5))
for a in range (0,len(Xsums)):
for a in range(0,len(Xsums)):
ax1y[a].append(np.sum(Xsums[a])-(len(ult_t)*NEDspeed*8*0.5))
#print(a,(np.sum(Xsums[a])-(len(ult_t)*NEDspeed*8*0.5)))
ax1s.append(((len(ult_t)*NEDspeed*8*0.25)**0.5)*1.96)
Expand Down