text string |
|---|
<reponame>evevkovacs/ML-SN-Classifier
#!/usr/bin/env python
"""
Create RandomForest classifier to type simulated DES SNe
http://scikit-learn.org
"""
import os, sys
import numpy as np
import re
from astropy import cosmology
from astropy.cosmology import FlatLambdaCDM
from astropy.table import Table, join, vstack
from a... |
<reponame>e5120/EDAs
import numpy as np
from scipy.special import gammaln
from eda.optimizer.metric import MetricBase
class K2(MetricBase):
"""
A class of K2 metric.
"""
def __init__(self, data, base):
super(K2, self).__init__(data, base)
def local_score(self, node, parents):
sco... |
import statistics
from typing import List
from src.db.models.event import Event
from src.db.models.match import Match
from src.db.models.year import Year
def process_year(year: Year, events: List[Event], matches: List[Match]) -> Year:
week_one_events = set([e.key for e in events if e.week == 1])
week_one_mat... |
# libs
import os
# third party lib
import h5py
import numpy as np
import seaborn as sb
import matplotlib.pyplot as plt
import matplotlib.cbook
import warnings
import pandas as pd
from scipy.stats import chi2
chi2sf = chi2.sf
warnings.simplefilter(action="ignore", category=FutureWarning)
warnings.filterwarnings("ignor... |
import math as m
import statistics as s
import time
print(m.sqrt(2))
data = [10, 20, 30, 40, 80, 99, 22, 44]
print(s.median(data))
now = time.localtime()
print(now.tm_year,now.tm_mon)
start = time.time()
for i in range(1,10):
time.sleep(1)
end = time.time()
print(end - start) |
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 21 07:43:46 2019
@author: <NAME>
"""
from PIL import ImageFont, ImageDraw, Image, ImageFilter
import Lib
from Lib import add_noise_img, ImgData, ImgSize, Fonts, MakeDataset
from sklearn.ensemble import RandomForestClassifier
from sklearn.utils import shuffle
im... |
<filename>SharifCTF/2016/RSA-Keygen/generate-key.py
from random import randrange
import fractions
def get_primes(n):
numbers = set(range(n, 1, -1))
primes = []
while numbers:
p = numbers.pop()
primes.append(p)
numbers.difference_update(set(range(p*2, n+1, p)))
return primes
def egcd(a, b):
if a == 0:
... |
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by <NAME>
# --------------------------------------------------------
# --------------------------------------------------------
# R*CNN
# Written by... |
<reponame>yuanc3/LSUnetMix
# -*- coding: utf-8 -*-
# @Time : 2021/6/19 11:30 上午
# @Author : <NAME>
# @File : Load_Dataset.py
# @Software: PyCharm
import numpy as np
import torch
import random
from scipy.ndimage.interpolation import zoom
from torch.utils.data import Dataset
from torchvision import transforms as T... |
import numpy as np
import scipy
import scipy.optimize
class FourierFit:
def __init__(self, P=2, ndims=2, maxiters=100, tol=1.0e-6):
super().__init__()
self.P = P
self.maxiters = maxiters
self.ndims = ndims
self.tol = tol
self.pp = []
self.t0 = None
... |
# -*- coding: utf-8 -*- #
# ------------------------------------------------------------------
# File Name: optimization_model.py
# Author: <NAME>
# Version: 1.2
# Created: 2021/11/27
# Description: Main Function: mathematical model for manipulator optimization in python
# ... |
<reponame>renjithbaby23/tf2.0_examples
"""
Fine tuning hyperparameters using tf.keras sklearn wrapper
This example uses tf.keras sequential model
"""
import tensorflow as tf
import numpy as np
from sklearn import model_selection, preprocessing
from sklearn import datasets
from scipy.stats import reciprocal
from sklear... |
import numpy as np
import statsmodels as sm
import math
import matplotlib.pyplot as plt
from scipy.integrate import quad
import sys
import os
import logging
from brd_mod.brdstats import *
from brd_mod.brdecon import *
def meter_to_mi(x):
'''
Converts a parameter in metres to miles
using a standar... |
'''
Mscale_HUB computes Huber's M-estimate of scale.
INPUTS:
y: real valued data vector of size N x 1
c: tuning constant c>=0 . default = 1.345
default tuning for 95 percent efficiency under the Gaussian model
max_iters: Number of iterations. default = 1000
... |
<reponame>yrahul3910/study
import os
import tensorflow as tf
import numpy as np
import pandas as pd
from glob import glob
from ivis import Ivis
from ghost import BinaryGHOST
from raise_utils.learners import FeedforwardDL, Learner
from raise_utils.hyperparams import DODGE
from raise_utils.transforms import Transform
fro... |
import ftplib
import glob
import subprocess as sp
import csv
import numpy as np
import netCDF4 as nc4
import pygrib as pg
import matplotlib.pyplot as plt
plt.switch_backend('agg')
import datetime
import scipy
import os
import sys
from mpl_toolkits.basemap import Basemap
from matplotlib.patches import Polygon
from matp... |
<gh_stars>1-10
# encoding: utf-8
"""
Tests of io.base
"""
from __future__ import absolute_import, division
try:
import unittest2 as unittest
except ImportError:
import unittest
from ...io import ExampleIO
import numpy
try:
import scipy
have_scipy = True
except ImportError:
have_scipy = False
fro... |
import pandas as pd
import numpy as np
import gc
import graph_search_algorithms
import model_features_insights_extractions
from scipy import spatial
def add_interactions(df, model = None, interactions = None):
'''
Summary: generic function for adding interaction features to a data frame either by passing the... |
# -*- coding: utf-8 -*-
"""
Created on Some night, Way to late
@author: bokorn
"""
import os
import torch
import numpy as np
from sklearn.neighbors import KDTree
import scipy
import scipy.io as sio
from functools import partial
from se3_distributions.utils.pose_processing import getGaussianKernal
from se3_distributio... |
<reponame>876lkj/APARENT
from __future__ import print_function
import keras
from keras.models import Sequential, Model, load_model
from keras import backend as K
import tensorflow as tf
import pandas as pd
import os
import sys
import time
import pickle
import numpy as np
import scipy.sparse as sp
import scipy.io as... |
import os
import dlib
import cv2
from scipy.spatial import distance
from scipy.misc import imresize
from time import clock
names, base = eval(open('names_descriptors.txt').read())
sp = dlib.shape_predictor('datasets\\shape_predictor_68_face_landmarks.dat')
facerec = dlib.face_recognition_model_v1('datasets\... |
"""Sensor Model
Description:
Sensor Models: Beam Model for Range Sensor and Likelihood Fields
License:
Copyright 2021 <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
... |
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 19 17:22:54 2018
@author: mirza009
"""
import numpy as np
from scipy.interpolate import *
import matplotlib.pyplot as plt
%matplotlib inline
%matplotlib qt #for polots in new window
x = np.linspace(0, 10, 20)
y = np.cos(x)*np.sin(x)
plt.plot(x, y, '.')
f = interp1d... |
<filename>estimated_topic_author_correlation.py
import argparse
import numpy as np
import sys
import timeit
from collections import Counter
from gensim.models import LdaModel
from scipy.sparse import lil_matrix
from scipy.special import xlogy
from downsample_corpus import get_vocab
from topic_author_correlation impor... |
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 21 09:10:41 2019
@author: KemenczkyP
"""
def HeatMap(grads, guided_bp, dims = 2):
'''
\n Makes a dims-D heatmap from computed gradients.
\n -------------------------
\n input: grads and guided_bp, the computed gradient
\n dims: 2 for images, 3 for vol... |
"""
binclf binclf
==================================
Utils library for Binary Classification.
Author: Casokaks (https://github.com/Casokaks/)
Created on: Nov 1st 2018
"""
from copy import deepcopy
import math
import statistics as stat
import itertools
from sklearn.preprocessing import LabelEncoder
from sklearn impo... |
import scipy
import scipy.misc
import numpy as np
def load(path):
img = scipy.misc.imread(path)
## TODO check what is the possible returned shapes
if img.shape[-1] == 1: # grey image
img = np.array([img, img, img])
elif img.shape[-1] == 4: # alpha component
img = img[:,:,:3]
return im... |
import numpy as np
from scipy.interpolate import RectBivariateSpline
from scipy.ndimage import shift
import matplotlib.pyplot as plt
#my imports
import cv2
def LucasKanadeInterp(It, It1, rect, p0 = np.zeros(2)):
# Input:
# It: template image
# It1: Current image
# rect: Current position of the car
# (top left, b... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import KFold
from sklearn.preprocessing import StandardScaler
from scipy.stats import multivariate_normal as mvn
import seaborn as sn
import math
import gc
import tensorflow as tf
from tensorflow.keras.models import Sequ... |
<gh_stars>1-10
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import subprocess
import numpy as np
import xarray as xr
from glob import glob
from pytmatrix.tmatrix import Scatterer
from pytmatrix import psd, orientation, radar
from pytmatrix import refractive, tmatrix_aux
from ... |
"""Script to plot 2 potentials stacked."""
import json
import glob
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import numpy as np
import scipy.interpolate
# matplotlib font configurations
matplotlib.rcParams["text.latex.preamble"] = [
# i need upright \micro symbols, ... |
<filename>ehyd_tools/synthetic_rainseries.py<gh_stars>0
from warnings import warn
import numpy as np
import pandas as pd
from math import floor
from abc import ABC, abstractmethod
from scipy.interpolate import interp2d
from ehyd_tools.design_rainfall import (get_ehyd_design_rainfall_file, read_ehyd_design_rainfall,
... |
# coding=utf-8
"""
Plotting of the profiling results
The script produces:
Profiling results for different components of SPADE. Run times as a function
of the number of spikes by varying (as shown in the respective second x-axis)
1) the firing rates λ of the neurons (left panel, fixed number of neurons N
and duration T... |
from __future__ import division
import numpy as np
import math
import scipy
import pickle
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from scipy import stats
from matplotlib.pyplot import figure
pi = math.pi
n_epoch = 1000
lambda_w_vec = list()
lambda_b_vec = list()
step_vec = list()
for i ... |
<gh_stars>10-100
from unittest import TestCase
import numpy as np
from qilib.data_set import DataArray, DataSet
from scipy.signal import sawtooth
from qtt.measurements.post_processing import ProcessSawtooth2D
class TestProcessSawtooth2D(TestCase):
def test_invalid_sample_count_slow_sawtooth(self):
sam... |
<gh_stars>1-10
import matplotlib.pyplot as plt
import netgraph
import networkx as nx
from networkx.convert_matrix import from_numpy_matrix
import numpy as np
import pandas as pd
import scipy.stats as ss
#############################################
# After model is done, experiment with different networkx plot types... |
<filename>ph.py
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 11 23:56:16 2019
@author: jaehooncha
@email: <EMAIL>
"""
from ripser import ripser
from persim import plot_diagrams
import tadasets
import numpy as np
import matplotlib.pyplot as plt
from sklearn.metrics.pairwise import pairwise_distances
from scipy impo... |
<gh_stars>10-100
import os, time, h5py, sys
import nibabel as nib
import cv2
import numpy as np
from scipy import ndimage
def load_dataset(filename):
f = h5py.File(filename, 'r')
image = np.array(f['image'])
label = np.array(f['label'])
return image, label
def convert_to_1hot(label, n_class):
# ... |
<reponame>Ayazdi/movie_recommender<filename>read_and_train.py
"""
This module read and clean the data into a dataframe foramt.
Then, train and save the models.
"""
import pandas as pd
import pickle
from sklearn.decomposition import NMF
from scipy.spatial import distance
from sqlalchemy import create_engine... |
import config
import models
import json
from scipy.spatial.distance import cosine
# data_path = './benchmarks/FB15K/'
# embedding_path = "./res/embedding.vec.json"
data_path = './benchmarks/DBPEDIA/'
embedding_path = "./res/dbpedia_embedding.vec.json"
def load_dict(src_path):
name2idx = {}
idx2name = {}
... |
# -*- coding: utf-8 -*-
# from __future__ import absolute_import, print_function, division
from future.utils import with_metaclass
import numpy as np
import scipy as sp
from abc import ABCMeta, abstractmethod
from collections import OrderedDict
__all__ = ['Eos','Calculator','CONSTS','fill_array']
# xmeos.models.Cal... |
import numpy as np
import math
import time
import utility
from scipy import signal
# =============================================================
# function: dbayer_mhc
# demosaicing using Malvar-He-Cutler algorithm
# http://www.ipol.im/pub/art/2011/g_mhcd/
# ======================================================... |
<reponame>datasolver/reservoir-engineering<filename>Unit 2 Review of Rock and Fluid Properties/functions/dranchuk_aboukassem.py
def dranchuk(T_pr, P_pr):
# T_pr : calculated pseudoreduced temperature
# P_pr : calculated pseudoreduced pressure
from scipy.optimize import fsolve # non-linear solver
import n... |
<reponame>hongkai-dai/neural-network-lyapunov-1
import neural_network_lyapunov.examples.pole.pole as mut
import neural_network_lyapunov.utils as utils
import torch
import numpy as np
import scipy.integrate
import unittest
class TestPole(unittest.TestCase):
def test_dynamics(self):
dut = mut.Pole(2., 5, 1... |
<filename>statsmodels/examples/l1_demo/demo.py
from __future__ import print_function
from statsmodels.compat.python import range
from optparse import OptionParser
import statsmodels.api as sm
import scipy as sp
from scipy import linalg
from scipy import stats
import pdb
# pdb.set_trace()
docstr = """
Demonstrates l1 ... |
<reponame>axr6077/ParticleTrajectory<filename>Python Scripts/spectrum.py
import numpy as np
def interp1d(x, data_x, data_y):
if len(data_y.shape) == 1:
data_y = data_y[np.newaxis, :]
return np.array([np.interp(x, data_x, data_y[i, :])
for i in range(data_y.shape[0])])
class Spect... |
import numpy as np
from numpy.linalg import inv,det
from scipy.special import gamma,digamma,gammaln
import matplotlib.pyplot as plt
from scipy.optimize import fmin, fminbound
pca_dim = 23
def tCost(v, k, E_h, E_log_h):
val = 0
for i in range(int(E_h)):
val += ((v[k]/2)-1)*E_log_h - (v[k]/2)*E_h - (v[k]/2)*np.log... |
<reponame>modichirag/21cm_cleaning
import warnings
from mpi4py import MPI
rank = MPI.COMM_WORLD.rank
warnings.filterwarnings("ignore")
if rank!=0: warnings.filterwarnings("ignore")
import numpy
from scipy.interpolate import InterpolatedUnivariateSpline as interpolate
from scipy.interpolate import interp1d
from cosmo4... |
<reponame>Sanskar329/monk_v1
import os
import sys
import numpy as np
from mxnet import image
from scipy.stats import logistic
|
import sys
from scipy import misc
import dlib
# from skimage import io
import time
detector = dlib.get_frontal_face_detector()
win = dlib.image_window()
# for f in sys.argv[1:]:
f='/home/xca64/remote/datasets/lfw/Two/177.jpg'
print("Processing file: {}".format(f))
img = misc.imread(f)
# The 1 in the second argument i... |
<filename>src/pymor/discretizers/builtin/cg.py
# This file is part of the pyMOR project (http://www.pymor.org).
# Copyright 2013-2020 pyMOR developers and contributors. All rights reserved.
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
"""This module provides some operators for continuo... |
<reponame>KeeyanGhoreshi/AudioToJummbox<filename>audioToJummbox/converter.py
import codecs
import json
import math
import matplotlib.pyplot as plt
import numpy as np
import librosa
from scipy.signal import find_peaks
from scipy.fft import fftshift
from scipy.fft import rfft, rfftfreq
from scipy import signal
from sci... |
<gh_stars>1-10
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
import json
import os
import boto3
import math
import ffmpeg
from ffmpeg import Error
import numpy as np
import audio2numpy as a2n
from scipy.fft import fft, fftfreq
from MediaReplayEnginePluginHelper ... |
import argparse
import os
import numpy as np
import scipy.io.wavfile as scwav
import pylab
import scipy.signal as scisig
import utils.preprocess as preproc
from glob import glob
from utils.feat_utils import preprocess_contour, normalize_wav
from nn_models.model_energy_f0_momenta_wasserstein import VariationalCycleGAN ... |
<reponame>Cecca/puffinn<filename>join-experiments/run.py
#!/usr/bin/env python3
# This script handles the execution of the join experiments
# in two different modes:
# - global top-k
# - local top-k
#
# Datasets are taken from ann-benchmarks or created ad-hoc from
# other sources (e.g. DBLP).
import gzip
import ... |
import numpy as np
import os
import cv2 as cv
import glob
import math
import scipy.spatial
from tqdm import tqdm
import scipy.io as sio
import trimesh
import trimesh.sample
import trimesh.curvature
import multiprocessing
import objio
"""
runtime configuration
"""
mesh_data_dir = '/data/huima/THuman2.0'
output_data_... |
<reponame>andrewquirk/cs191w<gh_stars>0
from collections import Counter
from nltk.tree import Tree
import numpy as np
import os
import pandas as pd
import random
from sklearn.model_selection import train_test_split, GridSearchCV
from sklearn.feature_extraction import DictVectorizer
from sklearn.linear_model import Logi... |
from ..utils import *
import numpy as np
import scipy.ndimage
def mse(referenceVideoData, distortedVideoData):
"""Computes mean-squared error (MSE).
Both video inputs are compared frame-by-frame to obtain T
MSE measurements.
Parameters
----------
referenceVideoData : ndarray
Referenc... |
<reponame>e2crawfo/dps
from contextlib import contextmanager
import numpy as np
import signal
import time
import re
import os
import traceback
import subprocess
import copy
import datetime
import psutil
import resource
import sys
import shutil
import errno
import tempfile
import dill
from functools import wraps, partia... |
<reponame>tknrsgym/quara<filename>quara/objects/multinomial_distribution.py<gh_stars>1-10
from functools import reduce
from operator import mul
from typing import List, Tuple, Union
import numpy as np
from scipy.stats import multinomial
from quara.math.probability import validate_prob_dist
from quara.utils.index_util... |
import abc
from typing import Union, Tuple
from sympy import ImmutableMatrix
class Cipher(metaclass=abc.ABCMeta):
"""
Abstract base class for all Cipher classes
"""
def __init__(self, key: Union[str, int, Tuple[int, ...], ImmutableMatrix]):
self.key = key
@abc.abstractmethod
def encr... |
<reponame>ngageoint/sarpy<filename>sarpy/io/complex/csk.py<gh_stars>100-1000
"""
Functionality for reading Cosmo Skymed data into a SICD model.
"""
__classification__ = "UNCLASSIFIED"
__author__ = ("<NAME>", "<NAME>", "<NAME>")
import logging
from collections import OrderedDict
import os
import re
from typ... |
# -*- coding: utf-8 -*-
"""Dataset represents a measurement session of a single sensor_type."""
import datetime
import warnings
from distutils.version import StrictVersion
from pathlib import Path
from typing import Union, Iterable, Optional, Tuple, Dict, TypeVar, Type, Sequence, TYPE_CHECKING, List
import numpy as np... |
<reponame>elishatofunmi/macer
import sys
if len(sys.argv)!=2:
print("Usage: python testPredAtK.py <PredK>")
sys.exit(1)
from timeit import default_timer as timer
import keras
import math
import pandas as pd
from keras.models import Sequential
from keras.layers import Dense,Dropout
import numpy a... |
from __future__ import print_function, division
import os, sys
import numpy as np
from scipy import ndimage
from skimage import morphology
from skimage.morphology import skeletonize, dilation, erosion
def skeleton_transform(label, relabel=True):
resolution = (1.0, 1.0)
alpha = 1.0
beta = 0.8
if relabe... |
"""
This class implements Gromov-Wasserstein Optimal Transport.
Several parts are copied from Alvarez-Melis and Jaakkola (2018) and adapted to the use at hand.
"""
import numpy as np
import scipy as sp
import matplotlib.pyplot as plt
import ot
from otalign.src import gw_optim
from typing import List, Dict, Tuple, A... |
<reponame>maps16/FComputacional1
import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import interp1d
#Generando datos
x01 = np.random.random(16)
x1 = 6.0*x01-3.0
y1 = (x1*x1)*(np.sin(2.0*x1))
#Graficar los puntos aleatorios x y los f(x)=Sin(2x)
plt.plot(x1, y1, 'o', label='Data')
#Punto para i... |
import scipy.constants as codata
angstroms_to_eV = codata.h*codata.c/codata.e*1e10
from wofry.propagator.wavefront2D.generic_wavefront import GenericWavefront2D
from wofry.propagator.propagator import PropagationManager, PropagationParameters, Propagator2D
from wofrysrw.beamline.srw_beamline import Where
from wofrysr... |
<gh_stars>0
import os
import warnings
import datetime
import numpy as np
from functools import lru_cache, partial
from autologging import logged
from multiprocessing import Pool
from scipy.optimize import OptimizeWarning
from astropy.table import Table, Column, MaskedColumn
from astropy.stats import mad_std
from as... |
import torch
import time
import numpy as np
from scipy.spatial.distance import pdist, squareform
def vprint(t, v):
if v:
print(t)
fp_mse = torch.nn.MSELoss(reduction='none').cuda()
def find_fps(fun, fp_candidates, params, x_star=None, verbose=True, device='cpu'):
"""
parameters:
fun - f... |
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 7 16:43:32 2020
@author: bryan
"""
def Q34_from_AMS(kPa):
import numpy as np
A = 1.42549766 #was 1.21609795
B = 6516.225347 #was 6653.33966
C = 0.97 #correlation value for Re~10^4
offset = 1.0 # for i2c AMS5915
volts = kPa + 1
... |
import matplotlib.pyplot as plt
from numpy import sum as npsum
from numpy import tile
from scipy.stats import gamma
plt.style.use('seaborn')
def Dirichlet(a,numSamples=1):
#Sample of Dirichlet distribution are obtained drawing gammas
#see http://en.wikipedia.org/wiki/Dirichlet_distribution#Related_distributi... |
<filename>mne_bids/utils.py
"""Utility and helper functions for MNE-BIDS."""
# Authors: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# License: BSD (3-clause)
import os
import os.path as op
import re
import... |
<reponame>krystophny/profit<gh_stars>10-100
# %%
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
# See https://debuggercafe.com/getting-started-with-variational-autoencoder-using-pytorch/
class LinearVAE(nn.Module):
def __init__(self, D, d):
super(LinearVAE, self).__in... |
"""
.. module:: gp_interp
"""
import treegp
import numpy as np
import copy
from .kernels import eval_kernel
from sklearn.gaussian_process.kernels import Kernel
from sklearn.neighbors import KNeighborsRegressor
from scipy.linalg import cholesky, cho_solve
class GPInterpolation(object):
"""
An interpolator t... |
<filename>_codes/_figurecodes/fig5_RainfallHistograms_CDFs.py
#/!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Figure 5 from Adams et al., "The competition between frequent and rare flood events:
impacts on erosion rates and landscape form"
Written by <NAME>
Updated April 14, 2020
"""
from landlab.io import read... |
import numpy as np
import scipy.constants as const
import json
import os
from matplotlib import pyplot as plt
import ckvpy.tools.photon_yield as photon_yield
import ckvpy.tools.effective as effective
class dataAnalysis(object):
"""Class to handle wavelength cuts, sorting, angle finding etc."""
def __init__(sel... |
'''
Copyright 2018 IN3PD
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 agreed to in writing, software
distribu... |
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 21 16:54:30 2017
@author: rflamary
"""
# Author: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# License: MIT License
import numpy as np
import sklearn
import scipy.optimize as spo
from sklearn.model_selection import KFold
from scipy.spatial.distance import cdist
from ... |
<reponame>avigna/peanutShapedSupernova
# ==========================================================#
#
# Make hdf5 file with SPH initial conditions for GADGET
# Specialized for Exploding Stars and binaries
#
# ==========================================================#
# =============================================... |
<filename>utils/environment_check.py
import struct
import scipy
import sys
import torch
import torchvision
def environment_check(gpu_index):
gpu_available = torch.cuda.is_available()
device = torch.device('cuda:%i' % gpu_index if gpu_available else 'cpu')
torch.backends.cudnn.deterministic = False
torch.back... |
<reponame>johnabender/ctrax-tmp<filename>Ctrax/ellipsesk_pre4.py
# ellipsesk.py
# KB 5/21/07
import scipy.ndimage as meas # connected components labeling code
import numpy as num
import wx
from params import params
import matchidentities as m_id
from version import DEBUG, DEBUG_TRACKINGSETTINGS
# for defining empty... |
import itertools
from scipy.special import comb
def check_metric(matrix):
dimension = matrix.shape[0]
metric = 0
for i in range(dimension):
for j in range(dimension):
for k in range(dimension):
if i == j or j == k or k == i:
continue
... |
<gh_stars>1-10
#!/usr/bin/env python
import numpy as np
import pandas as pd
import sys, os
import argparse as ap
import glob
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
import matplotlib.patches as mpatches
import matplotlib.lines as mlines
import matplotlib.gridspec as gridspec
import... |
print(__doc__)
# Authors: <NAME> <<EMAIL>>
# License: BSD
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
from sklearn import datasets
from sklearn.semi_supervised import label_propagation
from sklearn.metrics import classification_report, confusion_matrix
digits = datasets.l... |
import os
os.environ["THEANO_FLAGS"] = "device=gpu0,lib.cnmem=1"
import numpy as np
import scipy
import colorlog as log
import logging
from utils.model_monitor import ModelMonitor
from network.pixel_rnn import PixelRNN
from utils.visualization import save_network_graph, dynamic_image, save_grayscale_images_grid
lo... |
<filename>SNPerr/build/lib/SNPerr/snperr.py
import numpy as np
import scipy.stats as sp
import pandas as pd
from matplotlib import pyplot as plt
#pi,alt,adapted by @author: jcaleta
#shandiv concept @author: pbelange
######################################################################################################... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: jorgeh
# @Date: 2015-01-25 11:07:19
# @Last Modified by: jorgeh
# @Last Modified time: 2015-01-26 14:14:35
from scipy.io import loadmat
import numpy as np
import matplotlib.pyplot as plt
from pygrfnn.oscillator import Zparam
from pygrfnn.grfnn import GrFNN
... |
<filename>assignments/dhanushkanda/3/cookie.py
#!/usr/bin/env python3
import json
import os
from statistics import median
# Function to run the curl command on the terminal, create a new text file with the url name, and save the headers there.
def curl(url,file):
command = f"curl -ILsk {url}" # giving the comman... |
import pandas as pd
import numpy as np
from scipy.stats.mstats import winsorize
from scipy.stats import trim_mean
import matplotlib.pyplot as plt
my_dataset = pd.read_excel('Smith_glass_post_NYT_data.xlsx', sheet_name=1)
el = 'Pb'
my_sub_dataset = my_dataset[my_dataset.Epoch == 'three-b']
my_sub_dataset = my_sub_dat... |
<filename>pathfinder/pathfinder_analysis.py
import pickle
from tqdm import tqdm
import json
import timeit
import statistics
threshold = 0.17
PF_PATH = "../datasets/csqa_new/dev_rand_split.jsonl.statements.mcp.pf.cls.pruned.%s.pickle" % (str(threshold))
statement_json_file = "../datasets/csqa_new/dev_rand_split.jsonl.s... |
<reponame>Damseh/VascularGraph
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 5 11:03:31 2019
@author: rdamseh
"""
from VascGraph.Tools.CalcTools import *
from VascGraph.Skeletonize import BaseGraph
import scipy as sp
from scipy import sparse
class ContractGraph(BaseGraph):
de... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
import os.path
from scipy.misc import imread
import numpy as np
from PyQt4 import QtCore, QtGui, uic
from seam_carve import seam_carve
Ui_MainWindow, QtBaseClass = uic.loadUiType('./guiwindow.ui')
class Viewer(QtGui.QWidget):
def __init__(self, parent=None):
... |
# The MIT License (MIT)
#
# Copyright (C) 2016 - <NAME> <<EMAIL>>
#
# 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... |
<gh_stars>0
"""Align data with significant frequency drift
==============================================
Takes a 2D data set and applies proper phasing corrections followed by
aligning the data through a correlation routine.
"""
from pyspecdata import *
from pyspecProcScripts import *
from pylab import *
import symp... |
<filename>examples/case/example_simple.py<gh_stars>0
#!/usr/bin/env python
import dfl.dynamic_system
import dfl.dynamic_model as dm
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
m = 1.0
k11 = 0.2
k13 = 2.0
b1 = 3.0
class Plant1(dfl.dynamic_system.DFLDynamicPlant):
def __init_... |
<gh_stars>1-10
from __future__ import division
import matplotlib.pyplot as plt
import numpy as np
import os
from scipy.stats.kde import gaussian_kde
import sys
mydir = os.path.expanduser('~/GitHub/Emergence')
tools = os.path.expanduser(mydir + "/tools")
data = mydir + '/results/simulated_data/SAR-Data.csv'
def get_... |
<filename>jigsawpy/tools/meshutils.py
import numpy as np
from scipy.sparse import csr_matrix
from jigsawpy.tools.predicate import trivol2, trivol3
from jigsawpy.tools.orthoball import tribal2, tribal3
from jigsawpy.tools.scorecard import triscr2, triscr3
from jigsawpy.jig_t import jigsaw_jig_t
from jigsawpy.msh_t im... |
#============================================================
# LIGHT CURVE FUNCTION FOR GRB/SN/... etc.
# 2019.05.03. MADE BY <NAME>
#============================================================
import numpy as np
from astropy.io import ascii
import matplotlib.pyplot as plt
from astropy.time import Time
from scipy.opt... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import math
import pywt
import numpy as np
import pandas as pd
import scipy.ndimage
import scipy.stats as sts
from math import floor, log
from sklearn import preprocessing
from sklearn.utils import class_weight
from sklearn.feature_selection import chi2
from sklearn.feature... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.