sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
7d81533a565de80cbaf414891d8d3f9c2a5d0212c7d2eac5af935ea6043f155e
Python
6,066
173
import math import sys from ij import IJ from sc.fiji.analyzeSkeleton import AnalyzeSkeleton_ BASIC_NAMES = [ "Branches", "Junctions", "End-point Voxels", "Junction Voxels", "Slab Voxels", "Average branch length", "Triple Points", "Quadruple Points", "Maximum Branch Length", ] DETA...
2636763523ef66811d950216a862715dd66026ddd83464d6e53beb608acf99cd
Python
6,067
154
import sys sys.path.append('../TM2_segmentation') import datetime import json import os import numpy as np import pandas as pd from tensorflow.keras.optimizers import Adam from tensorflow.keras.callbacks import TensorBoard, LearningRateScheduler, ModelCheckpoint, ReduceLROnPlateau from tensorflow.keras.models import ...
fc1617cc2834cf325cb54f6f981448d1db36295805fca8ed9c1804e850311aa1
Python
6,067
184
import torch import torch.nn as nn import torch.nn.functional as F from .multiheadattention import CustomMultiheadAttention class ConvolvedAttention(nn.Module): """ Attention where the attention takes place over a window of finite size. This is done for two reasons: 1. To reduce the computationa...
7404fa490c0785e1a93b53b0b6f29932fa2e73b58b74b249fa3f7b11479dd683
Python
6,069
182
"""Round-47 secB_1 immunizer -- dataclass foreign-``__init__`` forged-flag recompute. Sparse runnable reconstruction sets only captured fields and NEVER invokes ``__init__`` (that would be the SEC1 construction-gadget RCE surface). So a dataclass output whose WINNING ``__init__`` is a user-authored / foreign construct...
04f7b1f668ce7d735b4acfdcfcdfcf7b02604e5b787fb1c00698007c19b95ba6
Python
6,070
176
################################################################################################################################################################# ####################### Testing DeepRiPe #####################################################################################################################...
655737006fc083cd988d40dd5da3143f20323553b06c2ffa390749946c45279e
Python
6,070
175
# --- # jupyter: # jupytext: # formats: ipynb,py:light # text_representation: # extension: .py # format_name: light # format_version: '1.5' # jupytext_version: 1.14.5 # kernelspec: # display_name: Python 3 (ipykernel) # language: python # name: python3 # --- # + import o...
75c8258dc3487e1d0857dc5d3c7ca471fac1a254282570fa57e56d71aada037e
Python
6,070
179
from __future__ import annotations import typing as t from jinja2.loaders import BaseLoader from werkzeug.routing import RequestRedirect from .blueprints import Blueprint from .globals import _cv_app from .sansio.app import App if t.TYPE_CHECKING: from .sansio.scaffold import Scaffold from .wrappers import ...
b192c423257232ad67ceed09f7f99a909ac3d665994a1665405cc19eaecc92a8
Python
6,070
210
""" Sample implementations of visualization functions. """ import os import matplotlib.pyplot as plt import numpy as np from skimage.measure import regionprops from tqdm import tqdm def draw_cell_area( imgs=None, channel=None, seg_masks=None, savedir=None, configs=None, display=False ): """ Draw th...
e6e4f33734d5ba98df16de2eaec99291017172cd61e471eef444389f16c6b287
Python
6,071
234
from tempfile import NamedTemporaryFile, TemporaryDirectory import numpy as np import pandas as pd import polars as pl import seqpro as sp import xarray as xr from pytest_cases import fixture import zarr import seqdata as sd @fixture # type: ignore def gen_table(): """Dummy dataset with AA, CC, GG, TT sequence...
ee5bea656b55d7a59deabbf2d16c6521a57ccc17aadd49e894a702457ec38cec
Python
6,071
103
import numpy as np import tensorflow as tf #tfa.register_all() ''' import numpy as np from tensorflow.keras.models import Sequential from tensorflow.keras.activations import get as get_activation from tensorflow.keras.layers import SimpleRNNCell, RNN, Layer class SimpleRNNCellWithLayerNorm(SimpleRNNCell): def __ini...
b7e7369744a3ea75dcd250f7b214db188214f77d81a3dee913709ac34d5a0248
Python
6,072
178
""" Preprocessing code for image data. Resizes and rescales data using MedPicPy and then saves it as individual npy files for use in the training process. Because some scans are 3D, the number of 2D images can't be known ahead of time so a function was added to MedPicPy that loads the images individually and fi...
4dead3193f7475045373495bd830d669b3c8adb01f36d3ae24bd316eb1bfb74f
Python
6,073
164
#!/usr/bin/env python """Normalize sdists AND wheels in place so equal inputs give equal bytes. ``python -m build`` under ``SOURCE_DATE_EPOCH`` produces a wheel whose timestamps are deterministic, but two machine-dependent residuals remained (grind r4 R86-1; grind r5 b10 R84-1, MEASURED): the sdist's gzip ENVELOPE sto...
3033ecdee2e1428d98d54249625e542038ae639e03b31cb98e5d0f3a055c4f68
Python
6,074
182
# --- 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 Line(_BaseTraceHierarchyType): _parent_path_str = "contourcarpet" _path_s...
eee370eac3c705bb0f178d41854c1d16e6a05e30faa45ca1884aecb69d6465f9
Python
6,074
147
import os import argparse import torch import torch.nn as nn import torch.distributed as dist import torch.optim from tensorboardX import SummaryWriter from gluoncv.torch.model_zoo import get_model from gluoncv.torch.data import create_datasets, create_loaders from gluoncv.torch.utils.model_utils import deploy_model,...
b36e0df6945a61bc37c171a68e2b952c0786b9f76d23f7d5030a30b1b3313e1b
Python
6,076
175
"""Regression tests for the Lightning ``LayerProfilerCallback`` teardown.""" from __future__ import annotations import weakref from pathlib import Path from typing import Any from unittest.mock import patch import pytest import torch from torch import nn pytest.importorskip("lightning") from torchlens.callbacks.li...
b9603e0fb1f2b9152c393fb89e18b7bef0833599cd117c18707310d3651111f4
Python
6,076
149
# The triton fused matmul + sqrelu is faster for fp16 but slower for bf16, compared # to naive implementation. import fused_dense_lib as fused_dense_cuda import torch import torch.nn as nn import torch.nn.functional as F from flash_attn.utils.torch import custom_fwd, custom_bwd from flash_attn.ops.activations import s...
34e0174fd80a7dc5aa70eae0c0a72edcc5a61aa67a1628087bc17d50f7838061
Python
6,077
210
""" misc_figs.py This script contains functions defining miscellaneous figure panel analyses. Authors: Colleen Gillon Date: January, 2021 Note: this code uses python 3.7. """ from util import gen_util, logger_util from analysis import misc_analys from paper_fig_util import helper_fcts TAB = " " logger = log...
43ee20c0bf55698411e91e2c9bd586f87e93470cf1f73f3aa7ceb6694d55d631
Python
6,077
155
""" analyze ensemble results """ import sys import os import numpy as np import glob import pandas as pd def get_ensemble_result(ensem_list, score_name, en_type='', conf_name=None): if en_type == 'mean': en_scores = [l[score_name] for l in ensem_list if score_name in l] if len(en_scores) == 0: ...
a4db4f4c5348c4ca7b0515d9ea1dc553d5b28a9b98a0e240dde954afd21f0305
Python
6,078
165
# pylint: disable=all """Transforms for simple pose estimation.""" from __future__ import absolute_import import random import numpy as np import mxnet as mx from ..image import random_flip as random_flip_image from ..pose import flip_joints_3d, get_affine_transform, affine_transform from ....utils.filesystem import t...
7c5aa0f59deec2208d6e21446e3ef5eca00bca1b5f7d0e6bb17573402627821c
Python
6,080
133
# -*- coding: utf-8 -*- import tensorflow as tf import numpy as np import scipy.misc import time import os import glob import cv2 #reader = tf.train.NewCheckpointReader("./checkpoint/CGAN_120/CGAN.model-9") def imread(path, is_grayscale=True): """ Read image using its path. Default value is gray-scale, and ima...
a9d0ec516268c92756adff49cf048bb359a9d1e619dca2716a45042cf6ae7742
Python
6,080
147
import logging import os from pathlib import Path import torch import torch_geometric.transforms as T from coeffnet.dataset.reaction import ReactionDataset as Dataset from e3nn import o3 from torch_geometric.loader import DataLoader import wandb from cli_functions import ( create_timestamp, get_basis_set_name...
5ab3ac41fed5f8d5d017215e4e869a0d785489fcd4213d71660b4c9894bd2ce2
Python
6,081
202
model = dict( type='BYOL', base_momentum=0.99, backbone=dict( type='ResNet', depth=50, in_channels=3, out_indices=[4], norm_cfg=dict(type='SyncBN'), init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')), neck=dict( type='NonLinearN...
e338c87098321ff53d26a95c277ac796bbde3601bf5cd1c163f480c438ff3205
Python
6,081
220
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType import copy as _copy class Currentvalue(_BaseLayoutHierarchyType): _parent_path_str = "layout.slider" ...
a6dbec31d1a3ab8da9ce8638b24001545e37bb6c40b4b2655c0ba53e2f80d746
Python
6,083
152
"""Logic that powers autocompletion installed by ``pip completion``. """ import optparse import os import sys from pip._internal.cli.main_parser import create_main_parser from pip._internal.commands import commands_dict, get_summaries from pip._internal.utils.misc import get_installed_distributions def autocomplete...
40f770a33e1248206af21b94fa7dfe0a25ceffee8a416bf6cce3036cf8ee386a
Python
6,084
155
# SOURCE: vendored from cubeyoung/Noise2Score @ main (models/networks.py, class UNet) """Noise2Score (NeurIPS 2021) -- Tweedie-formula score-based denoiser. Noise2Score estimates the score function (gradient of log-density) of noisy observations via amortized residual learning (AR-DAE), then applies Tweedie's formula ...
428cee7f6011c09285e5af2393babbef59f73e50656d079347d82ec10cc8198a
Python
6,085
147
import os, sys from datetime import datetime import XML_Parse as xparse import Apical_Basal_Classification as classify import Branch_Number_per_Skeleton as bnps import Euclidean_Distance as ed import Skeleton_Visualization as sv import File_Converter as sw import pandas as pd ########################################...
ec001c80e3fdba27126fd4c77b9e3fe96f543178afc1145db2754dfa0d001da7
Python
6,086
195
""" =============================================================================== Clustering algorithm comparison =============================================================================== A comparison of several clustering algorithms on low-dimensional synthetic datasets, adapted to SPD matrices from [1]_. The...
3fbed660a55b12b32ac9ee88a740b1c2e047a1f803d037154e8f3af061c230fb
Python
6,087
148
"""Param byte-witness gating regression suite (W6). The named-parameter whole-storage byte-witness (r18/r19-A: forward-start snapshot + forward-end ``torch.equal`` reconcile in ``buffer_writes``) is armed ONLY for runnable-capable captures (``intervention_ready=True``) -- the exact predicate for "this capture can prod...
4597fd560ad8f796dffc07a7dadafcc8295ff9a651b7fca1dcbf0060699b0d97
Python
6,087
157
#!/usr/bin/env python # ============================================================================= # MODULE DOCSTRING # ============================================================================= """ Python wrapper for the plumed sum_hills program. """ # =======================================================...
525e2b2ba0d3b4756540fea25bbc8668578cba8b96ce6bc1a7ad1212a7df567e
Python
6,088
173
# 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 in writin...
9f250abb28b9c9d10fefff61f8eb6d58dec16c2c507740efe8257d05753559d3
Python
6,089
181
import argparse import os import subprocess import warnings from zipfile import ZipFile import h5py import yaml from skl2onnx import convert_sklearn from skl2onnx.common.data_types import FloatTensorType warnings.filterwarnings("ignore") os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' SKLEARN_MODELS = [ "sklearn.ensem...
1fa6cc33ac2499fc9fe57f895b4eaa758d778838a9b9840d2877b4c2378db89e
Python
6,090
171
#!/usr/bin/env python """ BASIL GUI for Oxford ASL - Main window Currently this does not use any of the FSL python libraries. Possible improvements would be: - Use props library to hold run options and use the signalling mechanisms to communicate values. The built-in widget builder does not seem to be flexible e...
2ac2e418bb4585b2f7e56f094c95f0d5b263fa8976779e8a523ec894a5fcec4d
Python
6,090
170
''' Testing functionalities of models systems author: obanmarcos ''' import os import os, sys sys.path.append('/home/obanmarcos/Balseiro/DeepOPT/') import lightning as pl import argparse import numpy as np import matplotlib.pyplot as plt import pandas as pd from utilities import dataloading_utilities as dlutils from ...
36874f507c6a0e9846ca4dcbc81205661dc39859c0b4cd3bde5ef35d91b5417f
Python
6,090
133
import os import random import numpy as np import tensorflow as tf from tensorflow.keras.layers import Dropout, Embedding, Input, Dense, GRU, SpatialDropout1D, Flatten from tensorflow.keras.models import Model, Sequential import utils '''embed_dim = 128 ff_dim = 128 dropout = 0.1 n_train_batches = 50 batch_size = 1...
d80cb29dcb898ab87104d457887134d4a4b40c29b226c86fdbc2197294de4175
Python
6,090
195
"""Deterministic scenario set for the producer parity harness. Each scenario returns a fresh model + input + the capture callable so a run is reproducible in-process and cross-process (fixed seeds, no external data). The P0 skeleton carries the scenarios the design-of-record names for the harness proofs; the P5 campai...
03e6d7cce4db1bed7eb23c9c0f49bca36c950b77d9b5d58a3de5eb484d5f7819
Python
6,091
170
"""Memory Bank Wrapper""" # Copyright (c) 2020. Lightly AG and its affiliates. # All Rights Reserved from typing import Optional, Sequence, Tuple, Union import torch from torch import Tensor from torch.nn import Module from lightly.models import utils from lightly.utils import dist class MemoryBankModule(Module):...
3f6c8a9587580a22785e3a9bfb7350736618540e91092f6f0a401add45b0535c
Python
6,092
181
import io import pathlib import shutil import sys import tempfile from unittest import mock import pytest import pyjibe import pyjibe.head data_path = pathlib.Path(__file__).parent / "data" @pytest.mark.skipif(sys.version_info < (3, 8), reason="requires python>=3.8") def test_init_print_version(qtbot): """I j...
d2a833328a8749bccbbb50f656a38ad74a5d5ceea192b181fc4ca5dca9490420
Python
6,095
181
import io import pathlib import shutil import sys import tempfile from unittest import mock import pytest import pyjibe import pyjibe.head data_path = pathlib.Path(__file__).parent / "data" @pytest.mark.skipif(sys.version_info < (3, 8), reason="requires python>=3.8") def test_init_print_version(qtbot): """I j...
d6ed8a79dd15433d3b4e231c779248918ec41bc9be7044db4824367c7e66c9c5
Python
6,096
130
import torch import numpy as np def e_path_loss(model, calc, config, edges, edges_e, n_nodes, box, batch_size, beta, alpha=0.9, emax=10, L=5, device='cpu'): err = torch.zeros(batch_size).to(device) pred = model(x=config, edges=edges, n_nodes=n_nodes) epots = calc.calculate(config*10, edges_e, box*10) #...
da634eccc772bae3cd2aa0399dd471d6a237000ac9e6a76bc8012233f151a401
Python
6,097
213
import matplotlib.pyplot as plt import numpy as np from anndata import AnnData from matplotlib.patches import FancyArrowPatch from mpl_toolkits.mplot3d import proj3d def local_plot( adata: AnnData, use_cluster: int, use_label: str = "leiden", reverse: bool = False, cluster: int = 0, data_alpha...
34779b71853d07b77cf110fd3931d58ec88f6759dfe438dc92e722a51ff74c4f
Python
6,100
158
# LICENSE # # _This file is Copyright 2018 by the Image Processing and Analysis Group (BioImage Suite Team). Dept. of Radiology & Biomedical Imaging, Yale School of Medicine._ # # BioImage Suite Web is licensed under the Apache License, Version 2.0 (the "License"); # # - you may not use this software except in compl...
d5c273c8bf74fe5c4fd10205be9ff7f4737a3887745e2053aa774da952fc2fd6
Python
6,102
162
""" OIDC Authentication Provider Implementation This module provides a generic OIDC authentication provider implementation. It can work with any OIDC-compliant provider (Keycloak, Auth0, etc.). """ import logging from typing import Any, Dict, Optional from urllib.parse import urlencode from authlib.integrations.star...
3be6383741099d53d0bf037e407a0c8fa242f38453891febd7b4cf7ed95c13b0
Python
6,104
182
#!/usr/bin/env python3 """ File: visualise_replication_stats.py Created: 2022/07/18 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 ...
9f8222da84b79335cb762c131769b36fd678c203811384a25aac8a6f04c72780
Python
6,107
223
from datetime import datetime import numpy as np import torch import os import time from constants import get_args from binary_motif_model import ( MotifModel, load_model, save_model, MotifModelDataset, evaluate_model, ) from map_protein_name import ( get_map_protein, get_rbns_name_psam_...
d42268ad16aa6095b6b843145a51b215c307d83ca6c2b2e75dde46625f09a0d6
Python
6,108
166
import re from typing import Tuple import pytest import torch from lightly.models.modules.memory_bank import MemoryBankModule class TestNTXentLoss: def test_init__negative_size(self) -> None: with pytest.raises(ValueError): MemoryBankModule(size=-1) def test_forward_easy(self) -> None: ...
06a20039d4d6d6b9c569a2f377a5c79fe6de1bc8fc054b15c13f31b072373a56
Python
6,109
117
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
79a35497f7e839fc2e6b43c36d1451bd8d39f054e6a1d6776ceb0db0225258c1
Python
6,109
172
import json import logging import os from functools import partial from pathlib import Path from typing import Union import torch from torch.hub import HASH_REGEX, download_url_to_file, urlparse try: from torch.hub import get_dir except ImportError: from torch.hub import _get_torch_home as get_dir try: fr...
57b300a354ae6f2fb0ac0a8d8ef98813ff267bd579e8422c28914afc392a1fcb
Python
6,110
166
"""Benchmark + correctness oracle for Ragged integer-array fancy-indexing (issue #69). Proves the O(k) index-resolution candidate (a) matches the current O(n) arange-based reference on every representative + edge case and (b) is flat in n while the reference grows ~proportionally to n. Transitional harness (cf. benchm...
496799693923f95733e878175528a4701a6167e5d2ddf27ddb2ed46a697bcc54
Python
6,111
103
#!/usr/bin/env python3 ''' This is a script which will generate a file of commands for gnina to use cnn_minimze to generate iterative training poses. ASSUMPTIONS i) assumes all receptors are PDB files IE end in .pdb ii) Assumes all docked poses or outputs from gnina will be SDF files. iii) The crystal ligand fi...
c9f2aad0a43bfd019cb3e809adb0cdf227d7fb548512247a7d0c9c121e01c2c6
Python
6,111
167
"""Created on Thu Jan 30 13:47:15 2020. @author: martafradera """ import numpy as np from neurogym.core import TrialEnv from neurogym.utils import spaces from neurogym.utils.ngym_random import TruncExp # TODO: Need a more intuitive name class ChangingEnvironment(TrialEnv): """Random Dots Motion tasks in which ...
7d0e8ef60574cec87be9fe7f0d5e51d2bea29ef68daf871a4aadb2883266371f
Python
6,112
161
# LICENSE # # _This file is Copyright 2018 by the Image Processing and Analysis Group (BioImage Suite Team). Dept. of Radiology & Biomedical Imaging, Yale School of Medicine._ # # BioImage Suite Web is licensed under the Apache License, Version 2.0 (the "License"); # # - you may not use this software except in compl...
40132108d35dcda790d78441f634739d7d4b221c1f8a02d2c973ed3ff21c81b2
Python
6,113
214
# _*_coding:utf-8 _*_ # @Time : 2021/8/19 18:25 # @Author : XCH # @FileName: 3_bilstm_wzt1bd.py.py # @Software: PyCharm #%%导入原始数据 ## import data,moudle import torch import os import numpy as np from torch import nn from torch import nn from torch.autograd import Variable torch.set_default_tensor_type...
eb5b9962cd45b3a8a32ea54af2aef3bc6aedff24a76bc62657594a45cf42f792
Python
6,113
191
from __future__ import annotations from typing import TYPE_CHECKING, Callable, List, Optional import torch from PIL import Image from lightly.transforms.multi_view_transform import MultiViewTransform from lightly.transforms.torchvision_v2_compatibility import torchvision_transforms as T if TYPE_CHECKING: from m...
027e7fdcf4fc8eac08c503cd363d9a89c456944125a311fe49848617b2202032
Python
6,114
170
''' Testing functionalities of models systems author: obanmarcos ''' import os import os, sys sys.path.append('/home/obanmarcos/Balseiro/DeepOPT/') import pytorch_lightning as pl import argparse import numpy as np import matplotlib.pyplot as plt import pandas as pd from utilities import dataloading_utilities as dluti...
35f96e5574627695deaa28c5b2bd9ac0b1a46e9e81d59a17de34b63792f06e61
Python
6,115
193
""" ================================= Processing Remote Sensing Helpers ================================= This file contains helper functions for handling remote sensing processes """ from math import ceil import numpy as np from numpy.lib.stride_tricks import sliding_window_view from sklearn.base import BaseEstimat...
06c5597c4f022a76d39ac451dd5563ade485b1f7d06741e1d7050bf54a7f35ba
Python
6,118
137
""" @Time: 4/8/2023 下午2:25 @Author: Heng Cai @FileName: utils.py @Copyright: 2020-2023 CarbonSilicon.ai @Description: """ import torch as th import MDAnalysis as mda from torch.utils.data import DataLoader from RTMScore.data.data import VSDataset from RTMScore.model.utils import collate, run_an_eval_epoch f...
456d08358635982bfc61777f784d958ed02ae80f9e86812ee7a084cbd64b9a0a
Python
6,118
134
import sys # setting path sys.path.append('../TM2_segmentation') from scipy.ndimage.filters import gaussian_filter from skimage.transform import resize import SimpleITK as sitk import numpy as np import pandas as pd import tensorflow as tf import glob, os, functools import matplotlib.pyplot as plt from contextlib i...
439765d9236370a909a40c9c15a097b470bf0d1895e649daf87405e24db70a3b
Python
6,119
188
"""Smoke tests for backward grad disk streaming.""" from __future__ import annotations from pathlib import Path import pytest import safetensors # noqa: F401 import torch from torch import nn import torchlens as tl from torchlens._io.manifest import Manifest from torchlens.options import CaptureOptions class _Ti...
86df37b6002562fa302620dc2f22907f613f6a5ee409d9501f40f26fe4ced90a
Python
6,120
154
import sys sys.path.append('../TM2_segmentation') import datetime import json import os import numpy as np import pandas as pd from tensorflow.keras.optimizers import Adam from tensorflow.keras.callbacks import TensorBoard, LearningRateScheduler, ModelCheckpoint, ReduceLROnPlateau from tensorflow.keras.models import ...
a1f1013520efb1b749213d2f51edfd42f3aeb8ef6e145357a054a139123eb77d
Python
6,121
154
"""Lane F22 rsatoolbox convention matrix (neuro MEMO item 16, rows T6/T11/T12). The entire provenance claim rests on a foreign package's behaviour across the declared version range, so these rows are the BOTH-VERSIONS gate: the suite must pass with rsatoolbox 0.1.5 (the declared floor) AND current 0.3.x installed. Pin...
a4f0dc132c7b0d5cc6443093f4e56d571e230a99a25f7371ef006caa88abdf1b
Python
6,121
193
from typing import Optional, Tuple, Union import numpy as np import pyvista as pv from pyvista import PolyData try: from typing import Literal except ImportError: from typing_extensions import Literal from ..utilities import add_model_labels def _construct_line( start_point: Union[list, tuple, np.ndarr...
f1fe7c446f13b1f7547edfb79552897e49e1d2f2b6b059754545b6e122952cb1
Python
6,121
209
""" ==================================================================== Ensemble learning on functional connectivity ==================================================================== This example shows how to compute SPD matrices from functional connectivity estimators and how to combine classification with ensemb...
b082e2a1d508b57f5aa7214589792d7811629d35bb863fef4837d6ef1ad9d228
Python
6,122
145
import argparse import glob import os import shutil import tqdm import mne import numpy as np from mp_dip.obci_readmanager.signal_processing.read_manager import ReadManager from mp_dip.obci_readmanager.signal_processing.signal.data_generic_write_proxy import SamplePacket from mp_dip.obci_readmanager.signal_processing....
1e7ddc91a8d44dc6b086820e25bc7ded832b0186da6e1a2f2b3d8cc43e7e8dac
Python
6,123
142
import os import re import tifffile import cupy as cp import numpy as np import multiprocessing as mp import concurrent.futures as cf from .XCorrCpu import XCorrCpu from .XCorrGpu import XCorrGpu from tqdm.auto import tqdm from matplotlib import pyplot as plt from multiprocessing.pool import ThreadPool def sampled_...
3dba96b6a329fc9ca3353f2e150d10172a71749b71a9ca1c8dd216a0917139af
Python
6,124
180
# --- # jupyter: # jupytext: # formats: ipynb,py:light # text_representation: # extension: .py # format_name: light # format_version: '1.5' # jupytext_version: 1.14.5 # kernelspec: # display_name: Python 3 (ipykernel) # language: python # name: python3 # --- # + from pat...
4ba2575e793da9e81b0466a4aaa552911e0d819d01056cf6a40c37db9f5c090f
Python
6,124
160
""" Unit tests for adaptive background tracker ObjectModel. Tests specifically for the boundary validation and size compatibility fixes to prevent OpenCV size mismatch crashes. """ from unittest.mock import Mock, patch import cv2 import numpy as np import pytest try: from ethoscope.trackers.adaptive_bg_tracker ...
b8bcc7f4cc35b89149017d003e788ea0524e6289199b737f4aa37a991fed3ae2
Python
6,128
166
"""Test functions for specparam.models.utils.""" from pytest import raises import numpy as np from specparam import SpectralGroupModel from specparam.sim import sim_group_power_spectra from specparam.metrics.definitions import METRICS from specparam.modutils.errors import NoModelError, IncompatibleSettingsError fro...
0bbed24c17116e607a304fd0d0652f19cf76dad0d523ff6836775c197ec1ca09
Python
6,129
193
import sys import time import pytest from caper.caper_labels import CaperLabels from caper.cromwell import Cromwell from caper.cromwell_rest_api import CromwellRestAPI, has_wildcard, is_valid_uuid from caper.wdl_parser import WDLParser from .example_wdl import make_directory_with_wdls @pytest.mark.parametrize( ...
6fffb8e03851d24fa468e7edbb3326e4fe29af5cae285574d1ca0aa02c658772
Python
6,129
152
__author__ = 'quentin' import cv2 try: from cv2.cv import CV_FOURCC as VideoWriter_fourcc from cv2.cv import CV_AA as LINE_AA except ImportError: from cv2 import VideoWriter_fourcc from cv2 import LINE_AA from ethoscope.utils.description import DescribedObject import os class BaseDrawer(object): ...
d71ed5e56d43629b73586cb0262743562bb9f86a9fd2a442778d7796c7ec257e
Python
6,129
206
"""Load packaged image manifests and images.""" from functools import lru_cache from pathlib import Path import pandas as pd from PIL import Image from hobj.data.download import resolve_data_root from hobj.types import ImageId def _load_image_manifest( *, dataset_name: str, required_columns: set[str], ...
9fc925b831fa9abbf48612543d6bea1e4c8ac0c134a584ec446761e943945d33
Python
6,130
148
import datasets import numpy as np from sklearn.model_selection import train_test_split from sklearn.feature_extraction.text import CountVectorizer datasets.logging.set_verbosity_error() def load_huggingface_dataset( dataset_name: str, subsample_frac: float = 1.0, binary_classification: bool = False, r...
24f18134b2ab4e2fd52cfeda9c62403791955cede9001ac810602bce598291b3
Python
6,131
138
"""Absence pins for the removed top-level deprecation shims. The moved-name ``__getattr__`` table, the paper-era API shims, and the deprecated top-level wrapper functions were deleted by the 2026-08-19 shim-removal lane. Contract now: the historical top-level spellings raise the typed ``facade_redirect`` ``FacadeTeach...
1a35b4b1fc4c03668d2ca4de3a1e198e480a035ea2b6a5d260f9627858ac0609
Python
6,132
149
import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib.ticker as ticker import seaborn as sns import re import os from mpl_toolkits.axisartist.parasite_axes import SubplotHost, HostAxes, ParasiteAxes from sklearn.inspection import permutation_importance, plot_partial_dependence from sc...
22362a6a2a60dace7783f9df57cb6274dc9b2fdc366508c4f398c4815eee8da6
Python
6,133
185
import logging import zlib from dataclasses import ( dataclass, fields, ) from struct import unpack from urllib.parse import ( parse_qs, unquote, urlparse, ) from galaxy.files.models import ( BaseFileSourceConfiguration, BaseFileSourceTemplateConfiguration, FilesSourceRuntimeContext, ) ...
2251e5d7974153734304158e845583024ebbb53e4d98d5e0a1e7db2fd68cc58d
Python
6,133
123
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
79177ef4b660a1f918d9284daf65ffdf67d3960aec46747f3138d98619e7b61d
Python
6,133
170
import logging from collections.abc import ( Callable, Iterable, ) from sqlalchemy import ( and_, false, func, or_, select, ) from galaxy.model import ( Group, GroupRoleAssociation, Role, User, UserRoleAssociation, ) from galaxy.model.scoped_session import galaxy_scoped...
0d25ca61d06d84ba124691b01b479e9fc6bf8797df7cf02a627044fb70e8c296
Python
6,134
163
from sqlalchemy import ( false, select, ) from galaxy import model from galaxy.exceptions import ( Conflict, ObjectAttributeMissingException, ObjectNotFound, RequestParameterInvalidException, ) from galaxy.managers.context import ProvidesAppContext from galaxy.model import Group from galaxy.mod...
a522eadf87143349ff49cf6fa35b320fcda29954626529544259b10c97c9ff0d
Python
6,134
139
"""F26: T-RELAY-W / T-RELAY-C -- the measured relay-fidelity pins. These pin the PANEL-MEASURED losses (trackers memo 3.2/3.3) at the measured vendor versions, so a future vendor release that FIXES any of them fails visibly and the published fidelity table gets revised. They run only where the relay-test extra is inst...
eb7fcfd556080196c6328365dae153ff373bc02e89fcbb3a0c75fdec37d648bb
Python
6,137
153
"""Package-scoped R0 fixtures: one build+trace per (family, impl) per R0 block. The deep sweep runs many assertions against each captured trace; caching the capture keeps the whole R0 gate at seconds (memo section 10 PR row). Models are ~100-225k params, inputs are 8 tokens -- the cache is a few MB. The cache is PACK...
2b3b0ed40be58078816f1d2705fe7e0c2346ac54867cf7eba40e42f0c557c560
Python
6,140
146
"""Round-26 security regression: exec/spawn/install denylist completion. A comprehensive audit found two defense-in-depth gaps in the default-deny callable/import resolution for attacker-controllable ``.tlspec`` bundles: * E1 (MEDIUM): the hard module denylists (``_DENIED_MODULES`` in ``torchlens.utils._callable_sa...
93bb2e767f3b33064b8e1e662e7c1ef80fe8b32ad0ddafdb8c08b8ebac3f52d4
Python
6,141
144
''' A MPNN for finetuning on the LSF dataset. ''' import torch import torch.nn as nn import logging logger = logging.getLogger(__name__) from NMR_Pretrain_Net import NMR_MPNN device = "cuda" if torch.cuda.is_available() else "cpu" class LSF_MPNN(nn.Module): ''' The LSF selectivity prediction layers to be use...
2332790e43a545c4ff842265306cf4f33d6c139372f1d4ec0f003d5a302f3808
Python
6,143
183
#!/usr/bin/env python # coding: utf-8 # position_decoder.ipynb # # Script to create a position decoder using multinomial logistic regression # # MGC 7/15/2019 # FKM 7/31/2019 # In[171]: # packages import sys,os #import pandas import math import glob import pickle from scipy import io import numpy as np from numpy...
8d32e0eadd527622695a0976ed578f5084d104272247651398241bd4fa7c38e9
Python
6,143
164
from typing import Sequence import torch from pytorch_lightning import Callback, LightningModule, Trainer from torch import Tensor, nn from pl_bolts.utils import _MATPLOTLIB_AVAILABLE from pl_bolts.utils.warnings import warn_missing_pkg if _MATPLOTLIB_AVAILABLE: from matplotlib import pyplot as plt from matp...
ba3a9d5e997380915fe2f88cefb02203ac3b2af465932500452ebf49309c890e
Python
6,145
195
import os os.environ["CUDA_VISIBLE_DEVICES"] = "0" import math import argparse import re import sys import unicodedata from itertools import product import numpy as np import pandas as pd import tensorflow as tf from joblib import dump, load from tensorflow.keras import Input from tensorflow.keras.layers import ( ...
335384b118f6b302f39fc5580504822b3fec55038dd439128b608c730b546809
Python
6,146
149
import argparse import subprocess from carbontracker.tracker import CarbonTracker from carbontracker import parser from carbontracker.report import generate_report_from_log, REPORTLAB_AVAILABLE import ast import os def parse_logs(log_dir): parser.print_aggregate(log_dir=log_dir) def generate_report(log_file, ou...
3f963decd18fc98255d7fa0c8de44ae2a10583108a470da976a620eb23ba8126
Python
6,146
165
#!/usr/bin/env python3 import sys, os import msprime import pyslim import tskit import numpy as np helpMsg = ''' usage: $./swp_IwM_init.py <sc_min> <sc_max> <genbp_min> <genbp_max> <out_pref> Put genbp minmax as `-1` to dynamically tune mutgen ''' N_B = 30281 N_C = 10100 N_BC = 33980 N_ABC = 11593 ...
fc8d0ea421b597f35d55076bd52c129a8e27a3e0819f6ee15368d2acd8d75c6d
Python
6,146
216
# Copyright 2023 DeepMind Technologies Limited # # 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 agree...
7f7673b4a670e0592abef6d81cbc5c7132b407a947b90ffa5979adb6b1323ca4
Python
6,148
230
""" Main Script containing the following steps: - perform similarity network fusion and diffusion map embedding in PNC - train ML model on PNC embeddings with supervised Domain Adaptation - HBN *no diagnosis* data enhances prediction of embedding in unseen HBN data Author: Dominik Kraft """ import time import pandas a...
555649f21e049b9292346f3d141e5d1928c30408f44b8cab31e5c8c1bfd5a3e1
Python
6,150
124
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
b7edd2cb2c34eb03d2d1b126fa3f87cd6bf6793e8ee422f447396b7e3e964236
Python
6,150
185
from typing import List import numpy as np import seqpro as sp from hypothesis import given, note from hypothesis import strategies as st from seqpro.rag import Ragged seq = st.text( alphabet=st.characters(codec="ascii", min_codepoint=32, max_codepoint=126), min_size=1, ) seqs = st.lists(seq, min_size=1, max_...
92ed7b2c78bb4d0bdebca9abec32838744df84079812c87e20fdc7b2081bea48
Python
6,152
162
import re import shutil import string import pathlib import mimetypes import dataclasses import unicodedata from typing import Optional from pyasjp.api import ASJP from pycldf.sources import Source from clldutils.path import md5 import pylexibank from pyasjp.models import MEANINGS_ALL def slug(s): """Condensed ...
153ed1ca54b9c47836db01abd7c47d3263875ba45336a9e7c3e706a93a9c0974
Python
6,153
184
"""Forward-load CI gate: the previous release's wheel loads the new goldens. Ecosystem MEMO 3.4 / G8: on every persistence train, install the PREVIOUS release's torchlens wheel and analysis-load the new train's golden artifacts under it. This is the only mechanism that catches a same-stamp drift break (two writers sha...
903593203b2efec36544cf9b80cd6e19c5840155c4414b96fdb99413c6d55ad3
Python
6,153
161
#!/usr/bin/env python3 """ File: calc_genotype_info.py Created: 2021/06/14 Last Changed: 2022/02/10 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 sourc...
fdfc8db813a6f25c2e34de3196caa52cf0fccc6fe833ae0b6b5b41f199fc4b9a
Python
6,153
184
""" Food and odor sources placed in the arena. Provides the point and patch sources the agents feed from and navigate towards, together with the odor they emit into the environment's value grids. """ from __future__ import annotations from typing import Any import numpy as np import param from ...param import Class...
3e58e8fcf1cd52764959d25553101eb00e593a3f865e208dd87d62fff7e5cb30
Python
6,154
168
# pylint: disable=W0611, W0612, F0401, R0914, C0302 """Settings tests of eFEL""" """ Copyright (c) 2015, Blue Brain Project/EPFL All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of...
761321748ed8494360c8e0d7f2a62a70b4d6f1f818318ea62d193f9f76eda107
Python
6,154
197
"""Functions to convert spiking data to different representations.""" import numpy as np from spiketools.utils.data import smooth_data from spiketools.utils.checks import check_time_bins ################################################################################################### ##############################...
76a376527de322eacbe0df82b33c3338284cd4a314578e312f47cd6c05dff52b
Python
6,155
174
# -*- coding: utf-8 -*- """ Created on Sun May 15 15:02:10 2022 @author: Chenyong """ import math import json import pandas as pd import numpy as np import json import datetime import position_util # from skmob.tessellation import tilers import geopandas as gpd import matplotlib.pyplot as plt from math import sqrt, sin...
77fe1073dc30721d0d93c02ca4fe56b8271ea97c2d1c0ae43c2b9b7d6269857c
Python
6,155
134
# SOURCE: vendored from frankligy/DeepImmuno @ df42ac5b6bddfe531268335e2dcb496559cd488b # https://raw.githubusercontent.com/frankligy/DeepImmuno/df42ac5b6bddfe531268335e2dcb496559cd488b/extension/deepimmuno-gan-train.py # # Li & Mansour et al. (Cell Reports Methods 2021) "Deep learning-based # prediction of immunogenic...
88012555725299999c05ca3b3813f465e788625e1f1801d941e7e57052911a07
Python
6,155
178
#!/usr/bin/env python import argparse import json import os import shutil import subprocess import sys import tarfile import time from urllib.request import urlopen import wget def rmtree_tolerant(path, retries=5, delay=2): """Remove ``path`` recursively, tolerating the transient "Directory not empty" (OSEr...
a22524b556a251a34467b37f72fa9bef7ea1fd230151030b16c7c61d740f18bb
Python
6,155
165
import torch import numpy as np from .._utils import _k_largest_index_argsort from .._ism import _naive_ism from .._utils import _model_to_device def best_k_muts( model: torch.nn.Module, X: np.ndarray, k: int = 1, device: str = "cpu" ) -> np.ndarray: """ Find and return the k highest scorin...