repo
stringlengths
2
99
file
stringlengths
13
225
code
stringlengths
0
18.3M
file_length
int64
0
18.3M
avg_line_length
float64
0
1.36M
max_line_length
int64
0
4.26M
extension_type
stringclasses
1 value
gecco-2022
gecco-2022-main/AND-XOR/DynamicalMatrix.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Oct 10 22:09:09 2017 @author: Hightoutou """ def DM_mass(N, x0, y0, D0, m0, L): import numpy as np Lx = L[0] Ly = L[1] M = np.zeros((2*N, 2*N)) contactNum = 0 for i in range(N): for j in range(i): ...
12,537
30.423559
104
py
gecco-2022
gecco-2022-main/AND-XOR/ConfigPlot.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Oct 10 21:01:26 2017 @author: Hightoutou """ import numpy as np def ConfigPlot_DiffSize(N, x, y, D, L, mark_print): import matplotlib.pyplot as plt from matplotlib.patches import Ellipse Dmin = min(D) fig, ax = plt.subplots(subplo...
22,835
29.488652
117
py
gecco-2022
gecco-2022-main/AND-XOR/MOO2.py
# multi-objective optimization to evolve AND and XOR gates in the same material # imports for DEAP import time, array, random, copy, math import numpy as np from deap import algorithms, base, benchmarks, tools, creator import matplotlib.pyplot as plt import seaborn #seaborn.set(style='whitegrid') import pandas as pd ...
12,452
35.626471
248
py
gecco-2022
gecco-2022-main/AND-XOR/MOO.py
# multi-objective optimization to evolve AND and XOR gates in the same material # imports for DEAP import time, array, random, copy, math import numpy as np from deap import algorithms, base, benchmarks, tools, creator import matplotlib.pyplot as plt import seaborn #seaborn.set(style='whitegrid') import pandas as pd ...
15,147
35.501205
248
py
gecco-2022
gecco-2022-main/AND-XOR/plotMOO3.py
## plot stuff after loading everything from the pickled files for MOO import time, array, random, copy, math import numpy as np from deap import algorithms, base, benchmarks, tools, creator import matplotlib.pyplot as plt import seaborn import pandas as pd import random import pickle from os.path import exists import ...
11,771
36.730769
248
py
gecco-2022
gecco-2022-main/AND-XOR/plot_functions.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Oct 22 14:48:04 2017 @author: Hightoutou """ import matplotlib.pyplot as plt #import matplotlib #matplotlib.use('TkAgg') def Line_single(xdata, ydata, line_spec, xlabel, ylabel, mark_print, fn = '', xscale='linear', yscale='linear'): fig, ax1 = plt...
2,062
33.966102
112
py
gecco-2022
gecco-2022-main/AND-XOR/FFT_functions.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Oct 17 15:10:21 2017 @author: Hightoutou """ import numpy as np import matplotlib.pyplot as plt from plot_functions import Line_multi, Line_single #from numba import jit def FFT_Fup(Nt, F, dt, Freq_Vibr): sampling_rate = 1/dt t = np.arange(Nt...
3,487
25.225564
152
py
gecco-2022
gecco-2022-main/AND-XOR/plotMOO.py
## plot stuff after loading everything from the pickled files for MOO import time, array, random, copy, math import numpy as np from deap import algorithms, base, benchmarks, tools, creator import matplotlib.pyplot as plt import seaborn import pandas as pd import random import pickle from os.path import exists import ...
51,850
38.281061
267
py
gecco-2022
gecco-2022-main/RandomSearch/AND-NESS/switch_binary.py
import numpy as np from ConfigPlot import ConfigPlot_EigenMode_DiffMass, ConfigPlot_YFixed_rec, ConfigPlot_DiffMass_SP from MD_functions import MD_VibrSP_ConstV_Yfixed_DiffK from MD_functions import FIRE_YFixed_ConstV_DiffK from DynamicalMatrix import DM_mass_DiffK_Yfixed from plot_functions import Line_single, Line_m...
14,736
36.594388
252
py
gecco-2022
gecco-2022-main/RandomSearch/AND-NESS/MD_functions.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Oct 13 13:09:27 2017 @author: Hightoutou """ import numpy as np import time #from numba import jit from FFT_functions import FFT_Fup, FFT_vCorr from plot_functions import Line_multi, Line_yy, Line_single from ConfigPlot import ConfigPlot_YFixed_rec imp...
133,858
30.675106
178
py
gecco-2022
gecco-2022-main/RandomSearch/AND-NESS/constants.py
# number of runs RUNS = 3 worstFitness = +1000000 # population size popSize = 50 # number of generations numGenerations = 200
129
10.818182
23
py
gecco-2022
gecco-2022-main/RandomSearch/AND-NESS/afpo_seed_binary.py
import constants as c import copy import numpy as np import operator import statistics import pickle from joblib import Parallel, delayed import multiprocessing from genome_seed_binary import GENOME class AFPO: def __init__(self,randomSeed): self.randomSeed = randomSeed self.currentGene...
5,048
30.955696
112
py
gecco-2022
gecco-2022-main/RandomSearch/AND-NESS/DynamicalMatrix.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Oct 10 22:09:09 2017 @author: Hightoutou """ def DM_mass(N, x0, y0, D0, m0, L): import numpy as np Lx = L[0] Ly = L[1] M = np.zeros((2*N, 2*N)) contactNum = 0 for i in range(N): for j in range(i): ...
12,537
30.423559
104
py
gecco-2022
gecco-2022-main/RandomSearch/AND-NESS/ConfigPlot.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Oct 10 21:01:26 2017 @author: Hightoutou """ import numpy as np def ConfigPlot_DiffSize(N, x, y, D, L, mark_print): import matplotlib.pyplot as plt from matplotlib.patches import Ellipse Dmin = min(D) fig, ax = plt.subplots(subplo...
22,835
29.488652
117
py
gecco-2022
gecco-2022-main/RandomSearch/AND-NESS/genome_seed_binary.py
import constants as c from individual_seed_binary import INDIVIDUAL import pickle class GENOME: def __init__(self,ID,fitness=c.worstFitness): self.Set_ID(ID) self.indv = INDIVIDUAL(ID) self.age = 0 self.fitness = fitness def Age(self): self.age = self.age + 1 def ...
2,336
24.681319
74
py
gecco-2022
gecco-2022-main/RandomSearch/AND-NESS/afpoPlots_seed_binary.py
import pickle import matplotlib.pyplot as plt from switch_binary import switch import constants as c import numpy runs = c.RUNS gens = c.numGenerations fitnesses = numpy.zeros([runs, gens]) temp = [] individuals = [] with open('savedRobotsAfpoSeed.dat', "rb") as f: for r in range(1, runs+1): for g in range...
2,217
28.972973
103
py
gecco-2022
gecco-2022-main/RandomSearch/AND-NESS/evolveAfpo_seed_binary.py
from afpo_seed_binary import AFPO import os import constants as c import random #cleaning up the data files try: os.remove("savedRobotsLastGenAfpoSeed.dat") except OSError: pass try: os.remove("avgFitnessAfpoSeed.dat") except OSError: pass try: os.remove("savedRobotsAfpoSeed.dat") except OSError: ...
616
18.28125
82
py
gecco-2022
gecco-2022-main/RandomSearch/AND-NESS/individual_seed_binary.py
from switch_binary import switch import constants as c import random import math import numpy as np import sys import pickle class INDIVIDUAL: def __init__(self, i): # assuming curves have one control point, [Sx, Ex, Cx, Cy] for each fiber # assuming we have two planes, each with c.FIBERS of fibers...
1,936
35.54717
190
py
gecco-2022
gecco-2022-main/RandomSearch/AND-NESS/randomSearch2.py
from switch_binary import switch import matplotlib.pyplot as plt import random import numpy as np from joblib import Parallel, delayed import multiprocessing import pickle from scipy.stats import norm import operator from ConfigPlot import ConfigPlot_DiffStiffness3 with open('outs.dat', "rb") as f: outs = pickle.l...
3,115
24.966667
138
py
gecco-2022
gecco-2022-main/RandomSearch/AND-NESS/plot_functions.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Oct 22 14:48:04 2017 @author: Hightoutou """ import matplotlib.pyplot as plt #import matplotlib #matplotlib.use('TkAgg') def Line_single(xdata, ydata, line_spec, xlabel, ylabel, mark_print, fn = '', xscale='linear', yscale='linear'): fig, ax1 = plt...
2,062
33.966102
112
py
gecco-2022
gecco-2022-main/RandomSearch/AND-NESS/FFT_functions.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Oct 17 15:10:21 2017 @author: Hightoutou """ import numpy as np import matplotlib.pyplot as plt from plot_functions import Line_multi, Line_single #from numba import jit def FFT_Fup(Nt, F, dt, Freq_Vibr): sampling_rate = 1/dt t = np.arange(Nt...
3,487
25.225564
152
py
gecco-2022
gecco-2022-main/RandomSearch/AND-NESS/randomSearch.py
from switch_binary import switch import matplotlib.pyplot as plt import random import numpy as np from joblib import Parallel, delayed import multiprocessing import pickle m1 = 1 m2 = 10 N = 30 N_light = 9 samples = [] print("sampling", flush=True) for i in range(0, 5001): samples.append(np.random.randint(low=0,...
978
21.767442
112
py
gecco-2022
gecco-2022-main/RandomSearch/AND-NESS/plotInOut.py
import constants as c import numpy as np from ConfigPlot import ConfigPlot_DiffStiffness2 from MD_functions import MD_VibrSP_ConstV_Yfixed_DiffK, FIRE_YFixed_ConstV_DiffK, MD_VibrSP_ConstV_Yfixed_DiffK2 from DynamicalMatrix import DM_mass_DiffK_Yfixed import random import matplotlib.pyplot as plt import pickle from os....
13,392
35.997238
248
py
gecco-2022
gecco-2022-main/RandomSearch/XOR-NESS/switch_binary.py
import numpy as np from ConfigPlot import ConfigPlot_EigenMode_DiffMass, ConfigPlot_YFixed_rec, ConfigPlot_DiffMass_SP from MD_functions import MD_VibrSP_ConstV_Yfixed_DiffK from MD_functions import FIRE_YFixed_ConstV_DiffK from DynamicalMatrix import DM_mass_DiffK_Yfixed from plot_functions import Line_single, Line_m...
14,724
36.563776
252
py
gecco-2022
gecco-2022-main/RandomSearch/XOR-NESS/MD_functions.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Oct 13 13:09:27 2017 @author: Hightoutou """ import numpy as np import time #from numba import jit from FFT_functions import FFT_Fup, FFT_vCorr from plot_functions import Line_multi, Line_yy, Line_single from ConfigPlot import ConfigPlot_YFixed_rec imp...
133,858
30.675106
178
py
gecco-2022
gecco-2022-main/RandomSearch/XOR-NESS/constants.py
# number of runs RUNS = 3 worstFitness = +1000000 # population size popSize = 50 # number of generations numGenerations = 200
129
10.818182
23
py
gecco-2022
gecco-2022-main/RandomSearch/XOR-NESS/afpo_seed_binary.py
import constants as c import copy import numpy as np import operator import statistics import pickle from joblib import Parallel, delayed import multiprocessing from genome_seed_binary import GENOME class AFPO: def __init__(self,randomSeed): self.randomSeed = randomSeed self.currentGene...
5,048
30.955696
112
py
gecco-2022
gecco-2022-main/RandomSearch/XOR-NESS/DynamicalMatrix.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Oct 10 22:09:09 2017 @author: Hightoutou """ def DM_mass(N, x0, y0, D0, m0, L): import numpy as np Lx = L[0] Ly = L[1] M = np.zeros((2*N, 2*N)) contactNum = 0 for i in range(N): for j in range(i): ...
12,537
30.423559
104
py
gecco-2022
gecco-2022-main/RandomSearch/XOR-NESS/ConfigPlot.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Oct 10 21:01:26 2017 @author: Hightoutou """ import numpy as np def ConfigPlot_DiffSize(N, x, y, D, L, mark_print): import matplotlib.pyplot as plt from matplotlib.patches import Ellipse Dmin = min(D) fig, ax = plt.subplots(subplo...
22,835
29.488652
117
py
gecco-2022
gecco-2022-main/RandomSearch/XOR-NESS/genome_seed_binary.py
import constants as c from individual_seed_binary import INDIVIDUAL import pickle class GENOME: def __init__(self,ID,fitness=c.worstFitness): self.Set_ID(ID) self.indv = INDIVIDUAL(ID) self.age = 0 self.fitness = fitness def Age(self): self.age = self.age + 1 def ...
2,336
24.681319
74
py
gecco-2022
gecco-2022-main/RandomSearch/XOR-NESS/afpoPlots_seed_binary.py
import pickle import matplotlib.pyplot as plt from switch_binary import switch import constants as c import numpy runs = c.RUNS gens = c.numGenerations fitnesses = numpy.zeros([runs, gens]) temp = [] individuals = [] with open('savedRobotsAfpoSeed.dat', "rb") as f: for r in range(1, runs+1): for g in range...
2,217
28.972973
103
py
gecco-2022
gecco-2022-main/RandomSearch/XOR-NESS/evolveAfpo_seed_binary.py
from afpo_seed_binary import AFPO import os import constants as c import random #cleaning up the data files try: os.remove("savedRobotsLastGenAfpoSeed.dat") except OSError: pass try: os.remove("avgFitnessAfpoSeed.dat") except OSError: pass try: os.remove("savedRobotsAfpoSeed.dat") except OSError: ...
616
18.28125
82
py
gecco-2022
gecco-2022-main/RandomSearch/XOR-NESS/individual_seed_binary.py
from switch_binary import switch import constants as c import random import math import numpy as np import sys import pickle class INDIVIDUAL: def __init__(self, i): # assuming curves have one control point, [Sx, Ex, Cx, Cy] for each fiber # assuming we have two planes, each with c.FIBERS of fibers...
1,936
35.54717
190
py
gecco-2022
gecco-2022-main/RandomSearch/XOR-NESS/randomSearch2.py
from switch_binary import switch import matplotlib.pyplot as plt import random import numpy as np from joblib import Parallel, delayed import multiprocessing import pickle from scipy.stats import norm import operator from ConfigPlot import ConfigPlot_DiffStiffness3 with open('outs.dat', "rb") as f: outs = pickle.l...
3,171
25
138
py
gecco-2022
gecco-2022-main/RandomSearch/XOR-NESS/plot_functions.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Oct 22 14:48:04 2017 @author: Hightoutou """ import matplotlib.pyplot as plt #import matplotlib #matplotlib.use('TkAgg') def Line_single(xdata, ydata, line_spec, xlabel, ylabel, mark_print, fn = '', xscale='linear', yscale='linear'): fig, ax1 = plt...
2,062
33.966102
112
py
gecco-2022
gecco-2022-main/RandomSearch/XOR-NESS/FFT_functions.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Oct 17 15:10:21 2017 @author: Hightoutou """ import numpy as np import matplotlib.pyplot as plt from plot_functions import Line_multi, Line_single #from numba import jit def FFT_Fup(Nt, F, dt, Freq_Vibr): sampling_rate = 1/dt t = np.arange(Nt...
3,487
25.225564
152
py
gecco-2022
gecco-2022-main/RandomSearch/XOR-NESS/randomSearch.py
from switch_binary import switch import matplotlib.pyplot as plt import random import numpy as np from joblib import Parallel, delayed import multiprocessing import pickle m1 = 1 m2 = 10 N = 30 N_light = 9 samples = [] print("sampling", flush=True) for i in range(0, 5001): samples.append(np.random.randint(low=0,...
978
21.767442
112
py
gecco-2022
gecco-2022-main/RandomSearch/XOR-NESS/plotInOut.py
import constants as c import numpy as np from ConfigPlot import ConfigPlot_DiffStiffness2 from MD_functions import MD_VibrSP_ConstV_Yfixed_DiffK, FIRE_YFixed_ConstV_DiffK, MD_VibrSP_ConstV_Yfixed_DiffK2 from DynamicalMatrix import DM_mass_DiffK_Yfixed import random import matplotlib.pyplot as plt import pickle from os....
13,392
35.997238
248
py
python-urx
python-urx-master/setup.py
from setuptools import setup setup( name="urx", version="0.11.0", description="Python library to control an UR robot", author="Olivier Roulet-Dubonnet", author_email="olivier.roulet@gmail.com", url='https://github.com/oroulet/python-urx', packages=["urx"], provides=["urx"], install_...
778
32.869565
71
py
python-urx
python-urx-master/make_deb.py
#!/usr/bin/python3 """ hackish file to crreate deb from setup.py """ import subprocess from email.utils import formatdate import urx DEBVERSION = urx.__version__ branch = subprocess.check_output("git rev-parse --abbrev-ref HEAD", shell=True) branch = branch.decode() branch = branch.strip() branch = str(branch).repl...
1,478
24.947368
119
py
python-urx
python-urx-master/release.py
import re import os def bump_version(): with open("setup.py") as f: s = f.read() m = re.search(r'version="(.*)\.(.*)\.(.*)",', s) v1, v2, v3 = m.groups() oldv = "{0}.{1}.{2}".format(v1, v2, v3) newv = "{0}.{1}.{2}".format(v1, v2, str(int(v3) + 1)) print("Current version is: {0}, write ...
1,197
27.52381
84
py
python-urx
python-urx-master/tools/find_packet.py
from urx import ursecmon if __name__ == "__main__": f = open("packets.bin", "rb") s = open("packet.bin", "wb") data = f.read(99999) parser = ursecmon.ParserUtils() p, rest = parser.find_first_packet(data) print(len(p)) p, rest = parser.find_first_packet(rest) print(len(p)) s.write(p...
385
24.733333
44
py
python-urx
python-urx-master/tools/grabber.py
import socket import sys if __name__ == "__main__": host, port = "localhost", 30002 host, port = "192.168.1.8", 30002 if len(sys.argv) > 1: host = sys.argv[1] sock = socket.create_connection((host, port)) f = open("packets.bin", "wb") try: # Connect to server and send data ...
500
19.875
49
py
python-urx
python-urx-master/tools/get_rob.py
#!/usr/bin/env python import sys import logging from math import pi from IPython import embed from urx import Robot import math3d if __name__ == "__main__": if len(sys.argv) > 1: host = sys.argv[1] else: host = 'localhost' try: robot = Robot(host) r = robot embed() ...
389
15.956522
28
py
python-urx
python-urx-master/tools/fakerobot.py
import socket import threading import socketserver import time class RequestHandler(socketserver.BaseRequestHandler): #def __init__(self, *args, **kwargs): #print(self, *args, **kwargs) #print("Got connection from {}".format( self.client_address[0]) ) #socketserver.BaseRequestHandler.__init...
2,177
28.432432
95
py
python-urx
python-urx-master/examples/test_movep.py
import time import urx import logging if __name__ == "__main__": rob = urx.Robot("192.168.1.6") try: l = 0.1 v = 0.07 a = 0.1 r = 0.05 pose = rob.getl() pose[2] += l rob.movep(pose, acc=a, vel=v, radius=r, wait=False) while True: p =...
914
21.317073
59
py
python-urx
python-urx-master/examples/get_robot.py
import urx from IPython import embed import logging if __name__ == "__main__": try: logging.basicConfig(level=logging.INFO) #robot = urx.Robot("192.168.1.6") robot = urx.Robot("192.168.1.100") #robot = urx.Robot("localhost") r = robot print("Robot object is available...
388
23.3125
56
py
python-urx
python-urx-master/examples/simple.py
import urx import logging if __name__ == "__main__": logging.basicConfig(level=logging.WARN) rob = urx.Robot("192.168.1.100") #rob = urx.Robot("localhost") rob.set_tcp((0,0,0,0,0,0)) rob.set_payload(0.5, (0,0,0)) try: l = 0.05 v = 0.05 a = 0.3 pose = rob.getl()...
775
25.758621
64
py
python-urx
python-urx-master/examples/get_realtime_data.py
import urx import time import logging r = urx.Robot("192.168.111.134", use_rt=True, urFirm=5.1) if __name__ == "__main__": logging.basicConfig(level=logging.INFO) while 1: try: j_temp = r.get_joint_temperature() j_voltage = r.get_joint_voltage() j_current = r.get_jo...
1,035
23.093023
67
py
python-urx
python-urx-master/examples/matrices.py
from math import pi import urx import logging if __name__ == "__main__": rob = urx.Robot("192.168.1.100") #rob = urx.Robot("localhost") rob.set_tcp((0,0,0,0,0,0)) rob.set_payload(0.5, (0,0,0)) try: l = 0.05 v = 0.05 a = 0.3 j = rob.getj() print("Initial join...
937
23.051282
56
py
python-urx
python-urx-master/examples/spnav_control.py
from __future__ import division import spnav import time import math3d as m3d from math import pi import urx class Cmd(object): def __init__(self): self.reset() def reset(self): self.x = 0 self.y = 0 self.z = 0 self.rx = 0 self.ry = 0 self.rz = 0 ...
2,806
28.547368
76
py
python-urx
python-urx-master/examples/joystick_control.py
""" example program to control a universal robot with a joystick All joysticks are differens, so you will need to modify the script to work with your joystick """ import time import pygame import math3d as m3d from math import pi import urx class Cmd(object): def __init__(self): self.reset() def r...
4,580
31.721429
147
py
python-urx
python-urx-master/examples/test_all.py
""" Testing script that runs many of the urx methods, while attempting to keep robot pose around its starting pose """ from math import pi import time import sys import urx import logging if sys.version_info[0] < 3: # support python v2 input = raw_input def wait(): if do_wait: print("Click enter to...
2,420
24.484211
110
py
python-urx
python-urx-master/docs/conf.py
# -*- coding: utf-8 -*- # # Python URx documentation build configuration file, created by # sphinx-quickstart on Mon May 11 21:37:43 2015. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # ...
9,300
31.183391
79
py
python-urx
python-urx-master/urx/urrtmon.py
''' Module for implementing a UR controller real-time monitor over socket port 30003. Confer http://support.universal-robots.com/Technical/RealTimeClientInterface Note: The packet lenght given in the web-page is 740. What is actually received from the controller is 692. It is assumed that the motor currents, the last ...
14,305
34.410891
124
py
python-urx
python-urx-master/urx/robot.py
""" Python library to control an UR robot through its TCP/IP interface DOC LINK http://support.universal-robots.com/URRobot/RemoteAccess """ import math3d as m3d import numpy as np from urx.urrobot import URRobot __author__ = "Olivier Roulet-Dubonnet" __copyright__ = "Copyright 2011-2016, Sintef Raufoss Manufacturi...
11,388
29.94837
127
py
python-urx
python-urx-master/urx/robotiq_two_finger_gripper.py
#! /usr/bin/env python """ Python library to control Robotiq Two Finger Gripper connected to UR robot via Python-URX Tested using a UR5 Version CB3 and Robotiq 2-Finger Gripper Version 85 SETUP You must install the driver first and then power on the gripper from the gripper UI. The driver can be found here: http:/...
6,377
28.391705
86
py
python-urx
python-urx-master/urx/__init__.py
""" Python library to control an UR robot through its TCP/IP interface """ from urx.urrobot import RobotException, URRobot # noqa __version__ = "0.11.0" try: from urx.robot import Robot except ImportError as ex: print("Exception while importing math3d base robot, disabling use of matrices", ex) Robot = U...
327
24.230769
87
py
python-urx
python-urx-master/urx/urscript.py
#! /usr/bin/env python import logging # Controller Settings CONTROLLER_PORTS = [0, 1] CONTROLLER_VOLTAGE = [ 0, # 0-5V 2, # 0-10V ] # Tool Settings TOOL_PORTS = [2, 3] TOOL_VOLTAGE = [ 0, # 0-5V 1, # 0-10V 2, # 4-20mA ] OUTPUT_DOMAIN_VOLTAGE = [ 0, # 4-20mA 1, # 0-10V ] class U...
4,900
30.216561
103
py
python-urx
python-urx-master/urx/urrobot.py
""" Python library to control an UR robot through its TCP/IP interface Documentation from universal robots: http://support.universal-robots.com/URRobot/RemoteAccess """ import logging import numbers try: from collections.abc import Sequence except ImportError: from collections import Sequence from urx import...
20,532
35.086116
231
py
python-urx
python-urx-master/urx/ursecmon.py
""" This file contains 2 classes: - ParseUtils containing utilies to parse data from UR robot - SecondaryMonitor, a class opening a socket to the robot and with methods to access data and send programs to the robot Both use data from the secondary port of the URRobot. Only the last connected socket ...
20,776
45.795045
443
py
CANTM
CANTM-main/updateTopics_covid.py
import sys from GateMIcateLib import ModelUltiUpdateCAtopic as ModelUlti from GateMIcateLib import BatchIterBert, DictionaryProcess from GateMIcateLib.batchPostProcessors import bowBertBatchProcessor as batchPostProcessor from GateMIcateLib import ScholarPostProcessor as ReaderPostProcessor from GateMIcateLib.readers i...
3,093
37.675
175
py
CANTM
CANTM-main/getPerpare.py
import os import torch from transformers import * import nltk from pathlib import Path nltk.download('stopwords') nltk.download('punkt') model = BertModel.from_pretrained('bert-base-uncased') tokenizer = BertTokenizer.from_pretrained('bert-base-uncased') script_path = os.path.abspath(__file__) print(script_path) par...
753
25
62
py
CANTM
CANTM-main/raw2folds.py
import json import os import sys import random import math from pathlib import Path import copy def outputChunk(output_dir, chunkIdx, chunks): output_path = os.path.join(output_dir, str(chunkIdx)) path = Path(output_path) path.mkdir(parents=True, exist_ok=True) for i, item in enumerate(chunks): ...
1,062
22.108696
67
py
CANTM
CANTM-main/evaluation.py
import argparse import json import os from GateMIcateLib import EvaluationManager if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("trainReaderargs", help="args for train reader") parser.add_argument("--testReaderargs", help="args for test reader") parser.add_argument("...
3,273
42.653333
121
py
CANTM
CANTM-main/updateTopics.py
import sys from GateMIcateLib import ModelUltiUpdateCAtopic as ModelUlti from GateMIcateLib import BatchIterBert, DictionaryProcess from GateMIcateLib.batchPostProcessors import bowBertBatchProcessor as batchPostProcessor from GateMIcateLib import ScholarPostProcessor as ReaderPostProcessor from GateMIcateLib.readers i...
2,718
38.405797
175
py
CANTM
CANTM-main/wvCovidData/update_wv_unique_id.py
import json import re import nltk import argparse import copy import os import sys script_path = os.path.abspath(__file__) print(script_path) global parent parent = os.path.dirname(script_path) print(parent) gatePython = os.path.join(parent, 'GATEpythonInterface') sys.path.append(gatePython) from GateInterface import *...
902
19.066667
62
py
CANTM
CANTM-main/wvCovidData/downloadIFCNSource.py
import sys from bs4 import BeautifulSoup import json from selenium import webdriver from selenium.webdriver.firefox.options import Options def download_source(url): options = Options() options.headless = True driver = webdriver.Firefox(options=options) driver.get(url) html = driver.page_source ...
1,648
29.537037
116
py
CANTM
CANTM-main/wvCovidData/update_label.py
import json import re import nltk import argparse import copy import os import sys script_path = os.path.abspath(__file__) print(script_path) global parent parent = os.path.dirname(script_path) print(parent) gatePython = os.path.join(parent, 'GATEpythonInterface') sys.path.append(gatePython) from GateInterface import *...
1,941
30.322581
361
py
CANTM
CANTM-main/wvCovidData/update_type_media.py
import json import re import nltk import argparse import copy import os import sys script_path = os.path.abspath(__file__) print(script_path) global parent parent = os.path.dirname(script_path) print(parent) gatePython = os.path.join(parent, 'GATEpythonInterface') sys.path.append(gatePython) from GateInterface import *...
9,461
33.786765
115
py
CANTM
CANTM-main/wvCovidData/mergeAnnos.py
import sys from WvLibs import WVdataIter import re from itertools import combinations import argparse import json import logging global logger class Wv_loger: def __init__(self, logging_level): self.logger = logging.getLogger('root') if logging_level == 'info': self.logger.setLevel(log...
10,180
33.986254
332
py
CANTM
CANTM-main/wvCovidData/update_website.py
import json import re import nltk import sys import string import copy class MediaTypeOrg: def __init__(self): punct_chars = list(set(string.punctuation)-set("_")) print(punct_chars) punctuation = ''.join(punct_chars) self.replace = re.compile('[%s]' % re.escape(punctuation)) ...
3,918
30.352
127
py
CANTM
CANTM-main/wvCovidData/getData.py
import wget import os import zipfile script_path = os.path.abspath(__file__) print(script_path) parent = os.path.dirname(script_path) print(parent) data_url = 'https://gate.ac.uk/g8/page/show/2/gatewiki/cow/covid19catedata/covidCateData.zip' wget.download(data_url, parent) zip_path = os.path.join(parent, 'covidCateD...
411
21.888889
93
py
CANTM
CANTM-main/wvCovidData/WvLibs/WVdataIter.py
from .DataReader import DataReader import random def disagreementSolver(annotations, local_logger=None): mergeMethodList = ['single_annotation', 'all_agreement', 'majority_agreement', 'majority_confidence', 'highest_confidence'] mergeMethod = None annotation_list = [] label_list = [] annotator_list...
5,834
36.403846
171
py
CANTM
CANTM-main/wvCovidData/WvLibs/__init__.py
from .DataReader import DataReader from .WVdataIter import WVdataIter
70
22.666667
34
py
CANTM
CANTM-main/wvCovidData/WvLibs/DataReader.py
import json import glob import os import re import hashlib import logging import sys class DataReader: def __init__(self, annoed_json_dir, raw_json_dir, kwargs): self._read_input_options(kwargs) print('label ignored: ', self.ignoreLabelList) print('user ignored: ', self.ignoreUserList) ...
7,530
39.058511
107
py
CANTM
CANTM-main/wvCovidData/GATEpythonInterface/example.py
from GateInterface import * #initialise gate gate= GateInterFace() # path to gate interface, for my case is /Users/xingyi/Gate/gateCodes/pythonInferface # this will open java tcp server (on port 7899) to execute GATE operation #gate.init('/Users/xingyi/Gate/gateCodes/pythonInferface') gate.init('./') # load documen...
2,298
28.101266
106
py
CANTM
CANTM-main/wvCovidData/GATEpythonInterface/GateInterface/GateInterface.py
import socket import json import re import os import subprocess import time import signal import pathlib class MyEncoder(json.JSONEncoder): def default(self, obj): if isinstance(obj, np.integer): return int(obj) elif isinstance(obj, np.floating): return float(obj) e...
22,190
34.335987
160
py
CANTM
CANTM-main/wvCovidData/GATEpythonInterface/GateInterface/__init__.py
from .GateInterface import GateInterFace, AnnotationSet, Annotation, Node, GateDocument, GatePipeline, GateCorpus
115
37.666667
113
py
CANTM
CANTM-main/GateMIcateLib/modelUltiClassTopic.py
import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F import numpy as np import copy import os from pathlib import Path import pickle import datetime from .modelUlti import modelUlti class ModelUltiClass(modelUlti): def __init__(self, net=None, gpu=False, load_path=None): ...
11,148
37.711806
270
py
CANTM
CANTM-main/GateMIcateLib/PostprocessorBase.py
import nltk from nltk.corpus import stopwords import os import re class ReaderPostProcessorBase: def __init__(self, keep_case=False, label2id=True, config=None, word2id=False, exteralWord2idFunction=None, return_mask=False, remo...
4,597
29.25
173
py
CANTM
CANTM-main/GateMIcateLib/modelUltiUpdateCATopic.py
import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F import numpy as np import copy import os from pathlib import Path import pickle from .modelUltiClassTopic import ModelUltiClass class ModelUltiUpdateCAtopic(ModelUltiClass): def __init__(self, net=None, gpu=False, load_p...
2,399
31
125
py
CANTM
CANTM-main/GateMIcateLib/batchPostProcessors.py
import torch def xonlyBatchProcessor(x, y): ss = [s[1] for s in x] return ss[0] def bowBertBatchProcessor(raw_x, y): x = [s[0] for s in raw_x] idded_words = [s[1] for s in raw_x] y_class = y return torch.tensor(x), torch.tensor(idded_words), torch.tensor(y_class) def xyOnlyBertBatchProcessor...
508
21.130435
76
py
CANTM
CANTM-main/GateMIcateLib/modelUltiVAEtm_noatt.py
import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F import numpy as np import copy import os from pathlib import Path from .modelUlti import modelUlti class ModelUltiVAEtmNOatt(modelUlti): def __init__(self, net=None, gpu=False): super().__init__(net=net, gpu=gpu)...
6,838
38.304598
138
py
CANTM
CANTM-main/GateMIcateLib/ScholarPostProcessor.py
import nltk from nltk.corpus import stopwords import os import re from .WVPostProcessor import WVPostProcessor from transformers import BertTokenizer import glob import string from collections import Counter from nltk.tokenize import sent_tokenize punct_chars = list(set(string.punctuation) - set("'")) punct_chars.s...
7,529
34.023256
191
py
CANTM
CANTM-main/GateMIcateLib/BatchIter.py
import math import random class BatchIterBert: def __init__(self, dataIter, batch_size=32, filling_last_batch=False, postProcessor=None): self.dataIter = dataIter self.batch_size = batch_size self.num_batches = self._get_num_batches() self.filling_last_batch = filling_last_batch ...
2,508
31.166667
101
py
CANTM
CANTM-main/GateMIcateLib/DictionaryProcess.py
class DictionaryProcess: def __init__(self, common_dictionary): self.common_dictionary = common_dictionary self.num_vocab = len(self.common_dictionary) def doc2bow(self, input_doc): gensim_bow_doc = self.common_dictionary.doc2bow(input_doc) return gensim_bow_doc def doc2cou...
734
29.625
66
py
CANTM
CANTM-main/GateMIcateLib/ScholarProcessor.py
import nltk from nltk.corpus import stopwords import os import re from .PostprocessorBase import ReaderPostProcessorBase from transformers import BertTokenizer def tokenize(text, strip_html=False, lower=True, keep_emails=False, keep_at_mentions=False, keep_numbers=False, keep_alphanum=False, min_length=3, stopwords=N...
4,509
35.370968
175
py
CANTM
CANTM-main/GateMIcateLib/__init__.py
from .BatchIter import BatchIterBert from .DictionaryProcess import DictionaryProcess from .WVPostProcessor import WVPostProcessor from .ScholarPostProcessor import ScholarPostProcessor from .modelUltiClassTopic import ModelUltiClass from .modelUlti import modelUlti as ModelUlti from .EvaluationManager import Evaluatio...
388
42.222222
58
py
CANTM
CANTM-main/GateMIcateLib/modelUlti.py
import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F import numpy as np import os from pathlib import Path class modelUlti: def __init__(self, net=None, gpu=False): if net: self.net = net self.gpu = gpu if self.gpu and net: s...
8,968
35.02008
126
py
CANTM
CANTM-main/GateMIcateLib/EvaluationManager.py
import sys import nltk import math from GateMIcateLib import BatchIterBert, DictionaryProcess #from GateMIcateLib import WVPostProcessor as ReaderPostProcessor from configobj import ConfigObj import torch import argparse import copy from sklearn.model_selection import KFold import random import os from pathlib import P...
20,370
42.342553
208
py
CANTM
CANTM-main/GateMIcateLib/WVPostProcessor.py
import nltk from nltk.corpus import stopwords import os import re from .PostprocessorBase import ReaderPostProcessorBase from transformers import BertTokenizer class WVPostProcessor(ReaderPostProcessorBase): def __init__(self, x_fields=['Claim', 'Explaination'], y_field='category', **kwargs): super().__in...
2,216
37.894737
155
py
CANTM
CANTM-main/GateMIcateLib/models/CLSAW_TopicModel_simple_loss.py
import torch from torch import nn from torch.nn import init from torch.nn import functional as F import math from .miscLayer import BERT_Embedding, WVHidden, WVClassifier, Identity, Topics, kld, CLSAW_TopicModel_Base class CLSAW_TopicModelSL(CLSAW_TopicModel_Base): def __init__(self, config, vocab_dim=None): ...
6,776
35.435484
150
py
CANTM
CANTM-main/GateMIcateLib/models/CLSAW_TopicModel.py
import torch from torch import nn from torch.nn import init from torch.nn import functional as F import math from .miscLayer import BERT_Embedding, WVHidden, WVClassifier, Identity, Topics, kld, CLSAW_TopicModel_Base class CLSAW_TopicModel(CLSAW_TopicModel_Base): def __init__(self, config, vocab_dim=None): ...
7,541
35.434783
150
py
CANTM
CANTM-main/GateMIcateLib/models/CLSAW_TopicModelBertEnrich.py
import torch from torch import nn from torch.nn import init from torch.nn import functional as F import math from .miscLayer import BERT_Embedding, WVHidden, WVClassifier, Identity, Topics, kld, CLSAW_TopicModel_Base class CLSAW_TopicModel_BERTEN(CLSAW_TopicModel_Base): def __init__(self, config, vocab_dim=None):...
7,008
34.760204
150
py
CANTM
CANTM-main/GateMIcateLib/models/miscLayer.py
from transformers import BertModel import math import os import torch.nn.functional as F import torch import torch.nn as nn class SingleHeadAttention(nn.Module): def __init__(self, d_model, d_output, dropout = 0.1): super().__init__() self.q = nn.Parameter(torch.randn([d_output, 1]).float()) ...
9,182
29.407285
103
py
CANTM
CANTM-main/GateMIcateLib/models/CLSAW_TopicModel_linear.py
import torch from torch import nn from torch.nn import init from torch.nn import functional as F import math from .miscLayer import BERT_Embedding, WVHidden, WVClassifier, Identity, Topics, kld, CLSAW_TopicModel_Base class CLSAW_TopicModel(CLSAW_TopicModel_Base): def __init__(self, config, vocab_dim=None): ...
6,843
35.795699
150
py
CANTM
CANTM-main/GateMIcateLib/models/bertSimple.py
from transformers import BertModel from .miscLayer import BERT_Embedding, CLSAW_TopicModel_Base, WVHidden import os import torch.nn.functional as F import torch import torch.nn as nn class BERT_Simple(CLSAW_TopicModel_Base): def __init__(self, config, **kwargs): super().__init__(config=config) se...
1,100
25.853659
71
py
CANTM
CANTM-main/GateMIcateLib/models/bertPure.py
from transformers import BertModel from .miscLayer import BERT_Embedding, CLSAW_TopicModel_Base, WVHidden import os import torch.nn.functional as F import torch import torch.nn as nn class BERT_Simple(CLSAW_TopicModel_Base): def __init__(self, config, **kwargs): super().__init__(config=config) se...
1,102
25.902439
72
py
CANTM
CANTM-main/GateMIcateLib/models/NVDM.py
import torch from torch import nn from torch.nn import init from torch.nn import functional as F import math from .miscLayer import BERT_Embedding, WVHidden, WVClassifier, Identity, Topics, kld, CLSAW_TopicModel_Base class NVDM(CLSAW_TopicModel_Base): def __init__(self, config, vocab_dim=None): super().__...
3,804
31.801724
117
py