text string |
|---|
<reponame>akakou/privacy-enhanced-antivirus<gh_stars>0
from kivy.lang import Builder
import array
import scipy
import os
import syft as sy
import tensorflow as tf
import numpy
import time
import scipy
import sys
from dataset import get_dataset
from cluster import get_cluster
from PIL import Image
import leargist
from... |
<filename>gentex/texmeas.py<gh_stars>1-10
""" gentex.texmeas package
"""
import numpy as np
class Texmeas:
"""Class texmeas for generating texture measures from co-occurrence matrix
Parameters
----------
comat: ndarray
Non-normalized co-occurrence matrix - chi-squared conditional distribu... |
import numpy as np
from scipy.interpolate import BSpline
from colossus.cosmology import cosmology
"""
Helper routines for basis functions for the continuous-function estimator.
"""
################
# Spline basis #
################
def spline_bases(rmin, rmax, projfn, ncomponents, ncont=2000, order=3):
'''
Co... |
import numpy as np
from scipy.optimize import curve_fit, minimize_scalar
h_planck = 4.135667662e-3 # eV/ps
h_planck_bar = 6.58211951e-4 # eV/ps
kb_boltzmann = 8.6173324e-5 # eV/K
def get_standard_errors_from_covariance(covariance):
# return np.linalg.eigvals(covariance)
return np.sqrt(np.diag(covariance))
... |
#!/usr/bin/env python
__author__ = "<NAME>"
__license__ = "Feel free to copy, I appreciate if you acknowledge Python for Microscopists"
# https://www.youtube.com/watch?v=6P8YhJa2V6o
"""
Using Random walker to generate lables and then segment and finally cleanup using closing operation.
"""
import matplotlib.pyplot ... |
<reponame>brjathu/PHALP
"""
Modified code from https://github.com/nwojke/deep_sort
"""
import numpy as np
import copy
import torch
import torch.nn as nn
import torch.nn.functional as F
import scipy.signal as signal
from scipy.ndimage.filters import gaussian_filter1d
class TrackState:
"""
Enumeration type... |
#!/usr/bin/env python
# BCET Workflow
__author__ = '<NAME>'
__date__ = 'September 2017'
__copyright__ = '(C) 2017, <NAME>'
__email__ = "<EMAIL>"
import os
import georasters as gr
import matplotlib.pyplot as plt
import numpy as np
from optparse import OptionParser
import fnmatch
import re
from scipy.interpolate impo... |
"""
Compiles stellar model isochrones into an easy-to-access format.
"""
from numpy import *
from scipy.interpolate import LinearNDInterpolator as interpnd
from consts import *
import os,sys,re
import scipy.optimize
#try:
# import pymc as pm
#except:
# print 'isochrones: pymc not loaded! MCMC will not work'
i... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
import os
import logging
from functions.et_helper import findFile,gaze_to_pandas
import functions.et_parse as parse
import functions.et_make_df as make_df
import functions.et_helper as helper
import imp # for edfread reload
im... |
import sys
import numpy as np
import h5py
import random
import os
from subprocess import check_output
# 1. h5 i/o
def readh5(filename, datasetname):
data=np.array(h5py.File(filename,'r')[datasetname])
return data
def writeh5(filename, datasetname, dtarray):
# reduce redundant
fid=h5py.File(filename,... |
import matplotlib
import matplotlib.pyplot as plt
import os
import pdb
import pickle
import copy
import scipy.signal
import scipy.interpolate
import numpy as np
from astropy.modeling import models, fitting
from astropy.nddata import CCDData, StdDevUncertainty
from astropy.io import ascii, fits
from astropy.convolution ... |
import os
import json
from copy import copy
from subprocess import call, Popen, PIPE, STDOUT
import time
import numpy as np
import pandas as pd
from pyproj import Transformer
import rasterio
import fiona
from affine import Affine
from shapely.geometry import shape
from scipy.ndimage.morphology import binary_erosion
fr... |
# License: BSD 3 clause
import gc
import unittest
import weakref
import numpy as np
import scipy
from scipy.sparse import csr_matrix
from tick.array.build.array import tick_double_sparse2d_from_file
from tick.array.build.array import tick_double_sparse2d_to_file
from tick.array_test.build import array_test as test
... |
import pytest
import numpy as np
from anndata import AnnData
from scipy.sparse import csr_matrix
import scanpy as sc
# test "data" for 3 cells * 4 genes
X = [
[-1, 2, 0, 0],
[1, 2, 4, 0],
[0, 2, 2, 0],
] # with gene std 1,0,2,0 and center 0,2,2,0
X_scaled = [
[-1, 2, 0, 0],
[1, 2, 2, 0],
[0, ... |
# -*- coding: utf-8 -*-
"""
Created on Tue May 25 10:24:05 2021
@author: danaukes
https://en.wikipedia.org/wiki/Rotation_formalisms_in_three_dimensions
https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation
https://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles
"""
import sympy
sympy.in... |
import scipy
from scipy.io import loadmat
import random
import numpy as np
from sklearn.metrics import zero_one_loss
from sklearn.naive_bayes import BernoulliNB,MultinomialNB,GaussianNB
import matplotlib.pyplot as plt
from sklearn.feature_selection import mutual_info_classif
import os
data = loadmat('../data/Xwindo... |
<gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Wed May 8 12:43:42 2019
@author: solale
In this version I will try to shrink the network and reduce the tensorization
"""
# Multilayer Perceptron
import pandas
import numpy
# fix random seed for reproducibility
seed = 7
numpy.random.seed(seed)
# from tensorflow impo... |
<reponame>zahraghh/Operation-Planning<gh_stars>0
import numpy as np
import matplotlib.pyplot as plt
import warnings
import pandas as pd
import scipy.stats as st
import statsmodels as sm
import seaborn as sns
import math
import collections
from collections import Counter
import statistics
import matplotlib
#... |
<reponame>pasqualefiore/Adult_dataset_analysis<gh_stars>0
import matplotlib.pyplot as plt
import seaborn as sns
from scipy.stats import kendalltau,chi2_contingency, pearsonr
import pandas as pd
def plot_var_num(dataset,variabile):
""" Plot delle variabili numeriche
--------------
Parametri:
dataset... |
# Copyright 2020 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
#
# Unless required by applicable law or agree... |
<reponame>tgquintela/Firms_locations<gh_stars>0
"""
Assign geographically density value to a points.
"""
from scipy.spatial import KDTree
from scipy.spatial.distance import cdist
from scipy.stats import norm
from scipy.optimize import minimize
import numpy as np
def general_density_assignation(locs, parameters, val... |
# Copyright (c) 2019 MindAffect B.V.
# Author: <NAME> <<EMAIL>>
# This file is part of pymindaffectBCI <https://github.com/mindaffect/pymindaffectBCI>.
#
# pymindaffectBCI 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 Softwar... |
<reponame>Sanzeed/balanced_influence_maximization<gh_stars>1-10
import numpy as np
from scipy.stats import bernoulli
import heapq
class DiffusionModel:
def __init__(self, graph, majority, get_diffusion_probability, num_rels):
self.graph = graph
self.majority = majority
nodes = sort... |
<filename>HandSComp.py
"""
~~~ IMPORT EXPERIMENTAL DATA, PROCESS, AND NONDIMENSIONALIZE ~~~
This code reads in the rescaled Snodgrass data and compares parameters
to known parameters found in the Henderson and Segur paper.
1. Get distances
2. Read in the gauge data for each event (get frequencies and Fourier magnitu... |
"""pyGEEMs: Geotechnical earthquake engineering models implemented in Python."""
import pathlib
from pkg_resources import get_distribution
import scipy.constants
FPATH_DATA = pathlib.Path(__file__).parent / "data"
KPA_TO_ATM = scipy.constants.kilo / scipy.constants.atm
__author__ = "<NAME>"
__copyright__ = "Copyrig... |
<gh_stars>1-10
import numpy as np
from scipy.spatial.distance import cdist
import sys
from plot_area import plot_area
COLOR = ['tab:blue', 'tab:orange', 'tab:green']
class BaseClassifier:
d = -1
c = -1
def __init__(self, d):
super().__init__()
if (d <= 0):
raise RuntimeError... |
import math, sys, random, mcint
from scipy import integrate
import numpy as np
gap = float(sys.argv[1])
lam = float(sys.argv[2])
print(gap, lam)
## calculate the yukawa force over a distributed test mass assumed to be cube
D = 5 # diameter of bead (um)
rhob = 2e3 # density bead (kg/m^3)
rhoa = 19.3e3 # density attr... |
# - * - coding: utf-8 - * -
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import scipy.signal
from ..signal import signal_smooth
from ..signal import signal_zerocrossings
def ecg_findpeaks(ecg_cleaned, sampling_rate=1000, method="neurokit", show=False):
"""Find R-peaks in an ECG signal... |
import numpy as np
from scipy.misc import imread, imsave
from scipy import ndimage
img = imread('doc1.bmp')
def f(x):
ret = x * 255 / 150
if ret > 255:
ret = 255
return ret
F = np.vectorize(f)
treated_img = F(img)
imsave('treated_doc.bmp', treated_img)
mask = treated_img < treated_img.mean()
... |
import pandas as pd
import numpy as np
import sys
import os
import itertools
import pandas as pd
import os
from tqdm import tqdm_notebook, tnrange
import numpy as np
import networkx as nx
import seaborn as sns
import matplotlib.pyplot as plt
from scipy.optimize import minimize
import scipy
from sklearn import linear_... |
'''
0 Preprocess segments:
-
- specify segments you want to process
- dilate slightly the segments
- create mask for dilation.
- np.unique(my_masked_id) --> select only part with biggest uc
- eliminates ouliers too disconnected/far from main structure
'''
import numpy as np
import h5py
from scipy.ndimage import binar... |
import numpy as np
from scipy.optimize import minimize
from intvalpy.MyClass import Interval
from intvalpy.intoper import zeros
def Uni(A, b, x=None, maxQ=False, x0=None, tol=1e-12, maxiter=1e3):
"""
Вычисление распознающего функционала Uni.
В случае, если maxQ=True то находится максимум функционала.
... |
# -*- coding: utf-8 -*-
## @package palette.core.color_transfer
#
# Color transfer.
# @author tody
# @date 2015/09/16
import numpy as np
from scipy.interpolate import Rbf
import matplotlib.pyplot as plt
from palette.core.lab_slices import LabSlice, LabSlicePlot, Lab2rgb_py
## Color transfer for ab co... |
<filename>code/plotting/plot_lsst.py
#!/usr/bin/env python3
#
# Plots the power spectra and Fourier-space biases for the HI.
#
import warnings
from mpi4py import MPI
rank = MPI.COMM_WORLD.rank
#warnings.filterwarnings("ignore")
if rank!=0: warnings.filterwarnings("ignore")
import numpy as np
import os, sy... |
<gh_stars>10-100
import tensorflow as tf
import numpy as np
from scipy.integrate import odeint
import matplotlib.pyplot as plt
from plotting import newfig, savefig
import matplotlib.gridspec as gridspec
import seaborn as sns
import time
from utilities import neural_net, fwd_gradients, heaviside, \
... |
#!/usr/bin/env python
import rospy
import tf
import scipy.linalg as la
import numpy as np
from math import *
import mavros_msgs.srv
from mavros_msgs.msg import AttitudeTarget
from nav_msgs.msg import Odometry
from std_msgs.msg import *
from test.msg import *
from geometry_msgs.msg import *
from mavros_msgs.msg import *... |
<reponame>kamilazdybal/multipy
"""multipy: Python library for multicomponent mass transfer"""
__author__ = "<NAME>, <NAME>"
__copyright__ = "Copyright (c) 2022, <NAME>, <NAME>"
__license__ = "MIT"
__version__ = "1.0.0"
__maintainer__ = ["<NAME>"]
__email__ = ["<EMAIL>"]
__status__ = "Production"
import numpy as np
im... |
<reponame>ernforslab/Hu-et-al._GBMlineage2022<gh_stars>1-10
import datetime
import seaborn as sns
import pickle as pickle
from scipy.spatial.distance import cdist, pdist, squareform
import pandas as pd
from sklearn.linear_model import LogisticRegression, LogisticRegressionCV
#from sklearn.model_selection import... |
#!/usr/bin/env python
"""Waypoint Updater.
This node will publish waypoints from the car's current position to some `x` distance ahead.
As mentioned in the doc, you should ideally first implement a version which does not care
about traffic lights or obstacles.
Once you have created dbw_node, you will update this node... |
<reponame>MarkusLohmayer/master-thesis-code
"""Gauss-Legendre collocation methods for port-Hamiltonian systems"""
import sympy
import numpy
import math
from newton import newton_raphson, DidNotConvergeError
from symbolic import eval_expr
def butcher(s):
"""Compute the Butcher tableau for a Gauss-Legendre colloc... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Exercise 10.10 from Kane 1985."""
from __future__ import division
from sympy import expand, solve, symbols, sin, cos, S
from sympy.physics.mechanics import ReferenceFrame, RigidBody, Point
from sympy.physics.mechanics import dot, dynamicsymbols, inertia, msprint
from ut... |
<reponame>ooshyun/filterdesign<gh_stars>1-10
import os
import json
import numpy as np
from numpy import log10, pi, sqrt
import scipy.io.wavfile as wav
from scipy.fftpack import *
from src import (
FilterAnalyzePlot,
WaveProcessor,
ParametricEqualizer,
GraphicalEqualizer,
cvt_char2num,
maker_log... |
<gh_stars>1-10
#!/usr/bin/python3
from functools import partial
from datetime import datetime
import pandas as pd
from joblib import parallel_backend
import random
import numpy as np
from sklearn.calibration import CalibratedClassifierCV
import shutil
import pathlib
import os
import math
import random
from matplotlib... |
<filename>dm/algorithms/HungarianAlg.py<gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
from scipy import optimize, sparse
from .AbstractDistanceAlg import AbstractDistanceAlg
class HungarianAlg(AbstractDistanceAlg):
def __init__(self, df, size):
super().__init__(df, size)
... |
from ROAR.control_module.controller import Controller
from ROAR.utilities_module.vehicle_models import VehicleControl, Vehicle
from ROAR.utilities_module.data_structures_models import Transform, Location
import numpy as np
import logging
from ROAR.agent_module.agent import Agent
from typing import Tuple
import json
fro... |
import numpy as np
import pandas as pd
from sklearn.metrics import silhouette_samples, silhouette_score
from sklearn.metrics import confusion_matrix, accuracy_score, recall_score, precision_score, f1_score,roc_auc_score,roc_curve
from sklearn.metrics import mean_squared_error,mean_absolute_error,r2_score
import ma... |
<filename>Dataflow/full_executer_wordshop.py
# -*- coding: utf-8 -*-
"""Full Executer WordShop.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1kGSQWNtImJknauUN9L8ZRRwIzAdwbmo_
First, we load the pegasus paraphraser.
"""
# Commented out IPython ... |
<gh_stars>1-10
import math
import numpy as np
from scipy import signal, fftpack
def pre_emphasize(data, pre_emphasis=0.97):
return np.append(data[0], data[1:] - pre_emphasis * data[:-1])
def hz_to_mel(hz):
return 2595 * math.log10(1 + hz / 700)
def mel_to_hz(mel):
return 700 * (10 ** (mel / 2595) - 1)... |
<filename>spirou/sandbox/fits2ramp.py<gh_stars>1-10
#!/usr/bin/env python2.7
# Version date : Aug 21, 2018
#
# --> very minor correction compared to previous version. As keywords may change in files through time, when we delete
# a keyword, we first check if the keyword is preseent rather than "blindly" deleting it... |
# This is automatically-generated code.
# Uses the jinja2 library for templating.
import cvxpy as cp
import numpy as np
import scipy as sp
# setup
problemID = "least_abs_dev_0"
prob = None
opt_val = None
# Variable declarations
import scipy.sparse as sps
np.random.seed(0)
m = 5000
n = 200
A = np.random.rand... |
import matplotlib.pyplot as plt
import pandas as pd
import scipy.stats as st
import statsmodels.api as sm
import math
import numpy as np
__all__ = ["deming", "passingbablok", "linear"]
class _Deming(object):
"""Internal class for drawing a Deming regression plot"""
def __init__(self, method1, method2,
... |
"""
Creates a fidelity estimator for any pure state, using randomized Pauli measurement strategy.
Author: <NAME>
"""
import warnings
import numpy as np
import scipy as sp
from scipy import optimize
import project_root # noqa
from src.optimization.proximal_gradient import minimize_proximal_gradient_neste... |
<reponame>fernandezdaniel/Spearmint<filename>spearmint/transformations/demos/bibeta/show_warp_bibeta.py<gh_stars>1-10
#Bibeta in action.
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import beta
from scipy.stats import randint
def plot_1D_function(x, y, y_name='y'):
ax = plt.subplot(111)
... |
#!/usr/bin/env python
"""
# Author: <NAME>
# Created Time : Thu 10 Jan 2019 07:38:10 PM CST
# File Name: metrics.py
# Description:
"""
import numpy as np
import scipy
from sklearn.neighbors import NearestNeighbors, KNeighborsRegressor
def batch_entropy_mixing_score(data, batches, n_neighbors=100, n_pools=100, n_sa... |
#!/bin/python
import sys, os, re, subprocess, math
import argparse
import psutil
from pysam import pysam
from Bio import SeqIO
import numpy as np
import numpy.random
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
#import seaborn as sns
import pandas as pd
import scipy.stats
from scipy.stats imp... |
# -*- coding: utf-8 -*-
"""Plotting.py for notebook 05_Preliminary_comparison_of_simulations_AGN_fraction_with_data
This python file contains all the functions used for plotting graphs and maps in the 2nd notebook (.ipynb) of the repository: 05. Preliminary comparison of the 𝑓MM between simulation and data
Script wr... |
from __future__ import division
import numpy as np
from scipy import integrate
__all__ = ['area', 'simple']
def simple(p):
pass
def area(p):
cumul = np.hstack(([0], integrate.cumtrapz(np.abs(np.gradient(p)))))
return cumul / max(cumul)
|
import os
from ase.visualize import view
from mpl_toolkits.mplot3d import Axes3D # noqa
from scipy.optimize import curve_fit
from tqdm import tqdm
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
sns.set(
style="ticks",
rc={
"font.family": "Arial",
"font.size": 40,
... |
<reponame>caos21/Grodi<filename>plazma.py
# Copyright 2019 <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
#
# Unless req... |
<reponame>Aldair47x/DISTRIBUIDOS-UTP
import xmlrpclib
from SimpleXMLRPCServer import SimpleXMLRPCServer
from SimpleXMLRPCServer import SimpleXMLRPCRequestHandler
import numpy as np
from io import StringIO
from numpy.linalg import inv
from scipy.linalg import *
# Restrict to a particular path.
class RequestHan... |
<reponame>rddaz2013/fluids<filename>fluids/flow_meter.py
# -*- coding: utf-8 -*-
'''Chemical Engineering Design Library (ChEDL). Utilities for process modeling.
Copyright (C) 2018 <NAME> <<EMAIL>>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation... |
<reponame>cjayross/riccipy
"""
Name: <NAME>
References: Ernst, Phys. Rev., v167, p1175, (1968)
Coordinates: Cartesian
"""
from sympy import Function, Rational, exp, symbols, zeros
coords = symbols("t x y z", real=True)
variables = ()
functions = symbols("k r s w", cls=Function)
t, x, y, z = coords
k, r, s, w = functio... |
import numpy as np
import matplotlib.pyplot as plt
from scipy import optimize
# Lecture 11 2-user water allocation example
# First approach: scipy.optimize.linprog
# need matrix form: minimize c^T * x, subject to Ax <= b
c = [-5, -3] # negative to maximize
A = [[10,5], [1,1.5], [2,2], [-1,0], [0,-1]]
b = [20, 3, 4.5... |
<reponame>GeWu-Lab/OGM-GE_CVPR2022
import multiprocessing
import os
import os.path
import pickle
import librosa
import numpy as np
from scipy import signal
def audio_extract(path, audio_name, audio_path, sr=16000):
save_path = path
samples, samplerate = librosa.load(audio_path)
resamples = np.tile(sample... |
<reponame>sympy/sympy_doc<filename>latest/modules/physics/control/control_plots-5.py
from sympy.abc import s
from sympy.physics.control.lti import TransferFunction
from sympy.physics.control.control_plots import ramp_response_plot
tf1 = TransferFunction(s, (s+4)*(s+8), s)
ramp_response_plot(tf1, upper_limit=2) # ... |
<filename>Chapter 01/fraction-type.py
from fractions import Fraction
num1 = Fraction(1, 3)
num2 = Fraction(1, 7)
num1 * num2 # Fraction(1, 21)
|
<reponame>asplos2020/DRTest<gh_stars>1-10
"""
This tutorial shows how to generate adversarial examples using FGSM
and train a model using adversarial training with TensorFlow.
It is very similar to mnist_tutorial_keras_tf.py, which does the same
thing but with a dependence on keras.
The original paper can be found at:
... |
<filename>cxphasing/CXResolutionEstimate.py
"""
.. module:: CXResolutionEstimate.py
:platform: Unix
:synopsis: A class for predicting the resolution of a ptychography measurement.
.. moduleauthor:: <NAME> <<EMAIL>>
"""
import requests
import pdb
import scipy as sp
import numpy as np
import scipy.fftpack as spf... |
<filename>safe_eval/default_rules.py
from _ast import In, NotIn, Is, IsNot
from collections import deque, Counter
from decimal import Decimal
from fractions import Fraction
from safe_eval.rules import BinOpRule, CallableTypeRule, CallableRule, GetattrTypeRule, CallableMethodRule
k_view_type = type({}.keys())
v_view_t... |
"""
ToDo: convert to proper format
Tests for modules in this directory
"""
from __future__ import print_function
# Author: <NAME>, last modified 05.04.07
import scipy
import scipy.ndimage
import numpy
import pyto.util.numpy_plus as np_plus
# define test arrays
aa = numpy.arange(12, dtype='int32')
aa = aa.reshape((3... |
# Copyright (c) 2021 <NAME>
import struct
from dataclasses import dataclass
import numpy as np
from scipy.spatial.transform import Rotation
@dataclass
class ThrowData:
NUM_POINTS = 2000
SENSORS_GRAVITY_STANDARD = 9.80665
SENSORS_DPS_TO_RADS = 0.017453293
OUTPUT_SCALE_FACTOR_400G = (SENSORS_GRAVITY_STA... |
import os
import pickle
import sys
import warnings
from collections import OrderedDict
import biosppy.signals.tools as st
import numpy as np
import wfdb
from biosppy.signals.ecg import correct_rpeaks, hamilton_segmenter
from hrv.classical import frequency_domain, time_domain
from scipy.signal import medfilt... |
<filename>Manuscript files/modflow_reference/auxfile_hexaplot.py
"""
This library contains several functions designed to help with the illustration of hexagonal grids
Functions:
plot_hexagaons : plots a specified data vector over a 2-D hexagon grid.
create_alpha_mask : creates an al... |
import pytest
import numpy as np
import pandas as pd
from scipy.special import binom
import os
import sys
sys.path.insert(0, "..")
from autogenes import objectives as ga_objectives
def test_distance():
arr = np.ones((3,3))
assert ga_objectives.distance(arr) == 0
arr = np.identity(3)
assert np.isclose(ga_... |
from io import StringIO
from os import path, listdir, remove
from math import radians, tan, cos, pi, atan, sin
from pandas import read_csv
import sympy as sy
import numpy as np
# these variables are used to solve symbolic mathematical equations
# x is the control variable over the height ... max(x) = H_cross_section
... |
from collections import namedtuple
import os
import sympy
import numpy as np
from means.core.model import Model
_Reaction = namedtuple('_REACTION', ['id', 'reactants', 'products', 'propensity', 'parameters'])
def _sbml_like_piecewise(*args):
if len(args) % 2 == 1:
# Add a final True element you can skip ... |
#!/usr/bin/env python3
from statistics import mode
def execute():
with open('./input/day.3.txt') as inp:
lines = inp.readlines()
data = [l.strip() for l in lines if len(l.strip()) > 0]
return power_consumption(data), life_support_rating(data)
tests_failed = 0
tests_executed = 0
def verify(a, b):... |
<gh_stars>1-10
import cv2
import numpy as np
from scipy.signal import medfilt
from utils import init_dict, l2_dst
def keypoint_transform(H, keypoint):
"""
Input:
H: homography matrix of dimension (3*3)
keypoint: the (x, y) point to be transformed
Output:
keypoint_trans: Transformed point keyp... |
import logging
import sys
from typing import Iterable
# 3rd party imports
import numpy as np
# import matplotlib.pyplot as plt
from scipy.io.wavfile import read as wavread
# local imports
from .dio import dio
from .stonemask import stonemask
from .harvest import harvest
from .cheaptrick import cheaptrick
from .d4c im... |
<filename>pose/datasets/real_animal_all.py
from __future__ import print_function, absolute_import
import random
import torch.utils.data as data
from pose.utils.osutils import *
from pose.utils.transforms import *
from scipy.io import loadmat
import argparse
class Real_Animal_All(data.Dataset):
def __init__(self... |
"""
Visual Genome in Scene Graph Generation by Iterative Message Passing split
"""
import os
import cv2
import json
import h5py
import pickle
import numpy as np
import scipy.sparse
import os.path as osp
from datasets.imdb import imdb
from model.utils.config import cfg
from IPython import embed
class vg_sggimp(imdb)... |
<gh_stars>10-100
# -*- coding: utf-8 -*-
'''
Created on Fri Nov 16 09:36:50 2018
@author:
<NAME>
Turku University Hospital
November 2018
@description:
This model is used to predict radiation dose from pre-treatment patient
parameters
'''
#%% clear variables
%reset -f
%clear
... |
'''
Created on 31 Jul 2009
@author: charanpal
'''
from __future__ import print_function
import sys
import os
import numpy
from contextlib import contextmanager
import numpy.random as rand
import logging
import scipy.linalg
import scipy.sparse as sparse
import scipy.special
import pickle
from apgl.util.Parameter imp... |
import logging
import numpy as np
import pandas as pd
import scipy.stats as ss
from scipy.linalg import eig
from numba import jit
import sg_covid_impact
# from mi_scotland.utils.pandas import preview
logger = logging.getLogger(__name__)
np.seterr(all="raise") # Raise errors on floating point errors
def process_c... |
"""
Blurring of images
===================
An example showing various processes that blur an image.
"""
import scipy.misc
from scipy import ndimage
import matplotlib.pyplot as plt
face = scipy.misc.face(gray=True)
blurred_face = ndimage.gaussian_filter(face, sigma=3)
very_blurred = ndimage.gaussian_filter(face, sigm... |
"""Functions for generating random data with injected relationships"""
from itertools import product
import os
import json
import re
import random
import numpy as np
from numpy import random as rd
from scipy.special import comb
from ntp.util.util_kb import load_from_list
def gen_relationships(n_pred, n_rel, body_... |
<gh_stars>0
import sympy.physics.mechanics as _me
import sympy as _sm
import math as m
import numpy as _np
frame_n = _me.ReferenceFrame('n')
frame_a = _me.ReferenceFrame('a')
a = 0
d = _me.inertia(frame_a, 1, 1, 1)
point_po1 = _me.Point('po1')
point_po2 = _me.Point('po2')
particle_p1 = _me.Particle('p1', _m... |
import matplotlib.pyplot as plt
import numpy as np
import cv2
import scipy.spatial
from sklearn.linear_model import RANSACRegressor
import os
import sys
import inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0, parent... |
<filename>src/detect_utils.py
import cv2
from scipy.spatial import distance as dist
def mouth_aspect_ratio(mouth) -> float:
# compute the euclidean distances between the two sets of
# vertical mouth landmarks (x, y)-coordinates
A = dist.euclidean(mouth[2], mouth[10]) # 51, 59
B = dist.euclidean(mouth... |
r"""
This module contains several utility functions which can be used e.g.
for thresholding the alpha-shearlet coefficients or for using the
alpha-shearlet transform for denoising.
Finally, it also contains the functions :func:`my_ravel` and :func:`my_unravel`
which can be used to convert the alpha-shearlet coefficien... |
import os, sys
import logging
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
from scipy.ndimage import label
from .utils import watershed_tissue_sections, get_spot_adjacency_matrix
# Read in a series of Loupe annotation files and return the set of all unique categories.
# NOTE: "Undefine... |
import csv
import os
import difflib
import statistics
import numpy as np
import matplotlib.pyplot as plt
SMALL_SIZE = 12
MEDIUM_SIZE = 14
LARGE_SIZE = 18
plt.rc('font', size=SMALL_SIZE) # controls default text sizes
# plt.rc('title', titlesize=MEDIUM_SIZE) # fontsize of the axes title
plt.rc('axes', lab... |
from tensorflow.python.platform import flags
from tensorflow.contrib.data.python.ops import batching
import tensorflow as tf
import json
from torch.utils.data import Dataset
import pickle
import os.path as osp
import os
import numpy as np
import time
from scipy.misc import imread, imresize
from torchvision.datasets imp... |
<reponame>mmicromegas/ransX<filename>EQUATIONS/FOR_RESOLUTION_STUDY/BuoyancyResolutionStudy.py
import numpy as np
from scipy import integrate
import matplotlib.pyplot as plt
from UTILS.Calculus import Calculus
from UTILS.SetAxisLimit import SetAxisLimit
from UTILS.Tools import Tools
from UTILS.Errors import Errors
impo... |
import datetime
import warnings
import pandas as pd
import numpy as np
from MongoDBUtils import *
from scipy.optimize import fsolve
import pymongo
TRADING_FEE = 0.008
EARLIEST_DATE = datetime.datetime(2014, 10, 17)
LATEST_DATE = datetime.datetime(2019, 10, 17)
# In any cases, we shouldn't know today's and future val... |
import os
import torch
import numpy as np
import pandas as pd
from torch.utils.data import Dataset, DataLoader
from scipy.spatial.distance import cdist
import logging
class STD_Dataset(Dataset):
"""Spoken Term Detection dataset."""
def __init__(self, root_dir, labels_csv, query_dir, audio_dir, apply_vad = Fal... |
<reponame>nkruyer/SkillsWorkshop2018
#!/usr/bin/env python
import matplotlib.pyplot as plt
import numpy as np
from scipy.integrate import simps
from scipy.optimize import curve_fit
def curve3(x,a,b,c,d):
return a*x**3+b*x**2+c*x+d
def BIC(y, yhat, k, weight = 1):
err = y - yhat
sigma = np.std(np.real(err))... |
<filename>fluid.py
import numpy as np
import scipy.sparse as sp
from scipy.ndimage import map_coordinates
from scipy.sparse.linalg import factorized
import operators as ops
class Fluid:
def __init__(self, shape, viscosity, quantities):
self.shape = shape
# Defining these here keeps the code somew... |
import argparse
import os
import cv2
import numpy as np
import hdf5storage as hdf5
from scipy.io import loadmat
from matplotlib import pyplot as plt
from SpectralUtils import savePNG, projectToRGB
from EvalMetrics import computeMRAE
BIT_8 = 256
# read path
def get_files(path):
# read a folder, return the complet... |
<gh_stars>10-100
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import tensorflow as tf
import copy
from tf_image_segmentation.models.fcn_8s import FCN_8s
from tf_image_segmentation.utils.tf_records import read_tfrecord_and_decode_into_image_annotation_pair_tensors
from tf_image_segmentation.utils.training import get_v... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.