text stringlengths 0 1.05M | meta dict |
|---|---|
__author__ = 'Mark Laane'
import numpy
class PCA:
def __init__(self, training_samples_per_class):
self.training_samples_per_class = training_samples_per_class
self.average_sample = None
self.eig_vectors = None
self.train_weights = None
def train(self, training_samples: numpy.... | {
"repo_name": "zidik/PatternRecognition_HW_PCA_Combining",
"path": "pca.py",
"copies": "1",
"size": "3047",
"license": "mit",
"hash": 4412354474667636000,
"line_mean": 40.1891891892,
"line_max": 108,
"alpha_frac": 0.6905152609,
"autogenerated": false,
"ratio": 3.891443167305236,
"config_test": ... |
__author__ = 'Mark Laane'
import os
import errno
import numpy
import cv2
def extract_color_channels(all_face_vectors):
try:
number_of_channels = all_face_vectors.shape[2]
except IndexError:
# Only one channel vectors were returned
color_channels = numpy.array([all_face_vectors])
... | {
"repo_name": "zidik/PatternRecognition_HW_PCA_Combining",
"path": "loading_images.py",
"copies": "1",
"size": "3946",
"license": "mit",
"hash": -5029489434327647000,
"line_mean": 32.4491525424,
"line_max": 118,
"alpha_frac": 0.6188545362,
"autogenerated": false,
"ratio": 3.5421903052064634,
"c... |
__author__ = 'Mark'
from copy import deepcopy
class SudokuSolver:
def __init__(self, puzzle=None):
self.puzzle = puzzle if (puzzle is not None) else SudokuPuzzle(SudokuPuzzle.empty())
self.solution = None
def solve(self):
self.solution = self.solve_rec(self.puzzle)
@classmethod
... | {
"repo_name": "zidik/SudokuSolver",
"path": "sudoku_solver.py",
"copies": "1",
"size": "7422",
"license": "mit",
"hash": 6528335788551673000,
"line_mean": 35.387254902,
"line_max": 114,
"alpha_frac": 0.5109135004,
"autogenerated": false,
"ratio": 4.153329602686066,
"config_test": false,
"has_... |
__author__ = 'mark'
from django.shortcuts import render, get_object_or_404, render_to_response
from django.template import Template, Context, RequestContext
from django.conf import settings as CONFIG
from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_required
from django.http.r... | {
"repo_name": "ekivemark/my_device",
"path": "bbp/device/views.py",
"copies": "1",
"size": "1509",
"license": "apache-2.0",
"hash": 5280302236808629000,
"line_mean": 28.0384615385,
"line_max": 87,
"alpha_frac": 0.6355202121,
"autogenerated": false,
"ratio": 3.8396946564885495,
"config_test": fa... |
__author__ = 'Mark'
from scipy import stats
def combine_majority_vote(predictions):
majority_vote_predictions = (stats.mode(predictions[:, :, 0])[0])[0]
return majority_vote_predictions.astype(int)
def combine_minimum_rule(predictions):
total_testing_samples = predictions.shape[1]
all_minimum_distan... | {
"repo_name": "zidik/PatternRecognition_HW_PCA_Combining",
"path": "combining_classifications.py",
"copies": "1",
"size": "1633",
"license": "mit",
"hash": 5339993845132773000,
"line_mean": 40.8974358974,
"line_max": 113,
"alpha_frac": 0.6540110227,
"autogenerated": false,
"ratio": 4.022167487684... |
__author__ = 'Mark'
import matplotlib.pyplot as plt
import numpy
def plot_results(x_axis, y_axis, x_min, x_max, labels):
try:
y_axis[0][0]
except IndexError:
# Convert 1D list to 2D
y_axis = [y_axis]
colors = ('blue', 'green', 'red', 'cyan', 'magenta', 'yellow', 'black')
# Ca... | {
"repo_name": "zidik/PatternRecognition_HW_PCA_Combining",
"path": "plotting.py",
"copies": "1",
"size": "1547",
"license": "mit",
"hash": 6876479444449574000,
"line_mean": 29.3529411765,
"line_max": 120,
"alpha_frac": 0.5798319328,
"autogenerated": false,
"ratio": 3.15071283095723,
"config_tes... |
__author__ = 'mark'
class Mammal(object):
population = 0
def __init__(self, age=0):
self.age = age
Mammal.population += 1
def __str__(self):
return "I am a mammal of age {} but I am also a ".format(self.age)
class Cat(Mammal):
population = 0
def __init__(self, name=... | {
"repo_name": "mcgettin/ditOldProgramming",
"path": "yr2/sem1/sample-programs/inheritanceTest1.py",
"copies": "1",
"size": "1405",
"license": "mit",
"hash": 5519314906940599000,
"line_mean": 18.5138888889,
"line_max": 74,
"alpha_frac": 0.5316725979,
"autogenerated": false,
"ratio": 3.143176733780... |
__author__ = 'mark'
class MeasurementList:
def __init__(self, animal, algorithm, user):
self.animal = animal
self.algorithm = algorithm
self.user = user
self.measurements = []
def add_measurement(self, time_stamp, value1, value2=None, value3=None, value4=None, value5=None, co... | {
"repo_name": "elec-otago/agbase",
"path": "pythonlib/mooglePy/measurement_list.py",
"copies": "1",
"size": "1203",
"license": "mpl-2.0",
"hash": 5744279694266774000,
"line_mean": 26.3636363636,
"line_max": 116,
"alpha_frac": 0.5793848712,
"autogenerated": false,
"ratio": 4.1482758620689655,
"c... |
__author__ = 'mark'
''' Demonstrate import and rational class'''
def gcd(a, b):
# Ensure that a > b, if it is not reverse a & b
if not a > b:
a, b = b, a
print("Initial fraction is {}/{}".format(a, b))
while b != 0:
rem = a % b
a, b = b, rem
print(("... {}/{}".format(... | {
"repo_name": "r-martin-/Code_College",
"path": "PythonProgramming/frac.py",
"copies": "1",
"size": "1396",
"license": "mit",
"hash": -8040906892493720000,
"line_mean": 18.3888888889,
"line_max": 65,
"alpha_frac": 0.4670487106,
"autogenerated": false,
"ratio": 2.4405594405594404,
"config_test":... |
__author__ = 'Mark'
from enum import Enum
import cv2
from geometry import line_intersection
from drawing_helpers import draw_horizontal_line, draw_vertical_line
class Corner(Enum):
BottomLeft = 0,
BottomRight = 1,
TopLeft = 2,
TopRight = 3
class CoordinateMapper:
@property
def horizon(self)... | {
"repo_name": "zidik/TelliskiviCameraCalibration",
"path": "coordinate_mapper.py",
"copies": "1",
"size": "4560",
"license": "mit",
"hash": -1789072530026348500,
"line_mean": 33.2857142857,
"line_max": 105,
"alpha_frac": 0.5927631579,
"autogenerated": false,
"ratio": 3.5266821345707657,
"config... |
__author__ = 'Mark'
import cv2
import threading
import copy
from pattern_type import PatternType
class PatternFinder(threading.Thread):
# Read only properties:
@property
def recognition_in_progress(self):
return self._new_data.is_set()
@property
def pattern_found(self):
return s... | {
"repo_name": "zidik/TelliskiviCameraCalibration",
"path": "pattern_finder.py",
"copies": "1",
"size": "3051",
"license": "mit",
"hash": 7248124214481587000,
"line_mean": 32.5274725275,
"line_max": 115,
"alpha_frac": 0.6037364798,
"autogenerated": false,
"ratio": 3.9623376623376623,
"config_tes... |
__author__ = 'Mark'
import cv2
def draw_corners(frame, corners):
count = 0
for name, point in corners.items():
count +=1
cv2.circle(frame, point, radius=5, color=(0, 0, 255), thickness=2)
cv2.putText(
img=frame,
text="{} {}".format(count, name),
org=... | {
"repo_name": "zidik/TelliskiviCameraCalibration",
"path": "drawing_helpers.py",
"copies": "1",
"size": "1112",
"license": "mit",
"hash": 5320965534938508000,
"line_mean": 32.7272727273,
"line_max": 84,
"alpha_frac": 0.5917266187,
"autogenerated": false,
"ratio": 3.0549450549450547,
"config_tes... |
__author__ = 'mark'
import math
class Point:
"""Class to define a 'point' object which has x/y cartesian coordinates and its associated methods."""
def __init__(self, x=0.0, y=0.0):
"""Initial values for x and y, defaults 0.0 in both cases. Note that x and y are private - indicated
by preced... | {
"repo_name": "r-martin-/Code_College",
"path": "PythonProgramming/PointClass.py",
"copies": "1",
"size": "1370",
"license": "mit",
"hash": -4836078360184393000,
"line_mean": 23.4642857143,
"line_max": 108,
"alpha_frac": 0.5496350365,
"autogenerated": false,
"ratio": 3.0925507900677203,
"config... |
__author__ = 'Mark'
import numpy
import cv2
import os
import errno
def load_face_vectors_from_disk(image_numbers, img_size, show=True):
"""
Loads images from disk, detects faces from them, resizes the face images to common size, vectorizes the face image
and stores it in a dictionary with key (pers_no, s... | {
"repo_name": "zidik/PatternRecognition_HW_LDA",
"path": "loading_images.py",
"copies": "1",
"size": "2904",
"license": "mit",
"hash": 1469533100378321000,
"line_mean": 32.0113636364,
"line_max": 118,
"alpha_frac": 0.6201790634,
"autogenerated": false,
"ratio": 3.607453416149068,
"config_test":... |
__author__ = 'mark'
import string
strange_text = """OK, so I have a piece of 'plain' text that I want save. If I only have unaccented latin characters that conform to the old 'ASCII' standard character set, then I'm probably OK. But what if I'm not an English-speaker? What if I want to store some accented characters ... | {
"repo_name": "r-martin-/Code_College",
"path": "PythonProgramming/write_odd_chars.py",
"copies": "1",
"size": "1102",
"license": "mit",
"hash": -8549444017896070000,
"line_mean": 27.4444444444,
"line_max": 327,
"alpha_frac": 0.669599218,
"autogenerated": false,
"ratio": 2.4127358490566038,
"co... |
__author__ = 'mark'
class MeasurementCategory:
def __init__(self, name, id=-1):
self.name = name
self.id = id
class Algorithm:
def __init__(self, name, id=-1, category_id=-1):
self.name = name
self.id = id
self.category_id = category_id
class User:
def __init... | {
"repo_name": "elec-otago/agbase",
"path": "pythonlib/mooglePy/models.py",
"copies": "1",
"size": "1988",
"license": "mpl-2.0",
"hash": -1705315632636007700,
"line_mean": 21.6022727273,
"line_max": 70,
"alpha_frac": 0.5503018109,
"autogenerated": false,
"ratio": 3.2536824877250408,
"config_test... |
__author__ = 'mark'
# Read file in abc music notation.
'''
X:101
T:Killavil Fancy, The
T:Eilish Brogan
T:Ten Pound Float, The
R:reel
D:Music at Matt Molloy's
D:Frankie Gavin & Alec Finn
Z:Sometimes played doubled.
Z:id:hn-reel-101
M:C|
K:G
~B3G A2BA|GE~E2 cEGE|DGBG A2BA|GEED EFGA|
~B3d A2BA|GE~E2 cEGE|DGBG A2BA|GEED ... | {
"repo_name": "mcgettin/ditOldProgramming",
"path": "yr2/sem1/sample-programs/abc_reader.py",
"copies": "1",
"size": "1492",
"license": "mit",
"hash": -148376024164739360,
"line_mean": 24.724137931,
"line_max": 81,
"alpha_frac": 0.5502680965,
"autogenerated": false,
"ratio": 2.4825291181364393,
... |
__author__ = 'mark'
# ========== Start =================
# This imports the necessary module to enable us to treat a URL as a file
import urllib.request
# URL is just a variable which stores the url string of the data that we want
URL = "http://archive.ics.uci.edu/ml/machine-learning-databases/adult/adult.data"
# Wh... | {
"repo_name": "mcgettin/ditOldProgramming",
"path": "yr2/sem1/sample-programs/getURL.py",
"copies": "1",
"size": "1356",
"license": "mit",
"hash": -3472379978226932000,
"line_mean": 38.8823529412,
"line_max": 114,
"alpha_frac": 0.7057522124,
"autogenerated": false,
"ratio": 3.6648648648648647,
... |
__author__ = 'mark'
# simple clock class
class Clock(object):
"""Simple clock class
Takes hours, minutes, seconds as ints
Can be updated by time in the form of 'hh:mm:ss'"""
def __init__(self, hours=0, minutes=0, seconds=0):
try:
assert type(hours) == int and -1 < hours < 24
... | {
"repo_name": "mcgettin/ditOldProgramming",
"path": "yr2/sem1/sample-programs/clockClass.py",
"copies": "1",
"size": "1861",
"license": "mit",
"hash": -5530205341142077000,
"line_mean": 34.7884615385,
"line_max": 120,
"alpha_frac": 0.5615260613,
"autogenerated": false,
"ratio": 3.722,
"config_t... |
__author__ = 'mark'
# simple Rational number class
# assumes both gcd and lcm are already imported
# import sys
#sys.path.append( "/home/mark/Dropbox-Work/Projects-Geany/" )
#from frac import gcd, lcm
def gcd(a, b):
# Ensure that a > b, if it is not reverse a & b
if not a > b:
a, b = b, a
print(... | {
"repo_name": "r-martin-/Code_College",
"path": "PythonProgramming/rationalClass.py",
"copies": "1",
"size": "3156",
"license": "mit",
"hash": -1965549693687195000,
"line_mean": 30.56,
"line_max": 77,
"alpha_frac": 0.5484790875,
"autogenerated": false,
"ratio": 3.6151202749140894,
"config_test"... |
__author__ = 'mark'
# ========== Start =================
# This imports the necessary module to enable us to treat a URL as a file
import urllib.request
# URL is just a variable which stores the url string of the data that we want
URL = "http://archive.ics.uci.edu/ml/machine-learning-databases/adult/adult.data"
# Whe... | {
"repo_name": "mcgettin/ditOldProgramming",
"path": "yr2/sem1/sample-programs/sampleReadURL.py",
"copies": "1",
"size": "2075",
"license": "mit",
"hash": -1815666578762936300,
"line_mean": 33.0163934426,
"line_max": 114,
"alpha_frac": 0.646746988,
"autogenerated": false,
"ratio": 3.60869565217391... |
__author__ = 'mark'
'''This program illustrates the way data is acutally represented in files
on the computer as opposed to the way users might preceive this by using
and viewing text files and, possibly, ignoring and/or misunderstanding
that which is invisible (encodings that don't have a glyph or 'character'
to repre... | {
"repo_name": "mcgettin/ditOldProgramming",
"path": "yr2/sem1/sample-programs/testUtf8.py",
"copies": "1",
"size": "6126",
"license": "mit",
"hash": -1669274867334383900,
"line_mean": 36.5828220859,
"line_max": 122,
"alpha_frac": 0.7082925237,
"autogenerated": false,
"ratio": 3.4945807187678266,
... |
__author__ = 'marko'
from sklearn.learning_curve import learning_curve
from sklearn.svm import LinearSVC, SVC
from sklearn.naive_bayes import GaussianNB
from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble import RandomForestClassifier
from sklearn.dummy import DummyClassifier
from sklearn.externals... | {
"repo_name": "ssip16teamb/ssip16teamb.github.io",
"path": "solution/application/modules/ml_utils.py",
"copies": "1",
"size": "4574",
"license": "mit",
"hash": -7872678343776616000,
"line_mean": 34.1846153846,
"line_max": 144,
"alpha_frac": 0.6574114561,
"autogenerated": false,
"ratio": 3.2555160... |
__author__ = 'marko'
import cv2
import matplotlib.pyplot as plt
import numpy as np
def plt_imshow(img):
""" Util method used to display opencv images using matplotlib"""
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
plt.imshow(img)
def cv2_imshow(title, img):
"""
Util method used to display images i... | {
"repo_name": "ssip16teamb/ssip16teamb.github.io",
"path": "solution/application/modules/image_utils.py",
"copies": "1",
"size": "1619",
"license": "mit",
"hash": -8067227819800215000,
"line_mean": 23.5303030303,
"line_max": 78,
"alpha_frac": 0.610870908,
"autogenerated": false,
"ratio": 3.131528... |
__author__ = 'marko'
import numpy as np
from random import randint
from skimage.feature import hessian_matrix
from skimage.morphology import disk
from skimage.filters.rank import entropy
from preprocess import Preprocess
import cv2
class ImageSample(object):
'''Image wrapper class that is used for samples extract... | {
"repo_name": "ssip16teamb/ssip16teamb.github.io",
"path": "solution/application/modules/image_sample.py",
"copies": "1",
"size": "4888",
"license": "mit",
"hash": 5413847411520198000,
"line_mean": 31.3708609272,
"line_max": 86,
"alpha_frac": 0.5192307692,
"autogenerated": false,
"ratio": 3.79797... |
__author__ = 'marko'
import time
import os
import logging
import sys
class Timer(object):
"""
Use as 'with' construct to measure execution time.
"""
def __init__(self, label='', verbose=False):
self.verbose = verbose
self.label = label
def __enter__(self):
self.start = ti... | {
"repo_name": "ssip16teamb/ssip16teamb.github.io",
"path": "solution/application/modules/utils.py",
"copies": "1",
"size": "2665",
"license": "mit",
"hash": 4529596197872056300,
"line_mean": 27.0526315789,
"line_max": 86,
"alpha_frac": 0.6225140713,
"autogenerated": false,
"ratio": 3.701388888888... |
__author__ = 'marko'
#!/usr/local/bin/python
import logging
import cv2
import numpy as np
from scipy import misc
from scipy import ndimage
from sklearn import preprocessing
"""
TODO: Documentation of the class and methods
"""
logger = logging.getLogger(__name__)
class Preprocess(object):
# sharpness met... | {
"repo_name": "ssip16teamb/ssip16teamb.github.io",
"path": "solution/application/modules/preprocess.py",
"copies": "1",
"size": "2586",
"license": "mit",
"hash": -2898793164539410400,
"line_mean": 30.156626506,
"line_max": 119,
"alpha_frac": 0.6368909513,
"autogenerated": false,
"ratio": 3.119420... |
description = """
Runs pdf_gen with geometrically increasing timeout settings in an attempt
to generate all valid pdfs. Emails error log to --notify and then attempts
to run timeouts from last time.
"""
__docformat__ = 'restructuredtext'
import sys
print sys.path
import os
import datetime
from optparse import Optio... | {
"repo_name": "mredar/oac-ead-to-pdf",
"path": "scripts/pdf_gen_timeout_retry.py",
"copies": "1",
"size": "7489",
"license": "bsd-3-clause",
"hash": -4331737530281619500,
"line_mean": 32.7342342342,
"line_max": 125,
"alpha_frac": 0.5729736948,
"autogenerated": false,
"ratio": 3.6746810598626105,
... |
__author__ = 'markshao'
import string
from pagrant.exceptions import PagrantError
class BaseProvisioner(object):
def __init__(self, machine, logger, provision_info, provider_info=None):
self.machine = machine
self.logger = logger
self.provider_info = provider_info
self.provision_i... | {
"repo_name": "markshao/pagrant",
"path": "pagrant/provisioners/__init__.py",
"copies": "1",
"size": "1445",
"license": "mit",
"hash": -8258599454179528000,
"line_mean": 31.8409090909,
"line_max": 103,
"alpha_frac": 0.7128027682,
"autogenerated": false,
"ratio": 3.9807162534435263,
"config_test... |
r"""Regularized linear regression with custom training and regularization costs.
:class:`FlexibleLinearRegression` is a scikit-learn-compatible linear
regression estimator that allows specification of arbitrary
training and regularization cost functions.
For a linear model:
.. math::
\textrm{predictions} = X \cd... | {
"repo_name": "mkliegl/custom-sklearn",
"path": "flexible_linear.py",
"copies": "1",
"size": "8775",
"license": "mit",
"hash": 7101083635727586000,
"line_mean": 28.9488054608,
"line_max": 118,
"alpha_frac": 0.5883760684,
"autogenerated": false,
"ratio": 3.4465828750981933,
"config_test": false,... |
__author__ = "Markus Lechner"
__license__ = "GPL"
__version__ = "0.0.2"
__maintainer__ = "Markus Lechner"
__email__ = "markus.lechner@technikum-wien.at"
__status__ = "Production"
import re
import socket
import logging
class TCP_IP_CLIENT:
IP_ADDRESS = "169.254.0.1"
PORT = 30000
REC_BUFFER_SIZE = 64
... | {
"repo_name": "sguertl/Flying_Pi",
"path": "FHTW_Com/RPI_Software/V002_20062017/eth_client_com.py",
"copies": "3",
"size": "2464",
"license": "apache-2.0",
"hash": 4481118708300394000,
"line_mean": 30.6025641026,
"line_max": 81,
"alpha_frac": 0.5600649351,
"autogenerated": false,
"ratio": 3.94871... |
__author__ = "Markus Lechner"
__license__ = "GPL"
__version__ = "0.0.2"
__maintainer__ = "Markus Lechner"
__email__ = "markus.lechner@technikum-wien.at"
__status__ = "Production"
import spidev
import time
import array
import struct
import logging
from packet_manager import packet_assembler
from packet_manager import ... | {
"repo_name": "sguertl/Flying_Pi",
"path": "FHTW_Com/RPI_Software/V002_20062017/spi_com.py",
"copies": "3",
"size": "3501",
"license": "apache-2.0",
"hash": 6180684915021809000,
"line_mean": 35.1030927835,
"line_max": 90,
"alpha_frac": 0.548129106,
"autogenerated": false,
"ratio": 3.9117318435754... |
__author__ = 'Markus'
import os
import sqlite3
from collections import defaultdict
def convert(db_file, out_dir):
if not out_dir:
raise Exception("Must specify csv destination out_dir")
if not os.path.isdir(out_dir):
if os.path.exists(out_dir):
raise Exception("File already exists a... | {
"repo_name": "mpern/master_thesis",
"path": "funf_analyze/data_processing/db2json.py",
"copies": "1",
"size": "1426",
"license": "mit",
"hash": -5941065320174715000,
"line_mean": 32.1860465116,
"line_max": 108,
"alpha_frac": 0.5687237027,
"autogenerated": false,
"ratio": 3.8961748633879782,
"c... |
__author__ = 'Mark Worden'
from mi.core.log import get_logger
log = get_logger()
from mi.core.common import BaseEnum
from mi.core.instrument.dataset_data_particle import DataParticle, DataParticleKey
from mi.dataset.parser.utilities import \
mac_timestamp_to_utc_timestamp, \
time_1904_to_ntp
class Pco2wAbcP... | {
"repo_name": "oceanobservatories/mi-instrument",
"path": "mi/dataset/parser/pco2w_abc_particles.py",
"copies": "1",
"size": "22916",
"license": "bsd-2-clause",
"hash": -2923586429561635000,
"line_mean": 41.047706422,
"line_max": 111,
"alpha_frac": 0.6736341421,
"autogenerated": false,
"ratio": 3... |
from contextlib import contextmanager
import os.path as op
import pathlib
import re
import numpy as np
from numpy.testing import assert_allclose, assert_array_equal
import pytest
from scipy import sparse
from scipy.special import sph_harm
import mne
from mne import compute_raw_covariance, pick_types, concatenate_raw... | {
"repo_name": "drammock/mne-python",
"path": "mne/preprocessing/tests/test_maxwell.py",
"copies": "3",
"size": "63332",
"license": "bsd-3-clause",
"hash": -813415126138306200,
"line_mean": 44.4318507891,
"line_max": 193,
"alpha_frac": 0.6032969115,
"autogenerated": false,
"ratio": 3.0000947418285... |
import os.path as op
import warnings
import numpy as np
import sys
import scipy
from numpy.testing import assert_equal, assert_allclose
from nose.tools import assert_true, assert_raises
from nose.plugins.skip import SkipTest
from distutils.version import LooseVersion
from mne import compute_raw_covariance, pick_types... | {
"repo_name": "ARudiuk/mne-python",
"path": "mne/preprocessing/tests/test_maxwell.py",
"copies": "1",
"size": "42130",
"license": "bsd-3-clause",
"hash": -7531226672957870000,
"line_mean": 44.7437567861,
"line_max": 79,
"alpha_frac": 0.6082126751,
"autogenerated": false,
"ratio": 2.97171474924172... |
import os.path as op
from mne.datasets import testing
from mne.preprocessing._fine_cal import (read_fine_calibration,
write_fine_calibration)
from mne.utils import _TempDir, object_hash, run_tests_if_main
# Define fine calibration filepaths
data_path = testing.data_path(downl... | {
"repo_name": "teonlamont/mne-python",
"path": "mne/preprocessing/tests/test_fine_cal.py",
"copies": "6",
"size": "1267",
"license": "bsd-3-clause",
"hash": -1762631118966190300,
"line_mean": 33.2432432432,
"line_max": 72,
"alpha_frac": 0.6724546172,
"autogenerated": false,
"ratio": 3.19949494949... |
__author__ = 'marleyjaffe'
import sqlite3 as lite
import argparse
import os
import time
import glob
import platform
# Sets Global variables for verbosity and outFile
verbosity = 3
outFile = False
def ParseCommandLine():
"""
Name: ParseCommandLine
Description: Process and Validate the comma... | {
"repo_name": "marleyjaffe/ChromeSyncParser",
"path": "ChromeParser.py",
"copies": "1",
"size": "31480",
"license": "mit",
"hash": -216064574420553570,
"line_mean": 36.1676505313,
"line_max": 165,
"alpha_frac": 0.5418996188,
"autogenerated": false,
"ratio": 4.8580246913580245,
"config_test": fa... |
import random
import argparse
import numpy as np
import scipy as sp
import scipy.stats
class ArgsParser:
"""
Read the user's input and parse the arguments properly. When returning args, each value is properly filled.
Ideally one shouldn't have to read this function to access the proper arguments, but I p... | {
"repo_name": "mcmachado/gridworld-lib",
"path": "utils.py",
"copies": "1",
"size": "2588",
"license": "mit",
"hash": -2777530781984255500,
"line_mean": 34.4657534247,
"line_max": 111,
"alpha_frac": 0.614374034,
"autogenerated": false,
"ratio": 3.8626865671641792,
"config_test": false,
"has_n... |
import sys
import numpy as np
class GridWorld:
_str_mdp = ''
_num_rows = -1
_num_cols = -1
_num_states = -1
_matrix_mdp = None
_adj_matrix = None
_reward_function = None
_use_negative_rewards = False
_curr_x = 0
_curr_y = 0
_start_x = 0
_start_y = 0
_goal_x = 0
... | {
"repo_name": "mcmachado/gridworld-lib",
"path": "gridworld.py",
"copies": "1",
"size": "13429",
"license": "mit",
"hash": -3766788888078111000,
"line_mean": 40.7049689441,
"line_max": 119,
"alpha_frac": 0.5670563705,
"autogenerated": false,
"ratio": 3.8489538549727715,
"config_test": false,
... |
import utils
import numpy as np
import matplotlib.pylab as plt
import matplotlib.patches as patches
# I need this for the 3d projection:
from mpl_toolkits.mplot3d import Axes3D
def plot_basis_function(args, x_range, y_range, basis, prefix):
"""
Plots 3d graph where the x and y coordinates represent the grid ... | {
"repo_name": "mcmachado/gridworld-lib",
"path": "plotting.py",
"copies": "1",
"size": "4695",
"license": "mit",
"hash": -5868338336376025000,
"line_mean": 37.1707317073,
"line_max": 120,
"alpha_frac": 0.6048988285,
"autogenerated": false,
"ratio": 3.3801295896328294,
"config_test": false,
"h... |
import utils
import random
import plotting
import numpy as np
from gridworld import GridWorld
if __name__ == "__main__":
# Read input arguments
args = utils.ArgsParser.read_input_args()
# Create environment
env = GridWorld(path=args.input)
num_states = env.get_num_states()
num_actions = len(e... | {
"repo_name": "mcmachado/gridworld-lib",
"path": "sarsa.py",
"copies": "1",
"size": "2095",
"license": "mit",
"hash": -3515992231064541000,
"line_mean": 35.1379310345,
"line_max": 118,
"alpha_frac": 0.5813842482,
"autogenerated": false,
"ratio": 3.4400656814449917,
"config_test": false,
"has_... |
__author__ = 'maroun'
import os
import io
import nose_docstring_modifier.nose_docstring_modifier
from setuptools import setup, find_packages
ROOT = os.path.abspath(os.path.dirname(__file__))
requires = [
'nose',
]
def read(*filenames, **kwargs):
encoding = kwargs.get('encoding', 'utf-8')
sep = kwarg... | {
"repo_name": "taykey/nose-docstring-modifier",
"path": "setup.py",
"copies": "1",
"size": "1567",
"license": "apache-2.0",
"hash": 5714815534913255000,
"line_mean": 28.037037037,
"line_max": 81,
"alpha_frac": 0.6215698787,
"autogenerated": false,
"ratio": 3.9872773536895676,
"config_test": fal... |
__author__ = 'marrabld'
import logging.config
import os
import inspect
#log_conf_file = os.path.join(os.path.dirname(__file__), 'logging.conf')
log_conf_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
# log_conf_dir = os.path.join(log_conf_dir, 'lib')
# log_conf_dir = os.path.join(log_... | {
"repo_name": "marrabld/web_bootstrappy",
"path": "project/lib/bootstrappy/libbootstrap/logger.py",
"copies": "1",
"size": "1045",
"license": "mit",
"hash": 6187119145814117000,
"line_mean": 27.2702702703,
"line_max": 99,
"alpha_frac": 0.6583732057,
"autogenerated": false,
"ratio": 3.110119047619... |
__author__ = 'marrabld'
import os
import sys
sys.path.append("../..")
import logger as log
import scipy
import scipy.fftpack
import numpy as np
#import lib.bootstrappy.libbootstrap
import state
import numpy.random
# import libbootstrap
# import libbootstrap.state
import csv
import spectralmodel
DEBUG_LEVEL = state.... | {
"repo_name": "marrabld/web_bootstrappy",
"path": "project/lib/bootstrappy/libbootstrap/spectra_generator.py",
"copies": "1",
"size": "3125",
"license": "mit",
"hash": 5635172900305586000,
"line_mean": 20.2585034014,
"line_max": 80,
"alpha_frac": 0.55168,
"autogenerated": false,
"ratio": 3.426535... |
__author__ = 'marrabld'
import os
import sys
sys.path.append("../..")
import logger as log
import scipy
import scipy.optimize
import libbootstrap
import libbootstrap.state
import csv
import pylab
DEBUG_LEVEL = libbootstrap.state.State().debug
lg = log.logger
lg.setLevel(DEBUG_LEVEL)
class BioOpticalParameters():
... | {
"repo_name": "marrabld/web_bootstrappy",
"path": "project/lib/bootstrappy/libbootstrap/deconv.py",
"copies": "1",
"size": "23841",
"license": "mit",
"hash": 8167987968196646000,
"line_mean": 33.7536443149,
"line_max": 171,
"alpha_frac": 0.5416719097,
"autogenerated": false,
"ratio": 3.1535714285... |
__author__ = 'marrabld'
import os
import sys
sys.path.append("..")
sys.path.append("../..")
sys.path.append("../../../..")
import logger as log
import scipy
import scipy.fftpack
import numpy as np
#import lib.bootstrappy.libbootstrap
import state
import csv
DEBUG_LEVEL = state.State().debug
lg = log.logger
lg.setLe... | {
"repo_name": "marrabld/web_bootstrappy",
"path": "project/lib/bootstrappy/libbootstrap/spectralmodel.py",
"copies": "1",
"size": "2399",
"license": "mit",
"hash": -2123905420255528200,
"line_mean": 21.4205607477,
"line_max": 105,
"alpha_frac": 0.5506461025,
"autogenerated": false,
"ratio": 3.507... |
__author__ = 'marrabld'
import sys
import pylab
import numpy as np
sys.path.append('../..')
import libbootstrap.spectralmodel as spectralmodel
import libbootstrap.spectra_generator as spectra_generator
#test_data_file = '/home/marrabld/Projects/phd/bootstrappy/inputs/test_data/hope_rrs.csv'
test_data_file = '/home/... | {
"repo_name": "marrabld/web_bootstrappy",
"path": "project/lib/bootstrappy/tests/test_spectralmodel.py",
"copies": "1",
"size": "1114",
"license": "mit",
"hash": -781213170667308300,
"line_mean": 25.5476190476,
"line_max": 120,
"alpha_frac": 0.723518851,
"autogenerated": false,
"ratio": 2.6650717... |
__author__ = 'marrabld'
import sys
import scipy
sys.path.append('../..')
import unittest
import libbootstrap.deconv
import pylab
class setUp(unittest.TestCase):
# wavelengths = scipy.asarray(
# [410, 420, 430, 440, 450, 460, 470, 480, 490, 500, 510, 520, 530, 540, 550, 560, 570, 580, 590, 600, 610, 620,... | {
"repo_name": "marrabld/web_bootstrappy",
"path": "project/lib/bootstrappy/tests/test_deconv.py",
"copies": "1",
"size": "2926",
"license": "mit",
"hash": 21194702738854530,
"line_mean": 36.0379746835,
"line_max": 119,
"alpha_frac": 0.5635680109,
"autogenerated": false,
"ratio": 2.926,
"config_... |
__author__ = 'mart3565'
import arcpy
import os.path
import time
def getDrivePath():
while True:
drivePath = raw_input("Please enter the path to your Drive folder (i.e. D:\drive or C:\Users\username\Google "
"Drive): ")
if not os.path.exists(drivePath):
pri... | {
"repo_name": "borchert/metadata-tools",
"path": "metadata_export_batch/metadata_batch_operations_with_templatecreation.py",
"copies": "1",
"size": "5062",
"license": "mit",
"hash": -6615657689811742000,
"line_mean": 32.3092105263,
"line_max": 118,
"alpha_frac": 0.6100355591,
"autogenerated": false... |
__author__ = 'mart3565'
''' --------------------------------------------------------------------
Script used to compare two paths for differences in files present (shp).
------------------------------------------------------------------------'''
import os
import arcpy
inputDirOne = r'C:\Users\mart3565\Downloads\he... | {
"repo_name": "borchert/metadata-tools",
"path": "compareDatasets/compareDatasets.py",
"copies": "1",
"size": "2446",
"license": "mit",
"hash": 2840887560966908000,
"line_mean": 30.3717948718,
"line_max": 112,
"alpha_frac": 0.5384300899,
"autogenerated": false,
"ratio": 4.110924369747899,
"conf... |
__author__ = ['Marten Fischer (m.fischer@hs-osnabrueck.de)', 'Daniel Puschmann']
from virtualisation.aggregation.genericaggregation import GenericAggregator
from virtualisation.aggregation.sax.saxcontrol import SaxControl
from virtualisation.misc.jsonobject import JSONObject
from virtualisation.misc.log import Log
cl... | {
"repo_name": "CityPulse/CP_Resourcemanagement",
"path": "virtualisation/aggregation/sax/saxaggregator.py",
"copies": "1",
"size": "1410",
"license": "mit",
"hash": 7293986943306338000,
"line_mean": 40.4705882353,
"line_max": 80,
"alpha_frac": 0.604964539,
"autogenerated": false,
"ratio": 4.42006... |
__author__ = 'Marten Fischer (m.fischer@hs-osnabrueck.de)'
from virtualisation.clock.abstractclock import AbstractClock
from time import sleep
import datetime
class RealClock(AbstractClock):
def __init__(self, endCallback=None, endCallbackArgs=None):
super(RealClock, self).__init__()
self.delay = ... | {
"repo_name": "CityPulse/CP_Resourcemanagement",
"path": "virtualisation/clock/realclock.py",
"copies": "1",
"size": "1130",
"license": "mit",
"hash": -7743577109372262000,
"line_mean": 27.25,
"line_max": 69,
"alpha_frac": 0.6309734513,
"autogenerated": false,
"ratio": 4.00709219858156,
"config... |
__author__ = 'Marten Fischer (m.fischer@hs-osnabrueck.de)'
from virtualisation.misc.jsonobject import JSONObject
import copy
import _strptime # A bug in Python, that may cause a AttributeError (http://stackoverflow.com/questions/2427240/thread-safe-equivalent-to-pythons-time-strptime)
import datetime
import uuid
clas... | {
"repo_name": "CityPulse/CP_Resourcemanagement",
"path": "virtualisation/sensordescription.py",
"copies": "1",
"size": "4281",
"license": "mit",
"hash": -5071674176906632000,
"line_mean": 48.2068965517,
"line_max": 251,
"alpha_frac": 0.6026629292,
"autogenerated": false,
"ratio": 4.05781990521327... |
__author__ = 'Marten Fischer (m.fischer@hs-osnabrueck.de)'
import csv
import os.path
if __name__ == "__main__":
writers = {}
for i in range(1, 6):
_id = "BV-%d" % (i,)
fileobj = open(os.path.join("historicdata", "pollution-%s.csv" % (_id,)), "wb")
writers[_id] = csv.writer(fileobj, del... | {
"repo_name": "CityPulse/CP_Resourcemanagement",
"path": "wrapper_dev/brasov_pollution/splithistory.py",
"copies": "1",
"size": "1027",
"license": "mit",
"hash": 6042846211048967000,
"line_mean": 37.037037037,
"line_max": 143,
"alpha_frac": 0.558909445,
"autogenerated": false,
"ratio": 2.80601092... |
__author__ = 'Marten Fischer (m.fischer@hs-osnabrueck.de)'
import csv
import os.path
def niceFilename(org):
return org.replace('(', '_').replace(')', '_').replace(' ', '_').replace('/', '_').lower()
if __name__ == "__main__":
writers = {}
ids = {
"Arad": "POINT(21.31 46.19)",
"Bacau": "P... | {
"repo_name": "CityPulse/CP_Resourcemanagement",
"path": "wrapper_dev/romania_weather/splithistory.py",
"copies": "1",
"size": "10281",
"license": "mit",
"hash": 1577548990176241200,
"line_mean": 37.0777777778,
"line_max": 101,
"alpha_frac": 0.5064682424,
"autogenerated": false,
"ratio": 2.568323... |
__author__ = 'Marten Fischer (m.fischer@hs-osnabrueck.de)'
import threading
class TimeStampedItem(object):
def __init__(self, timestamp, data):
self.timestamp = timestamp
self.data = data
class TimestampedList(object):
def __init__(self):
self.items = []
def add(self, timestamp, ... | {
"repo_name": "CityPulse/CP_Resourcemanagement",
"path": "virtualisation/misc/lists.py",
"copies": "1",
"size": "4801",
"license": "mit",
"hash": 5197995108146595000,
"line_mean": 35.9307692308,
"line_max": 204,
"alpha_frac": 0.5850864403,
"autogenerated": false,
"ratio": 4.248672566371681,
"co... |
__author__ = 'Martijn Berger'
import OpenGL.GL as gl
import numpy as np
import ctypes
import glfw
NULL = ctypes.c_void_p(0)
vertex_data = np.array([-1,-1, -1,+1, +1,-1, +1,+1 ], dtype=np.float32)
color_data = np.array([1,0,0,1, 0,1,0,1, 0,0,1,1, 1,1,0,1], dtype=np.float32)
def main():
# Initialize the library... | {
"repo_name": "martijnberger/OpenGL-tests",
"path": "pyglfw/test-opengl-2.1.py",
"copies": "1",
"size": "1279",
"license": "unlicense",
"hash": -8050317440384974000,
"line_mean": 24.0784313725,
"line_max": 77,
"alpha_frac": 0.625488663,
"autogenerated": false,
"ratio": 3.023640661938534,
"confi... |
__author__ = 'Martijn Berger'
import OpenGL.GL as gl
import numpy as np
import ctypes
import glfw
vertex_code = """
uniform float scale;
attribute vec2 position;
attribute vec4 color;
varying vec4 v_color;
void main()
{
gl_Position = vec4(position*scale, 0.0, 1.0);
v_color = color;
}
"""
fragment_code = """... | {
"repo_name": "martijnberger/OpenGL-tests",
"path": "pyglfw/test-opengl-3.2.py",
"copies": "1",
"size": "3164",
"license": "unlicense",
"hash": -8304012110484531000,
"line_mean": 24.9344262295,
"line_max": 78,
"alpha_frac": 0.6403286979,
"autogenerated": false,
"ratio": 3.2821576763485476,
"con... |
__author__ = 'Martijn Berger'
import OpenGL.GL as gl
import numpy as np
import ctypes
import glfw
vertex_code = """
#version 120
void main(void)
{
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
gl_FrontColor = gl_Color;
}
"""
fragment_code = """
#version 120
void main()
{
gl_FragColor = gl_Co... | {
"repo_name": "martijnberger/OpenGL-tests",
"path": "pyglfw/test-opengl-2.1-vbo-shader.py",
"copies": "1",
"size": "2832",
"license": "unlicense",
"hash": -2704337918333372400,
"line_mean": 24.0619469027,
"line_max": 91,
"alpha_frac": 0.6596045198,
"autogenerated": false,
"ratio": 3.1466666666666... |
__author__ = 'Martin Aryee'
# source /apps/lab/aryee/pyenv/versions/venv-2.7.6/bin/activate
# python consolidate.py /data/ngscid-research/testing/CTCTCTACACTGATGG.sorted.fastq tmp.fastq 15 0.9
import HTSeq
import sys
import os
import logging
#fastq_file = '/data/ngscid-research/testing/CTCTCTACACTGATGG.sorted.fastq'... | {
"repo_name": "aryeelab/umi",
"path": "consolidate.py",
"copies": "1",
"size": "4222",
"license": "mit",
"hash": -7662737998562677000,
"line_mean": 37.3818181818,
"line_max": 172,
"alpha_frac": 0.6328754145,
"autogenerated": false,
"ratio": 3.1181683899556867,
"config_test": false,
"has_no_ke... |
import os
from os import path as op
from ...externals.six import string_types
from ...externals.six.moves import input
from ...utils import _fetch_file, get_config, set_config, _url_to_local_path
EEGMI_URL = 'http://www.physionet.org/physiobank/database/eegmmidb/'
def data_path(url, path=None, force_update=False, ... | {
"repo_name": "effigies/mne-python",
"path": "mne/datasets/eegbci/eegbci.py",
"copies": "1",
"size": "8044",
"license": "bsd-3-clause",
"hash": -8756035164384364000,
"line_mean": 39.0199004975,
"line_max": 82,
"alpha_frac": 0.5909995027,
"autogenerated": false,
"ratio": 3.7536164255716287,
"con... |
import os
from os import path as op
from ..utils import _get_path, _do_path_update
from ...utils import _fetch_file, _url_to_local_path, verbose
EEGMI_URL = 'https://physionet.org/files/eegmmidb/1.0.0/'
@verbose
def data_path(url, path=None, force_update=False, update_path=None,
verbose=None):
"... | {
"repo_name": "cjayb/mne-python",
"path": "mne/datasets/eegbci/eegbci.py",
"copies": "6",
"size": "6800",
"license": "bsd-3-clause",
"hash": -3731674217454894600,
"line_mean": 35.5591397849,
"line_max": 82,
"alpha_frac": 0.6013235294,
"autogenerated": false,
"ratio": 3.5416666666666665,
"config... |
"""Reader for existing document trees."""
from docutils import readers, utils, transforms
class Reader(readers.ReReader):
"""
Adapt the Reader API for an existing document tree.
The existing document tree must be passed as the ``source`` parameter to
the `docutils.core.Publisher` initializer, wrap... | {
"repo_name": "santisiri/popego",
"path": "envs/ALPHA-POPEGO/lib/python2.5/site-packages/docutils-0.4-py2.5.egg/docutils/readers/doctree.py",
"copies": "6",
"size": "1654",
"license": "bsd-3-clause",
"hash": -8538361207303785000,
"line_mean": 33.4583333333,
"line_max": 77,
"alpha_frac": 0.6704957678,... |
"""Reader for existing document trees."""
from docutils import readers, utils, transforms
class Reader(readers.ReReader):
"""
Adapt the Reader API for an existing document tree.
The existing document tree must be passed as the ``source`` parameter to
the `docutils.core.Publisher` initi... | {
"repo_name": "epall/selenium",
"path": "selenium/src/py/lib/docutils/readers/doctree.py",
"copies": "5",
"size": "1702",
"license": "apache-2.0",
"hash": 4202386913002875000,
"line_mean": 33.4583333333,
"line_max": 77,
"alpha_frac": 0.651586369,
"autogenerated": false,
"ratio": 4.364102564102564... |
__author__ = "Martin Etnestad Johansen"
__copyright__ = "Copyright 2015, Martin Etnestad Johansen"
from abc import ABCMeta, abstractstaticmethod
from collections import defaultdict, Counter
class ReorderingTransform(metaclass=ABCMeta):
@abstractstaticmethod
def iter_byte_indexes(len_bytes):
"""
... | {
"repo_name": "gnawybol/transforms",
"path": "transforms/reordering.py",
"copies": "1",
"size": "2869",
"license": "mit",
"hash": 7886626673031467000,
"line_mean": 25.8130841121,
"line_max": 90,
"alpha_frac": 0.591146741,
"autogenerated": false,
"ratio": 4.029494382022472,
"config_test": false,... |
__author__ = "Martin Felder, felder@in.tum.de"
from numpy import zeros, where, ravel, r_, single
from numpy.random import permutation
from pybrain.datasets import SupervisedDataSet, SequentialDataSet
class ClassificationDataSet(SupervisedDataSet):
""" Specialized data set for classification data. Classes are to b... | {
"repo_name": "abhishekgahlot/pybrain",
"path": "pybrain/datasets/classification.py",
"copies": "5",
"size": "14989",
"license": "bsd-3-clause",
"hash": -7355281591139591000,
"line_mean": 40.7520891365,
"line_max": 108,
"alpha_frac": 0.5909667089,
"autogenerated": false,
"ratio": 4.06978007059462... |
__author__ = 'Martin Felder, felder@in.tum.de'
from OpenGL.GL import * #@UnusedWildImport
from OpenGL.GLU import * #@UnusedWildImport
from OpenGL.GLUT import * #@UnusedWildImport
from math import acos, pi, sqrt
from tools.mathhelpers import crossproduct, norm, dotproduct
import time
import Image
from py... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/rl/environments/ode/viewer.py",
"copies": "1",
"size": "13226",
"license": "bsd-3-clause",
"hash": 255167451151536300,
"line_mean": 34.2693333333,
"line_max": 123,
"alpha_frac": 0.5523967942,
"autogenerated": false,
"ratio": 3.561120086160473... |
__author__ = 'Martin Felder, felder@in.tum.de'
from pybrain.rl.environments import EpisodicTask
from shipsteer import ShipSteeringEnvironment
class GoNorthwardTask(EpisodicTask):
""" The task of balancing some pole(s) on a cart """
def __init__(self, env=None, maxsteps=1000):
"""
:key env: (... | {
"repo_name": "rbalda/neural_ocr",
"path": "env/lib/python2.7/site-packages/pybrain/rl/environments/shipsteer/northwardtask.py",
"copies": "3",
"size": "1677",
"license": "mit",
"hash": 4903229586892030000,
"line_mean": 31.25,
"line_max": 93,
"alpha_frac": 0.5247465713,
"autogenerated": false,
"r... |
__author__ = 'Martin Felder, felder@in.tum.de'
from pybrain.rl.environments import EpisodicTask
from .shipsteer import ShipSteeringEnvironment
class GoNorthwardTask(EpisodicTask):
""" The task of balancing some pole(s) on a cart """
def __init__(self, env=None, maxsteps=1000):
"""
:key env: ... | {
"repo_name": "styskin/pybrain",
"path": "pybrain/rl/environments/shipsteer/northwardtask.py",
"copies": "25",
"size": "1592",
"license": "bsd-3-clause",
"hash": -95979775169281280,
"line_mean": 29.6153846154,
"line_max": 93,
"alpha_frac": 0.5527638191,
"autogenerated": false,
"ratio": 3.53777777... |
__author__ = 'Martin Felder, felder@in.tum.de'
from pybrain.rl.tasks import EpisodicTask
from shipsteer import ShipSteeringEnvironment
class GoNorthwardTask(EpisodicTask):
""" The task of balancing some pole(s) on a cart """
def __init__(self, env = None, maxsteps = 1000):
"""
@param env: (o... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/rl/environments/shipsteer/northwardtask.py",
"copies": "1",
"size": "1650",
"license": "bsd-3-clause",
"hash": -7769601794404610000,
"line_mean": 30.7307692308,
"line_max": 91,
"alpha_frac": 0.5224242424,
"autogenerated": false,
"ratio": 3.68... |
__author__ = 'Martin Felder, felder@in.tum.de'
from scipy import random
from pybrain.tools.networking.udpconnection import UDPServer
import threading
from pybrain.utilities import threaded
from time import sleep
from pybrain.rl.environments.environment import Environment
class ShipSteeringEnvironment(Environment):
... | {
"repo_name": "Neural-Network/TicTacToe",
"path": "pybrain/rl/environments/shipsteer/shipsteer.py",
"copies": "31",
"size": "4170",
"license": "bsd-3-clause",
"hash": 4586759278276096000,
"line_mean": 31.3255813953,
"line_max": 93,
"alpha_frac": 0.5690647482,
"autogenerated": false,
"ratio": 3.79... |
__author__ = "Martin Felder, felder@in.tum.de"
try:
from svm import svm_model, svm_parameter, svm_problem, cross_validation #@UnresolvedImport
from svm import C_SVC, NU_SVC, ONE_CLASS, EPSILON_SVR, NU_SVR #@UnresolvedImport @UnusedImport
from svm import LINEAR, POLY, RBF, SIGMOID, PRECOMPUTED #@Unresolved... | {
"repo_name": "rbalda/neural_ocr",
"path": "env/lib/python2.7/site-packages/pybrain/supervised/trainers/svmtrainer.py",
"copies": "1",
"size": "15887",
"license": "mit",
"hash": -7228766766194480000,
"line_mean": 39.631713555,
"line_max": 162,
"alpha_frac": 0.562157739,
"autogenerated": false,
"r... |
__author__ = "Martin Felder, felder@in.tum.de"
__version__ = '$Id$'
from svm import svm_model, svm_parameter, svm_problem, cross_validation
from svm import C_SVC, NU_SVC, ONE_CLASS, EPSILON_SVR, NU_SVR
from svm import LINEAR, POLY, RBF, SIGMOID, PRECOMPUTED
from numpy import *
import logging
class SVMTrainer(object... | {
"repo_name": "daanwierstra/pybrain",
"path": "pybrain/supervised/trainers/svmtrainer.py",
"copies": "1",
"size": "15536",
"license": "bsd-3-clause",
"hash": 1455946047362074000,
"line_mean": 39.4583333333,
"line_max": 160,
"alpha_frac": 0.5652677652,
"autogenerated": false,
"ratio": 3.7409101854... |
__author__ = "Martin Felder"
__version__ = '$Id: exampleRNN.py 1503 2008-09-13 15:25:06Z bayerj $'
try:
from svm import svm_model
except ImportError:
raise ImportError("Cannot find LIBSVM installation. Make sure svm.py and svmc.* are in the PYTHONPATH!")
class SVMUnit(object):
""" This unit represents an ... | {
"repo_name": "rbalda/neural_ocr",
"path": "env/lib/python2.7/site-packages/pybrain/structure/modules/svmunit.py",
"copies": "3",
"size": "3595",
"license": "mit",
"hash": -7553768197429112000,
"line_mean": 41.7976190476,
"line_max": 108,
"alpha_frac": 0.6278164117,
"autogenerated": false,
"ratio... |
__author__ = "Martin Jakomin, Mateja Rojko"
from bool import Var, Neg, And, Or, Const, cnf, nnf, simplify, solve
from sat import sat
from sat_converter import sudoku2SAT, graph2SAT
print "~~~~OPERATORS~~~~"
# Constants - Const
tr = Const(True)
fl = Const(False)
print "Constants:", tr, ",", fl
# Variable - Var
op = ... | {
"repo_name": "MartinGHub/lvr-sat",
"path": "SAT/examples.py",
"copies": "1",
"size": "3995",
"license": "bsd-3-clause",
"hash": -5803423408676745000,
"line_mean": 32.2916666667,
"line_max": 173,
"alpha_frac": 0.4916145181,
"autogenerated": false,
"ratio": 2.2802511415525113,
"config_test": fal... |
_author__ = 'Martin Jakomin, Mateja Rojko'
from bool import Var, Neg, And, Or, Const, cnf, simplify_cnf, nnf, simplify, solve
from sat import sat, get_literals
from sat_converter import sudoku2SAT, graph2SAT
import unittest
class SatTests(unittest.TestCase):
"""
Unit tests for functions:
- nnf
- cnf... | {
"repo_name": "MartinGHub/lvr-sat",
"path": "SAT/test.py",
"copies": "1",
"size": "26604",
"license": "bsd-3-clause",
"hash": 3267213983449219600,
"line_mean": 73.7303370787,
"line_max": 504,
"alpha_frac": 0.4999624117,
"autogenerated": false,
"ratio": 2.8665014545846352,
"config_test": true,
... |
__author__ = "Martin Jakomin, Mateja Rojko"
"""
Classes for boolean operators:
- Var
- Neg
- Or
- And
- Const
Functions:
- nnf
- simplify
- cnf
- solve
- simplify_cnf
"""
import itertools
# functions
def nnf(f):
""" Returns negation normal form """
return f.nnf()
def simplify(f):
""" Simplifies th... | {
"repo_name": "MartinGHub/lvr-sat",
"path": "SAT/bool.py",
"copies": "1",
"size": "6053",
"license": "bsd-3-clause",
"hash": -471220664340900350,
"line_mean": 19.3804713805,
"line_max": 64,
"alpha_frac": 0.4812489675,
"autogenerated": false,
"ratio": 3.6332533013205284,
"config_test": false,
... |
__author__ = "Martin Jakomin, Mateja Rojko"
"""
Conversion of multiple problems to Boolean expressions (for SAT solving):
- n-coloring of a graph
- Sudoku
"""
from collections import defaultdict
from bool import Var, Neg, And, Or
# functions
def graph2SAT(V, E, n):
"""
n-coloring of a graph G=(V,E)
E... | {
"repo_name": "MartinGHub/lvr-sat",
"path": "SAT/sat_converter.py",
"copies": "1",
"size": "2689",
"license": "bsd-3-clause",
"hash": -2653620152673212400,
"line_mean": 25.362745098,
"line_max": 100,
"alpha_frac": 0.4209743399,
"autogenerated": false,
"ratio": 2.718907987866532,
"config_test": ... |
__author__ = "Martin Jakomin, Mateja Rojko"
"""
SAT solver based on DPLL algorithm
Functions:
- get_literals
- sat
"""
from bool import Var, Neg, And, Or, Const, cnf, simplify_cnf
# functions
def get_literals(f):
"""
Gets a dictionary of all literals with information about their purity and independence
... | {
"repo_name": "MartinGHub/lvr-sat",
"path": "SAT/sat.py",
"copies": "1",
"size": "3128",
"license": "bsd-3-clause",
"hash": 4396930922179188000,
"line_mean": 22.5187969925,
"line_max": 112,
"alpha_frac": 0.516943734,
"autogenerated": false,
"ratio": 3.5146067415730338,
"config_test": false,
"... |
# Parts of this code were copied from NiTime http://nipy.sourceforge.net/nitime
from warnings import warn
import numpy as np
from scipy import fftpack, linalg, interpolate
import warnings
from ..parallel import parallel_func
from ..utils import verbose, sum_squared
def tridisolve(d, e, b, overwrite_b=True):
""... | {
"repo_name": "effigies/mne-python",
"path": "mne/time_frequency/multitaper.py",
"copies": "2",
"size": "17599",
"license": "bsd-3-clause",
"hash": -2341423405805552600,
"line_mean": 30.9981818182,
"line_max": 79,
"alpha_frac": 0.5766804932,
"autogenerated": false,
"ratio": 3.3566660308983405,
... |
# Parts of this code were copied from NiTime http://nipy.sourceforge.net/nitime
from warnings import warn
import numpy as np
from scipy import fftpack, linalg, interpolate
from ..parallel import parallel_func
from ..utils import verbose, sum_squared
def tridisolve(d, e, b, overwrite_b=True):
"""
Symmetric ... | {
"repo_name": "jaeilepp/eggie",
"path": "mne/time_frequency/multitaper.py",
"copies": "1",
"size": "17354",
"license": "bsd-2-clause",
"hash": -3397773331011539000,
"line_mean": 30.8422018349,
"line_max": 79,
"alpha_frac": 0.5771003803,
"autogenerated": false,
"ratio": 3.347608024691358,
"confi... |
# Parts of this code were copied from NiTime http://nipy.sourceforge.net/nitime
from warnings import warn
import numpy as np
from scipy import fftpack, linalg
import warnings
from ..parallel import parallel_func
from ..utils import verbose, sum_squared, deprecated
def tridisolve(d, e, b, overwrite_b=True):
"""... | {
"repo_name": "cmoutard/mne-python",
"path": "mne/time_frequency/multitaper.py",
"copies": "1",
"size": "19776",
"license": "bsd-3-clause",
"hash": 7551058929296967000,
"line_mean": 31.5799011532,
"line_max": 79,
"alpha_frac": 0.5791363269,
"autogenerated": false,
"ratio": 3.4190871369294604,
"... |
# Parts of this code were copied from NiTime http://nipy.sourceforge.net/nitime
import numpy as np
from scipy import fftpack, linalg
from ..parallel import parallel_func
from ..utils import sum_squared, warn
def tridisolve(d, e, b, overwrite_b=True):
"""
Symmetric tridiagonal system solver, from Golub and ... | {
"repo_name": "alexandrebarachant/mne-python",
"path": "mne/time_frequency/multitaper.py",
"copies": "5",
"size": "18687",
"license": "bsd-3-clause",
"hash": 1596488341828146700,
"line_mean": 32.3101604278,
"line_max": 79,
"alpha_frac": 0.5790656606,
"autogenerated": false,
"ratio": 3.33875290334... |
# Parts of this code were copied from NiTime http://nipy.sourceforge.net/nitime
import numpy as np
from scipy import fftpack, linalg
from ..parallel import parallel_func
from ..utils import verbose, sum_squared, deprecated, warn
def tridisolve(d, e, b, overwrite_b=True):
"""
Symmetric tridiagonal system so... | {
"repo_name": "wronk/mne-python",
"path": "mne/time_frequency/multitaper.py",
"copies": "2",
"size": "20641",
"license": "bsd-3-clause",
"hash": 2435834003820523000,
"line_mean": 32.453808752,
"line_max": 79,
"alpha_frac": 0.5814156291,
"autogenerated": false,
"ratio": 3.387657968160184,
"confi... |
# Parts of this code were copied from NiTime http://nipy.sourceforge.net/nitime
import operator
import numpy as np
from scipy import linalg
from ..parallel import parallel_func
from ..utils import sum_squared, warn, verbose, logger
def tridisolve(d, e, b, overwrite_b=True):
"""Symmetric tridiagonal system solv... | {
"repo_name": "teonlamont/mne-python",
"path": "mne/time_frequency/multitaper.py",
"copies": "4",
"size": "23259",
"license": "bsd-3-clause",
"hash": 7284130161432912000,
"line_mean": 33.8710644678,
"line_max": 79,
"alpha_frac": 0.5842899523,
"autogenerated": false,
"ratio": 3.4099105702976105,
... |
# Parts of this code were copied from NiTime http://nipy.sourceforge.net/nitime
import operator
import numpy as np
from ..fixes import _get_dpss
from ..parallel import parallel_func
from ..utils import sum_squared, warn, verbose, logger, _check_option
def dpss_windows(N, half_nbw, Kmax, low_bias=True, interp_from=... | {
"repo_name": "adykstra/mne-python",
"path": "mne/time_frequency/multitaper.py",
"copies": "1",
"size": "18647",
"license": "bsd-3-clause",
"hash": 6517981224593222000,
"line_mean": 33.7243947858,
"line_max": 79,
"alpha_frac": 0.5907116426,
"autogenerated": false,
"ratio": 3.481516056758775,
"c... |
# Parts of this code were copied from NiTime http://nipy.sourceforge.net/nitime
import operator
import numpy as np
from ..fixes import _get_dpss, rfft, irfft, rfftfreq
from ..parallel import parallel_func
from ..utils import sum_squared, warn, verbose, logger, _check_option
def dpss_windows(N, half_nbw, Kmax, low_... | {
"repo_name": "cjayb/mne-python",
"path": "mne/time_frequency/multitaper.py",
"copies": "2",
"size": "18569",
"license": "bsd-3-clause",
"hash": 5858111137492562000,
"line_mean": 33.8386491557,
"line_max": 79,
"alpha_frac": 0.5902848834,
"autogenerated": false,
"ratio": 3.4805998125585753,
"con... |
# Parts of this code were copied from NiTime http://nipy.sourceforge.net/nitime
import operator
import numpy as np
from ..fixes import _import_fft
from ..parallel import parallel_func
from ..utils import sum_squared, warn, verbose, logger, _check_option
def dpss_windows(N, half_nbw, Kmax, low_bias=True, interp_fro... | {
"repo_name": "drammock/mne-python",
"path": "mne/time_frequency/multitaper.py",
"copies": "5",
"size": "18815",
"license": "bsd-3-clause",
"hash": -1682303598340643600,
"line_mean": 33.9721189591,
"line_max": 79,
"alpha_frac": 0.5908583577,
"autogenerated": false,
"ratio": 3.470761852056816,
"... |
# Parts of this code were copied from NiTime http://nipy.sourceforge.net/nitime
import operator
import numpy as np
from ..fixes import rfft, irfft, rfftfreq
from ..parallel import parallel_func
from ..utils import sum_squared, warn, verbose, logger, _check_option
def dpss_windows(N, half_nbw, Kmax, low_bias=True, ... | {
"repo_name": "olafhauk/mne-python",
"path": "mne/time_frequency/multitaper.py",
"copies": "4",
"size": "18682",
"license": "bsd-3-clause",
"hash": 22441103795019050,
"line_mean": 33.9196261682,
"line_max": 79,
"alpha_frac": 0.5909431538,
"autogenerated": false,
"ratio": 3.47960514062209,
"conf... |
import os.path as op
import numpy as np
from nose.tools import assert_true
from numpy.testing import assert_array_almost_equal
from mne.datasets import sample
from mne import read_cov, read_forward_solution, read_evokeds
from mne.cov import regularize
from mne.inverse_sparse import gamma_map
data_path = sample.data_... | {
"repo_name": "jaeilepp/eggie",
"path": "mne/inverse_sparse/tests/test_gamma_map.py",
"copies": "2",
"size": "1903",
"license": "bsd-2-clause",
"hash": 6003651233035691000,
"line_mean": 36.3137254902,
"line_max": 75,
"alpha_frac": 0.6468733579,
"autogenerated": false,
"ratio": 2.9968503937007873,... |
import math
import numpy as np
from pysound.buffer import create_buffer
def create_sine_table(size):
args = np.linspace(0.0, 2*math.pi, num=size, endpoint=False)
return np.sin(args)
def square_wave(params, frequency=400, amplitude=1,
offset=0, ratio=0.5):
'''
Generate a square wave
... | {
"repo_name": "martinmcbride/pysound",
"path": "pysound/oscillators.py",
"copies": "1",
"size": "5715",
"license": "mit",
"hash": -1012536591863999100,
"line_mean": 38.1438356164,
"line_max": 108,
"alpha_frac": 0.6810148731,
"autogenerated": false,
"ratio": 3.898362892223738,
"config_test": fal... |
import numpy as np
from functools import reduce
def modulator(sources=None):
'''
Multiply all sources
:param sources: list of arrays, must all be same length
:return:
'''
if not sources:
return np.zeros(0)
return reduce(np.multiply, sources)
def adder(sources=None):
... | {
"repo_name": "martinmcbride/pysound",
"path": "pysound/mixers.py",
"copies": "1",
"size": "1246",
"license": "mit",
"hash": 6172697742134076000,
"line_mean": 27.976744186,
"line_max": 110,
"alpha_frac": 0.6428571429,
"autogenerated": false,
"ratio": 3.869565217391304,
"config_test": false,
"... |
# Numpy array is used to store sound data
import numpy as np
class BufferParams:
'''
Length and sample rate of a buffer
'''
def __init__(self, value=None):
'''
Create parameters
:param value: sample rate to use, defaults to 11025
If value is a BufferParams, copy i... | {
"repo_name": "martinmcbride/pysound",
"path": "pysound/buffer.py",
"copies": "1",
"size": "3188",
"license": "mit",
"hash": 3017836908988404700,
"line_mean": 27.9818181818,
"line_max": 100,
"alpha_frac": 0.5730865747,
"autogenerated": false,
"ratio": 4.076726342710997,
"config_test": false,
... |
from pysound import buffer
import numpy as np
def join(buffers):
return np.concatenate(buffers)
class BasicSequence:
def __init__(self, params, instrument, step):
self.params = params
self.instrument = instrument
self.step = step
self.buffer = buffer.create_buffer(params, 0)... | {
"repo_name": "martinmcbride/pysound",
"path": "pysound/sequencers.py",
"copies": "1",
"size": "1282",
"license": "mit",
"hash": 2599561815979315700,
"line_mean": 29.5238095238,
"line_max": 80,
"alpha_frac": 0.6521060842,
"autogenerated": false,
"ratio": 3.7267441860465116,
"config_test": false... |
import cairo
import numpy as np
from PIL import Image
'''
The movie functions operate pn lazy sequences of images. The images are stored as numpy arrays.
'''
def normalise_array(array):
"""
If greyscale array has a shape [a, b, 1] it must be normalised to [a, b] otherwise
the pillow fromarray function wi... | {
"repo_name": "martinmcbride/pytexture",
"path": "generativepy/movie.py",
"copies": "1",
"size": "1738",
"license": "mit",
"hash": -2262083811203520000,
"line_mean": 27.4918032787,
"line_max": 95,
"alpha_frac": 0.6547756041,
"autogenerated": false,
"ratio": 3.7947598253275108,
"config_test": fa... |
import cairo
import math
from generativepy.drawing import LEFT, CENTER, RIGHT, BOTTOM, MIDDLE, BASELINE, TOP
from generativepy.drawing import WINDING
from generativepy.drawing import MITER, ROUND, BEVEL, BUTT, SQUARE
from generativepy.drawing import LINE, RAY, SEGMENT
from generativepy.color import Color
# DEPRECATED ... | {
"repo_name": "martinmcbride/pytexture",
"path": "generativepy/geometry.py",
"copies": "1",
"size": "23075",
"license": "mit",
"hash": -1737104808354898200,
"line_mean": 27.8077403246,
"line_max": 164,
"alpha_frac": 0.5384182015,
"autogenerated": false,
"ratio": 3.1713853765805387,
"config_test... |
import math
class Tween():
'''
Tweening class for scalar values
Initial value is set on construction.
wait() maintains the current value for the requested number of frames
pad() similar to wait, but pads until the total length of the tween is the required size.
set() sets a new current va... | {
"repo_name": "martinmcbride/pytexture",
"path": "generativepy/tween.py",
"copies": "1",
"size": "7231",
"license": "mit",
"hash": -6644751898270942000,
"line_mean": 28.6352459016,
"line_max": 120,
"alpha_frac": 0.5692158761,
"autogenerated": false,
"ratio": 3.4647819837086726,
"config_test": f... |
import cairo
import math
import numpy as np
from generativepy.geometry import text, Polygon
from generativepy.color import Color
from generativepy import drawing
class Axes:
def __init__(self, ctx, start=(0, 0), extent=(10, 10), divisions=(1, 1), pixel_divider=10):
self.ctx = ctx
self.start = st... | {
"repo_name": "martinmcbride/pytexture",
"path": "generativepy/graph.py",
"copies": "1",
"size": "8051",
"license": "mit",
"hash": 4462885292175015400,
"line_mean": 39.6616161616,
"line_max": 113,
"alpha_frac": 0.5983107688,
"autogenerated": false,
"ratio": 3.3365105677579776,
"config_test": fa... |
import colorsys
import itertools
cssColors = {
"indianred":(205,92,92),
"lightcoral":(240,128,128),
"salmon":(250,128,114),
"darksalmon":(233,150,122),
"lightsalmon":(255,160,122),
"crimson":(220,20,60),
"red":(255,0,0),
"firebrick":(178,34,34),
"darkred":(139,0,0),
"pink":(255,192,203),
"lightpink":(255,182,193),
"h... | {
"repo_name": "martinmcbride/pytexture",
"path": "generativepy/color.py",
"copies": "1",
"size": "12386",
"license": "mit",
"hash": -8490204181060607000,
"line_mean": 29.1362530414,
"line_max": 114,
"alpha_frac": 0.5918779267,
"autogenerated": false,
"ratio": 2.7073224043715847,
"config_test": ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.