sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
9a0032478b056538e625f3991a09c684ddbd51400989413be2ef39f1b26b02cf
Python
3,616
110
''' Author: Naiyuan liu Github: https://github.com/NNNNAI Date: 2021-11-23 17:03:58 LastEditors: Naiyuan liu LastEditTime: 2021-11-24 19:19:26 Description: ''' import cv2 import torch import fractions import numpy as np from PIL import Image import torch.nn.functional as F from torchvision import transforms from mode...
f481c99fbb8db97e78f8fac7d76c22eb6ea522f73155cac4e1b6169e9aeb1c29
Python
3,616
97
import os import sys from types import ModuleType from typing import Optional, Tuple import numpy as np from ..base import DatabaseBase, ALL, load_fids ######################################################################## class Database(DatabaseBase): """""" fids = load_fids(os.path.join(os.path.dirname(...
20a91db392af9d929b044e049844a24959d6e8c68420dc224d94962a19c6200f
Python
3,617
117
""" 2021/11/30 Plot comparisons of zv_recon_scale """ import os import numpy as np import pandas as pd from sklearn.decomposition import PCA import umap import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import seaborn as sns from sklearn.model_selection import StratifiedKFold from siVAE im...
c840177327c00fcf5e1cb8b3daa77b3d1803b58d2f9c816c6054f9e418ee2622
Python
3,618
101
#!/usr/bin/env python3 """ File: merge_results.py Created: 2020/07/09 Last Changed: Author: M.Vochteloo Copyright (C) 2020 M.Vochteloo This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundat...
e2623bc714267516af08a4ef44aae7114dd4c0fc8b9a06fac185a879297948d2
Python
3,619
104
# Copyright 2022 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
7b052d64481aee4ad12e78675b09b1b032aed086a6c087286a8cbb4b0d423739
Python
3,620
110
''' Author: Naiyuan liu Github: https://github.com/NNNNAI Date: 2021-11-23 17:03:58 LastEditors: Naiyuan liu LastEditTime: 2021-11-24 19:19:43 Description: ''' import cv2 import torch import fractions import numpy as np from PIL import Image import torch.nn.functional as F from torchvision import transforms from mode...
d901471e86b8624d10e8e5e3fcf31b146e3cd8475e929e6dc636685e4cdc322a
Python
3,621
109
#!/bin/python import os, shutil, sys, subprocess import datetime import argparse, zipfile, glob parser = argparse.ArgumentParser() parser.add_argument('--zip', action='store_true') parser.add_argument('--prune-torchlibs', action='store_true') args = parser.parse_args() os.environ['DO_NOT_RELOAD'] = 'true' from ba...
6e12ffbe078e22033ea2c83fbf08b784c2dfc5de34941b018e03e1789ee96876
Python
3,622
112
from __future__ import annotations import logging import os from typing import TYPE_CHECKING, Iterable, List from logging import Logger from palm_tools.data_structure.trackset import TrackSets from ..data_structure.trackset import TrackSet from abc import ABC, abstractmethod import json from tqdm import tqdm from tqdm...
5bf185c6e2557adf5b4994892105b3c2a5d562fe92080fecc056643c8207fb9f
Python
3,625
87
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Variational Animal Motion Embedding 1.0-alpha Toolbox © K. Luxem & P. Bauer, Department of Cellular Neuroscience Leibniz Institute for Neurobiology, Magdeburg, Germany https://github.com/LINCellularNeuroscience/VAME Licensed under GNU General Public License v3.0 """ ...
8afd8eeedd0c0e3bf9b5e42f75d8d123f6edf18347e0e009b9ce104842c58eb0
Python
3,626
104
import os.path as op import numpy as np import numpy.testing as npt import nibabel as nib import nibabel.tmpdirs as nbtmp from dipy.core.geometry import vector_norm import dipy.core.gradients as dpg import dipy.data as dpd from dipy.io.gradients import read_bvals_bvecs import AFQ.utils.models as ut from AFQ.models ...
92d432008ce3f618168145e0f7f181ef01b4cd4412ffb5eb544b27e277f933d3
Python
3,627
104
# coding=utf-8 # Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
aabc750457a82544c1dc4e6ef1381d3d8aa4c54ccbf0e4c49731ac3bdf45ff7c
Python
3,627
97
import tensorflow as tf from tensorflow.keras import backend as K import matplotlib matplotlib.use('agg') class RESNET: def __init__(self, input_shape, nb_classes, verbose=False, build=True, is_train=True): if build: self.model = self.build_model(input_shape, nb_classes, is_train) ...
4dfd58c72979f6ddf79b301cdb42996f57878746a6b08d2348a61bb03dfcec99
Python
3,628
93
# Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
747844b351d60348860b8be7f08abca27245f9303082e5cbced5c5cdf16cc756
Python
3,629
95
import torch from mmdet.core import bbox2result, bbox_mapping_back, multiclass_nms from ..builder import DETECTORS from .single_stage import SingleStageDetector @DETECTORS.register_module() class RepPointsDetector(SingleStageDetector): """RepPoints: Point Set Representation for Object Detection. This de...
18922f1fb266297fa748ca6381481eba6107f844db99680971312683b146e76b
Python
3,630
96
import numpy as np import scipy.ndimage as nd import torch import torch.nn as nn import torch.nn.functional as F from engine.logger import get_logger logger = get_logger() class SigmoidFocalLoss(nn.Module): def __init__(self, ignore_label, gamma=2.0, alpha=0.25, reduction='mean'): supe...
7266ffbf99da395d4670bb52df35626d3c1ee1486571f8ee36146a8b136c4359
Python
3,630
86
#! /usr/bin/env python # Copyright 2019 Ashish Arora # Apache 2.0. """This script splits a kaldi (text) file into per_speaker per_session reference (text) file""" import argparse def get_args(): parser = argparse.ArgumentParser( description="""This script splits a kaldi text file into per_sp...
a41908400aad46719c93f418914f3bc4e90beb1f215ac7313c141abd3985ae74
Python
3,630
106
""" Change CONFIG class which reflecting learning hyper parameter (etc., meta-prior, the number of neural units). The detail of CONFIG class was written in `config.py`. """ import time import os from datetime import datetime from config import ConfigSoftmax as CONFIG from analysis.analysis_tutorial import analyze_tut...
bb8e90ce20d70cf0129f39e7e8208d55774454e542aeeef7dd0e8310079f2664
Python
3,630
112
from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import sys import shlex # from python 3.3 source # https://github.com/python/cpython/blob/master/Lib/shutil.py def which(cmd, mode=os.F_OK | os.X_OK, path=None): """Given a command, mode, and a P...
1fa8ada8d4850968bb288757cec892a5efa8223d5e853181d76e928ed705a927
Python
3,632
113
import os import shutil # from libtiff import TIFF from scipy import misc import random import cv2 import numpy as np # def tif2png(_src_path, _dst_path): # """ # Usage: # formatting `tif/tiff` files to `jpg/png` files # :param _src_path: # :param _dst_path: # :return: # """ # tif ...
fe492195c2afed66a35d2a6bd37b4174570a4f2bbf39de5c3e742e8ab6265f63
Python
3,632
118
# Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
2511d9c37460b36e9545b89c9e3be1125d82bc55363cb428cdfcac4ae4f25feb
Python
3,633
103
from brainrender import Scene from brainrender.actors.streamlines import Streamlines import pandas as pd import json import glob import re from paper.figures import INSET # removes the scale bars? ### # a few parameters / options # a few parameters / options interValue = True saveScreen = True animalName = "CR_transe...
5c054a62cca62b2f60121dbedd10b6251611c86d64cc22e325838cf8eac5527a
Python
3,633
92
#!/usr/bin/env python #title :train.py #description :Network for MR-tod #author :Zifei Liang #date :2022/05/22 #usage :Network for Deep learing from MRI to TOD #python_version :3.6 # import sys # positionOfPath = 1 # # sys.path.insert(positionOfPath, 'R:\zhangj18lab\zhangj1...
aac9441c55da5ef405dd95d00e3f20d3d54d7d2591adfa9eca10afc8d20d1a8d
Python
3,633
112
import mne import evoked as erp import stats as st import numpy as np import GrandAverage as ga import matplotlib.pyplot as plt import sys import datetime import os import fnmatch import pandas as pd import fnmatch from mne.channels import find_ch_connectivity from scipy import stats from mne.stats import...
02c85f8e0b0d9215a82d77d8a9771d3ffeb5a546be4db07308c5d5fa3f6ac6ca
Python
3,634
124
import argparse import matplotlib.pyplot as plt import os import numpy as np import torch from tqdm import tqdm import pdb from sklearn import metrics from torch.autograd import Variable from loader import load_data from model import TripleMRNet def get_parser(): parser = argparse.ArgumentParser() parser.ad...
27de91eaf5367a0dea9064b1ef0120c23cae8209004f9115808ef9d39243b7c2
Python
3,634
85
import os from copy import deepcopy import argparse area_report = "report_area >> %/rpt/&_area.rpt\n" timing_report = "report_timing -path full >> %/rpt/&_timing.rpt\n" power_report = "report_power >> %/rpt/&_power.rpt\n" analyze = "analyze -format verilog {%/verilog_file/&.v}\n" elaborate = "elaborate &\n" ...
7168b327898f1c4b2c9bd7861594978cc91b89d79cdeb87c7f54970eceeea64f
Python
3,634
127
import numpy as np import pandas as pd import pymaid from mpl_toolkits.mplot3d.art3d import Poly3DCollection import navis volume_names = ["PS_Neuropil_manual"] def rgb2hex(r, g, b): r = int(255 * r) g = int(255 * g) b = int(255 * b) return "#{:02x}{:02x}{:02x}".format(r, g, b) def simple_plot_neur...
4147fc7af2867d5c77a467e9e396f2a3fa0885064a3396dc1252e184af68a77e
Python
3,635
93
# Copyright 2022 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
57d8f5d1e74827f776ee29d93d206e9d02071b8ea7cf15e7becfac5a879a8e5e
Python
3,635
67
# Copyright 2020-2022 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
115c3fba3c0a87dcaf6cce234cbd922da9156708b28d1fb892daeeac8ed4ba87
Python
3,637
149
# %% import matplotlib.pyplot as plt import numpy as np import seaborn as sns from src.data import load_maggot_graph from src.hierarchy import signal_flow from src.data import load_palette from src.io import savefig from pathlib import Path from src.visualization import set_theme set_theme() save_path = Path("ma...
455fb6bb3d17ebd7858dc448069577da20bbdab41b787c046b3175b4a013961d
Python
3,637
128
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import torch from .bounding_box import BoxList from maskrcnn_benchmark.layers import nms as _box_nms def boxlist_nms(boxlist, nms_thresh, max_proposals=-1, score_field="scores"): """ Performs non-maximum suppression on a boxlist, with s...
ec1ec75b53639391a2e81291bf71589ea4353db68cf01adfe952962e0ab76954
Python
3,637
103
__author__ = 'jieqing jiao' import numpy as np from . import kt import matplotlib.pyplot as plt from scipy.signal import convolve from scipy.interpolate import interp1d from scipy.io import savemat def make_basis(inputf1, dt, beta_lim=[10e-6, 10e-1], n_beta=128, beta_space='log', w=None, k2p=None, fig=False): ...
d851f8fa4f45d7e3537ff3adaca8f78f0bce799c9c80912dd73c1fd298d05549
Python
3,638
98
#! /usr/bin/env python # Copyright 2019 Vimal Manohar # Apache 2.0. """This script converts an RTTM with speaker info into kaldi utt2spk and segments""" import argparse def get_args(): parser = argparse.ArgumentParser( description="""This script converts an RTTM with speaker info into kaldi u...
e1fad94b061a0935fdc0b73b05a74862d30b07e8f4875c7a0070f7ffa5519a46
Python
3,640
129
import argparse import pickle import torch from torch import nn import numpy as np from scipy import linalg from tqdm import tqdm from model import Generator from calc_inception import load_patched_inception_v3 @torch.no_grad() def extract_feature_from_samples( generator, inception, truncation, truncation_laten...
ef762851a16befb5e98dbb78d1110ff0b2c5ec3c2be403123c0b78057bc57b1e
Python
3,640
76
import numpy as np from sklearn.linear_model import LinearRegression import warnings import pandas as pd from typing import Union from src.util import susi def approximate_filters(target_filters: str, source_filters: str, optical_system_parts=None, normalize: bool = True) -> np.ndarray: "...
14c5c41fb1488f6e3300898b02e3b13bd618a27bcf22701a7ccf823eeb483271
Python
3,641
113
# Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
b852aa820075d8d84e02110f2a4ad1692c2b8ca3ee987e7320ced78707f94f9a
Python
3,641
146
# -*- coding: utf-8 -*- """ Created on Tue Jul 20 18:47:06 2021 @author: N.V """ import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation from matplotlib.animation import FuncAnimation import os # note that this must be executed before 'import numba' os.environ['NUMBA_DISABLE_INTEL_...
22cac0d26b099f815067eb1d766c8bf6089e5bde04d988bc902078c66821859f
Python
3,644
100
#!/usr/bin/env python3 import sys def hex_to_decimal(utf8_string): assert(len(utf8_string) == 3) hex_dict = {} char_list = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"] value_list = [0, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] for key, value in zip (char_list, value_...
c846f7fc9545f4792738a250b7c3a41f628360929b2424e3f8e107d885eed864
Python
3,644
73
import os import pickle import shutil import torch import argparse import numpy as np from biopandas.pdb import PandasPdb from data.loader import expand_sh from data.process_label import generate_dist_diff, generate_lddt_score, generate_coords_transform from feature import create_basic_features, get_base2d_feature fr...
81449daf77ac4994d2387c87e5aca5df97d650c413394ceb4a1c6a6a1c239515
Python
3,645
71
########################################################### ## ccAF: scvelo_analysis.py ## ## ______ ______ __ __ ## ## /\ __ \ /\ ___\ /\ \/\ \ ## ## \ \ __ \ \ \___ \ \ \ \_\ \ ## ## \ \_\ \_\ \/\__...
d4f39afad6cee318520efcf3a3443b57ce0b6be3ed3f107001bac99d124182ef
Python
3,645
93
"""Fit a standard EEG montage to the MNI152 standard brain. If we don't have digitised electrode positions or a structural MRI, we can use a standard montage and a standard brain to source reconstruct EEG data. However, the electrodes of a standard montage don't sit on the scalp of the standard brain. The coregistrat...
297cbbc2f4b5a91114e42c31d1f4978ef7bae0b7179aa7407ded37fba3c23f1c
Python
3,647
108
import torch import torch.nn as nn from torch import Tensor from torch_geometric.nn import MessagePassing from typing import Tuple def extract_step(model: nn.Module, x: Tensor, edge_index: Tensor, detach: bool = True, forward_kwargs: dict = {}): '''Gets information about every layer in the graph Args: ...
3c33b212a28cdcff1b3f1ab4aa9f59247bf17e6ba66bdc506056f2bf8930ad95
Python
3,648
109
#!/usr/bin/python # -*- encoding: utf-8 -*- import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.model_zoo as modelzoo # from modules.bn import InPlaceABNSync as BatchNorm2d resnet18_url = 'https://download.pytorch.org/models/resnet18-5c106cde.pth' def conv3x3(in_planes, out_planes...
fd6907eb359d5b18d1e8c22ee34d3f8a926e18f6de124f858ebe6755ed756963
Python
3,648
124
__author__ = "Jianfeng Sun" __version__ = "v1.0" __copyright__ = "Copyright 2023" __license__ = "GPL v3.0" __email__ = "jianfeng.sunmt@gmail.com" __maintainer__ = "Jianfeng Sun" from typing import List, Union import re import pandas as pd from tmkit.util.Reader import Reader as greader from tmkit.util.Writer import...
851d59446c20d4c71dc5dfe0c59cbc4aa9267dfd2120b702129310b6751fe3ef
Python
3,650
134
# -*- coding: utf-8 -*- """ Created on Wed Feb 12 09:54:06 2020 @author: yokoyama """ from copy import deepcopy from numpy.matlib import repmat from numpy.random import randn, rand import numpy as np #%% ############################################################################## def Sigm(v): v0 = 6 vma...
f17a336d22683f538f7cee685bf139a3bd5091be96debe30eed3fbb114e17276
Python
3,650
54
"""Final doc images from a gallery capture dir: per-sensor webp + composite grid.""" import os, sys import numpy as np from PIL import Image, ImageDraw, ImageFont D, OUT = sys.argv[1], sys.argv[2]; os.makedirs(OUT, exist_ok=True) S = os.path.join(D, "out") FONT = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/Dej...
43201331833c10eb664a045430b61e33ba2454d74c54de415fe0f0ca3508007b
Python
3,651
98
#!/usr/bin/env python3 """ File: combine_network_output.py Created: 2020/05/19 Last Changed: Author: M.Vochteloo Copyright (C) 2020 M.Vochteloo This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Softwar...
68677f02f3fb7e925aa7375ab87522516689047837b5245c96d5d1fe61ce8d61
Python
3,653
92
# Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
464123226ce8e9d5fd10c3b2c2b84bb3b9522e75b66c0587b0d0e782bd1bf178
Python
3,654
132
import argparse import warnings from tqdm import tqdm import pandas as pd import torch import sys from moses.models_storage import ModelsStorage warnings.filterwarnings("ignore", category=UserWarning) def get_collate_fn(model): def create_tensors(string, device): regression_values = string[2:] ...
e52a31e9ea27b5613ea1d0928d35063947ef45cd110427274089d9c89d8a52ab
Python
3,655
102
from mmcv.cnn import build_conv_layer, build_norm_layer from torch import nn as nn class ResLayer(nn.Sequential): """ResLayer to build ResNet style backbone. Args: block (nn.Module): block used to build ResLayer. inplanes (int): inplanes of block. planes (int): planes of block. ...
1d87af9b640de74735873c72d39de60ac6c433b89e0a5836ae35315edbb7c068
Python
3,656
71
import unittest from pathlib import Path from oaklib.implementations.pronto.pronto_implementation import ProntoImplementation from oaklib.implementations.sparql.sparql_implementation import SparqlImplementation from oaklib.implementations.sqldb.sql_implementation import SqlImplementation from oaklib.resource import On...
5a8389511ed3eac13c9669f33927b9d689b897637c2c878d8106d08d2141c870
Python
3,659
122
import os from skimage import io, transform import torch import torchvision from torch.autograd import Variable import torch.nn as nn import torch.nn.functional as F from torch.utils.data import Dataset, DataLoader from torchvision import transforms#, utils # import torch.optim as optim import numpy as np from PIL imp...
fb6186d660023812f28034f0c33b1314b40210d14a33887b284eafabdfe4da4c
Python
3,661
126
import torch from torch.nn import Parameter import torch.nn.functional as F import torch.nn as nn from torch_scatter import scatter_add, scatter_mean from torch_geometric.utils import remove_self_loops, add_self_loops, softmax from torch_geometric.nn.inits import uniform from torch_geometric.nn import max_pool_x fro...
c515732300b4f4ba3f27cba91761049011e3b1ed5007b6e74884525d853833cc
Python
3,662
79
import functions_basic_sak as funsak import pandas as pd import os import inspect import AIS_interp import AIS_neighbors import AIS_parameters import AIS_trajectory import AIS_geopandas_tagging import AIS_numpy_tagging import AIS_loitering import AIS_description import re import numpy as np import datetim...
444cdf07bbc5c3227496b0aaecb2da21fe9002a2f906fe5f7599f2331c0bacb5
Python
3,663
98
#!/usr/bin/env python3 """ File: combine_network_output.py Created: 2020/05/19 Last Changed: 2022/02/10 Author: M.Vochteloo Copyright (C) 2020 M.Vochteloo This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the F...
d4b1e9a115fc4196dfd904e2ecfab304a4311ee79549170afef2ec905970fc74
Python
3,663
114
from __future__ import absolute_import from __future__ import division from __future__ import print_function import pickle import imageio import numpy as np import matplotlib.pyplot as plt from PIL import Image Image.MAX_IMAGE_PIXELS = 100000000000 ''' Fast Plotter for Large Images - Resamples Images to a target re...
822e5b000f33ae68852a096b94274079e72298a962da627f9eb4c94be53f81b4
Python
3,664
99
"""Capture rain transitions and late sensor creation on a running CARLA server. Example: python test_rain_runtime.py --port 4654 --town Town03_Opt --load This changes weather and spectator pose; --load also replaces the world. Inspect the saved images for falling streaks and lens droplets. API assertions check state a...
78d49aee4bbe38c3db8710504ed84a4bafaf8e2d0a528b45736b2d40e6d6b319
Python
3,665
122
import os import numpy as np import matplotlib.pyplot as plt def calc_dfc(y, half_window): nreg, nt = y.shape fc = np.zeros((nt, nreg, nreg)) for i in range(half_window, nt-half_window): fc[i] = np.corrcoef(y[:,i-half_window:i+half_window]) inds = np.triu_indices(nreg, k=1) fc = fc[:, ...
7a17543a04dd874b770dfb5a5b785074fc23c23749e8ae712429839a84f06547
Python
3,665
103
from typing import Tuple import torch from .correct_answer import _is_correct_output def sort_elemnts_by_another(base: any, for_sort: any): return torch.as_tensor([x for _, x in sorted(zip(base, for_sort))]) class SubgroupFinder: def __init__(self, dt: float = 1e-3) -> None: self._dt = dt ...
cb4996acdcd582ff146785b3405e27e7762c42aed3daf1a2f65165f63e216ca5
Python
3,666
93
import mne import numpy as np import matplotlib.pyplot as plt import sys import datetime import os import fnmatch import pandas as pd import fnmatch from mne.channels import find_ch_connectivity from scipy import stats from mne.stats import spatio_temporal_cluster_1samp_test from mne.viz import plot_topomap...
26616cc5dfddf8208e7c221fdf285fe121c3a2a9b0dd3798665a53649c10c9f7
Python
3,667
114
# Copyright 2022 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
a30f8f0db32af4dbab93f148293138ab9dbe69f0753a3a311b17743687f701f9
Python
3,667
145
__author__ = "Jianfeng Sun" __version__ = "v1.0" __copyright__ = "Copyright 2023" __license__ = "GPL v3.0" __email__ = "jianfeng.sunmt@gmail.com" __maintainer__ = "Jianfeng Sun" from typing import Dict import pandas as pd from pandas import DataFrame from tmkit.db.cath.Reader import Reader as cathreader def summar...
b85d3a20f29e1344a2e779a1ec5bd1a3466dcedd1f54e9ef7ac50cbfeb9ea772
Python
3,668
102
import torch import networkx as nx import numpy as np import matplotlib.pyplot as plt from torch_geometric.nn import GCNConv, GINConv, BatchNorm from graphxai.datasets.BA_shapes.ba_houses import BAHouses from sklearn.metrics import f1_score, accuracy_score, precision_score, recall_score from graphxai.gnn_models.node_...
3483698e09aeda552eab0f86853e8d3a69a9509fb40776020e719e92590f8579
Python
3,669
94
# Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
80a62b0e0cbf70c4ac11e9db3e276c27e7794469044131655568ccd571da1306
Python
3,669
84
"""Hybrid-render patch for nre-ga serve-grpc (prototype). Loaded through PYTHONPATH by the engine's compiled entry point. When ``nre.grpc.serve`` is imported, ``SensorSimService.render_rgb`` gains a second behaviour: a request whose ``image_quality`` equals the sentinel ``-7`` is rendered with the engine's internal ``...
7f872f74406692a997c5a02751ea82a8d89fe333646a68b1c012de648dda5969
Python
3,670
111
import torch import torch.nn as nn from neuralop.models import FNO class OTNO(FNO): """ Optimal Transport Neural Operator The architecture is described in [1]_. OTNO integrates optimal transport (OT) into operator learning for partial differential equations (PDEs) on complex geometries. Pa...
49c8b8c86a8aaa15d2d39bf0284dea7360b8b178337c5f937d954829df1d1d00
Python
3,671
104
# Copyright 2022 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
e32b5419ad287430f3e23e29b69e296ca13415edbe0b21611192aa6a95c2db76
Python
3,676
101
"""An in-memory sqlite index for simple associations.""" import logging import sqlite3 from collections import defaultdict from dataclasses import dataclass, field from typing import Any, Dict, Iterable, Iterator, List, Tuple from semsql.sqla.semsql import TermAssociation from sqlalchemy import Column, String, create...
0d719f6048c2393b328d4d0d135efe97a6908c31d10d97e602febe5e8004fc1b
Python
3,677
102
import os import math import glob import argparse parser = argparse.ArgumentParser(description='Create slurm jobs to call genotype on a genomicDB') parser.add_argument('genomicDB_dir', help='Directory that contains the merged gVCFs') parser.add_argument('jobs_dir', help='directory to write jobs to') parser.add_argum...
151b2beefcb5793a986bfe6c011485ca5c21ccbd96cc3873aeb57f2508d3aed1
Python
3,677
89
import os import argparse import random import warnings import math from shutil import copyfile, move from tqdm import tqdm import concurrent.futures import numpy as np def copy_file_fnc(s_d): s, d = s_d file_name = os.path.split(s)[-1] copyfile(s, os.path.join(d, file_name)) return int(os.path.exist...
9da3ee39df6cf6217598caec18ccf0261d137b25716f8c39539709e9cb70f7bb
Python
3,678
62
"""Walker skeleton projected on an RGB camera that follows it.""" import os, re, sys, queue, math import numpy as np, carla from PIL import Image, ImageDraw sys.path.insert(0, os.path.dirname(__file__)); import scene OUT = sys.argv[1]; os.makedirs(OUT, exist_ok=True) ROOT = os.environ.get("CARLA_ROOT", os.path.join(os....
16a8ca42dcaa97d2440ac801c34167d6af003c70a3135efd6079895593176b97
Python
3,679
88
# Copyright 2020-2022 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agre...
703efc64bc420d0fd389f74328728b483e10544285b0bb6d5460000e9b1a4d34
Python
3,681
112
import os, random import torch import numpy as np import torch.nn.functional as F #from tqdm import trange import matplotlib.pyplot as plt from torch_geometric.utils import sort_edge_index, to_undirected from graphxai.datasets import ShapeGGen from graphxai.datasets.load_synthetic import load_ShapeGGen def if_edge_ex...
fb72a8bc2703008ca2e410cbadd86cc7c4e627bf5c1bb8ba7436d2ab542df249
Python
3,682
86
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jan 25 11:12:36 2021 @author: paulmueller Run for each patient a calc script but bunch up the calculation be a set of datafiles to keep runs short """ import os import subprocess import numpy as np import glob def write_submit_file(cmd, time_in_sec, j...
545fb4076d94231e68fef466c767dff705124b0a4577cd2a597d922d598d7295
Python
3,683
97
import os import itertools import numpy as np import torch from torch import nn from .utilities import ReaderWriter class RNNHyperparamConfig: def __init__(self, embed_dim, z_dim, num_hidden_layers, bidirection, p_dropout, ...
f1cef8af67004d8df7139c90786fb49b46acb80c086023fafd4e7fde72eff58f
Python
3,683
85
import networkx as nx import numpy as np from scipy.interpolate import RegularGridInterpolator, LinearNDInterpolator def graph_to_ndarray(graph): out_nodes = np.empty((1, 3)) out_edges = np.empty((1, 3)) visited_nodes = list() visited_node_pairs = list() for (start_node, end_node) in graph.edges()...
061e744bbcded569996b8269c62fedf633701c70a36daafe3ce7cb6806a064d1
Python
3,687
139
import torch import torch.nn as nn import numpy as np class Flatten(torch.nn.Module): def forward(self, x): batch_size = x.shape[0] return x.view(batch_size, -1) class unFlatten2(torch.nn.Module): def forward(self, x): batch_size = x.shape[0] return x.view(batch_size, 1, 28, 2...
c4303c73766743630abcd5cabed5d91a75a91b16a46a9341456f4428da23490d
Python
3,689
129
"""Static analysis of Nottingham movie data. """ print("Setting up") import os import numpy as np from osl_dynamics.analysis import static from osl_dynamics.data import Data from osl_dynamics.utils import plotting from osl_dynamics.analysis import power, connectivity #%% Setup run = 1 #subjects_dir = '/well/woolri...
369bfa9f0bc89419e336843f49ced9efe9909e10ee45c00d48b518dce0c823eb
Python
3,691
100
"""Bounded native assembly probes, launched by test_callvar_assembly.py.""" from pathlib import Path import sys from MACS3.IO.PeakIO import PeakIO from MACS3.Signal import RACollection as module from MACS3.Signal.ReadAlignment import ReadAlignment def reference(n=400): x = 20261003 seq = bytearray() for...
8b541186086dc961c38a24380674e13728338d6bb8591d91b7881c443c20b6ea
Python
3,692
102
# Copyright 2021 DeepMind Technologies Limited # # 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 agr...
cd2e8ac46799c7fa9649f4ae17c24e18fc77047c80d20cad27cb40d4ea11e998
Python
3,692
81
import os import shutil import argparse parser = argparse.ArgumentParser() parser.add_argument('--dataset', type=str, required=True) parser.add_argument('--folds', type=int, default=1, required=False) args = parser.parse_args() original_imgs = f"./data/{args.dataset}/images" groundTruth_imgs = f"./data/{args.dataset}...
b0af9dd8292bc9b89462cf95273e3513ffedd8babaee693f1337a831f04d1d3f
Python
3,693
127
#!/usr/bin/env python3 """Tests for utils.""" from unittest.mock import patch import numpy as np import pytest from phys2cvr import utils # ## Unit tests @pytest.mark.parametrize( 'var, dtype, out', [ (10, 'int', 10), (10.0, 'int', 10), ('10', 'int', 10), ([10], 'int', 10),...
edc65c3f5cb42216a263dd484362ecc95f1eedcd95b8c5af7824914f7ea1df55
Python
3,694
79
# Copyright 2023 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
f6b8cd02d4717e8f4e1dc6fb98d89eeca624e1c9b60621e93f8398a0a7ff335e
Python
3,696
105
# Copyright 2020 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
81b7a055ece15d8216db114fe954a28ab641c3c0afea9648a1988ed3ebedc9f6
Python
3,697
114
# This script is part of navis (http://www.github.com/schlegelp/navis). # Copyright (C) 2018 Philipp Schlegel # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of...
be3379819a58bd15e3c90409b9760388ecbae49c51a84e25555375eaf79e24f0
Python
3,697
102
""" This file gets each voxel's corresponding searchlight voxel indices and outputs a matrix of num_voxels * searchlight_size Example run: python searchlight_get_indices.py -s 1 -m mask_path.npy -o output_path.npy -s : subject -m : cortical mask -c : path to table of coco proportions organized by images x coco label...
41633f342ed0a0d39861f1e9e389d4b89fb7faa63b1d4999dc52e56a3f7aee70
Python
3,698
85
"""Phase 3 tests: novel-odor probing pin-downs. The headline claim of the project is that the AIF agent produces a max-entropy DAN response on truly novel KC patterns while RPE has no such mechanism. These tests pin down that signature on the real larval connectome. """ import numpy as np from mb_dual_dan.connectome...
5feb1e07b02b2d2d83bcab44813b4629de5662f5150a64caed00d647716984fd
Python
3,699
120
from pathlib import Path import pytest from conftest import RESOURCES from ppqm import chembridge, gaussian, tasks from ppqm.utils import shell if shell.which(gaussian.G16_CMD) is None: pytest.skip("Skipped. Could not find Gaussian executable", allow_module_level=True) TEST_ENERGIES = [ ("O", -51.7615037201...
9ab0bc00dbc1fa4039fe522be332def985ee063a14c7d75f96e75114650de101
Python
3,699
125
import threading import numpy as np import pytest import torch from backend import jobs from backend import tracking_matcher def descriptors(count, offset=0): values = torch.arange( offset, offset + count * 4, dtype=torch.float32, ).reshape(count, 1, 2, 2) return values / max(flo...
deed5e49f666e80c567a12eae52c704a63bdcc7c46ace3a57fa95d77bd3d164d
Python
3,699
120
import unittest from linkml_runtime.linkml_model import EnumDefinition, SchemaDefinition from linkml_runtime.loaders import yaml_loader from oaklib.datamodels.value_set_configuration import ValueSetConfiguration from oaklib.utilities.subsets.value_set_expander import ValueSetExpander from tests import ( BACTERIA,...
73af9f3aedcf7dee762a962c388bd2ceb914d5a023a1f118c9c6407278909ce8
Python
3,703
110
import math import torch import torch.nn as nn from torch.autograd import Function from torch.autograd.function import once_differentiable from torch.nn.modules.utils import _pair from ..utils import ext_loader ext_module = ext_loader.load_ext( '_ext', ['masked_im2col_forward', 'masked_col2im_forward']) class ...
a578c83162d1b4f3a55358fab913ee5266e7dac8e4c31385309d98eed6d056e8
Python
3,703
118
import os.path from PIL import Image as PIL_Image import math from subprocess import call from charpragcap.utils.image_and_text_utils import vectorize_caption,valid_item,index_to_char,char_to_index,edit_region,get_img_from_id from charpragcap.utils.config import * print("rep_size",rep_size) if __name__ == "__main__":...
fe22f12cd416c4e1bdecb6a36d8b56b117ed270df24d3ae6a26e50e46bc708cf
Python
3,706
116
# %% import os try: os.chdir('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/') print(os.getcwd()) except: pass # %% import sys sys.path.append("/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/") import pandas as pd import numpy as np import connectome_tools.process_matrix as prom...
6cb098623c7791eb2cfee392d65edaad0061ac6dcc6bd868fe161e3e9ab320be
Python
3,707
136
#%% [markdown] ## gzipping a connectome # > A (perhaps silly) experiment running gzip on a connectome edgelist # # - toc: false # - badges: false # - categories: [pedigo, graspologic] # - hide: false # - search_exclude: false #%% import gzip # edgelist_loc = "maggot_models/data/processed/2020-09-23/G.edgelist" edgelis...
9dc3c6ae8137ad411953e246f890a9f7fa2a66cf43385e28de4733702bcbb9e4
Python
3,708
110
#!/usr/bin/env python # Copyright (c) 2026 Computer Vision Center (CVC) at the Universitat Autonoma de # Barcelona (UAB). # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. import argparse import sys import carla TRAFFIC_LIGHT_STATES = { 'Gree...
af54e76cd01a80a46f9196f27bb1fd3fa8d6837a8c82bea0426db662d2c20ef2
Python
3,708
128
import torch import wandb import sys from neuralop.training import setup, AdamW from neuralop import get_model from neuralop.utils import get_wandb_api_key from neuralop.losses.data_losses import LpLoss from neuralop.training.trainer import Trainer from neuralop.data.datasets import CarOTDataset, load_saved_ot, CFDData...
d23a8892a26baaaac7885bff91c032230e5bf49a1f333d92a858fd00b559e57c
Python
3,708
116
#Authors: Ceyao Zhang, Renjie Li, May 2022, CUHKSZ import numpy as np from gym.spaces import Box, Discrete import torch import torch.nn as nn from torch.distributions.normal import Normal from torch.distributions.categorical import Categorical def mlp(sizes, activation=nn.ReLU, output_activation=nn.Identity): la...
304b2839631325e5e59d1f9d40b6f0f926991c4dbc5dc5666edd3652be0deaab
Python
3,709
108
""" File: combine_eqtlprobes.py Created: 2020/10/08 Last Changed: 2020/10/13 Author: M.Vochteloo Copyright (C) 2020 M.Vochteloo This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, eith...
1ddc821045d3718007a02dd288efef9b40e69ac49cfa5ecc739edb89af1db27e
Python
3,710
81
# Parse TargetALS samplesheet to make molgenis-compute samplesheet import os.path import argparse parser = argparse.ArgumentParser(description='Make Molgenis Compute samplesheet for TargetALS.') parser.add_argument('samplesheet', help='TargetALS samplesheet') parser.add_argument('cram_dir', help='path to cram file dir...
7b2da7f53c1e25de3a64b409ea3548baaf7b1a1c99f9c8440cd72aafb61e5de2
Python
3,710
99
import matlab import numpy as np import sys import AIRLOCALIZE_N5 import n5_metadata_utils as n5mu def as_matlab(arr): try: np2matlabDict = { 'float64': matlab.double, 'float32': matlab.single, 'uint8': matlab.uint8, 'int8': matlab.int8, 'uint16...
e149b8daa006d88996a8ff1db7479397a61376931925853a4ea6f4004ba16706
Python
3,711
145
# %% [markdown] # # import os import colorcet as cc import matplotlib as mpl import matplotlib.pyplot as plt import networkx as nx import numpy as np import pandas as pd import seaborn as sns from scipy.stats import rankdata from sklearn.decomposition import PCA from graspy.plot import heatmap, pairplot from graspy...