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
blend
blend-master/tools/meteor-1.4/scripts/meteor_shower.py
#!/usr/bin/env python # Learn Meteor parameters quickly with up to 42 Meteors # Run as many as requeted in parallel # Meteors use 1 cpu / 2gb each import collections, os, subprocess, sys, threading def main(argv): if len(argv[1:]) < 7: print >> sys.stderr, 'Learn Meteor parameters efficiently with p...
2,954
32.579545
328
py
blend
blend-master/tools/meteor-1.4/scripts/bleu.py
#!/usr/bin/env python import codecs, os, shutil, subprocess, sys, tempfile mteval_pl = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'mt-diff', 'files', 'mteval-v13m.pl') def main(argv): if len(argv[1:]) < 2: print 'Score with NIST BLEU' print '' print 'usage: {0} <hyp> ...
1,540
25.568966
78
py
blend
blend-master/tools/meteor-1.4/scripts/filter_merge_rank_set.py
#!/usr/bin/env python # Filter and merge multiple rank training sets into a single set. Segments are # relabeled by original data set and renumbered after filtering. The resulting # combined set contains only segments for which rank judgments exist. # Filtering is highly recommended even for single sets to greatly ...
2,940
33.6
84
py
blend
blend-master/tools/meteor-1.4/scripts/wmt_fmt.py
#!/usr/bin/env python # Read Meteor output, write to WMT score format import os, sys def main(argv): if len(argv[1:]) < 3: print 'usage: {0} <lang-pair> <test-set> <system> [metric]'.format( argv[0]) print 'writes metric.lang-pair.test-set.system.{seg.scr,sys.scr}' print ''...
1,447
25.814815
79
py
blend
blend-master/tools/meteor-1.4/xray/Generation.py
import re, shutil, subprocess, sys, tempfile from MeteorAlignment import * # Edit as needed xelatex_cmd = '/usr/bin/xelatex' # Edit as needed gnuplot_cmd = '/usr/bin/gnuplot' def check_xelatex(): if not shutil.os.path.exists(xelatex_cmd): print 'Could not find xelatex_cmd \'{0}\''.format(xelatex_cmd) ...
11,189
29.407609
185
py
blend
blend-master/tools/meteor-1.4/xray/MeteorAlignment.py
import math ALIGN_DEFAULT = 1 ALIGN_METEOR = 2 MATCH_TYPES = ['ex', 'ap', 'ap', 'ap', 'rm'] NO_MATCH = 'blank' class ScoredAlignment(object): name = '' sen1 = [] sen2 = [] p = 0.0 r = 0.0 frag = 0.0 score = 0.0 matrix = [[]] sen1_matched = [] def __init__(self, align_in=None...
3,837
25.468966
72
py
blend
blend-master/tools/meteor-1.4/xray/xray.py
#!/usr/bin/env python import optparse, shutil, subprocess, sys, tempfile from MeteorAlignment import * from Generation import * def main(argv): if not (check_xelatex() and check_gnuplot()): sys.exit(1) # Options opt = optparse.OptionParser( \ usage='Usage: %prog [options] <align.out> [ali...
7,705
37.148515
98
py
blend
blend-master/tools/meteor-1.4/xray/visualize_alignments.py
#!/usr/bin/env python import sys from MeteorAlignment import * from Generation import * def main(argv): if not check_xelatex(): sys.exit() if len(argv[1:]) < 2: print 'usage: {0} <align.out> <prefix> [max]'.format(argv[0]) print 'writes: <prefix>.pdf, <prefix>.tex' print 'ma...
1,274
26.12766
87
py
blend
blend-master/tools/meteor-1.5/mt-diff/mt-diff.py
#!/usr/bin/env python import math, os, re, shutil, subprocess, sys, tempfile # MT-Diff: measure changes in segment-level quality between two systems # according to BLEU and Meteor bleu_script = os.path.abspath(os.path.join(os.path.dirname(__file__), \ 'files', 'mteval-v13m.pl')) meteor_jar = os.path.abspath(os.pat...
6,507
31.217822
111
py
blend
blend-master/tools/meteor-1.5/scripts/build_wordnet_files.py
#!/usr/bin/env python import os, sys # Set for WordNet3 excFiles = ["adj.exc", "adv.exc", "noun.exc", "verb.exc"] senseFile = "index.sense" nounFile = "data.noun" verbFile = "data.verb" adjFile = "data.adj" nounRelations = ["@", "@i", "~", "~i"] # Hypernym (instance), Hyponym (instance) verbRelations = ["@", "~",...
3,141
24.136
80
py
blend
blend-master/tools/meteor-1.5/scripts/wmt_bleu.py
#!/usr/bin/env python # Score with BLEU, produce WMT score files import os, subprocess, sys def main(argv): if len(argv[1:]) < 5: print 'usage: {0} <test> <ref> <lang-pair> <test-set> <system>'.format( argv[0]) print 'writes bleu.lang-pair.test-set.system.{seg.scr,sys.scr}' ...
1,420
24.375
85
py
blend
blend-master/tools/meteor-1.5/scripts/combine_segcor_trainset.py
#!/usr/bin/env python import os, shutil, sys def main(argv): if len(argv) < 3: print "Create a single Meteor training set from HTER test sets" print "usage:", argv[0], "<outDir> <hterDir1> [hterDir2] ..." sys.exit(1) outDir = argv[1] hterDirs = argv[2:] if os.path.exists(outDir): print "File", outDir, ...
780
24.193548
70
py
blend
blend-master/tools/meteor-1.5/scripts/sgmlize.py
#!/usr/bin/env python # Convert to and from SGML easily. There exist many SGML/XML standards # for MT evaulation. This script produces files in a format compatible # with meteor-*.jar, mteval-v*.pl, and tercom.*.jar import codecs, re, sys sys.stdin = codecs.getreader('utf-8')(sys.stdin) sys.stdout = codecs.getwrit...
1,881
30.366667
84
py
blend
blend-master/tools/meteor-1.5/scripts/unroll_wmt_ranks.py
#!/usr/bin/env python import sys LANGS = { 'cs': 'Czech', 'en': 'English', 'es': 'Spanish', 'de': 'German', 'fr': 'French', 'hi': 'Hindi', 'ru': 'Russian', } N_SYSTEMS = 5 def main(argv): if len(argv[1:]) != 1: sys.stderr.write('usage:...
1,679
27.474576
142
py
blend
blend-master/tools/meteor-1.5/scripts/delete_stray_matches.py
#!/usr/bin/env python import re, sys DEFAULT_DIST = 0.0 DEFAULT_LEN = 0 def main(argv): # Directions if len(argv[1:]) < 1: sys.stderr.write('Using defaults - for help, use {0} -h\n'.format(argv[0])) min_dist = DEFAULT_DIST min_len = DEFAULT_LEN words = [] # help or min distance...
4,642
33.909774
83
py
blend
blend-master/tools/meteor-1.5/scripts/agg.py
#!/usr/bin/env python # Aggregate: sum input lines by column. Useful for aggregating # MeteorStats lines as a MERT implementation would. from sys import argv, exit, stdin parse = int if len(argv) > 1: if argv[1].startswith('-h'): print 'usage: agg [-f] FILE' exit() if argv[1] == '-f': ...
814
19.375
63
py
blend
blend-master/tools/meteor-1.5/scripts/freq.py
#!/usr/bin/env python # Simple word relative frequency counter. Used to create # function word lists. from sys import stdin, argv freq = {} total = 0 if argv[1:]: stdin = open(argv[1], 'r') while True: line = stdin.readline() if not line: break f = line.split() for w in f: freq...
476
18.08
57
py
blend
blend-master/tools/meteor-1.5/scripts/ter.py
#!/usr/bin/env python import os, subprocess, shutil, sys, tempfile TERCOM = os.path.join(os.path.dirname(__file__), 'tercom-0.8.0.jar') def main(argv): if len(argv[1:]) < 2: print >> sys.stderr, 'Usage: {0} hyps refs [--no-norm] [--char]'.format(argv[0]) print >> sys.stderr, 'Segment scores to s...
1,644
26.416667
88
py
blend
blend-master/tools/meteor-1.5/scripts/rankconsist.py
#!/usr/bin/env python import collections import sys def main(argv): if len(argv[1:]) != 2: sys.stderr.write('usage: {} scr rank\n'.format(argv[0])) sys.exit(2) scr = collections.defaultdict(lambda: collections.defaultdict(dict)) for line in open(argv[1]): # Meteor en-ru news...
976
25.405405
72
py
blend
blend-master/tools/meteor-1.5/scripts/meteor_shower.py
#!/usr/bin/env python # Learn Meteor parameters quickly with up to 42 Meteors # Run as many as requeted in parallel # Meteors use 1 cpu / 2gb each import collections, os, subprocess, sys, threading def main(argv): if len(argv[1:]) < 7: print >> sys.stderr, 'Learn Meteor parameters efficiently with p...
2,952
32.556818
305
py
blend
blend-master/tools/meteor-1.5/scripts/meteorToMosesAlign.py
#!/usr/bin/env python # Author: Austin Matthews import sys for Line in sys.stdin: Line = Line.strip() if Line.startswith( "Alignment" ): sys.stdin.next() # Hyp sys.stdin.next() # Ref sys.stdin.next() # Table header Alignments = [] for Line in sys.stdin: Line = Line.strip() if not Line: break ...
834
23.558824
69
py
blend
blend-master/tools/meteor-1.5/scripts/wmt_ter.py
#!/usr/bin/env python import os, subprocess, sys def main(argv): if len(argv[1:]) < 5: print 'usage: {0} <test> <ref> <lang-pair> <test-set> <system>'.format( argv[0]) print 'writes ter.lang-pair.test-set.system.{seg.scr,sys.scr}' sys.exit(1) BLEU = [os.path.join(os...
1,370
24.388889
84
py
blend
blend-master/tools/meteor-1.5/scripts/bleu.py
#!/usr/bin/env python import os, shutil, subprocess, sys, tempfile mteval_pl = os.path.abspath(os.path.join(os.path.dirname(__file__), 'mteval-v13m.pl')) def main(argv): if len(argv[1:]) < 2: print >> sys.stderr, 'Usage: {0} <hyp> <ref> [--no-norm] [--char]'.format(argv[0]) print >> sys.stde...
1,979
30.428571
91
py
blend
blend-master/tools/meteor-1.5/scripts/filter_merge_rank_set.py
#!/usr/bin/env python # Filter and merge multiple rank training sets into a single set. Segments are # relabeled by original data set and renumbered after filtering. The resulting # combined set contains only segments for which rank judgments exist. # Filtering is highly recommended even for single sets to greatly ...
2,869
32.372093
84
py
blend
blend-master/tools/meteor-1.5/scripts/tc_train_set.py
#!/usr/bin/env python import os import sys ID = 'ID' MT = 'MT' SCORES = ('HTER', 'Rating') NORM_SCORES = ('Keypress', 'Edits', 'Time') PAUSE_SCORES = ('APR', 'PWR') class DataSet: def __init__(self, dir): os.mkdir(dir) self.tst = open(os.path.join(dir, 'corpus.tst'), 'w') self.ref = open...
4,189
39.679612
122
py
blend
blend-master/tools/meteor-1.5/scripts/new_language.py
#!/usr/bin/env python import codecs import glob import gzip import os import shutil import subprocess import sys METEOR_JAR = glob.glob(os.path.join(os.path.dirname(os.path.dirname(__file__)), 'meteor-*.jar'))[0] JVM_SIZE = '12G' def lower(in_f, out_f, limit=None): inp = gzip.open(in_f) if in_f.endswith('.gz') ...
2,698
32.320988
160
py
blend
blend-master/tools/meteor-1.5/scripts/wmt_fmt.py
#!/usr/bin/env python # Read Meteor output, write to WMT score format import os, sys def main(argv): if len(argv[1:]) < 3: print 'usage: {0} <lang-pair> <test-set> <system> [metric]'.format( argv[0]) print 'writes metric.lang-pair.test-set.system.{seg.scr,sys.scr}' print ''...
1,447
25.814815
79
py
blend
blend-master/tools/meteor-1.5/xray/Generation.py
import re, shutil, subprocess, sys, tempfile from MeteorAlignment import * # Edit as needed xelatex_cmd = '/usr/bin/xelatex' # Edit as needed gnuplot_cmd = '/usr/bin/gnuplot' def check_xelatex(): if not shutil.os.path.exists(xelatex_cmd): print 'Could not find xelatex_cmd \'{0}\''.format(xelatex_cmd) ...
11,189
29.407609
185
py
blend
blend-master/tools/meteor-1.5/xray/MeteorAlignment.py
import math ALIGN_DEFAULT = 1 ALIGN_METEOR = 2 MATCH_TYPES = ['ex', 'ap', 'ap', 'ap', 'rm'] NO_MATCH = 'blank' class ScoredAlignment(object): name = '' sen1 = [] sen2 = [] p = 0.0 r = 0.0 frag = 0.0 score = 0.0 matrix = [[]] sen1_matched = [] def __init__(self, align_in=None...
3,837
25.468966
72
py
blend
blend-master/tools/meteor-1.5/xray/xray.py
#!/usr/bin/env python import optparse, shutil, subprocess, sys, tempfile from MeteorAlignment import * from Generation import * def main(argv): if not (check_xelatex() and check_gnuplot()): sys.exit(1) # Options opt = optparse.OptionParser( \ usage='Usage: %prog [options] <align.out> [ali...
7,705
37.148515
98
py
blend
blend-master/tools/meteor-1.5/xray/visualize_alignments.py
#!/usr/bin/env python import sys from MeteorAlignment import * from Generation import * def main(argv): if not check_xelatex(): sys.exit() if len(argv[1:]) < 2: print 'usage: {0} <align.out> <prefix> [max]'.format(argv[0]) print 'writes: <prefix>.pdf, <prefix>.tex' print 'ma...
1,274
26.12766
87
py
blend
blend-master/scripts/form-meteor-score.py
import sys predir = sys.argv[1] tst = sys.argv[2] tstname = tst[5:-4] # rm data/, .sgm def form_score(inf, outf): fout = open(predir + outf, 'w') for idx, line in enumerate(open(inf, 'rU')): score = line.split()[-1] fout.write(score + "\n") fout.close() if __name__ == '__main__'...
530
25.55
51
py
blend
blend-master/scripts/form-gtm-score.py
import sys predir = sys.argv[1] tst = sys.argv[2] tmpdir = './tmp/' tstname = tst[5:-4] # rm data/, .sgm def form_score(inf, outf): fout = open(predir + outf, 'w') for idx, line in enumerate(open(tmpdir + inf, 'rU')): if 'doc "' in line: score = line.split()[-1] fout.writ...
511
21.26087
57
py
blend
blend-master/scripts/form-terp-score.py
import sys predir = sys.argv[1] tst = sys.argv[2] tstname = tst[5:-4] # rm data/, .sgm def form_score(inf, outf): fout = open(predir + outf, 'w') for idx, line in enumerate(open(inf, 'rU')): score = line.split()[-2] fout.write('-' + score + "\n") fout.close() if __name__ == '__m...
508
24.45
48
py
blend
blend-master/scripts/form-bleunist-score.py
import sys predir = sys.argv[1] tst = sys.argv[2] inf_bleu = 'BLEU-seg.scr' inf_nist = 'NIST-seg.scr' tstname = tst[5:-4] # rm data/ .sgm fo_bleu = open(predir + tstname + ".BLEU", 'w') fo_nist = open(predir + tstname + ".NIST", 'w') for idx, line in enumerate(open(inf_bleu, 'rU')): score = line.split()[-1] ...
495
19.666667
49
py
blend
blend-master/scripts/form-rouge-score.py
import sys predir = sys.argv[1] tst = sys.argv[2] tstname = tst[5:] # rm data/ inf = 'ROUGE' predir += tstname fout1 = open(predir + '.ROUGE-1', 'w') fout2 = open(predir + '.ROUGE-2', 'w') fout3 = open(predir + '.ROUGE-3', 'w') fout4 = open(predir + '.ROUGE-4', 'w') foutL = open(predir + '.ROUGE-L', 'w') foutS = op...
1,187
23.75
44
py
marabunta
marabunta-master/setup.py
import os # from setuptools import setup from distutils.core import setup def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() setup( name='marabunta', version='1.0', description='Library for design and control of artificial swarms.', long_description=read("READM...
578
29.473684
74
py
marabunta
marabunta-master/examples/dr4/dr4_demo.py
from marabunta import * from marabunta.models import PerimeterDefenseRobot from math import * from time import time,sleep import sys import threading from settings import s class CustomRobot(PerimeterDefenseRobot): def update(self, deltat, v=None): """Same as PerimeterDefenseRobot except that if t...
3,266
30.114286
87
py
marabunta
marabunta-master/examples/dr4/settings.py
from math import pi s={} s["ID"]="RXX" s["position"] = [0., 0.] s["heading"] = 0. s["slot"] = 0.1 #s["calibration"] = [ 0000 , 0000 ]
135
14.111111
35
py
marabunta
marabunta-master/examples/dr4/dr4_simula.py
from marabunta import MockBody, MockNetwork from marabunta.models import PerimeterDefenseRobot from math import * from time import time,sleep import sys import threading #from settings import s dt=0.2 total_time = 5 * 60 speed=0.15 log = open("the_cloud.dat","w+") settings = [] settings.append( {"ID":1 , "position":[...
2,610
36.84058
136
py
marabunta
marabunta-master/examples/dr3/settings.py
from math import pi s={} s["ID"]="RXX" s["position"] = [0., 0.] s["heading"] = 0. s["slot"] = 0.1
99
11.5
24
py
marabunta
marabunta-master/examples/dr3/leader.py
from marabunta import BaseRobot, ebotBody, XBeeNetwork, XBeeExpirationNetwork from math import * from time import time,sleep import sys from threading import Lock from settings import s class Leader(BaseRobot): def update(self, deltat, v=None): self.broadcast_state() if self.obstacle_infront(): ...
1,679
22.333333
77
py
marabunta
marabunta-master/examples/dr3/heading.py
from marabunta import ebotBody, XBeeNetwork, XBeeExpirationNetwork from marabunta.models import PerimeterDefenseRobot from math import * from time import time,sleep import sys from threading import Lock from settings import s dt=0.05 total_time = 50 speed=0.15 try: num_friends = float(sys.argv[1])-1 except: n...
1,251
22.622642
69
py
marabunta
marabunta-master/examples/dr3/dr3_demo.py
from marabunta import ebotBody, XBeeNetwork from marabunta.models import PerimeterDefenseRobot from math import * from time import time,sleep import sys from threading import Lock from settings import s dt=0.05 total_time = 60 speed=0.15 try: num_friends = float(sys.argv[1])-1 except: num_friends = 4-1 # The...
1,236
21.490909
69
py
marabunta
marabunta-master/examples/spreading/spreading.py
from marabunta import MockBody, MockNetwork from marabunta.models import PerimeterDefenseRobot dt=1.0 log = open("the_cloud.dat","w+") settings = [] settings.append( {"ID":1 , "pos":[ 0., 0.] , "heading":0.} ) settings.append( {"ID":2 , "pos":[ 2., 0.] , "heading":0.} ) settings.append( {"ID":3 , "pos":[ 0.,-1.] , "h...
874
26.34375
60
py
marabunta
marabunta-master/examples/labyrinth/labyrinth.py
from marabunta import BaseRobot, MockBody, MockNetwork import random # for visualization import numpy as np import pylab as pl class myRobot(BaseRobot): def __init__(self, setting): body = MockBody(setting.get("position") ,setting.get("heading")) network = MockNetwork(setting.get("ID")) Ba...
3,153
28.754717
112
py
marabunta
marabunta-master/marabunta/BaseRobot.py
# import math as m from math import pi, sin, cos, atan2, sqrt import threading from time import sleep, time from utils import clean_angle class BaseRobot(object): """Base class of Robot containing the basic tools to operate a swarming robot. It requires a *body* instance that is inherits from BaseBody...
17,457
34.411765
79
py
marabunta
marabunta-master/marabunta/MockBody.py
from math import sin, cos, sqrt from BaseRobot import BaseBody from Map import Map2D class MockBody(BaseBody): """Simulation of a body. Locomotion with this body is simply updating the values of *pos* and *heading*. Sensors simulated through a Map instance that contains the obstacles to be detecte...
3,667
30.084746
74
py
marabunta
marabunta-master/marabunta/eBotBody.py
from math import atan2, sin, cos, pi from eBot import eBot from BaseRobot import BaseBody import threading from time import time, sleep import sys from utils import clean_angle class eBotBody(BaseBody, eBot.eBot): """Body class for controlling an eBot (see https://github.com/EdgeBotix/docs) by using its pytho...
12,305
32.440217
81
py
marabunta
marabunta-master/marabunta/utils.py
from serial import Serial import thread import threading from math import pi def clean_angle(th): """Return the angle th wrapped into the range [-pi,pi]. """ while th > pi: th -= 2 * pi while th < -pi: th += 2 * pi return th class SafeSerial(Serial): """Extension of seria...
1,410
24.196429
59
py
marabunta
marabunta-master/marabunta/Map.py
class Map2D(object): """Store the position of obstacles in a grid. Right now it can only load from a single file. The list of all obstacles is stored in self.obstacles and a grid with the obstacles near each part of the space is stored in self.grid. The obstacles are input through *data*. Th...
5,286
33.555556
77
py
marabunta
marabunta-master/marabunta/MockNetwork.py
from random import randint from time import time from BaseRobot import BaseNetwork import glob import sys class MockNetwork(BaseNetwork): """Simulate communication between agents by using the filesystem. All the agents should share a common file where they check who is currently broadcasting and w...
7,194
32.156682
79
py
marabunta
marabunta-master/marabunta/example_ePuckBody.py
from math import * from time import sleep, time from BaseRobot import BaseBody from ePuck import ePuck class ePuckBody(BaseBody,ePuck): """Example of a minimal Body implementation for the ePuck using its Python API, see https://github.com/mmartinortiz/pyePuck . This is meant to illustrate how to i...
5,063
33.924138
84
py
marabunta
marabunta-master/marabunta/__init__.py
from BaseRobot import BaseRobot, BaseBody, BaseNetwork from MockBody import MockBody from MockNetwork import MockNetwork from Map import Map2D import imp __all__ = ['BaseRobot', 'BaseBody', 'BaseNetwork', 'MockBody', 'MockNetwork', 'Map2D'] # Include eBotBody only if eBot-API is installed try: ...
839
23.705882
62
py
marabunta
marabunta-master/marabunta/XBeeNetwork.py
from random import randint from time import time, sleep import threading import Queue import glob import sys from BaseRobot import BaseNetwork from utils import SafeSerial from serial import Serial class XBeeNetwork(BaseNetwork): """Network class for communication using XBee series 1 connected as a serial por...
15,757
35.476852
79
py
marabunta
marabunta-master/marabunta/models/HeadingConsensusRobot.py
from marabunta import BaseRobot from math import sin,cos,pi class HeadingConsensusRobot(BaseRobot): """Robot model for heading consensus. By iteratively calling the update() method, this robot will communicate with the rest of the swarm and align its heading to the swarm's mean heading. Obstacl...
2,310
31.549296
59
py
marabunta
marabunta-master/marabunta/models/PerimeterDefenseRobot.py
from marabunta import BaseRobot from math import * class PerimeterDefenseRobot(BaseRobot): """Robot model for perimeter defense. By iteratively calling the update() method, this robot will communicate with the rest of the swarm and move away from the others as far as possible. Takes a *threshold* ...
7,197
35.170854
94
py
marabunta
marabunta-master/marabunta/models/AreaCoverageRobot.py
from math import * from marabunta.models import PerimeterDefenseRobot class AreaCoverageRobot(PerimeterDefenseRobot): """Robot model for perimeter defense. By iteratively calling the update() method, this robot will communicate with the rest of the swarm and move away from the others as far as poss...
2,879
35
101
py
marabunta
marabunta-master/marabunta/models/MarchingRobot.py
from marabunta import BaseRobot from math import * class MarchingRobot(BaseRobot): """Robot model for marching algorithm. By iteratively calling the update() method, this robot will communicate with the rest of the swarm and move in a way that simulatenouslty tries to [Spread] stay away fro...
4,687
36.206349
96
py
marabunta
marabunta-master/marabunta/models/__init__.py
from HeadingConsensusRobot import HeadingConsensusRobot from PerimeterDefenseRobot import PerimeterDefenseRobot from AreaCoverageRobot import AreaCoverageRobot from MarchingRobot import MarchingRobot __all__ = ['HeadingConsensusRobot', 'PerimeterDefenseRobot', 'AreaCoverageRobot', 'MarchingRobot']
315
38.5
60
py
HEPnOS-Autotuning
HEPnOS-Autotuning-main/hepnos_theta/extend_with_constants.py
import pandas as pd HP_DEFAULT_VALUES = { "hepnos_num_threads": 31, "hepnos_num_databases": 1, "busy_spin": False, "loader_progress_thread": False, "loader_batch_size": 1024, "enable_pep": False, "pep_num_threads": 31, "pep_ibatch_size": 32, "pep_obatch_size": 32, "pep_use_prelo...
984
24.25641
96
py
HEPnOS-Autotuning
HEPnOS-Autotuning-main/hepnos_theta/run_exp.py
""" python -m hepnos_theta.run_exp -w exp/exp-test -q debug-cache-quad -t 60 -A radix-io -n 8 --nodes-per-task 4 -as ./SetUpEnv.sh --run hepnos_theta.run.run --problem hepnos_theta.problem.Problem --fit-search-space exp/ """ import os import argparse import pathlib import stat from jinja2 import Template HERE = os.pat...
4,718
39.333333
216
py
HEPnOS-Autotuning
HEPnOS-Autotuning-main/hepnos_theta/problem.py
import os from deephyper.problem import HpProblem Problem = HpProblem(seed=2021) # the following is the old definition of the Problem """ # 1. step Problem.add_hyperparameter((0, 31), "hepnos_num_threads") Problem.add_hyperparameter((1, 10), "hepnos_num_databases") Problem.add_hyperparameter([True, False], "busy_spin...
4,467
44.131313
84
py
HEPnOS-Autotuning
HEPnOS-Autotuning-main/hepnos_theta/run_test.py
import re import subprocess def __make_node_list(nodes): if nodes is None: return None result = [] for n in nodes: m = re.search('([0-9]+)', n) result.append(str(int(str(m.group(0))))) return result def run(config, nodes=None): val = config["loader_batch_size"] num_node...
842
32.72
104
py
HEPnOS-Autotuning
HEPnOS-Autotuning-main/hepnos_theta/run.py
import os, uuid import copy import json import re from shutil import copyfile def __setup_directory(id_=None): if id_ == None: id_ = uuid.uuid4() exp_dir = 'exp-' + str(id_) os.mkdir(exp_dir) cwd = os.getcwd() return cwd + '/' + exp_dir def __make_node_list(nodes): if nodes is None: ...
15,785
37.881773
79
py
HEPnOS-Autotuning
HEPnOS-Autotuning-main/hepnos_theta/test_corr.py
import os import ray import pandas as pd from hepnos_theta.run import run from hepnos_theta.problem import Problem settings = { "num_cpus": 0.25, "num_samples": 50 } # settings = { # "num_cpus": 1, # "num_samples": 5 # } # debug ray.init(address="auto") run_func = ray.remote(num_cpus=settings["num_...
1,044
23.302326
69
py
HEPnOS-Autotuning
HEPnOS-Autotuning-main/hepnos_theta/__init__.py
0
0
0
py
HEPnOS-Autotuning
HEPnOS-Autotuning-main/hepnos_theta/scripts/old_scripts/latest/problem_v31_constraint.py
from deephyper.problem import HpProblem import ConfigSpace as cs import ConfigSpace.hyperparameters as CSH Problem = HpProblem(seed=45) #Problem.add_dim('units', (1, 100)) #Problem.add_dim('activation', ['NA', 'relu', 'sigmoid', 'tanh']) #Problem.add_dim('lr', (0.0001, 1.)) # parameters ''' Number of threads: the n...
3,074
37.4375
212
py
HEPnOS-Autotuning
HEPnOS-Autotuning-main/hepnos_theta/scripts/old_scripts/latest/model_run_v3.py
import os, uuid import yaml from shutil import copyfile import numpy as np import time def __setup_directory(): exp_dir = 'exp-' + str(uuid.uuid4())[0:8] os.mkdir(exp_dir) cwd = os.getcwd() return cwd + '/' + exp_dir def __create_settings(exp_dir, loader_batch_size, loader_progress_thread, ...
6,642
39.754601
123
py
HEPnOS-Autotuning
HEPnOS-Autotuning-main/hepnos_theta/scripts/old_scripts/latest/problem_v3.py
from deephyper.problem import HpProblem Problem = HpProblem() #Problem.add_dim('units', (1, 100)) #Problem.add_dim('activation', ['NA', 'relu', 'sigmoid', 'tanh']) #Problem.add_dim('lr', (0.0001, 1.)) # parameters ''' Number of threads: the number of threads that a server can use, not including the progress thread....
2,473
39.557377
212
py
HEPnOS-Autotuning
HEPnOS-Autotuning-main/hepnos_theta/scripts/old_scripts/working_ray_not_setup/problem.py
from deephyper.problem import HpProblem Problem = HpProblem() # parameters ''' Number of threads: the number of threads that a server can use, not including the progress thread. Since 2 servers are deployed on each node, this number can range from 0 to 31. Number of databases: the number of databases per server for ...
1,681
41.05
212
py
HEPnOS-Autotuning
HEPnOS-Autotuning-main/hepnos_theta/scripts/old_scripts/working_ray_not_setup/model_run.py
import os, uuid import yaml from shutil import copyfile import numpy as np import time def __setup_directory(): exp_dir = 'exp-' + str(uuid.uuid4())[0:8] os.mkdir(exp_dir) cwd = os.getcwd() return cwd + '/' + exp_dir def __create_settings(exp_dir, loader_batch_size, loader_progress_thread, ...
5,212
36.775362
115
py
HEPnOS-Autotuning
HEPnOS-Autotuning-main/plots/generate_plot.py
import os import pathlib import matplotlib import matplotlib.pyplot as plt import matplotlib.ticker as ticker import yaml import pandas as pd import inspect from scipy import stats import numpy as np try: from yaml import CLoader as Loader except ImportError: from yaml import Loader width = 8 height = width ...
8,900
29.27551
82
py
HEPnOS-Autotuning
HEPnOS-Autotuning-main/hepnos_bebop/extend_with_constants.py
import pandas as pd HP_DEFAULT_VALUES = { "hepnos_num_threads": 31, "hepnos_num_databases": 1, "busy_spin": False, "loader_progress_thread": False, "loader_batch_size": 1024, "enable_pep": False, "pep_num_threads": 31, "pep_ibatch_size": 32, "pep_obatch_size": 32, "pep_use_prelo...
984
24.25641
96
py
HEPnOS-Autotuning
HEPnOS-Autotuning-main/hepnos_bebop/run_exp.py
""" python -m hepnos_bebop.run_exp -w exp/exp-test -q bdw -t 60 -A radix-io -n 8 --nodes-per-task 4 -as ./SetUpEnv.sh --run hepnos_bebop.run.run --problem hepnos_bebop.problem.Problem --fit-search-space exp/ """ import os import argparse import pathlib import stat from jinja2 import Template HERE = os.path.dirname(os....
4,714
38.957627
203
py
HEPnOS-Autotuning
HEPnOS-Autotuning-main/hepnos_bebop/problem.py
import os from deephyper.problem import HpProblem Problem = HpProblem(seed=2021) # the following is the old definition of the Problem """ # 1. step Problem.add_hyperparameter((0, 31), "hepnos_num_threads") Problem.add_hyperparameter((1, 10), "hepnos_num_databases") Problem.add_hyperparameter([True, False], "busy_spin...
4,467
44.131313
84
py
HEPnOS-Autotuning
HEPnOS-Autotuning-main/hepnos_bebop/run.py
import os, uuid import copy import json import re from shutil import copyfile def __setup_directory(id_=None): if id_ == None: id_ = uuid.uuid4() exp_dir = 'exp-' + str(id_) os.mkdir(exp_dir) cwd = os.getcwd() return cwd + '/' + exp_dir def __make_node_list(nodes): if nodes is None: ...
16,025
37.898058
79
py
HEPnOS-Autotuning
HEPnOS-Autotuning-main/hepnos_bebop/__init__.py
0
0
0
py
StatisticalClearSky
StatisticalClearSky-master/setup.py
"""A setuptools based setup module. See: https://packaging.python.org/en/latest/distributing.html https://github.com/pypa/sampleproject """ # Always prefer setuptools over distutils from pathlib import Path import subprocess from setuptools import setup, find_packages # io.open is needed for projects that support Pyt...
9,720
42.397321
122
py
StatisticalClearSky
StatisticalClearSky-master/statistical_clear_sky/dataviewer.py
# -*- coding: utf-8 -*- """ This module contains the a data viewer class for data set investigation. """ from statistical_clear_sky.utilities.data_loading import load_results from statistical_clear_sky.utilities.data_loading import load_sys from statistical_clear_sky.algorithm.iterative_fitting import IterativeFitting ...
17,012
40.800983
159
py
StatisticalClearSky
StatisticalClearSky-master/statistical_clear_sky/configuration.py
CONFIG1 = { 'mu_l': 5e3, 'mu_r': 1e3, 'tau': 0.9, 'exit_criterion_epsilon': 5e-3, 'max_iteration': 10, 'min_degradation': None, 'max_degradation': None }
182
17.3
35
py
StatisticalClearSky
StatisticalClearSky-master/statistical_clear_sky/__init__.py
from statistical_clear_sky.algorithm.iterative_fitting import IterativeFitting from statistical_clear_sky.algorithm.iterative_fitting import IterativeFitting as SCSF
165
82
86
py
StatisticalClearSky
StatisticalClearSky-master/statistical_clear_sky/utilities/data_loading.py
import numpy as np import pandas as pd TZ_LOOKUP = { 'America/Anchorage': 9, 'America/Chicago': 6, 'America/Denver': 7, 'America/Los_Angeles': 8, 'America/New_York': 5, 'America/Phoenix': 7, 'Pacific/Honolulu': 10 } def load_results(): base = 's3://pvinsight.nrel/output/' nrel_data...
2,483
34.485714
111
py
StatisticalClearSky
StatisticalClearSky-master/statistical_clear_sky/utilities/progress.py
import sys def progress(count, total, status='', bar_length=60): """ Python command line progress bar in less than 10 lines of code. · GitHub https://gist.github.com/vladignatyev/06860ec2040cb497f0f3 :param count: the current count, int :param total: to total count, int :param status: a messag...
648
31.45
76
py
StatisticalClearSky
StatisticalClearSky-master/statistical_clear_sky/utilities/data_conversion.py
import pandas as pd def make_time_series(df, return_keys=True, localize_time=-8, filter_length=200): ''' Accepts a Pandas data frame extracted from the Cassandra database. Returns a data frame with a single timestamp index and the data from different systems split into columns. :param df: A Pandas data...
2,379
49.638298
115
py
StatisticalClearSky
StatisticalClearSky-master/statistical_clear_sky/utilities/__init__.py
0
0
0
py
StatisticalClearSky
StatisticalClearSky-master/statistical_clear_sky/utilities/filters.py
import numpy as np import matplotlib.pyplot as plt import cvxpy as cvx def lowpass_2d(data, r=25): fs = np.fft.fft2(data) fltr = np.zeros_like(data, dtype=np.float) m, n = data.shape c = (m // 2, n // 2) if m % 2 == 0: di = 0 else: di = 1 if n % 2 == 0: dj = 0 el...
2,156
32.703125
118
py
StatisticalClearSky
StatisticalClearSky-master/statistical_clear_sky/algorithm/iterative_fitting.py
""" This module defines "Statistical Clear Sky Fitting" algorithm. """ from time import time import numpy as np from numpy.linalg import norm import cvxpy as cvx from collections import defaultdict from\ statistical_clear_sky.algorithm.initialization.singular_value_decomposition\ import SingularValueDecomposition fr...
36,042
42.530193
111
py
StatisticalClearSky
StatisticalClearSky-master/statistical_clear_sky/algorithm/exception.py
""" Defines exceptions used in the context of this module "algorithm" """ class ProblemStatusError(Exception): """Error thrown when SCSF algorithm experiences something other than an 'optimal' problem status during one of the solve steps."""
255
27.444444
72
py
StatisticalClearSky
StatisticalClearSky-master/statistical_clear_sky/algorithm/__init__.py
0
0
0
py
StatisticalClearSky
StatisticalClearSky-master/statistical_clear_sky/algorithm/minimization/right_matrix_no_constraints.py
""" This module defines functionality unique to right matrix minimization. """ import cvxpy as cvx from statistical_clear_sky.algorithm.minimization.abstract\ import AbstractMinimization from statistical_clear_sky.algorithm.exception import ProblemStatusError class RightMatrixModifiedMinimization(AbstractMinimization...
5,241
40.936
97
py
StatisticalClearSky
StatisticalClearSky-master/statistical_clear_sky/algorithm/minimization/right_matrix.py
""" This module defines functionality unique to right matrix minimization. """ import cvxpy as cvx from statistical_clear_sky.algorithm.minimization.abstract\ import AbstractMinimization from statistical_clear_sky.algorithm.exception import ProblemStatusError class RightMatrixMinimization(AbstractMinimization): "...
4,734
40.535088
97
py
StatisticalClearSky
StatisticalClearSky-master/statistical_clear_sky/algorithm/minimization/abstract.py
""" This module defines common functionality of minimization problem solution process. Since there is common code for minimization of both L matrix and R matrix, the common code is placed in the abstract base class. """ from abc import abstractmethod import cvxpy as cvx import numpy as np class AbstractMinimization()...
3,873
36.25
95
py
StatisticalClearSky
StatisticalClearSky-master/statistical_clear_sky/algorithm/minimization/__init__.py
0
0
0
py
StatisticalClearSky
StatisticalClearSky-master/statistical_clear_sky/algorithm/minimization/left_matrix.py
""" This module defines functionality unique to left matrix minimization. """ import cvxpy as cvx import numpy as np from statistical_clear_sky.algorithm.minimization.abstract\ import AbstractMinimization from statistical_clear_sky.algorithm.exception import ProblemStatusError class LeftMatrixMinimization(AbstractMin...
3,700
40.58427
97
py
StatisticalClearSky
StatisticalClearSky-master/statistical_clear_sky/algorithm/initialization/singular_value_decomposition.py
""" This module defines the class for Singular Value Decomposition related operations. """ import numpy as np class SingularValueDecomposition: """ Class to perform various calculations based on Sigular Value Decomposition. """ def decompose(self, power_signals_d, rank_k=4): """ Argum...
2,137
30.910448
80
py
StatisticalClearSky
StatisticalClearSky-master/statistical_clear_sky/algorithm/initialization/linearization_helper.py
""" This module defines helper class for the purpose of linearization. (Named as a helper instead of util since it doesn't directly do liniearization.) """ import numpy as np import cvxpy as cvx class LinearizationHelper(object): """ Delegate class to take care of obtaining a value used to make make a con...
2,108
34.15
97
py
StatisticalClearSky
StatisticalClearSky-master/statistical_clear_sky/algorithm/initialization/weight_setting.py
""" This module defines a class for Weight Setting Algorithm. """ import numpy as np class WeightSetting(object): """ Delegate class. Weight Setting Algorithm: Two metrics are calculated and normalized to the interval [0, 1], and then the geometric mean is taken. Metric 1: daily smoothness ...
976
30.516129
75
py
StatisticalClearSky
StatisticalClearSky-master/statistical_clear_sky/algorithm/initialization/__init__.py
0
0
0
py
StatisticalClearSky
StatisticalClearSky-master/statistical_clear_sky/algorithm/plot/plot_mixin.py
""" This module defines Mixin for plot for IterativeClearSky. """ import numpy as np import seaborn as sns import matplotlib.pyplot as plt from solardatatools import plot_2d class PlotMixin(object): def plot_lr(self, figsize=(14, 10), show_days=False): fig, ax = plt.subplots(nrows=2, ncols=2, figsize=fig...
7,545
43.916667
103
py