text string |
|---|
# --------------
# Importing header files
import numpy as np
import pandas as pd
from scipy.stats import mode
import warnings
warnings.filterwarnings('ignore')
#Reading file
bank_data = pd.read_csv(path)
bank=pd.DataFrame(bank_data)
categorical_var=bank.select_dtypes(include='object')
numerical_var=ba... |
<filename>shakemap/coremods/coverage.py
# stdlib imports
import os.path
import json
# third party imports
import numpy as np
from scipy.ndimage import gaussian_filter
from impactutils.io.smcontainers import ShakeMapOutputContainer
from openquake.hazardlib import imt
# local imports
from .base import CoreModule, Conte... |
<reponame>gptune/GPTune
#! /usr/bin/env python
# GPTune Copyright (c) 2019, The Regents of the University of California,
# through Lawrence Berkeley National Laboratory (subject to receipt of any
# required approvals from the U.S.Dept. of Energy) and the University of
# California, Berkeley. All rights reserved.
#
# ... |
<filename>utils/plot_helper.py
# Plotly Graphs
import plotly.express as px
import plotly.graph_objects as go
import plotly.figure_factory as ff
from scipy.spatial.distance import pdist, squareform
# ML funcs
from .ml_helper import calculate_cm
# Others
import numpy as np
import pandas as pd
from itertools import chai... |
<filename>tom-utils/tod.py
# Utilities for time-ordered data. Mostly for ACT.
def rot_2d(a):
return np.array([[np.cos(a),np.sin(a)],[-np.sin(a),np.cos(a)]])
def xy_to_ae(dx,dy,ca=0,ce=0):
y,z = np.matmul()
# I want to standardize what data object I work on. I now use:
# a dict with keys time, azim, elev... |
<filename>models/dirichlet.py
# Copyright 2019 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICE... |
"""
Some codes from https://github.com/Newmu/dcgan_code
"""
from __future__ import division
import math
import json
import random
import pprint
import scipy.misc
import numpy as np
from time import gmtime, strftime
from six.moves import xrange
import pdb
# MEEE
import json
from colorama import init, Fore, Back, Style
... |
from sklearn.base import BaseEstimator
from sklearn.base import TransformerMixin
from scipy.sparse import coo_matrix
class SparseMatrixCreator(BaseEstimator, TransformerMixin):
def fit(self, x, y=None):
return self
def transform(self, data):
books = data['books']
users = data['users'... |
<filename>performance/calc_performance.py
'''
Calculates the results from latency and throughput measurements, and generates plots for them.
You might need to edit the code to generate plots for different types of messages; see relevant comments for more details
This script should be run with different system argumen... |
<gh_stars>1-10
import json
from microtc.utils import tweet_iterator
from sklearn.svm import LinearSVC
from joblib import Parallel, delayed
from tqdm import tqdm
from utils import transform2 as transform
from scipy.sparse import vstack
if __name__ == '__main__':
train = list(tweet_iterator('snli_train.json'))
... |
import csv
#import cv2
import numpy as np
from scipy import ndimage
lines = []
with open('recData/driving_log.csv') as csvfile:
reader = csv.reader(csvfile)
for line in reader:
lines.append(line)
images = []
measurements = []
for line in lines :
for i in range(3):
if i ==... |
<gh_stars>1-10
import math
import numpy as np
import scipy.signal
from playground import rhythm
import rir_generator as rir
from playground import modules
P = modules.Parameter
|
<filename>8b_write_scaled_isos.py
from vedo import applications, load, loadTransform, printc, Text3D, precision
from vedo.pyplot import plot
import numpy as np
import scipy.optimize as opt
import glob
import os
srcdir = 'data/wt/'
outdir = 'output/wt/'
#################################################################... |
<filename>psisim/signal.py
import numpy as np
from scipy.signal import medfilt, correlate
from numpy.random import poisson, randn
from scipy.ndimage.filters import median_filter
import matplotlib.pyplot as plt
from scipy.interpolate import interp1d, RegularGridInterpolator as rgi
import astropy.units as u
import warnin... |
<reponame>SPINLab/Tree_Detection<gh_stars>1-10
import json
import time
import traceback
import numpy as np
import pandas as pd
import pdal
import shapely
from geopandas import GeoDataFrame, sjoin
from hdbscan import HDBSCAN
from scipy.spatial.qhull import ConvexHull
from shapely.geometry import Point
from shapely.wkt ... |
<gh_stars>0
import torch
from scipy.special import softmax
from torch.utils.data import DataLoader, TensorDataset
from transformers import BertForSequenceClassification, AutoTokenizer
__all__ = [
'GenderEstimator',
'EthnicityEstimator'
]
def get_name_pair(s):
return s, ' '.join(str(s)).replace(' ', ' ')... |
<filename>pommermanLearn/plot_logs.py
import matplotlib.pyplot as plt
import numpy
import json
from pprint import pprint
import sys
import argparse
from scipy.interpolate import make_interp_spline, BSpline
import numpy as np
import os
import re
def smooth(scalars, weight): # Weight between 0 and 1
last = scalars... |
<reponame>gdmcbain/quadpy
# -*- coding: utf-8 -*-
#
from __future__ import division
from math import factorial
import numpy
import sympy
from ..helpers import untangle
class Walkington(object):
"""
<NAME>,
Quadrature on simplices of arbitrary dimension,
Technical Report,
CMU, 2000,
<http://... |
<filename>QPCA_QPhE.py
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
import numpy as np
from qiskit import BasicAer, execute
from qiskit.tools.visualization import plot_histogram
from qiskit.tools.monitor import job_monitor
from qiskit.providers.ibmq import least_busy
import cmath
q=QuantumRegi... |
<reponame>MrCubanfrog/NorLyst<filename>norlyst/eventWindows.py
"""
This module contains all new windows that are openable from eventPage
"""
import time
from copy import deepcopy
from scipy import signal
import numpy
from matplotlib import cm as colormap
from PyQt5.QtWidgets import QWidget, QGridLayout, QComboBox, ... |
##################################################### Import system libraries ######################################################
import matplotlib as mpl
mpl.rcdefaults()
mpl.rcParams.update(mpl.rc_params_from_file('meine-matplotlibrc'))
import matplotlib.pyplot as plt
import numpy as np
import scipy.constants as c... |
<gh_stars>1-10
#!/usr/bin/env python
# Copyright (c) 2017-present, Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unle... |
<filename>parsimony/utils/linalgs.py
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 23 19:15:22 2014
Copyright (c) 2013-2014, CEA/DSV/I2BM/Neurospin. All rights reserved.
@author: <NAME>, <NAME>
@email: <EMAIL>, <EMAIL>
@license: BSD 3-clause.
"""
from six import with_metaclass
import abc
import numpy as np
impor... |
<filename>myclasses.py<gh_stars>0
from itertools import combinations
import numpy as np
from scipy.optimize import minimize
from scipy.special import softmax
from scipy.stats import spearmanr
from sklearn.impute import KNNImputer
from sklearn.preprocessing import StandardScaler, LabelEncoder
from sklearn.feature_select... |
<filename>src/main/python/autolex/__init__.py
from astroid.__pkginfo__ import author
import cgi
from collections import Counter
import logging
from math import log, exp
import math
from numpy import clip, mean
import os
import pyfscache
import re
from scipy import stats
import sqlite3
from sqlitedict import SqliteDict
... |
<reponame>mourtadg7/goodwin-keen-model
import os
import numpy as np
from sympy.solvers import solve
import matplotlib.pyplot as plt
from sympy import symbols, Matrix
import scipy.integrate as integrate
PATH = os.path.join(os.getcwd(), 'static/imgs')
def num_goodwin(y, t):
W, L = y
alpha = 0.025 ... |
import csv # read excel
import random
import nltk
from nltk.corpus import stopwords
import numpy as np
from nltk.stem.snowball import SnowballStemmer
from scipy import spatial
from autocorrect import Speller # Check spelling
from sklearn.linear_model import LogisticRegression
from sklearn.feature_extraction.text imp... |
<filename>codes/EnvEq_sum/EnvEq.py
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from scipy.integrate import solve_ivp,odeint,ode
from scipy.stats import truncnorm
import pandas as pd
def f_res(res,lim):
if res>=lim[1]:
return 1
elif res>=lim[0]:
return (res-lim[0])/(li... |
'''
This function function used for training and cross-validating model using. The database is not
included in this repo, please download the CinC Challenge database and truncate/pad data into a
NxM matrix array, being N the number of recordings and M the window accepted by the network (i.e.
30 seconds).
For more... |
import igraph
import numpy as np
import pandas as pd
import geopandas
from shapely.geometry import LineString
from skimage.graph import MCP_Geometric, MCP
from skimage import graph
from pyproj import Transformer
from scipy import stats
def cost_tobler_hiking_function(S,symmetric=True):
"""
Applies Tobler's Hik... |
import numpy as np
import base64
from scipy import misc
from PIL import Image
import logging
logging.basicConfig(filename='logging.txt', format='%(asctime)s %(message)s', datefmt ='%m/%d/%Y &I:%M:%S %p', level=logging.DEBUG)
def image_to_b64(filename):
""" Function transforms image to b64
:param filename... |
<filename>DoCalculationsDummy.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 7 14:31:56 2017
@author: <NAME>
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib import animation
from scipy.spatial import ConvexHull
import time
import datetime
from pyla... |
"""
@brief test log(time=120s)
"""
import unittest
import warnings
import sys
from logging import getLogger
from contextlib import redirect_stdout
from io import StringIO
import numpy
import onnx
from scipy.sparse import coo_matrix, csr_matrix, SparseEfficiencyWarning
from scipy.special import ( # pylint: disable... |
import os
import itertools
import torch
import numpy as np
import pandas as pd
from scipy.stats import special_ortho_group, pearsonr
from sklearn.decomposition import PCA
class Constants(object):
eta = 1e-6
class CustomBatch:
def __init__(self, batch):
self.batch = torch.stack(batch, dim=1)
de... |
"""
=====================================================================
Reconstruction of the diffusion signal with the kurtosis tensor model
=====================================================================
The diffusion kurtosis model is an expansion of the diffusion tensor model
(see :ref:`example_reconst_dti... |
import logging
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy.misc import imshow
import scipy.ndimage as ndi
from scipy.ndimage.filters import convolve
from scipy.ndimage import zoom
# from scipy.stats import threshold DEPRECATED
from skimage import exposure
from skimage.io... |
'''
===========================
Playing with Badges dataset
===========================
'''
import numpy as np
from scipy.sparse import hstack
from collections import Counter
from sklearn import preprocessing
from sklearn import feature_extraction
from sklearn import naive_bayes
from sklearn import cross_validation
fr... |
<gh_stars>0
#!usr/bin/python
from __future__ import division
from scipy.spatial.distance import pdist, squareform, euclidean
import numpy as np
import time
from Cal_Formula import Cal_Class_Contribution as C_C_C
# Calculate Pruning Threshold ==> W(S) / m
#
# Step 1: Calculate each of data to W(xi)
# Step 2: W(S) /... |
import os
import six
from time import time
import numpy as np
import mceq_config as config
from MCEq.misc import normalize_hadronic_model_name, info
from MCEq.particlemanager import ParticleManager
import MCEq.data
class MCEqRun(object):
"""Main class for handling the calculation.
This class is the main user... |
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 23 18:15:54 2021
@author: vonGostev
"""
import __init__
import sys
import numpy as np
from scipy.special import fresnel
import matplotlib.pyplot as plt
from lightprop2d import gaussian_beam, round_hole, square_hole
from lightprop2d import Beam2D
from logging import Logg... |
<filename>precompute_gram_args.py
#!/usr/bin/env python
#SBATCH -N 1 # nodes requested
#SBATCH -n 1 # tasks requested
#SBATCH -c 8 # cores requested
#SBATCH --mem=24000 # memory in Mb
#SBATCH -t 140:00:00 # time requested in hour:minute:second
import warnings
def fxn():
warnings.warn("deprecate... |
<filename>utils/process.py<gh_stars>1-10
import numpy as np
import pickle as pkl
import networkx as nx
import scipy.sparse as sp
from scipy.sparse.linalg.eigen.arpack import eigsh
import sys
from sklearn.preprocessing import label_binarize
from sklearn.metrics import roc_curve, auc
"""
Generate training data for each... |
<reponame>Tarheel-Formal-Methods/kaa-optimize
'''
Test / demo code for pykodiak interface.
<NAME>
Oct 2018
'''
from pykodiak_interface import Kodiak
from sympy.parsing.sympy_parser import parse_expr
def setup_function(_):
'''setup method for each test'''
#Kodiak.use_bernstein(True)
#Kodiak.set_precision... |
<reponame>mjirik/imtools
#! /usr/bin/python
# -*- coding: utf-8 -*-
"""
Generator of histology report
"""
import logging
logger = logging.getLogger(__name__)
# import funkcí z jiného adresáře
import sys
import os.path
path_to_script = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.join(path_to... |
<reponame>lefevre-fraser/openmeta-mms<gh_stars>0
"""
Run test benches related to ingress/egress for a vehicle assembly model specified in settings.
"""
import sys
import os
import _winreg
from scipy.ndimage import measurements as meas
def query_analysis_tools():
"""
Find the location of the Ricardo... |
from __future__ import print_function, division
from abc import abstractmethod, ABC
import numpy as np
import scipy.stats as st
from gym.spaces.discrete import Discrete
from ..utils import argmax
class BasePolicy(ABC):
"""
Abstract base class for policy objects.
"""
def __init__(self, env, random_see... |
<reponame>lquirosd/TFM
import scipy.ndimage as ndi
class BBox(object):
def __init__(self, x1, y1, x2, y2):
'''
(x1, y1) is the upper left corner,
(x2, y2) is the lower right corner,
with (0, 0) being in the upper left corner.
'''
if x1 > x2: x1, x2 = x2, x1
if y1 > y2: y1, ... |
import copy
import numpy as np
import george
from george.kernels import ExpSquaredKernel, Matern52Kernel, \
ExpKernel, RationalQuadraticKernel, Matern32Kernel
import scipy.optimize as op
#Assert statements to guarantee the linter doesn't complain
assert ExpSquaredKernel
assert Matern52Kernel
assert ExpKernel
asse... |
import cv2
import numpy as np
from scipy import ndimage
from SOLO.model import model
from SOLO.visualize import visualize
from SOLO.preprocess.find_folder import find_folder
model = model()
model.load_weights('../weights/solo.h5')
""" pre-processing """
dataset_directory = '../../EgoGesture Dataset/'
image_name = 'Co... |
from statistics import mode
import cv2
import sys
import base64
import time
from keras.models import load_model
import numpy as np
from utils.datasets import get_labels
from utils.inference import detect_faces
from utils.inference import draw_text
from utils.inference import draw_bounding_box
from utils.inference imp... |
import numpy as np
def subsequenceDTW(dist,debug=False):
'''subsequneceDTW'''
if debug:
cost,path = _python_subseq_dtw(dist)
else:
cost,path = _subseq_dtw(dist)
return cost,path
def _python_subseq_dtw(dist):
'''Pure python, slow version of DTW'''
nx,ny = dist.shape
cost... |
<gh_stars>0
"""
Code inspired by Donglaiw @ https://github.com/donglaiw/MitoEM-challenge
- h5_name : path to the directory from which the images will be read
- h5_name : name of the H5 file to be created (follow the instructions in
https://mitoem.grand-challenge.org/Evaluation/ to name the ... |
"""
Created on Thu Jan 26 17:04:11 2017
@author: <NAME>, <EMAIL>
"""
#%matplotlib inline
import numpy as np
import pandas as pd
import dicom
import os
import scipy.ndimage as ndimage
import matplotlib.pyplot as plt
import scipy.ndimage # added for scaling
import cv2
import time
import glob
from skimage import me... |
<gh_stars>10-100
# Generic imports
import os, os.path
import math
import pygmsh
import meshio
import scipy.special
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
# Custom imports
from meshes_utils import *
### ************************************************
### Class defining shape ... |
"""monte_carlo_simulations Script for running monte carlo simulations
Script used for running monte carlo simulations.
"""
import numpy as np
import scipy
from stonesoup.types.state import GaussianState
from matplotlib import pyplot as plt
from utils import open_object
from utils import calc_metrics
from utils.scena... |
<gh_stars>100-1000
# This script is used to compute CSIG, CBAK and COVL,
# and it is from https://github.com/facebookresearch/denoiser/blob/main/scripts/matlab_eval.py
from scipy.linalg import toeplitz
from tqdm import tqdm
from pesq import pesq
import librosa
import numpy as np
import os
import sys
def eval_composi... |
<gh_stars>0
# noqa: D205,D400
"""
Ensemble reduction.
===================
Ensemble reduction is the process of selecting a subset of members from an ensemble in
order to reduce the volume of computation needed while still covering a good portion of
the simulated climate variability.
"""
import logging
import warnings
f... |
from __future__ import division
'''
NeuroLearn Analysis Tools
=========================
These tools provide the ability to quickly run
machine-learning analyses on imaging data
'''
__all__ = ['Roc']
__author__ = ["<NAME>"]
__license__ = "MIT"
import pandas as pd
import numpy as np
from nltools.plotti... |
from scipy.optimize import leastsq
import numpy as np
import matplotlib.pyplot as plt
def main():
# data provided
x=np.array([1.0,2.5,3.5,4.0,1.1,1.8,2.2,3.7])
y=np.array([6.008,15.722,27.130,33.772,5.257,9.549,11.098,28.828])
# here, create lambda functions for Line, Quadratic fit
# tpl is a... |
import argparse
import tensorflow as tf
import numpy as np
from tfbldr.datasets import fetch_mnist
from collections import namedtuple
import sys
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import copy
from tfbldr.datasets import rsync_fetch, fetch_ljspeech
from tfbldr.datasets import wavfile... |
from scipy.optimize import minimize
import numpy as np
# np.random.seed(123)
def simulate(x, theta=1):
x1, x2 = x.T
return np.array(
[x1 * np.exp(-theta * x2), 1 - x1 * np.exp(-theta * x2)]
).T
def lsq(theta, candidates, data):
pred = simulate(candidates, theta)
error = data - pred
e... |
from scipy.stats import norm
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(-5, 5, 100)
zoomed_x = np.linspace(0, 5, 100)
data = [
{ 'x': x, 'fn': norm.pdf, 'c': 'red', 'ls': '-', 'label': 'pdf', 'title': 'Probability density function (pdf)' },
{ 'x': x, 'fn': norm.cdf, 'c': 'blue', 'ls':... |
#
# Automated Dynamic Application Penetration Testing (ADAPT)
#
# Copyright (C) 2018 Applied Visions - http://securedecisions.com
#
# Written by <NAME> - http://www.siegetechnologies.com/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the L... |
<reponame>viniciusd/DCO1020---Mobile-Communications
import math
import matplotlib.pylab as plt
import numpy as np
from scipy import stats
from scipy.io import loadmat
from stats import distribution_fit
def _load_signal(name):
try:
mat = loadmat(name)
except FileNotFoundError:
raise
return... |
"""This file contains functions to:
- compute the parameters used to generate simulated data,
- generate simulated data using these parameters,
- compute the Bayes rate of the pattern mixture model (both exact analytic
expression and Monte Carlo approximation).
"""
import numpy as np
from sklearn.utils ... |
#!/usr/bin/env python
# Copyright 2014-2021 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... |
import numpy as np
from scipy.linalg import logm, expm
from noneq_settings import BETA, build_J
from noneq_functions import state_to_label, label_to_state, hamiltonian, hamming, get_adjacent_labels
def get_states_energies_prob(N, J, beta=BETA):
assert (J.transpose() == J).all() # assert J is symm
# only mak... |
import numpy as np
import scipy
class BottomTrackPoint(object):
def __init__(self, time_index, beam_num, ship_x, ship_y, ship_z, aug_x, aug_y, aug_z):
"""TODO
Coordinate system:
(+) x = East
(+) y = North
(+) z = Downwards
"""
self.time_index... |
# implement a simple shading model
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Ellipse
from shapely.geometry import Point, Polygon
class SimpleFlicker():
def __init__(self, solar_verts, T, turbine_locs):
self.turbine_locs = [[0, 0]]
self.solar_verts = solar_... |
"""
Test for amfe-tools module
"""
from unittest import TestCase
import numpy as np
from scipy.sparse import csr_matrix
import pandas as pd
from amfe.tools import invert_dictionary, invert_dictionary_with_iterables
from .tools import CustomDictAssertTest
class ToolsTest(TestCase):
def setUp(self):
self.c... |
<reponame>hanbao-ucla/pycsep
import numpy
import scipy.stats
import scipy.special
# PyCSEP imports
from csep.core.regions import geographical_area_from_bounds
def sup_dist(cdf1, cdf2):
"""
given two cumulative distribution functions, compute the supremum of the set of absolute distances.
note:
thi... |
import numpy as np
from scipy.ndimage.morphology import distance_transform_edt
""" Useful functions for image processing.
@author: <NAME>
@email: <EMAIL>
"""
def distanceMap3D (volume):
"""Calculate the euclidean distance map for a given 3D numpy array.
Note
The function also works for a 2D or N-... |
from scipy.signal import find_peaks
from numpy import*
from .utilities import ConstantDeriv, ConstantPoints, ESR_ls, Cap_ls, Half_pt_ind
#Capacitance analysis (given x and y dataset, current and masses)
#Recieve current in mA and mass in mg and convert to A and g for calculations
def CC_Cap(xset, yset, current, m1 =... |
#!/usr/bin/env python
from scipy import signal
import numpy as np
import matplotlib.pyplot as plt
def create_coeffs_sd1(alpha):
R1 = 10e3
C1 = 0.018e-6
R2 = 22e3
C2 = 0.027e-6
R3 = 470
C3 = 0.01e-6
R4 = 10e3
return (C3*R4*(R3*C2+alpha*(1-alpha)*R2*C2), C2*R3+R4*C3+alpha*(1-alpha)*R2*C2+alpha*C2*R4,... |
<gh_stars>1-10
import numpy as np
from numpy.lib.nanfunctions import nanmax
from scipy import signal
from astropy import convolution # deals with nans unlike other convs
from ephysiopy.common.utils import blurImage
# Suppress warnings generated from doing the ffts for the spatial
# autocorrelogram
# see autoCorr2D an... |
import os,fnmatch,sys
import shutil,re
import numpy as np
from natsort import natsorted
import cv2
import numpy as np
import tifffile as TIF
import skimage
from skimage import io
from skimage import feature
from skimage import exposure
from skimage import morphology
from scipy import ndimage
from skimage import measure... |
<reponame>sankhaaditya/Hartree-Fock
## Courtesy of <NAME> <https://joshuagoings.com/2017/04/28/integrals/>
import numpy as np
from scipy.special import hyp1f1
def calc_E(power0, power1, t, Q, a, b):
p = a + b
q = a * b / (a + b)
if (t < 0) or (t > (power0 + power1)):
return 0.0
elif... |
"""
Visualization library for cynet
@author <EMAIL>
"""
import pandas as pd
import numpy as np
import json
import os
import warnings
try:
import cartopy.crs as ccrs
import cartopy as crt
import cartopy.io.shapereader as shpreader
import cartopy.feature as cfeature
from cartopy.io.shapereader import... |
<filename>models/T2.py
#!/ur/bin/python
# -*- coding: utf-8 -*-
"""
@author: <NAME>
T2-mapping signal model-fit
2021
"""
import os
import numpy as np
from scipy.optimize import curve_fit
import multiprocessing
def exp_func(T2_prep_times,S0,T2):
""" mono-exponential decay function performing T2-map fitting.
... |
# -*- coding: utf-8 -*-
import json
from django.http import HttpResponse
from django.utils.safestring import mark_safe
from django.contrib.sites.models import Site
from django.template.loader import render_to_string
from django.views.decorators.csrf import csrf_protect
from django.template import RequestContext
from d... |
import numpy as np
from cst_modeling.surface import BasicSurface
from scipy.interpolate import CubicSpline, CubicHermiteSpline
import matplotlib.pyplot as plt
#* 插值方法
# https://docs.scipy.org/doc/scipy/reference/interpolate.html
if __name__ == "__main__":
#*==============================================
... |
# Copyright 2013-2019, The James Hutton Insitute
# Author: <NAME>
#
# This code is part of the pyani package, and is governed by its licence.
# Please see the LICENSE file that should have been included as part of
# this package.
"""Code to implement graphics output for ANI analyses."""
# Force matplotlib NOT to use ... |
<filename>sesansdemo.py
# Example of conversion of scattering cross section from SANS in absolute
# units into SESANS using a Hankel transformation
# everything is in units of metres except specified otherwise
# <NAME> (<EMAIL>), June 2013
from __future__ import division
from pylab import *
from scipy.special import ... |
from sympy import I, Matrix
from sympy.physics.quantum import hbar, represent, Commutator
from sympy.physics.quantum import qapply
from sympy.physics.quantum.spin import *
def test_represent():
assert represent(Jz) == hbar*Matrix([[1,0],[0,-1]])/2
assert represent(Jz, j=1) == hbar*Matrix([[1,0,0],[0,0,0],[0,... |
"""
This is an implementation of OpenMax from
<NAME>, <NAME> [Towards Open Set Deep Networks](http://vast.uccs.edu/~abendale/papers/0348.pdf). CVPR 2016
The implementation is checked against the original implementation https://github.com/abhijitbendale/OSDN
we do not rely on third party libraries to per... |
#!/usr/bin/env python
#
# Train the model weights
#
from math import log,exp
import sys
import numpy as np
from scipy.optimize.optimize import fmin_cg, fmin_bfgs, fmin
from scipy.optimize.lbfgsb import fmin_l_bfgs_b
import nbest
from util import safelog
def sigmoid(x):
return 1.0 / (1.0 + np.exp(-x))
class Optim... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""A miscellaneous collection of basic functions."""
from __future__ import (absolute_import, unicode_literals, division,
print_function)
import numpy as np
import logging
import sys
def r_in(td, r_0):
"""Calculate incident ... |
<filename>SimAug/code/pred_models.py<gh_stars>100-1000
# coding=utf-8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
"""Model graph definitions and other functions for training and testing."""
import functools
import math
import operator
import os
import ra... |
import argparse
import copy
import os
import pickle
import sys
import time
import cv2
import numpy as np
from PIL import Image
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT_DIR = os.path.dirname(BASE_DIR)
sys.path.append(BASE_DIR)
sys.path.append(ROOT_DIR)
import kitti_util as utils
from kitti_object im... |
# Copyright (c) 2015.
# <NAME> <bytefish[at]gmx[dot]de> and
# <NAME> <flier[at]techfak.uni-bielefeld.de> and
# <NAME> <nkoester[at]techfak.uni-bielefeld.de>
#
#
# Released to public domain under terms of the BSD Simplified license.
#
# Redistribution and use in source and binary forms, with or without
# modification, a... |
<filename>test/roc_excited_states.py
#!/usr/bin/env python3
import datetime
import glob
import json
import os
import sys
import numpy as np
from sklearn.metrics import accuracy_score
from scipy.integrate import simps
from scipy.interpolate import interp1d
script_path = os.path.dirname(os.path.realpath(__file__))
time... |
<reponame>Famingzhao/Kassandra
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import pearsonr
from sklearn.metrics import mean_absolute_error
cells_p = {'B_cells': '#558ce0',
'CD4_T_cells': '#28a35c',
'CD8_T_cells': '#58d3bb',
'Dendritic_cells': '#eaabcc',
'Endothelium': '... |
<gh_stars>10-100
import cv2, math
import numpy as np
import pandas as pd
import scipy
from scipy import signal
# Read tracking data from file
distances = []
# Get pose data from the spreadsheet
source_path = '/home/stephen/Desktop/source_data/ss77772_id_121.csv'
df = pd.read_csv(source_path)
# Define the image scale... |
# import cv2
# import numpy as np
# from PIL import ImageFont, ImageDraw, Image
# # img = cv2.imread('1561625887_eng_2.jpg')
# # cv2.threshold(img, 210, 255, cv2.THRESH_BINARY)[1][:,:,0]
# # dst = cv2.inpaint(img, mask, 7, cv2.INPAINT_NS)
# # cv2.imwrite('../upload/test.png', dst)
# image_src = cv2.imread('../upload/1... |
<reponame>rsuprun/ocropy
import glob
import copy
import PIL
import cv2
import numpy as np
import scipy.ndimage as ndimage
import matplotlib.pyplot as plt
class record:
def __init__(self,**kw): self.__dict__.update(kw)
def disp_img(img, title, h, w):
cv2.namedWindow(title, flags=cv2.WINDOW_NORMAL)
cv2.i... |
<reponame>Vinicius-Tanigawa/Undergraduate-Research-Project<gh_stars>0
## @ingroup Methods-Power-Battery-Ragone
# find_ragone_optimimum.py
#
# Created: ### 2014, <NAME>
# Modified: Sep 2015, <NAME>
# Feb 2016, <NAME>
# ----------------------------------------------------------------------
# Imports
# ----... |
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import ode
def f(phi, current_concentrations):
# use simpler variable names
s1 = current_concentrations[0]
s2 = current_concentrations[1]
v0 = 5.0
k1 = 3.0
k2 = 2.0
change_in_s1 = v0 - k1 * s1
change_in_s2 = k1 * s1 - k2*s2
return [chan... |
<gh_stars>1-10
"""!
@file
@date 07 Jun 2015
@license
Copyright 2015 <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 required by applic... |
<gh_stars>10-100
import os
import gzip
import shutil
import pandas as pd
from scipy import io
def write_to_files(sparse_matrix, top_cells, ordered_tags_map, data_type, outfolder):
"""Write the umi and read sparse matrices to file in gzipped mtx format.
Args:
sparse_matrix (dok_matrix): Results in a... |
import torch
import torch.nn.functional as F
import torchvision
from ..utils import reduce
from .metric import EvaluationMetric
__all__ = ["ClassifierScore"]
class ClassifierScore(EvaluationMetric):
r"""
Computes the Classifier Score of a Model. Also popularly known as the Inception Score.
The ``classif... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.