text string |
|---|
<reponame>Screams233/MachineLearning_Python<gh_stars>1000+
#-*- coding: utf-8 -*-
import numpy as np
from scipy import io as spio
from matplotlib import pyplot as plt
from scipy import optimize
from matplotlib.font_manager import FontProperties
font = FontProperties(fname=r"c:\windows\fonts\simsun.ttc", size=14) # 解... |
<reponame>wentaozhu/deep-mil-for-whole-mammogram-classification<gh_stars>100-1000
#import dicom # some machines not install pydicom
import scipy.misc
import numpy as np
from sklearn.model_selection import StratifiedKFold
import cPickle
#import matplotlib
#import matplotlib.pyplot as plt
from skimage.filters im... |
import os
import warnings
import tempfile
import pandas as pd
import numpy as np
from scipy.stats import pearsonr
import tensorflow.keras as keras
from keras import backend as K
from keras.models import Model,model_from_json
from keras.layers import Dense,Dropout,Input
from keras.callbacks import EarlyStopping
import... |
<filename>src/python/zquantum/qcbm/ansatz.py
import numpy as np
import sympy
from zquantum.core.circuit import Circuit, Qubit, Gate, create_layer_of_gates
from zquantum.core.interfaces.ansatz import Ansatz
from zquantum.core.interfaces.ansatz_utils import (
ansatz_property,
invalidates_parametrized_circuit,
)
f... |
<gh_stars>0
"""
This module implements the plot_missing(df) function's
calculating intermediate part
"""
from typing import Optional, Tuple, Union, List
import dask
import dask.array as da
import dask.dataframe as dd
import numpy as np
import pandas as pd
from scipy.stats import rv_histogram
from ...errors im... |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
#
# Copyright 2021 The NiPreps Developers <<EMAIL>>
#
# 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 ... |
"""
simple.py
"""
import numpy as np
from scipy.sparse import spdiags
def simple(self, n0, vs0, tilde=None):
"""
Simple inversion of the density
Invert Density n0 to vind vs
"""
pol = 1 if len(n0.shape) == 1 else 2
Nelem = n0.shape[0]
n0 = n0[:None] if len(n0.shape) == 1 else n[:,0][:,... |
<reponame>Mohamed-Ibrahim-124/Image-Segmentaion
import numpy as np
import os
from sklearn.neighbors import kneighbors_graph
from scipy.sparse.csgraph import laplacian
from sklearn.metrics.pairwise import rbf_kernel
from kmeans import kmeans, draw_clusters
from sklearn.preprocessing import normalize as normalize
import ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
<NAME> A01194204
Tarea 2: Recocido simulado
Programar el algoritmo de recocido simulado y resolver el problema del vendedor viajero
El algoritmo puede tener cualquier criterio de terminacion (tiempo, iteraciones,
temperatura cercana a cero, etc.)
"""
import numpy as n... |
# Copyright 2020 D-Wave Systems 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
#
# Unless required by applicable law or... |
# coding: utf-8
"""TV-L1 optical flow algorithm implementation.
"""
from functools import partial
from itertools import combinations_with_replacement
import numpy as np
from scipy import ndimage as ndi
from .._shared.filters import gaussian as gaussian_filter
from .._shared.utils import _supported_float_type
from .... |
from utils.BCD_DR import ALS_DR
from utils.ocpdl import Online_CPDL
import numpy as np
import matplotlib.pyplot as plt
import pickle
from scipy.interpolate import interp1d
plt.rcParams['font.family'] = 'serif'
plt.rcParams['font.serif'] = ['Times New Roman'] + plt.rcParams['font.serif']
def Out_tensor(loa... |
from shader import Shader
from entities import *
from scipy import integrate as intg
def angular_velocity(time_step: float, initial_condition: float, angular_velocity: intg.ode):
return angular_velocity
def pendulum_equation(time_step: float, initial_condition: float, string_length: float, angle:float ):
retu... |
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy import stats
from conf.settings import FilesConf, ModelConf, DatabaseConf
from conf.settings import CONNECTION_STRING
from sqlalchemy import create_engine
from statsmodels.tsa.stattools import pacf
from statsmodels.graphics.tsa... |
<gh_stars>1-10
import scipy as _sp
import matplotlib.pylab as _plt
def profiles(network, fig=None, values=None, bins=[10, 10, 10]):
r"""
Compute the profiles for the property of interest and plots it in all
three dimensions
Parameters
----------
network : OpenPNM Network object
values : ... |
#!/bin/env python
"""
OXASL - Module to calibrate a perfusion output using previously calculated M0 value or image
Copyright (c) 2008-2020 Univerisity of Oxford
"""
import sys
import os
import math
import traceback
import numpy as np
import scipy.ndimage
from fsl.data.image import Image
from fsl.data.atlases import... |
#!/usr/bin/env python
# Copyright 2018 Division of Medical Image Computing, German Cancer Research Center (DKFZ).
#
# 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... |
#
# Use this program to find a reward scale so that
# reward distributions are adjusted.
#
import os
import sys
import pickle
import sqlite3
import datetime
import numpy as np
import pandas as pd
import scipy.special
import scipy.spatial.distance
from global_paths import global_paths
if not global_paths["COBS"] in s... |
import argparse
import time
import logging
from statistics import mean, stdev
import zmq
from multiprocessing import Process, Manager
from ipyparallel.serialize import pack_apply_message, unpack_apply_message
from ipyparallel.serialize import deserialize_object
from constants import CLIENT_IP_FILE
from parsl.addresse... |
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/01_stats_utils.ipynb (unless otherwise specified).
__all__ = ['cPreProcessing', 'cStationary', 'cErrorMetrics']
# Cell
import numpy as np
import pandas as pd
from scipy.stats import boxcox, pearsonr
from scipy.special import inv_boxcox
from pandas.tseries.frequencies im... |
from pprint import pprint
import numpy as np
from scipy import sparse
from .label_aggregator import LabelAggregator
from .multi_label_aggregator import MultiLabelAggregator
def odds_to_prob(l):
"""
This is the inverse logit function logit^{-1}:
l = \log\frac{p}{1-p}
\exp(l) = \frac{p}{1-p}
p... |
# License is MIT: see LICENSE.md.
"""Nestle: nested sampling routines to evaluate Bayesian evidence."""
import sys
import warnings
import math
import numpy as np
try:
from scipy.cluster.vq import kmeans2
HAVE_KMEANS = True
except ImportError: # pragma: no cover
HAVE_KMEANS = False
__all__ = ["sample",... |
<reponame>darnoceloc/Algorithms<gh_stars>0
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import scipy as sci
alpha = 0.1
Times = np.array([2, 3, 4, 5, 7, 10, 20, 30])
Times_T = np.transpose(Times)
Yields = np.array([-0.0079, -0.0073, -0.0065, -0.0055, -0.0033, -0.0004, 0.0054, 0.0073])
Betas ... |
#!/usr/bin/env python3
import argparse
import sys
from os import system, devnull
from math import log
from math import ceil
import numpy as np
from scipy.signal import argrelextrema
# hetkmers dependencies
from collections import defaultdict
from itertools import combinations
version = '0.2.3dev_rn'
################... |
<filename>src/features/fre_to_tpm/viirs/ftt_plume_tracking.py<gh_stars>0
# load in required packages
import glob
import os
from datetime import datetime, timedelta
import logging
import re
import numpy as np
from scipy import ndimage
import cv2
from shapely.geometry import Point, LineString
import src.data.readers.lo... |
<reponame>jthestness/catamount
import sympy
from .base_op import Op
from ..api import utils
# HACK: Remove me later
from .stack_ops import StackPushOp
class SubgraphOp(Op):
''' A SubgraphOp designates a subgraph that manages a collection of ops.
Note: SubgraphOps can contain other SubgraphOps (nesting).
... |
import numpy as np
from scipy.interpolate import interp2d
def gencsm(m, sol, ID):
nu = m.Ncoldpipes
nhot = nu
nv = 2
nw = m.Nhotpipes
ncold = nw
nParams = 8
# Creating corner coordinates
x = [sum(sol(m.coldpipes.w)[0:i].to("m").magnitude) for i in range(nu+1)]
y = [sum(sol(m.hotpi... |
import numpy as np
import imageio
from PIL import Image
from skimage import transform, io
from itertools import product
import os, sys
import matplotlib.pyplot as plt
import math
from scipy import ndimage, misc
from contextlib import contextmanager
import pickle
import time;
from scipy import stats
from p... |
<reponame>julio0029/OxPhos_Leak_Fitted_curve<gh_stars>0
#!/usr/bin/env python3
#-*- coding: utf-8 -*-
'''-------------------------------------------------------------------------------
Copyright© 2021 <NAME> / <NAME>. All Rights Reserved
Open Source script under Apache License 2.0
-------------------------------------... |
<gh_stars>0
import json
import os.path
import numpy as np
import pycocotools.mask
import scipy.ndimage
def mask2bbox(mask):
rows = np.any(mask, axis=1)
cols = np.any(mask, axis=0)
rmin, rmax = np.where(rows)[0][[0, -1]]
cmin, cmax = np.where(cols)[0][[0, -1]]
return cmin, rmin, cmax - cmin, rmax... |
from os.path import dirname, join, expanduser
from zrp.validate import ValidateGeo
from .preprocessing import *
from .base import BaseZRP
from .utils import *
import pandas as pd
import numpy as np
import statistics
import json
import sys
import os
import re
import warnings
warnings.filterwarnings(action='ignore')
d... |
import numpy as np
from scipy.linalg import orthogonal_procrustes
from sklearn.base import RegressorMixin, MultiOutputMixin
from sklearn.linear_model import LinearRegression
class OrthogonalRegression(MultiOutputMixin, RegressorMixin):
"""Orthogonal regression by solving the Procrustes problem
Linear regres... |
<reponame>maxpit/human-pose-estimation
import numpy as np
import tensorflow as tf
import scipy.io as sio
import re
import matplotlib.pyplot as plt
from glob import glob
from os.path import basename
def load_mat(fname):
import scipy.io as sio
res = sio.loadmat(fname)
# this is 3 x 14 x 2000
return res... |
from evaluator import ProxyEvaluator
import pandas as pd
import numpy as np
import scipy.sparse as sp
from util import Logger
import os
import time
import torch
def _create_logger(config, data_name):
# create a logger
timestamp = time.time()
param_str = "%s_%s" % (data_name, config.params_str()... |
#------------------------------------------------------------------------------
# Image Classification Model Builder
# Copyright (c) 2019, scpepper All rights reserved.
#------------------------------------------------------------------------------
import os, shutil
import matplotlib.pyplot as plt
import cv2
import num... |
# Perform the necessary imports
from scipy.cluster.hierarchy import linkage, dendrogram
import matplotlib.pyplot as plt
# Calculate the linkage: mergings
mergings = linkage(samples, method='complete')
# Plot the dendrogram, using varieties as labels
dendrogram(mergings,
labels=varieties,
leaf_ro... |
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
import os
project_name = "reco-tut-ysr"; branch = "main"; account = "sparsh-ai"
project_path = os.path.join('/content', project_name)
if not os.path.exists(project_path):
get_ipython().system(u'cp /content/drive/MyDrive/mykeys.py /content')
import mykeys
g... |
<reponame>garrettj403/RF-tools<filename>rftools/conduction.py<gh_stars>1-10
"""Functions related to conductivity/resistivity."""
import numpy as np
import scipy.constants as sc
from numpy import pi, sqrt, arctan
from scipy.constants import mu_0, m_e, e
def surface_resistance(frequency, conductivity):
"""Calcu... |
import sympy as sym
import numpy as np
import math
x = sym.Symbol('x')
# define the function:
def foo(x):
y =
return y
DerivativeOfFoo = sym.lambdify(x, sym.diff(foo(x)), "numpy")
def root(formula, der, cur, mistake):
after = cur - formula(cur)/der(cur)
while formula(after) ... |
# AUTOGENERATED! DO NOT EDIT! File to edit: 02_metrics.ipynb (unless otherwise specified).
__all__ = ['bbox_iou', 'hungarian_loss']
# Cell
import torch
from scipy.optimize import linear_sum_assignment
# Cell
def bbox_iou(boxA, boxB):
# determine the (x, y)-coordinates of the intersection rectangle
xA = max(b... |
<filename>idunn/places/pj_poi.py
import re
from functools import lru_cache
from statistics import mean, StatisticsError
from typing import List, Optional, Union
from .base import BasePlace
from .models import pj_info, pj_find
from .models.pj_info import TransactionalLinkType, UrlType
from ..api.constants import PoiSou... |
<filename>Examples/StrengthTest/demo.py
import numpy as np
import scipy as sp
from scipy.linalg import norm
from pyamg import *
from pyamg.gallery import stencil_grid
from pyamg.gallery.diffusion import diffusion_stencil_2d
n=1e2
stencil = diffusion_stencil_2d(type='FE',epsilon=0.001,theta=sp.pi/3)
A = stencil_grid(st... |
<reponame>t107598066/CRAFT_TORCH
###for icdar2015####
import torch
import torch.utils.data as data
import scipy.io as scio
from gaussian import GaussianTransformer
from watershed import watershed
import re
import itertools
from file_utils import *
from mep import mep
import random
from PIL import... |
"""
Utilities for metric learning code
"""
import numpy as np
from scipy.spatial.distance import pdist
import warnings
from numpy.testing import assert_equal
from numpy.random import shuffle, randint
def labels_to_constraints(X, labels, s_size=50, d_size=50, s_delta=0.1, d_delta=1.0):
"""
Take the row major ... |
#!/usr/bin/env python
# coding: utf-8
# ## Model Training and Evaluation
# Author: <NAME>
# In[ ]:
# Load modules
import os, shutil
import re
import csv
from utils import bigrams, trigram, replace_collocation
from tika import parser
import timeit
import pandas as pd
import string
from nltk.stem import PorterStemmer... |
import numpy as np
import scipy.stats as stats
from matplotlib import pyplot as plt
from matplotlib import animation
from MCMC import MCMC
# Unpack the chain data
xRwm, yRwm = np.load("rwm.npy")
xCov, yCov = np.load("adapt.npy")
# Define parameters for the distributions
pMean = np.array([5, 5])
pCov = np.array([[1, 1... |
import glob
import os
import typing
import logging
import scipy
import numpy as np
import numpy as np
import keras
from keras.models import Sequential, Model
from keras.layers import Dense, Dropout, Flatten
from keras.layers import Conv2D, MaxPooling2D, GlobalAveragePooling2D
from keras.optimizers import SGD
import ... |
from torch_geometric.data import DataLoader
import torch
import scipy.io as sio
from torch_geometric.data.data import Data
import numpy as np
import os.path as osp
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Sequential, Linear, ReLU
from torch_geometric.nn import (NNConv, graclus, max_p... |
<gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Functions for the computation of the Geographically Weighted Multi scale analysis
on dataset of points carrying (or not) a valued quantity.
GWMFA.analysis : performfull GWMFA analysis of a set of points
GWMFA.localWaveTrans : c... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Unit tests for utils.py.
@author: <NAME>
"""
import os
import pathlib
import glob
import time
import unittest
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import tensorflow as tf
tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR)
import numpy as np
import m... |
<reponame>coursekevin/AerospikeDesign<filename>angelinoNozzle_py/single_efficiency.py
import numpy as np
import matplotlib.pyplot as plt
from scipy import interpolate
PRs = np.linspace(8.9,200,100)
s_pr = np.array([8.9,10,20,30,100,200])
s_eff = np.array([0.89,0.88,0.82,0.85,0.94,0.97])
b_pr = np.array([8.9,30,2... |
<reponame>ctralie/MorseSSM
#Programmer: <NAME>
#Purpose: To create a collection of functions for making random curves and applying
#random rotations/translations/deformations/reparameterizations to existing curves
#to test out the Morse matching algorithm
import numpy as np
import matplotlib.pyplot as plt
import scipy.... |
<gh_stars>0
from time import time
import numpy as np
from math import pi
lib = {
"0": ([(0, 0.5, 0.5, 0, 0)], [(1, 1, 0, 0, 1)], 0.5),
"1": ([(0.25, 0.25)], [(0, 1)], 0.5),
"2": ([(0, 0.5, 0.5, 0, 0, 0.5)], [(1, 1, 0.5, 0.5, 0, 0)], 0.5),
"3": ([(0, 0.5, 0.5, 0), (0, 0.5)], [(1, 1, 0, 0), (0.5, 0.5)], ... |
<reponame>syedsaifhasan/rl_reconstruct
#!/usr/bin/env python
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
# Workaround for segmentation fault for some versions when ndimage is imported after tensorflow.
import scipy.ndimage as nd
import os
import sys
im... |
import numpy as np
import scipy.misc
import scipy.stats
import matplotlib.pyplot as plt
from matplotlib.patches import Ellipse
import snl.util as util
from snl.pdfs.gaussian import Gaussian
class MoG:
"""
Implements a mixture of gaussians.
"""
def __init__(self, a, ms=None, Ps=None, Us=None, Ss=No... |
<filename>code/graph_cnn/checking_out_graphs.py<gh_stars>1-10
import scipy.io as sio
import skimage.io as skio
class helper_mat_file(object):
def __init__(self, mat_file, img_file):
self.img = img_file
self.seg_img = mat_file['segImgI']
self.adj_graph = mat_file['graphI']
self.sI =... |
import logging
from abc import ABC
import numpy as np
from scipy.integrate import trapz
from scipy.interpolate import interp1d, splev, splrep
class PowerToCorrelation(ABC):
""" Generic class for converting power spectra to correlation functions
Using a class based method as there might be multiple implemen... |
import matplotlib.pyplot as plt
import numpy as np
from scipy.stats import chisquare
from numpy.random import normal
import math
from scipy.stats import normaltest
class Input_analysis:
def __init__(self):
self.arrival_times = []
self.arrivel_times_processed = []
self.base_stations = []
... |
<gh_stars>0
from scipy.io import wavfile
from cmath import sqrt
import numpy as np
import matplotlib.pyplot as mplt
def rms(X, frameLength, hopLength):
rms = []
for i in range(0, len(X), hopLength):
rmsCurrent = np.sqrt( np.sum(X[i:i + frameLength]**2.0) / frameLength )
rms.append(rmsCurrent)
... |
<gh_stars>1-10
#conda install -c rapidsai -c h2oai -c conda-forge h2o4gpu-cuda92 cuml
import fire # cuml , h2o4gpu
# conda install -c h2oai -c conda-forge h2o4gpu-cuda10
from pymethylprocess.MethylationDataTypes import MethylationArray
# import cudf
import numpy as np
from dask.diagnostics import ProgressBar
# from cum... |
# Author: <NAME>, <EMAIL>
# Sep 8, 2018
# Copyright 2018 <NAME>
import numpy as np
from matplotlib import pyplot as plt
from scipy.spatial import distance as dist
import scipy.io
import pickle
import networkx as nx
from time import time
tics = []
def tic():
tics.append(time())
def toc():
if len(tics)=... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 21 23:36:13 2017
@author: virati
Trying to reconstruct a dynamical system from a time series
Synthetic attempt, but should be translatable to empirical time series
"""
import numpy as np
import scipy.integrate as integ
import matplotlib.pyplot as p... |
<gh_stars>10-100
import pdb
from warnings import WarningMessage
import warnings
import numpy as np
from numpy.core.defchararray import array
import pandas as pd
from scipy.spatial import distance
from streamad.base import BaseDetector
class KNNDetector(BaseDetector):
"""Univariate KNN-CAD model with mahalanobis d... |
<reponame>sbhattacharyay/ordinal_GOSE_prediction
#### Master Script 1: Extract study sample from CENTER-TBI dataset ####
#
# <NAME>
# University of Cambridge
# email address: <EMAIL>
#
### Contents:
# I. Initialisation
# II. Load and filter CENTER-TBI dataset
# III. Characterise ICU stay timestamps
### I. Initialisati... |
<reponame>untergunter/LunaLnder
import torch.nn as nn
import torch.nn.functional as F
import torch
import numpy as np
import gym
from scipy.optimize import minimize
import random
class Critic(nn.Module):
def __init__(self, device):
super(Critic, self).__init__()
self.fc1 = nn.Linear(10, 10)
... |
<gh_stars>10-100
# ==============================================================================
__title__ = "ensenble significance"
__author__ = "<NAME>"
__version__ = "v1.0(23.06.2020)"
__email__ = "<EMAIL>"
# ==============================================================================
import os
im... |
<reponame>rayonde/yarn<gh_stars>1-10
import time
import scipy.sparse
import scipy.linalg
import numpy as np
double = 1
rtype = np.float64 if double else np.float32
ctype = np.complex128 if double else np.complex64
def run(Hs, ctrls, psi0, psif, taylor_order):
Hs = [-1j*H for H in Hs]
Hs_ct = [H.conj().T.tocsr... |
<filename>KwikTeam/spikedetekt2/spikedetekt2/processing/pca.py
"""PCA routines."""
# -----------------------------------------------------------------------------
# Imports
# -----------------------------------------------------------------------------
import numpy as np
from scipy import signal
from kwiklib.utils.six... |
<reponame>ChoiSeEun/Korean-NLP-Visual<filename>SoyNLP/soynlp/vectorizer/_word_context.py
from soynlp.utils import get_process_memory
from collections import defaultdict
from scipy.sparse import csr_matrix
def sent_to_word_context_matrix(sents, windows=3, min_tf=10,
tokenizer=lambda x:x.split(), verbose=True):
... |
"""
Approximation of functions by linear combination of basis functions in
function spaces and the least squares method (or the Galerkin method).
2D version.
"""
import sympy as sym
import numpy as np
def least_squares(f, psi, Omega, symbolic=True, print_latex=False):
"""
Given a function f(x,y) on a rectangul... |
import numpy as np
from scipy.ndimage.filters import convolve, gaussian_filter
import matplotlib.pyplot as plt
import math
import os
import re
ArcToCm = math.pi / 180.0 / 3600.0 * 1.49597870e13
frequency = [
1000000000,
2000000000,
3750000000,
9400000000,
17000000000,
35000000000,
55000000... |
<reponame>JBEI/Ajinomoto
import matplotlib.pyplot as plt
import matplotlib.colors as colors
from mpl_toolkits.axes_grid1 import AxesGrid
from mpl_toolkits.axes_grid1 import make_axes_locatable
from mpl_toolkits.mplot3d import Axes3D
import seaborn as sns
from sklearn.decomposition import PCA
from sklearn.model_selecti... |
<filename>tests/test_models/test1/test1.py
import logging
import os
from keras.models import load_model
from PIL import ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True
from scipy.misc import imread, imresize
import numpy as np
from models.modelController import ModelControllerClass
class CarsClass(ModelControllerCla... |
import sys
sys.path.append('..')
from util import *
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import scipy
import pickle
from tqdm import tqdm
import scipy.io
from sklearn import preprocessing
from data_collection_merge_data import preprocess_dataframes, trim_by_start_time, trim_by_start_... |
# -*- coding: utf-8 -*-
"""
@author: <NAME>.
Department of Aerodynamics
Faculty of Aerospace Engineering
TU Delft, Delft, Netherlands
"""
import sys
if './' not in sys.path: sys.path.append('/')
from objects.CSCG._2d.forms.standard._1_form.inner.special import _1Form_Inner_Special
import nu... |
# acrobot
# import trajectory class and necessary dependencies
import sys
from pytrajectory import TransitionProblem, log
import numpy as np
from sympy import cos, sin
if "log" in sys.argv:
log.console_handler.setLevel(10)
def f(xx, uu, uuref, t, pp):
""" Right hand side of the vectorfield defining the sys... |
#
# Biharmonic
#
from __future__ import division
from sympy import Symbol, lambdify, sin
import lega.biharmonic_clamped_basis as shen
import scipy.sparse.linalg as la
from sympy.mpmath import quad
import numpy as np
def solve_shen(g, h, n):
# Mat
A = shen.bending_matrix(n)
# The f is zero on -1, 0 so t... |
<filename>code/permutation_importance.py
import numpy as np
import pandas as pd
from sklearn.metrics import mean_squared_error, mean_absolute_error, accuracy_score, log_loss, roc_auc_score
from scipy.stats import spearmanr
class PermulationImportance(object):
"""
compute permutation importance
"""
... |
<reponame>katya-zossi/tmm-sensors
"""
Additional scripts required to reproduce the far-field
radiation patters of polarizable molecules on the
surface of multilayer complex materials.
"""
from __future__ import division, print_function, absolute_import
from tmm import (coh_tmm, position_resolved)
from scipy.interpol... |
<filename>topic_modeling.py
#From NLTK we import a function that splits the text into words (tokens)
from nltk.tokenize import word_tokenize
import nltk.stem
from unidecode import unidecode
from lxml import etree
from nltk.corpus import stopwords
import gensim
import numpy as np
from sklearn import svm
import ... |
<filename>src/tests/admittance_matrix_test.py
# This file is part of GridCal.
#
# GridCal is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later versio... |
from flask import render_template, flash, redirect, Blueprint, request, send_file
import json
import numpy as np
import cv2
from .models import Person, object_db
from sqlalchemy import func
from flask import current_app as app
import random
from PIL import Image
import requests
from io import BytesIO
from... |
import numpy as np
from scipy import signal
# 3 sample delay: y[n] = x[n] - x[n-3]
b = [1,0,0,-1]
# 4 sample delay: y[n] = x[n] - x[n-4]
b1 = [1,0,0,0,-1]
# 5 sample delay: y[n] = x[n] - x[n-5]
b2 = [1,0,0,0,0,-1]
# Sampling frequency = 2
w, h = signal.freqz(b, fs=2)
w1, h1 = signal.freqz(b1, fs=2)
w2, h2 = signa... |
<filename>src/stormcenterings.py<gh_stars>0
#%%[markdown]
# # Storm Centering
# The notebook analyzes the spatial patterns of annaul daily maximum precipitation. It performs this analysis on the North Branch of the Potomac Watershed, using a dataset constructed from the Livneh data $^{1}$. This dataset is constructed u... |
import os, pickle
import matplotlib.pyplot as pl
import matplotlib.dates as mdates
import scipy as sp
import mpl_toolkits.basemap as bm
from mpl_toolkits.basemap.cm import sstanom
dsetname='HadISST'
varname='sst'
indname='amo'
path=os.environ['NOBACKUP']+'/verification/'+dsetname
indfile=path+'/data/'+varname+'_'+indn... |
from attr import attrs, attrib, Factory, validate
from attr.validators import instance_of, optional
from enum import Enum
from fractions import Fraction
from six import string_types
from ..exceptions import AdmError
from ....common import CartesianScreen, PolarScreen, default_screen, list_of
def _lookup_elements(adm... |
<filename>code/trustExperiment.py<gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import torch
from torch.autograd import Variable
from torch import nn
from torch.nn import Parameter
import csv
import os
import numpy as np
from numpy.linalg import norm
from numpy import pi, sign, fabs, genfromtxt
from ... |
"""
This is the module file to train and predict on job_training data.
Author(s) : <NAME>
<EMAIL>
<NAME>
<EMAIL>
Parts of code may have been provided by COS 424 staff. Such code portions are properly
credited.
Last Updated : 03-27-2018
"""
# Import the relevant packages/module... |
<reponame>fraunhoferhhi/pred6dof
# '''
# The copyright in this software is being made available under this Software
# Copyright License. This software may be subject to other third party and
# contributor rights, including patent rights, and no such rights are
# granted under this license.
# Copyright (c) 1995 - 2021 F... |
<filename>basicMaps.separate.output_climetincides.py
# To: This is for basic maps (pr, qtot, soilmoist). >>> Fig.1, SupFig.1
# - Global maps: base-period, historical, 2050s, and 2080s
# - absolute or change x ensemble or members
# - a change map has 2D colorbar (change & agreement/
#... |
<filename>2021.4/bin/genetic_circuit_partition.py
#!/usr/bin/env python
# Copyright (C) 2021 by
# <NAME> <<EMAIL>>, Densmore Lab, Boston University
# All rights reserved.
# OSI Non-Profit Open Software License ("Non-Profit OSL") 3.0 license.
# Load required modules
import csv
import random
import matplotlib.pyplot ... |
<gh_stars>1-10
"""
This file contains all curve fitting used for the emission lines:
least squares circle fit (LSF), LMA circle fit, parabolic arc fit, and a LSF line fit.
"""
import scipy.stats as stats
import scipy.optimize as optimize
import scipy as sc
import numpy as np
import math
def LSF(x,y):
"""Fit a ... |
## Script which processes the Stanford Sentiment Treebank datasets into formats which can be used to train
## a Keras model. This format is two files, with one containing the sentences converted to lower case with
## all punctuation removed, and the other containing the category labels (one integer per line).
import s... |
import os, math, itertools
from statistics import mean
from argparse import ArgumentParser, Namespace
from typing import List, Callable, Dict, Tuple
import torch.nn as nn
from torch.utils.data import DataLoader
from torch.optim import Optimizer
from torch.optim.lr_scheduler import _LRScheduler
from torch.nn.modules.lo... |
from sympy import cos, Matrix, sin, symbols, pi, S, Function, zeros
from sympy.abc import x, y, z
from sympy.physics.mechanics import Vector, ReferenceFrame, dot, dynamicsymbols
from sympy.physics.mechanics import Dyadic, CoordinateSym, express
from sympy.physics.mechanics.essential import MechanicsLatexPrinter
from sy... |
import cPickle
from abc import ABCMeta, abstractmethod
from scipy.misc import imsave
import numpy
import tensorflow as tf
from Log import log
from Measures import compute_iou_for_binary_segmentation, compute_measures_for_binary_segmentation, average_measures
from datasets.Util.pascal_colormap import save_with_pascal_c... |
<reponame>javierpi/machine_learning
from statistics import mean
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import style
import random
style.use('ggplot')
# Algoritmo para calcular regresion lineal
###########################
# _ _ __
# x . y - xy
# m = ------------------
# ... |
from collections import namedtuple
from autograd import value_and_grad, vector_jacobian_product
from autograd.extend import primitive, defvjp
import autograd.numpy as np
import autograd.numpy.random as npr
import autograd.scipy.stats.multivariate_normal as mvn
import autograd.scipy.stats.t as t_dist
from autograd.sci... |
#!/usr/bin/env python3
from numpy import *
from scipy import *
from scipy.interpolate import interp1d
from scipy.interpolate import pchip
import sys
import os
import argparse
import json
parser = argparse.ArgumentParser(description='Produce bd-rate report')
parser.add_argument('run',nargs=2,help='Run folders to compa... |
# encoding: utf-8
"""
Methods to compute dissimilarity matrices (DSMs).
"""
import numpy as np
from scipy.spatial import distance
from mne.utils import logger
from .folds import _create_folds
from .searchlight import searchlight
def compute_dsm(data, metric='correlation', **kwargs):
"""Compute a dissimilarity m... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.