sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
3cd5d02c7635e8ac48e0232194530d0829022852a0caaab79008590c29533bfd
Python
4,797
125
# basic imports import os import gc import pickle import numpy as np import pyqtgraph as qg # framework imports from cobel.agents.sfma import SFMAAgent from cobel.interfaces.gridworld import InterfaceGridworld from cobel.misc.gridworld_tools import make_empty_field # store experiment directory cwd = os.getcwd() # shal...
d8d63e48733ee5f1cf2387483d14b8a1b97767df43b2755c5effbf8e7a4ebca7
Python
4,798
123
# merge psi (percent spliced-in) tables together import glob import argparse import os parser = argparse.ArgumentParser(description='Merge rMATs files.') parser.add_argument('psi_base_dir', help='Base dir which contains all subdirectories from which files need to be merged') parser.add_argument('output_directory', he...
7c68886a93e46fe493cf5586e7830a9f7a70adddf437c93604023d4bb5f1f84f
Python
4,800
152
# Scaling module is adapted from here # https://github.com/ahendriksen/msd_pytorch/blob/master/msd_pytorch/msd_model.py import numpy as np import torch import torch.nn as nn from torchvision import models def scaling_module(num_channels): c = nn.Conv2d(num_channels, num_channels, 1) c.bias.requires_grad = Fal...
202f6d0933eaa23291e4cc3f802694ec541cd2fb3b7d1c2b96172452a1bdfee7
Python
4,801
125
""" Handles computing and outputting the difference scores """ from .handler import PredictionsHandler class DiffScoreHandler(PredictionsHandler): """ The "diff score" is the difference between `alt` and `ref` predictions (`alt - ref`). Parameters ---------- features : list(str) List ...
62e0e766ccbdbf44c4b4735ec6c90dcd4d15c79be22e8b93d7c8df430037370a
Python
4,801
181
#%% import matplotlib.pyplot as plt import numpy as np import seaborn as sns from scipy.ndimage import gaussian_filter1d from src.data import load_maggot_graph, load_palette from src.io import savefig from src.visualization import adjplot, set_theme from src.visualization import HUE_KEY, ORDER_KEY set_theme(font_scale...
fbcf4ffacf0e16ee6566bd1c93a17562175f0048105de6ae6635eb2bdf2856d4
Python
4,802
136
from __future__ import print_function # -------------------------------------------------------- # Fast R-CNN # Copyright (c) 2015 Microsoft # Licensed under The MIT License [see LICENSE for details] # Written by Ross Girshick # -------------------------------------------------------- import os from os.path import joi...
d9b9b9cf36d24da81572e6b68d91e5df2f92ce3ddede696f0dc6d9e8d1eb3997
Python
4,804
139
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import logging import os import torch from maskrcnn_benchmark.utils.model_serialization import load_state_dict from maskrcnn_benchmark.utils.c2_model_loading import load_c2_format from maskrcnn_benchmark.utils.imports import import_file from mask...
988bae02cdc38db6f36211314097605d01929b94ed996d05cc30066bbe7a42f1
Python
4,805
151
""" DyNeMo: Plotting Networks ========================= In this tutorial we will plot networks from a DyNeMo model trained on source reconstructed MEG data. This tutorial covers: 1. Load regression spectra 2. PSDs 3. Power maps 4. Coherence networks 5. Coherence maps """ #%% # Download post-hoc spectra # ^^^^^^^^^^^...
4957ccc96912681d9a9df863d0ef893f5fe1e688dc73017a257ff2944b020bca
Python
4,807
129
# -*- coding: utf-8 -*- ''' @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 torch.nn as nn import torch from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence import numpy as np class RNN_LSTM(nn...
42de36f4de9e30b11054c414e87077a0e1e29957ab63e50f4d65f5631630ca59
Python
4,808
185
#%% from src.data import load_maggot_graph from pathlib import Path import pandas as pd import time from graspologic.cluster import DivisiveCluster, AutoGMMCluster from src.visualization import CLASS_COLOR_DICT import numpy as np import matplotlib.pyplot as plt from giskard.plot import crosstabplot import datetime from...
fe9a756281e351459bc98b096d2abdfaa48849eaf2f264f41c8eb531b03edd13
Python
4,809
138
#!/usr/bin/env python3 """ File: get_gene_expression.py Created: 2021/05/19 Last Changed: Author: M.Vochteloo Copyright (C) 2020 M.Vochteloo This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software F...
650c2e42d7d4b2365dfb2fb78a9ea00e4a9575ccb5af0c7c506cab96ceb51d01
Python
4,810
199
#%% import datetime import time import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from pkg.data import load_network_palette, load_unmatched from pkg.io import FIG_PATH, get_environment_variables from pkg.io import glue as default_glue from pkg.io import savefig from pkg.plot ...
5bf0e857dcd6485046f86005b2b7cb14ab46139bbf83ef2268ff3714da6b573b
Python
4,811
109
#!/usr/bin/env python3 """Inventory the .scenic scenarios reachable from this environment. Reads each file's header statically — no Scenic import, no server — so it works before anything is installed and cannot be broken by a bad model import. python3 list_scenic.py every scenario, its model and map...
c50d0769a77e8f261cd0f4a26244f9ba10d3a646c19350bc62d9559f82524e60
Python
4,811
136
#!/usr/bin/env python3 """ File: combine_rosmap_ihc_files.py Created: 2020/06/30 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 Softw...
e5176835ee2801fa7b8bdab0522f62406a0d76fb2f3f4e123722d995951077a6
Python
4,811
174
# -*- coding: utf-8 -*- import queue class CSummaryTree(object): def __init__(self, root_node): assert isinstance(root_node, CSummaryNode) self.root_node = root_node def get_same_level_max_node_depth(self, query_node): if query_node.name == self.root_node.name: return 0 ...
5f3441e6d0f61ae38fdfe491c2c9f53cf5b6dc8ada312e3993a564689dd2798c
Python
4,813
141
#!/usr/bin/env python3 # # 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 u...
33dc0389260e879507ab76abfe479b2d8678557854907c53cb07487d392174de
Python
4,814
130
#%% import os import sys 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/maggot_models/') sys.path.append('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/') fr...
5be0738e478586a90738a5f9a7398dd7f1fe1afc0dc0f661f1ab08e59247a31c
Python
4,816
135
# 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...
8bb436100328dd4ffb48e7519c62d2c6f20eee34d5f355cdeae5fe1e21739ab3
Python
4,816
141
''' Mean-field Dyn @YX 1210 Edit ''' import numpy as np import matplotlib.pylab as plt import matplotlib from numpy import linalg as la from scipy import linalg as scpla import scipy # import seaborn as sb from cmath import * from scipy.optimize import fsolve,leastsq,minimize import scipy.integrate from math import tan...
202037d5c27184d3193f4f5994b7bd2e7ac348d8415b75f36290a8d8f60eb8bb
Python
4,819
156
""" The example with nx=3, ny=4 should run ~1.5secs """ import numpy as np import carpet.visualize as vis import matplotlib.pyplot as plt # =====Ring===== import carpet.lattice.ring1d as lattice # Geometry N = 6 # number of cilia a = 18 # [um] lattice spacing e1 = (1, 0) # direction of the chain ## Initialize # G...
cdc03f3e50e691d70198a3e2de5c9c15256b66058842a91de638b6298d3fd6e5
Python
4,819
128
import numpy as np import math class SamplePadder(object): # this transformation object will pad the image and the masks so that: # - they are the same size # - they are properly aligned # - they are square # - the side length is a multiple of <img_size_mult> # optionally, the transformation c...
9a73c9ae5931541feca6089927581695df9b4d2e19091e14ceb85030da6d3449
Python
4,820
118
"""In-editor half of import-carla-ue58-prop. Runs inside UnrealEditor via `-run=pythonscript`; never invoke directly. Reads a job JSON, imports each FBX as a StaticMesh, measures it, and writes a result JSON. Three UE 5.8 facts shape this file: * print() and unreal.log() from the pythonscript commandlet do NOT reac...
14727f4a9e462d7a2e70956dc866a61bdb5bb1c8a82fca152a52b8be171cf7dd
Python
4,822
140
import numpy as np import matplotlib.pyplot as plt import time from helper import * from ALsim import ALsim import sim import sys import os from ALsimParameters import std_paras import random """ Run and experiment to investigate the effect of decreasing response with higher concentration. We generate N_odour-1 odour...
772e7db79873a9829aa127693930528b25158404b3ecf207fe83766b5cb1beb8
Python
4,822
121
# 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...
14e8bc266aca502cfc2ea314c96b3ce933305dcf0e7b3e41551f202724005488
Python
4,823
151
''' MRNet Challenge Submission script Output predictions file should be a 3-column CSV file (with no header), where each column contains a prediction for abnormality, ACL tear, and meniscal tear, in that order Yash Bhalgat, yashbhalgat95@gmail.com ''' import numpy as np import os import pickle import sys import torc...
3f2b5a213fd84075a994843fecfb4b6c0640f1c6831c12a85f0621e62db43ea6
Python
4,825
163
#!/usr/bin/env python3 """Tests for io.""" import os from pathlib import PosixPath from unittest.mock import patch import numpy as np import pytest from phys2cvr import signal # ## Unit tests def test_spc(): # Test case 1: test with a single time series ts = np.array([1, 2, 3, 4, 5]) expected_result =...
58babcc19df9527da6ff90b829ff374864fa290ad5d4e08eb4ad6158d1b713e6
Python
4,826
134
# 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...
f2689122479eaf5b5f691afde8dffa8aaf58d4c75a88d9d89c0c06f76445e473
Python
4,828
127
# 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...
10d629a8b3333da1acd3413c0aa352df27e2820ee3f9ae36f2fea3971b232d14
Python
4,830
174
import numpy as np import pytest import tensorflow as tf from typing import List, Tuple TypeFixture = Tuple[tf.Tensor, tf.Tensor, tf.Tensor, List[int]] #------------------------------------------------------------------------- @pytest.fixture def setup_flip_img(img_dims: List[int]) -> TypeFixture: """ Create fix...
6cc337a9d7f0dbac6193a822516c6cdc101b6440fa54b8c6826dd84799b1c61c
Python
4,830
138
import torch.nn as nn import torch.nn.functional as F from torchvision import models class InceptionV3(nn.Module): """Pretrained InceptionV3 network returning feature maps""" # Index of default block of inception to return, # corresponds to output of final average pooling DEFAULT_BLOCK_INDEX = 3 ...
36d992eb8860f4897a3105af82388e83feece7874e2754388e41afc4b1b5beeb
Python
4,831
103
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 PYCHARM_EXEC = os.getenv('PYCHARM_EXEC') == 'True' import numpy as np import tensorflow as tf from tensorflow.keras.callbacks ...
946fefad5a80c8de8118a0c0aa57c1c209a82d2868d08b43dde919a444141c66
Python
4,834
125
from PIL import Image import numpy as np import pandas as pd import torch from torchvision.transforms import transforms import mne from RV.model.utils import tf from RV.callbacks.utils.channel_selection_utils import get_10_20_channels def segment_metadata(raw: mne.io.Raw, events: np.array, window_size: float): ...
e135056401c1810a80c785c0c43d95a3476d9bb5996dbee578829a883cda215d
Python
4,834
135
#!/usr/bin/env python3 """ File: get_trait_info.py Created: 2020/11/17 Last Changed: Author: M.Vochteloo Copyright (C) 2020 M.Vochteloo This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundat...
b17c04762b78c7e556db8c86e1b7dc75f93661f4595f38931d43f9067bed0535
Python
4,835
140
# 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...
0ab4c08ccee7b477f5e0a514cefb46eb23a826b3e28166083c58ef095de104c6
Python
4,836
139
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import logging import os import torch from maskrcnn_benchmark.utils.model_serialization import load_state_dict from maskrcnn_benchmark.utils.c2_model_loading import load_c2_format from maskrcnn_benchmark.utils.imports import import_file from mask...
1c5069e41b11705e2f6b526a91eaf59dd30cfb808dbe6ddb10a99fe19f07e441
Python
4,836
123
# -*- coding: utf-8 -*- import os import json import shutil import argparse from drugex.logs import logger from drugex.logs.utils import enable_file_logger from drugex.utils.download import download_file from qsprpred.data.sources.papyrus import Papyrus def DownloadArgParser(): parser = argparse.ArgumentParser...
afb9fa181231c9e88c586155c16eaeeab77f828b73c928c7d53a274e286c6ce0
Python
4,836
134
# 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...
e23139ff702f5bc96d879e1604a8c567c02ab8d288890e6d300c16a545db4e43
Python
4,841
128
#################################################################################################### # Copyright (c) 2019 - 2023, EPFL / Blue Brain Project # # This file is part of VessMorphoVis <https://github.com/BlueBrain/VessMorphoVis> # # This program is free software: you can redistribute it and/or modify it unde...
e5b382aca4746633345da57fcfc9c617edb67571514fb175ba681d71a1722297
Python
4,842
121
# 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...
8f6b480518285733f7db1cb81981f571e4a7ce9fad472b3dc875c95c17e046cf
Python
4,843
129
# basic imports import os import numpy as np import pickle def recoverStates(replay): ''' This function extracts the states of replayed experiences. | **Args** | replay: A sequence of replayed experiences. ''' states = [] for experience in replay: states ...
3424f7a4396f06f737105b5152554aa3629c536c666f60afd0ad658265a1ca34
Python
4,844
135
# 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...
7b8373f8bf4bf408cf6f88e0ed91e2bd2fd730c646212611cf436992c273311e
Python
4,845
122
# 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 a...
84d57cb45f744646ced56fa0990ddf6c2474d5a3e7bc1fec0b44f1da0823c7ba
Python
4,845
115
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import itertools import torch from torch.utils.data.sampler import BatchSampler from torch.utils.data.sampler import Sampler class GroupedBatchSampler(BatchSampler): """ Wraps another sampler to yield a mini-batch of indices. It enfo...
444414bf96b6dacc0c7863c6b78984b8ab32e0836e8d9c7fab24c4d0efc23099
Python
4,846
113
# -*- coding: utf-8 -*- import mne import pandas as pd import numpy as np from scipy.spatial.distance import cdist import glob import seaborn as sns Brain = mne.viz.get_brain_class() subjects_dir = str(mne.datasets.sample.data_path()) + '/subjects' mne.datasets.fetch_hcp_mmp_parcellation(subjects_dir=subjects_dir,...
1cae412ac18ee2fbc734421065dad25402bf11a08bc7feff94dd65e7f464541d
Python
4,847
124
""" In this script, we use KFold Cross Validation to train the model. We save all of the K best models. """ from __future__ import print_function import numpy as np import random import pandas as pd from scipy import stats import sys, os import logging import tensorflow as tf from keras import layers from keras import...
426c1bd0b987e60089d83a3d25e81115ec375674fd772c63fa0a0feede30f76b
Python
4,848
113
"""Phase 3i regression tests: dual-valence Bennett-MV / Felsenberg-POM model. Headline behaviour: parallel appetitive (w+) and aversive (w-) traces, with cross-valence DAN feedback (M+ excites D-, M- excites D+). This is the mathematical instantiation of Felsenberg 2018's parallel-opposing-memories. The diagnostic fo...
16cf4da5f8cd989911c7327fa7a97ce8aa836825e665f7b2e3795ce10ed2188b
Python
4,849
119
import warnings warnings.filterwarnings("ignore") import numpy as np import sys import os from Bio.PDB import * from sklearn.neighbors import KDTree from IPython.core.debugger import set_trace # Pablo Gainza 2019 - eval zdock results for comparison with MaSIF. def test_alignment(target_pdb_fn, source_pdb_fn, aligned...
660be04dd9cf03dfba8817fc946bb8127502778694f2d936f1b7ef2dbc73bdc5
Python
4,855
156
# -*- coding: utf-8 -*- # # PIDGINv4 documentation build configuration file, created by # sphinx-quickstart on Thu Aug 2 09:36:15 2018. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # ...
9bc8e8c8c7d6133c3e7cd8cd0ea256eb3c31eb208421bd98b2a87d0a44423467
Python
4,857
159
# -*- coding: utf-8 -*- # # bruker2nifti documentation build configuration file, created by # sphinx-quickstart on Fri Jul 28 10:16:25 2017. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. ...
8ae316364e5c51e8d02319cb9a7f26d17650badcebe90f575b61f5047607ba3a
Python
4,858
104
# -*- coding: utf-8 -*- import numpy as np from scipy import stats from . import utils from ._base import _EmbeddingCausality, _DirectCausality class ConvergeCrossMapping(_EmbeddingCausality): def fit(self, data): self._preprocess(data) self._fit_data() def _fit_data(self): n_row = s...
99eb6741d35d63cb380c637f53a3b0dfbc0ceda3a178768fc61afad4cf3e1c9a
Python
4,858
118
import os import numpy as np import torch from cgtasknet.instruments.instrument_accuracy_network import CorrectAnswerNetwork from norse.torch import LIFAdExState from tqdm import tqdm from create_dataset import create_dataset_default_values from load_network import load_network criterion = torch.nn.MSELoss() def r...
d00cfc412ce011273bf18c2b44965cc9f74df05a28f454fe35c547889d7593ea
Python
4,858
121
"""Tensorflow model utility functions.""" import tensorflow as tf import os import tempfile def get_layer_index_by_name(model, name): for i, layer in enumerate(model.layers): if layer.name == name: return i def negative_log_likelihood(y_true, y_pred): '''Implemented by Fred Howard, adapte...
c26a304fa5068327d8aaabeca0636d729771906b8bf18fd21e00d971da6b7ef8
Python
4,859
125
# 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...
e3e9d4c8bddda110829090fbd755433bd373721d3c68169e04ddeaab18bd4ba3
Python
4,860
118
# 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...
f1c4ad1d87eee73c01fba5a49de70b12fff5391cdad9e8f164ea1a19fa66fe26
Python
4,861
129
# 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...
303acd927f435a6ec90198ef9d046ac0460776c3bca38e83b038363cdc011b94
Python
4,866
143
#!/usr/bin/env python3 """ File: gradient_plot.py Created: 2020/04/15 Last Changed: 2020/06/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 published by the Free Softw...
48bd11c1c8c54a9ef34a7e9712d827a76c1cfa4d753a46b1df10ec3e9fc194e6
Python
4,866
142
import numpy as np import pandas as pd ''' Descirption study: EEG music convolution study Protocol: Coma PP music Resp.: F Perrin Lead.: L Heine Code: L Heine - A Corneyllie this file gives general settings for the study 'Early Evocked' ''' ################################### ...
1738f93457db3fff5a84a07d7b3b3a1e4a6e01f729c40f3f47b5d2b63c004289
Python
4,868
125
# Copyright 2021-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...
33705856f9d13e60118507b0822260e018a68f7c02df331e0828df3671589aca
Python
4,869
175
from neuron import h import matplotlib.pyplot as plt import numpy as np from scipy.signal import find_peaks from cell_models import OLMCell from opt import myinit, mystyle # Make plots nicer! plt.style.use("seaborn-colorblind") plt.rcParams.update(mystyle()) cellname = 'olm' # If we had not included gui in the list...
a435376cfc9c9428a38e75ed71f996aa8f6b2ebc9afeddd2c8a99a51947c5126
Python
4,869
139
#!/usr/bin/env python3 import sys, pathlib, os import unetsl.cli_interface import unetsl.model import unetsl.data import unetsl.config import math import time import tensorflow as tf import click def trainModel(config, n_gpus, base_name): input_file = base_name model_output_file = base_name if pathli...
63f098d8eef81cdc78568c48df0b28b2554b968e47c7cc755140c97adb5ec610
Python
4,870
151
#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 in wr...
cb1f7173af6ef5c84dd79c924806d0dd96e49ea876e5442e377519550521b71b
Python
4,870
122
# Google utils: https://cloud.google.com/storage/docs/reference/libraries import os import platform import subprocess import time from pathlib import Path import requests import torch def gsutil_getsize(url=''): # gs://bucket/file size https://cloud.google.com/storage/docs/gsutil/commands/du s = subprocess....
5f8550fa7b8a177b0807bf5dc539edb75973d0edc275307f84d087076db6ecae
Python
4,871
175
from neuron import h import matplotlib.pyplot as plt import numpy as np from scipy.signal import find_peaks from cell_models import OLMCell from opt import myinit, mystyle # Make plots nicer! plt.style.use("tableau-colorblind10") plt.rcParams.update(mystyle()) cellname = 'olm' # If we had not included gui in the li...
38ea19710b813d9578abaa05ab12f0a8c2b8a051abd0f0f0001e9e8cf8d84df3
Python
4,874
124
import os import time import numpy as np import cortex import warnings warnings.warn(''' `glabtools.save_3d_views.save_3d_views()` has moved to `glabtools.viz.pycortex_extras.save_3d_views`''', UserWarning) file_pattern = "{base}_{view}_{surface}.png" _combine = lambda a,b: ( lambda c: [c, c.update(b)][0] )(dict(a))...
b094938444edcb114f704193ce83a4d304765dab772ae216835614c872b359ae
Python
4,874
127
# 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...
54d793b3931711256a9027df3be0f229c23dd06321a3dc7c5fce2d31287f1d6b
Python
4,875
123
from typing import Optional, Callable #from collections.abc import Callable import torch from torch_geometric.utils import k_hop_subgraph from torch_geometric.data import Data from torch_geometric.utils.num_nodes import maybe_num_nodes from graphxai.explainers._base import _BaseExplainer from graphxai.utils import Ex...
bfe435f606b4920f468b2ab59dfeb99d7d4b09a478f179ff25a01845537edeb3
Python
4,875
135
import copy import platform import random from functools import partial import numpy as np from mmcv.parallel import collate from mmcv.runner import get_dist_info from mmcv.utils import Registry, build_from_cfg from torch.utils.data import DataLoader from .samplers import DistributedGroupSampler, DistributedSampler, ...
f7491b0d3631e0fe7264582441489a0e97b6815ef792423d6da903da121db562
Python
4,875
119
# 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...
265cd1b2a4c9a21d02dacd2fa4625d97875066b05f0f0f349c242326053ca27b
Python
4,876
124
# 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 # -- Path setup -------------------------------------------------------------- # If ex...
7b9be4e210f14911659afc602faa2b34cd8850530be34906c45acc2573259f5f
Python
4,878
150
"""High-level loaders for MedMNIST-NAS-Bench data. The benchmark ships two parallel formats per (dataset, search_space): * ``<search_space>_<dataset>_bench.parquet`` &mdash; flat tidy table of all scalar metrics. Best for SQL-style queries, ranking architectures, and pandas/polars/duckdb workflows. * ``<search_sp...
33e4c671fe21810447a60755d957980eed050b56a9e5a16f7eed66c574902823
Python
4,879
137
import argparse import torch import sys import os.path as osp sys.path.append(osp.join(sys.path[0], '..')) import mmcv import models from mmcv.parallel import MMDataParallel, collate, scatter from mmcv.runner import load_checkpoint, obj_from_dict, parallel_test from mmdet import datasets from mmdet.core import coco_e...
f765d0e5bffc3c18deffa3e4b92288aa7bc332a42b1055c2bb212aa10685f648
Python
4,879
119
# 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...
373b1c4e0c2c9991c211807b7c99fd9cce779232bf8168ec95a9dcb95dc39a8d
Python
4,881
140
# 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...
7fcff5ffa8a4b86ab40f407c3261ff0b8bdbbbd435f1e69cad593999afcdd49d
Python
4,882
127
"""MobileNetV2""" import torch.nn as nn from models.baselines.base_model.basic import _ConvBNReLU, InvertedResidual __all__ = ['MobileNetV2', 'get_mobilenet_v2', 'mobilenet_v2_1_0', 'mobilenet_v2_0_75', 'mobilenet_v2_0_5', 'mobilenet_v2_0_25'] class MobileNetV2(nn.Module): def __init__(self, num_clas...
9ca06c05241097723dceeb6d3c442aa9bf7965b20404575d9507b795af88d16f
Python
4,888
157
import numpy as np from matplotlib import pyplot as plt from matplotlib.patches import Rectangle from matplotlib import rcParams from matplotlib.backends.backend_pdf import PdfPages rcParams.update({ 'font.family':'sans-serif', 'font.sans-serif':['Liberation Sans'], }) fnames = [ 'learn.np...
3869d56fd9e0c8075fb361e2301968e15a873f1ed55f8d6f170992bef459928a
Python
4,889
171
# %% [markdown] # ## import datetime import os import time from pathlib import Path import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import pandas as pd import pymaid import seaborn as sns from src.data import load_palette from src.graph import MetaGraph from src.io import savecsv, savefig f...
d4b720ac3190d67b5f9e60e2d230338803449e31b05b33bb5df8f8b93a4f472d
Python
4,889
120
from base.backend.settings import Settings as BaseSettings import typing as tp import torch class Settings(BaseSettings): exmask_enabled: bool use_gpu: bool too_many_roots: int @classmethod def get_defaults(cls): defaults = tp.cast(tp.Dict[str, tp.Any], super().get_defaults()) defa...
5679b4c96b8e82a944ee71b9286e2fd4e210391b87a6cbc1a30c0ed282cbd670
Python
4,890
126
""" Handles computing and outputting the absolute difference scores """ import numpy as np from .handler import PredictionsHandler class AbsDiffScoreHandler(PredictionsHandler): """ The "abs diff score" is the absolute difference between `alt` and `ref` predictions. Parameters ---------- fea...
8bbc37d946eda193928828e468bdaa0d5cdcda6ffc21dac57d25d72396cacb9a
Python
4,891
111
import torch from torch.nn import functional as F def plasticity_rule(activation, e, params, feedback, Theta, vec, fbk): """ Pool of plasticity rules. This function receives the network weights as input and updates them based on a meta-learned plasticity rule. It's worth noting that the weights ...
76c30f41177ad9910c9a390fdbfb66174d943511f635e849e6db61818b27c59e
Python
4,893
144
# Time-stamp: <2024-10-02 16:55:48 Tao Liu> """Description: Random sample certain number/percentage of tags. This code is free software; you can redistribute it and/or modify it under the terms of the BSD License (see the file LICENSE included with the distribution). """ # ------------------------------------ # pyth...
58e4e56b404fa286b2f9c08412e6fd469ed02d256aa904e87ff6dc4f957a8241
Python
4,895
156
#!/usr/bin/env python # Copyright 2015 David Snyder # Apache 2.0. # # This script creates four files for each HUB4 Broadcast News # transcript file. The four files are for the music, speech, ad, # and other transcripts. Each line of the output files define the # start and end times of the individual events. # # This ...
11b805da27d737457601cf23fc3b7cf8fa15446ebe0e5d982e75b17a113bb246
Python
4,896
131
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. from collections import OrderedDict from torch import nn from maskrcnn_benchmark.modeling import registry from maskrcnn_benchmark.modeling.make_layers import conv_with_kaiming_uniform from . import fpn as fpn_module from . import resnet from . im...
6baec7d898cc59f05e0bd38a4c63f4f55250032b04f24bb53cb0b9d28b4cd06d
Python
4,896
130
""" File: data_filter.py Created: 2020/09/04 Last Changed: 2021/08/04 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, either ver...
39d9a65f1754a5891921766407610e8d5cebf8235a3c2d0a82fa996694e64e47
Python
4,898
140
from __future__ import division import math import numpy as np import torch from mmcv.runner import get_dist_info from torch.utils.data import Sampler class GroupSampler(Sampler): def __init__(self, dataset, samples_per_gpu=1): assert hasattr(dataset, 'flag') self.dataset = dataset self....
9c80a038877a8fe02b4f3d2ff3aa59b2924c412b0e2475f97e4f1054275a8f08
Python
4,898
132
import os.path as osp import warnings from mmcv.runner import Hook from torch.utils.data import DataLoader class EvalHook(Hook): """Evaluation hook. Notes: If new arguments are added for EvalHook, tools/test.py may be effected. Attributes: dataloader (DataLoader): A PyTorch dataload...
e3c9d2aca8a77aec4b9477e1ec44ecdd58935359729b5cd5b837986b867702f5
Python
4,898
158
import os import warnings import subprocess import platform import shutil import sys import pytest from bruker2nifti.converter import Bruker2Nifti here = os.path.abspath(os.path.dirname(__file__)) root_dir = os.path.dirname(here) def test_convert_the_banana(open_converted=False): pfo_study_in = os.path.join(r...
8000c1b60fecbfb2f84b87c270015ddc242fbd0efa2034fc5dc141266b6b4685
Python
4,901
144
# Copyright Copyright 2021 Huawei Technologies Co., Ltd (authors: zhangqi) # 2023.02 - Modified code to support Mindspore # 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 ...
1e691fb922f368ad9fd6f543625a11095c2ab02f69df87d417a2ef9db67160b5
Python
4,902
136
"""Modified version of UNet model for brain parcellation with encoding and decoding blocks.""" from torch import nn class BaseUnetModel(nn.Module): """Implementation of BPARC-UNet model for brain parcellation. Args: in_dim (int): size of input layer hidden_dim (int): size of hidden layer ...
3e30e0524679a5536f5681c03f2549a51b58a6cd4f4c0573f8c0b960fbafaddc
Python
4,903
172
import base64 import json import re import sys import uuid from io import TextIOWrapper from pathlib import Path from typing import Callable, Iterator, List, Optional, TextIO, Union import kgcl_schema.datamodel.kgcl as kgcl import kgcl_schema.grammar.parser as kgcl_parser from kgcl_schema.grammar.render_operations imp...
22ff52a431896e36a6008b57426bfa10672f5564a428af5fe16c7d0eb4d94633
Python
4,904
149
######################################################################## # Interplay of membrane curvature and actin assembly # # Modeling the shape and size of GUV dumbbells # # Felix Frey, TU Delft, 2022 # #########################...
640f852f0bd8195e7cf6be06b123b3b054343b79f775108db551ac6f4aac9f71
Python
4,905
128
# 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...
791ecc851dcb83ff84e70653a8c0abe894df8db7e36e31070185d6388c3867f3
Python
4,908
104
import argparse import numpy as np from keras.models import load_model from plotread import * def evaluateresults(model, opt, trainx, trainy, validx, validy, testx, testy, output_size): #Evaluate on training, validation and test data train_l = model.evaluate(np.array(trainx), np.array(trainy), batch_size=opt....
4547959eb333e34ffa10b82cfcf6731c6d37f702895227aa143485b933a7770b
Python
4,910
182
# -*- coding: utf-8 -*- """ Spyder Editor. This is a temporary script file. """ from neuron import h import matplotlib.pyplot as plt import numpy as np from scipy.signal import find_peaks from cell_models import CCKCell from opt import myinit, mystyle # Make plots nicer! plt.style.use("tableau-colorblind10") plt.rc...
17e3ea1c38ffd1b9531f0e4219e0a7d660957294a24e3d30cd78e37a47ddb117
Python
4,911
125
import math from queue import Queue from IPython import embed import torch import torch.distributed as dist import torch.cuda.comm as comm from torch.autograd.function import once_differentiable from torch.nn.modules.batchnorm import _BatchNorm import torch.nn.functional as F import syncbn_gpu from maskrcnn_benchmark...
0f001495176787ba1ca83b366602824cc87163efa27cf4a984076bbc2fea13eb
Python
4,913
171
import numpy as np from scipy import signal import weave from .Trace import getRisingEdges def getIndicesFarFromSpikes( T, spikes_i, dt_before, dt_after, initial_cutoff, dt ): T_i = int(T / dt) flag = np.zeros(T_i) flag[: int(initial_cutoff / dt)] = 1 flag[-1] = 1 dt_before_i = int(dt_befor...
998f1ff63e7b3e0f417a8e308e8532c45aec3c14884c17bbfbdb11bf5bb02d33
Python
4,913
183
# -*- coding: utf-8 -*- """ Spyder Editor. This is a temporary script file. """ from neuron import h import matplotlib.pyplot as plt import numpy as np from scipy.signal import find_peaks from cell_models import CCKCell from opt import myinit, mystyle # Make plots nicer! plt.style.use("seaborn-colorblind") plt.rcPa...
bcce29df61cabf1763fffe6f1154c437c2da4485408db292c0697bde88a4fcae
Python
4,914
150
# 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...
3897cf010f573276a6de7127c2eff8d56a91e9589b8bfdf768079fdfef98534c
Python
4,915
136
#%% 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...
4029f2931a3939ee5a3f1e3952840a99f8bb6df2f281e19a96f978c40645f55a
Python
4,916
115
''' @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...
9ec0edfda7af0a73d39a956df816dd4dd2e7926fcd1494de573b4f9783f1ad9d
Python
4,916
135
#! /usr/env/python import warnings from os.path import exists as pexists from os.path import join as pjoin from os.path import pardir import pandas as pd from bids import BIDSLayout class ThingsMRIdataset: """ Data loader for the THINGS-fMRI BIDS timeseries dataset. """ def __init__(self, root_path...