sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
258c751835b14097ab501f547f3455cdf6fd591ea16db6f75e31dd78994b79b6
Python
2,478
52
import torch.nn as nn import torch.nn.functional as F from .base_model import BaseModel ######################### ####### BRATS ######### ######################### from .blocks import ConvBlock # for plain vgg like 3D network from monai.networks.nets import densenet121 # for tumorsyn class GeneNet(nn.Module):# [ba...
e47cefb19aab7982a4551ff71620abb09f4c43cdb1145b293ca3ca7bceb5bb33
Python
2,478
87
from os.path import basename from pathlib import Path import numpy as np from sacred import Experiment from sacred.observers import FileStorageObserver, SlackObserver from graspy.models import SBMEstimator, DCSBMEstimator from src.data import load_left, load_right from graspy.utils import binarize, symmetrize from src...
f9a7d016edf787b251b2c7966a37f9b19db320454cb6e21f540269c760e14036
Python
2,478
75
""" File: utilities.py Created: 2020/11/09 Last Changed: Author(s): 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, either version 3 of the...
779dd5b7dbe12664854ecfdc700288b3fe6bb0c3cf40f676ff659cbe95545824
Python
2,480
72
import sys import torch from torch_geometric.datasets import TUDataset from graphxai.explainers import RandomExplainer #from graphxai.explainers.utils.visualizations import visualize_mol_explanation from graphxai.gnn_models.graph_classification import train, test from graphxai.gnn_models.graph_classification.gcn impor...
93651310e9e33dfc61354f21b7c7ec1e37fde65a9bbbfefad97442fe052d246a
Python
2,480
64
# 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...
7fad9c76134380a0e9bf83a7e8cbec112d6e1f2538c3c571800322f565a1b97e
Python
2,481
70
import torch import torch.nn as nn class FocalLoss(nn.Module): def __init__(self, gamma=2, alpha=None, ignore_index=255, reduction='mean'): super(FocalLoss, self).__init__() self.gamma = gamma self.reduction = reduction self.CE_loss = nn.CrossEntropyLoss( reduction=redu...
9993dd8e1301a04f72e76f92cf29d7fbc1322ce36e5be9e05e1666c4333dd3b3
Python
2,483
60
import logging import unittest from oaklib.datamodels.association import Association, NegatedAssociation, ParserConfiguration from oaklib.parsers import GAF from oaklib.parsers.association_parser_factory import get_association_parser from tests import INPUT_DIR INPUT_GAF = INPUT_DIR / "test-uniprot.gaf" class GafAs...
9a9841523401e871821e6e3116e86a25d2ae9c517ceee2613a2330420114d89b
Python
2,483
65
# 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...
d3330526f9e93b10741b05d86e75414f9c45bd1f120d8dd8c016863b68f5bbc8
Python
2,484
64
""" Model derived from "Human 5′ UTR design and variant effect prediction from a massively parallel translation assay", https://doi.org/10.1101/310375 """ import torch import numpy import torch.nn as nn class UTRModel(nn.Module): def __init__(self, sequence_length=50, n_targets=1): super(UTRModel, self)....
d0fcf43e6ddbbe662627e2e1da38ada7ce0850f0023f9ebe277b6ed74f06c445
Python
2,485
72
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. from __future__ import division import torch class ImageList(object): """ Structure that holds a list of images (of possibly varying sizes) as a single tensor. This works by padding the images to the same size, and storing in...
dc8d691664169153a630def5657908321a08f87529678e751511314f1b8289f6
Python
2,487
67
import random import torch import matplotlib.pyplot as plt from graphxai.explainers import GraphLIME from graphxai.gnn_models.node_classification.testing import GCN_3layer_basic, GIN_3layer_basic, test, train from graphxai.datasets.shape_graph import ShapeGGen # Load dataset: # Smaller graph is shown to work well wi...
926657947ce5e040c28ca934a63562fb1a4e30750ac267fb585df07840566f16
Python
2,488
80
from __future__ import annotations import logging import os from palmari.processing.utils import get_values_as_in_dict from abc import ABC, abstractmethod import json class PostProcessingParameters(ABC): def __init__(self, params: dict = {}): for key in params: assert ( key in...
bd9a27640aae5fef186f1820c48f94db469689c5985f4c4c2b9a19628cda9ba2
Python
2,488
62
import copy import warnings def replace_ImageToTensor(pipelines): """Replace the ImageToTensor transform in a data pipeline to DefaultFormatBundle, which is normally useful in batch inference. Args: pipelines (list[dict]): Data pipeline configs. Returns: list: The new pipeline list w...
37c484923fe98600194a3785c458bfcfd94de84996fbc655c7a637cb25f4f47e
Python
2,489
62
import os, sys; sys.path.append('..') import argparse import torch import numpy as np from tqdm import trange from torch_geometric.datasets import TUDataset from graphxai.explainers import IntegratedGradExplainer #from graphxai.explainers.utils.visualizations import visualize_mol_explanation from graphxai.gnn_models.g...
4a3640a5b83049c31b7035719806a7d6ee8ab27cc241f862540e0090b11422db
Python
2,489
72
#!/usr/bin/env python3 # Copyright 2020 Maxim Korenevsky (STC-innovations Ltd) # Apache 2.0. import argparse import logging import sys import numpy as np import kaldi_io from scipy.spatial.distance import cosine, pdist, squareform sys.path.insert(0, 'steps') import libs.common as common_lib def LoadReco2Utt(file)...
5ef96e5f348fd200fbae599017aa24b8dd544a9339a80adda3e5341c6338519c
Python
2,489
66
# 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...
c7e2d1459d53c13a5be792ee7f398dc32ca84bc1deada9a42bb4b5add173d24a
Python
2,489
75
""" File: utilities.py Created: 2020/10/08 Last Changed: 2020/10/15 Author(s): 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, either versi...
e4b30ac5f290de85d3b952d029c978ff3eeffd917bab0e71d654b354b8ca1aef
Python
2,489
82
import argparse import glob import os parser = argparse.ArgumentParser(description='Generate htseq job files.') parser.add_argument('jobs_directory', help='Directory for jobs') parser.add_argument('cram_base_directory', help='Directory with cramFiles') parser.add_argument('ref_gtf', help='Reference gtf file location')...
f298d142c87906d5948fff2e1cd9001e4735678e90a3e2e5b9387ea745b3b0ab
Python
2,489
71
import os from pytorch_lightning import Trainer from pytorch_lightning.callbacks import ModelCheckpoint from argparse import ArgumentParser from omegaconf import OmegaConf from utils.utils import get_commit_hash from cotatron import Cotatron from utils.loggers import TacotronLogger def main(args): model = Cotatr...
bcd7ed13a554c28e7108bdca6be3246337cfc35817ae87ac731c47f770e6a1bc
Python
2,490
70
import sys import torch from torch_geometric.datasets import TUDataset from graphxai.explainers import CAM, GradCAM from graphxai.explainers.utils.visualizations import visualize_mol_explanation from graphxai.gnn_models.graph_classification import GIN, load_data, train, test import matplotlib.pyplot as plt dataset...
09af1154a2b483f8050ac531b22742830d369bb5df2d85adacd0ea603444f180
Python
2,491
96
#%% import time import matplotlib.pyplot as plt import numpy as np from giskard.hierarchy import BaseNetworkTree from giskard.plot import plot_dendrogram from src.data import load_maggot_graph, load_palette from src.io import savefig from src.visualization import adjplot, set_theme t0 = time.time() set_theme() def ...
2a812a5fd6bacf0ba6e373a2e4a986fe885fd53be427e61454f6443bf9842c88
Python
2,491
82
""" Utilities for working with networkx ----------------------------------- NetworkX is a popular python package for working with graphs """ from collections import defaultdict from typing import Dict, Iterable, List, Tuple import networkx as nx from sssom_schema import Mapping from oaklib.interfaces.basic_ontology...
bdcefee4e91eb4e4fe30dc864e8dea6d0ecdd729527a519790792fbb8952edb9
Python
2,491
81
#!/usr/bin/python # # Convert instances from png files to a dictionary # This files is created according to https://github.com/facebookresearch/Detectron/issues/111 from __future__ import print_function, absolute_import, division import os, sys sys.path.append( os.path.normpath( os.path.join( os.path.dirname( __file_...
312ba53ea39a2c7ae6069d711fcb97308369b14b95a411de05d2644b307b2d3d
Python
2,493
60
import tensorflow as tf import tensorflow.keras.backend as K import logging import numpy as np class RollingAverageWeighting(tf.keras.callbacks.Callback): def __init__(self, weights: list, loss_names: list, ref_loss: str, epoch_update): super(RollingAverageWeighting, self).__init__() assert len(we...
a67031437e86ac1ade2516e184b8e4f7f4facf862f97df41e242f25df823770f
Python
2,494
70
import sys import torch from torch_geometric.datasets import TUDataset from graphxai.explainers import CAM, GradCAM from graphxai.explainers.utils.visualizations import visualize_mol_explanation from graphxai.gnn_models.graph_classification import GCN, load_data, train, test import matplotlib.pyplot as plt dataset...
b3dfc7fadc1cf8c2f341e0c6aaf7d1f118a7973937b65dd8e1406f710f384333
Python
2,494
95
import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd.function import once_differentiable from mmcv.cnn import Scale from ..utils import ext_loader ext_module = ext_loader.load_ext( '_ext', ['ca_forward', 'ca_backward', 'ca_map_forward', 'ca_map_backward']) class CAWeightFunctio...
79095ca52efa7fe869ef040362f80ded50b5973f6db97e5534675fe040c64505
Python
2,495
69
# python 3.7 """Contains the encoder class of StyleGAN inversion. This class is derived from the `BaseEncoder` class defined in `base_encoder.py`. """ import numpy as np import torch from .base_encoder import BaseEncoder from .stylegan_encoder_network import StyleGANEncoderNet __all__ = ['StyleGANEncoder'] class...
38bfa91cb75f6de703f608f307b4da59d3adff9d81984c350b5a76b616f261c9
Python
2,496
67
import random import torch import matplotlib.pyplot as plt from graphxai.explainers import GNN_LRP from graphxai.gnn_models.node_classification.testing import GCN_3layer_basic, GIN_3layer_basic, test, train from graphxai.datasets.shape_graph import ShapeGGen # Load dataset: # Smaller graph is shown to work well with...
d00143e9938ef06c9fd26433fe6c795f0cdb578fb806b984c9c616049a3f3562
Python
2,497
94
# %% [markdown] # ## from src.visualization import adjplot, matrixplot import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns sns.set_context("talk") n_rows = 100 n_cols = 200 data11 = np.random.normal(0, 1, size=(n_rows, n_cols)) data21 = np.random.normal(0, 2, size=(n_rows, n_...
105066cc0aa5a0dbc703017dbf3a427de74dc973d165839459cc22510fc40954
Python
2,499
73
# 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...
e745fb6d509285907431562ff67fdc792ed459ab9a633da3eb78006b1991af21
Python
2,499
85
import os.path as op import os import json def write_json(fname, data): """ Write data to JSON file. Parameters ---------- fname : str Full path to the file to write. data : dict A dict containing the data to write. Returns ------- None """ with open(fnam...
fb884dff231047a5d2c21d37821f926e8678733655cda68db2a35ba345e87308
Python
2,500
85
#%% import pymaid from pymaid_creds import url, name, password, token import numpy as np import pandas as pd import re import datetime #pymaid.clear_cache() rm = pymaid.CatmaidInstance(url, token, name, password) # %% def timeTracing(user, interval, start_date, end_date=None): time_interval = pd.Timestamp(year...
292b2456ba8c89fec6671af21069239c24f98fb8f51f5902c52efd6eb9d91fe9
Python
2,501
76
import multiprocessing import argparse import time import logging import json import tqdm from os.path import join, exists from os import makedirs def build_batches(args, file_name): with open(join(args.data_dir, file_name)) as f: return [(args, json.loads(line.strip())) for line in f] def format_story(d...
91f0d13588d2ac6cb086197391c2433f3e2122d875256a457aa6039017333f62
Python
2,501
86
#!/usr/bin/env python3 # 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>. """Download big files from Google Drive.""" import argparse import shutil i...
ece63f6dd722bcc44479e9c1d91089e9474d73a25fda27a4c330d7856a6497e8
Python
2,501
72
import copy import numpy as np from ..builder import PIPELINES from .compose import Compose @PIPELINES.register_module() class AutoAugment(object): """Auto augmentation. This data augmentation is proposed in `Learning Data Augmentation Strategies for Object Detection <https://arxiv.org/pdf/1906.11172>`...
13edc493adc404b75617ff22b445dc3905f6916e9fe334d9a2b219d788e5aee6
Python
2,502
72
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. from torch import nn from torch.nn import functional as F from ..box_head.roi_box_feature_extractors import ResNet50Conv5ROIFeatureExtractor from maskrcnn_benchmark.modeling import registry from maskrcnn_benchmark.modeling.poolers import Pooler fr...
8d0efee0cc2c3cb9c91f25743088ff2b2c4141f78c928edd8e59c8a3f14cc29b
Python
2,502
65
from pathlib import Path from os import chdir import unittest from math import sqrt from nipype.interfaces.base import CommandLine from qipype.commands import NewImage, Diff from qipype.utils import PolyImage, PolyFit, Filter, RFProfile vb = True CommandLine.terminal_output = 'allatonce' class Utils(unittest.TestCas...
94938dc566e40848eeee5cbd8375259710fa0d4c1803907d0dcf9903f16add0e
Python
2,502
80
from __future__ import absolute_import from __future__ import division from __future__ import print_function from imlib.dtype import * import numpy as np import scipy.misc def rgb2gray(images): if images.ndim == 4 or images.ndim == 3: assert images.shape[-1] == 3, 'Channel size should be 3!' else: ...
e69e5d355b76014f2a0c6f8f5f8ae3411ba22ac2f61ee27670d645c7872c8dc9
Python
2,502
63
#!/bin/bash # 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 ...
e85270f8295a8b0723a7a0a9a93bea0e3f5810c83683cf5627032ac563f02828
Python
2,502
37
"""Plot the tuto_G_traffic_manager set_path routes on the road network (from the Map API).""" import sys, carla, numpy as np import matplotlib; matplotlib.use("Agg"); import matplotlib.pyplot as plt OUT = sys.argv[1] import json D = json.load(open(sys.argv[2])) R1S, R1 = D["r1"][0], D["r1"][1:] R2S, R2 = D["r2"][0], D[...
fb3ad6235aa3472fc36e07f9280598bb83a38840271cf8aaa525a618413e71b7
Python
2,502
55
import os import torch from akt import AKT # from sakt import SAKT # from dkvmn import DKVMN # from dkt import DKT # from dktplus import DKTPlus device = torch.device("cuda" if torch.cuda.is_available() else "cpu") def try_makedirs(path_): if not os.path.isdir(path_): try: os.makedirs(path_) ...
b9115ee0a43bc8a774f21fee8dca15c1cc6157d062c1f2f1225bbfa63e799394
Python
2,504
65
# 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...
d862669bf376cce483d1b4b7db304e247f0423251b59863152c7cdf67de9574f
Python
2,505
64
# Merge FeatureCount count files (counts per sample) to matrix with rows genes, columns samples # NOTE: Needs Python version 3.5+ import glob import argparse import gzip import sys parser = argparse.ArgumentParser(description='Calculate the fraction each transcript of a gene is expressed') parser.add_argument('feature_...
284bdfe5a6a44abc059c3cbb0c582ba0b450088cbe9667856439b8d51891c8d5
Python
2,506
74
# 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...
e6ea4ec0426effcea03e7357b5c506d65790d3b7ce4fbb93cc12dce0d4ab9f23
Python
2,506
68
import torch.utils.data from torch.utils.data.dataloader import default_collate from batch import BatchSubstructContext, BatchMasking, BatchAE class DataLoaderSubstructContext(torch.utils.data.DataLoader): r"""Data loader which merges data objects from a :class:`torch_geometric.data.dataset` to a mini-batch. ...
6f811b39149cc65835af5f036f0fbf52f1706dc59940f80a6617945872383732
Python
2,507
100
"""Example script for training Single-Channel DyNeMo on simulated data. This script should achieve a dice coefficient of ~0.8. """ import numpy as np from osl_dynamics.data import Data from osl_dynamics.inference import modes, metrics from osl_dynamics.simulation import HMM from osl_dynamics.models.sc_dynemo import C...
1ae58a6f050b37174dfa65d6d81c155367254aac06debb19e238a450252cd309
Python
2,510
76
# 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...
7a44a949af07116054ac183037c29b4dd3181d94403f86296d74dbcbdb11e8eb
Python
2,510
67
import random import torch import matplotlib.pyplot as plt from graphxai.explainers import GradCAM from graphxai.gnn_models.node_classification.testing import GCN_3layer_basic, GIN_3layer_basic, test, train from graphxai.datasets.shape_graph import ShapeGGen # Load dataset: # Smaller graph is shown to work well with...
e30c7bf659a34058a33dec04fbf0e5da292377ea2e08cc229beb5db05e8089dc
Python
2,510
103
# -*- coding: utf-8 -*- """ Created on Mon Mar 16 09:22:57 2020 @author: Sandi """ import numpy as np from matplotlib import pyplot as plt import pickle from sklearn import metrics from sklearn.neural_network import MLPRegressor data=np.loadtxt("dataset.csv", delimiter=",") print(data) data= data[data[:, 2].argsort...
89371a78071919dd62066897d88b208e725ab8a1dd1c644b02f051cdcdeea913
Python
2,511
86
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', ['roi_pool_forward', 'roi_pool_backward']) ...
15157a7ebcdb4631ba880f6ef54908406de086451d31a26875e324eb0c671e64
Python
2,512
66
import random import torch import matplotlib.pyplot as plt from graphxai.explainers import RandomExplainer from graphxai.gnn_models.node_classification.testing import GCN_3layer_basic, test, train from graphxai.datasets.shape_graph import ShapeGGen from graphxai.utils import aggregate_explanations # Load dataset: # ...
51b825e1dc1468672d8fc31f5fe553a8de55fb71ed76f8d32a71a3215debc506
Python
2,512
66
import random import torch import matplotlib.pyplot as plt from graphxai.explainers import IntegratedGradExplainer from graphxai.gnn_models.node_classification.testing import GCN_3layer_basic, GIN_3layer_basic, test, train from graphxai.datasets.shape_graph import ShapeGGen # Load dataset: # Smaller graph is shown t...
6d7fe6b9b58c731e65d18a541a95af6dbc6a82de6b3c79e1f1a8b2b4a575975b
Python
2,512
81
import torch from torch import nn class Basic3DUNet(nn.Module): def __init__(self, **kwargs): super(Basic3DUNet, self).__init__(**kwargs) self.output_layer = nn.Conv3d(16, 1, 1, padding="same") self.bottom_layer = nn.Sequential( nn.Conv3d(128, 128, (2, 3, 3), padding="same"), ...
9a4339f002d61b0e7ec6954dbc63f6d0e6720aebaccce134a7781b79cdfb5b68
Python
2,512
64
""" Estimating stability of macro model by root finding. Here, we want to find a root of jw + Fe(w)*(I-alpha*C)/tauC This becomes a multiplication of jw + Fe(w)*lambda_i(w)/tauC, multiplication over i where lambda_i are eigenvalues Thus, we need to find roots of jw + lambda_i(w)/(tauC*(tau_e*jw+1)**2) T...
1587deebb57f658da1b043c2d7586e29792f8ee6d01eef955390076608d53892
Python
2,513
63
# this code will generate a literal caption and a pragmatic caption (referring expression) for the first of the urls provided in the context of the rest import matplotlib matplotlib.use('Agg') import re import requests import time import pickle import tensorflow as tf import numpy as np from keras.preprocessing import...
4a25a0ee640bcdc21807900cd3638eb8e56f7851309aa680769733cf7eb80722
Python
2,515
100
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> import numpy as np from eelbrain import datasets, plot, testnd from eelbrain.plot._figure import Figure from eelbrain.plot._utsnd import _ax_bfly_epoch from eelbrain.testing import requires_mne_sample_data from eelbrain._wxgui.testing import hide_plots @hide_p...
8402fd0ac7f1ddad5e5d7281d2a2e6d1dea66428d63f4cee0132697a6c7b36ad
Python
2,517
103
# -*- coding: utf-8 -*- """ Created on Mon Mar 16 09:22:57 2020 @author: Sandi """ import numpy as np from matplotlib import pyplot as plt import pickle from sklearn import metrics from sklearn.neural_network import MLPRegressor data=np.loadtxt("dataset.csv", delimiter=",") print(data) data= data[data[:, 2].argsort...
f6ebd7856b1e87603a81284e358461d21faa49f242e6d70d042150caf86da265
Python
2,518
68
""" The build/compilations setup >> pip install -r requirements.txt >> python setup.py install """ import pip import logging import pkg_resources try: from setuptools import setup except ImportError: from distutils.core import setup def _parse_requirements(file_path): pip_ver = pkg_resources.get_distribu...
568f2952ba22943e5bf3cb69618c7f49ff2ddd87ac1f13e62f1cbf92ba45b8c8
Python
2,519
100
import pandas as pd import os import sys def read_genome_BED(): ''' Read genome intron/exon coordinates (from parse_gft.R) ''' genome_bed = pd.read_csv( "/hpf/largeprojects/ccm_dccforge/dccdipg/Common/genomes/hg19_introns_exons.bed", sep=" ", skiprows=1, low_memory=Fals...
e42b75a48f4ce605475e17ce496188886356787aa3da4c0bd9a2955a78885ab7
Python
2,519
59
#################################################################################################### # Copyright (c) 2019 - 2023, 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 ...
d07fb482847f8c4be7136af6ff70b730132b79dfd205798643e87948be6b9cde
Python
2,520
85
# Copyright 2020 The HuggingFace Team. 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 applicabl...
e284f2f458853067cf4ddf26a43be3f962c998223f652e1b1dd0cb4b099cd933
Python
2,520
85
import abc import numpy as np import cPickle as pkl from . import Tools class SpikingModel: """ Abstract class defining an interface for a Spiking Neuron Model, a model that produces spikes. Inherit from this class to generate a new Spiking Neuron Model. To create a new model that explicitly descri...
d013fa1da460ae14cb423e5f972bb0304b55888e2cae259580f34ee03df692d0
Python
2,522
60
import unittest import numpy as np from selene_sdk.sequences.proteome import Proteome from selene_sdk.sequences.proteome import _get_sequence_from_coords class TestProteome(unittest.TestCase): def setUp(self): self.proteome = Proteome("selene_sdk/sequences/tests/files/small.faa") self.fill_value...
07b4e366129dc82b88131686d9b934a48b22dccfa99b27b4887c1abdd22d44f2
Python
2,524
64
from dataclasses import dataclass from typing import Any from linkml_runtime import CurieNamespace from oaklib.interfaces.obograph_interface import OboGraphInterface from oaklib.interfaces.semsim_interface import SemanticSimilarityInterface from oaklib.io.streaming_writer import StreamingWriter from oaklib.utilities....
d0e520bc32fb9ad0a931ffff11f7aa59ea9d353ccbbf837d597ec80b3fcda147
Python
2,524
82
from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import argparse from keras.models import Model from keras.models import load_model import os import cv2 def make_dir(dir_): if not os.path.exists(dir_): os.makedir...
7e9277e948874c23537823a776b5da8d5ff4a9bd0de9a25fde2e041c3aba29b5
Python
2,525
66
# Configuration file for the Sphinx documentation builder. # # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html import os import sys sys.path.insert(0, os.path.abspath('../..')) sys.path.insert(0, os.path.abspath('../../..')) #...
6a03f421bdb45e761b2337166129e1c5bf9b0b021e21119889a61467e0891df9
Python
2,526
66
"""Latent inhibition task — the classical discriminator for RPE vs hybrid models. Protocol (Jacob & Waddell 2022 style, adapted for our minimal setting): Group: pre-exposed 1) Pre-exposure N_pre trials of CS+ alone (no reward) 2) Acquisition N_acq trials of CS+/CS- (CS+ paired) G...
8338906f0bb2115b2648d8fca0ce17cffbd96307b8ca74932395cb842057c440
Python
2,526
72
# 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...
389bef227da975d8ce0746d3747d10771e806ba5f1d42a21f3efaff5a52a20de
Python
2,527
76
#!/usr/bin/env python # Interface to cluster_report.csv file produced by IsoSeq. import os import sys import re # for regular expressions from tt_log import logger VERSION = '20141029.01' logger.debug('version %s loaded' % VERSION) class ClusterList (object): def __init__ (self, filen...
62bd5dd640dce5dff933edb732356df56f4a27cda06e1a915d0fc9597515b016
Python
2,528
79
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ phys2bids interface for txt files. """ import numpy as np from phys2bids.physio_obj import BlueprintInput def populate_phys_input(filename, chtrig): """ Populate object phys_input for now this works only with labchart files Input (Properties) ...
3c1a8d0884c3849fb2745fea7bb9652353d76de7473d353700d1a5fbc7eb9e32
Python
2,529
85
import logging import sys import warnings from dataclasses import asdict import chika from imblearn.metrics import geometric_mean_score from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import cohen_kappa_score, roc_auc_score from spikebench import load_allen, load_fcx1, load_retina from spikebe...
3fe10bff4f1249bc5153b643466d559586add9a14769d01002b023c24ba3ca48
Python
2,529
93
import cv2 import numpy as np def imnormalize(img, mean, std, to_rgb=True): """Normalize an image with mean and std. Args: img (ndarray): Image to be normalized. mean (ndarray): The mean to be used for normalize. std (ndarray): The std to be used for normalize. to_rgb (bool): ...
ed4d3600002d3b06a9b2b6e003789a00bc0793f30ee5139babb1d04fe59032bb
Python
2,529
85
import PIL import io import scipy.misc import numpy as np from PIL import Image import base64 def label_colormap(N=256): def bitget(byteval, idx): return ((byteval & (1 << idx)) != 0) cmap = np.zeros((N, 3)) for i in range(0, N): id = i r, g, b = 0, 0, 0 for j in range(0, ...
3001c6def86be62bbcf069d74e9a2a5a9e58a68b2356638d9fd49511346b5125
Python
2,531
79
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> """ Sample MneExperiment. This experiment can be used with a sample dataset that treats different parts of the recording from the MNE sample dataset as different subjects. To produce the data directory for this experiment use (make sure that the directory you spe...
3a70de6dbd9a103c21e1dc17fa50eceb5b6450228adab08be3b38361277dceb5
Python
2,531
61
import torch.nn as nn class BaseNetwork(nn.Module): def __init__(self): super(BaseNetwork, self).__init__() def print_network(self): if isinstance(self, list): self = self[0] num_params = 0 for param in self.parameters(): num_params += param.numel() ...
1e931c08e66fa76288861c172a29b1f912bd58d7852049c4a5b2fa0a7d691141
Python
2,535
76
# 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...
15e342b3f41feefcbd29f3c00f0bbd061a70359ad4dd75a0a42f82e216ea386a
Python
2,536
82
""" StyleMapGAN Copyright (c) 2021-present NAVER Corp. This work is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, U...
27ceb0b515a3250299f435cc48b6d832d6e0345583a3b2a0956bc93955acb323
Python
2,538
79
import gzip terms = [] count_term = {} term_type = {} print('count go') with open('term_order.txt','w') as out: out.write('term\torder\n') x = 1 with gzip.open('2020-03-29-goa_human.gaf.gz','rt') as input_file: for index, line in enumerate(input_file): if line.startswith('!'): ...
64d00706533ac773a2740e58e64bc7fa577f2cf0b57227dff5fddcfec3747339
Python
2,538
100
from os.path import basename from pathlib import Path import numpy as np import pandas as pd from sacred import Experiment from sacred.observers import FileStorageObserver, SlackObserver from graspy.datasets import load_drosophila_left from graspy.utils import binarize, symmetrize, is_fully_connected from graspy.plot i...
93d3cde13ba747a3b5608abd154e961d0154c8505c1a3e5d9ebb3b6728e044fb
Python
2,538
82
""" Title ----- AMPA synapses Description ----------- AMPA receptors are the most common type of ionotropic glutamate receptors in the brain. They have fast kinetics and are responsible for excitatory synaptic transmission. In this example we show: - How to add and activate AMPA synapses at various model compartment...
a25b451a292704e4485b5bf0f7bc6112b4e3d255d8babd7ed8d0ca3afc53728e
Python
2,538
69
from scipy.linalg import blas import numpy as np from dipy.data import default_sphere from dipy.reconst.shm import anisotropic_power, sh_to_sf_matrix __all__ = ["extract_odf", "anisotropic_index", "anisotropic_power"] def extract_odf(odf, sphere=default_sphere, sh_order=8): """ Calculates spherical harmonic...
d14dca8e753ceaa95a867920cc826b16184a60aa729d78163332ee230b75bfb0
Python
2,538
53
#################################################################################################### # Copyright (c) 2019 - 2023, 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 ...
3cb835dfffebfaa5001d6a0254cebdab5fae68dd930874752fb217ca6bbb32b9
Python
2,539
82
""" Title ----- GABA synapses Description ----------- GABA receptors are the most common type of inhibitory ionotropic receptors in the brain. They have fast kinetics and are responsible for inhibitory synaptic transmission. In this example we show: - How to add and activate GABA synapses at various model compartmen...
e795193991397766309077a8b80adf9e2b434799c512673ac3437c70bc983353
Python
2,539
87
import contextlib import os from typing import Tuple import albumentations as alb import numpy as np import tifffile as tf from spotipy.utils import points_to_prob, normalize_fast2d from cenfind.core.data import Dataset def load_foci(path) -> np.ndarray: """ Load annotation file from text file given channel...
583db1a905d0fa9228dbd8296df3c4f769c6d405f571b123af28ddfd522ef12e
Python
2,541
103
# -*- coding: utf-8 -*- """ Created on Mon Mar 16 09:22:57 2020 @author: Sandi """ import numpy as np from matplotlib import pyplot as plt import pickle from sklearn import metrics from sklearn.neural_network import MLPRegressor data=np.loadtxt("dataset.csv", delimiter=",") print(data) data= data[data[:, 2].argsort...
7de43e4c02e5985e7cc4a2f442dd1e8cc6b6f75954cf6faf3828711f0319f59c
Python
2,541
82
import time import torch import pandas as pd import networkx as nx import numpy as np import matplotlib.pyplot as plt from torch_geometric.utils import from_networkx from sklearn.model_selection import train_test_split from graphxai.datasets.utils.bound_graph import build_bound_graph from graphxai.gnn_models.node_cla...
dbbaf7057e0ed82be3b7402bd8f009be64a2617bb384e6b007707e702ce7eaf6
Python
2,541
63
# 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...
440a79d13f3567c4c6c5a19a62ca390b87f78a94fa1e9fef067df0c48faa41bd
Python
2,542
78
from __future__ import absolute_import from __future__ import division from __future__ import print_function import os from keras.models import Model, load_model import argparse from util import load_avi_video, load_dcm_video, remove_info2, limited_equalize def predict(args): # predict probability ...
e388e079b41b1581a90925ad615e1b7754acef49e18b26ddc02745a3201df03e
Python
2,543
44
#!/usr/bin/env python3 # -*- coding:utf-8 -*- ############################################################# # File: logo_class.py # Created Date: Tuesday June 29th 2021 # Author: Chen Xuanhong # Email: chenxuanhongzju@outlook.com # Last Modified: Monday, 11th October 2021 12:39:55 am # Modified By: Chen Xuanhong # Cop...
dc8dd85613b6c452099d54219b8429c19d4123faf32e9cd259a4cae81be67c6a
Python
2,544
89
import os import os.path as op import numpy as np import nibabel as nib from dipy.reconst import fwdti import AFQ.utils.models as ut __all__ = ["fit_fwdti"] def _fit(data, gtab, mask): fwmodel = fwdti.FreeWaterTensorModel(gtab) fwfit = fwmodel.fit(data, mask=mask) return fwfit def fit_fwdti(data_fi...
43fd37213fabfb7969f2b88045de1fd008e531cdc678ccc45932e47b6696c15b
Python
2,545
85
import csv from dataclasses import dataclass from typing import Dict, Iterable, List, Set, Tuple, Union from oaklib.types import CURIE @dataclass class ListPair: set1_id: str = None set2_id: str = None list1: List = None list2: List = None list1_len: int = None list2_len: int = None inter...
02a364018813c4bcd676340f7a989b21e5bffbf1bb6f730ddce8fced2585134d
Python
2,546
63
# Copyright 2020-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 agre...
71ac28b4546cf617b5f3453c63ff079f81a4aa43ed1eec2d780354f5f6d6efdc
Python
2,546
66
import random import torch import matplotlib.pyplot as plt from graphxai.explainers import GradExplainer from graphxai.gnn_models.node_classification.testing import GCN_3layer_basic, GIN_3layer_basic, test, train from graphxai.datasets.shape_graph import ShapeGGen from graphxai.utils import aggregate_explanations # ...
233430516213c40bd40da7a1823ab46571bd5a4538c034180fb089709260fc45
Python
2,547
95
import sys from bokeh.io import curdoc from bokeh.layouts import column, row from bokeh.models import CustomJS, Slider from bokeh.plotting import ColumnDataSource, figure, output_file, show from bokeh. palettes import Greens7, OrRd3 import numpy as np from lib import File, segmentation, image_adjustments def reverse...
a6677e918b67db10f49f72ea0739737ebe50a1c0c0462133acee501332e92636
Python
2,547
69
from collections import defaultdict from dataclasses import dataclass from functools import lru_cache from typing import Any, List, Union from oaklib.converters.data_model_converter import DataModelConverter from oaklib.datamodels.obograph import Graph, GraphDocument, LogicalDefinitionAxiom from oaklib.types import CU...
3da3c4dfe72db26082ce4d83ee8e14cfcda4664f332668d63c2c04f4d73480ca
Python
2,548
92
import numpy as np from .traverse import BaseTraverse class RandomWalk(BaseTraverse): def _choose_next(self): node_transition_probs = self.transition_probs[self._active] if np.isclose(np.sum(node_transition_probs), 1): nxt = np.random.choice(self.n_verts, p=node_transition_probs) ...
8a825b6d37c6c718b5c0e7db2e0ecb6875df25b584eb215165ddc5b076b030e9
Python
2,548
87
import math import glob import argparse parser = argparse.ArgumentParser(description='Create slurm job to Concatenate gVCFs') parser.add_argument('list_of_vcfs', help='.txt file with list of path of VCFs to Concatenate (only for chr15, this will be replaced for other chr numbers)') parser.add_argument('jobs_dir', h...
ef065f47b08259551720617e1cbd23e7d068af370daef71f782c5db795c2aad4
Python
2,548
67
# 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...
6156ee6c97ec49ffd16d2c66b624bd3547d1ffbabd927b0d08f82b02e4035ca7
Python
2,549
73
""" Utilities for traversing Ontology Graphs ==================== """ from copy import copy from dataclasses import dataclass from typing import List, Union, Dict, Iterable, Tuple from oaklib.interfaces.basic_ontology_interface import RELATIONSHIP, BasicOntologyInterface from oaklib.types import CURIE, PRED_CURIE #...
744f8854edce85b58fb20d8150ce4249e00d52b4e42e49b1d556a3b228aeaf15
Python
2,549
67
#!/usr/bin/env python3 """ File: artificial_bulk_deconvolution.py Created: 2020/11/09 Last Changed: 2020/11/12 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 b...