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 |
|---|---|---|---|---|---|
zaxtax/scikit-learn | sklearn/linear_model/tests/test_ransac.py | 52 | 17482 | from scipy import sparse
import numpy as np
from scipy import sparse
from numpy.testing import assert_equal, assert_raises
from numpy.testing import assert_array_almost_equal
from numpy.testing import assert_array_equal
from sklearn.utils import check_random_state
from sklearn.utils.testing import assert_raises_rege... | bsd-3-clause |
daodaoliang/neural-network-animation | matplotlib/docstring.py | 23 | 3995 | from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
from matplotlib import cbook
import sys
import types
class Substitution(object):
"""
A decorator to take a function's docstring and perform string
substitution on it.
This decorat... | mit |
ptkool/spark | python/pyspark/sql/context.py | 5 | 18889 | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | apache-2.0 |
cdegroc/scikit-learn | sklearn/linear_model/stochastic_gradient.py | 1 | 28259 | # Authors: Peter Prettenhofer <peter.prettenhofer@gmail.com> (main author)
# Mathieu Blondel (partial_fit support)
#
# License: BSD Style.
"""Implementation of Stochastic Gradient Descent (SGD)."""
import numpy as np
import scipy.sparse as sp
import warnings
from ..externals.joblib import Parallel, delayed
... | bsd-3-clause |
jplourenco/bokeh | examples/compat/mpl/subplots.py | 34 | 1826 | """
Edward Tufte uses this example from Anscombe to show 4 datasets of x
and y that have the same mean, standard deviation, and regression
line, but which are qualitatively different.
matplotlib fun for a rainy day
"""
import matplotlib.pyplot as plt
import numpy as np
from bokeh import mpl
from bokeh.plotting impor... | bsd-3-clause |
Myoldmopar/SolarCalculations | demos/SolarAngles.py | 1 | 6462 | #!/usr/bin/env python
# add the solar directory to the path so we can import it
import os
import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'solar'))
# import the datetime library so we construct proper datetime instances
from datetime import datetime
# import the solar library
import solar... | mit |
jmetzen/scikit-learn | benchmarks/bench_isolation_forest.py | 40 | 3136 | """
==========================================
IsolationForest benchmark
==========================================
A test of IsolationForest on classical anomaly detection datasets.
"""
print(__doc__)
from time import time
import numpy as np
import matplotlib.pyplot as plt
from sklearn.ensemble import IsolationFore... | bsd-3-clause |
beni55/dipy | doc/examples/reconst_shore_metrics.py | 13 | 3275 | """
===========================
Calculate SHORE scalar maps
===========================
We show how to calculate two SHORE-based scalar maps: return to origin
probability (rtop) [Descoteaux2011]_ and mean square displacement (msd)
[Wu2007]_, [Wu2008]_ on your data. SHORE can be used with any multiple b-value
dataset l... | bsd-3-clause |
efulet/pca | pca/main.py | 1 | 3043 | """
@created_at 2014-07-15
@author Exequiel Fuentes <efulet@gmail.com>
@author Brian Keith <briankeithn@gmail.com>
"""
# Se recomienda seguir los siguientes estandares:
# 1. Para codificacion: PEP 8 - Style Guide for Python Code (http://legacy.python.org/dev/peps/pep-0008/)
# 2. Para documentacion: PEP 257 - Docst... | mit |
pcm17/tensorflow | tensorflow/examples/tutorials/word2vec/word2vec_basic.py | 5 | 9272 | # Copyright 2015 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 |
BigDataforYou/movie_recommendation_workshop_1 | big_data_4_you_demo_1/venv/lib/python2.7/site-packages/pandas/indexes/base.py | 1 | 120893 | import datetime
import warnings
import operator
import numpy as np
import pandas.tslib as tslib
import pandas.lib as lib
import pandas.algos as _algos
import pandas.index as _index
from pandas.lib import Timestamp, Timedelta, is_datetime_array
from pandas.compat import range, u
from pandas.compat.numpy import functio... | mit |
kaichogami/scikit-learn | sklearn/cluster/tests/test_dbscan.py | 176 | 12155 | """
Tests for DBSCAN clustering algorithm
"""
import pickle
import numpy as np
from scipy.spatial import distance
from scipy import sparse
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing im... | bsd-3-clause |
bzamecnik/sms-tools | lectures/03-Fourier-properties/plots-code/fft-zero-phase.py | 1 | 1147 | # matplotlib without any blocking GUI
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
from scipy.fftpack import fft, fftshift
from smst.utils import audio
(fs, x) = audio.read_wav('../../../sounds/oboe-A4.wav')
N = 512
M = 401
hN = N / 2
hM = (M + 1) / 2
start = .8 * fs
xw ... | agpl-3.0 |
neiltest/Neil_MyApp_Test_Appium | adb_bat/logviewer/test_001.py | 2 | 1669 | #!/usr/bin/env python
# coding: utf-8
"""
@Author: Well
@Date: 2015 - 06 - 01
"""
"""
http://matplotlib.org/
http://blog.csdn.net/daniel_ustc/article/details/9714163
https://github.com/pyinstaller/pyinstaller/wiki
"""
import os
import time
def get_now():
return time.strftime('%Y-%m-%d-%H_%M_%S', time.localtime... | unlicense |
dllllb/ds-tools | category_encoder/category_encoder_comparison.py | 1 | 5150 | import os
import pandas as pd
import numpy as np
from sklearn.feature_extraction import DictVectorizer
from sklearn.impute import SimpleImputer
from sklearn.model_selection import cross_val_score
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import FunctionTransformer
from sklearn.ensemble impo... | apache-2.0 |
XiaoxiaoLiu/morphology_analysis | bigneuron/metrics_comparison.py | 1 | 9932 | __author__ = 'xiaoxiaol'
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sb
import os
import os.path as path
import numpy as np
import recon_prescreening as rp
def calculate_similarities(neuron_distance_csv,metric='neuron_distance', output_similarity_csv =None):
df_nd = pd.read_csv(ne... | gpl-3.0 |
xu6148152/Binea_Python_Project | DataAnalysis/intro/movie_lens_test.py | 1 | 1230 | #!/usr/bin/env python3
# -*- encoding: utf-8 -*-
import pandas as pd
unames = ['user_id', 'gender', 'age', 'occupation', 'zip']
users = pd.read_table('users.dat', sep='::', header=None, names=unames)
rnames = ['user_id', 'movie_id', 'rating', 'timestamp']
ratings = pd.read_table('ratings.dat', sep='::', header=None,... | mit |
phoebe-project/phoebe2-docs | development/tutorials/spots.py | 2 | 3736 | #!/usr/bin/env python
# coding: utf-8
# Advanced: Spots
# ============================
#
# For an introduction features in general, see the [features](./features.ipynb) tutorial.
#
#
# Setup
# -----------------------------
# Let's first make sure we have the latest version of PHOEBE 2.3 installed (uncomment this l... | gpl-3.0 |
abimannans/scikit-learn | sklearn/metrics/classification.py | 95 | 67713 | """Metrics to assess performance on classification task given classe prediction
Functions named as ``*_score`` return a scalar value to maximize: the higher
the better
Function named as ``*_error`` or ``*_loss`` return a scalar value to minimize:
the lower the better
"""
# Authors: Alexandre Gramfort <alexandre.gram... | bsd-3-clause |
gem/oq-engine | openquake/hazardlib/lt.py | 1 | 24981 | # -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2020, GEM Foundation
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, ... | agpl-3.0 |
jpeterbaker/maxfield | lib/geometry.py | 1 | 12050 | '''
This file is part of Maxfield.
Maxfield is a planning tool for helping Ingress players to determine
an efficient plan to create many in-game fields.
Copyright (C) 2015 by Jonathan Baker: babamots@gmail.com
Maxfield is free software: you can redistribute it and/or modify
it under the terms of the GNU General Publ... | gpl-3.0 |
pdellaert/ansible | hacking/aws_config/build_iam_policy_framework.py | 25 | 11861 | # Requires pandas, bs4, html5lib, and lxml
#
# Call script with the output from aws_resource_actions callback, e.g.
# python build_iam_policy_framework.py ['ec2:AuthorizeSecurityGroupEgress', 'ec2:AuthorizeSecurityGroupIngress', 'sts:GetCallerIdentity']
#
# The sample output:
# {
# "Version": "2012-10-17",
# "S... | gpl-3.0 |
timmie/cartopy | lib/cartopy/examples/tick_labels.py | 6 | 1724 | __tags__ = ['Miscellanea']
"""
This example demonstrates adding tick labels to maps on rectangular
projections using special tick formatters.
"""
import cartopy.crs as ccrs
from cartopy.mpl.ticker import LongitudeFormatter, LatitudeFormatter
import matplotlib.pyplot as plt
def main():
plt.figure(figsize=(8, 10))... | gpl-3.0 |
trachelr/mne-python | examples/inverse/plot_label_from_stc.py | 31 | 3963 | """
=================================================
Generate a functional label from source estimates
=================================================
Threshold source estimates and produce a functional label. The label
is typically the region of interest that contains high values.
Here we compare the average time ... | bsd-3-clause |
srodney/hstsntools | filters.py | 1 | 9454 | # 2014.04.29
# S.Rodney
# HST Filter transmission curves: plotting and such
import numpy as np
from matplotlib import pylab as pl
import os
topdir = os.path.abspath( '.' )
try :
sndataroot = os.environ['SNDATA_ROOT']
os.chdir( sndataroot+'/filters/HST_CANDELS')
w435, f435 = np.loadtxt( 'ACS_WFC_F435W.da... | mit |
datapythonista/pandas | pandas/tests/series/methods/test_describe.py | 2 | 4855 | import numpy as np
from pandas import (
Period,
Series,
Timedelta,
Timestamp,
date_range,
)
import pandas._testing as tm
class TestSeriesDescribe:
def test_describe_ints(self):
ser = Series([0, 1, 2, 3, 4], name="int_data")
result = ser.describe()
expected = Series(
... | bsd-3-clause |
lucapinello/CRISPResso | CRISPResso/CRISPRessoCORE.py | 1 | 127566 | #!/usr/bin/env python
# -*- coding: utf8 -*-
'''
CRISPResso - Luca Pinello 2015
Software pipeline for the analysis of CRISPR-Cas9 genome editing outcomes from deep sequencing data
https://github.com/lucapinello/CRISPResso
'''
__version__ = "1.0.13"
import sys
import errno
import os
import subprocess as sb
import ar... | agpl-3.0 |
usaskulc/population_matching | resample.py | 1 | 11886 | # sudo pip install hungarian
# sudo easy_install statsmodels
#sudo apt-get install python-pandas
import pandas as pd
import numpy as np
import hungarian
import math
import argparse
from multiprocessing import Pool
from scipy.stats import ks_2samp
from scipy.stats import ttest_ind
from scipy.stats import chisquare
fro... | mit |
shortlab/hognose | plotting/enhancement.py | 1 | 5336 | # -*- coding: utf-8 -*-
"""
"""
import sys , os, getopt, traceback # First import required modules
import numpy as np # Operating system modules
import matplotlib.pyplot as plt # Numerical python
plt.switch_backend('agg')
import pylab as py
import scipy.optimize # needed for trendline calcs
#pl... | lgpl-2.1 |
q1ang/scikit-learn | examples/linear_model/plot_ols.py | 220 | 1940 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Linear Regression Example
=========================================================
This example uses the only the first feature of the `diabetes` dataset, in
order to illustrate a two-dimensional plot of this regre... | bsd-3-clause |
megies/numpy | numpy/core/code_generators/ufunc_docstrings.py | 4 | 86755 | """
Docstrings for generated ufuncs
The syntax is designed to look like the function add_newdoc is being
called from numpy.lib, but in this file add_newdoc puts the docstrings
in a dictionary. This dictionary is used in
numpy/core/code_generators/generate_umath.py to generate the docstrings
for the ufuncs in numpy.co... | bsd-3-clause |
martinjrobins/pdeToOffLattice | twoDimUniReactionMoving.py | 1 | 4775 | # -*- coding: utf-8 -*-
"""
Created on Wed Dec 24 12:07:07 2014
@author: robinsonm
"""
from fipy import *
from scipy.special import erf, erfc
from math import sqrt
import pyTyche as tyche
import numpy as np
import matplotlib.pyplot as plt
nx = 51
D = 1.
L = 1.
dx = L/nx
conversion_rate = 500.
lam = 10.0**6
k = 0.1
... | gpl-2.0 |
giacomov/3ML | threeML/io/plotting/light_curve_plots.py | 1 | 6500 | from __future__ import division
from builtins import zip
from builtins import range
from past.utils import old_div
import matplotlib.pyplot as plt
import numpy as np
from threeML.config.config import threeML_config
from threeML.io.plotting.step_plot import step_plot
# this file contains routines for plotting binned ... | bsd-3-clause |
KDD-OpenSource/geox-young-academy | day-2/exercises/PCA-SVM-exercise-solution.py | 1 | 5040 | from sklearn import svm
from sklearn import neighbors
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
# Note: Functions should go on top, but to group the code based on the sub-tasks, code and functions are mixed here
def show_raw_image(img):
img2 = np.log(img[[2... | mit |
springer-math/Mathematics-of-Epidemics-on-Networks | docs/examples/fig5p4.py | 1 | 2228 | import EoN
import networkx as nx
import matplotlib.pyplot as plt
import scipy
import random
def get_deg_seq(N, Pk):
while True: #run until degree sequence has even sum of N entries
deg_seq = []
for counter in range(N):
r = random.random()
for k in Pk:
if Pk... | mit |
osigaud/ArmModelPython | 3RModel_Gao2/install.py | 4 | 1723 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Author: Thomas Beucher + Olivier Sigaud
Module: install
'''
import os
import site
#------------------- install environment -----------------------------------------------------------------------------------
def checkPackages():
a = site.getsitepackages()
pac... | gpl-2.0 |
notmatthancock/acm-computing-seminar | resources/prog/example-assignment/figures/source/plot-figs.py | 2 | 1369 | # This is a python script to create the figures
# using `matplotlib`.
import numpy as np
import matplotlib.pyplot as plt
plt.style.use('classic')
title = {'forw': "Forward Difference",
'back': "Backward Difference",
'cent': "Central Difference"}
linestyles = ['-ok', '-^k']
# Create plots for func... | mit |
brookehus/msmbuilder | msmbuilder/io/io.py | 6 | 9756 | # Author: Matthew Harrigan <matthew.harrigan@outlook.com>
# Contributors:
# Copyright (c) 2016, Stanford University
# All rights reserved.
from __future__ import print_function, division, absolute_import
import os
import pickle
import re
import shutil
import stat
import warnings
import mdtraj as md
import numpy as n... | lgpl-2.1 |
trungnt13/scikit-learn | examples/covariance/plot_lw_vs_oas.py | 248 | 2903 | """
=============================
Ledoit-Wolf vs OAS estimation
=============================
The usual covariance maximum likelihood estimate can be regularized
using shrinkage. Ledoit and Wolf proposed a close formula to compute
the asymptotically optimal shrinkage parameter (minimizing a MSE
criterion), yielding th... | bsd-3-clause |
andyh616/mne-python | tutorials/plot_epochs_to_data_frame.py | 12 | 8847 | """
.. _tut_io_export_pandas:
=================================
Export epochs to Pandas DataFrame
=================================
In this example the pandas exporter will be used to produce a DataFrame
object. After exploring some basic features a split-apply-combine
work flow will be conducted to examine the laten... | bsd-3-clause |
dkandalov/katas | python/ml/scikit/svm_gui.py | 1 | 10729 | from __future__ import division, print_function
print(__doc__)
# Author: Peter Prettenhoer <peter.prettenhofer@gmail.com>
#
# License: BSD 3 clause
import matplotlib
matplotlib.use('TkAgg')
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from matplotlib.backends.backend_tkagg import NavigationToolba... | unlicense |
qifeigit/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 |
infoxchange/lettuce | tests/integration/django/dill/leaves/features/steps.py | 17 | 1432 | import json
from django.core.management import call_command
from leaves.models import *
from lettuce import after, step
from lettuce.django.steps.models import *
from nose.tools import assert_equals
after.each_scenario(clean_db)
max_rego = 0
@creates_models(Harvester)
def create_with_rego(step):
data = hash... | gpl-3.0 |
DamCB/tyssue | tests/geometry/test_planar_geometry.py | 2 | 2016 | import numpy as np
import pandas as pd
from numpy.testing import assert_array_equal
from tyssue import config
from tyssue.core import Epithelium
from tyssue.generation import (
three_faces_sheet,
extrude,
hexa_grid3d,
hexa_grid2d,
subdivide_faces,
)
from tyssue.geometry.planar_geometry import Plana... | gpl-3.0 |
aewhatley/scikit-learn | sklearn/neighbors/tests/test_kd_tree.py | 129 | 7848 | import numpy as np
from numpy.testing import assert_array_almost_equal
from sklearn.neighbors.kd_tree import (KDTree, NeighborsHeap,
simultaneous_sort, kernel_norm,
nodeheap_sort, DTYPE, ITYPE)
from sklearn.neighbors.dist_metrics import Dista... | bsd-3-clause |
kaushikcfd/eikonal-unstructured | Debug/debugValues/plotValues.py | 1 | 1783 | # Reference: http://matplotlib.org/examples/pylab_examples/triplot_demo.html
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.tri as tri
from matplotlib import rc
rc('font',**{'family':'serif','serif':['Times']})
x = []
y = []
T = []
triangles = []
#-----------------------------------------------... | gpl-3.0 |
casimp/pyxe | bin/data_creation.py | 3 | 3978 | import numpy as np
import matplotlib.pyplot as plt
import time
from pyxe.williams import sigma_xx, sigma_yy, sigma_xy, cart2pol
from pyxe.fitting_functions import strain_transformation, shear_transformation
def plane_strain_s2e(sigma_xx, sigma_yy, sigma_xy, E, v, G=None):
if G is None:
G = E / (2 * (1 - v... | mit |
morepj/numerical-mooc | lessons/02_spacetime/solutions/01.py | 3 | 1024 | import numpy #here we load numpy
import matplotlib.pyplot as plt #here we load matplotlib, calling it 'plt'
import time, sys #and load some utilities
nx = 41 # try changing this number from 41 to 81 and Run All ... what happens?
dx = 2./(nx-1)
nt = 25 #nt is the number of... | mit |
procoder317/scikit-learn | sklearn/cluster/tests/test_bicluster.py | 226 | 9457 | """Testing for Spectral Biclustering methods"""
import numpy as np
from scipy.sparse import csr_matrix, issparse
from sklearn.grid_search import ParameterGrid
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_equal
from... | bsd-3-clause |
tartavull/google-cloud-python | docs/conf.py | 2 | 9905 | # Copyright 2016 Google Inc.
#
# 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 or agreed to in writing, ... | apache-2.0 |
imperial-genomics-facility/data-management-python | test/process/reformat_samplesheet_file_test.py | 1 | 2785 | import unittest,os
import pandas as pd
from igf_data.utils.fileutils import get_temp_dir,remove_dir
from igf_data.process.metadata_reformat.reformat_samplesheet_file import Reformat_samplesheet_file,SampleSheet
class Reformat_samplesheet_file_testA(unittest.TestCase):
def setUp(self):
self.tmp_dir = get_temp_dir... | apache-2.0 |
iemejia/beam | sdks/python/apache_beam/runners/interactive/utils_test.py | 5 | 10771 | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | apache-2.0 |
wanglei828/apollo | modules/tools/navigation/planning/path_decider.py | 3 | 8453 | #!/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 |
UNR-AERIAL/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 |
msingh172/pylearn2 | pylearn2/models/svm.py | 21 | 3386 | """Wrappers for SVM models."""
__authors__ = "Ian Goodfellow"
__copyright__ = "Copyright 2010-2012, Universite de Montreal"
__credits__ = ["Ian Goodfellow"]
__license__ = "3-clause BSD"
__maintainer__ = "LISA Lab"
__email__ = "pylearn-dev@googlegroups"
import numpy as np
import warnings
try:
from sklearn.multicla... | bsd-3-clause |
stkeky/valar-morghulis | examples/first_keras_example.py | 1 | 2721 | from __future__ import absolute_import
from __future__ import print_function
import pandas as pd
import numpy as np
from keras.utils import np_utils
import seaborn as sns
from keras.models import Sequential
from keras.layers import Dense, Dropout
data = np.array([
[0, 0, 0],
[1, 1, 0],
[2, 2, 0],
[3... | mit |
jmetzen/scikit-learn | sklearn/datasets/tests/test_samples_generator.py | 181 | 15664 | from __future__ import division
from collections import defaultdict
from functools import partial
import numpy as np
import scipy.sparse as sp
from sklearn.externals.six.moves import zip
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing imp... | bsd-3-clause |
musically-ut/statsmodels | statsmodels/graphics/tukeyplot.py | 33 | 2473 | from statsmodels.compat.python import range
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as mticker
import matplotlib.lines as lines
def tukeyplot(results, dim=None, yticklabels=None):
npairs = len(results)
fig = plt.figure()
fsp = fig.add_subplot(111)
fsp.axis([-50,50,... | bsd-3-clause |
jnez71/demos | signals/fourier_transform.py | 1 | 1952 | #!/usr/bin/env python3
"""
Using a typical FFT routine and showing the principle
behind the DTFT computation.
"""
import numpy as np
from matplotlib import pyplot
##################################################
# Efficient practical usage
def fft(values, dt):
freqs = np.fft.rfftfreq(len(values), dt)
coeff... | mit |
mne-tools/mne-tools.github.io | 0.20/_downloads/ad24d853f2b5d1e965cb721301884c03/plot_40_visualize_raw.py | 4 | 8744 | # -*- coding: utf-8 -*-
"""
.. _tut-visualize-raw:
Built-in plotting methods for Raw objects
=========================================
This tutorial shows how to plot continuous data as a time series, how to plot
the spectral density of continuous data, and how to plot the sensor locations
and projectors stored in :c... | bsd-3-clause |
SpatialTranscriptomicsResearch/st_analysis | scripts/merge_replicates.py | 1 | 2837 | #! /usr/bin/env python
"""
This scripts merges two ST datasets (technical replicates
from the same individual).
It keeps only the genes that are in both datasets
(summing their counts or averaging them).
Assumes that both matrices have the same order of genes and spots
and that the spots of both datasets are located ... | mit |
dialounke/pylayers | pylayers/network/examples/ex_network.py | 3 | 3774 | from pylayers.gis.layout import *
from pylayers.mobility.agent import *
from pylayers.network.network import *
from pylayers.network.emsolver import *
import matplotlib.pyplot as plt
# ## Layout Creation
#
# First we need to load a layout structure.
#
# A place where nodes from a network can move and communicate
# <c... | mit |
arjoly/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 |
liberatorqjw/scikit-learn | examples/linear_model/plot_lasso_and_elasticnet.py | 249 | 1982 | """
========================================
Lasso and Elastic Net for Sparse Signals
========================================
Estimates Lasso and Elastic-Net regression models on a manually generated
sparse signal corrupted with an additive noise. Estimated coefficients are
compared with the ground-truth.
"""
print(... | bsd-3-clause |
paultopia/auto-sklearn | autosklearn/data/data_manager.py | 5 | 3374 | import numpy as np
import scipy.sparse
from ParamSklearn.implementations.OneHotEncoder import OneHotEncoder
from autosklearn.data import util as data_util
class DataManager(object):
def __init__(self):
self._data = dict()
self._info = dict()
@property
def data(self):
return self... | bsd-3-clause |
mtwharmby/lucky | Lucky/src_Mike_GUI_Total/trials/PreLucky_variant.py | 1 | 6919 | import math
pi = math.pi
##from math import pi
##Constants:
h=6.626*10**(-34)
c=3*10**8
Kb=1.38*10**(-23)
##Session where I define all the function needed
def Planck(x,e,T):
a=np.expm1(0.0144043/(x*10**(-9))/T)
P=e/(x*10**(-9))**5*3.74691*10**(-16)*1/(a-1)
return P
#Defined Wien function
def Wien(Int,x):
... | apache-2.0 |
rizkiarm/LipNet | evaluation/confusion.py | 1 | 4493 | import nltk
import sys
import string
import os
import numpy as np
from sklearn import metrics
import matplotlib.pyplot as plt
def plot_confusion_matrix(cm, classes,
normalize=False,
title='Confusion matrix',
cmap=plt.cm.Blues):
"""
T... | mit |
james4424/nest-simulator | pynest/examples/intrinsic_currents_subthreshold.py | 4 | 7182 | # -*- coding: utf-8 -*-
#
# intrinsic_currents_subthreshold.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version ... | gpl-2.0 |
anisyonk/pilot | Experiment.py | 3 | 37135 | # Class definition:
# Experiment
# This class is the main experiment class; ATLAS etc will inherit from this class
# Instances are generated with ExperimentFactory
# Subclasses should implement all needed methods prototyped in this class
# Note: not compatible with Singleton Design Pattern due to the subclass... | apache-2.0 |
aflaxman/scikit-learn | examples/mixture/plot_gmm_sin.py | 103 | 6101 | """
=================================
Gaussian Mixture Model Sine Curve
=================================
This example demonstrates the behavior of Gaussian mixture models fit on data
that was not sampled from a mixture of Gaussian random variables. The dataset
is formed by 100 points loosely spaced following a noisy ... | bsd-3-clause |
TomAugspurger/pandas | pandas/core/groupby/grouper.py | 1 | 28910 | """
Provide user facing operators for doing the split part of the
split-apply-combine paradigm.
"""
from typing import Dict, Hashable, List, Optional, Tuple
import warnings
import numpy as np
from pandas._typing import FrameOrSeries
from pandas.util._decorators import cache_readonly
from pandas.core.dtypes.common im... | bsd-3-clause |
jmhsi/justin_tinker | data_science/j_utils.py | 1 | 19568 |
# File with utility functions for models in pytorch
# Imports ___________________________________________________________________
import os
import re
import torch
import torchvision.datasets as datasets
from torch.utils.data import Dataset, DataLoader
import numpy as np
import matplotlib.pyplot as plt
from PIL import ... | apache-2.0 |
crystal150/CS350 | generator.py | 1 | 4662 | import pickle
import csv
import re
from sklearn import linear_model
from sklearn.feature_extraction.text import TfidfVectorizer
from scipy.sparse import hstack
TRAIN_FILE = "train.csv"
########### Ancillary functions ###########
# From .csv file to array
def readCsv(fname, skipFirst = True, delimiter = ","):
read... | mit |
ForestClaw/forestclaw | applications/geoclaw/tohoku/maketopo.py | 1 | 2298 | """
Create topo and dtopo files needed for this example:
etopo10min120W60W60S0S.asc download from GeoClaw topo repository
dtopo_usgs100227.tt3 create using Okada model
Prior to Clawpack 5.2.1, the fault parameters we specified in a .cfg file,
but now they are explicit below.
Call funct... | bsd-2-clause |
rosswhitfield/mantid | scripts/DiamondAttenuationCorrection/FitTransReadUB.py | 3 | 47813 | # Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 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 |
kaiyuanl/gem5 | util/stats/barchart.py | 90 | 12472 | # Copyright (c) 2005-2006 The Regents of The University of Michigan
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this ... | bsd-3-clause |
jereze/scikit-learn | examples/mixture/plot_gmm_selection.py | 248 | 3223 | """
=================================
Gaussian Mixture Model Selection
=================================
This example shows that model selection can be performed with
Gaussian Mixture Models using information-theoretic criteria (BIC).
Model selection concerns both the covariance type
and the number of components in th... | bsd-3-clause |
IamJeffG/geopandas | geopandas/tests/test_geodataframe.py | 1 | 19216 | from __future__ import absolute_import
import json
import os
import tempfile
import shutil
import numpy as np
import pandas as pd
from pandas.util.testing import assert_frame_equal
from shapely.geometry import Point, Polygon
import fiona
from geopandas import GeoDataFrame, read_file, GeoSeries
from geopandas.tests.u... | bsd-3-clause |
dennisss/sympy | examples/intermediate/mplot3d.py | 14 | 1261 | #!/usr/bin/env python
"""Matplotlib 3D plotting example
Demonstrates plotting with matplotlib.
"""
import sys
from sample import sample
from sympy import sin, Symbol
from sympy.external import import_module
def mplot3d(f, var1, var2, show=True):
"""
Plot a 3d function using matplotlib/Tk.
"""
im... | bsd-3-clause |
AudioBonsai/audiobonsai | weekly_sampler.py | 2 | 8309 | from audiobonsai import wsgi, settings
from datetime import datetime
from django.contrib.auth.models import User
from django.http import HttpResponseRedirect
import pandas as pd
from pprint import pprint
from sausage_grinder.models import Artist, ReleaseSet
from spotify_helper.models import SpotifyUser
from spotipy imp... | apache-2.0 |
JaviMerino/trappy | tests/test_dynamic.py | 2 | 4590 | # Copyright 2015-2016 ARM Limited
#
# 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 or agreed to in w... | apache-2.0 |
rezasafi/spark | examples/src/main/python/sql/arrow.py | 8 | 8426 | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | apache-2.0 |
diana-hep/carl | tests/distributions/test_base.py | 1 | 2940 | # Carl is free software; you can redistribute it and/or modify it
# under the terms of the Revised BSD License; see LICENSE file for
# more details.
import numpy as np
import theano
import theano.tensor as T
from numpy.testing import assert_raises
from theano.tensor import TensorVariable
from theano.tensor.sharedvar ... | bsd-3-clause |
toobaz/pandas | pandas/tests/arrays/sparse/test_array.py | 2 | 45199 | import operator
import re
import warnings
import numpy as np
import pytest
from pandas._libs.sparse import IntIndex
import pandas.util._test_decorators as td
import pandas as pd
from pandas import isna
from pandas.core.sparse.api import SparseArray, SparseDtype, SparseSeries
import pandas.util.testing as tm
from pan... | bsd-3-clause |
NikolaYolov/invenio_backup | modules/webstat/lib/webstat_engine.py | 2 | 87242 | ## This file is part of Invenio.
## Copyright (C) 2007, 2008, 2010, 2011 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your option) any later ... | gpl-2.0 |
ryandougherty/mwa-capstone | MWA_Tools/build/matplotlib/doc/mpl_examples/axes_grid/demo_colorbar_with_inset_locator.py | 8 | 1111 | import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
fig = plt.figure(1, [6, 3])
# first subplot
ax1 = fig.add_subplot(121)
axins1 = inset_axes(ax1,
width="50%", # width = 10% of parent_bbox width
height="5%", # height : 50%
... | gpl-2.0 |
djrodgerspryor/MCSE-Simulator | analysis.py | 1 | 28401 | import nanosim
import numpy as np
from itertools import repeat, izip, chain
import scipy.ndimage
from scipy.interpolate import griddata
from scipy.ndimage.interpolation import zoom
from scipy.ndimage.filters import gaussian_filter
from mpl_toolkits.axes_grid1 import make_axes_locatable
from matplotlib.ticker import Mul... | bsd-3-clause |
NunoEdgarGub1/scikit-learn | examples/calibration/plot_calibration_multiclass.py | 272 | 6972 | """
==================================================
Probability Calibration for 3-class classification
==================================================
This example illustrates how sigmoid calibration changes predicted
probabilities for a 3-class classification problem. Illustrated is the
standard 2-simplex, wher... | bsd-3-clause |
rbiswas4/Twinkles | twinkles/InstcatGenerationBooKeeping.py | 1 | 3405 | """
Each instance catalog has a list of spectra that are also written to disk,
and these instance catalogs are written in mutliple runs.
This module tries to check that all the files
"""
import pandas as pd
import sys, os
class ValidatePhoSimCatalogs(object):
MegaByte = 1024*1024
def __init__(self,
... | mit |
andyraib/data-storage | python_scripts/env/lib/python3.6/site-packages/matplotlib/backends/qt_editor/figureoptions.py | 10 | 8551 | # -*- coding: utf-8 -*-
#
# Copyright © 2009 Pierre Raybaut
# Licensed under the terms of the MIT License
# see the mpl licenses directory for a copy of the license
"""Module that provides a GUI-based editor for matplotlib's figure options"""
from __future__ import (absolute_import, division, print_function,
... | apache-2.0 |
waynenilsen/statsmodels | statsmodels/datasets/longley/data.py | 25 | 1930 | """Longley dataset"""
__docformat__ = 'restructuredtext'
COPYRIGHT = """This is public domain."""
TITLE = __doc__
SOURCE = """
The classic 1967 Longley Data
http://www.itl.nist.gov/div898/strd/lls/data/Longley.shtml
::
Longley, J.W. (1967) "An Appraisal of Least Squares Programs for the
El... | bsd-3-clause |
glouppe/scikit-learn | examples/datasets/plot_iris_dataset.py | 283 | 1928 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
The Iris Dataset
=========================================================
This data sets consists of 3 different types of irises'
(Setosa, Versicolour, and Virginica) petal and sepal
length, stored in a 150x4 numpy... | bsd-3-clause |
rishikksh20/scikit-learn | examples/decomposition/plot_kernel_pca.py | 353 | 2011 | """
==========
Kernel PCA
==========
This example shows that Kernel PCA is able to find a projection of the data
that makes data linearly separable.
"""
print(__doc__)
# Authors: Mathieu Blondel
# Andreas Mueller
# License: BSD 3 clause
import numpy as np
import matplotlib.pyplot as plt
from sklearn.decomp... | bsd-3-clause |
hypergravity/bopy | bopy/spec/line_indices.py | 1 | 21682 | # -*- coding: utf-8 -*-
"""
Author
------
Bo Zhang
Email
-----
bozhang@nao.cas.cn
Created on
----------
- Fri Jul 3 13:13:06 2015 read_spectrum
Modifications
-------------
- Wed Jul 29 21:46:00 2015 measure_line_index
- Fri Nov 20 10:16:59 2015 reformatting code
- Sat Jan 16 19:55:57 2016 migrate from ... | bsd-3-clause |
ChinmaiRaman/phys227-final | final.py | 1 | 6752 | #! /usr/bin/env python
"""
File: final.py
Copyright (c) 2016 Chinmai Raman
License: MIT
Course: PHYS227
Assignment: Final
Date: May 21, 2016
Email: raman105@mail.chapman.edu
Name: Chinmai Raman
Description: Final
"""
from __future__ import division
from unittest import TestCase
import numpy as np
import matplotlib
ma... | mit |
opencobra/cobrapy | src/cobra/test/test_flux_analysis/test_deletion.py | 1 | 11849 | # -*- coding: utf-8 -*-
"""Test functionalities of reaction and gene deletions."""
from __future__ import absolute_import
import math
import numpy as np
import pytest
from pandas import Series
from cobra.flux_analysis.deletion import (
double_gene_deletion,
double_reaction_deletion,
single_gene_deletio... | gpl-2.0 |
ltiao/scikit-learn | examples/text/document_clustering.py | 230 | 8356 | """
=======================================
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 |
mannyfin/VolatilityForecasting | src/function_runs.py | 1 | 5938 | from PastAsPresent import *
from linear_regression import *
from garch_pq_model import GarchModel as gm
# from KNN import KNN
import numpy as np
from KNN import KNN
import pandas as pd
from res2df_list import *
from VAR2 import *
class FunctionCalls(object):
input_data = None
tnplus1 = 0
lr = 0
arch ... | gpl-3.0 |
josephcslater/scipy | scipy/integrate/_bvp.py | 61 | 39966 | """Boundary value problem solver."""
from __future__ import division, print_function, absolute_import
from warnings import warn
import numpy as np
from numpy.linalg import norm, pinv
from scipy.sparse import coo_matrix, csc_matrix
from scipy.sparse.linalg import splu
from scipy.optimize import OptimizeResult
EPS =... | bsd-3-clause |
brian-team/brian2cuda | examples/compartmental/hodgkin_huxley_1952_cpp.py | 1 | 2435 | '''
Hodgkin-Huxley equations (1952).
'''
import os
import matplotlib
matplotlib.use('Agg')
from brian2 import *
name = os.path.basename(__file__).replace('.py', '')
codefolder = os.path.join('code', name)
print('runing example {}'.format(name))
print('compiling model in {}'.format(codefolder))
set_device('cpp_standal... | gpl-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.