repo
stringlengths
2
99
file
stringlengths
13
225
code
stringlengths
0
18.3M
file_length
int64
0
18.3M
avg_line_length
float64
0
1.36M
max_line_length
int64
0
4.26M
extension_type
stringclasses
1 value
brainiak
brainiak-master/tests/matnormal/test_matnormal_logp_conditional.py
import numpy as np from numpy.testing import assert_allclose from scipy.stats import wishart, multivariate_normal import tensorflow as tf from brainiak.matnormal.utils import rmn from brainiak.matnormal.matnormal_likelihoods import ( matnorm_logp_conditional_col, matnorm_logp_conditional_row, ) from brainiak.m...
2,215
27.050633
76
py
brainiak
brainiak-master/tests/matnormal/test_matnormal_regression.py
import pytest import numpy as np from scipy.stats import norm, wishart, pearsonr from brainiak.matnormal.covs import ( CovIdentity, CovUnconstrainedCholesky, CovUnconstrainedInvCholesky, CovDiagonal, ) from brainiak.matnormal.regression import MatnormalRegression from brainiak.matnormal.utils import rm...
4,328
26.05625
76
py
brainiak
brainiak-master/tests/matnormal/test_matnormal_utils.py
from brainiak.matnormal.utils import (pack_trainable_vars, unpack_trainable_vars, flatten_cholesky_unique, unflatten_cholesky_unique) import tensorflow as tf import numpy as np import numpy.testing as npt ...
1,059
35.551724
64
py
brainiak
brainiak-master/tests/matnormal/test_matnormal_rsa.py
from brainiak.matnormal.mnrsa import MNRSA from brainiak.utils.utils import cov2corr from brainiak.matnormal.covs import CovIdentity, CovDiagonal from scipy.stats import norm from brainiak.matnormal.utils import rmn import numpy as np def gen_U_nips2016_example(): n_C = 16 U = np.zeros([n_C, n_C]) U = np...
1,934
24.12987
75
py
brainiak
brainiak-master/tests/factoranalysis/test_htfa.py
# Copyright 2016 Intel Corporation # # 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...
5,283
30.266272
78
py
brainiak
brainiak-master/tests/factoranalysis/test_tfa.py
# Copyright 2016 Intel Corporation # # 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...
3,661
31.990991
75
py
brainiak
brainiak-master/tests/eventseg/test_event.py
from brainiak.eventseg.event import EventSegment from scipy.special import comb import numpy as np import pytest from sklearn.exceptions import NotFittedError def test_create_event_segmentation(): es = EventSegment(5) assert es, "Invalid EventSegment instance" def test_fit_shapes(): K = 5 V = 3 ...
6,744
32.063725
78
py
brainiak
brainiak-master/tests/fcma/test_mvpa_voxel_selection.py
# Copyright 2016 Intel Corporation # # 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...
1,972
34.872727
75
py
brainiak
brainiak-master/tests/fcma/test_util.py
# Copyright 2016 Intel Corporation # # 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...
2,131
34.533333
76
py
brainiak
brainiak-master/tests/fcma/test_classification.py
# Copyright 2016 Intel Corporation # # 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...
10,698
46.977578
79
py
brainiak
brainiak-master/tests/fcma/test_preprocessing.py
# Copyright 2016 Intel Corporation # # 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...
5,069
45.090909
79
py
brainiak
brainiak-master/tests/fcma/test_voxel_selection.py
# Copyright 2016 Intel Corporation # # 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...
4,790
38.595041
79
py
brainiak
brainiak-master/tests/funcalign/test_srm_distributed.py
# Copyright 2016 Intel Corporation # # 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...
5,271
32.794872
77
py
brainiak
brainiak-master/tests/funcalign/test_fastsrm.py
import os import tempfile import numpy as np import pytest from numpy.testing import assert_array_almost_equal from sklearn.exceptions import NotFittedError from brainiak.funcalign.fastsrm import ( FastSRM, _compute_and_save_corr_mat, _compute_and_save_subject_basis, _compute_basis_subject_online, _reduced_sp...
34,458
36.414767
79
py
brainiak
brainiak-master/tests/funcalign/test_rsrm.py
# Copyright 2016 Intel Corporation # # 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...
5,042
37.496183
78
py
brainiak
brainiak-master/tests/funcalign/test_srm.py
# Copyright 2016 Intel Corporation # # 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...
11,513
34.98125
79
py
brainiak
brainiak-master/tests/funcalign/test_sssrm.py
# Copyright 2016 Intel Corporation # # 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...
10,092
36.381481
79
py
brainiak
brainiak-master/tests/searchlight/test_searchlight.py
# Copyright 2016 Intel Corporation # # 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...
10,021
32.075908
75
py
brainiak
brainiak-master/tests/reprsimil/test_gbrsa.py
# Copyright 2016 Mingbo Cai, Princeton Neuroscience Instititute, # Princeton University # # 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...
27,071
41.903328
79
py
brainiak
brainiak-master/tests/reprsimil/test_brsa.py
# Copyright 2016 Mingbo Cai, Princeton Neuroscience Instititute, # Princeton University # # 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...
29,837
44.763804
79
py
brainiak
brainiak-master/tests/reconstruct/test_iem.py
# Copyright 2018 David Huberdeau & Peter Kok # # 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...
19,162
34.161468
77
py
brainiak
brainiak-master/tests/utils/test_fmrisim.py
# Copyright 2016 Intel Corporation # # 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...
37,943
40.514223
79
py
brainiak
brainiak-master/tests/utils/test_fmrisim_real_time.py
# Copyright 2016 Intel Corporation # # 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...
4,975
27.597701
77
py
brainiak
brainiak-master/tests/utils/test_utils.py
# Copyright 2016 Intel Corporation # # 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...
17,046
36.383772
79
py
brainiak
brainiak-master/tests/hyperparamopt/test_hpo.py
# Copyright 2016 Intel Corporation # # 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...
3,042
33.977011
78
py
brainiak
brainiak-master/docs/conf.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # toolkit documentation build configuration file, created by # sphinx-quickstart on Thu Mar 17 16:45:35 2016. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # au...
9,448
30.708054
79
py
DMGI
DMGI-master/main.py
import numpy as np np.random.seed(0) import torch torch.autograd.set_detect_anomaly(True) torch.manual_seed(0) torch.cuda.manual_seed_all(0) torch.backends.cudnn.deterministic = True torch.backends.cudnn.benchmark = False import argparse def parse_args(): # input arguments parser = argparse.ArgumentParser(desc...
2,131
33.95082
84
py
DMGI
DMGI-master/evaluate.py
import torch torch.manual_seed(0) torch.cuda.manual_seed_all(0) torch.backends.cudnn.deterministic = True torch.backends.cudnn.benchmark = False from models import LogReg import torch.nn as nn import numpy as np np.random.seed(0) from sklearn.metrics import f1_score from sklearn.cluster import KMeans from sklearn.metri...
4,571
34.71875
115
py
DMGI
DMGI-master/embedder.py
import time import numpy as np import torch from utils import process import torch.nn as nn from layers import AvgReadout class embedder: def __init__(self, args): args.batch_size = 1 args.sparse = True args.metapaths_list = args.metapaths.split(",") args.gpu_num_ = args.gpu_num ...
1,994
35.272727
108
py
DMGI
DMGI-master/models/logreg.py
import torch torch.manual_seed(0) torch.cuda.manual_seed_all(0) torch.backends.cudnn.deterministic = True torch.backends.cudnn.benchmark = False import torch.nn as nn import torch.nn.functional as F class LogReg(nn.Module): def __init__(self, ft_in, nb_classes): super(LogReg, self).__init__() self....
697
24.851852
56
py
DMGI
DMGI-master/models/DMGI.py
import torch torch.manual_seed(0) torch.cuda.manual_seed_all(0) torch.backends.cudnn.deterministic = True torch.backends.cudnn.benchmark = False import torch.nn as nn from embedder import embedder from layers import GCN, Discriminator, Attention import numpy as np np.random.seed(0) from evaluate import evaluate from mo...
5,373
34.826667
146
py
DMGI
DMGI-master/models/DGI.py
# Code based on https://github.com/PetarV-/DGI/blob/master/models/dgi.py import torch torch.manual_seed(0) torch.cuda.manual_seed_all(0) torch.backends.cudnn.deterministic = True torch.backends.cudnn.benchmark = False import torch.nn as nn from embedder import embedder from layers import GCN, Discriminator import numpy...
3,756
35.125
139
py
DMGI
DMGI-master/models/__init__.py
from .logreg import LogReg from .DMGI import DMGI from .DGI import DGI
71
17
26
py
DMGI
DMGI-master/layers/discriminator.py
import torch torch.manual_seed(0) torch.cuda.manual_seed_all(0) torch.backends.cudnn.deterministic = True torch.backends.cudnn.benchmark = False import torch.nn as nn class Discriminator(nn.Module): def __init__(self, n_h): super(Discriminator, self).__init__() self.f_k_bilinear = nn.Bilinear(n_h,...
1,143
30.777778
87
py
DMGI
DMGI-master/layers/readout.py
import torch torch.manual_seed(0) torch.cuda.manual_seed_all(0) torch.backends.cudnn.deterministic = True torch.backends.cudnn.benchmark = False import torch.nn as nn class AvgReadout(nn.Module): def __init__(self): super(AvgReadout, self).__init__() def forward(self, seq): return torch.mean(s...
326
24.153846
42
py
DMGI
DMGI-master/layers/gcn.py
import torch torch.manual_seed(0) torch.cuda.manual_seed_all(0) torch.backends.cudnn.deterministic = True torch.backends.cudnn.benchmark = False import torch.nn as nn import torch.nn.functional as F import pdb import math class GCN(nn.Module): def __init__(self, in_ft, out_ft, act, drop_prob, isBias=False): ...
2,239
28.473684
76
py
DMGI
DMGI-master/layers/__init__.py
from .gcn import GCN from .readout import AvgReadout from .discriminator import Discriminator from .attention import Attention
128
20.5
40
py
DMGI
DMGI-master/layers/attention.py
import torch.nn as nn import torch import torch.nn.functional as F class Attention(nn.Module): def __init__(self, args): super(Attention, self).__init__() self.args = args self.A = nn.ModuleList([nn.Linear(args.hid_units, 1) for _ in range(args.nb_graphs)]) self.weight_init() ...
1,865
37.875
114
py
DMGI
DMGI-master/utils/__init__.py
0
0
0
py
DMGI
DMGI-master/utils/process.py
import numpy as np import pickle as pkl import networkx as nx import scipy.sparse as sp import sys import torch import torch.nn as nn import scipy.io as sio import pdb def load_data_dblp(args): dataset = args.dataset metapaths = args.metapaths_list sc = args.sc if dataset == 'acm': data = sio....
8,988
33.178707
110
py
DMGI
DMGI-master/data/preprocess_dblp.py
import pdb import sys from nltk.corpus import stopwords import re import numpy as np import pandas as pd import pickle as pkl import pdb import sys from nltk.corpus import stopwords import re import time num_train = int(sys.argv[1]) raw_data_filename = 'dblp.txt' top_confs = ['icml','aaai','ijcai','sigkdd','internat...
14,440
36.028205
267
py
EEND
EEND-main/eend/infer.py
#!/usr/bin/env python3 # Copyright 2019 Hitachi, Ltd. (author: Yusuke Fujita) # Copyright 2022 Brno University of Technology (author: Federico Landini) # Licensed under the MIT license. from backend.models import ( average_checkpoints, get_model, ) from common_utils.diarization_dataset import KaldiDiarization...
10,400
37.098901
79
py
EEND
EEND-main/eend/train.py
#!/usr/bin/env python3 # Copyright 2019 Hitachi, Ltd. (author: Yusuke Fujita) # Copyright 2022 Brno University of Technology (authors: Federico Landini) # Licensed under the MIT license. from backend.models import ( average_checkpoints, get_model, load_checkpoint, pad_labels, pad_sequence, sa...
13,614
39.885886
79
py
EEND
EEND-main/eend/backend/losses.py
#!/usr/bin/env python3 # Copyright 2019 Hitachi, Ltd. (author: Yusuke Fujita) # Copyright 2022 Brno University of Technology (authors: Federico Landini, Lukas Burget, Mireia Diez) # Copyright 2022 AUDIAS Universidad Autonoma de Madrid (author: Alicia Lozano-Diez) # Licensed under the MIT license. from itertools impor...
3,481
43.641026
101
py
EEND
EEND-main/eend/backend/updater.py
#!/usr/bin/env python3 # Copyright 2022 Brno University of Technology (author: Federico Landini) # Licensed under the MIT license. import torch.optim as optim from torch.nn import Module from types import SimpleNamespace from typing import Any, Dict class NoamOpt: "Optim wrapper that implements rate." def _...
2,593
30.253012
79
py
EEND
EEND-main/eend/backend/models.py
#!/usr/bin/env python3 # Copyright 2019 Hitachi, Ltd. (author: Yusuke Fujita) # Copyright 2022 Brno University of Technology (author: Federico Landini) # Licensed under the MIT license. from os.path import isfile, join from backend.losses import ( pit_loss_multispk, vad_loss, ) from backend.updater import ( ...
18,812
33.519266
79
py
EEND
EEND-main/eend/backend/__init__.py
0
0
0
py
EEND
EEND-main/eend/common_utils/features.py
#!/usr/bin/env python3 # Copyright 2019 Hitachi, Ltd. (author: Yusuke Fujita) # Copyright 2022 Brno University of Technology (author: Federico Landini) # Licensed under the MIT license. from common_utils.kaldi_data import KaldiData from typing import Callable, Tuple import numpy as np import librosa def get_labeled...
5,743
31.089385
78
py
EEND
EEND-main/eend/common_utils/kaldi_data.py
#!/usr/bin/env python3 # Copyright 2019 Hitachi, Ltd. (author: Yusuke Fujita) # Copyright 2022 Brno University of Technology (author: Federico Landini) # Licensed under the MIT license. # This library provides utilities for kaldi-style data directory. import io import numpy as np import os import soundfile as sf im...
3,928
30.685484
78
py
EEND
EEND-main/eend/common_utils/diarization_dataset.py
#!/usr/bin/env python3 # Copyright 2019 Hitachi, Ltd. (author: Yusuke Fujita) # Copyright 2022 Brno University of Technology (author: Federico Landini) # Licensed under the MIT license. import common_utils.features as features import common_utils.kaldi_data as kaldi_data import numpy as np import torch from typing im...
3,895
31.739496
76
py
EEND
EEND-main/eend/common_utils/gpu_utils.py
#!/usr/bin/env python3 # Copyright 2022 Brno University of Technology (author: Federico Landini) # Licensed under the MIT license. from safe_gpu import safe_gpu def use_single_gpu(gpus_qty: int) -> safe_gpu.GPUOwner: assert gpus_qty < 2, "Multi-GPU still not available." gpu_owner = safe_gpu.GPUOwner(nb_gpus...
352
26.153846
73
py
EEND
EEND-main/eend/common_utils/metrics.py
#!/usr/bin/env python3 # Copyright 2022 Brno University of Technology (author: Federico Landini, Mireia Diez) # Licensed under the MIT license. from typing import Dict import torch def calculate_metrics( target: torch.Tensor, decisions: torch.Tensor, threshold: float = 0.5, round_digits: int = 2, ) ...
4,438
36.940171
128
py
ICWS2021-quantum-classical-microservices
ICWS2021-quantum-classical-microservices-main/utils_tsp.py
# imports import numpy as np import networkx as nx import dimod import dwave_networkx as dnx # helper function to compute distance from route def get_distance(route, data): """ find distance for given route = [0, 4, 3, 1, 2] and original data """ # get the total distance without return total_dist ...
4,549
33.469697
96
py
ICWS2021-quantum-classical-microservices
ICWS2021-quantum-classical-microservices-main/api/main.py
from flask import Flask, request, jsonify, send_file from flask_cors import CORS from gate import * from annealing import * gate_machines_arn= { "riggeti_aspen8":"arn:aws:braket:::device/qpu/rigetti/Aspen-8", "riggeti_aspen9":"arn:aws:braket:::device/qpu/rigetti/Aspen-9", "ionq":"arn:a...
2,787
27.742268
127
py
ICWS2021-quantum-classical-microservices
ICWS2021-quantum-classical-microservices-main/api/annealing.py
import boto3 from braket.aws import AwsDevice from braket.ocean_plugin import BraketSampler, BraketDWaveSampler import numpy as np import networkx as nx import dimod import dwave_networkx as dnx from dimod.binary_quadratic_model import BinaryQuadraticModel from dwave.system.composites import EmbeddingComposite import...
3,019
26.962963
101
py
ICWS2021-quantum-classical-microservices
ICWS2021-quantum-classical-microservices-main/api/utils_tsp.py
# imports import numpy as np import networkx as nx import dimod import dwave_networkx as dnx # helper function to compute distance from route def get_distance(route, data): """ find distance for given route = [0, 4, 3, 1, 2] and original data """ # get the total distance without return total_dist ...
3,506
32.721154
96
py
ICWS2021-quantum-classical-microservices
ICWS2021-quantum-classical-microservices-main/api/gate.py
import time import math # AWS imports: Import Braket SDK modules import boto3 from braket.circuits import Circuit, Gate, Observable from braket.devices import LocalSimulator from braket.aws import AwsDevice n_ancilla = 6 n_eigenvector = 8 def recover_task_result(task_load): # recover task sleep_times = 0 ...
4,822
33.205674
96
py
strees
strees-master/charge.py
import sys import os, os.path from optparse import OptionParser from matplotlib.colors import LogNorm from numpy import * import h5py try: import pylab except ImportError: pass X, Y, Z = 0, 1, 2 def main(): parser = OptionParser() parser.add_option("--show", dest="show", action="store_true", ...
2,129
23.204545
72
py
strees
strees-master/grow_tree.py
""" grow_tree.py is the main module of the code and the one you invoke from the command line to start a simulation. To start a simulation with parameters read from a file simulation.ini simply invoke this module as:: python grow_tree.py simulation.ini The output will be written in a file name simulation.h5 with ...
13,725
28.32906
82
py
strees
strees-master/tree.py
""" This module contains the data representation for the structure of trees. Note that we separate the structure of the branched tree from its realization, that would contain things such as charges, positions, etc. that evolve even when the structure is fixed. """ from random import random as uniform from scipy.sparse ...
11,005
26.722922
80
py
strees
strees-master/refinement.py
""" This module implement the structure of oct-trees for the implementation of the Fast Multipolar Method (FMM). . note:: Most of this code is not used, since we disabled the use of the FMM for the simulations reported in the paper. However, the simulated tree is embedded in a bounding box defined by a :class...
14,659
29.541667
80
py
strees
strees-master/solve_tree.py
import hotshot, hotshot.stats import time from numpy import * import pylab from matplotlib import cm import tree import mpolar from refinement import Box def main(): p = 5 k = 50000 t0 = time.time() tr = tree.random_branching_tree(k, 0.05) r = tree.sample_endpoints(tr) r0 = amin(r...
2,010
19.731959
66
py
strees
strees-master/relax_tree.py
import time from numpy import * from scipy.sparse import lil_matrix, csr_matrix from scipy.integrate import odeint, ode import pylab from matplotlib import cm from mpl_toolkits.mplot3d import Axes3D import tree import mpolar from refinement import Box def main(): p = 5 k = 5000 tr = tree.random_branchi...
4,196
23.982143
75
py
strees
strees-master/datafile.py
""" This module contains the code to save/retrieve the state of a simulation. """ import sys import time from contextlib import closing from numpy import * import h5py from tree import Tree class DataFile(object): """ Class to store and retrieve simulation data. """ def __init__(self, fname, parameters): ...
2,051
26.72973
80
py
strees
strees-master/errors.py
""" Calculation of the errors in solveing the potential and dq/dt. """ from numpy import * from numpy.linalg import norm import h5py import pylab from refinement import Box, containing_box import mpolar import datafile from plotter import plot_projections, bounding_box def main(): from optparse import OptionPars...
2,418
29.2375
73
py
strees
strees-master/expand.py
import sys from readinput import expand_input import parameters def main(): for ifile in sys.argv[1:]: expand_input(ifile, parameters) if __name__ == '__main__': main()
191
11.8
39
py
strees
strees-master/readinput.py
""" This is an auxiliary module for reading input .ini files. It is based on Python's stdlib `ConfigParser <http://docs.python.org/2/library/configparser.html/>`_ This module also provides functionality for setting run sets where one or more of the parameters run over a list of values. """ import os, os.path, socket...
5,485
26.707071
80
py
strees
strees-master/electrodes.py
""" Implementation of electrode geometries with the image charge method. """ from numpy import * X, Y, Z = 0, 1, 2 class Electrode(object): def __init__(self): pass def images(self, r, q): """ Calculates the images of charges q located at points r. Returns rimag, qimag. """ r...
1,946
23.037037
75
py
strees
strees-master/cst.py
""" Implementation of the charge simulation technique. """ import sys from numpy import * import pylab import h5py from scipy.sparse.linalg import LinearOperator, bicgstab, bicg, gmres from refinement import Box, containing_box import mpolar from plotter import bounding_box, plot_projections def paraboloid(a, ztip,...
2,745
26.46
79
py
strees
strees-master/contexttimer.py
""" Using the with keyword to time code snippets. """ from contextlib import contextmanager import time import sys # @contextmanager # def ContextTimer(name="Unknown", outf=sys.stdout): # t0 = time.time() # outf.write("[%s ..." % name) # outf.flush() # yield # t1 = time.time() # outf.wr...
1,093
18.535714
69
py
strees
strees-master/parameters.py
""" This is the parameter description file. Basically it provides a namespace where we store a function per input parameter. Each function receives a string and is responsible for converting to the appropriate type, checking for allowed values. The docstring of the function is a description of the parameter. """ fr...
3,918
22.467066
102
py
strees
strees-master/angles.py
""" Calculation of the branching angles of a tree. """ from numpy import * from numpy.linalg import norm import h5py import datafile def branching_angles(tr, r, **kwargs): """ Returns an array with the branching angles of the tree. """ ibranch = tr.branches() angles = zeros(ibranch.shape) for i...
3,313
28.070175
80
py
strees
strees-master/plotter.py
import sys import os, os.path from optparse import OptionParser from matplotlib.colors import LogNorm import matplotlib as mpl import scipy.constants as co from scipy.stats import scoreatpercentile from numpy import * import h5py import datafile import cmaps try: import pylab from mpl_toolkits.mplot3d import ...
11,230
28.555263
82
py
strees
strees-master/cmaps.py
from matplotlib.colors import Colormap import matplotlib.cm as cm import matplotlib.colors as colors from numpy import where def get_colormap(cmap, dynamic=False): """ If cmap is not None, sets the colormap by te specified string""" cmaps = {'hot': cm.hot, 'autumn': cm.autumn, 'bone...
6,305
34.426966
97
py
strees
strees-master/branch.py
""" Extract the shape of a branch. Mostly useful in single-branch simulations.""" from numpy import * from numpy.linalg import norm from scipy.optimize import curve_fit import h5py import pylab import datafile def extract_branch(tr, r, **kwargs): """ an array with the distances between segments in the two branc...
2,815
22.864407
80
py
strees
strees-master/submit.py
""" A python script to submit to the qsub queue. """ import sys import os from optparse import OptionParser from subprocess import call DEF_QUEUE = 'exe-x86_64' def encode_envlist(d): return ','.join('%s=%s' % (key, item) for key, item in d.iteritems()) def submit(ifile, queue, onlyprint=False): mypath = o...
2,385
26.744186
86
py
strees
strees-master/propagation.py
import sys import os, os.path from optparse import OptionParser from matplotlib.colors import LogNorm from numpy import * import h5py try: import pylab except ImportError: pass def main(): parser = OptionParser() parser.add_option("--show", dest="show", action="store_true", he...
2,028
19.917526
72
py
strees
strees-master/list.py
import sys import os, os.path from optparse import OptionParser from numpy import * import h5py def main(): parser = OptionParser() (opts, args) = parser.parse_args() for fname in args: fp = h5py.File(fname, "r") main = fp['main'] run_name = main.attrs['run_name'] steps ...
664
19.78125
69
py
strees
strees-master/src/setup.py
#! /usr/bin/python import distutils.sysconfig from distutils.core import setup, Extension import numpy as np numod = Extension('mpolar', sources = ['mpolarmod.c'], extra_objects = ['misc.o', 'multipol.o', 'efield.o'], include_dirs = [np.get_include(), ...
599
29
71
py
strees
strees-master/doc/conf.py
# -*- coding: utf-8 -*- # # strees documentation build configuration file, created by # sphinx-quickstart on Thu Jun 13 15:04:29 2013. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All ...
7,832
30.971429
80
py
COAT
COAT-main/engine.py
# This file is part of COAT, and is distributed under the # OSI-approved BSD 3-Clause License. See top-level LICENSE file or # https://github.com/Kitware/COAT/blob/master/LICENSE for details. import math import sys from copy import deepcopy import torch from torch.nn.utils import clip_grad_norm_ from tqdm import tqdm...
7,288
39.494444
124
py
COAT
COAT-main/defaults.py
# This file is part of COAT, and is distributed under the # OSI-approved BSD 3-Clause License. See top-level LICENSE file or # https://github.com/Kitware/COAT/blob/master/LICENSE for details. from yacs.config import CfgNode as CN _C = CN() # -------------------------------------------------------- # # ...
7,923
35.018182
141
py
COAT
COAT-main/eval_func.py
# This file is part of COAT, and is distributed under the # OSI-approved BSD 3-Clause License. See top-level LICENSE file or # https://github.com/Kitware/COAT/blob/master/LICENSE for details. import os.path as osp import numpy as np from scipy.io import loadmat from sklearn.metrics import average_precision_score from...
18,670
37.182004
98
py
COAT
COAT-main/train.py
# This file is part of COAT, and is distributed under the # OSI-approved BSD 3-Clause License. See top-level LICENSE file or # https://github.com/Kitware/COAT/blob/master/LICENSE for details. import argparse import datetime import os.path as osp import time import torch import torch.utils.data from datasets import b...
5,228
32.735484
128
py
COAT
COAT-main/models/resnet.py
# This file is part of COAT, and is distributed under the # OSI-approved BSD 3-Clause License. See top-level LICENSE file or # https://github.com/Kitware/COAT/blob/master/LICENSE for details. from collections import OrderedDict import torch.nn.functional as F import torchvision from torch import nn class Backbone(nn....
1,800
32.351852
88
py
COAT
COAT-main/models/transformer.py
# This file is part of COAT, and is distributed under the # OSI-approved BSD 3-Clause License. See top-level LICENSE file or # https://github.com/Kitware/COAT/blob/master/LICENSE for details. import math import random from functools import reduce import torch import torch.nn as nn import torch.nn.functional as F from ...
10,997
35.538206
135
py
COAT
COAT-main/models/coat.py
# This file is part of COAT, and is distributed under the # OSI-approved BSD 3-Clause License. See top-level LICENSE file or # https://github.com/Kitware/COAT/blob/master/LICENSE for details. from copy import deepcopy import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import init from tor...
32,368
41.25718
153
py
COAT
COAT-main/datasets/base.py
# This file is part of COAT, and is distributed under the # OSI-approved BSD 3-Clause License. See top-level LICENSE file or # https://github.com/Kitware/COAT/blob/master/LICENSE for details. import torch from PIL import Image class BaseDataset: """ Base class of person search dataset. """ def __init...
1,559
35.27907
89
py
COAT
COAT-main/datasets/prw.py
# This file is part of COAT, and is distributed under the # OSI-approved BSD 3-Clause License. See top-level LICENSE file or # https://github.com/Kitware/COAT/blob/master/LICENSE for details. import os.path as osp import re import numpy as np from scipy.io import loadmat from .base import BaseDataset class PRW(Bas...
3,413
33.836735
85
py
COAT
COAT-main/datasets/cuhk_sysu.py
# This file is part of COAT, and is distributed under the # OSI-approved BSD 3-Clause License. See top-level LICENSE file or # https://github.com/Kitware/COAT/blob/master/LICENSE for details. import os.path as osp import numpy as np from scipy.io import loadmat from .base import BaseDataset class CUHKSYSU(BaseDataset...
5,228
41.860656
96
py
COAT
COAT-main/datasets/__init__.py
# This file is part of COAT, and is distributed under the # OSI-approved BSD 3-Clause License. See top-level LICENSE file or # https://github.com/Kitware/COAT/blob/master/LICENSE for details. from .build import build_test_loader, build_train_loader
250
40.833333
66
py
COAT
COAT-main/datasets/build.py
# This file is part of COAT, and is distributed under the # OSI-approved BSD 3-Clause License. See top-level LICENSE file or # https://github.com/Kitware/COAT/blob/master/LICENSE for details. import torch from utils.transforms import build_transforms from utils.utils import create_small_table from .cuhk_sysu import CU...
3,537
32.695238
94
py
COAT
COAT-main/loss/softmax_loss.py
# This file is part of COAT, and is distributed under the # OSI-approved BSD 3-Clause License. See top-level LICENSE file or # https://github.com/Kitware/COAT/blob/master/LICENSE for details. import torch from torch import nn import torch.nn.functional as F class SoftmaxLoss(nn.Module): def __init__(self, cfg): ...
2,087
32.142857
98
py
COAT
COAT-main/loss/oim.py
# This file is part of COAT, and is distributed under the # OSI-approved BSD 3-Clause License. See top-level LICENSE file or # https://github.com/Kitware/COAT/blob/master/LICENSE for details. import torch import torch.nn.functional as F from torch import autograd, nn class OIM(autograd.Function): @staticmethod ...
2,848
36
97
py
COAT
COAT-main/utils/utils.py
# This file is part of COAT, and is distributed under the # OSI-approved BSD 3-Clause License. See top-level LICENSE file or # https://github.com/Kitware/COAT/blob/master/LICENSE for details. import datetime import errno import json import os import os.path as osp import pickle import random import time from collectio...
13,088
28.951945
99
py
COAT
COAT-main/utils/km.py
# This file is part of COAT, and is distributed under the # OSI-approved BSD 3-Clause License. See top-level LICENSE file or # https://github.com/Kitware/COAT/blob/master/LICENSE for details. import random import numpy as np zero_threshold = 0.00000001 class KMNode(object): def __init__(self, id, exception=0, ma...
4,297
27.463576
90
py
COAT
COAT-main/utils/mask.py
# This file is part of COAT, and is distributed under the # OSI-approved BSD 3-Clause License. See top-level LICENSE file or # https://github.com/Kitware/COAT/blob/master/LICENSE for details. import random import torch class exchange_token: def __init__(self): pass def __call__(self, features, mask_b...
11,890
35.47546
148
py
COAT
COAT-main/utils/transforms.py
# This file is part of COAT, and is distributed under the # OSI-approved BSD 3-Clause License. See top-level LICENSE file or # https://github.com/Kitware/COAT/blob/master/LICENSE for details. import random import math import torch import numpy as np from copy import deepcopy from torchvision.transforms import function...
4,443
29.648276
130
py
keras
keras-master/keras/backend_config.py
# Copyright 2019 The TensorFlow Authors. 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 # # Unless required by applica...
4,297
27.091503
80
py
keras
keras-master/keras/metrics_confusion_matrix_test.py
# Copyright 2016 The TensorFlow Authors. 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 # # Unless required by applica...
79,387
40.827187
80
py