text
string
<filename>pymir/Spectrum.py<gh_stars>100-1000 """ Spectrum class ndarray subclass for spectral data Last updated: 17 December 2012 """ from __future__ import division import math import numpy from numpy import * import scipy.stats import scipy.stats.mstats import matplotlib.pyplot as plt import pymir from pymir im...
# coding: utf-8 # # Numerically solving differential equations with python # # *This is a brief description of what numerical integration is and a practical tutorial on how to do it in Python.* # ## Software required # # *In order to run this notebook in your own computer, you need to install the following softwar...
#!/usr/bin/env python # coding: utf-8 import pandas as pd import numpy as np from scipy.stats import chisquare from evidently.analyzers.base_analyzer import Analyzer from .utils import proportions_diff_z_stat_ind, proportions_diff_z_test, process_columns class CatTargetDriftAnalyzer(Analyzer): def calculate(sel...
__author__ = '<NAME>' __email__ = '<EMAIL>' __url__ = 'http://helderc.net' """ This is an improved implementation of SSIM, based on version of: <NAME>, ISIT lab, <EMAIL>, http://isit.u-clermont1.fr/~anvacava References: [1] <NAME>, <NAME>, <NAME> and <NAME>. Image quality assessment: F...
<reponame>anontruess/anonymous from scipy.optimize import linear_sum_assignment from sklearn.metrics import confusion_matrix import matplotlib.pyplot as plt import numpy as np import os import datetime import shutil import torch def save_checkpoint(state, fdir, name='checkpoint.pth'): filepath = os.path.join(fdir,...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Oct 23 21:11:01 2019 @author: nico """ from scipy.fftpack import fft from scipy.signal import correlate import scipy.signal as sg import numpy as np import sys """ brief: Esta funcio realiza el periodograma de una señal argumentos signal: es la seña...
import abc from typing import Dict, List, Tuple import numpy import torch from scipy.spatial.qhull import Delaunay from surrogates.drivers import Driver from surrogates.likelihoods.likelihoods import Likelihood from surrogates.utils.distributions import Distribution from surrogates.utils.numpy import add_parameter_di...
import numpy as np from scipy.stats import laplace import matplotlib.pyplot as plt fig, ax = plt.subplots(1, 1) mean, var, skew, kurt = laplace.stats(moments='mvsk') x = np.linspace(laplace.ppf(0.01), laplace.ppf(0.99), 100) ax.plot(x, laplace.pdf(x), 'r-', lw=5, alpha=0.6, label='laplace pdf'...
<filename>src/util/comp_result_generator.py from typing import List, Dict, Tuple from statistics import mean import sys import os from numpy.lib import math sys.path.append(os.getcwd()) import locale locale.setlocale(locale.LC_ALL, '') import src.util.plot as alnsplot import pandas as pd def get_intermediate(exp...
import numpy as np from .util import pad, make_windows, weights_to_laplacian import scipy.sparse def closed_form_laplacian(image, epsilon): h, w, depth = image.shape n = h * w indices = np.arange(n).reshape(h, w) neighbor_indices = make_windows(pad(indices)) # shape: h w 3 means = make_windo...
<reponame>dicai/stats_notebook # coding: utf-8 # In[184]: import numpy as np import pylab import scipy import seaborn as sns get_ipython().magic(u'matplotlib inline') get_ipython().magic(u"config InlineBackend.figure_format = 'retina'") # # Importance sampling # # We'll look at an example where we can compute the...
<gh_stars>0 # ALCe by <NAME> # Copyright (C) 2018 - Science and Technology Facility Council # 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 ...
<reponame>shwang/imitation-extern """Finite-horizon tabular Maximum Causal Entropy IRL. Follows the description in chapters 9 and 10 of <NAME>'s `PhD thesis`_. Uses NumPy-based optimizer Jax, so the code can be run without PyTorch/TensorFlow, and some code for simple reward models. .. _PhD thesis: http://www.cs....
# coding: utf-8 """ xgboost: eXtreme Gradient Boosting library Version: 0.40 Authors: <NAME>, <NAME> Early stopping by <NAME> """ from __future__ import absolute_import import os import sys import re import ctypes import platform import collections import numpy as np import scipy.sparse try: from sklearn.base ...
#!/hosts/linuxhome/scarab/eva2/Programs/miniconda3/bin/python #python3 import sys from itertools import combinations from euk_og_dict import * from scipy.spatial import distance ################################################ #get inter orthology distances of profiles ################################################...
<gh_stars>1-10 import numpy as np from LVMvSSGP_model_SV2_IP import LVMvSSGP import scipy.io as sio from time import time def extend(x, y, z = {}): dictx=dict(x.items()) dicty=dict(y.items()) dictz=dict(z.items()) dictx.update(dicty) dictx.update(dictz) return dictx pool, global_f, gl...
<gh_stars>0 ############################################################################### # Potential.py: top-level class for a full potential # # Evaluate by calling the instance: Pot(R,z,phi) # # API for Potentials: # function _evaluate(self,R,z,phi) returns Phi(R,z,phi) # for orbit integration you ne...
<gh_stars>1-10 from __future__ import unicode_literals, print_function, division, \ absolute_import import numpy as np from scipy.io import savemat from datutils.utils import load_dat, create_dat, BUFFER_SIZE BUF = BUFFER_SIZE def dat2wave_clus(datfile, outfile): data, params = load_dat(datfile) sr = params["...
#!/usr/bin/env python from LLC_Membranes.analysis.markov_state_dependent_dynamics import States, Chain from LLC_Membranes.timeseries.msd import Diffusivity from LLC_Membranes.llclib import file_rw from scipy.stats import levy_stable import matplotlib.pyplot as plt import numpy as np import argparse def initialize(): ...
<gh_stars>0 import funcs from copy import copy import os from skimage import io, transform, color from matplotlib import pyplot as plt import pandas as pd import numpy as np from matplotlib_scalebar.scalebar import ScaleBar from matplotlib import patches import uncertainties from uncertainties import unumpy as unp impo...
<filename>visu_images_all.py # -*- coding: utf-8 -*- """ Created on Fri Jul 29 10:02:40 2016 @author: rflamary """ import sys import numpy as np import scipy as sp import scipy.io as spio import matplotlib.pylab as pl import deconv def get_fname(method,n,npsf,sigma,img): return 'res/{}_{}x{}_PSF{}_sigma{:1.3f}...
import sys sys.path.insert(1,"/home1/07064/tg863631/anaconda3/envs/CbrainCustomLayer/lib/python3.6/site-packages") #work around for h5py from cbrain.imports import * from cbrain.cam_constants import * from cbrain.utils import * from cbrain.layers import * from cbrain.data_generator import DataGenerator import tensorflo...
# -*- coding: utf-8 -*- """ This enables to parameterize the contributivity measurements to be performed. """ from __future__ import print_function import bisect import datetime from itertools import combinations from math import factorial from timeit import default_timer as timer import numpy as np from loguru impo...
<gh_stars>0 # -*- coding: utf-8 -*- """ Created on Sun Jan 3 13:21:37 2021 @author: mclea """ import numpy as np import field as f from scipy.interpolate import griddata def jacobi_update(x, b, A, Rj, invD, nsteps=1, max_err=1e-3): """ Solves Ax=b """ # b_inner = b[1:-1, 1:-1].flatten() n = x.x...
import sympy as sp from toy import Model class Carbon(Model): """ A simple carbon model with 3 reservoirs: atmosphere, shallow oceans and deep oceans. Carbon simply flows between reservoirs and is conserved. In larger time scales, we would expect net carbon sinks due to rock weathering, build up...
<filename>run_script_pyg.py import json import pickle import statistics import time import argparse from os import listdir import torch import torch.nn.functional as F from torch.nn import Linear, Sequential, ReLU from torch_geometric.data import DataLoader from torch_geometric.nn import GCNConv, avg_pool, global_mean...
<reponame>mattzett/arcs_scen1 #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Mar 5 06:02:51 2021 Load GEMINI output corresponding to synthetic Poynting flux, current density (parallel), and electric field (perp.). Attempt to process the data into conductances @author: zettergm """ # imports im...
import numpy as np import scipy as sp def emd(x, nIMF = 3, stoplim = .001): """Perform empirical mode decomposition to extract 'niMF' components out of the signal 'x'.""" r = x t = np.arange(len(r)) imfs = np.zeros(nIMF,dtype=object) for i in range(nIMF): r_t = r is_imf = False...
import numpy as np from scipy.special import expit def mean_temperature(temperature, doy_series, start_doy, end_doy): """Mean temperature of a single time period. ie. mean spring temperature. Parameters ---------- temperature : Numpy array array of daily temperature values doy_series...
#!/usr/bin/python3 """ Perform Ordering-Dependency (OD) and Task-Consistency (TC) method. Composed by <NAME> @THU_IVG Last revision: <NAME> @THU_IVG @Oct 3rd, 2019 CST """ import argparse import os.path import pickle as pkl import json import scipy.io as sio import numpy as np import itertools import concurrent.fut...
import seaborn as sns from matplotlib import pyplot as plt import os from scipy.io import loadmat from seqnmf import seqnmf, plot data = loadmat(os.path.join('data', 'MackeviciusData.mat')) W, H, cost, loadings, power = seqnmf(data['NEURAL']) h = plot(W, H) h.show() sns.heatmap(data['NEURAL'], cmap='gray_r') plt.sho...
<reponame>PetteriPulkkinen/SMPyBandits<filename>SMPyBandits/Arms/Poisson.py # -*- coding: utf-8 -*- """ Poisson distributed arm, possibly truncated. Example of creating an arm: >>> import random; import numpy as np >>> random.seed(0); np.random.seed(0) >>> Poisson5 = Poisson(5, trunc=10) >>> Poisson5 P(5, 10) >>> Poi...
<gh_stars>0 from sympy import * h = symbols('h',positive=true) A = Matrix([[1 - h**2/2, -h/2*(2-h**2/2)],[h , 1-h**2/2]]) print("transition matrix") print(A) print("\n") ATA = A.adjoint()*A print("gram matrix") print(simplify(ATA)) print("\n") v1 = ATA.eigenvects()[0][2][0] v2 = ATA.eigenvects()[1][2][0] pri...
"""Module containing the processing steps of the cwEPR package. .. sidebar:: processing *vs.* analysis For more details on the difference between processing and analysis, see the `ASpecD documentation <https://docs.aspecd.de/>`_. A processing step always operates on a dataset and usually modifies the nu...
import json from collections import defaultdict import random import csv from sklearn.svm import LinearSVC from scipy import sparse from joblib import dump, load import numpy as np from sklearn.feature_extraction import DictVectorizer from sklearn.feature_extraction.text import TfidfTransformer from collections import...
import warnings import numpy as np from scipy.integrate import quad from scipy.interpolate import BSpline from randomvars.options import config # %% Array manipulations def _as_1d_numpy(x, x_name, chkfinite=True, dtype="float64"): """Convert input to one-dimensional numpy array Parameters ---------- ...
"""Comparing low vs. high dimensions/embeddings. Description ----------- import flameplot as flameplot scores = flameplot.compare(data1, data2) fig = flameplot.plot(scores) X,y = flameplot.import_example() fig = flameplot.scatterd(X[:,0],X[:,1],label=y) Requirements ------------ os numpy tqdm scipy imagesc...
<reponame>rinelson456/raven<gh_stars>100-1000 # Copyright 2017 Battelle Energy Alliance, LLC # # 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 # #...
<reponame>delos/dm-pta-mc<gh_stars>0 """ Handling custom density profile """ import numpy as np from scipy.interpolate import interp1d from scipy.integrate import cumtrapz from scipy.special import hyp2f1 from src.input_parser import read_form def prepare_form(form_path, verbose=False): """ Prepares in...
<filename>basic_robotics/kinematics/arm_model.py from ..general import tm, fmr, fsr from ..plotting.Draw import DrawArm, DrawRectangle from ..utilities.disp import disp import numpy as np import scipy as sci import scipy.linalg as ling import random import xml.etree.ElementTree as ET import os import json from os.path ...
<reponame>rudimeier/BrainStat import sys sys.path.append("python") from SurfStatPeakClus import * from SurfStatEdg import * import surfstat_wrap as sw import numpy as np import random from scipy.io import loadmat import pytest def dummy_test(slm, mask, thresh, reselspvert=None, edg=None): # Deal with edge offset....
# Computes the t-statistics on the whole experiment 1 dataset import math import csv from scipy import stats import numpy def tstat(x1, x2, s1, s2, n): ''' (float, float, float, float, int) => float Computes the t-statistic for two datasets. ''' t = (x1 - x2) / math.sqrt((s1**2 +s2**2)/n) ret...
"""Defines all the functions for plotting, allowing easier generation of results. Flexible, general functions remain a constant issue with plotting, so for more complex plots some tweaking may be needed. Examples of these functions can be found in the :ref:`plotting_page` guide. """ from pathlib import Path from iter...
<gh_stars>1-10 from __future__ import print_function from nltk.translate.bleu_score import sentence_bleu from nltk.translate.bleu_score import SmoothingFunction import sys import re import argparse import torch from util import read_corpus import numpy as np from scipy.misc import comb from vocab import Vocab, VocabEnt...
#!/usr/bin/env python3 import json import numpy as np import tkinter import requests as req from tkinter import * from tkinter import ttk from datetime import datetime #from scipy import optimize from scipy import signal from matplotlib.backends.backend_tkagg import ( FigureCanvasTkAgg, NavigationToolbar2Tk) # Im...
<filename>graphics.py # September 2020 #<EMAIL> #graphings tools for plume rise analysis import numpy as np import matplotlib.pyplot as plt import os.path from matplotlib import ticker from scipy.stats import linregress from scipy.interpolate import interp1d from mpl_toolkits.axes_grid1.inset_locator import inset_axes...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Jul 9 20:36:20 2020 @author: duttar Description : Reads the daily temperature data from DS633 catalog Calculates the Accumulated Degree Days of Thawing from the temperature data """ import numpy as np from netCDF4 import Dataset # http://code.googl...
<gh_stars>1-10 from importlib.util import find_spec from scipy.sparse import coo_matrix, vstack from numpy import matmul, isnan, clip from numpy.linalg import norm from math import ceil if find_spec('joblib') is not None: from joblib import Parallel, delayed, cpu_count DEFAULT_CPUS = -1 else: print('Could ...
<reponame>bmoretz/Python-Playground<filename>src/Mathematics/Calculus/Differential/ch_03/3.1.py import math from sympy import Symbol, Limit, Derivative, sympify, S, simplify, pprint, init_printing init_printing( order = 'rev-lex', use_unicode = True ) # 3.1.1 # h(t) = e^t + 2t^2 # simplify the expression: # ( h( 5 ...
<reponame>rsdefever/mosdef_slitpore import numpy as np import pandas as pd import matplotlib.pyplot as plt from scipy.ndimage.measurements import center_of_mass from scipy import stats import numpy as np def compute_density( traj, area, surface_normal_dim=2, pore_center=0.0, max_distance = 1.0, ...
<reponame>dezeraecox/GEN_cell_culture import os import matplotlib as mpl import matplotlib.pyplot as plt import matplotlib.ticker as tkr import numpy as np import pandas as pd import scipy.stats as stats import seaborn as sns from loguru import logger from matplotlib import rc from pandas_profiling import ProfileRepo...
<filename>vision/depth_camera/surface/bibspline_surface.py import scipy.interpolate as si import vision.depth_camera.surface._surface as sfc import numpy as np class BiBSpline(sfc.Surface): def __init__(self, xydata, zdata, degree_x=3, degree_y=3...
import subprocess import matplotlib as mpl import matplotlib matplotlib.use('Qt5Agg') import matplotlib.pyplot as plt import numpy as np import re import math, cmath from scipy.interpolate import griddata import os from femm import FEMM, FEMMfem, FEMMans from PyQt5.QtWidgets import QApplication, QMainWindow, QMenu, ...
#!/usr/bin/env python import rospy from std_msgs.msg import Int32 from geometry_msgs.msg import PoseStamped, Pose from styx_msgs.msg import TrafficLightArray, TrafficLight from styx_msgs.msg import Lane from sensor_msgs.msg import Image from cv_bridge import CvBridge from light_classification.tl_classifier import TLCla...
"""Various statistical helper functions""" import warnings import numpy as np from scipy import stats from scipy.special import ndtri from .due import due from . import references def one_way(data, n): """ One-way chi-square test of independence. Takes a 1D array as input and compares activation at each vox...
import os import sys import torch import numpy as np import scipy.misc as m import matplotlib.pyplot as plt import matplotlib.image as imgs from PIL import Image import random import scipy.io as io from tqdm import tqdm from scipy import stats from torch.utils import data from .utils import recursive_glob from augme...
# This is the image processing module, which I used to preprocess my images, augment my dataset, and # organize them into a structure suitable for input to a machine learning model from __future__ import print_function import matplotlib.pyplot as plt import numpy as np import os import sys import tarfile import tensor...
# License: BSD 3-clause # Authors: <NAME>, # <NAME> import numpy as np from numpy.lib.stride_tricks import as_strided import scipy.signal as sg from scipy import linalg, fftpack from numpy.testing import assert_almost_equal def rolling_mean(X, window_size): """ Calculate the rolling mean Parame...
import scipy from SloppyCell.ReactionNetworks import * import LeeNet reload(LeeNet) from LeeNet import net # Network that is at unstimulated fixed point net.set_var_ic('W', 0) traj1 = Dynamics.integrate(net, [0, 1e5], rtol=1e-12) unstimulated = net.copy('unstimulated') for var in unstimulated.dynamicVars.keys(): ...
<reponame>zmlabe/predictGMSTrate """ Create plot to show scores vs. number of hiatuses it trained on Author : <NAME> Date : 27 September 2021 Version : 2 (mostly for testing) """ ### Import packages import sys import matplotlib.pyplot as plt import matplotlib.colors as c import numpy as np import scipy.s...
<filename>src/test_mh_ggk.py<gh_stars>10-100 import unittest import qnet import qnetu import numpy import mytime import netutils import estimation import yaml import pwfun import sampling import arrivals import qstats import queues import test_qnet from scipy import integrate from numpy import random import gc impor...
from math import floor, ceil from scipy.stats import uniform, randint, norm, truncnorm, bernoulli, geom, hypergeom, poisson, zipf, triang from snake_eyes.distribution import add, mul from snake_eyes.from_rv import rv_continuous_class, rv_discrete_class from snake_eyes.support_space import DiscreteWholeSupportSpace ...
<reponame>merenlab/meren.github.io '''loop over a bam file and get the edit distance to the reference genome stored in the NM tag scale by aligned read length. works for bowtie2, maybe others. Adopted from https://gigabaseorgigabyte.wordpress.com/2017/04/14/getting-the-edit-distance-from-a-bam-alignment-a-journey/''' ...
<filename>fastface/metric/ar.py from pytorch_lightning.metrics import Metric from typing import List import torch from ..utils.box import jaccard_vectorized from scipy.optimize import linear_sum_assignment class AverageRecall(Metric): r"""pytorch_lightning.metrics.Metric instance to calculate average recall .. math...
<reponame>jm-begon/randconv # -*- coding: utf-8 -*- """ """ __author__ = "<NAME> <<EMAIL>>" __copyright__ = "3-clause BSD License" __date__ = "20 January 2015" import numpy as np import scipy.sparse as sps from sklearn.metrics import confusion_matrix from sklearn.ensemble import RandomTreesEmbedding from progressmo...
from pandas import Series,DataFrame import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn.cross_validation import train_test_split from sklearn.cluster import KMeans from sklearn import preprocessing import os from sklearn import datasets import sklearn.metrics as sm from sklearn.preproc...
# # Generates output .csv files from # import os import numpy as np import pandas as pd import scipy.io from typing import Dict from birdspy.image_factory import ImageFactory class OutputWriter: """Factory to generate ground truth images from a given annotation dataset. Currently only stores the number of...
<gh_stars>0 """spectrum is an array of data which defines a physical spectrum A Spectrum is a numpy array with an associated type which describes the physical quantity (e.g. wavelength, energy, etc.) and a unit for specifiying the SI unit of the spectrum (e.g. meter, electronVolt) """ import numpy as np import scipy.c...
<gh_stars>0 import warnings import numpy as np import pandas as pd from scipy import stats def _delta_mean(x, y): "Implemented as function to allow calling from bootstrap." return np.nanmean(x) - np.nanmean(y) def make_delta(assume_normal=True, percentiles=[2.5, 97.5], min_observations=20, n...
<gh_stars>1-10 from __future__ import print_function import sys import os from setuptools import setup, find_packages from distutils.extension import Extension from Cython.Build import cythonize from Cython.Distutils import build_ext with open('requirements.txt') as f: INSTALL_REQUIRES = [l.strip() for l in f.re...
import numpy as np import os import matplotlib as mpl import matplotlib.pyplot as plt import matplotlib.colors as colors from astropy.time import Time import matplotlib.dates as mdates from astropy.io import fits import numpy.ma as ma import matplotlib.cm as cm from mpl_toolkits.axes_grid1 import make_axes_locatable im...
from initialise_parameters import params, control_data, categories, calculated_categories, change_in_categories from math import exp, ceil, log, floor, sqrt import numpy as np from scipy.integrate import ode from scipy.stats import norm, gamma import pandas as pd import statistics import os import pickle from tqdm impo...
<filename>machine-learning-ex2/owns/myex2++.py<gh_stars>0 import numpy as np import pandas as pd import matplotlib.pyplot as plt #Scipy库中的optimiz可以实现matlab中fminunc的功能,来优化函数计算成本和梯度 import scipy.optimize as opt #高级处理分类的一个信息report from sklearn.metrics import classification_report as cr #=================visualizing data...
<gh_stars>1-10 import sys sys.path.insert(0, '../prog') from .psUtils import * import numpy as np import scipy.special class ReconstructFromPyramid: def __init__(self, pyr, indices, levels=-1, bands=-1, twidth=1): self._pyr = pyr if not isinstance(indices, np.ndarray): self._pInd = np...
<gh_stars>10-100 #!/usr/bin/env python # Test example to generate 2D (embedded in 3D) and 3D Delaunay triangulations that output to VTK import pyvtk import numpy as np from scipy.spatial import Delaunay # Generate the random points npoints = 1000 np.random.seed(1) x = np.random.normal(size=npoints)*np.pi y = np.rand...
#!/usr/bin/env python # coding: utf-8 # ### Level 4 - Normalized DMSO Profiles Cell painting data # # # #### The goal here: # # -- is to determine the median score of each compound per dose based on taking the median of the correlation values between replicates of the same compound. # # - Level 4 data - are replic...
from __future__ import print_function #!/usr/bin/env python # -*- coding: utf-8 -*- # ''' Copyright (c) 2016 <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...
# -*- coding: utf-8 -*- # import torch # import torch.nn.functional as F # from torch.autograd import Variable # import numpy as np # from math import exp # import math # def gaussian(window_size, sigma): # gauss = torch.Tensor([exp(-(x - window_size//2)**2/float(2*sigma**2)) for x in range(window_size)]) # r...
<filename>radmc-3d/version_0.41/python/radmc3dPy/miescat.py """This module contains functions for Mie-scattering and to write dust opacity files """ from __future__ import absolute_import from __future__ import print_function import traceback try: import numpy as np except ImportError: np = None print(' Nu...
<filename>samurai/main_fitlc_mcmc_EPOXI_NEW.py<gh_stars>1-10 import numpy as np import healpy as hp import emcee from scipy.optimize import minimize import sys import datetime import multiprocessing import os from pdb import set_trace as stop import h5py __all__ = ["run_lightcurve_mcmc"] from fitlc_params import NUM_...
# License: BSD 3 clause import unittest import numpy as np from scipy.optimize import check_grad, fmin_bfgs from scipy.linalg import norm from scipy.sparse import csr_matrix from tick.survival import SimuSCCS, ModelSCCS from tick.preprocessing import LongitudinalFeaturesLagger from tick.solver import SVRG from tick.pr...
# GPS L1Cp code construction # # Copyright 2018 <NAME> import numpy as np from sympy.ntheory import legendre_symbol chip_rate = 1023000 code_length = 10230 l1cp_params = { 1: (5111,412), 2: (5109,161), 3: (5108,1), 4: (5106,303), 5: (5103,207), 6: (5101,4971), 7: (5100,4496), 8: (5098,5), ...
import pandas import numpy import numpy.random import typing import itertools import matplotlib.pyplot import scipy.stats DataFrame = typing.TypeVar('pandas.core.frame.DataFrame') class Corpus(object): def __init__(self, design_file_name: str, participant_file_name: str, genealogy_levels: list, weights: list) -...
<filename>tests/zquantum/core/wip/circuits/_wavefunction_operations_test.py import pytest import sympy from zquantum.core.wip.circuits import MultiPhaseOperation import numpy as np class TestMultiPhaseOperation: @pytest.mark.parametrize( "wavefunction", [ np.array([1, 0, 0, 0]), ...
<filename>notebooks/brunel-alpha-nest.py #!/usr/env/bin python # -*- coding: utf-8 -*- # # brunel_alpha_nest.py # # This file is part of NEST. # # Copyright (C) 2004 The NEST Initiative # # NEST is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published b...
""" The Abel habit model: contrasting stability tests """ from scipy.stats import norm import numpy as np class AbelModel: """ Represents the model. """ def __init__(self, β=0.99, γ=2.5, ρ=-0.14, σ=0.002, x...
import numpy as np import pandas as pd from scipy import interpolate from scipy.stats import norm from scipy.optimize import curve_fit from matplotlib import pyplot as plt from scipy.stats import exponnorm #import seaborn as sns #from fitter import Fitter, get_common_distributions, get_distributions def gauss_flat(xva...
import numpy as np from scipy.stats import kendalltau import pandas as pd def dividend_pricing(num_days, amount, completeness, position): """ Function is used to calculate "priced in" dividends in daily historical prices. As no strict model is established for dividend pricing, this is my own ...
import string import numpy as np from scipy.constants import codata from scipy.fftpack import fft, ifft eV = codata.value("electron volt") me = codata.value("electron mass") * 1e15 # convert to pico grams hbar = codata.value("Planck constant over 2 pi") * 1e27 # convert to pico-compatible values clas...
""" Prototyping some approaches for local orthogonalization """ from __future__ import print_function import numpy as np from stompy.grid import unstructured_grid from stompy.utils import (mag, circumcenter, circular_pairs,signed_area, poly_circumcenter, orient_intersection,array_append,wit...
import numpy as np import os import h5py import json from .utils import asymptotic_error_quantile, bootstrap,\ dict_to_margins, margins_to_dict, matrix_to_list from sklearn.utils import check_random_state from scipy.stats import gaussian_kde, norm from .vinecopula import Conversion class ListDependenceResult(li...
<gh_stars>0 """An array context with profiling capabilities.""" __copyright__ = """ Copyright (C) 2020 University of Illinois Board of Trustees """ __license__ = """ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to de...
<filename>pySPACE/missions/nodes/base_node.py """ Skeleton for an elemental transformation of the signal This includes some exception and metaclass handling, but the most important part is the :class:`~pySPACE.missions.nodes.base_node.BaseNode`. .. note:: This module includes a reimplementation of the MDP node cl...
# Using convolutions in numpy import numpy as np from scipy.ndimage import convolve from itertools import combinations def read_file(test = True): if test: filename = '../tests/day20.txt' else: filename = '../input/day20.txt' with open(filename) as file: image = list() for ...
<gh_stars>1-10 ################################################################################ # Github: https://github.com/MaxInGaussian/GomPlex # Author: <NAME> (<EMAIL>) ################################################################################ import random import numpy as np import numpy.random as npr fr...
<gh_stars>0 import numpy as np from scipy import stats import random import matplotlib.pyplot as plt n = 10 arms = np.random.rand(n) eps = 0.3 def reward(prob): reward = 0; for i in range(10): if random.random() < prob: reward += 1 return reward #initialize memory array; has 1 row de...
# -*- coding: utf-8 -*- """ Created on Tue Oct 5 17:56:11 2021 v0.8 28Oct21 @author: <NAME> CHANGE POINT DETECTOR This module takes a time series and returns the uunderlying linear trend and changpoints. It uses EVT as described in https://www.robots.ox.ac.uk/~sjrob/Pubs/LeeRoberts_EVT.pdf INSTRUCTIONS:...
# https://www.facebook.com/abhi.sensharma/posts/1241788872853419 # Subscribed by <NAME> # Polar coordinates problem solution # Enter your code here. Read input from STDIN. Print output to STDOUT import cmath # input is of type complex c = complex(input()) # cmath.polar(x) returns a pair (abs(x), phase(x)) # * prefix...
""" Script calculates comparisons of T2M with SIT from LENS. Note the first part regrids on 1x1 degree grid for comparison with LENS SIT Notes ----- Author : <NAME> Date : 22 February 2017 """ ### Import modules import numpy as np import matplotlib.pyplot as plt import datetime import scipy.stats as sts i...
<reponame>rgautam95/seislib<filename>seislib/an/an_attenuation.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: <NAME> @email1: <EMAIL> @email2: <EMAIL> """ import os import itertools as it from collections import defaultdict from types import GeneratorType import gc import numpy as np from numpy.fft im...