sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
89a47f18718c92d9b864dcdde9bc9a346119b83e51286aaebe81894da18c378b
Python
1,014
39
from PIL import Image, ImageFilter, ImageOps import math import random import torchvision.transforms.functional as tf class TwoCropsTransform: """Take two random crops of one image""" def __init__(self, base_transform1,base_transform2): self.base_transform1 = base_transform1 self.base_trans...
0213e6cb0b7c1a5d99d950de92fd1dc1043630dfa550be7541ee0285d26c6e23
Python
1,015
18
#################################################################################################### # 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 ...
1cdf27b0807af08204cd34be6173da0d5955cb1094844f5b2a065187c652fa80
Python
1,015
19
#################################################################################################### # 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 ...
64fb340ed7fc5eedec27166b62c5232dba6963fd63f53490834db6a452a469f1
Python
1,015
18
#################################################################################################### # 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 ...
65ffabbc1216b7cee8ae84ab953cfb1f311b00908b45c311d4b6e07876f0e71c
Python
1,015
35
#!/usr/bin/python import Bio from Bio.PDB import * import sys import importlib import os from default_config.masif_opts import masif_opts # Local includes from input_output.protonate import protonate if len(sys.argv) <= 1: print("Usage: "+sys.argv[0]+" PDBID_A_B") print("A or B are the chains to include in ...
ebc43360822562a9e6997268da534f7cd511c2cfe37f09292b2064730e95afae
Python
1,015
39
from typing import Any, Dict from pydantic import BaseModel from oaklib.types import CURIE class KeyValCache(BaseModel): """ Key-value cache for storing arbitrary data. """ cache: Dict[str, Dict[str, Any]] = {} def add(self, curie: CURIE, property: CURIE, value: Any): """ Add a...
03e333d0c0fe9ddd463dba4c3ed7ac2bed35938e6a20b5e8ca7751bf08733226
Python
1,016
31
"""MNI152 standard brain surfaces. Pre-extracted surfaces from the MNI152 T1 1mm brain using FSL BET. These files are downloaded on first use, see :py:mod:`osl_dynamics.files._fetch`. Files ----- - smri.nii.gz: MNI152 T1 structural MRI. - inskull_mesh.nii.gz, inskull_mesh.vtk, inskull.png - outskull_mesh.nii.gz, outs...
405376e77786f8a3a8683e57ca1150b80ebf7400036177da372b417a6843bf5c
Python
1,016
19
#################################################################################################### # 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 ...
a3ed1d16c55cf7a2eff205f49f53ae2b66d27ae2f42ba4b7981a602bfa0f6552
Python
1,016
18
#################################################################################################### # 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 ...
fe1db241dc592602388d4dc210b3cae6120623379a6b7548b28906e74e27bffd
Python
1,016
18
#################################################################################################### # 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 ...
2582c4f5dbbf233bf777974756a0e808ba32fbde66b96294dcd8d02b813c5cdb
Python
1,017
34
import os.path as op import numpy as np import numpy.testing as npt import nibabel as nib import nibabel.tmpdirs as nbtmp import dipy.data as dpd from dipy.reconst.shm import calculate_max_order from AFQ.models import csd def test_fit_csd(): fdata, fbval, fbvec = dpd.get_fnames('small_64D') with nbtmp.InT...
3b4266b7cbe8e9bc1a20eb579be1765b9a300a2cf949d906ae1d587ae57fd89b
Python
1,017
19
#################################################################################################### # 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 ...
893ec2d68ad54eec07fcbef4e3136183cfcf0d00f65eddfdd6452f9880c6cb45
Python
1,017
34
#! /usr/bin/env python """ Convert empty IPython notebook to a sphinx doc page. """ import sys from subprocess import check_call as sh def convert_nb(nbname, execute=False): if execute: # Execute the notebook sh(["jupyter", "nbconvert", "--to", "notebook", "--execute", "--inplace", nbname...
ceeccbc618bef454a920b3f8898d9f76c6568f6579aebdaa134cbb7239121de9
Python
1,017
37
import torch from cgtasknet.instruments.correct_answer import ( _is_correct_output, _is_correct_output_batches, ) def test_correct_output_good_answer(): real_outputs = torch.zeros(10, 1, 2) target_outputs = torch.zeros(10, 1, 2) real_outputs[:, 0, 0] = 1 target_outputs[:, 0, 0] = 1 asser...
97a9bec62f3dbc1abbf4b2d63967cf63d07f39e4cb574f6ec641b8e8970485a5
Python
1,018
26
# Copyright (c) 2026 Computer Vision Center (CVC) at the Universitat Autonoma de # Barcelona (UAB). # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. import re from . import SmokeTest class TestBlueprintLibrary(SmokeTest): def test_blueprint_i...
c26ee44312f60f6c8ca785feeee105d68f8aea5df6cc3cfaef395e31ecaacaef
Python
1,018
19
#################################################################################################### # 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 ...
c43b85ceae8fdc9c82142346a5deb86c153f62b28542feb2feb76c1266532c16
Python
1,018
34
import sys import os import config from src import train_hrnet """ Code based on ZSSR provided by Assaf Shocher https://github.com/assafshocher/ZSSR """ def main(input_img, ground_truth, kernels, gpu, conf_str, config_str,results_path): # Choose the wanted GPU if gpu is not None: os.environ["CUDA_VIS...
e53352ced433545c5dd07143b52f44aebfc0e70827017d6036ce29427b317afd
Python
1,018
18
#################################################################################################### # 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 ...
4905a3cad13337627e8ee20452321925f5f9f39ff2f41bc7cfc7d6ee79310e27
Python
1,019
18
#################################################################################################### # 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 ...
0d085b971ae347e23a9ba88c61724da7b65256302e0aeab536ea250da745d209
Python
1,020
37
''' Selection of deciliated cells (for Fig. 3). Discards cell with abnormal passive properties. ''' import pandas as pd from file_management.configuration import * from os.path import join from numpy import exp table_folder = join(config['root'],'Deciliated', 'tables') # Make the panda table df = pd.read_csv(join(tab...
147b818c064f841b8474a336047c142bf3ae289953cb27406fae03bce93853a2
Python
1,020
37
"""MEG scanner layouts and channel names. These files are downloaded on first use, see :py:mod:`osl_dynamics.files._fetch`. """ import numpy as np from osl_dynamics.files import _fetch _SUBDIRECTORY = "scanner" _CHANNEL_NAMES = { "ctf275_channel_names": "ctf275_channel_names.npy", "neuromag306_channel_name...
ae49ae0913dfe6b4fb22ed7b6d89de9d2e9666330b240766e8d171f0101e8e78
Python
1,020
34
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Module for the manual annotation window widget. This page lets the user create manually annotations for some selected frames to then fine tune the network on. The process can be repeated as will. Finally, the rest of the AxoID pipeline will be applied to the data. Cre...
fa4e1d324a6bfc9743ea52e8410660d08d3e800d8813bdc5e211ee3ee660307e
Python
1,020
37
''' Selection of ciliated cells with PIV (for Fig. 4). Discards cell with abnormal passive properties. ''' import pandas as pd from file_management.configuration import * from os.path import join from numpy import exp table_folder = join(config['root'],'Ciliated with PIV', 'tables') # Make the panda table df = pd.rea...
5025288757ed36ffe806266c3bbb9be09a2ef05e4222dedf163d8baa13ea2b67
Python
1,021
27
# 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...
7c7f2484c2d86864915d3204465d1bce56913c1c86759b675bc04753a755fe15
Python
1,021
26
# 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...
95dda201c6087d948441680f61f3e15fd822045334e44f95b10a1bd782b6fd4c
Python
1,021
27
# 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...
4a9e4b85d06388f6dc480850f8c6647e338fc5af647b90751747290f4d994be3
Python
1,022
35
_base_ = ['../faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py', '../_base_/datasets/voc0712.py'] model = dict( pretrained='torchvision://resnet101', backbone=dict( type='ResNet_MD', depth=101, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, norm_cfg=dict(type=...
ed1b1629f2fba900f4f9e19b0f37c6b4699e1ff09c5b109637b978dcb4b72642
Python
1,022
40
import subprocess def get_commit_hash(): message = subprocess.check_output(["git", "rev-parse", "--short", "HEAD"]) return message.strip().decode('utf-8') class WavBinaryWrapper(object): def __init__(self, data): super(WavBinaryWrapper, self).__init__() self.data = data self.posi...
ef22f3613817e64a22e60a5616fe56aa7ffc706ea064cd60d83af508f6c6b0d0
Python
1,022
37
_base_ = '../faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py' model = dict( pretrained='torchvision://resnet101', backbone=dict( type='ResNet_MD', depth=101, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, norm_cfg=dict(type='BN', requires_grad=True), mdconv=...
fdb394400e910626737b69d13e9ecb73d6d0e7af2eaeb0637cda22f2701623e5
Python
1,022
28
# 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...
6ce8d2361acffb50e9c4525e9c938cd678f6d31945acc538bf589067098de44e
Python
1,023
36
import argparse import gc import numpy as np import pandas as pd import tqdm if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('tsv_path', help='The path to the tsv to turn into a dataframe and pickle', ) parser.add_argument('...
62a421015024d50fc5ec6d1a23830749eb6d7e2e10dc0072ac2470e61c97866b
Python
1,024
37
_base_ = '../retinanet/retinanet_r50_fpn_1x_coco.py' model = dict( pretrained='torchvision://resnet101', backbone=dict( type='ResNet_MD', depth=101, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, norm_cfg=dict(type='BN', requires_grad=True), mdconv=dict...
c785a005890469b7fa50e90d080b7fa54ac7bed0eaca8273d1fe69e0e7b775ee
Python
1,024
35
_base_ = ['../faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py', '../_base_/datasets/voc0712.py'] model = dict( pretrained='torchvision://resnet101', backbone=dict( type='ResNet_MD', depth=101, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, norm_cfg=dict(type=...
e41aa37df23988bd34e3f24302251add4aef6892284eeeaa481af627984883be
Python
1,026
18
#################################################################################################### # 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 ...
20d2f9cdfab9fd689a2f403fb9e734b2e55fdfe0e209ea0de7626dc7db8d7ef0
Python
1,027
26
# 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 ...
30169ad73abc27de03fc124d81bc2f4e2783bf3fa6318bf8c8a808a090482372
Python
1,027
26
import h5py import tensorflow as tf num_feature = 5 def parse_proto(example_proto): features = { # 'X': tf.FixedLenFeature((num_feature,), tf.float32, allow_missing = True) # 'X': tf.FixedLenFeature((num_feature,), tf.float32) 'X': tf.compat.v1.FixedLenFeature([num_feature], tf.fl...
4bd4a12b65588dff3dd0c570a266b906f55591a3773f722461539d23cb364279
Python
1,027
38
"""Base simulation class.""" import numpy as np class Simulation: """Simulation base class. Parameters ---------- n_samples : int Number of time points to generate. """ def __init__(self, n_samples: int) -> None: self.n_samples = n_samples self.time_series = None ...
8cbdc0935bb1a0a4c4c03ca4a6f51efcd0bc4bfdbec76c118fffe236b0ac4e2a
Python
1,027
28
import csv import pandas as pd skeletons = pd.read_csv('axon_dendrite_data/splittable_skeletons_all.csv', header=0, skipinitialspace=True, keep_default_na = False) connectors = pd.read_csv('axon_dendrite_data/splittable_connectors_all.csv', header=0, skipinitialspace=True, keep_default_na = False) print(len(skeleto...
377eb0997caaf7c023698a4a5362487667f5fb5b66176e62b98264a8df8d1980
Python
1,028
30
from functools import partial import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from pycpd import rigid_registration import numpy as np import time def visualize(iteration, error, X, Y, ax): plt.cla() ax.scatter(X[:,0], X[:,1], X[:,2], color='red', label='Target') ax.scatter(Y[:,0], ...
ff98d87c3fc0f90a78b3471b93733010305b533c6e7e511faa06c8059b3a5393
Python
1,028
31
import unittest from linkml_runtime.dumpers import yaml_dumper from linkml_runtime.loaders import yaml_loader from linkml_runtime.utils.introspection import package_schemaview from oaklib.datamodels import ontology_metadata from tests import output_path class TestOntologyMetadataDatamodel(unittest.TestCase): de...
64e247dd8d84284f1fd4902106508044489c9007aaead52bcdf0885d30d47ceb
Python
1,029
36
# 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...
6860ee38322876eba8fe446688a6a8973ff4df35ec711b01d14030b957ffd681
Python
1,029
36
# 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...
88595ae4f6bd54bf3ebc78fb22d3a23455b2d594b31438aad22e6fa066b552b7
Python
1,029
27
# 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...
e986cbc8a179975af2c062c0a72fd12093f38fc2bd614c4fce8e764c690506a0
Python
1,029
32
# This updates usage/methods.rst to the latest API methods # Developers can run this after modifying any arguments the user can see from AFQ.api.utils import methods_descriptors from textwrap import dedent prologue = """ .. _methods_docs: The pyAFQ API methods --------------------- After defining your pyAFQ API obje...
1213ed12156098e5aa58d7ca072ea75dce3dd52ec49be660080badd421cc69b1
Python
1,030
37
# 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...
1846546bb16c268a26b389a92b4fcaa33ee835a4a964fa0188eee38e112e9181
Python
1,030
26
#!/usr/bin/python # This code was designed to build a fake dataset to test out SSAML import numpy as np import os import pandas as pd # MAIN CODE # CONSTANTS COVAfile = 'COVA-FAKE.csv' # First make fake COVA data how_many = 2000 COVA = pd.DataFrame(columns=('actual','CoVAScore','Prob-none','Prob-Hosp','Prob-ICU-MV',...
9653daeae7f3672498a01424bfb4b1a36d7aaeb74a5375ecb47197c3a42b2cb7
Python
1,030
24
# 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...
9caded59b2d7033ef9d6fa63dd5a3c74c34aeccdf5e0e0e08db9152e37677acb
Python
1,030
32
import pytest import torch from ..attention_kernel_integral import AttentionKernelIntegral from ..embeddings import RotaryEmbedding2D def test_AttentionWithRoPE(): """Test for Attention kernel integral with rotary position embeddings Checks the output size """ head_n_channels = 32 channels = 32 ...
bde3546a827780a59b9f3cffc6384ff3ceb21260656ad0afc202aafcc6bff5d5
Python
1,030
33
import numpy as np from classifiers import * from pipeline import * from tensorflow.keras.preprocessing.image import ImageDataGenerator # 1 - Load the model and its pretrained weights classifier = Meso4() classifier.load('weights/Meso4_DF.h5') # 2 - Minimial image generator # We did use it to read and compute the pr...
d1393eb047e6eb47c29685fe94a843ea7ca3a0d9f88a41f0cc842a566e03ad51
Python
1,030
43
import torch from cgtasknet.instruments.instrument_pca import PCA def test_pca_number_of_components_shape(): data = torch.zeros((10, 10)) pca1 = PCA(1) pca2 = PCA(2) pca3 = PCA(3) pca4 = PCA(4) pc1 = pca1.decompose(data) pc2 = pca2.decompose(data) pc3 = pca3.decompose(data) pc4 =...
fe5e857adfb92b686cbbf717442ca3c3ed713a9e2c2c4c20def866110992ce17
Python
1,030
19
#################################################################################################### # 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...
12780756d1c9dbec692eab2ec90f7413d520e5e8a5e232bc4d34ea65c8a4d5be
Python
1,031
19
#################################################################################################### # 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 ...
866a0f374eca3b03a68e11c2f01079279b27cc5f361bdd71e3f74d8a709da811
Python
1,031
19
#################################################################################################### # 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 ...
c109f7c55cb865095d6ed2b6e4e5ebc29db6934f93e9470a379ba9dcf0bbe8cc
Python
1,031
22
# 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...
f751ec7395586de5bc40ecbec0d6830b0589489d0adb0a6668ea0bae84b91f99
Python
1,031
26
# 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...
b5b1b98529c01a538dc2a6d79316607254d3dfa4bb6bb0ba5931a2c678ad375e
Python
1,032
31
import torch class PCA: def __init__(self, num_components: int = 1, calculate_derivation=False): self._num_components = num_components self._calculate_derivation = calculate_derivation def decompose(self, data: torch.Tensor, center: bool = True): X = torch.clone(data) if cente...
5a97ace69522e6f4074867e60e1163545541d48c6f8d58e806ce3f2d05b26db8
Python
1,033
19
#################################################################################################### # 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 ...
8a906b96d3a5cb13522454f65100168c942a9abb601f969189efd48b9ca36678
Python
1,033
32
""" get_split.py: Once a pocket has been align, print the pockets that do not align at 0.5 or more to at least one pocket in the training set. Pablo Gainza - LPDI STI EPFL 2019 Released under an Apache License 2.0 """ import os from IPython.core.debugger import set_trace import numpy as np for fn in...
a4ade25e6896c05ffcb08e5568a2cd76440272b8de5111415ea212f8c8602592
Python
1,033
20
# Copyright 2018 SciNet (https://github.com/eth-nn-physics/nn_physical_concepts) # # 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...
5de3a18aed5876a790931ab7459bc14685ef2c3f4ad74d11423bb910e75281b0
Python
1,034
20
#################################################################################################### # 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 ...
89ec75812fa7d92fa0e07e033983941cfc2a66fe5a05e9e60158ef394964954b
Python
1,034
27
import os # Heuristics created by Vincent for Abbas dataset sample6. # 27th Nov. 2019 # updated 23th Jan. 2020 def create_key(template, outtype=('nii.gz',), annotation_classes=None): if template is None or not template: raise ValueError('Template must be a valid format string') return template, outtype,...
110da2caf1d2ae7831b044332be5d6409f5de1e0db785a0cf94b42a4c7ce0bac
Python
1,035
31
import numpy as np import nibabel as nib import sys import os from utils import largestAfterOpen from scipy import ndimage out_path = sys.argv[1] prefix = sys.argv[2] if out_path[-1]!='/': out_path = out_path+'/' brain_mask = nib.load(out_path+prefix+'brain_mask.nii.gz').get_fdata().astype(bool) affine = nib.load...
7094fde8b85e8af597f83b3f4205adb680b9f54cb6ff676543f633ee9a143de1
Python
1,035
29
import logging from PyQt5 import uic from PyQt5.QtGui import QTextCursor from PyQt5.QtWidgets import QWidget, QTextEdit LoggingDialogUI, LoggingDialogBase = uic.loadUiType("LoggingDialog.ui") class LoggingDialog(LoggingDialogBase, LoggingDialogUI): def __init__(self, parent: QWidget = None): # uic boile...
4467e4d065e6d1d6026188386aeb1ee37452015be8a6776e693f29d580fb9b60
Python
1,036
36
# 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 ...
4560750c843b7ad248eff80957110b58362a41cbb9c4a4846d8e172cca8ef15b
Python
1,036
37
import numpy as np import math import PIL def postprocess(x): """[0,1] to uint8.""" x = np.clip(255 * x, 0, 255) x = np.cast[np.uint8](x) return x def tile(X, rows, cols): """Tile images for display.""" tiling = np.zeros((rows * X.shape[1], cols * X.shape[2], X.shape[3]), dtype = X.dtype)...
c81f1a7e54d3c8b46edad20061ccfaeec1bec9c1dc63bb91c61242a4c1668b4b
Python
1,037
19
#################################################################################################### # 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 ...
ca3a34189528b6a9bb42a3ff6b52bb05105ee0f001ecccfd966f307d8ea9ae35
Python
1,037
20
#################################################################################################### # Copyright (c) 2016 - 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 ...
7bfc97e51f5930bac6889097b1f6ff72c53fe8b4762e187ba9fb5d20c72fe27d
Python
1,038
30
# 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...
301bde5082887ee4835c8501cef12798450dec802a7215f5ca4c690575d704d2
Python
1,039
20
from .auto_augment import AutoAugment from .compose import Compose from .formating import (Collect, ImageToTensor, ToDataContainer, ToTensor, Transpose, to_tensor) from .instaboost import InstaBoost from .loading import (LoadAnnotations, LoadImageFromFile, LoadMultiChannelI...
60bdb55f4f6014de3f83219747a3b34cef95baac95ddfe85a25afc86f34eb0e8
Python
1,039
20
#################################################################################################### # 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 ...
e74a3c6d7334d120872923c8c995bc2f398eb5d6cc2a29e66a734ae8548fb3d7
Python
1,041
35
""" Splitting the data into train and test subsets. """ # import needed libraries. import os import random import numpy as np import pandas as pd from sklearn.model_selection import train_test_split random.seed(123) np.random.seed(123) # Define output directories for saving split data. out_dir = 'sv' os.makedirs(o...
3f1d50e346e709da623eed90fd695cd6efeef0b81075b9156c3e79ad0eff1d60
Python
1,042
40
import os import torch from torch import nn from torch.nn import functional as F module_path = os.path.dirname(__file__) class FusedLeakyReLU(nn.Module): def __init__(self, channel, negative_slope=0.2, scale=2 ** 0.5): super().__init__() self.bias = nn.Parameter(torch.zeros(channel)) s...
05c508dd1847a34d4c5b83246ce1872ae3da11773ddd4a906698c5824b1fea9e
Python
1,043
38
import numpy as np import matplotlib from matplotlib import pyplot as plt # ---------------------------------------------------------------------- def plot_eeg(data, channels, sample_rate, cmap='tab20', nxlabel=10, sca=1, offset=0, fig=None, ax=None, size=(15, 5), dpi=90): """""" if fig is None: plt....
60c10407a1b8e67043b64890fb732bf004100c494579888f7225cc0fbbe8ba4b
Python
1,044
22
from .builder import DATASETS, PIPELINES, build_dataloader, build_dataset from .cityscapes import CityscapesDataset from .coco import CocoDataset from .custom import CustomDataset from .dataset_wrappers import (ClassBalancedDataset, ConcatDataset, RepeatDataset) from .deepfashion import D...
be5c808a3f1187f2e7b0af7fcad4a5f8ba9f147b708dc0c5572f818598dd611f
Python
1,044
27
"""Phase 3g regression tests: robustness analysis tools.""" import numpy as np from mb_dual_dan.robustness import run_seeds, sweep_param def test_run_seeds_returns_means_and_bands(): def expt(seed: int) -> np.ndarray: rng = np.random.default_rng(seed) return rng.normal(loc=1.0, scale=0.2, size=1...
5f06f81c7277c2cf9b12e55ec927a21dc3cc376435506cff59404f9714fe508b
Python
1,046
22
# Copyright 2018 SciNet (https://github.com/eth-nn-physics/nn_physical_concepts) # # 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 #...
b0b33c0689289ac366bff42551af7bf35a790a6568e9ff4d91eeacdd55d79bef
Python
1,047
25
from typing import Union, Tuple, List, Optional, Dict, Callable, Iterable import jax.numpy as jnp import numpy as np import scipy.sparse as sp Shape2 = Tuple[int, int] Shape3 = Tuple[int, int, int] Size2 = Tuple[float, float] Size3 = Tuple[float, float, float] Size4 = Tuple[float, float, float, float] Shape = Union[S...
2b572907315f0eb9bdab26304e2fb29600e8818d8ff11a359455433a7bf450b8
Python
1,048
30
import os import numpy as np all_ranks = [] user_time = 0.0 for results_dir in os.listdir('results/'): full_dir = os.path.join('results/', results_dir) results_file = os.path.join(full_dir, 'results.txt') if os.path.exists(results_file): results_line = open(results_file).readlines() fields ...
6fbd405dfa5dd23e758ff63ef83ddde46285b9149d22bf6fb33ad02c8137b1e5
Python
1,049
40
from io import BytesIO import lmdb from PIL import Image from torch.utils.data import Dataset class MultiResolutionDataset(Dataset): def __init__(self, path, transform, resolution=256): self.env = lmdb.open( path, max_readers=32, readonly=True, lock=False, ...
87c544877046309b74a7fb019fbb9b37e1d2b6df5015ef33a40de2d35251a2d0
Python
1,050
34
from pathlib import Path import pandas as pd import pytest from cenfind.core.data import Dataset from cenfind.core.detectors import extract_cilia ROOT_DIR = Path(__file__).parent.parent if not (ROOT_DIR / "data/cilia").exists(): pytest.skip( "data/cilia fixture is not present (it is gitignored and not "...
bf1347027c8f35293a9b4efcceafa54e2899e91acc00487c657cc23fb1265171
Python
1,050
19
#################################################################################################### # 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...
8374b10399d8a507c68fe6c577c52ca3c0882a6657a889c88b5ad50a593c37e6
Python
1,051
24
import pandas as pd import os import scanpy as sc import pickle import seaborn as sns import numpy as np for type in ['order_distal', 'proximal']: with open("vis_id_"+type+"__all_scanpy_obj.pyn", "rb") as f: adata = pickle.load(f) print(adata.obs['louvain']) a=adata.obs.loc[:,["cluster", "louv...
d814747d3309e2d83744ccee64e32e25416c432982d1b9e32cf07bfdac6d0994
Python
1,051
38
from setuptools import setup with open("README.md", "r") as fh: long_description = fh.read() setup( name="axoid", version="0.1", author="Nicolas Talabot", author_email="nicolas.talabot@gmail.com", description="Regions of interest detection and tracking over 2-photon neuroimaging data", lon...
f7325c928c0f0a2c0667df2bad8b1708bbfc55d1bc227bb12380c67f41f2f183
Python
1,051
30
import os import numpy as np all_ranks = [] user_time = 0.0 for results_dir in os.listdir('results/'): full_dir = os.path.join('results/', results_dir) results_file = os.path.join(full_dir, 'results.txt') if os.path.exists(results_file): results_line = open(results_file).readlines() fields ...
1233e11747f5457b5e2be30d7a2007df0f07c29433c4e9fe45530e86b831cecc
Python
1,053
13
from .base_options import BaseOptions class ReadOptions(BaseOptions): def initialize(self, parser): parser = BaseOptions.initialize(self, parser) parser.add_argument('--shuffle', action='store_false', required=False, help='Shall the data be shuffled?') parser.add_argument('--no_data_info',...
b7aba6766bd403c14c5ecd19258d32b810ce86a8bb55be2343ce68fcba12a260
Python
1,053
36
from typing import Any, List, Optional from zencfg import ConfigBase from .distributed import DistributedConfig from .models import ModelConfig, OTNO_Small2d from .opt import OptimizationConfig, PatchingConfig from .wandb import WandbConfig class CarCFDDatasetConfig(ConfigBase): root: str = "~/processed-car-pres...
4c34734fee9f092c0bd18cb5870a71cd5eb40f9fe40d6c5b7cec748e97c21c75
Python
1,055
36
__author__ = "Jianfeng Sun" __version__ = "v1.0" __copyright__ = "Copyright 2023" __license__ = "GPL v3.0" __email__ = "jianfeng.sunmt@gmail.com" __maintainer__ = "Jianfeng Sun" from tmkit.seqnetrr.combo.Param import Param class Segment(Param): def __init__( self, seq_sep_inferior: int = None, seq_sep_su...
a5dc212ddb0236919b7f7c13794eda064a661049261dca173c760055c9cce240
Python
1,055
20
#################################################################################################### # 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 ...
1754d58af831f0d4660db2d64b161b9c7c5e2659ee48777791b68af5435e669e
Python
1,056
13
"""Weather and camera-profile grids from a looks.py --mode matrix capture. grids_matrix.py MATRIX_DIR FINAL_DIR TOWNTAG""" import os, subprocess, sys R, F, TAG = sys.argv[1:4] W = ["ClearNoon", "CloudyNoon", "WetNoon", "MidRainyNoon", "HardRainNoon", "ClearSunset", "SoftRainSunset", "ClearNight", "HardRainNight"] P = [...
8fc36fd8c7ab5cf6290ac5b8bf06d136c822b343923f84b9bf4f2daa94a047db
Python
1,056
29
import logging import unittest from oaklib.parsers import MEDGEN_MIM_G2D from oaklib.parsers.association_parser_factory import get_association_parser from tests import INPUT_DIR G2D_INPUT = INPUT_DIR / "example-g2d.mim2gene.tsv" class MIM2GeneAssociationParserTest(unittest.TestCase): """Tests parsing of medgen ...
cc9a4c33087752dae1a7db03f796d1cb9fc906a0f31b93e563f679017131d31e
Python
1,057
33
class ScheduledOptim: '''A simple wrapper class for learning rate scheduling''' def __init__(self, optimizer, init_lr, d_model, n_warmup_steps=4000): self._optimizer = optimizer self.init_lr = init_lr self.d_model = d_model self.n_warmup_steps = n_warmup_steps self.n_st...
dede8d022f79f92bad37d90fa2906f280a47902e059acc1bcd82db154036b343
Python
1,057
30
from eAE.eAE import eAE def main(): # Setting up the connection to interface ip = "interfaceeae.doc.ic.ac.uk" port = 443 eae = eAE(ip, port) # Testing if the interface is Alive is_alive = eae.is_eae_alive() if is_alive != 200: raise Exception("!!!") # Initialize i...
e8019a3b4afcf38f900ef327a67f9558ad677f9e2114d87588e3d9ce411a279e
Python
1,058
12
import os from tqdm import tqdm from scripts.nn_predict import main lats = [-8.685, -8.7362, -8.7808, -8.8033, -8.7759, -8.8261, -8.8432, -8.8287, -8.8155, -8.8224, -8.7923, -8.6471, -8.626, -8.6186, -8.5573, -8.3447, -8.2721, -8.2424, -8.1594, -8.1584, -8.1537, -8.1542, -8.155, -8.1714, -8.1993, -8.1883, -8.2292, -...
1e15c91002e33e4be4cb3f3e0fcb3c6bd560735ea58da77dd8e6b8ad844cc9a4
Python
1,059
33
import torch from torch_geometric.data import Data from torch_geometric.utils import convert from networkx.algorithms.swap import double_edge_swap as swap from networkx.linalg.graphmatrix import adjacency_matrix as adj_mat from IPython.display import SVG from sknetwork.visualization import svg_graph from old import ...
286c52d4f4528d61758ec75529bed1d8424d09704ea61d0ca2638f96ae1edaed
Python
1,059
41
__author__ = "Christopher Schröder" __copyright__ = "Copyright 2020, Christopher Schröder" __email__ = "christopher.schroeder@tu-dortmund.de" __license__ = "MIT" from os import path from snakemake.shell import shell # Extract arguments. extra = snakemake.params.get("extra", "") sort_extra = snakemake.params.get("s...
464f110823f105add542c91a813a2024f7d06802da5f767c57c20a099fba51ee
Python
1,059
33
import unittest from oaklib.datamodels.vocabulary import SKOS_CLOSE_MATCH, SKOS_EXACT_MATCH from oaklib.implementations.translator.translator_implementation import ( TranslatorImplementation, ) # TODO: use mock tests class TestTranslatorImplementation(unittest.TestCase): """ Tests :ref:`TranslatorImpleme...
109bc7b8e31f48eaeb045a2b8b1e1ca0802dd05739074cbee36d13c0cc4ce8b7
Python
1,061
29
import unittest from deeprank_gnn.DataSet import HDF5DataSet, DivideDataSet, PreCluster class TestDataSet(unittest.TestCase): def setUp(self): self.database = 'tests/hdf5/1ATN_residue.hdf5' def test_dataset(self): dataset = HDF5DataSet(database=self.database, no...
3b218fa89d43760ece4da65496b13b39096490d211379a823ac7562f033d6a55
Python
1,061
21
#################################################################################################### # 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 ...
8d5eafcf6be24e6a20945b8f31f31b857a66fc96d0d8c8d02d983d71d1793338
Python
1,061
49
__author__ = "Patrik Smeds" __copyright__ = "Copyright 2019, Patrik Smeds" __email__ = "patrik.smeds@gmail.com.com" __license__ = "MIT" import os from snakemake.shell import shell input_known = snakemake.input.known extra = snakemake.params.get("extra", "") bed = snakemake.input.get("bed", None) if bed is not None...
0cf1e7774df5a7904933405bc4cec576d73ed3964e821566f10d590e68341cce
Python
1,062
24
# 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...