sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
b83285d3c59836391041c06851e36277991f47af7b51ba81e8d2e23ca86eb9a2
Python
9,056
325
import functools import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.utils import spectral_norm ### single layers def conv2d(*args, **kwargs): return spectral_norm(nn.Conv2d(*args, **kwargs)) def convTranspose2d(*args, **kwargs): return spectral_norm(nn.ConvTranspose2d(*args, ...
98c5e07cd33e7eef8c6beab2aed443421c57c7c5dacc3ed99c86bdf2717c6f80
Python
9,058
272
#!/usr/bin/env python # Given a fasta file of reads-of-insert, qsub N trimPrimers jobs, each # of which will process a subset of the file. Combine the outpts when # all are done. import os import sys import optparse import re # regular expressions import datetime from tt_log import logger VERSION = '20150403...
d09a05536e84397cd2546567db428c5e5055bc08784119880ec5f57d14bac543
Python
9,060
298
from __future__ import absolute_import from __future__ import division from __future__ import print_function from model.utils.config import cfg from model.faster_rcnn.faster_rcnn import _fasterRCNN import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable import math impor...
6dd7052a2fc93aad6869d838d82fcece3f63e999e1059f70656d5490dbbfe9c1
Python
9,069
294
import matplotlib.pyplot as plt import numpy as np from scipy.signal import fftconvolve def intrinsic_reliability(traces, window_width=8, dt=0.1): """Compute the intrinsic reliability using Kistler window. """ rect_size_i = 2 * int(float(window_width) / dt) rect = np.ones(rect_size_i) spk_pairs...
d52b993141fd3c670725e3220bc0347fc3dbbc1f0e3c5865de6fd23712901e76
Python
9,069
156
import os, sys currentdir = os.path.dirname(os.path.realpath(__file__)) parentdir = os.path.dirname(currentdir) sys.path.append(parentdir) # PYTHON > 3.3 does not allow relative referencing import h5py from tqdm import tqdm from functools import partial import numpy as np from scipy.spatial.distance import euclidean ...
a91d26960d90866fc79f086519ed4f5c2cc133552383d2521708aad74f11ea96
Python
9,077
209
""" Forcekits (new in polychrom) ---------------------------- The goal of the forcekits is two-fold. First, sometimes communication between forces is required. Since explicit is better than implicit, according to The Zen of Python, we are trying to avoid communication between forces using hidden variables (as done in ...
03d1923a3967a81fc859162235fff9ef6c0d05ebc9a60efc0f2c072b3ca733b6
Python
9,081
211
# 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...
8b0b1ffa50de25c7afc62dc3431e0dea4e526922c0dccad133604fe4076f31a5
Python
9,081
370
# Generic import numpy as np # Scipy from scipy import linalg def triu(M): m = M.shape[0] r = np.arange(m) mask = r[:, None] < r return M[mask] def gmm_intersection_matrix(y_pred, y, include_all=False, **params): """Compute the GMM intersection area matrix. .. note: At the moment all distri...
388511477388d0fc7fec6f9f94e54f2a3d5732f3dcfc796e9853c78c5b8c9d2c
Python
9,083
203
import mne import numpy as np import matplotlib.pyplot as plt import os if protocol == 'WORDS': import config_WORDS as cfg if protocol == 'PP': import config_PP as cfg ## logging info ### import logging from datetime import datetime logname = './logs/' + datetime.now().strftime('log_%Y-%m-%...
e5c31927818e581de1e2b95906847ad16be0259ebe5d6a8eb34c6ac7a0263207
Python
9,089
241
""" File: perform_deconvolution.py Created: 2020/10/08 Last Changed: 2021/12/07 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, e...
c93ba160835f0ea0a89bc60f0b8671d57076a36efb1eb4c57dec2d3aef1c9191
Python
9,090
328
import os import numpy as np import nibabel as nib from numpy.testing import ( assert_array_equal, assert_equal, assert_raises, assert_almost_equal, ) from bruker2nifti._utils import ( indians_file_parser, normalise_b_vect, data_corrector, eliminate_consecutive_duplicates, compute...
f78925f102f3990d9c23a8a86f81e46ce2b34b0bb45c05622e39ff0b7a27a5ac
Python
9,090
220
import cv2 from aicspylibczi import CziFile from pathlib import Path from os.path import dirname, realpath, join import pickle import numpy as np import colorsys from .uuuuuu import hex2rgb # czi_path = '~/Work/Kavli/Data/HERBS_DATA/abraham/Pecorino_mec_slide_1.czi' class CZIReader(object): def __init__(self, cz...
3349ae076835f3207cc180b18deb028a896a2263b6184fa445f150a00ec1cd9f
Python
9,093
219
# 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...
317f0d8f3e20b0caed42a99903b8cb7348e6278469c6aa7275e3db1574bfbcf2
Python
9,095
193
# Modified from https://github.com/facebookresearch/detectron2/tree/master/projects/PointRend # noqa import torch import torch.nn.functional as F from mmcv.ops import point_sample, rel_roi_point_to_rel_img_point from mmdet.core import bbox2roi, bbox_mapping, merge_aug_masks from .. import builder from ..builder impo...
8f9e1de7b2ac788d0ade2be02d114994e853d25fc144bee33f6b48804920ac66
Python
9,097
328
# -*- coding: utf-8 -*- import matplotlib.pyplot as plt import networkx as nx import numpy as np import seaborn as sns from sklearn import metrics from .utils import two_array_to_edges_set def plot_ratios_curve(ratios, label=None, diag_line=True, grid=True, tight_layout=True, xlabel='Normalized...
c5f4391257f8aeca1c5f7cc3fbad73f341d89c8cef7268ce527a4021839f88d4
Python
9,098
242
# 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...
30f4caadb69e63a5815a22e8f5234690713001eb86942fd53f312686979a02ed
Python
9,099
248
"""Parser for GAF/HPOA and related association formats""" import logging import re from dataclasses import dataclass, field from typing import Dict, Iterator, List, Optional, TextIO, Union from oaklib.datamodels.association import ( Association, NegatedAssociation, ParserConfiguration, PropertyValue, ...
e603d7720ffccb493215ab816e7dd50556f46f00fe2547e97558b10062847a6e
Python
9,099
261
__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, List, Union import warnings import pandas as pd from Bio import BiopythonWarning from tmkit.sequence.PDB import P...
162875180a55f01f5586cc918513d45f2e8896ccc77a34a42a641790b3d5d19d
Python
9,102
301
# Code written by: Maksim Imakaev (imakaev@mit.edu) """ This file contains a bunch of method to work on contact maps of a Hi-C data. """ from __future__ import absolute_import, division, print_function, unicode_literals import sys import warnings import numpy as np from polychrom.polymer_analyses import calculate...
a118cf8a804e72e8efa757c5c1aaa97356b6dc40324aafa9bd8776285fa3ce74
Python
9,102
237
import torch.nn as nn from torch.nn import Parameter import torch.nn.functional as F import torch from torch import Tensor from torch.optim.optimizer import Optimizer, required from torch.autograd import Variable from torchvision import models from collections import namedtuple from .Inpaint_base_model import * class...
d2188d0a5088ba8c48c8d83d5039b8b9dac9d55bf5090807babedddbdb054850
Python
9,105
257
import torch import torch.nn as nn from mol_tree import Vocab, MolTree, MolTreeNode from nnutils import create_var, GRU from chemutils import enum_assemble import copy MAX_NB = 8 MAX_DECODE_LEN = 100 class Motif_Generation_bfs(nn.Module): def __init__(self, vocab, hidden_size, device): super(Motif_Gener...
4824844090eba16168d2d6035b0b1321bbb2d50d9ec6cb40f5c3a00f9fd76da8
Python
9,106
235
from pathlib import Path from timeit import default_timer from typing import List, Union import numpy as np # import open3d for io if built. Otherwise, # the class will build, but no files will be loaded. try: import open3d as o3d o3d_warn = False except ModuleNotFoundError: o3d_warn = True try: imp...
408db4952ac003d9cc9a7a98c572773cbefcfa0df8e219628b06ed4ef15490f5
Python
9,107
208
import numpy as np import pandas as pd import scanpy.api as sc import anndata import bbknn import os from scipy import sparse import pickle from multiprocessing import Pool from sklearn.metrics import auc, roc_curve import sys from read_pickle_data import * sc.settings.verbosity = 3 # verbosity: errors (0), warnings ...
636e76b8f433e6a2056554e680b246ef8563b1db96a49908d7f60b52cfcd2560
Python
9,109
265
# -------------------------------------------------------- # Fast R-CNN # Copyright (c) 2015 Microsoft # Licensed under The MIT License [see LICENSE for details] # Written by Ross Girshick and Xinlei Chen # -------------------------------------------------------- from __future__ import absolute_import from __future__ i...
85c406eda0200f73babc90c828cd9652c54692ede24e1db18ce74cfb06e9e9ba
Python
9,110
239
#!/usr/bin/env python # Copyright 2016 Johns Hopkins University (Author: Matthew Wiesner) # Apache 2.0 # ======= Prepare dictionary directory (e.g. data/local) from lexicon.txt ===== # This script takes a valid kaldi format lexicon (lexicon.txt) as input and # from it creates the rest of the files in the dictionary d...
1a4c80f43a3a50fd1fbeca22268558172949e6c99273ccc35246e64f204bbb5f
Python
9,113
229
#!/usr/bin/env python3 """ File: create_cf_correlation_heatmap.py Created: 2022/01/25 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...
d20ac8175c53e57c73537350f85ca76192ed2876284583b1982a4f1d490ffc49
Python
9,113
253
# 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...
ebc2d0f19880f3d4cdab767dd41138f7c1c1dabf37f88a7ac75254bd86079d54
Python
9,113
280
#%% [markdown] # # Larval *Drosophila melanogaster* brain connectome # # Recently, authors mapped a connectome of a *Drosophila melanogaster* larva. This # synaptic wiring diagram is comprised of 3,013 neurons and over 544,000 # synapses. Importantly, this work yielded a complete reconstruction of both the left # and r...
97aa174d6c98a47862c244982ffef48728be1492e6dce50a117fcf1e670a1bec
Python
9,115
303
""" <Script to read Nifty data and corresponding labels in CSV file, and save data as binary file> Copyright (C) <2019> <Cecilia Ostertag> 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...
c982a1a0af98247ff2d12077761b4cdf451a777c259e330d1f15cd11718b6e4a
Python
9,117
261
import logging from abc import ABC from dataclasses import dataclass, field from enum import Enum from typing import Dict, List, Tuple, Iterable, Union, Iterator, Optional, Any from oaklib.interfaces.basic_ontology_interface import BasicOntologyInterface, RELATIONSHIP_MAP, RELATIONSHIP from oaklib.types import CURIE, ...
1534cb2c2d7ef6d52cd68cd2125f3287618385547bb5901d97b7da3b8ada53e5
Python
9,120
196
#!/usr/bin/env python3 """Read and change a running CARLA server's WorldSettings, then verify. Commands: show print the current WorldSettings (+ derived fps) sync --fps 20 enable synchronous mode at a fixed step sync --delta 0.05 same, giving the step d...
4c378125ee9b20be3dde9c8bdab9cd677140b834edbd25b0b1620ef46f66213b
Python
9,120
228
#!/usr/bin/env python3 """ File: simple_cell_fraction_gene_correlations.py Created: 2021/02/02 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 ...
0703cf168fe08110bfde32807503d3ea4b93edfb48ef88b7ecf291ac55ad6116
Python
9,123
258
# 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...
0b44142eef35bac51f0f45914129a31d0932716a74c4b730c078f5cb6c83555b
Python
9,128
254
# Built-in from typing import Any # Third-party import brian2 as b2 from brian2.units import * # Local import cxsystem2.neurodynlib.neuron_models as nd """ This module is a stub. It contains placeholders for multicompartment neuron models. """ class LeakyCompartment(nd.PointNeuron): """ Not implemented! ...
7223f50129a96e501e0635642577996dca6e2c5006fa2933c9a37f02ad213512
Python
9,131
346
#!/usr/bin/env python3 """ I/O and related utils. Attributes ---------- EXT_1D : list List of supported TXT/1D file extensions, in lower case. EXT_MAT : list List of supported matlab file extensions, in lower case. EXT_ARRAY : list List of supported 1D and 2D array-like file extensions, in lower case. EXT_...
b40ba40da8bd41f3dcf07d7b396d836bee0fd5bac498831d8db349cc7f6e048d
Python
9,139
215
""" File: gene_network_decomposition.py Created: 2020-04-30 Last Changed: 2021-01-08 Author(s): H.H.Wiersma Code to create distribution plot and a mask image used in the research plan Copyright (C) 2019 H.H.Wiersma This program is free software: you can redistribute it and/or modify it under the terms...
d7ee578eb4f759381946c6e71c2e3f1548cda7c562426d4219cd1afb7342ab2b
Python
9,144
239
import sys import time import random import numpy as np import scipy.spatial as sp import matplotlib.pyplot as plt from voronoiUtilities import * class Voronoi: def __init__(self, Nx, Ny, shape, notchWidth, lamda, seed=1): """ Nx,Ny: number of points along each dim notchWidth: number of mi...
630c611027447f1817b6da30d78f571e6a0a7710524c259cd9a297c9ed3bf461
Python
9,148
325
import sys import pandas as pd import numpy as np import os from itertools import groupby import utils.general_utils as general_utils import utils.plot_utils as plot_utils import utils.plot_setting as plot_setting import utils.math_utils as math_utils import utils.sync_utils as sync_utils import utils.list_twoP_exp a...
1722e5331b6286857e15537a9abb3dbd2ef3b90bb602eb27fb19428c1b89e6e3
Python
9,149
257
#!/usr/bin/env python3 """ File: visualise_cell_fractions.py Created: 2020/11/24 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 Softwa...
2e2c06275af93aed846c2072c37d9ad246f57489176db289cdd02da56d11c715
Python
9,152
280
import torch # Original implementation: # https://github.com/warmspringwinds/pytorch-segmentation-detection/blob/master/pytorch_segmentation_detection/utils/flops_benchmark.py # ---- Public functions def comp_multadds(model, input_size=(3,224,224), magnitude='M', half=False): assert magnitude in ['K', 'M', 'B'] ...
e0b62998b5f72443e14f175d624d92e2d49be1693369bd99fc0d696ae8f98432
Python
9,161
226
import os from os.path import join import numpy as np import pandas as pd from collections import OrderedDict from itertools import chain from sklearn.model_selection import train_test_split from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import ShuffleSplit from sklearn.model_selectio...
d1d1062854cc049627cea6ee710e4505bae8aa89810755595bd88ab3e00d4db4
Python
9,162
249
from __future__ import annotations from qtpy.QtWidgets import ( QDialog, QLabel, QVBoxLayout, QHBoxLayout, QPushButton, QStyle, QTreeWidget, QTreeWidgetItem, ) from qtpy import QtCore import logging from magicgui.widgets import LineEdit from .image_pipeline import ImagePipeline class ...
24aa173d690e1cc4b5eba2b12e63751eac451777cf3a932640cc12bca3649d2f
Python
9,166
204
#!/usr/bin/env python3 """ File: create_psychencode_idlinks.py Created: 2021/10/08 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 Sof...
8c53bcef678a0b8bc74af61bd8b0d0646451591625c869d81dc151257efe2172
Python
9,167
232
# 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...
9b36128cbd5299e9eda8c500266c445be0c49746fde9b7ea66b3e65ac8607237
Python
9,168
259
import logging import os import os.path as osp import time from collections import OrderedDict import numpy as np import torch from torch.utils import model_zoo import torch.distributed as dist import mmcv from mmcv.runner.utils import get_dist_info from tools.multadds_count import comp_multadds_fw def set_data_pat...
6e0bca113af77f78f2d93911c3896312c057def49493248ff95192897ab138be
Python
9,171
206
# Copyright (c) 2016, Konstantinos Kamnitsas # All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the BSD license. See the accompanying LICENSE file # or read the terms at https://opensource.org/licenses/BSD-3-Clause. from __future__ import absolute_im...
94958add42aae048c20cdeab683b99231c1bf4150c063c25573913d97121df30
Python
9,173
237
#!/usr/bin/env python3 # encoding: utf-8 # @Time : 2018/10/3 下午1:45 # @Author : yuchangqian # @Contact : changqian_yu@163.com # @File : syncbn.py.py """Synchronized Cross-GPU Batch Normalization Module""" import collections import threading import torch from torch.nn.modules.batchnorm import _BatchNorm from to...
1d5c875407d634d26f2318ff189d5574d9e7868fcd0bb33e88e6e30f47fa7384
Python
9,176
291
from __future__ import absolute_import, division, print_function, unicode_literals import copy import json import logging from collections import OrderedDict from . import ( fbnet_builder as mbuilder, fbnet_modeldef as modeldef, ) import torch.nn as nn from . import fpn as fpn_module from maskrcnn_benchmark.m...
bece587edd6225c4d1b8a23653db1fec02de2e30754627cf69938e9f1bc82258
Python
9,181
252
import numpy as np import tensorflow as tf import pathlib import json from datetime import datetime from mip.get_nn import get_nn import time from multiprocessing import Pool import os from helper.misc import infer_and_accuracy, clear_print, printProgressBar from helper.misc import extract_params, get_weighted_mean_bou...
fe5110644dc0b1435d14755b42790d660b9de9126b6649fec39722e9c3eec4c7
Python
9,183
219
""" File: create_deconvolution_matrices.py Created: 2020/04/07 Last Changed: 2020/07/15 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 Found...
6dffaa67d1b9bdb10e1081bf03720b4a4f0f39ee875e34ce53a0b2dab7edd8c6
Python
9,186
319
# %% [markdown] # ## import os import time import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from matplotlib.patches import Circle from mpl_toolkits.axes_grid1 import make_axes_locatable from mpl_toolkits.mplot3d.art3d import Poly3DCollection from sci...
077ff0ef08474d8a2a8fed8b32c3a993d147788c11bdc5a558d3cad5c5df4cfc
Python
9,187
205
from modules.parameters import ParameterSet, ParameterSpace, extract_nestvalid_dict from modules.input_architect import EncodingLayer from modules.net_architect import Network from modules.io import set_storage_locations from modules.signals import iterate_obj_list from modules.analysis import single_neuron_dcresponse ...
67b1d558e52db7c1b7b37534ea160b526eb3fad7e2e924488a0525e5a68a586c
Python
9,187
256
from __future__ import division from future import standard_library standard_library.install_aliases() from builtins import zip from builtins import range from builtins import object from past.utils import old_div # Unit tests for sima/motion/_hmm.py # Tests follow conventions for NumPy/SciPy avialble at # https://gith...
50d3f826acd0667ed9d1ab51a04a8e5eead9163506d6613f0d4bd76f77164563
Python
9,190
358
__author__ = "Jianfeng Sun" __version__ = "v1.0" __copyright__ = "Copyright 2023" __license__ = "GPL v3.0" __email__ = "jianfeng.sunmt@gmail.com" __maintainer__ = "Jianfeng Sun" from typing import Any, Dict, Tuple import pandas as pd from tmkit.property.HelixSurface import HelixSurface as hs def generate_helix_su...
24fb9b76d1f029e6c1297d989bed2c032d9d2afe5ffffb36fe1781d8520f8bea
Python
9,191
275
from collections import namedtuple import numpy as np import pandas as pd from graspologic.utils import remove_loops from scipy.stats import combine_pvalues from statsmodels.stats.multitest import multipletests from .binomial import binom_2samp, binom_2samp_paired from .utils import compute_density # from .combine i...
8388435ef436ad9658cf7c1a2815c8af90b5b2a8cd106f64828549d59e75d4ec
Python
9,191
247
# Copyright 2020 Google Research. 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 applicable law...
db395b303fabbc38c40309a11fdfa105316993410c6bbd1accef3e20986ba0e3
Python
9,192
188
# # Copyright (c) 2018 Institute for Basic Science # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge...
eb1254857a22201d9b7e363bf71280ab452e3f815f5b9db115c8031e6a8ad5ff
Python
9,192
286
import argparse import yaml from model.dataloader import TripletData from model.model import PairModel, TripletModel, TripletGraphModel import os import torch.utils.data as Data import torch import random import numpy as np import pandas as pd from tqdm import tqdm import sys, os def build_dataset(cfg, train=1): ...
b542cf04fc7677e9fd2ccfb9abd6337d8584b7cb1ac0d8ff20295075b5042bdb
Python
9,194
218
# 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...
f3f428107adabbe9dbfeda39972cde458b43a1d233f74cd53a2cc7e599f35503
Python
9,194
217
"""Command line client logic for postprocessing Finnish parliament data.""" import json import re from datetime import date from logging import Logger from pathlib import Path from typing import Any from typing import Dict from typing import List from typing import Optional from typing import Tuple import pandas as pd...
dd9db9484cfab8f1091ed6da15c27be2986138f60da9d254623cab28742320fd
Python
9,195
223
# basic imports import numpy as np import pickle import matplotlib.pyplot as plt def count_points(replays: list, width: int, height: int, bin_size=1) -> np.ndarray: ''' This function counts how often replays start in a given area of the environment. Parameters ---------- replays : ...
59be13e047518d8632105d1dbee2fa940eb0580262b2048c601078c270c6eb60
Python
9,198
203
#%% import os import sys try: os.chdir('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/') sys.path.append('/Volumes/GoogleDrive/My Drive/python_code/maggot_models/') sys.path.append('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/') except: pass from pymaid_creds import url, nam...
3e976fbc9d39468d71b1e64b70a1702b16fd797b43b1caa879c6a80dd55fb778
Python
9,206
204
#################################################################################################### # Copyright (c) 2019 - 2021, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of VessMorphoVis <https://github.com/BlueBrain/VessMorphoVis> # # This program is free ...
741846e94aad3a342c4f4144552037e46a9b77fcfb226979983c2af7a28b30b5
Python
9,207
321
from matplotlib import pyplot as plt from matplotlib import patches as mpatches from matplotlib import lines as mlines from matplotlib.legend_handler import HandlerLine2D, HandlerTuple import numpy as np def panels( w,pf,pm,r, my_xlims = [0,200], my_xticks = [0,50,100,150,200], dm...
0f92057bc1809e6b46036e311b2af1c20cf7aa8e18c9d3148126e70e69c9c5ca
Python
9,210
335
#import packages import networkx as nx import pandas as pd import torch import torch.nn as nn import torch.nn.functional as F import numpy as np from pytorchtools import EarlyStopping from scipy import spatial from scipy.spatial import cKDTree import scipy.sparse as sp import time import json from networkx.readwrite...
e8583b33d9ca80e92c8cc577db00343d7445fab154a2487b3e848c32bb421535
Python
9,216
234
import json import numpy as np import matplotlib as mpl mpl.use('Agg') import seaborn as sns import matplotlib.pyplot as plt import sklearn.metrics import os from IPython.core.debugger import set_trace """ parse_json_tmscore_rocauc.py: Compute the ROC AUC values for MaSIF-ligand and ProBiS Pablo Gainza - LPDI STI EP...
2e661f20964e037fecba97e48c52002c3f42da9ba7abe99c16b747c28e336e03
Python
9,220
294
import os import pika from multiprocessing.pool import ThreadPool import threading import pickle from functools import partial from typing import Tuple from queue import Queue import time from abc import ABCMeta,abstractmethod import sys sys.setrecursionlimit(100000) import functools import termcolor import datetim...
d75d60248e1409391443a1d7b36e23c0f3efb345dbd74a19932ce200cd066a4f
Python
9,221
361
# %% [markdown] # ## import os import warnings from itertools import chain import matplotlib as mpl import matplotlib.gridspec as gridspec import matplotlib.pyplot as plt import matplotlib.transforms as transforms import numpy as np import pandas as pd import seaborn as sns from joblib import Parallel, delayed from sc...
6fa7632ba2097008862bea7272e2af81a953750f1a5d9862ef398e27686a2eb9
Python
9,222
302
import os import cv2 import json import logging import numpy as np from heapq import heappushpop, heappop from shutil import rmtree import torch from ..rl.genotypes import OP_NAMES, AGG_NAMES def load_ckpt(ckpt_path, ckpt_dict): logger = logging.getLogger("maskrcnn_benchmark.nas.helpers") best_val = epoch_...
29249cd3e3d180bf0b04274ba869c4d48d861ce9b970c04d22593d974a5adfce
Python
9,224
203
# Copyright 2020-21 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...
f0f9dccea4b6f071d7dc03e87c3bd49016e7400551995188e3224327033b29b6
Python
9,230
240
# -*- coding: utf-8 -*- """ Created on Mon Dec 6 23:35:24 2021 @author: Fuyuki Asano """ import glob import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib.ticker as ticker import sys import os from scipy import signal import csv import math import statistics import scipy #mac #p...
3b4eba5a03d6c7571a930704abfbe24ebe88d29fad8f80b98ce967a1105cdbf6
Python
9,233
318
import os import operator from collections import Counter import numpy as np from scipy import sparse as sp from scipy.sparse import csgraph from scipy.spatial import cKDTree from meshparty import trimesh_io import networkx as nx import h5py from . import ngl MESHMETA = trimesh_io.MeshMeta() MITOMESHDIR = "data/mit...
5c86313a5077feb59bab2a10248c834ee4ff15b523bb4ec7793bf069b630775f
Python
9,234
201
import tensorflow as tf from tensorflow import keras from tensorflow.keras.layers import LSTM, Dense, Dropout, Activation, SimpleRNN, Bidirectional, Flatten, BatchNormalization, AvgPool1D from tensorflow.keras.layers import Conv2D, MaxPool2D,Reshape import numpy as np def Model_acp(): # left model: Conv + cha...
13b730a3f0af6c165e308f7ff79ee14aeac872aa8682506d1369086850aa8c6f
Python
9,235
312
from napari import Viewer from napari.qt import thread_worker import os from .processing import ImagePipeline from .processing.steps import * from qtpy.QtWidgets import ( QDialog, QErrorMessage, QLineEdit, QPushButton, QWidget, QVBoxLayout, QHBoxLayout, QLabel, ) from qtpy.QtCore import...
ed78c78639472360eb54bacb33a2ef3f7ba8f7f2c087d69233c907a1fafe0485
Python
9,236
252
"""``Capture`` honours the ``aovs`` tuple literally. ``semantic`` writes ``semantic_<camera>.mp4`` (CityScapes palette, the source ``--mask-classes`` needs) and ``instance`` writes the instance-coloured ``seg_<camera>.mp4``; asking for both gives both, from two sensors, frame for frame. The CARLA sensors are faked — ...
11a9acaea22a3f341f0a0309871fc3e81bd8a7d629d7ba7853b3ee90de61b77c
Python
9,246
228
# 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...
17e455a34351a886ac0b9f86181424f34a0c6fc4a38789d33ac07df88d7830de
Python
9,248
277
import numpy as np from scipy.stats import gamma import nibabel from scipy.stats import zscore from scipy import signal # for detrending from scipy.ndimage import gaussian_filter # for smoothing from numpy.linalg import pinv from scipy import stats from scipy.stats import t as tdistribution def hrf_convolve(X, hrf)...
cd81a9344f7e5c8a7afe671b1c8b8eb4cade96980f6c510567854dd1d3fa6eca
Python
9,249
291
import torch import torch.utils.data from torch import nn from torch.nn import functional as F import numpy as np import argparse class ModelFactory: @staticmethod def create(args): if args.n_layers == 1: if args.gating == "manual": return Gatednet(args) elif ar...
c7370d5f8f9413560ae74c20e543c4d9fe85087bf82f7b292569ee6f032723b5
Python
9,254
192
"""Shared torchrun rank supervisor (``cosmos_workers.common.ranks``) with the fake engines on CPU. The multi-rank cases launch two real ``torchrun`` ranks that rendezvous over gloo; they need torch in the test interpreter (the model venvs have it; a bare API venv does not -> skipped with the reason). """ from __futur...
bddfa9909e5527ffa908c10a90e959247b98b360fe2b47669268366a361c7f4b
Python
9,255
288
''' Created by: Zhiqing Guo Institutions: Hunan University Email: guozhiqing@hnu.edu.cn Copyright (c) 2020 ''' import torch import torch.nn as nn import math import torch.utils.model_zoo as model_zoo import torch.nn.functional as F __all__ = ['ResNet', 'resnet18_mta', 'resnet34_mta', 'resnet50_mta', 'resnet101_mta', ...
ccd927355abade3177753f4252fb6a972ebef592a7ab54148df0eb2b068f4671
Python
9,257
192
import math from pathlib import Path import cv2 import numpy as np from .saveFilesC import saveFilesC class positiveStrideC: def __init__(self): super().__init__() def positiveStride(self): acceptance_boolean, overlapping_percentage = ( self.check_if_lesions_and_gland_mask_over...
ddb7c34d3244c0257da1da39f265b21e77e722e0bbe38291a35f2568cc738cee
Python
9,257
200
# basic imports import os import pickle import numpy as np import matplotlib.pyplot as plt def count_pairs(replays: list) -> (list, list, list): ''' This function counts the number of forward, reverse and unordered replay pairs. Parameters ---------- replays : A list...
5b76d57457bf5ad7d7c04ea2b939cf50d762381ac4e2578ffc6848cc1f5e8964
Python
9,266
196
import numpy as np from nipype import Workflow, Node, MapNode, IdentityInterface from nipype.interfaces.fsl import maths, BET, MCFLIRT, FLIRT, ApplyXFM, ImageMaths, Smooth from qipype.fitting import LtzWaterMT, LtzWaterMTSim, LtzAmNOE from qipype.commands import ZSpec from qipype.utils import PCA, Select def prep(zfr...
0941fa791d1fa0e24fc4da62982cb4f661f8ecb1649c091f96428af8093bcb57
Python
9,268
218
import os from bruker2nifti._utils import bruker_read_files from bruker2nifti._getters import get_list_scans, get_subject_name from bruker2nifti._cores import scan2struct, write_struct class Bruker2Nifti(object): """ Facade to collect users preferences on the conversion and accessing the core methods for the...
e5c1b4e69e6cbfbbea9ef2a85ffe5e953193208bebc3c7ba96dac41a7cb79bf5
Python
9,274
275
# Built-in import json import pickle import re import zlib from pathlib import Path from typing import Any import brian2.units as b2u # Third-party import numpy as np class SpikeData: def __init__(self, filename: str | Path) -> None: self.data_filename = filename self.filename_stem = Path(file...
a7b69db47b6df51d62dcc85d8b68da938236cf16e222a16f14c3d09abf3b605d
Python
9,277
234
from torch_geometric.loader import DataLoader from typing import Tuple import torch import torch.nn as nn import random import numpy as np import matplotlib.pyplot as plt from sklearn import metrics import pandas as pd import os class TargetSelectTransform(object): def __init__(self, target_id=0): ...
f8b281e16cdfd723e7f57144a51b735132d501aaa65cf83708239f52dfc2038f
Python
9,278
287
''' @author: Mahbub Ul Alam (mahbub@dsv.su.se) @version: 1.0+ @copyright: Copyright (c) Mahbub Ul Alam (mahbub@dsv.su.se) @license : MIT License ''' import numpy as np import pickle from torch.utils.data import WeightedRandomSampler, DataLoader, TensorDataset import pandas as pd import torch def load_train_...
c4974fe611cec4436c082c6b4aaae5dd1919f9ab5daeceac960109a60e6832a1
Python
9,281
216
import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import ConvModule, xavier_init from mmdet.core import auto_fp16 from ..builder import NECKS @NECKS.register_module() class FPN(nn.Module): r"""Feature Pyramid Network. This is an implementation of paper `Feature Pyramid Networks for Object ...
06e30f01551fc3d0d1d31bcb7934a5fbb01a47ac0db88626260096c398dd09cd
Python
9,282
277
''' Information about cell folders This is only useful for data with old formats, except cell_orientation. ''' import os import re import datetime from clampy import * import yaml import numpy as np __all__ = ['read_lab_notes', 'is_PIV', 'protocol', 'protocols', 'stimulus_time', 'protocol_description', 're...
9aa7c1195094df5ba10a6b3552fec0ccc52c72f5e92e75410f7aa4eb07c3a9a2
Python
9,282
216
import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import ConvModule, xavier_init from mmcv.runner import auto_fp16 from ..builder import NECKS @NECKS.register_module() class FPN(nn.Module): r"""Feature Pyramid Network. This is an implementation of paper `Feature Pyramid Networks for Object...
b7abdcae287546455917ffa83c3f2daea90397da8d32e5c66afba3eb123c011e
Python
9,288
256
#!/usr/bin/env python3 """ File: compare_inter_matrices.py Created: 2020/04/06 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...
8614815d130da8b545b3dcd2be236ba736f1d61ebb84f62556523e5b56262822
Python
9,293
302
# To add a new cell, type '# %%' # To add a new markdown cell, type '# %% [markdown]' # %% from IPython import get_ipython # %% # General imports import os import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import statsmodels.api as sm from IPython.display import display #...
bc2a53146cebb98c15b9143373fccc519ed994374f223582f449dc5a62b310fc
Python
9,294
244
#!/usr/bin/env python3 """ File: gene_expresion_cohort_correction.py Created: 2020/08/31 Last Changed: 2020/09/02 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 publishe...
231ecba5ea4b311b9d53ebbaa3a8acacede0beba566a41096db0cce4addff717
Python
9,296
289
# -*- coding: utf-8 -*- import numpy as np from sklearn.neighbors import NearestNeighbors, KDTree from scipy.spatial.distance import cdist from scipy.special import psi from . import utils def cal_mi_from_knn(x, y, n_neighbors=3, norm=True, norm_mode='min'): """Compute mutual information between two continuous v...
e6ee66d12c08b612a2ee7d9e60b7ff992f31f0d0bdb1c431ae5ed60145f63c16
Python
9,297
234
#!/usr/bin/env python3 """ File: create_extra_CIA_jobs.py Created: 2020/10/25 Last Changed: 2020/10/27 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 Fr...
dc85d971f96f78c8e94856d679531ea77260d158b2d61a9946e67e7237891b58
Python
9,299
215
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Variational Animal Motion Embedding 0.1 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 """ import...
f34e6caf238b7307c374c8b62d525bc6fe2ea932bee459607d889cc400fc355c
Python
9,300
320
import torch import torch.nn as nn from torchtext.legacy.data import TabularDataset, Field, BucketIterator, Iterator import random import os from src.utils.tokenizer import smi_tokenizer from src.transformer import Encoder, Decoder, Seq2Seq def init_weights(m: nn.Module): if hasattr(m, "weight") and m.weight.di...
00499948919223de119d44c6c8068ce98912fa1b42aac0b96c7baebfe70faa61
Python
9,306
214
import numpy as np import imageio from pathlib import Path from scipy import ndimage import skimage from tqdm import tqdm import shutil import flexsim def write_playdoh_volume_stats(obj, out_folder): mat_counts = obj.get_stats() labels, nfeatures = ndimage.label(obj.volume == 2) sample_class = nfe...
04efcb72fd6fa0be90e3d4461c129a2e1042064e676d381ab88e95740fae6e5a
Python
9,309
183
import ship_pairing_analysis import collections import pandas as pd import inspect import re import os import numpy as np import itertools import tqdm import AIS_interp import functions_basic_sak as funsak from sklearn.cluster import DBSCAN from scipy.interpolate import interp1d import AIS_infer_mmsi ...
dc83445361bde380fe2451eb5ca00961bc4552080f61a1529a485c2a4a52d503
Python
9,309
249
import sys import time import torch import random import argparse import numpy as np from voronoi import Voronoi from joblib import Parallel, delayed sys.path.append('../generation') from voronoiUtilities import * sys.path.append('../learning') from model import * from utilities_gru import getNotchEdges from utilities...