sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
b4964abb287df0549a1e2c44f558bc5d34cc1b5e6dc528b2c34e0a68db0fc3ef
Python
16,527
518
from __future__ import annotations import re import pytest from pybind11_tests import ConstructorStats from pybind11_tests import factory_constructors as m from pybind11_tests.factory_constructors import tag def test_init_factory_basic(): """Tests py::init_factory() wrapper around various ways of returning the...
e04749e9b50a99de7293d60d75291e50c53551d215dc54d9cdbd537ddff14fd9
Python
16,532
392
"""DO NOT EDIT. This file was autogenerated. Do not edit it by hand, since your modifications would be overwritten. """ from keras.src.export.tfsm_layer import TFSMLayer as TFSMLayer from keras.src.layers import deserialize as deserialize from keras.src.layers import serialize as serialize from keras.src.layers.activ...
4b3d3689b1e672a12dc4dfe25ec934e95c3fc8da37a78b4c87c96d2b1d333c30
Python
16,533
408
"""Compile advanced (opt-in) ``custom_filter`` forms into an evaluable predicate. Pyrosm's default ``custom_filter`` is a plain dict of exact string values combined with OR. Two richer forms are supported on top of that, and both are strictly opt-in: 1. **Regex values** inside a dict, e.g. ``{"ref": [re.compile(r"I[ ...
c5b25787d16d3a3cf9503860e2f4513c94776f1f8748b070594d82531230bfa6
Python
16,534
361
import glob from copy import copy import numpy as np import argparse import pandas from tqdm import tqdm from tqdm.contrib.concurrent import process_map import pickle from mp_dip.mark_structures import RawChannelStandin, create_tag from mp_dip.utils.data_preprocessing_utils import convert_montage_channel_nr_to_raw from...
aa6f9136c44277577cfe325106a37c10eaa0f7eac29db553ae5311dcc4cf29b5
Python
16,552
442
"""Subspace selection producer: acceptance, provenance, and honesty gates. Covers the producer-lane obligations: the producer returns a composable ``Selection``, the resolved mask is the basis SUPPORT SET (exact as a set, verified against manually computed supports; a dense direction supports the whole axis), basis PR...
71c322dc270f3f77d5c6e1f591722527e80cfe0083c3891cbaa3e92b86f2495c
Python
16,566
307
import sys import os import gc sys.path.append('../TM2_segmentation') import SimpleITK as sitk import numpy as np import pandas as pd import nibabel as nib from skimage.transform import resize, rescale from scipy.ndimage import rotate from scipy import ndimage import matplotlib.pyplot as plt from numpy import median i...
58b3ae9c003bc258b863d14c7f44cf704760d3b97617a964600809402d158ef5
Python
16,569
460
"""Sparse runnable literal-grammar coverage for Python slice/index literals. ``x[:, 3:]``-style subscripting lowers ``__getitem__`` calls whose key argument is a ``slice`` (and, for multi-axis indexing, a tuple mixing ``slice``/``int``/``None``/ ``Ellipsis``). These are inert value types -- no callables, no imports --...
7f99996d8b0c74798befe785d4a0eecc4133c4c16996fdcf5bda7116ecdeaf12
Python
16,580
310
from utils import * DATADIR = (Path(os.getcwd()) / '..' / 'data').resolve() RESULTDIR = (Path(os.getcwd()) / '..' / 'results').resolve() CACHEDIR = (Path(os.getcwd()) / '..' / 'model_actv').resolve().as_posix() from resources import source_layer_map # Set random seed import random np.random.seed(0) random.seed(0) d...
dbbf0e6dce49d29eafa5434360f668a49ede6e914b6f55bc3dbb66887b290b89
Python
16,581
392
#!/usr/bin/env python3 """ Diagnostic X — ridge-regularized HC-cov whitening + ROC sweep. Three components: 1. Ridge-regularized HC-covariance whitening: Σ_c + λI before invsqrt. Sweep λ ∈ {0.001, 0.01, 0.1, 0.3, 1.0, 3.0}; pick the value that maximizes LOCO BA point estimate or that minimizes bootstrap CI w...
789973868c947b6d4a7e9740e39111a110bd9f6a709438872eb7dd064a76d604
Python
16,584
408
# Copyright (c) 2023, Tri Dao. import os import time from pathlib import Path current_dir = Path(__file__).parent.absolute() import pytest import torch from einops import rearrange from flash_attn.models.falcon import falcon_config_to_gpt2_config, remap_state_dict_hf_falcon from flash_attn.models.gpt import GPTLMHea...
478bdf20f8c08afd5818ce9f140ae6aff11d8093362af1b4424840de996167ce
Python
16,585
487
"""Helper functions and constants for GCP Batch runner.""" import logging import math import re from typing import ( Any, TypedDict, ) from humanfriendly import parse_timespan log = logging.getLogger(__name__) class VolumeDict(TypedDict): server: str # NFS server hostname/IP remote_path: str # pa...
59ac881720d857298450b21fc7acd836bc76ebbf6d6c70b39989554977bffd2b
Python
16,593
472
import math from keras.src.utils import backend_utils SUPPORTED_FORMATS = ( "xyxy", "yxyx", "xywh", "center_xywh", "center_yxhw", "rel_xyxy", "rel_yxyx", "rel_xywh", "rel_center_xywh", ) class BoundingBox: def __init__(self): self.backend = backend_utils.DynamicBacken...
d0d49f2b93a25931d972ed016ee4b6308e7b53563f448e8e483e352f913225e3
Python
16,593
650
#Written by Maryam Mahootiha #Import Libraries # In[]: import time import os import shutil import tempfile import matplotlib.pyplot as plt from PIL import Image import torch import numpy as np from sklearn.metrics import classification_report import pandas as pd from sklearn.model_selection import KFold import random...
513cc193959ef7e47cee0db4e2cf0a06ee654416df955861ab85879494f968a0
Python
16,594
348
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
b39b51302bfe3e3ad1cb389598c1db5ebdfd974b90fa22bdf2fe632cc765b1c2
Python
16,594
475
import inspect import os import re import textwrap import typing import warnings from collections import OrderedDict from rpy2.robjects.robject import RObjectMixin import rpy2.rinterface as rinterface import rpy2.rinterface_lib.sexp from rpy2.robjects import help from rpy2.robjects import conversion from rpy2.robjects....
aa6357ab88520907dc2357d0fe50baf2749e3f566634e64f99411195814aeb56
Python
16,600
422
# Copyright (c) 2023, Tri Dao. import json import math import os import re from collections import OrderedDict from pathlib import Path from typing import Dict, List, Union import torch import torch.nn.functional as F from sentencepiece import SentencePieceProcessor from transformers import GPT2Config, LlamaConfig f...
7f5d24a78852dcd29f3abd516a3c69cbb34e82286c4ee5131049036334df9d9f
Python
16,602
355
"""RCNN Model.""" from __future__ import absolute_import import warnings import mxnet as mx from mxnet import gluon from mxnet.gluon import nn from ...nn.coder import NormalizedBoxCenterDecoder, MultiPerClassDecoder from ...nn.feature import FPNFeatureExpander class RCNN(gluon.HybridBlock): """RCNN network. ...
d268636b284b540c7a5cf2d13d85bb8b243bdacd9d7e319a401a0a4930c1a3c0
Python
16,607
403
""" Visualization Tools: A Tour of PyCoBi's Plot Methods ==================================================== PyCoBi exposes five visualization methods on top of matplotlib, each suited to a different aspect of a bifurcation analysis: * :meth:`ODESystem.plot_continuation` — the 1D / 2D bifurcation diagram. Stable ...
ca6a908d9285628000520b072975664a50fb5abe76fe9932e90948048d7c43c9
Python
16,614
395
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license import sys from collections import OrderedDict from pathlib import Path from types import SimpleNamespace from unittest import mock import pytest import torch from tests import MODEL, SOURCE, TASK_MODEL_DATA from ultralytics import YOLO from ultraly...
5b9c445837d221d4271bfea923448028c80c949eec25fbd0927e2e81a3a3b2ea
Python
16,618
417
''' The setup of the adjacency matrices, atomic feature vectors, and reaction feature vectors. BE SURE TO BE USING NETWORKX VER. 1.11!! If using Fukui indices as input, import fukui_utils and uncomment out line 17 & line 343. ''' import os import numpy as np import networkx as nx import torch from rdkit import Chem ...
51c675a96a76efe56fdaeb306200be73837383665d5b42df661033d8d47d005d
Python
16,622
428
""" ROI Template system for external configuration of ROI definitions. This module provides the ROITemplate class that allows loading ROI configurations from external JSON files, replacing hardcoded parameters in ROI builders. """ import json import os from typing import Any import numpy as np from ethoscope.core.r...
760ee820064024f7b56cf55365d3a64a355cf7c58109423e3ef935fa6c6b36ed
Python
16,622
418
from ovseg.HPO.SHA import SHA from ovseg.model.SegmentationModel import SegmentationModel from ovseg.model.SegmentationEnsemble import SegmentationEnsemble from ovseg.utils.io import load_pkl from os import environ, listdir, makedirs from os.path import join, exists from time import sleep import numpy as np import sys ...
c5f95a490dbec404a4cf2ae0634916cfa0d20199d28ad3713a38b713e6a33795
Python
16,622
404
"""Predictors that map a history of embeddings and optional actions to the future. The predictor is the part that a latent world model has. It reads the embeddings of the past frames and, optionally, the actions that were taken, and it returns embeddings of future frames. It never sees pixels, so an encoder trained al...
dfd8b3117c1f31fcdae090d2e944e4f316995e6c32ff8a9dae63f2307fd19a9d
Python
16,623
445
import numpy as np import torch from ..preprocess._preprocess import decode_seq, decode_seqs, ohe_seq, reverse_complement_seqs from ..preprocess._helpers import _get_vocab def perturb_seq(seq): """Numpy version of perturbations""" n_choices, seq_len = seq.shape idxs = seq.argmax(axis=0) n = seq_len * ...
51bf32097a4c6fdba5b744e4ce78ac1beb6ed81a1ce04010ea179d7027ef0bb3
Python
16,625
323
#!/usr/bin/env python # encoding: utf-8 from __future__ import (absolute_import, division, print_function, unicode_literals) import argparse import math import string import os class fasta_input(object): def __init__(self, seq): super(fasta_input, self).__init__() self.buffer_size = os.stat(seq)....
8bbe9a64fe9f5e0d72bb36331d431857c07348ab6d75f779657fab827843c705
Python
16,636
495
"""Module for downsampling numpy arrays via various methods. See the :class:`~ome_zarr.scale.Scaler` class for details. """ import inspect import logging import warnings from collections.abc import Callable, Iterator, Sequence from dataclasses import dataclass from enum import Enum from typing import Any, Union, cast...
f0d86dcc781dae266ca6cc7ca846032339dc26a01f89c35cdb389c96697990a2
Python
16,647
426
"""Group model object and associated code for fitting the model to 2D groups of power spectra. Notes ----- Methods without defined docstrings import docs at runtime, from aliased external functions. """ import numpy as np from specparam.models import SpectralModel from specparam.data.data import Data2D from specpara...
98e40221ee7e9f61a9e2328277074347deeddfb66e32af67e5a569a58623e967
Python
16,663
418
""" Page assistant agent for Galaxy History Pages. Reads history contents via tools, proposes markdown edits with structured output (FullReplacementEdit or SectionPatchEdit), and supports conversational responses. """ import logging from pathlib import Path from typing import ( Any, Literal, ) from pydantic ...
f7c101164d0dbda15a2647a88cf736c120e56c933a0304846510e3c7442173b0
Python
16,665
425
"""This script is largely borrowed from https://github.com/open-mmlab/mmaction. """ import argparse import sys import os import os.path as osp import glob import fnmatch import random import zipfile from pipes import quote from multiprocessing import Pool, current_process import csv def dump_frames(vid_item): fr...
0e54cd6e06552cf898fd28ebfac2e0c911593e59e8153c99cd49650c15f52020
Python
16,668
349
import torch import torch.nn.functional as F from torch.distributions import NegativeBinomial from torch.distributions.gamma import Gamma import math import numpy as np import pandas as pd from sklearn.model_selection import train_test_split,cross_validate,KFold from sklearn.neighbors import KNeighborsClassifier from s...
d3f018667613b5e80d377b11a5b1d7c6d973bcc41e64b5c354fec395d8ba33d6
Python
16,673
505
"""Functional-style utilities.""" import inspect import operator import sys from collections import UserList from functools import partial from itertools import islice, tee, zip_longest from typing import Any, Callable from kombu.utils.functional import LRUCache, dictfilter, is_list, lazy, maybe_evaluate, maybe_list, ...
3457defc75f4b631b217edf454492f3bf7de666def9938ffd9ca8024e71dce1a
Python
16,681
440
"""Round-3 RNG monitor closures: uuid1's C funnel, raw ``_thread`` spawns, and bounded ``uncertain_detail`` growth. Three hunt-b8 findings on ``utils/rng.py``: * ``uuid.uuid1()`` escaped the seal completely on Linux -- the libuuid ``uuid._generate_time_safe`` C path (wall clock + clock-seq entropy + node) touches...
0776ff7634206568e8797a6619558885e609a5dbe28f28387ebd40aed30d2ff5
Python
16,685
508
"""Selector-valued ``layers=``: resolve on batch zero, freeze, attest (D12). ``layers=`` accepts capture's selector/predicate algebra plus extraction's string lookups and selector-valued mappings. Batch zero resolves in EXECUTION order and is harvested from the same trace; the ordered structural site keys and pass-qua...
e0568e8da469c0bb9f71b9e73240e0a8c0658d1bd321394df00f58f9f669ee67
Python
16,685
361
#!/usr/bin/env python import os import numpy as np import cv2 import math import rospy import tf2_ros from utils import decoder from utils import transforms from std_msgs.msg import String from geometry_msgs.msg import Transform, PoseStamped, Twist from sensor_msgs.msg import Image, CompressedImage, CameraInfo from ...
f1a6954df8d9ed9d8063814de7b5ccaeacf23b532250ec05c6b0bd9c2c988d95
Python
16,686
349
#!/usr/bin/python3 ########################################################################## ## ## ## Copyright (c) 2019 Philipp Lösel. All rights reserved. ## ## ## #...
726232633ea667ae177e1495598be95ccb5f2bc4507ac11695ff94ad3aaecb12
Python
16,687
459
"""Brute-force phase oracles for per-unit receptive-field queries.""" from __future__ import annotations from collections.abc import Iterator, Sequence from fractions import Fraction from functools import partial import pytest import torch import torch.nn.functional as functional from support.rf_isolation import pre...
38bb82a742866fb84a72f6d57b92a052d4adc16de66508a59820f45e97dfcc28
Python
16,689
529
from plotly.express._core import build_dataframe from plotly.express._doc import make_docstring from plotly.express._chart_types import choropleth_map, scatter_map import narwhals.stable.v1 as nw import numpy as np def _project_latlon_to_wgs84(lat, lon): """ Projects lat and lon to WGS84, used to get regular ...
3754a708c7e6f91ec790affa64f312bf7f1dd321ae8ea3b0979998fec5d5556f
Python
16,697
309
import json, os, random import torch import numpy as np import h5py from torch.utils.data import Dataset import dareblopy as db import torch.utils import torch.utils.data cpu = torch.device('cpu') class ECoGDataset(Dataset): """docstring for ECoGDataset""" def __init__(self, cfg,ReqSubjDict, mode = '...
b82f08011428008253e04831a8cb8679e0bd4b7a2b069e3e4c85404f729e3422
Python
16,700
393
"""DO NOT EDIT. This file was autogenerated. Do not edit it by hand, since your modifications would be overwritten. """ from keras.src.export.tfsm_layer import TFSMLayer as TFSMLayer from keras.src.layers import deserialize as deserialize from keras.src.layers import serialize as serialize from keras.src.layers.activ...
5a47c342217bef967ff531988783608df0457d4195c1ae44b7e234acdfd527c5
Python
16,702
549
"""Distances between SPD/HPD matrices.""" import numpy as np from scipy.linalg import eigvalsh, solve from .base import logm, sqrtm, invsqrtm def _check_inputs(A, B): if not isinstance(A, np.ndarray) or not isinstance(B, np.ndarray): raise ValueError("Inputs must be ndarrays") if not A.shape == B.sh...
21c31a2496e7797724e053382192975fcd706090dfd74f9b9062df354317d2fd
Python
16,704
313
import argparse import template parser = argparse.ArgumentParser(description='EDSR and MDSR') parser.add_argument('--debug', action='store_true', help='Enables debug mode') parser.add_argument('--template', default='.', help='You can set various templates in option.py') # Hard...
5e488d29181f9e1fde20d5df1df4bacea9cfdaece0621848e7f73b0b4bae9e2a
Python
16,707
411
"""Round-47 hon2_1 immunizer -- cross-thread captured-operand consumption over the FULL op surface. r45 hon2_1 ceilinged a runnable capture to UNVERIFIABLE when a NON-owner thread consumed a captured tensor as an operand -- but ONLY through the global torch-FUNCTION wrapper. The entire ``torch.ops.*`` (aten / higher-o...
8d6575bcdb82b0a7a4886affa00b3b736fb77e5c7607384ef2752858572d9ae4
Python
16,707
384
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Feb 25 11:43:54 2021 This script containts the functions implementing the learning dynamics and connectivity analyses (Fig. 4 in the manuscript). @author: emilia """ import pickle import torch import numpy as np import matplotlib.pyplot as plt from sci...
ce7c5787eec179954156eef7cdc6b9e939b03378e4ba35afea80d917fc2279ee
Python
16,716
542
import pandas as pd import numpy as np import Code_General_utility_spikes_pickling as util import os import matplotlib.pyplot as plt import matplotlib as mpl import matplotlib.colors as mcolors import warnings import logging logging.getLogger('matplotlib.font_manager').disabled = True warnings.filterwarni...
8c1b91afb4a225f6a4eb8a05c077172cdc99e30e17198e8b0cfe6ba219d14d51
Python
16,719
543
import pandas as pd import numpy as np import Code_General_utility_spikes_pickling as util import os import matplotlib.pyplot as plt import matplotlib as mpl import matplotlib.colors as mcolors import warnings import logging logging.getLogger('matplotlib.font_manager').disabled = True warnings.filterwarni...
963eefa3484bf98343f40810e0be444bb95bbb950de5ecea43b1774b25fdb243
Python
16,721
442
""" ResNet code gently borrowed from https://github.com/pytorch/vision/blob/master/torchvision/models/resnet.py """ from __future__ import print_function, division, absolute_import from collections import OrderedDict import math import torch.nn as nn from torch.utils import model_zoo __all__ = ['SENet', 'senet154', '...
378cbac9b473e5b70a3575c134941b5937b482dc1934ecbdac0e82804a4c93fc
Python
16,722
475
""" Timeseries plotting """ from __future__ import annotations from typing import Any, Optional, Sequence, Tuple import numpy as np from .. import plot, reg, util, funcs __all__: list[str] = [ "plot_ethogram", "plot_nengo_network", "timeplot", "timeplots", "plot_navigation_index", "plot_path...
cb3eda44d7d4eec964cfa13e9cd81f98e803bb17019127d87c347b90ccb82a70
Python
16,727
445
""" Example end-to-end pipelines for running the ``face_rhythm`` package. Each pipeline accepts a ``params`` dictionary that must contain all fields required by the steps it executes. """ def pipeline_basic(params): """ Runs the basic ``face_rhythm`` pipeline, mirroring ``notebooks/interactive_pipeline_ba...
e9c51639fc1e50be3bfe5c9b5b3e04fbfbd6770d8bac34fbeb686ad01bf711f8
Python
16,727
355
import torch.nn as nn import torch.nn.functional as F import torch.nn.init as init from bioseq2seq.models import NMTModel from bioseq2seq.encoders import TransformerEncoder, CNNEncoder, FourierEncoder, GlobalFilterEncoderLayer,\ LocalFilterEncoderLayer,FNetEncoderLayer,AFNOEncoderLayer from bioseq2seq.decoders...
5b11ef6c94c9e65844acc7818fd785e5ec517c9341be2b7481a39938321e5b49
Python
16,729
456
#!/usr/bin/env python # ============================================================================= # MODULE DOCSTRING # ============================================================================= """ Affine transformer for autoregressive normalizing flows. """ # ===============================================...
6922f1353b14afdc617060d220ed4a05604338defc743f0e3175f747e5df9f21
Python
16,730
369
import argparse, time, logging, os import mxnet as mx from mxnet import gluon, nd from mxnet import autograd as ag from mxnet.gluon import nn from mxnet.gluon.data.vision import transforms import gluoncv as gcv gcv.utils.check_version('0.6.0') from gluoncv.data import imagenet from gluoncv.loss import MixSoftmaxCross...
c4b08d2153c4981c6b4e2f1f0f8f1d5d35971d3faa936905f6bcc40a60ff6b91
Python
16,732
401
"""Model object, which defines the power spectrum model. Code Notes ---------- Methods without defined docstrings import docs at runtime, from aliased external functions. """ import numpy as np from specparam.models.base import BaseModel from specparam.data.data import Data from specparam.data.conversions import mod...
22d610a0f260e24fceb8073a50d1c64dea1085d14f65abf43ad71d4b94ee900e
Python
16,735
498
"""Extraction v2 engine rows: the D13 store pipeline end to end (lane F18). Covers the manifested pipeline order on real (toy-scale) runs: input-derived row truth (T-ROWCOUNT), pool numerics against manual oracles, dtype routing with byte-exact bf16/fp8 storage (T-FP8-BF16), the D4 ragged gate (T-WIDTH / T-DRIFT-PREFI...
7677c981bc5c9f997f8e1a82eacb2e4498ba55a6c6acccdb96196ec2c24ae193
Python
16,735
434
# Benchmark FP8 attention for FA4 (CuTe-DSL) on SM100. # # Run (recommended): # python -m flash_attn.cute.benchmark_flash_attention_fp8 # # Notes: # - This is intended to be used while bringing up FP8 support for SM100. # - FP8 correctness depends on descales + max-offset scaling being implemented in the SM100 kernel...
39148f6a1eb828e56b2a8f889cc337ce04b91d0a9b9794cb1c59c4fcbc6cb6af
Python
16,737
460
from __future__ import absolute_import import csv import functools import logging import os import sys import sysconfig from pip._vendor import pkg_resources from pip._internal.exceptions import UninstallationError from pip._internal.locations import bin_py, bin_user from pip._internal.utils.compat import WINDOWS, c...
d1343292123f6fe3d8929424ec6f683c7f2a5cfccbdc15f7f93ed36109dd3353
Python
16,743
454
"""Reachable-surface walk and the 4-way classification (oracles D2/D3). The enumeration root is what a user can actually reach: every non-underscore attribute of the ``torchlens`` module (module layer) and every non-underscore member of every class object reachable there (class layer). ``__all__`` is a CLAIM gated aga...
4a8eebd040905a15c63af1f683aa501f9f482cd0c4854ec36dfc8665fb7b6d21
Python
16,746
382
#!/usr/bin/env python # ============================================================================= # MODULE DOCSTRING # ============================================================================= """ Test objects and function in the module ``tfep.io.log``. """ # ===============================================...
e51f99688793c7d6a21d9a0df0420c7fe2a89760d90e6ad1cc29532fcc7e73fc
Python
16,757
441
"""Round-45 hon2_1 immunizer -- cross-thread captured-OPERAND consumption ceiling. r43 closed the DIRECT / owner-derived cross-thread escape rings: a non-owner thread's tensor->host escape ceilings only when the escaped tensor's OBJECT IDENTITY is captured or owner-registered. r44 hon2_1 found the WORKER-DERIVED sibli...
23fa91ad623dc9f832db1dddf470da689be852e67edeb886f2c42b1866e565dc
Python
16,763
453
""" Unit tests for sensor_scanner module. This module tests Sensor-specific scanner functionality including CSV data logging, sensor data retrieval, and remote configuration. """ import csv import json import os import tempfile import time import urllib.parse import urllib.request from unittest.mock import MagicMock,...
e0352d592930ba0debaf011be40168a6c22c7fab6c9d341516d84468777897b0
Python
16,768
390
""" Infers fine-scale recombination maps from data. Functions: optimize: Builds and optimizes an objective functon. Run on the command line with pyrho optimzie -h or --help to see a list of options and their description. """ from __future__ import division import time import logging import sys from itertools impo...
c3b8ba7cacc4e37772a2c4032f13871a5789ebf324600ac8b398aa463bd3b42a
Python
16,774
467
import locale locale.setlocale( locale.LC_ALL, 'en_US.UTF-8' ) import re import pandas as pd import camelot import pdfminer from pdfminer.high_level import extract_pages try: from local_extractor.utils import common_utils except ImportError: import sys, os, pathlib path = pathlib.Path(__file__).absolute(...
2a65a6d136442c2673b11a0a8973ac55d2c8bc163613ceecc64560f669305bc4
Python
16,775
418
''' Functions related to the extraction of signal from the frames, coded as numpy slicing and eventual weighting. Imports ------- numpy ''' import numpy as np def _generate_box_indices(Centers, box_size=(1,3,3), Box=np.array([]), shape=[None,None,None]): ''' Generate indices for sl...
6d67501a2d22b7d7375b7509ff44bb4efa957c7922cdc7be801c672e60c7c4ed
Python
16,777
456
from functools import lru_cache from typing import Generator import numpy as np import pandas as pd from mirp._images.generic_image import GenericImage from mirp._masks.base_mask import BaseMask from mirp._features.histogram import HistogramDerivedFeature from mirp.settings.feature_parameters import FeatureExtractio...
8033d9e3cfd5b7af70abc9e72ec220b537035f219150b02e4c66a670d14b89ab
Python
16,778
374
""" Traces_extraction.py Marthe Priouret, priouretmarthe@orange.fr Script to extract spatio-temporal components of firing neurons from Ca-imaging recordings. This pipeline is based on Caiman, and requires prior installation of the Caiman environment before running. See documentation here: https://github.com/flatiro...
32f59d645cfc43765945ad1c9cd3c287c7739e5465f31074a60a30578ca3d394
Python
16,783
397
from typing import List import numpy as np from sklearn.metrics import accuracy_score from sklearn.linear_model import LogisticRegression, RidgeClassifier import imodels from sklearn.base import BaseEstimator, ClassifierMixin, RegressorMixin import imodelsx.augtree.data import imodelsx.augtree.llm import imodelsx.augtr...
12addb8d255c454e0ab9f43b5ffc428d533e135a06a1e3e6c81c13f4f9259f38
Python
16,786
395
import locale locale.setlocale( locale.LC_ALL, 'en_US.UTF-8' ) import re import json import pandas as pd import camelot import pdfminer from pdfminer.high_level import extract_pages try: from local_extractor.utils import common_utils from local_extractor.states.state_utils import UK_utils except ImportError:...
d6866ae159b7414bb3cc40ead26410cd4d41bf03c134377203d747e771dc125b
Python
16,802
413
#!/usr/bin/env python3 """ File: compare_simulated_vs_observed.py Created: 2023/06/29 Last Changed: Author: M.Vochteloo Copyright (C) 2020 University Medical Center Groningen. A copy of the BSD 3-Clause "New" or "Revised" License can be found in the LICENSE file in the root directory of this sourc...
d01ec0e19b753e37ba1591d2ce6243d26d1f08c152cf33cead4ae6fb3331f3ca
Python
16,804
448
"""Custom fsspec filesystem implementation for Aspera ascp transfers. This module provides an fsspec-compatible filesystem wrapper around the Aspera ascp command-line tool for high-speed file transfers. It is designed to be extensible for future enhancements such as ENA-specific handling, retry logic, and fallback mec...
979a0c2faaec0afd4d8d7e555f47fd6208440d5a3fec46c889d3cbcb02a98e21
Python
16,809
464
import numpy as np from scipy.stats import zscore, spearmanr from scipy.optimize import curve_fit from sklearn.decomposition import PCA from netneurotools import datasets import pandas as pd import seaborn as sns sns.set_style("ticks") import matplotlib.pyplot as plt plt.rcParams['svg.fonttype'] = 'none' import plot...
9e504823cb4adf93f43abe3dce7dc82375cabae59147ec1cc3759e92565d65e5
Python
16,814
465
"""classic Acrobot task""" from typing import Optional import numpy as np from numpy import cos, pi, sin from gym import core, logger, spaces from gym.error import DependencyNotInstalled __copyright__ = "Copyright 2013, RLPy http://acl.mit.edu/RLPy" __credits__ = [ "Alborz Geramifard", "Robert H. Klein", ...
e2221fbcbf0eef679b0616bd6b2bd1cac8eeda275ef81e69a2f7b62f7cb82b86
Python
16,820
463
# 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...
9b8cee22efa64b9293d4717e0349cff3e80df38126024a45d16a79f8f2c6716d
Python
16,833
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. """ """ @Modification by Zh...
9846c866f3211e4acacd6b89c418bc956376f63fa0c75c11abd00d358ad6653d
Python
16,839
449
import logging import time import traceback import mysql.connector from .base import BaseAsyncSQLWriter, BaseResultWriter # Character encoding for MariaDB/MySQL connections SQL_CHARSET = "latin1" class AsyncMySQLWriter(BaseAsyncSQLWriter): """ Asynchronous MySQL/MariaDB database writer that runs in a separ...
f0d2c52d815b35d044c2498073993f4ddcaa5e1420e8e2234d432c8093fbdb81
Python
16,845
416
"""Transforms relate to noising from BART: based on code of fairseq.""" import math import numpy as np import torch from typing import Sequence, Callable from bioseq2seq.constants import DefaultTokens, SubwordMarker from bioseq2seq.transforms import register_transform from .transform import Transform def _subword_st...
cd06e7efe130cfcecf9ba5dad2736f110951737b4b1e8927c0c1f1b39f07b969
Python
16,851
376
from __future__ import annotations from collections import defaultdict from dataclasses import dataclass, field from typing import Dict, Mapping, Optional, Sequence, Tuple import numpy as np import torch import torch.nn.functional as F from .config import TrainingConfig from .data import DomainBatch, DomainTensorDat...
68436b899385e93eefe56f0528a0953aaed3cc692c440f179859aa485f80071c
Python
16,853
421
"""This script is for preprocessing HMDB51 dataset. """ import argparse import sys import os import os.path as osp import glob import fnmatch import random from pipes import quote from multiprocessing import Pool, current_process def dump_frames(vid_item): from gluoncv.utils.filesystem import try_import_mmcv ...
9d81761e587796adcd95e5823c4356e2d4463dacdbc32ac2a895966a2feab1a2
Python
16,854
434
"""Render the user-defined tool authoring help into a Sphinx page. The content lives in ``client/src/components/Tool/authoringHelp.yml`` so the tool editor's help panel and this page stay the same text. See that file for the authoring conventions; this script only reshapes it into MyST markdown. """ from __future__ i...
d0c2bcaa2c7b56b40e6d5479ca18da4776f46da88114a0611c9e67f8ea7074f6
Python
16,855
480
# -*- coding: utf-8 -*- """ Functionality for connectivity matrix """ import os import numpy as np import warnings from scipy.linalg import eigh from bct import get_components, distance_bin, reference from conn2res import utils PROJ_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) DATA_DIR = os.path...
3f32768eae76a0240fc94a422915d6b4c5edbf3e1ca7adcfe81d71a5d249c102
Python
16,863
364
########################################################################## ## ## ## Copyright (c) 2019-2024 Philipp Lösel. All rights reserved. ## ## ## ## This file is par...
92e8feed10c1051d16b849b7bbff5e210cb96895981aa63b00be842f5b5b5ecc
Python
16,863
445
# -*- coding: utf-8 -*- import tensorflow as tf ## ResNet base model ## class ResNet(tf.keras.models.Model): def __init__(self, stacks, version, use_bias, classes, bn_ep=1.001e-5): super(ResNet, self).__init__() self.version = version self.stacks = stacks # initial layers ...
ecda71b9c68c58406eab0ade29b683ca1a7f80b2f9587cc6a4a0bdb83b16ab39
Python
16,866
505
""" This module is currently primarily intended to be used as a script. It will print information about the rpy2's environment (Python version, R version, rpy2 version, etc...). """ import argparse import enum import locale import logging import os import shlex import subprocess import sys from typing import Optional ...
65e6e51955d5f5471a77635b5e1c5d81c278f36899483dc01d539ede9b6a613c
Python
16,872
454
# SPDX-License-Identifier: LGPL-2.1-or-later #!/usr/bin/env python #-*- coding: utf-8 -*- import os import numpy as np from .utils import general as utils def make_header_for_activity(phases, delimiter): header = 'mouse%s\"time [h]\"' % delimiter for phase in phases: header += delimiter + '\"' + phase...
86cc45d27857beaf447c2f2dacf6d3a80b42e84abcf29325e73fe616268b9a44
Python
16,878
509
from plotly import exceptions, optional_imports import plotly.colors as clrs from plotly.graph_objs import graph_objs np = optional_imports.get_module("numpy") def map_face2color(face, colormap, scale, vmin, vmax): """ Normalize facecolor values by vmin/vmax and return rgb-color strings This function ta...
07fba5202f2c8bd8275c1583e9b9c09ca23a6937ea54dfd45635d920f90448e1
Python
16,879
363
import os import torch import numpy as np import pickle def get_model_params_2d_segmentation(n_fg_classes=1, fp32=False): model_parameters = {} # we're doing no preprocessing parameters here as they can be loaded # from the preprocessed folder # Let's jump straigh...
2dd58a14583a473e40c5b42d358cfab7205ca722ec763d3bd21715cdc7e7ef79
Python
16,881
475
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """Workflows for post-processing NIfTI-format BOLD data.""" from nipype import logging from nipype.interfaces import utility as niu from nipype.pipeline import engine as pe from niworkflows.engine.workflow...
12267075575047ade2e8355389a3bba934bfcdedcc972f1105474392008a2a5f
Python
16,885
432
import pickle import torch import torch.nn.functional as F from trainingUtils import NBLoss,_convert_mean_disp_to_counts_logits #,MultipleOptimizer, MultipleScheduler, compute_kernel, compute_mmd from models import Encoder,Decoder,GaussianDecoder,VAE,CellStateEncoder,\ CellStateDecoder, CellStateVAE,...
04ad4c6078a1a23a5abcd0ad4ce0e771e865265e744c8ad27aaea5c2406ce596
Python
16,893
517
# Copyright (c) 2022 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...
1142d822d72a7118103eda0f862c59d6276f2c5d2b334377a8fe9888adc7e2ef
Python
16,894
432
"""S5 escaping test pack (E1-E6): the precondition for any HTML-label ship. The S5 contract (L5 design memo sec 1.4) requires this pack to land BEFORE any encoding channel, suppression, or summary-row work ships. Scope: (1) node labels through the ONE HTML choke point ``render_lines_to_html`` and (2) graph-proper labe...
14bd5068af6c3c34268411fd6f573b8ca538395815436d8db879d6d08a40d2e1
Python
16,897
324
import torch import itertools from util.image_pool import ImagePool from .base_model import BaseModel from data import aux_dataset from . import networks class AttnCycleGANV2Model(BaseModel): """ This class implements the CycleGAN model, for learning image-to-image translation without paired data. The mo...
598f2e8781c1156ef2cf21603cd35e090c4e168a0e2b64d04ccae9682270778f
Python
16,899
500
"""eFEL Python API functions. This module provides the user-facing Python API of eFEL. The convenience functions defined here call the underlying 'cppcore' library to hide the lower level API from the user. Copyright (c) 2015, EPFL/Blue Brain Project This file is part of eFEL <https://github.com/BlueBrain/eFEL> ...
2010a21fec85a0193e1895126d02707c64644146800c5b173bd91d830f871bbe
Python
16,903
513
import math from functools import partial import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from enum import Enum seed = 1234 torch.cuda.manual_seed(seed) #torch.cuda.manual_seed_all(seed) torch.manual_seed(seed) np.random.seed(seed) #torch.manual_seed_all(seed) class SelfAttention...
b46ad16f36f96423ed0ed62f1c5d1d73c5fe24dd2faf05b5985fc1f79cffc280
Python
16,906
510
"""Informational capture-path performance benchmark matrix.""" from __future__ import annotations import gc import importlib.util import math import os import resource import statistics import tempfile import time from collections.abc import Callable, Iterable, Iterator from dataclasses import dataclass from pathlib ...
7b55c063a2f31473bca53e7959cacb72befbbddcf1b378779e637b0ff557052a
Python
16,922
543
# SOURCE: vendored from claritychallenge/clarity @ baf2b2c99f2e799ba5b0e24d0ad8a9f7ca0370d6 # https://raw.githubusercontent.com/claritychallenge/clarity/main/clarity/enhancer/dnn/mc_conv_tasnet.py # # Spatial Conv-TasNet ("mc_conv_tasnet" / multi-channel Conv-TasNet, itself adapted by # the Clarity Challenge team from ...
cad3dbba27d7a0da543cb90f96c9e6359865de8ea961a94cb0694fd4b0344b8b
Python
16,923
491
''' Created on Dec 21, 2010 Mpl examples: http://matplotlib.sourceforge.net/examples/user_interfaces/index.html ''' from logging import getLogger import tempfile import numpy as np from matplotlib.backends.backend_wx import NavigationToolbar2Wx from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg from ma...
10363cd6289bb0d89339fc39ad5684f5f8a1709e9fd464cd6e37c0606e4e4b63
Python
16,924
584
#from tkinter import Image import utils.helper as helper from albumentations import (RandomCrop, Normalize, Compose) class ImageProperty(object): """ Class to store parameters of one WholeSlideImage type to use Attributes ---------- staining : string staining to use same as in WSI file name ...
0f51c0b4b56fcbeaea68f6fc50ac64741ecc7ed8d548f7131b77d41cc272e346
Python
16,927
502
from __future__ import annotations """Python implementation of features""" """ Copyright (c) 2015, Blue Brain Project/EPFL All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source co...
ae714ad5d7139507639de77e25b9d8e51a377f8caaf6bbe063d83d3e6f684e4d
Python
16,933
472
########################################################################## ## ## ## Copyright (c) 2019 Philipp Lösel. All rights reserved. ## ## ## ## This file is par...
01fc2a878afee892ff24760e498f3a36008cdda59b192ad53ecd935d35d773e1
Python
16,937
570
""" Matplotlib interface with the UI. Handles plotting of the traces in the base UI. SimplyFire - Customizable analysis of electrophysiology data Copyright (C) 2022 Megumi Mori This program comes with ABSOLUTELY NO WARRANTY This program is free software: you can redistribute it and/or modify it under the term...
3f955956af5a2c82442d4547accb8149cb623f788c12bc787de26a3901f80b5a
Python
16,938
451
"""Input/output-tree container contract honesty for sparse runnable execution. Round-5 hardening. The round-4 fix covered opaque *values*, but the input/output tree contract still mishandled whole classes of container shapes: * F1 -- non-tensor input leaves under non-``str``/``int`` mapping keys (tuple, bool, float...
bd1fd788d1d30871533f0e744d06a03f5c3809f3f1e674c7604731582eba9972
Python
16,941
405
"""r58 A3a: ``trace(..., cache=True)`` must never unpickle unauthenticated bytes. The capture cache stored a whole pickled ``Trace`` and read it back with a BARE ``pickle.load`` from a directory named by ``TORCHLENS_CACHE_DIR``. Point that variable at any path a second principal can write -- a CI cache mount, a contai...