repo_name stringlengths 7 90 | path stringlengths 5 191 | copies stringlengths 1 3 | size stringlengths 4 6 | content stringlengths 976 581k | license stringclasses 15
values |
|---|---|---|---|---|---|
jrdurrant/insect_analysis | vision/io_functions.py | 3 | 1853 | import csv
import glob
import os
import sys
import skimage.io
import matplotlib.pyplot as plt
import numpy as np
def read_image(filename, **kwargs):
return plt.imread(filename, **kwargs)[:, :, :3]
def write_image(filename, image, **kwargs):
if image.dtype.type == np.bool_:
image_out = 255 * image
... | gpl-2.0 |
QuantSoftware/QuantSoftwareToolkit | QSTK/qstkutil/DataAccess.py | 4 | 39833 | '''
(c) 2011, 2012 Georgia Tech Research Corporation
This source code is released under the New BSD license. Please see
http://wiki.quantsoftware.org/index.php?title=QSTK_License
for license details.
Created on Jan 15, 2013
@author: Sourabh Bajaj
@contact: sourabhbajaj@gatech.edu
@summary: Data Access python library... | bsd-3-clause |
pp-mo/iris | docs/iris/example_code/Meteorology/deriving_phenomena.py | 2 | 3148 | """
Deriving Exner Pressure and Air Temperature
===========================================
This example shows some processing of cubes in order to derive further related
cubes; in this case the derived cubes are Exner pressure and air temperature
which are calculated by combining air pressure, air potential temperatu... | lgpl-3.0 |
unnikrishnankgs/va | venv/lib/python3.5/site-packages/mpl_toolkits/exceltools.py | 10 | 3958 | """
Some io tools for excel -- requires xlwt
Example usage:
import matplotlib.mlab as mlab
import mpl_toolkits.exceltools as exceltools
r = mlab.csv2rec('somefile.csv', checkrows=0)
formatd = dict(
weight = mlab.FormatFloat(2),
change = mlab.FormatPercent(2),
cost = mlab.Fo... | bsd-2-clause |
akrherz/dep | scripts/util/compare_precip.py | 2 | 4239 | """Something precip related."""
import datetime
import pandas as pd
from pandas.io.sql import read_sql
import matplotlib.pyplot as plt
from pyiem.network import Table as NetworkTable
from pyiem.plot import MapPlot
from pyiem.util import get_dbconn, mm2inch
def two(year):
"""Compare yearly totals in a scatter plo... | mit |
jm-begon/scikit-learn | examples/missing_values.py | 233 | 3056 | """
======================================================
Imputing missing values before building an estimator
======================================================
This example shows that imputing the missing values can give better results
than discarding the samples containing any missing value.
Imputing does not ... | bsd-3-clause |
ycaihua/scikit-learn | sklearn/metrics/cluster/__init__.py | 312 | 1322 | """
The :mod:`sklearn.metrics.cluster` submodule contains evaluation metrics for
cluster analysis results. There are two forms of evaluation:
- supervised, which uses a ground truth class values for each sample.
- unsupervised, which does not and measures the 'quality' of the model itself.
"""
from .supervised import ... | bsd-3-clause |
nikhilgahlawat/ThinkStats2 | code/thinkplot.py | 75 | 18140 | """This file contains code for use with "Think Stats",
by Allen B. Downey, available from greenteapress.com
Copyright 2014 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
from __future__ import print_function
import math
import matplotlib
import matplotlib.pyplot as pyplot
import numpy as... | gpl-3.0 |
matthiaskoenig/sbmlutils | src/sbmlutils/test/manipulation/test_interpolation.py | 1 | 1441 | """Test interpolation."""
from pathlib import Path
import pandas as pd
import pytest
import roadrunner
from sbmlutils.manipulation import interpolation as ip
from sbmlutils.manipulation.interpolation_example import interpolation_example
x = [0.0, 1.0, 2.0, 3.0, 4.0, 5.0]
y = [0.0, 2.0, 1.0, 1.5, 2.5, 3.5]
z = [10.0... | lgpl-3.0 |
anntzer/scikit-learn | sklearn/decomposition/tests/test_incremental_pca.py | 12 | 14865 | """Tests for Incremental PCA."""
import numpy as np
import pytest
from sklearn.utils._testing import assert_almost_equal
from sklearn.utils._testing import assert_array_almost_equal
from sklearn.utils._testing import assert_allclose_dense_sparse
from sklearn import datasets
from sklearn.decomposition import PCA, Incr... | bsd-3-clause |
michaelaye/scikit-image | doc/examples/plot_edge_filter.py | 14 | 2258 | """
==============
Edge operators
==============
Edge operators are used in image processing within edge detection algorithms.
They are discrete differentiation operators, computing an approximation of the
gradient of the image intensity function.
"""
import numpy as np
import matplotlib.pyplot as plt
from skimage.d... | bsd-3-clause |
mahak/spark | python/pyspark/pandas/data_type_ops/datetime_ops.py | 5 | 4999 | #
# 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 |
ajylee/gpaw-rtxs | gpaw/test/ut_tddft.py | 1 | 11101 | #!/usr/bin/env python
import os, sys, time
import numpy as np
try:
# Matplotlib is not a dependency
import matplotlib as mpl
mpl.use('Agg') # force the antigrain backend
except (ImportError, RuntimeError):
mpl = None
from ase import Atoms
from ase.structure import molecule
from ase.parallel import p... | gpl-3.0 |
ibis-project/ibis | ibis/backends/pandas/execution/window.py | 1 | 16879 | """Code for computing window functions with ibis and pandas."""
import functools
import operator
import re
from typing import Any, List, NoReturn, Optional, Union
import pandas as pd
import toolz
from pandas.core.groupby import SeriesGroupBy
import ibis.common.exceptions as com
import ibis.expr.operations as ops
imp... | apache-2.0 |
Iecom-Lab/aps2016 | _exp_weibull_phase_plots.py | 1 | 1316 | import numpy as np
import matplotlib.pyplot as plt
from exp_weibull import phase_pdf
from exp_weibull import phase_hist
Omega = 1.0
alpha = 1.0
K = 1000000
t1 = np.linspace(0, 2 * np.pi / alpha, 1000)
graph = plt.gca(projection='polar')
graph.axes.get_yaxis().set_ticks([])
for m in [1.0, 1.25, 1.5, 1.8, 2.3, 3.0, 4.... | mit |
sanchestm/mitotic-index-calc | dev python code/texture.py | 1 | 1562 | import matplotlib.pyplot as plt
import numpy as np
from skimage.feature import greycomatrix, greycoprops
from scipy import misc
from skimage import exposure
def texture(img):
def local(image, value):
a = np.where(image == value)
minimum = np.array([(a[0][i]-55)**2 + (a[1][i]-55)**2 for i in range(l... | mit |
fredhusser/scikit-learn | examples/neighbors/plot_nearest_centroid.py | 264 | 1804 | """
===============================
Nearest Centroid Classification
===============================
Sample usage of Nearest Centroid classification.
It will plot the decision boundaries for each class.
"""
print(__doc__)
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
f... | bsd-3-clause |
magnastrazh/NEUCOGAR | nest/noradrenaline/nest-2.10.0/pynest/nest/voltage_trace.py | 12 | 6711 | # -*- coding: utf-8 -*-
#
# voltage_trace.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 2 of the License, ... | gpl-2.0 |
hitszxp/scikit-learn | examples/cluster/plot_lena_compress.py | 271 | 2229 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Vector Quantization Example
=========================================================
The classic image processing example, Lena, an 8-bit grayscale
bit-depth, 512 x 512 sized image, is used here to illustrate
how ... | bsd-3-clause |
daniel-muthukrishna/DASH | astrodash/restore_model.py | 1 | 5185 | import os
import pickle
from astrodash.input_spectra import *
from astrodash.multilayer_convnet import convnet_variables
try:
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
except ModuleNotFoundError:
import tensorflow as tf
def get_training_parameters(data_files='models_v06'):
scriptDire... | mit |
LiaoPan/scikit-learn | examples/bicluster/plot_spectral_coclustering.py | 276 | 1736 | """
==============================================
A demo of the Spectral Co-Clustering algorithm
==============================================
This example demonstrates how to generate a dataset and bicluster it
using the the Spectral Co-Clustering algorithm.
The dataset is generated using the ``make_biclusters`` f... | bsd-3-clause |
unicef/rhizome | rhizome/api/resources/date_datapoint.py | 1 | 11561 | from tastypie import fields
from tastypie.resources import ALL
from pandas import DataFrame
from rhizome.api.serialize import CustomSerializer
from rhizome.api.resources.base_model import BaseModelResource
from rhizome.api.exceptions import RhizomeApiException
from rhizome.models.location_models import Location, Locat... | agpl-3.0 |
dials/dials | algorithms/indexing/nearest_neighbor.py | 1 | 5934 | import math
class NeighborAnalysis:
def __init__(
self,
reflections,
step_size=45,
tolerance=1.5,
max_height_fraction=0.25,
percentile=None,
histogram_binning="linear",
nn_per_bin=5,
):
self.tolerance = tolerance # Margin of error for ma... | bsd-3-clause |
energy725/eecom | eecom/point.py | 1 | 2648 | import pandas as pd
from pandas import Series
from pandas.tseries.index import DatetimeIndex
class Point(object):
"""
The basic representation unit of energy data, usually refers to monitoring
or measurement point of meters or sensors.
"""
def __init__(self, data, p_name=None, p_type='cumulative'... | mit |
jmschrei/scikit-learn | sklearn/metrics/tests/test_classification.py | 20 | 50188 | from __future__ import division, print_function
import numpy as np
from scipy import linalg
from functools import partial
from itertools import product
import warnings
from sklearn import datasets
from sklearn import svm
from sklearn.datasets import make_multilabel_classification
from sklearn.preprocessing import la... | bsd-3-clause |
MSeifert04/astropy | astropy/visualization/tests/test_norm.py | 3 | 9643 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import numpy as np
from numpy import ma
from numpy.testing import assert_allclose, assert_equal
from astropy.visualization.mpl_normalize import ImageNormalize, simple_norm, imshow_norm
from astropy.visualization.interval import ManualInterv... | bsd-3-clause |
tensorflow/estimator | tensorflow_estimator/python/estimator/canned/v1/linear_testing_utils_v1.py | 1 | 91108 | # 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 |
bnaul/scikit-learn | benchmarks/bench_plot_incremental_pca.py | 40 | 5977 | """
========================
IncrementalPCA benchmark
========================
Benchmarks for IncrementalPCA
"""
import numpy as np
import gc
from time import time
from collections import defaultdict
import matplotlib.pyplot as plt
from sklearn.datasets import fetch_lfw_people
from sklearn.decomposition import Incre... | bsd-3-clause |
chase-qi/workload-automation | wlauto/utils/doc.py | 4 | 10459 | # Copyright 2014-2015 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 |
aflaxman/scikit-learn | examples/ensemble/plot_adaboost_multiclass.py | 38 | 4126 | """
=====================================
Multi-class AdaBoosted Decision Trees
=====================================
This example reproduces Figure 1 of Zhu et al [1]_ and shows how boosting can
improve prediction accuracy on a multi-class problem. The classification
dataset is constructed by taking a ten-dimensional... | bsd-3-clause |
yu4u/age-gender-estimation | utkface/detect_face_regions.py | 1 | 1422 | import argparse
from pathlib import Path
from tqdm import tqdm
import pandas as pd
import cv2
import dlib
def get_args():
parser = argparse.ArgumentParser(description="This script detect faces using dlib and save detected face rects",
formatter_class=argparse.ArgumentDefaultsH... | mit |
sumspr/scikit-learn | sklearn/preprocessing/data.py | 113 | 56747 | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Mathieu Blondel <mathieu@mblondel.org>
# Olivier Grisel <olivier.grisel@ensta.org>
# Andreas Mueller <amueller@ais.uni-bonn.de>
# Eric Martin <eric@ericmart.in>
# License: BSD 3 clause
from itertools import chain, combina... | bsd-3-clause |
devanshdalal/scikit-learn | examples/linear_model/plot_theilsen.py | 100 | 3846 | """
====================
Theil-Sen Regression
====================
Computes a Theil-Sen Regression on a synthetic dataset.
See :ref:`theil_sen_regression` for more information on the regressor.
Compared to the OLS (ordinary least squares) estimator, the Theil-Sen
estimator is robust against outliers. It has a breakd... | bsd-3-clause |
rsivapr/scikit-learn | sklearn/utils/tests/test_extmath.py | 4 | 12928 | # Authors: Olivier Grisel <olivier.grisel@ensta.org>
# Mathieu Blondel <mathieu@mblondel.org>
# Denis Engemann <d.engemann@fz-juelich.de>
#
# License: BSD 3 clause
import warnings
import numpy as np
from scipy import sparse
from scipy import linalg
from scipy import stats
from sklearn.utils.testing i... | bsd-3-clause |
cojacoo/echoRD_model | echoRD/partdyn_d2.py | 1 | 43305 | # coding=utf-8
import numpy as np
import scipy as sp
import matplotlib.pyplot as plt
import scipy.constants as const
import scipy.ndimage as spn
import dataread as dr
import vG_conv as vG
#particle dynamics
#macropore mc.soilmatrix interaction
def cellgrid(lat,z,mc):
'''Calculate cell number from given position o... | gpl-3.0 |
victorbergelin/scikit-learn | sklearn/tests/test_common.py | 127 | 7665 | """
General tests for all estimators in sklearn.
"""
# Authors: Andreas Mueller <amueller@ais.uni-bonn.de>
# Gael Varoquaux gael.varoquaux@normalesup.org
# License: BSD 3 clause
from __future__ import print_function
import os
import warnings
import sys
import pkgutil
from sklearn.externals.six import PY3
fr... | bsd-3-clause |
hsuantien/scikit-learn | examples/svm/plot_separating_hyperplane_unbalanced.py | 329 | 1850 | """
=================================================
SVM: Separating hyperplane for unbalanced classes
=================================================
Find the optimal separating hyperplane using an SVC for classes that
are unbalanced.
We first find the separating plane with a plain SVC and then plot
(dashed) the ... | bsd-3-clause |
Benedicto/ML-Learning | em_utilities.py | 7 | 5273 | from scipy.sparse import csr_matrix
from scipy.sparse import spdiags
from scipy.stats import multivariate_normal
import graphlab
import numpy as np
import sys
import time
from copy import deepcopy
from sklearn.metrics import pairwise_distances
from sklearn.preprocessing import normalize
def sframe_to_scipy(x, column_n... | gpl-3.0 |
lconceicao/son-cli | src/son/monitor/profiler.py | 3 | 27754 | """
Copyright (c) 2015 SONATA-NFV
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 applicable law or agreed to in... | apache-2.0 |
myron0330/caching-research | section_cmab/simulation/simu_mem_comp.py | 1 | 6851 | # -*- coding: UTF-8 -*-
# **********************************************************************************#
# File:
# **********************************************************************************#
from __future__ import division
import pickle
from collections import OrderedDict
from os import listdir
impor... | mit |
eickenberg/scikit-learn | examples/applications/wikipedia_principal_eigenvector.py | 41 | 7742 | """
===============================
Wikipedia principal eigenvector
===============================
A classical way to assert the relative importance of vertices in a
graph is to compute the principal eigenvector of the adjacency matrix
so as to assign to each vertex the values of the components of the first
eigenvect... | bsd-3-clause |
zrisher/webapp-public | webapp/apps/taxbrain/tasks.py | 4 | 2624 | import taxcalc
import pandas as pd
import os
import json
from taxcalc import *
import dropq
from celery import Celery
import time
import boto
from boto.s3.connection import S3Connection
import os
from .helpers import *
AWS_KEY_ID = os.environ['AWS_KEY_ID']
AWS_SECRET_ID = os.environ['AWS_SECRET_ID']
NUM_BUDGET_YEAR... | mit |
hstorm/nn_spatial | src/models/run00_003.py | 1 | 1986 |
#%%
from importlib import reload
import Model
reload(Model)
from Model import Model
import ModRun
reload(ModRun)
from ModRun import Run
import numpy as np
import pandas as pd
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation
from keras.optimizers import SGD,RMSprop
from sklea... | mit |
blbarker/spark-tk | regression-tests/sparktkregtests/testcases/models/linear_regression_test.py | 10 | 6006 | # vim: set encoding=utf-8
# Copyright (c) 2016 Intel Corporation
#
# 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 require... | apache-2.0 |
cloudera/ibis | ibis/backends/pandas/execution/window.py | 1 | 15409 | """Code for computing window functions with ibis and pandas."""
import functools
import operator
import re
from typing import Any, List, NoReturn, Optional
import pandas as pd
import toolz
from pandas.core.groupby import SeriesGroupBy
import ibis.common.exceptions as com
import ibis.expr.operations as ops
import ibi... | apache-2.0 |
Chuban/moose | python/peacock/PostprocessorViewer/plugins/LineGroupWidget.py | 4 | 12247 | import collections
from PyQt5 import QtCore, QtWidgets
from LineSettingsWidget import LineSettingsWidget
import peacock
import mooseutils
class LineGroupWidget(peacock.base.MooseWidget, QtWidgets.QGroupBox):
"""
A GroupBox containing the artist toggles for each postprocessor in the supplied data object.
... | lgpl-2.1 |
allenlavoie/tensorflow | tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined_test.py | 30 | 70017 | # 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 |
flightgong/scikit-learn | sklearn/tests/test_hmm.py | 31 | 28118 | from __future__ import print_function
import numpy as np
from numpy.testing import assert_array_equal, assert_array_almost_equal
from unittest import TestCase
from sklearn.datasets.samples_generator import make_spd_matrix
from sklearn import hmm
from sklearn import mixture
from sklearn.utils.extmath import logsumexp
... | bsd-3-clause |
quantumlib/Cirq | cirq-google/cirq_google/calibration/xeb_wrapper_test.py | 1 | 4677 | # Copyright 2021 The Cirq Developers
#
# 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 agreed to in ... | apache-2.0 |
astroJeff/dart_board | dart_board/plot_system_evolution.py | 1 | 10918 | import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import matplotlib.patches as mpatches
from .utils import A_to_P, P_to_A
N_times = 500
# Colors
C0 = 'C0'
C1 = 'C1'
def func_Roche_radius(M1, M2, A):
""" Get Roche lobe radius (Egg... | mit |
youprofit/scikit-image | doc/examples/plot_register_translation.py | 14 | 2463 | """
=====================================
Cross-Correlation (Phase Correlation)
=====================================
In this example, we use phase correlation to identify the relative shift
between two similar-sized images.
The ``register_translation`` function uses cross-correlation in Fourier space,
optionally emp... | bsd-3-clause |
shahankhatch/scikit-learn | examples/applications/plot_tomography_l1_reconstruction.py | 204 | 5442 | """
======================================================================
Compressive sensing: tomography reconstruction with L1 prior (Lasso)
======================================================================
This example shows the reconstruction of an image from a set of parallel
projections, acquired along dif... | bsd-3-clause |
jakobworldpeace/scikit-learn | sklearn/feature_selection/variance_threshold.py | 123 | 2572 | # Author: Lars Buitinck
# License: 3-clause BSD
import numpy as np
from ..base import BaseEstimator
from .base import SelectorMixin
from ..utils import check_array
from ..utils.sparsefuncs import mean_variance_axis
from ..utils.validation import check_is_fitted
class VarianceThreshold(BaseEstimator, SelectorMixin):
... | bsd-3-clause |
louispotok/pandas | pandas/core/indexes/accessors.py | 2 | 10282 | """
datetimelike delegation
"""
import numpy as np
from pandas.core.dtypes.generic import ABCSeries
from pandas.core.dtypes.common import (
is_period_arraylike,
is_datetime_arraylike, is_integer_dtype,
is_datetime64_dtype, is_datetime64tz_dtype,
is_timedelta64_dtype, is_categorical_dtype,
is_list_... | bsd-3-clause |
waterponey/scikit-learn | sklearn/preprocessing/tests/test_data.py | 15 | 61914 |
# Authors:
#
# Giorgio Patrini
#
# License: BSD 3 clause
import warnings
import numpy as np
import numpy.linalg as la
from scipy import sparse
from distutils.version import LooseVersion
from sklearn.utils import gen_batches
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing im... | bsd-3-clause |
wazeerzulfikar/scikit-learn | examples/ensemble/plot_adaboost_multiclass.py | 354 | 4124 | """
=====================================
Multi-class AdaBoosted Decision Trees
=====================================
This example reproduces Figure 1 of Zhu et al [1] and shows how boosting can
improve prediction accuracy on a multi-class problem. The classification
dataset is constructed by taking a ten-dimensional ... | bsd-3-clause |
nelson-liu/scikit-learn | sklearn/decomposition/base.py | 313 | 5647 | """Principal Component Analysis Base Classes"""
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Olivier Grisel <olivier.grisel@ensta.org>
# Mathieu Blondel <mathieu@mblondel.org>
# Denis A. Engemann <d.engemann@fz-juelich.de>
# Kyle Kastner <kastnerkyle@gmail.com>
#
# Licen... | bsd-3-clause |
ChanderG/scikit-learn | sklearn/covariance/tests/test_graph_lasso.py | 272 | 5245 | """ Test the graph_lasso module.
"""
import sys
import numpy as np
from scipy import linalg
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_array_less
from sklearn.covariance import (graph_lasso, GraphLasso, GraphLassoCV,
empirical_... | bsd-3-clause |
pombredanne/dask | dask/dataframe/tests/test_io.py | 1 | 25136 | import gzip
import pandas as pd
import numpy as np
import pandas.util.testing as tm
import os
import dask
from operator import getitem
import pytest
from toolz import valmap
import tempfile
import shutil
from time import sleep
import threading
import dask.array as da
import dask.dataframe as dd
from dask.dataframe.io ... | bsd-3-clause |
G-Node/nix-demo | utils/video_player.py | 1 | 3613 | # !/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, division
import nixio as nix
import math
import cv2
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import matplotlib
matplotlib.use('TkAgg')
class Playback(object):
def __init__... | bsd-3-clause |
kklmn/xrt | examples/withRaycing/11_Waves/waveGrating.py | 1 | 27261 | # -*- coding: utf-8 -*-
r"""
.. !!! select one of the three functions to run at the very bottom !!!
.. _gratingDiffraction:
Diffraction from grating
------------------------
Various gratings described in [Boots]_ have been tested with xrt for
diffraction efficiency. The efficiency curves in [Boots]_ were calculated... | mit |
5GExchange/mapping | simulation/create_plots.py | 1 | 52735 | #!/usr/bin/python
import matplotlib.pyplot as plt
from matplotlib import *
import sys, getopt
import copy
import time
import datetime
import random
import sys
import os
import statistics
def get_data(file_list, start, finish, nice, count_vnf, stat_file,
return_stat_refused=False):
mapped_reqs, runnin... | apache-2.0 |
xavierwu/scikit-learn | sklearn/decomposition/tests/test_nmf.py | 47 | 8566 | import numpy as np
from scipy import linalg
from sklearn.decomposition import nmf
from scipy.sparse import csc_matrix
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_false
from sklearn.utils.testing import assert_raise_message
from sklearn.utils.testing import assert_array_almost... | bsd-3-clause |
rallured/PyXFocus | examples/axro/WSverify.py | 1 | 7501 | import traces.PyTrace as PT
import numpy as np
import traces.conicsolve as con
import sys,pdb
import matplotlib.pyplot as plt
def traceChaseParam(num,psi,theta,alpha,L1,z0,bestFocus=False,chaseFocus=False):
"""Trace a WS mirror pair using the parameters in Eq. 13
of Chase & VanSpeybroeck
Return the RMS rad... | mit |
jinzishuai/learn2deeplearn | deeplearning.ai/C1.NN_DL/week2/Logistic+Regression+with+a+Neural+Network+mindset+v4.py | 1 | 29517 |
# coding: utf-8
# # Logistic Regression with a Neural Network mindset
#
# Welcome to your first (required) programming assignment! You will build a logistic regression classifier to recognize cats. This assignment will step you through how to do this with a Neural Network mindset, and so will also hone your intuiti... | gpl-3.0 |
d-grossman/magichour | deprecated/StringKernel/kernel_kmeans.py | 2 | 4996 | """Kernel K-means"""
# Author: Mathieu Blondel <mathieu@mblondel.org>
# License: BSD 3 clause
import logging
import numpy as np
import time
from sklearn.base import BaseEstimator, ClusterMixin
from sklearn.metrics.pairwise import pairwise_kernels
from sklearn.utils import check_random_state
logger = logging.getLogg... | apache-2.0 |
IndraVikas/scikit-learn | sklearn/tests/test_qda.py | 155 | 3481 | import numpy as np
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_greater
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing import ignore_war... | bsd-3-clause |
jmmease/pandas | pandas/tests/indexes/test_range.py | 3 | 35978 | # -*- coding: utf-8 -*-
import pytest
from datetime import datetime
from itertools import combinations
import operator
from pandas.compat import range, u, PY3
import numpy as np
from pandas import (isna, notna, Series, Index, Float64Index,
Int64Index, RangeIndex)
import pandas.util.testing as ... | bsd-3-clause |
ksk5429/ksk5429.github.io | DBNanoServer/demo.py | 3 | 2488 | # -*- coding: utf-8 -*-
"""
Demo for DBNanoServer
"""
import requests
import json
import numpy as np
import datetime
import matplotlib.pyplot as plt
def main():
# Generate a sine and cosine wave
Fs = 800
f = 60
sample = 50
x = np.arange(sample)
y_sin = np.sin(2 * np.pi * f * x / Fs)
y_... | apache-2.0 |
timsnyder/bokeh | bokeh/util/sampledata.py | 1 | 7454 | #-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2019, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | bsd-3-clause |
Martin09/E-BeamPatterns | 111 Wafers - 1.2cm Triangles/111A Nanowires/v1.0/gdsCAD_v045/core.py | 4 | 74577 | # -*- coding: utf-8 -*-
"""
The primary geometry elements, layout and organization classes.
The objects found here are intended to correspond directly to elements found in
the GDSII specification.
The fundamental gdsCAD object is the Layout, which contains all the information
to be sent to the mask shop. A Layout can... | gpl-3.0 |
has2k1/plotnine | plotnine/themes/theme_xkcd.py | 1 | 3535 | from copy import copy, deepcopy
from matplotlib import patheffects
from .elements import (element_line, element_rect, element_blank,
element_text)
from .theme import theme
from .theme_gray import theme_gray
class theme_xkcd(theme_gray):
"""
xkcd theme
Parameters
----------
... | gpl-2.0 |
guorendong/iridium-browser-ubuntu | native_client/buildbot/buildbot_pnacl.py | 2 | 10251 | #!/usr/bin/python
# Copyright (c) 2013 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import sys
from buildbot_lib import (
BuildContext, BuildStatus, Command, ParseStandardCommandLine,
RemoveScons... | bsd-3-clause |
GCerar/PythonTecaj | LTFE/staticne_slike.py | 1 | 3336 | from PIL import Image, ImageEnhance, ImageOps
import matplotlib as mpl
import matplotlib.pyplot as plt
def histogram(slika, pokazi=True):
"""Izriše histogram za dano sliko. Ta je lahko sivinska ali barvna.
Args:
slika (object): PIL/Pillow objekt
pokazi (bool): Če želimo takoj videti graf. (De... | mit |
boomsbloom/dtm-fmri | DTM/for_gensim/lib/python2.7/site-packages/sklearn/model_selection/_validation.py | 5 | 36967 | """
The :mod:`sklearn.model_selection._validation` module includes classes and
functions to validate the model.
"""
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>,
# Gael Varoquaux <gael.varoquaux@normalesup.org>,
# Olivier Grisel <olivier.grisel@ensta.org>
# License: BSD 3 clause
from __... | mit |
mlyundin/scikit-learn | examples/cluster/plot_dict_face_patches.py | 337 | 2747 | """
Online learning of a dictionary of parts of faces
==================================================
This example uses a large dataset of faces to learn a set of 20 x 20
images patches that constitute faces.
From the programming standpoint, it is interesting because it shows how
to use the online API of the sciki... | bsd-3-clause |
jdmcbr/geopandas | geopandas/tools/geocoding.py | 2 | 5897 | from collections import defaultdict
import time
import pandas as pd
from shapely.geometry import Point
import geopandas
def _get_throttle_time(provider):
"""
Amount of time to wait between requests to a geocoding API, for providers
that specify rate limits in their terms of service.
"""
import ... | bsd-3-clause |
UBOdin/jitd-synthesis | treetoaster_scripts/generate_graphs_11_13.py | 1 | 8921 |
import gzip
import json
import sys
import os
import io
import copy
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.patches as mpatches
import math
from matplotlib.patches import Patch
from matplotlib.lines import Line2D
runcount = 10
#xdim = 22
#ydim = 12
#xdim = 10
#... | apache-2.0 |
simongibbons/numpy | numpy/core/numeric.py | 3 | 72030 | import functools
import itertools
import operator
import sys
import warnings
import numbers
import numpy as np
from . import multiarray
from .multiarray import (
_fastCopyAndTranspose as fastCopyAndTranspose, ALLOW_THREADS,
BUFSIZE, CLIP, MAXDIMS, MAY_SHARE_BOUNDS, MAY_SHARE_EXACT, RAISE,
WRAP, arange, arr... | bsd-3-clause |
ustroetz/python-osrm | tests.py | 1 | 27075 | # -*- coding: utf-8 -*-
import unittest
try:
from unittest import mock
except:
import mock
try:
from urllib.request import URLError
except:
from urllib2 import URLError
from pandas import DataFrame
from geopandas import GeoDataFrame
import numpy
import os
import osrm
class MockReadable:
def __i... | mit |
ky822/scikit-learn | examples/preprocessing/plot_robust_scaling.py | 221 | 2702 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Robust Scaling on Toy Data
=========================================================
Making sure that each Feature has approximately the same scale can be a
crucial preprocessing step. However, when data contains o... | bsd-3-clause |
maximus009/kaggle-galaxies | try_convnet_cc_multirotflip_3x69r45_8433n_maxout2048_extradense_pysex.py | 7 | 17687 | import numpy as np
# import pandas as pd
import theano
import theano.tensor as T
import layers
import cc_layers
import custom
import load_data
import realtime_augmentation as ra
import time
import csv
import os
import cPickle as pickle
from datetime import datetime, timedelta
# import matplotlib.pyplot as plt
# plt.i... | bsd-3-clause |
Pedals2Paddles/ardupilot | Tools/LogAnalyzer/tests/TestOptFlow.py | 32 | 14968 | from LogAnalyzer import Test,TestResult
import DataflashLog
from math import sqrt
import numpy as np
import matplotlib.pyplot as plt
class TestFlow(Test):
'''test optical flow sensor scale factor calibration'''
#
# Use the following procedure to log the calibration data. is assumed that the optical flow ... | gpl-3.0 |
vortex-ape/scikit-learn | examples/applications/plot_topics_extraction_with_nmf_lda.py | 39 | 4820 | """
=======================================================================================
Topic extraction with Non-negative Matrix Factorization and Latent Dirichlet Allocation
=======================================================================================
This is an example of applying :class:`sklearn.deco... | bsd-3-clause |
erdc-cm/air-water-vv | 3d/floating_bar/suboff.py | 2 | 16114 | #! /usr/bin/env python
import proteus
from proteus import Domain
import numpy
def discretize_yz_plane(y,z,r,theta):
y[:] = r*numpy.cos(theta)
z[:] = r*numpy.sin(theta)
def test_cylinder(nx,ntheta):
"""
work on building mesh of a cylinder
"""
from math import sqrt,pow,pi
import n... | mit |
blbarker/spark-tk | regression-tests/sparktkregtests/testcases/models/naive_bayes_test.py | 10 | 6233 | # vim: set encoding=utf-8
# Copyright (c) 2016 Intel Corporation
#
# 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 require... | apache-2.0 |
haudren/scipy | scipy/stats/_binned_statistic.py | 28 | 25272 | from __future__ import division, print_function, absolute_import
import warnings
import numpy as np
from scipy._lib.six import callable, xrange
from collections import namedtuple
__all__ = ['binned_statistic',
'binned_statistic_2d',
'binned_statistic_dd']
BinnedStatisticResult = namedtuple('B... | bsd-3-clause |
mne-tools/mne-python | mne/io/fieldtrip/tests/test_fieldtrip.py | 4 | 13768 | # -*- coding: UTF-8 -*-
# Authors: Thomas Hartmann <thomas.hartmann@th-ht.de>
# Dirk Gütlin <dirk.guetlin@stud.sbg.ac.at>
#
# License: BSD (3-clause)
import mne
import os.path
import pytest
import copy
import itertools
import numpy as np
from mne.datasets import testing
from mne.io.fieldtrip.utils import NOIN... | bsd-3-clause |
azjps/bokeh | bokeh/sampledata/periodic_table.py | 15 | 1575 | '''
This module provides the periodic table as a data set. It exposes an attribute 'elements'
which is a pandas dataframe with the following fields
elements['atomic Number'] (units: g/cm^3)
elements['symbol']
elements['name']
elements['atomic mass'] (units: amu)
elements['CPK'] ... | bsd-3-clause |
kod3r/topic_space | topic_space/app/wordcloud_generator.py | 4 | 4772 | """Visualizations of the material science research files"""
import cPickle
import os
import os.path
import pandas as pd
import pattern.vector as pv
from wordcloud import WordCloud
from elasticsearch import Elasticsearch
from elasticsearch.helpers import scan
from config import ELASTICSEARCH_HOST, ELASTICSEARCH_INDE... | apache-2.0 |
jeepsterboy/waveletanalysis | wavelet_analy_plot_goa.py | 1 | 3588 | #!/usr/bin/env
"""
wavelet_analy_plots_goa.py
to be used with
Wavelet_analy_GOA_yearstitch.py
For P. Stabeno
Using Anaconda packaged Python
modifications for confidence intervals based on wave_matlab at
http://paos.colorado.edu/research/wavelets/
"""
#Standard packages
import os
#Science packages
i... | mit |
jblackburne/scikit-learn | examples/model_selection/plot_roc_crossval.py | 21 | 3477 | """
=============================================================
Receiver Operating Characteristic (ROC) with cross validation
=============================================================
Example of Receiver Operating Characteristic (ROC) metric to evaluate
classifier output quality using cross-validation.
ROC curv... | bsd-3-clause |
hrichstein/phys_50733 | rh_project/fiver.py | 1 | 4014 | import numpy as np
import matplotlib.pyplot as plt
# from scipy.constants import G
# Setting plotting parameters
from matplotlib import rc,rcParams
rc('text', usetex=True)
rc('axes', linewidth=2)
rc('font', weight='bold')
rc('font', **{'family': 'serif', 'serif':['Computer Modern']})
def find_vel_init(M1, M2, a):
pe... | mit |
RalphBariz/RalphsDotNet | Old/RalphsDotNet.Apps.OptimizationStudio/Resources/PyLib/numpy/doc/creation.py | 94 | 5411 | """
==============
Array Creation
==============
Introduction
============
There are 5 general mechanisms for creating arrays:
1) Conversion from other Python structures (e.g., lists, tuples)
2) Intrinsic numpy array array creation objects (e.g., arange, ones, zeros,
etc.)
3) Reading arrays from disk, either from... | gpl-3.0 |
jmetzen/scikit-learn | sklearn/gaussian_process/kernels.py | 18 | 66251 | """Kernels for Gaussian process regression and classification.
The kernels in this module allow kernel-engineering, i.e., they can be
combined via the "+" and "*" operators or be exponentiated with a scalar
via "**". These sum and product expressions can also contain scalar values,
which are automatically converted to... | bsd-3-clause |
r-mart/scikit-learn | sklearn/linear_model/tests/test_randomized_l1.py | 214 | 4690 | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# License: BSD 3 clause
import numpy as np
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.linear_model.randomized_l1 i... | bsd-3-clause |
jayhetee/auto-sklearn | test/automl/test_start_automl.py | 5 | 1938 | import cPickle
import multiprocessing
import os
import shutil
import unittest
import mock
import numpy as np
import ParamSklearn.util as putil
import autosklearn.automl
from autosklearn.constants import *
class AutoMLTest(unittest.TestCase):
def setUp(self):
self.test_dir = os.path.dirname(__file__)
... | bsd-3-clause |
ville-k/tensorflow | tensorflow/examples/learn/iris_custom_model.py | 50 | 2613 | # 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 appl... | apache-2.0 |
vybstat/scikit-learn | sklearn/tests/test_grid_search.py | 53 | 28730 | """
Testing for grid search module (sklearn.grid_search)
"""
from collections import Iterable, Sized
from sklearn.externals.six.moves import cStringIO as StringIO
from sklearn.externals.six.moves import xrange
from itertools import chain, product
import pickle
import sys
import numpy as np
import scipy.sparse as sp
... | bsd-3-clause |
sniemi/SamPy | astronomy/polarimetry.py | 1 | 9696 | """
Functions related to polarimetry, especially HST ACS WFC.
:requires: NumPy
:requires: SciPy
:requires: matplotlib
:requires: Kapteyn Python package
:author: Sami-Matias Niemi
:contact: sammy@sammyniemi.com
:version: 0.5
"""
from time import time
import os, os.path
import numpy as np
import pyfits as pf
import sc... | bsd-2-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.