sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
e4c5e53868e0f69111bd0b627d70eda64e7366b14f3813243bebba5bc29fbbf0
Python
7,598
231
"""Entrypoint for the `ome_zarr` command-line tool.""" import argparse import logging import sys from .csv import csv_to_zarr from .data import astronaut, coins, create_zarr from .format import CurrentFormat, Format, format_from_version from .utils import download as zarr_download from .utils import finder as bff_fin...
764898217fb1cdd93a6c6f7725080e712223de26f75305e6420647fd19988824
Python
7,601
179
import tensorflow as tf import numpy as np import os import tensorflow_datasets as tfds from tensorflow.keras import datasets, models from cvnn.initializers import ComplexGlorotUniform from cvnn.layers import ComplexDense, ComplexFlatten, ComplexInput import cvnn.layers as complex_layers from cvnn import layers from pd...
620c915d470e53f364a2213d91e1f68e5c4b57729da87e5ae50c41730d7ba274
Python
7,602
170
""" MXNet implementation of SMOT: Single-Shot Multi Object Tracking https://arxiv.org/abs/2010.16031 """ import os import argparse import logging import numpy as np import cv2 from gluoncv.model_zoo.smot import smot_tracker as Tracker from gluoncv.model_zoo.smot.tracktors import GluonSSDMultiClassTracktor parser = a...
201f2434e6436a8d014e5ebd8b74ecd7db92706226c61725a63fa2c5ec812029
Python
7,607
244
import sys sys.path.append("/home/rzhu/Documents/edamame/") import numpy as np import matplotlib.pyplot as plt import pandas as pd import nptdms import os from edamame import * # from edamame.analysis.InfoTheory import * from scipy.io import loadmat from dask.distributed import Client import mkl from IPython.core.de...
c53d8f9759bdaa6e54ad8369d0078c6ceeb549842c7674b7dea5c4e7d75a0398
Python
7,607
190
"""Plots for trial related measures and analyses.""" import numpy as np from spiketools.utils.base import flatten from spiketools.utils.options import get_avg_func, get_var_func from spiketools.plts.settings import DEFAULT_COLORS from spiketools.plts.annotate import add_vlines, add_vshades, add_significance from spik...
e753deb60549af5227ca6978bb44c9903026d68d1f30d824e76fe57a0fc2a243
Python
7,607
202
from dataclasses import dataclass from typing import Tuple import torch from PIL import Image from torch import nn from lightly.transforms.torchvision_v2_compatibility import functional as F from lightly.transforms.torchvision_v2_compatibility import torchvision_transforms as T @dataclass class Location: # The ...
fedffd591479a5de1e9265b98678c861a5f07f8561a60a0169ea4205d30d5cfe
Python
7,607
204
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created in July 2019 @author: Nathan de Lara <nathan.delara@polytechnique.org> @author: Thomas Bonald <thomas.bonald@telecom-paris.fr> """ from typing import Union, Optional, Tuple import numpy as np from scipy import sparse from sknetwork.linalg.normalizer import no...
0249db51e7492b3f03bec95f19036332f5648aae5c29aaddb9ecde8364c2b6e6
Python
7,608
216
import importlib import pickle import unittest import numpy as np from densratio import densratio class RCompatibilityTestSuite(unittest.TestCase): """Baseline checks ported from the R package tests.""" def setUp(self): rng = np.random.RandomState(314) self.x = rng.normal(loc=1, scale=1.0 /...
882899430119f99c03b8d00a317c95d56a9b778035539d1990301fedd77150e3
Python
7,608
208
from collections import OrderedDict import cv2 import numpy as np from skimage import img_as_ubyte from skimage import color import re import subprocess import openslide class FileHandler(object): def __init__(self): """The handler is responsible for storing the processed data, parsing the metada...
b8590c45fb2457fe8e6814b766e2b8d3c5d66f2a628528a5577e4a9a696b0ef5
Python
7,608
193
"""Real-model Model Explorer regressions (memo section 5; heavy tier). The id bug survived THREE rounds of toy validation -- capture-side recurrence folding rescued every toy -- so the id-uniqueness regression, the 158/158 edge-resolution case, model-mode receipt discipline, and the worker floors are pinned on real to...
e0c31566e6d975873c63d49036f8ff58243cdf66046215ea578d420b4b260847
Python
7,609
229
""" This module holds the core function of pynapple as well as the dispatch between numba and jax. If pynajax is installed and `nap.nap_config.backend` is set to `jax`, the module will call the functions within pynajax. Otherwise the module will call the functions within `_jitted_functions.py`. """ from typing impor...
66b424b6410b1346d990875f99ca7e9cb15b16a4026af825b1a35ea55306065c
Python
7,611
229
import datetime import glob import os import subprocess import sys from pathlib import Path from ruamel.yaml import YAML from pipeline_utils import create_config, extract_sync, find from registration.registration_spikeinterface import registration as registration_function from sorting.sorting_kilosort import sorting as...
7ed383fcd933fe9571d8311ffcb7177c7e37939b565543c15177e3c0bd8917ea
Python
7,611
165
import argparse import torch import torch.backends.cudnn as cudnn from torchvision import models from data_aug.contrastive_learning_dataset import ContrastiveLearningDataset from models.resnet_simclr import ResNetSimCLR from simclr import SimCLR import torchvision import sys import numpy as np import os import yaml imp...
0dfce237211e0e2b25c8fae31eba231dd5b3e241ffae8ef682dcabd285fc2fdf
Python
7,612
205
"""Bounded single-worker write pipeline behind the async streaming bundle writer. ``BundleStreamWriter`` submits prepared blob-write jobs here so the slow parts of a streamed disk save (safetensors serialization, the page-cache write, and the sha256 integrity hash) overlap forward capture instead of pausing it. The en...
47bb24f6676d87647eec152cb733e4f4de0123d712d8935bd6826017ebb11974
Python
7,612
234
import torch #from flash_attn_interface import flash_attn_func, flash_attn_varlen_func, flash_attn_with_kvcache import flash_attn_interface as fa3 import flash_attn as fa2 import torch.utils.benchmark as benchmark import time import argparse import math parser = argparse.ArgumentParser(description='Process some integ...
61566de65157e9e60aca72761fb17bb850cddb4d0bbf80f78e7aeb9559bb8699
Python
7,612
177
#!/usr/bin/env python import numpy as np import matplotlib.pyplot as plt from scipy.signal import welch import matplotlib matplotlib.rcParams['path.simplify'] = True matplotlib.rcParams['path.simplify_threshold'] = 1.0 matplotlib.rcParams['agg.path.chunksize'] = 10000 # import matplotlib.style as mplstyle # mplstyle....
34251017fb6d3ce7555b0fc4f012e615424c0323617c3d3f79421d77540e84b9
Python
7,614
204
#!/usr/bin/env python """ Temperature alert monitor for Ethoscope sensor system. Monitors sensor temperatures against configurable thresholds and sends alerts through the notification system when thresholds are crossed. Implements "alert once" behavior - alerts are sent when a threshold is first crossed, then suppres...
357641016c5efa6af04893d08af86ece39f997b044db4fc37ac5c04ff9af2cc2
Python
7,614
205
import numpy as np import pytest import tensorflow as tf from absl.testing import parameterized from keras.src import backend from keras.src import layers from keras.src import testing from keras.src.backend.common import standardize_dtype from keras.src.testing.test_utils import named_product class HashedCrossingTe...
351249f46253983d848001e4fcac695fa60dbb22c12a7b6243525593adbe79d0
Python
7,617
210
import torch import torch.nn as nn import torch.nn.functional as F from torch.optim import Adam import scipy.sparse as sp import numpy as np def sparse_to_tuple(sparse_mx): if not sp.isspmatrix_coo(sparse_mx): sparse_mx = sparse_mx.tocoo() coords = np.vstack((sparse_mx.row, sparse_mx.col))....
ec786543b642751ee355aad6258e85662e85d9e5e50adb6bd115299e81638900
Python
7,617
249
""" Helper functions for some special plot kinds """ import numpy as np import matplotlib as mpl from matplotlib import pyplot as pl from ..core import ifnot _gridshapes = {4:(2,2), 5:(2,3), 6:(2,3), 7:(2,4), 8:(2,4), 9:(3,3), ...
aae03ac7ed142e9df5fcd345f5d1a567e0c648e8e9ac2a95a79f7fd067a78e37
Python
7,621
202
""" Manager and Serializer for Roles. """ import logging from sqlalchemy import select from sqlalchemy.exc import ( MultipleResultsFound, NoResultFound, ) from galaxy import model from galaxy.exceptions import ( Conflict, InconsistentDatabase, InternalServerError, ObjectNotFound, RequestP...
1058e79ddd841d77e75891b5d4aed5921c9f6859998496d8e8b99c228c283343
Python
7,624
224
"""Helpers for vizualization.""" import numpy as np from ..embedding import SpectralEmbedding, LocallyLinearEmbedding def plot_embedding(X, y=None, *, metric="riemann", title="Embedding of covariances", embd_type='Spectral'...
7ca7400b2561ee629395e4a8b8544df2b578352bad71e4dac472a761fd97c452
Python
7,624
189
#!/usr/bin/env python # coding: utf-8 import numpy as np import pycuda.gpuarray as gpuarray from pycuda.compiler import SourceModule def _build_kernel(): code = """ __global__ void Funktion(int *match, float *verts1, float *verts2, int *arr1, int *arr2, int xsh1, int ysh1, int zsh1, int xsh2, int ysh2, int zs...
2c8c5640929da5fd95f2f0b5d93f9c11b79f419ebca28d7c92bebe205d7f072c
Python
7,625
190
import copy import inspect import itertools import string import warnings from keras.src import tree from keras.src.backend.common.stateless_scope import StatelessScope from keras.src.export.saved_model_export_archive import ( BaseSavedModelExportArchive, ) from keras.src.utils.module_utils import tensorflow as tf...
b2483097655ef9f9f5a8c82ed4c3c8524bd273173735afd776675070e2c4ccaa
Python
7,626
191
"""Orphan backward-hook fixture: the defensive contracts, provoked on purpose. TorchLens hooks every discovered grad_fn (posthook + prehooks). A hook is ORPHANED when it is armed but never fires in a pass, or fires after its pass closed. Both conditions are deterministically constructible with public torch APIs — no v...
185aad32540be3999f3221a7d8463bbb646383b8035bbd0dbdcea0c43fe4dd22
Python
7,629
187
import glob import pylab as pb import os from collections import defaultdict import numpy as np import argparse import pandas as pd import seaborn from scipy.stats import mannwhitneyu, ks_2samp, ttest_ind from tqdm import tqdm from mp_dip.utils.utils import get_all_atoms, read_raw, preanalyse_raw, get_mp_book_paths ...
f30a68b155f5d45672824ec0888e9245dd0085cdad8bbb49b262bdfc74d0231b
Python
7,630
228
import os import subprocess import tempfile import numpy as np from modular_splicing.dataset.additional_data import AdditionalData from modular_splicing.utils.construct import construct from modular_splicing.utils.sequence_utils import draw_bases from permacache import permacache, stable_hash, drop_if_equal error =...
78f3990042db6a9864e5236c052e3980ddb79a2d42b2ea2c0c0929a33f2a7329
Python
7,631
206
''' Data manager script with helper classes for neural system identification Author: Santiago Cadena Last update: April 2019 ''' import pickle import inspect import os from numpy import * import numpy as np PATH = os.path.dirname(os.path.dirname(inspect.stack()[0][1])) DATA_PATH = os.path.join(PATH, 'Cadena_PlosCB1...
fc42b1ec32bde06823d5a5383ec10713807f0a5afaa88d397f682798a6da7c26
Python
7,631
322
""" Mapping of the R library "grid" for graphics. The R library provides a low-level coordinate system and graphic primitives to built visualizations. """ import warnings import rpy2.rinterface as rinterface import rpy2.robjects as robjects import rpy2.robjects.conversion as conversion from rpy2.robjects.packages i...
1cc78418e095b671b7a85c8061d2fac29aea62dae2e9984da2d2fb30a7f865d9
Python
7,632
235
""" Ported to pytorch thanks to [tstandley](https://github.com/tstandley/Xception-PyTorch) @author: tstandley Adapted by cadene Creates an Xception Model as defined in: Francois Chollet Xception: Deep Learning with Depthwise Separable Convolutions https://arxiv.org/pdf/1610.02357.pdf This weights ported from the Ke...
5e28e85a4ccf60ae1fc86957cb5149aa64c986fc282681997e3999e122b8eb74
Python
7,634
179
""" Aperiodic Parameters ==================== Exploring properties and topics related to aperiodic parameters. """ ################################################################################################### from scipy.stats import spearmanr from specparam import SpectralModel, SpectralGroupModel from specpa...
c0940401ac4d25ff1129a6886a980eb71b20153215f4af25bd86b61758b89961
Python
7,634
149
# Written by Seonwoo Min, Seoul National University (mswzeus@gmail.com) # PLUS import os import sys import argparse import torch import plus.config as config from plus.data.alphabets import Protein import plus.data.solubility as solubility import plus.data.dataset as dataset import plus.model.plus_rnn as plus_rnn im...
e7af0f2fdbf90c342d2fa60399a0fbbcf34a4514ab924de7d8517030f628fbbd
Python
7,634
172
"""Closed ledger of sanctioned in-place op-lane writers (r7 R03-1). The producer contract says the op lane is append-only with post-commit knowledge riding the typed amendment lane -- but the fastlog ancestry-closure backfill legitimately REPLACES op-lane cells in place on the ``copy_for_replay`` projection a cook own...
874b94f83c6c98253797b9f8517e0d513f9d26ab200965822b2474a44448f6cd
Python
7,635
178
import os import sys from pathlib import Path from platform import python_version import gc import inspect from copy import deepcopy #from imp import reload import dill # Custom modules tr = "" # abs path to workdir sys.path.append(tr) import src from src.models.tree_utils import * from src.models.ml...
863186f25705b2ab795d6e1a0b625ce717f7e232e5b95d1545a10ccc75e2bbc1
Python
7,637
257
import matplotlib import numpy as np import pytest from packaging.version import Version from ..exporter import Exporter from ..renderers import FakeRenderer, FullFakeRenderer import matplotlib.pyplot as plt def fake_renderer_output(fig, Renderer): renderer = Renderer() exporter = Exporter(renderer) expo...
d8e6ed05f309e8f5f6d199eec702e48fdf9c84bcbbdefa7cda0035265286e17c
Python
7,637
211
#works for # pandas==0.25.1 # numpy==1.17.2 # scikit-learn==0.21.3 # Theano==1.0.4 # tqdm==4.36.1 # pickle==4.0 #### #Code tested on my machine; ###################### from cox_nnet_v2 import * import numpy import sklearn import sklearn.model_selection import pandas as pd import time from sklearn.preprocessing impor...
dd3598af9ea0aef1069adfa0ced6bb6b28cb94481250800081bb4ae769cec324
Python
7,637
240
"""Tests for ``tl.debug`` diagnostic helpers.""" from __future__ import annotations import builtins import inspect from typing import Any import pytest import torch from torch import nn import torchlens as tl class NanModel(nn.Module): """Tiny model that creates a known non-finite op.""" def forward(self...
469eee0cd235c8cb09bf812821988561dac2b0b8db1b3a61d374d0f8c7949fa4
Python
7,638
211
#works for # pandas==0.25.1 # numpy==1.17.2 # scikit-learn==0.21.3 # Theano==1.0.4 # tqdm==4.36.1 # pickle==4.0 #### #Code tested on my machine; ###################### from cox_nnet_v2 import * import numpy import sklearn import sklearn.model_selection import pandas as pd import time from sklearn.preprocessing impor...
9c6dceddbd3fca28e864e009ab6c1fef364eff612b2fb0a3bdb5665555a72d51
Python
7,638
166
""" Gregory Way 2017 PanCancer Classifier tcga_util.py Usage: For import only """ def get_args(): """ Get arguments for the main pancancer classifier script """ import argparse parser = argparse.ArgumentParser() parser.add_argument('-g', '--genes', help='Comma sep...
41d359166cd7e0bab089c5b444ac5a04971a14e906fa04070ff45dd6f90fc6a6
Python
7,639
151
# https://www.kaggle.com/code/vidushibhatia/2-ultrasound-nerve-seg-unet-from-scratch # https://colab.research.google.com/gist/kumarikanak/254381203742483cbe0ddce4f64945e6/u-net-implementation.ipynb#scrollTo=f5i7Thf4FDFG # for bulding and running deep learning model import tensorflow as tf from tensorflow.keras.layers...
591b60a716e08b03c70cdfcca29feebd9324d2121443b75615bd117fb0ae159f
Python
7,640
233
import os from tensorflow.keras.utils import to_categorical from sklearn.preprocessing import LabelEncoder from sklearn.utils import shuffle from sklearn.metrics import classification_report from spektral.layers import GCNConv from tensorflow.keras.models import Model from tensorflow.keras.layers import Input, Dropou...
c9402ff31f80dab81dcfb03fcd35fdbda4649e380f860de29f0dc917df9e64d8
Python
7,643
206
""" Tests for CPU, RAM, and GPU utilization tracking functionality. """ import time import unittest from pathlib import Path from unittest import mock import pandas as pd from codecarbon.emissions_tracker import OfflineEmissionsTracker from tests.testutils import get_custom_mock_open empty_conf = "[codecarbon]" c...
74cebb74001e087938dba3ed477999c986805c401b8817d126fce552c61a1680
Python
7,644
149
# Written by Seonwoo Min, Seoul National University (mswzeus@gmail.com) # PLUS import os import sys import argparse import torch import plus.config as config from plus.data.alphabets import Protein import plus.data.localization as localization import plus.data.dataset as dataset import plus.model.plus_rnn as plus_rn...
cefdd0dfdde6bb6f73e7b853aa789de432e2af52a8c920c1c2af17228235b72c
Python
7,644
215
from __future__ import annotations import dataclasses import decimal import json import typing as t import uuid import weakref from datetime import date from werkzeug.http import http_date if t.TYPE_CHECKING: # pragma: no cover from werkzeug.sansio.response import Response from ..sansio.app import App cl...
a8eac0cc65622bf89cc9e6c7633a68e8fc984f1adb417e764b8acf2c53e69a20
Python
7,645
147
import os import re import numpy as np import matplotlib.pyplot as plt import matplotlib.cbook as cbook import sys sys.path.insert(1,'/home/mila/l/lindongy/deeprl-timecells') from scipy.stats import kruskal from analysis.utils_analysis import sort_resp, plot_sorted_averaged_resp, single_cell_visualization, \ time_d...
93e05b3eb43754f8198f747ea06b9c5f3594b7951eef13fce90bca06a2035899
Python
7,646
189
"""Gate 2 -- the TransformerLens oracle (mikit D13/D14; legs G2a/G2b/G2c). LIVE in-process oracle on the transformers-5.x band, pinned transformer-lens 3.8.0 (test-only extra; packaging request filed). Revision-pinned real gpt2 from the local HF cache; the module skips without the pin installed and runs OFFLINE (no te...
53efb5115441a46c0ccbcdd0e4a9b0b8997cdabc44b5d24b3716713a5adea502
Python
7,647
124
# -*- coding: utf-8 -*- """ Created on Wed May 13 10:54:41 2020 @author: Caterina Brighi """ import numpy as np import pandas as pd import SimpleITK as sitk import os from ImageResultsVisualizationFunctions import * data_supradir = 'Path to data directory' subjs_path = [ f.path for f in os.scandir(da...
16575bb60844874b7225a0e803617a28a1085dac6a22d19c87be0d00b70af96a
Python
7,648
180
import contextlib import os import random import numpy as np from sklearn.model_selection import KFold, StratifiedKFold import torch from torch.utils.data.dataloader import DataLoader # from torchsummary import summary from hn_cnn.cnn import MODELS from hn_cnn.constants import * from hn_cnn.data_augmentation import g...
7c124fdea099f3f1bed904132303b7c8d038ac24ba932803bf6760ef2f9cbaa3
Python
7,648
217
# SOURCE: vendored from facebookresearch/drqv2 @ main # https://github.com/facebookresearch/drqv2/blob/main/drqv2.py # https://github.com/facebookresearch/drqv2/blob/main/utils.py (weight_init helper only) # # DrQ-v2: image-based continuous-control RL (data-augmented actor-critic with a # shared conv encoder). The real...
163401c41f0a5baa3fdccf763f5c6384ddd4b6b8246a9a76bd612aa174cdfcfd
Python
7,649
190
#!/usr/bin/env python3 """Which subjects does the pipeline drop, and why. v2""" import argparse, glob, os, re, warnings from collections import Counter, defaultdict import numpy as np warnings.filterwarnings("ignore") HEALTHY_ROOT = "raw/healthy/eegmmidb/eegmmidb_v1" STROKE_ROOT = "raw/stroke" STROKE_DIR = "raw/stroke...
da3b1bf15239bd67d70f3ad114f873e0a51554280eba99ca3e94eecf140eb7ae
Python
7,649
150
# Written by Seonwoo Min, Seoul National University (mswzeus@gmail.com) # PLUS import os import sys import argparse import torch import plus.config as config from plus.data.alphabets import Protein import plus.data.stability as ss import plus.data.dataset as dataset import plus.model.plus_rnn as plus_rnn import plus...
f2dfbe0c5f73ed95eef7a9125a9dd2352c533087e6d342a5dbe41a814f865aa0
Python
7,649
176
import pandas as pd import numpy as np import sklearn.neighbors def Cal_Spatial_Net(adata, rad_cutoff=None, k_cutoff=None, model='Radius', verbose=True): """\ Construct the spatial neighbor networks. Parameters ---------- adata AnnData object of scanpy package. rad_cutoff...
58489d213e851d3bc77b752cc6621cbb0088bc32d304d958ea409ea199a6db51
Python
7,653
222
"""Sprint A3 semantic output table and surface tests.""" from __future__ import annotations from pathlib import Path import pytest import torch from torch import nn import torchlens as tl from torchlens.visualization._render_nodes import _render_raw_output class _Config: """Small classifier config carrying ex...
3a464b3eda3c0a0bf4af83bf029241655aa29dab4fd4d4e8aab7cd26665b5869
Python
7,655
204
import numpy as np import pandas as pd from rdkit import Chem from rdkit.Chem import AllChem from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import roc_auc_score import argparse rf = RandomForestClassifier() def init_args(): parser = argparse.ArgumentParser() parser.add_argument('--tr...
443c2ec48c46b7ab24d5e706f380f2d0308ad6399a379b85a4ed20ab11c8b136
Python
7,658
236
"""Repeatable facet-coverage audit producing recipe PROPOSAL inputs. Runs a roster of models through TorchLens, computes ``torchlens.semantic.facet_coverage`` for each, and writes ONE review document aggregating classified/unclassified modules and typed facet absences. The output is evidence for the maintenance sweep ...
f1c1e5ac5e781f9d370c2b40918a0bb48b572504078df28ba711f17b8f785f91
Python
7,659
222
import os import time import cPickle import datetime import logging import flask import werkzeug import optparse import tornado.wsgi import tornado.httpserver import numpy as np import pandas as pd from PIL import Image as PILImage import cStringIO as StringIO import urllib import caffe import exifutil REPO_DIRNAME = ...
8441a39b2d28afcd8d73b574c147a29871678274befaf8eb4e95acb157550984
Python
7,660
185
"""Implementation of a space that represents textual strings.""" from typing import Any, Dict, FrozenSet, Optional, Set, Tuple, Union import numpy as np from gym.spaces.space import Space alphanumeric: FrozenSet[str] = frozenset( "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" ) class Text(Spa...
740c9b517bebe35a2f7d37ab28ce0448ca71cb93e7628d78ded9ca847c9d6dbe
Python
7,661
173
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
bd1866aea35fb0c5b7b4fc6928feeefdd496ca9742ae69b2e9b7291afeb6109e
Python
7,661
221
#!/usr/bin/env python3 """ Diagnostic H — Tier 1.1: 7D + FOOOF peaks. Tests whether adding FOOOF features (aperiodic exponent+offset, alpha peak CF+PW+BW, theta peak PW) on top of the 7D (5D + IAF + DFA) baseline with HC-anchored normalization improves AD-vs-HC / FTD-vs-HC / AD-vs-FTD classification. Feature variants...
c8afac99d9d8d0c8fd96f7c569de7a97bbcfc1c8934c5a94b50285482455b536
Python
7,661
158
import sys import optuna import torch import torch.nn as nn import torch.optim as optim import numpy as np from sklearn.metrics import roc_auc_score, precision_score, recall_score, average_precision_score, confusion_matrix from sklearn.utils.class_weight import compute_class_weight from torch_geometric.loader import Da...
5f5c08f3521ddfcd9643961dcfa0814c2b44698248433415688f8d3fcc6d1569
Python
7,662
198
from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import tensorflow as tf import pandas as pd import argparse import os import sys import pwd import pdb import grp INPUT_PATH = "SimBoost/data/davis_cv_nmlzd.csv" LOG_DIR = "logs/" PATIENCE =...
a01a5fd12e67cbf1d4ff969561c9508ef19863d311db98f217b42f17a382edbe
Python
7,662
240
#!/usr/bin/env python # from galaxy import eggs import sys import rpy2.rinterface as ri import rpy2.rlike.container as rlc # from rpy import * import rpy2.robjects as robjects r = robjects.r def stop_err(msg): sys.stderr.write(msg) sys.exit() infile = sys.argv[1] y_col = int(sys.argv[2]) - 1 x_cols = sys...
ed39dd9ce21055a1653c011806ffdf9a7630a50c60d5f6d798d313d503d9e181
Python
7,662
221
import warnings import numpy as np from ..utils.distance import distance from ..utils.utils import check_weights def _project(X, U): """ Project U on the tangent space of orthogonal matrices with base point X. """ return X @ ((X.T @ U) - (X.T @ U).T) / 2 def _retract(X, v): """ Retraction t...
093ebbb7697bf262242b53e0d87bdbb30ab09935e122e5a291a0f900318dc52f
Python
7,664
195
# -*- coding: utf-8 -*- import os import time import torch import torchvision import torchvision.transforms as transforms import platform from electric_network import * import shutil from pytorch_metric_learning.losses import * import numpy as np import torch.nn as nn import torch.nn.functional as F import logging impo...
a34a8d1052dcec1a411120ee2df7db935206a6b42324d524dafbed1fafb67e15
Python
7,664
182
from .pycobi import ODESystem from typing import Union, Any import numpy as np def continue_period_doubling_bf(solution: dict, continuation: Union[str, int, Any], pyauto_instance: Any, max_iter: int = 1000, iteration: int = 0, precision: int = 3, pds: list = [], ...
3148b49952213b6e43e5ce7582ad76b41d9023eab422a288508261e1cbe1d364
Python
7,665
248
import os import re import shutil import subprocess import sys import warnings import setuptools import setuptools.command.build_ext import wheel.bdist_wheel _this_dir = os.path.dirname(os.path.abspath(__file__)) _build_dir = os.path.join(_this_dir, 'build', 'python') _cmake_file = os.path.join(_this_dir, 'CMakeList...
7dbf2d9f3a1ed88c81c9cce6f42fafd6c58288d87a0214aa0b4665a7a3fc7e4a
Python
7,665
204
import os import subprocess import cv2 import sqlite3 import numpy as np from datetime import datetime, timedelta import argparse from tqdm import tqdm def load_tracking_data(conn): """ Load ROI map and all tracking positions from the database. Args: conn: SQLite connection object. Returns:...
803e49b35b2ad4aeada11be180e9775cd48ae95bca1ac790929ffe73147ea7ae
Python
7,665
256
from matplotlib import pyplot as plt from more_itertools import chunked import tqdm.auto as tqdm from permacache import permacache, stable_hash from mpl_toolkits.axes_grid1 import make_axes_locatable import numpy as np import torch from modular_splicing.dataset.generic_dataset import dataset_types from modular_splici...
f54924122ea64cf4767be836ab275fbcd73afb3f37a446c6a4aaf5a8daefa093
Python
7,668
145
""" Hopf Bifurcation and Limit Cycle Continuation ============================================= Here, we will demonstrate how to perform branch switching at an `Andronov-Hopf bifurcation <http://www.scholarpedia.org/article/Andronov-Hopf_bifurcation>`_ and continue a branch of periodic solutions. As an example model,...
1e63d6ace4a869c10a13a38f536b63112960aaf383e3de234bb472c4952f9b77
Python
7,670
235
import inspect from keras.src.api_export import keras_export from keras.src.backend.common import global_state GLOBAL_CUSTOM_OBJECTS = {} GLOBAL_CUSTOM_NAMES = {} @keras_export( [ "keras.saving.CustomObjectScope", "keras.saving.custom_object_scope", "keras.utils.CustomObjectScope", ...
c45789da418ceacbe768d8f231fde35886fdf993c4ec28160fdd3605c56684a8
Python
7,670
173
# pylint: disable=wildcard-import from timm.optim.optim_factory import * _TIMM_FC_NAMES = ('fc', 'head', 'last_linear', 'classifier') def optimizer_kwargs(cfg): kwargs = dict( opt=cfg.optimizer.opt, lr=cfg.train.lr, weight_decay=cfg.optimizer.weight_decay, momentum=cfg.optimizer.mo...
3e5604d3374bc9300cf4bbe32abd5ac7efd8362a1eaf94bfb11ed5c9eca211d4
Python
7,673
205
#!/usr/bin/env python # python version of fasta-stats with some extra features # written by anmol.kiran@gmail.com # git: @codemeleon # date: 10/11/2021 import argparse import re from os import path import numpy as np from Bio import SeqIO def calculate_NG50(estimated_genome, total_length, sequence_lengths): t...
41a85ca90983b29fa1195816ac15cdfbaab5455e7a73fab36809117a8a6a61b1
Python
7,673
209
import torch.nn as nn import torch class AirModel(nn.Module): ''' Model based on LSTM. ''' def __init__(self, num_hidden=50, num_fin=36, num_layers=2): super().__init__() self.lstm = nn.LSTM(input_size=num_fin, hidden_size=num_hidden, num_layers=num_layers, batch_first=True) s...
68b6241d05451e495601498abb6924acd930983e89ecc76d581f2dfb48ce5ca6
Python
7,673
196
import torch from transformers import BertModel, DistilBertModel from transformers import pipeline from transformers import AutoTokenizer, AutoModelForSequenceClassification from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer import datasets import numpy as np import os.path from spacy.lang.en ...
217130c1e9ee57487eb6c272bf83f3f0642dee94e5662ef0a0b0fcfa84c2b9e9
Python
7,675
178
import io import os, sys, glob import shutil import zipfile import requests import src.EP_Generator_utils as EP_Generator_utils from eppy.modeleditor import IDF from src.Signal_Generator import generate_signal_for_EP from src.OB_GEN.OB_Generator import ob_gen def download_epw_create_directory(epw_url, configs): e...
4ba28bd935577d51130c8ed64dd3248ec593cb7ba87bd35e74d7ac6a5900dba8
Python
7,675
212
from typing import Dict, List, Tuple, Union from PIL.Image import Image from torch import Tensor from lightly.transforms.gaussian_blur import GaussianBlur from lightly.transforms.multi_view_transform import MultiViewTransform from lightly.transforms.solarize import RandomSolarization from lightly.transforms.torchvisi...
7176a8f4d0d19982015a4917e7e26331ecea9534c23935ca670e4deb8b2c460d
Python
7,675
224
""" Unit tests for the device scanner module. This module contains tests for device discovery and management functionality in the node package. """ import threading import time from unittest.mock import MagicMock, Mock, patch import pytest # Import the updated scanner modules from ethoscope_node.scanner.base_scanne...
bc32d37dc8e3d2482a704b1b3c17ef782e02471ca15a23a391efaa37466bf021
Python
7,676
213
from __future__ import absolute_import import logging import os import re from pip._internal.models.link import Link from pip._internal.utils.logging import indent_log from pip._internal.utils.misc import ( display_path, make_vcs_requirement_url, rmtree, split_auth_from_netloc, ) from pip._internal.vcs import Ver...
4ac253c5963872c3afd9c0eeb4287e7234ea8b6efc04e9bf945e6a2807997912
Python
7,677
257
# Copyright (c) 2021 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...
5b64ef9c8ef5064d183bc1e2b88de73f34345cf3cc6a71398f32fdb76266f979
Python
7,679
162
# FAITHFUL REIMPLEMENTATION of the Active Appearance Model (AAM) face decoder # used in Chang & Tsao, "The Code for Facial Identity in the Primate Brain" # (Cell, 2017; PMC8088389), built on the classic AAM formulation of Cootes, # Edwards & Taylor, "Active Appearance Models" (ECCV 1998) and Cootes, Edwards & # Taylor,...
df96e1a1a972498f63d00994fe5da61d23b1f15c6632a88a4328ee5f9658e94d
Python
7,682
216
"""Regression tests: ``force_shape_change`` flows from helper kwargs to execution. Round 26 W3 audit MED-1: ``normalize_hook_plan`` stamped the per-entry ``force_shape_change`` metadata from its own default-False parameter instead of the helper's kwargs. No production caller passes the parameter, so the documented esc...
122ae9608e440499880647379b79ac32ad1749e3b77e76ad964f1ea667b359d3
Python
7,684
150
# Written by Seonwoo Min, Seoul National University (mswzeus@gmail.com) # PLUS import os import sys import argparse import torch import plus.config as config from plus.data.alphabets import Protein import plus.data.fluorescence as fluorescence import plus.data.dataset as dataset import plus.model.plus_rnn as plus_rn...
3d86a3d7d7379298a6d0f2aa5f43f1cf60966d88b7ae8ebe23964e85b848c356
Python
7,684
222
"""Helpers for shape-matrix tests. A "shape-matrix" test verifies that a function applies independently across arbitrary leading and trailing dimensions surrounding its key axes (length, ohe, etc). The pattern: build a baseline input plus a "patterned" input that broadcasts the baseline along new leading and/or traili...
b5f18c2fb098bf3002f04d18022e916ee73f96ba4233656d211cb92c178d89d4
Python
7,684
198
__author__ = "quentin" import time from ethoscope.core.variables import BaseIntVariable from ethoscope.hardware.interfaces.interfaces import DefaultInterface from ethoscope.utils.description import DescribedObject from ethoscope.utils.scheduler import Scheduler class HasInteractedVariable(BaseIntVariable): """ ...
7d110748a4a2aad90c33489f4a50da0ac6aa19d64aab5414929be8a3fbb44dcf
Python
7,686
250
import json import os import tomllib import pytest import flask # config keys used for the TestConfig TEST_KEY = "foo" SECRET_KEY = "config" def common_object_test(app): assert app.secret_key == "config" assert app.config["TEST_KEY"] == "foo" assert "TestConfig" not in app.config def test_config_from...
c641c1cf78e9b0c7d7f871ceb2cf574495684537d3cd5725995e3d5e08302d27
Python
7,687
187
"""F29: payload_stats and compare -- bounded numbers, coverage honesty. Stats: deterministic float64 metrics against a torch reference, tagged non-finites through the strict serializer, per-row typed statuses (never a batch failure), byte refusal BEFORE materialization, one retained axis. Compare: subject-minus-refere...
d084d49b5b74d775e4b493d08ff4dfa51999e3e537c1d997cfd1810f9fb3ddd5
Python
7,687
236
"""Kernels for SPD matrices.""" import numpy as np from .base import invsqrtm, logm from .mean import mean_riemann def kernel_euclid(X, Y=None, *, reg=1e-10, **kwargs): r"""Euclidean kernel between two sets of matrices. Calculates the Euclidean kernel matrix :math:`\mathbf{K}` of inner products of two ...
d06326248d8d63c38c7947d2141294301f6f3dcab8969890a73909aed3085f7b
Python
7,689
215
"""Step-qualified selectors (lane F42, attested coupling). The trace-verb verdict's evidence-bar item "selectors can name step versus pass": ``at_step(...)`` matches ops recorded inside declared episode steps at capture time (the armed join session's live step position) and post hoc (the persisted ``Op.episode_step`` ...
4c86aadedec0eaf6df714c9a5449b9d2ff95e2131bc8bd1933c80adfb9507bdf
Python
7,690
238
# Copyright (c) 2023 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...
0b487fced791343b8f1b20c1945f944c0d2ced25de50dc5cfe0edd904bb97379
Python
7,692
181
import torch as ch import dill import os from .tools import helpers, constants from .attacker import AttackerModel class FeatureExtractor(ch.nn.Module): ''' Tool for extracting layers from models. Args: submod (torch.nn.Module): model to extract activations from layers (list of functions):...
c0661ebcd476dac1ce69212441a2fbb895b539bed7a0f30bb74ecf158e612242
Python
7,692
227
''' use detectron2 library to detecated the person centered video ''' # %% import torch import numpy as np import detectron2 from detectron2.config import get_cfg from detectron2 import model_zoo from detectron2.engine import DefaultPredictor from torchvision.transforms.functional import crop, pad, resize # %% cl...
2e4a68311af4aa8f728536f8b50920caa02185d1d673ac68834007764dc571b8
Python
7,694
212
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import numpy as np import slowfast.utils.logging as logging import torch logger = logging.get_logger(__name__) def round_width(width, multiplier, min_width=1, divisor=1, verbose=False): if not multiplier: return width width *= m...
8b5dfe7fc0e9e59f4ff167cb3d38c76e283680906d890bf76807a7c4d31d1139
Python
7,694
203
""" ==================================================================== Offline SSVEP-based BCI Multiclass Prediction ==================================================================== Building extended covariance matrices for SSVEP-based BCI. The obtained matrices are shown. A Minimum Distance to Mean classifier i...
eefa0e830c479ca08af073a8b8caf47dd1d9aed7a146002e18fbf53e10c0c075
Python
7,694
255
import ast import importlib import inspect import pkgutil import sys import textwrap import pytest from numba import jit import pynapple as nap def valid_func(x): # do not call x.__class__ @jit def valid_func_decorated(x): x.__class__ def invalid_func(x): x.__class__() @jit def invalid_func_de...
d826c2a5b2dc38bf94e2196dcd60ef0928584a36f2585c18f59595cc1ee8af68
Python
7,698
210
"""Smoke tests for intervention Phase 2 selector resolution.""" from __future__ import annotations import warnings from dataclasses import FrozenInstanceError import pytest import torch import torchlens as tl from torchlens.intervention.errors import ( MultiMatchWarning, SiteAmbiguityError, SiteResoluti...
e71c962ad2536a6c33e75f18e432c0f0816c1d6b982ee18746b7aaeda6a3387f
Python
7,700
218
from model import common import cv2 import torch import torch.nn as nn import torch.nn.functional as F import numpy as np ### Lattice网络 def make_model(args, parent=False): return LatticeNet(args) ## Combination Coefficient class CC(nn.Module): def __init__(self, channel, reduction=16): super(CC, self...
abb4dc057617cc0e88d12e536b3a6fc3c96873dc5b01938f391d44650fec1938
Python
7,702
156
"""R45: `_state` raw-access exemption is declared AND pinned no-growth. ``torchlens._state`` is the sanctioned dependency-free toggle substrate: direct reads of its published globals from other torchlens modules (including the bare hot-path wrapper loads) are the documented design, exempt-by-declaration from private-m...
35553032ddb43fee3a960a42f9552ef027bb3fdccddde428be54e0d51d943195
Python
7,703
181
import datetime from contextlib import AbstractContextManager from typing import List, Optional from dependency_injector.providers import Callable from fastapi import HTTPException from carbonserver.api.domain.project_tokens import ProjectTokens from carbonserver.api.infra.api_key_utils import generate_lookup_value, ...
3456c3afd9ee5e37894c2e7b312ba94ce21d5fda61e5af65521c5fa2cc62031e
Python
7,704
234
import glob import logging import multiprocessing import os import warnings import numpy as np import tifffile as tf from scipy.optimize import least_squares from . import llsdir, util try: from numba import jit except ImportError: def jit(**_): def deco(f): return f return deco...
e478808b843e6f7bb63649ae95a7f5bc75466e3082cf4c527cc35a057d6a4e0b
Python
7,704
263
import numpy as np from tqdm.auto import tqdm from itertools import product import tensorflow as tf import pandas as pd import RNAutils import matplotlib.pyplot as plt import scipy.stats from matplotlib import cm def subsample_points(x, y, max_points=30000): assert(len(x)==len(y)) if (len(x)>max_points): ...