repo_name stringlengths 6 112 | path stringlengths 4 204 | copies stringlengths 1 3 | size stringlengths 4 7 | content stringlengths 711 1.04M | license stringclasses 15
values | hash int64 -9,223,328,406,218,787,000 9,223,331,109B | line_mean float64 5.74 99.7 | line_max int64 17 1k | alpha_frac float64 0.25 0.96 | autogenerated bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|
OMS-NetZero/FAIR | fair/gas_cycle/gir.py | 1 | 2430 | from __future__ import division
import numpy as np
from ..constants.general import ppm_gtc
"""Gas cycle functions from Generalised Impulse Response Model v1.0.0.
Much of this has been adapted from:
Leach et al., 2020, Geoscientific Model Development
https://www.geosci-model-dev-discuss.net/gmd-2019-379/
"""
def c... | apache-2.0 | -8,292,986,400,798,594,000 | 37.571429 | 104 | 0.680247 | false |
mathkann/hyperopt | hyperopt/tests/test_criteria.py | 7 | 1917 | import numpy as np
import hyperopt.criteria as crit
def test_ei():
rng = np.random.RandomState(123)
for mean, var in [(0, 1), (-4, 9)]:
thresholds = np.arange(-5, 5, .25) * np.sqrt(var) + mean
v_n = [crit.EI_gaussian_empirical(mean, var, thresh, rng, 10000)
for thresh in thresh... | bsd-3-clause | -1,589,826,703,282,367,200 | 29.919355 | 73 | 0.542514 | false |
cython-testbed/pandas | pandas/tests/scalar/timestamp/test_timezones.py | 1 | 12514 | # -*- coding: utf-8 -*-
"""
Tests for Timestamp timezone-related methods
"""
from datetime import datetime, date, timedelta
from distutils.version import LooseVersion
import pytest
import pytz
from pytz.exceptions import AmbiguousTimeError, NonExistentTimeError
import dateutil
from dateutil.tz import gettz, tzoffset
... | bsd-3-clause | -6,155,344,485,097,374,000 | 39.498382 | 79 | 0.590698 | false |
zhuhuifeng/PyML | mla/neuralnet/layers/basic.py | 1 | 4512 | import autograd.numpy as np
from autograd import elementwise_grad
from mla.neuralnet.activations import get_activation
from mla.neuralnet.parameters import Parameters
np.random.seed(9999)
class Layer(object):
def setup(self, X_shape):
"""Allocates initial weights."""
pass
def forward_pass(s... | apache-2.0 | 4,052,290,290,537,210,400 | 23.791209 | 77 | 0.586436 | false |
rykov8/ssd_keras | ssd_layers.py | 3 | 6719 | """Some special pupropse layers for SSD."""
import keras.backend as K
from keras.engine.topology import InputSpec
from keras.engine.topology import Layer
import numpy as np
import tensorflow as tf
class Normalize(Layer):
"""Normalization layer as described in ParseNet paper.
# Arguments
scale: Defau... | mit | 9,192,958,743,215,568,000 | 36.121547 | 78 | 0.564072 | false |
OmnesRes/pan_cancer | paper/cox_regression/KIRC/patient_info.py | 1 | 6241 | ## A script for extracting info about the patients used in the analysis
## Load necessary modules
from rpy2 import robjects as ro
import numpy as np
import os
ro.r('library(survival)')
##This call will only work if you are running python from the command line.
##If you are not running from the command line manually... | mit | 3,009,862,005,212,880,400 | 28.300469 | 132 | 0.645089 | false |
l-althueser/NiMoNa_DCM16 | DCM/programs/RK4.py | 1 | 1088 | # -*- coding: utf-8 -*-
"""
@author: Tobias
Timo
Beschreibung:
Runge-Kutta-Verfahren vierter Ordnung zur Lösung von gewöhnlichen DGL 1. Ordnung.
Ausgabe der Zeitentwicklung in Matrixform.
Wichtig:
Die Dimension des Eingabeparameters x_0 muss mit dem verwendetem Modell überinstimmen.
Pythonversion:... | bsd-2-clause | -8,869,651,187,784,231,000 | 29.111111 | 105 | 0.553093 | false |
dingliu0305/Tree-Tensor-Networks-in-Machine-Learning | code/tsne_mnist.py | 1 | 3214 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# import matplotlib as mpl
# mpl.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import pickle
from matplotlib.backends.backend_pdf import PdfPages
from sklearn.manifold import TSNE
data_folder = "./data/mnist/"
n_epochs = 3
bond_data = 2
bond_inner = 3
bo... | mit | 9,021,563,037,263,550,000 | 22.289855 | 75 | 0.584941 | false |
ominux/scikit-learn | examples/manifold/plot_compare_methods.py | 4 | 2211 | """
=========================================
Comparison of Manifold Learning methods
=========================================
An illustration of dimensionality reduction on the S-curve dataset
with various manifold learning methods.
For a discussion and comparison of these algorithms, see the
:ref:`manifold module... | bsd-3-clause | -8,009,370,989,050,230,000 | 29.708333 | 71 | 0.620081 | false |
StongeEtienne/trimeshpy | trimeshpy/math/mesh_map.py | 1 | 6095 | # Etienne St-Onge
from __future__ import division
import numpy as np
from scipy.sparse import csc_matrix
from trimeshpy.math.util import square_length
from trimeshpy.math.mesh_global import G_DTYPE
# Mesh structure functions
# Map ( Adjacency / Connectivity ) Functions
#
# number of vertices = n
# number of ... | mit | -4,785,637,220,778,597,000 | 34.028736 | 78 | 0.474815 | false |
hosseinsadeghi/ultracold-ions | test/test_CoulombAcc.py | 2 | 4459 | import uci.CoulombAcc as uci
import numpy as np
import pyopencl as cl
import pyopencl.array as cl_array
testCtx = cl.create_some_context(interactive = True)
testQueue = cl.CommandQueue(testCtx)
def test_Constructor():
coulomb_acc = uci.CoulombAcc()
def test_ForceOnSingleParticleIsZero():
coulomb_acc = uci.Co... | mit | -2,679,120,046,525,874,700 | 30.401408 | 73 | 0.578381 | false |
hughperkins/gpu-experiments | gpuexperiments/occupancy_dyn_graphs.py | 1 | 2094 | """
Try using dynamic shared memory, see if gets optimized away, or affects occupancy
"""
from __future__ import print_function, division
import argparse
import string
import numpy as np
import os
import matplotlib.pyplot as plt
plt.rcdefaults()
import matplotlib.pyplot as plt
from os.path import join
parser = argpar... | bsd-2-clause | -6,801,072,646,690,389,000 | 26.552632 | 102 | 0.660936 | false |
ljschumacher/tierpsy-tracker | tierpsy/analysis/stage_aligment/findStageMovement.py | 2 | 58507 | import numpy as np
import warnings
import tables
from tierpsy.helper.misc import TimeCounter, print_flush, get_base_name
from tierpsy.helper.params import read_fps
from tierpsy.analysis.stage_aligment.get_mask_diff_var import get_mask_diff_var
def _matlab_std(x):
if x.size <= 1:
#in array of size 1 MAT... | mit | 6,729,585,383,931,663,000 | 43.222222 | 116 | 0.551167 | false |
fsxfreak/esys-pbi | src/pupil/pupil_src/shared_modules/frame_publisher.py | 2 | 2998 | '''
(*)~---------------------------------------------------------------------------
Pupil - eye tracking platform
Copyright (C) 2012-2017 Pupil Labs
Distributed under the terms of the GNU
Lesser General Public License (LGPL v3.0).
See COPYING and COPYING.LESSER for license details.
-----------------------------------... | mit | 2,254,809,564,954,330,000 | 33.079545 | 150 | 0.543362 | false |
dmitru/pines | pines/trees.py | 1 | 8172 | # coding=utf-8
import numpy as np
from copy import deepcopy
class BinaryDecisionTreeSplit(object):
def __init__(self, feature_id, value):
self.feature_id = feature_id
self.value = value
class BinaryDecisionTree(object):
"""
Implements a binary decision tree with array-based representation... | mit | 2,368,062,335,330,216,400 | 34.947137 | 103 | 0.55098 | false |
philouc/pyhrf | python/pyhrf/test/test_glm.py | 1 | 3214 | import unittest
import pyhrf
import os.path as op
import shutil
class NipyGLMTest(unittest.TestCase):
def setUp(self):
self.tmp_dir = pyhrf.get_tmp_path()
def tearDown(self):
shutil.rmtree(self.tmp_dir)
# def _simulate_bold(self):
# boldf, tr, paradigmf, maskf = simulate_bold(o... | gpl-3.0 | -4,689,871,972,983,716,000 | 27.192982 | 78 | 0.589919 | false |
florian-f/sklearn | examples/svm/plot_svm_margin.py | 4 | 2295 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
SVM Margins Example
=========================================================
The plots below illustrate the effect the parameter `C` has
on the seperation line. A large value of `C` basically tells
our model that w... | bsd-3-clause | -3,608,698,199,744,564,700 | 25.37931 | 76 | 0.582571 | false |
Marcello-Sega/pytim | setup.py | 1 | 5678 | # -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding: utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
"""A python based tool for interfacial molecules analysis
"""
# To use a consistent encoding
import codecs
import os
import sys
# Always prefer setuptools over distutils
try:
from setupt... | gpl-3.0 | 2,636,920,363,843,867,600 | 34.710692 | 94 | 0.661853 | false |
Sravan2j/DIGITS | tools/test_create_db.py | 1 | 4429 | # Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
import os.path
import tempfile
import shutil
from cStringIO import StringIO
from nose.tools import raises, assert_raises
import mock
import unittest
import PIL.Image
import numpy as np
from . import create_db as _
class TestInit():
@classmetho... | bsd-3-clause | 7,553,932,435,437,362,000 | 29.972028 | 120 | 0.582298 | false |
arizona-phonological-imaging-lab/Autotrace | under-development/a3/roi.py | 2 | 5643 | #!/usr/bin/env python3
from __future__ import division
import numpy as np
import json
class ROI(object):
""" Region of Interest for a set of images
Attributes:
shape (tuple of numeric): the height and width of the ROI
offset (tuple of numeric): the lower bounds of the ROI
extent ... | mit | 4,787,143,582,170,665,000 | 34.049689 | 72 | 0.550771 | false |
dirmeier/dataframe | tests/test_cases.py | 1 | 2832 | # dataframe: a data-frame implementation using method piping
#
# Copyright (C) 2016 Simon Dirmeier
#
# This file is part of dataframe.
#
# dataframe 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 versi... | gpl-3.0 | -3,136,135,424,214,697,500 | 24.754545 | 77 | 0.647952 | false |
DavideCanton/Python3 | pyIAprove/labyrinth.py | 1 | 12404 | from math import sqrt
import numpy as np
from collections import defaultdict, namedtuple
from PIL import Image
DIRS = U, L, D, R, UL, UR, DL, DR = [(0, -1), (-1, 0), (0, 1), (1, 0), (-1, -1),
(1, -1), (-1, 1), (1, 1)]
def dist_2(p1, p2):
dx = p1[0] - p2[0]
dy = p1[1] - p2... | gpl-3.0 | -3,098,687,144,941,617,000 | 31.814815 | 80 | 0.484844 | false |
J4sp3r/damrobot | Project/lib/util.py | 1 | 1474 | #!/usr/local/bin/python
import cv2,os
import numpy as np
import matplotlib.pyplot as plt
from lib import log
def imshow(img):
cv2.namedWindow("preview")
cv2.imshow("preview",img)
rval = True
while rval:
key = cv2.waitKey(27)
if key == 27: # exit on ESC
break
cv2.destroyWindow("preview")
def imshow2(img):
... | mit | -8,841,574,868,602,686,000 | 24 | 235 | 0.656716 | false |
End of preview. Expand in Data Studio
- Downloads last month
- 12