text string |
|---|
<reponame>bikram-sahu/Photometry-Toolkit
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 1 15:49:26 2019
@author: <NAME>
"""
import numpy as np
def circular_sum(data, center, radius):
X = center[0]
Y = center[1]
x = np.arange(data.shape[1])
y = np.arange... |
import os
from datetime import datetime, timedelta
import pytz
import numpy as np
import scipy.io as io
import utm
import yaml
from munch import Munch, munchify
from scipy.ndimage import median_filter
import scipy.signal as sig
def loadmat(filename, check_arrays=False, **kwargs):
"""
Big thanks to mergen on ... |
import sys, os, glob
sys.path.append("../.")
sys.path.append("../data/")
import numpy as np
import matplotlib.pyplot as plt
import torch
from torch.nn import MSELoss, L1Loss
from torch.optim import Adam
from PIL import Image
import argparse, json, torchvision
import scipy.io
import helper.canon_supervised_dataset as ds... |
<filename>ChoateStudentHelp/ChoateStudentHelp_module.py<gh_stars>0
'''
<NAME>
5/24/2021
Description: This is a Python module that has 6 functions that I thought would be useful in my own life as a Choate student. There is are 6 math help functions, 2 standardized test simulation functions, a
function for stock pr... |
<reponame>dx199771/ACMMM2021
import argparse
import os
import torch
from PIL import Image
from scipy.io import loadmat
from tqdm import tqdm
def read_txt(path, data_num):
data = {}
for line in open(path, 'r', encoding='utf-8'):
if data_num == 2:
data_1, data_2 = line.split()
else:... |
import os
import numpy as np
import scipy.signal as scs
from PyAstronomy import pyasl
from scipy import integrate, interpolate
from scipy.optimize import differential_evolution, dual_annealing
from scipy.optimize import shgo, leastsq, NonlinearConstraint
from bokeh.models import ColumnDataSource, RangeTool, Line... |
import lettuce as lt
import torch
import numpy as np
import matplotlib.pyplot as plt
import imageio
import scipy.io
from datetime import datetime
import os
# Not interactive to prevent trying to spawn a window
plt.ioff()
# get GPU ID
GPUID = os.getenv('GPUID')
print(GPUID)
deviceName = 'cuda:'+str(GPUID)
print(devic... |
"""
This module provides functions for using Orca models for various
types of the predictions. This is the main module that you need for
interacting with Orca models.
To use any of the prediction functions, `load_resources` has to be
called first to load the necessary resources.
The coordinates used in Orca are 0-ba... |
<gh_stars>0
import libnum
import math
import scipy.stats as st
import numpy as np
def invmod(a, p): # a*b=1(mod p) return b
return libnum.invmod(a, p)
def modpow(b, e, m): # return b^e(mod m)
result = pow(b, e, m)
return result
def custom_frexp(num):
man, exp = math.frexp(num)
while (not ma... |
"""Compare VILA predictors to other models on VLUE."""
import argparse
import csv
import os
from collections import defaultdict
from dataclasses import dataclass
from statistics import mean, stdev
from typing import Callable, Dict, List
from mmda.eval.vlue import (LabeledDoc, PredictedDoc, grobid_prediction,
... |
'''
Statistical Computing for Scientists and Engineers
Homework 4
Fall 2018
University of Notre Dame
'''
import numpy as np
import matplotlib.pyplot as plt
import math
from scipy.stats import gamma
import scipy as sc
def metropolis_hastings(#fill the parameters):
########## add code below ##################
######... |
<filename>pyroomacoustics/doa/tops.py
# Author: <NAME>
# Date: July 15, 2016
import numpy as np
from .music import MUSIC
from scipy.linalg import svdvals
from scipy import linalg
class TOPS(MUSIC):
"""
Class to apply Test of Orthogonality of Projected Subspaces [TOPS]_ for
Direction of Arrival (DoA) es... |
"""
Data that results from running tests
"""
from dataclasses import dataclass
import enum
import statistics
from simple_checker import cli
@dataclass
class TestResult:
"""Result of a single test"""
class Status(enum.IntEnum):
"""Status of run program"""
OK = 0
ANS = 1
TLE = ... |
import numpy as np
import scipy.signal as signal
import matplotlib.pyplot as plt
n = np.array( [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ] )
x = np.array( [ 1, 2, 1, -1, -2, -1, 0, 0, 0, 0 ] )
b = np.array( [ 1 ] )
a = np.array( [ 1, -0.8 ] )
y = signal.lfilter( b, a, x )
print( "x =", x )
print( "y =", y )
plt.figure( 1 )
pl... |
<filename>MATLAB_Discovery_and_Comparisons/NSGA_comparisons/comparison_stats.py
import numpy as np
from pymoo.algorithms.nsga2 import NSGA2
from pymoo.factory import get_sampling, get_crossover, get_mutation
from pymoo.factory import get_termination
from pymoo.optimize import minimize
from pymoo.visualization.scatter i... |
# ACT likelihood, ported 11/6/2016 <NAME>, updated for DR4 on 4/11/2020
# original fortran by <NAME>, <NAME> 2016
import os, sys
import numpy as np
from scipy.io import FortranFile # need this to read the fortran data format
from scipy import linalg # need this for cholesky decomposition and inverse
import pkg_resou... |
<reponame>pureexe/my-simple-sfm-ceres<gh_stars>0
import numpy as np
from scipy.spatial.transform import Rotation
# https://github.com/kashif/ceres-solver/blob/master/include/ceres/rotation.h#L457
def angle_axis_rotate_point(angle_axis, point3d):
theta2 = np.dot(angle_axis,angle_axis)
w = np.zeros(3)
result... |
<filename>ipfe/saliency.py
#!/usr/bin/python
import os
import numpy as np
import math
from scipy import fftpack, ndimage, misc
import skimage as si
def edge_based(image):
"""
A simple method for detecting salient regions
<NAME>
Abstract
A simple method for detecting salient regions in images is p... |
import numpy as np
from joblib import Memory
from scipy.optimize import fmin_l_bfgs_b
location = './cachedir'
memory = Memory(location, verbose=0)
def x_to_params(x, p, q, n):
A = x[:p * q].reshape(p, q)
P = x[p * q: p * q + q * n].reshape(n, q)
return A, P
def params_to_x(A, P):
p, q = A.shape
... |
# Median in a row-wise sorted Matrix
#https://practice.geeksforgeeks.org/problems/median-in-a-row-wise-sorted-matrix1527/
import statistics
class Solution:
def median(self, matrix, r, c):
#code here
list_matrix = []
for i in range(0,r):
for j in range(0 , c):
l... |
<filename>src/utils.py
from tqdm import tqdm
import numpy as np
import torch
from torch._six import string_classes, int_classes
import collections
import shutil
import scipy.signal
from itertools import chain
class AverageMeter(object):
"""Computes and stores the average and current value"""
def __init__(self... |
"""
Name : c8_08_python_hierachical.py
Book : Hands-on Data Science with Anaconda )
Publisher: Packt Publishing Ltd.
Author : <NAME> and <NAME>
Date : 3/25/2018
email : <EMAIL>
<EMAIL>
"""
import numpy as np
import scipy.cluster.hierarchy as hac
import matplotlib.pyplot as p... |
"""
Spatially structured OCT model of network simulation, with optimisation methods.
"""
import os
import subprocess
import warnings
from collections import namedtuple
import argparse
import numpy as np
from scipy import integrate
from scipy.interpolate import interp1d
import bocop_utils
if __name__ == "__main__":
... |
"""
Code to generate line profiles for the RM effect of rings taking into account the pixel size of the data and the resolution of the spectrograph.
Requires C-code to be compiled using
g++ -Wall -fPIC -O3 -march=native -fopenmp -c utils.cpp
g++ -shared -o libutils.so utils.o
"""
import numpy as np
from scipy imp... |
<reponame>goroyabu/anlpy2<gh_stars>0
#!/usr/bin/env python3
import os, time, datetime, argparse
import enum, math
# import numpy, scipy
import ROOT
import builtins
from .analysis_status import AnalysisStatus as stt
from .event_flags import EventFlags as evs
class VANLModule :
"""Basic class of analysis module
... |
from __future__ import print_function, division
import imgaug as ia
from imgaug import augmenters as iaa
from scipy import misc
import numpy as np
from skimage import data
def main():
image = data.astronaut()
image = ia.imresize_single_image(image, (128, 128))
images = []
params = [
(0.25, 0.2... |
<filename>venv/tests/introToFourierTransform.py
import scipy
import matplotlib
import numpy as np
from matplotlib import pyplot as plt
from scipy.io.wavfile import write
from scipy.fft import fft, fftfreq, rfft, rfftfreq
SAMPLE_RATE = 44100 # Hertz
DURATION = 5 # Seconds
def generate_sine_wave(freq, sample_rate, d... |
import os
import sys
import errno
import pandas as pd
import numpy as np
import scipy.sparse as sparse
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
try:
import cPickle as pickle
except ImportError:
import pickle
np.set_printoptions(s... |
"""
legacyhalos.ellipse
===================
Code to do ellipse fitting on the residual coadds.
"""
import os, pdb
import time, warnings
import numpy as np
import matplotlib.pyplot as plt
import astropy.modeling
from photutils.isophote import (EllipseGeometry, Ellipse, EllipseSample,
Is... |
<filename>code/figures/supplement/figS6_naa_v_ribosome_inference.py
#%%
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import prot.viz
import prot.size
import scipy.optimize
import scipy.stats
colors = prot.viz.plotting_style()
dataset_colors = prot.viz.dataset_colors()
# Load data for ribosome... |
"""
Controller for a cyber physical network based on Lego Mindstorms.
"""
import datetime
import argparse
import logging
import time
import tempfile
import pkgutil
import os
import numpy as np
from scipy import io
from threading import Event,Thread
from multiprocessing import Queue
import ncsbench.common.packet as pa... |
#!/usr/bin/env python3
#--coding:utf-8 --
"""
callPeaks.py
2019-08-27: updated as select the most significant peaks for overlapped ones; also stich together close peaks.
2019-09-10: basically finished.
2020-01-20: fine tune, also change cDBSCAN to blockDBSCAN
2020-01-25: fine tune enrichment score, using real control R... |
<filename>condor/source.py
# -----------------------------------------------------------------------------------------------------
# CONDOR
# Simulator for diffractive single-particle imaging experiments with X-ray lasers
# http://xfel.icm.uu.se/condor/
# ----------------------------------------------------------------... |
<gh_stars>0
import numpy as np
from math import fabs, log
from scipy.integrate import simps
def _get_duration(timecourse, below_threshold=0.1):
"""
Calculation of the duration as the time it takes to decline below the threshold
Parameters
----------
timecourse : array
Simulated time cours... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 2 19:32:33 2022
@author: diesel
"""
import os
import pickle
from pathlib import Path
import numpy as np
from scipy.optimize import curve_fit
import matplotlib.pyplot as plt
# define constants
J_eV = 6.242E18
eV_J = 1/J_eV
m_n = 1.675E-27 # kg/mol... |
import os
import torch
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import warnings
from scipy.stats import pearsonr
from sklearn import metrics
from task import SequenceLearning
from utils.params import P
from utils.constants import TZ_COND_DICT
from utils.io import build_log_path, get_tes... |
<gh_stars>0
### telem_util.py: For code that interacts with Keck AO Telemetry files
### Author: <NAME>
### Date: 11/18/2020
import numpy as np
import pandas as pd
import glob
from scipy.io import readsav
from . import times
from . import templates
### For importing package files
### May need to edit this later if th... |
from __future__ import division, absolute_import, print_function
import numpy as np
try:
from scipy.signal import lfilter, firwin, decimate
except ImportError:
pass
from .common import Benchmark
class Decimate(Benchmark):
param_names = ['q', 'ftype', 'zero_phase']
params = [
[2, 10, 30],
... |
import numpy as np
import tensorflow as tf
import time
import scipy.ndimage.filters
# build encoder
def encoder(opt,image): # [B,H,W,3]
def conv2Layer(opt,feat,outDim):
weight,bias = createVariable(opt,[3,3,int(feat.shape[-1]),outDim])
conv = tf.nn.conv2d(feat,weight,strides=[1,2,2,1],padding="SAME")+bias
batch... |
import pylab as np
import scipy.special
class ClickDistribution():
############################################# Initialisation functions
def __init__( self ):
params = dict({ 'learning_rate' : 0.8, #Percentage of previous pdf when updating new pdf
'update' : Tr... |
<filename>pyphe/analysis.py
import pandas as pd
from warnings import warn
import os
from scipy import interpolate
import numpy as np
from matplotlib.backends.backend_pdf import PdfPages
from matplotlib import pyplot as plt
import seaborn as sns
sns.set_style('white')
class Experiment():
'''
A pyphe Experiment obj... |
# coding: utf-8
import xgboost
import numpy as np
from time import time
from operator import itemgetter
from scipy.stats import randint as sp_randint
import xgboost as xgb
import preprocessing as pr_kaggle
import pandas as pd
import numpy as np
import xgboost as xgb
from sklearn import preprocessing as pre
from sk... |
<gh_stars>0
import logging
import numpy as np
from scipy.interpolate import interp1d
from ibllib.io.extractors import bpod_trials
from ibllib.io.extractors.base import get_session_extractor_type
from ibllib.io.extractors.training_wheel import get_wheel_position
from ibllib.io.extractors import ephys_fpga
import iblli... |
<gh_stars>0
"""Unit tests for the COLMAP Loader class.
Authors: <NAME>
"""
import unittest
from pathlib import Path
import numpy as np
from gtsam import Rot3, Pose3
from scipy.spatial.transform import Rotation
from gtsfm.common.image import Image
from gtsfm.loader.colmap_loader import ColmapLoader
TEST_DATA_ROOT =... |
from scipy.io import loadmat
import random
content = loadmat("demand_10.mat")["demand"]
date=-1
for i in range(content.shape[0]):
print(i)
if i//144 == i/144:
date += 1
date = date % 7
row = content[i]
idx = i % 144
if random.uniform(0,1) < 0.2:
f = open("data_test.txt", "a"... |
#!/usr/bin/env python3
import pickle
import os
import json
import matplotlib.pyplot as plt
from operator import add, sub
from scipy.ndimage.filters import gaussian_filter1d
import logging
import numpy as np
import matplotlib
import tikzplotlib
from tap import Tap
logging.basicConfig(format="%(levelname)s: %(message)s... |
# This file is part of GridCal.
#
# GridCal is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GridCal is distributed in the hope that... |
<filename>gtsne/_st_gtsne.py
import numpy as np
import scipy.linalg as la
from sklearn.cluster import KMeans
from st_gtsne import ST_GTSNE
def gtsne(
data,
pca_d=None,
D_Z = None,
d= 2,
K = None,
alpha = 1e-2,
beta = 5e-2,
perplexity=30.0,
theta=0.5,
random_state=None,
cop... |
<filename>Group19_0521/5_21_1.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon May 21 10:44:31 2018
@author: joycehsu
"""
import numpy as np
from skimage import io
from scipy.stats import multivariate_normal
pic_bgr=io.imread("1.jpg")
h,w,d=pic_bgr.shape
pic_2D=pic_bgr.reshape(h*w,d)
ctr_x1=80
... |
import numpy as np
import scipy.sparse as sp
from IPython import embed
from tqdm import tqdm
class Sampler(object):
def __init__(self, dims, num_ng=4, sample_method='item-desc', sample_ratio=0, reindex=False):
"""
negative sampling class for some algorithms
Parameters
----------
... |
<reponame>eaaskt/nlu<filename>rad-antonyms/rasa_pipeline.py
import configparser
import copy
import io
import json
import os
import subprocess
import sys
import time
from shutil import copyfile
from shutil import rmtree
from statistics import stdev, mean
from typing import Optional
from zipfile import ZipFile
import gs... |
"""
Script plots boxplots
Author : <NAME>
Date : 27 January 2021
"""
### Import modules
import numpy as np
import scipy.stats as sts
import matplotlib.pyplot as plt
import calc_Utilities as UT
import calc_dataFunctions as df
import palettable.wesanderson as ww
import calc_Stats as dSS
from sklearn.metrics imp... |
<reponame>casutton/bayes-qnet
from math import exp, sqrt
from numpy import random
from scipy import special
import numpy
import sampling
import pwfun
# This file is really annoying. Various function that aren't in Cython b/c
# they're easier to do with closures
def expify (fn, C=0): return lambda x: exp(fn(x)+C)
d... |
from __future__ import print_function, absolute_import
import pandas as pd, numpy as np
import itertools, scipy
from sympy.parsing import ast_parser
from . import misc
def _df_engineer(self, name, columns=None, quiet=False):
'''
name(Array|string): Can list-like of names. ';' split list of names
also... |
<reponame>OmnesRes/infarction<filename>functions.py
import numpy as np
from scipy.stats import f as f_stat
from scipy.stats import f_oneway
##load the data set with a list comprehension, using tab as delimiter
f=open('pizzastudy.txt')
data=[i.strip().split('\t') for i in f]
#get indexes of columns
treatment=data[0].... |
<gh_stars>1-10
import numpy as np
from scipy import integrate
from pymoc.utils import make_func, make_array, check_numpy_version
class Column(object):
r"""
Vertical Advection-Diffusion Column Model
Instances of this class represent 1D representations of buoyancy in a water
column governed by vertical advecti... |
<reponame>CamDavidsonPilon/zepid
import warnings
import math
import numpy as np
import pandas as pd
from scipy import stats
import matplotlib.pyplot as plt
class MonteCarloRR:
'''Monte Carlo simulation to assess the impact of an unmeasured binary confounder on the results
of a study. Observed RR comes from th... |
import numpy as np
#import DccFort as FDCC
from numpy import unravel_index
from scipy import interpolate
from scipy.interpolate import RegularGridInterpolator
from scipy.optimize import minimize
import scipy.io as sio
import scipy.interpolate as interp
from scipy.interpolate import RegularGridInterpolator
... |
<reponame>mwpb/bayesian-regression
# ---
# jupyter:
# jupytext:
# formats: ipynb,py:light
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.4'
# jupytext_version: 1.2.4
# kernelspec:
# display_name: Python 3
# language: python
# name: pytho... |
<gh_stars>0
from sympy import symbols, integrate, Rational, lambdify, solve
import matplotlib.pyplot as plt
import numpy as np
g_xlim = [ -8, 8 ]
def plot_fun( fun, name, col ):
x_vals = np.linspace( g_xlim[0], g_xlim[1], 1000, endpoint=True )
y_vals = fun( x_vals )
plt.plot( x_vals, y_vals, label = name, color = ... |
<gh_stars>0
#!/usr/bin/env python
# encoding: utf-8
# @author: ysl
# @file: csvadaptor.py
# @time: 2020/4/17 17:05
# @version v1.0
# @desc:
#
#
import argparse
import sys
import pickle
import spartan as st
import scipy as S
import numpy as N
import pandas as pd
import io
def coo_submatrix_pull(matr, rows, cols):
"... |
import time
from absl import app, logging
import cv2
import numpy as np
import tensorflow.compat.v1 as tf
from flask import Flask, request, Response, jsonify, send_from_directory, abort
import os
from .config import shooting_result
import sys
from sys import platform
import argparse
import matplotlib.pyplot as plt
from... |
import numpy as np
import pandas as pd
import scipy.sparse
import macau
np.random.seed(1234)
Y = pd.DataFrame({
"A": np.random.randint(0, 5, 7),
"B": np.random.randint(0, 4, 7),
"C": np.random.randint(0, 3, 7),
"value": np.random.randn(7)
})
Ytest = pd.DataFrame({
"A": np.random.randint(0, 5, 5),
... |
from matplotlib import pyplot as plt
from numpy import multiply, array, median, meshgrid, arange, zeros, dstack, vectorize
from numpy.linalg import inv
from math import floor, ceil
from scipy.stats import mode
from plotly.graph_objects import Figure, Scatter3d
import torch
from torch.utils.data import Dataset
import os... |
import scipy.sparse as sparse
import matplotlib.pyplot as plt
import scipy.io as io
from math import sqrt, atan, cos, sin, pi, atan2
import numpy as np
from nutils import *
cc = list('gbcmy')
def plot_opt_splitting2(e, w, W):
df = 0.01
w_span = np.arange(w,W+2.0*pi*df,2.0*pi*df)
J_span2 = np.em... |
import sys
import io
import click
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from scipy.special import betainc
from scipy.stats import wilcoxon
from statsmodels.stats.multitest import fdrcorrection, multipletests
SIGNIFICANT_COLOR = sns.color_palette('colorblind')[2]
O... |
from ball import Ball, Cup
from ballstring import String
import pygame
import gym
from gym import error, spaces, utils
import numpy as np
from math import sqrt, cos
from cmath import phase
WIDTH = 1200
HEIGHT = 700
pygame.init()
pygame.font.init()
pygame.display.set_mode((WIDTH, HEIGHT))
class Ga... |
<reponame>HerrZYZ/scikit-network<filename>sknetwork/classification/diffusion.py<gh_stars>100-1000
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mar, 2020
@author: <NAME> <<EMAIL>>
"""
from typing import Optional
import numpy as np
from scipy import sparse
from sknetwork.classification.base_rank import... |
<filename>models_config/predict_unet2d.py
# -*- coding:UTF-8 -*-
# !/usr/bin/env python
#########################################################################
# File Name: predict.py
# Author: Banggui
# mail: <EMAIL>
# Created Time: 2017年04月25日 星期二 14时18分55秒
#########################################################... |
<gh_stars>0
import cmath
import ConsoleUtil as cu
def sgn(a):
return 1 if a >= 0 else -1
def quad_eq(a, b, c):
x_1 = -((b + sgn(b) * cmath.sqrt(b ** 2 - 4 * a * c)) / (2 * a))
x_2 = c / (a * x_1)
return (x_1, x_2)
def run():
formating = '.3e'
print("Skriv inn koeffisientene til en andregra... |
#!/usr/bin/env python
#
# Created on 07/11/2014 <NAME> - Vightel Corporation
#
# Input: Landsat8 Atmospherically Corrected GeoTiff EPSG:4326
# Output: Water map
#
import os, inspect, sys
import argparse
import numpy
import scipy
import math
from scipy import ndimage
from osgeo import gdal
from osgeo import osr
from... |
"""Normal distribution
"""
import numpy as np
from scipy.stats import norm
from xgboost_distribution.distributions.base import BaseDistribution
class Normal(BaseDistribution):
"""Normal distribution with log scoring
Definition:
f(x) = exp( -[ (x-mean) / std ]^2 / 2 ) / std
We reparameterize:
... |
import torch
import torch.nn as nn
class HookBasedFeatureExtractor(nn.Module):
def __init__(self, model, layer_name, upscale=False):
super(HookBasedFeatureExtractor, self).__init__()
self.model = model
self.model.eval()
self.layer_name = layer_name
self.outputs_size = None... |
<reponame>ma-kast/AMfe
#
# Copyright (c) 2018 TECHNICAL UNIVERSITY OF MUNICH, DEPARTMENT OF MECHANICAL ENGINEERING, CHAIR OF APPLIED MECHANICS,
# BOLTZMANNSTRASSE 15, 85748 GARCHING/MUNICH, GERMANY, <EMAIL>.
#
# Distributed under 3-Clause BSD license. See LICENSE file for more information.
#
"""
Module for updating bas... |
import matplotlib.pyplot as plt
import numpy as np
from scipy.stats import lognorm
gmax=.000333
gmin=.000000333
w_max = 0.3
w = 0.1
gp = w/w_max * (gmax - gmin) + gmin
gn = gmin
fig = plt.figure()
ax1 = fig.add_subplot(4, 1, 1)
ax2 = fig.add_subplot(4, 1, 2)
ax3 = fig.add_subplot(4, 1, 3)
ax4 = fig.add_subplot(4, ... |
<gh_stars>1-10
## HISTOGRAM PLOTTING 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 matplotlib.pyplot as plt
import time as tictoc
from netCDF4 import Datase... |
import numpy as np
from scipy.special import expit
import pandas as pd
import networkx as nx
class NPWord2Vec:
def __init__(
self,
embedding_dim,
learning_rate=0.05,
negative_rate = 5,
uniform_ratio = 1.0,
ns_exponent=0.75,
loss="logsigmoid",
mirror=F... |
<reponame>Nikhil-Xavier-DS/Self_Driving_Car----Computer-Vision---Deep-Learning<filename>Self_Driving_Car----Vehicle-Detection/libraries.py
import matplotlib.image as mpimg
import numpy as np
import cv2
from skimage.feature import hog
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
im... |
<filename>src/visualization/visualize_manual_data.py<gh_stars>1-10
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# formats: ipynb,py:light
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.11.3
# kernelspec:
# displa... |
<gh_stars>1-10
import numpy as np
from random import shuffle
from astropy.convolution import Box1DKernel
from astropy.convolution import convolve
import scipy.io as io
import scipy.interpolate as interp
from tqdm import tqdm
from glob import glob
import os
import pickle
import time
from mpi4py import MPI
import argpars... |
<filename>niftynet/contrib/evaluation/segmentation_evaluations.py<gh_stars>0
"""
This module holds built-in segmentation evaluations without tests
"""
import os
import numpy as np
import pandas as pd
from scipy import ndimage
from niftynet.evaluation.base_evaluations import BaseEvaluation
from niftynet.evaluation.se... |
<reponame>metno/pyromsobs
import numpy as np
from netCDF4 import Dataset
from .utils import popEntries, setDimensions
from .OBSstruct import OBSstruct
from scipy.interpolate import griddata,interp1d
def applyMask(S,romsfile):
if not isinstance(S,OBSstruct):
fid = Dataset(S)
OBS = OBSstruct(fid)
... |
import csv
import numpy as np
import matplotlib.pyplot as plt
import array
import pandas as pd
from scipy import stats
import steric_tools as st
import tas_tool as tt
## scenario: CMIP scenario
## yta_st : Time range start [Inclusive]
## yta_ed : Time range end [Inclusive]
## ybl_st : Baseline period start [Inclusive]... |
import numpy as np
from numpy import random, linspace, cos, pi
import math
import random
import matplotlib.pyplot as plt
from scipy.fft import fft, fftfreq
from scipy.fft import rfft, rfftfreq
import copy
from mpl_toolkits.mplot3d import axes3d
from mpl_toolkits import mplot3d
from plotly import __version__
import pand... |
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
from copy import deepcopy
import sys
from imageio import imwrite
import math
import os
import random
from collections import deque
import numpy as np
import scipy.linalg as sp_la
from imageio import mimwrite
import torch
import torch.nn as nn
impo... |
<filename>VCPWithFreeRTOS/Host/ArmorPanelCommand.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
def to_real_panel(panel):
"""2次元配列から7SegArmorの実配列への変換
<armor0> <armor1> <armor2>
panel[0][0:8] panel[0][8:16] panel[0][16:24]
panel[1][0:8] panel[1][8:16] panel[1][16:24]
p... |
import os
import re
import sys
import json
import numpy as np
import tensorflow as tf
from scipy import signal
# Hack to put BSDS on the path
sys.path.append(
os.path.join(
'/media',
'data_cifs',
'cluster_projects',
'BSDS500',
'py-bsds500'))
def update_config(param_dict, ... |
#!/usr/bin/env python
from __future__ import division
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import numpy as np
from PIL import Image
import random
import cv2
import collections
import rospy
from geometry_msgs.msg import Twist,Pose
from nav_msgs.msg import Odometry
import numpy as np
import math
im... |
import numpy as np
import os
from sklearn.preprocessing import MinMaxScaler
from sklearn.cluster import KMeans
from sklearn.metrics import accuracy_score
import matplotlib.pyplot as plt
from scipy import stats
from scipy.spatial import distance
import math
import pickle
from sklearn.neighbors import KNeighborsClassifie... |
"""
system.py
Handles the system class for openMM
"""
# Global imports
import openmm
import openmm.app
from simtk import unit
import numpy as np
import pandas
import sklearn.decomposition
import configparser
import prody
import scipy.spatial.distance as sdist
from . import utils
__author__ = '<NAME>'
__version__ = ... |
"""Data generation step."""
import argparse
import logging
from pathlib import Path
from typing import Tuple
import h5py
import numpy as np
from scipy.integrate import solve_ivp
from common import BETA, DATA_DIR, RHO, SIGMA
def lorenz(_: float, u: np.ndarray, sigma: float, rho: float,
beta: float) -> np... |
<reponame>babylonhealth/multiverse
"""
We compute the ground truth values of counterfactual queries
using enumeration.
To compute, we enumerate over all possible combinations
of exogenous variables twice:
1. First time we execute the program with each combination
without interventions to calculate the posterior l... |
import numpy
import json
import cv2
import numpy as np
import os
import scipy.misc as misc
# Create semantic map from instance map
#############################################################################################
def show(Im):
cv2.imshow("show",Im.astype(np.uint8))
cv2.waitKey()
cv2.d... |
import numpy as np
import scipy as sp
def norm_cdf_int(mu, std, LB, UB):
""" Return P(LB < X < UB) for X Normal(mu, std) """
rv = sp.stats.norm(mu, std)
return rv.cdf(UB) - rv.cdf(LB)
def norm_cdf_int_approx(mu, std, LB, UB):
"""
Return P(LB < X < UB) for X Normal(mu, std) using approximation of ... |
import os
import sys
import glob
import numpy as np
import pandas as pd
from scipy.spatial import distance_matrix as distance_matrix
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
import ply_io
import qrdar
rotation = np.array([[0, 0, 1, 0],
[0, -1, 0, 0],
... |
# -*- coding: utf-8 -*-
"""
@File: patent2vec.py
@Description: This is a module for generating document embedding for patents.
This application,
1. Creates Patent2Vec model
2. Initializes Patent2Vec model's weights
with pre... |
#!/usr/bin/env python
# Copyright 2014-2018 The PySCF Developers. 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
#
# U... |
<filename>regseg/misc.py
#!/usr/bin/env python
# coding: utf-8
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
Miscelaneous helpers
"""
from __future__ import print_function, division, absolute_import, unicode_literals
import os.path as op
import n... |
<gh_stars>1-10
import itertools
from typing import Any, Dict, List, Set
import scipy.stats
import pandas
def read_pmids_tsv(path, key, min_articles = 1):
term_to_pmids = dict()
pmids_df = pandas.read_table(path, compression='gzip')
pmids_df = pmids_df[pmids_df.n_articles >= min_articles]
for i, row i... |
<gh_stars>1-10
#!/usr/bin/python3
# coding: utf-8
'''
Optimize a total score of final exems
Based on
https://stackoverflow.com/questions/21765794/python-constrained-non-linear-optimization?rq=1
'''
import numbers
from collections import namedtuple
import numpy as np
import matplotlib.pyplot as plt
from s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.