sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
03a545d360323c4eebc0ba13b6fe22a36ceab30af5ee5f8beb933983e0d66287
Python
1,482
57
from typing import Callable, Dict, List from ..base_transform import BaseTransform class Lambda(BaseTransform): r''' Apply a user-defined lambda as a transform. .. code-block:: python transform = Lambda(targets=['y'], lambda x: x + 1) transform(y=1)['y'] >>> 2 Args: ...
058a5e0411175843c1b4526d2a1fd782e913a2c9720aa3d3ea07a2fa7832538f
Python
1,482
60
# Copyright (c) OpenMMLab. All rights reserved. import torch.nn as nn from mmcv import build_from_cfg from .registry import BACKBONES, COMPONENTS, LOSSES, MODELS def build(cfg, registry, default_args=None): """Build module function. Args: cfg (dict): Configuration for building modules. regis...
7fff38d9d49d55718ab8e07dcb0412de703052dd947815759683c80944a06700
Python
1,482
41
# 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...
d5b1a8a3b4ac296cd6f158a6bc7f585229aeb7803913b32c12d0104c51c7dfeb
Python
1,483
56
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward.suites import suite_optimal_with_ipc11 from downward.configs import default_configs_optimal from downward.reports.scatter import ScatterPlotReport import common_setup REVS = ["issue214-base", "issue214-v2"] CONFIGS = default_configs_optimal() # remove co...
dd5eb45b23fecdb8f3ccfb56d758baae55ebd30e160dfa0411d3c8e05b923dde
Python
1,483
37
# # MIT License # # Copyright (c) 2022 GT4SD team # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge,...
a22d83c2869173869f24c3a5aaf07f8a50cacd350afced9312cf0f95cbe30f4e
Python
1,484
53
from sys import argv import numpy as np import os def extract_geometries(filename): #extract the xyz-geometries and writes it to an external file #the first line should contain the number of atoms initconds=open(filename,"r").readlines() geom=int(1) line_for_geom=int(0) for line in initconds: #get ...
e0f7d9221508ac2eeb7e8f194555335e7d00380ab5b4d7ef8be3c77f9793874f
Python
1,484
40
import pandas as pd from sklearn.metrics import confusion_matrix, accuracy_score, f1_score, roc_auc_score def load_model(model_path): # Assuming the model is a pickled sklearn model, modify as necessary import joblib return joblib.load(model_path) def load_test_data(file_path): return pd.read...
e71f180f9c36135d7c839ad825d31e350a10f11ac2ff97959bef6de35affe531
Python
1,484
74
"""To see the steady-state activation/inactivation variables and time constants in KQT3""" import numpy as np import math import matplotlib.pyplot as plt import os x = np.arange(-90, 90, 0.1) vhm = -12.8 ka = 15.8 vhw = -1.1 kiw = 28.8 aw = 0.5 bw = 0.5 vhs = -45.3 kis = 12.3 ass = 0.3 bs = 0.7 atmf = 395.3 btmf = 38...
977d42e299aec8792107c268350fef037e60b5e9f478954fb2d740d5b4d03787
Python
1,485
39
import torch import torch.nn as nn from torch import Tensor from scipy.spatial.distance import cosine def cal_reliable(spatial_df: Tensor, reliable_X: Tensor, reliable_test_X: Tensor): """ Args: spatial_df: [torch.Tensor] normalized and logarithmized original spatial data (cell by gene)...
221c2a7d60b387ad98b2f3428dc4ad6a25df607a5d459e6a38cde2a4845c9723
Python
1,486
49
import matplotlib.pyplot as plt import numpy as np import os import pandas as pd import seaborn as sns from src.analyze.utils import init_mpl init_mpl(sns_style='ticks', colorpalette='muted') def get_errors(results_dir, rotation_angles=None): errors = [] for rot in rotation_angles: prefix = f"rot={r...
249052bfb17c5f4bdf1fdedd00466d29e0c26f092e714d94c6e71572e502b71f
Python
1,486
49
from __future__ import annotations from shutil import which import pytest from quacc import get_settings pytestmark = pytest.mark.skipif( which(str(get_settings().QCHEM_CMD)) is None, reason="QChem not installed" ) from pathlib import Path from ase.build import molecule from quacc.recipes.qchem.core import re...
4711989822eacedb583f0c07726327257b08d547b85bebb19cc1ba463a565a83
Python
1,487
50
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, BaselSlurmEnvironment from lab.reports import Attribute, finite_sum import common_setup from common_setup import IssueConfig, IssueExperiment DIR = os.path.dirname(os.path.abspath(__file__)) BENCHMARKS_DIR = os.e...
8c797b0a86e3b995610cca2ca476a9b019ec1a6a0e9677259a867f97684515fd
Python
1,487
50
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, BaselSlurmEnvironment from lab.reports import Attribute, finite_sum import common_setup from common_setup import IssueConfig, IssueExperiment DIR = os.path.dirname(os.path.abspath(__file__)) BENCHMARKS_DIR = os.e...
a7d721378b24e4212e4eeebda989c2fc60ce6c438a4e78570cf90f10ce88bc75
Python
1,487
45
import sys, os, random, math from miscFuncs import * baseOutDir, filePrefix, numReps = sys.argv[1:] numReps = int(numReps) def selectVal(minVal, maxVal): size = maxVal-minVal return (random.random()*size)+minVal msOutDir = "%s/sims" %(baseOutDir) logDir = "%s/logs" %(baseOutDir) msOutPath = msOutDir+"/"+file...
9d222c35f55789b4269f34b23c0147a04d3ca6d9bebf518c2fef88e9bcb1f7ce
Python
1,489
27
# 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 # # ht...
d01aedcf1a034481b5e8bc0b22eb6518871b80e5e8b1747916009c191a57912c
Python
1,489
46
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, BaselSlurmEnvironment import common_setup from common_setup import IssueConfig, IssueExperiment from relativescatter import RelativeScatterPlotReport DIR = os.path.dirname(os.path.abspath(__file__)) BENCHMARKS_DI...
2a21af46e74d952790866e1ed70816bcbdce6c5624dd4f6059b106a51606440f
Python
1,490
47
# 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...
4921d0a9a0f48bee208dcced5aa1a8ff5c4e9764fd83aa86b0a9a3feff5122b1
Python
1,490
60
import networkx as nx import pandas as pd import numpy as np def edges_to_graph(df, multi=False): if multi: G = nx.MultiDiGraph() else: G = nx.DiGraph() for k, row in df.iterrows(): G.add_node(row['pre']) G.add_node(row['post']) G.add_edge(row['pre'], row['post']) ...
51af9725fd0380a7380a5999ad2650ffbd39897e40b09d74c4b99c81da5c1601
Python
1,490
38
import base64, io, os from PIL import Image from regtools.registration.report import _img_data_uri def _big_png(path, size=(1700, 1700)): # Random noise, not a solid fill: PNG crushes a uniform fill to well # under _EMBED_MIN_BYTES, so a solid image never reaches the # optimization gate this test ...
6cc5a57ddf8f6ab9f4896c371766c700d2e2a931bac9303830eb8a3154b76204
Python
1,490
47
from __future__ import print_function import platform # from multiprocessing import Pool, TimeoutError, cpu_count from torch.multiprocessing import Pool, Process, set_start_method,TimeoutError, cpu_count try: set_start_method('spawn') except RuntimeError: pass DATE_FORMAT = '%y-%m-%d_%H-%M-%S' def get_max_co...
99a865a40552d247cf5f50ba6af515c4145838c6e8f9281586510130aa6e1f31
Python
1,490
47
# 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...
f834c62a9ea79e73b0a6cf79f86449aec50fe4159c5509d6d94e5ad39d36946d
Python
1,490
50
# -*- coding: utf-8 -*- """ Created on Fri May 11 19:47:20 2018 @author: Francois """ def updateStylePatched(self): r = '3px' if self.dim: fg = '#466e82' bg = '#466e82' #dark blue border = '#466e82' #dark blue # border = '#7cf3ac' else: fg = '#43b1e...
22766fb7aaa63dc55d5fb9f9650a748933222f65651b13c6e7b12b5467ebb588
Python
1,491
42
import matplotlib.pyplot as plt import autograd.numpy as np from autograd import elementwise_grad as egrad """ Mathematically we can only take gradients of scalar-valued functions, but autograd's elementwise_grad function also handles numpy's familiar vectorization of scalar functions, which is used in this example. ...
48a825a1f7bd054d9e7b4da4b89e1fa9d78a1544ffbdb449b675c9e41ecac381
Python
1,491
54
from typing import Callable, Tuple, Any import numpy as np import netket as nk import jax import jax.numpy as jnp import flax.linen as nn from typing import Any, Tuple from flax import struct from netket.utils.types import DType, PyTree, Array, Callable import copy from functools import partial import numpy as np impor...
d19eea9a9fe84df6e73054632d644380822ba5f8b9695d6bff17b3e14f3fdceb
Python
1,491
39
"""Implementation of CLI convert command.""" import numpy as np from treem import Node, SWC, Morph def convert(args): """Converts input data to compliant SWC format.""" vprint = print if not args.quiet else lambda *a, **k: None nam = 'I', 'T', 'X', 'Y', 'Z', 'R', 'P' fmt = 'i', 'i', 'f', 'f', 'f', '...
ed2f665735a3d4ab3b8864e20e9efecbb856da07799e73d442027c169735cacb
Python
1,492
46
import numpy as np import pytest from regtools.geometry_registration.pipeline import apply_orientation from regtools.geometry_registration.types import RunParams def test_runparams_orientation_defaults(): p = RunParams(tiff_path="x.tif", ccf_index=1) assert p.rotate_k == 0 assert p.flip_h is Fa...
f35f1afbfc92e960c01d44721e6c2d52f1fa6f872f9ae35c5e5b524bc60c6589
Python
1,492
56
from .tools import Tools class GraphElement: """Base class for elements of a graph.""" def __init__(self, features: dict = {}, label: str = None, id: str = None): """Constructor Args: features (list[float]: List containing edge features that characterise the edge). ...
f95ba6361927f935538b0674b04e820a2e643d7931efd3897690cde28edebdc6
Python
1,492
41
#!/usr/bin/python #"usage: 3piece_read_split.py Input_file First_piece_size(bp) Last_piece_size(bp) upstream_to_trim(bp) downstream_to_trim(bp)" import gzip import sys fn1=sys.argv[1] if 'gz' in fn1: dfh1=gzip.open(fn1,'r') if 'gz' not in fn1: dfh1=open(fn1,'r') ID1=dfh1.readline().split() line1=dfh1.readl...
02d02be0f1e4e8c3865620d9d1c51c78d84c70125c17a176ea5d21c3a3dfad38
Python
1,494
53
""" 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...
39926976ef52dc2245869ac241af50f868e766790fb66bce19a854167dfb28a6
Python
1,494
45
import dolfin from smart import mesh_tools def test_save_load_mesh(tmp_path): mesh = dolfin.UnitCubeMesh(3, 3, 3) mf_cell = dolfin.MeshFunction("size_t", mesh, 3) mf_cell.array()[:] = 1 mf_facet = dolfin.MeshFunction("size_t", mesh, 2) mf_facet.array()[:] = 2 mesh_tools.write_mesh( me...
568185b43aaa9e62dfafcd447f7084579ae0fc5a5847034ee72e1ad4d3136259
Python
1,494
48
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Sep 29 15:43:24 2020 @author: usingh Use this script to benchmark runtimes of different tools args[1]<-input_fasta_file args[2]<-out dir [3]<-Num trials [4]<-Min len of ORF should be multiple of 3 for orfm to work """ from pyrpipe import pyrpipe_engi...
a045e9b7e766ce71acd1ecd07c1fd38b3f96700b5c966e55596c04c1e7e55598
Python
1,494
46
import logging import logging.config from pathlib import Path from ..util import read_json LOG_LEVELS = { 'DEBUG': logging.DEBUG, 'INFO': logging.INFO, 'WARNING': logging.WARNING, 'ERROR': logging.ERROR, 'CRITICAL': logging.CRITICAL } def setup_logging(log_dir, log_config='utils/logger/logger_co...
d24ca40e9db784d7e6ee06f453294aaed03ef61d9e3206d9f489417aec10d380
Python
1,494
50
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites import common_setup REVS = ["issue455"] SUITE = suites.suite_satisficing_with_ipc11() CONFIGS = { "01-ff": [ "--heuristic", "hff=ff(cost_type=one)", "--search", "lazy(alt([single(hff),single(hff, ...
e7d80a7a95116a8bacbd511a571706dd8cc0b97de34ed5df32ffa258bfa2a169
Python
1,494
41
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2024 Clinic for Diagnositic and Interventional Radiology, University Hospital Bonn, 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 ...
5a9e5bbeaa318bf9dc4e563840e8af748aa67fdfdbeb94b4af2ca80040b1c07c
Python
1,495
47
# 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...
81fd79d78d903fb2cbd95529f2dfc21b16d792160f326af42cb38fa2af823949
Python
1,495
41
"""Tests for the --reg_spacing option plumbing (downsample registration grid).""" import os import sys PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) if PROJECT_ROOT not in sys.path: sys.path.insert(0, PROJECT_ROOT) import inspect import pytest from regtools.registration...
2506e057d0e9e8bfabb53ec46a451f74382d00f39d6d41b00f7f4189c3e3ca07
Python
1,496
54
""" This script converts NeSys .xyz files containing in-brain coordinates to MeshView JSON format (https://meshview.apps.hbp.eu/). """ import os import json def parse_xyz(fname): jsondata = [] obj = {} triplets = [] with open(fname,"r") as xyz: for line in xyz: li...
548d05e1268c9eaf1c89454fb978237fcd67315f32ecb9cb4d6f01acfcc3ec88
Python
1,496
49
import torch import torch.nn as nn from torch.optim import Adam from rocf_scoring.models.model import CNN, weights_init from scripts.training import train, get_dataloaders, directory_setup, initialize_training_csv import os from rocf_scoring.helpers.helpers import visualize_training def train_CNN(): # setup dirct...
8ddbab7d44e56aab5e4b537d7599682cdef8e42bba8ac38d9f5a9932f9bc1035
Python
1,496
18
"""INDEP_CHECK.py 2026-09-29 (methods check, descriptive): does an independent LIF implementation (INDEP_LIF.py, written from the equations only) reproduce the olfactory runaway and its fix on the AL cut-out? DL5 ORNs at 150 Hz, 1 s.""" import sys, time; sys.path.insert(0, 'D:/eucys/03-CODE') import numpy as np, scipy....
8e33412ba1786f1a5a6ee25a2d2666ed8e6fb8d7e3f1c389c54781e88bc52b03
Python
1,496
26
# 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...
24feee3b5182aab796e16a57a1b80484f202910ad029223d9d191adafa569858
Python
1,497
58
# pylint: disable=too-many-function-args, invalid-name, unused-argument """ HCP ROI dataset loading script""" import numpy as np import pandas as pd from omegaconf import DictConfig from src.settings import DATA_ROOT def load_data( cfg: DictConfig, dataset_path: str = DATA_ROOT.joinpath("hcp_roi"), ): "...
cde62e56ee21b8382a9af0ac10293d6e51e6250bc24c745c517683e5b87db636
Python
1,497
37
from typing import List from dataclasses import dataclass from sitetack.app.kmer import Kmer @dataclass(frozen=True) class Sequence: """ Represents a sequence in a fasta file.""" """ UniProtID, such as 'RNase_1' """ sequence_name: str """ The sequence, such as 'MTEITAAMVKELRESTGAGMMDCKNALSETNGDFDKAV...
0bd7562ae19191519e9df479c721a458567c20f9ff7bc91e62988456782ff901
Python
1,498
61
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Initialize TFR model Created on Thu Jun 13 2019 @author: jmagraner """ # %% import autograd.numpy.random as npr def initparams_random(specs,*unused): sc=0.01 ndim, tdim, mdim, cdim, cxdim = specs['data dims'] udim, xdim, cohdim, tiodim = ...
1d5657d22f9b3399487e17a3e15724d28f1933a5bac3a3045cba825dc0bd9582
Python
1,498
42
"""For backward compatibility, expose main functions from ``setuptools.config.setupcfg`` """ from functools import wraps from typing import Callable, TypeVar, cast from ..warnings import SetuptoolsDeprecationWarning from . import setupcfg Fn = TypeVar("Fn", bound=Callable) __all__ = ('parse_configuration', 'read_con...
862566e0028a5e6bd1102d266375650fa66baf4a4a997d587a65d209e0d07132
Python
1,499
45
# install boto3 and set up aws cli import boto3 description = 'AMI for Bransonlab APT backend' source_ami_id = 'ami-0f31a10294d11388a' source_region = 'us-east-1' name = 'bransonlab_apt_ami_tf113_20190419' owner_id = '535416095125' ## client = boto3.client('ec2') regions = client.describe_regions()['Regions'] filter...
17a2492fe810a7f951dae6a2c1e94a71d75cfda779ab180c4cf636ce668a6b1e
Python
1,500
45
import torch from torch.nn import Linear as Lin, Sequential as Seq import torch.nn.functional as F from torch import nn class PAE(torch.nn.Module): def __init__(self, input_dim, dropout=0.2): super(PAE, self).__init__() hidden=128 self.parser =nn.Sequential( nn.Lin...
9c3b409ea090046d7d305dfc32f5ae97331e8720701f6dceef20883ec4e13820
Python
1,500
51
#!/usr/bin/env python import os, sys, time, datetime def getDate(): return time.strftime("%a, %d %b %Y %H:%M:%S %Z") def formatTime(seconds): return str(datetime.timedelta(seconds = seconds)) """def runCommand(command, output_filename): if os.path.exists(output_filename) and os.path.getsize(output_filename)...
a746e78e3a3a16e038e150eeb2cb151be118946a3cb557a50c3192102c1c7bd2
Python
1,500
58
import json import numpy as np def extract_meter_values(meters): ret = { } for split in meters.keys(): ret[split] = { } for field,meter in meters[split].items(): ret[split][field] = meter.value()[0] return ret def render_meter_values(meter_values): field_info = [] fo...
34e56e019aab901c6d93259740c36a349eadc33a0a4d2b66c28ed6e60e25c2f6
Python
1,501
57
import random import unittest import torch import torch.nn as nn from torch.utils.data import Dataset from torch.utils.data.dataloader import DataLoader from torcheeg.trainers import ContrastiveTrainer class DummyDataset(Dataset): def __init__(self, length: int = 101): self.length = length def __le...
d5ef1b01eb0a942a82c64422012b455e7bc85b8602f4badc17d019b900c81941
Python
1,501
37
import os # Enable JAX persistent compilation cache before importing jax # This caches compiled XLA programs to disk, eliminating ~5s of JIT # compilation overhead on subsequent runs # Cache dir is given by an environment variable, or a fallback if not set # Explicitly setting the environment variable is recommended i...
d8a07fdd60019685081d4aa52f9bfab24412e5372cada9fcef303fa9f3c3aa17
Python
1,501
41
import torch from elasticai.creator.nn.integer.quant_utils.simulate_bitshifting import ( simulate_bitshifting, ) def test_simulate_bitshifting_basic(): x_q = torch.tensor([10], dtype=torch.int32) m_q_shift = torch.tensor([2], dtype=torch.int32) m_q = torch.tensor([4], dtype=torch.int32) result = ...
12ad2d92c7a8a0e4f76563cfd0cbbcea4c2c543356c0406a5ddd7d6ce0daa39c
Python
1,502
45
# 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...
479134eb7e4a25f64400e614096ea9b3ce69f1ed25e69ff60cbb68b99bbabbf0
Python
1,502
49
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, BaselSlurmEnvironment import common_setup from common_setup import IssueConfig, IssueExperiment from relativescatter import RelativeScatterPlotReport DIR = os.path.dirname(os.path.abspath(__file__)) BENCHMARKS_D...
c38b6c683f8d4aa9873b48ad769ac125b37aa5276a137eadc95d29da6c636db8
Python
1,502
58
import pdb from typing import Dict, List, Callable from ..base_transform import BaseTransform class PDB(BaseTransform): r''' For debugging, insert breakpoints in transforms. The transformation itself does not change the input data. .. code-block:: python transform = Compose([ ToTens...
dd1e062046447027e9394a7491639d2de7f407b72dadb074a0929600afb12fb8
Python
1,502
59
import torch from diff_frech_mean.frechetmean.utils import EPS, arcosh def l_prime(y): cond = y < 1e-12 val = 4 * torch.ones_like(y) ret = torch.where(cond, val, 2 * arcosh(1 + 2 * y) / (y.pow(2) + y).sqrt()) return ret def frechet_ball_forward(X, w, K=-1.0, max_iter=1000, rtol=1e-6, atol=1e-6, ver...
05420da27cf445d98d3401f14a6e503156961678f1270e7c2e821f27c309dec9
Python
1,503
37
'''Since the n-back has 1 and 2-back events and the beta series are computed on the events type, then we have one network for 1-back and another for 2-back. Following the GLM contrasts, the final networks are obtained from substracting the 1-back adjecency matrix from the 2-back adjacency matrix. This script comput...
2593f66638d9962c5f1b006f61d918975f3b66a995ee203a2772efa989cb76ab
Python
1,504
29
__version__ = "1.0.0" #__picture__ = """ # ____ MiaoNet # ,' , `. (v.{} RELEASE ฅ^oωo^ ฅ){}___ # ,-+-,.' _ | ,--, ===================================== ,--.'|_ # ,-+-. ; , |,--....
32032833c0a51b04074f89e90db903c67fec98640c62412fa2583811c1f7bbf4
Python
1,504
52
# -------------------------------------------------------- # DaSiamRPN # Licensed under The MIT License # Written by Qiang Wang (wangqiang2015 at ia.ac.cn) # -------------------------------------------------------- #!/usr/bin/python import vot from vot import Rectangle import sys import cv2 # imread import torch impo...
67082deef2457ef7f8abfdf16eefd4ba01c89642700df204e79078801a896de0
Python
1,504
48
def update_param(name, param): if name == 'distribution': param['values'].remove('ordinal') return param return None # param untouched extensions = dict( extra_params=[('verbose', 'FALSE')], validate_params=""" # Required maps for different names params, including deprecated params .g...
818d3f1d7f5e4bd86cba50aaf62e8f211eaeb9ffa94a3fb12af8c437b529a2fc
Python
1,504
38
""" 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 Found...
abb457e4a26384b4132fdac84953d203572ebfaddf686e26cd3bf2440f52e9ab
Python
1,505
53
# 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...
c8a49b41edd483784016ae55b254991bba071ed1574347ada05580b908829939
Python
1,506
52
# 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...
e125fbb40cbc0d9c88fed983a8f781b61b0c40c3d469807d6c942754e8223683
Python
1,506
51
#!/usr/bin/env python3 import cc3d import numpy as np from skimage.measure import label from skimage.measure import regionprops from skimage.measure import label2rgb def instance_segnmentation(img, background, arr_type): ''' Perform instance segmentation of puncta args: img -> numpy array of the...
7c72bc86e9de1160e98ae62f3794efbd4b4cf0d0984be7da0044d031f3430e16
Python
1,507
47
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, BaselSlurmEnvironment import common_setup from common_setup import IssueConfig, IssueExperiment from relativescatter import RelativeScatterPlotReport DIR = os.path.dirname(os.path.abspath(__file__)) BENCHMARKS_DI...
bd889c37553557881866f70a966a7340d4e1b103ece8f20494c12c2e56991a9b
Python
1,507
41
import torch import torch.nn as nn import math class lap_spatial_param_module(torch.nn.Module): def __init__(self, channels=None): super(lap_spatial_param_module, self).__init__() self.learn_adjust = nn.Parameter(torch.zeros([1, channels, 1, 1])) self.learn_scale = nn.Parameter(torch.ones(...
e4c960712ba1d1ececa6d748713f4cadb337963f039b4104db5c9325ccdba291
Python
1,508
34
import os import pandas as pd from src.utils import contain_substr from joblib import Parallel, delayed # load all skel and re-sample def load_and_sample(path, sample): input_df = pd.read_csv(path) return input_df.sample(n=sample) def pool_features(complete_skel_path='output/skel_complete.txt', output_stat...
0d9ee6d3e675f9571375c1f772ee90aa19eab117944d6940c5964c9f4aafe808
Python
1,509
44
"""Unit tests for the reusable MIND descriptor generator.""" import os import sys PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) if PROJECT_ROOT not in sys.path: sys.path.insert(0, PROJECT_ROOT) import numpy as np import pytest from regtools.registration.core.metrics imp...
4880df00be12324938316616251d41946658f2b941f4883eccc73d74435a0d5f
Python
1,509
44
# -------------------------------------------------------- # DaSiamRPN # Licensed under The MIT License # Written by Qiang Wang (wangqiang2015 at ia.ac.cn) # -------------------------------------------------------- #!/usr/bin/python import glob, cv2, torch import numpy as np from os.path import realpath, dirname, join...
aea40b989e072e89d784c6e1d30ce380cc08d6a53d3fc95fdf1c1247c988eca2
Python
1,509
42
import os import pandas as pd import numpy as np from dotenv import load_dotenv load_dotenv() # take environment variables from .env. BASE_PATH = os.path.join(os.environ['WORKSPACE'], 'results/') def ch_ds(ch): locs = { 'cme-bins1': BASE_PATH + 'cme/analysis/mappers_cme_bins1.json', 'cme-bins2': ...
c224ab73a0f5dc32921988c5f915a8ee00f3a65a2d10318c6e51e689808f446b
Python
1,509
54
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, BaselSlurmEnvironment import common_setup from common_setup import IssueConfig, IssueExperiment DIR = os.path.dirname(os.path.abspath(__file__)) BENCHMARKS_DIR = os.environ["DOWNWARD_BENCHMARKS"] REVISIONS = ["is...
ecde5670910fe43f65c54b3f6315004bb78e7b2771cd8b1caccc0fd48de916b5
Python
1,509
54
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, BaselSlurmEnvironment import common_setup from common_setup import IssueConfig, IssueExperiment DIR = os.path.dirname(os.path.abspath(__file__)) BENCHMARKS_DIR = os.environ["DOWNWARD_BENCHMARKS"] REVISIONS = ["is...
ee0c08dd4289da8969838e751784a8d754a6f680476ac98da8bb1c1f3544d97f
Python
1,510
38
### adapted from Adriano Fonzino et al. ## (ENSG00000160710) ADAR ## (ENSG00000197381) ADARB1 ## (ENSG00000185736) ADARB2 import sys, os print('Sample\tGene\tTPM') f=open('/media/Scratch_SSD_Voyager/sammi/RNA_editing/fc_TS_v1/counts_all_organize_tpm.txt') tpm_list={} for i in f: if i.startswith('Geneid'): h=i.s...
3ef65ebcb000367bbc2a1bdfcaa573a9649d70428f3ea2c013b0819e739492fc
Python
1,512
37
# # MIT License # # Copyright (c) 2022 GT4SD team # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge,...
66527570788e8cd7d1534ef24cde72142fe2a7e43dcf78f1bdc1d4aedcd497ed
Python
1,512
44
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed May 31 16:52:48 2023 @author: felipe """ import numpy as np import sys import os sys.path.append(os.path.abspath('../../../')) import analysis.frequency as frequency import analysis.synchronization as synchronization import scipy.io as sio import scipy....
93e6bc3c1a0fea6f10fec6ec7b1583953060506792ea64dad6b927015d82f2cb
Python
1,513
48
# flake8: noqa # There's no way to ignore "F401 '...' imported but unused" warnings in this # module, but to preserve other warnings. So, don't check this module at all. # Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use thi...
8ed01445f3973a10cdbdc1e35d7febb88dc3fd02bd98ad57711c61d44eeeba72
Python
1,514
36
""" Training and evaluation parameters """ train_params = { '78 100': { "workers": 10, "is_binary": 0, "eval_test": True, "id": "final", "epochs": 75, "batch_size": 64, "lr": 0.01, "gamma": 0.95, "wd": 0, "weighted_sampling": 1, "image_size": [78, 100], "simulated_data": None, "max_simulat...
b1e6c3b41ec20413f855650e825d5242408b41c28923587edf71fd0c88cd0e23
Python
1,514
50
# 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...
f5b4f44b858834ffc99fe1840fab350263b7ed4c0bf99e877f07e6927a1ef4cf
Python
1,514
39
import torch.nn as nn class PreActResNetBlock(nn.Module): def __init__(self, c_in, act_fn, subsample=False, c_out=-1, grouped_maps=1): """ Inputs: c_in - Number of input features act_fn - Activation class constructor (e.g. nn.ReLU) subsample - If True, we want t...
fa0acbbca165b5d723dab955872023aae8105169dc0589db19c1acbbe3a201f6
Python
1,514
48
# Material dispersion example, from the Meep tutorial. Here, we simply # simulate homogenous space filled with a dispersive material, and compute # its modes as a function of wavevector k. Since omega/c = k/n, we can # extract the dielectric function epsilon(omega) = (ck/omega)^2. import meep as mp cell = mp.Vector3...
202e1dabc81957e5d184987133497463404f4d1b612b5e823bd6b2c4e946723a
Python
1,515
49
""" A subpackage for reading rotation matrices and translation vectors for biological assemblies from different file formats. The central functions are `get_transformations_` """ from abc import ABCMeta, abstractmethod class AssemblyParser(metaclass=ABCMeta): @abstractmethod def list_assemblies(self): ...
25b309cb3d0f5ce3784024be699c3d8cfe59fc0bf617dd6944743db5f456db00
Python
1,515
48
from psychopy import prefs prefs.hardware['audioLib'] = ['PTB'] from psychopy import gui, visual, event, core from os import system, path, chdir from random import shuffle my_path = path.abspath(path.dirname(__file__)) chdir(my_path) def quit(): win0.close() core.quit() event.globalKeys.add(key='escape', fun...
2a2f8c77868d8093cfd8b8cfc529a37a054abe5b630779905b4c6396923907c1
Python
1,515
51
from __future__ import absolute_import from __future__ import division from __future__ import print_function from .scVI_distribution import * import os import copy import random import numpy as np import pandas as pd import scipy import torch from torch import nn, optim import torch.nn.functional as F import torch.di...
321c289e1ab826d7ba7fe63bb0409d67bb0d6292eeaade13e1a7184edc065eb3
Python
1,515
43
#!/bin/env python3 """ Compare different kinds of heart rhythms for experiment and simulation """ import ithildin as ith import numpy as np import matplotlib.pyplot as plt def compare_exp_theo(it, ax): drawn = [] drawn.append(ax[0,0].imshow(sd.vars["u"][it+52,0], vmin=-0.5*3, vmax=1.3*3)) drawn.append(a...
4510fcf07010997b9e334d675c9cfb0ac88ae623b2427755961fd0e2eae5c8b2
Python
1,516
49
PaviaU = { 'path_to_hsi': './datasets/PaviaU/PaviaU.mat', 'hsi_key': 'paviaU', 'path_to_mask': './datasets/PaviaU/PaviaU_gt.mat', 'mask_key': 'paviaU_gt', 'train_sample_percentage': 0.2 } PaviaC = { 'path_to_hsi': './datasets/PaviaC/Pavia.mat', 'hsi_key': 'pavia', 'path_to_mask': './data...
991fcaa6252388db88c075123658bda8152a9aca10c3893c42283fdb63236cf1
Python
1,516
53
import sys import traceback import getopt def main(parameters): """ The main function, which starts to software according to the given command line arguments. :param parameters: the command line parameters: * -h help * -c command line * -g graphic interface """ if not parameters: ...
9da5d9cf7eeac72a86ac8c49961f15223257a9b027473c2fae9b932557636e57
Python
1,516
46
from merlin.core import analysistask class ExportBarcodes(analysistask.AnalysisTask): """ An analysis task that filters barcodes based on area and mean intensity. """ def __init__(self, dataSet, parameters=None, analysisName=None): super().__init__(dataSet, parameters, analysisName) ...
e7fdf85d97665323237a94cda5f95c255cdf8cd3e4900af8dc564bd0da39d609
Python
1,516
49
"""Build script for Cython extensions, used by poetry's build system.""" import os import shutil from pathlib import Path def main(): """Build Cython extensions when invoked by poetry.""" try: import numpy as np from Cython.Build import cythonize from Cython.Distutils import build_ext...
02579b53faeed6a6acdb7cdd11611f6a52a6459935402573da737f7175a0721c
Python
1,517
51
# Copyright (c) OpenMMLab. All rights reserved. import torch.nn as nn import torch.nn.functional as F from .sr_backbone_utils import default_init_weights class PixelShufflePack(nn.Module): """ Pixel Shuffle upsample layer. Args: in_channels (int): Number of input channels. out_channels (int)...
7302ce4bac939874615590e04319ccfd1d19ccd58c558fa6509869a20382159f
Python
1,518
59
from typing import Callable, Dict, List from ..base_transform import BaseTransform class Lambda(BaseTransform): r''' Apply a user-defined lambda as a transform. .. code-block:: python from torcheeg import transforms t = transforms.Lambda(targets=['y'], lambda x: x + 1) t(y=1)['...
ceda5e159b9664f8380045d5e28d36b7e19c42065423e161bb50eba3f6851e47
Python
1,518
51
# -*- coding: utf-8 -*- """ Created on Wed Sep 14 22:16:23 2016 downloaded from http://scipy-cookbook.readthedocs.io/items/Matplotlib_HintonDiagrams.html?highlight=hinton%20diagrams """ from __future__ import division, print_function import numpy as N import pylab as P def _blob(x,y,area,colour): """ Draws a...
101a4bd4e2834b4a35dbb7f4aa38e753b9c1d85976d485100d9d56de781572e1
Python
1,519
52
import io import cv2 import numpy as np from decord import VideoReader, cpu try: from petrel_client.client import Client petrel_backend_imported = True except (ImportError, ModuleNotFoundError): petrel_backend_imported = False def get_video_loader(use_petrel_backend: bool = True, en...
5739b3b76f501980ecf604df451aef3460f39cbc6052b40123a89f4e559caf5d
Python
1,519
57
from elasticai.creator.testing.ghdl_report_parsing import parse_report def test_parse_ghdl_simulation_results_one_liner(): simulation_output = ( "my_test_bench.vhd:64:17:@4ps:(report note):my report message\nsimulation" " finished\n" ) expected = [ { "source": "my_test_...
cef393d5dd0c9dabb743cc60f8434ad0793cba548859f1995d2f20df2e843f87
Python
1,519
53
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, MaiaEnvironment import common_setup from common_setup import IssueConfig, IssueExperiment DIR = os.path.dirname(os.path.abspath(__file__)) BENCHMARKS_DIR = os.environ["DOWNWARD_BENCHMARKS"] REVISIONS = ["issue68...
41b52adb400f78b861ed2ee31dce9b81e8b6746b7cca08c6a49e21e946c4e97a
Python
1,520
53
#!/usr/bin/env python from __future__ import absolute_import, division, print_function, unicode_literals import argparse import logging import os import sys import glob import re import tensorflow as tf tf.keras.backend.clear_session() from callbacks import CallBacks from model_factory import GetModel from preprocess...
a711a550c254d164b10e2e942f0ae854d93c860072528117aab0b1db69a70cf9
Python
1,520
38
#!/usr/bin/env python # coding=utf-8 # Copyright 2021 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LI...
cd3e03754b408bcebe246859ebfc390bacbc79e01a52a84150d7504584694a96
Python
1,520
39
"""3D TIFF orientation is opt-in via --tissuecyte_orient; --no_orient deprecated. Aligns the 3D CLI path with 2D: TIFF data loads exactly as stored unless the user opts into the TissueCyte transform. --no_orient is kept for backward compatibility but no longer controls orientation. """ import inspect from r...
d6d460c6c7e73b319e0be9759c31b53a3112d6f70522c15cfd16ebc73bab3387
Python
1,520
36
# Plots effect sizes and sensitivities for Fig 5C-H from os.path import join from get_paths import * from TVATPlotting import TVATPlotting import matplotlib.pyplot as plt if __name__ == "__main__": save_flag = 0 ## Load data fname_regressions = "data_tvat_polynomialregressions.pickle" ...
0fe1bd9ce4bc27aa4f5cd196f92898aae202731ad865504ee2984b9809f61073
Python
1,521
48
import numpy as np import scipy.sparse as sp def sparse_to_tuple(sparse_mx): """Convert sparse matrix to tuple representation.""" def to_tuple(mx): if not sp.isspmatrix_coo(mx): mx = mx.tocoo() coords = np.vstack((mx.row, mx.col)).transpose() values = mx.data ...
307eb0a55517bcee77334b3ea8b7c3ab4362432ffbf85936e1a8cb3520e8bdf6
Python
1,521
51
# pylint: disable=too-many-function-args, invalid-name """ UKB ICA dataset loading script""" import numpy as np import pandas as pd from omegaconf import DictConfig def load_data( cfg: DictConfig, dataset_path: str = "/data/users2/ppopov1/datasets/ukb/UKB_", indices_path: str = "/data/users2/ppopov1/data...
5670c8ce7d3c497343324140f1e63a50ca3c683a1daaa13b8e129f211cbdc34b
Python
1,522
42
from typing import Dict, Tuple import numpy as np import torch from constants import N_ITEMS from src.inference.utils import assign_score def predict_item_presence(input_tensor: torch.Tensor, classifiers: Dict[int, torch.nn.Module]) -> Dict[int, int]: results = {} with torch.no_grad(): for i in ran...