sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
48d021352f9f43308ad315a9d4f42904247e03c8b0516f5b5eca2e0988ca4812
Python
4,889
148
import sys import json import pickle import argparse from lop.nets.ffnn import FFNN from lop.nets.linear import MyLinear from lop.algos.bp import Backprop from lop.algos.cbp import ContinualBackprop from lop.utils.miscellaneous import * def expr(params: {}): agent_type = params['agent'] env_file = params['env...
4c1716aa326fc44e328c737ede0003a2cd1a1047fde4e4fb26e6251d5940ba6b
Python
4,890
140
# Modified from https://github.com/dbolya/tide # This work is licensed under MIT license. from collections import defaultdict class Data: """A class to hold ground truth or predictions data in an easy to work with format. Note: Any time they appear, bounding boxes are [x, y, width, height] and masks ...
f0ce756e7ebabe32fb16701814ad66087949f1cd28b117385648ca21f20b2b0a
Python
4,890
138
import torch from torch import nn from torch.nn import functional as F #from ._utils import _SimpleSegmentationModel __all__ = ["DeepLabV3"] class DeepLabHead(nn.Sequential): def __init__(self, in_channels, num_classes): super(DeepLabHead, self).__init__( ASPP(in_channels, [12, 24, 36]), ...
104dd44eee171421e967d7ee2f3b8038bba51ff3f1ca91217ec0b6692dcd1b5c
Python
4,891
163
import pdb import numpy as np import yaml from yaml.loader import SafeLoader import torch import matplotlib.pyplot as plt from latent_time_stepping.time_stepping_models.neural_ODE import NODETimeSteppingModel from latent_time_stepping.time_stepping_training.optimizers import Optimizer from latent_time_stepping.time_ste...
8f4ec557705fe7de987b222273ec2bb0b81e8b74a73ec2036979c5560a765afb
Python
4,893
127
#!/usr/bin/env python #------------------------------------------------------------------------------- # Name : subtitle downloader # Purpose : One step subtitle download # # Authors : manoj m j, arun shivaram p, Valentin Vetter, niroyb # Edited by : Valentin Vetter # Created : # Copyright : (c) www.manojmj....
d474d7e30f7cd4bbf2b9447490c3f35ea3a54f92c0c391fde8b75eb0d64e7897
Python
4,893
84
import wandb def wandb_initializer(model_config, pretraining_config, finetune_config, method): """ Initialize a Weights & Biases (wandb) run for experiment tracking and logging. This function sets up a wandb run based on the provided method (reconstruction, DEC, IDEC) and configuration parameters. It...
54c5b28bbc06899416f737101608f2698346ba5d67512c6bb6ec94be27ca49bd
Python
4,895
164
import math import random from PIL import Image import numpy as np from torch.utils.data import DataLoader, Dataset import scanpy as sc import torch import sys sys.path.append('..') from ..VAE.VAE_model import VAE from sklearn.preprocessing import LabelEncoder def stabilize(expression_matrix): ''' Use Anscombes ...
93d5a14f631567311bc40b102a5ca441698d519bda4842d98e647ebcc9754df2
Python
4,895
144
#!/usr/bin/env python #!/usr/local/bin/python print(""" Update: tf.nn.seq2seq doesn't work as hoped: It needs a 1D Tensor (chars) as input, not 2D spectrogram/mfcc/... unless we feed it with very long 1D wave data, but that is probably not what seq2seq was intended to for. Fear not: 1D dilated convolution and LST...
95450b3e500b3c6795d8160cc6c9cef8a653ed02167de173246ea8591d8070f7
Python
4,895
139
# __train_model_start__ from sklearn.datasets import make_regression from sklearn.ensemble import RandomForestRegressor from sklearn.metrics import mean_squared_error from sklearn.model_selection import train_test_split from sklearn.pipeline import Pipeline from sklearn.preprocessing import StandardScaler import mlflow...
a0f4aff6e23abf29571db353f07a9095f0b6bdd6cc40ecd90a6f4d55df0a651e
Python
4,897
147
import logging from typing import TYPE_CHECKING, Dict, List, Optional from ray.data.block import Block, BlockMetadata from ray.data.datasource.datasource import Datasource, ReadTask if TYPE_CHECKING: import pymongoarrow.api from ray.data.context import DataContext logger = logging.getLogger(__name__) clas...
3a8e5c3be728bb2426c2642cb5bf009ff82dcfde6b6dfd84712f4ab218922f84
Python
4,900
187
import unittest from lisa.core import data_interface import numpy as np import tempfile import os from scipy import sparse class TestProjections(unittest.TestCase): @classmethod def setUpClass(cls): cls.data = data_interface.DataInterface('mm10', window_size=1000, path = './test.h5', make_new=True) ...
95993a4cc83f17299791bfe09ff0db0a07aede76cf0a6cb784f176fa2cf16d33
Python
4,900
121
import logging import time from typing import Dict, List, Optional from ray.data._internal.cluster_autoscaler import ( AutoscalingCoordinator, DefaultAutoscalingCoordinator, ) from ray.data._internal.cluster_autoscaler.base_cluster_autoscaler import ( ClusterAutoscaler, ) from ray.data._internal.execution....
29422ca41ac9f3b5c583ec665a281b4719c0dd3a3422102077b81cc05756e970
Python
4,902
106
#Instruction configuration for Social Doors Task #Ori Zaff 12/20/22 instruction_hello_door = ''' Hello! This is the Door Feedback Game. \n\nPress the with your right pointer finger button to continue. ''' instruction_hello_face = ''' Hello! This is the Peer Feedback Game. \n\nPress with your right pointer finger to ...
18833b39f31f86584ceb980c45557f09ea2c8b42c675df2e445e50d029c1428c
Python
4,904
128
# Vendored from `decoupler` (https://github.com/scverse/decoupler) by # omicverse for in-tree GPU acceleration work. Original copyright by # the decoupler authors, redistributed under decoupler's GPL-3.0 # license. Cross-module imports rewritten from `decoupler.*` to # `omicverse.es.*` (see scripts/vendor_decoupler.py)...
f122fe5956599216166ed88d5dc88cebd3e49a9cf03ae18c79823934fac9ae8e
Python
4,905
130
import os import argparse # Implementation note: # This code implements the same python code in the CalculateCpxEvidences task without alterations. def sample_svid_readin(filein): out = {} fin = open(filein) for line in fin: pin = line.strip().split() if not pin[1] in out.keys(): ...
d731b86f1178a8c6b9e169ec1d986a26038a112804d0d8e4e4734580a800f6b7
Python
4,906
111
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
f36c07a81c05df6ac9eec731659807386921d1d8f8ef15626014d7b7eeed23de
Python
4,906
164
# # CEBRA: Consistent EmBeddings of high-dimensional Recordings using Auxiliary variables # © Mackenzie W. Mathis & Steffen Schneider (v0.4.0+) # Source code: # https://github.com/AdaptiveMotorControlLab/CEBRA # # Please see LICENSE.md for the full license document: # https://github.com/AdaptiveMotorControlLab/CEBRA/bl...
4c4b11acecad27f68564033449d79bcf8951d4773cce2b20ee8b5f979e4cd2f0
Python
4,907
160
from typing import Callable, Optional import jax import jax.numpy as jnp from jax.lax import cond from jax.scipy.linalg import solve, eigh from jax.scipy.sparse.linalg import cg class lstsq_shift_cg: def __init__( self, diag_shift: float = 0.01, tol: float = 1e-5, atol: float = 0.0...
79c3659a299864b715d0685dc85c8df8fa3f68bce4a62701fcafd4089d5f786d
Python
4,907
163
""" This camera object can inherit from the same genreal class as basler and flir, but with some pecularities. - Azures should await a trigger from the arduino before starting - The camera grabs multiple images. RGB, IR, and depth. - ??? """ from multicamera_acquisition.interfaces.camera_base import BaseCamera, Came...
896ff8555a66d2ee664c5120782eed986082ef171db3e23e6729532613c431dd
Python
4,907
110
import gzip import argparse import logging """ Reformats an SV BED file for VaPoR. * Outputs headerless BED file containing columns chrom, start, end, name, svtype * Extracts contig of interest * Keeps DEL, DUP, INS, INV, and CTX but drops BND, CPX, and CNV types * Appends SVLEN to INS * Extracts sites in sample of i...
653faa98dc8013e3783cf9355a96a6822fc368126742c20353e3646da3bcb7f6
Python
4,909
169
""" Copyright (c) Meta Platforms, Inc. and affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. Node-to-edge gather + Wigner transform + L→M permutation operation. This operation is the first step in the edge message passing pipeline: 1. ...
8e0525613aba114c9038ea3e7c6ab66221080b56781b001b526938e5710b9e67
Python
4,909
101
import os import numpy as np import argparse import pickle def main(args): fmri_path = os.path.join(args.dataset_root,"derivatives", "versionB", "fsLR32k","GLM") subject = f"sub-{int(args.subject):02}" print(f"starting {subject}") betas_tmp = {f"vid{stim:04}": [] for stim in range(1,1103)} beta_ty...
1bf1cccca3bbe9a89318cd22deef8f8cc12b1d8b3b3a59ddaf63cc33c9304239
Python
4,910
134
# -*- coding: utf-8 -*- """ Created on Tue Apr 23 19:44:26 2024 @author: Leyang Xue """ import sys import networkx as nx # Add package path packagepath = '../kcorePercolation' # Manually specify the path to your script sys.path.append(packagepath) from utils import kcorePercolation as kp # Import custom utility fu...
2b022f00489bcbd26437653f3cc896b41e80386afd98ab7999d7c5dfba709632
Python
4,910
126
import math import threading import time from typing import Dict, List import ray # Resource requests are considered stale after this number of seconds, and # will be purged. RESOURCE_REQUEST_TIMEOUT = 60 PURGE_INTERVAL = RESOURCE_REQUEST_TIMEOUT * 2 # When the autoscaling is driven by memory pressure and there are ...
6a7a237cb299932c8303ad0f8cfa475dd91f0b244d54d6f8837410ce2569cdda
Python
4,910
150
import numpy as np class CameraError(Exception): pass class BaseCamera(object): """ A class used to encapsulate a Camera. Attributes ---------- cam : PySpin Camera running : bool True if acquiring images camera_attributes : dictionary Contains links to all of the came...
e834a0b62998db60d28cb6dcbd9e03fa32e29215d167accd92c145678495fd01
Python
4,911
124
import torch from torch import nn from torch import distributions from torch.nn.parameter import Parameter use_cuda = torch.cuda.is_available() device = torch.device('cuda:0') if use_cuda else torch.device('cpu') class Simple_Spring_Model(): def __init__(self, device, R=3): self.device = device ...
da06690ea67cc059fd29c5d8c3b6895323d0b88415a9fffd6f5ff6967b912b33
Python
4,912
134
# -*- coding: utf-8 -*- """ Created on Tue Apr 23 19:44:26 2024 @author: Leyang Xue """ import sys import networkx as nx # Add package path packagepath = '../kcorePercolation' # Manually specify the path to your script sys.path.append(packagepath) from utils import kcorePercolation as kp # Import custom utility fu...
f2dab2b7e17656e1e6de9e60b4f9d84dc0c5e8051f548ee3008c5dfce3e3ecea
Python
4,915
151
from typing import Dict, Optional, List, Any, Union import logging import copy as cp import numpy as np import pandas as pd import warnings from argschema.argschema_parser import ArgSchemaParser from neuron_morphology.transforms.scale_correction._schemas import ( InputParameters, OutputParameters) from neuron_mor...
6a115be4b996944ce53a642919938a9db8aa2521415b806c48e3500f71c616c2
Python
4,916
131
import copy import os from typing import Any, Dict, Tuple from ray._common.utils import get_default_ray_temp_dir from ray.autoscaler._private.cli_logger import cli_logger unsupported_field_message = "The field {} is not supported for on-premise clusters." LOCAL_CLUSTER_NODE_TYPE = "local.cluster.node" def prepare_...
e19f40a640235fc2d4fa368380a050419972f4ec6565869e6337d88465bdb43c
Python
4,918
137
import torch from diffusers import UnCLIPScheduler from .test_schedulers import SchedulerCommonTest # UnCLIPScheduler is a modified DDPMScheduler with a subset of the configuration. class UnCLIPSchedulerTest(SchedulerCommonTest): scheduler_classes = (UnCLIPScheduler,) def get_scheduler_config(self, **kwarg...
4133d1e3f86e7e8cb305228e24549941ed9e114c08315c524caa20a5fbe7edf3
Python
4,920
148
import argparse import glob import os from time import time import cupy import nvtabular as nvt import torch import torch.distributed as dist from nvtabular.framework_utils.torch.models import Model from nvtabular.framework_utils.torch.utils import process_epoch from nvtabular.loader.torch import DLDataLoader, TorchAs...
83aa27a6b7883b89c695b0bbc8f14cd562d017b9ebcafc6716df65064d3e074a
Python
4,920
155
# This file is part of the INTREPPPID programme. # Copyright (c) 2023 Joseph Szymborski. # # This programme 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, version 3. # # This programme is distributed i...
a8230286ea258ba41afa8c0f01b9be36c4ff04513164bcd44cd6127277d88699
Python
4,925
124
MRI_DIRS = [ "/gpfs/data/oermannlab/private_data/ObermannNeuro/dicom/", "/gpfs/data/oermannlab/private_data/ObermannNeuro2/dicom/", "/gpfs/data/oermannlab/ObermannNeuro3/dicom/"] RT_DIRS = [ "/gpfs/data/oermannlab/private_data/temporalMRI/gammaplan/", "/gpfs/data/oermannlab/private_...
c94718b58a1089ce2597bd0614e367bdd3fb1e723ebacd546661ddbc89ccfff1
Python
4,926
132
# Copyright 2023 Google LLC # 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 # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
033757fda5904defe1676692335e82925f2c30b8d4698fdef463518b6c0b9619
Python
4,927
108
#----------------------------------------------------------------------------------------- #Author: Brandon S Coventry #Date: 12/18/23 #Purpose: Demonstrate the role of sample size on two comparison t-tests and Bayes t-tests #Requires: Data from DBS_LFP_GenData.py #------------------------------------------------------...
86689cae2bf8d81fff38297b451bb1892e9e16633015c70b1207910dc1093ec9
Python
4,928
104
import torch import torch.nn as nn from DWonder.RMBG.buildingblocks import Encoder, Decoder, FinalConv, DoubleConv, ExtResNetBlock, SingleConv from DWonder.RMBG.utils import create_feature_maps class UNet3D(nn.Module): """ 3DUnet model from `"3D U-Net: Learning Dense Volumetric Segmentation from Sparse A...
d153060d41d1fe8368c6bd73d7fdc209f14ac48da4bd9862afa54741e366d7dc
Python
4,930
101
__author__ = "Simon Andermatt" __copyright__ = "Copyright (C) 2017 Simon Andermatt" import numpy as np import tensorflow as tf from mdgru.helper import argget, generate_defaults_info from mdgru.helper import compile_arguments from mdgru.model import batch_norm, get_modified_xavier_method # CaffeMDGRU is not supported...
dbcd81e2bbaafef3f1b3a34fdd82361d50b0d84da1cba7f09948baa692d5a81f
Python
4,932
163
# mypy: ignore-errors """Correlations between variables.""" import warnings from typing import Dict, List, Optional, Sized, no_type_check import numpy as np import pandas as pd from data_profiling.config import Settings try: from pandas.core.base import DataError except ImportError: from pandas.errors impo...
3809614092bd4535364608facb62a38dceeba1b7f542667f87b651bba548a1cc
Python
4,933
148
import random from typing import Any, Callable, Dict, Iterable, Optional, Set, Tuple, Union import ray _ResultCallback = Callable[[Any], None] _ErrorCallback = Callable[[Exception], None] class RayEventManager: """Event manager for Ray futures. The event manager can be used to track futures and invoke call...
6ba33c6ff5d72babca11c5ad10d7315fa72ba11204209f25097cf74c678efc7d
Python
4,935
95
from .bioprocessor import BioProcessor import pysolr from bionlp.processors.utils import unique_terms import re import os class DiseaseProcessor(BioProcessor): def __init__(self, model_name): super().__init__(model_name) self.solr_url = os.getenv('SOLR_URL','http://localhost:8983/solr/') ...
0f9d447b95ca2c7b19275a9a40d1e659defeaed0ce54e7f85b3757967c903af7
Python
4,938
148
# Copyright 2023 Google LLC # 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 # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
f68b99c77fa7ab3e605cb464202306a3f033398a47ab8e3a87100ecb84c7cfa3
Python
4,940
197
# This file is autogenerated by the command `make fix-copies`, do not edit. from ..utils import DummyObject, requires_backends class FlaxControlNetModel(metaclass=DummyObject): _backends = ["flax"] def __init__(self, *args, **kwargs): requires_backends(self, ["flax"]) @classmethod def from_c...
1fbb091e2271d43b57f02d61efeb05eb5562269b38b8eae30c2b447eb2d3464b
Python
4,941
136
# -*- coding: utf-8 -*- # (C) Copyright 2026 IBM. All Rights Reserved. # # Licensed under the MIT license. See LICENSE file in the project root for details. """Analog Modules that contain children Modules.""" # pylint: disable=unused-argument, arguments-differ from types import new_class from typing import Any, Opti...
5e8cb3d30156152bd38da65f85d569c7508374f29358984c533b1e5252c83647
Python
4,942
139
from utils.tool import read_img, save_img import time import os import numpy as np import argparse def alpha(x): return 0.8*(2**(x/6)-1) def beta(x): return 0.5*x-7 def clip(x,min,max): if x < min: x = min if x > max: x = max return x def judge_filter(p1,p0,q0,q1,index_a,index_b,...
94da32b5a8df67358af4e0a2c752a249cd455f466021e73befec15f7c9743982
Python
4,942
132
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Python version: 3.10.9 pandas version: 1.5.0 seaborn version: 0.11.0 matplotlib version: 3.6.3 pingouin version: 0.5.3 ptitprince version: 0.2.6 scipy version: 1.11.4 """ #%% Import Modules import pandas as pd import glob import seaborn as sns import matplotlib.pylab...
9aaf916d2c2352fac1ef6c2f87975f81b965c1123ea9c7e66111e5bb1d21f42f
Python
4,943
148
import os import torch from setuptools import setup from torch.utils.cpp_extension import BuildExtension, CUDAExtension import sys SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) ROOT_DIR = os.path.dirname(os.path.dirname(SCRIPT_DIR)) # Find version of tinycudann by scraping CMakeLists.txt with o...
ea4373400b5c97e05d2c3e7f1a49145df456bc8c4083c068d04d213f128f2421
Python
4,943
142
# # CEBRA: Consistent EmBeddings of high-dimensional Recordings using Auxiliary variables # © Mackenzie W. Mathis & Steffen Schneider (v0.4.0+) # Source code: # https://github.com/AdaptiveMotorControlLab/CEBRA # # Please see LICENSE.md for the full license document: # https://github.com/AdaptiveMotorControlLab/CEBRA/bl...
0ac5d20fc91448445fe394acbe6a04fdecf02fa5a8ecea8543b6d9f736f7b592
Python
4,945
145
import numpy as np import pytest import torch from datamate import set_root_context from flyvis.network.directories import NetworkDir from flyvis.solver import MultiTaskSolver from flyvis.utils.config_utils import get_default_config @pytest.fixture(scope="module") def solver(mock_sintel_data, tmp_path_factory) -> Mu...
7a21235b606518b86486b8435db5e0d7e2e2056a5aa40f228009f70cd07cb99b
Python
4,945
141
#------------------------------------------------------------------------------ # Libraries #------------------------------------------------------------------------------ import torch import torch.nn as nn import torch.nn.functional as F #----------------------------------------------------------------------------...
a1cf87d5f848a4d24a5534d8550dc02ab5e2627de994dd287170eac69f57c5a4
Python
4,946
118
from __future__ import annotations import numpy as np def _check_shape(x, y): """Check that x and y have the correct shapes.""" if len(x.shape) != 2 or len(y.shape) != 2: raise ValueError("x and y must be 2D arrays.") if x.shape[0] != y.shape[0]: raise ValueError("Number of datapoints in...
936ca60f3ffdb6e66ff804312f10fdb650425695e9936c7d635b9fbfb97f691e
Python
4,947
161
import numpy as np from scipy.stats import sem NULL_RESPONSE = -1 class SimpleTracker(): def __init__(self, size=256): self.buffer = {} self.unique = {} self.size = size def add(self, ctx_id, value, verbose=False): # if input is new, create new slots if not self.ctx_in...
7183aa8db3a5711de95723027e8f88edadd67be65a706cd48edda1272fcd618f
Python
4,950
114
import os from ray._private.ray_constants import env_bool, env_float, env_integer DASHBOARD_LOG_FILENAME = "dashboard.log" DASHBOARD_AGENT_ADDR_NODE_ID_PREFIX = "DASHBOARD_AGENT_ADDR_NODE_ID_PREFIX:" DASHBOARD_AGENT_ADDR_IP_PREFIX = "DASHBOARD_AGENT_ADDR_IP_PREFIX:" DASHBOARD_AGENT_LOG_FILENAME = "dashboard_agent.log...
9e97e9193f376e5a9fb6cc11aad4d68b8be18fd4181a6e5d1b64aa895a25ad63
Python
4,950
160
""" Copyright (c) Meta Platforms, Inc. and affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ from __future__ import annotations import hashlib import os import shutil import subprocess import pytest from fairchem.core.common impo...
dd89fa7d3f9d2c4b9b7ca54f9d2c1e94bc5a4afda4529cb2f0fc293fa59da584
Python
4,951
112
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
37e55c091dfd24a84d291999dc68fcd9ad744c04b8ea55859768bb93486f796d
Python
4,953
148
import sys from glob import glob import skimage from skimage import measure import nibabel import numpy import os from math import floor import argparse def f(i, j, k, affine): """ Returns affine transformed coordinates (i,j,k) -> (x,y,z) Use to set correct coordinates and size for the mesh. Parameters ----------...
ef462b1bad8346a0747841cbdec889a4d38d6b5db54f5647d84ed3a5bfa9f412
Python
4,954
110
r"""Vendored access to `ThermoMPNN <https://github.com/Kuhlman-Lab/ThermoMPNN>`_ for real thermostability ΔΔG prediction. ThermoMPNN (Dieckhaus *et al.* 2024, PNAS) is a transfer-learning head on a frozen ProteinMPNN encoder, trained on the mega-scale stability dataset. It has no PyPI package and its inference script ...
2080269e7840228ca692d6583aeab1f901871e8e8d809d0d70b90ac6eed28d55
Python
4,955
107
import numpy as np import statsmodels.api as sm import statsmodels.formula.api as smf import pandas as pd from ..io import SAVED_DIR, load_rates, load_current, load_weights, save_convergence from ..math import ones def test_convergence(run_name, directory=SAVED_DIR, conv_trials=100, conv_alpha=0.05, conv_thresh=0.01, ...
da8274656813ded01077b98b23269ebcb5995f89c2b27c9ceb28826177f8cab3
Python
4,956
120
# Copyright 2023 The HuggingFace 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/LICENSE-2.0 # # Unless required by applicabl...
ff5199b8ca851f3063c29cffeab5ebd09751aaca2715c72778213ea63c33bf07
Python
4,958
99
# camera-ready import torch import torch.nn as nn import torch.nn.functional as F class ASPP(nn.Module): def __init__(self, num_classes): super(ASPP, self).__init__() self.conv_1x1_1 = nn.Conv2d(512, 256, kernel_size=1) self.bn_conv_1x1_1 = nn.BatchNorm2d(256) self.conv_3x3_1 = n...
13f36921c2bfb6736777fb2f39b4ab83619c61e23be85efa45e58f5a00a8bb10
Python
4,959
215
import pytest import ray @ray.remote class Counter: def __init__(self, init_value=0): self.i = init_value def inc(self): self.i += 1 def get(self): return self.i def test_basic_task_dag(shared_ray_instance): ct = Counter.remote() @ray.remote def a(): ray.g...
a519a3c6ad0a65014d2c54446a75c0f25e84483378388476ec9f01d12fc2f049
Python
4,959
130
import numpy import matplotlib from matplotlib import pyplot class PickIndex: def __init__(self, idx): self.idx = idx def select(thetas, objectives, with_time, times, figsize=(8, 8), borders=None, *args, **kwargs): """Asks the user to select the best option by clicking on the points from the :mo...
aa5ac895adea0d9e372cdeaa0ebdc802a3c7945a61e089e5a6aabba12b72a9d9
Python
4,960
111
# This file is part of the INTREPPPID programme. # Copyright (c) 2023 Joseph Szymborski. # # This programme 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, version 3. # # This programme is distributed i...
e9f03b81455db9ae8b63099b0e197085b5158a911164724f5f69ee21e050994c
Python
4,960
188
import os import pdb from matplotlib import pyplot as plt import numpy as np import yaml from yaml.loader import SafeLoader import torch import ray from latent_time_stepping.oracle import ObjectStorageClientWrapper from latent_time_stepping.utils import create_directory from latent_time_stepping.AE_models.VAE_encoder ...
5aecc3ff856920c22f3a2704b832724b13dca829b7f1584f5f86b453d4be9ff7
Python
4,962
130
r"""Plotting for single-cell metabolism results (:class:`ov.single.Metabolism`). :func:`metabolism_heatmap` summarises the ``adata.obsm['X_metabolism']`` matrix written by any :class:`ov.single.Metabolism` backend (scMetabolism pathway activity, Compass reaction flux, scFEA module flux) as a group-mean heatmap. """ f...
5430e9ee616bee9bfcd6be7171b2204dd95cca69e707ceb038dcdbab2f507f7c
Python
4,963
145
# Modified from https://github.com/DiZhang-XDU/sleepstager-twobranch/blob/main/sleep_models/ResAtt_OneLoss.py import torch import torch.nn as nn import torch.nn.functional as F class ChannelMask(nn.Module): def __init__(self, input_channels, ratio=8): super(ChannelMask, self).__init__() squ...
f3c72baace69347fa013028df1a6855def5f7609630ab8645d1b9c0a5b6177db
Python
4,964
165
import os import csv import numpy as np import itertools import subprocess #See conditions nname below def register_images(subject_dir, subject_id): fmA_infile =os.path.join(subject_dir) fmA_outfile = os.path.join(subject_dir, 'model', 'model001','onsets','task002_run001') fmB_infile =os.path.join(subject_dir) f...
05429644b662532aa4ed3f8d99bfa35e35ea112733fce0c846bafa7ae43e2e59
Python
4,965
109
import time from experiments.keras.models.brainage_3dcnn import BrainAge3DCNN from experiments.keras.models.cifar_cnn import CifarCNN from experiments.keras.models.fashion_mnist_fc import FashionMnistModel from projectmetis.proto import learner_pb2_grpc from projectmetis.python.utils.grpc_services import GRPCChannelMa...
fa767c029ab988f0fc97987f8c28c4874bd2e925f4833bf0e5a65a43e669292b
Python
4,966
144
from abc import ABC, abstractmethod from typing import Any, Dict, Generic, TypeVar from ray.experimental.channel.accelerator_context import AcceleratorContext from ray.util.annotations import DeveloperAPI T = TypeVar("T") @DeveloperAPI class DAGOperationFuture(ABC, Generic[T]): """ A future representing the...
bbaa794c194b83bbe868638b779377998f24958e9f2cc9c379c8374b7d809f14
Python
4,968
130
import gzip from csv import reader, DictWriter, DictReader from pathlib import Path from typing import Optional import plyvel import requests from rich.progress import Progress from . import utils def build_ensembl_pro_to_upkb_db(processed_folder: Path): db = plyvel.DB( str(processed_folder / "ensembl_p...
bbfdff11687a268e61d7f65ef4bc6014806eef15b13f685f375ff1356c15e004
Python
4,969
124
from typing import Optional, Sequence, Tuple, Union import numpy as np import torch import torch.nn as nn from monai.networks.blocks.convolutions import Convolution from monai.networks.layers.convutils import same_padding from monai.networks.layers.factories import Conv class ResidualUnit(nn.Module): """ Res...
4cf6635289fdc492ad2199edb6a43471c89f6e7281e3fa4605f6abf34d33e196
Python
4,970
151
import numpy as np import pandas as pd from sklearn.neighbors import NearestNeighbors import itertools import networkx as nx # Modified from https://github.com/lkmklsmn/insct def create_dictionary_mnn(adata, use_rep, batch_name, k = 50, save_on_disk = True, approx = True, verbose = 1, iter_comb = None): cell_n...
656bf109e9f0d49a03c1e455b97b67f21748a4a6d310c41b0adeefd09984d640
Python
4,970
149
import tensorflow as tf from utils.nn import linearND, linear from mol_graph import atom_fdim as adim, bond_fdim as bdim, max_nb, smiles2graph, smiles2graph_test, bond_types from models import * import math, sys, random from optparse import OptionParser import threading from multiprocessing import Queue import rdkit fr...
f7bb419029fa62583af5dd4d36ddb05d2482608f187035b20b710eb963ff09e5
Python
4,970
155
# Dependencies # LinAlg / Stats / Plotting Dependencies import numpy as np from PIL import Image # Torch Dependencies import torch import torch.multiprocessing from torchvision import transforms from einops import rearrange # Local Dependencies import vision_transformer as vits import vision_transformer4k as vits4k ...
1e910cbde773519162480fd3a0306e8fecb9687a51804f742724a4b51117f21d
Python
4,973
156
# coding=utf-8 """ Module for computing The Hartigans' dip statistic. The dip statistic measures unimodality of a sample from a random process. See: Hartigan, J. A.; Hartigan, P. M. The Dip Test of Unimodality. The Annals of Statistics 13 (1985), no. 1, 70--84. doi:10.1214/aos/1176346577. http...
d326b0e3b9f0e3b52a4ef6186bb6e707dcd2b3167d944889f587bc9ed3c820e3
Python
4,976
163
#!/usr/bin/env python # -*- coding: utf-8 -*- # """ """ import argparse import sys import pysam import svtk.utils as svu from svtk.vcfcluster import VCFCluster from svtk.svfile import SVRecordCluster def samples_overlap(samplesA, samplesB, upper_thresh=0.8, lower_thresh=0.5): # Get lists of called samples for ...
725005a181991710f976109ef5ba4d7b3e402b4c757bcf6d2fbac4d2921d6cba
Python
4,978
125
""" Copyright (c) Meta Platforms, Inc. and affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ from __future__ import annotations import os import pytest import torch from fairchem.core.common import distutils, gp_utils from fairch...
c9debb536bd5e12c3176fd37bd5fd483b65262c5079eec65c64d2ce20e6f9d91
Python
4,982
126
#################################################################################################### # Copyright (c) 2020, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is free softw...
84d9fdd4a4e8bfffb70bb77deec591ac735cf70263f0ec6fc1ef683bfc6a9903
Python
4,983
168
# This file is part of the INTREPPPID programme. # Copyright (c) 2023 Joseph Szymborski. # # This programme 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, version 3. # # This programme is distributed i...
c5a74ab3f2f3549f8eef3fbd98675420dbcc567a0be902ef96851b6e33adc609
Python
4,983
164
#!/usr/bin/python import warnings import numpy as np from scipy.sparse import coo_matrix import pandas as pd def sample_molecules(counts, n): """Sample n molecules from a vector of molecular counts Parameters ---------- counts: ndarray ngene x 1 count vector n: int number of molec...
408667ae9c514848205c748f296ed1f9357d183782ff3b5070734a43d75393c5
Python
4,986
131
#!/usr/bin/env python # -*- coding: utf-8 -*- # """ """ import argparse import heapq from collections import deque import pysam import svtk.utils as svu def records_match(record, other): """ Test if two records are same SV: check chromosome, position, stop, SVTYPE, SVLEN (for insertions), STRANDS (for B...
f27298589170ea92bfe2be4eb8b106059ac618cdd91a1ad1fc5af9939749bbd0
Python
4,986
109
""" Copyright (c) Meta Platforms, Inc. and affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ from __future__ import annotations import argparse import os import pathlib mapping = { "fairchem.experimental.foundation_models.unit...
17f488dbdb094584521a448d518da1fe529aea0176b359a56f70a213948338d7
Python
4,987
159
"""Transforms on raw wav samples.""" __author__ = 'Yuan Xu' import random import numpy as np import librosa import torch from torch.utils.data import Dataset def should_apply_transform(prob=0.5): """Transforms are only randomly applied with the given probability.""" return random.random() < prob class Load...
73021605ca640ddc15ecc67aa4421f435ddce1e468060918f1025f6ea2cf6e39
Python
4,987
148
from __future__ import annotations """ OmicVerse Agent utilities Public API ---------- seeker(links, *, name=None, description=None, max_pages=30, target="skills", out_dir=None, package=False, package_dir=None) Create a Claude Agent skill from a link (or list of links) directly from Jupyter. Examples -------- >>...
8ab5210d6ad0d04159a4241b71c4f682ca5c47369d6b9fd52ffd33fcb1583b41
Python
4,989
172
""" test 'charge_and_spike' neuron model """ import os import matplotlib.pyplot as plt import numpy as np from spinnaker2 import hardware, snn rng = np.random.default_rng(42) def v_silent(input_spikes, weights, t): ts = np.ones_like(input_spikes) * t t_diff = ts - input_spikes t_diff = np.maximum(t_diff...
e17768225f0ea615d78f3e5b9218d55881d35d94c0e4bd2893a0712a561278a1
Python
4,989
123
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
196c7a3450489febc64d956a87555bca547cc9df0251a03bf0cc1226af154ddd
Python
4,991
131
# Copyright 2024 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
f8c05cb5e7863edf023d3eec64f6b69504713ce116513a7dcce5a5fdc5718a4b
Python
4,991
131
import torch import torch.distributed as dist import torch.multiprocessing as mp import argparse import os, glob from sklearn.model_selection import train_test_split from torch_geometric.loader import DataLoader import socket from src import AseReadDatasetAttr from src import TrainerFineTuneRegression from equiformer_...
2d4155db4ee92f640de1211d95986e3244b3d146eb3cfd63514f6356a43ff83f
Python
4,993
91
# -*- coding: utf-8 -*- """Convert .czi image stack (saved by Zeiss microscopes) into .tif image stack. This script is used to convert .czi image stack into .tif image stack. The .czi file is saved by Zeiss microscopes and contains 3D SIM data. While the .czi file can be directly loaded by the SIM3DDataLoader class in...
a1245b1cb54ec10a78f66e85304c426bd22e7dc1b8781431ca97357d9f46ea21
Python
4,993
132
# -*- coding: utf-8 -*- """ Created on Wed Sep 14 12:18:00 2022 @author: ju-bar EMD file I/O This code is part of the 'emilys' repository https://github.com/ju-bar/emilys published under the GNU General Publishing License, version 3 """ import json import h5py import numpy as np def get_data_as_str(data): d = ...
354f45becf49a7badc0273315420b30f58ee0465c44e0ed612667ce49b8f894f
Python
4,994
116
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
90bce2df02d315d34986341ad6a81815b5533046356902d1452a733bdf540fc1
Python
4,994
100
import torch import numpy as np import nibabel as nib import torch.nn as nn import torchio as tio import kornia.augmentation as K from torch.utils.data import Dataset from pytorch3dunet.unet3d.model import UNet3D from skimage.morphology import closing, cube model_path = '/space/calico/3/asterion/1/users/lr252/synth_hy...
3210721a15b18c3c72dbe8eb6ef398b9637a035b292c252167601bc5aa297b5e
Python
4,995
127
from typing import Dict, TypeVar from ray.data._internal.execution.interfaces import ExecutionResources # The math functions defined in this module use a generic type rather than # `PhysicalOperator` so it's easier to test. We already pass in all of the necessary # inputs, so the actual type doesn't matter. T = TypeV...
d3efa6f3db4830be9cf97a0a7ce3a1feb92e1deaed0dbeab5cd5075c5472865e
Python
4,995
156
# -*- coding: utf-8 -*- # (C) Copyright 2026 IBM. All Rights Reserved. # # Licensed under the MIT license. See LICENSE file in the project root for details. """aihwkit example 21: Fitting a device data to a piecewise step device. Plots the fitted response of a piecewise step device """ # pylint: disable=redefined-o...
3bbc0aa2e8f3b0e3d5e6737c05f9cb6620ef8f07fc63724f08758006066c70a3
Python
4,996
161
# -*- coding: utf-8 -*- # (C) Copyright 2026 IBM. All Rights Reserved. # # Licensed under the MIT license. See LICENSE file in the project root for details. """Parsers for the AIHW Composer API.""" from datetime import datetime, timezone from typing import Any, Dict from aihwkit.cloud.client.entities import ( C...
3fbdd9d9f3dd46bc111e48a8893f8d752c845933ca2a72e72c99c24c5e0f9a5f
Python
4,997
128
# coding=utf-8 # Copyright 2023, Haofan Wang, Qixun Wang, All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless re...
71052f00f5ff5b886daaa5f329625f3eb0c7bf8b053edb38698d8fbb6516e677
Python
4,998
113
import torch from loss import spearman_loss from metrics import spearman_corr class ProcessingData(torch.utils.data.Dataset): def __init__(self, train_csv, train_pt, dataset_type): self.train_csv = train_csv self.train_pt = train_pt self.dataset_type = dataset_type def __len__(self)...
8a671fc1ab2f6c10434b87609bc4737d0a77b92cb3c8c63e3a9cc1355fd43b16
Python
4,999
150
import multiprocessing as mp import tkinter as tk import PIL from PIL import Image, ImageTk import cv2 import numpy as np import logging import time def get_latest(queue, timeout = 0.1 ): start_time = time.time() try: item = queue.get(timeout=timeout) while True: try: ...
dbbfbadfc9535f52decdaf22b52a3f318ceebf7d40bc81e341ddcb6fc6d43c86
Python
4,999
130
#!/usr/bin/env python # coding: utf-8 # In[ ]: #In order for this code to be executed one needs the detailed spreadsheets that are created after each model's training #and testing process and contain the individual predictions and probabilities for each patient. #The code can then read the spreadsheets and calculat...
58acc1de8efab1d754c7d82b8a5a0b43afa28c304fa85157b21769f408c48803
Python
5,002
139
from typing import Tuple import numpy as np class ValidateMapping: def __init__( self, input_feature_size: int, output_feature_size: int, kernel_size: Tuple[int, int], stride: Tuple[int, int], padding: Tuple[int, int], input_dimension: Tuple[int, int] = [64,...
d6c16cf07d4d6f3b67e748f5bbca6c5a074017bae74e00bdd84c26b9d29c87c8
Python
5,003
181
#!/usr/bin/env python import os import numpy as np from scipy.sparse import coo_matrix from scipy.io import mmread, mmwrite from clusterdiffex.distance import spearmanr import umap import phenograph def get_knn(distance, k=20): """ Get a cell x cell k-nearest neigbors adjacency matrix Parameters -------...