sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
b382d080f74124e0b3ca9a168b9c03039c0f23f247b79453dd609e6abc4e7566
Python
13,409
336
import sys import numpy as np import matplotlib.pyplot as plt import threading import csv import mappy as mp base_dict_op = {0:'A', 1:'C', 2:'G', 3:'T'} base_dict = {'A': 0, 'C': 1, 'G': 2, 'T': 3, 'a': 0, 'c': 1, 'g': 2, 't': 3} def str2bool(v): if v.lower() in ('yes', 'True','true', 't', 'y', '1'): return True ...
cd0bb64c98dd70046609a5b17f257fc1f4f625549a9c4cb38817419518d6499f
Python
13,411
306
import pysam import os import gzip import copy import shutil import pytest from TestUtils import make_data_files, BAM_DATADIR def setUpModule(): make_data_files(BAM_DATADIR) class TestFastaFile: sequences = { 'chr1': "CACTAGTGGCTCATTGTAAATGTGTGGTTTAACTCGTCCATGGCCCAGCATTAGGGAGCTGTGGACCCTGC...
39a2e214243dfd128b5839e06a4707c1cded3af31f51177f251a59849c7a709b
Python
13,414
431
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class ErrorY(_BaseTraceHierarchyType): _parent_path_str = "histogram" _path_str...
87f3e336b2648aed37c6dbc7c2d56f549859fda4ae0e3ad2603c6e968a605dda
Python
13,414
431
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class ErrorZ(_BaseTraceHierarchyType): _parent_path_str = "scatter3d" _path_str...
e42082f0bb938f0d781179a812e0307d8f19a60e28e682a1ba14fff6715a8f37
Python
13,414
431
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class ErrorY(_BaseTraceHierarchyType): _parent_path_str = "scattergl" _path_str...
7aa1a7e99cbfc726180ceb08024d01205db28b7e7a3d48568a71562d883d5b56
Python
13,416
364
import random from pyoperant.utils import rand_from_log_shape_dist import pickle import numpy as np def random_queue(conditions,tr_max=100,weights=None): """ generator which randomly samples conditions Args: conditions (list): The conditions to sample from. weights (list of ints): Weights of e...
6e5bbab700fc4e0824a8e17223de78011b1c5368abda228bf094c879851fe089
Python
13,418
299
import numpy as np import torch from torch.autograd import Variable from torch import autograd, optim, nn import torch.nn.functional as F from torch.distributions import Categorical from collections import namedtuple use_cuda = True if torch.cuda.is_available() and use_cuda: device = torch.device('cuda') else: ...
6e6e8726d5b9fd7c00f93b9d915db041aed748e44ad13e2760d30acf3d9c0f6a
Python
13,422
319
''' Load K-folding models from groups and evaluate performance author : obanmarcos ''' import os import os, sys from config import * sys.path.append(where_am_i()) import lightning as pl import argparse import numpy as np import matplotlib.pyplot as plt import pandas as pd from utilities import dataloading_utilities...
86cb828b39d310e524032d1ff48140bd44cad05fcace07b04146e245d4bc6591
Python
13,423
317
#!/usr/bin/env python3 """ Dx AL — single-channel ablation sensitivity (figshare cohort). Question for clinical deployment: which of the 19 standard 10-20 channels carries the most diagnostic weight, and how much accuracy do we lose if a particular electrode fails? Method: Re-extract per-epoch raw input data for th...
4bfbb35a9edc998206e89b346a19733d5e86617c3df76ce3f10bb75223e1e927
Python
13,427
320
""" Error analysis agent for tool error diagnosis. """ import logging import re from functools import partial from pathlib import Path from typing import ( Any, ) import anyio from pydantic import BaseModel from pydantic_ai import Agent from galaxy.schema.agents import ConfidenceLevel from .base import ( Act...
90d19558d8f68f8d0f13e5b8b8bcd434f3b324aceda87a1f35352c32e2bd9359
Python
13,428
322
""" Transforming Power Spectra ========================== Apply transformations to power spectra. One of the goals of parameterizing neural power spectra is to be able to understand if and how power spectra may be different and/or be changing across time or context. In order to explore how power spectra can change, ...
48381bc8d42f14d0b62d4f2e995210a9024f743a9dac92a11b620807154c652c
Python
13,429
368
# Copyright (c) 2022 PaddlePaddle Authors. 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 app...
56307fe7711e7195078659148ad8506d4d69e1ee4ac512140ac26c306e69243f
Python
13,430
360
from typing import Dict, List from abc import ABC, abstractmethod import logging import math import random import imodels import numpy as np from scipy.special import softmax from sklearn.metrics import accuracy_score from sklearn.linear_model import LogisticRegression import torch.cuda import tqdm import imodelsx.llm...
d9b0a1ad6ab982331d172ea9cc49faad943623b13a78fde05318e613c387fd5d
Python
13,431
397
"""Pool presets: axis-explicit, mask-aware, refuse ambiguity (extract D10). Presets (spellings DOCUMENTED-UNSTABLE): ``flatten``, ``spatial_mean`` / ``spatial_max`` (4D feature maps), ``token_mean`` / ``token_max`` / ``token_sum`` (3D token sequences, MASK-AWARE), ``cls`` (first token), and ``last_token`` — the last V...
d5ea66416e8e9aa30196b545c97fa66d4f413b298ac75b9c0f49bc32d090af47
Python
13,433
310
import json from pathlib import Path import numpy as np import torch, random import open3d as o3d from PIL import Image from helpers.configurations import OR_4D_DATA_ROOT_PATH def zero_mean(point): mean = torch.mean(point, dim=0) point -= mean.unsqueeze(0) # Norm to unit sphere furthest_distance = p...
581b3a07d546ca2dcb9409dffc7558419eb05f72a94eb616ad3553ebf5966f8a
Python
13,435
390
import json import random from typing import List, Tuple, Dict import numpy as np import pandas as pd from tensorflow.keras.utils import Sequence class TrainDataset(Sequence): def __init__(self, pos: Tuple[List[Tuple[str, str]], List[int]], neg: Tuple[List[Tuple[str, str]], List[int]], fe...
3e5ee13effdf80d6120338f1bbc9c76274921894239f72fbee4262e3b55fce9a
Python
13,440
379
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. """Optimizer.""" import slowfast.utils.lr_policy as lr_policy import torch def construct_optimizer(model, cfg): """ Construct a stochastic gradient descent or ADAM optimizer with momentum. Details can be found...
a7a48e1c8a3654a9f0548dcaba1720fce28afe34d2fa72e9bc4bd8a5c9bc46a4
Python
13,441
370
#!/usr/bin/env python3 """ File: create_regplot_per_dataset.py Created: 2022/03/21 Last Changed: Author: M.Vochteloo Copyright (C) 2020 University Medical Center Groningen. A copy of the BSD 3-Clause "New" or "Revised" License can be found in the LICENSE file in the root directory of this source t...
f66e82d375061b6e0c3beeb545fd9f7da3d8c95ea4a19babc5652b308811c49b
Python
13,443
416
# Copyright (c) 2024 PaddleHelix Authors. All Rights Reserved. # # Licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 # International License (the "License"); you may not use this file except # in compliance with the License. You may obtain a copy of the License at # # http://creativecommo...
5fe0c0f5f6b86080fb440f3d6f451e87e377db4ab95df79a476262d6dd3a096b
Python
13,450
300
from functools import partial import numpy as np import pandas from sklearn.metrics import accuracy_score, confusion_matrix from sklearn.model_selection import StratifiedShuffleSplit from sklearn.utils import compute_class_weight from tensorflow import keras from tensorflow.keras import layers from tensorflow_addons.l...
c318036e4f7bdddadc12ba95eff29c97bfc2da296b52e933174c72a8934de95b
Python
13,450
362
from __future__ import annotations import contextlib import io import os import shutil import tempfile from fractions import Fraction from typing import Any, Generator from unittest import mock import PIL import pytest import torch import torchvision from lightly.data import LightlyDataset, NonIncreasingTimestampErr...
386cd0e3e38fddef5d434fbcfd58264bedfa37295534e9a2b7174a3436d4db62
Python
13,454
301
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license import sys import time import torch from ultralytics.utils import LOGGER from ultralytics.utils.metrics import batch_probiou, box_iou from ultralytics.utils.ops import xywh2xyxy def non_max_suppression( prediction, conf_thres: float = 0.25...
9ed6c0073b72ca4103ccdabe2539ee756515faee659a6903b1b1a555a8c60b31
Python
13,455
339
"""LeJEPA loss functions and regularizers.""" import torch from torch import Tensor, nn from torch import distributed as torch_dist from torch.distributed import nn as torch_dist_nn from lightly.utils import dist as lightly_dist def lejepa_invariance_loss(*, all_proj: Tensor, global_proj: Tensor) -> Tensor: """...
fa068bfb55c24ab69af6d14ac1b4a2f547c1404814f54c5703107ab3682257ef
Python
13,455
262
from typing import Any from dataclasses import dataclass from mirp.settings.utilities import setting_def @dataclass class ImagePerturbationSettingsClass: """ Parameters related to image and mask perturbation / augmentation. By default images and masks are not perturbed or augmented. Parameters --...
fb5f77ca96ecec1b45a0b1b6798d6bcb238622c4b532c0ae739660ac2d8a810c
Python
13,456
419
""" Indexing of the datasets stored in a workspace. Lists the imported and simulated datasets a workspace holds, reading only the stored metadata rather than the datasets themselves. """ from __future__ import annotations import logging from pathlib import Path from typing import Any from larvaworld.lib.util.dictsN...
c14c798edbe26bff094fb350fc7d42e3453cbe6145069002e754e1867fc93c76
Python
13,460
416
#!/usr/bin/python import numpy as np import matplotlib as pl import struct import glob from scipy.sparse import * from scipy.io import mmread, mmwrite current_version = (0,8,3) class AurynBinaryFile: ''' This class is the abstract base class to access binary Auryn files. ''' def unpack(self, data):...
88d873962c1d97367ce20adfcc76f742e696dd9887fa581b61f96df6e0524b8f
Python
13,461
382
"""CTM, HRM, and AKOrN: frontier neural dynamics models. CTM (Continuous Thought Machine): Sakana AI, "Continuous Thought Machines." arXiv:2505.05522 (2025). Source: https://github.com/SakanaAI/continual-learning-baselines (Official: https://github.com/SakanaAI/continuous-thought-machines) HRM (Hierarchical Rea...
22bb810c9d1aede62e736d2457ee49f7ac1b72180596e25e8685928dae87dd4e
Python
13,467
321
import math import random import pytest import torch import torch.nn.functional as F from einops import rearrange import triton from flash_attn.layers.rotary import apply_rotary_emb, apply_rotary_emb_torch from flash_attn.layers.rotary import apply_rotary_emb_qkv_, apply_rotary_emb_kv_ from flash_attn.bert_padding i...
9091f68972379a64fa3f99bcee74c480f3fb1ef733dfce0392844c37faefae6e
Python
13,468
287
import os import logging import contextlib import numpy as np from tqdm.auto import tqdm import concurrent.futures as cf from .XCorrCpu import XCorrCpu # Setting the logger from .TqdmLoggingHandler import TqdmLoggingHandler logger = logging.getLogger(__name__) logger.setLevel(logging.WARN) logger.addHandler(TqdmLoggi...
0ae42a576045e2c5fadc5fbe9398ebcbc554d16763cca81b9f0e78fc9c359961
Python
13,469
348
import json import logging import urllib.parse import urllib.request from pathlib import Path import geopandas as gpd import pandas as pd import pytest from shapely.geometry import box import pyrosm import pyrosm.data.extract_index as ei import pyrosm.data.geocoding as gc # The cache folder function itself; each tes...
c64d6b8627f9a2e676b47b4256f74d7e81365bd7fdf6484f5b4ac56d9f2d35fd
Python
13,471
323
''' Load K-folding models from groups and evaluate performance author : obanmarcos ''' import os import os, sys from config import * sys.path.append(where_am_i()) import pytorch_lightning as pl import argparse import numpy as np import matplotlib.pyplot as plt import pandas as pd from utilities import dataloading_u...
4926c92c3f1bb729d80dc7a099ba8df4567174324df2e229bc2e7916fcb7bd4d
Python
13,474
336
"""Lane F44 stage 2: injected-op persistence, degrade-to-unattested, replay. foldA MEMO s5 item 12: the persistence codec rides the trusted-callable resolver and the C07 ``Op.injection_provenance`` slot (no schema bump); loads degrade to ``unattested`` -- never refusing on an unresolvable callable; :func:`torchlens.in...
d7c4857e4ce4a6c2fdb298a86d0a4e4e5d44a9f35f9f9ea8fb7a49e130c80f1a
Python
13,474
304
# # MIT License # # Copyright (c) 2022. # # 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, publish, ...
31ba1783902695b61fcb0a239b33d4d72d729c84bfca7d2d806203da8f66ad73
Python
13,476
337
import os import pandas as pd from typing import List, Dict from rdkit import Chem from rdkit.Chem.rdchem import Mol from tqdm import tqdm from bioconfpred.conf_ensemble import ConfEnsemble from bioconfpred.utils import MolConfViewer from bioconfpred.params import (BIO_CONF_DIRNAME, GEN_CONF_DIRNAM...
c4ef6a79db905e6dcc4cdaa2058587b604763f2439ba2ca3451fc2701e68100f
Python
13,476
360
""" glm_plots.py This script contains functions to plot results of GLM analyses (glm.py) from dictionaries. Authors: Colleen Gillon Date: October, 2019 Note: this code uses python 3.7. """ import copy import warnings from pathlib import Path import numpy as np from util import file_util, gen_util, logger_util,...
a65d3c85156cd0492fb1ff07600124c396d502298467c4964ac841c82bdfce49
Python
13,478
327
"""ResNet model definition, adapted from https://pytorch.org/docs/stable/torchvision/models.html, to take single channel instead of 3-channel images. """ import torch import torch.nn as nn def conv3x3(in_planes, out_planes, stride=1, groups=1, dilation=1): """3x3 convolution with padding""" return nn.Conv2d...
2a84b234ec3197bd4a0aed4b4c6542642b891d4a725693c98fb3d0899f830bea
Python
13,479
347
# Copyright 2022 Deepfold Team # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
4369f0fe76e5c4899f29c1280070c9893d806cc9d7633b5a3f6279eccd4697ff
Python
13,486
317
# Dependencies: # - dcm2niix # - pydicom # - nibabel # - pandas # - fsl import os, re, pydicom, threading import nibabel as nib import pandas as pd # variables - feel free to change report = "ct-report.csv" # name of the report csv to_scan = "/Users/gravo/Google Drive/MEIC-A/2° ANO/tese/data/TAC_gravo" # absolu...
429b003beedf48de46739c011e7cd37b7b55eac772471f165c0172263a17e25e
Python
13,493
354
from typing import Any import numpy as np import copy import pandas as pd from mirp._images.generic_image import GenericImage from mirp._imagefilters.generic import GenericFilter from mirp._imagefilters.utilities import pool_voxel_grids, FilterSet2D from mirp._images.transformed_image import TransformedImage from mi...
a602199c0cab583689c647254282f4691887ac9ebdbfef6ccc4801c3ec0c3085
Python
13,493
441
""" The simulated larva, driven by a brain and a body model. Couples the behavioural modules to the segmented body, translating the locomotor's linear and angular velocity into motion of the body segments. """ from __future__ import annotations from typing import Any, Tuple import math import numpy as np import par...
3cdec2d120cddb0f3ef28984c60f58126006f8bb16c9caa9e3d7e5ad74957d9b
Python
13,494
392
"""Phase 4 capture target tests.""" from __future__ import annotations import weakref from pathlib import Path from types import SimpleNamespace from typing import Any import pytest import torch import torchlens as tl from torchlens.backends.torch.ops import _save_activation_fields from torchlens.data_classes impor...
c8210337c96eceb34ac2b36968750d8116840ff340482b68f5fb5f1603a197a7
Python
13,495
348
"""Dtype-aware gradient-validation tolerances (tripwire strengthening). The legacy module constants ``PARAM_GRAD_VALIDATION_*`` / ``LAYER_GRAD_VALIDATION_*`` are the fp32 rows of an error model that was silently applied to every dtype: fp64 gradients were checked ~4.5e11 of their own ULPs loose (masking corruption far...
1c6f1e4017f47d4c7ff7a5a615b9518ab4b1aa6c68ba9a0eaceaf39f2817939d
Python
13,504
340
import copy import unittest import os import json import glob import deepdiff import copy class TestSum(unittest.TestCase): def test_lts(self): pass def test_chin(self): pass def test_fs(self): model_dir = os.path.join("..", "data", "neurons", "striatum", "fs") models...
efad62e539b875cada366010658c415a5ea70d056f3ea3b010cd7ac8e71a1c45
Python
13,510
368
""" Manager and Serializer for HDCAs. HistoryDatasetCollectionAssociations (HDCAs) are datasets contained or created in a history. """ import logging from galaxy import model from galaxy.exceptions import RequestParameterInvalidException from galaxy.managers import ( annotatable, base, deletable, hda...
12b03205b7a9d1d7a4f13a0dafc2f3f280234611a339ba7a5c6a4548c1f967d9
Python
13,515
348
import re from keras.src import backend from keras.src.api_export import keras_export from keras.src.optimizers import optimizer @keras_export(["keras.optimizers.Muon"]) class Muon(optimizer.Optimizer): """Optimizer that implements the Muon algorithm. Note that this optimizer should not be used in the follo...
3d6abbc5678c08f942419ef62bf21b1ab57df18c00074cf7ccad9cce64956cb0
Python
13,516
341
import numpy as np from neurogym.core import TrialEnv from neurogym.utils import spaces class CVLearning(TrialEnv): """Implements shaping for the delay-response task. Agents have to integrate two stimuli and report which one is larger on average after a delay. Args: stim_scale: Controls the dif...
74f76aa570963a3434d1ef620d91858f3021d5e4fec94c91a931c64229270968
Python
13,524
468
import os import cv2 import matplotlib.pyplot as plt import numpy as np import torch import torch.nn.functional as f import torchvision from PIL import Image from scipy import stats IMG_EXTENSIONS = ['jpg', 'jpeg', 'png', 'ppm', 'bmp', 'pgm'] def _tensor_size(t): return t.size()[1] * t.size()[2] * t.size()[3] ...
b87ebf48fbdea6a55edf099a9bb28dfd9df44d0eb71a6c1c10f5d15b66c54b0e
Python
13,525
324
#!/usr/bin/env python3 """ Dx AX — Complete normalization-choice picture ================================================ Two follow-up tests after Dx AW's surprise finding (z-score outperforms rank-norm on held-out figshare under proper per-fold): 1. Z-score under STRICT mode (pooled training HCs as anchor) on ...
0557a06a96f7e70aa87a4b5c764e6e3b6f1ddc5669aa4c0888cae93c45a85202
Python
13,529
384
import threading import unittest from time import sleep from unittest import mock from codecarbon.core.units import Power from codecarbon.emissions_tracker import OfflineEmissionsTracker from codecarbon.external.hardware import ( CPU, MODE_CPU_LOAD, AppleSiliconChip, SystemCPULoadMeter, ) @mock.patch...
89b36d331f8917c68553fc8a016661c7e86ed21bd5e33c0edb7860072c6e5013
Python
13,530
477
from torch.utils.data import Dataset import numpy as np import mdtraj as md import torch from torch import nn from .utils import pbc, get_rc_edges, get_mol_edges from .data_augmentation import transform_traj_to_knn_list, transform_traj_to_ndist_list class NNDataset(Dataset): """Unified dataset for non-graph (NN) ...
86461b35a0a726377d2f6cdbc9f03aee4ab347f5cb849be82bb1495efd4f9628
Python
13,538
412
"""Embedding SPD matrices via manifold learning techniques.""" import numpy as np from scipy.linalg import solve, eigh from scipy.sparse import csr_matrix from sklearn.base import BaseEstimator, TransformerMixin from sklearn.manifold import spectral_embedding from .utils.kernel import kernel from .utils.distance imp...
a15d8a8abc534dd983fb7c82605a311165fd52c1f47247d0c8e0112d1c2b4b68
Python
13,538
305
import itertools import unittest import numpy as np from permacache import stable_hash from modular_splicing.dataset.basic_dataset import basic_dataset from modular_splicing.dataset.h5_dataset import H5Dataset class RegressionTestData(unittest.TestCase): def test_hashes(self): expected = { "b...
bc342ae52802f5d1366c7f9c648cfc442357eceeec3e395f39d7bb52ccf2e1f4
Python
13,543
250
from os.path import join import numpy as np import matplotlib.pyplot as plt import os from library.comput_utils import get_tspdiff from library.script_wrappers import best_worst_analysis, exin_analysis, find_nidx_along_traj from library.shared_vars import sim_results_dir, plots_dir from library.utils import load_pickle...
2f371973b74b4b3fbbdd65c7f5dcf91d3a8773fdd9ed26a086bccb0e824842fb
Python
13,547
366
""" train.py: Functions for training neural networks on single tasks and two tasks. """ __author__ = "Louis Kang" __date__ = "2023/03/07" __license__ = "GPLv3" __reference__ = "To be determined" import os, sys import gc import numpy as np import torch from torch import nn from torch.utils.data import DataLoade...
9d27726e98794838ddcdb122664d4c5a8489e2c225aa18d75ec3bcd7328bba9b
Python
13,548
417
""" Reproduce univariate data curves: observed vs DEBtool vs Larvaworld (closed/stepped). This module generates comparison plots for the four univariate datasets from Drosophila_melanogaster: 1. tWw_f: time vs wet weight (larval development) 2. tR_C: time vs reproductive output (standard diet) 3. tR_DR: time vs repro...
3b1aebf546cde3f781c5723facd21d0e11386671981644a44064a68c10547560
Python
13,550
339
# Converting bam to read information # Cell barcode, UMI, gene alignment, and counts import os import sys from multiprocessing import Process import pandas as pd from collections import defaultdict import gzip #from pylab import * import numpy as np #import HTSeq import pysam PATH = os.path.dirname(__file__) bases...
f2aee7d0e91705131c57785a2b0a6dcf88d68a0f4c2d5453368c65e870614b7b
Python
13,552
362
from math import pi as PI from typing import Optional import torch import torch.nn.functional as F from torch.nn import Embedding, Linear, ModuleList, Sequential from torch_scatter import scatter from torch_geometric.nn import MessagePassing, radius_graph from torch_geometric.utils import to_dense_batch import torch...
4db3a68b24cd622e0063f4a509df15206e83db3579b4860216321a00467c96e4
Python
13,556
359
# flake8: noqa: E402 (matplotlib.use has to be right after the import) import os.path as os_path import pathlib import importlib.resources import signal import sys import traceback import webbrowser import matplotlib matplotlib.use('QT5Agg') from PyQt6 import uic, QtCore, QtWidgets from PyQt6.QtCore import QStandardP...
38e8a0c47a1ee423b82a78125c72e06332f15c6e5b2b72fc73870b293b31ca01
Python
13,557
443
"""Asteroid source-separation architectures in compact pure PyTorch form. Sources: Asteroid model docs for DCUNet/DCCRNet, DPRNN-TasNet, DPTNet, and SuDORMRF variants. These reconstructions keep the architectural primitives that make the original models distinct: encoder-masker-decoder separation, complex-style U-Net...
d34385e300d341357457ebd29e2cdc78850bfc3c3f851e9d2abd5e4ef98d2490
Python
13,560
365
# Force import of standard library logging module import builtins import functools import sys import time from contextlib import contextmanager _original_import = builtins.__import__ def _import_stdlib_logging(): """Force import of stdlib logging, not spateo.logging""" # Temporarily remove current directory ...
fa25d744ff87b5cea5a144d05caf982b37fc18773dfed775a98453e13a1dbc95
Python
13,560
330
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> from dataclasses import replace from itertools import product from math import floor import os from warnings import catch_warnings, filterwarnings import numpy as np from numpy.testing import assert_array_equal, assert_allclose import pickle import pytest from p...
fafd0c09bc6de56ba29f22507c7caf8aabb7a5a5b28a3f0ca3868324869fe8c8
Python
13,564
361
import tensorflow as tf from tensorflow import keras import numpy as np from matplotlib import pyplot as plt import pandas as pd import random #%% select a portion of data from database from gemmi import cif number = [] I = [] for i in range(0, 1000000):#1667834 try: doc = cif.read_file(".../...
af2a40fe2cc6ea9bb830bd945fb24fde8f980f1df374aad6e6ec00ac360bcf1d
Python
13,566
256
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
fa35dbab91aca0bb4a23cf265b1ab557652822712ab3a67918e56a155071aeff
Python
13,568
334
"""Round-59 hon_1 immunizer -- registered-module ``__slots__`` RNG generators are inventoried. r58 hon_1: a REGISTERED ``nn.Module`` (the TOP model or a registered submodule) holding a live RNG generator in a ``__slots__`` slot instead of ``__dict__`` escaped the host-nondeterminism inventory belt. The seed loop read ...
40434ab6a9503e295aeb19bd0b028bfe469bcb89c84fe4855fcde61ed36610e5
Python
13,571
281
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations from typing import Any import torch import torch.nn.functional as F from torch import nn from ultralytics.utils.metrics import bbox_iou from ultralytics.utils.ops import linear_sum_assignment, xywh2xyxy, xyxy2xywh...
b5d7a9c427b0b175cd14a4886064b188bbf38b5c42bfb515153f634420cef740
Python
13,578
353
"""Dependency Resolution The dependency resolution in pip is performed as follows: for top-level requirements: a. only one spec allowed per project, regardless of conflicts or not. otherwise a "double requirement" exception is raised b. they override sub-dependency requirements. for sub-dependencies ...
b556813df004b55990fa5294eeb74832a26c19a286108f09bf9ecb36b31ef366
Python
13,584
325
#Create a stitched well from the original files and save as zarr # imports import argparse import configparser import re import zarr import numpy as np import xml.etree.ElementTree as ET from numcodecs import Blosc from pathlib import Path from skimage import io, morphology, filters, measure import pandas as pd import ...
e6045b5a6bae9b8359afff9d66f0b5904b45c41f69ab01ec2701a7eb2c04308d
Python
13,585
289
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
4fa1b15d3e082726e59bd216c84bbc82ea37a66639b687867034300cd36c2e5e
Python
13,588
432
"""Regression tests for round-14 postprocess metadata hardening.""" from __future__ import annotations import importlib.util import textwrap from pathlib import Path from types import ModuleType, SimpleNamespace import pytest import torch import torch.nn as nn import torchlens as tl from torchlens.data_classes.trac...
de76185a291d46b2c9c1eba41626c3637936ed3dfe54196470ba5ad4b4f26128
Python
13,588
384
"""P2 tests for input-side container capture.""" from __future__ import annotations import pytest import torch from torch import nn import torchlens as tl from torchlens.ir.container import DictKey, TupleIndex from torchlens.ir.container_registry import Phase, Role class ScalarConfigModel(nn.Module): """Use sc...
24233f773f22e6e3e81c5ce37713f701b6e408a348a0e489a97672095bf293ca
Python
13,590
410
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import warnings import numpy as np import pandas as pd import scanpy as sc from sklearn.metrics import r2_score from scipy.sparse import issparse from scipy.stats import wasserstein_distance import torch warnings.filterwarnings("ignore") import ...
8ec64a5751697c5f1423b992252f266c32a8a4f257b5b3b77f871af3e68a9533
Python
13,592
295
"""Basic class for TreeGrower Algorithms""" import copy import logging import numpy as np from tmd.Topology.analysis import get_lengths from tns.generate.algorithms.abstractgrower import AbstractAlgo from tns.generate.algorithms.common import bif_methods from tns.generate.algorithms.common import TMDStop from tns.gen...
9bf289dad6d085645a9088afa900e08fdf33a4eef77cb2709543987b38435fdb
Python
13,596
320
#! /usr/bin/env python # -*- coding: utf-8 -*- import math import numpy as np # ROS libraries import rospy # ROS messages from std_msgs.msg import String from geometry_msgs.msg import Twist from trajectory_msgs.msg import JointTrajectory, JointTrajectoryPoint from nav_msgs.msg import Odometry from sensor_msgs.msg im...
0ce36ddfc3bba43719652b1c4ea9586fec5ca110a4a7bd239f31748689a400fb
Python
13,597
359
"""Tests for portable pickle scrubbing and rehydration.""" from __future__ import annotations import pickle import pytest import torch from safetensors.torch import save_file from torch import nn import torchlens as tl from torchlens import Trace, trace as trace_fn from torchlens._io import TLSPEC_VERSION, TorchLen...
d971a8b67d79f3085f51bbf80c1b68ef98872ab95b6048fed5b803b92d54010b
Python
13,597
346
import torch import numpy as np from ovseg.data.utils import crop_and_pad_image from ovseg.utils.torch_np_utils import maybe_add_channel_dim import os from time import sleep try: from tqdm import tqdm except ModuleNotFoundError: print('No tqdm found, using no pretty progressing bars') tqdm = lambda x: x c...
533f9c5dd27542570b6ea0922eecd09d0ff1f23481855f8913a553cb8b6a9e77
Python
13,600
350
"""The universe registry: the closure object of the composition harness. Compo memo D1/3.2: closure lives on a COUNTED, OWNED, code-derived universe registry, not on any taxonomy of bugs. Every universe carries a descriptor (id, owner, derivation, public boundary, filters, independent census, adequacy status, review t...
d860610b2ed25748480796ab157415dafdc994bc8b5a256c7a14abc7120ee1e0
Python
13,604
315
import os,re from tqdm import tqdm import matplotlib #matplotlib.use('Agg') import matplotlib.pyplot as plt from utils import parse_config, setup_fonts, build_output_dir from Bio.SeqUtils import seq3 from scipy.stats import pearsonr import numpy as np import pandas as pd import seaborn as sns def getLongestORF(mRNA)...
df5ba6c3740c66bd15c3ffc0db66be2fc4fe91ad43ade8e4f07ff7ddb8845e3f
Python
13,604
344
# objectives of choice import numpy as np from numpy import prod import torch import torch.nn.functional as F from src.utils import log_mean_exp, is_multidata, kl_divergence from src.datasets import convert_label_to_int # helper to vectorise computation def compute_microbatch_split(x, K): """ Checks if batch nee...
041dc1fc47ce3b879f903edd56a24838f8b38df09c515d9ca081e668b76d9ef2
Python
13,605
252
import torch import torch.nn as nn import torch.optim as optim from torch.utils.data import DataLoader import os import sys import argparse import math import time from model import BIML_S, describe_model from eval import evaluate_ll import datasets as dat from train_lib import seed_all, timeSince DEVICE = torch.device...
acadcc2cd8f0de77cba75eb2687e9e8e19c2940b00c591e5fe54f0f0294b14ec
Python
13,613
350
# -*- coding: utf-8 -*- import brainpy as bp import brainpy.math as bm import numpy as np bp.math.set_platform('cpu') class LIF(bp.NeuGroup): def __init__(self, size, tau_neu=10., tau_syn=0.5, tau_ref=2., V_reset=-65., V_th=-50., Cm=0.25, ): super(LIF, self).__init__(size=size) # parameter...
140bd89b2a1b53cb40e38b074c12c46d87d447ef25b9838028e9d4a586fd4710
Python
13,615
384
import pandas as pd import pytest from types import SimpleNamespace from larvaworld.lib import reg import larvaworld.lib.process.importing as importing @pytest.fixture def tracker(): return SimpleNamespace(Npoints=3, dt=0.25) @pytest.fixture def filesystem(): return SimpleNamespace(read_sequence=["t", "x",...
311d3469c9146f37489224731f9a4d77d50af7101be931fd0f4c96b8ec2e3d84
Python
13,616
354
from typing import Optional, Tuple, Union try: from typing import Literal except ImportError: from typing_extensions import Literal import numpy as np import torch import torch.nn as nn import torch.optim as optim # import tensorflow as tf from dynamo.tools.sampling import sample from .backbone_utils import...
8e20a31c4d462463e14a2a1521f96acac07057bad53e711ce080cf744ce6865b
Python
13,616
267
import pickle import torch import torch.nn.functional as F from models import Encoder,Decoder,GaussianDecoder,VAE,CellStateEncoder,\ CellStateDecoder, CellStateVAE,\ SimpleEncoder,LocalDiscriminator,PriorDiscriminator,\ EmbInfomax,MultiEncInfomax,Classifier,\ ...
28f4c52b08d9931ea1cf8beb9e6de278c5236ba29f00245db011bbd0d7b444a1
Python
13,617
322
#!/usr/bin/env python3 """ Dx BP — Data-quality audit on tool-missed AD subjects ====================================================== Are the AD subjects the tool misses (Dx BO inventory) recordings of unusually marginal data quality? If so, data-quality screening could be expected to improve sensitivity. If not, th...
e3f372b7291fd94a436afa60d1c01755f543af5fa10e7be24c95f4a720217bf6
Python
13,620
344
<<<<<<< HEAD import numpy as np import torch from sklearn.metrics import roc_auc_score from torch import nn from tqdm import tqdm from models.Estimator import EarlyStopping ======= import time import torch from torch import nn import numpy as np from tqdm import tqdm from sklearn.metrics import roc_auc_score >>>>>>>...
74f43bc6bf15b79e6b57b3026d149bca7304bed31718d7873f37cff946557c80
Python
13,623
312
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations import contextlib from functools import partial from pathlib import Path import numpy as np import torch from ultralytics.nn.modules import Detect, Pose, Pose26 from ultralytics.utils import ARM64, AUTOINSTALL, LI...
fd63be29b8aedb893158a6e5ed5900a3eca10e58e9fa4a55d0853c190839381d
Python
13,624
358
"""Unit tests for the creation of RDMs.""" import numpy as np import pytest from mne_rsa import ( compute_rdm, compute_rdm_cv, pick_rdm, rdm_array, searchlight, create_folds, ) from mne_rsa.rdm import _ensure_condensed, _n_items_from_rdm from numpy.testing import assert_allclose, assert_equal ...
5f793e3c4877bb12cced0ee64fa242fc98adc2174c27e40a5e573c9d09b416ee
Python
13,625
381
"""Interfaces/mixins for transaction-like objects. These objects describe the context around a unit of work. This unit of work is very broad and can be anything from the response to a web request, the scheduling of a workflow, the reloading the toolbox, etc.. Traditionally, Galaxy has simply passed around a GalaxyWebT...
533139c29413d18a2cb8c02faa767c8bb26b8f36b7d727bea6488377bc4e9525
Python
13,629
352
# performance.py # Authors: Alex Tseng <amtseng@stanford.edu> # Jacob Schreiber <jmschreiber91@gmail.com> """ This module contains performance measures that are used to evaluate the model but are not explicitly used as losses for optimization. IMPORTANT: MANY OF THESE FUNCTIONS ASSUME THE INPUTS TO BE PREDIC...
fdb21182298b97354da1f7313d7d909ef74d7bf3e7f621c9cda2e0a38f6131f3
Python
13,632
405
import numpy as np import numpy.typing as npt import pandas as pd import scipy as sc import scipy.spatial as spatial from anndata import AnnData from numba import njit, prange from numba.typed import List from .het import create_grids def calc_distance(adata: AnnData, distance: float | None) -> float: """Automat...
9cccaea9eceb1dda1c380d718b09424808a5e6ef9060c4b5afce7a992bb763e3
Python
13,634
348
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Three-line (booktabs) tables for `manuscript/manuscript_en.docx`: apply / check. WHY THIS SCRIPT EXISTS ---------------------- On 2026-09-12 the author converted the manuscript's tables to the three-line convention by hand, inside Word/WPS. That created a trap: `expor...
b2193b12301ee9af175cc0aa87e7be9125a1c07025abc49c5baf07f3e40458a8
Python
13,636
318
import ipdb import matplotlib.pyplot as plt import pandas as pd import numpy as np import os import statsmodels.api as sm import torch from sklearn.preprocessing import MinMaxScaler import random import tqdm def file_name(file_dir): for root, dirs, files in os.walk(file_dir): # print(root) # 当前目录路径 ...
62e9c68e7ddfff6b36173686d3da70a605477129f589f9141fc293aa018bf6d9
Python
13,638
384
# import scipy import copy from scipy import signal from scipy.signal import lfilter_zi import numpy as np from scipy.stats.stats import pearsonr import pdb def make_mr(): return MR(trsamples=9750, N_thr=5, corr_thr = 0.995, forget=5, highpass=[3, 1.0, 5000]) class RtFilter(): def __init__(self, *args, **kw...
da9292837f869d3a51eb65473fa9027bbf002a13f1d6f6e755c2c0230bb8b27f
Python
13,639
377
''' From Niklas Wilming et al. Nature Communications 2020 https://github.com/DonnerLab/2020_Large-scale-Dynamics-of-Perceptual-Decision-Information-across-Human-Cortex Preprocess an MEG data set. The idea for preprocessing MEG data is modelled around a few aspects of the confidence data set: 1. Each MEG dataset i...
911973db15bc49868d189d8137d4ec7315562996801577abd5bee4b433f25541
Python
13,647
316
#!/usr/bin/env python3 """ File: prepare_picalo_files.py Created: 2021/12/06 Last Changed: 2023/01/31 Author: M.Vochteloo Copyright (C) 2020 University Medical Center Groningen. A copy of the BSD 3-Clause "New" or "Revised" License can be found in the LICENSE file in the root directory of this sou...
466d9fdc9ea07daceff8a432e953d08b32ca5e69d00ef5db9f03cdd6e9c36eae
Python
13,655
308
import csv import os import argparse from operator import add from functools import reduce from copy import deepcopy import sys sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import torch from read_deep.rt import rt_deep from importlib import import_module import yaml def get_parameter_nu...
e4745ebff471442b047c30eb060fc86a88992d5400d611e77c46d97e89d26d83
Python
13,655
425
from __future__ import annotations import tensorflow as tf from tensorflow.python.data.ops.dataset_ops import Dataset import numpy as np from kgcnn.graph.adj import ( coordinates_to_distancematrix, define_adjacency_from_distance, ) from kgcnn.graph.adj import sort_edge_indices from ase.io import read from pathl...
156f3076d73b0ef370242946aff4ef19996a7283b8f361987b4518f672a6a6ca
Python
13,657
421
from __future__ import absolute_import, division import contextlib import itertools import logging import sys import time from signal import SIGINT, default_int_handler, signal from pip._vendor import six from pip._vendor.progress.bar import ( Bar, ChargingBar, FillingCirclesBar, FillingSquaresBar, IncrementalBar...
3ac0fc937dbf63b26152f7f3eb9c2808f70040910e02a2a32c08be96b9bf0f72
Python
13,658
454
""" Firmware management module for Arduino-based ethoscope modules. Provides functionality to check firmware versions, compile, and upload firmware to connected Arduino modules using arduino-cli. Requires arduino-cli to be pre-installed on the system (SD image build-time). All functions gracefully handle missing ardu...
84ffd6ad072bcccb4e49870b71d742e5c44e4dcb204f3c78894b40ae13df51e0
Python
13,658
333
from typing import Dict, Any, Optional from src.neuron_morphology import NeuronMorphology from src.cpd_registration import RigidRegistration from src.synthetic_morphology import MorphologyInterpolator from legacy import rpc_interface from src.utils import * class SBA_interface: def __init__(self, sbaHostAlpha: O...