text
string
import numpy as np from scipy import stats from pysofia import svm_train, svm_predict, learner_type, loop_type, eta_type def test_1(): np.random.seed(0) X = np.random.randn(200, 5) query_id = np.ones(len(X)) w = np.random.randn(5) y = np.dot(X, w) coef = svm_train(X, y, query_id, 1., X.shape[0...
<filename>notebook/scipy_sparse_method.py import numpy as np from scipy.sparse import csr_matrix, lil_matrix l = [[0, 1, 2], [3, 0, 4], [0, 0, 0]] csr = csr_matrix(l) lil = lil_matrix(l) print(csr.sum()) # 10 print(csr.mean()) # 1.111111111111111 print(csr.max()) # 4 print(csr.min()) # 0 # print(lil.ma...
<reponame>raun1/Complementary_Segmentation_Network-Raw-Code-Available-Under-Construction-<filename>src/comp_net_raw.py<gh_stars>10-100 # coding: utf-8 # In[2]: import keras import scipy as sp import scipy.misc, scipy.ndimage.interpolation from medpy import metric import numpy as np import os from keras import losses...
############################################################################################################################### # This script implements a simplification of the evolutionary process proposed by Real et al.: https://arxiv.org/abs/1802.01548v7# #############################################################...
from keras.models import Sequential from keras.layers import Dense, Dropout, Activation from keras.regularizers import l2 from keras.optimizers import SGD ,Adagrad from scipy.io import loadmat, savemat from keras.models import model_from_json import theano.tensor as T import theano import csv import configparser import...
import numpy as np import matplotlib.pyplot as plt from scipy import signal import statsmodels.api as sm def separate_frequency_linear(HISm_mean, REA=0): hig_list = [] low_list = [] org_list = [] if REA == 0: hig_list = [] low_list = [] org_list = [] for i in range(HISm_...
<gh_stars>0 import os import csv from math import sqrt, pi, sin, cos, tan, atan from cmath import phase from calculation import TIntensity, TStokesVector, TStokesNaturalVector from gradient import Gradient class TTask12: def __init__(self, Idx, Alfa, Beta): self.Idx = Idx self.Alfa = Alfa ...
<reponame>dellani/TractSeg<filename>tractseg/libs/plot_utils.py<gh_stars>0 from __future__ import absolute_import from __future__ import division from __future__ import print_function from os.path import join import math import numpy as np import nibabel as nib import torch from nibabel import trackvis from dipy.tra...
<reponame>bjodah/pyneqsys #!/usr/bin/env python # -*- coding: utf-8 -*- # # PYTHON_ARGCOMPLETE_OK # Pass --help flag for help on command-line interface import sympy as sp import numpy as np from pyneqsys.symbolic import SymbolicSys def solve(guess_a, guess_b, power, solver='scipy'): """ Constructs a pyneqsys.sy...
<reponame>AmirooR/caffe_video_segmentation import caffe import numpy as np from matplotlib.pyplot import imshow, show, figure from skimage import io from skimage.transform import resize from scipy.sparse import csr_matrix path = 'test_pywarping_layer.prototxt' img_paths = ['input_0.jpg', 'input_1.jpg'] im_shape = (100...
<filename>galpy/orbit/integrateLinearOrbit.py import ctypes import ctypes.util from numpy.ctypeslib import ndpointer import numpy from scipy import integrate from .. import potential from ..util.multi import parallel_map from .integratePlanarOrbit import _parse_integrator, _parse_tol from .integrateFullOrbit import _pa...
from sympy import solve, sin, cos, pprint from sympy.abc import x, y from sympy.plotting import plot import numpy as np sol = solve(x**2+2*x+5, x) pprint(sol) plot(sin(x))
<reponame>oublalkhalid/Time-series-anomaly<filename>anom_detect.py<gh_stars>0 from __future__ import division import numpy as np import pandas as pd import matplotlib.pyplot as plt from scipy import stats class anom_detect(): """Anomaly detection for time series data The method can be used to computed a movi...
<filename>inception.py import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from scipy.stats import entropy from data_sampler import SequentialSampler, BatchSampler from utl import aduc k3same = dict(kernel_size=3, stride=1, padding=1) k5same = dict(kernel_size=5, stride=1, padding=2)...
<filename>tests/evaluation/detection/test_eval.py # <Copyright 2022, Argo AI, LLC. Released under the MIT license.> """Detection evaluation unit tests. Only the last two unit tests here use map ROI information. The rest apply no filtering to objects that have their corners located outside of the ROI. """ import math...
# --------------------------------------------------------------------------------------------------------------------- # Aufgabe 15: Branching DQN with soft copy of weights (weighted update) # 19.02.2022, <NAME> # # Implementation changes: # - New class StateDictHelper for the state_dict calculations # - New methode B...
# MIT License # # Copyright (c) 2022 Quandela # # 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, pub...
<reponame>LavaRNG/lava import numpy as np from scipy import special as sp from scipy import misc as ms from math import pi as PI from math import isnan # estimates NP = np.array([10**i for i in range(1,7)]) # 10:1M NR = np.array([10**i for i in range(1,7)]) # 10:1M # hyperparameters A = np.array([10**i for i in range...
<reponame>gumpy-hybridBCI/gumpy-Realtime<filename>src/ssvep/preprocess.py import mne import os import scipy.io as sio import numpy as np import matplotlib.pyplot as plt from mne.time_frequency import psd_welch mne.set_log_level("ERROR") recording_dir = os.path.join(os.path.dirname(__file__), "..", "REC") stimulation...
<gh_stars>0 #!/usr/bin/env python """ Plot backed by a pandas DataFrame. """ # Major library imports from numpy import linspace from pandas import DataFrame from scipy.special import jn # Enthought library imports from enable.api import Component, ComponentEditor from traits.api import HasTraits, Instance from traits...
<gh_stars>10-100 import plotly.graph_objs as go from plotly.offline import plot import numpy as np from scipy.spatial.transform.rotation import Rotation from scipy.spatial.ckdtree import cKDTree def plot_box(pd, pos, quat, size): d = -size p = size X = np.array([[d[0], d[0], p[0], p[0], d[0], d[0], p[0], ...
import numpy as np from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson from scipy.sparse import csr_matrix n = 100 c = n * 2 np.random.seed(1) d = np.random.randint(0, n, c) i = np.random.randint(0, n, c) j = np.random.randint(0, n, c) csr = csr_matrix((d, (i, j)), shape=(n...
# -*- coding:Utf-8 -*- import numpy as np import scipy as sp import time import pdb import os import sys import pickle as pk import matplotlib.pyplot as plt from matplotlib.collections import PolyCollection # scenario CDF mode 3D from matplotlib.colors import colorConverter # scenario CDF mode 3D from pylayers.l...
from os.path import dirname, abspath, join import numpy as np from matplotlib import patches from matplotlib import pyplot as plt from scipy.interpolate import interp1d import pdb from sofacontrol.utils import load_data path = dirname(abspath(__file__)) ############################################# # Problem 1, Fig...
import numpy as np import pytest from sklearn.utils.testing import assert_array_equal from scipy import sparse from anndata.tests.helpers import gen_adata, subset_func, asarray @pytest.fixture( params=[np.array, sparse.csr_matrix, sparse.csc_matrix], ids=["np_array", "scipy_csr", "scipy_csc"], ) def matrix_t...
<gh_stars>1-10 import artm import operator import functools import numpy as np import pandas as pd from collections import Counter, OrderedDict from scipy.optimize import curve_fit from .base_score import BaseScore # change log style lc = artm.messages.ConfigureLoggingArgs() lc.minloglevel = 3 lib = artm.wrapper.Lib...
import numpy as np import scipy.interpolate from scipy.interpolate import make_interp_spline, BSpline, CubicSpline from scipy.spatial.transform import Rotation as Rot import torch import os import json def shiftRaceline(raceline: np.ndarray, reference_vec: np.ndarray, distance: float, s = None): diffs = raceline[1...
<reponame>fdeloche/fmaskedCAP-model import torch import copy import numpy as np import matplotlib.pyplot as pl from scipy.optimize import curve_fit from functools import partial class PowerLawLatencies: ''' Links frequencies and latencies (power law model). log(f)= log(A) + alpha log ( |t-t0|) |t-t0| (mode:'bo...
import os import time import numpy as np from scipy import sparse as spsp import dgl import backend as F import unittest, pytest from dgl.graph_index import create_graph_index from numpy.testing import assert_array_equal def create_random_graph(n): arr = (spsp.random(n, n, density=0.001, format='coo') != 0).astyp...
import numpy as np import torch from scipy.stats import truncnorm, truncexpon from torch import nn from torch.nn.functional import interpolate from paderbox.transform.module_fbank import hz2mel, mel2hz from einops import rearrange from padertorch.utils import to_list from typing import Tuple, List import torch.nn.func...
""" Utility functions to fit and apply coordinates transformation from FVC to FP """ import json from pkg_resources import resource_filename import numpy as np from scipy.interpolate import interp1d from desimeter.transform.zhaoburge import getZhaoBurgeXY, transform, fitZhaoBurge from desimeter.trig import average_an...
# Copyright 2020 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
""" Implements 'propagation', whereby terms from the full ConceptNet graph are assigned vectors from the embeddings produced by retrofitting against the reduced graph. """ import numpy as np import pandas as pd from scipy.sparse import diags from conceptnet5.builders.reduce_assoc import ConceptNetAssociationGraph fro...
<filename>utils/utils_test.py import numpy as np import scipy.sparse as sp import torch import time import random from utils.tool import read_data, write_dic, dictionary, normalize, sparse_mx_to_torch_sparse_tensor def encoding_test(run = 10, train_dataset = "fb237_v1", test_dataset = "fb237_v1_ind"): "...
<reponame>Abdumaleek/infinity-mirror import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # Train on CPU (hide GPU) due to memory constraints os.environ['CUDA_VISIBLE_DEVICES'] = "0" import tensorflow as tf import numpy as np import scipy.sparse as sp from collections import namedtuple from src.gae.gae.optimizer imp...
import numpy as np from scipy.spatial import distance def cayley_menger_analysis(vertices, d = 2): """ Determines volume and circumradius for a tetrahedron given the vertices https://westy31.home.xs4all.nl/Circumsphere/ncircumsphere.htm#Coxeter """ if d == 3: cm_matrix = np.array([[0, 1, 1,...
import pickle, glob, sys, csv, warnings import numpy as np from feature_extraction_utils import _load_file, _save_file, _get_node_info from sklearn.preprocessing import PolynomialFeatures from sklearn.metrics import accuracy_score, confusion_matrix, auc, roc_curve from sklearn.naive_bayes import GaussianNB from sklear...
import csv import numpy as np import cv2 from scipy import ndimage #this fumction reads the CSV file and return left,center and right images. Also the steering measurments. def read_csv(): lines = list() with open("./data/driving_log.csv") as csvfile: reader = csv.reader(csvfile) for line in reader: lines.a...
import numpy as np from scipy.stats import binom from statsmodels.stats.multitest import multipletests from .common import * def predict_expression(transcripts, init_site_range, p): """ Probability that at least the number of observed transcripts in the initiation site is due to random chance assuming th...
<reponame>princeton-computational-imaging/NLOSFeatureEmbeddings import torch import torch.nn as nn import torch.nn.functional as F import numpy as np ################################################################ class lct_fk_fast(nn.Module): def __init__(self, spatial=256, crop=512, \ ...
import numpy as np import matplotlib.pyplot as plt from scipy.linalg import cholesky, cho_solve import seaborn as sns sns.set_style('darkgrid') class GP: def __init__(self, x_train: np.ndarray, y_train: np.ndarray, noise_var: float = 1., lscale: float = 1., k_var: float = 1., prior_mean: float =...
<gh_stars>1-10 """ Define the class for adaptive loss scaling. """ from timeit import default_timer as timer import numpy as np from scipy.special import erfinv class AdaLoss(object): """ Implementation of the adaptive loss scaling method. """ def __init__( self, func_params=None, s...
<reponame>MasaKat0/D3RE import numpy as np import six from scipy import optimize from sklearn import metrics import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torchvision import datasets, transforms def train(x_train, t_train, x_test, t_test, epoch, model, optimizer,...
<filename>vispol/test.py import vispol import numpy as np import matplotlib.pyplot as plt import sys sys.path.append('C:/python scripts/ciecam02 plot') import Read_Meredith as rm import scipy.io as sio import colorspacious as clr from scipy.stats import entropy from scipy.signal import convolve2d from scipy.signal impo...
from numpy import * import theano import theano.tensor as T import theano.typed_list as tl import theano.sparse as sparse from scipy.misc import logsumexp from scipy.optimize import fmin_ncg import scipy.sparse as sp import time random.seed(1) K = 5 #nClasses N = 150 #nSamples D = 3 #nFeatures #single precision for...
<gh_stars>0 import numpy as np import numpy.random as rand import scipy as sp import matplotlib.pyplot as plt def gen_training(func, x, var=1): y = func(x) y += rand.normal(0, var, y.shape) return y def const(x): return lambda y: x def lms(funcs, x, y, alpha): (m,) = x.shape (n,) = funcs....
<filename>python/algo/ff9.py #!/usr/env/python import time import numpy as np # import matplotlib.pyplot as plt from scipy import signal as sig from numba import jit # from ..datasets import synthetic as synth # from ..datasets import read_msrc as msrc from ..utils import arrays as ar from ..utils import sliding_win...
import tensorflow as tf import numpy as np import pandas as pd from scipy import optimize, stats from collections import OrderedDict import argparse # likelihood function for MK test class SimpleMK(object): def __init__(self, neutral_div, neutral_poly, foreground...
<gh_stars>0 import numpy,copy class SO(): def __init__(self):#This class can only be inherited from pass def drawPSFandSB(self,band): dat=self.stochasticobservingdata[band] k=numpy.random.randint(len(dat[:,0])) return dat[k,0],dat[k,1] def CalculateETSB(self,sbs,ban...
from collections import OrderedDict import numpy as np import os from hazel.atmosphere import General_atmosphere from hazel.util import i0_allen from hazel.codes import sir_code from hazel.io import Generic_SIR_file import scipy.interpolate as interp from hazel.exceptions import NumericalErrorSIR from hazel.transforms ...
# -------------- import pandas as pd import scipy.stats as stats import math import numpy as np import warnings warnings.filterwarnings('ignore') #Sample_Size sample_size=2000 #Z_Critical Score z_critical = stats.norm.ppf(q = 0.95) # path [File location variable] #Code starts here data = ...
#!/usr/bin/python2.7 from fractions import gcd N = 1000000 phi = [0, 1] for n in range(2, N+1): phi.append(0) for n in range(2, N+1): if phi[n] == 0: phi[n] = n-1 k = 1 p = n while (p**k) <= N: pk = p**k phi[pk] = (pk/p) * (p-1) m = 2 ...
<filename>model_large_dataset.py import random import string import os import pandas as pd import numpy as np import scipy import joblib from scipy.stats import uniform from sklearn.model_selection import RandomizedSearchCV from sklearn.metrics import f1_score, classification_report, confusion_matrix from sklearn.pipe...
<filename>tests/test_variant_effect.py import copy import os import sys import warnings import cyvcf2 import numpy as np import pandas as pd import pybedtools as pb import pytest from scipy.special import logit import config import kipoi import kipoi_veff import kipoi_veff as ve import kipoi_veff.snv_predict as sp im...
""" Test that batch and run-order correction behaves sensibly with a combination of synthetic and model datasets. """ import scipy import pandas import numpy import seaborn as sns import sys import unittest import os sys.path.append("..") import nPYc from generateTestDataset import generateTestDataset class test_ro...
<reponame>SophieHerbst/mne-bids """Utility functions to copy raw data files. When writing BIDS datasets, we often move and/or rename raw data files. several original data formats have properties that restrict such operations. That is, moving/renaming raw data files naively might lead to broken files, for example due t...
"""Makes flattened views of volumetric data on the cortical surface. """ from six import string_types from functools import reduce import os import glob import numpy as np import string from .. import utils from .. import dataset from ..database import db from ..options import config def make_flatmap_image(braindata...
<gh_stars>10-100 """Cross-tabulation module The module implements the cross-tabulation analysis. """ from __future__ import annotations import itertools from typing import Any, Optional, Union from patsy import dmatrix import numpy as np import pandas as pd from scipy.stats import chi2, f from samplics.estima...
<reponame>indiradutta/PULSE<gh_stars>0 import torch import torchvision import numpy as np import sys import os import glob import dlib import gdown import json import scipy import scipy.ndimage import PIL import PIL.Image from pathlib import Path __PREFIX__ = os.path.dirname(os.path.realpath(__file__)) class Prepr...
<filename>bdgym/envs/utils.py<gh_stars>0 """General utility functions Credit to: https://github.com/eleurent/highway-env """ from typing import Union, Tuple, List import numpy as np from scipy.stats import truncnorm Interval = Union[ np.ndarray, Tuple[float, float], List[float] ] def lmap(v: float, x: ...
# Copyright (c) 2020 NVIDIA Corporation. All rights reserved. # This work is licensed under the NVIDIA Source Code License - Non-commercial. Full # text can be found in LICENSE.md import cv2 import math import matplotlib.pyplot as plt import numpy as np from PIL import Image as PILImage from scipy.ndimage.filters impo...
<gh_stars>0 import os from itertools import combinations from typing import Tuple, Optional, Union, Callable, Dict, Iterable import pandas as pd import numpy as np import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import matplotlib.colors as colors import matplotlib.cm as cm from matplotlib.backend...
""" Provides class Hiarrchy for the analysis of multiple segementations orgainized in a hierarchy (each segmentation is a subset of the next one). # Author: <NAME> (Max Planck Institute for Biochemistry) # $Id$ """ from __future__ import unicode_literals from __future__ import absolute_import from __future__ import ...
''' These give the derivations for Euler angles to rotation matrix and Euler angles to quaternion. We use the rotation matrix derivation only in the tests. The quaternion derivation is in the tests, and, in more compact form, in the ``euler2quat`` code. The rotation matrices operate on column vectors, thus, if ``R``...
<filename>astro345_fall2015/kepler_cleanedup.py import math import numpy import scipy import pylab import scipy.optimize #function definitions. #the 0.2 is the t-Tau moved to the other side so we can solve for x when y is 0. def f(x): y = x - 0.2 * numpy.sin(x) - 0.8 return y def f_prime(x): y = ...
<gh_stars>10-100 # Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. import itertools import logging import re from collections import OrderedDict from typing import List import mxnet as mx import scipy as sp from mxnet import nd, gluon from tqdm import tqdm from data.AugmentedAST import Augment...
"""Common algebra of "quantum" objects. Quantum objects have an associated Hilbert space, and they support (at least partially) summation, products, multiplication with a scalar, and adjoints. The algebra defined in this module is the superset of the Hilbert space algebra of states (augmented by the tensor product), ...
#!/home/renato/anaconda2/bin/python import numpy as np import matplotlib.pyplot as plt import os, sys from scipy.interpolate import interp2d from pylab import * import pandas as pd print "--------------------------------------------------------------------------" print "------------------------ Start GroIMP 1.5 --...
<filename>regression/module_NN_ens.py import numpy as np import matplotlib.pyplot as plt from scipy.stats import norm import tensorflow as tf import datetime from scipy.special import erf import importlib import utils importlib.reload(utils) from utils import * class NN(): def __init__(self, activation_fn, x_di...
""" Helpers to prepare input data for models stack, shuffle, normalize __author__: <NAME> """ import os import warnings from typing import List, Optional, Tuple import matplotlib.pyplot as plt import numpy as np import pandas as pd import scipy.interpolate from scipy import stats from scipy.stats import norm from skl...
<reponame>BrancoLab/LocomotionControl from loguru import logger import numpy as np from scipy.signal import medfilt import pandas as pd from fcutils.maths.geometry import ( calc_distance_between_points_in_a_vector_2d as get_speed_from_xy, ) from fcutils.maths.geometry import ( calc_angle_between_points_of_vect...
<reponame>jma712/DIRECT<filename>src/main_disent.py<gh_stars>1-10 ''' Disentangled multiple cause effect learning 2020-07-08 ''' import time import numpy as np import torch from torch import optim from torch import nn from torch.nn import functional as F from torchvision.utils import save_image from torch.utils.data i...
# -MPdSH '''_____Standard imports_____''' import numpy as np import scipy.fftpack as fp import scipy '''_____Project imports_____''' from src.toolbox.filters import butter_highpass_filter #from src.toolbox.calibration_processing import linearize_spectra, compensate_dispersion from src.toolbox.maths import spectra2ali...
""" MissX Imputer for Missing Data Modified code of missforest (https://github.com/stekhoven/missForest) - The imputer was modified so that... - Custom predictors can be used - Predictions are done in parallel (for faster calculation) - Delete codes for classification """ import warnings i...
<reponame>KorlaMarch/tuplex<gh_stars>0 #!/usr/bin/env python # coding: utf-8 # ## Flights core-exp plot # In[1]: import matplotlib import matplotlib.pyplot as plt import numpy as np import pandas as pd import re import json import seaborn as sns import datetime from matplotlib.patches import Patch import matplot...
<gh_stars>0 from scipy import signal import numpy as np class NpCircularArray: def __init__(self, n, length): self.arr = np.zeros([length, n]) def append(self, arr): self.arr[0:-1, :] = self.arr[1:, :] self.arr[-1, :] = arr def set_all(self, arr): self.arr = np.tile(arr, ...
import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from sklearn.decomposition import PCA import scipy.io as sio from scipy import sparse import time from CSMSSMTools import * def getDiffusionMap(SSM, Kappa, t = -1, includeDiag = True, thresh = 5e-4, NEigs = 51): """ :par...
""" NOTE: below is some legacy code that is not compatible with current BayesFast we will revise it later """ import numpy as np from scipy.special import expit import multiprocessing as mp import warnings import time from ..samplers.pymc3.nuts import NUTS from ..utils.warnings import SamplingProgess from ..uti...
import numpy as np from panqec.codes import StabilizerCode from panqec.decoders import BaseDecoder from panqec.error_models import BaseErrorModel from typing import Dict import panqec.bsparse as bsparse from panqec.bpauli import bcommute from scipy.sparse import csr_matrix PAULI_I = 0 PAULI_X = 1 PAULI_Y = 2 PAULI_Z ...
import pandas as pd import seaborn as sns import numpy as np import plotly.express as px import json import os import matplotlib.pyplot as plt import nltk import statistics as sts # %matplotlib inline from urllib.request import urlopen from nltk.corpus import stopwords from nltk.stem import RSLPStemmer from sklearn...
import numba as nb import numpy as np import warnings from scipy import optimize from .utils import ( preprocess_trajs, get_nfeatures, trajs_matmul, symeig, solve_stationary, compute_ic, compute_c0, batch_compute_ic, batch_compute_c0, is_cutlag, ) # ----------------------------...
r""" Solve Klein-Gordon equation on [-2pi, 2pi]**3 with periodic bcs u_tt = div(grad(u)) - u + u*|u|**2 (1) Discretize in time by defining f = u_t and use mixed formulation f_t = div(grad(u)) - u + u*|u|**2 (1) u_t = f (2) with both u(x, y, z, t=0) and f...
''' Define Bernstein Polynomials i and p index the BPs t is the time variable h is the size of the timestep ''' import scipy.special import math def BP(t: float, i: int, p: int, h: float): if i < 1 or i > p: return 0 elif t >= 0 and t <= h: norm_coef = scipy.special.binom(p-1,i-1) t = t/h return norm_...
<gh_stars>0 import sys if sys.version_info < (3,): range = xrange import numpy as np import pandas as pd import scipy.stats as ss from .. import families as fam from .. import output as op from .. import tests as tst from .. import tsm as tsm from .. import data_check as dc from .garch_recursions import garch_re...
<gh_stars>1-10 __author__ = 'dash' import os import numpy as np from PIL import Image import random from bucketdata import BucketData from scipy import signal class DataGen(object): GO = 1 EOS = 2 def __init__(self, data_root, annotation_fn, evaluate=False, ...
<reponame>Rapid-Design-of-Systems-Laboratory/beluga-legacy<filename>examples/Air Traffic Noise Minimization/AircraftNoiseCtrl_test.py #Generates a dictionary of possible control solutions for the noise minimization #problem. The output is meant to be passed directly into ctrl_sol on line 289 #of NecessaryConditions.py....
from imblearn.metrics import classification_report_imbalanced as imbal_class_report from scipy.stats import randint as sp_randint from sklearn import metrics from sklearn.ensemble import GradientBoostingClassifier, RandomForestClassifier, VotingClassifier, BaggingClassifier, \ AdaBoostClassifier, ExtraTreesClassifi...
import skimage.morphology as skm import numpy as np from scipy import misc import matplotlib.pyplot as plt from sklearn.decomposition import PCA from skimage.color import rgb2gray def dispersionratio(image, alpha_th=5): #image = misc.imread("../data/cellI4.tif") [h,l]=image.shape sortim = np.sort(np.reshape(i...
<reponame>LMNS3d/sharpy """ @modified <NAME> """ import ctypes as ct import numpy as np import scipy as sc import os import itertools import warnings import sharpy.structure.utils.xbeamlib as xbeamlib from sharpy.utils.solver_interface import solver, BaseSolver import sharpy.utils.settings as settings import sharpy....
import numpy as np import scipy.stats as ss def const_prior(t, p: float = 0.25): """ Constant prior for every datapoint Arguments: p - probability of event """ return np.log(p) def geom_prior(t, p: float = 0.25): """ geometric prior for every datapoint Refer to https://docs.s...
import tensorflow as tf import numpy as np import argparse import socket import importlib import time import os import scipy.misc import sys import h5py import math BASE_DIR = os.path.dirname(os.path.abspath(__file__)) sys.path.append(BASE_DIR) sys.path.append(os.path.join(BASE_DIR, 'models')) sys.path.append(os.path.j...
<reponame>FoxFortino/adfox<gh_stars>10-100 import os from scipy.signal import medfilt from astrodash.preprocessing import ReadSpectrumFile, ProcessingTools, PreProcessSpectrum from astrodash.array_tools import zero_non_overlap_part, normalise_spectrum class CombineSnAndHost(object): def __init__(self, snInfo, gal...
<gh_stars>0 import numpy as np import scipy as sp import scipy.linalg as linalg def my_LDA(X, Y): """ Train a LDA classifier from the training set X: training data Y: class labels of training data """ classLabels = np.unique(Y) # different class labels on the dataset classNum = len(classL...
#!/usr/bin/env python # -*- coding: UTF-8 -*- ### Require Anaconda3 ### ============================ ### 3D FSC Software Package ### Analysis Section ### Written by <NAME> and <NAME> ### Downloaded from https://github.com/nysbc/Anisotropy ### ### See Paper: ### Addressing preferred specimen orientation in single-part...
import os import time import scipy import numpy as np def mel_scale(freq): return 1127.0 * np.log(1.0 + float(freq)/700) def inv_mel_scale(mel_freq): return 700 * (np.exp(float(mel_freq)/1127) - 1) class MelBank(object): def __init__(self, low_freq=20, high_freq=8000, ...
from typing import Optional, Tuple, List, Callable import logging import numpy as np from progressbar import progressbar from scipy.interpolate import interp1d from dat_analysis.core_util import data_row_name_append, get_data_index from dat_analysis import useful_functions as U logger = logging.getLogger(__name__) ...
"""DRO and DORO Training Algorithms Reference: [1] Hashimoto et al., Fairness Without Demographics in Repeated Loss Minimization, ICML 2018. """ import math import scipy.optimize as sopt import torch import torch.nn from torch import optim from torch.nn.modules.module import Module from torch.utils.data import...
<reponame>jknox13/iterative_hierarchical_clustering<filename>flithic/clustering.py # Authors: <NAME> <EMAIL> # License: # TODO: FIX lowest level of dendrogram (linkage property) # TODO: option to run clustering past tolerance will make this more like # scipy.cluster.hierarchy. # TODO: incorporate heapq - priorit...
import os import glob import tensorflow as tf import tensorflow_datasets as tfds from scipy.interpolate import interp1d from astropy.table import Table from astropy.io import fits import numpy as np import pandas as pd # To extract the SnapNumLastMajorMerger values from TNG100_SDSS_MajorMergers.csv _DESCRIPTION = """ ...
<reponame>PabloAlvarado/ssgp from gpflow.kernels import Matern52, Matern32, Matern12 from gpitch.kernels import Matern32sm, MercerCosMix from gpitch.methods import find_ideal_f0, init_cparam import numpy as np import gpflow from scipy import signal def init_iv(x, num_sources, nivps_a, nivps_c, fs): """ Initia...