sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
abc08fe10adb6570e54bf6b307a45e342c0b223a3e756a550f4466a2bb989537 | Python | 15,049 | 374 | """
Custom Metrics
==============
This example covers defining and using custom metrics.
"""
# Import spectral model object
from specparam import SpectralModel
# Import Metric object for defining custom metrics
from specparam.metrics.metric import Metric
# Import function to simulate power spectra
from specparam.si... |
92936165aee4258ecec1f630ce2744053653fec3a2985cb852278f0779946c8e | Python | 15,051 | 388 | import logging
import os
from copy import deepcopy
from autouri import AutoURI
from .cromwell_backend import (
BACKEND_AWS,
BACKEND_GCP,
BACKEND_SGE,
CromwellBackendAws,
CromwellBackendBase,
CromwellBackendCommon,
CromwellBackendDatabase,
CromwellBackendGcp,
CromwellBackendLocal,
... |
452f1e7a7d1468f202c173f1cca350f115c48bcba09af73c8424db2560ea34e0 | Python | 15,052 | 375 | import os
import pandas as pd
import numpy as np
import multiprocessing
import regex as re
import logging
import matplotlib.pyplot as plt
import seaborn as sns
from MarkovModels import common
import matplotlib
matplotlib.use('agg')
pool_kws = {'maxtasksperchild': 1}
def fit_func(protocol, well, model_class, defaul... |
985e809ef6488a1e656689bbabd863c54b59a5d84ed6ac4e1584dc2c3dc0a177 | Python | 15,052 | 374 | from __future__ import annotations
import pytest
import torch
from lightly.models.modules.world_model import predictor as predictor_module
from lightly.models.modules.world_model.predictor import (
AdaLNZero,
LatentDynamicsPredictor,
PredictorBlock,
)
# The predictor requires torch>=2.0 (scaled_dot_produ... |
f3afc22872bc6beb7a7279c83985f4431eb8a8684261e795ff57c328567ae6e4 | Python | 15,058 | 421 | import os, sys
import numpy as np
import pandas as pd
import networkx as nx
from Bio import SeqIO
from scipy.stats import mannwhitneyu
#--------------------------------------------------------------------
def extract_cluster(fileIN, metaIN):
"""
Extract the mapping between experiment id and cluster label
... |
0e66dfcfe50947c2cd6c4becea53670b21adeef44928f2d0d9972622efc3306c | Python | 15,067 | 420 | """Base Estimator"""
# pylint: disable=bare-except
import os
import math
import pickle
import io
import logging
from datetime import datetime
import numpy as np
import pandas as pd
from ...utils import random as _random
from ...utils.filesystem import temporary_filename
from .utils import _suggest_load_context
logging... |
64f81427b83991be2af64204a66bdb736fb249192df871cd667826414247a7cb | Python | 15,068 | 371 | """Deep Layer Aggregation networks, implemented in Gluon."""
# pylint: disable=arguments-differ,unused-argument,missing-docstring
from __future__ import division
import os
import mxnet as mx
from mxnet.gluon.block import HybridBlock
from mxnet.gluon import nn
from mxnet.gluon.nn import BatchNorm
__all__ = ['DLA', 'g... |
435b9c6d321c75063c040b34295d1ab25caaecdb26e0ed532629a36d08720501 | Python | 15,070 | 401 | import difflib
from pathlib import Path
from pyrosm.utils.download import download
from pyrosm.data.geofabrik_index import extract_file_name
from pyrosm.data.geofabrik import (
Africa,
Antarctica,
Asia,
AustraliaOceania,
Europe,
NorthAmerica,
SouthAmerica,
CentralAmerica,
Brazil,
... |
b2fe52767e9f83fb6e83bf1bb9c22ce41392038935f4d347f9c375d1af3abd6b | Python | 15,076 | 444 | #!/usr/bin/env python3
import logging
import os
import random
import time
from collections import defaultdict
import cv2
import numpy as np
import torch
from slowfast.utils.env import pathmgr
from torch.utils.data.distributed import DistributedSampler
from torchvision import transforms
from . import transform as tra... |
e1ef58e2256d72deef390783ca67c693407495926744b06b3971ed656226c2d6 | Python | 15,081 | 379 | """Quantization geometry: the layer-side protocol behind the strategy registry.
A layer exposes its quantizable structure through
`Layer._quantization_geometry()`, which returns one of the geometry classes
below (the base `Layer` implementation returns `None`, meaning the layer has
no generic quantization support). Th... |
b2c012ed5046615ccfc70fea85588fd3a23913b3f17d11ef7036632d2d2bcdd9 | Python | 15,089 | 363 | """
evoked_basic plugin - Handles UI component of the plugin
Must be loaded from the base UI system.
Analyze evoked synaptic events.
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 redistr... |
85105160dfab667ef932759aa7325774f8e7c30b0359d10a9d61c42de416f1f2 | Python | 15,093 | 379 | # 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... |
90ab1011ee9acd1df224874a3db2511f3bf1f071eda6c012830946a0251d27e9 | Python | 15,097 | 384 | import math
import warnings
from keras.src import backend
from keras.src import initializers
from keras.src import layers
from keras.src import ops
from keras.src.api_export import keras_export
from keras.src.backend.common import standardize_dtype
from keras.src.utils.module_utils import scipy
@keras_export("keras.... |
4c01ce38448906fc2c106cc13c75597c3bfe049d0a6ba1010aa0c68b30595041 | Python | 15,098 | 279 | #结论:当模型进行ensemble的时候性能会明显提升。
import json
import numpy as np
import os, sys
from collections import Counter
from sklearn import preprocessing
from sklearn.metrics import f1_score
from sklearn.metrics import confusion_matrix
import torch
import torch.nn as nn
import torch.nn.utils.rnn as rnn_utils
import torch.nn.functio... |
18e50b7f47d573ac6fb986ef9e7413a4e1df5bb9145d97f1816ce990d39c3f49 | Python | 15,099 | 478 | import inspect
import sys
from contextlib import contextmanager
from enum import IntEnum
from pathlib import Path
from time import time
from logging import getLevelName
from typing import Any, Union, Optional, Iterable, TextIO
from typing import Tuple, List, ContextManager
from . import logging
from .logging import _s... |
e708f31a15d92dcb6b09a81d45b84550fd9a4381d4d2ed1056a1b17719953d19 | Python | 15,099 | 296 | # Form implementation generated from reading ui file 'img_window.ui'
#
# Created by: PyQt5 UI code generator 5.6
#
# WARNING! All changes made in this file will be lost!
from qtpy import QtCore, QtGui, QtWidgets
class Ui_Dialog:
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.res... |
30e8b9faa1696ccc7c65b3b06f935b6935fbffa08325644913e7895490b5e1d0 | Python | 15,101 | 411 | import random
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patheffects as path_effects
import plotly.express as px
import plotly.offline as po
from tlib import tutils
def vectorize(array, axis, random_frac=None, random_seed=None):
"""
Vectorizes given array at given axis. This can be... |
542681ce875f76a3446a126db0ea5311b0ea95ad375bd1a80bddf70289254f39 | Python | 15,102 | 293 |
import numpy as np
import sys
sys.path.append('../')
from pycore.tikzeng import *
offset = -1.5
scale = .3
decoder_offset = 0
def ppos(num_tuple_s):
nums = num_tuple_s.replace(' ', '').replace('(', '').replace(')', '')
nums = nums.split(',')
nums = np.array([float(n) for n in nums])
nums[0] += decoder... |
5b4e0f2c9f23041fbb19c8268f7d078969e01554ccd12692ca0fc962ab52caa6 | Python | 15,104 | 359 | #! /usr/bin/python3
import subprocess
import uuid
import time
# try to load tkinter, if tk is not installed, install it first.
try:
from tkinter import *
import tkinter.ttk as ttk
except Exception as e:
print(e)
subprocess.call(["sudo", "pacman", "-Sy", "tk", "--noconfirm"])
finally:
from tkinter... |
4e0e5e177c968a0afccb7f5c6051eac8de137024b9f152597545cf4b44e67953 | Python | 15,107 | 405 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Simple MAF on cartesian coordinates.
"""
# ===================================================================... |
ba97bb51257ab4a2909f53c6b01695d328fd6e29574054fad668ea659ca5f527 | Python | 15,107 | 492 | import textwrap
import pkgutil
import copy
import os
import json
from functools import reduce
try:
from math import gcd
except ImportError:
# Python 2
from fractions import gcd
# Create Lazy sentinal object to indicate that a template should be loaded
# on-demand from package_data
Lazy = object()
# Tem... |
643d42367bafc9aee7adb2c78e4b9bef9e43c30f1da698081fc4d494af6a378f | Python | 15,114 | 378 | """Classes and functions having to do with creating searchlights.
Authors
-------
Marijn van Vliet <marijn.vanvliet@aalto.fi>
"""
import numpy as np
from mne.utils import logger
class searchlight:
"""Generate indices for searchlight patches.
Generates a sequence of tuples that can be used to index a data a... |
150ad03291057ab862af3e30506605b6568dda55a9040bdfd0128e2587183aa8 | Python | 15,120 | 362 | """Functions for building the features for the HelixFold multimer model."""
import collections
import contextlib
import copy
import dataclasses
import json
import pickle
import os
import tempfile
from typing import Mapping, MutableMapping, Sequence
from absl import logging
from helixfold.common import protein
from he... |
c8db43ef7c67ca52d0eba0fe4fa1899a3efbcb5bba37958efe2c8c8d88972599 | Python | 15,120 | 437 | import math
import sys
import matplotlib.pyplot as plt
import numpy as np
from sklearn.model_selection import cross_val_score
from .classification import MDM
from .geometry.distance import distance, pairwise_distance
from .geometry.mean import gmean
from .utils._check import check_metric
def multiset_perm_number(y)... |
0c5fd9016adfb48fa725222b7dea4519adc487a7b6b05e1966ec3096ad9309b3 | Python | 15,125 | 384 | """Test for distribution_lib.py."""
import functools
from unittest import mock
import jax
import numpy as np
import pytest
from jax.experimental import layout as jax_layout
from jax.sharding import PartitionSpec as P
from keras.src import backend
from keras.src import layers
from keras.src import models
from keras.s... |
eb017a26b63e6317796af9160f5bbe88a5830877c279bf97f3cdfa1ef04be8ee | Python | 15,134 | 213 |
import numpy as np
from rdkit import Chem
from rdkit.Chem import rdChemReactions
from itertools import chain
reagent_smarts_dict = {'O2' : '[OH]', 'PF-07222283' : 'C#CCOc1ccc(C(c2ccc(OCCCC(F)F)cc2)=O)cc1', '(CF3SO2)2Zn' : 'C(F)(F)(F)',
'(HCF2SO2)2Zn' : 'C(F)(F)', 'MeOCH2BF3K' : 'COC', 'N-Me formamide'... |
fc18a37eb3169a3722b15de8b7072b8c8e5120c46b129c79360a8a9af858cfdc | Python | 15,135 | 487 | import builtins
import inspect
import sys
from collections.abc import Iterable, Iterator
from contextlib import contextmanager
from enum import IntEnum
from logging import getLevelName
from pathlib import Path
from time import time
from typing import Any, Literal, TextIO
from . import logging
from .logging import _Roo... |
5420eeaf28c1766891cb783ba049fa97c108c15931285cd1d6a327d4ece3fba8 | Python | 15,136 | 378 | import torch.nn as nn
from torch.hub import load_state_dict_from_url
__all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101',
'resnet152', 'resnext50_32x4d', 'resnext101_32x8d',
'wide_resnet50_2', 'wide_resnet101_2']
model_urls = {
'resnet18': 'https://download.pytorch.org/mode... |
b0561556894cf94342156fc5453564ac84f4b9dbdf1dc3f88f8d0aca7195ed16 | Python | 15,137 | 279 | #结论:当模型进行ensemble的时候性能会明显提升。
import json
import numpy as np
import os, sys
from collections import Counter
from sklearn import preprocessing
from sklearn.metrics import f1_score
from sklearn.metrics import confusion_matrix
import torch
import torch.nn as nn
import torch.nn.utils.rnn as rnn_utils
import torch.nn.functio... |
bcaf9af8675529e124ad76d3799356d1cf863bd69af1feefbe4e404d978a395b | Python | 15,140 | 328 | from typing import List, Optional, Tuple, Union
try:
from typing import Literal
except ImportError:
from typing_extensions import Literal
import numpy as np
import pandas as pd
from anndata import AnnData
from spateo.alignment.methods import paste_pairwise_align
from spateo.alignment.utils import get_optimal... |
5706862650510efb117bc53835a309dd1e26cf6bf2fc1d4b51b2f72ad5c32799 | Python | 15,141 | 476 | """
Simple unit tests for authentication system core functionality.
Tests the authentication logic without complex database interactions.
"""
import hashlib
import os
import sys
import tempfile
import time
from datetime import datetime, timedelta
from unittest.mock import MagicMock, Mock, patch
import pytest
class... |
786c45dc30d347d6b082cd3bfb0c05ed8e08441513f80c44448ee59ac136c9b2 | Python | 15,142 | 389 | """Round-19 PARAM/BUFFER within-forward write-masking + read-only over-trigger cluster.
The r18 param/buffer parity fix keyed its host-write tripwire on "bytes-changed-but-version-STATIC"
to flag an untracked host write. A version-BUMPING op (a tracked in-place op, OR a host write
followed by one) DEFEATS that gate, s... |
ee01b99a78b1b635dc8e1f7914b2f4d96237f99e6b18b2538ffdd43651d62383 | Python | 15,146 | 453 | # SOURCE: vendored from huankoh/CST-GL @ main
#
# Vendors the real nn.Module classes from layer.py (nconv/linear/mixprop graph-convolution
# building blocks + dilated_inception temporal-conv + LayerNorm), mtcl.py (graph_constructor,
# the "Multivariate Time Series Correlation Layer" that learns a sparse adjacency over ... |
3a6e090e5698dbb48c6b963ebfb888f9ebdd70e3fc9db1e6a2d1b08cc0d10878 | Python | 15,149 | 339 | CheckFeaturizer = {
('davis', 'graphconv'): ['GraphConv', 75],
('davis', 'graphconvreg'): ['GraphConv', 75],
('davis', 'tf'): ['ECFP', 1024],
('davis', 'tf_regression'): ['ECFP', 1024],
('davis', 'weave_regression'): ['Weave', 75],
('davis', 'weave'): ['Weave', 75],
('davis', 'mpnn_regressio... |
89b6f92e246faa12142fd8e08866b24c9103dd5c7875e0868475747fe7f0503a | Python | 15,166 | 368 | """Checkpoint invocation token pins (L9 memo 2.3, wave-2 subset).
Tokens are the WITNESS, site keys the GROUPER: one classified non-reentrant
checkpoint enter mints exactly one per-trace ordinal token; pack evidence is
count-only (the forward-side slot->op binding is NOT claimed); unpack
evidence points are backward-d... |
f1386e669469e899dd14b69523fa652c1740e3384f3a00f0225fe72cb7c539f0 | Python | 15,167 | 465 | import sys
import cv2 as cv
import numpy as np
def line_mode(x, y):
"""Click with the left mouse button to draw lines
on the original image and the mask to distinguish regions
Args:
x: x_coordinate where the left mouse button is clicked
y: y_coordinate where the left mouse button is c... |
e3ec81214783ab7906b19838df6a043f2f6349b3e243370edf3b354325d8f583 | Python | 15,170 | 310 | """Проверки правок 13 октября 2026 (ИДЕИ_2026-10-13.md, ПОРУЧЕНИЕ_ПРАВКИ_2026-10-13.md).
* новые флаги выключены по умолчанию и не меняют старые прогоны (бит в бит);
* метрика при явных порогах 200 и 1000: при 1000 совпадает со старой;
* neighbour: счётчики настоящий сосед / подмена покрывают все агент-тики;
*... |
c9ffaf2f716ce8a27aca29880180c8e6f3a2bab7ace4556f6cc99fc16cce2088 | Python | 15,177 | 411 | """S4 predicate runtime extension point: contract + registry tests.
Covers the m1 (contract core: ``PredicateProtocol`` + ``coerce_predicate``
over raw callables) and m2 (named registry: ``register_predicate`` + name
acceptance) obligations from the S4 contract
(``docs/reference/predicate_runtime.md``).
The no-behavi... |
d095f052cf7b180578a6950a78335eaaf6eaacdadf0fe101a5d769bbb64baab6 | Python | 15,180 | 371 | # Copyright (c) MONAI Consortium
# 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, so... |
3c1129e68e4b67f29e60bcc648bb46c7e04f444a48b1a33b313518b269a9c27a | Python | 15,186 | 316 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
from pathlib import Path
from typing import Any
import numpy as np
import torch
from ultralytics.models.yolo.detect import DetectionValidator
from ultralytics.utils import LOGGER, ops
from ultralytics.utils.metric... |
fd29c9843a0e82c7aa3802b074f6b4f8e9161d4d30915abcd6eac04c536100f5 | Python | 15,190 | 394 | import pathlib
import time
import numpy as np
import torch
from sklearn.metrics import roc_auc_score
from torch import nn
from torch.nn.utils import clip_grad_norm_
from torch_geometric.data import Batch
from tqdm import tqdm
from utils.utils import extract_best_model
class Estimator:
"""
A class that wraps... |
8388bfe55d46f98418273601c48e4bd3d310c55ad6c0961131d85dab7a55efac | Python | 15,198 | 446 | """
Tomographic preprocessing and fast reconstruction utilities.
This module provides helper functions for optical/CT tomographic workflows,
including:
• Flat-field estimation from corner/background regions
• Sinogram resizing for memory-efficient reconstruction
• Fast GPU-accelerated filtered back-projection using Q... |
b55e209e77268c34d17b6525a1a4824899fb93b645e2ad8a93e3117975ddf4c9 | Python | 15,199 | 361 | import abc
import functools
import logging
import os
import posixpath
from typing import (
Annotated,
Any,
cast,
ClassVar,
TypeVar,
)
from fsspec import AbstractFileSystem
from pydantic import Field
from galaxy.exceptions import (
AuthenticationRequired,
MessageException,
ObjectNotFoun... |
89b6382f0ed6cd2f06316c8bf43e29478fa876141d238adc3c260a03087d3df3 | Python | 15,206 | 372 | """
report_08.py — builds outputs/report.md, report.html and report.pdf
The abstract is generated from results.csv and statistics.json rather than
written in advance. The previous version asserted that amplification improved
accuracy for stroke and Parkinson's patients no matter what the run produced,
which is the one... |
db82cc70fa8e8257d82b7e4303a1ddc5f50cc4ea5bbe61196f8a0db8c30e5746 | Python | 15,217 | 444 | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from src.utils import Constants
hidden_dim = 400
def extra_hidden_layer():
return nn.Sequential(nn.Linear(hidden_dim, hidden_dim), nn.ReLU(True))
class EncMLP(nn.Module):
""" Generate latent parameters for MNIST image da... |
7f46380e45954b6e208b06b46507fad371670b5b28496f60fe57c6d5c1247ea6 | Python | 15,219 | 481 | import copy
import warnings
import numpy as np
from typing import Self, Generator
class BaseImage:
def __init__(
self,
sample_name: None | str = None,
image_modality: None | str = None,
image_origin: None | tuple[float, ...] = None,
image_orientation: ... |
967486fb5a3b4957fd3ef9daa15358e8483c17a2c73f5c7a31c4e940cc6b3771 | Python | 15,219 | 517 | """
Sensory landscape plotting
"""
from __future__ import annotations
from typing import Any, Optional, Sequence, Tuple
import numpy as np
import pandas as pd
import seaborn as sns
from .. import plot, reg, util, funcs
__all__: list[str] = [
"plot_odorscape",
"plot_2d",
"plot_3pars",
"odorscape_isoc... |
cf91f762470c6f5fad8673f3aa7dcd63623c3b13d90f93f51261057203b41f83 | Python | 15,219 | 329 | import torch
import torch.nn as nn
import math
from utils import get_mask_from_data
import torch.nn.functional as F
from qsm_fun import get_tkd
class AffineResBlock(nn.Module):
''' mod from AffineResBlock '''
def __init__(self, in_ch, out_ch, stride1=1, stride2=1, k_size=3, ud_flag=None, bias=True)... |
53db7afd4b204a2959d4a6d3efb317ec57c62928d5c7c22228489db81fe88c4e | Python | 15,220 | 302 | """Train CenterNet"""
import argparse
import os
import logging
import warnings
import time
import numpy as np
import mxnet as mx
from mxnet import nd
from mxnet import gluon
from mxnet import autograd
import gluoncv as gcv
gcv.utils.check_version('0.6.0')
from gluoncv import data as gdata
from gluoncv import utils as g... |
4603d286725d923edfd3a38f6c2d6349c7f4eabdff81afaa4028f18602ef90f6 | Python | 15,221 | 297 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
09792911387ed4b54d3c02b6bca14f42565717e3357eda385ec78d64877a0d37 | Python | 15,228 | 394 |
# coding: utf-8
# In[16]:
from __future__ import division
# get_ipython().magic(u'matplotlib inline')
import sys
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import scipy.io as io
import pickle
import scipy.stats
# In[2]:
SBJ = sys.argv[1]#raw_input('Ent... |
5d5b3b1a4a7ab1da0174ca23bd5f5ee72d968f7bf66ba3ae43a0428333cd6560 | Python | 15,229 | 578 | import os.path as opath
import textwrap
from io import StringIO
from codegen.utils import CAVEAT, write_source_py
def get_typing_type(plotly_type, array_ok=False):
"""
Get Python type corresponding to a valType string from the plotly schema
Parameters
----------
plotly_type : str
a plotl... |
eda2bb4800eb5a88adfe5e5515ff3560bafc27c2b775851a7c6b291497e30b41 | Python | 15,234 | 468 | __author__ = "quentin"
import collections
import json
import logging
import os
import time
import urllib.error
import urllib.parse
import urllib.request
from threading import Thread
import serial
class WrongSerialPortError(Exception):
pass
class NoValidPortError(Exception):
pass
def connectedUSB(optiona... |
13633f1c7feb48e7785c04ff2b7fe54b7f09249286757ee9eeb3cc5e064fe6a0 | Python | 15,240 | 334 | #!/usr/bin/env python
import pandas as pd
import numpy as np
import time
import re
import os
import sys
import argparse
import configparser
import multiprocessing
from more_itertools import sliced
import codes3d
def produce_summary(
eqtl_df, snp_df, gene_df,
expression_table_fp, fdr_threshold, outpu... |
33d48330dbc70b868e161b39b099346a2e907beb39f37791e50955d1783eea68 | Python | 15,240 | 192 | from __future__ import absolute_import, division, print_function
import os
import absl.flags
FLAGS = absl.flags.FLAGS
# sphinx-doc: training_ref_flags_start
def create_flags():
# Importer
# ========
f = absl.flags
f.DEFINE_string('train_files', '', 'comma separated list of files specifying the data... |
10a2fee92c14b5724c1a843d4e8762f4af355cabe1baa8191404684f03a3ad1a | Python | 15,247 | 483 | """Pure data layer for the portal Module Inspector (no Panel/Bokeh).
Builds standalone module instances from ``moduleDB`` and steps them per "kind":
- "effector" (crawler, turner): ``step(A_in=<scalar>)`` with a constant A_in.
- "feeder": ``start_effector()`` once, then ``step()`` (self-oscillator, no input).
-... |
9c74cc95ea3dcc9d6e490d67cca3ae150c5d333115b046ff3a39a9dfcb8fc4ff | Python | 15,250 | 487 | """
Tests for the ComposedStimulator trigger/action architecture.
Tests triggers, actions, channel maps, and the ComposedStimulator integration.
"""
from unittest.mock import MagicMock, PropertyMock
import pytest
from ethoscope.stimulators.actions import (
ACTION_REGISTRY,
LEDPulseAction,
LEDPulseTrainA... |
6c429bda5c6c7cd8ee0b9ec316eeeae383e029b11ab961d1d8a4b7d4b248cb0e | Python | 15,252 | 371 | #!/usr/bin/env python3
"""
figshare_5450293 (Vicchietti et al. / Pineda et al.) — CAR + 5D Reprocessing
Cohort:
59 AD + 7 MCI + 102 HC = 168 subjects.
Format heterogeneity ("preprocessing asymmetry"):
- HC subjects: single .mat file `<id>fir.mat` with var `segmenty`,
shape (22, 12288), 128 Hz, microvolt scale... |
377d0b3555e99991c3cdca249ff1d28c1f0bd7bdc30a2e12bf9ed1d2c158a93a | Python | 15,253 | 432 | #! /usr/bin/env python
# Author: Maria Nattestad
# Email: maria.nattestad@gmail.com
import argparse
import gzip
import operator
import re
import time
import numpy as np
def run(args):
filename = args.delta
unique_length = args.unique_length
output_filename = args.out
keep_small_uniques = True
... |
01a97a164c9525204e1aae2ba28cc25480b5feede1ff64652b8a927c854acaf2 | Python | 15,257 | 445 | import logging
import sys
from collections import defaultdict
from io import StringIO
from tempfile import mkstemp
from unittest.mock import Mock, patch
import pytest
from celery import signals, uuid
from celery.app.log import TaskFormatter
from celery.utils.log import ColorFormatter, LoggingProxy, get_logger, get_ta... |
13cbd827e51bbb2fcb387034ee09b0b44a2e42205e6b087eb907f2c2e7ed5abc | Python | 15,257 | 340 | import glob
import json
import os
from collections import defaultdict
import argparse
import numpy as np
import tqdm
from mp_dip.utils.db_atoms_utils import read_db_atoms
from mp_dip.utils.data_preprocessing_utils import prepare_data, ATOM_FEATURES
from mp_dip.utils.utils import read_raw, get_mp_book_paths, get_all_a... |
7cc4cbe4d1f400aab82fd2a80e18faa73e1b6d12f3c9d928c81662218268eace | Python | 15,263 | 383 | """Module-tier collector tests (explorer item 6; D15-D17, D21).
Observation is INERT: a collected run's losses, gradients, updates, and
model state EQUAL a seeded unobserved control, including train-mode
BatchNorm running stats and in-place ReLU models.
"""
from __future__ import annotations
import pytest
import tor... |
f2ed67e2cea7f700987808c57d793d373b6583a686824f806a79c08800304872 | Python | 15,267 | 384 | from __future__ import annotations
import pytest
import torch
from pytest_mock import MockerFixture
from torch import distributed as dist
from torch.distributed import nn as dist_nn
from lightly.loss import LeJEPALoss, SIGReg
from lightly.loss.lejepa_loss import lejepa_invariance_loss
class TestSIGReg:
# TODO: ... |
fa4b069f63b43e7be015f6ca5af7aac415dccde1425d845b417692ef944b869a | Python | 15,268 | 452 | from copy import deepcopy
import os
import re
from typing import Sequence, Union
import mne
from .._mne import combination_label, labels_from_mni_coords, rename_label, dissolve_label
from .definitions import DefinitionError, Definition, tuple_arg
SEEDED_PARC_RE = re.compile(r'^(.+)-(\d+)$')
class Parcellation(Def... |
05464e1991005597ff9f61e6b2ebe1cecb4d5446fc3b73b7c42efc5bd5f45d46 | Python | 15,272 | 439 | """Paddle backend validation tripwire adversary tests."""
from __future__ import annotations
from typing import Any
import pytest
paddle = pytest.importorskip("paddle")
import torchlens as tl # noqa: E402
from torchlens.backends import BackendUnsupportedError # noqa: E402
from torchlens.backends.paddle import ( ... |
9a9f628ca19c459b71f4900f231a4d654510ebd0a8aa77545e66573c97850b89 | Python | 15,272 | 438 | import sys
import math
import numpy as np
from .utils.utils import check_version
from .utils.distance import distance, pairwise_distance
from .utils.mean import mean_covariance
from .classification import MDM, _check_metric
if check_version('sklearn', '0.18'):
from sklearn.model_selection import cross_val_score
e... |
1dd0ead7338df143903178c7357ddd81cdd1cda2d3c4591b7509c613a7fc76fa | Python | 15,275 | 403 | """
This code contains methods to reconstruct the mesh model based on the 3D point cloud.
1. 3D Delaunay
2. marching cube algorithm
3. alpha shape algorithm
4. ball pivoting algorithm
5. poisson reconstruction
"""
from typing import List, Optional, Union
import numpy as np
import pyvista as pv
fro... |
53aefbea77d398f3213411fad83618447e2d7af13df91fb3634db648d342c102 | Python | 15,282 | 376 | import re
from datetime import datetime
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import io
# Check for optional reportlab dependency
try:
from reportlab.lib import colors
from reportlab.lib.pagesizes import letter
from reportlab.platypus import SimpleDocTemplate, Paragraph,... |
3e8de493ce08dcb43b8d439b1e9596a28fd4d93a410f1fd46d3ab1ffdb03fcdf | Python | 15,288 | 368 | # SOURCE: vendored from https://github.com/pykt-team/pykt-toolkit @ main
# (pykt/models/skvmn.py)
#
# SKVMN: Sequential Key-Value Memory Networks (Abdelrahman & Wang, SIGIR 2019)
# for knowledge tracing. The classes below are the REAL SKVMN model code from
# the pyKT toolkit (an established academic knowledge-tracing b... |
614b2791f4fb84ab5a4f53d1bda62a02d7b1835d0c754480a078d161ab14afec | Python | 15,289 | 386 | """Utilities of visualising an environment."""
from collections import deque
from typing import Callable, Dict, List, Optional, Tuple, Union
import numpy as np
import gym.error
from gym import Env, logger
from gym.core import ActType, ObsType
from gym.error import DependencyNotInstalled
from gym.logger import depreca... |
ac99f840e936b248169bda691b02d303d5aef9e65ef044f12b1df723a90f4849 | Python | 15,289 | 407 | import copy
import inspect
import typing
from keras.src import tree
from keras.src.api_export import keras_export
from keras.src.backend.common import get_keras_mask
from keras.src.backend.common import global_state
from keras.src.backend.common import standardize_shape
from keras.src.layers.core.input_layer import In... |
de1a6f588d396a679d5a30dc9d32f5ce786a68fd1caccfdde223699180f72fca | Python | 15,289 | 408 | # Copyright (c) 2024 PaddleHelix Authors. All Rights Reserved.
#
# Licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0
# International License (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://creativecommo... |
e1595b063b8ecd93f37c0c5df44997a58acb2187ee6fbf5bb2849f5534fa7804 | Python | 15,289 | 484 | ###########################################################
# LC analyses: spot-level deconvolution using cell2location
# using merged reference clusters
# Lukas Weber, Jun 2022
###########################################################
# references:
# - cell2location tutorial: https://cell2location.readthedocs.io/en... |
c3016476be727af03d51b8bc49fe725afed5e0ca61eb31899f8133ed70e8f1a6 | Python | 15,290 | 410 |
import sys
import os
# required python versions (2.7+ or 3.0+)
required_python_version_major = [2,3]
required_python_version_minor = [7,0]
# check for either of the required versions
pass_check=False
try:
for major, minor in zip(required_python_version_major, required_python_version_minor):
if (sys.versi... |
50f9bd91e2601cfc51c3a9a6987cbab84e102bdf9c67f071b564741ed56ff247 | Python | 15,296 | 441 | #!/usr/bin/env python3
"""
File: manim_scene2.py
Created: 2022/02/10
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 this source tree... |
8a93fd3c5e44d3acf26d7f725648c87fe7602cfd4684213d3f73e69a2b1c1730 | Python | 15,299 | 354 | # SOURCE: vendored from jordiclive/Convert-PolyAI-Torch @ master
# (src/model.py, src/model_components.py, src/config.py, src/dataset.py)
#
# ConveRT (Conversational Representation from Transformer), Henderson et al.
# 2019 (https://arxiv.org/abs/1911.03688), PolyAI. This is a faithful
# open-source PyTorch reimplement... |
ee056029d28acd832c762c419d2ff1c0490c9ce33f9fd28ffb22d2dc94ab11ce | Python | 15,300 | 435 | # -*- coding: utf-8 -*-
"""
This process is repeated with Temp2-5
# Install Package
"""
!pip install spams
!pip install staintools
"""# Import Libraries"""
import itertools
import os
import statistics
import matplotlib.pylab as plt
import numpy as np
import tensorflow as tf
import tensorflow_hub as hub
import PIL
f... |
01a8f5144eddf20176c1badf79b8c6fe01b433cd28e059ccfa125e999383a64a | Python | 15,305 | 474 | ###########################################################
# LC analyses: spot-level deconvolution using cell2location
# Lukas Weber, Apr 2022
###########################################################
# references:
# - cell2location tutorial: https://cell2location.readthedocs.io/en/latest/notebooks/cell2location_tu... |
af39d7938464882f647c185e7ad7551301f4c066ad0507304947a4fd09c71b5a | Python | 15,307 | 355 | from __future__ import division
from __future__ import unicode_literals
import numpy as np
import tensorflow as tf
import collections
from deepchem.metrics import to_one_hot
from deepchem.models.tensorgraph.tensor_graph import TensorGraph, TFWrapper
from deepchem.models.tensorgraph.layers import Feature, Label, Weig... |
f0ee1926b7f1dfaa7d7d6a035fa405d5af7e6f531dcb969006d9b7f29f3d62fe | Python | 15,307 | 527 | # 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... |
f43b72558064a1eacf56648c85eca84d8f727bf7e0c7fd683322daa5c52bfecd | Python | 15,308 | 434 | from enum import Enum
from pathlib import Path
from typing import Any, Dict, Generic, List, Literal, Optional, Type, Union, cast
import joblib
import numpy as np
import polars as pl
import pysam
import zarr
from more_itertools import split_when
from numcodecs import (
Blosc,
Delta,
VLenArray,
VLenUTF8,... |
9dd71064d295016a6617097edd0ee076151bbe724698e69dc72e802fb6dfd33a | Python | 15,310 | 437 | import os
from pathlib import Path
import wkw
import numpy as np
import shutil
from os import path, makedirs
import pytest
POSITION = (0, 0, 0)
SIZE = (32, 32, 32)
def test_context_manager():
wkw.Dataset.create("tests/tmp", wkw.Header(np.uint16)).close()
with wkw.Dataset.open("tests/tmp") as dataset:
... |
029e2752c5165083b8df9712e58972808365a13bcb0e6f923a0b3b1d4e7c1205 | Python | 15,312 | 422 |
from copy import deepcopy
class ParamsHolder:
def __init__(self):
# Template parameters.
self.config_dict = dict()
self.config_dict['dt'] = 0.1
# # Izhikevich's model
self.config_dict['izhi_c1'] = 0.04
self.config_dict['izhi_c2'] = 5
self.config_dict['izhi... |
b136a9b3ab99416bb7a04e59ff65c0bc87d824266776e7e5cfdab716b29919e0 | Python | 15,312 | 369 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
E(n) equivariant graph neural network for continuous normalizing flows.
"""
# ================================... |
632da99b73566def2dccbea03340d322446288b25b3a483f5e71d3d5b5aa445a | Python | 15,313 | 398 | """F06 B10: the consolidated captum oracle ledger (attrib memo B10 / s4).
LEDGER_VERSION = 1. One versioned file holds every captum oracle row; it
SKIPS CLEANLY when the captum extra is absent (the ``captum~=0.7`` ->
``>=0.7,<1.0`` pin widening is externally owned; see the F06 row in
the packaging-request ledger). Dis... |
a443e3ea3cba1308a51c75b954449792f5a70d2c845499561bd1ac78655b1c45 | Python | 15,315 | 366 | import numpy as np
from utils import Recorder, Q_nak
from lifcell import LIFCell
import figure_properties as fp
import matplotlib.pyplot as plt
from matplotlib import gridspec, cm, patches, colors, colorbar
import matplotlib.font_manager as fm
from mpl_toolkits.axes_grid1.anchored_artists import AnchoredSizeBar
fon... |
81a5cd577b7e9c09a9f077ab5a0680283b20740d027e70e34f9fde2bb6f4944c | Python | 15,319 | 450 | """
Session management for Ethoscope Node authentication.
Handles secure session creation, validation, and cleanup.
"""
import datetime
import logging
import secrets
import time
from typing import Any
class SessionManager:
"""
Manages user sessions with secure token generation and validation.
Sessions ... |
d0fe508f934639c7b288b4d8f105060f3c5b561fb3ee860282a3c152ddd38459 | Python | 15,324 | 403 | import torch
from time import time
from copy import deepcopy
import numpy as np
from NNucleate.models import GNNCV, NNCV
from torch.utils.data import DataLoader
from typing import Callable
from scipy.spatial.transform import Rotation as R
import mdtraj as md
from NNucleate.utils import pbc_config, flatten_graph_edges,... |
c478b5955d7839d0f68b6524a0294cbcff77f15371ca7fff3944b8ad63cdc795 | Python | 15,326 | 376 | """SQLAlchemy result store backend."""
import logging
import pickle
from contextlib import contextmanager
from datetime import datetime, timezone
from kombu.utils.encoding import ensure_bytes
from celery import states
from celery.backends.base import BaseBackend
from celery.exceptions import ImproperlyConfigured
from... |
ff5e0fbf0af96433f8c41b2ac3ef8c5f3958662a5a1182974afabbd7d9084fe8 | Python | 15,331 | 503 | from __future__ import annotations
from unittest import mock
import pytest
import env
from pybind11_tests import PYBIND11_REFCNT_IMMORTAL, ConstructorStats, UserType
from pybind11_tests import class_ as m
def test_obj_class_name():
expected_name = "UserType" if env.PYPY else "pybind11_tests.UserType"
asser... |
cadad848975e2a285df73a33e1bfc6e8bcc00b5c1c2b222dc08ca8c652d9c6e2 | Python | 15,337 | 489 | import numpy as np
import matplotlib.pyplot as plt
from ..functional import (
r2,
mae,
mse,
rmse,
accuracy,
precision,
recall,
f1,
confusion_matrix,
)
# Collections
def regression_functions():
"""
All regression functions.
"""
d = {
'r2': r2,
'... |
defa8ac09b20e893c2b8e633cb61524a47928048f3d67481ef989f032643b35c | Python | 15,339 | 404 | """
Comparison Plugin - allows overlay of multiple abf files
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 terms of the GNU General Public Lice... |
9f59288fb21b156beeb415c1bd46410e5443cb9d3a3b78103b5d6693fe5a5b34 | Python | 15,343 | 490 | """Extracellular features functions"""
"""
Copyright (c) 2024, EPFL/Blue Brain Project
This file is part of eFEL <https://github.com/BlueBrain/eFEL>
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License version 3.0 as published
by the Fre... |
7ebb6cb6c50a86dec4966513719a6c0582f8aafdf162e3707df8bfc3a70e3a2e | Python | 15,346 | 333 | import abc
import collections
import os
from typing import Any, Callable, Dict, List, Optional, Tuple, Union, overload
import yaml
from config_manager import config_field, config_template
class BaseConfiguration(abc.ABC):
"""Object in which to store configuration parameters.
Makes checks on configuratio... |
8b899fbf294d21d4807d97865631062148c21086f70a6f91efcf601aefba4a85 | Python | 15,347 | 391 | # Routines and classes to read MES files (as produced by Femtonics microscopes)
import itertools as itt
import numpy as np
from scipy import io
from imfun.external.physics import Q
from ..core.units import QS
from ..core import units
from ..core import fnutils as fu
from ..core import array_handling as ah
def gue... |
ba993c88ea4f0b389924ebaef1e44dda67ec068d66e1e98aa24876df5f34c16d | Python | 15,355 | 403 | """The persisted-state contract service (ecosystem MEMO 3.3, megaplan P05).
ONE service shared by load, inspect, and digest generation: it enumerates the
known fields per record contract (through the field registry, which derives
them from the same ``FIELD_POLICY`` / ``PORTABLE_STATE_SPEC`` tables the
serializers use)... |
709d05dd77be4f061150df2a236450d515338920fdbe5d111b87442168ab7fff | Python | 15,358 | 337 | # -------------------------------------------------------------------------------------
# Code to simulate behaviour from agents fits
# Marta Blanco-Pozo, 2023
# Adapted from Akam, Costa & Dayan (2015), Simple Plans or Sophisticated Habits? State, Transition and Learning Interactions in the Two-Step Task
# ------------... |
a406dde40fac7d3eb531b0675e6ba225c10b66c6efa9ea17c981f68cc520d20a | Python | 15,362 | 372 | """Round-63 immunizer: bare CONSTRUCTION of torch tensor / numpy ndarray types is denied.
The r49 belt (``tests/test_r49_unpickler_weights_only_baseline.py``) closes torch STORAGE
construction, but a torch storage is not the only pickle-reachable attacker-sized
allocator. A hostile ``metadata.pkl`` can REDUCE/NEWOBJ/N... |
910650a48d67bcd627495757f2fae906e2eaf538c76ca731a4d1bf5a2ac48b87 | Python | 15,364 | 543 | """Phase 4c live hook execution tests."""
from __future__ import annotations
from collections import namedtuple
import pytest
import torch
import torchlens as tl
from torchlens._trace_state import TraceState
from torchlens.intervention.errors import LiveModeLabelError, SiteResolutionError
from torchlens.options imp... |
ba57be732ade83b0dfad5e2f319e75f2629ee3e4ae4830914f1b25253398ac19 | Python | 15,367 | 446 | """
Loader for the UI system. Connects to all components of the software.
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 terms of the GNU Genera... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.