text
string
<gh_stars>0 """ ===================================== Linear Gaussian Models for Regression ===================================== In this example, we use a MVN to approximate a linear function and a mixture of MVNs to approximate a nonlinear function. We estimate p(x, y) first and then we compute the conditional distr...
<filename>wine-quality-prediction/code/regression_logistic.py import csv import numpy as np from scipy.optimize import fmin_bfgs import matplotlib.pyplot as plt import pandas as pd import pylab as pl """ Uses L2 Logistic Regression on the wine data. L2 Regression is used to help control overfitting. This is shown fo...
<filename>attitude/error/axes.py """ Functions for converting fit parameters into covariance and hyperbolic axes. These all operate in axis-aligned space---rotation into global coordinate systems should occur after these transformations are applied. """ from __future__ import division import numpy as N from scipy.stats...
import sys import time import numpy as np import multiprocessing from joblib import Parallel, delayed # metrics from scipy.spatial.distance import cdist from sklearn.metrics import average_precision_score def prec(actual, predicted, k): act_set = set(actual) if k is not None: pred_set = se...
<gh_stars>0 from typing import Iterable, Optional, List, Tuple import copy import numpy as np import json from scipy.linalg import expm def swap_forward(iterable_item: Iterable, starting_index: Optional[int] = 0): new_sequence = copy.deepcopy(iterable_item) for i in range(starting_index, len(i...
import os import numpy as np import scipy.io as sio from skimage import io, transform import skimage from src.faceutil import mesh import argparse import ast import copy import multiprocessing import math from config import * from src.dataset.uv_face import uv_coords from src.dataset.base_face import bfm, get_transfor...
<filename>SSVDpkg_663proj21/SSVDversion2.py ## This is the first-step optimization, based on SSVDversion1. ## Based on linear algebra, ## computation about about Y, Z, and the Kronecker product are replaced. import numpy as np import scipy.linalg as la def get_tilde(lam, tilde_hat, w): """Get the tilde vector g...
import numpy as np from py_wake.wind_turbines import OneTypeWindTurbines from scipy.special import gamma from scipy.interpolate import UnivariateSpline from py_wake.site._site import UniformSite power_curve = np.array([[2.99000000e+00, 0.00000000e+00], [3.00000000e+00, 3.99687614e+01], ...
import os import cv2 import sys import time # import ssim import imageio import tensorflow as tf import scipy.misc as sm import scipy.io as sio import numpy as np import skimage.measure as measure from mcnet import MCNET from utils import * from os import listdir, makedirs, system from os.path import exists from argp...
<gh_stars>0 import pandas as pd import numpy as np import bisect import os import multiprocessing as mp from tqdm import tqdm from itertools import chain from scipy import interpolate class FemtoMesh: def __init__(self, name): self.data_frame = None self.data_frame_name = name self.chun...
#!/usr/bin/env python3 # MIT License # # Copyright (c) 2020 UiL OTS labs # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to...
<gh_stars>1-10 import numpy as np from autograd.extend import VSpace import scipy class SparseArrayVSpace(VSpace): def __init__(self, value): self.t = type(value) self.value = self.t(value) self.shape = value.shape self.dtype = value.dtype @property def size(self): ...
import os import scipy import scipy.stats import numpy as np from collections import namedtuple from functools import partial from io import StringIO import fitz from lxml import etree BLOCK_IMAGE = 1 BLOCK_TEXT = 0 Block = namedtuple("Block", ['filename','tl','br','w','h','content', 'type', 'density']) SBlock = nam...
from scipy.special import expit from rbm import RBM from sampler import VanillaSampler, PartitionedSampler from trainer import VanillaTrainier import numpy as np import datasets, performance, plotter, mnist, pickle import argparse from warnings import warn warn("Currently will not work. Relies on older buggy implemen...
import sympy import tkinter x = sympy.Symbol('x') print(sympy.integrate(3/x**2,(x,1,'+oo'))) class Application(tkinter.Frame): def __init__(self, master=None): super().__init__(master) self.master = master self.pack() self.create_widgets() def create_widgets(self): ...
<reponame>bbrister/cudaImageWarp<gh_stars>10-100 """ Warp an image using scipy. This is a CPU-only implementation of cudaImageWarp.py. (c) <NAME> 2018-2021 """ import numpy as np import scipy.ndimage as nd import pyCudaImageWarp import concurrent.futures import os from .cudaImageWarp import __check_inputs # Place ...
""" Routines for the orthogonal rangefinder problem: Given an m-by-n input matrix A, find a matrix Q with k << min(m, n) orthogonal columns where the operator norm || A - Q Q' A ||_2 is small. This problem can be considered where k is given or when a tolerance "tol" is given and we require || A - Q Q'...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Aug 21 11:20:57 2020 @author: joel """ import numpy as np import scipy.stats as st import matplotlib.pyplot as plt # Histograms # RV lognormal N = 10**5 log_rv = np.random.lognormal(size=N) # RV normal with same SD norm_rv = np.random.normal(scale=l...
<reponame>SStroteich/stella-1<gh_stars>0 from scipy.io import netcdf import numpy as np import numpy.matlib tave = 900 basedir = '/marconi_work/FUA34_MULTEI/stonge0_FUA34/rad_test/2nd_deriv/T1/' basedir = '/marconi_work/FUA34_MULTEI/stonge0_FUA34/rad_test/2nd_deriv/rho_scan2/r0.001/' basedir = '/marconi_work/FUA34...
<reponame>brmprnk/lindel423<gh_stars>0 import numpy as np import scipy.sparse as sparse def gen_indel(sequence,cut_site): '''This is the function that used to generate all possible unique indels and list the redundant classes which will be combined after''' nt = ['A','T','C','G'] up = sequence[0:cut_si...
import numpy as np from scipy.spatial import Delaunay from sklearn.linear_model import LinearRegression from collections import defaultdict from math import inf def closest_points(point, points, k): K = [] for i in range(len(points)): point2 = [points[i][0][0], points[i][1][0]] # points[i][0] + point...
<gh_stars>1-10 from typing import Tuple, Optional, Union, Iterable, List from numpy import ndarray from pandas import DataFrame, Series from scipy.optimize import fmin from scipy.stats import rv_continuous, rv_discrete from scipy.stats._distn_infrastructure import rv_generic from probability.distributions.functions.c...
<gh_stars>1-10 import numpy as np from cv2 import cv2 from scipy import signal #defining a few filters vkernel = np.array([[-1, 0, 1], [-1, 0, 1], [-1, 0, 1]]) hkernel = np.array([[-1, -1, -1], [0, 0, 0], [1, 1, 1]]) testkernel = np.array([[-1, -1, -1], [-1, 8, -1], [-1, -1, -1]]) lpf = np.array([[1/9, 1/9, 1/9], [1/9...
import napari import time from napari._qt.qthreading import thread_worker from cv2.cv2 import VideoCapture from napari.layers import Points from skimage.color import rgb2gray import numpy as np from skimage import draw camera_index = 0 def acquire_image(camera : VideoCapture): """ Acquires an image from a gi...
<filename>pyavia/core/interpolate.py """ **pyavia.interpolate** provides functions for interpolation that are specific to engineering tasks, for convenience or not otherwise covered by NumPy. """ # Last updated: 20 January 2021 by <NAME> from __future__ import annotations from collections import Sequence from copy im...
import numpy as np import time import cv2 from scipy.signal import argrelextrema class Analyzer(): def __init__(self): self.avg_bpm = self.cnt = self.fps = self.bpm = self.breathes = 0 self.up = self.down = -1 self.index = 1 self.incoming_frame = self.outgoing_frame = np.zeros((10, 10)) self.face = False ...
<filename>jax/_src/third_party/scipy/linalg.py<gh_stars>1-10 import scipy.linalg from jax import jit, lax from jax._src.numpy import lax_numpy as jnp from jax._src.numpy.linalg import norm from jax._src.numpy.util import _wraps from jax._src.scipy.linalg import rsf2csf, schur @jit def _algorithm_11_1_1(F, T): # Alg...
#shape update shape import sys # set the input file path, you have to change this path mod_path = '/Users/Simo//Documents/energyanalytics/energyanalytics/disaggregation' if not (mod_path in sys.path): sys.path.insert(0, mod_path) mod_path = '/Users/Simo//Documents/energyanalytics/energyanalytics/disaggregation...
import os import numpy as np import bluefog.torch as bf import matplotlib.pyplot as plt import torch import scipy.io as sio # Generate different A and b through different seed. bf.init() torch.manual_seed(12345 * bf.rank()) def generate_data(m, d): A = torch.randn(m, d).to(torch.double) ns = 0.1 * torch.ran...
<gh_stars>1-10 import logging import numpy as np from scipy.fftpack import fft2, fftshift, ifftshift from pattern.utils import field2intensity __all__ = ["Field"] logger = logging.getLogger(__name__) class Field(object): """ Field describes how the final product is formed, including system s...
import numpy as np import matplotlib.pyplot as plt from scipy import integrate import numba from numba import jit u_inf = 1 # defines the cylinder R = 1.0 theta = np.linspace(0, 2 * np.pi, 100) # coordinates of the cylinder x_cylinder, y_cylinder = R * np.cos(theta), R * np.sin(theta) size = 4 plt.figure(figsize=...
import numpy as np import scipy import copy import scipy.sparse class LaplacianRigidEnergy: def __init__(self, mesh, vertices, cregu): self.cT = scipy.sparse.kron( mesh.adjacencies.Laplacian.T * mesh.adjacencies.Laplacian, scipy.sparse.eye(3), ).tocsr() self.Vref = ...
"""Definition of volume phase scattering functions""" import numpy as np import sympy as sp from functools import partial, update_wrapper from .scatter import Scatter from .rtplots import polarplot class Volume(Scatter): """basic volume class""" def __init__(self, **kwargs): self.omega = kwargs.pop(...
<filename>Investigation/condition_functions.py # -*- coding: utf-8 -*- """ Created on Fri Nov 15 07:11:05 2019 @author: thele """ import scipy.signal as signal import pickle import numpy as np from .scoring.Last_score import final_score_cls from skimage.feature import blob_log import time def mock_peak_check(anchor,...
import logging import os import sys from collections import Counter import SimpleITK as sitk import matplotlib.patches as mpatches import matplotlib.pyplot as plt import matplotlib.transforms as transforms import numpy as np from matplotlib.ticker import PercentFormatter from sklearn.metrics import confusion_matrix f...
from typing import Dict, Union from scipy.stats._distn_infrastructure import rv_frozen class Surveyor: """Represents an individual who will participate in the survey. Parameters ---------- name : str Unique name for the surveyor team_name : str Name of the parent team surveyo...
<gh_stars>1-10 from typing import Dict, Union, Iterable, Callable, Sequence, List import itertools import re import sympy as sp import pycparser.c_ast as c_ast import checkdp.transform.constants as constants from checkdp.transform.typesystem import TypeSystem from checkdp.transform.random_distance import AlignmentIndex...
<reponame>Guydada/MIND-Recommender-System-Ptoject-Pytorch-TF-IDF--Deep-Learning<filename>mind.py<gh_stars>1-10 import os import pickle from collections import OrderedDict from typing import Union import click_spinner import torch import typer import numpy as np from sklearn.feature_extraction.text import TfidfVectorize...
<gh_stars>0 """ *Audio Interval* A difference between two audio frequencies. """ from __future__ import annotations from dataclasses import dataclass from enum import Enum from fractions import Fraction from ._ratio import FrequencyRatio __all__ = ["Interval"] class AudioInterval: pass # class _Inte...
""" This file is part of Seten which is released under the MIT License (MIT). See file LICENSE or go to https://github.com/gungorbudak/seten-cli/blob/master/LICENSE for full license details. """ import random import numpy as np from scipy import stats from seten.multi_comp import fdr_correction from seten.multi_comp im...
<filename>src/optimize.py import numpy as np import scipy as sp from functools import partial from sklearn import metrics from collections import Counter class OptimizedRounder(object): def __init__(self): self.coef_ = 0 def _kappa_loss(self, coef, X, y): X_p = np.copy(X) for i, pred i...
<reponame>MatthewRalston/ecopy import numpy as np from pandas import DataFrame, Series import matplotlib.pyplot as plt import matplotlib.cm as cm from scipy.stats import pearsonr from ..regression import isotonic from ..ordination import pca, pcoa class MDS(object): ''' Docstring for function ecopy.pca ===...
<filename>libs/cvae.py ''' Copyright (c) 2020. IIP Lab, Wuhan University Author: <NAME> ''' import os import sys sys.path.append("libs") import numpy as np import scipy as sp import scipy.io as sio from tensorflow.keras import optimizers from layers import mse class CollaborativeVAE(): def __i...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ # CODE NAME HERE # CODE DESCRIPTION HERE Created on 2020-04-05 11:44:00 @author: cook """ import numpy as np import os from scipy.signal import medfilt,convolve2d from astropy.table import Table from astropy.io import fits import argparse from apero import core from...
""" This Module being called from .sh script for the problem 1 Runs the pre-trained GAN, DCGAN model and saves the generated 32 fake images """ # general import random import os import numpy as np # dl related import torch # custom modules import parser from generator import Generator #from discriminator import Dis...
''' Defines the UnitarySequenceEntry class. ''' import numpy as np import scipy.sparse from typing import List from .unitary import Unitary class UnitarySequenceEntry: ''' Represents an entry in a unitary sequence applied to a specific subset of qubits in a system. :param unitary: The unitary operat...
# coding: utf-8 # DO NOT EDIT # Autogenerated from the notebook glm_weights.ipynb. # Edit the notebook and then sync the output with this file. # # flake8: noqa # DO NOT EDIT # # 加权广义线性模型 import numpy as np import pandas as pd import statsmodels.formula.api as smf import statsmodels.api as sm # ## 加权GLM:泊松响应数据 # # ...
# Licensed under an MIT open source license - see LICENSE from __future__ import print_function, absolute_import, division import numpy as np from scipy.stats import binned_statistic import astropy.units as u from astropy.coordinates import Angle from scipy.stats import t as t_dist def pspec(psd2, nbins=None, return...
from tqdm import tqdm import sklearn from scipy.stats import binom_test import numpy as np import logging import cPickle as pickle import random import matplotlib.pyplot as plt import seaborn as sns sns.set_style("whitegrid") from argparse import ArgumentParser from path import Path from deepx.sequence import Characte...
# To Train and Test an AI using the German Traffic Sign Recognition "Benchmark"-Dataset # Requires the German Traffic Sign Recogintion Benchmark somewhere around you can point a path to # can be found under http://benchmark.ini.rub.de/?section=gtsdb&subsection=dataset # but is annoyingly strong wrapped. import matplo...
<reponame>jppaiement/fSEIR_simulator import networkx as nx import matplotlib.pyplot as plt import matplotlib import getopt import os import random import sys import time import cartopy.crs as ccrs import seaborn as sns import csv import numpy as np import pandas as pd from sklearn.metrics import r2_score from sklearn....
import numpy as np from skimage import transform, color, restoration, feature from sklearn.preprocessing import PolynomialFeatures from sklearn.linear_model import LinearRegression from scipy import optimize from scipy import stats import cv2 from matplotlib import pyplot as plt def float_to_uint8(frame): ''' ...
#!/usr/bin/env python import rospy from geometry_msgs.msg import PoseStamped from styx_msgs.msg import Lane, Waypoint from std_msgs.msg import Int32 from scipy.spatial import KDTree from sensor_msgs.msg import Image import cv2 import cv_bridge import numpy as np import time import math LOOP_HERTZ = 10 class Doernbac...
<gh_stars>10-100 #!/usr/bin/env python # -*- coding: utf-8 -*- """ SeedEditor for organ segmentation Example: $ seed_editor_qp.py -f head.mat """ # import unittest from optparse import OptionParser from PyQt5.QtWidgets import * from scipy.io import loadmat import numpy as np import sys from scipy.spatial import Dela...
def mix_norm_cdf(x,means,std,weights=-1) : # calculate cdf(x) of a mixture of normal distributions with # means: an array containing the mean of each distributions # std: an array len(means) containing the std deviation of each normal _or_ # a single value which is a common standard deviation for each nor...
import scipy.misc as misc import torch import copy import torchvision.models as models import numpy as np import torch.nn as nn import torch.nn.functional as F # FCN Net model class for semantic segmentation ##############################################This is a standart FCN with the lat layer split into prediction o...
<gh_stars>1-10 """Implements multinomial and mixed logit models.""" # pylint: disable=invalid-name import numpy as np from scipy.stats import t from time import time from abc import ABC import warnings """ Notations --------- N : Number of choice situations P : Number of observations per panel J : Number ...
from file_util import read_first_line_as_integers from functools import reduce import statistics def task1(crab_positions: list[int]) -> int: median = statistics.median(crab_positions) return int(sum(map(lambda x: abs(x - median), crab_positions))) def task2(crab_positions: list[int]) -> int: crab_posit...
<reponame>gregstarr/trough import xarray as xr import numpy as np from pathlib import Path from datetime import datetime, timedelta from apexpy import Apex from scipy.interpolate import interp1d import logging import warnings try: import h5py except ImportError as imp_err: warnings.warn(f"Packages required for...
# ====================================================================== # Copyright CERFACS (October 2018) # Contributor: <NAME> (<EMAIL>) # # This software is governed by the CeCILL-B license under French law and # abiding by the rules of distribution of free software. You can use, # modify and/or redistribute ...
<filename>fun stuff/chart data.py import math import statistics tbl1 = [[-0.01, 0.02, 0.04], [0.22, 0.22, 0.25], [1.06, 1.14, 1.00], [2.15, 1.94, 2.06], [6.96, 7.85, 7.93], [10.3, 10.3, 11.0], [16.8, 15.7, 18.6], [18.4, 18.3, 17.3], [19.9, 18.9, 19.5], [21.0, 21.6, 20.0]] means = [] sd = [] N = 4 for i in range(len...
""" Generate new images """ import os import numpy as np import torch import torchvision import argparse as ap from matplotlib import pyplot as plt import pickle as pkl import pandas as pd from scipy.misc import imsave def build_parser(): parser = ap.ArgumentParser() parser.add_argument('--model', '-m', help...
import tensorflow as tf tf.set_random_seed(42) import numpy as np from scipy import integrate import neural_networks import kovasznay_flow_problem import matplotlib.pyplot as plt import sys, getopt class sampling_from_dataset: def __init__(self, filepath, total_samples): self.filepath = filepath self.total_sam...
<reponame>sylvain2002/CBM101<gh_stars>0 # Importing the needed python packages import numpy as np import matplotlib.pyplot as plt from scipy.integrate import odeint import time import sys from pylab import * from matplotlib.patches import Rectangle # Defining the right hand side of the ODEs (rate of changes of predat...
<filename>grb/attack/speit.py import random import numpy as np import scipy.sparse as sp import torch import torch.nn.functional as F import grb.utils as utils from grb.attack.base import InjectionAttack from grb.evaluator import metric class SPEIT(InjectionAttack): def __init__(self, lr, ...
import numpy as np import pytest from numpy.testing import assert_allclose from ..linalg.cholesky import ChoInv, ChoInvPivot, cholesky_factor, fixed_cholesky from ..linalg.cholesky import jit_cholesky, _check_cholesky_inputs, pivot_cholesky, _pivot_transpose from ..linalg.linalg_utils import calc_Ainv, calc_A_deriv, ca...
#! /usr/bin/env python3 # Copyright 2021 OVHCloud # # 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 app...
from fractions import Fraction def sqrt2(it): dem = 2 for i in range(it): dem = 2 + Fraction(1, dem) return(str(1 + 1/dem).split('/')) cont = 0 for i in range(1, 1000+1): N = sqrt2(i) if len(N[0]) > len(N[1]): cont += 1 print(cont)
<filename>content/downloads/code/minesweeper.py """ Matplotlib Minesweeper ---------------------- A simple Minesweeper implementation in matplotlib. Author: <NAME> <<EMAIL>>, Dec. 2012 License: BSD """ import numpy as np from itertools import product from scipy.signal import convolve2d import matplotlib.pyplot as plt ...
<gh_stars>1-10 """Example 05 Section: Rectangular 230 x 500 Compression steel: 3 layer, Tension steel: 2 layers Output: xu and report of the section. """ from scipy.optimize import brentq from rcdesign.is456.stressblock import LSMStressBlock from rcdesign.is456.concrete import Concrete from rcdesign.is456.rebar impor...
<filename>gw_processing.py from typing import List import numpy as np from pycbc.types import TimeSeries from scipy.signal.windows import tukey from gw_data import SIGNAL_DELTA_T, N_SIGNALS def timeseries_from_signal(sig: np.ndarray) -> TimeSeries: return TimeSeries(sig, epoch=0, delta_t=SIGNAL_DELTA_T) def t...
<filename>RSpring/rtr_copilot/inverted_pendulum_rtr_ompl/inv_pen_sim.py<gh_stars>1-10 from numpy import sin, cos import numpy as np import matplotlib.pyplot as plt import scipy.integrate as integrate import matplotlib.animation as animation import math xaxis = 5 class DoublePendulum: """Double Pendulum Class ...
<filename>models/lrp_modules.py<gh_stars>1-10 """ This module implements PyTorch Modules that support LRP. This is done by re-implementing the forward pass in NumPy and then implementing a custom backward pass using LRP rules. """ from abc import ABC, abstractmethod from typing import Tuple import numpy as np from sci...
<reponame>sometimescasey/pca_animations ''' Question 1 Skeleton Code Here you should implement and evaluate the Conditional Gaussian classifier. <NAME> 998816973 ''' import data import numpy as np import matplotlib.pyplot as plt from scipy.misc import logsumexp from PIL import Image, ImageFilter def ...
import re import sys import numpy as np import scipy.sparse as sparse class ProgressBar(object): def __init__(self, N, length=40): # Protect against division by zero (N = 0 results in full bar being printed) self.N = max(1, N) self.nf = float(self.N) self.length = length ...
<filename>echem_testphoto.py import time, copy import os, os.path import sys import numpy from PyQt4.QtCore import * from PyQt4.QtGui import * from scipy import optimize from echem_plate_ui import * from echem_plate_math import * homepath='C:/Users/Gregoire/Documents/CaltechWork/echemdrop/20130301_CuZnSnFe_Plate3_365...
<gh_stars>0 import scipy.io from tkinter.filedialog import askopenfilename import time import numpy as np from copy import deepcopy #import h5py from functools import partial from numpy import array, ndarray class ModelicaDataItem(object): def __init__(self, name, data): self.name = name self.dat...
from pathlib import Path import torch from torch.utils.data import Dataset import os, sys from PIL import Image import datasets.transforms_w_depth as T from scipy import io import numpy as np #import matplotlib.pyplot as plt def box_cxcywh_to_xyxy(x): """Convert the coordinate format.""" # [x_center, y_center...
<gh_stars>0 import numpy as np from scipy.optimize import linprog c = np.array([2, -1, 1, 0, 0, 0]) * -1 A_eq = [ [2, 1, -2, 1, 0, 0], [4, -1, 2, 0, -1, 0], [2, 3, -1, 0, 0, -1] ] b_eq = [8, 2, 4] def callback(xk, **kwargs): np.set_printoptions(precision=3) np.set_printoptions(suppress=True) ...
<reponame>UASLab/OpenFlightAnalysis """ University of Minnesota Aerospace Engineering and Mechanics - UAV Lab Copyright 2019 Regents of the University of Minnesota See: LICENSE.md for complete license details Author: <NAME> """ import numpy as np import AirData # Constants #%% # Define the Cost Function for the Op...
import os, sys from statistics import stdev solvers = ['cvc4', 'z3'] # TODO If adding a new solver, add it here theories = ['qf_slia'] # TODO If adding a new theory, add it here # The buckets for the features to be created # For example, if buckets = [9, 10, 100], # four features will be returned: # -- Number o...
from train_helper import run_multi_bleu, Meteor from collections import Counter from tqdm import tqdm import statistics import rouge import argparse parser = argparse.ArgumentParser() parser.add_argument('--references', type=str, default=None) parser.add_argument('--generations', type=str, default=None) args = pars...
<filename>embedd.py<gh_stars>1-10 import argparse import numpy as np import glob import torch import torch.nn.functional as F import os import sys import pathlib from kaldi_io import read_mat_scp, open_or_fd, write_vec_flt import model as model_ import scipy.io as sio from utils.utils import * from librosa.feature impo...
<reponame>kechunl/histoapp_tools #!/usr/bin/env python3 # Copyright (c) <NAME> 2011, Germany. All rights reserved. # Transforms points based on the transformation in a sqreg file. import os import sqlite3 import numpy as np import scipy.interpolate def deformation_from_file_no_interp(filepath: str): if not os...
import json from train_mountaincar import fqi, warm_start, transfer_learning import configargparse import torch import torch.optim as optim import scipy import sys sys.path.append('../') from environments import MountainCarEnv, Continuous_MountainCarEnv from models.agents import NFQAgent from models.networks import NF...
<reponame>stefanches7/gin-train<filename>gin_train/metrics.py import sklearn.metrics as skm import pandas as pd import numpy as np from collections import OrderedDict import gin # -------------------------------------------- # Combined metrics @gin.configurable class BootstrapMetric: def __init__(self, metric, n...
<gh_stars>1-10 #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed May 29 16:40:20 2019 @author: gparkes """ import numpy as np from scipy import integrate, ndimage import matplotlib.pyplot as plt def task_1(): x = 10. / 100. # x is a constant because we are dealing with a cubical container. a =...
<gh_stars>1-10 import os import numpy as np from scipy import signal, misc import functions basePath = './' print(os.listdir(basePath)) print('Loading train_data') ST = np.load(basePath+"/train_data/ST_full.npy") print(ST.shape) STU = np.unique(ST,axis=0) del ST print(STU.shape) STS = np.split(STU,2,axis=1) del STU...
import time import copy import pathlib import pickle import hjson import gym import numpy as np from mujoco_py import load_model_from_path, MjSim, MjViewer from motor_skills.envs.mj_jaco import MjJacoEnv from mujoco_py import cymj from scipy.spatial.transform import Rotation as R from motor_skills.cip.ImpedanceCIP im...
<reponame>ddland/TIS-TN-python #!/usr/bin/env python import logging try: from sympy import pi, cos, sin, sqrt, arg, exp, Abs, S from sympy import integrate, Rational, nfloat, conjugate, Symbol from sympy.functions.special.delta_functions import Piecewise except ImportError as e: print("sympy kon niet ...
<gh_stars>10-100 import numpy as np from scipy import ndimage def get_morphological_patch(dimension, shape): """ :param dimension: dimension of the image (NOT the shape). :param shape: circle or square. :return: morphological patch as ndimage """ if shape == 'circle': morpho_patch = nd...
'''Plotting library for CluStR ''' import os import clustr import corner import PyPDF2 import numpy as np import matplotlib import matplotlib.pyplot as plt import scipy.stats as stats from matplotlib.ticker import LogFormatter, ScalarFormatter, FormatStrFormatter #import seaborn as ssb #plt.style.use('seaborn') #matpl...
#!/usr/bin/env python """ Calculate the distances between fixed-dimensional vectors and write to file. Author: <NAME> Contact: <EMAIL> Date: 2014-2015 """ from scipy.spatial.distance import pdist import argparse import datetime import sys import scipy.linalg import numpy as np blas_norm, = scipy.linalg.get_blas_fun...
#TODO: change counterID to triple (gene,mut,mutval) ID from neuron import h import matplotlib matplotlib.use('Agg') import numpy from pylab import * import mytools import pickle import time import sys import scipy.io morphology_file = "morphologies/cell1.asc" biophys_file = "models/L5PCbiophys3.hoc" template_file = "...
import numpy as np import pandas as pd from scipy.spatial.distance import cdist import matplotlib as mpl import matplotlib.pyplot as plt import seaborn as sns from plotutils import set_style, savefig def poisson_disc_sample(array_radius, fixation_radius, radius, candidates): """Find positions using poisson-disc ...
import numpy as np import scipy.optimize import pandas as pd import scipy.io import scipy import scipy.sparse import time import cvxopt # import time #Helper functions def prox(eta_0, y, B): """Prox_{-eta_0 f}(y) = argmin_x {-f(x) + \frac{1}{2\eta_0}\|x-y\|^2} where f = x^T B x, B = block_diag(N_m diag(\b...
''' Simple script that reads .wav-files from the UrbanSound8K_modified_v2 dataset into a python array using scipy's wavfile library and stores them in three labeled python arrays for TRAINING, VALIDATION, and TESTING. Then it exports these using pickle. @date 2017-07-01 ''' import sys import pickle from scipy.io impo...
#!/usr/bin/env python # -*- coding: utf-8 -*- import geocoder import numpy as np import scipy.ndimage as ndimage import scipy.ndimage.filters as filters import matplotlib.pyplot as plt from utils import create_divisions """ Copyright 2019 <NAME> Licensed under the Apache License, Version 2.0 (the "L...
<reponame>tanxicccc/rsopt import numpy as np from scipy.constants import c as clight def dummy(H): return 0 def calculate_emittance(bunch): x = bunch.x xp = bunch.ux y = bunch.y yp = bunch.uy enx = np.sqrt(np.average(x**2) * np.average(xp**2) - np.average(x * xp)**2) eny = np.sqrt(n...
#%% from pikapi.orientation_estimator import RotationEstimator rotation_estimator = RotationEstimator(0.70, True) import numpy as np rotation_estimator.process_gyro(np.array([-0.00346511, -0.00172339, -0.00172537]), 0.1) rotation_estimator.process_accel(np.array([0.00913589, -0.02, -9.00])) rotation_estimator.get_t...