sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
f7dc936588ba8046c13b0164bc46575080a626e3d883a2737d69a49b2281deab | Python | 586 | 24 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
requirements = [ "torchvision",
"torch"
]
setup(
packages=find_packages(exclude=['tests']),
include_package_data=True,
install_requires=requirements,
license="MIT license",
zip_safe=False,
... |
08e00c3391b01fb10606e0deb67e57935a1fab0ccb9422fa53af5abcb4b02912 | Python | 587 | 27 | import numpy as np
from impyute.ops import matrix
from impyute.ops import wrapper
@wrapper.wrappers
@wrapper.checks
def random(data):
""" Fill missing values in with a randomly selected value from the same
column.
Parameters
----------
data: numpy.ndarray
Data to impute.
Returns
-... |
7aabc34d5548d06896a5f47a99bf4a6cff87deff65a09aed86714c306007c46b | Python | 587 | 11 | import torch
from dataset import hetero_graph_vectorize
graph, uid_to_user_index, tid_to_tweet_index, train_uid_with_label, valid_uid_with_label, test_uid_with_label = hetero_graph_vectorize(include_node_feature=True, dataset="Twibot-20", server_id="209")
torch.save(graph, "./graph.pt")
torch.save(uid_to_user_index, ... |
8fcad48eeac8aad37e7a8c51fc00781d221b71f7874131764b3c3aea94fc221f | Python | 587 | 22 | from setuptools import setup, find_packages
requirements = [ "torchvision",
"torch"
]
setup(
packages=find_packages(exclude=['tests']),
include_package_data=True,
install_requires=requirements,
license="MIT license",
zip_safe=False,
keywords='brain-score template',
classif... |
17078929bc385907041f9e78d5bb737b5c3d6166a18212d6d7f36b1fef6d67fd | Python | 588 | 31 | #!/usr/bin/env python
"""
Read a MAF from standard input and print average GC content of each alignment
usage: %prog < maf > out
"""
import sys
from bx.align import maf
def __main__():
maf_reader = maf.Reader(sys.stdin)
for m in maf_reader:
gc = 0
bases = 0
for c in m.components:
... |
e96d1daed84753c75bdcdc4bac3ed1e26573d26fbd4dc2db1f8da7040d111806 | Python | 588 | 24 | from dataclasses import asdict, dataclass
import toml
from brainways.utils.paths import get_brainways_config_path
@dataclass
class BrainwaysConfig:
initialized: bool = False
def write_config(config: BrainwaysConfig) -> None:
config_path = get_brainways_config_path()
with open(config_path, "w") as f:
... |
4b503a4c9e2bc8ae78390b1385a7c5088ba4d7262f7fde14bc7f19121591cda1 | Python | 589 | 11 | import torch
from dataset import hetero_graph_vectorize
graph, uid_to_user_index, tid_to_tweet_index, train_uid_with_label, valid_uid_with_label, test_uid_with_label = hetero_graph_vectorize(include_node_feature=True, dataset="cresci-2015", server_id="209")
torch.save(graph, "./graph.pt")
torch.save(uid_to_user_index... |
943277c7f45f763813b08f708d35b6ee5f34977db3ebb1b79a8ddaa449ad14eb | Python | 589 | 22 | import torch
from . import common_functions as c_f
class ModuleWithRecords(torch.nn.Module):
def __init__(self, collect_stats=True):
super().__init__()
self.collect_stats = collect_stats
def add_to_recordable_attributes(
self, name=None, list_of_names=None, is_stat=False
):
... |
df99fbab779657ebd519cdec2ffbbcdc0bcb300aa164a9b4448907a600e1a528 | Python | 589 | 24 | import base64
from IPython.display import HTML
def embed_video(path):
with open(path, "rb") as f:
mp4_data = base64.b64encode(f.read()).decode()
return HTML(
f'<video controls><source src="data:video/mp4;base64,{mp4_data}" '
'type="video/mp4"></video>'
)
def embed_image(path):
... |
179968e518f62c00be54303e213168346289e3378a7cce21d844dc584c3ec936 | Python | 590 | 28 | #!/usr/bin/env python
"""
Randomly shuffle the columns of each block of a maf file. Note that this does
not change any other features of the maf block, thus the text of each row no
longer will match the sequence refered to by the other row attributes!
usage: %prog < maf > maf
"""
import sys
from bx import align
fro... |
42fb061e846897efc22c699544148c44e3dbbb160fedc9e4b56f1f16c0c57b65 | Python | 590 | 19 | # -----------------------------------------------------------------------------
# Copyright © 2009- The Spyder Development Team
#
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# -----------------------------------------------------------------------------
"""Provides QtWebChannel classe... |
5be536481bd74a269ca83040bdf64c5e285a73093862a690a1887ba34f0c0c02 | Python | 590 | 15 | from brainscore_vision import metric_registry
from .metric import CKA, CKACrossValidated
metric_registry['cka'] = CKA
metric_registry['cka_cv'] = CKACrossValidated
metric_registry['cka_biased'] = lambda *args, **kwargs: CKA(*args, unbiased=False, **kwargs)
BIBTEX = """@inproceedings{kornblith2019similarity,
title={... |
b9609182be8a96a4bba9e20537a3268dda6601ee27dcdf32f90e4575d2da7c6b | Python | 590 | 18 | from brainscore_vision import model_registry
from brainscore_vision.model_helpers.brain_transformation import ModelCommitment
from .model import get_model, get_layers, LAYER_NAME
_REGION_LAYER_MAP = {
'V1': LAYER_NAME,
'V2': LAYER_NAME,
'V4': LAYER_NAME,
'IT': LAYER_NAME,
}
model_regist... |
e9ad40dabbd06406652ae83a7b4a1b3e79a57897a9bb551b8346c4bd555cb34c | Python | 590 | 19 | # -----------------------------------------------------------------------------
# Copyright © 2009- The Spyder Development Team
#
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# -----------------------------------------------------------------------------
"""Provides QtWebSockets classe... |
0e3234a42dbcf113c5d097f5d3609337ecb0aa9ee5c990591caba7300b127014 | Python | 591 | 12 | from brainscore_vision import model_registry
from brainscore_vision.model_helpers.brain_transformation import ModelCommitment
from .model import get_model, get_layers
model_registry['abl_light_evresnet_50_457_0'] = lambda: ModelCommitment(
identifier='abl_light_evresnet_50_457_0',
activations_model=get_model('... |
43c675730a92b4db17b059771a767041e1907e4200d22cb3ab7442da6b03d082 | Python | 591 | 23 | import pytest
from qtpy import PYQT5, PYQT_VERSION, QtQuickWidgets
def test_qtquickwidgets():
"""Test the qtpy.QtQuickWidgets namespace"""
assert QtQuickWidgets.QQuickWidget is not None
@pytest.mark.skipif(
PYQT5 and PYQT_VERSION.startswith("5.9"),
reason=(
"A specific setup with at least s... |
994cf81a441a51ac4d2f3ed4d59d8bc8d8357a920044b05fa18701e1c74ed425 | Python | 591 | 22 | # Generated by Django 4.2.1 on 2023-07-10 15:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("engine", "0072_alter_issue_updated_date"),
]
operations = [
migrations.AlterField(
model_name="attributespec",
name="... |
d8ff84802dbf9818392c854c1f416a1e583899a917743fbe771ca45a2a90d242 | Python | 591 | 17 | import torch.nn as nn
class Projector(nn.Module):
def __init__(self, in_dim, out_dim=768, apply_bn=True):
super(Projector, self).__init__()
self.linear1 = nn.Linear(in_dim, in_dim)
self.linear2 = nn.Linear(in_dim, out_dim)
self.bn = nn.BatchNorm1d(in_dim)
self.relu = nn.ReL... |
dc371f19777112285eeb0cac6a48435fcfa4d4dc522a7eb38968a8d462da4a86 | Python | 591 | 20 | """
Reference:
- Zhang, Hang, Chongruo Wu, Zhongyue Zhang, Yi Zhu, Zhi Zhang, Haibin Lin, Yue Sun et al. "Resnest: Split-attention networks." arXiv preprint arXiv:2004.08955 (2020)
"""
import torch
from . import resnet
ResNet = resnet.ResNet
Bottleneck = resnet.Bottleneck
def CSA(pretrained=False, root='~/.encodi... |
2fbe1640918f85278aa658d5278d277b9afa9e8c8ef57a895969cd0df482b0eb | Python | 592 | 36 | __all__ = [
'REGION_COLORS_HIST',
'REGION_COLORS_PHY',
'SESSION_COLORS',
'ROIS_COLORS',
]
SESSION_COLORS = {
'light_bas': 'black',
'dark': 'lightcoral',
'light_end': 'silver'
}
# histology exp
REGION_COLORS_HIST = {
'aRSC': 'gold',
'pRSC': 'violet',
'overlap': 'gray'
}
# physi... |
4a02c1a561e4fe01cc8cd1d15cf754a2c9d2035e36cd67fbf6d4459790ad03a0 | Python | 592 | 23 | import errno
import yaml
import os
def ensure_dir(path):
try:
os.makedirs(path)
except OSError as exception:
if exception.errno != errno.EEXIST:
raise
class ConfigurationLinker(object):
def __init__(self, config_dict):
self.config_dict = config_dict
def save_link... |
8687f3f5c186871116a595d7f322e9e64fcb4149962ff4a177d91fccae14eb3d | Python | 592 | 25 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from .model import SAM
from .predict import (
Predictor,
SAM2DynamicInteractivePredictor,
SAM2Predictor,
SAM2VideoPredictor,
SAM3Predictor,
SAM3SemanticPredictor,
SAM3VideoPredictor,
SAM3VideoSemanticPredictor,
)
__all... |
a48b85afb853072579ae03325b4f6a3d81e69c39a606cb95019d126fa6a20ff8 | Python | 592 | 22 | from typing import Tuple
import numpy as np
from brainways.elastix.elastix import elastix_registration
from brainways.utils.atlas.brainways_atlas import AtlasSlice
def test_elastix(test_data: Tuple[np.ndarray, AtlasSlice]):
image, atlas_slice = test_data
points_src = np.random.randint(0, 10, (5, 2))
fix... |
b8df1f20509327777a32244d4c126a4d90c4337188726dcab26d08c5d6183ec6 | Python | 592 | 21 | import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
description="Biomedical Image Segmentation Models (BISM)",
long_description=long_description,
long_description_content_type="text/markdown",
packages=setuptools.find_packages(),
python_requires=... |
000cd91e3fb9cfb774dd479ac005cbd08a2b2600e757053061a2cc8edbaaa956 | Python | 593 | 16 | featuresetMetadataTemplate= [
"root name",#name of the featureset
"computational sequence description",#name of the featureset
"dimension names"
"computational sequence version",#the version of featureset
"alignment compatible",#name of the featureset
"dataset name",#featureset belongs to which datase... |
bc594af67a9b02ce038edfede302d0145c324c74d2709baccc0298f5e4f23ec6 | Python | 593 | 15 | from qtpy import PYSIDE2, PYSIDE_VERSION, _parse_version
from tests.utils import pytest_importorskip
def test_qtconcurrent():
"""Test the qtpy.QtConcurrent namespace"""
QtConcurrent = pytest_importorskip("qtpy.QtConcurrent")
assert QtConcurrent.QtConcurrent is not None
if PYSIDE2 and _parse_version(... |
3a474ff0b96cc95072fd3daae4558fe23eb34ec9cb234f6d555cfcbeb1d833ab | Python | 594 | 21 | from __future__ import absolute_import
import torch
def to_numpy(tensor):
if torch.is_tensor(tensor):
return tensor.cpu().numpy()
elif type(tensor).__module__ != 'numpy':
raise ValueError("Cannot convert {} to numpy array"
.format(type(tensor)))
return tensor
de... |
808d10bff0c3db8edeb78bb3d7e26399a877ff2c7e9e62812c4d901738876c6e | Python | 594 | 32 | import sys
sys.path.append('../')
import jieba
import jieba.analyse
from optparse import OptionParser
USAGE = "usage: python extract_tags_idfpath.py [file name] -k [top k]"
parser = OptionParser(USAGE)
parser.add_option("-k", dest="topK")
opt, args = parser.parse_args()
if len(args) < 1:
print(USAGE)
sy... |
0ce8aeea746fbe93121cf98ddb9ebce3a837c79c383976c7aecdd1f02e4ccb21 | Python | 595 | 12 | from brainscore_vision import model_registry
from brainscore_vision.model_helpers.brain_transformation import ModelCommitment
from .model import get_model, get_layers
model_registry['abl_pcells_evresnet_50_457_0'] = lambda: ModelCommitment(
identifier='abl_pcells_evresnet_50_457_0',
activations_model=get_model... |
679f72e1b6617448cf7e555bfa312225b6b97dad344cf15a45ba3e584c65922f | Python | 595 | 24 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
requirements = [
]
setup(
packages=find_packages(exclude=['tests']),
include_package_data=True,
install_requires=requirements,
license="MIT license",
zip_safe=False,
keywords='brain-score template',
... |
c2bce0ee97b510cd2a416ec5d73ea1152664bbb17c3e8db08d457e371fa1654c | Python | 595 | 13 | import brainscore_vision
import pytest
@pytest.mark.parametrize('assembly_identifier', [
pytest.param('SanghaviMurty2020', marks=[pytest.mark.private_access]),
pytest.param('SanghaviJozwik2020', marks=[pytest.mark.private_access]),
pytest.param('Sanghavi2020', marks=[pytest.mark.private_access]),
pyte... |
e4ab18deba454fa21c9ca8a061d605153bafd3c534102881d26a34e7668056c7 | Python | 595 | 12 | from brainscore_vision import model_registry
from brainscore_vision.model_helpers.brain_transformation import ModelCommitment
from .model import get_model, get_layers
model_registry['abl_mcells_evresnet_50_457_0'] = lambda: ModelCommitment(
identifier='abl_mcells_evresnet_50_457_0',
activations_model=get_model... |
12a55c34bcf261fa4f648207b0c5160a24ea902bf17a5113b42f2a8ffa981c63 | Python | 596 | 20 | # Created by David Coggan on 2024 06 26
import pytest
from pytest import approx
from brainscore_vision import benchmark_registry, load_benchmark
from brainscore_vision import load_model
def test_benchmark_registry():
assert ('tong.Coggan2024_behavior-ConditionWiseAccuracySimilarity' in
benchmark_regi... |
145ca2fb436d0ab43a413c852bac806cb29c211de5ba2fe9db628f7312fcde2b | Python | 596 | 23 | from .cli_camera import *
from .cli_ccf import *
from .cli_core import *
from .cli_glm import *
from .cli_hist import *
from .cli_io import *
from .cli_model import *
from .cli_multiproc import *
from .cli_output import *
from .cli_persistence import *
from .cli_plot import *
from .cli_rastermap import *
from .cli_roi ... |
24dcef02e69d747568331d60677e5cbf2e67f18d392dccd10acc9dda377fdc2b | Python | 596 | 23 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from collections.abc import Iterable
def parse_frame_step(frame_filter: str) -> int:
return int((frame_filter or "step=1").split("=")[1])
def to_rel_frame(abs_frame: int, *, frame_step: int, task_start_frame: int) -> int:
return (abs_fra... |
45c7387c501cf7b707d6f33581a5d91adb619cd360e6a9ec1ad7ee50ca4648a4 | Python | 596 | 18 | import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
def hide_empty_axes(axes):
[ax.axis("off") for ax in axes.ravel() if ax.axis() == (0.0, 1.0, 0.0, 1.0)]
def colors_from_values(values, palette_name):
# normalize the values to range [0, 1]
normalized = (values - min(values)) /... |
d4fd3fa071b5cd3d54a23a5d0d5e4ec470f9d9e12960987ced8bfd4256adb141 | Python | 596 | 30 | import torch
def bernoulli_kl_divergence(values, targets):
# targets acts as p for P (P is the actual distribution)
# values acts as q for Q (Q is the approximative distribution)
p = targets
q = values
numerator = p - p * q
denominator = q - p * q
loss = p * torch.log(numerator / denomi... |
d5dbbbd60b63b019eaccaf4a12495a21fddf8fa340c82024cbf152550f071ca8 | Python | 596 | 18 | try:
import torch
except ImportError:
raise ImportError(
"\n\nPyTorch is not installed, but it is required for RapidParc.\n" \
"There are two options: \n"
"(i)\t For GPU support, please install PyTorch according to your hardware (recommended): \n"
"\t\t https://pytorch.org/get-st... |
1cb38c6afaebc5ca2c84d9be504f66f2b8258d98c3634ad71dcc923fa38c0569 | Python | 597 | 17 | import sys, importlib.util
sys.path.insert(0,'src')
spec=importlib.util.spec_from_file_location('rc','parityRun/run_step1_freshcheck.py')
m=importlib.util.module_from_spec(spec); spec.loader.exec_module(m)
p=m.build_params()
p.start_analysis_step=3; p.stop_analysis_step=4
p.recording_workers=1
# functional connectivity... |
d90ce58ff0932d404083925e5ca0c84db18d350ccea2bfb896bc4c30565f80f4 | Python | 597 | 19 |
from .brainsfit import BRAINSFit
from .dti_reg import DTIReg
from .dtiaverage import DTIAverage
from .dtiprocess import DTIProcess
from .fiberprocess import FiberProcess
from .fiberpostprocess import FiberPostProcess
from .dtitractstat import DTITractStat
from .greedy_atlas import GreedyAtlas
from .image_math impor... |
5db2f3d8163e1f914cf13ce940d8d69e346dcdcec6b08722a9381c148fec9bc5 | Python | 598 | 16 | import os, sys
# Makes relative imports to work in Python 3.6
# without the need of '.' before the name of the
# package or py file.
# Allows for consistent syntax of relative imports
# across python2 and python3.
here = os.path.dirname(os.path.realpath(__file__))
sys.path.append(here)
# Ground source of truth for ve... |
a690744ba0edae8e2237156c22d7f056a7ca9f991b29396405c591ecd5b9dca0 | Python | 598 | 9 | from brainscore_vision import model_registry
from brainscore_vision.model_helpers.brain_transformation import ModelCommitment
from .model import get_model, get_layers
model_registry['effnetb1_cutmixpatch_augmix_robust32_avge4e7_manylayers_324x288'] = \
lambda: ModelCommitment(identifier='effnetb1_cutmixpatch_augm... |
0a3e7b360472471981d57d128527ec4980b43b96bc05b328c7f3a1e41053dd63 | Python | 599 | 21 | import pytest
from napari_dmc_brainmap._platform import ensure_supported_platform
@pytest.mark.parametrize(
("sys_platform", "machine"),
[
("darwin", "arm64"),
("linux", "x86_64"),
("win32", "AMD64"),
],
)
def test_supported_platforms_are_accepted(sys_platform, machine):
ensur... |
951ea598760091887387aeff9c293f42862da5283cf326238401c34f57f6f52a | Python | 599 | 24 | # Copyright 2015 Numenta Inc.
#
# Copyright may exist in Contributors' modifications
# and/or contributions to the work.
#
# Use of this source code is governed by the MIT
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.
"""
This detector establishes a baseline score by reco... |
a93fd2e80c96ac0ed126550bed7d023cb62cd912ad5a44c13278e59bb3f371aa | Python | 599 | 22 | #!/usr/bin/env python
# author: Jannes Spangenberg
# github: https://github.com/JannesSP
# website: https://jannessp.github.io
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, Namespace
from dynamont.segmentation.utils import plt_parameters
def parse() -> Namespace:
parser = ArgumentParser(
... |
7349f048c65c82ff90627833dca10dcfca1d5501df807376930fe80625ba8322 | Python | 600 | 22 | '''Test the ogo command line interface for calib exists'''
import unittest
import subprocess
class TestCLIForCalib(unittest.TestCase):
'''Test the ogo command line interface for calib exists'''
def test_can_call_calib(self):
'''Can call `ogo calib`'''
command = ['ogo', 'calib']
self.... |
75d58aca755d43c8b58942fc3a65af949d5a2d7a88648d96e94795d012347101 | Python | 600 | 21 | # This file is part of connectome-manipulator.
#
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2024 Blue Brain Project/EPFL
import os
import subprocess
def test_parquet2hdf5():
"""Test if parquet2hdf5 function is available."""
try:
with subprocess.Popen(
["parquet2hdf5", "--versio... |
99538b92f432bf18390968ef7a04e0c4a2bacb59f377f21b281293a33e3aedce | Python | 600 | 30 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from django.contrib import admin
from .models import Membership, Organization
class MembershipInline(admin.TabularInline):
model = Membership
extra = 0
radio_fields = {
"role": admin.VERTICAL,
}
autocomplete_fields = ... |
30b39dbf78bd574ea8f931c5cc3119e100bd80c9ff70e364426afe2827535cd1 | Python | 601 | 22 | import os
import numpy as np
import pandas as pd
import scanpy as sc
import anndata as ad
os.chdir("/data/wuqinhua/phase/covid19")
adata = ad.read_h5ad("./Alldata.h5ad")
sc.pp.normalize_total(adata, target_sum=1e4)
sc.pp.log1p(adata)
batch_key = "batch"
sc.pp.highly_variable_genes(adata, n_top_genes=5000, flavor="ce... |
81cdfe33b69411c7596f146a98acbe1f4291db9f2c394cbbf474dae3d5ad4359 | Python | 601 | 10 | from brainscore_vision import benchmark_registry
from .benchmarks.benchmark import MovshonFreemanZiemba2013V1PLS, MovshonFreemanZiemba2013V2PLS
from .benchmarks.public_benchmarks import FreemanZiembaV1PublicBenchmark, FreemanZiembaV2PublicBenchmark
benchmark_registry['FreemanZiemba2013.V1-pls'] = MovshonFreemanZiemba2... |
bd07b0492c9e6ad3de4de3898a9002a6a2fc1f8eb1b7901164826e49b10cca44 | Python | 601 | 8 | from ._spatial_refine import gen_w, pre_cal1, sparsify, cal_glvs, glvs, estimate_scale
from ._spatial_refine import compute_correlation_matrix_cpu, compute_correlation_matrix_gpu
from ._spatial_refine import H_matrix_vectorized_cpu, H_matrix_vectorized_gpu
from ._spatial_refine import F_spot_optimized_cpu, F_spot_optim... |
ffbbc563eb81a977b223529e68d5924f2dcabee7e784d084335adc0d047289d4 | Python | 601 | 23 | """# File dialog widget
A dialog to select multiple files.
"""
from collections.abc import Sequence
from pathlib import Path
from magicgui import magicgui
# Sequence of paths
# We change the label using "label" for added clarity
# the filter argument restricts file types
@magicgui(filenames={"label": "Choose Tiff ... |
91842e08dde9b9bdc018824d43df6ca58a9c7f1f94de71a7c1cf80f6c4b2d220 | Python | 602 | 22 | from __future__ import print_function
import os
import sys
if len(sys.argv) != 2:
print("Usage: python " + sys.argv[0] + " <refgene file>",
file=sys.stderr)
sys.exit()
refgene_file = sys.argv[1]
gene_to_refseq = dict()
with open(refgene_file, "r") as f:
for line in f:
... |
bdcaa1d6823534e5b0542d410337c72d9aaf806ba4e392f45b09e129a082ec94 | Python | 602 | 21 | from typing import TYPE_CHECKING
from eir.train_utils.evaluation_modules.train_handlers_array_output import (
array_out_single_sample_evaluation_wrapper,
)
if TYPE_CHECKING:
from eir.predict import PredictExperiment
def predict_array_wrapper(
predict_experiment: "PredictExperiment",
output_folder: s... |
dad584816ede9eda9b99eadde144641d3d739d1e8144bde35abb9c8381868025 | Python | 602 | 24 | # Generated by Django 4.2.26 on 2026-02-05 17:10
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("engine", "0097_alter_relatedfile_path"),
]
operations = [
migrations.AddField(
model_name="dat... |
2bad7e8b436e29ad9bf33167eb3b8bae361ebba317424fd71cafdb3d472c6c13 | Python | 603 | 23 | """Prepare training dataset.
"""
from glob import glob
from osl_dynamics.data import Data
# Find files containing the parcel-level data
# Note, spring23 contains eyes closed resting-state data only
files = sorted(glob("/well/woolrich/projects/camcan/spring23/src/*/sflip_parc-raw.fif"))
# Load into osl-dynamics
dat... |
30942c28f0d73f94a773b3e23ae364395c42e21370bfca090b1bdab6ba158776 | Python | 603 | 19 | ''' initializations for the neuron project '''
# general imports
import os
import numpy as np
import keras.backend as K
def output_init(shape, name=None, dim_ordering=None):
''' initialization for output weights'''
size = (shape[0], shape[1], shape[2] - shape[3], shape[3])
# initialize output weights wi... |
413769b3e553b1423697b5651299e48688eb753d6c60b5a9253302b1b1afe1b7 | Python | 603 | 16 | import pod5
def open_pod5(path: str) -> pod5.Reader:
return pod5.Reader(path)
def get_signal(reader: pod5.Reader, read_id: str, calibrated: bool = False):
record = next(
reader.reads(
selection=[read_id],
missing_ok=False,
preload={"samples"},
)
)
# ... |
63cbb2afcaf1a1895ddfda09eaa26f5215156196dce8c64c37b17c4536d31d17 | Python | 603 | 18 | """Migration guidance for removed workflow names."""
REMOVED_WORKFLOWS = {
"python_relp": "deep_agent",
"python_repl": "deep_agent",
}
def get_removed_workflow_message(name: str) -> str | None:
"""Return migration guidance for a removed workflow, if any."""
replacement = REMOVED_WORKFLOWS.get(name)
... |
73484c3a68a14ed63487af5b5b2e99af71e5a603152bd2d411bd2890f8b0c5e8 | Python | 603 | 15 | # scripts/make_val_split.py
import pandas as pd, numpy as np, argparse, pathlib, json, os
p = argparse.ArgumentParser()
p.add_argument("--in", default="data/Data_M1D5_Preproc.csv")
p.add_argument("--out", default="data/val.csv")
p.add_argument("--val_frac", type=float, default=0.2)
p.add_argument("--seed", type=int, ... |
7b2ae6a5997fcb324651da2fbca0b525cdcfc5d100096e45f16990f463d73811 | Python | 603 | 22 | # Copyright (c) DP Technology.
# 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.
from functools import lru_cache
from . import BaseWrapperDataset
class LRUCacheDataset(BaseWrapperDataset):
... |
84cde84a53556a29cd50fe330a3a86084b655c74f89fb04f5dd97c1e4a7b89a1 | Python | 603 | 25 | #!/usr/bin/env python
"""
split bam file into .shrt.bam and .long.bam
Created by Rongxin Fang
Modified by Armen Abnousi
"""
import sys
import pysam
import collections
from itertools import islice
import pybedtools
import time
import sys
def bam2bed(bam1, bed1):
print(time.ctime() + "starting the splitting operation... |
beb1c56ea12a65e814f7c75a08e3113f5619dd871e0f9c0d32f263b5dc0bd9f7 | Python | 603 | 12 | from brainscore_vision import model_registry
from brainscore_vision.model_helpers.brain_transformation import ModelCommitment
from .model import get_model, get_layers
model_registry['abl_contrast_evresnet_50_457_0'] = lambda: ModelCommitment(
identifier='abl_contrast_evresnet_50_457_0',
activations_model=get_m... |
d3224b8140f3465a7ccbaedf3cc43fd81bd81e67541a5f3038f863b31e30ab16 | Python | 603 | 18 | from argclz.commands import parse_command_args
from .main_polar import VisualPolarOptions
from .main_reliability import VisualReliabilityOptions
from .main_sftf_fit import SFTFModelCacheBuilder
from .main_sftf_pref import VisualSFTFPrefOptions
from .main_tuning import VisualTuningOptions
parse_command_args(
usage=... |
090e377f9dd929b1d5cf4a9d87212e059b0a27cd6cea0a986a9e88ee38534668 | Python | 604 | 28 | # -*- coding: utf-8 -*-
# @Author : LG
# import os
import sys
from PyQt5 import QtWidgets
from ISAT.widgets.mainwindow import MainWindow
# ubuntu18.04装其他应用时,环境崩了。。。qtapp初始化后,torch调用cuda会卡死,但先调用下cuda就不会卡死。
import torch
torch.cuda.is_available()
# (知道怎么处理该问题,请反馈下 T.T)
def main():
from ISAT.banner import print... |
c67173bb44137f19ac4a62714f5158d30df335cd73ca902dfc2a87630e4188e0 | Python | 604 | 24 | # torch imports
import torch
import torch.nn as nn
class FFNet(nn.Module):
'''
Simple Feed-Forward Neural Network
'''
def __init__(self, n_input, n_hidden, n_out):
super().__init__()
self.layers = nn.Sequential(nn.Linear(n_input, n_hidden),
nn.Softplus(),
... |
c94a9525b06aba253794e0bd70956960fc2fa9a4607cf682154f24ce583a88c1 | Python | 604 | 21 | from __future__ import absolute_import
import torch
from ..utils import to_torch
def accuracy(output, target, topk=(1,)):
with torch.no_grad():
output, target = to_torch(output), to_torch(target)
maxk = max(topk)
batch_size = target.size(0)
_, pred = output.topk(maxk, 1, True, Tr... |
d4efd8f6cdd536c3dfff3789b004103bd28cbe4145c9f1626155af9fdf41ad6d | Python | 604 | 16 | import importlib.metadata
__appname__ = "Labelme"
# Semantic Versioning 2.0.0: https://semver.org/
# 1. MAJOR version when you make incompatible API changes;
# 2. MINOR version when you add functionality in a backwards-compatible manner;
# 3. PATCH version when you make backwards-compatible bug fixes.
# e.g., 1.0.0a0... |
1f2444210ce0ad58e23765adc0a076d32c3cbceae3f28c4882627bca466e46b8 | Python | 605 | 24 | import numpy as np
from impyute.deletion import complete_case
from impyute.ops.testing import return_na_check
SHAPE = (5, 5)
def test_complete_case_(test_data):
data = test_data(SHAPE)
imputed = complete_case(data)
return_na_check(imputed)
def test_impute_missing_values(test_data):
data = test_data... |
5520908acbd140d74d1d1bb6400f41b2a025148ac074e99fbb520c90dc81d20a | Python | 605 | 19 | from __future__ import annotations
from chemgraph.academy.dashboard.server import DashboardHandler
from chemgraph.academy.dashboard.server import events_payload
from chemgraph.academy.dashboard.server import main
from chemgraph.academy.dashboard.server import parse_args
from chemgraph.academy.dashboard.server import s... |
9359b5b575dff0a4c9c806e10f9627dca0ea600c9b68dbfdaedf0d168eda8e6e | Python | 605 | 19 | # -----------------------------------------------------------------------------
# Copyright © 2009- The Spyder Development Team
#
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# -----------------------------------------------------------------------------
"""Provides QtRemoteObjects cla... |
957051daa7a43203f915751140fff7b525dd5ac9de84c69745ea6ee7a8220f25 | Python | 605 | 23 | import pytest
def pytest_addoption(parser):
parser.addoption(
"--ml", action="store_true", default=False,
help="Run machine learning tests"
)
def pytest_configure(config):
config.addinivalue_line(
"markers", "ML: mark test that refer to machine learning")
def pytest_collection_... |
bfa460dab6499f3df4db87283ec7589cf67e844552d52eb04d0dad9ef607cd10 | Python | 605 | 23 | import click
from _cli import LazyGroup
# @click.group(
# cls=LazyGroup,
# lazy_subcommands={
# "mesh-generation": "brainmeshing.mesh_generation.meshgen",
# "process-surfaces": "brainmeshing.mesh_generation.process_surfaces",
# "extract-ventricles": "brainmeshing.mesh_generation.extra... |
114de0f65f7280b0493350030d984e130ac692d50f13640086ac16097633a992 | Python | 606 | 23 | # Generated by Django 4.2.21 on 2025-05-27 11:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("engine", "0089_alter_labeledimage_source_alter_labeledshape_source_and_more"),
]
operations = [
migrations.AddField(
model_name... |
1334d56e530fd712d3be88d7a50bd2bec5167d0b3219c303a27503295df7acf2 | Python | 606 | 24 | import logging
import os
import sys
def setup_logging(output_folder):
"""
Set up logging to output logs to both a file and the terminal.
Parameters
----------
output_folder : str
Path where log file will be stored.
"""
os.makedirs(output_folder, exist_ok=True)
log_file = os.pat... |
876945632cdc5feb72963a1c04a196eed9fa5f8910684d92fc1ac3a38780a48e | Python | 606 | 23 | # Copyright (C) 2021 Intel Corporation
# Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from django.apps import AppConfig
class OrganizationsConfig(AppConfig):
name = "cvat.apps.organizations"
def ready(self) -> None:
from django.conf import settings
from . import defaul... |
ad4874bb1fc255b5e764ca7b33b829d965862188ce034f149bcaf97d782b98f2 | Python | 606 | 23 | # -----------------------------------------------------------------------------
# Copyright © 2009- The Spyder Development Team
#
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# -----------------------------------------------------------------------------
"""Provides QtScxml classes and... |
f102ee9f76ac64c405158c80454840845bb73eb8c340f8e9efaefce55886aa15 | Python | 607 | 11 | from PUMI.pipelines.multimodal.atlas import atlas_selection
atlas_selection_wf = atlas_selection('atlas_selection_wf',modularize=True, module_threshold=0.0)
atlas_selection_wf.get_node('inputspec').inputs.atlas = 'basc'
atlas_selection_wf.get_node('inputspec').inputs.atlas_params = {}
atlas_selection_wf.get_node('inpu... |
3f94f969a9b4207346165957d56fbb0bbfe1d45439eed9bba22b3e80959845e8 | Python | 608 | 20 | """
kinescope: Predict clinical and sports scores from human movement video.
Canonical pose format: COCO-17 keypoints.
Supported pose sources: sam3d-video-pose, OpenPose, MediaPipe, KinectV2, SMPL.
"""
from kinescope.pipeline.pose_pipeline import PoseProcessingPipeline
from kinescope.prediction.train import train_and... |
dadb19e371315536e6192037b06583abf491e599e1301840b85cd07737faf5fe | Python | 608 | 25 | """ Slice a surface in different planes """
import SVMTK as svm
from pathlib import Path
import numpy as np
if __name__ == "__main__":
print("Start ",__file__)
cube = svm.Surface()
sphere= svm.Surface()
outdir = Path("results")
outdir.mkdir(exist_ok=True)
surf = svm.Surface("../Data/b... |
58955ab69069eea96c677e4fb68a0fd88325e63e1fd89c227ce226d22f623817 | Python | 609 | 19 | # mc_analysis.is developed using the version philosophy described here: https://semver.org/
import importlib.metadata
from pathlib import Path
import toml
_PROJECT_PATH = Path(__file__).parents[1]
try:
__version__ = importlib.metadata.version(__package__ or __name__)
except importlib.metadata.PackageNotFoundErro... |
730591610926e182d6b7cfc43e6aa6b7d4d2ca234ecb4c44ccc84cc357afd9d6 | Python | 609 | 23 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 16 12:07:14 2018
@author: hromada
"""
f = open('filter_report.log','r')
passfilter = 0
total_num = 0
for line in f.readlines():
if line[0:5] == '\tPass':
x = line.split(':')[1]
passfilter = passfilter+ int(x.split(' / ')[0])
... |
5251c01e4c7b0e5a3f5aea42862d5ace91ba15f176d23e42ff4a4430b48f0fe4 | Python | 610 | 25 | import networkx as nx
from node2vec import Node2Vec
import numpy as np
import os
from tqdm import tqdm
edge_path=r'Twibot-22/edges.npy'
edge_index=list(np.load(edge_path))
edges=edge_index
dataset_name='Twibot-22'
id_include=(np.load(dataset_name+'/id_include.npy',allow_pickle=True))
if not os.path.exists(dataset_name... |
998e9444b5816f5c0d0040469a278ce2e917b6737ee4fac345d79663d9b8bd8f | Python | 610 | 25 | """Utility for stripping known image file extensions from filenames."""
import os
def strip_extension(filename: str) -> str:
"""Strips the extension from filename.
Handles the double extension of ``.nii.gz`` as a single unit;
any other extension is stripped via ``os.path.splitext``.
Parameters
... |
187d5fa51e662a1591416cdcd66eb66865cb5b691ef9b4bacbd164a11d6e0835 | Python | 612 | 20 | # -*- coding: utf-8 -*-
"""
Created on Sat Oct 15 18:03:10 2022
@author: tianj
"""
import torch.nn as nn
# initialize orthogonal weights
def InitializeWeights(m):
if isinstance(m, nn.Conv2d):
#nn.init.orthogonal_(m.weight.data)
nn.init.xavier_uniform_(m.weight.data)
if m.bias is not Non... |
8e82ba26db4f109795a39e2fabfa5e9c1fb0bb2ce15e847bb9b9698783f7688f | Python | 612 | 25 | # -*- coding: utf-8 -*-
"""
Created on Tue Dec 3 23:32:10 2019
@author: Yoshi
"""
import numpy as np
def background_calculator(segment,data_duration):
# Make empty list for background
background_data = []
# Finds the start and end values for the background and finds the slope
slope = (segm... |
afd3b5100e666c72f75740171870756dcd749f7fdd9682727fe13961461c7476 | Python | 612 | 26 | import os
import sys
import scipy
import numpy as np
import pandas as pd
import scanpy as sc
os.chdir("/data/wuqinhua/phase/covid19")
adata = sc.read('./Alldata_hvg.h5ad')
adata.raw = adata
adata = adata[:,adata.var.highly_variable]
sc.pp.scale(adata, max_value=10)
sc.tl.pca(adata, svd_solver='arpack')
sc.pp.neighb... |
fd3f4477d6df661153b62f9495566e29ae2981e93292b54ac342b4b9b38cc72b | Python | 612 | 18 | """Contains constants used throughout ADMET-AI."""
from importlib import resources
# Paths to data and models
with resources.path("admet_ai", "resources") as resources_dir:
DEFAULT_ADMET_PATH = resources_dir / "data" / "admet.csv"
DEFAULT_DRUGBANK_PATH = resources_dir / "data" / "drugbank_approved.csv"
DE... |
6f6230ad6428e7d073c168fc28aa7d62178ba7da9babf88a9ed9f8107d1d9ec9 | Python | 613 | 8 | from brainscore_vision import benchmark_registry
from brainscore_vision.benchmarks.bmd2024.benchmark import BMD2024AccuracyDistance
# behavioral benchmarks
benchmark_registry['BMD2024.texture_1Behavioral-accuracy_distance'] = lambda: BMD2024AccuracyDistance('texture_1')
benchmark_registry['BMD2024.texture_2Behavioral-... |
8173672265a568594fdb56bda5af55526738a5f58599a49cceead28dfc4eb9a9 | Python | 613 | 27 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from functools import partial
from pathlib import PurePosixPath
import pytest
import shared.utils.s3 as s3
@pytest.fixture
def fxt_uploaded_s3_file(request: pytest.FixtureRequest):
def upload_file(s3_client: s3.S3Client, *, path: PurePosixPat... |
eec429f6756e42a51ad835a6be3c0408986044238c1f3ca2ea5580826020564a | Python | 613 | 16 | from brainscore_vision import metric_registry
from .metric import I1, I2n
metric_registry['i1'] = I1
metric_registry['i2n'] = I2n
BIBTEX = """@article{rajalingham2018large,
title={Large-scale, high-resolution comparison of the core visual object recognition behavior of humans, monkeys, and state-of-the-art deep art... |
2275f02ee2609c3b2beadde5fc256b955813fe91dca9ab851da6602d77e29793 | Python | 614 | 28 | import numpy as np
import pickle
import matplotlib.pyplot as plt
import src.pureCont as pC
def save_anal(dat_dir,save_dir):
res=[]
#load input
with open(dat_dir, 'rb') as f:
state,N,assdict=pickle.load(f)
#data loop
print(N)
for i in range(0,N):
arr=state[i]
nar=[]
... |
74c11c0f2953c69718d3ecb8d884c8a2d417e5866dd3b8a47691a9cf088431a6 | Python | 614 | 21 | from typing import TYPE_CHECKING
from eir.train_utils.evaluation_modules.train_handlers_sequence_output import (
sequence_out_single_sample_evaluation_wrapper,
)
if TYPE_CHECKING:
from eir.predict import PredictExperiment
def predict_sequence_wrapper(
predict_experiment: "PredictExperiment",
output_... |
d056bee99b934bda57c161cc8948749df07d94fdc23690c499a981eead8a4a1e | Python | 614 | 15 | """Resolve operator-configured executables without invoking a shell."""
import os
from pathlib import Path
import shutil
def resolve_executable(name: str, env_var: str | None = None) -> str:
"""Resolve an environment override or a command on PATH at call time."""
command = os.environ.get(env_var, name) if en... |
e1ebcfc02f7d808a462cf2b43716c7c299c99c012556849b7255400811a92202 | Python | 614 | 23 | # -----------------------------------------------------------------------------
# Copyright © 2009- The Spyder Development Team
#
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# -----------------------------------------------------------------------------
"""Provides QtUiTools classes a... |
e6c63cb64cf10585256804447c2a22093a1f7f250726efac4aa1411aa97962c1 | Python | 614 | 25 | # Generated by Django 3.2.15 on 2022-09-09 09:00
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("engine", "0059_labeledshape_outside"),
]
operations = [
migrations.AlterField(
model_name="lab... |
92aa9e1c847afce14c73d4fcb3811b232e972546bf0f6879cd2acdbf4dbedf8a | Python | 615 | 20 | """Tools for optimizing NEMS Models with TensorFlow."""
import tensorflow as tf
gpus = tf.config.list_physical_devices('GPU')
if gpus:
try:
# Currently, memory growth needs to be the same across GPUs
for gpu in gpus:
tf.config.experimental.set_memory_growth(gpu, True)
logical_gpus = tf.config.lis... |
54e0c2dc5c9d44a15397f7860f91ea4f12e9b7ff8d5a2b1d905ef7b8bbe02717 | Python | 618 | 21 | import numpy as np
from AFQ.nn.utils import merge_PVEs
def test_wm_is_elementwise_maximum():
a = np.array([[0.5, 0.3, 0.2], [0.1, 0.1, 0.8]])
b = np.array([[0.1, 0.2, 0.7], [0.4, 0.3, 0.3]])
np.testing.assert_allclose(merge_PVEs(a, b)[..., 2], [0.7, 0.8])
def test_larger_gm_source_wins():
a = np.ar... |
821e882a3184c742b08db33581b5dbfaaf8bb74a5549fe5a393a28a936e07150 | Python | 618 | 25 | import base64
import numpy as np
import requests
def encode_numpy_array(file_path: str) -> str:
array = np.load(file_path)
encoded = base64.b64encode(array.tobytes()).decode("utf-8")
return encoded
def send_request(url: str, payload: list[dict]):
response = requests.post(url, json=payload)
retu... |
51f4676908da4853bbff20646b82930f6c2d468e22910d0b95b9335d8176ae6a | Python | 619 | 25 | """magicgui is a utility for generating a GUI from a python function."""
from importlib.metadata import PackageNotFoundError, version
try:
__version__ = version("magicgui")
except PackageNotFoundError: # pragma: no cover
__version__ = "uninstalled"
__author__ = """Talley Lambert"""
__email__ = "talley.lambe... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.