repo_name
stringlengths
6
67
path
stringlengths
5
185
copies
stringlengths
1
3
size
stringlengths
4
6
content
stringlengths
1.02k
962k
license
stringclasses
15 values
pederka/pythonBoids2D
flock.py
1
1786
'''Module containing the Flock class, meant for containing a group of Bird and Predator objects ''' import random import matplotlib.pyplot as plt from predator import Predator from bird import Bird class Flock(object): ''' Class for groups of birds and a possible predator ''' def __init__(self, number, se...
mit
OshynSong/scikit-learn
sklearn/metrics/cluster/bicluster.py
359
2797
from __future__ import division import numpy as np from sklearn.utils.linear_assignment_ import linear_assignment from sklearn.utils.validation import check_consistent_length, check_array __all__ = ["consensus_score"] def _check_rows_and_columns(a, b): """Unpacks the row and column arrays and checks their shap...
bsd-3-clause
eickenberg/scikit-learn
examples/text/document_clustering.py
8
8032
""" ======================================= Clustering text documents using k-means ======================================= This is an example showing how the scikit-learn can be used to cluster documents by topics using a bag-of-words approach. This example uses a scipy.sparse matrix to store the features instead of ...
bsd-3-clause
smblance/ggplot
ggplot/utils/utils.py
12
2636
""" Little functions used all over the codebase """ from __future__ import (absolute_import, division, print_function, unicode_literals) import numpy as np import matplotlib.cbook as cbook import six def pop(dataframe, key, default): """ Pop element *key* from dataframe and return it....
bsd-2-clause
JoulesCESAR/domain_wall
polarization_three.py
1
2447
# Script for calculation of ferroelectric wall domain profile from math import * from numpy import * import matplotlib.pyplot as plt axes = plt.gca() axes.set_xlim([-0.6,0.6]) axes.set_ylim([-0.8,0.8]) beta = -2.92e8 g = 0.54e-10 xi = 1.56e9 alpha0 = 7.6e5 q11 = 0.089 q12 = -0.026 s11 = -2.5 s12 = 9.0 e = 4.0/((8.8...
gpl-3.0
abhishekkrthakur/scikit-learn
sklearn/manifold/tests/test_locally_linear.py
41
4827
from itertools import product from nose.tools import assert_true import numpy as np from numpy.testing import assert_almost_equal, assert_array_almost_equal from scipy import linalg from sklearn import neighbors, manifold from sklearn.manifold.locally_linear import barycenter_kneighbors_graph from sklearn.utils.testi...
bsd-3-clause
lthurlow/Network-Grapher
proj/external/matplotlib-1.2.1/lib/mpl_examples/user_interfaces/embedding_in_wx3.py
9
4849
#!/usr/bin/env python """ Copyright (C) 2003-2004 Andrew Straw, Jeremy O'Donoghue and others License: This work is licensed under the PSF. A copy should be included with this source code, and is also available at http://www.python.org/psf/license.html This is yet another example of using matplotlib with wx. Hopeful...
mit
bavardage/statsmodels
statsmodels/graphics/boxplots.py
4
15866
"""Variations on boxplots.""" # Author: Ralf Gommers # Based on code by Flavio Coelho and Teemu Ikonen. import numpy as np from scipy.stats import gaussian_kde from . import utils __all__ = ['violinplot', 'beanplot'] def violinplot(data, ax=None, labels=None, positions=None, side='both', show_box...
bsd-3-clause
openp2pdesign/PyMakerspaces
makerlabs/makeinitaly_foundation.py
2
7684
# -*- encoding: utf-8 -*- # # Access data from makeinitaly.foundation # # Author: Massimo Menichinelli # Homepage: http://www.openp2pdesign.org # License: LGPL v.3 # # from classes import Lab import json from simplemediawiki import MediaWiki import pandas as pd makeinitaly__foundation_api_url = "http://makeinitaly...
lgpl-3.0
depet/scikit-learn
sklearn/decomposition/tests/test_sparse_pca.py
5
6098
# Author: Vlad Niculae # License: BSD 3 clause import sys import numpy as np from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import SkipTest from sklearn.utils.testing import ass...
bsd-3-clause
XiaoxiaoLiu/morphology_analysis
bigneuron/comparison_and_plots.py
1
4676
__author__ = 'xiaoxiaoliu' import pandas as pd import numpy as np import os from os import sys, path import seaborn as sb import matplotlib.pyplot as plt WORK_PATH = "/Users/xiaoxiaoliu/work" p = WORK_PATH + '/src/morphology_analysis' sys.path.append(p) sb.set_context("poster") data_DIR = WORK_PATH+"/data/201510...
gpl-3.0
andaag/scikit-learn
examples/ensemble/plot_adaboost_hastie_10_2.py
355
3576
""" ============================= Discrete versus Real AdaBoost ============================= This example is based on Figure 10.2 from Hastie et al 2009 [1] and illustrates the difference in performance between the discrete SAMME [2] boosting algorithm and real SAMME.R boosting algorithm. Both algorithms are evaluate...
bsd-3-clause
fabioticconi/scikit-learn
sklearn/externals/joblib/parallel.py
31
35665
""" Helpers for embarrassingly parallel code. """ # Author: Gael Varoquaux < gael dot varoquaux at normalesup dot org > # Copyright: 2010, Gael Varoquaux # License: BSD 3 clause from __future__ import division import os import sys import gc import warnings from math import sqrt import functools import time import thr...
bsd-3-clause
ericdill/xray-vision
xray_vision/__init__.py
3
3200
# ###################################################################### # Copyright (c) 2014, Brookhaven Science Associates, Brookhaven # # National Laboratory. All rights reserved. # # # # Redistribution and use in ...
bsd-3-clause
RNAer/Calour
calour/tests/test_transforming.py
1
5611
# ---------------------------------------------------------------------------- # Copyright (c) 2016--, Calour development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. # -----------------------------------------------...
bsd-3-clause
guziy/basemap
examples/nsper_demo.py
2
1909
from __future__ import (absolute_import, division, print_function) from mpl_toolkits.basemap import Basemap import numpy as np import matplotlib.pyplot as plt import sys def get_input(prompt): if sys.hexversion > 0x03000000: return input(prompt) else: return raw_input(prompt) # create Basemap...
gpl-2.0
wheeler-microfluidics/pulse-counter-rpc
rename.py
1
2569
import sys import pandas as pd from path_helpers import path def main(root, old_name, new_name): names = pd.Series([old_name, new_name], index=['old', 'new']) underscore_names = names.map(lambda v: v.replace('-', '_')) camel_names = names.str.split('-').map(lambda x: ''.join([y.title() ...
gpl-3.0
prheenan/Research
Perkins/Projects/WetLab/Demos/Dilutions/2016-9-31-SolutionProtocols/2016-11-4-strept-standard-dilution/main_strept.py
1
1815
# force floating point division. Can still use integer with // from __future__ import division # This file is used for importing the common utilities classes. import numpy as np import matplotlib.pyplot as plt import sys sys.path.append("../../../../") from Util import DilutionUtil def run(): """ For aliquot...
gpl-3.0
rishikksh20/scikit-learn
sklearn/datasets/tests/test_base.py
16
9390
import os import shutil import tempfile import warnings import numpy from pickle import loads from pickle import dumps from sklearn.datasets import get_data_home from sklearn.datasets import clear_data_home from sklearn.datasets import load_files from sklearn.datasets import load_sample_images from sklearn.datasets im...
bsd-3-clause
cbmoore/statsmodels
statsmodels/datasets/anes96/data.py
25
4146
"""American National Election Survey 1996""" __docformat__ = 'restructuredtext' COPYRIGHT = """This is public domain.""" TITLE = __doc__ SOURCE = """ http://www.electionstudies.org/ The American National Election Studies. """ DESCRSHORT = """This data is a subset of the American National Election Stud...
bsd-3-clause
Averroes/statsmodels
statsmodels/sandbox/examples/thirdparty/findow_1.py
33
2548
# -*- coding: utf-8 -*- """A quick look at volatility of stock returns for 2009 Just an exercise to find my way around the pandas methods. Shows the daily rate of return, the square of it (volatility) and a 5 day moving average of the volatility. No guarantee for correctness. Assumes no missing values. colors of lines...
bsd-3-clause
rcrowder/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/contour.py
69
42063
""" These are classes to support contour plotting and labelling for the axes class """ from __future__ import division import warnings import matplotlib as mpl import numpy as np from numpy import ma import matplotlib._cntr as _cntr import matplotlib.path as path import matplotlib.ticker as ticker import matplotlib.cm...
agpl-3.0
NUAAXXY/globOpt
evaluation/generatePolarPrimDirections.py
2
9382
from pylab import * import argparse import packages.primitive as primitive import scipy.signal parser = argparse.ArgumentParser(description='Generate polar view of the lines directions.') parser.add_argument('primitivefile') parser.add_argument('--shownormals', action="store_true", help="Shows the normal distribution ...
apache-2.0
devanshdalal/scikit-learn
examples/linear_model/plot_logistic_l1_l2_sparsity.py
384
2601
""" ============================================== L1 Penalty and Sparsity in Logistic Regression ============================================== Comparison of the sparsity (percentage of zero coefficients) of solutions when L1 and L2 penalty are used for different values of C. We can see that large values of C give mo...
bsd-3-clause
vybstat/scikit-learn
examples/model_selection/plot_train_error_vs_test_error.py
349
2577
""" ========================= Train error vs Test error ========================= Illustration of how the performance of an estimator on unseen data (test data) is not the same as the performance on training data. As the regularization increases the performance on train decreases while the performance on test is optim...
bsd-3-clause
LingyuMa/kaggle_planet
src/models/predict_model.py
1
4441
import tensorflow as tf import time from datetime import datetime import numpy as np import math import os import src.models.network as network import src.data.data_provider as data import src.settings as settings from sklearn.metrics import fbeta_score def f2_score(y_true, y_pred): y_true = tf.cast(y_true, "i...
mit
gef756/statsmodels
statsmodels/tsa/filters/filtertools.py
25
12438
# -*- coding: utf-8 -*- """Linear Filters for time series analysis and testing TODO: * check common sequence in signature of filter functions (ar,ma,x) or (x,ar,ma) Created on Sat Oct 23 17:18:03 2010 Author: Josef-pktd """ #not original copied from various experimental scripts #version control history is there fr...
bsd-3-clause
gurgeh/data-preppy
cluster_csv.py
1
2053
import csv import sys import pandas as pd from sklearn import cluster from numpy.linalg import norm """ group = cc.mb.predict(cc.df) cluster_csv.output_cluster(cc.mb, group, '1.csv', '2.csv') """ class ClusterCSV: def __init__(self, fname='../data/filtered_fixed.csv', nr_clusters=5): self.fname = fna...
apache-2.0
xmnlab/skdata
skdata/widgets.py
2
9651
from abc import ABCMeta, abstractmethod from IPython.display import display, update_display from ipywidgets import widgets, IntSlider # locals from import from .utils import plot2html from .data import cross_fields from .data import SkData import numpy as np import pandas as pd class SkDataWidget: """ """ ...
mit
pyspace/pyspace
pySPACE/missions/nodes/scikit_nodes.py
1
33408
# -*- coding:utf-8; -*- """ Wrap the algorithms defined in `scikit.learn <http://scikit-learn.org/>`_ in pySPACE nodes For details on parameter usage look at the `scikit documentation <http://scikit-learn.org/>`_ or the wrapped documentation of pySPACE: :ref:`scikit_nodes`. The parameters given in the node specificati...
bsd-3-clause
luo66/scikit-learn
examples/ensemble/plot_forest_iris.py
335
6271
""" ==================================================================== Plot the decision surfaces of ensembles of trees on the iris dataset ==================================================================== Plot the decision surfaces of forests of randomized trees trained on pairs of features of the iris dataset. ...
bsd-3-clause
winklerand/pandas
pandas/tests/test_expressions.py
3
18169
# -*- coding: utf-8 -*- from __future__ import print_function # pylint: disable-msg=W0612,E1101 from warnings import catch_warnings import re import operator import pytest from numpy.random import randn import numpy as np from pandas.core.api import DataFrame, Panel from pandas.core.computation import expressions a...
bsd-3-clause
bdmckean/MachineLearning
fall_2017/hw2/feature_eng.py
1
8400
import os import json from csv import DictReader, DictWriter import numpy as np from numpy import array from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer from sklearn.linear_model import SGDClassifier from sklearn.model_selection import train_test_split from sklearn.base import BaseEstimato...
mit
tkhirianov/kpk2016
graphs/input_graph.py
1
2588
import networkx import matplotlib.pyplot as plt def input_edges_list(): """считывает список рёбер в форме: в первой строке N - число рёбер, затем следует N строк из двух слов и одного числа слова - названия вершин, концы ребра, а число - его вес return граф в форме словаря рёбер и соответствую...
gpl-3.0
paulray/NICERsoft
scripts/cr_cut.py
1
8209
#!/usr/bin/env python from __future__ import print_function, division import os, sys import matplotlib.pyplot as plt import numpy as np import argparse from astropy import log from os import path from glob import glob from subprocess import check_call import shutil from astropy.table import Table from astropy.io import...
mit
detrout/debian-statsmodels
statsmodels/graphics/functional.py
31
14477
"""Module for functional boxplots.""" from statsmodels.compat.python import combinations, range import numpy as np from scipy import stats from scipy.misc import factorial from . import utils __all__ = ['fboxplot', 'rainbowplot', 'banddepth'] def fboxplot(data, xdata=None, labels=None, depth=None, method='MBD', ...
bsd-3-clause
TomAugspurger/pandas
pandas/tests/indexing/multiindex/test_chaining_and_caching.py
1
1979
import numpy as np import pytest from pandas import DataFrame, MultiIndex, Series import pandas._testing as tm import pandas.core.common as com def test_detect_chained_assignment(): # Inplace ops, originally from: # https://stackoverflow.com/questions/20508968/series-fillna-in-a-multiindex-dataframe-does-not...
bsd-3-clause
tensorflow/model-analysis
tensorflow_model_analysis/api/model_eval_lib.py
1
64480
# Lint as: python3 # Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
apache-2.0
flowdy/sompyler
tests/pitch-reception-test.py
1
1821
from sine2wav import write_wavefile from Sompyler.synthesizer import normalize_amplitude # import matplotlib.pyplot as plt from Sompyler.instrument import Variation def write_file(sound, filename): print "Writing", filename normalize_amplitude(sound) channels = ((x for x in sound),) write_wavefile(fil...
gpl-3.0
hrjn/scikit-learn
sklearn/tests/test_cross_validation.py
79
47914
"""Test the cross_validation module""" from __future__ import division import warnings import numpy as np from scipy.sparse import coo_matrix from scipy.sparse import csr_matrix from scipy import stats from sklearn.exceptions import ConvergenceWarning from sklearn.utils.testing import assert_true from sklearn.utils.t...
bsd-3-clause
msbeta/apollo
modules/tools/realtime_plot/stitem.py
5
2611
#!/usr/bin/env python ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy ...
apache-2.0
msyriac/alhazen
tests/varyBeam.py
1
3943
import matplotlib matplotlib.use('Agg') from orphics.tools.io import Plotter,dictFromSection,listFromConfig,getFileNameString import flipper.liteMap as lm from szlib.szcounts import ClusterCosmology from alhazen.halos import NFWMatchedFilterSN import numpy as np from orphics.tools.cmb import loadTheorySpectraFromCAMB f...
gpl-3.0
DonBeo/scikit-learn
sklearn/setup.py
225
2856
import os from os.path import join import warnings def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration from numpy.distutils.system_info import get_info, BlasNotFoundError import numpy libraries = [] if os.name == 'posix': libraries.appe...
bsd-3-clause
DSLituiev/scikit-learn
sklearn/semi_supervised/label_propagation.py
14
15965
# coding=utf8 """ Label propagation in the context of this module refers to a set of semisupervised classification algorithms. In the high level, these algorithms work by forming a fully-connected graph between all points given and solving for the steady-state distribution of labels at each point. These algorithms per...
bsd-3-clause
white-lab/pyproteome
pyproteome/motifs/logo.py
1
11772
from collections import Counter import logging import os import re from matplotlib import transforms from matplotlib import pyplot as plt import matplotlib.patches as patches from matplotlib.text import TextPath from matplotlib.patches import PathPatch from matplotlib.font_manager import FontProperties import numpy a...
bsd-2-clause
dongjoon-hyun/tensorflow
tensorflow/contrib/learn/python/learn/grid_search_test.py
137
2035
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
apache-2.0
mauriceleutenegger/windprofile
WindAbsorption/plotCD.py
1
2145
#!/usr/bin/env python2.5 import numpy as np import matplotlib.pyplot as pl # from scipy cookbook for publication quality figures: fig_width_pt = 245.0 # Get this from LaTeX using \showthe\columnwidth inches_per_pt = 1.0/72.27 # Convert pt to inches fig_width = fig_width_pt*inches_per_pt # width in in...
gpl-2.0
AISpace2/AISpace2
aipython/learnKMeans.py
1
6029
# learnKMeans.py - k-means learning # AIFCA Python3 code Version 0.7.1 Documentation at http://aipython.org # Artificial Intelligence: Foundations of Computational Agents # http://artint.info # Copyright David L Poole and Alan K Mackworth 2017. # This work is licensed under a Creative Commons # Attribution-NonCommerci...
gpl-3.0
grandtiger/trading-with-python
historicDataDownloader/historicDataDownloader.py
77
4526
''' Created on 4 aug. 2012 Copyright: Jev Kuznetsov License: BSD a module for downloading historic data from IB ''' import ib import pandas from ib.ext.Contract import Contract from ib.opt import ibConnection, message from time import sleep import tradingWithPython.lib.logger as logger from pandas impor...
bsd-3-clause
scienceopen/dmcutils
dmcutils/neospool.py
1
13811
#!/usr/bin/env python from pathlib import Path from tempfile import mkstemp from time import time, sleep import logging from configparser import ConfigParser from datetime import datetime from pytz import UTC import numpy as np import imageio import h5py import pandas from typing import Dict, Any, Sequence, Tuple try:...
gpl-3.0
stack-of-tasks/dynamic-graph-tutorial
src/dynamic_graph/tutorial/simu.py
1
1574
import dynamic_graph as dg import dynamic_graph.tutorial as dgt import matplotlib.pyplot as pl import numpy as np def build_graph(): # define inverted pendulum a = dgt.InvertedPendulum("IP") a.setCartMass(1.0) a.setPendulumMass(1.0) a.setPendulumLength(1.0) b = dgt.FeedbackController("K") ...
bsd-2-clause
thomaslima/PySpice
examples/operational-amplifier/astable.py
1
2141
#################################################################################################### import matplotlib.pyplot as plt #################################################################################################### import PySpice.Logging.Logging as Logging logger = Logging.setup_logging() #######...
gpl-3.0
Hiyorimi/scikit-image
skimage/viewer/utils/core.py
19
6555
import numpy as np from ..qt import QtWidgets, has_qt, FigureManagerQT, FigureCanvasQTAgg from ..._shared.utils import warn import matplotlib as mpl from matplotlib.figure import Figure from matplotlib import _pylab_helpers from matplotlib.colors import LinearSegmentedColormap if has_qt and 'agg' not in mpl.get_backen...
bsd-3-clause
ville-k/tensorflow
tensorflow/contrib/learn/python/learn/learn_io/io_test.py
137
5063
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
apache-2.0
DentonW/Ps-H-Scattering
General Code/Python Scripts/Extrapolation.py
1
15927
#!/usr/bin/python #TODO: Add checks for whether files are good #TODO: Make relative difference function import sys, scipy, pylab import numpy as np from math import * import matplotlib.pyplot as plt from xml.dom.minidom import parse, parseString from xml.dom import minidom def NumTermsOmega(omega): # Return the...
mit
jblackburne/scikit-learn
examples/cluster/plot_kmeans_stability_low_dim_dense.py
338
4324
""" ============================================================ Empirical evaluation of the impact of k-means initialization ============================================================ Evaluate the ability of k-means initializations strategies to make the algorithm convergence robust as measured by the relative stan...
bsd-3-clause
laurentperrinet/Khoei_2017_PLoSCB
scripts/default_param.py
1
3196
# -*- coding: utf-8 -*- """ Default parameters for all experiments """ from __future__ import division, print_function import numpy as np import MotionParticlesFLE as mp N_X, N_Y, N_frame = mp.N_X, mp.N_Y, mp.N_frame X_0 = -1. V_X = 1. PBP_D_x = mp.D_x*2. PBP_D_V = np.inf #mp.D_V*1000. PBP_prior = mp.v_prior #/1.e6 ...
mit
zhupengjia/beampackage
beampackage/bpmcalib.py
2
17801
#!/usr/bin/env python import os,re,numpy from harppos import * from bpmfit import * from signalfilter import decode,getrealpos from runinfo import * #class to calibrate bpm class bpmcalib: def __init__(self,keywords=False,treename="T",rootpath=os.getenv("REPLAY_OUT_PATH"), onlyb=False,forcefastbus=False,forceredec...
gpl-3.0
xya/sms-tools
lectures/08-Sound-transformations/plots-code/FFT-filtering.py
21
1723
import math import matplotlib.pyplot as plt import numpy as np import time, os, sys sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../software/models/')) import dftModel as DFT import utilFunctions as UF (fs, x) = UF.wavread('../../../sounds/orchestra.wav') N = 2048 start = 1.0*fs ...
agpl-3.0
jorisvandenbossche/DS-python-data-analysis
_solved/spreaddiagram.py
1
5658
# -*- coding: utf-8 -*- """ @author: Stijnvh """ import sys import datetime import numpy as np from scipy import stats from scipy.stats import linregress import pandas as pd from pandas.tseries.offsets import DateOffset import pylab as p import matplotlib as mpl mpl.rcParams['mathtext.default'] = 'regular' import ...
bsd-3-clause
elijah513/scikit-learn
sklearn/datasets/species_distributions.py
198
7923
""" ============================= Species distribution dataset ============================= This dataset represents the geographic distribution of species. The dataset is provided by Phillips et. al. (2006). The two species are: - `"Bradypus variegatus" <http://www.iucnredlist.org/apps/redlist/details/3038/0>`_...
bsd-3-clause
anurag313/scikit-learn
sklearn/linear_model/tests/test_bayes.py
299
1770
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Fabian Pedregosa <fabian.pedregosa@inria.fr> # # License: BSD 3 clause import numpy as np from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import SkipTest from sklearn.linear_model.bayes import BayesianRidge, ARDRegres...
bsd-3-clause
mwaskom/PySurfer
examples/plot_label.py
2
1518
""" Display ROI Labels ================== Using PySurfer you can plot Freesurfer cortical labels on the surface with a large amount of control over the visual representation. """ import os from surfer import Brain print(__doc__) subject_id = "fsaverage" hemi = "lh" surf = "smoothwm" brain = Brain(subject_id, hemi, ...
bsd-3-clause
thilbern/scikit-learn
examples/linear_model/plot_ard.py
248
2622
""" ================================================== Automatic Relevance Determination Regression (ARD) ================================================== Fit regression model with Bayesian Ridge Regression. See :ref:`bayesian_ridge_regression` for more information on the regressor. Compared to the OLS (ordinary l...
bsd-3-clause
gnuradio/gnuradio
gr-filter/examples/synth_filter.py
6
1806
#!/usr/bin/env python # # Copyright 2010,2012,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # # SPDX-License-Identifier: GPL-3.0-or-later # # from gnuradio import gr from gnuradio import filter from gnuradio import blocks import sys import numpy try: from gnuradio import analog except Imp...
gpl-3.0
LeeMendelowitz/basketball-reference
basketball_reference/boxscore.py
1
3212
""" Parse a box score page. """ from bs4 import BeautifulSoup from itertools import izip import pandas import numpy as np def parse_basic_team_stats(elem): """ Parse the basic team stats table from the box score page. Both the visiting and home team have basic stats table, which summarizes the stats for each ...
gpl-3.0
tradingcraig/trading-with-python
lib/qtpandas.py
77
7937
''' Easy integration of DataFrame into pyqt framework Copyright: Jev Kuznetsov Licence: BSD ''' from PyQt4.QtCore import (QAbstractTableModel,Qt,QVariant,QModelIndex,SIGNAL) from PyQt4.QtGui import (QApplication,QDialog,QVBoxLayout, QHBoxLayout, QTableView, QPushButton, QWidget,QTabl...
bsd-3-clause
fspaolo/scikit-learn
benchmarks/bench_plot_fastkmeans.py
294
4676
from __future__ import print_function from collections import defaultdict from time import time import numpy as np from numpy import random as nr from sklearn.cluster.k_means_ import KMeans, MiniBatchKMeans def compute_bench(samples_range, features_range): it = 0 results = defaultdict(lambda: []) chun...
bsd-3-clause
spikefairway/VOIAnalyzer
base.py
1
2273
#!/usr/bin/env python # coding : utf-8 """ Basis for VOI analyzer. """ import pandas as pd import numpy as np import VOIAnalyzer.utils as utils def _analysis(img_mat, voi_mat, voi_no, eps=1e-12): """ Extract VOI statistices for each VOI. """ vec = img_mat[voi_mat == voi_no] vec2 = vec[~np.isnan(vec)...
mit
d-mittal/pystruct
examples/plot_latent_crf.py
4
2024
""" =================== Latent Dynamics CRF =================== Solving a 2d grid problem by introducing latent variable interactions. The input data is the same as in plot_grid_crf, a cross pattern. But now, the center is not given an extra state. That makes the problem much harder to solve for a pairwise model. We...
bsd-2-clause
ionanrozenfeld/networkx
examples/drawing/unix_email.py
26
2678
#!/usr/bin/env python """ Create a directed graph, allowing multiple edges and self loops, from a unix mailbox. The nodes are email addresses with links that point from the sender to the recievers. The edge data is a Python email.Message object which contains all of the email message data. This example shows the po...
bsd-3-clause
asinghal17/graphAPI-tools
countLikes/countLikes.py
1
2580
#!/usr/bin/env python #title : countLikes.py #description : Take CSV with (Name,Facebook_ID,Type) and outputs a CSV with Total Like Counts using Graph API #author : @asinghal #======================================================================================================================= imp...
mit
vamsirajendra/nupic
external/linux32/lib/python2.6/site-packages/matplotlib/delaunay/testfuncs.py
72
20890
"""Some test functions for bivariate interpolation. Most of these have been yoinked from ACM TOMS 792. http://netlib.org/toms/792 """ import numpy as np from triangulate import Triangulation class TestData(dict): def __init__(self, *args, **kwds): dict.__init__(self, *args, **kwds) self.__dict__ ...
agpl-3.0
jacobbieker/GCP-perpendicular-least-squares
pls.py
1
35002
__author__ = 'Jacob Bieker' import os, sys, random import numpy import pandas from astropy.table import Table, vstack import copy import scipy.odr as odr from scipy.stats import linregress from statsmodels.formula.api import ols import statsmodels.api as sm # Fit plane or line iteratively # if more than one cluster,...
mit
nextstrain/augur
scripts/identify_emerging_clades.py
1
14036
#!/usr/bin/env python3 # coding: utf-8 """Identify emerging clades from previously defined clades based on a minimum number of new mutations that have reached a minimum frequency in a given region. Example use cases: # Find subclades based on nucleotide mutations with defaults. python3 scripts/identify_emerging_clades...
agpl-3.0
vivekmishra1991/scikit-learn
sklearn/linear_model/sag.py
64
9815
"""Solvers for Ridge and LogisticRegression using SAG algorithm""" # Authors: Tom Dupre la Tour <tom.dupre-la-tour@m4x.org> # # Licence: BSD 3 clause import numpy as np import warnings from ..utils import ConvergenceWarning from ..utils import check_array from .base import make_dataset from .sgd_fast import Log, Squ...
bsd-3-clause
Habasari/sms-tools
lectures/04-STFT/plots-code/spectrogram.py
19
1174
import numpy as np import time, os, sys sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../software/models/')) import stft as STFT import utilFunctions as UF import matplotlib.pyplot as plt from scipy.signal import hamming from scipy.fftpack import fft import math (fs, x) = UF.wavrea...
agpl-3.0
chdecultot/erpnext
erpnext/selling/page/sales_funnel/sales_funnel.py
13
4035
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals import frappe from frappe import _ from erpnext.accounts.report.utils import convert import pandas as pd @frappe.whitelist() def get_funnel_data(from_...
gpl-3.0
joshrule/LOTlib
LOTlib/Legacy/MCMCSummary/VectorSummary.py
3
8466
import csv, math import numpy as np import pickle from MCMCSummary import MCMCSummary class VectorSummary(MCMCSummary): """ Summarize & plot data for MCMC with a VectorHypothesis (e.g. GrammarHypothesis). """ def __init__(self, skip=100, cap=100): MCMCSummary.__init__(self, skip=skip, cap=cap...
gpl-3.0
clairetang6/bokeh
bokeh/charts/models.py
9
8430
from __future__ import absolute_import from six import iteritems import pandas as pd from bokeh.models.renderers import GlyphRenderer from bokeh.models.sources import ColumnDataSource from bokeh.core.properties import (HasProps, String, Either, Float, Color, Instance, List, Any, Dict) fr...
bsd-3-clause
barbagroup/PetIBM
examples/decoupledibpm/cylinder2dRe3000_GPU/scripts/plotDragCoefficient.py
6
2037
""" Plots the instantaneous drag coefficient between 0 and 3 time-units of flow simulation and compares with numerical results from Koumoutsakos and Leonard (1995). _References:_ * Koumoutsakos, P., & Leonard, A. (1995). High-resolution simulations of the flow around an impulsively started cylinder using vortex me...
bsd-3-clause
dsm054/pandas
pandas/tests/indexes/period/test_construction.py
1
19613
import numpy as np import pytest from pandas.compat import PY3, lmap, lrange, text_type from pandas.core.dtypes.dtypes import PeriodDtype import pandas as pd from pandas import ( Index, Period, PeriodIndex, Series, date_range, offsets, period_range) import pandas.core.indexes.period as period import pandas.util....
bsd-3-clause
peterfpeterson/mantid
Framework/PythonInterface/mantid/simpleapi.py
3
53905
# Mantid Repository : https://github.com/mantidproject/mantid # # Copyright &copy; 2018 ISIS Rutherford Appleton Laboratory UKRI, # NScD Oak Ridge National Laboratory, European Spallation Source, # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + """ ...
gpl-3.0
cancan101/StarCluster
starcluster/balancers/sge/__init__.py
1
37941
# Copyright 2009-2014 Justin Riley # # This file is part of StarCluster. # # StarCluster is free software: you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later ...
lgpl-3.0
jakejhansen/minesweeper_solver
policy_gradients/train_full_6x6_CNN.py
1
10221
#Base code was written by Jonas Busk - Modified to suit project by Jacob Jon Hansen import matplotlib.pyplot as plt import numpy as np import tensorflow as tf from tensorflow.python.ops.nn import relu, softmax import gym import pickle from sklearn.preprocessing import normalize import sys import os sys.path.append('....
mit
timodonnell/genomisc
setup.py
1
2502
# Copyright (c) 2014. Mount Sinai School of Medicine # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
apache-2.0
mulhod/reviewer_experience_prediction
util/cv_learn.py
1
61443
""" :author: Matt Mulholland (mulhodm@gmail.com) :date: 10/14/2015 Command-line utility utilizing the RunCVExperiments class, which enables one to run cross-validation experiments incrementally with a number of different machine learning algorithms and parameter customizations, etc. """ import logging from copy import...
mit
henridwyer/scikit-learn
examples/svm/plot_separating_hyperplane.py
62
1274
""" ========================================= SVM: Maximum margin separating hyperplane ========================================= Plot the maximum margin separating hyperplane within a two-class separable dataset using a Support Vector Machines classifier with linear kernel. """ print(__doc__) import numpy as np impo...
bsd-3-clause
marcsans/cnn-physics-perception
phy/lib/python2.7/site-packages/matplotlib/testing/jpl_units/EpochConverter.py
8
5505
#=========================================================================== # # EpochConverter # #=========================================================================== """EpochConverter module containing class EpochConverter.""" #=========================================================================== # Pl...
mit
elenita1221/BDA_py_demos
demos_ch3/demo3_6.py
19
2810
"""Bayesian Data Analysis, 3rd ed Chapter 3, demo 6 Illustrate posterior inference for Bioassay data (BDA3 p. 74-). Instructions for exercise (3.11 in BDA3) - Check that the range and spacing of A and B are sensible for the alternative prior - Compute the log-posterior in a grid - Scale the log-posterior by subtra...
gpl-3.0
r-mart/scikit-learn
sklearn/neighbors/classification.py
132
14388
"""Nearest Neighbor Classification""" # Authors: Jake Vanderplas <vanderplas@astro.washington.edu> # Fabian Pedregosa <fabian.pedregosa@inria.fr> # Alexandre Gramfort <alexandre.gramfort@inria.fr> # Sparseness support by Lars Buitinck <L.J.Buitinck@uva.nl> # Multi-output support by ...
bsd-3-clause
mavenlin/tensorflow
tensorflow/contrib/learn/python/learn/estimators/estimators_test.py
21
6697
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
apache-2.0
schets/scikit-learn
examples/bicluster/plot_spectral_biclustering.py
403
2011
""" ============================================= A demo of the Spectral Biclustering algorithm ============================================= This example demonstrates how to generate a checkerboard dataset and bicluster it using the Spectral Biclustering algorithm. The data is generated with the ``make_checkerboard`...
bsd-3-clause
r-mart/scikit-learn
sklearn/datasets/tests/test_rcv1.py
322
2414
"""Test the rcv1 loader. Skipped if rcv1 is not already downloaded to data_home. """ import errno import scipy.sparse as sp import numpy as np from sklearn.datasets import fetch_rcv1 from sklearn.utils.testing import assert_almost_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing i...
bsd-3-clause
Mistobaan/tensorflow
tensorflow/python/estimator/canned/dnn_linear_combined_test.py
46
26964
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
apache-2.0
beepee14/scikit-learn
examples/tree/plot_tree_regression.py
206
1476
""" =================================================================== Decision Tree Regression =================================================================== A 1D regression with decision tree. The :ref:`decision trees <tree>` is used to fit a sine curve with addition noisy observation. As a result, it learns ...
bsd-3-clause
gfyoung/pandas
pandas/tests/indexes/datetimelike_/test_equals.py
2
6163
""" Tests shared for DatetimeIndex/TimedeltaIndex/PeriodIndex """ from datetime import datetime, timedelta import numpy as np import pytest import pandas as pd from pandas import ( CategoricalIndex, DatetimeIndex, Index, PeriodIndex, TimedeltaIndex, date_range, period_range, ) import panda...
bsd-3-clause
ishanic/scikit-learn
sklearn/datasets/tests/test_mldata.py
384
5221
"""Test functionality of mldata fetching utilities.""" import os import shutil import tempfile import scipy as sp from sklearn import datasets from sklearn.datasets import mldata_filename, fetch_mldata from sklearn.utils.testing import assert_in from sklearn.utils.testing import assert_not_in from sklearn.utils.test...
bsd-3-clause
rgommers/statsmodels
statsmodels/stats/tests/test_weightstats.py
30
21864
'''tests for weightstats, compares with replication no failures but needs cleanup update 2012-09-09: added test after fixing bug in covariance TODOs: - I don't remember what all the commented out code is doing - should be refactored to use generator or inherited tests - still gaps in test coverage...
bsd-3-clause
appapantula/scikit-learn
sklearn/utils/tests/test_random.py
230
7344
from __future__ import division import numpy as np import scipy.sparse as sp from scipy.misc import comb as combinations from numpy.testing import assert_array_almost_equal from sklearn.utils.random import sample_without_replacement from sklearn.utils.random import random_choice_csc from sklearn.utils.testing import ...
bsd-3-clause