text
string
<filename>alumni/utils.py<gh_stars>0 from typing import Any import numpy as np import scipy.sparse.csr import sklearn.base import sklearn.tree.tree def assert_equal( actual: Any, desired: Any, err_msg: str = "", verbose: bool = True ) -> None: # recursively call itself when needed (copied from np.testing.ass...
<gh_stars>0 import time import os import gym import numpy as np import matplotlib.pyplot as plt from stable_baselines3 import PPO from stable_baselines3.common.evaluation import evaluate_policy from stable_baselines3.common.monitor import Monitor from stable_baselines3.common.results_plotter import load_results, ts2x...
import os import soundfile as sf import sounddevice as sd from sys import argv from prompt_yes_no import * from scipy.io.wavfile import write DTYPE = "int16" MONO, STEREO = 1, 2 # number of audio channels SAMPLE_RATE = 8000 # voice recording # OUTPUT_FOLDER = os.path.join("D:\\", "Music") OUTPUT_FOLDER = '.' def ...
#!/usr/bin/python # -*- coding: utf-8 -*- ########################################################################################## # author: <NAME> # contact: <EMAIL> # date: 2021-05-10 # file: mpl_discrete_poisson_pmf_A.py # tested with python 3.7.6 in conjunction with mpl version 3.4.2 #############################...
import os import sys py_dll_path = os.path.join(sys.exec_prefix, 'Library', 'bin') os.add_dll_directory(py_dll_path) import numpy as np import cv2 from PIL import Image, ImageDraw from matplotlib import cm from scipy import ndimage import torch import torchvision from torchvision.models.detection.faster_rcnn...
#!/usr/bin/env python # coding: utf-8 # ## Setup # In[1]: get_ipython().run_line_magic('load_ext', 'autoreload') get_ipython().run_line_magic('autoreload', '2') ######################################################## # python import pandas as pd import numpy as np import scipy.stats norm = scipy.stats.norm import...
<reponame>m-philipps/pyPESTO import os from functools import partial import numpy as np import scipy.optimize as so import pypesto import pypesto.optimize as optimize from pypesto.C import AMICI_STATUS, AMICI_T, AMICI_Y, MEAN, WEIGHTED_SIGMA from pypesto.engine import MultiProcessEngine from pypesto.ensemble import (...
"""Transform feature matrices with grouped covariates.""" import logging import numpy as np from scipy.interpolate import interp1d from sklearn.base import BaseEstimator, TransformerMixin from sklearn.utils import check_array, check_random_state, check_scalar from sklearn.utils import shuffle as util_shuffle from .u...
<filename>src/algorithms.py<gh_stars>1-10 import pandas as pd import numpy as np import scipy as sp from sklearn.feature_extraction import DictVectorizer from sklearn.linear_model import LogisticRegression from sklearn.tree import DecisionTreeClassifier, export_graphviz, ExtraTreeClassifier def get_feature_relevance...
<reponame>fabiosky/dcv-color-primitives<filename>benches/geninput.py #!/usr/bin/env python3 from array import array from itertools import product as cartesian_product from random import Random from os.path import join, exists, dirname, realpath from os import environ from fractions import Fraction as frac import sys s...
from joblib import Parallel, delayed from scipy import spatial import numpy as np import matplotlib.pyplot as plt import pandas as pd import multiprocessing as mp import copy import time tree = None pred_vectors = None def ordered_distance(i): return tree.query(pred_vectors[i],k=1000)[1] def load(a_tree, a_pred_ve...
<reponame>cphyc/py_extrema<filename>py_extrema/critical_events.py<gh_stars>0 from scipy.spatial import cKDTree from py_extrema.extrema import ExtremaFinder import numpy as np from tqdm.autonotebook import tqdm import pandas as pd from unyt import unyt_array from .extrema import logger from .utils import measure_hessia...
import os import glob import matplotlib.image as mpimg import numpy as np import cv2 import time import sys from skimage.feature import hog from sklearn.svm import LinearSVC from sklearn.preprocessing import StandardScaler from sklearn.model_selection import train_test_split from sklearn.externals import joblib from sc...
import numpy as np import os import h5py from scipy.io import loadmat import random import json import cv2 class_name_list_all = [ "02691156_airplane", "02828884_bench", "02933112_cabinet", "02958343_car", "03001627_chair", "03211117_display", "03636649_lamp", "03691459_speaker", "04090263_rifle", "04256520_couch", "0...
import binomial import scipy.stats import numpy as np import unittest import logging import sys from timeit import timeit class TestBinomial(unittest.TestCase): PRECISION = 5 def test_simple_entry(self): self.assertEqual(binomial.binomialpmf(1,20,0.1,),scipy.stats.binom.pmf(1,20,0.1)) def test_lis...
# -*- coding: utf-8 -*- # from __future__ import division import numpy import sympy from ..helpers import untangle, fsd, z from .helpers import volume_unit_ball class HammerStroud(object): """ <NAME> and <NAME>, Numerical Evaluation of Multiple Integrals II, Math. Comp. 12 (1958), 272-280, <http...
<gh_stars>1-10 """ markowitzModel.py Created by <NAME> at 13/09/2020, University of Milano-Bicocca. (<EMAIL>) All rights reserved. This file is part of the EcoFin-Library (https://github.com/LucaCamerani/EcoFin-Library), and is released under the "BSD Open Source License". """ from collections import namedtuple imp...
""" predict labels for birdsong syllables, using already-trained models specified in config file """ import os import sys import glob # from dependencies import yaml import numpy as np from sklearn.externals import joblib from scipy.io import wavfile # from hvc import hvc.featureextract from .parseconfig import par...
<reponame>zangobot/secml """ .. module:: CFunction :synopsis: Wrapper to manage a function and its gradient .. moduleauthor:: <NAME> <<EMAIL>> .. moduleauthor:: <NAME> <<EMAIL>> """ from scipy import optimize as sc_opt from secml.core import CCreator from secml.array import CArray from secml.core.constants import...
#!/usr/bin/env python3 from fractions import Fraction from functools import reduce import operator def product(fracs): t = reduce(operator.mul, fracs, 1) return t.numerator, t.denominator if __name__ == '__main__': n = int(input()) l = [Fraction(*map(int, input().split())) for _ in range(n)] pr...
import numpy as np import os import scipy.io as spio import pydicom import sys def names_of_slices(folder_path,patient): path = slices_path + patient all_slices_names = [] all_slices=[] for file in os.listdir(path): all_slices.append([pydicom.dcmread(path + '/' + file)]) all_slice...
<filename>HELENA3.py #!/usr/bin/env python3 ################################# # Point of Contact # # # # Dr. <NAME> # # University of Michigan # # Electrical Engineering # # & Computer Science Dept. # # 1301 Beal Ave, Ann Arbor, # # MI 48109-2122 USA # # <EMAIL> # # ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Author: <NAME> # Description : FFT Baseline Correction import sys, os import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib.widgets import Slider, Button, SpanSelector from matplotlib import gridspec import scipy.fftpack ...
<reponame>or-tal-robotics/dynamic_map_matcher #!/usr/bin/env python import rospy import numpy as np import matplotlib.pyplot as plt from sklearn.neighbors import NearestNeighbors # for KNN algorithm from scipy.optimize import differential_evolution import copy import pandas as pd import rosbag import rospkg ground_tr...
import numpy as np import matplotlib.pyplot as plt from sklearn.ensemble import IsolationForest import os import pandas as pd import scipy from scipy import stats import sys rng = np.random.RandomState(42) # # Generate train data # X = 0.3 * rng.randn(100, 2) # X_train = np.r_[X + 2, X - 2] # # Generate some regular ...
<reponame>microsoft/nanotune import logging from functools import partial from typing import List, Optional, Union, Dict, Tuple, Sequence, Any import numpy.typing as npt import numpy as np import scipy as sc import itertools import json import logging import copy from numpy.linalg import inv from numpy.linalg import m...
<filename>scr/sound.py from pylab import* from scipy.io import wavfile if len(sys.argv) < 2: print("Plays a wave file.\n\nUsage: %s filename.wav" % sys.argv[0]) sys.exit(-1) file_name = sys.argv[1] # sampFreq, snd = wavfile.read('../Downloads/TT_soundtrack_-_k13.wav') # sampFreq, snd = wavfile.read('../Downl...
from optimism.JaxConfig import * import optimism.EquationSolver as EquationSolver from optimism.Objective import Objective from optimism.Objective import param_index_update from optimism.SparseCholesky import SparseCholesky import numpy as onp from scipy.sparse import csc_matrix from scipy.sparse import diags as sparse...
# This files contains your custom actions which can be used to run # custom Python code. # # See this guide on how to implement these action: # https://rasa.com/docs/rasa/core/actions/#custom-actions/ # This is a simple example for a custom action which utters "Hello World!" import re import io import ast import req...
import numpy as np import utils import math import scipy from scipy import optimize import random from scipy.special import xlogy class RegLogisticRegressor: def __init__(self): self.theta = None def sigmoid(self, x): return (1 / (1 + np.exp(-x))) def train(self,X,y,reg=1e-5,num_iters=1...
<gh_stars>1-10 import abc import random from typing import List, Optional, Union import numpy as np import torch from qiskit import QuantumCircuit from qiskit.opflow import PauliOp from qiskit.quantum_info import Pauli, DensityMatrix, Statevector from scipy.linalg import expm from utils.np_utils import normalized_mat...
<gh_stars>10-100 import logging import numpy as np import pandas as pd import scipy.io from sklearn.model_selection import train_test_split from sklearn.preprocessing import MinMaxScaler logger = logging.getLogger(__name__) def get_train(label=0, scale=False, v=0, *args): """Get training dataset for Thyroid data...
from utils import * import numpy import matplotlib.pyplot as plt import os, os.path from scipy.constants import pi, hbar, e vf = 1.1e6 # Use C/m^2 def delta_phi_gr(sigma): fac = hbar * vf / e * numpy.sqrt(pi * numpy.abs(sigma) / e) return fac * numpy.sign(sigma) quantities = ("V", "c_p", "c_n", "zflux_cp", "...
import bpy import bpy_extras import math import random import cv2 import bmesh import numpy as np from scipy.optimize import minimize, minimize_scalar from mathutils import Euler, Vector from abc import ABC, abstractmethod from blvcw.crystal_well_simulation_utils import get_random_euler, get_normal_distributed_values...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Software License Agreement (Lesser GPL) # # Copyright (C) 2009-2012 <NAME> # # ikfast is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of ...
# coding=utf-8 # Copyright 2020 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...
"""Informativeness model. Loads a language model and computes various entropy-based informativeness measures. """ from functools import lru_cache import logging import numpy as np import scipy from gensim.models import Word2Vec __all__ = ('Informativeness') logger = logging.getLogger(__name__) class Informati...
# Written by Dr <NAME>, Marda Science LLC # for the USGS Coastal Change Hazards Program # # MIT License # # Copyright (c) 2020, Marda Science LLC # # 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 Soft...
""" SGA.galex ========= Code to generate GALEX custom coadds / mosaics. """ import os, pdb import numpy as np from astrometry.util.util import Tan from astrometry.util.fits import fits_table import SGA.misc def _ra_ranges_overlap(ralo, rahi, ra1, ra2): import numpy as np x1 = np.cos(np.deg2rad(ralo)) y...
<filename>training.py # -*- coding: utf-8 -*- """ Created on Sun Mar 4 08:38:40 2018 @author: Nasif """ from sklearn import datasets from sklearn.svm import SVC from scipy import misc from PIL import Image import PIL.ImageOps digits = datasets.load_digits() features = digits.data labels = digits.t...
<filename>dataset.py import os import csv import pickle import numpy as np from scipy.sparse import csr_matrix from tqdm import tqdm """ Just a reminder :) features_prefixes = ['real_permission', 'feature', 'api_call', 'call', 'permission', 'provider', 'activity', 'i...
import os, sys import numpy as np from scipy.sparse import csr_matrix, coo_matrix def texts_nwd_csr(list_texts): ''' Make a csr n_wd matrix from a list of texts. each text is a list of tokens. provide dict_w_iw == mapping of words to indices i_w=0,...,V-1 ''' ## unqiue words and alphabeticall...
import pandas as pd import numpy as np import json from tqdm import tqdm from scipy.optimize import minimize from utils import get_next_gw, time_decay from ranked_probability_score import ranked_probability_score, match_outcome class Bradley_Terry: """ Model game outcomes using logistic distribution """ de...
import numpy as np import sys from sympy import * from matplotlib import pyplot as plt def biseccion(func,rango, tol, iterMax): #Funcion de prueba: "E**x - x - 2", [0,2], 10**(-10), 100 x = Symbol('x') #Inicializa "x" como símbolo f = sympify(func) #Se traduce el string "func" a una función...
<gh_stars>1000+ # -*- coding: utf-8 -*- """Copyright 2015 <NAME>. FilterPy library. http://github.com/rlabbe/filterpy Documentation at: https://filterpy.readthedocs.org Supporting book at: https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python This is licensed under an MIT license. See the readme.MD file f...
<reponame>tomjaguarpaw/knossos-ksc """ Correctness test for blas_combined.kso Requires: - pytest - scipy - ksc """ # fmt: off import pytest import numpy as np import scipy.linalg from rlo import utils from ksc.utils import translate_and_import # pylint:disable=no-name-in-module def make_random_normal(n, v, sz): ...
# Copyright (c) 2019 <NAME> # Universidad Carlos III de Madrid # # The Bayesian CPD computation is based on # the original code by <NAME> (2006). # # INFINITE HIERARCHICAL CHANGE-POINT DETECTION import numpy as np from scipy.stats import norm import random import matplotlib.pyplot as plt class infiniteHierCPD(): ...
<filename>visualize.py # Copied from https://github.com/emansim/baselines-mansimov/blob/master/baselines/a2c/visualize_atari.py # and https://github.com/emansim/baselines-mansimov/blob/master/baselines/a2c/load.py # Thanks to the author and OpenAI team! import glob import os import pandas as pd import matplotlib mat...
<filename>src/train/bork_nlg_model.py<gh_stars>0 #!/usr/bin/env python # coding: utf-8 # In[1]: import pandas as pd import numpy as np import scipy import math import os import tensorflow as tf import matplotlib.pyplot as plt import seaborn as sns def load_sts_dataset(filename): # Loads a subset of the STS dat...
""" [summary] [extended_summary] """ # region [Imports] # * Standard Library Imports ------------------------------------------------------------------------------------------------------------------------------------> import gc import os import re import sys import json import lzma import time import queue import ...
<gh_stars>0 """ PySC2_A3C_AtariNetNew.py A script for training and running an A3C agent on the PySC2 environment, with reference to DeepMind's paper: [1] Vinyals, Oriol, et al. "Starcraft II: A new challenge for reinforcement learning." arXiv preprint arXiv:1708.04782 (2017). Advantage estimation uses generalized advan...
<filename>tests/test_envs.py import unittest from gym import spaces from functools import reduce import numpy as np import numpy.testing as npt from scipy import stats from cognibench.models import decision_making from cognibench.envs import BanditEnv, ClassicalConditioningEnv from cognibench.simulation import simulate...
import Image,numpy,math, pylab, scipy import mpl_toolkits.mplot3d.axes3d as p3 from mayavi import mlab import matplotlib.pyplot as plt import gaussfitter from scipy import ndimage class Image_obj: def __init__ (self, image=None,array=None,surf=None): if image != None: self.im = image ...
import numpy as np from menpofit.aam import HolisticAAM from menpo.feature import igo from menpofit.aam import LucasKanadeAAMFitter from menpofit.fitter import align_shape_with_bounding_box from menpo.shape import PointCloud from menpofit.sdm import RegularizedSDM from menpo.feature import hellinger_vector_128_dsift im...
""" dtwhaclustering.plot_linear_trend ---------------------------------- DTW HAC analysis support :author: <NAME> :date: 2021/06 :copyright: Copyright 2021 Institute of Earth Sciences, Academia Sinica. """ import pandas as pd import numpy as np from scipy.interpolate import griddata import xarray as xr import pygmt f...
from argparse import ArgumentParser import numpy as np import pandas as pd import matplotlib.pyplot as plt from fyne import heston from scipy.integrate import solve_ivp from statsmodels.api import OLS import settings _EPS = 1.e-12 def optimal_controls(time, inventory_bounds, price_risk_aversion, ...
<gh_stars>0 #!/usr/bin/env python # -*- coding: utf-8 -*- """Calculate HOG features for an image""" import os import Image import numpy from scipy.misc import toimage def main(filename): """ Orchestrate the HOG feature calculation Parameters ---------- filename : str """ bins = 8 g...
#python example to infer document vectors from trained doc2vec model import gensim.models as g import codecs import sys import pandas as pd import pandas_datareader as pdr from pandas_datareader import data, wb import time import math import os from datetime import datetime from datetime import date from datetime impor...
<gh_stars>0 """ Module that contains the command line app. Why does this file exist, and why not put this in __main__? You might be tempted to import things from __main__ later, but that will cause problems: the code will get executed twice: - When you run `python -mTime_Frequency_Analysis` python will execute...
<filename>steps/MTP_Steps.py #import packages import datetime import quandl import pandas as pd import numpy as np import matplotlib.pyplot as plt import scipy as spy from behave import given, when, then ################################################################################ quandl.ApiConfig.api_key = 'API ke...
# # BSD 3-Clause License # # Copyright (c) 2019, Analog Devices, Inc. # All rights reserved. # # 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 copyright notice, ...
<reponame>edunnsigouin/ds21grl """ Calculates anomalous monthly mean climatology xy file for a given surface (or vertically integrated) variable in a given aquaplanet simulation. Anomalies are defined relative to the control simulation. """ import numpy as np import xarray as xr from scipy ...
from logs import logDecorator as lD import jsonref, pprint import matplotlib matplotlib.use('Qt5Agg') import matplotlib.pyplot as plt import numpy as np import seaborn as sns sns.set(style="dark") sns.set_palette(sns.diverging_palette(240, 120, l=60, n=3, center="dark")) from scipy import stats from scipy.stats import...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jan 24 15:54:31 2020 @author: heiko """ import numpy as np import scipy.optimize as opt from pyrsa.rdm import compare def fit_mock(model, data, method='cosine', pattern_sample=None, pattern_descriptor=None): """ formally acceptable f...
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ sbpy Photometry Module created on June 23, 2017 """ __all__ = ['ref2mag', 'mag2ref', 'spline', 'DiskIntegratedModelClass', 'LinearPhaseFunc', 'HG', 'HG12', 'HG1G2', 'DiskFunctionModel', 'LommelSeeliger', 'Lambert', 'LunarLambert...
<filename>scripts/pagerank_power_method_sparse.py<gh_stars>1-10 # Implements the power method without using any matrix multiplications, i.e. Monte Carlo approximation to the sum implied by v = Mv # Author : <NAME>, <NAME> # This function is the Python implementation of https://github.com/probml/pmtk3/blob/master/demos...
<reponame>nsevilla/descqa<gh_stars>0 from __future__ import print_function, division, unicode_literals, absolute_import import os import re import fnmatch from itertools import cycle from collections import defaultdict, OrderedDict import numpy as np import numexpr as ne from scipy.stats import norm import time from ....
import random import numpy as np import skimage.io as sio import skimage.color as sc import skimage.transform as st import torch from scipy.signal import convolve2d from skimage.util import view_as_windows import torch from torchvision import transforms def random_patch_select(img,ih,iw,ip): ix = random.randran...
# -*- coding: utf-8 -*- """ Created on Fri Nov 24 16:52:00 2017 @author: Paul """ import numpy as np from skimage import measure from collections import defaultdict import PySkelFrac.classes as c from scipy import ndimage import copy import time import cv2 def NewAssociatedContours(AllContours,AllArc...
import ops.utils import networkx as nx import pandas as pd import numpy as np import scipy.spatial.kdtree from collections import Counter from scipy.spatial.distance import cdist from scipy.interpolate import UnivariateSpline from statsmodels.stats.multitest import multipletests def format_stats_wide(df_stats): ...
import logging import os from pathlib import Path import click import pandas as pd from scipy import stats from tqdm import tqdm logging.basicConfig(level=logging.INFO) CORRECT_NER_ENTAILS = "Entails" CORRECT_NER_NOT_ENTAILS = "Not Entails/Error" CORRECT_NER_VALS = [CORRECT_NER_ENTAILS, CORRECT_NER_NOT_ENTAILS] AGG...
<reponame>DhruvThunderBolt/ControllingChaosInTheDuffingOscillator import numpy as np from scipy.integrate import odeint '''import scipy.integrate as integrate''' import matplotlib.pyplot as plt import matplotlib import math import sympy import statistics import sys import operator import collections import time import ...
<reponame>Womac/pyroomacoustics """ Adaptive Filter in STFT Domain Example ====================================== In this example, we will run adaptive filters for system identification, but in the frequeny domain. """ from __future__ import division, print_function import numpy as np from scipy.signal import fftcon...
import scipy as sc import scipy.stats as stats import scipy.linalg as linalg import math as m def sample_normal(mean,covar,nsamples=1): """sample_normal: Sample a d-dimensional Gaussian distribution with mean and covar. Input: mean - the mean of the Gaussian covar - the covariance of ...
"""Recursive nearest agglomeration (ReNA): fastclustering for approximation of structured signals Author: <NAME>, <NAME>, <NAME> and <NAME> """ import numpy as np from sklearn.utils.validation import check_is_fitted from sklearn.externals.joblib import Parallel, delayed, Memory from sklearn.externals import s...
from typing import List, Tuple, cast import numpy as np import scipy.linalg as spLinalg from ..misc.utils import isType from .classification import isMatrixDiagDominant def svdAndReconstruction(A: np.ndarray, singularValues: np.ndarray) -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]: """ Generates ...
import matplotlib.pyplot as plt import numpy as np from numpy import arange, pi, real, interp, floor, log, exp, sqrt from numpy.fft import fft from scipy.interpolate import interp1d plt.style.use('seaborn') def CallPriceHestonFFT(s_0,k,r,tau,z): # This function computes the Heston price of european call options ...
# external imports import numpy as np import matplotlib.pyplot as plt from scipy.linalg import block_diag # internal inputs from pympc.dynamics.discrete_time_systems import AffineSystem, PieceWiseAffineSystem from pympc.optimization.parametric_programs import MultiParametricQuadraticProgram, MultiParametricMixedIntege...
<reponame>TOPDyn/TOPDyn from time import time import numpy as np from scipy.sparse import csc_matrix, csr_matrix from scipy.sparse.linalg import spsolve from scipy import spatial def shapeH8(rrx, ssx, ttx): """ Linear Shape Functions and Derivatives. Args: rrx (:obj:`float`): Local coordinate of the e...
# %% [markdown] # # Bayesian Linear Regression # In this post I talk about reformulating linear regression in a Bayesian framework. # This gives us the notion of epistemic uncertainty which allows us to generate probabilistic model predictions. # I formulate a model class which can perform linear regression via Bayes r...
"""Evaluating DL models on M4 timeseries """ from darts import TimeSeries, SeasonalityMode from darts.models import Theta, FourTheta from darts.utils.statistics import check_seasonality, remove_from_series, extract_trend_and_seasonality from darts.utils import _build_tqdm_iterator from scipy.stats import boxcox, box...
# gate_factory.py """Contains factory functions for creating quantum gates.""" from cmath import exp from math import sqrt from numpy import array, eye, ones, zeros from quantum.quantum_gate import QuantumGate, tensor_power def x_gate(): """Factory method for Pauli-X gate (i.e. "not gate")""" return Quantum...
<filename>backend/backend/files/graph_utils.py import os import re import sys import numpy as np import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import scipy import zipfile import seaborn as sns def histogram(correlation_matrix,folder_path,bin_size = 0.10,img_format = 'png'): """! \brie...
# hspace_widget.py # # This file is part of scqubits: a Python package for superconducting qubits, # arXiv:2107.08552 (2021). https://arxiv.org/abs/2107.08552 # # Copyright (c) 2019 and later, <NAME> and <NAME> # All rights reserved. # # This source code is licensed under the BSD-style license found in the # ...
import glob as glb import sys import numpy as np from sklearn.decomposition import KernelPCA as pca_f import os import matplotlib as mpl mpl.use("WebAgg") import matplotlib.pyplot as plt from scipy.spatial.distance import pdist import scipy.cluster.hierarchy as sch import time import copy def genome_label(bed_file_li...
import sys sys.path.insert(0, "..") import crnt4sbml import numpy import sympy network = crnt4sbml.CRNT("../sbml_files/simple_biterminal.xml") signal = "C2" response = "s11" iters = 15 d_iters = 1000 bnds = [(2.4, 2.42), (27.5, 28.1), (2.0, 2.15), (48.25, 48.4), (0.5, 1.1), (1.8, 2.1), (17.0, 17.5), (92.4, 92.6), (0.0...
<filename>tests/test_fjs_names.py<gh_stars>1-10 from fractions import Fraction from typing import Callable import pytest from xenterval.ji import Monzo from xenterval.interval.name.fjs import FJS, FJSName def test_fjs_commas() -> None: commas_str = ( '80/81', '63/64', '33/32', '1053...
<gh_stars>0 import re import pandas as pd from scipy.stats import beta, entropy from scipy.special import loggamma, digamma import random import numpy as np # from compute_metrics import exp def exp(x, a=10): return 1 - (a ** (-1 * x)) def kl(p, q): return entropy([p, 1-p], [q, 1-q]) def fit_beta(data): ...
<reponame>MathPhysSim/PER-NAF<gh_stars>1-10 import logging.config import matplotlib.pyplot as plt import random import scipy.optimize as opt import gym import numpy as np # 3rd party modules import math from enum import Enum class simpleEnv(gym.Env): """ Define a simple environment. The environment define...
import datetime import pytz import pandas as pd import MetaTrader5 as mt5 import matplotlib.pyplot as plt import numpy as np import statistics as stats frame_MIN1 = mt5.TIMEFRAME_M1 frame_M5 = mt5.TIMEFRAME_M5 frame_M10 = mt5.TIME...
<gh_stars>10-100 import TimestampedUDPData_pb2 import google.protobuf.json_format import os import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import cv2 import numpy.linalg as la import scipy.stats as stats import TimestampedPacketMotionData_pb2 def sortkey(packet : TimestampedP...
<filename>src/eval_result_stats.py<gh_stars>0 import pandas as pd import numpy as np import os, sys from sklearn.metrics import mean_absolute_error, mean_absolute_percentage_error import numpy as np import math import scipy.integrate as integrate import scipy.special as special # from varname import nameof class CpEva...
import scipy as sp from scipy.linalg import eig, inv from ....caching import lru_cache from .liouvillian import compute_liouvillian PI = sp.pi dot = sp.dot diag = sp.diag exp = sp.exp ix_ = sp.ix_ @lru_cache() def make_calc_observable(time_t1=0.0, b1_offset=0.0, b1_frq=0.0, carrier=0.0, pp...
<filename>train_dae_curves.py # Martens reports the mse even though the optimized quantity is the likelihood. # Does he use multiply the error by .5? import theano import numpy as np import theano.tensor as T from optimizer import Model, krylov_descent from autoencoder import DAE import scipy.io as sio class Dataset:...
<reponame>UKPLab/ijcai2019-relis<filename>summariser/reward_learner/pref_rewarder.py import numpy as np import random from sklearn.linear_model import LogisticRegression from sklearn import svm import scipy.stats as stats from itertools import permutations from summariser.utils.evaluator import evaluateReward from sum...
import compare_performance import argparse from random import shuffle import statistics __author__ = 'buchholb' parser = argparse.ArgumentParser() parser.add_argument('--queryfile', type=str, help='One line per (standard) SPARQL query. TS specific transformations are made by t...
import matplotlib.pyplot as plt import pandas as pd import numpy as np from numpy import exp, abs, log from scipy.special import gamma, factorial from utils import * def cumulative_return(rt_v): return exp(np.sum(rt_v)) def plot_cumulative_return_history(concat_results, strategy_lst, figsize=(10,5)): plt.figu...
<reponame>FelSiq/statistics-related<gh_stars>1-10 # Cool video explaining this test: https://www.youtube.com/watch?v=CqLGvwi-5Pc&list=PLblh5JKOoLUIzaEkCLIUxQFjPIlapw8nU&index=6 import typing as t import numpy as np import scipy.stats import sklearn.linear_model def _check_X_y(X, y): X = np.asfarray(X) y = np...
import numpy as np import pytest import scipy.sparse as sp from lib.dataset import normalization as N def f(adj): C = len(adj) aug_adj = adj + np.eye(C) d_inv_sqrt = 1. / np.sqrt(aug_adj.sum(axis=1)) return d_inv_sqrt[:, None] * (aug_adj) * d_inv_sqrt @pytest.fixture def adj_simple(): return np...
from numpy import zeros,sqrt,linspace,unique from scipy import linalg #====================================================================== # python function to calculate element mass and stiffness matrices for # vertical bending given beam mass per unit span "m" (mass/length) and # flexural stiffness "EI" (Force l...