sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
6053202964d6d061ce34a04acf299554c9d8fd2cfaa8deac3e9083da492b0324
Python
3,640
63
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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://w...
75cf6a5f42d8764ab5a7c5a5c71551a3f2c1f7327b4b885ea16aa3263bc160c2
Python
3,641
105
"""Settings GuPPy remembers between launches. The input root folder and the output root folder belong to a project rather than to one analysis: they hold still while the sessions and run names chosen inside them change from run to run. Remembering the pair means a returning user does not re-pick them, which is what le...
f726f1ed0855fb5a60932e063de59096610b9c295118300f93c903ed25bf379f
Python
3,641
76
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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://...
1171f859090ed61dbd548053952f16cb34861289a4b37d0d8d639e89f75f813a
Python
3,642
111
import os import cv2 import numpy as np def fill_corner(point, directions, img, visited): h, w = img.shape cp = point td = [directions[0][0] + directions[1][0], directions[0][1] + directions[1][1]] while True: for d in directions: r, c = cp visited[r, c] = 1 ...
b56ed0ea43e8113e52e3584e2d2f08b42d54d78b610073047b8cdc86bbaea1aa
Python
3,642
107
# 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 -------------------------------------------------------------- import ...
050e526a9da35eaee22121b281dcf4eed2b2f3e95320368926a44105fa3d3c3e
Python
3,646
99
from .models import ExperimentDataset from django.http import Http404 from rest_framework.generics import GenericAPIView from rest_framework.response import Response from rest_framework import status from drf_spectacular.utils import extend_schema from .permissions import IsAdmin, IsDatasetOwner, IsExpOwner from .seri...
d439626f22360677e5c986eb8b2192aa0647807577f1a79ba52a1befb94b454f
Python
3,647
24
import torch from transformers import BertTokenizer,T5Tokenizer from fengshen.models.PPVAE.pluginVAE import PPVAEModel device = torch.device("cuda" if torch.cuda.is_available() else "cpu") encoder_tokenizer = BertTokenizer.from_pretrained("IDEA-CCNL/Randeng-PPVAE-1.2B-Augmentation-Chinese") decoder_tokenizer = T5Token...
095f676d6da44860e13a630dc7c3a983c42e50037e0b9f54f766db352792d8eb
Python
3,648
94
# -*- coding: utf-8 -*- from django.db import connection from collections import defaultdict from itertools import chain from typing import Any, DefaultDict, List, Set def find_empty_neurons() -> Set: """ Returns a set of empty neurons. Also prints the total number of neurons and the total number of neurons fo...
08dfb4cf50c919155410af686df3378a5e14976747918b9bf7c73997b335a026
Python
3,649
126
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import numpy as np import pandas as pd import logomaker import seaborn as sns class motif(): alphabet = ['A', 'C', 'G', 'T'] colorscheme = { 'G': [0.004, 0.125, 0.305], 'TU': [0.007, 0.514, 0.569], 'C': [0.965, 0.863, 0.67...
c6348683ce03fe171f967138a6a73f05d86a2bba1a4747aab96195144be327f1
Python
3,650
109
#!/usr/bin/env python """ MeteWIBELE workflow: A collection of AnADAMA2 workflows 1) characterization workflow: characterize protein families for functional and taxonomic annotation 2) prioritization workflow: prioritize protein families for unsupervised (ecological properties) and supervised (association with phenoty...
0c307a671eeb5686ab3cc05f65f6fa7b8629c857a0568d3fcfc62772b86a0c33
Python
3,651
113
_base_ = [ '../_base_/datasets/cityscapes_1024x1024.py', '../_base_/default_runtime.py' ] # The class_weight is borrowed from https://github.com/openseg-group/OCNet.pytorch/issues/14 # noqa # Licensed under the MIT License class_weight = [ 0.8373, 0.918, 0.866, 1.0345, 1.0166, 0.9969, 0.9754, 1.0489, 0.878...
36e2ec72d3c933cf901c9a809081269d9b69922e6eb5453b3f97b2ed569ac1d4
Python
3,652
94
"""Unit tests for src/datahandlers/ec.py (ECgraph).""" import pyoxigraph import pytest from src.categories import MOLECULAR_ACTIVITY from src.datahandlers.ec import ECgraph, make_ids, make_labels from src.prefixes import EC from tests.datahandlers.conftest import RDF_NS, RDFS_NS, SKOS_NS, lit, make_graph_from_store, ...
d5bc97763e9a2f34ae8d709d73d6046e2aa77814a7b68fdc9fdca70f94657f35
Python
3,654
105
# run generate_processed_exp_data first import numpy as np import matplotlib.pyplot as plt from sklearn.linear_model import LinearRegression, Lasso from sklearn.model_selection import train_test_split from grid_cell.util import pca_accumulated_variance_explained_ratio from sklearn.metrics import mean_squared_error, r2_...
d495ac9e630d5787fa499befa27937f3ae463669543ef6ad0a43ed50f714a9a7
Python
3,655
83
""" Demo for survival analysis (regression) with Optuna. ==================================================== Demo for survival analysis (regression) using Accelerated Failure Time (AFT) model, using Optuna to tune hyperparameters """ import numpy as np import optuna import pandas as pd from sklearn.model_selection i...
c648b250f34cd23e00e751ce42bd0f92b7bea86752043f819078614b5455218f
Python
3,657
90
from __future__ import print_function import pytest from keras.utils.test_utils import get_test_data from keras.models import Sequential from keras import layers import keras from keras.utils.np_utils import to_categorical num_classes = 2 def test_vector_classification(): ''' Classify random float vectors i...
8a857bc6003d7cfbef8463f3d17f88d716b627ecbbd1c0090e870bc51cbc2a64
Python
3,658
119
#!/usr/bin/env python """ MetaWIBELE: extract_abundance_feature_subset module Extract the subset table based on specific feature Copyright (c) 2019 Harvard School of Public Health Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "So...
27f9d4d6da5af2cff3bbe3cd3cdea9ee271ba195c856e874f8769b11005d6245
Python
3,661
109
import numpy as np from sklearn.linear_model import Ridge from sklearn.svm import SVC from sklearn.linear_model import LogisticRegression from sklearn.neighbors import KNeighborsClassifier from sklearn.preprocessing import StandardScaler from sklearn.pipeline import make_pipeline from sklearn.model_selection import Gri...
83cbbfa81013cdc334cc7264c543ca1c66f90525ac07703041ee656b70d39acc
Python
3,662
146
import data_utils as du import os import sys from keras.optimizers import Adam, SGD from keras.callbacks import LearningRateScheduler from keras.metrics import Precision, Recall, FalsePositives, FalseNegatives from keras.models import Sequential from keras.layers import Dense, Dropout, Activation from keras.layers im...
ea62e28dfc6fb0e3a36516866db542da0da42136bd71b0f09c5ee9fdd8146805
Python
3,663
104
#!/usr/bin/env python # -*- coding: utf-8 -*- """ deltalm model configuration""" import warnings from transformers.configuration_utils import PretrainedConfig from transformers.utils import logging logger = logging.get_logger(__name__) BART_PRETRAINED_CONFIG_ARCHIVE_MAP = { "IDEA/Deltalm": "https://huggingface.c...
adf98d3a9aa60b8d9708bbe19f73a97371ebddb967f474cb990c981b1f1a4f22
Python
3,664
93
import holoviews as hv import numpy as np import pytest from guppy.visualization.binned_metrics import ( build_bin_bars, build_binned_metrics_panel, ) @pytest.fixture def bins(): # Two whole bins and a short third one, as a ragged final bin produces. return { "bin_starts": np.array([0.0, 4.0,...
9e71f8603c23c5d36275fe60fc5e0056988182b1d64c1ec516023e5ab8efd6f2
Python
3,666
127
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import logging import torch import torch.nn as nn from torch_geometric.nn import radius_graph from ocpmodels.common.utils import ( comp...
1d9cc372350f8c949a6ba8495201e96497655f0f85896e84fc35b09813d3aa7c
Python
3,667
118
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. ONLY for use in the NeurIPS 2021 Open Catalyst Challenge. For all other submissions please use make_submission_file.py. """ import argparse imp...
8b1eb0375f895f9e4421ad58929d8722aab96a74101619bb35dac6c23f0397cb
Python
3,669
110
import yaml from collections import OrderedDict from os import path as osp def ordered_yaml(): """Support OrderedDict for yaml. Returns: yaml Loader and Dumper. """ try: from yaml import CDumper as Dumper from yaml import CLoader as Loader except ImportError: from ...
a139313721c5b54532a0ba238fe24edf1f64103e95f2a168e04aef4ed92fb279
Python
3,669
184
# Author: Hauxu Yu # Evaluate feature quality by chromatographic peak shapes, mz errors, rt errors, etc. # imports import numpy as np """ Functions ------------------------------------------------------------------------------------------------------------------------ """ def calculate_gaussian_similarity(x, y): ...
9b26589429a2804cac44d647295b1297405b7d499d626953f451a97d7bc3843b
Python
3,670
111
import typing import numpy as np import scipy import functools import os from statsmodels.tsa.stattools import acf import tsgm ''' All statistics should return lists. ''' def _to_numpy(ts: tsgm.types.Tensor) -> np.ndarray: """Convert tensor to numpy array based on current backend.""" if os.environ.get("KER...
1ecabdf9ab28dc51c42ac1d319e2167bc092f40410f9e0921c06867cc5825c7b
Python
3,672
108
# -*- coding: utf-8 -*- #MEGの前処理をするためのスクリプト #ECG,EOGがを用いたSSP,ICAによる処理、ECG,EOGなしでのICAによる処理、notch filterが行うことが出来る #処理の手順は一番下を参照。 #自動読み込み############################################## #PARAMETER_DIR='/Volumes/Promise_Pegasus/Dropbox/MEG_current/kougakubu/parameter' #PARAMETER_DIR='/Volumes/ssdraid/Dropbox (MEG)/seirisyu...
2c01027300350d4cd1cbaa9b9c0a34630030394e1657cda01588d6bddab3fc1e
Python
3,673
98
from os import makedirs from os.path import join as pjoin, exists as pexists, abspath, realpath, basename, dirname from visualqc.vqc import cli_run import shlex import sys import numpy as np from pytest import raises, warns test_dir = dirname(realpath(__file__)) base_dir = realpath(pjoin(test_dir, '..', '..', 'exampl...
ddc19eb2bde7c766c47fc1e0c4ff33510bd21b2f8e2f2e259d6eda11d932b424
Python
3,673
90
import numpy as np import pandas as pd from scipy.interpolate import CubicSpline from zigzeg import find_runs from experiment import * def interpolate(x, gap_size=5): # get transformed x = np.array(x) # find gaps to interpolate x_nan = np.any(np.isnan(x), axis=1) gaps, = np.where(x_nan) gaps ...
014d75f908412db564e05e33777bce7101ceadc50ed1185f67ce1327f6044078
Python
3,675
105
from typing import Dict, List, Optional import torch from e3nn.util.jit import compile_mode from mace.tools.scatter import scatter_sum @compile_mode("script") class LAMMPS_MACE(torch.nn.Module): def __init__(self, model, **kwargs): super().__init__() self.model = model self.register_buff...
6bd51e8023d0435d31e9a7c2e17c6e7679612782f316b755d2ba99686aa57c13
Python
3,675
75
# %% import os from itertools import cycle from os.path import join from pathlib import Path import numpy as np import pandas as pd __author__ = "Heejung Jung" __copyright__ = "Spatial Topology Project" __credits__ = ["Melanie Kos"] __license__ = "MIT" __version__ = "0.0.1" __maintainer__ = "Heejung Jung" __email__ =...
98cd788f7d2ef69f3423bcf628d224ec0bdd7bc4d38f90f53ca1f4c2890fb875
Python
3,676
73
# Function for opening pyPhotometry data files in Python. # Copyright (c) Thomas Akam 2018. Licenced under the GNU General Public License v3. import json import numpy as np from scipy.signal import butter, filtfilt def import_ppd(file_path, low_pass=20, high_pass=0.01): '''Function to import pyPhotometry binary ...
e72c06ab777509b6838d4f1609228c7b05e58818446ebcf984b6a811171603a4
Python
3,677
96
"""Support for InplaceUpdateRequirement.""" from typing import Final, NamedTuple from cwl_utils.types import CWLDirectoryType, CWLFileType from .errors import WorkflowException class _MutationState(NamedTuple): generation: int readers: list[str] stepname: str _generation: Final[str] = "http://commonw...
3fab6af3856ec70d250b85aa5ffab8cc6f7f1641a3675f74225c4e5d08de2e4e
Python
3,679
114
"""Test script for the export of sbml files and importing """ import jax.numpy as jnp from jaxkineticmodel.kinetic_mechanisms import JaxKineticMechanisms as jm from jaxkineticmodel.building_models import JaxKineticModelBuild as jkm from jaxkineticmodel.load_sbml.export_sbml import SBMLExporter import equinox import p...
6d34c9178e4ab32532956b247727693232ce3e794a66648ae345f61c23f6393c
Python
3,679
91
DOCS = """ train the model on the a dataset (gabor or mnist) to show the effect of feedback connection from L5 to L2/3. Current figures: figure 5. """ from dataset import GaborDatasetOrientation from model import ShallowMLP from experiment.utils import set_seed, init_model, Logger, Trainer, Checkpointer import torch i...
6f58f3c6b031df82c1ae14eca0197b1b2c0c6a5a3ffcef4f375cdccdd14fdcf7
Python
3,681
104
import pytest import numpy as np import os import sys sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) import tsgm @pytest.mark.parametrize("mock_aug", [ [tsgm.models.augmentations.GaussianNoise()] * 10, tsgm.models.augmentations.GaussianNoise() ]) def test_base_compose(mock_a...
55f3dfac3b86f9d84837ea7b87494f170c418ce6f489c67dcf1306125a119afe
Python
3,682
110
#!/usr/bin/env python3 # # Small example on how to use the Miniscope library from Python # In order to make this example work, first install the "miniscope" Python # module, e.g. with `pip install .` from the PoMiDAQ source directory, or by # building PoMiDAQ with CMake (with the PYTHON option enabled). # Alternativel...
6cd037c47c5ece90849ec52c39eb2e8cdc5a159b97e2d173766e327cdc85161e
Python
3,682
97
import unittest import numpy as np import numpy.testing as npt from DiastereomericResolutions.Representation.legacy_implementation import ( gen_weighted_rdf, ) from DiastereomericResolutions.Representation.weighted_rdf import ( gen_weighted_rdf as gen_weighted_rdf_refactored, ) class TestRDFFunctions(unitte...
c9d8a88891c5b0fca1d6ff508cd0bd29d55b5d406a1176a18492a74c136ce638
Python
3,684
112
#!/usr/bin/env python # # Copyright 2006, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list...
faac9efa32a3ea36223c9daee97312e9182a6f62f639a3c79922dbc5dd219c22
Python
3,686
101
from __future__ import annotations from typing import Any import numpy as np from scipy.optimize import linear_sum_assignment from soccertrack import BBoxDataFrame from soccertrack.utils.utils import list2dict def identity_score( bboxes_track: BBoxDataFrame, bboxes_gt: BBoxDataFrame ) -> dict[str, Any]: ""...
c3f5e833551f25401beed53de13a39190723ec1650ac34e7a0d60375bdd7203f
Python
3,687
98
#!/usr/bin/env python """ Sorts the raw acquisitions files into semi-BIDS format NOTE: The output will not be quite BIDS yet, because we haven't split the physio data into runs, yet. Parameters ------------------ physio_dir: str path where physio data lives sub_zeropad: int how many zeros to pad for BIDS subje...
18cf47cacc6481f314b297ecd9f9f363fe911090a61fe5ea723736860ed2bf72
Python
3,688
118
import colorsys import functools import numpy as np from colormath.color_conversions import convert_color from colormath.color_diff import delta_e_cie2000 from colormath.color_objects import sRGBColor, LabColor LUMINOSITY_VECTOR = np.array([0.2126, 0.7152, 0.0722]) def hsv_palette(how_many): return [colorsys.hs...
2afbadcd4f2b8473475d276309d9e0f52cea3e124159a85a0b857930efd0ed0b
Python
3,688
98
# Script to generate simulated diffraction library of a zone-plate focused beam diffracted by an epitaxial thin film # Method developed by Tao Zhou (tzhou@anl.gov) # Simulate over strain, tilt_lr, and tilt_ud, in that order, for 11.7 nm SrIrO3 on LSAT from math import * import numpy as np import os import time from jo...
9181adaf58c938b78e661b8649341746cdbb5a91eccb6554a046cbc50a026b5c
Python
3,689
83
# functions for preprocessing import numpy as np def filter_genes(data, min_counts=0, min_cells=0, min_counts_uniq=0, min_cells_uniq=0, min_MIF_uniq=0.001, uniq_layers=['isoform1', 'isoform2'], ambg_layers=['ambiguous'], copy=False): """Filter genes based on nu...
d7115a105abcb9176d7ef1ffbe4ab46df375560b54baf194228928d1d4584359
Python
3,690
120
# encoding=utf-8 from typing import List, Union import torch from torch.nn.utils.rnn import pad_sequence from transformers import T5Tokenizer from fengshen.models.transfo_xl_reasoning import TransfoXLModel from fengshen.utils import sample_sequence_batch def en_to_zh(sentence:str): en_pun = u",.!?[]()<>\"\"''" ...
b854fe12e3b654be563e8db0bc050dcd310a816796c4aa7bbff5a05987752804
Python
3,691
39
import argparse parser = argparse.ArgumentParser(description='TSAN-Brain age estimation') # =========== save path ================ # parser.add_argument('--model_name' ,default='best_model.pth.tar' ,type=str, help="Checkpoint file name") parser.add_argument('--output_dir' ,default='./model/' ,t...
9ecba3ac3baf6f3eb0e369ed69525c237d1eb479973a9846017f68623a53b78d
Python
3,692
93
#!/usr/bin/env python import torch from torch.utils.data import DataLoader from rdkit import Chem from rdkit import rdBase from tqdm import tqdm from MCMG_utils.data_structs_fragment import MolData, Vocabulary from models.model import RNN from MCMG_utils.utils import Variable, decrease_learning_rate rdBase.DisableLo...
dc70e5b46b03621a33121a9db6c86a46973ba1983afc530f0db12b3c273b94c8
Python
3,693
147
import numpy as np # make TensorLike more flexible from tsgm.types import Tensor as TensorLike import typing as T EPS = 1e-18 class TSGlobalScaler(): """ Scales time series data globally. """ def fit(self, X: TensorLike) -> "TSGlobalScaler": """ Fits the scaler to the data. ...
eefb53c663255ec8a613ab5f2f4155983833f2afa018e46d10c821bd86595fc0
Python
3,693
118
"""Application configuration. Settings class configured via environment variables with the ZNDRAW_SERVER_ prefix. Storage backend is selected by URI string (e.g. ``memory://``, ``/path/to/data.lmdb``, ``mongodb://host:port/db``). """ from pathlib import Path from typing import Annotated from fastapi import Depends, ...
07003f8f7dfb3722b4de5cba5a1078cfb0ff69ebb6a4224a2f3a7ce95e3fc3a7
Python
3,694
101
import pytest import copy import itertools import os import sys sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) import tsgm import keras def _get_gunpoint_dataset(): data_manager = tsgm.utils.UCRDataManager(ds="GunPoint") X_train, y_train, X_test, y_test = data_manager.get(...
8d11e973acd8a34782a9b74511a9fb3866d53a9b506c2a70b0c2a72ea46d243c
Python
3,696
123
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Dec 15 15:13:24 2022 @author: george """ import warnings warnings.simplefilter(action='ignore', category=Warning) import numpy as np import pandas as pd from tqdm import tqdm import os, glob from sklearn.neighbors import KDTree import math from sci...
1fbf5c12b3732c5ba0a70ee06b6ac29430f04818cb57daa72def7e7969518416
Python
3,697
93
#!/usr/bin/env python import torch from torch.utils.data import DataLoader from rdkit import Chem from rdkit import rdBase from tqdm import tqdm from MCMG_utils.data_structs_fragment import MolData, Vocabulary from models.model import RNN from MCMG_utils.utils import Variable, decrease_learning_rate rdBase.DisableLo...
1ecd161cfa6f678b36cc6038c6dc0c7f62c315c2efe1307860f1df65d510cd2a
Python
3,698
122
import os from typing import List from medperf.entities.training_exp import TrainingExp from medperf.entities.interface import Entity from medperf.entities.schemas import AggregatorSchema import medperf.config as config from medperf.account_management import get_medperf_user_data import yaml from medperf.entities.ut...
1931a8dff2c48a0f9e15f58cbbd4d720bc9cf9db2878b5d3b3b679582295297c
Python
3,699
119
#!/usr/bin/env python # -*- coding: utf-8 -*- # tests/run_two_tests.py ################################################################################ # EncoderMap: A python library for dimensionality reduction. # # Copyright 2019-2024 University of Konstanz and the Authors # # Authors: # Kevin Sawade # # Encodermap i...
a65a13059dce55b472277cab92ffec88235b7b9d195fbbd1c68ff39f3a0759c6
Python
3,699
108
import pytest import requests import builtins import os from copy import deepcopy from medperf import config from medperf.ui.interface import UI from medperf.comms.rest import REST from medperf.comms.auth.interface import Auth from medperf.init import initialize import importlib # from copy import deepcopy @pytest.f...
23b91a7d5e8fe107540b821872e5391e41650f0385038fce81250fecb6401a6d
Python
3,700
96
"""Resolves references to CWL documents from local or remote places.""" import os import urllib from pathlib import Path from schema_salad.ref_resolver import Loader from .loghandler import _logger def resolve_local(document_loader: Loader | None, uri: str) -> str | None: """Use the local resolver to find the ...
8cce0d607a6361b1329f0a8fbf066a7217f0bbc175f2d3208fee88fbd65ccd31
Python
3,701
130
import argparse import csv import os import sys import os.path as op from re import L import numpy as np from MH_consensus_utils import consensus_kmeans from nilearn.input_data import NiftiMasker from nilearn.masking import unmask from sklearn.cluster import KMeans from sklearn.metrics import pairwise_dist...
f6bdd62458f71ae44257042dc8342ee69a5872e6b6d85d6b918cdc29c4d7f50f
Python
3,704
96
#!/usr/bin/env python3 """Public-safe static and numeric checks for output-smoothing geometry.""" from math import isfinite, log, sqrt from pathlib import Path REPO_ROOT = Path(__file__).resolve().parents[2] HELPERS = REPO_ROOT / "helper_functions" FWHM_PER_SIGMA = 2 * sqrt(2 * log(2)) def sigma_vox(fwhm_mm, voxel...
21b2121c5050cb27347b27d17ad6755276cd0671fd6a609ada991880290cc297
Python
3,709
89
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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://w...
388487cedd85de1542b3b9bb866e0e92150249bebbe1ce981fefb9912bf6ea5a
Python
3,712
108
## Restormer: Efficient Transformer for High-Resolution Image Restoration ## Syed Waqas Zamir, Aditya Arora, Salman Khan, Munawar Hayat, Fahad Shahbaz Khan, and Ming-Hsuan Yang ## https://arxiv.org/abs/2111.09881 ##### Data preparation file for training Restormer on the GoPro Dataset ######## import cv2 import numpy ...
96237baed2a5ff60ba38d835759b26d847d06e65ca3a881fc99c5f98949895c4
Python
3,715
105
import numpy as np import pandas as pd from sklearn.metrics import * from scipy.stats import pearsonr import matplotlib.pyplot as plt import seaborn as sns def classification_matrices(true, pred): print('Converting to binary') print(f'ground truth: max {true.max():.3f}, min {true.min():.3f}') print(f'pred...
aeb0ce81e9276732313ae7fc35580aaa64ccf66da3f42a11739060b91740dcaf
Python
3,715
116
#!/usr/bin/env python import argparse import torch import time # from models import transformer_RL # from data_structs import Vocabulary from MCMG_utils.data_structs import MolData, Vocabulary from models.model_MCMG import transformer_RL from MCMG_utils.utils import seq_to_smiles_frag import pandas as pd import torc...
2f5dd309bcf18fbcd9e00b2f40de0ab5898aeaf9c80c59c9c3b357d2e7e045c7
Python
3,717
93
import os from Utils.dataloader_BrainTumorMRI import * from Utils.models import * from Utils.TrainModel import * from Utils.config import * from multiprocessing import Process # Load configs def task(backbone:str, model_path:str): _data_config = DatasetConfig() _loader_config = LoaderConfig() _model_conf...
bddefd0ebda7b0fc56bed3805c6b1cb97388b5f23e4179f8fba127f30bad9637
Python
3,719
121
# Copyright (C) The Arvados Authors. All rights reserved. # # SPDX-License-Identifier: Apache-2.0 """TaskQueue.""" import queue import threading from collections.abc import Callable from typing import Union from .loghandler import _logger class TaskQueue: """A TaskQueue class. Uses a first-in, first-out qu...
463f3c067dd4de3d7d807caedd5277e74b0afde88401d35cd1aa19b36d35a215
Python
3,720
110
import os import shutil import argparse import json import urllib.request import hashlib from urllib.error import URLError, HTTPError from typing import Union from tqdm import tqdm FIGSHARE_URL_PREFIX = 'https://figshare.com/ndownloader/files/' FIGSHARE_FALLBACK_PREFIX = 'https://ndownloader.figshare.com/files/' de...
3ed37efaa45802e3eaecac989cca89a783674f9dd30f765fb5551b01a764fbe1
Python
3,722
108
import os import textwrap import pytest def _seed(path): """Pre-seed the download/extract markers so get_example_data() skips the network.""" (path / "example_data.tar.gz").write_bytes(b"") extracted_dir = path / "example_data" extracted_dir.mkdir(parents=True) (extracted_dir / "data.py").write_t...
95f253c14e3c2e03ab8a693cfac3f8b65aa990e0e87f8add6b9f5ba86dc2741e
Python
3,722
79
"""Pipeline tests for the MONDO_GARD concord, run against a real built concord. Skipped by default unless pytest is run with --pipeline. Run with: uv run pytest tests/pipeline/test_mondo_gard.py --pipeline --no-cov -v MONDO_GARD is the one place this pipeline reads `oboInOwl:hasDbXref`, and it has no bad-xrefs f...
3c04e41836846bb7870b5f67b6c52ec0dbbb0c38a97dcb8552e6577eec90bf25
Python
3,723
123
import os, json import pandas as pd import numpy as np from os.path import join as opj ''' Generate : data/parsed_questions_bootstrap/acc_each_scene_stiff.csv data/parsed_questions_bootstrap/cor_each_scene_stiff.csv data/parsed_questions_bootstrap/cor_stiff.csv Before running this script, ensure you've executed bash...
d07bb333c0b8dd7fd202f0e985955b4e200cf1535fb3be7a0bed7b29881d8621
Python
3,723
104
from __future__ import annotations from typing import Optional from heudiconv.utils import SeqInfo def create_key( template: Optional[str], outtype: tuple[str, ...] = ("nii.gz",), annotation_classes: None = None, ) -> tuple[str, tuple[str, ...], None]: if template is None or not template: ra...
e43fc49c5216afdd728e31602185ebe5ecadca7f5a3b91f93d59e2bb5aebdeb9
Python
3,724
96
# pytest unit tests for spinalcordtoolbox.deepseg._sc import pytest import numpy as np import nibabel as nib from spinalcordtoolbox.image import Image import spinalcordtoolbox.deepseg_.sc as deepseg_sc from spinalcordtoolbox.utils.sys import sct_test_path from .test_centerline import dummy_centerline param_deepseg...
47ec4911faf1926acba62b5540cfecd77b81ba5e27ca26f92c1110238cc30fd3
Python
3,725
101
from .models import BenchmarkDataset from django.http import Http404 from rest_framework.generics import GenericAPIView from rest_framework.response import Response from rest_framework import status from drf_spectacular.utils import extend_schema from .permissions import IsAdmin, IsDatasetOwner, IsBenchmarkOwner, IsCo...
ee10c346193b93c5d0ca52c9543202389668a3e4f6ee7c4024ea0e4b496065b0
Python
3,725
120
""" Copyright (c) 2016-2022, EPFL/Blue Brain Project This file is part of BluePyOpt <https://github.com/BlueBrain/BluePyOpt> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 3.0 as published by the Free Software Foundation. ...
24f5befdf4d62477a2f20b759f3e8ea135aeaa91c6eed643220f7d3abe9c8fba
Python
3,729
125
# -*- coding:utf-8 -*- ##---IMPORTS import scipy as sp from scipy import linalg as sp_la from common import TimeSeriesCovE from plot import P, mcdata from nsim.scene.noise import ArNoiseGen from database import MunkSession ##---CONSTANTS DB = MunkSession() ##---FUNCTIONS def load_cmx(): ...
6473a065b3ff16785bdc7402d1529122f9d63ec13d31d7b9d2f2377c94487ed6
Python
3,730
101
from typing import Dict, Optional import torch from e3nn import o3 from e3nn.util.jit import compile_mode from mace.modules.models import ScaleShiftMACE from mace.modules.utils import get_edge_vectors_and_lengths @compile_mode("script") class NonLinearReadoutBlock(torch.nn.Module): def __init__( self, ir...
3f916c74a1473a55c49d8a81b85b3841351f62155d9546acb00eb772eb33467e
Python
3,732
95
''' reproducing the torus manifold by umap, from the Gardner et al. 2022. ''' import numpy as np import matplotlib.pyplot as plt from grid_cell.util import select_arr_by_t, apply_each_col from sklearn.decomposition import PCA from umap import UMAP import grid_cell.tuning as gct from scipy.ndimage import gaussian_filter...
74629834adc2137da3c1156b05e52cb1d5d1a1cbb8e559eb03772f2d1a7ed84d
Python
3,733
156
#+ # # This file is part of h5py, a low-level Python interface to the HDF5 library. # # Contributed by Darren Dale # # Copyright (C) 2009 Darren Dale # # http://h5py.org # License: BSD (See LICENSE.txt for full license) # #- # pylint: disable=eval-used,protected-access """ This is the h5py completer extension fo...
389c871ae922ebf740d19117092ce3b0d23745f85ef02f7bcce74e0008dda8f2
Python
3,734
98
import igraph as ig from igraph import Graph import numpy as np import os import json from delaunay_graph import generate_delaunay_graph from pattern_checker import PatternChecker from multiprocessing import Pool, cpu_count from delaunay_graph_generator_high import generate_delaunay_graph_true import argparse ...
78b5684aa02369ddb3affa43791e6f20eda02ef1ee7dfb716f478976bd53857a
Python
3,734
71
## Restormer: Efficient Transformer for High-Resolution Image Restoration ## Syed Waqas Zamir, Aditya Arora, Salman Khan, Munawar Hayat, Fahad Shahbaz Khan, and Ming-Hsuan Yang ## https://arxiv.org/abs/2111.09881 ## Download training and testing data for single-image motion deblurring task import os # import gdown imp...
b25a0dd47897b19fa21edb6056a227f1df827c4344452cbc01ab0df154e404d4
Python
3,734
115
#!/usr/bin/env python """ MetaWIBELE: extract_protein_coding_genes module Extract protein coding genes from total gene sets Copyright (c) 2019 Harvard School of Public Health Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Softwar...
0ca1d8927edb5eb42e3c4e9785b5ebdf70342810ab4aaf9fa689f0f3b82bc539
Python
3,735
88
# -*- coding: utf-8 -*- from typing import Dict from django.core.management.base import BaseCommand, CommandError from django.core.management import call_command from catmaid.fields import Double3D, Integer3D from catmaid.models import Project, ProjectStack, Stack, StackMirror, User class Command(BaseCommand): ...
0f9430854325c5a0d8cdf4e3d503524373a996edbda6412c67ce0516074c08ae
Python
3,736
111
## ## CPCantalapiedra 2020 import multiprocessing from tempfile import NamedTemporaryFile from ...emapperException import EmapperException from ...common import get_pfam_db, get_data_path, set_data_path from .pfam import get_hmmsearch_args, PfamAligner, parse_hmmsearch_file from .pfam_common import filter_fasta_hmm_...
abc7aeedd650bd14376c7f35a689fe71c9dc72c1ca717f8d900df5b4f5a7252a
Python
3,737
131
""" Core layers provide basic operations, e.g., MLP """ from typing import List, Union import torch from torch import nn, Tensor, tensor ACTIVATION_MAPPING = { "swish": nn.SiLU(), "silu": nn.SiLU(), "relu": nn.ReLU(), "sigmoid": nn.Sigmoid(), } class ZeroLayer(nn.Module): r"""A skeleton layer t...
fd2b5546f7c4d07e2bdf388ac89d5f5d6c1153769f654606dc9f9d09476b2799
Python
3,737
127
"""Tests for run_kwargs support in registration and task claiming.""" from typing import Any, ClassVar from zndraw_joblib.client import ( Category, ClaimedTask, Extension, JobManager, ) class Echo(Extension): """Extension that records what run() received.""" category: ClassVar[Category] = C...
075e607f736583941ee208f001a59f7acd09288d7aa8662110872675902cf239
Python
3,740
101
""" create_configs.py - code for creating a set of configuration files for optimising the MLP for several subjects - run this script (from iml-dl/.) with: python -u ./projects/moco_t2star/preprocessing/create_configs.py --base_config_path /path_to_base_config_file.yaml --output_directory /path_...
b7e85eb0bb03c228666cf22e534318dbf1c04df9b786013ff772771749f511c0
Python
3,740
107
import os import pandas as pd import datetime import numpy as np from medperf.entities.benchmark import Benchmark from medperf.entities.dataset import Dataset from medperf import config from .utils import get_institution_from_email, stage_id2name def get_dsets(benchmark_id): bmk = Benchmark.get(benchmark_id) ...
21f855ed8c945f3264e1375f0146c8095b703c6334a5fdda4af908f63c175a13
Python
3,743
117
# This file is part of h5py, a Python interface to the HDF5 library. # # http://www.h5py.org # # Copyright 2008-2013 Andrew Collette and contributors # # License: Standard 3-clause BSD; see "license.txt" for full license terms # and contributor agreement. """ This is the h5py package, a Python interface...
9b81c37ee06de824ce5d2c9dd4cb1a31cad187308ffb97415e7054ae76667041
Python
3,746
106
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. # pyre-strict # pyre-ignore-all-errors[58] import torch from torch.nn import functional as F def sigmoid_focal_loss( inputs: torch.Tensor, targets: torch.Tensor, alpha: float = -1, gamma: float = 2, reduction: str = "none", ...
c00fbd2593a8043d6fd8017e49ef73260f3d2cc08a91db2b992a43d19c3fa1b6
Python
3,747
104
# Copyright (c) OpenMMLab. All rights reserved. import os.path as osp import shutil from unittest import TestCase import numpy as np import torch from mmengine.structures import PixelData from mmseg.evaluation import IoUMetric from mmseg.structures import SegDataSample class TestIoUMetric(TestCase): def _demo_...
7ce88158b51c241e00e1857f0fc7e1d85cd70aca677534d9f2c962cc21fa5c9e
Python
3,748
112
# Copyright (c) OpenMMLab. All rights reserved. from argparse import ArgumentParser, Namespace from pathlib import Path from tempfile import TemporaryDirectory from mmengine import Config from mmengine.utils import mkdir_or_exist try: from model_archiver.model_packaging import package_model from model_archive...
d092653916a0911345d95c1d8fd9847d9242052eb0f38f56398fd985091619de
Python
3,749
96
# Copyright (c) OpenMMLab. All rights reserved. import pytest import torch from mmseg.models.losses import DiceLoss @pytest.mark.parametrize('naive_dice', [True, False]) def test_dice_loss(naive_dice): loss_class = DiceLoss pred = torch.rand((1, 10, 4, 4)) target = torch.randint(0, 10, (1, 4, 4)) wei...
a7c31104777d8c957032224612021019e0fe06bc506bd65b578fb0cc0e3e883b
Python
3,751
116
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import bisect import pickle from pathlib import Path import lmdb import numpy as np from torch.utils.data import Dataset from torch_geometri...
942585284273e3e743cfcf4e65ca164f6e33ff0a50515bc87fc468b120f24f8e
Python
3,756
89
import unittest import tempfile import caffe from caffe import layers as L from caffe import params as P def lenet(batch_size): n = caffe.NetSpec() n.data, n.label = L.DummyData(shape=[dict(dim=[batch_size, 1, 28, 28]), dict(dim=[batch_size, 1, 1, 1])], ...
356f79708b520751db053876cf6184093dfabbeda47b218e754fc89f652789c1
Python
3,759
134
"""ephys/morphologies.py unit tests""" import json import os import pytest import bluepyopt.ephys as ephys from bluepyopt.ephys.serializer import instantiator testdata_dir = os.path.join( os.path.dirname( os.path.abspath(__file__)), 'testdata') simpleswc_morphpath = os.path.join(testdata_dir, 'sim...
e75b2809f29fc7390943d9078c9d168e65355cd90e62aae65025c4c4af8a9946
Python
3,759
134
import os from kgx.source import JsonSource from kgx.transformer import Transformer from tests import RESOURCE_DIR def test_read_json1(): """ Read from a JSON using JsonSource. """ t = Transformer() s = JsonSource(t) g = s.parse(os.path.join(RESOURCE_DIR, "valid.json")) nodes = {} edg...
a22a925fea5a0fc0b1b7b666534fa2018dbfff83920c6e949e92f0cc6416335e
Python
3,764
84
import shutil from pathlib import Path import pandas as pd import pytest from guppy.testing.api import locate_run_folder, step1, step2, step3, step4 from guppy_test_data import STUBBED_TESTING_DATA def _stage_session(*, session_subdir: str, destination_parent) -> str: """Copy a stubbed session into its own pare...
3b741749f74acb99c404b568467ec40744fc2c9454127f6b18618ea91f537016
Python
3,768
90
from mpi4py import MPI import numpy as np import hickle as hkl from grid_cell.persistent_homology import Is_Torus from grid_cell.manifold_fitter import GP_Fitter, Avg_Fitter from grid_cell.ploter import error_bar_plot import matplotlib.pyplot as plt import tensorflow as tf import os from sklearn import datasets from gl...
b58103bc63d26b8e0d78632a440b8b84486d5cf67544e0aff1f9d60b6cf982d0
Python
3,769
91
import pandas as pd import argparse from scipy.spatial import Delaunay import matplotlib.pyplot as plt import numpy as np import seaborn as sns from matplotlib.lines import Line2D import os def parse_args(): parser = argparse.ArgumentParser(description='Transfer input to gml file') parser.add_argu...
7f2718259e59286eb9c47d5d2b94791503133b456c28024f3a5860f78ec715b2
Python
3,770
116
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import pandas as pd import itertools class qdata(pd.DataFrame): def __init__(self, data, sort=True, encoding_function=False): """ Parameters ---------- data : pandas.DataFrame Dataframe including the columns 'spec' ...
c837ac924419ba6650f9c6749504f3c924e357b0f27d10e85a060b09958d9f2e
Python
3,771
130
"""Test ephys model objects""" # pylint: disable=R0914 import os import pytest import numpy from bluepyopt import ephys TESTDATA_DIR = os.path.join( os.path.dirname( os.path.abspath(__file__)), 'testdata') simple_morphology_path = os.path.join(TESTDATA_DIR, 'simple.swc') @pytest.mark.unit def t...
30516ed421bf79b6e76a08a60f5fdfc821742fb7df2497f3d74264ddd06fbc24
Python
3,772
109
""" Test the layers. Currently only on cpu since travis doesn't have GPU. """ import unittest import pytest import librosa import numpy as np import torch import torch.nn as nn from torchaudio_contrib.layers import (STFT, Spectrogram, MelFilterbank, AmplitudeToDb, TimeStretch, Com...
7bb7149b945e38e073f1b4d64e36fae08c0fe5f0f91bf9f7c3dcf330105f2b0f
Python
3,773
110
# Copyright (c) OpenMMLab. All rights reserved. import argparse import os import os.path as osp import tempfile import zipfile import mmcv import numpy as np from mmengine.utils import mkdir_or_exist def parse_args(): parser = argparse.ArgumentParser( description='Convert REFUGE dataset to mmsegmentation...