text
string
<reponame>hrichstein/phys_50733<filename>rh_hw6/richstein_hw6_prob1b.py """ Student Name: <NAME> Professor Name: Dr. Frinchaboy Class: PHYS 50733 HW 6: Nonlinear Pendulum - Leapfrog Method Last edited: 24 April 2017 Overview: --------- Input: ------ Output: ------- """ # Importing Needed Modules import numpy a...
<filename>active_semi_clustering/active/pairwise_constraints/min_max.py<gh_stars>1-10 import numpy as np from scipy.spatial.distance import cdist, pdist from .example_oracle import MaximumQueriesExceeded from .explore_consolidate import ExploreConsolidate class MinMax(ExploreConsolidate): ''' More intellige...
<gh_stars>0 import torch, os from statistics import mean from itertools import takewhile from _train import jieba_train from _train import bert_train from _train import print_data USE_CUDA = torch.cuda.is_available() device = torch.device("cuda" if USE_CUDA else "cpu") def train_evaluation(data_mode, data_...
<filename>draw.py<gh_stars>1-10 import os import numpy as np def process(filename): '读取文件,并且输出数据位置,与处理好的横纵坐标数据' data = [] with open (filename,encoding = 'UTF-8', errors = 'ignore') as lines: for line in lines: line = line.split()#按制位符将数据分割 data.append(line)#读取的文件付给dat...
#<EMAIL> 02/20/2018 import numpy as np from scipy.optimize import bisect class PyCFD: def __init__(self, params): self.sample_interval = params['sample_interval'] self.delay = int(params['delay']/self.sample_interval) self.fraction = params['fraction'] self.threshold = params['t...
<reponame>PacktPublishing/Building-Practical-Recommendation-Engines-Part-2 # -*- coding: utf-8 -*- """ Created on Wed Nov 30 22:36:10 2016 @author: Suresh """ import pandas as pd import numpy as np import scipy import sklearn path = "C:/RND/RecoEngine/anonymous-msweb.test.txt" raw_data = pd.read_csv(path,header=None...
<gh_stars>1-10 from sympy import symbols from homogeneous import * def main(): a, b, c, d, e, f, g, h, k, m, n, p, q = symbols('a, b, c, d, e, f, g, h, k, m, n, p, q') A, C, E, B, D = (a, 0, b), (c, 0, d), (e, 0, f), (0, g, h), (k, m, n) # The dual theorem is also proved when lines ACE are parallel. # ...
import csv import statistics from collections import defaultdict as dd def parse_data(filename): #initialize list of valid years and months to use for checking valid_years = ["2010", "2011", "2012", "2013", "2014"] valid_months = ["JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "...
#!/usr/bin/env python3 # Project : From geodynamic to Seismic observations in the Earth's inner core # Author : <NAME> # Seismic properties of material as function of ka (adimensional frequency): P and S wave velocity and attenuation. # Please refer to Calvet and Margerin 2008 (figures 3 and 4) from __future__ import...
<reponame>ed-ortizm/autoencoders-outlier-detection import numpy as np from scipy.stats import norm, gamma, uniform, expon, entropy ############################################################################### class KLD: """ Compute Kullback-Leibler Divergence (KLD) between samples of a distribution and a...
import pickle import numpy as np from util.editdistance import lcsdistance from scipy.cluster.hierarchy import linkage, dendrogram from scipy.spatial.distance import squareform import matplotlib.pyplot as plt from scipy.cluster.hierarchy import fcluster import random # Borg pattern for EZ singletons https://python-3-p...
<filename>datafactory/preprocessing/outlier_detecting.py import pandas as pd from scipy.stats import iqr from sklearn.ensemble import IsolationForest from sklearn.neighbors import LocalOutlierFactor import sys sys.path.append('../util') from ..util.constants import logger def outlier_detection_dataframe(df: pd.DataFr...
<filename>Bio-StrongHold/src/The_Wright_Fisher_Model_of_Genetic_Drift.py from scipy.misc import comb with open('data/data.dat') as input_data: N,m,g,k = [int(num) for num in input_data.read().strip().split()] # Determine the probabiliy of a given of recessive allels in the first generation. # Use a binomial random v...
<filename>project.py # <NAME>, 20-April-2018 # Analysis of the Iris Flower Data Set # Adapted from http://archive.ics.uci.edu/ml/machine-learning-databases/iris/ print("Petal Length", "Petal Width", "Sepal Length", "Sepal Width") # Column headings with open ("Data/iris.csv") as f: # Link the csv file for line i...
#encoding: utf-8 import math import numpy as np from sympy import * Nm=8 def get_Amount_of_Motif(): array=open('./data2/CountMotif.csv').readlines() matrix=[] for line in array: line=line.strip('\r\n').split(',') line=[int(x) for x in line] matrix.append(line) matrix=np.array...
<filename>CalculateError.py # Name: <NAME> # NUSP: 10276675 # SCC0251 - Image Processing # Project: Segmentation of Cell Cycles Images # 2021/1 import ImagePreprocessing from scipy import stats import numpy as np import os import imageio import cv2 def convertLuminance(img): """ Convert to Grayscale using Lu...
""" Diagnostics for MCMC methods ================================== This notebook illustrates the use of a few diagnostics for :class:`.MCMC`. The example consists in learning the parameters of a regression model via Bayesian inference. """ # %% md # # Import the necessary libraries. # %% from UQpy.sampling import...
<gh_stars>0 #Algoritm of Gamp from autograd.differential_operators import jacobian import matplotlib.pyplot as plt import numpy as np import pandas as pd from scipy.optimize import minimize from autograd import elementwise_grad as egrad from autograd import grad # This function open window for search loca...
import csv import json import logging import multiprocessing as mp import os import sys import scipy import pandas as pd import daisy import numpy as np from lsd import local_segmentation from pymongo import MongoClient from scipy.spatial import KDTree import pymaid from . import database, synapse, evaluation logger...
from unittest import TestCase import numpy as np from scipy.stats import truncnorm from copulas.univariate import GaussianKDE, GaussianUnivariate, TruncatedGaussian from copulas.univariate.selection import select_univariate class TestSelectUnivariate(TestCase): def setUp(self): size = 1000 np.r...
from numpy import (abs, array, eye, rint) # from scipy.linalg import lu, svd from sympy import acos, cos, pi, sin, sqrt, Rational def round_if_safe(val, atol): ival = rint(val) if abs(ival - val) < atol: return int(ival) else: return val def rotx(theta): c = cos(theta) s = sin(t...
# -*- coding: utf-8 -*- # ------------------------------------------------------------------ # Filename: <filename> # Purpose: <purpose> # Author: <author> # Email: <email> # # Copyright (C) <copyright> # -------------------------------------------------------------------- """ :copyright: <copyright> :licen...
<reponame>suchyta1/BalrogReconstruction #!/usr/bin/env python import numpy as np from numpy import recarray from scipy import linalg as slin import sys import esutil import matplotlib as mpl import matplotlib.pyplot as plt from matplotlib.ticker import MultipleLocator, FormatStrFormatter def generateTr...
<filename>widget_creation.py import numpy as np import pandas as pd from scipy import stats idx = pd.IndexSlice from os import getcwd,listdir import matplotlib.pyplot as plt from random import shuffle, sample, seed import seaborn as sns from random import seed, sample, shuffle from matplotlib.lines import Line2D import...
<reponame>emdodds/DictLearner # -*- coding: utf-8 -*- """ Created on Fri Dec 11 22:33:12 2015 @author: Eric """ import scipy.io as io import LCALearner import numpy as np import sys import pca.pca sys.modules['pca'] = pca.pca import matplotlib.pyplot as plt plt.ioff() overcompleteness = 0.5 numinp...
<reponame>n-yoshikawa/automatic-differentiation-SCF<gh_stars>1-10 import time import numpy import matplotlib.pyplot as plt from pyscf import gto, scf, ao2mo import scipy from scipy.optimize import minimize import jax.numpy as jnp from jax import grad, jit, random from jax.config import config config.update("jax_enab...
<filename>startup/41-ESM_motion.py import IPython import numpy as np import pandas as pd import matplotlib.pyplot as plt from scipy.interpolate import interp1d import scipy.optimize as opt import os from bluesky.plans import scan, adaptive_scan, spiral_fermat, spiral,scan_nd from bluesky.plan_stubs import abs_set, mv ...
<gh_stars>1-10 # -*- coding: utf-8 -*- """ Created on Wed Jul 06 12:33:31 2016 @author: <NAME> """ import math import numpy as np from scipy import polyfit, polyval import matplotlib.pyplot as plt from xfoil_module import output_reader # Wire properties rho = 3.55041728247e-06 A = math.pi*(0.000381/2.)**2 L = math.s...
<reponame>bmorris3/catastropy from copy import copy from itertools import zip_longest from concurrent import futures as cf import numpy as np from scipy.stats import gamma, nbinom from numba import njit __all__ = ['abc', 'compute', 'simulate_outbreak'] @njit def sample_nbinom(n, p, size): nb = np.zeros(size) ...
<reponame>VDelv/Emotion-EEG<filename>Utils_Bashivan.py ''' Created by <NAME> This code has been created by p. bashivan source : https://github.com/pbashivan/EEGLearn ''' __author__ = '<NAME>' import numpy as np np.random.seed(123) import scipy.io from scipy.interpolate import griddata from sklearn.pr...
#!/usr/bin/env python3 import sys import os import argparse import matplotlib.pyplot as plt import pandas as pd import math import numpy as np import scipy.stats import h5py import json # import seaborn as sns # from matplotlib import cm # from matplotlib.colors import ListedColormap, LinearSegmentedColormap colors =...
"""Defines N-1 dimensional surfaces in N-dimensional space. All surfaces are represented by a Mesh with points and connections (i.e. line segments or triangles) between those points. """ import numpy as np from scipy import sparse, linalg from nibabel import freesurfer, spatialimages, gifti import nibabel as nib from ...
<filename>client/read_data.py import numpy import pandas as pd import pickle from sklearn.model_selection import train_test_split from sklearn.preprocessing import normalize, StandardScaler, LabelEncoder import keras import sys import numpy as np import scipy import scipy.io from keras.utils import to_categorical impor...
from __future__ import annotations from typing import List, Optional from typing import final import numpy as np import scipy.linalg import pyccl import sacc from ..likelihood import Likelihood from ...updatable import UpdatableCollection from .statistic.statistic import Statistic from ...parameters import ParamsMap,...
<gh_stars>1-10 # import some modules import filter_env from ddpg import * import gc gc.enable() #import math and ros modules import roslib import rospy import rostopic import random import time import math import csv from std_srvs.srv import Empty from gazebo_msgs.srv import SetModelConfiguration #import some msgs ty...
# -- coding: utf-8 -- # Copyright 2018 <NAME> <<EMAIL>> """ Helper functions to handle spectras. """ def get_substance_peaks(substance, negative=True): import os import sqlite3 DB_PATH = os.path.join(os.path.abspath(os.path.join(__file__,"../..")),"data", "elements.db") conn = sqlite3.connect(DB_PATH...
<filename>jetset/template_2Dmodel.py __author__ = "<NAME>" from scipy import interpolate import numpy as np from astropy.units import Unit as u from astropy.units import spectral from astropy.table import Table import os from .plot_sedfit import PlotSED,PlotSpectralMultipl from .model_parameters import ModelP...
<gh_stars>0 #!/usr/bin/env python import os import glob import sys import shutil import re from argparse import ArgumentParser import pandas as pd import numpy as np import math import matplotlib.pyplot as plt sys.path.insert(0,'..') import ESM_xsec_setup_inputs import ESM_utils as esm from scipy.optimize import ...
#!/usr/bin/env python # Run using python3 N50_Calculator <Input Path> <GenomeSize (Optional)> import sys import os import scipy def file_parser(file_path): # Parses a txt file to consolidate all the contig lengths into a list # txt file must contain contigs on seperate lines for this parsing func to work o...
from __future__ import division import os.path as op from itertools import product import numpy as np import pandas as pd import nibabel as nib from scipy.signal import periodogram import pytest from pytest import approx from .. import glm def assert_highly_correlated(a, b, thresh=.999): corr = np.corrcoef(a.f...
# Copyright (c) <NAME>. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory. import ray import os import sys import math import random import time import ctypes as ct import multiprocessing as mp from multiprocessing import Process from numpy.random import Generato...
<gh_stars>0 #!/usr/bin/python # -*- coding: utf-8 -*- ''' Created on Dec 4, 2014 @author: jwe ''' import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np from numpy import array from scipy import interpolate wifsipqe = array([[300, 0.675], [320, 0.725], [340, 0.66], [350, 0.62], [36...
import numpy as np import scipy.misc from du.preprocessing.image2d import affine_transform from du._test_utils import (numpy_almost_equal, equal, numpy_allclose, numpy_not_allclose, numpy_not_almost_equal) ...
<reponame>masterdesky/ELTE_Digit_Lab_2018 from numpy import convolve, mean, sin, pi from pylab import find def radar_korkep(fn, dphi = .015, s_chirp = 9.5, n_chirp = 3, noise_percentile = .99, trig_thresh = .8, cut_sample = .75): """ param fn: filename (*.wav) param dphi: egy lepes param trig_thresh: simitott trig...
<filename>lib/linalg.py # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # written by <NAME> (<EMAIL>) while at Facebook. from __future__ import print_function import scipy.sparse.linalg as l...
<reponame>19katz/matching from scipy.spatial import distance from collections import Counter from typing import Dict, List, Tuple import numpy as np import pandas as pd import random import copy # random.seed(42) np.set_printoptions(suppress=True) # import itertools def mini_sheet(matchesFile: str, n_suiteds: int, m_...
import unittest from functools import partial import numpy as np from scipy import stats from pyapprox.arbitrary_polynomial_chaos import \ compute_moment_matrix_from_samples, APC, FPC, \ compute_moment_matrix_using_tensor_product_quadrature, \ compute_grammian_matrix_using_combination_sparse_grid, \ c...
<gh_stars>1-10 import os import csv import numpy as np from Bio.motifs import transfac from scipy.stats import pearsonr, spearmanr def motif_compare(args): """Compare PSSMs of filter motifs.""" # create output directory if not os.path.exists(args.out_dir): os.makedirs(args.out_dir) # load tra...
<filename>smarts/core/smarts.py # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # # 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 witho...
<filename>fibonacci.py import sys try: import math import sympy as sym from sympy import sin,cos,tan,N except: print("Packages not installed. Please install 'sympy' package") sys.exit() print("Fibonacci search method") x = sym.Symbol('x') def substitute(k): return (f.subs(x,k)) ...
#!/usr/bin/env python3 import numpy as np import random import math from scipy import signal import imageio from skimage import segmentation as seg import matplotlib.pyplot as plt from PIL import Image from skimage import transform from collections import Counter from scipy import signal, ndimage from skimage import mo...
<filename>tests/test_repet.py #!/usr/bin/env python # -*- coding: utf-8 -*- import unittest import nussl import numpy as np import scipy.io import os class TestRepet(unittest.TestCase): @staticmethod def _load_final_matlab_results(): back_path = os.path.join('repet_reference', 'repet_matlab_results', ...
<gh_stars>1-10 from numpy import min, max, asarray, percentile, zeros, exp, unravel_index,\ ones, dot, where, round, reshape, r_, ix_, arange, nan_to_num, argmax,\ prod, mean, sqrt, repeat, allclose, any, outer, unique, hstack, isnan from numpy.linalg import norm from numpy.random import randint from scipy.sign...
import numpy as np from scipy.linalg import expm import pymctdh.units as units from .optools import matel from .cy.wftools import norm,inner def lanczos(A, nel, nmodes, nspfs, npbfs, ham, uopips, copips, spfovs, nvecs=5, return_evecs=True): """ """ # thing to store A tensors V = np.zeros(n...
<filename>XRDXRFutils/spectra.py from numpy import loadtxt,arctan,pi,arange,array, asarray, linspace, zeros from matplotlib.pyplot import plot from .utils import snip,convolve import xml.etree.ElementTree as et from scipy.interpolate import interp1d from .calibration import Calibration class Spectra(): def __init...
# coding: utf-8 from __future__ import print_function import os from functools import partial import numpy as np from scipy.interpolate import interp1d def get_filepath(base_path, driver, period, post_amp, tube_r, exp_fac): if exp_fac is not None: data_dir = os.path.join(base_path, '%s/%s_%s_%s_%s/'%(dr...
# -*- coding: utf-8 -*- # (c) 2017-2018, ETH Zurich, Institut fuer Theoretische Physik # Author: <NAME> <<EMAIL>> """ Defines constants which are useful for creating orbitals. """ from fractions import Fraction from ._orbitals import Spin __all__ = ['WANNIER_ORBITALS', 'SPIN_UP', 'SPIN_DOWN', 'NO_SPIN'] WANNIER_OR...
#!/usr/bin/python3 ## dependencies from pylab import * import matplotlib as mplt import numpy as np import matplotlib.pyplot as plt import os import math import argparse from module_getarg import getarg from argparse import RawTextHelpFormatter # this is to ignore warnings import warnings warnings.filterwarnings("ig...
# Test script for comparing GMM integrator to existing mcsampler integrator in # RIFT. A simple n-dimensional integrand consisting of a highly-correlated # Gaussian is used. from __future__ import print_function import numpy as np from scipy.stats import multivariate_normal from scipy.stats import truncnorm import mat...
<gh_stars>0 import matplotlib # reset defaults matplotlib.rcParams.update(matplotlib.rcParamsDefault) # matplotlib.rcParams['font.sans-serif'] = "Arial" # matplotlib.rcParams['font.family'] = "sans-serif" #matplotlib.rcParams['axes.linewidth'] = 0.3 matplotlib.rcParams["axes.labelcolor"] = "black" matplotlib.rcParam...
import numpy as np import scipy.integrate as integrate import control import matplotlib.pyplot as plt import controlinverilog as civ def ise(time, error): return integrate.trapz(error*error, time) def ramp_tracking_optimization_tuning_example(): s = control.TransferFunction.s ratio = 0.1 wn = 2*np.pi*...
#!/usr/bin/env python import sys, pdb import sqlalchemy as sa from sqlalchemy.orm import Session from sqlalchemy.ext.declarative import declarative_base #from pisces.io.trace import read_waveform from obspy.core import UTCDateTime from obspy.core import trace from obspy.core import Stream from obspy.core.util import ...
import argparse import gc import json import logging from pathlib import Path import feather import numpy as np import lightgbm as lgb import pandas as pd from scipy import sparse as sp from tqdm import tqdm import config as cfg from predictors import GBMFeatures, GBMPredictor from utils import ( ProductEncoder, ...
######## IMPORTS ######## # General purpose imports import numpy as np import os import scipy from lumopt import CONFIG # Optimization specific imports from lumopt.utilities.load_lumerical_scripts import load_from_lsf from lumopt.geometries.polygon import function_defined_Polygon from lumopt.figures_of_merit.modematc...
import math import logging import torch import torch.nn as nn from torch.nn import functional as F from scipy.ndimage import gaussian_filter as G from scipy.signal import argrelextrema import numpy as np # logger = logging.getLogger(__name__) def calc_db(keypoints_seqs): # keypoints_seqs = keypoints_seqs.data.c...
<filename>scripts/esrm20_total-repl-cost_vulnerability_postprocess.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Jul 17 19:04:01 2021 @author: helencrowley """ import glob import os import pandas as pd import numpy as np from scipy import stats #%% read list of typologies from capacity curves ...
<reponame>Morrighan89/Python-In-The-Lab_Project # coding: utf-8 # # Python-in-the-lab: function and data fitting # In[42]: import os import numpy as np import scipy.integrate as integrate import matplotlib.pylab as plt from scipy.optimize import curve_fit parameters3p = ["gamma", "A1", "A2"] def fitShape3p(x, gamm...
# Python 2-to-3 compatibility code from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from collections import namedtuple try: import qutip as qu except ImportError: qu = None import numpy as np import scipy.const...
<reponame>mshobair/invitro_cheminformatics import pandas as pd import scipy.stats as stats ## this only works for toxprints chemotypes can change this to work with any set of fingerprints ##create and fill final_table def generate_final_table(my_enrichment_table,full_table): column_names = ['Fingerprint_ID','TP...
# -*- coding: utf-8 -*- """ FHWwallDesignSCR This script finds the value of the force required to mantain stability of a slope (Preqd), maximizing the failure surface's angle (alpha) and the d/H relation (xi). Additionally, calculates the safety factor of the sliding wedge that was found by the FHWA's simplified meth...
from asist.utility import power_spectrum from datetime import datetime, timedelta import matplotlib.pyplot as plt import numpy as np import pandas as pd from scipy.signal import detrend from scipy.stats import beta from sustain_drag_2020.irgason import read_irgason_from_toa5, rotate from sustain_drag_2020.udm import re...
import pdb import numpy as np import scipy as sp import scipy.optimize as op import util import matplotlib.pyplot as plt import time # Laplace Inference ----------------------------------------------------------- def negLogPosteriorUnNorm(xbar, ybar, C_big, d_big, K_bigInv, xdim, ydim): xbar = np.ndarray.flatten...
<reponame>PacktPublishing/Practical-Machine-Learning # Practical Machine learning # Clustering based Analysis - K-Means Clustering example # Chapter 8 import pandas as pd from sklearn.cross_validation import train_test_split data = pd.read_csv('household_power_consumption.txt', delimiter=';') power_consumption = dat...
<filename>pandas_help/pandas_module.py<gh_stars>0 import pandas as pd #%% ''' if you want to read a txt or any other files as pandas use below code: data = pd.read_csv(file, sep='\t', comment='#', na_values=['Nothing']) ''' #%% ''' pickle is used for saving python objects with the concept of serializing and des...
import numpy as np from scipy.signal import convolve def parse_data(): with open('2020/17/input.txt') as f: data = f.read() return np.array( [[int(value == '#') for value in line] for line in data.splitlines()] ) def conway_cubes(data, dimensions): kernel = np.ones((3,) * dimensions...
#------------------ #Contour Size extractor #<NAME> # #writes contours to pickle files given a mojo folder #7/30/13 #------------------ import sys import h5py import numpy as np import glob import os import pickle import math import time import cv2 import threading from Queue import Queue import Polygon import scip...
<reponame>PyCubed-Mini/GNC # -*- coding: utf-8 -*- """ Created on Wed Oct 9 11:53:17 2019 @author: <NAME> @description: example script for calling and testing dynamics/kinematics functions """ from euler import quat2DCM, get_attitude_derivative, get_q_dot, get_w_dot import matplotlib.pyplot as plt from mpl_toolkits...
<reponame>novoalab/mpileup2stats<gh_stars>0 #!/usr/bin/env python import sys import numpy as np from scipy.stats import mannwhitneyu def mann_whitney_test (list1,list2): ary1 = np.array(list1) ary2 = np.array(list2) return mannwhitneyu(ary1,ary2) def cal_man_whitney_z_score (samp1, samp2): s1_len = sa...
from abc import ABCMeta from abc import abstractmethod import numpy as np import scipy as sp import scipy.sparse import random from scipy.sparse.linalg import eigs from scipy.sparse import coo_matrix class UndirectedGraph(metaclass=ABCMeta): """ Use a doubly stochastic mixing matrix to represent an undirected...
<reponame>bondgeodima/first<filename>sas_planet_cache.py<gh_stars>0 from maptiler import GlobalMercator import os import sqlite3 from sqlite3 import Error import io from PIL import Image import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np import skimage.io import sys import mrcnn.mod...
from statistics import NormalDist import dataclasses from typing import Iterable import numpy as np class OrderUpToNormal: def fit(self, demand: Iterable): self.normal_distribution = NormalDist.from_samples(demand) return self def predict( self, current_inventory: int, ...
<reponame>ecaruyer/qspace<filename>qspace/sampling/multishell.py from __future__ import division from scipy import optimize as scopt import numpy as np def equality_constraints(vects, *args): """ Spherical equality constraint. Returns 0 if vects lies on the unit sphere. Parameters ----------...
<gh_stars>0 import matplotlib.pyplot as plt import matplotlib.ticker as mtick import numpy as np from scipy.stats import norm # Create an array of points to use as the x-coordinates for plotting the normal distribution x_min = norm.ppf(0.00005) # we will plot 99.99 % of the normal curve. x_max = norm.ppf(0.99995) x =...
<filename>craftroom/twod.py '''tools for dealing with 2D arrays (images), or 3D arrays of images.''' import numpy as np import scipy.ndimage import matplotlib.pyplot as plt try: from .displays.ds9 import ds9 except ImportError: def ds9(): raise NameError("This is a kludge, because ds9 couldn't be import...
<gh_stars>1-10 import sys import json import numpy as np from scipy import signal import time def butter_highpass_filter(data, cutoff, fs, order=5): nyq = 0.5 * fs normal_cutoff = cutoff / nyq b, a = signal.butter(order, normal_cutoff, btype='high', analog=False) filt_data = signal.filtfilt(b, a, data)...
"""Print an input number into a series.""" from sympy import Symbol, pprint, init_printing def print_series(n, x_value): """Print the series. x + x**2 + X**3 +... + x**n _ _ _ 2 3 n """ init_printing(order='rev-lex') x = Symbol('x') series = x ...
<filename>moirai/webapi/api.py # -*- 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, including without limitation the r...
<gh_stars>0 import os import time import numpy as np from tqdm import tqdm import scipy.stats import pandas as pd import matplotlib # Force matplotlib to not use any Xwindows backend. matplotlib.use('Agg') import matplotlib.pyplot as plt import argparse import tensorflow as tf from tensorflow import keras import mode...
<filename>jp.atcoder/code-festival-2014-morning-easy/code_festival_morning_easy_c/31219820.py import sys import numpy as np import scipy.sparse def main() -> None: n, m, s, t, *latter = map(int, sys.stdin.read().split()) x, y, d = np.array(latter).reshape(m, 3).T csgraph = scipy.sparse.csr_matrix(...
import concurrent import contextlib import itertools import logging import os import pickle import statistics import time from abc import ABC, abstractmethod from functools import wraps import math import numpy as np import scipy.fft as fft import torch from pyinsect.collector.NGramGraphCollector import ( ArrayGra...
<filename>tests/atom_expr_test.py from .context import assert_equal import pytest from sympy import Symbol, Integer, Pow # label, text, symbol_text symbols = [ ('letter', 'x', 'x'), ('greek letter', '\\lambda', 'lambda'), ('greek letter w/ space', '\\alpha ', 'alpha'), ('accented letter', '\\overline{x...
<filename>tests/test_propagation.py<gh_stars>0 """Tests for propagation sub-module.""" import matplotlib.pyplot as plt import numpy as np import pytest import scipy.constants as sc import skrf as rf from pytest import approx import waveguide as wg # Test against examples in Pozar -------------------------...
<filename>kmeans_from_scratch.py import pandas as pd #Loading the required modules import numpy as np from scipy.spatial.distance import cdist from sklearn.datasets import load_digits from sklearn.decomposition import PCA import matplotlib.pyplot as plt K = 10 N_iter = 10 cluster = {} data = load_digits().data dat...
<gh_stars>10-100 import torch import argparse import torch.nn.functional as F import statistics import utils from loaders.mms_dataloader_meta_split_test import get_meta_split_data_loaders import models from metrics.dice_loss import dice_coeff from metrics.hausdorff import hausdorff_distance # python inference.py -bs 1...
import pytest from hypothesis import given, assume from hypothesis.strategies import sampled_from, decimals, floats, fractions, integers from fractions import Fraction as Frac import omk_core as omk denominators = [2**n for n in range(1, 10)] @given(integers(1,100), sampled_from(denominators)) def test_str(n, d): ...
<filename>nasws/cnn/policy/cnn_general_search_policies.py<gh_stars>1-10 # ======================================================== # CONFIDENTIAL - Under development # ======================================================== # Author: <NAME> with email <EMAIL> # All Rights Reserved. # Last modified: 2019/11/27 下午...
<filename>code/Sparse_Dense matrix.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Dec 7 15:05:31 2019 @author: quert """ import numpy as np from numpy import array # Dense matrix -> Sparse matrix from scipy.sparse import csr_matrix # Create dense matrix A = array([[1, 0, 0, 1, 0, 0], [0, 0, 2...
#TO-DO #WORKING ON THIES import pandas as pd import numpy as np from pandas import DataFrame from sklearn.cross_validation import train_test_split import sklearn.cross_validation from scipy.spatial.distance import pdist, squareform from tpot import TPOTClassifier from tpot import TPOTRegressor df = pd.read_csv('sourc...
<reponame>Suveksha/labelflow from datetime import datetime import scipy.misc as sm from collections import OrderedDict import glob import numpy as np import socket # PyTorch includes import torch import torch.optim as optim from torchvision import transforms from torch.utils.data import DataLoader # Custom includes f...
from ContinuousGridworld import * import helpersContinuous from scipy.optimize import linprog import numpy as np import argparse if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument('--iteration', type=int, default=1, help='number irl iterations') parser.add_argument('--disc...