sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
8f55fe0f0f28cd2414e0afca5da8f68c4c6997594d4bbbb708a16f2fc9231d88
Python
17,353
437
"""L4 until= battery: truncation term, positive-claim cap, prefix projection. Pinned per the design-review-converged L4 design memo (sec 2-3) and S2 ratification sec 2: truncation is a run-result term, never a capture outcome; a truncated run never settles a positive claim; the prefix projection never loosens; the two...
ff71f56a65a8056f066b5c1ea179600a58eb1926eb456cd88f9fbe233ea123a0
Python
17,359
434
#! /usr/bin/env python import os import sys import pandas as pd import numpy as np import time from sqlalchemy import create_engine from sqlalchemy.pool import NullPool import multiprocessing import tqdm from itertools import repeat def get_gene_fragments(gene_df, restriction_enzymes, db, pchic=False): db.dispos...
c7b9a5f4a2c457bafc72e984a03f276fbcc6b70b2b0f780880815a50975b5237
Python
17,366
229
"""3. Inference with Quantized Models ===================================== This is a tutorial which illustrates how to use quantized GluonCV models for inference on Intel Xeon Processors to gain higher performance. The following example requires ``GluonCV>=0.5`` and ``MXNet-mkl>=1.6.0b20191010``. Please follow `our ...
bfd8b7e5193ded344d156a242a2b1eac765141fa5183897ca6fa4b30ff64c641
Python
17,369
445
""" The training function used in the finetuning task. """ import csv import logging import os import pickle import time from argparse import Namespace from logging import Logger from typing import List import numpy as np import pandas as pd import torch from torch.optim.lr_scheduler import ExponentialLR from torch.ut...
6e11d4f7de9db0093c51ddf0c5b635cf37f20a965bbb9b35ec10d8258f22e7d2
Python
17,379
436
""" ori_analys.py This module contains functions to run analyses of ROI orientation selectivity in the data generated by the Allen Institute OpenScope experiments for the Credit Assignment Project Authors: Colleen Gillon Date: October, 2018 Note: this code uses python 3.7. """ import copy from joblib import Pa...
24542433bc4b374e9a558c3f68704cb583952bf6e259a1998cc5042c0ad6de75
Python
17,381
426
__author__ = "quentin" import logging import cv2 try: from cv2.cv import CV_AA as LINE_AA from cv2.cv import CV_FOURCC as VideoWriter_fourcc except ImportError: from cv2 import LINE_AA, VideoWriter_fourcc import os class BaseDrawer: def __init__( self, video_out=None, draw_...
2d22e09fa53f4b32cfbe628071ccf559da489110bf16a9ffc5cfcad07e490b16
Python
17,381
469
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import argparse import time import os import sys from tqdm import tqdm from pathlib import Path import numpy as np import nibabel as nib import pandas as pd import torch import torch.nn as nn from torch.utils.data import DataLoader from utilities.adversarial_loss i...
8b9124db681e90ff02d44044a704c676f06d6bec31b7e9ab68bddf35ee9d6285
Python
17,381
464
import io import json import logging import os import re from collections import defaultdict import humanfriendly import numpy as np import pandas as pd from autouri import GCSURI, AbsPath, AutoURI, URIBase from .dict_tool import recurse_dict_value logger = logging.getLogger(__name__) def get_workflow_root_from_ca...
e5cdc5af652f1cbf203f5090569a5b88a43a7e3385060911ae4295525e408b74
Python
17,384
536
import warnings from pathlib import Path from typing import ( Any, Dict, Hashable, Iterable, Literal, Mapping, MutableMapping, Optional, Tuple, Union, cast, ) import numpy as np import pandas as pd import polars as pl import xarray as xr import zarr from numcodecs import Blo...
1cdf6f1370a913959f190f474f4e0df4c508613f52867792e364526d6ee484a2
Python
17,386
479
# 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...
eca455a5626260b18c3e36b91eb6563d7fd43520fd61f6914f312df591a37588
Python
17,387
428
from datetime import datetime, timedelta, timezone from threading import Event, Thread from time import monotonic, sleep from uuid import uuid4 from zoneinfo import ZoneInfo import pytest from dateutil import tz as dateutil_tz from celery import beat from celery.schedules import crontab from t.integration.tasks impor...
724e55be98dce79b5c6aeb68031f17aa85bd8c1e9f75bd2567bdc29826f2e920
Python
17,391
551
"""JAX backend derived-gradient preview tests.""" from __future__ import annotations from typing import Any, cast import pytest import torchlens as tl from torchlens.backends import BackendUnsupportedError from torchlens.backends.jax import GradOptions from torchlens.backends.jax.backend import ( _experimental_...
ecc9cd86040f7f81cc69464bb1886c72e4f1dd09d93c50f3bbffd4af3f81bbf8
Python
17,392
383
""" For analyses of flatmaps """ import numpy import math import random import voxcell import matplotlib.pyplot as plt from voxel_maps import coordinates_to_image import os import pandas as pd from scipy.spatial.distance import pdist, squareform # Function below provides a wrapper that turns a function with multipl...
e81f9b089638cd9549d121bb447c5acf47f6af9318808d2e114c2448927dffe6
Python
17,394
511
__author__ = 'quentin' from collections import deque from math import log10, sqrt, pi import cv2 try: CV_VERSION = int(cv2.__version__.split(".")[0]) except: CV_VERSION = 2 import numpy as np from scipy import ndimage from ethoscope.core.variables import XPosVariable, YPosVariable, XYDistance, WidthVariabl...
00a05d6d85c3e6a0d3704d73e12c1608f90956a70962d1dc00655b2aeef73354
Python
17,395
452
"""W051-IO: load-time integrity anchors the loader never checked (AUD-CODE 3.0). (a) forged ``Op.edge_substitutions`` carriers, (b) manifest <-> metadata anchors and op-graph coherence, (d) TorchLens-owned annotation families, (e) an absent ``root_entry_point`` on a tlspec v9+ artifact. Tampering is done on the bytes ...
ce08b39324f4bfb24a7519f2e7f989eb5c3a19d75bdaa68cc83f2ed76032e4ec
Python
17,397
323
from os.path import join import numpy as np import matplotlib.pyplot as plt import os from mpl_toolkits.axes_grid1.inset_locator import inset_axes from pycircstat import mean as cmean from library.comput_utils import circular_density_1d from library.script_wrappers import best_worst_analysis, exin_analysis from library...
4322b59d19a095273ab3ce7c7c3c40a716f11efdf81d30f4ddda9bdb8d870a6c
Python
17,398
467
import matplotlib.pyplot as plt from joblib import load import scipy.cluster.hierarchy as sch import pandas as pd import figutils import sequence_logo from quad_model import * def get_link_midpoint( link_function, midpoint=0.5, epsilon=1e-5, lb=-100, ub=100, max_iters=50 ): """Assumes monotonicity and smoot...
24fdf747b45ac62d4b8d0cb7491703b95192a29b626171030007b3a4578ef332
Python
17,400
503
import numpy as np import os import json import itertools import copy import multiprocessing import pandas as pd import networkx as nx import PIL.Image import warnings from pathlib import Path from typing import List from nway.pairwise_matching import PairwiseMatching from nway.schemas import NwayMatchingSchema, NwayMa...
dfe3dbfd8652a881799edabb58ba2af4b5010e7ff0a3399391ad35ec9d6d844e
Python
17,408
459
# Copyright 2022 Deepfold Team # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
94a0e5d8d1ef023ac621e5eab126cbe1b106d53c7499eaa488aa6e88fc7d6149
Python
17,411
413
""" To Test: - upgrading with missing secret raise exception - upgrading removes old secrets - upgrading with partial variables keeps the old one - upgrading with no variables works just fine - upgrading and missing variables raises exception """ import logging from uuid import uuid4 from pydantic import UUID4 from ...
bbac1a0739dddf2871a981adb02e56f99fafe4081cd94e71eb684afbc9af6639
Python
17,412
514
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import numpy import torch import torch.nn as nn import torch.nn.functional as F from slowfast.models.common import DropPath, Mlp from torch.nn.init import trunc_normal_ def attention_pool(tensor, pool, thw_shape, has_cls_...
5e50d1401fc2e0e797be93ae1f4a30a9af8e621c243ee05ada3ac83b8089f61e
Python
17,424
551
"""Adapted interfaces from Niworkflows.""" import os import shutil from json import dump, loads import filelock import nibabel as nb import numpy as np from bids.layout import Config from nipype import logging from nipype.interfaces.base import ( BaseInterfaceInputSpec, Directory, DynamicTraitedSpec, ...
7c670d362c06f66bcccd1e717857737dbafad30dbe561f1eb45c7559b616e791
Python
17,425
491
# SOURCE: vendored from ujscjj/DPTNet @ master # https://github.com/ujscjj/DPTNet/blob/master/models.py # https://github.com/ujscjj/DPTNet/blob/master/transformer_improved.py # https://github.com/ujscjj/DPTNet/blob/master/utils.py # # DPTNet (Chen, Mao & Liu, Interspeech 2020, arXiv:2007.13975) speech # separation: a d...
28b0fa1cdca9b5b76deee75c5266f2414ced17ac1908b6a1884318dfbf7c9686
Python
17,433
480
"""Adapted from: https://github.com/facebookresearch/moco. Original work is: Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved This implementation is: Copyright (c) PyTorch Lightning, Inc. and its affiliates. All Rights Reserved This implementation is licensed under Attribution-NonCommercial 4.0 In...
e7df69ee50b9436774457dda1cd5be2af080de7c9f187ef8e0de726c14e3be8a
Python
17,434
345
# pylint: disable=line-too-long,too-many-lines,missing-docstring,arguments-differ,unused-argument __all__ = ['I3D_InceptionV3', 'i3d_inceptionv3_kinetics400'] from mxnet import nd from mxnet import init from mxnet.context import cpu from mxnet.gluon.block import HybridBlock from mxnet.gluon import nn from mxnet.gluon...
d30629f0a955b0caedf3aabf41384b9ff45e1ff172ae3ec0d5cb9ce0cf21967e
Python
17,438
447
# coding=utf-8 # Copyright 2023 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...
63fae672b96ef57e7d8c81c6e6a9ab7932f8d1397d8f4ac6bbd2b7639dd28ad5
Python
17,442
442
import datetime from tqdm import tqdm import operator from collections import defaultdict, Counter import pandas as pd import numpy as np from ..utils import constants import random latitude = constants.LATITUDE longitude = constants.LONGITUDE date_time = constants.DATETIME user_id = constants.UID class MarkovDiaryG...
9be3549717301c17c7cca7aa7e12f53d818d3b3f5e8a2952a40a4baee15d5b80
Python
17,457
529
"""Tests for failed-forward partial fastlog Recordings.""" from __future__ import annotations from pathlib import Path from typing import Any import pytest import torch from torch import nn import torchlens as tl import torchlens._state as torchlens_state import torchlens.capture.projections as fastlog_state from t...
830e96d519e80c41730a8eaaddeffd31d69c33c924b4186781cabd19f14dcb08
Python
17,459
438
import warnings from keras.src import backend from keras.src import layers from keras.src.api_export import keras_export from keras.src.applications import imagenet_utils from keras.src.models import Functional from keras.src.ops import operation_utils from keras.src.utils import file_utils BASE_WEIGHT_PATH = ( "...
66ffc8c81bbc952483cf5a2c984cc3682670a07d969220d3601cc9be5c86e7ef
Python
17,470
440
# -*- coding: utf-8 -*- """ the main app for part classification """ _debug = True _using_saved_model = True # use the checkpoint _calculating_gflops = False # calc computation cost BATCH_SIZE = 200 # if dataset is small, make this bigger EPOCH_COUNT = 50 INIT_LEARN_RATE = 5e-3 # batch_normalization ne...
38622d3c0889db793685966431aaabbee02d8ff409770e454ffdd33f999d7020
Python
17,472
440
"""Basic class for TreeGrower Algorithms for space colonization""" import logging import numpy as np from numpy.core.umath import clip from tns.morphmath import sample from tns.generate.algorithms.tmdgrower import TMDAlgo from tns.generate.algorithms.common import section_data from tns.morphmath.bifurcation import di...
b767958d12888ff9460fd626c6dcc89c19a07da6b098819ad9aab2c91b6a80bd
Python
17,474
469
import logging from contextlib import contextmanager from unittest.mock import ANY, Mock, patch import pytest from kombu.utils.limits import TokenBucket from celery import Task, signals from celery.app.trace import LOG_RECEIVED from celery.exceptions import InvalidTaskError from celery.utils.time import rate from cel...
1ece2b4cf88807b7da10469196042bb19dad83005e907b6a73bf136932258199
Python
17,478
340
# -*- coding: utf-8 -*- import os import time from tokenize import group from joblib import parallel_backend import torch import torchvision import torchvision.transforms as transforms import platform import matplotlib.pyplot as plt import numpy as np import torch.nn as nn import torch.nn.functional as F from optical_l...
f725a362465ab3fa94fa12c1aba2ef775720a462ad306aaae4c51b1aabce6e00
Python
17,479
488
from torch_geometric.data.data import Data import torch import copy import numpy as np import random import time class ensemble(object): """ The class ensemble represents the main user API for the Ensemble_GNN package. """ def __init__(self, gnnsubnet=None, method="chebnet", epoch_nr: int = 50, ni...
0300ff0a37d5cd7eb9de75b8fe2d14e1b9053021b86482e83198b1c8bf02678a
Python
17,490
500
""" This module provides helpers for C++11+ projects using pybind11. LICENSE: Copyright (c) 2016 Wenzel Jakob <wenzel.jakob@epfl.ch>, All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions...
c62e75522b2b16937e9b13131f520406c0f41e83aaba2db2a9d075be51b2832a
Python
17,494
380
# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # ------------------------------------------------------------------------------ from __future__ import absolute_import from __future__ import d...
32ae8dbe732c4bde8430dc1df973a89132736dfe8430b207215f932abd3675a6
Python
17,497
393
""" Author: Derek van Tilborg -- TU/e -- 23-05-2022 A collection of random functions that are used in different places - Data: Class that holds all data, featurizes it, and can augment it - featurize_data() - shuffle() - augment() - get_config(): functio...
4c986eb258efd801aba9c83109cd65476a1a16503ea0f1cbe24057b57535331e
Python
17,498
505
r""" Comprehensive DEB prediction pipeline with multi-scenario analysis, k_X sensitivity, closed vs. stepped engine comparison, and environment-coupled gut integration. This module orchestrates: 1. Instar moult calculations (t1, t2, L1, L2) from MATLAB DEBtool formulas 2. Multiple functional response values (f, f_DR, ...
f5baa9eacabfdf27a670cd527dd07b7b933a3f1406fe94f4d07d036f3d9893aa
Python
17,514
411
# pylint: disable=missing-function-docstring, line-too-long, unused-argument """ SlowFast Networks for Video Recognition ICCV 2019, https://arxiv.org/abs/1812.03982 Code adapted from https://github.com/open-mmlab/mmaction and https://github.com/decisionforce/TPN """ from mxnet import init from mxnet.context import cpu ...
7022aa427918870062eb3c43f0c04c0cc703d62a9438639746c4b5505ab25bb5
Python
17,521
445
# --- 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 Label(_BaseLayoutHierarchyType): _parent_path_str = "layout.shape" _pat...
142d00ba1d79e4835256bd2dd552e99483a459878e6c7864f52029c342a362bf
Python
17,529
419
"""F26: the tier-P/M watch engine -- step law, cadence, loud failures. Realism rule: the tier-M rows run against a REAL config-built GPT-2 (transformers), zero network; tier-P rows use a real MLP + AdamW loop. """ from __future__ import annotations import pytest import torch import torchlens.trackers as trk from to...
9ddfe2fe16e4ca3ce27522a3154aff1c7e9c589f055bf4d2c319f42d2c142889
Python
17,535
489
import torch import torch.nn as nn import torch.nn.functional as F from torch_geometric.nn import GCNConv, GATConv, global_max_pool as gmp, global_add_pool as gap,global_mean_pool as gep,global_sort_pool from torch_geometric.utils import dropout_adj # GCN based model class GNNNet(torch.nn.Module): def __init__(s...
cc7ab65d58e8447aea5bf7e7456f1c0ede7a9f937a7d7177f181fa102503d36a
Python
17,536
477
""" Test to verify that rapl_include_dram and rapl_prefer_psys parameters work correctly. """ import logging import sys import pytest from codecarbon.core.cpu import IntelRAPL @pytest.mark.skipif(not sys.platform.lower().startswith("lin"), reason="requires Linux") def test_rapl_include_dram_default_false(tmp_path)...
97b9573b7133f21ae754a8e20b4bfb233f32cd0fbd6eeb39c5d426fb999ecbad
Python
17,539
449
import sys from lmfit import Model, Parameters import math import numpy as np import powerlaw from scipy import stats from scipy.stats import mannwhitneyu from scipy.optimize import curve_fit import utils def Linear(x, m, b): return m*x+b def PRW3D(t, S, P): return 3*((S)**2)*((P)**2)*(np.exp(-t/P) + t/P - ...
9a1cf69f831fced199330e5652e867866e040613d737b90842e7633db07e9290
Python
17,541
471
"""Source-embedding privacy policy for portable saves (split from scrub.py). Every source-file reference in a bundle is relativized to a bare basename (absolute paths embed the producer's ``$HOME``, OS username, and filesystem layout -- host PII with no portable value), and ``include_source=False`` drops source text, ...
8e3325d372d8bd591e7afe848a7f379d5b1bc162537f84a5ec49e7a15d7153a8
Python
17,545
367
import csv import torch.nn as nn import torch.nn.functional as F import torch from torch import optim from torch.autograd import Variable from torch.utils.tensorboard import SummaryWriter import cv2 from skimage import segmentation import numpy as np import openslide import matplotlib.pyplot as plt import...
61afdd7a98b2abdc8b578b408393bfa113bb5d4ba2a4f62f35ef7107a408a675
Python
17,546
406
""" Tests for pcmci.py, including tests for run_pc_stable, run_mci, and run_pcmci. """ from __future__ import print_function from collections import defaultdict from distutils.version import LooseVersion import numpy as np import pytest from scipy.special import comb from tigramite.pcmci import PCMCI from tigramite.in...
886365b66c9abd2dd9f29e34f0589f9ab8b610ee04a618794e94dacb28cb9a62
Python
17,553
415
import functools from keras.src import ops from keras.src.ops import linalg from keras.src.quantizers.calibrator import Calibrator from keras.src.quantizers.quantizers import compute_quantization_parameters from keras.src.quantizers.quantizers import dequantize_with_zero_point from keras.src.quantizers.quantizers impo...
c99f51e13cf538c768e3ba022a08673e2c18f3953e4e64f0c36cd062b6c64458
Python
17,560
564
"""Convert BDD100K to COCO format.""" import argparse import json import os from functools import partial from multiprocessing import Pool from typing import Dict, List, Tuple import numpy as np from PIL import Image from scalabel.common.parallel import NPROC from scalabel.common.typing import NDArrayI32 from scalabe...
23037e12a7b4b6075cef38c3c71e594784898e8fe8d1848a2dc2635c391c8fa9
Python
17,569
574
""" R objects as Python objects. The module is structured around the singleton r of class R, that represents an embedded R. License: GPLv2+ """ import array import os import types import typing import warnings import rpy2.rinterface as rinterface import rpy2.rinterface_lib.embedded import rpy2.rinterface_lib.openrl...
a34d4be2b9b04981a64d779831a00449eab4f367a2b3554ee67c2a5bad190992
Python
17,569
424
"""Flash-Linear-Attention token-mixing layers (faithful recurrent reference forms). Source: fla-org/flash-linear-attention (``fla/layers/*.py``, ``fla/ops/*``). These are linear-attention / gated-RNN sequence mixers that replace softmax attention with an explicit recurrent state update. Each block here reproduces the...
bc22f332498e369d1416913ce538b96b1dba5144252ff6c1c14e058dce4a86e5
Python
17,573
441
import os import numpy as np import pickle as pkl import nibabel as nib from os.path import join as pjoin from scipy.stats import pearsonr, zscore from magicbox.io.io import CiftiReader, save2cifti from cxy_visual_dev.lib.predefine import proj_dir, Atlas,\ s1200_avg_eccentricity, LR_count_32k, get_rois,\ s1200_...
471b2c482248d782b93881c5e834c0edc23c1e7e6f42a437e4c096b9d8ed4c3e
Python
17,580
367
from functools import partial from typing import Any, Callable, List, Optional, Sequence, Tuple, Union from torch import nn, Tensor import torch.nn.functional as F from torchvision.ops.misc import ConvNormActivation from torch.hub import load_state_dict_from_url import urllib.parse from models.mn.utils import cnn_out_...
b09e7ffd992d87ef74c226225662b242cf229352acddd442cf21a86579cabbbd
Python
17,593
461
# -*- coding: utf-8 -*- """ Created on Sun Aug 3 15:18:38 2014 @author: Dan Denman and Josh Siegle Loads .continuous, .events, and .spikes files saved from the Open Ephys GUI Usage: import OpenEphys data = OpenEphys.load(pathToFile) # returns a dict with data, timestamps, etc. """ import os import numpy as np...
bba2f233ecbb12200cd94cc5fc8f6098f4b38ead91369f90e91f8b6e4efa063f
Python
17,593
542
#!/usr/bin/env python """ run_paper_figures.py This script produces paper figures for this project. Authors: Colleen Gillon Date: January, 2021 Note: this code uses python 3.7. """ import argparse import copy import inspect from pathlib import Path import time import warnings # try to set cache/config as early ...
bb9856eae0a5c40d010eacd0b066e7a93a40bae195c6e67da2583ca53d6692fd
Python
17,601
498
""" module to handle detectron2 integration of CAP (requires detectron2 installation) """ # from google.colab.patches import cv2_imshow from detectron2.config import configurable from detectron2.engine.defaults import DefaultTrainer from detectron2.data.build import build_detection_train_loader from detectron2.d...
44035b2ef945e0b4b50f97ac4ad3caeedb014fdd98bbfbaa7ee7c6e32130ce8a
Python
17,602
451
from keras.src import activations from keras.src import backend from keras.src import constraints from keras.src import initializers from keras.src import ops from keras.src import regularizers from keras.src.api_export import keras_export from keras.src.layers.input_spec import InputSpec from keras.src.layers.layer im...
85428621a91f3c484ebb879e703790fcb070a2e660ecd344b9917274330f4df9
Python
17,613
405
import os import math import random from functools import reduce import torch import torch.nn as nn import re import numpy as np from transformers import * from src.utils.util import device class adapet(torch.nn.Module): def __init__(self, config, tokenizer, dataset_reader): ''' ADAPET model ...
ac4d2cab3f72ea0f9217860a55dca413ed69f936ce0322efebc1c9ae050285b8
Python
17,613
497
import locale locale.setlocale( locale.LC_ALL, 'en_US.UTF-8' ) import re import dateparser try: from local_extractor.utils import common_utils from local_extractor.utils.table_concatenation import concatenate_tables except ImportError: import sys, os, pathlib path = pathlib.Path(__file__).absolute().p...
ad8348a16efca92f0acca8e42d8ce5d0e9941c2fdb5157b931f4528878c94263
Python
17,614
496
from typing import Callable from hypo_x import hebb_update, fsm_step from dataclasses import dataclass, field import jax import jax.numpy as jnp from functools import partial import numpy as np from data_gen_x import gen_data_x """ Condition Functions """ def an_cond(i, _): """Active nothing condition :param ...
112967c62dd867a02962573ecc9e00b9fe4fd563bd8eba38cc9ba32bafb76ab8
Python
17,615
380
import argparse from loader import MoleculeDataset, load_data import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from sklearn import metrics from sklearn.metrics import roc_auc_score,accuracy_score,precision_score,recall_score,precision_recall_curve,f1_score from skle...
43592845e40bcd66fb395024e630aa2bf693fc69a923cce42c381acca621452b
Python
17,616
386
from ...core.trajectorydataframe import TrajDataFrame from ...utils import constants, gislib from ...measures import individual import numpy as np import pandas as pd import math from collections import Counter import operator import pytest earth_distance_km = gislib.getDistance latitude = constants.LATITUDE longi...
2fdf62ee393ab66f9338a45f96e2dfd74f4a776498e8f8ca4441e10d9960eb47
Python
17,618
537
"""Tests for the Explore app: the zero-configuration entry point.""" from __future__ import annotations from concurrent.futures import Future from html import escape from queue import SimpleQueue from types import SimpleNamespace from unittest.mock import PropertyMock import panel as pn import pytest from larvaworl...
7b23e244f2f354beb43ae5548b5ca57dd864215da6f3a215ed32974d97a33c59
Python
17,621
476
#!/usr/bin/env python """ run_logreg.py This script runs and analyses logistic regressions predicting stimulus information based on ROI activity for data generated by the Allen Institute OpenScope experiments for the Credit Assignment Project Authors: Colleen Gillon Date: October, 2018 Note: this code uses pytho...
7297a5042c7987a1a13d763f1c9d20e7c9b22fdf5b2f62e906e44a7b2c378a7f
Python
17,624
437
import random from typing import Optional import mujoco import numpy as np from angorapy.common.const import N_SUBSTEPS from angorapy.tasks.envs.dexterity.consts import DEFAULT_INITIAL_QPOS from angorapy.tasks.envs.dexterity.consts import FINGERTIP_SITE_NAMES from angorapy.tasks.envs.dexterity.core import BaseShadowH...
c6c52dd3e458f0c7065eead8ba9b267df5c3e13f6d9d109d0d772b6db60edf83
Python
17,624
367
from __future__ import generators import logging import glob, os, functools import sys sys.path.append('../TM2_segmentation') import SimpleITK as sitk from scipy.signal import medfilt import numpy as np from numpy import median import scipy import nibabel as nib import skimage import matplotlib.pyplot as plt import sci...
03fb6a69ec7af0f738924eaaca93eea3973e471e2b14d04c6144761a4d864b56
Python
17,627
432
"""model.py - Model and module class for EfficientNet. They are built to mirror those in the official TensorFlow implementation. """ # Author: lukemelas (github username) # Github repo: https://github.com/lukemelas/EfficientNet-PyTorch # With adjustments and added comments by workingcoder (github username) and Alex...
eca1923f55dc9c1f671fbbd0322ca01f5ea067ad3671b7a10803b7ea8681bb9d
Python
17,631
505
"""Reader for Neurosuite/Neuroscope formatted electrophysiology data. Handles: - XML metadata parsing (channel count, sampling rates, channel groups) - Binary signal files (.dat, .eeg, .lfp) via memory mapping - Spike sorting results (.clu.N / .res.N pairs) - Event files (.evt) with automatic pairing of start/stop eve...
3769cad1f9e6c0f1c00e6bc18c01c1ec316e24272d87306e516e15ba414b40de
Python
17,639
353
import torch import torch.nn.functional as F from torch.utils.data import DataLoader from torch.distributions.categorical import Categorical import os import sys import argparse import numpy as np import math from copy import deepcopy from model import BIML_S, describe_model import datasets as dat from train_lib import...
d3dfc85fdfba861e150b9f97481461ade511d82c20381ca4412b03ab9bfb3c6d
Python
17,639
432
"""Library for exporting SavedModel for Keras models/layers.""" from keras.src import backend from keras.src.api_export import keras_export from keras.src.export.export_utils import get_input_signature # Re-export for backward compatibility (used by tfsm_layer.py) from keras.src.export.saved_model_export_archive impo...
5292eb9d6ed17ad9a9f8f549e4aec572ce0249a5be65190704f63bfd5ebe0707
Python
17,646
446
# --- 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 Label(_BaseLayoutHierarchyType): _parent_path_str = "layout.newshape" _...
b3627f2104b84ce71e27ec64fc2097252759423016b284fb6d4225f663593c67
Python
17,659
423
"""Real-model transform rows (memo 10.2; lane F19). Offline, cache-gated. The realism rule discharged on the transforms library itself: real checkpoints, real tokenizers, real ragged shapes — NEVER downloads. Vision rows skip typed where their cached checkpoint is absent; tokenizer rows run only in the R1 offline venu...
fd2de011d56136af54234c36a3505be414a15b6735f84d74162ff08ecd61a02a
Python
17,664
349
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations from collections import deque from typing import Any import numpy as np from ultralytics.utils.metrics import bbox_ioa from .basetrack import TrackState from .byte_tracker import BYTETracker, STrack from .utils i...
2a10e2f10cd72caa755b64509cf0accceb13b447a14563048861f0fb04e9cf56
Python
17,671
347
from keras.src import backend from keras.src.api_export import keras_export from keras.src.backend.common import is_float_dtype from keras.src.backend.common import is_int_dtype @keras_export("keras.random.normal") def normal(shape, mean=0.0, stddev=1.0, dtype=None, seed=None): """Draw random samples from a norma...
cc4ea65d57ade4f76c6f7016f66e0e4885d28179f0523411e6b54d57394f0cf4
Python
17,672
493
import numpy as np from sklearn.utils.validation import check_random_state from ..utils.mean import mean_riemann from ..utils.distance import distance_riemann from ..utils.base import invsqrtm, powm, sqrtm, expm from .sampling import generate_random_spd_matrix, sample_gaussian_spd from ..transfer import encode_domains...
a58df147f5e314a2de30277b4e8ff7c88b0245138f84cddcc282e6d252cb0521
Python
17,677
405
''' Tools for online output to display/download. ''' import re import os import argparse import glob import logging import json import time import zipfile import tempfile import os.path as osp from typing import Union import numpy as np import pandas as pd from tools.draw_results import draw_pae, draw_interface_h...
680ff207ff37305dff2743ceb6c858a73ab389bc2ed89cc41d16faac73ca8af3
Python
17,680
458
import numpy as np import torch import pandas as pd from lifelines.utils import concordance_index from lifelines.statistics import logrank_test from lifelines import CoxPHFitter from sklearn.preprocessing import MinMaxScaler from survival_plus_x.losses.coxph import neg_cox_log_likelihood,\ neg_cox_log...
dc2c608546c7b011f46e0b2a1bb248c2fc14e182983224bc4f016a8aedfb3a7f
Python
17,681
373
import random import os import numpy as np import paddle import paddle.nn as nn import paddle.nn.functional as F import joblib import pgl.graph as G from paddle.io import DataLoader from .maml import MAML from ..datasets import sample_meta_datasets, sample_test_datasets, MoleculeDataset from ..utils import Logger cla...
24ed366b15c76184914308826564e79689b01c2420143f48dfbb7135051e200e
Python
17,683
355
from mirp.data_import.import_image import import_image from mirp.data_import.import_mask import import_mask from mirp._data_import.generic_file import ImageFile, MaskFile, MaskFullImage from mirp._data_import.dicom_file import ImageDicomFile, MaskDicomFile from mirp._data_import.dicom_file_stack import ImageDicomFileSt...
c2a35008cb736e278cc7a22aa2c2ed2a71e0309ca777a345cfff6eb5b9c48e4e
Python
17,688
548
''' Copyright 2021 Twente Medical Systems international B.V., Oldenzaal The Netherlands 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 requir...
71a70d5eb37379c90f40d8f612ebaddba211ed7ad7f58ed825c413c2e2419886
Python
17,690
513
""" To test it, you need to set: export CODECARBON_API_URL=http://localhost:8008 export DATABASE_URL=postgresql://codecarbon-user:supersecret@localhost:5480/codecarbon_db Then execute the tests: uv run task test-api-integ """ import os import unittest import uuid from datetime import datetime import jwt import pytest...
0d4ef274108ee768ec7cf8f572b823e21c6602bbb11bf5136c86aba6c5d2b846
Python
17,697
514
"""Wave-0 gates for the private DROP-gated ATen execution profile.""" from __future__ import annotations import re from collections.abc import Iterator from pathlib import Path import pytest import torch from torch import nn import torchlens as tl from torchlens import _state from torchlens._io import TorchLensIOEr...
ba2765327a5c82c0bf0ba9b932c68ea77941a1ea63d3de6b722054d66592ec22
Python
17,697
437
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: bream/mux_scan_results.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 _reflection from...
f96c26a5433461249e0f8a6a61d1ffe295468dbe23caa161e63ff99b5e1c74bd
Python
17,701
530
""" Taken and adapted from https://github.com/lucidrains/vit-pytorch. Also some inspiration for the embeddings taken from https://github.com/rwightman/pytorch-image-models """ import torch from torch import nn from einops import rearrange, repeat from einops.layers.torch import Rearrange import numpy as...
a32a0706125c57bb536e941b84f10e5a48d8f17c967d83ddd5b8e2171b244e83
Python
17,708
460
# Copyright (c) 2023, Tri Dao. import os import time from pathlib import Path import torch import pytest from einops import rearrange from transformers import AutoConfig, AutoTokenizer, AutoModelForCausalLM from flash_attn.models.gpt import ( GPTLMHeadModel, combine_state_dicts_tp, shard_state_dict_tp, ...
9759cc668175a43493aa3013d819013dbe25c75b30f229ba2a1b9352bd0afe0d
Python
17,721
563
# 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...
4686d3eb0bf1e91457b79ab30bc8bb6a15f3f1f0cbbef52f36c7fa89e4c11a7f
Python
17,725
518
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. ''' Pointnet2 layers. Modified based on: https://github.com/erikwijmans/Pointnet2_PyTorch Extended with the following: 1. Uniform sampling in...
dd4a18d7463519f595d1dd7bd169dd9025d8378cb8e6e4d7d47d0708a328d0e3
Python
17,726
430
''' Copyright 2021 Twente Medical Systems international B.V., Oldenzaal The Netherlands 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 requir...
06cfd744eca84491b3275ad2d9a5c623e552b8d18a049bc25df6947a3fe986af
Python
17,729
459
# 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...
12fa68f97124d840ca5e1378a5c479c84a6edcf039926deac4f5fa2cb2c9fe89
Python
17,733
394
#!/usr/bin/env python3 """ Dx AY — Phase B2 high-impact auxiliary re-runs ================================================ Re-runs three load-bearing auxiliary diagnostics under the proper per-fold per-cohort-deployment pipeline: 1. §3.2 4×4 bootstrap CIs (classifier-only): rank-norm vs z-score × deployment vs...
2a8ab65143ad14242e046b715cb4294c4d41d5abb56fa15069d50c86d7908297
Python
17,742
408
import torch import numpy as np import os from utils import parse_config,load_CDS,rename from scipy.stats import pearsonr,kendalltau,spearmanr import seaborn as sns import matplotlib.pyplot as plt import pandas as pd from itertools import combinations from os.path import exists from utils import parse_config, setup_fo...
b8bff59d369fbaaaa4e2006b42c0889f51b2dd9c7508c1a44fe83c4c81cb7c06
Python
17,757
466
from typing import Optional try: from typing import Literal except ImportError: from typing_extensions import Literal import os import anndata import cv2 import numpy as np import pandas as pd from scipy.sparse import isspmatrix from scipy.spatial import distance from tqdm import tqdm from ...configuration ...
103b51d6250032ecf7cc181ea3a88f4a4b4001b8d08618880dbbd941e7a81b75
Python
17,764
441
''' Figuras para la tesis 1) Plot per boxes 2) ''' import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import sys import matplotlib.patches as mpatches import numpy as np import sys, os import pickle import matplotlib matplotlib.use('Agg') # plt.style.use('seaborn-colorblind') acceleration_...
7264ea0c8c9a645f3e00fed0721a754a25b2b459949fb3c716e90cbdb36c20dc
Python
17,764
447
"""Utils for auto tasks""" import copy import warnings import numpy as np import autogluon.core as ag from ..estimators.base_estimator import BaseEstimator from ..estimators import SSDEstimator, FasterRCNNEstimator, YOLOv3Estimator, CenterNetEstimator from ..estimators import ImageClassificationEstimator from ..data....
32f9c9b0c5b62124d741de51dbe974c28c043af0b5dff79a38919bce4f98fcf2
Python
17,770
509
import re from pathlib import Path from typing import Any, Iterable, List, Optional, Union import numpy as np import pandas as pd # auto-object related utility functions ####################################### # --------------------------------------------------------------------------- # Regexes for parsing auto-...
20f2b2067c0412d1f8b2de1bc23a378402e5d4a5b17324b877bbba7193c00dd7
Python
17,774
465
""" A single simulated experiment. Runs one experiment configuration to completion, then optionally enriches and analyses the dataset it produced. """ from __future__ import annotations from typing import Any, Optional import os import time import contextlib import io import agentpy import numpy as np import pandas ...
b92546f5e4c3f86b0e699fa83aa4981e24b191f311b7e1634f5f497954701697
Python
17,792
439
"""SRP construction oracles: exact, corpus-free identities (memo B6/B10; lane F19). O1a (construction algebra), O1f (distribution identity — what makes T-C13's labels checkable rather than editorial), O3 (generation determinism, kept executable because "passes by construction" is exactly the claim that should be teste...
e08cd168a1629b7dfb1223f9e0968d4e1d5be2f2bf79a37f4df01ac707c34476
Python
17,804
553
import textwrap from copy import copy import os from packaging.version import Version import warnings from plotly import optional_imports from plotly.io._base_renderers import ( MimetypeRenderer, ExternalRenderer, PlotlyRenderer, NotebookRenderer, KaggleRenderer, AzureRenderer, ColabRender...
b9d8fa0a7bcb83fd85a24a1dbc9078af4b4a2914c2c45b33a79eed8ae46f78a1
Python
17,809
442
"""IO functions for BGI stereo technology. """ import gzip import math import warnings from typing import Callable, Dict, List, NamedTuple, Optional, Tuple, Union import cv2 import numpy as np import pandas as pd with warnings.catch_warnings(): warnings.simplefilter("ignore") import skimage.io from anndata i...
75bb7a0be67d86315c23cfa7fc24f72467738f787e574317bfe484473e797069
Python
17,814
484
''' I'd like to make a container class. The container should just be based on a numpy array. The Container is EEG data - so there should be some header info as well as data info It should have some methods to allow for communication (Possibly using multithreading cues) It should have some automated methods, called ...