sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
b62e4458e81676a8341cc76752a1f1260a7abfbbeca4d2f06c63590dfbeb4463
Python
6,894
172
#!/usr/bin/env python3 """ Dx BJ — Sub-sampling + recording-length redo under proper per-fold =================================================================== Two analyses re-run under the proper per-fold deployment-mode pipeline: A) HC sub-sampling: shrink each cohort's HC pool to fractions {1.0, 0.7, 0.5,...
d4c5b379a74641fedb7ca91edaf6a974900ac489df14271ebb8c8d0a1934994e
Python
6,896
135
"""Label definition.""" from collections import namedtuple # a label and all meta information # Code inspired by Cityscapes https://github.com/mcordts/cityscapesScripts Label = namedtuple( "Label", [ "name", # The identifier of this label, e.g. 'car', 'person', ... . # We use them to uniquely...
7bc5f2f679894cdef26535ff348bfeb56835d527d63f166413fa8f51183dd6cd
Python
6,897
200
# SOURCE: vendored from https://github.com/yihaosun1124/OfflineRL-Kit @ main (951302eed019) # (offlinerlkit/nets/ensemble_linear.py + offlinerlkit/modules/dynamics_module.py, # minimal changes: merged into one file, imports fixed) """COMBO (Conservative Offline Model-Based Optimization, Yu et al. 2021) -- the distingu...
04def0147b9f7c7779222ed6921c8efb6bc4c984fa878d920826190cb6b6bae6
Python
6,899
199
model = dict( type='RetinaNet', backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=0, norm_cfg=dict(type='SyncBN', requires_grad=True), norm_eval=False, style='pytorch', init_cfg=dict(type='Pretrai...
4749d9b68be2cd743a7fefc4880d96560f22035df4f5bfc321f56df19784a6ed
Python
6,899
167
""" Théo Gauvrit Spetembre 2021 General script to compute PSD for different frequency bands from resting menbrane potential recordings. Comparaison of two groups(ex: WT vs KO) Compute the PSD with bands, plot the wlech periodogram. """ import os import time import matplotlib.pyplot as plt import numpy as np import pan...
535fb11fb75079013cdec35c207a8a3ef5e9e23e5090af68728a9d92232d2cba
Python
6,899
199
model = dict( type='RetinaNet', backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=0, norm_cfg=dict(type='SyncBN', requires_grad=True), norm_eval=False, style='pytorch', init_cfg=dict(type='Pretrai...
62c4a222bdf81c5256bc72e5a7b3bea98444d4d587d4d1200db8ee50d3be21ab
Python
6,899
134
from ovseg.preprocessing.SegmentationPreprocessing import SegmentationPreprocessing from os.path import join from os import environ import argparse import warnings warnings.filterwarnings("ignore", category=UserWarning) parser = argparse.ArgumentParser() # first some arguments we need for the planning and saving pars...
65f5caa62528480392b0c44e46b5305d7e63bf8093ca712a7d30ce58fd32c336
Python
6,899
203
from __future__ import annotations from pathlib import Path from types import SimpleNamespace import pytest from larvaworld.portal.datasets import import_adapter from larvaworld.portal.datasets.models import ImportRequest, WorkspaceDatasetRecord from larvaworld.portal.workspace import initialize_workspace, set_activ...
d7b90a6a01ead65ced723e1b54795924491ef325baba08ba8b0805d81cf7b0d9
Python
6,899
199
model = dict( type='RetinaNet', backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=0, norm_cfg=dict(type='SyncBN', requires_grad=True), norm_eval=False, style='pytorch', init_cfg=dict(type='Pretrai...
a36b7831dab261ccd777618619fac8d3407fa91be93906b4bf517bf0ce72d853
Python
6,900
143
import math,copy,random import numpy as np from rdkit import Chem from rdkit.Chem import MolFromSmiles,MolToSmiles,CanonSmiles, AllChem import torch from torch_geometric.data import Data from torch_geometric.utils import to_dense_adj from torch_geometric.utils import add_self_loops allowable_features = { ...
1a662e4fd4805dc0100a3cfca02ccab1e5ba44aefa7150219af87cf2d0789db4
Python
6,901
199
model = dict( type='RetinaNet', backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=0, norm_cfg=dict(type='SyncBN', requires_grad=True), norm_eval=False, style='pytorch', init_cfg=dict(type='Pretrai...
659a24e00c7f843c13f88257146436884d769b02388650bc29557f86a4d170d6
Python
6,901
188
#!/usr/bin/env python3 """ Dx AG — Platt scaling for calibrated probability output. The Dx AA tool outputs continuous LDA discriminant scores. Platt scaling transforms these into calibrated P(AD | features) probabilities via a logistic regression fit on (score, label) pairs from training data. For clinical deployment...
a1128789cf06887774d5db975c83fe1141503411455c013de7d5260612edfe50
Python
6,901
199
model = dict( type='RetinaNet', backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=0, norm_cfg=dict(type='SyncBN', requires_grad=True), norm_eval=False, style='pytorch', init_cfg=dict(type='Pretrai...
cd3431c61924789aa8fef7b050f767d85b8f6249b27871fe1f1e4e1be53494b1
Python
6,901
242
""" Methods for managing context and attributes """ from __future__ import annotations import functools import os import sys import time from collections import Counter from contextlib import contextmanager, redirect_stderr, redirect_stdout from typing import Any, Callable, Iterable, Iterator # from functools import...
65762ec7da872eb094ea185820bd6503ad339b205e5ff03c8d8af7dbcadd9c20
Python
6,903
199
model = dict( type='RetinaNet', backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=0, norm_cfg=dict(type='SyncBN', requires_grad=True), norm_eval=False, style='pytorch', init_cfg=dict(type='Pretrai...
9305c8a7fecc120b032dc6b145fce5b96c04c14eb0f3b2febcafcdede04761fd
Python
6,903
174
""" Copyright (C) 2022 Giansalvo Gusinu 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, distribu...
a0959bf9060a2fe991d2f5455f0f8f44c12070892b124a0869371d4fb3aaa27d
Python
6,903
193
from __future__ import annotations import copy from typing import Any, Optional import numpy as np import pandas as pd from bream4.device_interfaces.devices.base_device import BaseDeviceInterface from bream4.device_interfaces.devices.promethion import PromethionGrpcClient from bream4.toolkit.procedure_components.dat...
bfbad78d2ae7397c25673d005a2da181b89626adb734fbe04b60606427dfd3fe
Python
6,905
170
"""G3 ceiling consolidation: one typed above-ceiling refusal at every door. Every "artifact is newer than this runtime" site raises ``ArtifactVersionAboveRuntimeError`` through the one ``above_ceiling_error`` chokepoint; runtime-axis refusals (torch major mismatch) are the distinct ``ArtifactRuntimeIncompatibleError``...
3b056ad2776b46928580c8b3d9b210f106de928c230ad3ad114aaccbd6272741
Python
6,908
199
import copy import numpy as np import pytest from numpy.testing import assert_array_equal from gym.spaces import Box, Dict, MultiDiscrete, Space, Tuple from gym.vector.utils.spaces import batch_space, iterate from tests.vector.utils import CustomSpace, assert_rng_equal, custom_spaces, spaces expected_batch_spaces_4 ...
3e9549dd361f05684e642c0c2a43dfa0edf592e8f7b4254bb5f67a7f19dc8963
Python
6,909
217
"""Tests for bdpy.task.callback.""" from __future__ import annotations import unittest from typing import Any, Callable from bdpy.task import callback as callback_module # NOTE: setup functions def setup_fns() -> list[tuple[Callable, tuple[Any, ...], Any]]: def f1(input_: Any) -> None: pass def f2...
46cdfb820c1d1d11797de33de8874cfeee2f7b4e713b452373a954bc3454336b
Python
6,909
189
''' TNS class : Soma ''' import logging import numpy as np from scipy.spatial import ConvexHull # pylint: disable=no-name-in-module from scipy.spatial.qhull import QhullError # pylint: disable=no-name-in-module from tns.utils import TNSError from tns.morphmath import rotation from tns.morphmath.utils import norm L...
776b2cf124b9b2c1cbcdbd7d7cf27518ff75d1cc8462fcab7487573ad396d869
Python
6,909
179
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
89879d03740c0b43041c482f68b8811d16beee224910ffef4b8fe09a020cb732
Python
6,909
218
"""Set of wrapper functions for gym environments taken from https://github.com/Shmuma/ptan/blob/master/ptan/common/wrappers.py.""" import collections import numpy as np import torch from pl_bolts.utils import _GYM_AVAILABLE, _OPENCV_AVAILABLE from pl_bolts.utils.warnings import warn_missing_pkg if _GYM_AVAILABLE: ...
f87e6bc21ceb8a3742c36a74c801bba3a8548fac53a4bbde703d951b7d9dfddf
Python
6,909
168
import subprocess import torch import pandas as pd import numpy as np import torch.nn as nn import itertools def get_aa_list(): aa_list = ["A", "R", "N", "D", "C", "Q", "E", "G", "H", "I", "L", "K", "M", "F", "P", "S", "T", "W", "Y", "V"] return aa_list def remove_nonstandard_aas(prot_seq): aa_list = get_...
9bd21febbecfcef9a5672cbb5158425063a75876270448d932b5aa1ce392bd3c
Python
6,910
142
#!/usr/bin/python3 import os import sys import argparse import pandas as pd import numpy as np version = "0.1.5" # converts count data to fpkm and tpm values # remove anyheaders ... #HTSEQ count footer is removed (last 5 lines).... # prepare data def prepare_data(**opt): # check output directory exists, create ...
7135ab6354f00471c903b3d9cf73beddaee73b11e918862988edbb401b01c375
Python
6,912
199
model = dict( type='RetinaNet', backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=0, norm_cfg=dict(type='SyncBN', requires_grad=True), norm_eval=False, style='pytorch', init_cfg=dict(type='Pretrai...
d9eb0890dcd4bb3d073df6a27ffce349392cb80c2df670422b427898df5932e9
Python
6,912
181
"""Smoke tests for face_rhythm.alignment_multisession. These tests validate three invariants that the port must hold: 1. The module imports cleanly even when the optional ``romatch`` dependency is not installed. 2. ``Aligner(...)`` can be instantiated with the notebook's canonical kwargs. 3. ``Aligner.fit_geometri...
90e5c7066d96694294f0ccd021578107e150a313c8883e3fd2347b74b2e6171f
Python
6,913
230
''' Functions related to saving and loading of signal arrays to and from files. The numpy savetxt and loadtxt are used, in addition to a header containing the json-serialized information about how the signal was extracted. Imports ------- numpy, wormdatamodel, pkg_resources, json ''' import numpy as np import wormdat...
fd85f23833579e3ce9da7213172a0a20e4d8aa2901c9ddb4ef9326e59b7dbd77
Python
6,913
186
#!/usr/bin/env python # ============================================================================= # MODULE DOCSTRING # ============================================================================= """ A transformer applying different transformers to different features. """ # ===================================...
9e37276118241007db2291192e7b5ad09b563e237aeaf56812227d00b80eb4d0
Python
6,914
203
import logging import time from ethoscope.hardware.interfaces.interfaces import BaseInterface class WrongSerialPortError(Exception): pass class NoValidPortError(Exception): pass class SimpleLynxMotionInterface(BaseInterface): _baud = 115200 _min_angle_pulse = (-90.,535.) _max_angle_pulse = (90.,...
3f280e786d1b39c92e8a906ba8efb412f8b3d1aaadefb6e9619fe4a7deffb9c6
Python
6,916
187
import typing from typing import List import numpy as np import pytest import torch import torch.nn.functional as F from torch import Tensor from lightly.loss import VICRegLLoss class TestVICRegLLoss: def test_forward(self) -> None: torch.manual_seed(0) criterion = VICRegLLoss() global_v...
ae4046bdfe0eb14a324a335f92a4aa679ed303cf7227bdcfe240dded9b0bb11d
Python
6,917
202
import os.path import numpy as np import data_prep import pre_process from Bio.Seq import Seq import argparse from tensorflow import keras import modeling def normalize_theta(theta): """ Converts unnormalized probabilities of categorical distributions into the corresponding normalized probabilities. "...
eaab208d0eb407fcc89c2f94ba8ba3fb5bd84040ad6f8075e7d35d4d3d0e8612
Python
6,917
164
# Author : John Tsang # Date : December 7th, 2017 # Purpose : Implement the Diebold-Mariano Test (DM test) to compare # forecast accuracy # Input : 1) actual_lst: the list of actual values # 2) pred1_lst : the first list of predicted values # 3) pred2_lst : the second l...
5ae6bf1bb043b53c28706b6572eb402e4ea653c1cc9a3c9e56d1fe54c9fbdf18
Python
6,918
167
import datetime import logging import os import socket import threading from sqlalchemy import ( and_, delete, select, ) from galaxy.model import WorkerProcess from galaxy.model.base import check_database_connection from galaxy.util import now log = logging.getLogger(__name__) WEBAPP = "webapp" # Worke...
696ed1e271af8b415abf69fb38a19094a8e3ed8d252f77efa717dd029382898a
Python
6,918
230
import math import numpy as np import torch import torch.nn.functional as F from matplotlib import cm #### def crop_op(x, cropping, data_format="NCHW"): """Center crop image. Args: x: input image cropping: the substracted amount data_format: choose either `NCHW` or `NHWC` ...
0323c2e4a9d0b9436dc1c2cca2e8dabe53bd9bfbbe7b7d6578125da4077f935d
Python
6,919
210
from pathlib import Path import pandas as pd from utils.metrics_ECPred import MacroAvg from collections import Counter def parse_special_case(ec_number): if "No" in ec_number: return "-1.-1.-1.-1" # We create a class for no alignement found and then no prediction of BLAST if "EC:" in ec_number: ...
16a9f5c1a7d9f6e8bf39292920f111e4b7a7db121e7d07bf3235ea5ba5e743df
Python
6,919
179
import copy from keras.src import backend from keras.src import ops from keras.src.api_export import keras_export from keras.src.layers.merging.base_merge import Merge @keras_export("keras.layers.Concatenate") class Concatenate(Merge): """Concatenates a list of inputs. It takes as input a list of tensors, a...
aef1f2cfadf8c9b87917cbec5cb9db418e36e0267081d418c2d17f3704c3e8ab
Python
6,919
193
""" BoAmps output handler for CodeCarbon. Writes BoAmps-formatted JSON reports containing energy consumption data from CodeCarbon runs, enriched with user-provided ML task context. """ import json import os from typing import Optional from codecarbon.external.logger import logger from codecarbon.output_methods.base_...
f70a15cc262b08830ef1a787349d2c648a91d3b896a0aeeee8038c370de33222
Python
6,919
214
import sys import argparse import logging import time def pase_info(seq): info = {'SVLEN': 0, 'END': 0, "SVTYPE": '', "RE": 0, "CHR2": ''} for i in seq.split(';'): if i.split('=')[0] in ["SVLEN", "END", "RE"]: try: info[i.split('=')[0]] = abs(int(float(i.split('=')[1]))) except: pass if i.split('='...
2907ef03eb9650635ad121e2d727ebc3ed46e743808c5283f9fb65de0ad2ef2f
Python
6,921
205
# -*- coding: utf-8 -*- import math # Based on Gale & Church 1993, # "A Program for Aligning Sentences in Bilingual Corpora" infinity = float("inf") def erfcc(x): """Complementary error function.""" z = abs(x) t = 1 / (1 + 0.5 * z) r = t * math.exp(-z * z - 1.26551223 + t * ...
2fb4ac609747c3510276d64511e542633d872daf36a93b07662e22f0e8501365
Python
6,922
211
# type: ignore[override] from typing import Any, Callable from pytorch_lightning import LightningDataModule from torch.utils.data import DataLoader from pl_bolts.utils import _TORCHVISION_AVAILABLE from pl_bolts.utils.warnings import warn_missing_pkg if _TORCHVISION_AVAILABLE: from torchvision import transforms ...
4bcb3ef443a9b9a7711d154062ef54d259ce32058323ec42730df22d445c2ebb
Python
6,922
171
from typing import Callable, List, Optional, Tuple, Union import numpy as np from anndata import AnnData from ..configuration import SKM from ..errors import SegmentationError from ..logging import logger_manager as lm @SKM.check_adata_is_type(SKM.ADATA_AGG_TYPE) def select_qc_regions( adata: AnnData, regio...
e2a9dd82e9c1b6598a9f8fa4a267eb181fe0fa4a47a0bdb5fec82cd14286ffbf
Python
6,922
157
#!/usr/bin/env python3 import os import sys import pandas as pd import random from random import shuffle from collections import Counter from collections import defaultdict import argparse # the following line is to deal with the case that self-defined module # in the submission directory are not found when submit...
415da3230e775a5b8c66d2900166ad8700eea409cf58cd3e4c7738112960df7d
Python
6,924
184
import argparse import os import numpy as np import torch import pytorch_lightning as pl from pytorch_lightning.callbacks import ModelCheckpoint, EarlyStopping from pytorch_lightning.loggers import WandbLogger from torch_geometric.loader import DataLoader as GeometricDataLoader from pathlib import Path # Imports from ...
ca9c24b51091e43beb665ca960304d89fe8b84b667ce2f94bdf6c3c24b546f4a
Python
6,924
201
import os import random import shutil from collections import OrderedDict import numpy as np import torch import torch.nn as nn from imgaug import imgaug as ia from termcolor import colored from torch.autograd import Variable #### def convert_pytorch_checkpoint(net_state_dict): variable_name_list = list(net_stat...
f9c39f98f99c22e08b3a19ab87b27fce346bcec4986cbedc9bb1cd5b0ebb3d60
Python
6,926
195
#!/usr/bin/env python # # Copyright 2006, Google Inc. # 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 source code must retain the above copyright # notice, this list...
32466bd3bac44aae8166583c1dbd0aacd16f59cde6a2e4da368d7cf9d320b1b8
Python
6,927
182
""" =============================================================================== Artifact Correction by AJDC-based Blind Source Separation =============================================================================== Blind source separation (BSS) based on approximate joint diagonalization of Fourier cospectra (AJ...
f28d6792a7f6229ff81469ec0986dfec884ba45c728ce172f30dc56e1eb094e3
Python
6,927
182
""" =============================================================================== Artifact Correction by AJDC-based Blind Source Separation =============================================================================== Blind source separation (BSS) based on approximate joint diagonalization of Fourier cospectra (AJ...
4660c9e511a8ace591658bfb35a9cfad435bd9bf8019cb9d76ff3d2377c2ba23
Python
6,930
207
"""Compile all public Python fences and execute the corrected flagship workflows.""" from __future__ import annotations import ast import importlib import re from pathlib import Path from typing import Any import pytest import torch from torch import nn import torchlens as tl from torchlens.options import CaptureOp...
4b8cf79b0d839dc4001ff91030dd98030a04c06cb02c12393c6235f76f716b5e
Python
6,930
222
from collections import defaultdict import numpy as np import seqpro as sp from pytest_cases import parametrize_with_cases from seqpro._modifiers import _align_axes, _slice_kmers, reverse_complement from seqpro._utils import cast_seqs, check_axes def test_align_axes(): arr1 = np.random.randint(0, 5, (3, 2, 7)) ...
1f80477a59ff40fe1b5b3c0700cf5110bb778b98f378f78615069237fb90d338
Python
6,933
146
"""Read and write files of queued and running jobs on behalf of remote job runners.""" import os import re import shutil from galaxy import ( exceptions, util, ) from galaxy.config import GalaxyAppConfiguration from galaxy.job_execution.setup import JobWorkingDirectory from galaxy.model import ( Job, ...
0100f135a35e055c88e4c9fc790a29a597986649d734f1b1c8f97dc6cd7f5445
Python
6,934
234
from tempfile import TemporaryDirectory import numpy as np import polars as pl import pandas as pd import seqpro as sp import xarray as xr from pytest import fixture import pickle import seqdata as sd import zarr def read_fasta(file_path): """ Reads a FASTA file and returns a dictionary of sequences. P...
571809e99a4120b3a982308ce4431ef17dc676a80c54566813093a4976f04928
Python
6,939
216
import configparser import os from pathlib import Path from typing import Dict, List, Optional, Tuple, Union from codecarbon.external.logger import logger CONFIG_FILE_NAME = ".codecarbon.config" CONFIG_SECTION = "codecarbon" def clean_env_key(k: str) -> str: """ Clean up an environment variable key: remove ...
b27e6a7f2dcfa52b2d14885188a0ccac8b1b13a21bb0a993c21001c4c893d7f4
Python
6,940
222
"""Evaluation procedures for semantic segmentation. For dataset with `n` classes, we treat the index `n` as the ignored class. When compute IoUs, this ignored class is considered. However, IoU(ignored) doesn't influence mIoU. """ from functools import partial from multiprocessing import Pool from typing import Abstra...
e0a0868f72fb77eb9f2e2e2bbd9a30898468d7f9cffe4219cf3eb345cfee9447
Python
6,942
202
import os,sys,re import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns #from bioseq2seq.bin.batcher import train_test_val_split,filter_by_length from Bio import SeqIO from Bio.Seq import Seq from Bio.SeqRecord import SeqRecord from collections import defaultdict from ushuffle impo...
ebc00d88f1c9b287d0396dec6404964a32e7077eaea507c1bc6d00dd482ddbe4
Python
6,943
172
from fastapi import HTTPException from carbonserver.api.errors import NotAllowedError, NotAllowedErrorEnum, UserException from carbonserver.api.infra.api_key_utils import generate_api_key, get_api_key_hash from carbonserver.api.infra.repositories.repository_projects_tokens import ( SqlAlchemyRepository as ProjectT...
7160861999c8e8298301927d1dc1902d6cd0612138c4eb64e9da4bd106ad793a
Python
6,945
232
# %% import pandas as pd import numpy as np import matplotlib.pyplot as plt import cv2 from globals import path, sessions, subjects, folder_spots_noboth, colours_types import os from plotting import prettifySpinesTicks, removeSpines mc = "black" plt.rcParams.update( { "font.size": 40, "axes.labelco...
92fd91012c06bfb25e4f15cf327abe040cc8442555567570a236ed3377bfa5f3
Python
6,945
178
#!/usr/bin/env python3 import os import numpy as np import h5py from snudda.utils import SnuddaLoad class DegreeDistribution: def __init__(self, network_file): self.network_loader = SnuddaLoad(network_file=network_file, load_synapses=True) self.network_file = self.network_loader.network_file ...
be78b30e7e6fd396b916305737b2b0427c6a4d69edc6619d1457435da2e3b94c
Python
6,945
170
""" The `trendline_functions` module contains functions which are called by Plotly Express when the `trendline` argument is used. Valid values for `trendline` are the names of the functions in this module, and the value of the `trendline_options` argument to PX functions is passed in as the first argument to these func...
9b78c615b86ab3c13b07f31d7e1cc661ee449ee20e2a06f588fee8d6250ad6e5
Python
6,946
175
import argparse import datetime import shutil import sys import os import random from logging import getLogger from collections import OrderedDict import numpy as np import pytorch_lightning as pl import torch from omegaconf import OmegaConf import wandb from src.modeling.modeling_base_model import BetaConfig from .lo...
067eb13e63b5d19741d0abd83d14c4160894775d62b557d63a9a1043d2342054
Python
6,947
211
from __future__ import annotations import json import time from typing import TYPE_CHECKING from typing import Final import numpy as np from loguru import logger from numpy.typing import NDArray from .._shape import Shape from ._geometry import shape_to_xyxy_bbox from ._osam_session import OsamSession from ._shape_b...
73fd4d20dc487ecd1c33a82717b161074a59acfd30a818f56947b7229b95cb95
Python
6,948
179
import pickle import json import numpy as np import os,sys from collections import OrderedDict import torch import biovec from tape import ProteinBertModel, TAPETokenizer import warnings warnings.filterwarnings("ignore") def generate_Y(dataset_path): affinity = open(dataset_path+'/affinity.tsv','r').readlines() ...
e24577e42e9553ec8d06eff69fd24d36ad5fe193539236eea73649dd63ab3d2e
Python
6,948
123
from Utilities.common_packages import np ''' NOTE: Returns emperical EMCCD cumulative density function ''' def getEMCCDExperimentalCDF(): pmf = np.array([1.09863281e-08, 2.19726563e-08, 2.24609375e-07, 9.36279297e-07, 4.07592773e-06, 1.59155273e-05, 5.57116699e-05, 1.79609375e-04, 5.28302002e-04, 1.4...
f5c6e9b2ffd11bf4bc374f484325d10f80335dcc5571fc1f38d9a996e65c5855
Python
6,948
211
# Copyright 2023 Blue Brain Project, EPFL. # See the top-level LICENSE file for details. # # SPDX-License-Identifier: Apache-2.0 from nmodl.ode import differentiate2c, integrate2c, make_symbol from nmodl.ode import transform_expression, discretize_derivative import pytest import sympy as sp def _equivalent( lhs...
02392005ce98a433702c668bb640a933ad6f48c963be52f645d89f88d45e6c51
Python
6,952
148
''' Data driven CNN model for neural system identification Author: Santiago Cadena Last update: April 2019 ''' import numpy as np import os from scipy import stats import tensorflow as tf import hashlib import inspect import random from tensorflow.contrib import layers from tensorflow import losses from cnn_sys_ident...
a2ff25374ddc8f01024a82b565ca8829e1f637077ac9b1bed541f64c04b671c3
Python
6,952
186
"""Gallery gates (row 0.6): fingerprints, fork isolation, consume-not-construct. The galleries are the substrate every matrix shares (memo 0.6); these gates prove the economics rules actually enforce -- the fingerprint detects mutation, forks isolate, and no cell constructs its own products. """ from __future__ impor...
5fa14ce065c87ce3453b9d1a7895db4d092cd777164151b93dd1c80dea7af193
Python
6,953
250
""" sess_stim_df_util.py This module contains the functions needed to generate the stimulus dataframe for Allen Institute OpenScope experiments for the Credit Assignment Project. Authors: Colleen Gillon Date: October, 2018 Note: this code uses python 3.7. """ import numpy as np import pynwb from util import gen_...
13dfbc2b424cfcef34c46f0197a992d08f44cd13161d8236d8af3c9288b63481
Python
6,954
204
### This code displays and image, then it grabs the position of the pixel when you click on the image # It saves the positions in a csv file from tkinter import * from tkinter import filedialog as tkfd import numpy as np from PIL import Image, ImageDraw, ImageTk import csv import os import sys counter = 0 library = ...
c96b34b4d3d66c32adec7b0c88f279228f730571513647ed389fc40e1b397774
Python
6,957
214
""" Simple scikit-learn interface for finetuning a single linear layer on top of LLM embeddings. """ from numpy.typing import ArrayLike import numpy as np from scipy.special import softmax from sklearn.base import BaseEstimator, ClassifierMixin, RegressorMixin from sklearn.linear_model import LogisticRegressionCV, Ridg...
b2f8a0d70f38897350bcb45f87a63340c98f50078e385c7d34dfcc6808b30c52
Python
6,959
169
"""Entry self-test for the shared replay comparator (R75-4). ``tensor_nanequal`` is the single judge behind every per-op replay verdict AND capture-side alias/mutation bookkeeping, with no oracle above it: a degradation making it vacuously true would blind the whole forward-replay tripwire while the suite stays green ...
4c59ab29608e6af4c642f904caaff7503f4040854989ca86de103a9b193e5f28
Python
6,960
175
"""L6 DNA CANARY (D7 evidence) — lands immediately after stage 2. Two live-trace demos judging the do()-verb lock (design memo sec 5): DEMO 1 — zero-ablation via ``do()``: downstream deltas real; FireRecords + state ``REPLAY_PROPAGATED`` + ``last_run`` honest; the nonfinite-gate (ABORTED_NONFINITE settlement) behavio...
6279fcdff47c2ac1b5345ddd8fa760efb57cfce893050386ac25d9c9aa9390d4
Python
6,961
228
from functools import partial from pathlib import Path from textwrap import dedent from typing import List, Optional, Union import numpy as np import polars as pl import zarr from numcodecs import Blosc, VLenBytes from tqdm import tqdm from seqdata._io.utils import _df_to_xr_zarr from seqdata.types import FlatReader,...
aff9530003cba0ae9b0be08bd95f16c6c0c7f7998702b849b461fa1e441fa739
Python
6,961
159
import numpy as np import torch as ch import scipy.signal as signal try: from scipy.signal import kaiser except ImportError: from scipy.signal.windows import kaiser class DownsampleEnvelopes(ch.nn.Module): """ Base class for downsampling operations for the cochlear envelopes. """ def __init__(s...
bb6c4f88aa4a005ddb668776265c08fe20cc184f937bff9525cadb2d3e0a4aa8
Python
6,961
320
from gym.envs.registration import load_env_plugins as _load_env_plugins from gym.envs.registration import make, register, registry, spec # Hook to load plugins from entry points _load_env_plugins() # Classic # ---------------------------------------- register( id="CartPole-v0", entry_point="gym.envs.classic...
428370d97a8f4463d7441f9ab467c9618db4a6df183b1b3510d517efad93c80d
Python
6,962
167
import os import sys from robustness import datasets from robustness.attacker import AttackerModel from robustness.model_utils import make_and_restore_model from model_analysis_folders.all_model_info import IMAGENET_PATH from robustness.imagenet_models.clip import clip import torch from PIL import Image sys.path.appen...
43f4f6789259f4cf45278335d2a05307ba7dae2a1e6c77834647f5eaee909e6b
Python
6,962
204
from typing import Any import torch import numpy as np import pandas as pd from .metrics import MetricManager from tqdm import tqdm import os import os.path as osp import json import matplotlib.pyplot as plt class GNNTrainer(): """ Class to train and validate GNN models. It can also run predictions with t...
b5ad5b55067d2b5bc3ebf82e8d9eaac3e56a5d141be8c672316e1960f877c940
Python
6,962
211
"""Functions to help segmentation benchmarking, specifically to compare two sets of segmentation labels. """ from typing import Optional, Tuple import numpy as np import pandas as pd from anndata import AnnData from scipy import sparse from sklearn import metrics from ..configuration import SKM from ..logging import ...
225d4f76c6384e6d9a6cd2be159f8c67e44e66122f38fcae90ac1a13a58fdfc5
Python
6,964
187
""" test_canonical_pipeline.py — Smoke tests for the deposit. Three tests, each fast (< 1 minute total): 1. test_build_trained_model_reproduces_paper_numbers Runs build_trained_model.py against the bundled feature JSONs and asserts the four paper headline numbers are within tolerance. 2. test_rank_norm...
a8ed3dc701445911644c154b79178fc1e81c17291394a683b70217bab579d6a0
Python
6,964
202
# meshAttributes.py # # Created on: August 1, 2019 # Authors: An Qu # {an.qu} <at> yale.edu # import numpy as np from sklearn.preprocessing import normalize def triangleMeshAttributes(vertices, faces, returnList): ''' This function can be used for calculating th...
87a0f2fff23af4677bc7d6b16648b455888535f9efaa1c85787ce5247a609f87
Python
6,966
175
__author__ = "quentin" import datetime import logging import time import traceback from .tracking_unit import TrackingUnit class Monitor: def __init__( self, camera, tracker_class, rois=None, reference_points=None, stimulators=None, time_offset=0, ...
b365fd714d4833e54e9c6e12da2dd4af411a6fc4aef854292f3bb0a79c2efbb5
Python
6,966
148
''' Finetuning on the top 4 atom GRU 4 linear layer network. ''' import torch import torch.nn as nn import logging logger = logging.getLogger(__name__) from neural_nets.NMR_4ll_Net import NMR_MPNN import collections device = "cuda" if torch.cuda.is_available() else "cpu" import os def gen_states(model_state_dict): ...
55f8429e27a09376ee3d83c28fb724fef1b3ed3ac4dad083510be6c40dbc86bb
Python
6,967
198
"""Cold-import subprocess matrix: the A10 row gate. One fresh interpreter per matrix run proves, with no test-session state: - ``import torchlens`` imports no appliance/integration namespace, no semantic package, and no foreign extra package; - a ``hasattr``/``dir()`` probe sweep across the root and every facade ...
60480a04f3b30891a12462624315f5851cf25e8f98bc2435b2843a0ff76c2004
Python
6,968
185
#!/usr/bin/env python3 """ File: filter_gte_file.py Created: 2021/10/28 Last Changed: 2021/11/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 source t...
4621fe81638363706a7feaa08c1288882adb10471ae0fe83c674006cbcd5a4f0
Python
6,969
184
"""Fabrication pins (W1-FAB, memo L2/L5, sec 8.1 items 5-6), RED-first. The generalized rule (D6): weights-free, a value comparison that cannot answer resolves to ``unknown``, never ``changed``; no record and no completeness-witness flag may rest on an ``unknown``. Fail-closed in the HONEST direction: absence of a wri...
43f5c7d83ef0d52005db91f8cdd2a354d491978c2e44eb0c94f2a0a884d16194
Python
6,970
227
""" Behaviorl-epoch-related plotting """ from __future__ import annotations from typing import Any, Optional, Sequence import copy from .. import plot, reg, util, funcs __all__: list[str] = [ "plot_single_bout", "plot_bouts", # 'plot_stridesNpauses', ] def plot_single_bout( x0: Sequence[float], ...
e277abdd25ac8c56fede7ec9a13bb9fa41e3050c401a46807c665df54eb3d092
Python
6,970
192
import os import sys import abc import math import yaml import torch from torch.utils.tensorboard import SummaryWriter from config.default_hparas import default_hparas from src.util import human_format, Timer class BaseSolver(): ''' Prototype Solver for all kinds of tasks Arguments config - yaml-s...
d0d5ceecd117533169c924cdbb01ea5bb0ee74b7b1c4b22855f73f0e4dea0ee7
Python
6,971
191
from __future__ import annotations import typing as t from . import typing as ft from .globals import current_app from .globals import request F = t.TypeVar("F", bound=t.Callable[..., t.Any]) http_method_funcs = frozenset( ["get", "query", "post", "head", "options", "delete", "put", "trace", "patch"] ) class ...
8e00fc32770c94dc9c9c5ee2bef31406525d161833da8103b58c780d64f5f9b5
Python
6,972
175
"""Round-11 security regression: duplicate container-type resolver RCE. r10 hardened the container-type resolver in ``torchlens/ir/container.py`` into a strict default-deny, never-import gate. But a PARALLEL resolver survived in ``torchlens/data_classes/op.py``: the public inspection property ``Op.multi_output_type`` ...
fb5dfb11c9bad7d90164e07a8e2bea76fcfe3bcc1c0d73d1e149c5e9f8946faf
Python
6,973
168
#%% import dataprocessing import numpy as np from tensorflow.keras.layers import Dense, Conv2D, MaxPooling2D, Flatten,Input,Concatenate,Reshape,UpSampling2D,PReLU from tensorflow.keras.models import * from tensorflow.keras.optimizers import Adam,SGD,RMSprop,Adagrad,Adadelta,Adamax from tensorflow.python.keras.u...
aaa56725ad4bfae27e0f862d068ebbd514cdf6a060a22ced193151127a3a32d2
Python
6,974
185
"""W051-MECH regression pins for AUD-CODE 3.12 (a) and (c): flops_report. (a) The model door ran its one capture under eval + ``no_grad``, which flips ``nn.MultiheadAttention`` / ``nn.TransformerEncoderLayer`` onto the fused fast path (``_native_multi_head_attention`` / ``_transformer_encoder_layer_fwd``) -- one opaqu...
c35b3ae6da553da338d57247ae2b453b9ea797b18b5aa53be6c9f90dc4bd5004
Python
6,976
132
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
478e305baf8763ae17b6aa2d5dafc559261239094d08ff9f04af183a9b57bb75
Python
6,977
182
# -------------------------------------------------------- # Based on BEiT, timm, DINO and DeiT code bases # https://github.com/microsoft/unilm/tree/master/beit # https://github.com/rwightman/pytorch-image-models/tree/master/timm # https://github.com/facebookresearch/deit # https://github.com/facebookresearch/dino # --...
599813b85ae252f615ad8aee807a5cc5611124d905097e7bc2a3a3da1935a5ce
Python
6,977
175
"""Edge substitution into a NON-LAST pass of a multi-pass child (AUD-CODE 1.2). Before the fix the edge door committed ``{child.layer_label: new_out}`` and ``{child.layer_label: [fire_record]}`` -- the BARE label, which ``layer_dict_all_keys`` resolves to the LAST pass -- then ``push_from`` pushed the addressed pass's...
6eacb200fe860c210f1e5a50d1a4c0c66f6f931c24acffc0d688104a127556b3
Python
6,977
193
""" ================================= Frequency Band Selection Helpers ================================= This file contains helper functions for the frequency band selection example """ import numpy as np from mne import Epochs, events_from_annotations from pyriemann.estimation import Covariances from pyriemann.cla...
e9702374a10893a5ca8bb1f2acf0c504900a7fc6164db869137d859950a1def1
Python
6,982
180
"""Video models: C3D (3D-conv action recognition) and DCVC (deep contextual video codec). C3D -- Tran et al., ICCV 2015, "Learning Spatiotemporal Features with 3D Convolutional Networks", arXiv:1412.0767. Source: github.com/facebookarchive/C3D. DISTINCTIVE primitive: 3x3x3 3D convolutions over a video clip (T x H x ...
974a423565f4da472d30b3c55ccedfc3689faaa6b82df7fea4ccd0e7f4435c67
Python
6,984
224
# coding=utf-8 # Copyright 2025 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
3c6405003d4a50c968a052babb02f7bd9bf98c1c99ca7f9baa9887bceadbf4b9
Python
6,985
207
# ------------------------------------------------------------------------------ # Copyright (c) Microsoft # Licensed under the MIT License. # Written by Bin Xiao (leoxiaobin@gmail.com) # Modified by Bowen Cheng (bcheng9@illinois.edu) # ------------------------------------------------------------------------------ fro...
4489c104313f07f49d47562a06aff970aa715c7b2e61173bddf25d00308a4e62
Python
6,989
192
""" ================================= Frequency Band Selection Helpers ================================= This file contains helper functions for the frequency band selection example """ import numpy as np from mne import Epochs, events_from_annotations from pyriemann.estimation import Covariances from pyriemann.cla...
7c7c050c010e709fe1c387b51781eb624248ea108328b8f81773d39a172aa6a8
Python
6,991
177
"""Vizmech wave-2 item 15: cluster caption placement from member geometry (D18b). Captions were emitted ``labelloc=b`` and INHERITED the graph-level ``labeljust=left``: a fixed corner of the cluster box, up to 1121.9 pt from the nearest member (p90 732.6 pt over 1066 measured clusters). Pins here: - every module clus...
9fd389617c4304f27ff88520226c0db6257efb7d689cbbda6d97cea41a6d9d06
Python
6,991
227
from __future__ import annotations import time from threading import Thread import pytest import env # noqa: F401 from pybind11_tests import callbacks as m from pybind11_tests import detailed_error_messages_enabled def test_callbacks(): from functools import partial def func1(): return "func1" ...