sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
25af59128e09ad35809bb5253e0dfa870a11d5aa12baae1427076b5eef0f5c3f
Python
20,327
477
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: bream/protocol_communication.proto """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflectio...
c2a5e60c61e9f3025853b70b6914244365928f98eaffcb66cb3632222a6001d5
Python
20,335
622
import bottle import subprocess import socket import logging import traceback import os import optparse import zipfile import datetime import fnmatch import tempfile import shutil import netifaces import json from ethoscope_node.utils.device_scanner import EthoscopeScanner, SensorScanner from ethoscope_node.utils.conf...
c01cac9ca2b210aa8ba26b78996aa86848ec3da756a5a08019fb0673bb9c6e4c
Python
20,352
596
from array_api_compat import array_namespace as get_namespace import numpy as np from numpy.testing import assert_array_equal, assert_array_almost_equal import pytest from scipy.linalg import solve_continuous_lyapunov from conftest import approx, to_numpy from pyriemann.geometry.distance import distance, distance_riem...
601f04b240ded6814c88699ef5cb634ac8ee1debb12a68ae299e7755748f55e2
Python
20,353
577
"""Code-derived universe censuses for the composition harness (compo rows 0.2-0.4). Every derivation here consumes the ONE shared source parse (``tests/_source_corpus.py``) -- independent AST walks are forbidden by the compo memo (section 3.2, "one parse, many universes"). The two diagnostic censuses: * **S-17 refus...
a73756171072c79bb3c810aaca94808d777d30520686876ca3933c3f74d40fd6
Python
20,356
561
import os import io import base64 import gc from datetime import datetime import warnings import rasterio import rasterio.features import rasterio.warp import numpy as np import matplotlib.pyplot as plt import ipyleaflet as L import PIL from tqdm.auto import tqdm from tlib import tutils from .utils import get_map fro...
c2c1ec153364dfea0f69aa093fcb463ab588b0d103649bb19653d02ae25b248d
Python
20,357
527
import os, sys import numpy as np import pandas as pd import networkx as nx from scipy.stats import mannwhitneyu from sklearn.svm import SVC from sklearn.metrics import accuracy_score from sklearn.ensemble import RandomForestClassifier from sklearn.feature_selection import SelectFromModel from sklearn.cluster import Ag...
2963f04339972d2a2b43f11f9a57855896f0198d74d9ba289e215f6bde6fb8fa
Python
20,358
479
import numpy as np from cuteSV.cuteSV_genotype import cal_CIPOS, overlap_cover, assign_gt import logging import pickle ''' ******************************************* TO DO LIST ******************************************* 1. Identify DP with samfile pointer; 2. Add CIPOS, CILEN and/or CIEND; ...
9ec85b1edf35e71cadd3ed2bb834cb1b7339a0095f86d321e8fab913d630b92a
Python
20,361
327
import gc import random import os from re import I from agents.model_1d import * from envs.tunl_1d import TunlEnv import numpy as np import torch import matplotlib.pyplot as plt from lesion_expt_utils import generate_random_index import argparse from tqdm import tqdm from numpy import array import re import sys sys.pat...
79779a94e0fb0f4982efd559e0b414fbee7f84f7a781af8cce41e1b01467d809
Python
20,366
534
import csv import os import shutil import tempfile import unittest from dataclasses import replace from unittest.mock import patch import pandas as pd from codecarbon.output_methods.emissions_data import EmissionsData, TaskEmissionsData from codecarbon.output_methods.file import FileOutput class TestFileOutput(unit...
3d771e5e7c8352efc0c1c82c4bb1057da17469aed46438979f72aa489dbee779
Python
20,368
672
import sys from functools import partial import torch from slowfast.models.attention import attention_pool, MultiScaleAttention from slowfast.models.common import drop_path, Mlp, TwoStreamFusion from slowfast.models.utils import round_width from torch import nn from torch.autograd import Function as Function class R...
4ede3d47ba63b30604056bd4f2bfe1906febf6cbeaa51e9d392630592afa04ba
Python
20,392
416
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ @author: Pramod Bharadwaj Chandrashekar, Li Liu @email: pchandrashe3@wisc.edu, liliu@asu.edu """ import argparse import os import time import pickle as pk import numpy as np import sklearn.metrics as skm import tensorflow as tf import DeepCORE_data_util as ddu from De...
f0d36f89e255b42771bc5d0cdb36bd7f6944497e09404989426339a7d22fd4b6
Python
20,393
555
"""Input-boundary walking: one inert authority, witnessed arity, bounded descent (B3 L4). Every case below was a live defect on main: * classification probed ``_fields`` through the LIVE instance (``hasattr``), so a hostile container's ``__getattribute__`` executed during ``snapshot_input_boundary`` -- the exact ...
6423b4759bed2569b86b1f6c643893a43c6a74915a15b691d25b92c5f04a684f
Python
20,394
423
""" Contains library functions """ import json import logging import os.path from typing import ( Any, Protocol, ) from markupsafe import escape from galaxy import ( exceptions, util, ) from galaxy.managers.collections import DatasetCollectionManager from galaxy.managers.collections_util import ( ...
4d8f26a3479c2784f23f25083bd4e776447f325116375741f8e7264b01f23a78
Python
20,396
621
""" Chemical composition of food, odors and the experimental timeline. Defines the compounds and substrates the larvae feed on, the odors sources emit, and the life history and air-puff events that structure an experiment. """ from __future__ import annotations import numpy as np import param from scipy.stats import ...
62ea45f82fb6f89d1ce43c8489fd8b668bdbe93a88a03209aa3a06a5072f3cc4
Python
20,403
574
""" Unit tests for Bug Report API endpoints. Tests bug report generation including node system information collection, device information collection, and error handling. """ import datetime import unittest from unittest.mock import MagicMock, Mock, patch from ethoscope_node.api.bugreport_api import ( DEFAULT_LOG...
11d373a839eee03b6826726a3eb3c8680e9c8d8c3a44d8dd157426cd73125ccc
Python
20,404
496
"""The tlspec FORMAT CONTRACT: L1 product vocabulary + record-adjacent helpers. The persistence four-way ruling (architecture memo 3.2): the format contract and its record-adjacent helpers -- ``TLSPEC_VERSION``, ``FieldPolicy``, ``BlobRef``, payload load hints, version read, fill-state defaults, container coercion -- ...
a2490822a4f23688eb3b78d05d9ad0d486b97437b42b8b233f3f164802769ed5
Python
20,414
752
# 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...
973d7d97502da0772da69d7fb5b619bf5efa9eb123e06a5fef290d2184c89004
Python
20,425
656
from __future__ import absolute_import, unicode_literals import io import os import sys import warnings import functools from collections import defaultdict from functools import partial from functools import wraps from importlib import import_module from distutils.errors import DistutilsOptionError, DistutilsFileErr...
c90ff5978d7cee1d642a9268911818e6b2978f72f36856c6378842239d718a49
Python
20,426
677
"""Tests of correlograms for `pynapple` package.""" from contextlib import nullcontext as does_not_raise from itertools import combinations import numpy as np import pandas as pd import pytest import pynapple as nap def test_cross_correlogram(): t1 = np.array([0]) t2 = np.array([1]) cc, bincenter = nap...
2aeadd19409175d52b65cc758bfc779df5a1c7b4c3bb5ef4f21b205c8df290ac
Python
20,433
370
import argparse import os os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" os.environ["CUDA_VISIBLE_DEVICES"] = "1" # specify which GPU(s) to be used from datetime import datetime import numpy as np import torch from torch.utils.data import DataLoader from external_src.group_free_3D.models import APCalculator, parse_...
043b2d853103b1d11647a5b8435180678d6c90c69d295a0d3884acd01527df32
Python
20,436
582
#!/usr/bin/env python """ Unit tests for TemperatureAlertMonitor class. Tests the temperature monitoring and alert system including: - Alert triggering when thresholds are crossed - Alert suppression after first alert - State reset when temperature normalizes - Configuration-based enable/disable """ from unittest.mo...
12b33a58c36e2a5c7995847fc3221a0b9e7d51bd4d21b579eb0f63070cce1453
Python
20,440
439
import numpy as np import pandas as pd import random import pkg_resources #from importlib import resources from collections import defaultdict from sklearn.preprocessing import OneHotEncoder def prepare_encoders(hla_class, enc_method): # load HLA pseudo sequence information for encoding if hla_clas...
fa81b59bb420e9ecefb7aab349933ed3a19b63597db7e8ec6a51ef44bc1d8b9a
Python
20,445
327
# -*- coding: utf-8 -*- """ Created on Wed May 13 08:41:56 2020 @author: Caterina Brighi """ #%% Import functions import matplotlib.pyplot as plt import matplotlib as mpl import SimpleITK as sitk import numpy as np import pandas as pd import datetime import os import glob import gzip import shutil...
b558c427b39f20292af05b44d27fcb9f66d46d3033bf9a4205b39a0748b8eed6
Python
20,454
529
# FAITHFUL PORT of deepmodeling/CrystalFormer @ main (original framework: JAX / Haiku) # # CrystalFormer: "autoregressive transformer conditioning on Wyckoff positions # and space group symmetry for crystal generation" (ICLR 2024). Source files: # crystalformer/src/transformer.py (make_transformer -> the network fn)...
eee02bee800d604b6c2ea37ec55076a01c7ce38acbec1fd2ad756cd7e85fc76c
Python
20,456
519
# --- 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 = "parcoords" _path_str =...
f3e691348aae03a0a7af92198fe5d5542b5c68b3be9d3a9ef2563d5e39fa97ce
Python
20,465
498
#!/usr/bin/env python # coding: utf-8 # In[1]: from __future__ import absolute_import, division from tqdm.auto import tqdm import torch import torch.nn.functional as F from trainingUtils import MultipleOptimizer, MultipleScheduler, compute_kernel, compute_mmd from models import Decoder, SimpleEncoder,LocalDiscrimina...
5da29e3cdfb773cd390bca95ea3d028454725acbe4c0d5a4eb5cacb690306938
Python
20,469
600
from __future__ import annotations import copy import json from pathlib import Path import panel as pn import pytest from larvaworld.lib import reg, util from larvaworld.lib.reg import config as reg_config from larvaworld.portal.config_widgets.preset_controls import ( ADVANCED_PRESET_POLICY, USER_PRESET_POLI...
67e6a2f0363da0b3f66430e74c3de88cf9a1087241d2086e457ba44195724881
Python
20,473
522
#!/bin/env python3 # This script simulates a virtual hardware sensor with its corresponding network service advertisements # and a RESTful API server. # It uses the Zeroconf/mDNS protocol for service discovery on a local network and the Bottle framework # for setting up HTTP endpoints. The virtual sensor can provide d...
3c5bd8f5f9d060066c80650d5a4f10f0862da2a8bcfc62e14333b1cc470f38dd
Python
20,477
574
import logging import os from collections import defaultdict from collections.abc import Callable from datetime import datetime from typing import ( Any, NamedTuple, Protocol, ) from galaxy import exceptions from galaxy.files.sources import ( BaseFilesSource, PluginKind, ) from galaxy.util.dictifia...
f8628e8413ad1ea468528ba3ea3f6e9becc0e9940adb6c6e2f65bf5e20be10be
Python
20,477
524
"""Unit suite for the M6 relation freeze (``_trace_core/relation_views.py``). Covers the conversion mechanics directly on synthetic stores — edge projection, differential CSR clearing vs explicit-view fallback, label resolution failure modes — plus the end-to-end behavioral surface on real captures: immutable views, C...
35249488e0005a5b7a236f04386f785a1a6e673aba21f7d2115f4ecd3a91d281
Python
20,485
648
"""Utility functions for extracting data segments of interest.""" import numpy as np from spiketools.utils.checks import check_axis, check_param_type ################################################################################################### ###################################################################...
416ba2f94a97ed8d3c201d51cf5fb54aa59b218b485d5ec5c3faa6bb9f81150b
Python
20,485
645
import contextlib import warnings import networkx as nx import numpy as np from numpy import linalg as la from scipy import linalg as spla from scipy import sparse as sps from scipy.sparse import csr_matrix, issparse, isspmatrix_csr, spmatrix from scipy.sparse import linalg as sparse_spla from scipy.stats import norm ...
583ba161ce888370f0686ca349299f9481ec9a1bac28a078c2c24ba7bffe41e7
Python
20,488
663
from functools import partial from array_api_compat import array_namespace as get_namespace, device import numpy as np import pytest from scipy.stats import hmean, gmean as gmean_sp from conftest import to_backend, approx from pyriemann.geometry.base import invsqrtm, logm, sqrtm from pyriemann.geometry.geodesic impor...
71b499f22cc87d2b827d344c2911f287594436d5d7066d1258c151afaeadda65
Python
20,491
611
""" Boxplots """ from __future__ import annotations from typing import Any, Optional, Sequence import itertools import numpy as np import pandas as pd import seaborn as sns from scipy.stats import ttest_ind from .. import plot, reg, util, funcs __all__: list[str] = [ "boxplot", "boxplot_PI", "PIboxplot...
0b10773c1138d184dc10e8f60d040372558c9196c2f1d0e22c2389a6893685d2
Python
20,493
476
#!/usr/bin/env python3 """ Dx BO — Deep HC-scoring AD subjects across cohorts (in-house data audit) ======================================================================== In-house data examination prompted by Spencer's recollection that the original ds004504 cohort had ~4 AD subjects scoring well into the HC range. ...
820321cf7ddb49414fe94c3d99a5a3e6a510e845c785154d74e19201d3332949
Python
20,494
583
"""Tests for source-code panel visualization.""" from __future__ import annotations import gc import getpass import html import inspect import os import re import weakref from pathlib import Path from typing import Any import torch from torch import nn import torchlens as tl from torchlens.visualization import code...
40cb5e148349c179688fe32392f7d45426dbc7f2dc6202d22448126c84014eb3
Python
20,499
463
"""Auto pipeline for image classification task""" # pylint: disable=bad-whitespace,missing-class-docstring,bare-except import time import os import math import copy import logging import pprint import json import pickle from typing import Union, Tuple import uuid import shutil import numpy as np import pandas as pd fr...
62d809da205efb018a60ea1757628dd5d473f5f0c17807514e9aba15967660fc
Python
20,499
536
#!/usr/bin/env python """Unified SM90 benchmark for forward and backward passes. Usage: # Default: bench fwd+bwd for hdim 64,96,128 at seqlen 8192 python benchmarks/bench_sm90.py # Forward only, specific hdims python benchmarks/bench_sm90.py --direction fwd --hdim 64,96 # Backward only python...
ffcdbfc9f1bc01a2cf46d79aa880adb3d72a99853b7df4cbedca47c1c69f6df7
Python
20,509
604
from typing import List, Dict, Tuple import bokeh import numpy import numpy as np import pandas as pd import scipy from bokeh import embed, layouts from bokeh.io import export_svg from bokeh.models import Span, Range1d, LinearAxis, ColumnDataSource, HoverTool from bokeh.plotting import figure from scipy import stats ...
d5a2d36f601f30ba64f187a10215de51dd0476f7844592cc9f4d7dc60a9088f3
Python
20,519
397
import numpy import voxcell class RegionHierarchyWrapper(object): def __init__(self, hierarchy_fn): self._tree = voxcell.RegionMap.load_json(hierarchy_fn) def region_ids(self, lst_regions): region_id_set = set() for region in lst_regions: region_id_set.update(self._tre...
a0653d88a7cbb254f9fba710cc0d61f51c67634580a33dace69530efc4cc4fe8
Python
20,524
527
# 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...
91a3278f6cd55ec3281621e007c63bde80565d1eb88b1e670ac65ae66c41be34
Python
20,530
551
# --- 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 Minor(_BaseLayoutHierarchyType): _parent_path_str = "layout.xaxis" _pat...
ce05f04de0742977bd29a0eb13abe2e01e448a4b2fc785b4a55158f78a3ebc11
Python
20,530
551
# --- 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 Minor(_BaseLayoutHierarchyType): _parent_path_str = "layout.yaxis" _pat...
4744ee1cfa1de8d038d66318e7a0e5b29c47a74987ecc8e2da0adbc857938306
Python
20,542
507
#!/usr/bin/env python3 """ File: picalo_graphical_overview.py Created: 2022/02/02 Last Changed: 2022/07/20 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 thi...
62331283333727b0f78392c27f969840dd1d332231c72ecca16ff8c0cd952063
Python
20,542
436
#!/usr/bin/env python # fix problems with pythons terrible import system import sys import os file_dir = os.path.dirname(os.path.realpath(__file__)) sys.path.append(os.path.join(file_dir, '../')) sys.path.append(os.path.join(file_dir, '../../')) # package import import prob2020.python.utils as utils from prob2020.pyth...
fe81ff29299346419b51fadfec6901b71103a2c9673bc7d319579c4fadbaf5a6
Python
20,543
580
""" From Niklas Wilming et al. Nature Communications 2020 https://github.com/DonnerLab/2020_Large-scale-Dynamics-of-Perceptual-Decision-Information-across-Human-Cortex """ import os from os.path import join import mne import pandas as pd import numpy as np from joblib import Memory from . import preprocessing import ...
f4ee106ad5b3e1a45020d7c7ca80a46e05730d517714a822bda8f3b1b3047f4e
Python
20,544
551
__author__ = 'luis' import logging import traceback from optparse import OptionParser from ethoscope.web_utils.control_thread import ControlThread from ethoscope.web_utils.helpers import * from ethoscope.web_utils.record import ControlThreadVideoRecording import subprocess import json import os import glob #from bott...
ba49fd1281845daf738a5d71b7074a0d0bd5945af48bcde0ba2a46b618bd4e1f
Python
20,547
518
#!/usr/bin/env python3 """ Dx BB — Severity stratification redo under proper per-fold ========================================================== Re-runs the Dx Y / Dx Y2 severity-stratified sensitivity analysis under the proper per-fold per-cohort-deployment pipeline used in draft v0.79 / v0.80, instead of the legacy ...
e9798c9422552b538dd4f72c87759c16264fc990a9b2b3114cdf2f5a05227060
Python
20,561
567
import numpy as np from absl.testing import parameterized from keras.src import dtype_policies from keras.src import layers from keras.src import models from keras.src import ops from keras.src import saving from keras.src import testing from keras.src.backend.common import standardize_dtype from keras.src.quantizers ...
d6c05aac897445b9040eed13c4c1c8e0ec8ce9e314378d7a32840ea2255da6ea
Python
20,565
563
import abc from abc import ABC from os import path from typing import Any from typing import Callable from typing import Dict from typing import Optional from typing import Tuple from typing import Union import dm_control import gymnasium as gym import mujoco import numpy as np from dm_control.mjcf import RootElement ...
9d1e43ee4abc1cb293d2d8a2526d81e467d251aa5ebff309d4911d8df21a981a
Python
20,593
527
""" This file contains the object and CLI for training our VAEs. The models themselves are in the `models/` directory. Each of these Python files should have a `build` function that returns a dictionary with entries for: encoder, decoder, and vae. We also require each model to define a corresponding `prepare_data` fu...
1ef89a038a58fa23d275b8d4c13e98f9eee643c0d13b79232cdb48bb6854699e
Python
20,595
341
# pylint: disable=wildcard-import, unused-wildcard-import, line-too-long """Model store which provides pretrained models.""" from __future__ import print_function __all__ = ['get_model_file', 'purge'] import os import zipfile import logging import portalocker from ..utils import download, check_sha1 _model_sha1 = {n...
847779ff1b064be4318a56f421d6a3af8b5ddd9087b6e3b1b6544d4d003a7704
Python
20,601
497
# %% import time # %% import brainpy.math as bm import matplotlib.patches as patches import matplotlib.pyplot as plt import scipy.stats from mpl_toolkits.axes_grid1 import make_axes_locatable from scipy.io import loadmat # %% __all__ = [ 'fig1', 'fig2', 'fig3', ] # %% dt = 1. time2len = lambda t: int(t / dt)...
90f885fef3e35ce96221074354f0c5cdeff00374d63b2d4d393e7d864c6b823d
Python
20,601
573
# -*- coding: utf-8 -*- from __future__ import print_function, division, absolute_import import torchvision.models as models import torch.utils.model_zoo as model_zoo import torch.nn.functional as F import types import re ################################################################# # You can find the definitions ...
763da4005823843940bc1778b1071d47fdb30f351b0cffbb4b047ebcfde556e3
Python
20,603
615
import os import json from pathlib import Path from typing import Union, List import importlib.metadata as importlib_metadata from packaging.version import Version import warnings import plotly from plotly.io._utils import validate_coerce_fig_to_dict, broadcast_args_to_dicts from plotly.io._defaults import defaults fr...
078081b7aee0e0f879df2f4a7f66f7dc1c2872114800a84b55b3f29e463d8832
Python
20,618
523
import os from process import * from training import * from model import * import torch import settings import time import pickle def main( ########## work_name, run_mode, data_mode, model_name, train_size, fingerprint, random_state, model_path, load_model, cuda_id, ###...
b075f26f963773af9ff5afc87d0ce8461387c2c68814b8341d4cf8831133d4a9
Python
20,620
468
"""Core API for Environment, Wrapper, ActionWrapper, RewardWrapper and ObservationWrapper.""" import sys from typing import ( TYPE_CHECKING, Any, Dict, Generic, List, Optional, SupportsFloat, Tuple, TypeVar, Union, ) import numpy as np from gym import spaces from gym.logger imp...
c49abc2aeffa32415892831183f08ba158aeb4652cc491aed01c45d0639b1476
Python
20,622
551
# --- 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 Marker(_BaseTraceHierarchyType): _parent_path_str = "icicle" _path_str = ...
d1e487e8a04094647016402f0e3a87b24fc230d30e8d09b9b098fbe4ce9117f9
Python
20,623
491
import random import matplotlib.pyplot as plt import networkx as nx import numpy as np import pandas as pd import scanpy as sc import scipy from sklearn.metrics import pairwise_distances, pairwise_distances_chunked from tqdm import tqdm from .visualize import link_plot def coords2adjacentmat(coords, output_mode="ad...
d0b8c7f5244f3f91677945861212e2eb995f9c50a60381b1eefe69c5894b6d9f
Python
20,634
427
from typing import Optional import pandas as pd import numpy as np import networkx as nx import scanpy as sc from sklearn.linear_model import LinearRegression as lr from matplotlib import pyplot as plt from matplotlib_venn import venn3 import matplotlib.ticker as ticker from matplotlib.pyplot import rc_context import...
361eb0e524a1a18c7b0604c9869e8e737d47de1e31ec0df4317d236d9d1f081c
Python
20,654
446
# -*- coding: utf-8 -*- from __future__ import print_function, unicode_literals, absolute_import, division import warnings import numpy as np from six import string_types from csbdeep.internals.probability import ProbabilisticPrediction from .config import Config from .base_model import BaseModel, suppress_without_ba...
01791482e16e14f73409fdcf620e7d8ae7f9f086d92cba20109c701e1d981463
Python
20,657
628
"""PYTEST_DONT_REWRITE Targeted corruption tests for Phase 6 conditional metadata invariants. """ from __future__ import annotations from collections.abc import Iterable import pytest import torch import torch.nn as nn import torchlens as tl from torchlens import trace as trace_fn from torchlens.data_classes.layer...
ebea615aedea9572f1e00e9ac25b814b75f64e737238ed06c4eabaf0bb9463dd
Python
20,663
555
""" Code here relates to the creation of stimulus waveforms from epoch tables. In the waveform editor of ClampEx, you can edit the stimulus waveform table for each channel (DAC). Each waveform table is made of epochs, which appear as a single column of values in the waveform editor. The overall strategy here is that ...
c9813ab7620e19a6acc2fa299c08be24d844a3d93be10dbc2329c745fd168b8a
Python
20,664
552
# --- 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 Marker(_BaseTraceHierarchyType): _parent_path_str = "sunburst" _path_str ...
142920d8b9e1303470f41d8ab01a1988ef774cf58a3e94744d5f76e92cd3df8f
Python
20,668
480
#!/usr/bin/python3 ########################################################################## ## ## ## Copyright (c) 2019 Philipp Lösel. All rights reserved. ## ## ## #...
5355c055d153b73fdd13f56a43782c9a583c3a88ac1391d8a46977992ba75221
Python
20,675
627
"""Regression tests for multi-output module handling.""" from __future__ import annotations from collections import namedtuple from collections.abc import Iterator from dataclasses import dataclass from typing import Any import pytest import torch from torch import nn import torchlens as tl from torchlens.errors im...
54295a2dc03fe2e871589ce4ae908592684ef8e7c43610a05a5657cbe09c2ab4
Python
20,679
555
"""Sibling-order rank groups sit in a cluster holding all members; failed ordered layouts fall back. Graphviz 16 fails ("trouble in init_rank"), crashes, or warns "already in a rankset, deleted from cluster" on a top-level ``rank=same`` set whose members sit inside clusters; a set emitted inside a cluster may span tha...
bb3bc73d79e7758eabf2865b2a4d92613b8ddcf0d26160f5b5498224d4b7b2d2
Python
20,689
525
"""Module that contain shard utils for dynamic data.""" import os, re from bioseq2seq.utils.logging import logger from bioseq2seq.constants import CorpusName from bioseq2seq.transforms import TransformPipe from bioseq2seq.inputters.dataset_base import _dynamic_dict from torchtext.data import Dataset as TorchtextDataset...
0a4640690f95c0822e417ec75868efb668dfda83c0a58510bd44c2761519df90
Python
20,707
569
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """Functions to support ingression of non-BIDS preprocessing derivatives.""" import filecmp import json import os import shutil import numpy as np import pandas as pd from nilearn import image, maskers fr...
06b0a0a398e18d2daed32d19de7c389113bd43a6f0ea617336cae0118635b201
Python
20,709
576
__author__ = "quentin" import logging # noqa: F811 import time import cv2 try: CV_VERSION = int(cv2.__version__.split(".")[0]) except Exception: CV_VERSION = 2 try: from cv2.cv import CV_AA as LINE_AA from cv2.cv import CV_CHAIN_APPROX_SIMPLE as CHAIN_APPROX_SIMPLE except ImportError: from cv2 ...
4807de3e16d91ed397249472ce50e3ff1eab988a85abac50281a6384316541b9
Python
20,712
544
"""Episode capture (capture_kind=episode): S7 ledger + typed refusals. Covers the L2 core contracts ratified at S2: the session ledger written at settlement, the monotone prefix law and token presence rule as load tripwires, every episode TYPED-REFUSE row, the E-A4 declaration-time refusal, teacher forcing as a disclo...
99aef12f18e368388453e68bc8a10df30c4dcc36b2504c489877ff1b52d56c7d
Python
20,716
456
r""" Homoclinic Continuation in a QIF Mean-Field Model =================================================== This example demonstrates PyCoBi's support for auto-07p's HomCont extension (:math:`IPS=9`, AUTO manual Ch. 20) via three new entry points: * The ``'hom'`` scenario in ``auto_constants=(...)`` generates a ``c.ho...
7397b5af87017cdfa4c9b546909b7f29a2e518aa1fb240e6071a9d3776b34aee
Python
20,738
528
# SOURCE: vendored from IDKiro/CBDNet-pytorch @ 09a2e55, ZitongYu/CDCN @ fd8370e, apourchot/CEM-RL @ 1a45822, MingLunHan/CIF-PyTorch @ 48c581e from __future__ import annotations from types import SimpleNamespace import torch import torch.nn.functional as F from torch import nn class CbdSingleConv(nn.Module): ""...
dd1a43e4e56943f6d0955c93d803ad562a1bd0adc3b6d40984813256d4010290
Python
20,742
512
"""Capability-table load-bearing conformance. The registered ``BackendCapabilities`` table must be the single authority for backend feature support, fail-closed in BOTH directions on EVERY backend: - Flag ``False`` refuses the corresponding public surface typed — torch included, so an in-place flip of torch's table...
e5263e578f810d652fdb442082e4f516e613ae3a78d7a30b57a1d9a70a1dae11
Python
20,743
645
"""Data-specific colormaps""" from itertools import cycle import logging from math import ceil from numbers import Real from typing import Sequence, Tuple, Union # colormath starts out at 0; needs to be set before init logger = logging.getLogger('colormath.color_conversions') if logger.level == 0: # otherwise it was ...
f8d269591cbb8f79490b529f4d0184d6694d315ac0904e95c3af986c7c345448
Python
20,743
557
"""Episode join arms (lane F40c): live + settlement ``step_join``. The trace-verb verdict's mid-call oracle break contract: per-row join grades (continuous / transformed / declared / exogenous / unchecked), the DEFAULT return-and-disclose arm with episode-dependent claims refused across a measured break, the FORK-4 ``...
9df74d4cecee8be82a6992d89f0b59e79ddf7eeb8c97978b3078d385ca7f9e72
Python
20,750
439
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license """ Check a model's accuracy on a test or val split of a dataset. Usage: $ yolo val model=yolo26n.pt data=coco8.yaml imgsz=640 Usage - formats: $ yolo val model=yolo26n.pt # PyTorch yolo26n.torchscript ...
aceca58f56f34951ed9e9ee7c3a7152c99647664ee6c8f25f701f867644674d4
Python
20,750
637
# Copyright 2025 Google. # # 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 writing, soft...
f1ee254cc08d5fdcc95e83dcd494816001d41d5547cc0e66f0dd1a3ddf96d99f
Python
20,753
630
# SPDX-License-Identifier: LGPL-2.1-or-later #!/usr/bin/env python #-*- coding: utf-8 -*- import os import time import calendar import sys from collections import OrderedDict, Counter import numpy as np from .general import check_directory h = u"antenna, incorrect transitions count, percentage of antenna recordings\n"...
1f8892df20264db0876b4b9d70e0acb57442066965568ecfeb91b4284c49a87a
Python
20,755
530
from spitfire.chemistry.flamelet2d import _Flamelet2D from spitfire.chemistry.flamelet import Flamelet from spitfire.chemistry.mechanism import ChemicalMechanismSpec from spitfire.time.integrator import Governor, NumberOfTimeSteps, FinalTime, Steady, SaveAllDataToList from spitfire.time.methods import AdaptiveERK54Cash...
0b5a6004b3c1c04da10d3f32e20b6d4e2d7e7c921d22f3d77f3fe81150981ffe
Python
20,759
470
#!/usr/bin/env python3 """run_downsample_wafer.py Top level command-line interface for downsampling images from a wafer from native resolution (4nm) to the pipeline resolution (typically 16 nm). Copyright (C) 2018-2026 Max Planck Institute for Neurobiology of Behavior This program is free software: you can redistr...
d5fa719ab97f1a9b26448c4a0205b48dc19893513260275389a905c8688a539e
Python
20,762
567
import torch import torchaudio import random import numpy as np import sys import chcochleagram from chcochleagram import compression from chcochleagram import cochleagram from chcochleagram import * def ch_demean(x, dim=0): ''' Helper function to mean-subtract tensor. Args ---- x (tensor): te...
612c3f2f4715265b0708986fd3a3bdd8414f95208eea0948671ed76fca0dbe67
Python
20,768
535
import logging import os os.environ["CUDA_VISIBLE_DEVICES"] = '2' os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" from argparse import ArgumentParser import json import re from tqdm import tqdm, trange from pprint import pprint, pformat import time from datetime import timedelta from shutil import copyfile import pytor...
dcdc89693dcc6823247cd50661e9772bcf7e7fb2d7f81f30b33a1de6a012911a
Python
20,769
478
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Nov 22 16:39:34 2020 @author: emilia """ import numpy as np import torch import itertools import seaborn as sns import matplotlib.pyplot as plt import src.plotting_funcs as cplot from scipy.stats import vonmises from src.helpers import check_path def ...
dee347b61f8242a286eb60e2dc88060431ea9bf192e66760f608c95970971e01
Python
20,771
563
"""Miscellaneous utility interfaces.""" import json import os import h5py import numpy as np import pandas as pd from nipype import logging from nipype.interfaces.base import ( BaseInterfaceInputSpec, File, OutputMultiObject, SimpleInterface, TraitedSpec, Undefined, isdefined, traits, ...
ba900d0b54f54239c55e9407139dc71494e58154254908df324d9c2e20921d16
Python
20,773
402
# 2022/2023 Josue Page Vizcaino pv.josue@gmail.com # Third party libraries imports import matplotlib.pyplot as plt import numpy as np import torch import torch.nn as nn from torch.utils import data from torch.utils.tensorboard import SummaryWriter from torch.utils.data.sampler import SubsetRandomSampler, SequentialSam...
f270c7e5640bdaa369ca9ff94a95a5b50c55bc6d4b8d70965ba3475b68f24522
Python
20,780
565
import multiprocessing import time from multiprocessing import Pool import networkx as nx import numpy as np import scipy.sparse from scipy.spatial import distance_matrix, minkowski_distance, distance from sklearn.ensemble import IsolationForest # Calculate graph, return adjcency matrix in 0/1 def generateAdj(featur...
a68b5e77e60ebe7263b82e21ad39212dc838218b0a15052f9f7251b00be87836
Python
20,782
544
"""Robustness sprint PR 2 — tensor-variant pre-flight guard + channels_last fix. Covers the tensor-variant subset of the catalog: - Meta tensors in inputs/params must be caught up front with a clear message rather than crashing partway through the 18-step postprocess pipeline. - Sparse tensors in inputs...
d2444b2f3d4ca4fb5abd8c5adf921fdd8406bb4b7ef76dd309557faedaa48328
Python
20,786
516
"""COCO evaluation utils""" # pylint: disable=line-too-long, redefined-builtin import contextlib import copy import io import itertools import json import logging import os import pickle from collections import OrderedDict import numpy as np import torch import pandas as pd from .. import comm from ...data.registry.c...
91302a81d99f9297c9d5f88cc254cb2ff392a58cdc5c1a22bd5a8c7b108a8d4b
Python
20,812
573
from functools import partial import matplotlib.pyplot as plt plt.switch_backend('agg') from tqdm import tqdm from rdkit.Chem import MolFromSmiles from rdkit.Chem import Draw import numpy as np import rdkit from rdkit import Chem from rdkit.Chem import AllChem import os import AttentiveFP.Featurizer from AttentiveFP.F...
b7616ed2b0079f200497902179343e9574ee86bddf13a0364d4ec2520e9d8f0a
Python
20,815
532
"""Hardening tests for loop/recurrence grouping (round-21, follow-up 2). Locks the fixes for the two round-20 review findings the first r21 loop fixer did not cover: * Exact parameter identity must not override module identity or non-tensor call semantics (review cluster 2). Two DISTINCT modules deliberately sharin...
b0ee873ba3029e8a8dde26ad589b32552e911bf92792e5d58b74c1887ce41122
Python
20,816
608
import os import numpy as np import matplotlib.pyplot as plt from tqdm.auto import tqdm from tlib import tutils from . import geotif from .utils import get_ndvi, get_evi, get_map from .landcover import plot_legend from .kml import subfolders_to_kml # plotter class Plotter: def __init__( self, ...
3ad46f2b3f3176997eeefdeafd94da4bd7dd06df57af33326a9811af9d2e05b3
Python
20,841
594
# Adapted from https://github.com/ELS-RD/kernl/blob/main/src/kernl/implementations/linear_layer.py # and https://github.com/openai/triton/blob/master/python/triton/ops/matmul.py from typing import Optional import torch import triton import triton.language as tl from triton.ops.matmul_perf_model import early_config_pru...
d4f67b3cc9d72456c5d0c74c87279a044488b14ed9b45d607bb4ce13713dcb5f
Python
20,845
476
import torch import torch.nn as nn import torch.nn.functional as F from opt_einsum import contract as einsum import torch.utils.checkpoint as checkpoint from util import cross_product_matrix from util_module import * from Attention_module import * from SE3_network import SE3TransformerWrapper from icecream import ic #...
531a8188eea7cb565f9880a6a16f50d979879a03493215f9f40eabef6f75697b
Python
20,847
441
#!/usr/bin/env python # fix problems with pythons terrible import system import sys import os file_dir = os.path.dirname(os.path.realpath(__file__)) sys.path.append(os.path.join(file_dir, '../')) sys.path.append(os.path.join(file_dir, '../../')) # package imports import prob2020.python.utils as utils from prob2020.pyt...
1c1188ce77a6232fa52283358a3144d14a53be6c182563697b1f324d491a5798
Python
20,861
577
import functools import math import re import shutil import rich import rich.console import rich.markup # See https://github.com/keras-team/keras/issues/448 # for below imports import rich.table from keras.src import tree from keras.src.backend.common import standardize_dtype from keras.src.utils import dtype_utils ...
5629c9082329faf46fc62b89b51133fb57720a671c3f8ae281b029c04636ce03
Python
20,864
498
from typing import Optional, Sequence, Tuple import torch import torch.distributed as dist from torch import Tensor from torch.nn import Module from lightly.loss.vicreg_loss import ( VICRegLoss, covariance_loss, invariance_loss, variance_loss, ) from lightly.models import utils from lightly.utils.dist...
e2b9e8a481e8350d269265e83dcd06f5a6940ad95d166925af3019960569fca1
Python
20,873
582
"""Compact faithful reimplementations for dependency-gated REIMPL3 batch 3. Paper: Graphormer, Exphormer, GVP-GNN, HyperNetworks, Occupancy Networks, GIRAFFE. The models in this module are deliberately small random-initialized PyTorch reconstructions of install-heavy architectures. Each keeps the audited load-bearin...
239a25d85cb0b73f88d3d8781fa9d05fc30d28219c276cc657f1b7e790e842ee
Python
20,874
570
"""Tests for PyTorch backend core utilities.""" import concurrent.futures import threading import numpy as np import pytest import torch from absl.testing import parameterized from torch._dynamo.testing import CompileCounter from torch.distributed.device_mesh import DeviceMesh as TorchDeviceMesh from torch.distribute...
840e8326aeac24b7a62b8f15825fe57cc933dfe5bfc79f6c6f34582842becbf4
Python
20,884
600
""" Body geometry of the simulated larva. Defines the stored body plans, the contour they generate, and the segmented body whose joints the locomotor drives. Also provides the sensor mounting points used by the touch modality. """ from __future__ import annotations from typing import Any, Optional, Sequence import n...