text
string
<reponame>tansey/deep-dose-response<filename>python/step6_factorize_features.py<gh_stars>1-10 ''' Creates a binary matrix of biomarker features and runs a binary matrix factorization routine on it. Code for factorizing the matrix is courtesy of <NAME>. We use k=50 latent factors and run the model for 30 minutes which a...
<gh_stars>10-100 import matplotlib.pyplot as plt import numpy as np from scipy.linalg import expm, inv, eig from sklearn.metrics import accuracy_score, plot_confusion_matrix from sklearn.neural_network import MLPClassifier from bayesian_decision_tree.classification import PerpendicularClassificationTree def get_cova...
import numpy as np import scipy.stats def L2_norm(x): return np.sqrt(np.sum(np.square(x), axis=-1)) class Circle(object): def __init__(self, ndim, r=1000, origin=0.0): if np.isscalar(origin): self.origin = origin * np.ones(ndim) else: self.origin = np.array(origin) ...
# # Packt Publishing # Hands-on Tensorflow Lite for Intelligent Mobile Apps # @author: <NAME> # # Section 5: Gesture recognition # Video 5-3: Parameter study and data augmentation # from PIL import Image import numpy as np import scipy.misc import os def hotvector(vector,classes): ''' This function will transform a ...
import pygad as pg import matplotlib.pyplot as plt import numpy as np from scipy import stats import utils import glob from multiprocessing import Pool filename = __file__ def plot(args): halo = args[0] definition = args[1] print args path = '/ptmp/mpa/naab/REFINED/%s/SF_X/4x-2phase/out/snap_%s_4x_???...
<filename>arlobot_bringup/src/nodes/olddrivenode.py<gh_stars>0 #!/usr/bin/env python """ ---------------------------------------------------------------------------------------------------- File: olddrivenode.py Description: Provides implementation of the DriveNode responsible for: * driving the moto...
import numpy as np import pandas as pd import matplotlib.pyplot as plt import joblib import yaml from datetime import datetime import os import shutil import seaborn as sns import pickle from pickle import dump from scipy.signal import find_peaks from sklearn import metrics from sklearn.model_selection import cross_va...
<reponame>johnbanq/modl import scipy.sparse as sp from numpy.testing import assert_equal from modl.utils.recsys.cross_validation import ShuffleSplit def test_shuffle_split(): X = [[3, 0, 0, 1], [2, 0, 5, 0], [0, 4, 3, 0], [0, 0, 2, 0]] X = sp.coo_matrix(X) cv = ShuffleSplit(n_...
<reponame>atsoukevin93/tumorgrowth<filename>codes/power_dichotomy_algorithm.py #!/usr/bin/env python # -*- coding: utf-8 -*- from fipy import * import numpy as np import scipy.sparse as sp import scipy.sparse.linalg as la from matplotlib import pyplot as plt import parameterFunctions.immuneResponse as delt import para...
import matplotlib.pyplot as plt import numpy as np from scipy.stats import multivariate_normal from mpl_toolkits.mplot3d import proj3d from matplotlib.patches import FancyArrowPatch from matplotlib import cm from matplotlib import rc __author__ = 'ernesto' # if use latex or mathtext rc('text', usetex=True) rc('mathte...
<gh_stars>0 import numpy as np import time import torch import torch.nn as nn import torch.autograd import h5py import torch.optim as optim import scipy.io from torch.autograd import Variable import torch.optim as optim from enum import Enum from HeatEquation.Dataset.Baseline import HeatEquationDataset from Schrodinge...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Jun 20 14:34:15 2021 @author: tobrien Script for re-analysing Ida's data based upon my script -- refer to this script for nice comments on what each line of the script is doing! Script that loops through different strains and does: -First step of K...
## """ The script implement three steps for refining the segmentation results based on the fitted SSM. Step 1: Close holes in regions dictated by the SSM step 2: Remove unconnected components outside the span of the SSM Step 3: Remove voxels that are further than the 95% of contour distances Processed segmentation ma...
<gh_stars>1-10 import numpy as np import matplotlib.pyplot as plt import seaborn as sns import sys import matplotlib.gridspec as gridspec import pandas as pd import warnings np.random.seed(1) warnings.filterwarnings("ignore") sns.set(palette="colorblind") sys.path.insert(0, "../reports/code_blocks/") import reflecto...
<filename>structureimpute/explore/set_one_validate_null_to_another_validate.py<gh_stars>1-10 from __future__ import print_function import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt import seaborn as sns sns.set(style="ticks") sns.set_context("poster") plt.rcParams["font.family"] = "Helvetica" imp...
# Copyright (c) 2016, <NAME> # Licensed under the BSD 3-clause license (see LICENSE) import numpy as np import scipy.linalg as la from .test_matrix_base import MatrixTestBase from .kronecker import Kronecker from .numpy_matrix import NumpyMatrix from .matrix import Matrix from .sum_matrix import SumMatrix from .toepl...
<filename>src/object_detection/Object_detection_image.py import os import uuid import cv2 import numpy as np import tensorflow as tf import sys import scipy import scipy.misc # This is needed since the notebook is stored in the object_detection folder. from api_results.clasification_result import ClassificationResult ...
<gh_stars>1-10 # -*- coding: utf-8 -*- """ Created on Mon Jan 10 12:18:45 2022 @author: maout """ import time import torch import random import numpy as np import pandas as pd import matplotlib.pyplot as plt from scipy.spatial.distance import cdist from typing import Union # GPU + autodiff library from torch.autogra...
"""Conversion functions for weather radar and rainfall data.""" from numpy import isfinite, log, ubyte from scipy.ndimage import gaussian_filter from skimage.exposure import equalize_hist, rescale_intensity def dBZ_to_ubyte(I, dBZ_min=-10.0, dBZ_max=50.0, filter_stddev=3.0): """Convert a dBZ field into a 8-bit imag...
<filename>create_market.py #!/usr/bin/env python # -*- coding: UTF-8 -*- from scipy.stats import chi2 import numpy as np import random, pickle from scipy.optimize import fsolve from initial_market import StartMarket from matplotlib import pyplot as plt class init_agents(StartMarket): def createAgents...
<filename>seeds/hmmer.py import os import numpy as np import pandas as pd from scipy import sparse from seeds import Seed from Utils import ColourClass, Utilities from Utils.HmmerTbloutParser import HmmerTbloutFile class HMMerSeed(Seed): def __init__(self, hmmer, proteins, terms, go, blacklist, goa, protein_fo...
import scipy.special import numpy from pylab import plot,show def gauss(n): x,w = scipy.special.orthogonal.p_roots(n) x=(x+1)/2.0 w=.5*w return x,w def tensorquad(x,wx,y,wy): """Combine two quadrules in the x and y direction into a 2D tensor rule""" nx=len(x) ny=len(y) m=numpy.m...
<reponame>AlbertoJimenezDiaz/ctplanet ''' Functions for calculating the shape of hydrostatic density interfaces and their gravitational potential in a planet with a non-hydrostatic lithosphere. ''' import numpy as np import scipy.linalg.lapack as lapack import pyshtools as pysh # ==== HydrostaticShapeLith ==== def ...
import numpy as np import seren3 # the_mass_bins=[7., 8., 9., 10.] def plot(path, iout, pickle_path, the_mass_bins=[7., 8., 9., 10,], lab='', ax=None, **kwargs): import pickle from seren3.analysis.plots import fit_scatter from seren3.utils import flatten_nested_array import matplotlib.pylab as plt ...
<gh_stars>1-10 import os import os.path import numpy as np import pandas as pd from PIL import Image from scipy import ndimage, spatial from scipy.stats import skew import skimage.feature np.set_printoptions(threshold=np.inf) def skewness_cells(image): indices = np.where(image) y_coord = np.asarray(indices[0]...
<gh_stars>1-10 from math import e, factorial,log, gamma, sqrt, floor, exp from matplotlib import pyplot as pt from numpy.random import geometric, poisson, exponential from scipy.stats import ks_2samp from scipy.stats import norm#,poisson from numpy import linspace import re def computeEvents(V, ttx, trx, tn): Eb =...
<filename>anisotropic/utils.py<gh_stars>1-10 import tensorflow as tf import tensorlayer as tl from tensorlayer.prepro import * # from config import config, log_config # # img_path = config.TRAIN.img_path import scipy import numpy as np import skimage def Subpixel_mod(X, scale=2): I = X.outputs bsize, a, b, c ...
class Solver(object): def get(self, Otrain, Ftrain, xmin, xmax): raise NotImplementedError() class Fmin(Solver): def get(self, Otrain, Ftrain, xmin, xmax): y = np.linspace(xmin, xmax, self._nbins) I = np.where((y >= np.min(Otrain)) & (y <= np.max(Otrain)))[0] assert(len(I) > 0) ...
# -*- encoding: utf-8 -*- """ tests.help.test_helping module """ import pytest import datetime import pysodium import fractions from dataclasses import dataclass, asdict from keri.help.helping import isign, sceil from keri.help.helping import mdict from keri.help.helping import extractValues from keri.help.helping ...
__author__ = 'mricha56' __version__ = '4.0' # Interface for accessing the PASCAL in Detail dataset. detail is a Python API # that assists in loading, parsing, and visualizing the annotations of PASCAL # in Detail. Please visit https://sites.google.com/view/pasd/home for more # information about the PASCAL in Detail cha...
""" Constant and units conversion functions for for petroleum engineering calculations """ import numpy as np import scipy.constants as const g = const.g # gravity pi = const.pi pressure_sc_bar = 1 # pressure standard condition temperature_sc_C = 15 # temperature standard condition const_at = 98066.5 # techni...
#!/usr/bin/env python # -*- coding: UTF-8 -*- import argparse import re import shlex import time from contextlib import suppress from functools import partial from pathlib import Path from statistics import mean, median from threading import Event, Thread from typing import Any, Dict, List, Optional, Set, Hashable, Un...
#!/usr/bin/env python # # Copyright (C) 2019 # <NAME> # Centre of Excellence Cognitive Interaction Technology (CITEC) # Bielefeld University # # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of so...
import matplotlib.pyplot as plt import numpy as np import pandas as pd from scipy.interpolate import make_interp_spline, BSpline from matplotlib.pyplot import MultipleLocator #%matplotlib inline df=pd.read_csv('pred_r.csv') df2=pd.read_csv('real_r.csv') #print(df) x=list(range(len(df))) datelist=list() datelist2=list...
import sys import os import pickle import tarfile import numpy as np import urllib import zipfile import fnmatch import shutil import gzip import cPickle as cPkl import pickle as pkl def whiten(X_train, X_valid): offset = np.mean(X_train, 0) scale = np.std(X_train, 0).clip(min=1) X_train = (X_train - offs...
<filename>rssympim/examples/performance_benchmarks/performance.py # # Performance Testing for SymPIM-rz - script generated from IPython notebook # # This will follow the BeamLoad approach, varying the number of modes in the longitudinal and radial direction as well as the number of macro-particles, to produce a few pl...
__author__ = 'DafniAntotsiou' ''' This script calculates dataset DTW scor. It uses the fastdtw python package @https://pypi.org/project/fastdtw/ ''' from cat_dauggi.functions import read_npz from fastdtw import fastdtw from scipy.spatial.distance import euclidean import argparse from baselines.common.misc_util import...
<filename>proclivity.py from __future__ import division #For decimal division. import numpy as np #For use in numerical computation. from matplotlib import pylab as plt #Plotting. import argparse #For commandline input import scipy.io #For loading sparse matrices. import sys import time #Check time of computation. impo...
# -*- coding: utf-8 -*- from __future__ import print_function import weakref import numpy as np from scipy.ndimage.filters import gaussian_filter from acq4.Manager import getManager from acq4.modules.TaskRunner.analysisModules.AnalysisModule import AnalysisModule from acq4.util import Qt from acq4.util.debug import ...
<filename>util/download.py from statistics import mode import requests import base64 headers_with_book118 = { "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", "Accept-Encoding": "gzip, deflate, br", "Accept-Language":...
<reponame>virati/cortical_signatures #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Nov 23 16:13:54 2018 @author: virati This scipt is focused on characterizing the ONTarget response Includes some DTI support modeling which should be split out """ from DBSpace.control import proc_dEEG import DBSpa...
<gh_stars>0 # coding: utf-8 # カルマンフィルタ p107から from robot import * from noise_robot import * from scipy.stats import multivariate_normal from matplotlib.patches import Ellipse # カルマンフィルタの実装 class KalmanFilter: # envmap : 地図 # init_pose : 初期姿勢 # motion_noise_stds : 動きに加えるノイズの標準偏差 def __init__(self, ...
#!/usr/bin/env python import numpy as np import matplotlib.pyplot as plt plt.style.use('mystyle') import scipy.interpolate as interpol nu,eV,Sy,Br,IC,pp,ColdDisk,Refl,Tot,ICin = np.loadtxt('lumThermal.dat',unpack=True) NT_logeV,NT_logSyp,NT_logIC,NT_logpIC,NT_logpp,NT_logpg,NT_logNotAbs, NT_logAbs = np.loadtxt('lum...
<filename>src/extrapolated_lowess/extrapolated_lowess.py import logging import numpy as np from scipy import linalg LOGGER = logging.getLogger(__name__) def extrapolated_lowess(x_data, y_data, alpha=1, y_std=None): r"""Performs a locally-weighted regression (LOWESS) and extrapolation for missing dependent-...
<reponame>shishitao/boffi_dynamics<filename>dati_2014/08/ex2.py<gh_stars>0 from scipy import * from scipy.linalg import eigh story_stiffness = range(23,11,-1) story_stiffness.append(0) K = matrix(zeros((13,13))) M = matrix(zeros((12,12))) for i in range(12): M[i,i] = 1.0 K[i,i] = story_stiffness[i] + story_s...
<filename>Probability Statistics Beginner/Linear regression-15.py ## 2. Drawing lines ## import matplotlib.pyplot as plt import numpy as np x = [0, 1, 2, 3, 4, 5] # Going by our formula, every y value at a position is the same as the x-value in the same position. # We could write y = x, but let's write them all out t...
# -*- coding: utf-8 -*- """ Created on Thu Jul 23 14:33:44 2015 @author: Eric """ from os import chdir chdir("..") import numpy as np import matplotlib.pyplot as plt import scipy.io from pca.pca import PCA import SAILnet imfile = "patches.mat" imname = "patches" nullpca = PCA() normalpca = PCA(...
<gh_stars>1-10 import constants import math import statistics def normalize_audio_file(x, set_dB=110): Pref = constants.Pref # load reference sound pressure amp_value = Pref * 10 ** (set_dB / 20) # calculate amp value with reference from db # root_mean_square = math.sqrt(statistics.mean(x ** 2.)) # RMS...
<filename>recommender/train.py import json import os from argparse import ArgumentParser from collections import OrderedDict import numpy as np import pandas as pd import torch import torch.nn.functional as F import torch.optim as optim import torchvision.transforms as transforms from scipy.optimize import linear_sum_...
<reponame>apirzadeh1365/omic_project<filename>main/dashboard/pages/spo2/oxygensat.py """ This module contains the page that shows the oxygen saturation (SpO2) levels. <NAME>: - Created spo2 plot <NAME>: - Created general structure - Implemented spo2 plot - Refactored whole spo2 plot in several functions """ import...
<filename>create_Multi.py import numpy as np import scipy.io as sio def read_gct(fn): with open(fn, 'rb') as f: for i, line in enumerate(f): if i == 1: row = line.split('\t') p = int(row[0]) n = int(row[1]) break X = np.zeros([...
# -*- coding: utf-8 -*- """ @author: <NAME> & <NAME> """ #Import Statements from scipy.constants import physical_constants, Boltzmann, R, femto, pico, nano from math import pi, pow, sqrt, cos, radians, exp, floor import codons import pandas import json, sys, os def is_number(self,c): numbers = ".0123456789" i...
import six import torch import ubelt as ub if six.PY2: from fractions import gcd else: from math import gcd def rectify_nonlinearity(key=ub.NoParam, dim=2): """ Allows dictionary based specification of a nonlinearity Example: >>> rectify_nonlinearity('relu') ReLU(...) >>> ...
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------------------------- """ Helpers to process schemas. """ ...
#!/usr/bin/env python3 """ Main script to create spectrogram images Original Data Information -------------------------- High Pass Filter: 0 Low Pass Filter: 104 Useful Information BDF file detected Setting channel info structure... Creating raw.info structure... <Info | 7 no...
<gh_stars>0 import numpy as np from numpy.lib.arraysetops import isin import torch from scipy.optimize import linear_sum_assignment from torch.nn.modules.activation import Sigmoid, Softmax from toolbox.utils import get_device, greedy_qap, perm_matrix import torch.nn.functional as F from sklearn.cluster import KMeans im...
# -*- coding: utf-8 -*- """ Validation of Laplacian using spherical harmonics ==================================================================== Study the eigenvalue spectrum of the discretize laplace-beltrami operator on a spherical mesh. Compare the spectrum to analytical solution. """ import numpy as np...
import numpy as np import pandas as pd import scipy import matplotlib.pyplot as plt from sklearn import linear_model import seaborn data = pd.read_csv('dataset.csv') data = data.fillna(value=data.mean()) (data['BsmtFinType2'].fillna(value='VARIOUS',inplace=True)) (data['BsmtFinType1'].fillna(value='VARIOUS',inplace=T...
<filename>src/clophfit/old/fit_titration.py<gh_stars>0 #!/usr/bin/env python import os import argparse import numpy as np import pandas as pd from collections import namedtuple from scipy import optimize import matplotlib.pyplot as plt import seaborn def main(): """Fit pH and cl titrations where data are spectr...
#!/bin/python3 import os # # Complete the storyOfATree function below. # def storyOfATree(n, edges, k, guesses): # # Write your code here. # import fractions # Compute neighbors of nodes. neighbors = [[] for _ in range(n)] for [u, v] in edges: neighbors[u - 1].append(v - 1) ...
"""Restricted Boltzmann Machine with softmax visible units. Based on sklearn's BernoulliRBM class. """ # Authors: <NAME> <<EMAIL>> # <NAME> # <NAME> # <NAME> # License: BSD 3 clause import time import re import numpy as np import scipy.sparse as sp from sklearn.base import BaseEstimator f...
"""Create constant and point scatterer models.""" import numpy as np import scipy.special import scipy.integrate from scipy.ndimage.interpolation import shift from smii.modeling.propagators.propagators import (Scalar1D, Scalar2D) from smii.modeling.wavelets.wavelets import ricker from smii.modeling.forward_model import...
#!/usr/bin/python3 import logging import numpy as np import pandas as pd import gzip import itertools from scipy.io import mmread,mmwrite from scipy.sparse import coo_matrix from os.path import join as pjoin from os import linesep np.random.seed(12345) #Number of NTC gRNAs to keep ng_negselect=15 #Number of TSS targe...
<gh_stars>1-10 ''' This code reads in a batch of very high resolution spectra and degrades them to a lower resolution, assuming a Gaussian line-spread function. The main use case is that we produce synthetic spectra (from an updated version of the Kurucz line list by default) at R~300,000 and need to convolve them the...
<gh_stars>1-10 # 质量波动和应力波动模型 import os,yaml,sys import numpy as np import scipy.constants as C # 定义全局变量 pi = C.pi h = C.Planck hbar = h/(2*pi) R = C.R k = C.k prompt = ">>>" def periodic_table(): CurrentPath=os.getcwd() YamlFile=os.path.join(CurrentPath,"periodic-table.yaml") with open(YamlFile,"r") as...
#!/usr/bin/env python import h5py import os import scipy as sp import pdb import utilities.hdf5 as hdf5 import fnmatch import sys if __name__ == "__main__": tempvarfiles = sys.argv[1] fn_output = sys.argv[2] files = [] for rts,dirs,fs in os.walk(tempvarfiles): fs = fnmatch.filter(fs, '*.hdf5'...
<gh_stars>0 #Imports from scipy.integrate import dblquad #Constants LowerLimit_x = 0.0 UpperLimit_x = 10.0 LowerLimit_y = 0.0 UpperLimit_y = 10.0 #Defining Function def function(x,y): return (x**2)+(y**2) # Turning the constants into a function. (Makes the code work). def Lfy(x): return LowerLimit_y def Ufy(x): ...
from __future__ import print_function import numpy as np from scipy.special import gamma, gammaincc from scipy.interpolate import splev, splrep from scipy.optimize import brentq class target_LF: ''' Class containing methods for calculating the target luminosity function of the MXXL mock catalogue ''' ...
import numpy as np from scipy import special from zenquant.ctastrategy import ( CtaTemplate, StopOrder, TickData, BarData, TradeData, OrderData, BarGenerator, ) from zenquant.trader.constant import ( Status, Direction, Offset, Exchange ) import lightgbm as lgb from tzlocal i...
<filename>examples/camera_example.py<gh_stars>1-10 import matplotlib.pyplot as plt import matplotlib import visgeom as vg import numpy as np from scipy.spatial.transform import Rotation # Use Qt 5 backend in visualisation. matplotlib.use('qt5agg') # Create axis. fig = plt.figure() ax = plt.axes(projection='3d') ax.se...
<gh_stars>1-10 #!/usr/bin/env python # -*- coding: utf-8 -*- """ Created on Wed May 15 17:15:19 2019 @author: philipp """ # ======================================================================= # Sort genes by adjusted robust rank aggregation (Li et al., Genome Biology 2014) # ======================================...
#!/usr/bin/env python # coding: utf-8 # - Edge weight is inferred by GNNExplainer and node importance is given by five Ebay annotators. Not every annotator has annotated each node. # - Seed is the txn to explain. # - id is the community id. import os import pickle import math from tqdm.auto import tqdm import random...
import numpy as np import scipy from active_semi_clustering.exceptions import EmptyClustersException from active_semi_clustering.farthest_first_traversal import weighted_farthest_first_traversal from .constraints import preprocess_constraints # np.seterr('raise') class MPCKMeansMF: """ MPCK-Means that learn...
import numpy as np import numpy.polynomial.chebyshev as C import time from scipy.interpolate import BarycentricInterpolator as bi from barycentric import Barycentric if __name__ == '__main__': ni = 500 ne = 20000 # Interpolation points xi = C.chebpts1(ni) # Evalutation points xe = np.linspac...
<gh_stars>10-100 import datetime import scipy as sp from pymote import * from pymote.conf import global_settings from pymote import propagation from toplogies import Topology from pymote.utils import plotter from pymote.utils.filing import get_path, date2str,\ DATA_DIR, TOPOLOGY_DIR, CHART_DIR, DATETIME_DIR imp...
<gh_stars>1-10 import pytest import itertools import numpy as np from scipy import sparse from sklearn.datasets import make_classification, make_regression from gsroptim.sgl_tools import generate_data from gsroptim.logreg import logreg_path from gsroptim.lasso import lasso_path from gsroptim.multi_task_lasso import m...
import numpy as np import scipy from tsa.science import numpy_ext as npx # def binned_timeseries_1d(times, values, time_units_per_bin=1, time_unit='D', statistic='mean'): # ''' # ''' # first, last = npx.bounds(times) # bins = npx.datespace(first, last, time_units_per_bin, time_unit).astype('datetime64...
#!/usr/bin/env python """ convolve.py -- Convolve sourceimage to a lower resolution image. Outputs the lower resolution image as a fits file. Usage: convolve [-h] [-v] [-o SAVELOC] [--overwrite] (pixel | arcsec) <fitsfile> <init_res> <final_rez> Arguments: fitsfile (string) Path to image to be convolved. ...
<reponame>ABaldrati/SupeRAuGAN import datetime import gc from argparse import ArgumentParser from math import log10 from pathlib import Path from statistics import mean import numpy as np import pytorch_ssim import torch import torchvision.utils as utils from lpips import lpips from torch import optim from torch.nn im...
<reponame>vb690/machine_learning_exercises<gh_stars>0 import os from tqdm import tqdm import numpy as np from scipy.interpolate import griddata from sklearn.preprocessing import KBinsDiscretizer import imageio from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt import matplotlib def save_3D_a...
<filename>velodyn/velocity_divergence.py<gh_stars>10-100 """Compute divergence maps from RNA velocity fields""" import numpy as np import anndata from sklearn.neighbors import NearestNeighbors from scipy.stats import norm as normal import matplotlib import matplotlib.pyplot as plt import seaborn as sns # modified f...
# coding: utf-8 # In[1]: #get_ipython().magic(u'matplotlib inline') # In[2]: import os import numpy as np np.set_printoptions(precision=3, linewidth=250) import scipy as sp from scipy import signal, io import pandas as pd import statsmodels.formula.api as smf import matplotlib.pyplot as plt import matplotlib....
<gh_stars>0 import numpy as np def sparse_diags(A): # x = dia_matrix(A) max_diag_size = A.diagonal(0).shape[0] d = [] data = [] for diag in range(-A.shape[0], A.shape[1]): diag_value = A.diagonal(diag) if np.any(diag_value): d.append(diag) if diag < 0: ...
# -*- coding: utf-8 -*- """ Created on Wed Jun 29 19:18:23 2016 @author: <NAME> """ # ============================================================================= # Standard Python modules # ============================================================================= import os, sys, time from scipy.optimize import ...
<filename>Tutorial-2.py<gh_stars>0 """For a given dataset: (1,1.2), (2,1.9), (3,3.2) Find the line which fits the data using maximum likelihood function. Plot the line with the given dataset and post it here in the Google class room. Also create your github account and post the link of the code along with the plot so t...
# %% [markdown] # This python script takes audio files from "filedata" from sonicboom, runs each audio file through # Fast Fourier Transform, plots the FFT image, splits the FFT'd images into train, test & validation # and paste them in their respective folders # Import Dependencies import numpy as np import pandas...
from __future__ import print_function, division from ctypes import POINTER, c_int64, c_float, c_char_p, create_string_buffer from pyscf.nao.m_libnao import libnao # interfacing with fortran subroutines libnao.siesta_hsx_size.argtypes = (c_char_p, POINTER(c_int64), POINTER(c_int64)) libnao.siesta_hsx_read.argtypes = (...
""" playing around with fbprophet """ import datetime as dt import matplotlib.pyplot as plt import numpy as np import pandas as pd from fbprophet import Prophet from scipy.stats import boxcox from scipy.special import inv_boxcox from rich import print columns = ["created_at", "id"] tic = dt.datetime.now() _df = pd.re...
<reponame>Anysomeday/SpecPatConv3D-Network<gh_stars>10-100 import numpy as np from random import shuffle import scipy.io as io import argparse from helper import * parser = argparse.ArgumentParser() parser.add_argument('--data', type=str, default='Indian_pines', help='default:Indian_pines, options: Salinas, KSC, Botsw...
# Copyright 2019 Xanadu Quantum Technologies 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 agre...
<reponame>syats/light_topic_transitions<gh_stars>0 """ Authors: <NAME> & <NAME> for Semantic Web Company Cite: <NAME>., <NAME>. "Evolution of Semantically Identified Topics" CEUR vol 1923 (2017) http://ceur-ws.org/Vol-1923/article-06.pdf """ import numpy as np import scipy from sci...
<filename>TB2J/spinham/qsolver.py #!/usr/bin/env python import math import numpy as np import scipy.linalg as linalg class QSolver(object): def __init__(self, hamiltonian): self.ham = hamiltonian self.nspin = self.ham.nspin M = linalg.norm(self.ham.spinat, axis=1) self.M_mat=np.kron...
<filename>207demography_2018/calc.py<gh_stars>0 #!/usr/bin/env python3 from math import * from statistics import * def sum_sq(data): res = 0 for i in data: res += i ** 2 return res def sum_mul(data, date): res = 0 i = 0 while i < len(data): res += data[i] * date[i] ...
<reponame>ctralie/DynamicsSynchronization """ Replicate the 1D time series reshuffling problem in the equal space paper """ import numpy as np import scipy.io as sio import scipy.linalg as slinalg import matplotlib.pyplot as plt from PDE2D import * from PatchDescriptors import * from DiffusionMaps import * class GLSim...
<filename>prof.py __all__ = ['prof4'] import pyfits as pf import numpy as np import matplotlib.pyplot as pl import sys import scipy.io class prof4(object): def __init__(self, fileIn): self.currentFile = fileIn self.readData() self.currentPos = [0,0] # Plot with integrated maps self.figFixedMaps = pl.figure...
<filename>src/models/network.py<gh_stars>0 import math import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.utils.weight_norm as wn from torch.nn.parameter import Parameter from torch import Tensor from src.models.utils import get_activation from typing import List, Tuple, Dict, Union fr...
<reponame>sglyon/quant-econ<filename>examples/optgrowth_v0.py<gh_stars>1-10 """ Filename: optgrowth_v0.py Authors: <NAME> and <NAME> A first pass at solving the optimal growth problem via value function iteration. A more general version is provided in optgrowth.py. """ from __future__ import division # Omit for Pyt...
<reponame>cgarcia-UCO/AgentSurvival ''' Esta clase tiene agentes (clase anterior) que se mueven en el laberinto. Los agentes tienen métodos para moverse hacia adelante y para girar a ambos lados. HECHO Cuando un agente hace una acción, el Laberinto debería comprobar si ha agotado el número de movimientos en su turno...
<reponame>imandrealombardo/FACT-AI<filename>Fairness_attack/run_gradient_em_attack.py<gh_stars>0 from __future__ import division from __future__ import print_function from __future__ import absolute_import from __future__ import unicode_literals import os import argparse import time import numpy as np import scipy.s...
#!/usr/bin/python3 from paho.mqtt import client as mqttclient from collections import OrderedDict from picamera import PiCamera, Color from telegram import Update, ChatAction from telegram.ext import Updater, CommandHandler, MessageHandler, Filters, CallbackContext import json import time import socket import threadi...