text string |
|---|
<filename>pipeline/mtl_analysis/helper_functions.py
from pipeline import lab, experiment, ephys, tracking, oralfacial_analysis
from scipy import optimize
import matplotlib.pyplot as plt
plt.rcParams['font.size'] = 48
import numpy as np
# ======== Define some useful variables ==============
_side_cam = {'tracking_de... |
<filename>RunCifarCnn.py
# import theano.sandbox.cuda
# theano.sandbox.cuda.use('gpu0')
import numpy as np
import cPickle as cP
import theano as TH
import theano.tensor as T
import scipy.misc as sm
import nnet.lasagnenetsCFCNN as LN
import lasagne as L
import datetime
def unpickle(file):
import cPickle
fo... |
import numpy as np
import scipy
import warnings
import cProfile
import pstats
import pdb
import shutil
import sys
import os
import pathlib
import nbformat as nbf
import inspect
import importlib
import doctest
from numpy.testing import rundocs
try:
import matplotlib.pyplot as plt
except Exception:
pass
# impor... |
from matplotlib import pyplot as plt
import numpy
from scipy.optimize import curve_fit
from .Spikes import Spikes
class Spectrum:
"""An example docstring for a class."""
def __init__(self, mz: numpy.array, intensities: numpy.array, metadata=None):
"""An example docstring for a constructor."""
... |
# Copyright 2022 The TensorFlow Authors. All Rights Reserved.
#
# 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 applica... |
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
#
# 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 Lice... |
import sys
import os
import argparse
import json
import cv2
from numpy.lib.function_base import extract
from scipy import optimize
from tqdm import tqdm
import torch.nn as nn
from torch.utils.data import DataLoader
# debug the file error
import torch.multiprocessing
torch.multiprocessing.set_sharing_strategy('file_sys... |
<filename>Data_analysis/fit_CO2/fit_CO2_exp02_noAZ.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 13 10:33:29 2020
Fit data to CO2 related kinetics
@author: LIMeng, limco2(AT)uw.edu
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf... |
from __future__ import print_function,division
import os,sys,re,os.path,shutil,fnmatch
import numpy as np
from progressbar import Percentage,Bar,RotatingMarker,ETA,ProgressBar
import atpy
try:
import matplotlib.pyplot as plt
except ImportError:
print('pylab not imported.')
import logging
import h5py
import pand... |
import math
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import scipy.stats as stats
from scipy.stats import t
from scipy.stats import norm
def least_squares(x, y):
#from SciPy Stats
slope, intercept, r_value, p_value, std_err = stats.linregress(x, y)
#Calculate R-Squared (c... |
<filename>notebooks/run_all_datasets.py<gh_stars>0
#!/usr/bin/env python
# coding: utf-8
# Evaluate an embedding
import os
import pandas as pd
import sys
import numpy as np
from pandas.core.common import flatten
import pickle
from pathlib import Path
import datetime
import scipy
import matplotlib.pyplot as plt
import... |
<gh_stars>0
#
#*******************************************************************************
# Copyright 2014-2020 Intel Corporation
#
# 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
#
# ... |
from __future__ import print_function, division
from cProfile import label
from logging import raiseExceptions
from typing import Mapping, Union, Optional, Callable, Dict
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import os
from tqdm import tqdm, t... |
<reponame>vibhoothi/awcy
#!/usr/bin/env python3
from __future__ import print_function
from numpy import *
import numpy as np
from scipy import *
from scipy.interpolate import interp1d
from scipy.interpolate import pchip
from scipy.interpolate import BPoly
from scipy._lib._util import _asarray_validated
import sys
imp... |
<reponame>dwillcox/gauss-jordan-solver
"""
Copyright (c) 2016, <NAME>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list... |
<reponame>dmargala/tpcorr
#!/usr/bin/env python
"""
"""
import argparse
import os
import h5py
import numpy as np
from astropy.io import fits
import scipy.interpolate
import scipy.stats.mstats as mstats
import scipy.signal
import matplotlib as mpl
mpl.use('Agg')
mpl.rcParams.update({'font.size': 14})
mpl.rcParams.up... |
from typing import AbstractSet, Dict, List, Optional, Tuple
from sympy import Poly, prod
from sympy.abc import x
from ccc.polynomialtracker import PolynomialTracker
class Multiset(PolynomialTracker):
"""
Track multisets that meet zero or more constraints.
"""
def __init__(
self,
si... |
<reponame>RuslanAgishev/crazyflie_ros<gh_stars>0
#!/usr/bin/env python
import numpy as np
from numpy.linalg import norm
import matplotlib.pyplot as plt
from matplotlib import collections
from scipy.ndimage.morphology import distance_transform_edt as bwdist
from math import *
import random
from impedance_modeles import... |
# -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <codecell>
#Here the interpolation data is loaded from disk
from scipy.interpolate import interp1d
tInterp = interp1d( np.loadtxt('banddat/interpdat_t_v0.dat'), np.loadtxt('banddat/interpdat_t_tCalc.dat'))
from scipy.interpolate import interp1d
wFInterp = interp1d... |
"""
All image search ranking related functionalities
"""
from scipy.spatial.distance import cdist, pdist
import numpy as np
import time
# from numba import double
from numba import jit
# from numba.decorators import jit, autojit
# --------- Dummy Test variables to be inserted around line 36---------
total= 100
total... |
<gh_stars>1-10
import unittest
import math_lib
import statistics
import random
import math
import os
class TestMathLib(unittest.TestCase):
def test_list_mean_for_empty_list(self):
r = math_lib.list_mean([])
self.assertEqual(r, None)
def test_list_mean_for_None_list(self):
r = math_lib.... |
<reponame>tim-shea/code-everyday
#!/usr/bin/env python
import sys
import rospy
import os
import time
import numpy
import tf
import math
from gazebo_msgs.msg import *
from gazebo_msgs.srv import *
from geometry_msgs.msg import Point, Vector3, Pose, Quaternion, Twist, Wrench
from std_srvs.srv import Empty
from scipy.si... |
import scipy.misc
import random
from PIL import Image
import numpy as np
class ImageSteeringDB(object):
"""Preprocess images of the road ahead ans steering angles."""
def __init__(self, data_dir):
imgs = []
angles = []
# points to the end of the last batch, train & validation
... |
"""
Super simple class to wrap an HMM with multinomial observations
"""
import numpy as np
from scipy.special import gammaln
from pyhsmm.models import HMM
from pybasicbayes.distributions import Multinomial
class MultinomialHMM(HMM):
def __init__(self, K, D,
alpha_0=1, # Conce... |
<filename>src/designPool.py<gh_stars>0
#!/usr/bin/env python
from collections import defaultdict
from itertools import chain
import numpy as np
from operator import itemgetter
from scipy.stats import rankdata
import sqlite3
import sys
import designParams
from string import maketrans, translate
DNA_complement_table = ... |
<gh_stars>1-10
import numpy as np
import tifffile as tiff
import os
import scipy.io as scio
def save_image(output, label, filename, out_results_path):
if not os.path.exists(out_results_path):
os.makedirs(out_results_path)
image = output
image = np.clip(image, 0, 1)
image = image * 25... |
<reponame>Jhko725/Contact-Point-Detection
import numpy as np
from scipy.integrate import solve_ivp
import sys, abc
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from .InteractionForce import TipSampleInteraction
class EquationOfMotion(abc.ABC):
@abc.abstractmethod
def _get_eom(se... |
<reponame>InduManimaran/pennylane<filename>pennylane/plugins/default_qubit.py
# Copyright 2018-2019 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http... |
<filename>bdi/scripts/gh_iso.py<gh_stars>1-10
# -*- coding: utf-8 -*-
import numpy as np
import torch, gudhi
import sys, time, codecs
from sklearn.preprocessing import normalize
from scipy.spatial.distance import cosine
reload(sys)
sys.setdefaultencoding('utf8')
FREQ = 5000
HOMO_DIM = 1
def load_word_vectors(file_d... |
<reponame>romanlutz/pmf-automl
import torch
import gaussian_process_latent_variable_model
import numpy as np
import scipy.stats as st
def expected_improvement(mean, variance, ybest, xi=0.01, eps=1e-12):
'''
xi is a parameter to encourage exploration
'''
standard_deviation = torch.sqrt(variance) + eps
... |
import segment
from scipy.spatial import cKDTree
pcmap = 'shahe.gps.1.log.pcmap'
vslam = 0
gps = 1
autovel = 0
is_local = 0
_, _, _, _, _, _, _, jw, _, _, key_jw, real_str_id, point4all, point4key = segment.seg(pcmap, vslam, gps, autovel,
... |
<reponame>kuntzer/binfind
from __future__ import division
import numpy as np
import pylab as plt
from scipy import stats
def hist(ax, stars_characteristics, predictions):
"""
"""
binary_stars = stars_characteristics[:,0]
idbin = np.where(binary_stars == 1)
all_stars = stars_characteristics[idbin, 1].flatte... |
# by TR
from matplotlib.mlab import psd
from numpy.fft.helper import fftfreq
from obspy.core import Trace as ObsPyTrace
from obspy.signal.util import nextpow2
from scipy.fftpack import fft, ifft
import scipy.interpolate
from sito import util
from sito.util import filterResp, fillArray
from sito.xcorr import timeNorm, ... |
from scipy.special import hyp2f1
from mrcc.mutation_model_simulator import MutationModel
from mrcc.kmer_mutation_formulas_thm5 import exp_n_mutated, var_n_mutated
from matplotlib import pyplot as plt
import mrcc.kmer_mutation_formulas_thm5 as thm5
def var_c_scaled_first_order_taylor(L,k,p,s):
q = 1 - (1 - p) ** k
... |
<reponame>mzy2240/GridCal<gh_stars>100-1000
import pandas as pd
import numpy as np
from scipy.sparse import lil_matrix, csc_matrix
pd.set_option('display.max_rows', 500)
pd.set_option('display.max_columns', 500)
pd.set_option('display.width', 1000)
# file_name = 'D:\\GitHub\\GridCal\\Grids_and_profiles\\grids\\Reduc... |
# https://www.hackerrank.com/contests/infinitum-sep14/challenges/mehta-and-his-laziness
from sys import stdin
from fractions import gcd
from math import sqrt
def getInt():
return map(int, stdin.readline().split())
def isPerfectSquare(n):
lo = 0
hi = n
while (hi - lo) > 1:
mid = (lo + hi) /... |
#!/usr/bin/env python
#-*- coding: utf-8 -*-u
u"""
Ce module python s'occupe de suivre le drone et d'envoyer des estimés de position et de rotation
angulaire au pixhawk.
"""
import math
import numpy as np
import unscented_kalman_filter as ukf
import rospy
import cv2
from geometry_msgs.msg import Pose
from geometry... |
import numpy as np
import scipy.signal
from pb_bss_eval.evaluation.wrapper import InputMetrics, OutputMetrics
def scenario():
samples = 10_000
rir_length = 4
channels = 3
speakers = 2
np.random.seed(1)
speech_source_1 = np.random.rand(samples)
speech_source_2 = np.random.rand(samples)
... |
<reponame>brandondavid/sympy
"""Prime ideals in number fields. """
from sympy.polys.polytools import Poly
from sympy.polys.domains.finitefield import FF
from sympy.polys.domains.rationalfield import QQ
from sympy.polys.domains.integerring import ZZ
from sympy.polys.matrices.domainmatrix import DomainMatrix
from sympy.... |
<gh_stars>10-100
"""
Chapter 9: Healthcare IoT
Code for ECG matlab signal exploration
"""
import scipy.io
import numpy as np
import matplotlib.pyplot as plt
#Import to a python dictionary
Class1 = scipy.io.loadmat('dataset/ECG/A00001.mat') # Normal Rhythm
Class2 = scipy.io.loadmat('dataset/ECG/A00004.mat') # Atrial ... |
<filename>inst/python/python_spatial_genes.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 25 12:13:31 2019
@author: <NAME>
"""
import scipy
import scipy.stats
import sys
import re
import os
import numpy as np
import math
from operator import itemgetter
from scipy.spatial.distance import squa... |
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 28 11:35:57 2015
@author: <NAME>, <NAME>, <NAME>
"""
from __future__ import division, print_function, absolute_import, unicode_literals
import numpy as np
from numpy import exp, abs, sqrt, sum, real, imag, arctan2, append
from scipy.optimize import minimize
def SHOfunc(... |
<reponame>Michal-Gagala/sympy
"""Compatibility interface between dense and sparse polys. """
from sympy.polys.densearith import dup_add_term
from sympy.polys.densearith import dmp_add_term
from sympy.polys.densearith import dup_sub_term
from sympy.polys.densearith import dmp_sub_term
from sympy.polys.densearit... |
<filename>Topic 3 - Function Approximation/20.Integral/Cotez.py
from sympy import *
import numpy as np
import math
cotezCoefs = [[1/2, 1/2],
[1/6, 4/6, 1/6],
[1/8, 3/8, 3/8, 1/8],
[7/90, 32/90, 12/90, 32/90, 7/90],
... |
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as stats
import math
class Player:
def __init__(self, name, tsid, rating=None, kfactor=None, sd=None):
self.name = name
self.tsid = tsid
if rating:
self.rating = rating
else:
self.rating ... |
# core data structures
import networkx as nx
import numpy as np
import scipy.sparse as sp
from .decomposition import get_calculation_method
class Class:
def __init__(self, lab_id, name, members):
self.name = name
self.id = lab_id
self.index = -1
self.members = members # ids of me... |
import time, copy
import os, os.path
import sys
import numpy
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from scipy import optimize
from echem_plate_ui import *
from echem_plate_math import *
import pickle
p1='C:/Users/Gregoire/Documents/CaltechWork/echemdrop/20121031NiFeCoTi_P/results/echemplots/20121031NiF... |
import unittest
from datetime import date
import numpy as np
import pandas as pd
import pint_pandas
from dateutil import relativedelta
from os import path
from scipy import stats
import pint
from table_data_reader import ParameterRepository, growth_coefficients
from table_data_reader.table_handlers import TableParame... |
import os
from itertools import chain
from typing import List, Tuple, Dict
from datetime import datetime
import pandas as pd
import numpy as np
import scipy
from scipy.sparse import csc_matrix
from tqdm import tqdm
def chainer(s: pd.Series) -> List[str]:
return list(chain.from_iterable(s))
path = "../../input... |
<reponame>nishantuzir/just_a_naive_flowmeter
#!/usr/bin/env python
import json
import os
import pandas as pd
import numpy as np
from scipy.stats import kurtosis,skew,hmean
from scipy.stats.mstats import gmean
import time
from datetime import datetime
def generate_flows(pcap_file_path,time_out):
print("creating jso... |
# Copyright 2021 The PyMC Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... |
import math
import numpy as np
import scipy.interpolate as si
import scipy.optimize as so, scipy.spatial.distance as ssd, scipy.integrate
import os, sys, pathlib, json
l2r_path = os.path.abspath('../learn-to-race')
sys.path.append(l2r_path)
from Shapes.utils import *
class RaceTrack():
def __init__(self, trackNa... |
"""
This file contains all helper utility functions.
"""
import os
import sys
import math
import importlib
from scipy.optimize import linear_sum_assignment
import torch
import numpy as np
import trimesh, configparser
from pyquaternion import Quaternion
import h5py
def worker_init_fn(worker_id):
... |
<filename>deformetrica/support/probability_distributions/alamain_gradient.py
import numpy as np
import torch
from torch.autograd import Variable
import scipy.spatial as sp
from ...support import utilities
class AlamainGradientDistribution:
#########################################################################... |
<reponame>avinashhsinghh/CarND-Traffic-Sign-Classifier<filename>utils.py
#augmentation
import tensorflow as tf
import random
IMAGE_SIZE=32
import os
from scipy.ndimage import rotate
from scipy.misc import face
from matplotlib import pyplot as plt
from scipy.ndimage import zoom
import cv2
import requests
i... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 3rd party imports
import numpy as np
from scipy import constants
# Local imports
from .resample import resample
__author__ = "<NAME>"
__email__ = "<EMAIL>"
__copyright__ = "Copyright 2020-2021"
__license__ = "MIT"
__version__ = "2.3.7"
__status__ = "Prototype"
def p... |
import cmath
import numpy as np
from matplotlib import pyplot as plt
from skimage import data, color
from skimage.transform import rescale, resize, downscale_local_mean,rotate
def dft(n,normalize):
matrix = np.zeros((n, n), dtype=np.complex_)
identity = np.zeros((n, n), dtype=np.complex_)
omega=cmath.exp(... |
from random import randint
from dataclasses import dataclass
from telnetlib import Telnet
from time import sleep
from datetime import datetime, timedelta
from dataclasses import dataclass, field
import argparse
import yaml
import sys
import pyaudio
import numpy as np
import matplotlib.pyplot as plt
from scipy import ... |
import numpy as np
import os
import sys
from matplotlib import pyplot as plt
from matplotlib import colors
import matplotlib.gridspec as gridspec
from matplotlib.ticker import FormatStrFormatter, AutoMinorLocator
import matplotlib.cm as cm
import starry
import jax.numpy as jnp
from jax import random, jit, vmap, lax
... |
import numpy as np
from scipy.linalg import expm, logm
def se3Exp(twist):
m = np.array([[0, -twist[5], twist[4], twist[0]],
[twist[5], 0, -twist[3], twist[1]],
[-twist[4], twist[3], 0, twist[2]],
[0, 0, 0, 0]], dtype='float64')
omega_hat = m[0:3, 0:3]
... |
import os
import sys
import numpy as np
from scipy.io.wavfile import write as wavwrite
import tensorflow as tf
out_dir, tfrecord_fps = sys.argv[1], sys.argv[2:]
if not os.path.isdir(out_dir):
os.makedirs(out_dir)
def _mapper(example_proto):
features = {
'samples': tf.FixedLenSequenceFeature([1], tf.float3... |
<gh_stars>10-100
"""Filter the solution to topology optimization."""
from __future__ import division
# Import standard library
import abc
# Import modules
import numpy
import scipy
class Filter(abc.ABC):
"""Filter solutions to topology optimization to avoid checker boarding."""
def __init__(self, nelx: int... |
<filename>collect_exp_results.py<gh_stars>10-100
import os
import torch
import collections
import json
import statistics
import util
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
def load_checkpoint_history(checkpoint_path):
for file in os.listdir(checkpoint_path):
if file.endswith... |
<gh_stars>0
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# written by <NAME>
# 2016-12-06
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d.axes3d import Axes3D
import matplotlib.cm as cm
import numpy as np
from scipy.optimize import curve_fit
from scipy.stats import gamma
import set_data_path
def result_... |
<gh_stars>1-10
from time import time
from sys import stdout
import h5py
import numpy as np
from scipy import interpolate
from transforms3d import euler
from sklearn.model_selection import train_test_split
from sklearn import preprocessing
from sklearn import decomposition
from sklearn.neighbors import KNeighborsClas... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 25 19:15:10 2019
@author: kaniska
"""
import math
import numpy as np
from scipy.fftpack import fft, fftshift
import matplotlib.pyplot as plt
import global_params as G
def plot_signal(t, sig, ax_sig):
# Plot signal
ax_sig.plot(t, sig)
... |
<reponame>SenhuWong/PySPOD
# Auxiliary plotting functions
# ---------------------------------------------------------------------------
import os
import sys
# import time
# import dask
# import xarray as xr
import numpy as np
# import opt_einsum as oe
from pathlib import Path
from os.path import splitext
from scip... |
import os
import numpy as np
from scipy.signal import medfilt, savgol_filter
from statsmodels.robust import mad
import matplotlib.pyplot as plt
from sigpyproc.Readers import FilReader
import tqdm
from astropy import log
def ref_mad(array, window=1):
"""Ref. Median Absolute Deviation of an array, rolling median-su... |
<filename>pyccapt/calibration/pyccapt/calibration_tools/data_tools.py<gh_stars>0
import numpy as np
import h5py
import pandas as pd
import scipy.io
def read_hdf5(filename:"type: string - Path to hdf5(.h5) file")->"type: dataframe - Pandas dataframe converted from H5 file":
"""
This function differs from read_... |
<filename>post_proc/radial_color.py
'''
# This is an 80 character line #
What does this file do?
(Reads single argument, .gsd file name)
1.) Read in .gsd file of particle positions
2.) Mesh the space
3.) Loop through tsteps and ...
3a.) Place all particles in appropriate... |
<gh_stars>0
import matplotlib
from cplvm import CPLVM
from cplvm import CPLVMLogNormalApprox
import functools
import warnings
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
import pandas as pd
import os
from scipy.stats import poisson
from scipy.special import logsumexp
import tensorflow.c... |
from __future__ import division
from cctbx import miller
from cctbx import crystal
from cctbx import sgtbx
from cctbx import uctbx
from cctbx.array_family import flex
from cmath import cos, sin, pi
def miller_export_as_shelx_fcf(self, f_calc, file_object=None):
""" Export self and the miller array f_calc as ShelX w... |
from pathlib import Path
from typing import Union, Tuple, List
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import StandardScaler
import statsmodels.api as sm
import seaborn as sns
import scipy.stats as spt
import sc... |
########################################################################
########################################################################
########################################################################
#### ####
#### csBehavior v1.1 ####
#### ####
#### A P... |
<filename>test_retrieval.py<gh_stars>0
# Copyright 2018 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unl... |
<reponame>YasushiIizuka/python_ai
'''このプログラムについて
このプログラムは下記に公開されているソースコードと
https://github.com/moritalous/mnist_vs_me
下記記事を参考にしました
https://qiita.com/takus69/items/dd904dfc62372310c46f
'''
import keras
import numpy as np
from keras.models import load_model
from keras.preprocessing.image import array_to_img, img_to_array... |
<filename>torchcrepe/load.py
import os
import numpy as np
import torch
import torchcrepe
from scipy.io import wavfile
def audio(filename):
"""Load audio from disk"""
sample_rate, audio = wavfile.read(filename)
# Convert to float32
if audio.dtype == np.int16:
audio = audio.astype(np.float32) ... |
<filename>8queens/genetic.py<gh_stars>0
import random
import statistics
import time
class Chromosome:
Genes = None
Fitness = None
def __init__(self,genes,fitness):
self.Genes = genes
self.Fitness = fitness
def _generate_gene(length,geneset,get_fitness):
genes = []
while len(genes) < length:
#samples = min... |
from classifiers import *
import math
import numpy as np
from scipy.spatial import KDTree
import utils
def kdtree_classify(classifier, entry, class_index=-1, k=1):
prepared_entry = utils.without_column(entry, class_index)
result = classifier.descriptor.query([prepared_entry], k=k)
scoreboard = {}
inde... |
#!/usr/bin/env python
# _*_ coding: UTF-8 _*_
# author:"<NAME>"
"""半自动标注图像,并生成可供labelme接口解析的json类型的文件"""
import cv2
import scipy.io as sio
from pylab import *
from json import dumps
import json
from img2json import img_to_json
import customserializer
import glob
from base64 import b64encode
# json_file_input = "D:\\Pr... |
# import
import numpy as np
import json
from urllib.request import urlopen
from scipy.optimize import curve_fit
import matplotlib.pyplot as plt
import pickle
import os.path
from dataUtil import *
def linear(x, a, b):
return a * x + b
def poly(x, a, b, c, d, e):
return a * x ** 4+ b * x ** 3 + c * x ** 2 + d *... |
<filename>vfs_appointment_bot/_VfsClient.py
from cmath import exp
import email
import time
import logging
import datetime
from _TwilioClient import _TwilioClient
from _ConfigReader import _ConfigReader
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from selenium.common.exception... |
# This takes a regions file as input and generates a 512x512 mask and saves it on at the given path
import json
from numpy import array, zeros
from scipy.misc import imsave
import sys
# verify the regions json path is given
if (len(sys.argv) < 3):
print ('Usage: python generate_segments.py [PATH_TO_JSON] [OUTPUT_MA... |
# coding: utf-8
# ### DEMQUA10
# # Monte Carlo Simulation of Time Series
#
# Simulate time series using Monte Carlo Method
# In[1]:
import numpy as np
from compecon import demo
from scipy.stats import norm
import matplotlib.pyplot as plt
# In[2]:
m, n = 3, 40
mu, sigma = 0.005, 0.02
e = norm.rvs(mu,sigma,size... |
#!/usr/bin/env python
""" create gifti vector file for rendering in caret
- based on fo_write_vectors_nodes_to_CARET.m by <NAME>
"""
import scipy.io
import numpy as N
basedir='/scratch/01329/poldrack/openfmri/analyses/connectivity_paper/'
atlasdir='/work/01329/poldrack/software_lonestar/atlases/sc_HO_atlas/'
def get... |
<filename>swm-master/swm-master/calc/misc/ReRo_hist.py
## HISTOGRAM COMPUTATIONS FOR REYNOLDS AND ROSSBY NUMBERS
from __future__ import print_function
path = '/home/mkloewer/python/swm/'
import os; os.chdir(path) # change working directory
import numpy as np
from scipy import sparse
import time as tictoc
from netCDF4 i... |
#!/usr/bin/python
# encoding: utf-8
import torch
from torch.utils.data import Dataset
from PIL import Image
from .image import *
from scipy.ndimage import imread
class listDataset(Dataset):
def __init__(self, root, shape=None, shuffle=True, transform=None, target_transform=None, train=False, seen=0, batch_size... |
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm
# using msdsl
from scipy.stats import truncnorm
from msdsl import Function
inv_cdf = lambda x: truncnorm.ppf(x, -6, +6)
func = Function(inv_cdf, domain=[0.0, 0.5], order=1, numel=512, log_bits=5)
# print(func.get_samp_points_spline())
# fo... |
# !/usr/bin/python
# -*- coding: utf-8 -*-
import argparse
import numpy as np
import tensorflow as tf
import time
import os
from sys import path
import tf_util as U
from maddpg import MADDPGAgentTrainer
# from maddpg import MADDPGEnsembleAgentTrainer
import tensorflow.contrib.layers as layers
# from tf_slim import laye... |
<reponame>xbresson/spectral_graph_convnets<filename>check_install.py
#!/bin/env python3
print('\nRun Python installation test for graph ConvNets')
import os
import sys
major, minor = sys.version_info.major, sys.version_info.minor
if ( (major is not 3) or (minor is not 6) ):
raise Exception('Code developed for Py... |
<gh_stars>10-100
import numpy as np
import scipy.sparse as sp
import scipy.sparse.linalg as LA
from pySDC.core.Problem import ptype
from pySDC.implementations.datatype_classes import mesh
from pySDC.playgrounds.deprecated.advection_1d_implicit.getFDMatrix import getFDMatrix
class advection(ptype):
"""
Examp... |
import numpy as np
import matplotlib.pyplot as plt
from scipy import interpolate
def loadTimeFile(fileName):
timeList = []
verticesList = []
with open(fileName) as file:
line = file.readline()
while line:
s = line.split(' ')
n = int(s[0])
time = float(s[1... |
import copy
import sys
import numpy as np
from sklearn.base import BaseEstimator, ClusterMixin
from sklearn.utils.validation import check_array
from scipy.special import gammaln
from dpmmlearn.probability import Prior
from dpmmlearn.utils import log_ewens_sampling_formula, pick_discrete
INT_MAX = sys.maxsize
MINUS_I... |
<filename>Stage 3/qca3.py
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 28 18:24:43 2019
@author: Ulysse
-
Version lourde avec gravitons et particules quantiques.
"""
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from matplotlib.ticker import LinearLocator, FormatStrFormatter#Used for 3d plotting... |
<filename>RealnessGAN_on_MNIST/GAN.py
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from torchvision import datasets, transforms
import torchvision
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import skewnorm
import os
from swd import swd
from s... |
<gh_stars>1-10
from __future__ import print_function
__author__ = 'jeremy'
import sys
import os
import cv2
import logging
import time
logging.basicConfig(level=logging.INFO) #debug is actually lower than info: critical/error/warning/info/debug
import shutil
# So this file can be imported on servers where joblib is n... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import itertools
import random
from glob import glob
import argparse
import cv2
import scipy.misc
import numpy as np
from skimage import color
from PIL import Image
SIZES = (3, 5, 7)
SIGMAS = (0, 2... |
from __future__ import absolute_import
import hashlib
import numpy as nm
import warnings
import scipy.sparse as sps
import six
from six.moves import range
warnings.simplefilter('ignore', sps.SparseEfficiencyWarning)
from sfepy.base.base import output, get_default, assert_, try_imports
from sfepy.base.timing import ... |
import json
import requests
from . import config
from statistics import mean
class Saltlux_Language:
"""
Not limited to, but preferably for Korean Language Analysis.
"""
def __init__(self):
self.api_key = config.saltlux_api_key
@staticmethod
def dump_json(json_object, filepath):
... |
""" This program solves differential equations of 3rd order
given in form y''' = f(x, y, y', y'').
Define right side of equation f and region XLIM, YLIM by yourself.
Default is y''' = 3 * y' * y''**2 / (1 + y''**2)
in region [-4, 4] x [-4, 4] (equation of a circle).
Start the program and ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.