text string |
|---|
<reponame>Vinicius-Tanigawa/Undergraduate-Research-Project<gh_stars>0
## @ingroup Methods-Aerodynamics-AVL
#create_avl_datastructure.py
#
# Created: Oct 2014, <NAME>
# Modified: Jan 2016, <NAME>
# Apr 2017, <NAME>
# Jul 2017, <NAME>
# Aug 2019, <NAME>
# Mar 2020, <NAME>
# ----... |
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
import keras
from keras.callbacks import Callback
from sklearn.metrics import confusion_matrix, classification_report
import os
from scipy import misc
class SPARCS_Callback(keras.callbacks.Callback):
def __init__(self, valid_datasets, vali... |
<gh_stars>0
#!/usr/bin/env python
"""
Generate a PSF using the Gibson and Lanni model.
Note: All distance units are microns.
This is slightly reworked version of the Python code provided by Kyle
Douglass, "Implementing a fast Gibson-Lanni PSF solver in Python".
http://kmdouglass.github.io/posts/implementing-a-fast-g... |
<reponame>meichenfang/velocyto.py
import numpy as np
from numpy import matlib
import scipy.optimize
from scipy import sparse
import logging
from typing import *
from sklearn.neighbors import NearestNeighbors
from .speedboosted import _colDeltaCor, _colDeltaCorLog10, _colDeltaCorSqrt
from .speedboosted import _colDeltaC... |
#!/usr/bin/python
from pylab import *
base = '/data/echelle/'
import numpy
import scipy
import time
import os
import math
import pyfits
import vels
from scipy import optimize
from scipy import interpolate
from scipy import integrate
import copy
from pylab import *
def n_Edlen(l):
"""
Refractive index accordin... |
<gh_stars>1-10
from functools import lru_cache
import numpy as np
from scipy.linalg import eigh_tridiagonal, eigvalsh_tridiagonal
from scipy.optimize import minimize
from waveforms.math.signal import complexPeaks
class Transmon():
def __init__(self, **kw):
self.Ec = 0.2
self.EJ = 20
self... |
<filename>cspy/classifier.py<gh_stars>1-10
import keras
import scipy.io as sio
from keras import Sequential
from keras.layers import Dense, Dropout
from keras.regularizers import l2
import CONFIG
__all__ = [
'classifier_model',
'build_classifier_model',
'conv_dict',
'load_weights',
]
def classifier_... |
<reponame>mas-veritas2/veritastool
import numpy as np
import sklearn.metrics as skm
from scipy import interpolate
import concurrent.futures
class ModelRateClassify:
"""
Class to compute the interpolated base rates for classification models.
"""
def __init__(self, y_true, y_prob, sample_weight = None):
... |
<reponame>arakcheev/python-data-plotter
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import AutoMinorLocator
from scipy import interpolate
from scipy import integrate
from scipy.interpolate import InterpolatedUnivariateSpline
asda = {'names': ('rho', 'x'),
'formats': ('f4', 'f4')}
... |
import numpy as np
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import KFold
from xgboost import XGBClassifier
def entropy_xgb(X, n_splits=5, verbose=True, compare=0, compare_method='grassberger', base2=True, eps=1e-8, gpu=False, **kwargs):
if gpu:
kwargs['tree_method'... |
<gh_stars>0
'''
Name: trait_extract_parallel.py
Version: 1.0
Summary: Extract plant shoot traits (larea, temp_index, max_width, max_height, avg_curv, color_cluster) by paralell processing
Author: <NAME>
Author-email: <EMAIL>
Created: 2018-05-29
USAGE:
time python3 demo_trait_extract_parallel.py -p ~/example... |
<filename>SIGVerse/planning/SpCoNavi_Astar_approx_expect.py
#coding:utf-8
###########################################################
# SpCoNavi: Spatial Concept-based Path-Planning Program for SIGVerse
# Path-Planning Program by A star algorithm (ver. approximate inference)
# Path Selection: expected log-likelihood p... |
from __future__ import print_function
import os
import time
import glob
import random
import math
import re
import sys
import cv2
import numpy as np
import scipy.io
import urllib
import matplotlib.pyplot as plt
from PIL import Image
from utils.sampling_utils import *
TAG_FLOAT = 202021.25
TAG_CHAR = 'PIEH'
def rea... |
<filename>Algorithms/tree_t(G)/Correctness/plotter.py
import numpy as np
import matplotlib.pyplot as plt
from scipy import interpolate
def loadFile(fileName):
totalList = []
correctList = []
with open(fileName) as file:
line = file.readline()
while line:
s = line.split(' ')
... |
<reponame>cty123/TriNet
# -*- coding:utf-8 -*-
"""
utils script
"""
import os
import cv2
import torch
import numpy as np
import matplotlib
#matplotlib.use("Qt4Agg")
import math
import matplotlib.pyplot as plt
from math import cos, sin
from mpl_toolkits.mplot3d.axes3d import Axes3D
#from rotation import Rotation as ... |
<filename>temp-uplift-submission/keras/ngram_keras.py
import sys
import time
import os
import string
import numpy as np
import tensorflow as tf
from tensorflow.keras.layers.experimental import preprocessing
from tensorflow.keras import layers
import scipy as sp
from scipy.sparse import csr_matrix
import pandas as pd
im... |
import numpy as np
from scipy.optimize import leastsq, curve_fit
import matplotlib.pyplot as plt
def lorentzian(p, x):
return p[0] + p[1] / ((x - p[2]) ** 2 + (0.5 * p[3]) ** 2)
def lorentzian2(p0, p1, p2, p3, x):
return p0 + p1 / ((x - p2) ** 2 + (0.5 * p3) ** 2)
def lorentzian_wavelength(width, central,... |
<reponame>mindThomas/acados<filename>examples/acados_python/getting_started/mhe/minimal_example_mhe.py
#
# Copyright 2019 <NAME>, <NAME>, <NAME>,
# <NAME>, <NAME>, <NAME>, <NAME>,
# <NAME>, <NAME>, <NAME>, <NAME>,
# <NAME>, <NAME>, <NAME>, <NAME>, <NAME>
#
# This file is part of acados.
#
# The 2-Clause BSD License
#
#... |
<reponame>xccheng/mars<gh_stars>1-10
# Copyright 1999-2020 Alibaba Group Holding Ltd.
#
# 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
#
# U... |
import math
import numpy as np
#import matplotlib.pyplot as plt
import scipy.interpolate as ip
from scipy.ndimage import gaussian_filter1d
from utils.helpers import crossings_nonzero_all, find_index, peakdet, replace_nan
from params import spring_params as def_spring_params
from utils.helpers import set_user_params
d... |
import unittest
from unittest import TestCase
from escnn.group import *
import numpy as np
from scipy import sparse
class TestGroups(TestCase):
def _test_SO3_CB_1(self):
# Test some of the properties of SO(3)'s GC coeffs
# WARNING: this test fails!
# it is likely this is because the... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import pandas as pd
import numpy as np
from sklearn import linear_model
from sklearn.neighbors import KNeighborsRegressor
from service.base import ServiceInterface
from service.tools import plot_service_model, plot_service_values
#%%
class WebDLServiceLinear(ServiceInte... |
"""
Copyright (C) 2018-2019 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 required by applicable law or agreed to i... |
<reponame>earnestt1234/FED3_Viz<filename>FED3_Viz/fed_inspect/fed_inspect.py
# -*- coding: utf-8 -*-
"""
Generates the text used when the "Plot Code" button is pressed
in FED3 Viz. Creates a runnable python script for recreating graphs.
@author: https://github.com/earnestt1234
"""
import inspect
from importlib import... |
<reponame>vinbigdata-medical/abdomen-phases
from os import replace
import pandas as pd
import numpy as np
from tqdm import tqdm
from multiprocessing import Pool
from sklearn.metrics import classification_report
import json
import scipy
from collections import Counter
# df = pd.read_csv('../eval_valid.csv')
df = pd.r... |
<reponame>seyuboglu/milieu<gh_stars>1-10
"""Run experiment"""
import logging
import os
import json
import datetime
from collections import defaultdict, Counter
from multiprocessing import Pool
import numpy as np
from scipy.stats import spearmanr, pearsonr, ttest_ind, ttest_rel
from scipy.sparse import csr_matrix
impor... |
# -*- coding: utf-8 -*-
# Copyright 2018, IBM.
#
# This source code is licensed under the Apache License, Version 2.0 found in
# the LICENSE.txt file in the root directory of this source tree.
import random
import unittest
import numpy
from scipy.stats import chi2_contingency
from qiskit import execute
from qiskit ... |
"""This module generates and does computation with molecular surfaces.
"""
from __future__ import division
from numbers import Number
from distutils.version import LooseVersion
import warnings
import oddt.toolkits
import numpy as np
from scipy.spatial import cKDTree
try:
from skimage.morphology import ball, bina... |
<gh_stars>0
#!/usr/bin/env python
# standard library
import os
import subprocess
import importlib
import random
from itertools import chain
# external libraries
import numpy as np
from sympy import lambdify, numbered_symbols, cse, symbols
from sympy.printing.ccode import CCodePrinter
try:
import theano
except Imp... |
from __future__ import unicode_literals, print_function
from sympy.external import import_module
import os
cin = import_module('clang.cindex', import_kwargs = {'fromlist': ['cindex']})
"""
This module contains all the necessary Classes and Function used to Parse C and
C++ code into SymPy expression
The module serves ... |
import argparse
import os
from scipy.misc import imsave
from image_class import image_class
def rename_images(input_folder, output_folder, starting_number):
for i, image_name in enumerate(os.listdir(input_folder), starting_number):
image_path = os.path.join(input_folder, image_name)
os.rename(imag... |
<filename>yc_curvebuilder.py
# Copyright © 2017 <NAME>, All rights reserved
# http://github.com/omartinsky/pybor
import collections
import re
import numpy
from collections import OrderedDict, defaultdict
from pandas import *
import scipy.optimize
import copy, os
from instruments.basisswap import BasisSwa... |
<filename>test/test_algorithms.py
from flucoma import fluid
from flucoma.utils import get_buffer
from scipy.io import wavfile
from pathlib import Path
import numpy as np
import os
test_file = Path(".") / "test" / "test_file.wav"
test_file = test_file.resolve()
test_buf = get_buffer(test_file)
# slicers
def test_trans... |
import numba
import numpy as np
from numba import jit
from scipy.optimize import minimize
from scipy.special import gammainc, gammaincc, gammaln as gamln
from scipy.stats import rv_continuous
from scipy.stats._discrete_distns import nbinom_gen
from scipy.stats._distn_infrastructure import argsreduce
class negbinom_ge... |
import time
import os
import random
import time
import argparse
import torch
import torch.nn.functional as F
import pyaudio
import librosa
import numpy as np
import webrtcvad
from scipy import spatial
from hparam import hparam as hp
from speech_embedder_net import SpeechEmbedder, GE2ELoss, get_centroids, get_cossim
... |
"""
Cloud Regime Error Metrics (CREM).
Author: <NAME> (Metoffice, UK)
Project: ESA-CMUG
Description
Calculates the Cloud Regime Error Metric (CREM) following Williams and
Webb (2009, Clim. Dyn.)
Required diag_script_info attributes (diagnostics specific)
none
Optional diag_script_info attribu... |
#!/usr/bin/env python
# Copyright 2014-2021 The PySCF Developers. 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
#
# U... |
# Though Python for Unity currently uses Python 2.7,
# We are ready for the coming of Python 3.x.
from __future__ import division, print_function
# This import fixes our sys.path if it's missing the package root.
# It also adds threading.get_ident if it's missing.
from unity_python.client import unity_client
import ... |
# -*- coding: utf-8 -*-
# -*- mode: python -*-
""" Python reference implementations of model code
CODE ORIGINALLY FROM
https://github.com/melizalab/mat-neuron/blob/master/mat_neuron/_pymodel.py
"""
from __future__ import division, print_function, absolute_import
import numpy as np
#from mat_neuron.core import impuls... |
<filename>build/lib/step/tracking.py
import copy
from math import sqrt
import numpy as np
from scipy.ndimage.measurements import center_of_mass
from scipy.spatial.distance import pdist, squareform
from skimage.segmentation import relabel_sequential
def track(labeled_maps: np.ndarray, precip_data: np.ndarray, tau: flo... |
<filename>_build/jupyter_execute/08_soccer.py
# Chapter 8
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
## Review
In [the previous notebook](https://colab.research.google.com/github/AllenDowney/BiteSizeBayes/blob/master/07_euro.ipynb), we used data from a coin-spinning experiment to estima... |
import fractions
import functools
def lcm(a, b):
return a * b // fractions.gcd(a, b)
N = int(input())
T = []
for i in range(N):
T.append(int(input()))
res = functools.reduce(lcm, T)
print(res)
|
# imports
import numpy as np
from scipy import stats
from statsmodels.stats.descriptivestats import sign_test
def run_sig_test(recommended_test, score, alpha, B, mu):
if isinstance(score,dict):
x = np.array(list(score.values()))
else:
x = score
test_stats_value = 0
pval = 0
# already i... |
import pandas as pd
import re
from scipy.sparse import csr_matrix
ratings = pd.read_csv("./data/ml-latest-small/ratings.csv")
movies = pd.read_csv("./data/ml-latest-small/movies.csv")
def get_ratings_matrix(ratings):
"""
This function returns a CSR matrix of the given dataframe
"""
R = csr_matrix((r... |
'''
------------------------------------------------------------------------
This script contains functions common to the SS and TP solutions for the
OG model with S-period lived agents, exogenous labor, and M industries and I goods.
get_p
get_p_tilde
get_c_tilde
get_c
get_C
get_K
get_L
... |
<reponame>timcast725/MVCNN_Pytorch
"""
Train VFL on ModelNet-10 dataset
"""
import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
from torch.utils.data import DataLoader
from torch.autograd import Variable
import torchvision.transforms as transforms
import argparse
import numpy as np
import time
im... |
from __future__ import division
from __future__ import print_function
import numpy as np
import pickle as pkl
import networkx as nx
import scipy.sparse as sp
import sys
from utils import parse_index_file, sample_mask
import math
from metrics import masked_accuracy_numpy
from Load_npz import load_npz_data_ood
def get_... |
<gh_stars>10-100
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Copyright (c) 2020, Sandflow Consulting LLC
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above c... |
from copy import deepcopy
import numpy as np
from scipy.linalg import norm
from sklearn.base import BaseEstimator
from sklearn.cluster import KMeans
from sklearn.linear_model import LogisticRegression
class Node:
def __init__(self, objects, labels, **kwargs):
self.objects = objects
self.labels =... |
<filename>py/desispec/qproc/qfiberflat.py
import time
import numpy as np
import scipy.ndimage
from desiutil.log import get_logger
from desispec.linalg import spline_fit
from desispec.qproc.qframe import QFrame
from desispec.fiberflat import FiberFlat
def qproc_apply_fiberflat(qframe,fiberflat,return_flat=False) :
... |
<reponame>CMRI-ProCan/CRANE<filename>crane/app.py
import os
import numpy as np
import pandas as pd
import scipy
import scipy.sparse
import datetime
import toffee
from tqdm import tqdm
from .srl import SpectralLibrary
from .denoiser import DenoiserBase
from .mass_ranges import MassRangeCalculatorBase
class App():
... |
# -*- coding: utf-8 -*-
"""
Created on Mon May 25 22:33:04 2020
@author: kkrao
"""
import pandas as pd
from init import dir_data, lc_dict, color_dict, dir_root, short_lc
import seaborn as sns
import os
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import mannwhitneyu
from sklearn.ensemble impor... |
<reponame>matteoterruzzi/aptl3<gh_stars>0
import warnings
import numpy as np
from scipy.linalg import orthogonal_procrustes
class OrthogonalProcrustesModel:
# NOTE: A lot of redundant asserts and checks
def pad(self, v):
dim = v.shape[1]
assert dim in [self.src_dim, self.dest_dim]
as... |
<reponame>alibabaquantumlab/qoc
"""
expm.py - a module for all things e^M
"""
from autograd.extend import (defvjp as autograd_defvjp,
primitive as autograd_primitive)
import autograd.numpy as anp
import numpy as np
import scipy.linalg as la
from numba import jit
### EXPM IMPLEMENTATION VI... |
'''
Use mitsuba renderer to obtain a depth and a reflectance image, given the
camera's rotation parameters and the file path of the object to be rendered.
'''
import numpy as np
import uuid
import os
import cv2
import subprocess
import shutil
from scipy.signal import medfilt2d
# import config
from pytorch.utils.utils ... |
import sympy
import numpy
import scipy
from ignition.dsl.riemann.language import *
q = Conserved('q')
p, u = q.fields(['p','u'])
rho = Constant('rho')
K = Constant('K')
f = [ K*u ,
p/rho]
A = sympy.Matrix(q.jacobian(f))
As = A.eigenvects
An = numpy.matrix([[0, 1.],[.5,0]], dtype=numpy.float32)
print A
print ... |
<filename>commons/process_mols.py
import math
import warnings
import pandas as pd
import dgl
import numpy as np
import scipy.spatial as spa
import torch
from Bio.PDB import get_surface, PDBParser, ShrakeRupley
from Bio.PDB.PDBExceptions import PDBConstructionWarning
from biopandas.pdb import PandasPdb
from rdkit impor... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ##################################################
# 適応法を用いた音の最小知覚移動角度の心理測定実験
#
# <NAME> (<EMAIL>)
# 2020
# ##################################################
import json
import re
import signal
import sys
import fire
import matplotlib.pyplot as plt
import numpy as np... |
<filename>hard-gists/6165747/snippet.py
"""
(C) August 2013, <NAME>
# License: BSD 3 clause
This is a Numba-based reimplementation of the block coordinate descent solver
(without line search) described in the paper:
Block Coordinate Descent Algorithms for Large-scale Sparse Multiclass
Classification. <NAME>,... |
<gh_stars>1-10
import OpenPNM
import scipy as sp
from os.path import join
class MatFileTest:
def setup_class(self):
fname = join(FIXTURE_DIR, 'example_network.mat')
self.net = OpenPNM.Network.MatFile(filename=fname)
|
import scipy.io as sio
import numpy as np
VAL = 'val'
UNITS = 'egu'
FIT = [
'Gaussian',
'Asymmetric',
'Super',
'RMS',
'RMS cut peak',
'RMS cut area',
'RMS floor'
]
STAT = 'status'
SCAN_TYPE = 'type'
NAME = 'name'
QUAD_NAME = 'quadName'
QUAD_VALS = 'quadVal'
USE = 'use'
TS = 'ts'
BEAM = 'b... |
<gh_stars>1-10
import os, pickle
from g5lib import domain
from datetime import datetime
import scipy as sp
path=os.environ['NOBACKUP']+'/verification/HadISST'
execfile(path+'/ctl.py')
ctl=Ctl()
dates=(datetime(1870,1,1),datetime(2008,12,1))
dom=domain.Domain(lons=(-180,180),lats=(90,-90),dates=dates)
var='sst'
sst=... |
# coding=utf-8
# Copyright 2019 The Google Research Authors.
#
# 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 applicab... |
<reponame>martengooz/github-scraper
import numpy
import json
import time
import datetime
from dateutil.relativedelta import *
import dateutil
import dateutil.parser
from scipy.stats.stats import pearsonr
import matplotlib.pyplot as plt
import scipy
from operator import truediv
with open('repos') as data_file:
data... |
"""
An example for the exptest variability test.
- Simulate constant rate events for several observations.
- Check that the ``mr`` distribution is a standard normal, as expected.
"""
import numpy as np
from scipy.stats import norm
import matplotlib.pyplot as plt
from astropy.table import Table
from gammapy.time import... |
from CoolProp.Plots.Plots import hs
import CoolProp
from CoolProp.CoolProp import Props
import matplotlib.pyplot as plt
import numpy as np
import scipy.optimize
import json
from build_DTU_JSON import RP2CAS
# CAS ; Name ; Tmin [K] ; Tmax [K] ; pmax [Pa]
limits_data = """7732-18-5;Water;273.16;1273;1000000000
811-97-2... |
from scipy.spatial.distance import cdist
import heapq
import numpy as np
import random
from hashlib import sha1
from itertools import zip_longest
def batch_unit_norm(b, epsilon=1e-8):
"""
Give all vectors unit norm along the last dimension
"""
return b / np.linalg.norm(b, axis=-1, keepdims=True) + eps... |
<filename>seqlearn/_utils/transmatrix.py
# Copyright 2013 <NAME> / University of Amsterdam
# encoding: utf-8
import numpy as np
from scipy.sparse import csr_matrix
from sklearn.externals import six
def make_trans_matrix(y, n_classes, dtype=np.float64):
"""Make a sparse transition matrix for y.
Takes a label... |
<filename>dsets/tfidf_stats.py<gh_stars>10-100
import torch
import numpy as np
import json
from sklearn.feature_extraction.text import TfidfVectorizer
from pathlib import Path
from itertools import chain
import scipy.sparse as sp
from dsets import AttributeSnippets
from util.globals import *
REMOTE_IDF_URL = f"{REMOT... |
<filename>finance/ml/train.py<gh_stars>1-10
import os
import sys
import yaml
import numpy as np
import pandas as pd
import yfinance as yf
import scipy
from sklearn import preprocessing
from sklearn.model_selection import train_test_split
import tensorflow_datasets as tfds
import tensorflow as tf
import time
BUFFER_SIZ... |
import numpy as np
import scipy.stats
import scipy.special
from .density import density
from .methods import get_func
def density_fit(xx, nbins, k, edge = None, sq = True, alpha = None):
#this function attempts to fit a density having a power law behavior to eigenvalues supplied by xx
# xx should be decreasi... |
<reponame>h2oai/doctr
# Copyright (C) 2021-2022, Mindee.
# This program is licensed under the Apache License version 2.
# See LICENSE or go to <https://www.apache.org/licenses/LICENSE-2.0.txt> for full license details.
from math import floor
from statistics import median_low
from typing import List
import cv2
import... |
import numpy as np
from scipy.ndimage import filters
import matplotlib.pyplot as plt
import iris.plot as iplt
from irise import convert, diagnostics
from irise.plot.util import legend
from myscripts.models.um import case_studies
from systematic_forecasts import second_analysis
forecast = case_studies.iop8.copy()
name... |
import datetime
from dateutil.relativedelta import *
from fuzzywuzzy import fuzz
import argparse
import glob
import numpy as np
import pandas as pd
from scipy.stats import ttest_1samp
import sys
import xarray as xr
from paths_bra import *
sys.path.append('./..')
from refuelplot import *
setup()
from utils import *
... |
<filename>src/clause_alignment.py<gh_stars>0
# coding=utf-8
from __future__ import print_function
from __future__ import division
import pulp
import numpy as np
import pickle
import os
import argparse
import codecs
import scipy.stats
parser = argparse.ArgumentParser()
parser.add_argument("--data_dir", type=str, defau... |
#!/usr/bin/env python
import argparse
import glob
import io
import os
import random
import numpy
from PIL import Image, ImageFont, ImageDraw
from scipy.ndimage.interpolation import map_coordinates
from scipy.ndimage.filters import gaussian_filter
SCRIPT_PATH = os.path.dirname(os.path.abspath(__file__))
# Default d... |
from functools import reduce
from typing import Tuple
import numpy as np
from numpy import dot, pi, exp, cos
from scipy.special import erfc
# TODO: use cython
def calc_ewald_sum(dielectric_tensor: np.ndarray,
real_lattice_set: np.ndarray,
reciprocal_lattice_set: np.ndarray,
... |
import helpfunctions as hlp
import numpy as np
import scipy.stats as stat
import scipy.special as spec
import nestedFAPF2 as nsmc
from optparse import OptionParser
parser = OptionParser()
parser.add_option("-d", type=int, help="State dimension")
parser.add_option("--tauPhi", type=float, help="Measurement precision")
p... |
<reponame>oustling/dicom_profile_fitting<filename>minimize/retic_xmm_1gauss/2minimize_6mv.py<gh_stars>1-10
#!\usr\bin\python
from numpy import array
from scipy.special import erf
from scipy.optimize import minimize
from math import pi, sin, cos, exp, sqrt
line_array = [] ## global
def read_line (file_name ):
w... |
<gh_stars>0
import numpy as np
from internal.data_structures import Weights
from internal.weighters.base import WeighterBase
from scipy.optimize import minimize
class LeastSquaresWeighter(WeighterBase):
def weight(self) -> Weights:
weights = Weights(self.priority_set)
initial_guess = [1.0 / len(w... |
#! /usr/bin/env python3
# coding: utf-8
import numpy as np
import pandas as pd
import scipy as sp
import scipy.fftpack
import scipy.signal
np.set_printoptions(formatter={'float': '{: 0.2f}'.format})
from keras.models import Sequential, model_from_json, load_model, Model
from keras.layers import Dense, Activation, Dro... |
#!/usr/bin/env python
# Copyright (c) 2013. <NAME> <<EMAIL>>
#
# This work is licensed under the terms of the Apache Software License, Version 2.0. See the file LICENSE for details.
import ming
import logging as log
import argparse
import madsenlab.axelrod.analysis as maa
import madsenlab.axelrod.data as data
impo... |
<reponame>milankl/misc<filename>gyres_scripts/gyres_variance.py
## VARIANCE OF HIGH VS LOW
import numpy as np
import matplotlib.pyplot as plt
exec(open('python/ecco2/colormap.py').read())
import scipy.stats as stats
## load data
thi = np.load('python/gyres/temp_highres_sfc.npy')
tlo = np.load('python/gyres/temp_lowr... |
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 30 14:18:05 2021
@author: Administrator
"""
import numpy as np
import time
import torch
from scipy.stats import norm
class Simulator:
@staticmethod
def simulate_pseudo(spot, r, q, sigma, dt, num_paths, time_steps):
np.random.seed(1234)
half_path... |
<filename>experiments/PMI/pmi-solver.py<gh_stars>1-10
#!/usr/bin/python3
import nltk
import os, argparse, json, re, math, statistics, sys
from pmi import *
from multiprocessing import Pool
def load_stopwords():
sw = []
sw_file = ""
if os.path.isfile('../stopwords-pt.txt'):
sw_file = '../stopwords... |
#!/usr/bin/env python3
import numpy as np
import scipy.stats as st
from arpym.statistics.simulate_t import simulate_t
def simulate_markov_chain_multiv(x_tnow, p, m_, *, rho2=None, nu=None, j_=1000):
"""For details, see here.
Parameters
----------
x_tnow : array, shape(d_, )
p : array, s... |
# coding: utf-8
# In[1]:
import absorberspec, ebossspec, sdssspec, datapath, fitsio, starburstspec
import cookb_signalsmooth as cbs
from scipy.stats import nanmean, nanmedian
import cosmology as cosmo
masterwave, allflux, allivar = ebossspec.rest_allspec_readin()
objs_ori = ebossspec.elg_readin()
nobj = objs_ori.siz... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Utilities for reading or working with Camera geometry files
"""
import logging
import numpy as np
from astropy import units as u
from astropy.coordinates import Angle, SkyCoord
from astropy.table import Table
from astropy.utils import lazyproperty
fro... |
<gh_stars>10-100
# -*- coding: utf-8 -*-
"""FAQ Module."""
import os
import yaml
from yaml import Loader
from sklearn.feature_extraction.text import TfidfVectorizer
from scipy.spatial.distance import cosine
from ..common.component import Component
def tokenizer(x):
"""Tokenize sentence."""
return list(x)
c... |
import numpy as np
from scipy.ndimage import convolve
def loaddata(path):
""" Load bayerdata from file
Args:
Path of the .npy file
Returns:
Bayer data as numpy array (H,W)
"""
#
# You code here
#
data = np.load(path)
# print(np.shape(data))
# print(data)
r... |
<gh_stars>0
# test_matrices_like_
import matrices_new_extended as mne
import numpy as np
import sympy as sp
from equality_check import Point
x, y, z = sp.symbols("x y z")
Point.base_point = np.array([x, y, z, 1])
class Test_Mirror_xymx:
def test_matrix_m_xymx(self):
expected = Point([ -z, y, -x, 1])
... |
<gh_stars>0
import numpy as np
from scipy.misc import imresize
from moviepy.editor import VideoFileClip
from IPython.display import HTML
from keras.models import load_model
import tensorflow as tf
from cv2 import cv2
import time
from lane_detection import Lanes, predict_lane
lanes = Lanes()
|
<reponame>jameschapman19/cca_zoo<gh_stars>10-100
import numpy as np
import scipy.linalg
import tensorly as tl
import torch
from tensorly.cp_tensor import cp_to_tensor
from tensorly.decomposition import parafac
from torch.autograd import Function
class MatrixSquareRoot(Function):
"""Square root of a positive defin... |
<filename>Models/Reactors/MechanisticMods_RxtrV2.py
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 18 21:55:13 2020
@author: leonardo
"""
import sys;
sys.path.insert(1,r'C:\Users\leonardo\OneDrive - UW-Madison\Research\bayesianopt\Scripts')
from numpy import exp, arange, random, array, vstack, argmax, delete... |
import sys
import os.path
# sys.path.insert(0, os.path.abspath("./simple-dnn"))
import tensorflow as tf
import numpy as np
import tensorflow.contrib.slim as slim
import scipy.misc
import time
class BaseGAN(object):
""" Base class for Generative Adversarial Network implementation.
"""
def __init__(self,
... |
from sympy import *
x, y, z = symbols('x y z')
init_printing(use_unicode=True)
#print simplify(sin(x)**2 + cos(x)**2)
#print simplify((x**3 + x**2 - x - 1)/(x**2 + 2*x + 1))
#print simplify(gamma(x)/gamma(x - 2))
print simplify((x + 1)**2)
print expand((x + 1)**2)
|
# -*- coding: utf-8 -*-
"""Quora Question Pairs.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1XzHONVcBJlYC-7QKf6cQ3DE4fqbMvg7_
#Import Dependencies and Data
***Mount Google Drive***
"""
from google.colab import drive
drive.mount('/content/dr... |
<reponame>baidu/Quanlse<gh_stars>10-100
#!/usr/bin/python3
# -*- coding: utf8 -*-
# Copyright (c) 2021 Baidu, Inc. 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
#
# ... |
import numpy as np
import itertools
import numpy as np
import scipy.misc as sc
import cPickle as pickle
import itertools
from itertools import combinations
import sys
import os
import timeit
from hand_scoring import get_hand_type, payout
"""
1) Enumerate all the possibilties.
2) Save these data structures to disc.... |
<reponame>dugu9sword/certified-word-sub
import argparse
from scipy import stats
import sys
OPTS = None
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('scores_1')
parser.add_argument('scores_2')
if len(sys.argv) == 1:
parser.print_help()
sys.exit(1)
return parser.parse_args(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.