text
string
<reponame>bigfooted/sympy from sympy.core.numbers import Rational from sympy.ntheory.egyptian_fraction import egyptian_fraction from sympy.core.add import Add from sympy.testing.pytest import raises from sympy.testing.randtest import random_complex_number def test_egyptian_fraction(): def test_equality(r, alg="Gr...
<filename>report/code/sympy.py from sympy import lambdify, diff, hessian, jacobi, cos, sin, pprint from sympy.matrices import Matrix from sympy.abc import x,y,w,z from Error import * from Log import *
from __future__ import print_function, division from sympy.core import Mul, sympify, Pow from sympy.strategies import unpack, flatten, condition, exhaust, do_one from sympy.matrices.expressions.matexpr import MatrixExpr, ShapeError def hadamard_product(*matrices): """ Return the elementwise (aka Hadamard) pr...
<filename>src/tests/unit/test_fraction_sum.py import unittest from models import sum from fractions import Fraction """ (base) ➜ src git:(master) ✗ python -m unittest discover -s tests/unit/ -v test_bad_type (test_sum.TestSum) ... ok test_list_fraction (test_sum.TestSum) ... ok test_list_int (test_sum.TestSum) ... o...
#!/usr/bin/python3 # final_project.py import logging import os import sys from itertools import product from functools import reduce from imutils.video import VideoStream from imutils.video import FPS import imutils import colorlog from PIL import Image import numpy as np from scipy import signal import cv2 as cv l...
import numpy as np import statsmodels.api as sm import matplotlib.pyplot as plt from scipy.fftpack import rfft from scipy.fftpack import fftshift data_loader = sm.datasets.sunspots.load_pandas() sunspots = data_loader.data["SUNACTIVITY"].values t = np.linspace(-2 * np.pi, 2 * np.pi, len(sunspots)) mid = np.ptp(sunspo...
<filename>gpt/element.py import numpy as np import os import math, cmath from matplotlib import pyplot as plt from numpy.linalg import norm import copy #from gpt.maps import Map1D_E, Map1D_B, Map1D_TM, Map2D_E, Map2D_B, Map25D_TM from gpt.tools import rotation_matrix from gpt.tools import cvector from gpt.tools impo...
<reponame>cwardell97/learn-hippo-1 import os import numpy as np from utils.constants import TZ_COND_DICT from analysis import compute_stats, remove_none from scipy.stats import pearsonr, sem, ttest_ind from collections import defaultdict import matplotlib.pyplot as plt import seaborn as sns sns.set(style='white', palet...
''' Utility module with functions that perform operations on (one or multiple) onset functions.''' import numpy as np from scipy.interpolate import interp1d def select_top_k(arr, k): idx = np.argpartition(arr, -k)[-k:] idx = idx[np.argsort(arr[idx])][::-1] return arr[idx], idx def hwr(x, N=16): de...
""" Image Data Analysis Using Numpy & OpenCV author: <NAME> email: <EMAIL> website: https://iphton.github.io/iphton.github.io/ Please feel free to use and modify this, but keep the above information. Thanks! """ # importing necessary packages from skimage import color from skimage import exposure impor...
<filename>pyDHM/utilities.py # -*- coding: utf-8 -*- """ Title--> Utility script Author--> <NAME>, <NAME>, <NAME>, Date--> 03/03/2019 Last modified--> 16/04/2022 University of Memphis Optical Imaging Research lab (OIRL) EAFI...
<gh_stars>1-10 ## label propagation routines ## label propagation algorithms: import networkx as nx import pandas as pd from sklearn.model_selection import ShuffleSplit from ..general.benchmark_classification import * import numpy as np import scipy.sparse as sp import time import multiprocessing as mp ## initialize t...
#!/usr/bin/env python from scipy.ndimage import imread import pickle import numpy import glob import os from joblib import Parallel, delayed import sys from datasets.DAVIS.DAVIS_iterative import get_bounding_box imgs_path = "/work/mahadevan/data/DAVIS/JPEGImages/480p/" annots_path = "/work/mahadevan/data/DAVIS/Annot...
#!/usr/bin/env python # Copyright 2014-2020 The PySCF Developers. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
#!/usr/bin/env python import matplotlib matplotlib.use('pdf') import scrublet as scr import scipy.io import numpy import numpy.ma from PIL import Image, ImageDraw, ImageFont import os import argparse if __name__ == '__main__': parser = argparse.ArgumentParser('Check sample sheet') parser.add_argument('--key',...
### # pySuStaIn: a Python implementation of the Subtype and Stage Inference (SuStaIn) algorithm # # If you use pySuStaIn, please cite the following core papers: # 1. The original SuStaIn paper: https://doi.org/10.1038/s41467-018-05892-0 # 2. The pySuStaIn software paper: https://doi.org/10.1016/j.softx.2021.100811 ...
<reponame>neurodata/j1c-experiments # Copyright 2020 NeuroData (http://neurodata.io) # # 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 # # Unl...
""" functions that convert predicted labels to file types used by different programs, e.g., evsonganaly (GUI for labeling song), Sound Analysis Pro, etc. """ import os import numpy as np import scipy.io def to_notmat(songfile_name, pred_labels, clf_file, samp_freq, segment_params, onsets_s, offsets_s, ...
# coding: utf-8 # # Hierarchical Clustering # **Hierarchical clustering** refers to a class of clustering methods that seek to build a **hierarchy** of clusters, in which some clusters contain others. In this assignment, we will explore a top-down approach, recursively bipartitioning the data using k-means. # **Not...
import numpy as np import matplotlib.pyplot as plt from scipy.integrate import odeint from scipy.optimize import minimize from scipy.interpolate import interp1d import warnings # Import data file # Column 1 = time (t) # Column 2 = input (u) # Column 3 = output (yp) data = np.loadtxt('data_step_test.csv',del...
import numpy as np import matplotlib.pyplot as plt from matplotlib.widgets import Slider import matplotlib from scipy.sparse import csr_matrix, identity, kron from scipy.sparse.linalg import eigs, eigsh import itertools from scipy.linalg import block_diag, eig, expm, eigh import yaml import copy from scipy.special impo...
<gh_stars>1-10 # -*- coding: utf-8 -*- """Written by <NAME> Email: danaukes<at>gmail.com Please see LICENSE for full license.""" #class FrameVector(object): # def __init__(self,frame,coords): # self.frame = frame # self.coords = sympy.Matrix(coords) # def __str__(self): # return str(self.f...
<reponame>dfki-asr/morphablegraphs<filename>morphablegraphs/construction/dtw.py #!/usr/bin/env python # # Copyright 2019 DFKI GmbH. # # 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 r...
from fractions import Fraction from unittest import TestCase from musurgia.fractaltree.fractalmusic import FractalMusic def get_infos(fm): return [fm.tempo, fm.quarter_duration, fm.duration] def print_infos(fm): print('tempo={}; quarter_duration={}; duration={};'.format( *get_infos(fm))) class Te...
# -------------- # Importing header files import numpy as np import pandas as pd from scipy.stats import mode import warnings warnings.filterwarnings('ignore') #Reading file bank_data = pd.read_csv(path) #Code starts here categorical_var=bank_data.select_dtypes(include='object') print(categorical_var) ...
<filename>inversion.py import argparse import h5sparse as h5py from h5py import SoftLink import os import numpy as np import blockmodel from math import sqrt from read_matrix import body_matrix, surface_matrix, revert_h_weighting, revert_c_weighting from scipy.sparse import csr_matrix, diags, vstack from scipy.sparse.l...
"""Copyright (c) 2021 <NAME> 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 use, copy, modify, merge, publish, distribute, sublicen...
<gh_stars>1-10 """ Simulate geomorphic scenarios along with CN production. """ from __future__ import division, print_function, unicode_literals import numpy as np import scipy.integrate from cosmogenic import production def nexpose(n, z, ti, tf=0, p=None, tol=1e-4, thickness=None): """ Calculate concentrat...
import ast import itertools import os import numpy as np from scipy.stats import gamma import mapel.elections.models.mallows as mallows from mapel.elections._glossary import * from mapel.elections.models.group_separable import get_gs_caterpillar_vectors from mapel.elections.models.mallows import get_mallows_vectors f...
#!/usr/bin/python import numpy as np from scipy.integrate import ode from scipy.stats import norm from hybmc.models.StochasticProcess import StochasticProcess # We implement three different approaches to evolve a sqrt-process. # Details follow Andersen/Piterbarg 2010, sec. 9.5 # Andersen/Piterbarg 2010, Corollary ...
<reponame>simo955/RecSys_2018<filename>Utils/data/IncrementalSparseMatrix.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on 09/09/2018 """ import scipy.sparse as sps class IncrementalSparseMatrix(object): def __init__(self, auto_create_col_mapper = False, auto_create_row_mapper = False, n_rows ...
# -*-coding:Utf-8 -* # Copyright (c) 2013 <NAME> # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this # list of cond...
import logging import argparse import ast from collections import OrderedDict import torch import os import scipy from datetime import datetime import time import math import random import numpy as np import sys import cv2 irange = range def mylogger(logpath='./param.log'): logger = logging.getLogger('mylogger') ...
<filename>mining/try_scipy.py ''' Created on 2018/04/08 @author: syuu ''' import numpy as np from scipy.cluster.hierarchy import linkage, dendrogram from matplotlib import pyplot x=np.array([[1,2],[2,1],[3,4],[4,3]]) z=linkage(x,'ward') dendrogram(z) pyplot.show()
<reponame>paulhtremblay/big-data from bokeh.plotting import figure, show from bokeh.models import Legend import numpy as np from scipy.signal import savgol_filter def line_historgram(): #positive skew percent_skew = 50 size = 1000 amount_skew = 4 start = size - int(round(size * percent_skew/100))...
<gh_stars>10-100 # (c) Copyright IBM Corporation 2020. # LICENSE: Apache License 2.0 (Apache-2.0) # http://www.apache.org/licenses/LICENSE-2.0 from statistics import mean from sklearn.neighbors import NearestNeighbors from lrtc_lib.active_learning.batch_measure_api import BatchScorerApi class DiversityCalculator(B...
# -*- coding: utf-8 -*- def main(): from math import pi from cmath import rect import sys input = sys.stdin.readline n = int(input()) x0, y0 = map(int, input().split()) xn2, yn2 = map(int, input().split()) p0 = complex(x0, y0) pn2 = complex(xn2, yn2) o = (p0 + pn2) / 2 r...
from scipy.optimize import fmin_bfgs from sklearn.base import BaseEstimator, ClassifierMixin, TransformerMixin from svm_kernels import linear_kernel, polynomial_kernel, rbf_kernel, gaussian_kernel import numpy as np import cvxpy as cp class PlattScaler(TransformerMixin): ''' Perform Platt Scaling. Based o...
<filename>testmanagementserver/lib/dwt_parse.py #! /usr/bin/env python3 """ Copyright (c) 2020, ETH Zurich, Computer Engineering Group All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions ...
""" Detects Cars in an image using KittiSeg. Input: Image Output: Image (with Cars plotted in Green) Utilizes: Trained KittiSeg weights. If no logdir is given, pretrained weights will be downloaded and used. Usage: python demo.py --input_image data/demo.png [--output_image output_image] [--logdir /pa...
# -*- coding: utf-8 -*- """ Created on Thu Apr 16 20:52:06 2020 @author: Nicolai """ from ITestbenchBase import ITestbenchBase import numpy as np import scipy.integrate as integrate import time import psutil import gc class CiPdeBase(ITestbenchBase): """ Abstract class that implements the ITestbenchBase inte...
<reponame>tychon/physics # This module gives easy access to fitting functions and supports # the quantities module. import inspect import numpy as np import numpy.random as random import quantities as pq import scipy.optimize as opt import scipy.odr as odr import scipy.stats as stats from physics.fmt import fmtquan...
<reponame>nameforjoy/Synchronisation """ NetworkClasses @author: JoyClimaco """ import numpy as np from scipy.integrate import odeint from odeintw import odeintw class StuartLandau(object): """ Class defining a Stuart-Landau network object. Holds the most important network properties of a network fo...
# Computation of normalized anomalies using JRA-55 # <NAME>, <NAME> # Klimamodelle SS19 # version: 2019-07-23 # # data: # /home/srvx11/lehre/users/a1127897/JRA-55/mslp_daily rh_daily spfh_daily # # execute: # python3 01-NormalizedAnomalies.py # python3 01-NormalizedAnomalies.py --ifile1 "mslp_daily/anl_surf125.002...
import matplotlib.pyplot as plt import matplotlib as mpl import numpy as np import h5py import os from glob import glob import argparse from scipy import ndimage plt.close('all') mpl.rcParams['pdf.fonttype'] = 42 mpl.rcParams['font.size'] = 12 mpl.rcParams['axes.linewidth'] = 2 mpl.rcParams['xtick.major.width'] = 2 mp...
<reponame>mwhchen/quantecon<gh_stars>10-100 # -*- coding: utf-8 -*- """ Created on Sun Feb 22 10:47:42 2015 @author: dgevans """ import numpy as np from scipy.interpolate import UnivariateSpline class interpolate_wrapper(object): ''' Wrapper to interpolate vector function ''' def __init__(self,F): ...
<reponame>bhaney/graph_embeddings<filename>gembed/embedding_models/rgcn_node_classification.py # Based primarily on https://github.com/tkipf/relational-gcn/blob/master/rgcn/train.py # From <NAME>'s relational-gcn repo from __future__ import print_function import pickle, os, random import numpy as np import scipy as sp...
from copy import copy import numpy as np import matplotlib import matplotlib.pyplot as plt from scipy import linalg as LA from scipy.sparse import linalg as las from scipy.signal import lti from scipy.signal import lsim from opentorsion.disk_element import Disk from opentorsion.shaft_element import Shaft from opentors...
<reponame>mad-lab-fau/SMARTurinalysis<filename>color_analysis.py<gh_stars>0 import math import os import cv2 import numpy as np import scipy.signal from matplotlib import cm from matplotlib import pyplot as plt from mpl_toolkits.mplot3d import Axes3D from numpyencoder import NumpyEncoder from helper import color_calc...
<reponame>aerial-defence/pytak<gh_stars>0 #!/usr/bin/env python # -*- coding: utf-8 -*- """Python Team Awareness Kit (PyTAK) Module Tests.""" import asyncio from cmath import isnan import enum import inspect import urllib from unittest import mock import pytest import pytak __author__ = '<NAME> W2GMD <<EMAIL>>'...
<reponame>EliotDucky/AC2XFLR<filename>AC2XFLR.py from scipy.integrate import quad import xml.etree.ElementTree as el from matplotlib import pyplot as plt import numpy as np import os.path as os_p from os import makedirs import math def createSimpleKVP(key, txt, parent): elem = el.Element(key) elem.text = txt parent...
<filename>Scripts/best_March2012six.py """ *Script Reads and Plots Leaf,Bloom,Freeze Data from 1880-2013* """ from netCDF4 import Dataset import numpy as np from scipy.stats import nanmean import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap import matplotlib.colors as c plt.rc('text',usetex=True) ...
""" Authors: <NAME>, <NAME> These are the functions for creation of encodings for TADs and chromosomes """ #Dependencies import itertools import numpy as np from scipy.spatial.distance import pdist def flatten(list_): ### flattens one layer of a list. For example, [[0,1],[2,3],[4,[5,6]]] will become [0,1,2,3,4,[5...
<filename>bmm/src/inference/parameters.py ######################################################################################################################## # Module: inference/parameters.py # Description: Expectation maximisation to infer maximum likelihood hyperparameters. # # Web: https://github.com/SamDuffiel...
<reponame>lixiaoyu0575/physionet_challenge2020_pytorch import sys import pandas as pd import numpy as np import scipy.io as scio import os import wfdb from scipy import signal import csv import pywt def WTfilt_1d(sig): coeffs = pywt.wavedec(data=sig, wavelet='db5', level=9) cA9, cD9, cD8, cD7, cD6, cD5, cD4, cD...
<filename>Without_DL_framework/opti_adam.py import numpy as np import matplotlib.pyplot as plt import h5py import scipy.io import math import sklearn import sklearn.datasets def init_adam(parameters) : L = len(parameters) // 2 # number of layers v = {} # the exponentially weighted average of the gradient ...
<filename>exps/thermo_final_exp.py<gh_stars>0 import sys sys.path.append("..") import json import numpy as np import math from typing import Dict, List, Tuple import copy from itertools import combinations from collections import Counter from statistics import median import logging from datetime import timedelta fro...
import os import numpy as np import sklearn.metrics as METRICS ; from collections import OrderedDict try: import cPickle as pickle except: import pickle import TEESDocumentHelper; import ProjectRunner; import FeatureGeneration as FeGen import GeneralFunctions as GF import SharedFunctions as SF class TS...
import pandas as pd import matplotlib.pyplot as plt import scipy.stats def draw_plot(): # Read data from file # df=pd.read_csv("epa-sea-level.csv") currDir = "" for aa in __file__.split("/")[:-1]: currDir = currDir + aa + "/" try: print("Reading file ", currDir + "epa-sea-level.csv")...
""" Core S4 convolution kernel implementing the 'normal plus low-rank' algorithm. The main module is SSKernelNPLR, which stores parameters A, B, C, dt, and calling it creates the SSM convolution kernel bar{K}. A much simpler version SSKernelSlow is included for illustration purposes: it has the same output, but uses ...
import os, re import basic_file_ops #from numpy import array, zeros, ones class txt_file(object): def readfile(self, pathin, strip=False, rstrip=True): return basic_file_ops.readfile(pathin, strip=strip, rstrip=rstrip) def writefile(self, pathin, listin=None, append=False): if listin is None...
<gh_stars>1-10 """Some basic routines for working with the force sensors.""" import numpy as np import matplotlib.pyplot as plt from scipy.stats import linregress from scipy.interpolate import CubicSpline import sys from calibrations import force_sensors as FORCE_SENSORS def plot_force_sensor(sensor_id): """Gene...
<gh_stars>10-100 import math import logging from random import random, randint, choices, seed import itertools import numpy as np from scipy.spatial import cKDTree from skimage.transform import integral_image, integrate from gunpowder.batch_request import BatchRequest from gunpowder.coordinate import Coordinate from g...
<filename>Chapter04/EMOTION_CNN/Python 2.7/EmotionDetectorUtils.py import pandas as pd import numpy as np import os, sys, inspect from six.moves import cPickle as pickle import scipy.misc as misc IMAGE_SIZE = 48 NUM_LABELS = 7 VALIDATION_PERCENT = 0.1 # use 10 percent of training images for validation IMAGE_LOCATION...
#!/usr/bin/env python # # (c) 2015-2018, ETH Zurich, Institut fuer Theoretische Physik # Author: <NAME> <<EMAIL>> """ Helper module wrapping scipy.sparse matrix types to make them convertible directly to numpy arrays by implementing the __array__ method. """ import scipy.sparse as sp class ArrayConvertible: """ ...
import argparse import glob import itertools import os import random import numpy as np import pandas as pd from scipy.stats import ttest_ind, kendalltau def parse_argument() -> argparse.Namespace: """ Parse input arguments. """ parser = argparse.ArgumentParser() parser.add_argument( '--...
<filename>magpylib/_src/obj_classes/class_BaseTransform.py """BaseTransform class code DOCSTRING v4 READY """ # pylint: disable=protected-access import numbers import numpy as np from scipy.spatial.transform import Rotation as R from magpylib._src.input_checks import check_degree_type from magpylib._src.input_checks ...
<gh_stars>1-10 import unittest from typing import Callable, Optional, Tuple import numpy as np import tensorflow as tf from scipy.stats import random_correlation, multivariate_normal from pilco.controllers import squash_sin, squash_cum_normal class TestSquash(unittest.TestCase): def test_sin_squash(self): ...
import regex as re import operator import numpy as np from scipy import sparse from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.base import BaseEstimator, ClassifierMixin from sklearn.utils.validation import check_X_y, check_is_fitted from sklearn.linear_model import LogisticRegression from skle...
import numbers from collections import Iterable import warnings from .lti import LinearTimeInvariant, _pickup_dt from .exception import * import numpy as np import sympy as sym # TODO: trans function of MIMO __all__ = ["TransferFunction", "tf", "zpk"] class TransferFunction(LinearTimeInvariant): """ a clas...
<reponame>SimonCqk/mars # Copyright 1999-2020 Alibaba Group Holding Ltd. # # 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 require...
<filename>src/data_visualization/visualize_price_distribution_of_airbnb_rentals_kdeplot.py # -*- coding: utf-8 -*- """ ------ What is this file? ------ This script targets one file: - istanbul_airbnb_processed.csv The script produces histograms for the distribution of Airbnb prices in the city of Istanbul. ...
# -*- coding: utf-8 -*- import pandas as pd import numpy as np from scipy.integrate import simps def transfer_fuction(xplane2dec,control_DATA,flight_data_for_integrate): Phi_sp = control_DATA[1]*180 Theta_sp = control_DATA[0]*180 Psi_sp = control_DATA[2]*180 h_sp = 300 sp_array = np.asarray([Phi_s...
from Statistics.Mean import mean from Calculator.Subtraction import subtraction import scipy.stats as st import numpy as np def ConfidenceInterval(Data, ConfidenceLevel): # Uses T distribution for under 30 if len(Data) < 30: DegreesOfFreedom = subtraction(len(Data), 1) DataMean = mean(Data) ...
<gh_stars>0 #!/usr/bin/python ''' mjtsai1974@20180606, v1.0, MLE for https://mjtsai1974.github.io/DevBlog/2018/06/06/bayesian-ml-beyes-to-practice/ http://www.astroml.org/book_figures/chapter3/fig_gaussian_distribution.html dist = scipy.stats.norm(...) Where ... should be filled in with the desired distribution par...
#!/usr/bin/env python3 # Author: <NAME> from __future__ import division from __future__ import absolute_import import numpy as np import matplotlib.pyplot as plt from scipy.optimize import fsolve, brentq # dummies function for testing def function_f(x, *args): return np.sin(x + 1.) def function_g(x): re...
<reponame>tp5uiuc/kinematic_snake import numpy as np from numpy.testing import assert_allclose from scipy.integrate import trapz import pytest from kinematic_snake.kinematic_snake import zero_mean_integral, project, KinematicSnake class TestZeroMeanIntegral: @pytest.fixture(scope="class", params=[101, np.random....
# This file is part of libigl, a simple c++ geometry processing library. # # Copyright (C) 2017 <NAME> <<EMAIL>> and <NAME> <<EMAIL>> # # This Source Code Form is subject to the terms of the Mozilla Public License # v. 2.0. If a copy of the MPL was not distributed with this file, You can # obtain one at http://mozilla....
<reponame>cleverhans-lab/capc-iclr from __future__ import absolute_import from __future__ import division from __future__ import print_function import getpass import argparse import numpy as np import os import pickle import random import scipy.stats import sys import torch import torch.nn as nn import torch.nn.funct...
<reponame>tskisner/redmonster # Use chi2 surfaces from zfinder.py to choose and classify objects on each fiber. Each zfind # argument is the ENTIRE object created by ZFinder for a single template, and each zfit argument # is the ENTIRE object created by ZFitter for a single template. Zfiti must correspond with # zfind...
<filename>tests/test_buildings.py from unittest.case import expectedFailure import numpy as np import sys from fractions import Fraction sys.path.append("..") from SimFactoryPy.simulation.Logistics import ConveyorBelt from SimFactoryPy.simulation.Buildings import Miner, Constructor from SimFactoryPy.simulation.entities...
<reponame>paulmorio/adventofcode """ Solution for Day 6 Part 1 """ from collections import defaultdict from scipy.spatial.distance import cityblock import numpy as np data_fp = "data.txt" coordinates = [] max_x = 500 max_y = 500 with open(data_fp, "r") as df: lines = df.readlines() for line in lines: x, y = line....
<gh_stars>0 from sympy import * from prettytable import PrettyTable, ALL circle = PrettyTable(["Degree", "Radian", "sin()", "cos()"]) circle.hrules = ALL for deg in [0,30,45,60,90,120,135,150,180,210,225,240,300,315,330]: rad = Rational(deg, 180) * pi circle.add_row([deg, pretty(rad), pretty(sin(rad)), pretty...
import os import itertools import numpy as np from PIL import Image import torch from torch.utils.data import Dataset from glob import glob import random import scipy.misc class ref_dataset(Dataset): def __init__(self, root, transform=None, target_transform=None,...
""" ******************************************************************************** Attitude Estimation with an IMU - Example ******************************************************************************** Goal of this script: - applying the UKF for estimating 3D attitude from an IMU. *We assume the reader is alrea...
""" Module: LMR_psms.py Purpose: Module containing methods for various Proxy System Models (PSMs) Adapted from LMR_proxy and LMR_calibrate using OOP by <NAME> Originator: <NAME>, U. of Washington Revisions: - Use of new more efficient "get_distance" function to calculate the distance ...
<gh_stars>10-100 # -*- coding: utf-8 -*- # Copyright 2019 <NAME> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
#!/usr/bin/env python """ author: <NAME> revised by: <NAME> (<EMAIL>) """ import sys import matplotlib.pyplot as plt import matplotlib.image as mpimg import cv2 import numpy as np from keras import backend as K from scipy.stats import truncnorm, norm from basics import * from FeatureExtraction import * import colle...
#!/usr/bin/env python3 # awkwardly need to use python3 for this single file because of the package statsmodels! import numpy as np import matplotlib.pyplot as plt import pandas as pd import os import sys import warnings import scipy import statsmodels.api as sm from statsmodels.nonparametric import _smoothers_lowess a...
from __future__ import division import numpy as np import math import random from scipy.spatial import Delaunay from copy import copy def randommap(rows, cols): '''terribly coded random-height-map generator, takes # of rows and cols as input as well as the minimum and maximum height for starting the randomization...
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 FGSM(InjectionAttack): def __init__(self, epsilon, n_epoch, ...
# -*- coding: utf-8 -*- """ Created on Wed Jul 24 10:27:06 2019 This code creates a class DBR that represents a reflection experiment on a porous DBR. The reflection is modelled using the transfer matrix model given structural information about the DBR. The model is capable of simulating graded interfaces between the ...
""" Authors: <NAME>, <NAME> and <NAME> All rights reserved, 2017. """ __all__ = ['solid_harmonic_filter_bank'] import numpy as np from scipy.special import sph_harm, factorial from .utils import get_3d_angles, double_factorial, sqrt def solid_harmonic_filter_bank(M, N, O, J, L, sigma_0, fourier=True): """ ...
<reponame>dhroth/count_quasars<filename>getMags.py from __future__ import print_function, division import os import sys from matplotlib import pyplot as plt import lsst.sims.photUtils.Bandpass as Bandpass import lsst.sims.photUtils.Sed as Sed import scipy.integrate as integrate import numpy as np import config def g...
<gh_stars>0 # Copyright 2019 The Cirq Developers # # 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 a...
# The particle filter, prediciton and correction. # In addition to the filtered particles, the density is estimated. In this # simple case, the mean position and heading is computed from all particles. # # slam_08_c_density_estimation. # <NAME>, 04.01.2013 from lego_robot import * from slam_e_library import get_...
<reponame>krematas/scannerapps import soccer.calibration.utils as utils import numpy as np from os.path import join import cv2 import matplotlib.pyplot as plt data_path = '/home/krematas/Mountpoints/grail/data/Singleview/Soccer/' path_to_field3d = join(data_path, 'field.ply') vertex_data, _, _, _ = utils.read_ply(pa...
<filename>lib/priors.py '''A module that contains a prior class that can be used with emcee (it has to be pickleable)''' import numpy as np from scipy.special import gamma as Gamma import os class Uninformative: '''Uninformative prior. Trivial.''' def __call__(self, value): return 0.0 class STAN: '''A...
# -*- coding:utf-8 -*- # # Copyright (C) 2019-2021, Saarland University # Copyright (C) 2019-2021, <NAME> <<EMAIL>> from __future__ import annotations import dataclasses as d import typing as t import abc import decimal import enum import fractions import math import warnings from . import errors, operators, types ...
import matplotlib.pyplot as plt import numpy as np from scipy.optimize import curve_fit from astropy.io import ascii from uncertainties import ufloat import uncertainties.unumpy as unp # bisher: Berechnung der Schallgeschwindigkeit über unsere Messung mit v_0 und bestimmten lambda # zudem: Import der ganzen daten mitte...