text string |
|---|
<filename>tmp_test_overwrite_tensorboard.py
import os
import sys
from os.path import join,basename,dirname,splitext
from pathlib import Path
import numpy as np
import scipy
from scipy import io
import scipy.sparse as sp
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib as mpl
from pprint import ppri... |
import os
import csv
import numpy as np
import pandas as pd
import pickle
import networkx as nx
from scipy.linalg import eigh
from itertools import product, permutations, combinations
import matplotlib.pyplot as plt
from sklearn.metrics import roc_curve, roc_auc_score
class DeshpandeMontanari:
def __init__(self, ... |
<gh_stars>100-1000
"""Custom expansions of :mod:`sklearn` functionalities.
Note
----
This module provides custom expansions of some :mod:`sklearn` classes and
functions which are necessary to fit the purposes for the desired
functionalities of the :ref:`MLR module <api.esmvaltool.diag_scripts.mlr>`. As
long-term goal ... |
import numpy as np
import mne
from warnings import warn
from sarna.utils import group, _invert_selection, _transfer_selection_to_raw
# from numba import jit
def dB(x):
return 10 * np.log10(x)
# - [ ] add detrending (1 + x + 1/x) or FOOOF cooperation
def transform_spectrum(spectrum, dB=False, normalize=False, de... |
<gh_stars>1-10
#!/usr/bin/env python
import collections
import os.path as osp
import random
import numpy as np
import scipy.io
import torch
import matplotlib.pyplot as plt
from torch.utils import data
import torchvision
from torchvision.transforms import Compose, CenterCrop, Normalize, Resize, Pad
from torchvision.tra... |
<gh_stars>1-10
from abc import ABC
import numpy as np
import scipy.sparse as sps
from src.model.HybridRecommender.AbstractHybridRecommender import AbstractHybridRecommender
# --------- UTILITY ---------
def get_ui_matrix_from_ranking(ranking, scores, n_users, n_items):
ranking_ui_matrix = sps.coo_matrix((n_user... |
<reponame>robert-anderson/pyscf
#!/usr/bin/env python
# constrained DFT
# written by <NAME>. <EMAIL>
r'''
Constrained DFT (cDFT) is a method to control the locality of electron density
during the SCF calculation. By constraining the electron density or occupation
on a particular orbital, atom, or functional group, cDF... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Timing argument calculations
Author: <NAME>.
"""
import numpy as np
import scipy.optimize as sp
import matplotlib.pyplot as plt
import sys
import math
# r = physical distance between MW and M31
# This evolves according to a differential equation involving G... |
<gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 8 13:04:14 2019
@author: avelinojaver
"""
import cv2
import numpy as np
from scipy.spatial.distance import cdist
from scipy.optimize import linear_sum_assignment
def cv2_peak_local_max(img, threshold_relative, threshold_abs):
... |
import numpy as np
import scipy.ndimage
def merge_bisenet_annotations(mask):
# remove ears and earrings
mask[np.logical_and(mask >= 7, mask <= 9)] = 0
# merge face parts
mask[np.logical_and(mask > 1, mask <= 13)] = 1
# remove hair, background, hat, neck, etc
mask[mask > 13] = 0
return mas... |
<reponame>Leits/openprocurement.auction<filename>openprocurement/auction/forms.py
from wtforms import Form, FloatField, StringField
from wtforms.validators import InputRequired, ValidationError, StopValidation
from fractions import Fraction
import wtforms_json
wtforms_json.init()
######################################... |
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from matplotlib import cm
import numpy as np
import networkx as nx
import scipy as sp
import scipy.sparse
def plot_bands(e, size=75):
"""
Plots the two bands side by side.
"""
plt.title('band 1 | band_2')
plt.imshow(np.c_[e.ban... |
import matplotlib.pyplot as plt
import numpy as np
import tifffile as tiff
import scipy
import os, json
from PIL import Image
from errors import check_paths
CONFIGS = './configs/transforms.json'
def prepare_settings():
if not os.path.exists('./configs'):
os.makedirs('./configs')
if not os.path.exists... |
<filename>ceRNA/Simulate.py
import pickle
import numpy as np
import scipy.integrate
import stochpy
from pdb import set_trace
from typing import Callable
def base_network_ode_solution(ks, mus, gammas):
# Returns a function which will calculate the derivatives
n = len(ks)
def calculate_derivatives(species_... |
import numpy as np
import scipy
from scipy.io import wavfile
from scipy.fftpack import dct
import matplotlib.pyplot as plt
import librosa
import math
import wave
from scipy.signal import lfilter, hamming
import warnings
warnings.filterwarnings('ignore')
import pickle
from sklearn import svm
from sklearn import preproc... |
<filename>test_few_shot.py
import argparse
import yaml
import random
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import scipy.stats
from tqdm import tqdm
from torch.utils.data import DataLoader
from datasets.dataset import make
from datasets.samplers import CategoriesSampler
... |
<filename>gap_test_stats.py<gh_stars>1-10
#!/usr/bin/env python3
#
# Copyright 2020 <NAME>
#
# 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
... |
<filename>cpab/distributions/standard_cdfs.py
#!/usr/bin/env python
"""
Created on Sat Oct 18 11:07:04 2014
Author: <NAME>
Email: <EMAIL>
"""
import numpy as np
from scipy.special import erf
def cdf_1d_gaussian(x,mu=0,sigma=1):
return 0.5*(1+erf((x-mu)/np.sqrt(2)/sigma))
if __name__ == "__main__":
pass... |
<filename>docker/flat/anomaly_simulation_v5.py
from typing import List, Tuple, Generator, Iterator
from enum import Enum
from os import path
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
import numpy as np
import scipy as sp
import pandas as pd
import matplotlib.pyplot as plt
# Set custom matplotlib themes
#tr... |
import os
import glob
import re
import sys # access system routines
import math
import scipy
import numpy as np
import matplotlib.pyplot as plt
import Common
import Plotting
# The aim of this module is to be able to read BER data in the format I currently have it stored
# Then make plots of single / multiple BER cu... |
<filename>figures/scripts/poisson.py
#!/usr/bin/env python
"""
Make plots of the Poisson distribution for different rates
"""
import matplotlib.pyplot as pl
from scipy.stats import poisson
mus = [0.5, 1., 3., 5.] # rates, mu
markers = ['bo-', 'ro-', 'mo-', 'ko-']
x = range(0, 11) # number of counts, r
# set plot t... |
# -*- coding: utf-8 -*-
#%%
#Basic setup
import numpy as np
import scipy as sp
from ismrmrdtools import sense, grappa, show, simulation, transform,coils
#%%
#import some data
exercise_data = sp.io.loadmat('hansen_exercises2.mat')
csm = np.transpose(exercise_data['smaps'])
pat = np.transpose(exercise_data['sp'])
data ... |
# To train a SVM classifier based on the features extracted for Void
# According to the original paper, when training on ASVspoof 2017 dataset, the SVM RBF classifier is
# trained with data in both training and developing sets and evaluated against the evaluation set.
import numpy as np
import scipy.io.wavfile as wa... |
<filename>scripts/pedestals.py
import numpy as np
from matplotlib import pyplot as plt
import numba as nb
import sys, mplhep
from numba_stats import norm_pdf
from scipy.stats import norm
plt.style.use(mplhep.style.ATLAS)
GUI = False
if "plot" in sys.argv:
GUI = True
@nb.njit(fastmath=True)
def gauss(x, par):
... |
<filename>archive/perform_welchs_test.py<gh_stars>0
"""
Perform Welch's unequal variances t-test to evaluate whether alpha is the same across genes, constructs or ncs.
Each of the three parts of the code corresponds to one changing parameter.
All of the tests are performed for alpha since we saw that it is close to be... |
import numpy as np
import scipy as sci
import scipy.spatial as scisp
import Utility as utl
import FiniteElement as fem
import importlib
'''
This program was written by <NAME> on June 10th, 2015.
It is based upon the OdfPf library that the Deformation Processing Lab has written in MATLAB.
The following functions are a... |
<filename>multitracking_test.py
__author__ = "<NAME>"
__copyright__ = "Copyright 2017, AI Research, Data Technology Centre, Volkswagen Group"
__credits__ = ["<NAME>, <NAME>"]
__license__ = "MIT"
__maintainer__ = "<NAME>"
import numpy as np
import glob
import cv2
import sys
import timeit
from scipy import ndimage
from... |
# --------------------------------------------------------------------------------------
# Copyright (C) 2020–2021 by <NAME> <<EMAIL>>
#
# Permission to use, copy, modify, and/or distribute this software for any purpose
# with or without fee is hereby granted.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DIS... |
<reponame>caballeto/DirectDemod
'''
fm specific
'''
from directdemod import source, sink, chunker, comm, constants, filters, demod_am, demod_fm
import numpy as np
import matplotlib.pyplot as plt
import scipy.io.wavfile as wavf
import time
'''
Object to decode wide or narrow FM
'''
class decode_fm:
'''
Objec... |
import warnings
import copy
import logging
import numpy as np
from scipy.interpolate import CubicSpline as spCubicSpline
from ..utils.tools import interval_selection, piezo_selection
ana_logger = logging.getLogger("ascam.analysis")
debug_logger = logging.getLogger("ascam.debug")
def interpolate(
signal, time,... |
import scipy.ndimage
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
# Changing figure's font to Times New Roman
plt.rcParams["font.family"] = "serif"
plt.rcParams["font.serif"] = "Times New Roman"
def show_images(images, cols = 1, titles = None):
"""D... |
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 24 22:48:15 2016
@author: ORCHISAMA
"""
from __future__ import division
from scipy.signal import hamming
from scipy.fftpack import fft, fftshift, dct
import numpy as np
import matplotlib.pyplot as plt
def hertz_to_mel(freq):
return 1125*np.log(1 + freq/700)
def... |
<gh_stars>10-100
# For each channel, we assume all the pixel (x,y) dimensions are i.i.d., and solve a scalar quantization problem
import numpy as np
np.random.seed(0)
import tensorflow as tf
import utils
class ChannelwisePriorCDFQuantizer:
def __init__(self, num_channels, max_bits_per_coord, float_type='floa... |
import numpy as np
from PIL import Image
import os
from skimage.transform import resize
from scipy.ndimage.filters import convolve
import argparse
from sklearn.metrics import mean_squared_error as compare_mse
from sklearn.metrics import mean_absolute_error as compare_mae
from skimage.measure import compare_psnr
from ... |
<filename>Sdistribution.py<gh_stars>0
# ---------------------------------------
# The modified mass function distribution
# ---------------------------------------
#
# This code utilizes the modified mass function, S, introduced
# by Shahaf, Mazeh and Faigler (2017, MNRAS)... |
<reponame>erichstrange/homework-8-group-3-1<gh_stars>0
"""Implementation of 2 sided CI of treatment effect."""
import math
import numpy as np
import scipy as sp
from scipy.special import comb
from itertools import filterfalse, combinations
from scipy.stats import hypergeom
def tau_twosided_ci(n11, n10, n01, n00, alp... |
<reponame>WINGHARE/Actmatcomp
"""
Author: <NAME> <EMAIL>
License: BSD 3 clause
"""
import os
import string
import sys
import random
import logging
import numpy as np
import pandas
import scipy.stats
from scipy.cluster.hierarchy import dendrogram, fcluster, linkage
from scipy.spatial.distance import cdist, pdist, sq... |
# External
# import scipy as scp
from scipy.stats import gamma
import numpy as np
# import hddm.simulators
# Collection of boundary functions
# Constant: (multiplicative)
def constant(t=0):
"""constant boundary"""
return 1
# Angle (additive)
def angle(t=1, theta=1):
"""angle boundary
:Arguments:
... |
<gh_stars>0
import sys
import os
import random
import numpy as np
from shapely.geometry import Polygon, MultiPolygon, LineString, MultiLineString, Point, LinearRing
from shapely.ops import polygonize, cascaded_union
from scipy.spatial.qhull import Delaunay
from crowddynamics.simulation.agents import Agents... |
<reponame>PacktPublishing/Data-Science-Algorithms-in-a-Week-Second-Edition<gh_stars>10-100
import numpy as np
from scipy.linalg import lstsq
month = np.array([1,2,3,4,5])
bill = np.array([120.0,131.2,142.1,152.9,164.3])
M = month[:, np.newaxis]**[0, 1]
model, _, _, _ = lstsq(M,bill)
print "Intercept =", model[0]
prin... |
from typing import Dict
import pandas as pd
from plot_keras_history import plot_history
from scipy.optimize import OptimizeResult
from ..space import Space
class History:
def __init__(self, space: Space, maximization_problem: bool):
self._history = []
self._space = space
self._maximization... |
import numpy as np
import matplotlib.pyplot as plt
import scipy.misc
# Use Dan FM's favourite fonts
plt.rc("font", size=20, family="serif", serif="Computer Sans")
plt.rc("text", usetex=True)
# Number of patients
N = 50
# Possible values for x
x = np.arange(0, N+1)
# p(x | H0)
p = scipy.misc.comb(N, x)*0.6**x*(1.0 -... |
import unittest
import numpy as np
from nptest import nptest
from scipy.interpolate import interp1d
class Test_NumericOperationsTests(unittest.TestCase):
def test_add_operations(self):
a = np.arange(0, 20, 1, dtype = np.int16)
a = a.reshape(5,-1)
print(a)
print(a.shape)
p... |
import configparser
import numpy
import sys
import time
import random
import argparse
import math
import os
import sys
from ast import literal_eval
from copy import deepcopy
import json
from numpy.linalg import norm
from numpy import dot
import codecs
from scipy.stats import spearmanr
import pandas as pd
from sklearn.... |
from sympy import *
from numpy import linalg
import numpy as np
#Function that finds modular inverse of number x
def modinv(x, mod):
for y in range(mod):
z = x * y
if (z % mod) == 1:
break
else:
raise ValueError('%d has no inverse mod %d' % (x, mod))
return ... |
from skopt import BayesSearchCV
import numpy as np
from scipy.stats import multivariate_normal
from evaluation.scoring import crps
counter = 0
opt = None
def bayesian_optimization(model, space, scorer, x_train, y_train, x_test, y_test, n_iter=256, cv=4, n_jobs=None):
global counter
global opt
if n_jobs... |
import os
import pathlib
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
import numpy as np
import torch
from scipy import linalg
from torch.nn.functional import adaptive_avg_pool2d
from PIL import Image
try:
from tqdm import tqdm
except ImportError:
# If not tqdm is not available, provide... |
import numpy as np
import pytest
import torch
from torch.autograd import gradcheck
from ..custom_periodic_kernel import PeriodicKernelNoConstant, i0e_torch
from ...tests.PERnc_testValuesAndGrads import PERnc_testValuesAndGrads
from scipy.special import i0e
from ...kernel_specs import PeriodicNoConstKernelSpec
from ..k... |
# -*- coding: utf-8 -*-
# Copyright (c) 2017 - for information on the respective copyright owner
# see the NOTICE file and/or the repository https://github.com/boschresearch/statestream
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.... |
<filename>doc/src/LectureNotes/_build/jupyter_execute/chapter4.py
<!-- dom:TITLE: Oscillations -->
# Oscillations
<!-- dom:AUTHOR: [<NAME>](http://mhjgit.github.io/info/doc/web/) at Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University, USA & Department of Phys... |
from __future__ import print_function
import tensorflow as tf
import numpy as np
from scipy import ndimage
from scipy.spatial.distance import euclidean
import TensorflowUtils as utils
import read_Data_list as scene_parsing
import BatchDatsetReader as dataset
from six.moves import xrange
import sys
FLAGS = tf.flags.FL... |
from swan import pycwt
import numpy as np
import matplotlib.pyplot as plt
import wave
#import struct
from scipy import fromstring, int16
#from pylab import *
#from scipy import signal
wavfile = 'hirakegoma.wav'
#wavfile = 'ohayo.wav'
wr = wave.open(wavfile, "rb")
ch = wr.getnchannels()
width = wr.getsampwidth()
fr = ... |
#!/usr/bin/env python
'''
Advent of Code 2021 - Day 7: The Treachery of Whales (Part 1)
https://adventofcode.com/2021/day/7
Minimizing the sum of absolute distances to a point.
References:
https://www.geeksforgeeks.org/optimum-location-point-minimize-total-distance/
https://math.stackexchange.com/questions/3092033/f... |
<reponame>metai/aitrace
import numpy as np
from scipy import signal
import matplotlib.pyplot as plt
Ts = 5
Fs = 400.0
n = Ts * Fs
f1 = 10
f2 = 25
f3 = 50
f4 = 100
t1 = np.linspace(0, Ts, n)
x1 = np.cos(2 * np.pi * f1 * t1)
t2 = np.linspace(Ts, 2 * Ts, n)
x2 = np.cos(2 * np.pi * f2 * t2)
t3 = np.linspace(2 * Ts, 3 * ... |
import numpy as np
from scipy.spatial.transform import Rotation as R
def matrix_to_quat(mat):
quat = R.from_matrix(mat).as_quat()
# xyzw -> wxyz
quat[1], quat[2], quat[3], quat[0] = quat[0], quat[1], quat[2], quat[3]
return quat
def quat_to_matrix(quat):
quat = quat.copy()
# wxyz -> xyzw
... |
<reponame>parvusvox/pydynamica<filename>pydynamica/env.py<gh_stars>1-10
from pydynamica.agent import Agent
from pydynamica.terrain import Resources, create_grid_world_parallel
import numpy as np
import random
import statistics
from pydynamica.utils import log
# default configs
# collection_rate = 2
class Env():
d... |
import numpy as np
from scipy.special import factorial,multigammaln
from decimal import Decimal
"""
The node class which has a tree-shaped structure for the hierarchical clustering.
Each node acts as a cluster and initially starts with one point when we start combining the nodes
we update the l... |
<reponame>bab81/RandomForest<gh_stars>0
import numpy as np
import traceback
import sys
from scipy.io import loadmat
###### Autograder file
def runtest(test, name):
print('Running Test: %s ... ' % (name), end='')
try:
if test():
print('✔ Passed!')
else:
print(
... |
import numpy as np
from ploting import Plot2d
from formulate import formulate_BNLSE, formulate_GNLSE
from combined_functions import overlap, dF_sidebands, sim_parameters, \
float_range, pulse_propagation_adaptive, pulse_propagation_constant,\
pulse_propagation_constant_timer
from scipy.constants import pi
impor... |
# SachinKalsi GITHUB
# https://github.com/SachinKalsi/kmedoids/blob/master/KMedoids.py
from typing import Optional
from scipy.sparse import csr_matrix
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import random
import pprint
from clustviz.utils import COLOR_DICT, annotate_points
class KMedoi... |
<reponame>pulkitag/pyphy-engine
import numpy as np
import matplotlib.pyplot as plt
import collections as co
import cairo
import math
import pdb
import copy
from collections import deque
import os
import scipy.io as sio
import scipy.misc as scm
import pickle
#Custom packages
import primitives as pm
import geometry as gm... |
<gh_stars>0
import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import CubicSpline
from matplotlib import pyplot
from numpy.polynomial.polynomial import polyfit
from numpy.polynomial import Polynomial as poly
def q1():
x = np.linspace(-1, 1, 100)
y = x**2 + 1
plt.plot(x, y... |
"""
元ソース:Port of Single Shot MultiBox Detector to Keras
https://github.com/rykov8/ssd_keras
SSD_training.ipynb
"""
import sys
sys.path.append(r'C:\Users\shingo\jupyter_notebook\tfgpu_py36_work\AI_Edge_Contest\object_detection\SSD_classes_py\all_SSD_module\SSD')
import random
import os
import numpy as np
import PIL.Im... |
<gh_stars>1-10
import sys
import struct
from fractions import Fraction
def pp4(fourcc):
(a,b,c,d) = struct.unpack("4B", fourcc)
return "%02x%02x%02x%02x" % (d, c, b, a)
class Avi:
def __init__(self, filename):
self.f = open(filename, "r+b")
self.atime = 0
self.vtime = 0
def ge... |
# -------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
# ----------------------------------------------------------------------... |
<filename>tutorials/03_exact_integration_simple.py<gh_stars>1-10
print("""
Numerical homogenisation based on exact integration, which is described in
<NAME>, Improved guaranteed computable bounds on homogenized properties
of periodic media by FourierGalerkin method with exact integration,
Int. J. Numer. Methods Eng., 2... |
<filename>LED2Net/PostProcessing.py
import torch
import torch.nn as nn
import numpy as np
from scipy.optimize import least_squares
from functools import partial
from .Conversion import EquirecTransformer
def errorCalculate(ratio, up_norm, down_norm):
error = np.abs(ratio * up_norm - down_norm)
#error = np.abs(... |
<gh_stars>0
#------------------------#
# Apache License 2.0
# @copyright
#------------------------#
# Common library
import sys
# feature realted library
import numpy as np
import scipy.linalg as lalgebra
def get_column(narr, col_num):
"""
:param narr:
:return:
"""
if col_num < narr.shape[1]:
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri May 14 11:23:03 2021
@author: abauville
Projet avec Dewi: optimization de la productivite en O2 des organismes en fonction de la profondeur
d'apres le papier de Berg et al 1998
"""
import numpy as np
import matplotlib.pyplot as plt
from scipy.sparse ... |
<filename>Image segmentation using EM.py
# coding: utf-8
# ## Image segmentation using EM
#
# Segment images using a clustering method - each segment is the cluster center to which a pixel belongs.
#
# Image pixels are represented by their r, g, and b values. EM algorithm is applied to the mixture of normal distr... |
# Copyright 2019-2021 Cambridge Quantum Computing
#
# 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 a... |
<filename>src/data/everest.py
"""Compile raw data from everest stations
"""
# External modules
import sys, os
import pandas as pd
import numpy as np
from datetime import datetime, timedelta
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
from matplotlib.backends.backend_pdf import PdfPages
from panda... |
<reponame>LungCellAtlas/LCA_preprocessing<filename>lca/scib_excerpts.py
import scanpy as sc
import anndata
import numpy as np
from scipy import sparse
# This script contains mostly functions taken from scib (https://github.com/theislab/scib)
# (see also https://www.biorxiv.org/content/10.1101/2020.05.22.111161v2), tha... |
#THIS CLASS ISN't NEEDED ANYMORE!
#(I still like it. Try it. alt saves and esc exits (R reloads))
import pygame, numpy, sys, scipy
from PIL import Image
from pygame import gfxdraw
def premultiply(im):
pixels = im.load()
for y in range(im.size[1]):
for x in range(im.size[0]):
r, g, b, a = p... |
<filename>src/model.py
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
# Modifications Copyright 2017 <NAME>
#
# 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.a... |
<reponame>felipefr/netfibGen
#~ from generator import *
#~ from delaunay import *
from scipy.spatial import Delaunay
import numpy as np
import matplotlib.pyplot as plt
import copy
import os, sys
class Network:
def __init__(s): # default constructor
s.altenancyPointArea = [1,1]
s.asymFac = 0
s.meanThe... |
<filename>src/grid.py
'''
we have seperate operators for omega to k
vs k to omega
'''
import numpy as np
import scipy.sparse as sp
class FiniteDifferenceGrid():
'''
operations on a yee grid, such as averaging, derivatives, etc.
works for 1d and 2d since we have TE and TM seperation
... |
# So far we've been making our own plots to visualize accuracy over time.
# Tensorflow comes with a tool tensorboard in which we can visualize merge_all
# the variables (including weights and biases) and even data points.
# In this exercie we will use TF summary writers to dump variables while the
# model is learaning.... |
<filename>pyzx/sparsify.py
import random
import math
from fractions import Fraction
def is_gadget(g, v):
return g.vertex_degree(v) == 1 and g.type(v) == 1
def is_boundary(g, v):
return g.type(v) == 0
def adj_gadget(g, v):
for n in g.neighbors(v):
if is_gadget(g, n): return (True, n)
return None... |
<gh_stars>1-10
import numpy as np
from scipy import signal
import emd
from scipy import stats
# helper function to flatten lists
def flatten(input):
new_list = []
for i in input:
for j in i:
new_list.append(j)
return new_list
def axes_to_list(axes_data: dict) -> list:
"""helper me... |
<reponame>iurteaga/menstrual_cycle_analysis
#imports
import matplotlib
import matplotlib.patches as mpatches
matplotlib.use('Agg')
import sys, os, re, time
import argparse
import pdb
import pickle
from itertools import *
# Science
import numpy as np
import scipy.stats as stats
import pandas as pd
from collections impor... |
<filename>brian2/utils/logger.py
'''
Brian's logging module.
Preferences
--------------------
.. document_brian_prefs:: logging
'''
import atexit
import logging
import os
import shutil
import sys
import tempfile
import time
from warnings import warn
import numpy
import scipy
import sympy
import brian2
from brian2.co... |
"""
Forward and inverse kinematics computations for robot joint control
<NAME> - <EMAIL>
"""
import robot_parameters
from robot_parameters import A1, A2
import numpy as np
import math
from numpy import random
from scipy.spatial import distance
def get_theta_two(x, y):
"""
Get theta2 angle for robot ar... |
<filename>Back-End/Python/Basics/Part -1 - Functional/09 - command line args/08_args_custom.py<gh_stars>10-100
import argparse
parser = argparse.ArgumentParser(description='testing defaults and flags')
parser.add_argument('--monty', action='store_const', const='Python')
parser.add_argument('-v', '--verbose', action='... |
from keras.models import Sequential
from keras.utils import np_utils
from keras.layers.core import Dense, Activation, Dropout
from keras import objectives
import pandas as pd
from scipy import stats
import pdb
import numpy as np
# from keras import backend as K
from sklearn.metrics import mean_squared_error
from sklear... |
<filename>draw_graph.py
#!/usr/bin/env python3
import argparse
import math
from statistics import mean
import sys
# these imports are relatively expensive, so delay them until needed
def import_matplotlib():
global matplotlib
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot
global ... |
<reponame>rfayat/sensors_IMU_head_tilt_rodents<filename>imu_helpers/head_tilt_features.py
"""Functions for computing IMU-extracted features describing postural deficits.
Author: <NAME>, July 2021
"""
import numpy as np
from scipy.spatial.transform import Rotation as R
def get_angle_x_to_xz(v, degrees=True):
"Ret... |
<reponame>StanfordASL/UP
import torch
import torch.nn as nn
import numpy as np
from tqdm import trange
import torch.optim as optim
from torch.utils.tensorboard import SummaryWriter
import datetime
from scipy import stats
from utils import ell_proj_np
from copy import deepcopy
def get_encoder(config, inp_dim):
ac... |
"""
flowfilter.plot
---------------
Module containing functions to plot flow fields.
:copyright: 2015, <NAME>, ANU. See AUTHORS for more details
:license: 3-clause BSD, see LICENSE for more details
"""
import pkg_resources
import numpy as np
import scipy.ndimage.interpolation as interp
import sc... |
import numpy as np
import scipy.linalg as linalg
import scipy.sparse
import scipy.sparse.linalg as splinalg
from simfempy import solvers
import simfempy.tools.iterationcounter
#=================================================================#
class LaplaceMixed(solvers.solver.Application):
"""
"""
def de... |
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 1 11:27:58 2020
@author: zh'h
"""
from numpy import *
import numpy as np
from numpy import genfromtxt
import math
from scipy import optimize, special
from pylab import *
import matplotlib.pyplot as plt
import pywt
from scipy import signal
import mpl_to... |
<filename>ml_baseline.py
from __future__ import absolute_import, print_function
import torch
import argparse
import os
from torch.utils.data import DataLoader, RandomSampler, SequentialSampler
from utils.data_utils import *
from utils.perf_utils import *
from utils.reduc_utils import *
from utils.plot_utils import *... |
<gh_stars>0
import os
import visdom
import torchvision.transforms as trans
import _init_paths
import torch
import xml.etree.ElementTree as ET
import numpy as np
import scipy.sparse
import scipy.io as sio
import pickle
import subprocess
import uuid
from datasets.factory import get_imdb
import cv2
vis = visdom.Visdom(se... |
<gh_stars>0
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Time : 3/8/2021 4:19 PM
# @Author: yzf
import hashlib
import pickle
import collections
from copy import deepcopy
from pathlib import Path
from abc import ABC, abstractmethod
from typing import Any, Optional, Callable, Sequence, Union, Dict, Tuple, H... |
<reponame>dajtmullaj/example_conda_pkg
import unittest
from unittest.mock import patch
from chemplot import Plotter
import pandas as pd
import numpy as np
from scipy import stats
from matplotlib import pyplot
from io import StringIO
class TestPCA(unittest.TestCase):
@classmethod
def setUpClass(cls):
... |
<filename>antitile/tiling.py<gh_stars>10-100
# -*- coding: utf-8 -*-
"""
Generic polyhedron and tiling methods
"""
import warnings
import numpy as np
from scipy import sparse
from scipy.sparse import csgraph
from . import xmath
class Tiling:
"""Generic class for tilings and polyhedrons
Args/Attributes:
... |
<reponame>JonathanWillnow/CompuStatsClustering
import numpy as np
import pandas as pd
import pandas.io.formats.style
import seaborn as sns
import matplotlib.pyplot as plt
import itertools as tools
import scipy.stats as scipy
import sklearn.datasets as sk_data
import sklearn.cluster as sk_cluster
import sklearn_extra.cl... |
<reponame>nealhnguyen/iotNetworkPowerAnalysisPaper
#region imports for plotly/dash graphing api
import dash
from dash.dependencies import Input, Output, State
import dash_core_components as dcc
import dash_html_components as html
import plotly
import plotly.graph_objs as go
import numpy as np
#endregion
#region genera... |
<filename>src/qinfer/tomography/legacy.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
# SMC.py: Tomgraphic models module
##
# © 2017, <NAME> (<EMAIL>) and
# <NAME> (<EMAIL>).
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditi... |
import numpy as np
import scipy as sp
import array as arr
def analyticEval (x,t):
return (-(1/2)*np.exp(-t)*(2*np.exp(t)*t-2*x-np.exp(t)*x**2))
L = 10
#Analytic solution
trail=[0,0,0,0,0,0,0,0,0,0,0]
print("Analytic solution:")
for i in range(0,11,1):
trail[i]=analyticEval(i/L,1)
print(trail)
L=10
T=0
K=1
H=1/... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.