sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
97d6b19ae4799856ed77a11737e1a9de8de53580e40408ba4c025ce67145c635
Python
2,339
74
''' Plots ''' from matplotlib import cm from mpl_toolkits.axes_grid1.anchored_artists import AnchoredSizeBar import matplotlib.pyplot as plt from brian2 import second, ms from pylab import * __all__ = ['plot_curves', 'prepare_panel', 'scale_bar', 'plot_fits'] def plot_fits(data, fits, metrics=None, vars=None): ''...
abf43a13641e00feddf6dfc51cc15c2c0739dda9715cf29424f0a9e657faab3d
Python
2,339
72
"""Cortical surface meshes. Mid-thickness, inflated and very inflated surfaces for the left and right hemispheres, on the 32k_fs_LR grid. These are used to render brain maps on the cortical surface, either with HCP Workbench (see :py:mod:`osl_dynamics.utils.workbench`) or directly from the vertices and triangles retur...
c6578ccd629c2307ed5070a94677ddc9d01231000c0c76c6fe60ec394ac1e859
Python
2,340
61
import json import logging import unittest from oaklib.implementations.pronto.pronto_implementation import ProntoImplementation from oaklib.resource import OntologyResource from oaklib.utilities.graph.relationship_walker import walk_up from oaklib.utilities.obograph_utils import as_multi_digraph, graph_as_dict, graph_...
15dee8d3d8710c82980e6876a7ea626b0795b06047d43104b35f95a4f5611f77
Python
2,342
72
# Built-in import os from pathlib import Path # Third-party import pandas as pd import pytest # Local from cxsystem2.core.exceptions import ParameterNotFoundError from cxsystem2.core.tools import change_anat_file_header_value @pytest.fixture def setup_and_teardown(): # Create a dummy CSV file dummy_data = [...
7bab0ebf6fc7c7395d1a9a550308ad4c81805267a758f38472001922c97cfa45
Python
2,342
77
#%% 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 promat...
8b319d4559c333f5ec5a1fd39fb76916ac7fbb8fbcb4f1f5ac60f904564ae1b7
Python
2,343
63
# 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...
c896ee123d52526010f124c7aae1a94d8593880f2d606439d294b4e6736780d8
Python
2,343
90
import csv import os import sys def feature_to_index(cases, column_nb, offset=0): feature_set = set() for case in cases: if len(case) > column_nb: feature_set.add(case[column_nb]) l = list(feature_set) index = {} i = 0 for f in l: if f != '': index[f] = i...
efc3e3a3ebec5cb5e9a55177c30222b2a1794d1c46d4d18eb4d3555a236c7ade
Python
2,343
57
#################################################################################################### # 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 ...
0052962a791706d450961b8acc8362ad1e2c34240bacd01a4efacad9e5714f9b
Python
2,344
90
import csv import os import sys def feature_to_index(cases, column_nb, offset=0): feature_set = set() for case in cases: if len(case) > column_nb: feature_set.add(case[column_nb]) l = list(feature_set) index = {} i = 0 for f in l: if f != '': index[f] = i...
528b4cb613921530e552fe5749bfc8a3ef2238ab41e43250a9f2d649cdd2155c
Python
2,344
61
from utils import Config import nltk class DataLoader: def __init__(self, config: Config): self.config = config self.articles = {} self.original_articles = {} self.vocabulary = {} self.frequency = {} # dict : keys Words et values : list of files where the words are from ...
9c30d9f12787a9ba3a85eb202b79249c767ef334ce227909dba92356941308dd
Python
2,344
58
rule align_trome2trome: input: query='refs/{query}-all.fa.gz', target='refs/{target}-all.mmidx' output: 'refs-filtering/{query}-{target}.bam' threads: 40 run: if wildcards.query == wildcards.target: shell('touch {output}') else: shell('minimap2 -a ...
00bfa940cc34cd665d3c1072d3100c803a55ae7faf8ea562250902b7a9cad010
Python
2,346
89
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.datasets import load_drosophila_left, load_drosophila_right from graspy.utils import binarize, symmetrize from src.models import select_dcs...
0b4f8844ba2f4ab583ca7f9d0d9e8bd33e6035435ade7c0e474003977cbdfd8e
Python
2,346
89
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.datasets import load_drosophila_left, load_drosophila_right from graspy.utils import binarize, symmetrize from src.models import select_dcs...
83c025cda5bdb09136e6918e58910d7bc887616a0540fc22d69eeef049142bc3
Python
2,346
71
""" Module for computing features """ import re from collections import Counter, defaultdict from typing import List, Optional, Tuple, Type import functools from spacy.tokens.token import Token as SpacyToken import scicite.constants as constants from scicite.constants import CITATION_TOKEN from scicite.resources.lexi...
c87d3260d6a21696146de0e5d86f6876b9c5ae8713bbcbd70a8f7df5db26c4b7
Python
2,346
73
import pandas as pd import numpy as np import torch, torchvision import torch.nn as nn from torchvision import transforms from PIL import Image from torch.utils.data import Dataset import argparse from functools import partial import moco.builder_infence import moco.loader import moco.optimizer import torchvision.model...
8f0e693eb4a74c623ed8ed01b112da4fbfcb0ccdca8ea244d58b55fc39b5880b
Python
2,347
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...
b465699033a94ad3e40ab8555b65d20d1e33335ac58aaa4c15eb1db8a1751308
Python
2,347
81
__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 import pandas as pd from tmkit.seqnetrr.combo.Param import Param from tmkit.seqnetrr.combo.Separation import Separa...
b0a58038c04d99a241ff0dc2a51e2a3fdf34c3dbe8ee1a9af6be0dd5398d4f19
Python
2,348
81
""" Original source: https://www.datacamp.com/community/tutorials/matplotlib-3d-volumetric-data """ import matplotlib.pyplot as plt import numpy as np def update_title(title, ax, total_slice): title_str = f' << Prev (J) - {viewer_title} {ax.index}/{total_slice-1} - Next (K) >>' ax.set_title(title_str) de...
bd7ebeb69d283f433739b2e0aa878f64121d562a82dcb08853ca069b72ee5889
Python
2,348
54
from pathlib import Path from matplotlib import pyplot as plt from metrics import calculate_lateral_errors, read_frames_driving def draw_error_plot(ax, model_frames, expert_frames, title=None): lat_errors = calculate_lateral_errors(model_frames, expert_frames, only_autonomous=True) autonomous_df = model_fr...
ffe8d554e01f91f7ec281477b409c653dd061b11afc78ce5fae3f0f1127261a8
Python
2,348
89
import csv import os import sys import data_processing def feature_to_index(cases, column_nb, offset=0): feature_set = set() for case in cases: feature_set.add(case[column_nb]) l = list(feature_set) index = {} i = 0 for f in l: if f != '': index[f] = i + offset ...
2f86f2e6e89a204b3be95c44daca3c9cafc771b1270d9fdf15efe0051e7c39af
Python
2,349
51
#################################################################################################### # Copyright (c) 2019, 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 softwar...
880b7b3455078b1107d6442bf5f8034db80d3800f350120e6f572170eb4be4e3
Python
2,349
61
import tqdm import argparse, sys, os import random as rand import torch from graphxai.explainers import * from graphxai.datasets import load_ShapeGGen from graphxai.datasets.shape_graph import ShapeGGen from graphxai.utils.performance.load_exp import exp_exists from graphxai.gnn_models.node_classification.testing impo...
64536df5cf7aa13ebff355fe270bff70708ddbe46941b3895e550c9a34b583eb
Python
2,350
39
"""Vehicle light states, front and rear 3/4 views at night (Cinematic).""" import os, sys, queue, math import numpy as np, carla sys.path.insert(0, os.path.dirname(__file__)); import scene OUT = sys.argv[1]; MODEL = sys.argv[2] if len(sys.argv) > 2 else "vehicle.lincoln.mkz" os.makedirs(OUT, exist_ok=True) c, w = scene...
c0e0d6b198e03fbcae14a0fa27a71734c608d55c65963790d7fffbc97048b9a3
Python
2,350
76
import torch from torch import nn from torch.autograd import Function from torch.autograd.function import once_differentiable from maskrcnn_benchmark import _C # TODO: Use JIT to replace CUDA implementation in the future. class _SigmoidFocalLoss(Function): @staticmethod def forward(ctx, logits, targets, gamma...
fa1b49be0915dc5d71cf5fb910609b7f2daea0fbf086402a22d1d5e0cc80f068
Python
2,350
72
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html import os import sys from datetime import datetime, timezone # -- Path setup ---------...
0bec889f56e73ba754bb4a303a319172aa0b2e7b44f3a819102e66efd0d737fc
Python
2,351
60
# 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...
c414cf59396dd5bd92d1d828d1b877528c1cf89b6845970374cf36abeb5491ef
Python
2,351
60
# 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...
ff3fe9557ac1f51d6e0257de95973ee9d7fb8a05814462b5c9fa994e57203739
Python
2,352
74
""" DeepSEA architecture (Zhou & Troyanskaya, 2015). """ import numpy as np import torch import torch.nn as nn class DeepSEA(nn.Module): def __init__(self, sequence_length, n_genomic_features): """ Parameters ---------- sequence_length : int n_genomic_features : int ...
4ae900a4a4b2ef9d50d525977abfada59f5da130792abd7d34c2c1c9e1b0edf6
Python
2,356
96
import contextlib import tempfile from linkml.generators import PythonGenerator from linkml_runtime import SchemaView from linkml_runtime.dumpers import yaml_dumper from linkml_runtime.loaders import yaml_loader from linkml_runtime.utils.compile_python import compile_python from src.oaklib.utilities.subsets.value_set...
6b37f859e1e267913123eafadb3e0eb492947ec640d6ca0caaad17589b7fd973
Python
2,356
55
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> """ .. _exa-impulse: Impulse predictors for epochs ============================= :func:`epoch_impulse_predictor` generates predictor variables for reverse correlation in trial-based experiments with discrete events. The function generates one impulse per trial, ...
c6cc470e5dac9b8f2bd059f0fe62ff87505102d9bd521a6eeec759c1aaa0b373
Python
2,360
73
import os if os.getcwd().endswith("UnitTests"): os.chdir("..") import unittest from Classes.QueryParser import QueryParser class QueryParserTest(unittest.TestCase): @classmethod def setUpClass(cls): cls.parser = QueryParser() def test_results_are_distinct(self): result = self.parse...
5479695936c24600db9f54a2746ee05e954bfd7704a457d6cf06f712f4d5e628
Python
2,361
68
#!/usr/bin/env python3 """ File: matrix_preparation.py Created: 2020/10/08 Last Changed: 2020/10/20 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 ...
66f55f8a2e99f13c864828f48725bd453ff8a78d1bde3d6a1b3ab139470f6c7c
Python
2,361
94
# 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...
b73e01b2a5a9eb42a98763468235aca779de07580a94f9d5009d8a97b39cd033
Python
2,361
69
# 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...
d752fa83b22f6b6cf18748095254e8a036b104318cf56e13aab8f3e1900135a4
Python
2,362
61
# 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...
d96ff47c0e1e415bee12d3a383d68ff990275bb0a0007da0ba8ac26c54d6a479
Python
2,362
84
#%% import datetime import time import pandas as pd from giskard.flow import rank_signal_flow, signal_flow from src.data import join_node_meta, load_maggot_graph t0 = time.time() #%% print("Loading data...") mg = load_maggot_graph() mg = mg.node_subgraph(mg.nodes[mg.nodes["selected_lcc"]].index) mg = mg.sum index ...
47a0c52f7464fc95d46615ebf2081bfba4d315053713a733a4ac6c22479e76ab
Python
2,363
55
# %% # import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt import networkx as nx from joblib import Parallel, delayed from tqdm import tqdm from contools import Analyze_Nx_G, Prograph, Promat, Celltype_Analyzer from pymaid_creds import url, name, password, token from data_sett...
688a3d88221f60859f390464b35eeb58df6e1acdffd1702bfb87c0d0b2440ab5
Python
2,363
81
from functools import cache from class_resolver import ClassResolver from oaklib.parsers.association_parser import AssociationParser from oaklib.parsers.gaf_association_parser import GafAssociationParser from oaklib.parsers.gencc_association_parser import GenCCAssociationParser from oaklib.parsers.hpoa_association_pa...
ed53d009fbbfe2a9ce00b381db96640d243829c1f4ae1ca8f5349afab5a164b1
Python
2,364
69
""" extractPDB.py: Extract selected chains from a PDB and save the extracted chains to an output file. Pablo Gainza - LPDI STI EPFL 2019 Released under an Apache License 2.0 """ from Bio.PDB import * from Bio.SeqUtils import IUPACData PROTEIN_LETTERS = [x.upper() for x in IUPACData.protein_letters_3to1.keys()] # Exc...
b02fe67a482c9a665db21bf211271f42afe95566dfa81790f782d006b042e7e4
Python
2,365
97
from numpyro.infer import MCMC, NUTS from numpyro.infer import Predictive from scipy.stats import zscore import numpy as np from typing import Optional mcmc_defaults = {"num_warmup": 1000, "num_samples": 3000} def run_inference( x: np.ndarray, y: np.ndarray, use_model, feature_indicator: Optional[np....
9a91d79b4a24386947cc6135f3f15f69d33de7d442bc8867abec6ec7f1be8934
Python
2,366
62
# Copyright 2019 by Gorka Munoz-Gil under the MIT license. # This file is part of the Anomalous diffusion challenge (AnDi), and is # released under the "MIT License Agreement". Please see the LICENSE # file that should have been included in the repository containing the file # (github.com/gorkamunoz/ANDI) import numpy...
bc34cf38e03e665fa95e2442c377865e1576f4537d6a29cdc3a92bc67ecff0f9
Python
2,366
89
# Copyright (c) Open-MMLab. All rights reserved. import functools import torch def assert_tensor_type(func): @functools.wraps(func) def wrapper(*args, **kwargs): if not isinstance(args[0].data, torch.Tensor): raise AttributeError( f'{args[0].__class__.__name__} has no att...
e84b5e1f7d6221dc63d037a12da9cd1e9450b0c922b131b80f0ce31dd664bcd3
Python
2,366
60
# 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...
947e6d2c9726012ce0ebee5214c52b75a5719e6ce5fb3ad78dd1667545fa63c5
Python
2,367
58
from utils import Config, load_glove_model from utils.ArticlesProvider import ArticlesProvider from utils.decomposition import Decomposition import numpy as np import torch class GloVeDecomposition(Decomposition): def __init__(self, config: Config, articles: ArticlesProvider): super().__init__(config, art...
ad1536f3b5432ecf0372e0cd8a30354e0fbedb553d3ed3be41dd48caef5ff1df
Python
2,367
74
# Copyright 2024 Chen Liang # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
43bb375d26f48ba007ec2aaafc0a01eca38fcba6902f97ceab615a33259ac2b2
Python
2,368
91
""" Copyright Dejan Kostyszyn 2019 This method prints all key paths that are read during reading the data. This method only exists for controlling the functionality of the ReadData.py """ import ReadData as rd from options.test_data_reading_options import ReadOptions import time, utils from os.path import join import...
8ca2f671ada16107cd7c2d99700112254fa3dc97da779de711ec8fdc5b43f677
Python
2,368
63
import torch import numpy as np from torch_geometric.loader import DataLoader import sklearn.metrics as metrics from sklearn.metrics import f1_score, precision_score, recall_score def load_data(dataset, mol_num): assert mol_num < len(dataset) train_dataset = dataset[:150] test_dataset = dataset[150:] ...
74f4f189b09d9dfadd1c1a74c454ea6cc765c6027f397eab0c3c0a4356500e93
Python
2,369
74
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ For segmeinting 3D image stacks to 2D images. This would help to skip a project step for analysing movies. Created on Fri Apr 3 15:27:27 2020 @author: smithm3 """ import click import unetsl import unetsl.model import unetsl @click.group(chain=True) def three_to_tw...
9246e096c3b98f07f1bf128b042bc3c2179dca4dcb2afd3d9dace7c9aa3e22b0
Python
2,369
75
import numpy.testing as npt import numpy as np import nibabel as nib import os.path as op import AFQ.data.fetch as afd import AFQ.recognition.curvature as abv import AFQ.recognition.utils as abu import AFQ.recognition.cleaning as abc from dipy.io.stateful_tractogram import StatefulTractogram, Space import dipy.data....
700f664a106e44bc47ee76a302573aa7425224c163085c3ba4c8ca1b6d0c04b4
Python
2,370
80
import numpy as np from cgtasknet.tasks.reduce import CtxDMTaskParameters, DMTaskParameters, DMTaskRandomModParameters, GoDlTaskParameters, \ GoDlTaskRandomModParameters, \ GoRtTaskParameters, \ GoRtTaskRandomModParameters, GoTaskParameters, GoTaskRandomModParameters, MultyReduceTasks, RomoTaskParameters, \...
cae6feab1bb4ad4f14585877d05244bed3271726a20806baf2b53b37d52d080b
Python
2,372
69
# 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.poolers import Pooler from maskrcnn_benchmark.layers import Conv2d from m...
b8c3d704512bbee1a3f6131fe1265718729882a8ca1a9c9f1daec3b821bb7066
Python
2,373
55
######################################## # UNCLASSIFIED # ######################################## """ This generate_mock_detections.py file is used to create mock YOLO detection output from AIS messages. This will be used to test the functionality of ship pairing code. """ import os ...
87af59c2828f413a79851ffc9adc33f39e7d09164f3eb03c57f23b83d4458a5b
Python
2,374
89
from dolfin import compile_cpp_code as compile_cpp from dolfin import Mesh code=""" #include <dolfin/mesh/Mesh.h> #include <dolfin/mesh/MeshEditor.h> #include <dolfin/mesh/CellType.h> #include <dolfin/mesh/MeshTopology.h> #include <dolfin/mesh/MeshConnectivity.h> #include <dolfin/mesh/MeshValueCollection.h> #include ...
b5ae38ad2dd71584796a92ae243a0e0691cbb2344db5a21db8c2cd90adecd7d7
Python
2,374
58
# 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...
c4eb7c26f88e549103860ec3f61d81b80d490d95a1957fd1f5404c46932e353a
Python
2,374
71
import argparse from tqdm import tqdm import numpy as np import pandas as pd from lib import skel, compartment, u def main(cellidfilename, mitotoskelfilename, outputfilename, branchtype="full"): ids = u.readids(cellidfilename) mitotoskeldf = compartment.readmitotoskel(mitotoskelfilename) celld...
e61a699deb23639eaa9e6a5792c975ed8223d7bdae3b6e8af7bb74a7d6be718b
Python
2,374
68
# coding=utf-8 """ 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...
a4bb1af9a2840650ff6adf0093d586250b357dcb243d10612ae828c155aca751
Python
2,375
71
import argparse import logging import pandas as pd from pathlib import Path import seaborn as sns from matplotlib import pyplot as plt from cenfind.core.data import Dataset logging.basicConfig(level=logging.ERROR) def register_parser(parent_subparsers): parser = parent_subparsers.add_parser( "analyse", ...
0117e73e15ec607385b60313a831eac11a9647b22fa8cf101070b23f37865d98
Python
2,377
66
#!/usr/bin/env python3 # # Expansion Hunter Denovo # Copyright (c) 2017 Illumina, Inc. # # Author: Egor Dolzhenko <edolzhenko@illumina.com>, # Sai Chen <schen6@illumina.com> # Concept: Michael Eberle <meberle@illumina.com> # # This program is free software: you can redistribute it and/or modify # it under the ...
539dc631a69103d15180ce00d1b7a9ca94486d0c2ff745976adfa654f6d2fa85
Python
2,377
75
import pandas as pd from biopandas.pdb import PandasPdb def create_atom_label(row): residue = row['residue_name'] atom = row['atom_name'] if atom == 'OXT': return '{}_{}'.format(residue, 'O') else: return '{}_{}'.format(residue, atom) def create_atom_id_raw(chain_id, residue_number,...
ff1a2282e5094bc44c2c43a56a07bb01bc64c92b43dfeef846692e9f14eff8df
Python
2,377
94
from builtins import object # Unit tests for sima/ROI.py # Tests follow conventions for NumPy/SciPy available at # https://github.com/numpy/numpy/blob/master/doc/TESTS.rst.txt # use assert_() and related functions over the built in assert to ensure tests # run properly, regardless of how python is started. from numpy....
0732596b5e89e12c4c62d2c00c66577d889deec84b8c74419d4f1a81d2eb12a9
Python
2,378
85
import os import torch from torch import nn from torch.autograd import Function from torch.utils.cpp_extension import load module_path = os.path.dirname(__file__) fused = load( 'fused', sources=[ os.path.join(module_path, 'fused_bias_act.cpp'), os.path.join(module_path, 'fused_bias_act_kernel....
1b4436c0137a0c47bdfdb56059f1086f105b41f248c87a99a0c6c2566e451591
Python
2,378
68
import argparse import descarteslabs as dl import geopandas as gpd from scripts import query_patch DL_SYSTEM_PARAMS = { 'image': ('us.gcr.io/dl-ci-cd/images/tasks/public/' + 'py3.8:v2020.09.22-5-ga6b4e5fa'), 'cpus': 1, 'maximum_concurrency': 1, 'memory': '8Gi', 'retry_count': 4, ...
252e9dd2a08edb46ec98bf85013aba3eb38000ebfade566cddc273afa74ec2f2
Python
2,378
64
import pandas as pd import numpy as np from rl_analysis.util import count_transitions from rl_analysis.info.util import dm_entropy # takes a syllable-RLE time-series and spits out the number of # times the current syllable happens over the next N timesteps # # e.g. if 45 50 45 45 37 37 50 happens, then # counts_5 wou...
49e8783358c500d5f9fabbbec5217abec2556341e1c0bfe152083b980c55c719
Python
2,380
88
''' @author: Mahbub Ul Alam (mahbub@dsv.su.se) @version: 1.0+ @copyright: Copyright (c) Mahbub Ul Alam (mahbub@dsv.su.se) @license : MIT License ''' '''@file early_sepsis_detector.py run this file to go through the complete neural net training, testing and evaluating procedures, look at the 'early_sepsis_detector_con...
ad7f8430daab99ce306f4fefd1c989bd5fe398f40759d00afcea03d859afe41c
Python
2,381
63
#!/usr/bin/env python # coding=utf-8 # Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the BSD 3-Clause License (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://opensource.org/licenses/BSD-3-Clause # # Unless requi...
611759e6b43515e03de1ca81a2d1c68f9b86c09ce6d9e81c3727a03327a5eee5
Python
2,382
104
"""Group-average evoked response analysis. """ from sys import argv if len(argv) != 3: print("Please pass the number of states and run id, e.g. python 6_evoked_response.py 8 1") exit() n_states = int(argv[1]) run = int(argv[2]) #%% Import packages import os import mne import pickle import numpy as np from ...
1915c780bfc9513b195d30273bde2445337cdf11b743dd635c7420e23a501893
Python
2,383
90
# libraries import pandas as pd import numpy as np from sklearn import preprocessing import tensorflow as tf from tensorflow.keras.models import Model, load_model from tensorflow.keras import optimizers, regularizers from tensorflow.keras.layers import Dense, Dropout, BatchNormalization, Conv1D, Flatten, Input, Leaky...
4561b026e1029154ec76f55986b0713da86d274a06b85ff686b063d1c5ce835c
Python
2,383
82
"""Wakeman-Henson: Preprocessing.""" from pathlib import Path import matplotlib matplotlib.use("Agg") import mne from osl_dynamics.meeg import parallel, preproc # ---------------------------------------------------------------------------- rawdir = Path("data/ds117") outdir = Path("data/preproc") log_dir = Path("lo...
ccd5ebf2810517688ce0b317262ccb94a75d0c69ed4e59369528ff7170340d8c
Python
2,383
90
import json import os import urllib import urllib2 import subprocess import time class SPARQLDB: def __init__(self): self.EndPointUrl = "http://localhost:3030/NeuroMLOntology/query" self.ServerUrl = "http://localhost:3030/" # Check if fuseki server is up self.CheckIfUpAndStar...
8cb926752ef76ead349e30eb807e861ba04a0b671a54c924a5eed1b4ef49b918
Python
2,384
55
# 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...
0b5ed78058c6421b3a60ace32c560b25280d520bdd784b5dc8b516a8bd1f7195
Python
2,386
82
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...
6ae9165de27de5062cab3b7999ce0e9b7a297579a0545e47df545da6476c6355
Python
2,386
70
import os import numpy as np import pandas as pd from PIL import Image from torch.utils.data import Dataset class NABirds(Dataset): base_folder = "nabirds" def __init__(self, root, split="train", transform=None): assert split in ["train", "val", "test_unseen"] super(NABirds, self).__init__(...
a4baaad6a6a1848cbcb31bc6061fae977d804fc2a46f54ecfc508cd8e1700577
Python
2,386
63
# 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...
f84f5b9cee83e49e7a3eb9e8d6efe285e3712b084b12db79a7f1c9e1725f1948
Python
2,387
52
#%% from pymaid_creds import url, name, password, token from data_settings import pairs_path, data_date_A1_brain import pymaid import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from datetime import date from contools import Promat, Celltype, Celltype_Analyzer, Analyze_Nx_G #...
5044631062ad0ff23b2981c9580e25ed7e97d14fe1a308e8d18b1717a205beec
Python
2,392
25
"""Run in a fresh Unreal Python commandlet to check saved assembly references.""" import json,os from pathlib import Path import unreal P=Path(os.environ.get('CARLA_MODEL3_WORKDIR',Path(__file__).resolve().parents[4]/'artifacts/tesla-model3')) root='/Game/Carla/Static/Car/4Wheeled/TeslaModel3UE58';path='/Game/Carla/Blu...
3534b460b832d44edb9a65ae3ab731eefa227ac4f6e35bf84e2168c02e957554
Python
2,393
64
# 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...
3aec75906cdf37a33c7501cb88351056e5d91648a2801b6d36b9b141a49c3f29
Python
2,393
66
# 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...
67fa2f3640ba5d6afbbfd81022afd926d4596d6c664e6eb15017f31352814418
Python
2,393
73
import random, os import torch import numpy as np import pandas as pd from pprint import pprint from torch.utils.data._utils.collate import default_collate import torch.nn.functional as F import SimpleITK as sitk from torch.cuda.amp import autocast def seed_torch(seed): random.seed(seed) os.environ["PYTHONHAS...
a0c3ddc8f6edbf4e3170854e63741a740eca5ec327bc5cc15b8683ab753e7a64
Python
2,393
72
import logging import numpy as np from matplotlib.pyplot import figure from skimage.filters import threshold_local from skimage import io from lib import File, SegmentedFile, utils logger = logging.getLogger(__name__) def segment_stack( channel_file: File, threshold_method: str, min_vox_size: int = 3, max...
a24991952ea24b6a81faf5ee7ed7beb2d5553f3a09732ea0020632c8d656764b
Python
2,393
60
# 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...
5e4600c39df0882f432486952193ad17f1f11640279c25f5da01cf607e99600d
Python
2,395
64
import unittest import json from bds_api.dumps.bds_queries import IndividualDetailsQuery, ListAllAllenIndividuals, GetOntologyMetadata, ListAllTaxonomies class QueriesTest(unittest.TestCase): def test_individual_details_query(self): individual_details_query = IndividualDetailsQuery() result = ind...
ef4f785f2153c664a986245426c748b87e412612465d331efa5fa59a3ead4b91
Python
2,396
69
import pandas as pd import numpy as np import networkx as nx def create_proximity_model(g, locs, avg_th=10): # get connection vs dist stats conn_p_dist = [] for source_node in g.nodes(): for target_node in g.nodes(): if source_node == target_node: continue distance = np.sqrt...
c1c9cc2b0d3f04ac30a325e324639199e13ff99517a40355c9da941177878584
Python
2,397
94
from abc import ABC from monai.networks.nets import UNet from monai.networks.layers import Norm import pytorch_lightning as pl class LowResBrainmaskModel(pl.LightningModule, ABC): def __init__(self): super().__init__() # initialize network architecture self.model = UNet( spatia...
bd9488d2f4eebcb0dfb24e206a940a35bf5a7bee705dfb6c0013dffd3c037e1c
Python
2,398
70
""" This is a sample simulation that does not represent any particular biological system. It is just a showcase of how create a Simulation object, add forces, and initialize the reporter. In this simulation, a simple polymer chain of 10,000 monomers is simulated. """ import os import sys import openmm import polych...
3cc4733b8e27936f0110ffe0247500f29554e8a3c5bf74d75ba7681ecca5e03a
Python
2,399
69
# 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...
a7d6cab0c9e184199815653f14017490e805968f648f54e3feb70884071915b8
Python
2,399
78
import numpy as np import tensorflow as tf class DataGenerator(tf.keras.utils.Sequence): """Initialization""" def __init__(self, list_ids, dataset, dim, batch_size, n_classes=1, iterator=1, shuffle=True): self.list_ids = list_ids self.dataset = dataset self.batch_size = batch_size ...
f82ef171d85ebb218d6df810ebc4c1b0741c4911c4d5cbc884f9e52387016df7
Python
2,399
70
import torch from typing import Callable def graph_build_zero_filling(x: torch.Tensor, edge_index: torch.Tensor, node_mask: torch.Tensor): """ Subgraph building through masking the unselected nodes with zero features. """ ret_x = x * node_mask.unsqueeze(1) return ret_...
b22cd3d1ffcb967801ab295ab8b85f126f90cf2a0d7f35e72f28901dbca81bea
Python
2,401
72
import argparse from pathlib import Path import numpy as np import pandas as pd from tqdm import tqdm import trajectory from dataloading.model import Camera from dataloading.nvidia import NvidiaValidationDataset, NvidiaTrainDataset def parse_arguments(): argparser = argparse.ArgumentParser() argparser.add_...
3362fd49d6c1fd10473ee7da8f5b73ed911f1de209ac3eef633b06956bde53bb
Python
2,402
56
# 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...
3c0e8501cf38ac7b5866aa7c009ba1b39e5c789aa4ba73ebc7377a125a308b4e
Python
2,402
83
import inspect import re from .registry import PLUGIN_LAYERS def infer_abbr(class_type): """Infer abbreviation from the class name. This method will infer the abbreviation to map class types to abbreviations. Rule 1: If the class has the property "abbr", return the property. Rule 2: Otherwise, ...
7866bb0c24f631f1bb91a5cdb8459dbd04762367f9db7fe7e62e3cde574ba784
Python
2,402
63
# -*- coding: utf-8 -*- import numpy as np import homcloud.interface as hc import matplotlib.pyplot as plt from os import mkdir from os.path import exists def peristent_homology_sublevel_cubic( image, filename, save_path, plot_persistence_diagrams=False): """Calculate sublevel set cubical homology ...
86dea7ad0fbcbac0991f4e704e74183acf36a3662921b163fe56dee2201d2763
Python
2,402
65
#!/usr/bin/env python # fpkm_to_tpm.py # convert a file with an arbitrary number of columns to tpm using the following formula: # TPM_i = FPKM_i * 1e6 / sum(FPKM_g for all genes g) # formula based on a Lynch paper http://lynchlab.uchicago.edu/publications/Wagner,%20Kin,%20and%20Lynch%20%282012%29.pdf import sy...
44763eefc1ee44b61b02b95fd5ff9de3b0eeb78919a045ba4d576a646ed461f9
Python
2,403
84
from seaborn import boxplot, kdeplot, violinplot import pandas as pd from matplotlib import pyplot as plt from math import fabs buckets = [] folder = "results/runs/5-final" with open(f"{folder}/random_forest/crossval.txt", "r") as fin: buckets.append(("decision tree", [float(l) for l in fin])) with open(f"{folde...
b705c336cb84e307343896959f11455376243d65e989ad613f3e3e382c811c08
Python
2,404
79
import sys import numpy as np import torch from torch_geometric.datasets import TUDataset from torch_geometric.data import DataLoader, Data from torch_geometric.nn import global_mean_pool, GCNConv import torch.nn.functional as F #from explainers.guidedbp import GuidedBP from graphxai.gnn_models.graph_classification i...
b9aad8b0a5db55a81a791e13ecc655551503a134b826d792b98dda81b6013d0d
Python
2,404
83
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...
443d9993b83b2aa4b14f596f109e1dc0c8367ed3af5d4fee4037120162b10a40
Python
2,405
76
import pyBigWig import numpy as np from .target import Target class qSeqGenomicFeatures(Target): """ Stores the dataset specifying sequence regions and features. Accepts a path to directory containing bigWig files with feature values Parameters ---------- features : list(str) non-redu...
5d62857d52725b948c8188aa4593c89c73b9af99e6509ca4455989754d767f6d
Python
2,405
91
""" From https://github.com/wanghao14/Stain_Normalization Normalize a patch stain to the target image using the method of: E. Reinhard, M. Adhikhmin, B. Gooch, and P. Shirley, ‘Color transfer between images’, IEEE Computer Graphics and Applications, vol. 21, no. 5, pp. 34–41, Sep. 2001. """ from __future__ import div...
679aaa200452d0e819b3f153394f4150f276afbb100280c2a214ef6f0a1e7da9
Python
2,406
61
"""Registry mapping (patient_status, crop_method) pairs to crop strategy executors. This decouples the algorithm dispatch from ``croppingControllerClass`` so new crop strategies can be registered without editing the controller's branching logic. Each registered executor is called with the controller instance as its so...
7e32fb6a7ccf1138fd56c88cabcc4ec754b3e7121367700d8e1bd12748af984c
Python
2,407
65
import sys import torch from torch_geometric.datasets import TUDataset from torch_geometric.utils import remove_self_loops from graphxai.explainers import GNN_LRP from graphxai.explainers.utils.visualizations import visualize_mol_explanation from graphxai.gnn_models.graph_classification import GCN, load_data, train, ...
f4de0f2b04ecef269613c35d83487d0b4ba0fc2676c4e680da7cb42f61d4a54a
Python
2,407
68
#!/usr/bin/env python """Import ImageJ ROIs To identify and import ZIP files within all SIMA directories: >> python import_ImageJ_rois.py /path/to/sima/datasets rois For help and additional arguments: >> python import_ImageJ_rois.py --help """ import argparse import os import sima def remove_empty_ROIs(rois, im_...