sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
aee345c2b91c62ab571fbabae3b4e7a7f2e56602e45f0b525c8d2bfb51809d09
Python
959
35
import numpy def rotate(matrix, degree): if abs(degree) not in [0, 90, 180, 270, 360]: print("raise error or just return nothing or original") if degree == 0: return matrix elif degree > 0: return rotate(zip(*matrix[::-1]), degree-90) else: return rotate(zip(...
cc1c2c33afbd196e8830539452beb0df478965d51a3f10d4658fc9e06062d73b
Python
959
32
import pyclesperanto_prototype as cle # list names of all available OpenCL-devices print("Available OpenCL devices:" + str(cle.available_device_names())) # list CPUs and GPUs separately gpu_devices = cle.available_device_names(dev_type="gpu") print("Available GPU OpenCL devices:" + str(gpu_devices)) cpu_devices = cl...
e8f28dc19e5a1d81ae63617ac96265cbf2fddea7821d5b8277176de248eb7da3
Python
959
29
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
fd6d4019cb13f40fca77d1a493c5ae7f8c4bf8903ce066083037b40a8193a7c3
Python
959
36
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Sep 20 11:46:14 2018 @author: Carlos A Ariza, PhD """ #Montage of images # import the necessary packages from imutils import build_montages from imutils import paths import pandas as pd import cv2 cv_df = pd.read_csv('../data/cv_feat.csv', index_col...
26ab6efc74db5a259c50642e189d1421bc446899913987fac7faf908b58aa926
Python
960
34
"""Standalone tissue-masking / background-removal GUI tool. Reads a folder (or several folders) of stitched section TIFFs and writes "cleaned" versions with non-tissue background zeroed out. Method: shared brain mask computed from the brightest-coverage channel via multi-Otsu (3 classes) + morphology, applied t...
50be86db9d0c1e8fd4549632be4704724c098f6f0bdeb2599a7a6205b9377660
Python
960
36
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import configs, suites import common_setup SEARCH_REVS = ["issue439-base", "issue439-v1"] LIMITS = {"search_time": 1800} SUITE = suites.suite_satisficing_with_ipc11() configs_satisficing_core = configs.configs_satisficing_core() CONFIGS = {} for name in ...
61595cebb0fbf65b74a36cbc9e5def0a879f15c2d454af688c1bf3fa4856bc3b
Python
960
27
from typing import Optional import yacs.config from pytorch_image_classification import get_default_config from pytorch_image_classification.config.config_node import ConfigNode def find_config_diff( config: yacs.config.CfgNode) -> Optional[yacs.config.CfgNode]: def _find_diff(node: yacs.config.CfgNode,...
68693ad7543279e06beb9d2a96acacb0fa996e3dc95867d93a8778d804e78f57
Python
960
28
import numpy as np import nibabel as nib import argparse import scipy.ndimage as ndimage def convert_file(inname, outname): img = nib.load(inname) header = img.header img_data = img.get_fdata() iso_voxels = np.min(header.get_zooms()) zoom_ratio = tuple(np.array(header.get_zooms()) / iso_voxels) ...
6ac4ba72711f1b4d3691db6261d585b26ed9e38bc3eabb41a9f90646a530f9ac
Python
960
46
import meep as mp from meep import mpb # Compute the bands at the X point for a quarter-wave stack Bragg # mirror (this is the point that defines the band gap edges). # the high and low indices: n_lo = 1.0 n_hi = 3.0 w_hi = n_lo / (n_hi + n_lo) # a quarter_wave stack geometry_lattice = mp.Lattice(size=mp.Vector3(1...
8ce76ce7264aa7a7765c2b48b1db388135f23ca304afce0334ce0c58f6818f35
Python
960
41
# external import pytest # project import textdistance ALG = textdistance.LCSSeq @pytest.mark.parametrize('left, right, expected', [ ('ab', 'cd', ''), ('abcd', 'abcd', 'abcd'), ('test', 'text', 'tet'), ('thisisatest', 'testing123testing', 'tsitest'), ('DIXON', 'DICKSONX', 'DION'), ('random...
b917e8b57994230e913748d26452d755149c1e7709af02c90e6089a7e7d4487f
Python
960
29
import cv2 import numpy as np import torch def label2rgb(alpha, img, mask): labeled_img = cv2.addWeighted(decode_segmap(mask).transpose(1, 2, 0).astype(int), alpha, img.astype(int), 1 - alpha, 0) return torch.from_numpy(labeled_img.transpose(2, 0, 1)) def decode_segmap(imag...
d46900eac8dcc376774eea461d75bd9dad5514db51cc76f63280676a79ed30a1
Python
960
32
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
95921fbc33c90e62dd37b24e8e715c32d7542ab959f15313348461b1dc20cca7
Python
961
14
from ..utils import format_channel_location_dict STROKEPATIENTSMI_CHANNEL_LIST = ['FP1', 'FP2', 'Fz', 'F3', 'F4', 'F7', 'F8', 'FCz', 'FC3', 'FC4', 'FT7', 'FT8', 'Cz', 'C3', 'C4', 'T3', 'T4', 'CPz', 'CP3', 'CP4', 'TP7', 'TP8', 'Pz', 'P3', 'P4', 'T5',...
a36210f6e1b384efc0c01f245f84e96b1df149a6ba0f2c1243e6808141c08f51
Python
961
33
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
aea24f388018435ba037ea96ba4f56a21dea8404c3eca73b7f0aa2ba5f81dd4d
Python
961
36
import argparse import os import glob from learning_experiment import LearningExp parser = argparse.ArgumentParser() parser.add_argument('path', help="Path to directory with learning experiment log files") args = parser.parse_args() files = glob.glob(os.path.join(args.path, '*_log.txt')) for file in files: ...
1481525023188270cc73139f1936ad2e590cae01f1a63f74bc8861a0411084da
Python
962
40
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, MaiaEnvironment from downward import suites from common_setup import IssueConfig, IssueExperiment, is_test_run BENCHMARKS_DIR = os.environ["DOWNWARD_BENCHMARKS"] REVISIONS = ["issue701-base", "issue701-v1"] CON...
162101836c9866eea28279e96658d56126b9648c541494f87a57bdb32004b8bc
Python
962
24
import json, os from regtools.registration.report import _render_methods, _render_reproduce, _render_manifest def test_methods_paragraph_mentions_atlas_and_method(): meta = {"atlas": "allen_ccf_25um", "registration_method": "ants", "random_seed": 42, "has_laplacian": True} html = _render_methods(meta, "...
7482989fbee19260e737b762a953eb17aaf6678d82a0eab7c529d3edce8c6952
Python
962
32
from __future__ import annotations import pytest pytest.importorskip("phonopy") pytest.importorskip("seekpath") import numpy as np from ase.build import bulk from numpy.testing import assert_almost_equal, assert_array_equal from quacc.atoms.phonons import get_phonopy def test_get_phonopy(): atoms = bulk("Cu")...
ae73db9619462a7b7ebffd2fe22053eedcd257b3d4617f96f80a18b39183b17d
Python
962
37
"""Provide a convenient way to link to GitHub issues and pull requests. Link to any issue or PR using :gh:`issue-or-pr-number`. Adapted from: https://doughellmann.com/blog/2010/05/09/defining-custom-roles-in-sphinx/ """ # Authors: The PyPREP developers # SPDX-License-Identifier: MIT from docutils.nodes import refe...
9039a7f19839f4c0eb569177095259276d60034b807b4277d1fd4d524497e9a2
Python
963
33
""" PREPROCESS FUNCTIONS These functions preprocess the data used by the algorithm based on user-set preferences. """ def preprocess(self): if self.DO_DIV: divide(self) elif self.DEBUG: print("\nDividing is not enabled!\n") if self.USE_LESS: reduce(self) elif self.DEBUG: ...
0f466dccdd1063d4c739caaa641f907c1e4f1ce52def23e635665006fff521e2
Python
965
27
"""Testing plot function for unrolled sequences.""" import matplotlib as mpl import numpy as np from pypulseq import Sequence from console.interfaces.acquisition_parameter import AcquisitionParameter from console.interfaces.unrolled_sequence import UnrolledSequence from console.pulseq_interpreter.sequence_provider imp...
cb334e6f434fc8f608f6f192361f8f6e1f97fde93141ec55754c7e6ac5ed50b8
Python
965
29
# coding: utf-8 from . import _init_paths import numpy as np import Sim3DR_Cython def get_normal(vertices, triangles): normal = np.zeros_like(vertices, dtype=np.float32) Sim3DR_Cython.get_normal(normal, vertices, triangles, vertices.shape[0], triangles.shape[0]) return normal def rasterize(vertices, tr...
dcd5271a3495f50d8da8fa149a46cdb2b8138515610422a078c339d9894dd04b
Python
965
28
from tensorflow.keras import layers from tensorflow.keras.models import Model from tensorflow.keras.applications import ResNet50V2 def resnet_model(num_classes, input_shape): inputs = layers.Input(input_shape) base_model = ResNet50V2(include_top = False, weights='imagenet', pooling='avg', input_tensor=inp...
5b0c4a8928ba246ec5a7ea2a73faa64693d840d0bb99806064c31e038dc43567
Python
966
27
import pandas as pd import numpy as np from pyfaidx import Fasta import argparse import vcf as pyvcf from pyensembl import Genome import tqdm import os from sptransformer import Annotator import torch if __name__ == '__main__': annotator = Annotator() gtf = annotator.gtf tis_names = ['Adipose Tissue', 'Bl...
f75551bcb392926f17c70d96ca720f9366365761479c2ee81b158a2ecd014f48
Python
966
38
# Save neuron positions in motor cortical macrocolumn model from os.path import join import sys dir_data = join("..", "data") dir_model_parameters = "settings_2013_31_120RMT" sys.path.append(dir_model_parameters) from net_esser import net_esser import settings_main import pickle # Initialize dummy delay_...
47c2a12570e95509d300a614637ccdcdd1cdc9b05be7ff35b60a10a7558d972c
Python
967
25
"""""" """ Prosper_nn provides implementations for specialized time series forecasting neural networks and related utility functions. Copyright (C) 2022 Nico Beck, Julia Schemm, Henning Frechen, Jacob Fidorra, Denni Schmidt, Sai Kiran Srivatsav Gollapalli This file is part of Propser_nn. Propser_nn is free softw...
a95628f1dc48125f9bbe9f949121f8654226513be560c1aaf73c045377813140
Python
967
25
"""""" """ Prosper_nn provides implementations for specialized time series forecasting neural networks and related utility functions. Copyright (C) 2022 Nico Beck, Julia Schemm, Henning Frechen, Jacob Fidorra, Denni Schmidt, Sai Kiran Srivatsav Gollapalli This file is part of Propser_nn. Propser_nn is free softw...
ae29a659cc85f1aad64b6f47a1cae3eb355eced5b2802e7e6a3ddc75c1f51ec7
Python
967
53
from .config import ( PlotConfig, ) from .morphospace import ( compute_umap_from_pca, plot_morphology_states, ) from .categories import ( plot_category_states, ) from .composition import ( build_composition_tables, plot_category_composition, ) from .profiles import ( build_morphometric_p...
eb387c2c1c5e10048e956d656c52dae7803ea0b0c08a4e075fda2bf86dddaad3
Python
967
32
from pathlib import Path import bpy from . import data from .template import install, uninstall ASSET_DIR = Path(__file__).resolve().parent # The shipped asset library, built from the sources in molecularnodes/nodes/ # (python -m nodebpy.assets build). Not tracked in git — see resources.blend # for the data-only datab...
53b1583e1de8189349a352495f95eca7cf218ef0edc8e01b478d3f7b8b46f73d
Python
968
43
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_pymrmr ---------------------------------- Tests for `pymrmr` module. """ import io import pandas as pd import requests as rq import sys import unittest from pymrmr import mRMR class TestPymrmr(unittest.TestCase): def setUp(self): data_url = 'http://h...
63469a55fc43997c84bfacba953ada80cb5cb87397e71c6be184a185c3474b60
Python
968
37
#!/bin/env python3 ''' Apply a chain reactions for the quasi-particles in the 2D patterns of cardiac arrhythmia ''' import yaml from pdlfeynman.particle import * from pdlfeynman.reaction import * from pdlfeynman.pool import ParticlePool from pdlfeynman.history import ReactionHistory # applying a list of reactions... ...
7064f559d7c2eae9ca7fa7ac6523bbda914d7b3a9c5b569697b696e8580236e4
Python
968
25
"""""" """ Prosper_nn provides implementations for specialized time series forecasting neural networks and related utility functions. Copyright (C) 2022 Nico Beck, Julia Schemm, Henning Frechen, Jacob Fidorra, Denni Schmidt, Sai Kiran Srivatsav Gollapalli This file is part of Propser_nn. Propser_nn is free softw...
c3546da5541a81a7944da4d88b84aa8a6be05d51bf36d1d680543a05573868d5
Python
968
25
"""""" """ Prosper_nn provides implementations for specialized time series forecasting neural networks and related utility functions. Copyright (C) 2022 Nico Beck, Julia Schemm, Henning Frechen, Jacob Fidorra, Denni Schmidt, Sai Kiran Srivatsav Gollapalli This file is part of Propser_nn. Propser_nn is free softw...
cb019871549a49ff8ff6211eb57d52872a823a81ad7ced96101ffbcf39b5cc6f
Python
968
30
import torch import torch.nn as nn import torch.nn.functional as F class ConvBlock(nn.Module): """ Basic convolutional block. Consists of a convolutional layer, a max pooling layer and a dropout layer. """ def __init__( self, in_channels: int, out_channels: int, ...
f7baac74c4004f1b78b859ad1881c79951f3b7af3b7d0ca176124be74eef160f
Python
968
27
# Copyright (c) OpenMMLab. All rights reserved. import logging from mmcv.utils import get_logger def get_root_logger(log_file=None, log_level=logging.INFO): """Get the root logger. The logger will be initialized if it has not been initialized. By default a StreamHandler will be added. If `log_file` is s...
0fc5d6ec7326ba33f063fe2f8187165a0acc324c56f089f0667c128b7be324b5
Python
969
32
import argparse import pandas as pd from measures import form2meaning_ratio def main(): """TODO: Docstring for main. :returns: TODO """ parser = argparse.ArgumentParser() parser.add_argument("input_languages_path") args = parser.parse_args() # Ambiguity measures: 1 - ( #num_unique_mess...
0933486f8c0aa86bba38872cb460dc5fa99b7fd39e71856dc595bde36afa481e
Python
970
25
"""""" """ Prosper_nn provides implementations for specialized time series forecasting neural networks and related utility functions. Copyright (C) 2022 Nico Beck, Julia Schemm, Henning Frechen, Jacob Fidorra, Denni Schmidt, Sai Kiran Srivatsav Gollapalli This file is part of Propser_nn. Propser_nn is free softw...
85c1e976ff3f4ac21893cf98bfc161da25894be18e3b84e5f5f9ec2101f6d356
Python
970
42
#!/usr/bin/env python import sys, subprocess, re import matplotlib.pyplot as plt INFILE = sys.argv[1] OUTFILE = 'contact_map.png' if len(sys.argv) > 2 : OUTFILE = sys.argv[1] x = [] y = [] cnts = [] nres = 0 for line in open(INFILE) : if line.strip()[0] == '#' : continue tokens = re.split("\s+",line.strip(...
99f1ea821a96a7781be0c4cdecd93584c42389c4f82c1509ec6157b07246fc07
Python
970
35
import scipy.stats import autograd.numpy as np from autograd.extend import defvjp, primitive from autograd.numpy.numpy_vjps import unbroadcast_f from autograd.scipy.special import gamma, psi cdf = primitive(scipy.stats.gamma.cdf) logpdf = primitive(scipy.stats.gamma.logpdf) pdf = primitive(scipy.stats.gamma.pdf) de...
68a227c0b9b97321ed5624bd43da302ab9dddaa47ace951e0784b791f4d925cb
Python
971
25
"""""" """ Prosper_nn provides implementations for specialized time series forecasting neural networks and related utility functions. Copyright (C) 2022 Nico Beck, Julia Schemm, Henning Frechen, Jacob Fidorra, Denni Schmidt, Sai Kiran Srivatsav Gollapalli This file is part of Propser_nn. Propser_nn is free softw...
6b227027833f182347b7121124e4aac5602ff5380b5310dc4fd1ceb1507ed251
Python
971
36
#! /usr/bin/env python # -*- coding: utf-8 -*- from lab.experiment import Experiment from lab.steps import Step from downward.reports.compare import CompareConfigsReport from common_setup import get_experiment_name, get_data_dir, get_repo_base import os DATADIR = os.path.join(os.path.dirname(__file__), 'data') exp ...
c927cc3d8ecbb9ae8d88fcc647bc2a8d9adb2a21ae5138162e2ec6f323415c92
Python
971
24
from REACTRL.img_modules.img_data import train_loader, test_loader from REACTRL.env_modules.net_framework import * from REACTRL.env_modules.img_conv import * from boss.bo.bo_main import BOMain from boss.pp.pp_main import PPMain from datetime import datetime import pandas as pd def func(X, model=None, method='resnet18'...
f331c4406d13077aec594ff3eda144375a401ce96765ea66a579ff8a94ec8433
Python
971
26
""" Modified by Mayank Kabra Original by DeepLabCut2.0 Toolbox (deeplabcut.org) copyright A. & M. Mathis Labs https://github.com/AlexEMG/DeepLabCut Please see AUTHORS for contributors. https://github.com/AlexEMG/DeepLabCut/blob/master/AUTHORS Licensed under GNU Lesser General Public License v3.0 """ from deeplabcut ...
6a7eaea2ec2128f025bd0858a4d3691aaf44272b1f3083afbc26cede84a8476e
Python
972
37
import os import platform from pip._vendor.rich import inspect from pip._vendor.rich.console import Console, get_windows_console_features from pip._vendor.rich.panel import Panel from pip._vendor.rich.pretty import Pretty def report() -> None: # pragma: no cover """Print a report to the terminal with debugging ...
2bc3f001179c6b84644e8f157548c400b50de0ed019e0084e4d8b21fc595cfa2
Python
974
33
import unittest import os import random import shutil from torcheeg.model_selection import KFold from torcheeg.datasets import DEAPDataset class TestKFold(unittest.TestCase): def setUp(self): shutil.rmtree('./tmp_out/') os.mkdir('./tmp_out/') def test_k_fold(self): io_path = f'./tmp_...
6e47f3ba83f495361904e0af4230690687d4fe042c16f068a0c679d5c0328141
Python
974
25
"""""" """ Prosper_nn provides implementations for specialized time series forecasting neural networks and related utility functions. Copyright (C) 2022 Nico Beck, Julia Schemm, Henning Frechen, Jacob Fidorra, Denni Schmidt, Sai Kiran Srivatsav Gollapalli This file is part of Propser_nn. Propser_nn is free softw...
7a609a809bf721bcfd0030dd8296e4d97e5b5d35eecfca957fcc406a1eb0ddee
Python
974
25
"""""" """ Prosper_nn provides implementations for specialized time series forecasting neural networks and related utility functions. Copyright (C) 2022 Nico Beck, Julia Schemm, Henning Frechen, Jacob Fidorra, Denni Schmidt, Sai Kiran Srivatsav Gollapalli This file is part of Propser_nn. Propser_nn is free softw...
924328500c901ac167b10f3470c6ccc9ef227f1ffe0317ddc555e357b03783a9
Python
974
33
# from jax.scipy.special import logsumexp from netket.vqs import MCState, expect, expect_and_forces from flax.core.scope import CollectionFilter, DenyList # noqa: F401 from .operator import InfidelityOperatorUPsi from tre_tvmc.driver.utils import calc_full_chunk_size @expect.dispatch def infidelity(vstate: MCState...
825a0554d411aacf13bbe18f0a0cf353f464251e9f44c22f9d47ebda15742260
Python
975
25
"""""" """ Prosper_nn provides implementations for specialized time series forecasting neural networks and related utility functions. Copyright (C) 2022 Nico Beck, Julia Schemm, Henning Frechen, Jacob Fidorra, Denni Schmidt, Sai Kiran Srivatsav Gollapalli This file is part of Propser_nn. Propser_nn is free softw...
a66942375ce684a2d0185fcce5e10361b63c6a72ecc901ca6d88a04cf7d13e20
Python
975
33
import os import warnings import argparse from yacs.config import CfgNode from .default import get_cfg_defaults # thanks Jack yet again :) def load_cfg(config_file=None, freeze=True, add_cfg_func=None): """Load configurations """ cfg = get_cfg_defaults() if add_cfg_func is not None: add_cfg_fu...
2c255d6370bc9987ab3837050506388bd8dbf9faad9de69e75edd7b2ce09474c
Python
976
28
"""Evaluators for survival predictions and model-specific prediction formats.""" from .competing_risks_evaluator import CompetingRisksEvaluator from .interval_cen_evaluator import IntervalCenEvaluator from .lifelines_evaluator import LifelinesEvaluator from .multi_state_evaluator import MultiStateEvaluator from .point...
886347d55938144d726901bcefbe4a2752ac9b194a0f0f51078add03034165f5
Python
976
27
import argparse import glob import re import os def main(): parser = argparse.ArgumentParser(description='Rename files in a time series by a specific offset.') parser.add_argument('--source', type=str, help='Path to the source files', required=True) parser.add_argument('--offset', type=int, help='Offset ...
90fc87396ce07a1a525e77a597b3840ec19ed4e6818d46c89715a740782dc604
Python
976
37
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites import common_setup REVS = ["issue527-v2"] SUITE = suites.suite_optimal_with_ipc11() CONFIGS = { "astar_occ_lmcut": [ "--search", "astar(operatorcounting([lmcut_constraints()]))"], "astar_occ_seq": [ "--search...
020e21b6eeebeae94efb637d729d6d75e67181a24e805098d2605756c95c4871
Python
977
30
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
2c41ad5c2dc04605e884238e0171277f671aea31e107652294320a6da86f1340
Python
977
27
from typing import Callable, Tuple import torch.nn as nn import yacs.config from .cutmix import CutMixLoss from .mixup import MixupLoss from .ricap import RICAPLoss from .dual_cutout import DualCutoutLoss from .label_smoothing import LabelSmoothingLoss def create_loss(config: yacs.config.CfgNode) -> Tuple[Callable,...
abce3f8e4cda32c52bdc3d2443305cd030c36ff70cc2feca2ca725f05dcf7c75
Python
977
25
import os import pandas as pd import unittest import sys sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../src") from hornet.uml import create_features class TestCreateFeatures(unittest.TestCase): def test_create_features_creation(self): # Test case 1: Check if 'afmccpow' column is...
cb2e9d585c37d080db83d23285503d02b2d01e68a8651434cd678cc207583674
Python
977
24
from REACTRL.img_modules.img_data_2_messy import train_loader, test_loader from REACTRL.env_modules.net_framework import * from REACTRL.env_modules.img_conv import * from boss.bo.bo_main import BOMain from boss.pp.pp_main import PPMain from datetime import datetime import pandas as pd def func(X, model=None, method='r...
04303a8bd9469ca46b0092481b4d3f7d0f6f4cd5647316fe9dc531f7738e6a62
Python
978
33
probe_map = {'208175_s_at':'DMP1', '221150_at':'MEPE', '221166_at':'FGF23', '223869_at':'SOST', '204879_at':'PDPN', '208233_at':'PDPN', '221898_at':'PDPN', '226658_at':'PDPN', '202310_s_at':'COL1A1', '202311_s_at':'COL1A1', '1556499_s_at':'...
ce2b6710b3e140cf1bdce4b02f7de16cc6f69d41ee6cbd7b999eab3e49f31f8d
Python
978
37
import boto.sqs from boto.sqs.message import Message import preprocessing import time import json import os import sys def get_connection(): secrets_subpath = ".cloudvolume/secrets/aws-secret.json" secret_path = os.path.join(os.path.expanduser('~'), secrets_subpath) with open(secret_path) as f: aws_secrets...
f90b104d274b5ff16033e18aad0cafbe61da2c1a625c21e9561094e3bf1db3a0
Python
978
35
#!/usr/bin/env python from __future__ import print_function import os results = {} version_files = [x for x in os.listdir(".") if x.endswith(".version.txt")] for version_file in version_files: software = version_file.replace(".version.txt", "") if software == "pipeline": software = "nf-core/rts" w...
301b46a67504e5a33ab458cddd289bda7107f5183ef27a5d1d030c175620b554
Python
979
36
from collections.abc import Callable from typing import Protocol class DummyLowerable(Protocol): more_data: list[str] class Translator(Protocol): def register(self, name: str, fn: Callable) -> Callable: ... class CallablePluginSymbol: def __init__(self, fn: Callable[[DummyLowerable], str]): se...
3348c149ebcda853e4da8062eb804ddd1b2e047044fac44e6bc8b7a6a79b82dc
Python
979
33
# Copyright (c) OpenMMLab. All rights reserved. from abc import ABCMeta, abstractmethod from mmcv.runner import BaseModule ON_APU = False FIT = False class BaseBackbone(BaseModule, metaclass=ABCMeta): """Base backbone. This class defines the basic functions of a backbone. Any backbone that inherits this c...
3ffcc1345934cd43d988b3fbfee49ebb47d273e61381af5283c0961a8913a53c
Python
979
24
from REACTRL.img_modules.img_data_2_class import train_loader, test_loader from REACTRL.env_modules.net_framework import * from REACTRL.env_modules.img_conv import * from boss.bo.bo_main import BOMain from boss.pp.pp_main import PPMain from datetime import datetime import pandas as pd def func(X, model=None, method='r...
7d28f652b9e353faf6fbada785dad50835025f0655bab43e85e80dbab26353e7
Python
979
24
from PIL import ImageDraw from typing import Optional from .shape import Shape, calculate_short_side class Cross(Shape): def draw(self, draw: ImageDraw.Draw, color: tuple[int, int, int]): x_vertical = self.x + self.width // 4 y_vertical = self.y x_horizontal = self.x y_horizontal =...
929ee8dddcb99f2bd1d4957d0149cefb79056b5df9e21129d80cbb7283712c42
Python
979
24
from REACTRL.img_modules.img_data_2_target import train_loader, test_loader from REACTRL.env_modules.net_framework import * from REACTRL.env_modules.img_conv import * from boss.bo.bo_main import BOMain from boss.pp.pp_main import PPMain from datetime import datetime import pandas as pd def func(X, model=None, method='...
9ec0b9d78d8ec6efb7ba089a9aa3a39696903ae8987b95ec1c94b8ca7b7ca97f
Python
979
24
from REACTRL.img_modules.img_data_3_class import train_loader, test_loader from REACTRL.env_modules.net_framework import * from REACTRL.env_modules.img_conv import * from boss.bo.bo_main import BOMain from boss.pp.pp_main import PPMain from datetime import datetime import pandas as pd def func(X, model=None, method='r...
34b72890421a40fd1d0e1cf52ee825d1457281627bc3a12ba3233f9b3d6b309b
Python
980
31
from queso.utils import * import qutip as qt # n = 6 # inds = list(kbits(n)) # # lst = list(range(n)) # for s in inds: # a = [lst[i] for i in range(n) if s[i] == 1] # b = [lst[i] for i in range(n) if s[i] == 0] # print(a, b) # %% n = 6 # rho = qt.ket2dm(qt.rand_ket(dims=[[2] * n, [1] * n])) ...
7decb76bc87c0183bf7503dc8099aa38b0cc1cfd37269b6a4bf288ed2ba20564
Python
980
29
#!/usr/bin/env python """ Automated Recognition and Classification of Histological layers. Machine learning for histological annotation and quantification of cortical layers pipeline """ import importlib from setuptools import find_packages, setup spec = importlib.util.spec_from_file_location("layer_recognition.versi...
acf57dc54bf799bbf14e3c69d50c971796ca1d8acf2dbb2f2d4a2b6ef496516b
Python
980
25
"""""" """ Prosper_nn provides implementations for specialized time series forecasting neural networks and related utility functions. Copyright (C) 2022 Nico Beck, Julia Schemm, Henning Frechen, Jacob Fidorra, Denni Schmidt, Sai Kiran Srivatsav Gollapalli This file is part of Propser_nn. Propser_nn is free softw...
4596a8950d486f52796a51eb12a24b5199f8a7f329cc8f563e734b2d3ab2c4a7
Python
982
36
from sys import exit import os import platform #os.environ['KMP_DUPLICATE_LIB_OK']='True' import json from utils import * import torch.nn as nn import torch.optim as optim from torch.utils.data import DataLoader, Dataset import time import tifffile #from scipy.ndimage.morphology import binary_erosion #distance_trans...
8a40d4d0493ba7861941d8710bafa72b6254a3eebcb63bbb309e9691d046e413
Python
982
32
import torch import torch.nn as nn import math class lap_ablation_none_module(torch.nn.Module): def __init__(self, channels=None): super(lap_ablation_none_module, self).__init__() @staticmethod def get_module_name(): return "lap_ablation_none" def forward(self, x): epsilon = ...
c47fc07c6a12b83200117e87fa64afd3bca4adbf1857b1f270a8671beb8ea966
Python
982
21
""" toposampling - Topology-assisted sampling and analysis of activity data Copyright (C) 2020 Blue Brain Project / EPFL & University of Aberdeen This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation...
da7f4cc398c20c312c07d69d34c459161b30859228a7dbb90b47937cf474fae1
Python
982
28
import zipfile import os import subprocess def unzip_file(zip_file_path, extracted_folder_path): # Open the zip file with zipfile.ZipFile(zip_file_path, 'r') as zip_ref: # Extract each file one by one for file_info in zip_ref.infolist(): zip_ref.extract(file_info, extracted_folder_...
25dfbfc307ce4702cbdad47049e5ad5f0b0e89b99e7834d5478076ddd5b80b9f
Python
983
37
import torch from torch import nn from torch.nn import functional as F from inv_vae.utils.helpers import to_var class GraphConv(nn.Linear): ''' graph convolutional layers. ---- inputs: ---- outputs: ''' def __init__(self, in_feat_dim, out_feat_dim, device, bias=True): ...
36b629b038a8d393e6846ad9c4f4cbcb63bd1b8529db9a529c2a84e00270a9cb
Python
984
44
import os import torch from torch_geometric.data import InMemoryDataset import pickle def read_sets(fpath, fold, split_type='warm'): filename = split_type + '.kfold' print(f"Reading fold_{fold} from {fpath}") with open(os.path.join(fpath, filename), 'rb') as f: kfold = pickle.load(f) return ...
da7ae53253c898d30063bba3a73f433284989f98577ba5039ab92049a5ba7547
Python
984
22
import torch.nn as nn from torch_geometric.nn import GATv2Conv class Spider(nn.Module): def __init__(self, input_num_features, hid_units, n_heads, nb_classes, edge_dim, dropout=0.0, activation=nn.ELU()): super(Spider, self).__init__() self.activation = activation self.conv1 = GATv2Conv(inp...
58c920bc993aaad601b10fafac96747668ef6a162ab6d752f266f66ebb966ed2
Python
985
32
import os os.environ.setdefault("QT_QPA_PLATFORM", "offscreen") import pytest pytest.importorskip("pyqtgraph") @pytest.fixture(scope="module") def qapp(): from PySide6.QtWidgets import QApplication return QApplication.instance() or QApplication([]) def test_batch_tab_has_atlas_edit_pane_an...
dd20b82505c9b8aa437194fd0a38a69d188e57a88dd7c3a2fbd78145d81c0303
Python
985
38
"""SWC data format defintion and services.""" import json import numpy as np class SWC(): # pylint: disable=too-few-public-methods """Definitions of the data format.""" TYPES = (SOMA, AXON, DEND, APIC) = range(1, 5) COLS = (I, T, X, Y, Z, R, P) = range(7) XY = slice(2, 4) XZ = slice(2, 5, 2) ...
f9ae0a96c389d310bdb37b0f903e4eaf486dc9824015d78b486f0e8614ff885e
Python
985
31
from __future__ import annotations from importlib.util import find_spec from pathlib import Path from shutil import rmtree import pytest TEST_RESULTS_DIR = Path(__file__).parent / "_test_results" TEST_SCRATCH_DIR = Path(__file__).parent / "_test_scratch" has_prefect = bool(find_spec("prefect")) if has_prefect: i...
4c90a338772e266e1e57b739727c9481de9c0003124e25782f21632513ea82c5
Python
986
34
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
785daf3b82e9386a0fbc828a91b3df9f2badf214f852279b64fa5bf8160641d2
Python
986
43
""" pygments.modeline ~~~~~~~~~~~~~~~~~ A simple modeline parser (based on pymodeline). :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import re __all__ = ['get_filetype_from_buffer'] modeline_re = re.compile(r''' (?: vi | vim...
e45bbf26dfc35b3cc4c11fa89a3580b4516c2d9b08fd5857384c07cbe757ffc6
Python
986
35
"""Module contains all the exceptions """ class UnrecognizedFormat(Exception): """Could not recognize the format of the file for channels. """ def __init__(self, value): self.value = value def __str__(self): return repr(self.value) class MissingDependency(): """Class to handle ...
728c08d0f013c1a5e082bd6f57aeffcaed994cf22f2ff5596377502ad4725a82
Python
987
32
import pytest import elasticai.creator.nn.fixed_point as nn_creator from elasticai.creator.arithmetic import FxpArithmetic, FxpParams from tests.integration_tests.nn.fixed_point.precomputed_routine import ( routine_testing_precomputed_module, ) @pytest.mark.ghdl @pytest.mark.parametrize( "total_bits, frac_bi...
d9e573ef8c0ca4331edcae5b49fb5da67b1629b7c3a7b98d7226f062fe1c4414
Python
987
25
import torch import torch.nn as nn import torch.nn.functional as F def soft_dice_loss(logits, targets, smooth=1.0): # targets is one hot probs = logits.softmax(dim=1) n_classes = logits.shape[1] loss = 0 for i_class in range(n_classes): if targets[:,i_class].sum()>0: loss += dice_lo...
65d8d2af3c643f18547c2c313bf4bbfeaa46409af8c0664c514ab4d777c3dc7d
Python
988
42
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward.suites import suite_optimal_with_ipc11 from downward.configs import default_configs_optimal import common_setup REVS = ["issue387-base", "issue387-v1"] CONFIGS = default_configs_optimal() # remove config that is disabled in this branch del CONFIGS['astar...
9ce0206faa30dbff2bb5dedfa44f73cf124ba94eb2a2db405a0ae05ea84c01a4
Python
988
42
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward.suites import suite_optimal_with_ipc11 from downward.configs import default_configs_optimal import common_setup REVS = ["issue386-base", "issue386-v2"] CONFIGS = default_configs_optimal() # remove config that is disabled in this branch del CONFIGS['astar...
b5ae7749ce21ed4968ffbfd51737d949872e34f559630e6bc103a0d2eeb7cca7
Python
988
34
# Copyright (c) OpenMMLab. All rights reserved. import mmcv from .version import __version__, version_info try: from mmcv.utils import digit_version except ImportError: def digit_version(version_str): digit_ver = [] for x in version_str.split('.'): if x.isdigit(): ...
d034eae9f8d50d75113e1d5e6fb25d515e402f8997f5b1b21e91703a3f4e1f53
Python
988
42
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward.suites import suite_optimal_with_ipc11 from downward.configs import default_configs_optimal import common_setup REVS = ["issue386-base", "issue386-v3"] CONFIGS = default_configs_optimal() # remove config that is disabled in this branch del CONFIGS['astar...
cd7ee0a2ea43727d794d3f8d09c4c1eca65c03d74999e2291984388ec1b3e04e
Python
989
30
"""Load nexus device configuration from file.""" import logging from pathlib import Path import yaml from pydantic import ValidationError from console.interfaces.device_configuration import NexusConfiguration, SystemLimits log = logging.getLogger("Config") def load_nexus_config(path: str | Path) -> NexusConfigurat...
ea43e73c7115963b7a8d616d2e34edc50676bc236a67b5de61bf272a580b8d37
Python
989
30
import MDAnalysis as mda from molecularnodes.entities.molecule.imd import StreamingTrajectory from .constants import data_dir def _streaming_trajectory() -> StreamingTrajectory: # a regular multi-frame universe stands in for an IMD stream, as `.next()` # behaves the same and lets the test observe the reader's...
52e2ae026b1651deeaaf1bc99704652393c67b3f33a4cb1f859ef5710d15e1d5
Python
990
33
# -*- coding: utf-8 -*- """ adapted from addExchanges on Nov 23 2023 @author: meine """ import os import sys import cobra from pandas import read_csv from pathlib import Path from reaction_class import Reaction from variables import * blank_model = cobra.Model("BiGG_exchanges") compounds = read_csv(BIGG_COMPOUNDS, ...
ea970006c691ec27c81e56c96ebdbf90c9152452ffcab6234f1e9255652708f4
Python
990
34
from pip._vendor.packaging.version import parse as parse_version from pip._internal.models.link import Link from pip._internal.utils.models import KeyBasedCompareMixin class InstallationCandidate(KeyBasedCompareMixin): """Represents a potential "candidate" for installation.""" __slots__ = ["name", "version"...
520c178572d689c7006b66b258cbb820cb54d90d07dcf5aafd280d876a4ba6ee
Python
991
32
from gymnasium.envs.registration import register from hippo.environments.w_maze import WmazeTasks, get_wmaze from hippo.environments.action_perception import action_perception_loop __all__ = ["get_wmaze", "action_perception_loop"] def register_envs(): register( id="MiniGrid-WMaze3-Task0-v0", ent...
66440635c86848cb08c4c0e1e0cac7c6b0a8977ff53f8c52e5b616d84b3e4564
Python
991
37
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Jul 20 17:45:42 2023 @author: felipe """ import numpy as np import matplotlib.pyplot as plt import matplotlib.colors as colors custom_map = colors.LinearSegmentedColormap.from_list("custom",["gray","yellow","orange","red"]) custom_map1 = colors.Linear...
90ef7dd02d01f73829218ee4c3d9577ecab9ead0be4777559020625912ac8772
Python
991
37
import boto.sqs from boto.sqs.message import Message import sys import os import json def get_connection(): secrets_subpath = ".cloudvolume/secrets/aws-secret.json" secret_path = os.path.join(os.path.expanduser('~'), secrets_subpath) with open(secret_path) as f: aws_secrets = json.load(f) return boto.sqs....
a3c0a9bc76cb24d32ef353998c97c62956172584301eb15b84caa078a41074b1
Python
991
42
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward.suites import suite_optimal_with_ipc11 from downward.configs import default_configs_optimal import common_setup REVS = ["issue385-v3-base", "issue385-v3"] CONFIGS = default_configs_optimal() # remove config that is disabled in this branch del CONFIGS['as...
4581dc413fe25850fe942d93c4d3e1479b2d0472794c4194f25721a9e3fa16e0
Python
992
29
from analyse import * import subprocess from jinja2 import Template submission = Template("""#!/bin/bash #PBS -W group_list=ku_10001 -A ku_10001 #PBS -N {{dirname}}_cluster #PBS -m n #PBS -l nodes=1:ppn=1:thinnode #PBS -l mem=20gb #PBS -l walltime=2:00:00 #PBS -e {{dirname}}_cluster_err #PBS -o {{dirname}}_cluster_out...
6c3fcf29bb53fc86369bf86581af1d9c4171c0aa5afb4d4fd874a6c4954bf6c4
Python
992
15
#---------------------------------------------------------------------------------------------------------------------------- # Author: Brandon S Coventry CAP Lab Purdue University Weldon School of BME # Date: 09/02/20 # Revision History: N/A # Purpose: This is the setup file to get spiking reinforcement learni...
709505c7b206599ce8ae8421e9b6b4317c82f100a9780bebd0347aa9e4e915e2
Python
992
31
from Patient import PatientDataBase # mods: gaussian, rectangle, noise, noise_gauss mods = 'noise_gauss' DATA_PATH_IN = "../../data/input_data" DATA_PATH_OUT = "../data/output_data/" + mods ct_data_out = "../data/output_data/png_org" if __name__ == '__main__': print('start initialization') data_base = Patien...
7a69563b8352b9c23ffd77f10d4d8002ad9454e683054e93c466c5bbba9e0b8b
Python
992
31
import os os.environ.setdefault("QT_QPA_PLATFORM", "offscreen") import numpy as np import pytest pytest.importorskip("PySide6") import nibabel as nib from PySide6.QtWidgets import QApplication from regtools.ccf_boundary_editor.viewer import CCFContourViewer _app = QApplication.instance() or QApplication([...