text
string
<gh_stars>1000+ from math import ceil import pytest from scipy.stats import norm, randint import numpy as np from sklearn.datasets import make_classification from sklearn.dummy import DummyClassifier from sklearn.experimental import enable_halving_search_cv # noqa from sklearn.model_selection import StratifiedKFold ...
<reponame>take2rohit/monk_v1<gh_stars>100-1000 import os import sys import numpy as np import torch from PIL import Image from torch.autograd import Variable from scipy.stats import logistic from scipy.special import softmax
import sys import random import array import math import registers as gd3 from PIL import Image, ImageFont, ImageDraw, ImageChops, ImageFilter from eve import align4, EVE import zlib import numpy as np from scipy.ndimage import gaussian_filter import common def gentext(s, h): fn = "../../.fonts/IBMPlexSans-SemiBo...
<gh_stars>0 #!/usr/bin/python # -*- coding utf-8 -*- # # Parallelogramm - Klasse von agla # # # This file is part of agla # # # Copyright (c) 2019 <NAME> <EMAIL> # # # Licensed under the Apache License, Ve...
<gh_stars>0 import numpy as np import numpy.polynomial.polynomial as npp import pandas as pd from scipy.stats import norm from scipy.signal import butter, filtfilt from numba import njit, prange, guvectorize, float64, float32, int64 def camera_waveforms(t_pulse, noise_offset, noise_std): n_samples = 96 pulse_...
<filename>jigs/prom/source/we.py """Very simple example using a pair of Lennard-Jones particles. This script has several pieces to pay attention to: - Importing the pieces from wepy to run a WExplore simulation. - Definition of a distance metric for this system and process. - Definition of the components used in th...
<gh_stars>0 """ A fantastic python code to determine the quenched SFH parameters of galaxies using emcee (http://dan.iel.fm/emcee/current/). This file contains all the functions needed to determine the mean SFH parameters of a population. N.B. The data files .ised_ASCII contain the extracted bc03 models and ha...
<filename>ebcic/__init__.py # %load ./ebcic/ebcic.py # %%writefile ./ebcic/ebcic.py # To be synchronized with ebcic.py copy either of the above magic functions # depending on whether to overwrite or to load, and then run this cell. """Exact Binomial Confidence Interval Calculator This module provides functions to calc...
""" The primary module for user-interaction with the :mod:`hmf` package. The module contains a single class, `MassFunction`, which wraps almost all the functionality of :mod:`hmf` in an easy-to-use way. """ import numpy as np import copy from scipy.optimize import minimize from scipy.interpolate import InterpolatedUn...
<reponame>SwellMai/Terminator-800 #!/usr/bin/env python import os import rospy import rosbag import message_filters from sensor_msgs.msg import LaserScan from nav_msgs.msg import Odometry from geometry_msgs.msg import PoseStamped, Twist import numpy as np from tf.transformations import euler_from_quaternion import math...
import scipy.io def save_to_ascii_file(data_list, out_filepath): write_list = [] for data in data_list: output_str = "" for val in data: output_str += str(val) + "\t" output_str = output_str[:-1] output_str += "\n" write_list.append(output_str) with ope...
<filename>ndmg/preproc/preproc_func.py<gh_stars>0 #!/usr/bin/env python # Copyright 2016 NeuroData (http://neurodata.io) # # 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.ap...
<gh_stars>10-100 # Copyright 2020 MIT Probabilistic Computing Project. # See LICENSE.txt import pytest from sympy import exp as SymExp from sympy import log as SymLog from sympy import symbols from sppl.sets import FiniteReal from sppl.sym_util import get_symbols from sppl.sym_util import partition_finite_real_conti...
import sys sys.path.insert(1, '../src/MyAIGuide/utilities') import pickle import matplotlib.pyplot as plt import numpy as np import pandas as pd from scipy import stats from sklearn.preprocessing import MinMaxScaler from dataFrameUtilities import check_if_zero_then_adjust_var_and_place_in_data, insert_data_to_tracker_m...
# Standard library from __future__ import division import re import os from io import StringIO from math import exp from collections import namedtuple import timeit import json import itertools # Conda packages import pandas import scipy.spatial.distance import numpy as np import matplotlib.pyplot as plt # From https...
<gh_stars>0 import numpy as np from utils import cost_function_logistic_regression_J , sigmoid_binari from scipy import optimize def train(): X1 = np.array([1 , 0 , 0 , 1]) X2 = np.array([1 , 0 , 1 , 0]) m = X1.size # should be same as the X2,y x0= np.ones(m) Y = np.array([1 , 0 , 0 , 0]) # logi...
import csv import numpy as np import scipy from sklearn import linear_model from datetime import datetime from dateutil.parser import parse import matplotlib.pyplot as plt from helperFunctions import printRSquared from helperFunctions import predictNext from helperFunctions import plotLearningCurve from sklearn.model_s...
# MIT License # # Copyright (c) 2020 <NAME> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, pu...
# -*- coding: utf-8 -*- """ Created on Sun May 09 22:35:21 2010 Author: josef-pktd License: BSD todo: change moment calculation, (currently uses default _ppf method - I think) >>> lognormalg.moment(4) Warning: The algorithm does not converge. Roundoff error is detected in the extrapolation table. It is assumed t...
<gh_stars>1-10 import argparse import numpy as np from scipy.special import logsumexp import scipy class Scorer (object): def __init__ (self, word, early_input, early_output, later_input, later_output, ind): self.word = word sim_early = np.dot (early_output, early_input[ind]) sim_later = np.dot (later_output, l...
<gh_stars>10-100 from __future__ import division import scipy as sp import numpy as np from statsmodels import api as sm import time import sys from DSTK.GAM.utils.p_splines import _get_percentiles, _get_basis_vector, R from DSTK.utils.function_helpers import sigmoid from DSTK.GAM.gam import ShapeFunction from DSTK.GAM...
# -*- coding: utf-8 -*- # # Copyright 2018-2020 Data61, CSIRO # # 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 applicabl...
''' Created on Oct 31, 2017 @author: udit.gupta ''' import numpy as np import matplotlib.pyplot as plt import scipy from scipy import misc from lr_utils import load_dataset # Loading the data (cat/non-cat) train_set_x_orig, train_set_y, test_set_x_orig, test_set_y, classes = load_dataset() # Example of a picture fro...
<reponame>ahmedabdelazzim/pyABS<filename>PyABS.py """PyABS, light version of aspects of proprietary code.""" import pandas as pd from pandas.compat import lmap import numpy as np from statsmodels.tsa.arima_model import ARMA from scipy.linalg import cholesky import matplotlib.pyplot as plt from tqdm import tqdm def au...
# libraries # simple graphical elements import matplotlib.pyplot as plt # numerical calulations import numpy as np # symbolic calculations import sympy as sp from sympy.abc import * # skip declaring symbols, eats up namespace though #!pip install magpylib # SMT solver #!pip install z3-solver import z3 # packaged ...
<filename>courses/nik/niklib/w2v_model.py import numpy as np from tqdm import tqdm import _pickle as pickle from scipy.spatial.distance import cosine from sklearn.neighbors import NearestNeighbors class Word2VecModel: # word index must start from 1 # word with idx=0 is empty word, which always has zero embeddi...
<gh_stars>0 # <Copyright 2019, Argo AI, LLC. Released under the MIT license.> """Utility functions for converting quaternions to 3d rotation matrices. Unit quaternions are a way to compactly represent 3D rotations while avoiding singularities or discontinuities (e.g. gimbal lock). If a quaternion is not normalized be...
""" Utility functions and constants for probabilistic dust models. """ import numpy as np import scipy.integrate as integrate import scipy.optimize as optimize import scipy.special as special import scipy.stats as stats import model_list import models from utils import B_nu, G_nu from fitting import noise_model # Ph...
<filename>project/utils/helpful_files/apply_affine.py import numpy as np import nibabel from monai.transforms import LoadNifti from scipy.ndimage import affine_transform import matplotlib.pyplot as plt import nibabel as nib import numpy.linalg as npl from nibabel.freesurfer.mghformat import MGHImage np.set_printoptio...
import numpy as np from scipy.spatial.transform import Rotation as R from radiosim.utils import get_exp from radiosim.gauss import gauss def create_jet(image, num_comps): if len(image.shape) == 3: image = image[None] jets = [] jet_comps = [] source_lists = [] for img in image: img...
<reponame>valebru/HyperLogLog_s<gh_stars>1-10 #!/usr/bin/env python2.7 from multiprocessing import Process import numbers from operator import itemgetter import math import xxhash_cffi as xxhash import socket import numpy as np import sys import numpy from scipy import stats import dpkt import time import argparse fr...
import time import scipy.io from scipy.spatial.distance import pdist from skimage.color import lab2rgb, rgb2lab from mpl_toolkits.mplot3d import Axes3D from tqdm import tqdm from helpers import * iterations = 0 def plot_data(data_by_types): """ Show a scatter plot of the data by type, the first dimension group...
<gh_stars>0 #!/usr/bin/env python import dfl.dynamic_system import dfl.dynamic_model as dm import numpy as np import matplotlib.pyplot as plt from scipy import signal plt.rcParams["font.family"] = "Times New Roman" plt.rcParams["font.size"] = 30 plt.rcParams['pdf.fonttype'] = 42 plt.rcParams['ps.fonttype'] = 42 def...
from __future__ import annotations from collections.abc import Iterable from pathlib import Path import numpy as np from lmfit import Parameters as ParametersLF from scipy import stats from chemex.containers.experiments import Experiments from chemex.messages import print_chi2 from chemex.messages import print_group...
<reponame>infmagic2047/arithgen """Quiz mode of arithgen. Usage: arithgen-quiz [options] arithgen-quiz --help arithgen-quiz --version Options: -d, --difficulty=<difficulty> Specify the complexity of expressions. [default: 3] -F, --format=<format> Specif...
import numpy as np from scipy import stats from statsmodels.regression.linear_model import OLS from statsmodels.tools.tools import add_constant from . import utils __all__ = ['qqplot'] def qqplot(data, dist=stats.norm, distargs=(), a=0, loc=0, scale=1, fit=False, line=False, ax=None): """ q...
<reponame>Ennosigaeon/scipy # # Tests for the lambertw function, # Adapted from the MPMath tests [1] by <NAME>, <EMAIL> # Distributed under the same license as SciPy itself. # # [1] mpmath source code, Subversion revision 992 # http://code.google.com/p/mpmath/source/browse/trunk/mpmath/tests/test_functions2.py?spec...
""" LIMBO Clustering Algorithm implementation DOI: 10.1109/TSE.2005.25 Usage: limbo.py -h """ from scipy.sparse import * import argparse import copy import pickle import numpy as np import sys import bisect import collections import sade.helpers np.warnings.filterwarnings('ignore') def kl_div(p, q): ...
#/usr/bin/env python """ Example of Most Descriptive compound selection. Code Source: <NAME> License: BSD 3 clausole """ import os import sys path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) if not path in sys.path: sys.path.insert(1, path) del path import numpy as np import matplotlib.py...
from typing import List, overload import numpy as np import pandas as pd def clip_hotspots(img: np.ndarray): """ Performs hotspot removal on an ion image to match the METASPACE website's ion image rendering """ min_visible = np.max(img) / 256 if min_visible > 0: hotspot_threshold = np.qua...
#!/usr/bin/env python3 # # Copyright (c) 2019 Seoul National University # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use...
<gh_stars>0 #!/usr/bin/env python import PID import time import matplotlib.pyplot as plt import numpy as np from scipy.interpolate import spline #P=2.0, I=0.0, D=1.0, Derivator=0, Integrator=0, Integrator_max=100, Integrator_min=-100, reference=0.0 def PID_test(P=2.0, I=0.0, D=1.0, reference=0.0): pidx = PID.PID(...
<gh_stars>10-100 # Copyright 2019, 2020 DeepMind Technologies Limited, <NAME> # # 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 # # Unl...
<gh_stars>0 import numpy as np import scipy.sparse as sp import torch def encode_onehot(labels): classes = set(labels) classes_dict = {c: np.identity(len(classes))[i, :] for i, c in enumerate(classes)} labels_onehot = np.array(list(map(classes_dict.get, labels)), ...
<gh_stars>1-10 import numpy as np from scipy.special import sph_harm def get_box_geometry(vectors): """expects box vectors in rows of 'vectors'""" # get box lengths, angles, and volume lengths = np.linalg.norm(vectors, axis=1) angles = np.empty(3) angles[0] = np.arccos( vectors[1,:].do...
<gh_stars>0 # from insitro_core.utils.storage import makedirs import os import time from os.path import basename, join import numpy as np import pandas as pd import scipy.sparse as ssp from insitro_core.utils.cloud.bucket_utils import check_exists, download_file def get_hic_file(chromosome, hic_dir, allow_vc=True, ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Oct 13 10:38:35 2020 @author: <NAME> (<EMAIL>) Additional functions for manuscript "Rapid processing and quantitative evaluation of multicontrast EPImix scans for adaptive multimodal imaging" """ # Additional functions to run EPImix comparison script...
import numpy as np import scipy.constants as sc class SED(object): def __init__(self,*args,filename=None): self._lamb=[] self._flam=[] if filename is not None: self.load_from_file(filename) if len(args)==2: self.load_from_data(*args) ...
import skimage.measure import scipy.ndimage import numpy as np import networkx as nx from skimage.morphology import skeletonize from numba import njit def _build_neighborhood(kernel, n): a = np.empty((3, 3), dtype=np.bool) for i in range(3): for j in range(3): a[i, j] = 1 if (n & kernel[i, j] != 0) else 0 re...
# -*- coding: utf-8 -*- """ Sections: - import libraries and define functions - loading all the data in a specific main folder into mainDataList - load data corresponding to a specific experiment (subfolder or video) into variables - load variables from postprocessed file corresponding to the specific experiment above ...
<gh_stars>1-10 #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Jan 21 19:05:06 2021 @author: saitel """ from periodic.no_contact_tracing import NoCT from periodic.backward_tracing.recursive_bct import RecursiveBCT from parameters.parameters import TestParameters1, TestParameters2 import numpy as np f...
<filename>enterprise_extensions/frequentist/chi_squared.py # -*- coding: utf-8 -*- import numpy as np import scipy.linalg as sl def get_chi2(pta, xs): """Compute generalize chisq for pta: chisq = y^T (N + F phi F^T)^-1 y = y^T N^-1 y - y^T N^-1 F (F^T N^-1 F + phi^-1)^-1 F^T N^-1 y """ ...
<reponame>knector01/pvc import sys import numpy as np import scipy.signal import matplotlib.pyplot as plt import soundfile import pvc # TODO: This doesn't work correctly, and grabs small peaks rather than the larger-scale formants if __name__ == "__main__": block_size = 4096 n_blocks = 4 vol_thresh = 0....
import statistics as np N = int(input()) A = list(map(int, input().split()[:N])) A.sort() Q2 = np.median(A) if N % 2 == 0 : A1 = A[:int((N/2))] A2 = A[int((N/2)):N] else : m = (N//2) A1 = A[:m] A2 = A[(m+1):N] Q1 = np.median(A1) Q3 = np.median(A2) print(int(Q1)) print(int(Q2)) print(int(Q3))
<gh_stars>1000+ from sympy import Integer from sympy.core import Symbol from sympy.utilities import public @public def approximants(l, X=Symbol('x'), simplify=False): """ Return a generator for consecutive Pade approximants for a series. It can also be used for computing the rational generating function of...
<filename>demo_wavelet.py import numpy as np from scipy import sparse import sys import random as rd import matplotlib.pyplot as plt from PIL import Image import waveletDec as wd import IAFNNESTA import IAFNNesterov def help(): return ''' Here we compare the tv reconstruction with the L1 reconstruction in the wave...
<gh_stars>10-100 import argparse import numpy as np import os import pickle from scipy.io import loadmat parser = argparse.ArgumentParser() parser.add_argument('--data-dir', required=True, type=str, default=None) args = parser.parse_args() assert (args.data_dir is not None) and (os.path.isdir(args.data_dir)) def lo...
import numpy as np import matplotlib.pyplot as plt from matplotlib.gridspec import GridSpec from matplotlib.collections import LineCollection from matplotlib.gridspec import GridSpec import matplotlib.gridspec as gridspec import scipy.signal as signal import os plt.rcParams['figure.figsize'] = (12, 9) plt.rcParam...
from sympy import * from . import commonFuncs as cf from sympy.abc import p, q, x from . import numericFuncs as nf # basic components of a region class RegionBase: # (pl, pu, ql, qu) tuple representation, # sgn: remove or add; # eta: a gate function to control the support # a, b: the eta function bound...
import scipy.io as sio import numpy as np import os import mne import gigadata import matplotlib.pyplot as plt from sklearn.discriminant_analysis import LinearDiscriminantAnalysis from sklearn.model_selection import ShuffleSplit, cross_val_score from pyriemann.estimation import Covariances from mne import Epochs, p...
import os from scipy.spatial.transform import Rotation as R import numpy as np import torch import json import cv2 import time import imageio #Helper functions vec_to_rot_matrix = lambda x: R.as_matrix(R.from_rotvec(x)) rot_matrix_to_vec = lambda y: R.as_rotvec(R.from_matrix(y)) rot_x = lambda phi: torch.tensor([ ...
from __future__ import division from numpy.testing import (TestCase, assert_equal, assert_array_equal, assert_almost_equal, assert_array_almost_equal, assert_allclose, assert_, assert_raises) import numpy as np from decimal import Decimal from macroeco.models impo...
<gh_stars>1-10 ### generate plots of luciferase data: ### Import dependencies import matplotlib matplotlib.use('Agg') ### set backend import matplotlib.pyplot as plt plt.rcParams['pdf.fonttype'] = 42 # this keeps most text as actual text in PDFs, not outlines plt.tight_layout() import sys import math import matplot...
#!/usr/bin/env python3 # importing functions import pandas as pd import numpy as np import cv2 import sklearn import matplotlib.pyplot as plt import matplotlib.image as mpimg from random import randint import csv from scipy import ndimage from sklearn.utils import shuffle # importing data samples = [] with open('da...
# Code written by: <NAME> (<EMAIL>) # <NAME> (<EMAIL>) """ This class is a collection of functions for showing data with pymol. Note that the limit of pymol is 100k monomers, therefore interpolateData is useful to collapse the 200k-long simulation into a 100k-long conformation. """ import os import te...
<filename>pymatgen/core/lattice.py # coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. """ Defines the classes relating to 3D lattices. """ import math import itertools import warnings from functools import reduce import collections from fractions import Fract...
from unittest import TestCase, main from sympy import sympify, symbols from numpy import array, allclose from tridiagonal import solve_diffeq class TridiagonalTestCase(TestCase): def setUp(self): """initial set up""" def test_model_solution(self): """Verify the resulting approximation is corr...
<gh_stars>1-10 """ Test reload for trained models. """ import os import pytest import unittest import tempfile import numpy as np import deepchem as dc import tensorflow as tf import scipy from flaky import flaky from sklearn.ensemble import RandomForestClassifier from deepchem.molnet.load_function.chembl25_datasets im...
import json import os import neurofinder import pandas as pd from scipy.io import savemat def calc_stats(file_name, caiman, cidan, suite2p, true): rows = [] caimain_file = [os.path.join(caiman, x) for x in os.listdir(caiman) if file_name in x and "json" in x][0] cidan_file = [os.path....
''' Contains a generic algorithm object which can do vanilla ICP Then, create plugin functions which can do naive, simple, and fast PFH ''' import time import numpy as np import matplotlib.pyplot as plt import scipy.special as sp from sklearn.metrics.pairwise import euclidean_distances from . import utils class PFH...
<filename>tools/capture_dataset.py """ Script to capture a set of test images. Be sure to register beforehand!!! Author: <NAME> """ import argparse import copy import IPython import logging import numpy as np import os import pcl import rosgraph.roslogging as rl import rospy import scipy.stats as ss import sys import t...
import numpy as np import dynesty from scipy.special import erf from utils import get_rstate, get_printing nlive = 100 printing = get_printing() win = 100 def loglike(x): return -0.5 * x[1]**2 def prior_transform(x): return (2 * x - 1) * win def test_periodic(): # hard test of dynamic sampler with hi...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import numpy as np from matplotlib import pyplot as plt; plt.ion() from scipy.signal import lfilter from itertools import chain def getSpikes(t, v, setdvdt, output=False, plotRaster=True, newfigure=True): ''' Expected matrices shapes: t: [length] or [length...
<reponame>garbagetrash/orbital<gh_stars>10-100 import unittest from scipy.constants import kilo, mega, pi from numpy import radians from orbital import earth, KeplerianElements from orbital.maneuver import * class TestOperation(unittest.TestCase): def setUp(self): self.LEO = KeplerianElements...
<reponame>akutta/hercules #!/usr/bin/env python3 import argparse from datetime import datetime, timedelta from importlib import import_module import io import json import os import re import shutil import sys import tempfile import threading import time import warnings try: from clint.textui import progress except...
import itertools,subprocess import numpy as np import taskA_scorer from scipy.special import softmax def all_subsets(ss): return itertools.chain(*map(lambda x: itertools.combinations(ss, x), range(0, len(ss)+1))) #all_models=["models_bert/albert_4a_new_dev_nonaug/checkpoint-300/", "models_bert/albert_4a_new_d...
from scipy.stats import loguniform, uniform import numpy as np from dask import compute from gillespy2 import Model, Species, Reaction, Parameter, RateRule, AssignmentRule, FunctionDefinition from gillespy2 import VariableSSACSolver def minmax_normalize(data, min_=None, max_=None): data_ = np.copy(data) if mi...
# import pyaudio from scipy.io.wavfile import read, write import scipy.signal as sig import numpy as np import scipy.interpolate as interp import sys import os.path from os import path def resample(file, target_rate): if file['rate'] != target_rate: return {'waveform':sig.resample(file['waveform'], target_...
from learners.learner import Learner import numpy as np from sklearn.gaussian_process import GaussianProcessRegressor from sklearn.gaussian_process.kernels import RBF, ConstantKernel as C from sklearn.preprocessing import StandardScaler from scipy.stats import norm class GPTS(Learner): LEARNER_NAME = "GPTS-Scale...
################################################################################ # (c) [2013] The Johns Hopkins University / Applied Physics Laboratory All Rights Reserved. # Contact the JHU/APL Office of Technology Transfer for any additional rights. www.jhuapl.edu/ott # # Licensed under the Apache License, Version ...
import os import time import logging import matplotlib.pyplot as plt import numpy as np import pdb from scipy import optimize as opt from stompy.spatial import field from stompy import utils from stompy.grid import (unstructured_grid, exact_delaunay, front) import logging logging.basicConfig(level=logging.INFO) fr...
<reponame>xxdreck/google-research # coding=utf-8 # Copyright 2021 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...
import numpy as np from scipy.interpolate import PchipInterpolator as Pchip from refnx.reflect import Structure, Component from refnx.analysis import Parameter, Parameters, possibly_create_parameter EPS = np.finfo(float).eps class Spline(Component): """ Freeform modelling of the real part of an SLD profil...
from sympy import * from common1 import plot_latex, plot_equation x, y = symbols('x y') eq = Eq(x**2 + y**2, 9) plot_equation(eq)
import pandas as pd import numpy as np import plotly.express as px import yaml from scipy.integrate import odeint from tqdm import tqdm import sys sys.path.insert(0,'.') # from seir import entrypoint from seir import entrypoint def iterate_simulation(current_state, seir_parameters, phase, initial): """ Iterate...
<filename>MMR_IVs/rkhs_model_LMO_nystr_mendelian.py import add_path,os import autograd.numpy as np from autograd import value_and_grad from scipy.optimize import minimize from util import get_median_inter_mnist, Kernel, load_data, ROOT_PATH,jitchol,_sqdist, remove_outliers,nystrom_decomp, chol_inv import time Nfeval ...
<gh_stars>0 from scipy.special import gammaln from scipy.stats import binom import numpy, random import pdb def tool_hypergeomPMF(k, M, n, N): tot, good = M, n bad = tot - good return numpy.exp(gammaln(good+1) - gammaln(good-k+1) - gammaln(k+1) + gammaln(bad+1) \ - gammaln(bad...
<filename>ML_functions.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Apr 28 2020 @author: <NAME> """ import numpy as np import joblib import pickle from scipy import linalg from scipy import sparse import pyfftw def create_HP_filt(flength,cutoff,TR): cut=cutoff/TR sigN2=(cut/np.sqrt(2)...
<gh_stars>0 import pandas as pd from sympy import Symbol, diff, factorial from sympy.core.add import Add from sympy.core.mul import Mul from typing import Union def n_diff(f: Union[Add, Mul], variable: Symbol, n: int): for _ in range(n): f = f.diff(variable) return f def taylor(f: Union[Add, Mul], variable: Sym...
''' swing up pendulum with limited torque ''' import sympy as sp import numpy as np from ilqr import iLQR from ilqr.utils import GetSyms, Constrain from ilqr.containers import Dynamics, Cost #state and action dimensions n_x = 3 n_u = 1 #time step dt = 0.025 #Construct pendulum dynamics m, g, l = 1, 10, 1 def f(x, u...
#!/usr/bin/env python import argparse import gzip import os import cPickle as pickle import numpy as np import matplotlib.pyplot as plt from matplotlib.backends.backend_pdf import PdfPages from scipy import signal import fileio def process_image(pickle_file, image, output_file): with gzip.open(pickle_file, mode...
<filename>cat_tools.py from astropy import units as u from astropy.io import ascii from astroquery.vizier import Vizier from astropy import table from astropy import coordinates as coord from astropy import units as u from misc import bcolors import numpy as np import os from scipy.spatial import...
import json from nltk import word_tokenize from nltk.corpus import stopwords from nltk.stem.porter import PorterStemmer import os import re import math from scipy import sparse import numpy as np from scipy import spatial import time ORIGINAL_ARTICLE_PATH = '../dataset/US_Financial_News_Articles/' EDITED_TEXT_PATH = '...
<reponame>puiseux/spleen<gh_stars>0 #!/usr/local/bin/python2.7 #-*-coding: utf-8 -*- ''' Axile -- Outil de conception/simulation de parapentes Nervures Classe NSpline Description : @author: puiseux @copyright: 2016-2017-2018 Nervures. All rights reserved. @contact: <EMAIL> __updated__="2019-05-06" ''' import ...
import os import sys """ Test 72 transform tf1 model on hits """ PROJECT_PATH = os.path.abspath( os.path.join(os.path.dirname(__file__), '..')) sys.path.append(PROJECT_PATH) from modules import utils import time import transformations import numpy as np from models.wide_residual_network import create_wide_residua...
<gh_stars>0 # -*- coding: utf-8 -*- """ Created on Wed Aug 31 13:04:09 2016 @author: diepencjv """ #%% import numpy as np import scipy.signal import logging import warnings import qcodes from qcodes import Instrument from qcodes.plots.pyqtgraph import QtPlot from qcodes import DataArray import qtt import qtt.utiliti...
import os import numpy as np from scipy.io import wavfile as wf ''' Read pitchmark file Get 25 msec window around it ( if possible) Read ccoeffs file and get the ccoeffs. Read the wavefile and get corresponding wave. Quantize the wave and store <ccoeffs,wav> in numpy array. ''' def mulaw(x, mu=256): return _sign(...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jan 16 16:18:45 2019 @author: matteo """ from potion.simulation.trajectory_generators import generate_batch from potion.common.misc_utils import performance, avg_horizon from potion.estimation.gradients import gpomdp_estimator from potion.estimation.met...
import numpy as np import scipy.sparse as sp from scipy.sparse.linalg import splu from pySDC.core.Errors import ParameterError, ProblemError from pySDC.core.Problem import ptype from pySDC.implementations.datatype_classes.mesh import mesh # noinspection PyUnusedLocal class advection1d(ptype): """ Example imp...
<gh_stars>0 from sklearn.preprocessing import StandardScaler from sklearn.model_selection import train_test_split import numpy as np import scipy.io ######################################## FUNCTIONS # Data loading. def loadData(dataPath, isTrain=True): Data = scipy.io.loadmat(dataPath) proj_m = Data['Proj_M...