text
string
# Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. """ Classes for reading/manipulating/writing VASP ouput files. """ import datetime import glob import itertools import json import logging import math import os import re import warnings import xml.etree.ElementTree as ET fro...
<filename>sympy/core/tests/test_power.py from sympy.core import ( Basic, Rational, Symbol, S, Float, Integer, Mul, Number, Pow, Expr, I, nan, pi, symbols, oo, zoo, N) from sympy.core.tests.test_evalf import NS from sympy.core.function import expand_multinomial from sympy.functions.elementary.miscellaneous impor...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri, 25 May 2018 20:29:09 @author: luohao """ """ CVPR2017 paper:<NAME>, <NAME>, <NAME>, et al. Re-ranking Person Re-identification with k-reciprocal Encoding[J]. 2017. url:http://openaccess.thecvf.com/content_cvpr_2017/papers/Zhong_Re-Ranking_Person_Re-Id...
# -*- coding: utf-8 -*- # Owner(s): ["module: linear algebra"] import torch import numpy as np import unittest import itertools import warnings import math from math import inf, nan, isnan import random from random import randrange from itertools import product from functools import reduce, partial, wraps from torch...
"""Rank genes according to differential expression. """ import numpy as np import pandas as pd from math import sqrt, floor from scipy.sparse import issparse from .. import utils from .. import settings from .. import logging as logg from ..preprocessing._simple import _get_mean_var def rank_genes_groups( a...
import emcee import logging import numpy as np from scipy import optimize from robo.models.base_model import BaseModel from robo.priors.bayesian_linear_regression_prior import BayesianLinearRegressionPrior def linear_basis_func(x): return np.append(x, np.ones([x.shape[0], 1]), axis=1) def quadratic_basis_func...
"""Module for indexing many-body states using Lin tables.""" import itertools import numpy as np try: from scipy.special import factorial except ImportError: # For backwards compatibility with older versions of SciPy from scipy.misc import factorial from .wrappers.mytypes import boolnp from .wrappers.myt...
import pandas as pd import numpy as np from scipy import stats from sklearn.linear_model import LinearRegression import pickle dat = pd.read_csv('Linear_Reg_Dat.csv') dat.dropna(subset = ['Salary'], axis=0, inplace=True) z = np.abs(stats.zscore(dat)) dat = dat[(z < 3).all(axis=1)] x = dat[['YearsExperi...
''' problems/healthy_skin_fixed_pads/runner.py Problem ------- Healthy skin extension Boundary conditions: -------------------- right pad: fixed displacements left pad: fixed displacements Maybe should start with some prestress because at zero displacement, the force is not zero ''' from dolfin import * import dol...
from copy import copy from sympy.tensor.array.dense_ndim_array import ImmutableDenseNDimArray from sympy import Symbol, Rational, SparseMatrix, Dict, diff, symbols, Indexed, IndexedBase, S from sympy.core.compatibility import long from sympy.matrices import Matrix from sympy.tensor.array.sparse_ndim_array import Immut...
import logging log = logging.getLogger(__name__) from fractions import math from math import gcd import numpy as np import pandas as pd from scipy import signal def as_numeric(x): if not isinstance(x, (np.ndarray, pd.DataFrame, pd.Series)): x = np.asanyarray(x) return x def db(target, reference=1)...
<reponame>anjohan/dscribe<gh_stars>1-10 # -*- coding: utf-8 -*- """Copyright 2019 DScribe 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 http://www.apache.org/licenses/LICENSE-2.0 ...
#!/usr/bin/env python3 import os import cv2 import torch import os.path import numpy as np import torchvision.transforms as transforms from PIL import Image from common import Config import pickle as pkl from utils.basic_utils import Basic_Utils import scipy.io as scio import scipy.misc try: from neupeak.utils.webc...
<gh_stars>10-100 ######################################################################################## # <NAME>, 2017 # # Optic disc in a retina image detection in TensorFlow # #####################################...
<filename>deep_rl/agent/PCPG2_agent.py # PCPG2 Agent from ..network import * from ..component import * from .BaseAgent import * import math, random, pdb, copy, sys import numpy as np from gym.spaces.discrete import Discrete from gym.spaces.box import Box from torch.utils.data import DataLoader, TensorDataset import...
<filename>kernelmethods/operations.py # -*- coding: utf-8 -*- """ This module implements the common kernel operations such as - normalization of a kernel matrix (KM), - centering (one- and two-sample cases), - evaluating similarity, computing alignment, - frobenius norms, - linear combinations and - checking wh...
import cPickle from scipy import signal import librosa import adaptfilt from sys import argv with open("netFile.pkl", "rb") as arch: net = cPickle.load(arch) y,sr = librosa.load(argv[1], duration=10.0) w = y for i in xrange(int(argv[2])): r, s, n = net.activate(w) r = abs(int(round(r))) s = abs(int(...
import numpy as np import subprocess import sys TEST_BODY = r""" import pytest import numpy as np from numpy.testing import assert_allclose import scipy import sys import pytest if hasattr(scipy, 'fft'): raise AssertionError("scipy.fft should require an explicit import") np.random.seed(1234) x = np.random.randn(...
<filename>lsml/data/dim2/hamburger.py import logging import numpy as np from scipy.stats import beta from scipy.ndimage import gaussian_filter logger = logging.getLogger(__name__) def make(n=101, r=25, ishift=0, jshift=0, sigma_noise=0.1, sigma_smooth=2, cut_b=0, cut_theta=0, cut_thickness=5, rs...
import cStringIO, sys, csv, copy, ImageDraw, Image, ImageClass from FindCenter import findCenter, showIm, getBiImList, getEllipse, getView from PyQt4 import QtGui from myFunc import detect_peaks, pil16pil8, a16a8, getStrVal from myMath import fitLine, fitCirc from myFigure import myFigure from scipy import ndimage, opt...
#from collections.abc import Sequence #import itertools import numpy as np import types #import xarray #from pleque.utils.decorators import deprecated class FluxFunctions: # def interpolate(self, coords, data) # def interpolate(self, R, Z, data): # pass def __init__(self, equi): # _flux...
<reponame>wanxinjin/Safe-PDP<filename>Examples/SPlan/SPlan_Rocket.py<gh_stars>10-100 import numpy as np from SafePDP import SafePDP from SafePDP import PDP from JinEnv import JinEnv from casadi import * import scipy.io as sio import matplotlib.pyplot as plt import time import random # --------------------------- load...
<reponame>barentsen/photutils # Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module implements classes, called Finders, for detecting stars in an astronomical image. The convention is that all Finders are subclasses of an abstract class called ``StarFinderBase``. Each Finder class should defi...
<reponame>nilax97/col774<filename>assignment4/src/svm.py import os import scipy.io import json import cv2 import numpy as np import pickle from sklearn.decomposition import PCA from sklearn.model_selection import train_test_split from sklearn.svm import SVC, LinearSVC from sklearn.metrics import classification_report, ...
<reponame>keithfma/somerville-slope<filename>somerville_slope.py """ Somerville MA LiDAR Slope Analysis This (importable) module contains all subroutines used """ # TODO: too many spurious results -- try a morphological filter on the gridded # elev / slope results to handle ugly edges of house footprints -- try # ...
<gh_stars>100-1000 import glob import os import cv2 import numpy as np import scipy.io as sio from tqdm import tqdm from mmhuman3d.core.conventions.keypoints_mapping import convert_kps from mmhuman3d.data.data_structures.human_data import HumanData from .base_converter import BaseConverter from .builder import DATA_C...
<reponame>BSchilperoort/python-dts-calibration # coding=utf-8 import os import numpy as np import scipy.sparse as sp from scipy import stats from dtscalibration import DataStore from dtscalibration import read_xml_dir from dtscalibration.calibrate_utils import wls_sparse from dtscalibration.calibrate_utils import wls...
""" Tests for :func:`nilearn.plotting.plot_connectome` and deprecated :func:`nilearn.plotting.plot_connectome_strength`. """ import os import pytest import numpy as np import matplotlib.pyplot as plt from scipy import sparse from matplotlib.patches import FancyArrow from nilearn.plotting import plot_connectome, plot_c...
import numpy as np from scipy.optimize import fsolve from astropy.utils import isiterable def stellarmass_from_halomass(log_Mhalo, z=0): """ Stellar mass from Halo Mass from Moster+2013 https://doi.org/10.1093/mnras/sts261 Args: log_Mhalo (float): log_10 halo mass in solar mass units....
#!/usr/bin/env python import math import numpy as np import signal import scipy.ndimage as ndimage import pdb """ This file contains scripts to filter ALOS data. """ def enhanced_lee_filter(img, window_size = 5, n_looks = 16): ''' Filters a masked array with the enhanced lee filter. Based on formulatio...
<filename>2018/d23.py #!/usr/bin/env python3 import sys import re import itertools import z3 from scipy.spatial import distance from pprint import pprint INPUTS = ['d23-input.txt', 'd23-input-example1.txt', 'd23-input-example2.txt'] DEBUG = False INPUT = INPUTS[2] if DEBUG else INPUTS[0] input_re = re.compile(r'pos=<...
import os import sys import yaml import numpy as np import matplotlib.pyplot as plt import scipy.linalg as scli from mpl_toolkits.mplot3d import Axes3D import seaborn as sns import pandas as pd from rdkit import Chem kcal_to_eV=0.0433641153 kB=8.6173303e-5 #eV/K T=298.15 kBT=kB*T def readXYZ(filename): infile=ope...
<filename>compute_distances.py<gh_stars>0 import scipy as sp import sys import os, glob import os.path as path import scipy.spatial.distance as spd from scipy.io import loadmat, savemat import json import torch import numpy as np import argparse def compute_channel_distances(mean_vector, features): mean_vector ...
# Figure 3, panels (c) and (d) import sys sys.path.append("../../") device_str, lang, _dpi = sys.argv[1], sys.argv[2], int(sys.argv[3]) ########################################################### from pathlib import Path reproduced_results = Path("reproduced-results") from sympy import exp as sp_exp from sympy imp...
<filename>caserec/recommenders/rating_prediction/base_rating_prediction.py # coding=utf-8 """" This class is base for rating prediction algorithms. """ # © 2018. Case Recommender (MIT License) from scipy.spatial.distance import squareform, pdist import numpy as np from caserec.evaluation.rating_prediction impo...
import os import tarfile import zipfile from os import path from sacred import Experiment from scipy.io import loadmat from torchvision.datasets.utils import download_url ex1 = Experiment('Prepare CUB') @ex1.config def config(): cub_dir = path.join('data', 'CUB_200_2011') cub_url = 'http://www.vision.caltec...
import argparse import tensorflow as tf from tensorflow.keras.layers import * from tensorflow.keras.models import Model, load_model from tensorflow.keras.optimizers import Adam from tensorflow.keras.losses import BinaryCrossentropy from tqdm import tqdm import numpy as np import robots_core from robots_core.train i...
"""Bayesian Gaussian Mixture Models and Dirichlet Process Gaussian Mixture Models""" from __future__ import print_function # Author: <NAME> (<EMAIL>) # <NAME> <<EMAIL>> # # Based on mixture.py by: # <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # # Important note for the deprecation cleaning of 0.20 : #...
<gh_stars>1-10 import compiler import parser from compiler.transformer import Transformer from compiler.ast import CallFunc, Name, Const from compiler.pycodegen import ExpressionCodeGenerator import re #this is python stdlib symbol, not SymPy symbol: import symbol from sympy.core.basic import Basic from sympy.core.sy...
<gh_stars>0 ########################################################################################################## # # # This code "ODE model simulation" is written by <NAME> for "a model of lysosomal acidificatio...
<filename>data/reactor_anu_spectra/Mueller/offeq/mueller_offequilibrium.py #!/usr/bin/env python import numpy as N from matplotlib import pyplot as P from collections import OrderedDict from scipy.interpolate import interp1d energy = N.concatenate([[1.8], N.linspace( 2., 4.5, 6 )]) """First and last poinst are added ...
import argparse import string import os import time from multiprocessing import Pool from itertools import repeat from scipy.stats import bernoulli import pandas as pd import numpy as np import sys from tqdm import tqdm np.random.seed(0) def parse_args(): parser = argparse.ArgumentParser(description='Reverse subs...
import anndata import scipy.sparse import numpy as np from sklearn.decomposition import TruncatedSVD from sklearn.neighbors import NearestNeighbors # VIASH START par = { "input_mod1": "../../../../resources_test/common/pbmc_1k_protein_v3.censored_rna.h5ad", "input_mod2": "../../../../resources_test/common/pbm...
#!/usr/bin/env python from fractions import Fraction as F notes = "C C# D D# E F F# G G# A A# B".split() pythagoras = [F(1,1), F(2187,2048), F(9,8), F(32,27), F(81,64), F(4,3), F(729,512), F(3,2), F(6561,4096), F(27,16), F(16,9), F(243,128)] just_intonation = [F(1,1), F(16,15), F(9,8), F(6,5), F(5,4)...
from typing import Union, List, Tuple, Sequence, Dict, Any, Optional, Collection from copy import copy from pathlib import Path import pickle as pkl import logging import random import lmdb import numpy as np import torch import torch.nn.functional as F from torch.utils.data import Dataset from scipy.spatial.distance ...
#!/usr/bin/env ipython # # untitled.py # # Copyright (c) 2020 <NAME> # # This program is free software; you can redistribute it and/or modify # it under the terms of the MIT License. # # See accompanying LICENSE.md or https://opensource.org/licenses/MIT. # import sys import atexit import logging import numpy as np f...
# # Compare masks produced by BBs, axis-aligned ellipses and full ellipses # with the GT maks. Also explores OBBs from segmentation masks # # IMPORTANT: ignores segmentation masks that formed by mopre than one connected component # # import cv2, os, pickle import numpy as np from numpy import sqrt import matplotli...
<gh_stars>0 # Tests of the quasiisothermaldf module from __future__ import print_function, division import numpy #fiducial setup uses these from galpy.potential import MWPotential, vcirc, omegac, epifreq, verticalfreq from galpy.actionAngle import actionAngleAdiabatic, actionAngleStaeckel from galpy.df import quasiisot...
from datetime import datetime import numpy as np import pandas as pd from scipy.stats import pearsonr from scipy.stats import zscore import matplotlib.pyplot as pyplot def drawHist(x): #创建散点图 #第一个参数为点的横坐标 #第二个参数为点的纵坐标 pyplot.hist(x, 100) pyplot.xlabel('x') pyplot.ylabel('y') pyplot.title('...
import numpy as np from scipy import ndimage as nd from scipy.interpolate import interp1d from astropy import units as u from astropy.io import fits from starkit.gridkit.io.process import BaseProcessGrid from starkit.gridkit.util import convolve_to_resolution class PhoenixProcessGrid(BaseProcessGrid): uv_wave...
"""Tests for dense recursive polynomials' basic tools. """ from sympy.polys.densebasic import ( dup_LC, dmp_LC, dup_TC, dmp_TC, dmp_ground_LC, dmp_ground_TC, dmp_true_LT, dup_degree, dmp_degree, dmp_degree_in, dmp_degree_list, dup_strip, dmp_strip, dmp_validate, ...
<reponame>viathor/OpenFermion-Cirq # 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 t...
# -*- coding: utf-8 -*- """ Created on Sun Sep 11 19:29:11 2016 @author: DIP """ from normalization import normalize_corpus from utils import build_feature_matrix import numpy as np toy_corpus = ['The sky is blue', 'The sky is blue and beautiful', 'Look at the bright blue sky!', 'Python is a great Programming lang...
<filename>process/util.py import os import numpy as np from scipy.io import loadmat, savemat import neurokit2 as nk import matplotlib.pyplot as plt # Find Challenge files. def load_label_files(label_directory): label_files = list() for f in sorted(os.listdir(label_directory)): F = os.path.join(label_di...
# Script to perform decoding analyses on the trained layer activations and the recurrent flow # Requires tensorflow 1.13, python 3.7, scikit-learn, and pytorch 1.6.0 ############################# IMPORTING MODULES ################################## import torch import torch.nn as nn import torch.nn.functional as F im...
<filename>mne/viz/_3d.py<gh_stars>0 """Functions to make 3D plots with M/EEG data """ from __future__ import print_function # Authors: <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # # License: Simplified BSD from ..externals.six impor...
""" The util module provides a collection of general purpose methods. """ from . import numeric import sys import os import numpy import collections.abc import inspect import functools import operator import numbers import pathlib import ctypes import io import contextlib supports_outdirfd = os.open in os.supports_di...
<filename>model/needs.py """ Things to do with the needs of consumers for products """ import numpy as np from scipy.stats import beta from .beta_distr import get_beta_params from .utility import multinomial def discretize_a_composite_beta(modes, vars, n_bins=500): """ Computes the weight of a composite bet...
import numpy as np import scipy import math class frame: def __init__(self, R, t): self.R = R self.t = t r_t = np.concatenate((R, t), 1) bot = np.array([0, 0, 0, 1]) self.F = np.concatenate((r_t, bot)) def get_R(self): return self.R def get_t(self): r...
<gh_stars>10-100 from __future__ import print_function, division import os import torch import pandas as pd from skimage import io, transform import numpy as np import matplotlib.pyplot as plt from torch.utils.data import Dataset, DataLoader, TensorDataset from torchvision import transforms, utils import torch.nn as nn...
#!/usr/bin/env python """ This module implements more advanced transformations. """ from __future__ import division __author__ = "<NAME>, <NAME>" __copyright__ = "Copyright 2012, The Materials Project" __version__ = "1.0" __maintainer__ = "<NAME>" __email__ = "<EMAIL>" __date__ = "Jul 24, 2012" import numpy as np f...
<reponame>KristapsE/DP4-AI<gh_stars>10-100 import numpy as np import qml from qml.fchl import get_atomic_kernels from scipy.stats import gaussian_kde as kde import pickle from scipy.stats import gmean from pathlib import Path from scipy import stats import os import pathos.multiprocessing as mp import copy import gzip ...
"""Utils to check the samplers and compatibility with scikit-learn """ # Adapted from imbalanced-learn # Adapated from scikit-learn # Authors: <NAME> <<EMAIL>> # License: MIT import sys import traceback import warnings from collections import Counter from functools import partial import pytest import numpy as np f...
import os import numpy as np from astropy.cosmology import FlatLambdaCDM from lenstronomy.Cosmo.lens_cosmo import LensCosmo from hierarc.Sampling.mcmc_sampling import MCMCSampler import corner import matplotlib.pyplot as plt from scipy.stats import norm, median_abs_deviation __all__ = ["reorder_to_tdlmc", "pred_to_nat...
<gh_stars>0 from scipy.spatial import cKDTree import pandas as pd import torch import numpy as np def nearest_neighbours(data, query_data, k): kdtree = cKDTree(data) return (kdtree.query(query_data, k)[1]).T def load_meta_data(textfile): meta_data = pd.read_csv(textfile, header=0) return meta_data.values.tol...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import mxnet as mx from scipy.signal import savgol_filter import pandas as pd import numpy as np def add_nan_trajectories(trajectories, max_frame): """Add np.nan to frame where the x,y coordinates are mis...
<reponame>joelphillips/pypyramid ''' Created on Oct 25, 2010 @author: joel ''' import pypyr.functions as pf import pypyr.utils as pu import scipy.linalg as sl import math import pylab import matplotlib.pyplot as mp #import enthought.mayavi.mlab as emm import numpy as np def poisson(N, points): ''' Solves lap u ...
from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.feature_extraction.text import TfidfTransformer from sklearn.feature_extraction.text import CountVectorizer from nltk.corpus import stopwords from scipy import spatial import re import random import operator import itertools import numpy as np i...
from scipy.io import loadmat as loadmat import os import subprocess import pandas as pd import numpy as np class RAW(): """Creates a pandas dataframe out fo eyetrace data This DF contains feature1, feature2, xmotion, ymotion, and timesecs """ def __init__(self, data_dir, dt_chopout=0): files =...
<gh_stars>0 # Copyright 2019 Xanadu Quantum Technologies 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...
from __future__ import division from scipy.optimize import minimize_scalar import numpy as np def vbmf(Y, cacb=1024, sigma2=None, H=None): """Implementation of the analytical solution to Variational Bayes Matrix Factorization. This function can be used to calculate the analytical solution to VBMF. This ...
<reponame>RoshanRane/ML_for_IMAGEN ################################################################################# #!/usr/bin/env python # coding: utf-8 """ IMAGEN Post hoc analysis Helper in all Session """ # Author: <NAME>, <<EMAIL>> # : <NAME>, <<EMAIL>> # Last modified: 17th January 2022 import os, sys, ins...
<gh_stars>0 # ------------------------------------------------------------- # Authors: <NAME> (10784012) # <NAME> (10542590) # Date: 11 April 2016 # File: naive_bayes.py # ------------------------------------------------------------- import numpy as np import scipy.stats as sp import matplotlib.pyplot as...
<filename>downstream/voxceleb2_ge2e/utils.py import numpy as np import pickle from scipy.optimize import brentq from scipy.interpolate import interp1d from sklearn.metrics import roc_curve ,auc import IPython import pdb from itertools import accumulate from functools import partial def EER(labels, scores): """ ...
<reponame>srio/paper-transfocators-resources import numpy from srxraylib.plot.gol import plot import matplotlib.pylab as plt beam_dimension_at_slit_in_um = 565 # needed for calculating Fresnel number LENS_RADII_IN_MICRONS = [100, 500, 1000] LENS_RADII_IN_MICRONS = [400, 200, 100, 50, 25] for j in range(len(LE...
import sys from random import random, randint from scipy.linalg import eigh_tridiagonal UPPER = 100 def generate_symmetric_matrix(size: int) -> list: main_diag = [random()*UPPER for elem in range(size)] sym_diag = [random() for elem in range(size-1)] return (main_diag, sym_diag) if __name__ == "__main_...
<filename>dataset.py import pandas as pd import matplotlib.pyplot as plt from datetime import datetime from matplotlib.figure import Figure from region import Region import numpy as np from scipy.signal import savgol_filter from state import State from datetime import datetime, timedelta import sys def datePadding(...
<gh_stars>0 import logging import pprint import os import sys import math import torch import time import random from sklearn.metrics import average_precision_score, roc_auc_score from scipy.sparse import coo_matrix import numpy as np import utils import joblib # import Parallel, delayed from torch.utils.tensorboard i...
<filename>fractopo_subsampling/plotting_utils.py """ Plotting utilities. """ import warnings from itertools import count from textwrap import wrap from typing import Dict, Generator, Sequence, Tuple, Union import geopandas as gpd import matplotlib.pyplot as plt import numpy as np import pandas as pd import scipy.stats...
<gh_stars>1-10 import logging import os import re from typing import Any, Dict, List, Optional, Text, Type, Tuple import numpy as np import scipy.sparse import rasa.shared.utils.io import rasa.utils.io import rasa.nlu.utils.pattern_utils as pattern_utils from rasa.nlu import utils from rasa.nlu.components import Comp...
New Algorithms for Simulating Dynamical Friction <NAME>, <NAME>, <NAME> — RadiaSoft, LLC This notebook describes—and documents in code—algorithms for simulating the dynamical friction experienced by ions in the presence of magnetized electrons. The $\LaTeX$ preamble is here. $$ %% math text \newcommand{\hmhsp}{\mspa...
import scipy.io as sio import numpy as np from feedforward_backprop import feedforward_backprop digit_data = sio.loadmat('digit_data.mat') X = digit_data['X'] y = digit_data['y'] _, num_cases = X.shape train_num_cases = num_cases * 4 // 5 X = X.reshape((400, num_cases)) X = X.reshape((num_cases, 400)) # X has the shape...
<gh_stars>0 """Core of arithgen.""" import math import random from fractions import Fraction from arithgen import ntheory from arithgen.expr import ( Integer, Addition, Subtraction, Multiplication, Division, ) def weighted_choice(choices): """Return a weighted random element from a non-empty...
<gh_stars>1-10 #!/usr/bin/env python # Written by <NAME> # See readme.pdf for documentation # Or go to http://www.isi.edu/~gregv/npeet.html import scipy.spatial as ss from scipy.special import digamma from math import log import numpy.random as nr import numpy as np import random # CONTINUOUS ESTIMATORS def entrop...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from backpack import extensions import torch import torch.nn as nn import torch.nn.functional as F import torch.autograd as autograd from torch.autograd import Variable import random from statistics import mean import math import copy import numpy...
<filename>experiments/notebooks/augment_3d.py # --- # jupyter: # jupytext: # formats: ipynb,py # text_representation: # extension: .py # format_name: light # format_version: '1.4' # jupytext_version: 1.2.4 # kernelspec: # display_name: Python 3 # language: python # name: ...
from __future__ import absolute_import from perses.dispersed import feptasks from perses.utils.openeye import * from perses.utils.data import load_smi from perses.annihilation.relative import HybridTopologyFactory from perses.annihilation.lambda_protocol import RelativeAlchemicalState, LambdaProtocol from perses.rjmc....
#coding=utf-8 import pandas as pd import numpy as np import sys import os from sklearn import preprocessing import datetime import scipy as sc from sklearn.preprocessing import MinMaxScaler,StandardScaler from sklearn.externals import joblib #import joblib class FEbase(object): """description of class""" def ...
<filename>src/libs_v0/bddc.py import numpy as np import math import scipy.sparse.linalg from scipy.sparse import csr_matrix as csr from scipy.sparse import bmat # Class containing all the data that should be distributed per proc class fineProc(): def __init__(self): self.nI = 0 # Number of interi...
<gh_stars>1-10 """ Contains the function 'iterative_tikhonov' and the accompanying class. """ import numpy as np import scipy.linalg as scilin from inversion.solver import ClassicSolver def iterative_tikhonov(fwd, y, x0, c0_root, delta, options): """ Implements the iterative Tikhonov method, which Tikhonov ...
<reponame>gyulka/bashair<filename>db/influx.py from pprint import pprint from statistics import mean from influxdb_client import InfluxDBClient, BucketRetentionRules from config import settings client = InfluxDBClient( url=settings.INFLUXDB_V2_URL, org=settings.INFLUXDB_V2_ORG, token=settings.INFLUXDB_V2...
<gh_stars>1-10 import pandas as pd import numpy as np from scipy import stats, linalg from statsmodels.stats import multitest def calculate_median_absolute(x): """Calculate Absolute median""" return (x - x.median()).abs().median() def fdr(x, alpha=0.05, method='fdr_bh'): ''' Apply FDR correction to...
import numpy as np from scipy import interpolate def fate_parfor(plist,fate_fname_base,time_interp): radius = np.zeros((len(time_interp),len(plist))) theta = np.zeros((len(time_interp),len(plist))) v_rad = np.zeros((len(time_interp),len(plist))) v_theta = np.zeros((len(time_interp...
# coding=utf-8 """Implement Part Affinity Fields :param centerA: int with shape (2,), centerA will pointed by centerB. :param centerB: int with shape (2,), centerB will point to centerA. :param accumulate_vec_map: one channel of paf. :param count: store how many pafs overlaped in one coordinate of accumulate_vec_map. :...
<gh_stars>10-100 # Copyright 2015 Novo Nordisk Foundation Center for Biosustainability, DTU. # 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 # Un...
#!/usr/bin/env python # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # Acknowledgement: Part of the codes are adapted from Unnat Jain import os import numpy as np impo...
<gh_stars>1-10 from __future__ import (absolute_import, print_function) import sympy as sp from sympy.core.compatibility import exec_, PY3 from sympy.codegen.ast import Assignment from sympy.codegen.algorithms import newtons_method, newtons_method_function from sympy.codegen.fnodes import bind_C from sympy.codegen.fu...
<reponame>rebcabin/mathics-core<gh_stars>0 # cython: language_level=3 # -*- coding: utf-8 -*- import sympy import mpmath import math import re import typing from typing import Any, Optional from functools import lru_cache from mathics.core.formatter import encode_mathml, encode_tex, extra_operators from mathics.core...
<filename>examples/process_viral_data.py import sys import numpy as np import pandas as pd import scipy.stats as stats # Individual,Position,n_percent,dip_percent,Mutation,BadReads df = pd.read_csv(sys.stdin, usecols = ['Individual', 'Position', 'Mutation', 'BadReads']) # df = df[df.Position >= 6558][df.Position <= ...
#Copyright (c) 2009,2010 <NAME> import numpy as num import cudamat as cm from cudamat import reformat from scipy.io import loadmat, savemat def logOnePlusExp(x, temp, targ = None): """ When this function is done, x should contain log(1+exp(x)). We clobber the value of temp. We compute log(1+exp(x)) as...