sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
8c79f75e74339e3ec98080e5fec5624644c7f684ebbee9f83f2f7c2ece2ec60c | Python | 271 | 9 | """
The primary PLS decomposition methods for use in conducting PLS analyses
"""
__all__ = ["behavioral_pls", "meancentered_pls", "pls_regression"]
from .behavioral import behavioral_pls
from .meancentered import meancentered_pls
from .regression import pls_regression
|
8fd18aea54027d4fd4718af42ece08d3e4b1d0f73deea65a0b13c12c318a476f | Python | 271 | 7 | import pytest
import brainscore_vision
@pytest.mark.travis_slow
def test_has_identifier():
model = brainscore_vision.load_model('convnext_base_fb_in22k_ft_in1k_gram_aligned_dinov3')
assert model.identifier == 'convnext_base_fb_in22k_ft_in1k_gram_aligned_dinov3'
|
d4b3225650b5cb1a219eede26b3884edb214d22f3282613ea78c3288bb33fb17 | Python | 271 | 12 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from rest_framework.routers import DefaultRouter
from .views import WebhookViewSet
router = DefaultRouter(trailing_slash=False)
router.register("webhooks", WebhookViewSet)
urlpatterns = router.urls
|
e9a0fa493ace4575c51c3306ca4abab7c21ccd1a79626e197ba3b85e2c4f2195 | Python | 271 | 7 | import pytest
import brainscore_vision
@pytest.mark.travis_slow
def test_has_identifier():
model = brainscore_vision.load_model('deit3_base_patch16_224_fb_in1k_gram_aligned_dinov3')
assert model.identifier == 'deit3_base_patch16_224_fb_in1k_gram_aligned_dinov3'
|
f6775caa52dfd58fa2ae1bb0c8dc32b87016c8d62ff5e474ce97ecf9ab20174b | Python | 271 | 9 | import os
# includes important Paths which are used frequently
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
DATA_IN_DIR = os.path.join(ROOT_DIR, 'data_in')
DATA_OUT_DIR = os.path.join(ROOT_DIR, 'data_out')
BIDS_DIR = os.path.join(ROOT_DIR, 'data_in', 'bids')
|
7b832308c188833be58d1be82ed9dd0026c6850fa6d9e4cbba2b562ee927096f | Python | 272 | 12 | from setuptools import setup
setup(name='UMI',
version='1.0',
description='Python Distribution Utilities',
author='Martin Aryee',
author_email='',
url='https://github.com/aryeelab/umi',
install_requires=[
'htseq'
]
) |
c5658c47f323231e211bd882890616386a76c4587659036d9dc16c38d0fface0 | Python | 272 | 22 | # -*- coding: utf-8 -*-
"""
Created on Tue Jul 28 13:33:30 2015
@author: ckirst
"""
import numpy as np;
def dosomething(x):
x = x.transpose();
return x;
z = np.random.rand(215000,5);
print z.shape
y = dosomething(z);
print z.shape
print y.shape |
34b41e9f7ed0be27e428af2bdb999b17d7d0ae03cdab6fadfb0237bec29d9b5b | Python | 273 | 10 | '''Base Model class and a collection of pre-built models and related tools.
'''
from .LN import LN_STRF, LN_pop
from .CNN import CNN_pop
from .decoder import LN_reconstruction, CNN_reconstruction
from .base import Model, Model_List
from .Multitask import MultiTaskModel
|
90ddeb62a958f0a7a53098289ad82e829687d4c3f02e946648e037585bbe68c2 | Python | 273 | 12 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from rest_framework import routers
from . import views
router = routers.DefaultRouter(trailing_slash=False)
router.register("events", views.EventsViewSet, basename="events")
urlpatterns = router.urls
|
c88e185650d6ba02c0445fc3a9703c08fb922a333d5e6165b10beab39772d1e0 | Python | 273 | 10 | from .file_loaders import get_loader, get_format
from .file_writers import get_writer, get_format
from .process import crop, stitch, normalize
from .show import show
__all__ = [
"get_loader", "get_writer", "get_format",
"crop", "stitch", "normalize",
"show"
]
|
14337395c3c4c0c9e8f2f1a4194cc1303e46010c30a4c9e57b9fa276ac420aa3 | Python | 274 | 10 | from argclz.commands import parse_command_args
from .main_eval import BehavioralGLMOptions
parse_command_args(
usage='python -m rscvp.model CMD ...',
description='do the related analysis for the modeling',
parsers=dict(
lnp=BehavioralGLMOptions
)
)
|
1fe81e5b1be129b15cd754149c3d41fbcd10331498a0de6ff4677828e75c1efc | Python | 274 | 8 | from .dot_product_similarity import DotProductSimilarity
class CosineSimilarity(DotProductSimilarity):
def __init__(self, **kwargs):
super().__init__(normalize_embeddings=True, **kwargs)
assert self.is_inverted
assert self.normalize_embeddings
|
5afce3390c9e94838e714ad195d948e6654209e27983c64e0e3c4279f1c206d1 | Python | 274 | 11 | from importlib.metadata import PackageNotFoundError, version
from napari_dmc_brainmap._platform import ensure_supported_platform
ensure_supported_platform()
try:
__version__ = version("napari-dmc-brainmap")
except PackageNotFoundError:
__version__ = "0+unknown"
|
75acda8c38cc37e27334ea73c01fb4ab4cbf931b7bc8d2e4cf131f4d3e9beb28 | Python | 274 | 10 | from tests.utils import pytest_importorskip
def test_qtpdf():
"""Test the qtpy.QtPdf namespace"""
QtPdf = pytest_importorskip("qtpy.QtPdf")
assert QtPdf.QPdfDocument is not None
assert QtPdf.QPdfLink is not None
assert QtPdf.QPdfSelection is not None
|
a30b1f62469f51675ba2dc7c81b4585b949b0b2c7655eefb4923fb1e9b67bfc9 | Python | 274 | 13 | from importlib.metadata import PackageNotFoundError, version
try:
__version__ = version("dynamont")
except PackageNotFoundError:
__version__ = "unknown"
from dynamont._dynamont import Aligner, PoreType
__all__ = [
"Aligner",
"PoreType",
"__version__"
] |
f2c5bbb21a031411afe88ae0d7cc5717899d4d16ea75f1323b156e50b2df8f4c | Python | 274 | 11 | """Sets the config parameters for the ADMET-AI Flask app object."""
from admet_ai.constants import (
DEFAULT_DRUGBANK_PATH,
DEFAULT_MODELS_DIR,
)
MODELS_DIR = DEFAULT_MODELS_DIR
DRUGBANK_PATH = DEFAULT_DRUGBANK_PATH
LOW_PERFORMANCE_THRESHOLD = 0.6
NUM_WORKERS = 0
|
6152b3dbc499a6aa20c0402b4d65a97841d772a378b42d2d52ace2774d0eccf3 | Python | 275 | 8 | import pathlib
REPO_PATH = pathlib.Path(__file__).parent.parent
DATA_PATH = REPO_PATH / "data"
WAVEFORM_PATH = REPO_PATH / "data" / "waveforms"
IRF_PATH = REPO_PATH / "data" / "irf"
FIGURE_PATH = REPO_PATH / "data" / "figures"
FIGURE_PATH.mkdir(exist_ok=True, parents=True)
|
64ffeb410d2a01318489b500f48f03d497c3d64453d97ab0f12b0e30f21d7688 | Python | 275 | 12 | """ Unorganized set of utility functions """
from . import error
from . import inverse_distance_weighting
from . import matrix
from . import util
from . import wrapper
__all__ = [
"error", "inverse_distance_weighting", "matrix",
"util", "wrapper"
]
|
a155bba4a3c350b9886466fc711f4550a18026fa506c1611bdea5e3a5e359ae5 | Python | 275 | 3 | from enformer_pytorch.config_enformer import EnformerConfig
from enformer_pytorch.modeling_enformer import Enformer, from_pretrained, SEQUENCE_LENGTH, AttentionPool
from enformer_pytorch.data import seq_indices_to_one_hot, str_to_one_hot, GenomeIntervalDataset, FastaInterval |
dc84e1859d7096463d16f9969bd704fb9f99c84e85d4583302d43a8ce385cf3c | Python | 275 | 7 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from .predict import SegmentationPredictor
from .train import SegmentationTrainer
from .val import SegmentationValidator
__all__ = "SegmentationPredictor", "SegmentationTrainer", "SegmentationValidator"
|
1447b95524a67601a3499850cfeba30f3813079649b842306f5948a0f569bbfd | Python | 277 | 15 | def test_import():
import encore
def test_entry_point():
import subprocess
import sys
result = subprocess.run(
[sys.executable, "-m", "encore", "--version"],
capture_output=True,
text=True,
)
assert result.returncode == 0
|
2f4fd2841e475adf7ee4ca1d6e245d52f3bed92af01c56a54178538a5e604dfe | Python | 277 | 7 | from pathlib import Path
import importlib
# automatically import any Python files in the criterions/ directory
for file in sorted(Path(__file__).parent.glob("*.py")):
if not file.name.startswith("_"):
importlib.import_module("unimol_plus.tasks." + file.name[:-3])
|
61f91670ea0e3fc72aa7fbbf2a547841ec0cb7a7df2798ba4ac176ad1d341d53 | Python | 277 | 9 | from tests.utils import pytest_importorskip
def test_qtaxcontainer():
"""Test the qtpy.QtAxContainer namespace"""
QtAxContainer = pytest_importorskip("qtpy.QtAxContainer")
assert QtAxContainer.QAxSelect is not None
assert QtAxContainer.QAxWidget is not None
|
9e6ace858c5906341ed6fc328aeda12f8843845ed671127cb4da9b9cbbfd0949 | Python | 277 | 7 | from pathlib import Path
import importlib
# automatically import any Python files in the criterions/ directory
for file in sorted(Path(__file__).parent.glob("*.py")):
if not file.name.startswith("_"):
importlib.import_module("unimol_plus.models." + file.name[:-3]) |
d91719c5739dddc5e94b795f4f162c56c23645fb64cb3da00ecb765f156a6eba | Python | 277 | 9 | """
This submodule contains data related code and numpy operations.
"""
from .cpn import *
from .cpn import labels2contour_list as labels2contours
from .misc import *
from .instance_eval import LabelMatcherList, LabelMatcher
from .segmentation import *
from .datasets import *
|
872ff62bdb532010264764fc38a630f41c3c1a35df236ab2d2c13b7fdcdff90c | Python | 278 | 10 | # import self-written scripts to get random positions and manage exp
import exp_utils
LOCATION = '7tscanner'
EXPNAME = 'priming'
# progress through the 'waiting for scanner...' screen by pressing 5
if __name__ == '__main__':
exp_utils.run_exp(LOCATION, exp_name=EXPNAME)
|
bb3b430dcdee3c534cb6b80b3ad7ed54ab37b652a5eb8c96b6816a9df4dedc8a | Python | 278 | 8 | from .pyvisascope import scope, get_resources
from .TDS2000 import TDS2000
from .RIGOL_DS1000Z import DS1000Z
from .RIGOLMS05000 import MSO5000
from .SIGLENT import SIGLENT
from .SDS_1104X_E import SDS_1104X_E
from .SDS_1104X_E import SDS_1104X_E
from .RS_RTB2000 import RTB2004 |
d482d8464015129f5ae7bc3d644628aa1768288ce47796480c3cab0a62bea8d4 | Python | 278 | 7 | from pathlib import Path
import importlib
# automatically import any Python files in the criterions/ directory
for file in sorted(Path(__file__).parent.glob("*.py")):
if not file.name.startswith("_"):
importlib.import_module("unimol_plus.losses." + file.name[:-3])
|
39e922a0824ba099e7d4f5b74d519127a05702184a7d85ef96ba8ac2f6316d18 | Python | 279 | 9 | from tests.utils import pytest_importorskip
def test_qtsvgwidgets():
"""Test the qtpy.QtSvgWidgets namespace"""
QtSvgWidgets = pytest_importorskip("qtpy.QtSvgWidgets")
assert QtSvgWidgets.QGraphicsSvgItem is not None
assert QtSvgWidgets.QSvgWidget is not None
|
3e5ba8fdba360ca829bcbb44107c3e81b22d174c733eb53b9ae461a71dfb263b | Python | 279 | 11 | from setuptools import setup
setup(
name='lib_3d_OT',
version='0.1.1',
url='https://github.com/dbjzs/3d-OT',
author='Bingjie Dai',
author_email='17516970902@163.com',
license='Apache',
packages=['lib_3d_OT', 'lib_3d_OT.ottools'],
zip_safe=False
)
|
448f1ca6037ff1c06e1bbedeb6f10602a9633a4258facc63c998a38d0fd3deea | Python | 279 | 12 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
def test_help_option(script_runner):
ret = script_runner.run(['scil_get_version', '--help'])
assert ret.success
def test_execution(script_runner):
ret = script_runner.run(['scil_get_version'])
assert ret.success
|
6a7908bd74e5cfec1613c1665f9e4c7d17268c252f237fc58ce54a9456387a45 | Python | 279 | 9 | # Module initialization
from .preprocessing import load_data, extract_edge_indices, create_atom_features, prepare_data_for_training, get_base_feature_dimension
__all__ = [
'load_data',
'extract_edge_indices',
'create_atom_features',
'prepare_data_for_training'
] |
191a99a5a8672267f3eb55e52c0fa2aba8cacf44f74c28d166926db7d0a8bf23 | Python | 280 | 11 | """
This module contains various learning rules for updating weights in neural networks.
"""
from .base_classes import *
from .backprop import *
from .backprop_like import *
from .hebbian import *
from .btsp import *
from .dendritic_loss import *
from .weight_functions import *
|
4b5a88b9d082202acdb69697b087b28ea85876512fc094301011562f9cb9ea2c | Python | 280 | 11 | from enum import Enum, auto
class FeatureSelectionType(Enum):
RFE = auto()
SelectFromModel = auto()
SequentialFeatureSelector = auto()
SelectBySingleFeaturePerformance = auto()
SelectByShuffling = auto()
GeneticSelectionCV = auto()
BorutaPy = auto()
|
08642b735ca47857590e70a226ec2b5949db47f7b6b44ae263d790b979e27d20 | Python | 282 | 10 | # scoreprs/__init__.py
__version__ = "1.1.0"
__author__ = "Seth A. Sharp"
__email__ = "ssharp@stanford.edu"
from .core import score_bcf
from .extensions import gen_dm
from .extensions.SQL import get_snp_db, get_dm_sql
__all__ = ["score_bcf", "gen_dm", "get_snp_db", "get_dm_sql"]
|
3faf87f3c2c5a7c5451392dfc722b7a81a4478c5d70a20b55da130f2b7581bdb | Python | 282 | 10 | # import self-written scripts to get random positions and manage exp
import exp_utils
LOCATION = '7tscanner'
EXPNAME = 'harveyaudio'
# progress through the 'waiting for scanner...' screen by pressing 5
if __name__ == '__main__':
exp_utils.run_exp(LOCATION, exp_name=EXPNAME)
|
97e97c39e175145b155427776507be64d04d5a0b53a232e4a8d904a1d55a2ed0 | Python | 283 | 13 | # Copyright (C) 2022 Intel Corporation
# Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import django.db.models as models
class FunctionKind(models.TextChoices):
DETECTOR = "detector"
INTERACTOR = "interactor"
REID = "reid"
TRACKER = "tracker"
|
64bbcf60a3649750d90efbfd037e6b5699d57be448d7aaf5ae9b198e4b3dc510 | Python | 285 | 11 | # Copyright (c) OpenMMLab. All rights reserved.
from .kitti import KITTIDataset
from .nyu import NYUDataset
from .sunrgbd import SUNRGBDDataset
from .builder import DATASETS, PIPELINES, build_dataloader, build_dataset
__all__ = [
'KITTIDataset', 'NYUDataset', 'SUNRGBDDataset'
] |
9ff384f9a154f53184587cd02e524c657f9cdf981f3f584347e6f00dab6f5c80 | Python | 285 | 8 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from .base import ComparisonSample, FrameComparisonSample, QualityBackend
from .factory import make_quality_backend
__all__ = ["ComparisonSample", "FrameComparisonSample", "QualityBackend", "make_quality_backend"]
|
5e1ee73d9f0d16158894862ad90fcf7d2211b3daf52332ae77af65802816414f | Python | 286 | 12 | import numpy as np
def getXYloc(statFpath):
stat = np.load(statFpath, allow_pickle=True)
x_loc = [stat[x]['med'][0] for x in np.arange(0, len(stat))]
y_loc = [stat[x]['med'][1] for x in np.arange(0, len(stat))]
XYloc = np.stack([x_loc, y_loc])
return XYloc
|
c1ca8d7ac1ebd13e0347473397b002bd1c2ce253f4c3ccfb881323176b0013f5 | Python | 286 | 8 | import streamlit as st
pg = st.navigation([st.Page("src/pages/1_Welcome.py"),
st.Page("src/pages/2_Database.py"),
st.Page("src/pages/3_Submit_New_Article.py"),
st.Page("src/pages/4_Legal.py"),
])
pg.run()
|
c3a6bb73734b56eb95f08f06c0611e68379ff799ac55399c677b498c21813d24 | Python | 286 | 12 | # Copyright (C) 2019-2022 Intel Corporation
#
# SPDX-License-Identifier: MIT
import mimetypes
import os
_SCRIPT_DIR = os.path.realpath(os.path.dirname(__file__))
MEDIA_MIMETYPES_FILES = [
os.path.join(_SCRIPT_DIR, "media.mimetypes"),
]
mimetypes.init(files=MEDIA_MIMETYPES_FILES)
|
0135c76514ee145d27be3a6bfe4c5f1ba0cdd6fd4d43772456697b9c1b187eb5 | Python | 287 | 13 | from logging import warn
class Defaults(object):
encoding = 'utf-8'
max_tokens = None
token_level_eval = False
def __getattr__(self, name):
warn('missing default for {}'.format(name))
setattr(self, name, None)
return None
defaults = Defaults()
|
254510e4e39f89a66519af0d72bacac576c79bb99830fda3c2ab07ea76b79fcd | Python | 287 | 16 | #!/usr/bin/env python3
# coding: utf-8
import json
import nrn_validation as V
V.override_defaults_from_args()
model = V.VModel()
model.add_soma(18.8, Ra=100)
model.add_iclamp(10, 100, 0.1)
data = V.run_nrn_sim(100, report_dt=None, model="soma")
print(json.dumps(data))
V.nrn_stop()
|
6d041640d3ba3665b63afcef9730921377a211e690ff539eb1a7973c56b3edcb | Python | 288 | 10 | # -*- coding: utf-8 -*-
def test_class_tracker():
"""
We will not test the tracker / propagator : too big to be tested, and only
used in scil_tracking_local_dev and scil_fibertube_tracking, which are
intented for developping and testing new parameters.
"""
pass
|
439cd7996fbc1ebe9240e16d0bf6e5d17f9ebdf6e1b374e879e685327835f673 | Python | 289 | 9 | CLASSES = ['ELSE', 'NETU']
NUM_CLASSES = len(CLASSES)
CHECK_POINT = '../../NETUnet_checkpoints'
Vahadane_stomach_10x_Mean =[0.847, 0.728, 0.867]
Vahadane_stomach_10x_Std = [0.130, 0.166, 0.116]
#normMean = [0.84739869 0.72832994 0.86686375]
#normStd = [0.12979899 0.16630153 0.11628297]
|
fc311bdda0fd0aede7da69e8de7643d263027c8b55b91f19be5cf284d369afba | Python | 289 | 7 | import pytest
import brainscore_vision
@pytest.mark.travis_slow
def test_has_identifier():
model = brainscore_vision.load_model('deit3_base_patch16_224_fb_in22k_ft_in1k_gram_aligned_dinov3')
assert model.identifier == 'deit3_base_patch16_224_fb_in22k_ft_in1k_gram_aligned_dinov3'
|
6e493599b2a0f4e1ba7e42846a15a34c0e99aa6b83a6bb916f511dd92289e0bc | Python | 290 | 11 | import pytest
from tests.utils import pytest_importorskip
def test_qtwinextras():
QtX11Extras = pytest_importorskip("qtpy.QtX11Extras")
assert QtX11Extras is not None
# This module doesn't seem to contain any classes
# See https://doc.qt.io/qt-5/qtx11extras-module.html
|
cfe552328b78aced3672832ea28b4f5180b4f5f0039ae0a04d2109f1c0c46ce6 | Python | 290 | 14 | import torch
import logging
import csv
from tensorboardX import SummaryWriter
from pathlib import Path
class logger:
def __init__(self, log_dir, log_filename):
self.log_dir = log_dir
self.log_filename = log_filename
def record(self, metric_dict):
|
e54cacaf29af38a582e942437a3dbd36f9135dea00217fd40858bbf0110f7c07 | Python | 290 | 11 | import torch
class GradReverse(torch.autograd.Function):
@staticmethod
def forward(ctx, x, alpha):
ctx.alpha = alpha
return x.view_as(x)
@staticmethod
def backward(ctx, grad_output):
output = grad_output.neg() * ctx.alpha
return output, None |
d2ddf9a8185177fc07cb18af0bb8cf2e0d6f10e909afed5f82c1fd4472657430 | Python | 291 | 17 | """Functions that map python types to widgets."""
from ._type_map import (
TypeMap,
get_widget_class,
register_type,
type2callback,
type_registered,
)
__all__ = [
"TypeMap",
"get_widget_class",
"register_type",
"type2callback",
"type_registered",
]
|
efcf12c0d6d0c6c0c0083e3b3df3c7984cc8261c8f99b8d1324692299b92fecc | Python | 291 | 10 | # -*- coding: utf-8 -*-
def test_class_propagator():
"""
We will not test the tracker / propagator : too big to be tested, and only
used in scil_tracking_local_dev and scil_fibertube_tracking, which are
intented for developping and testing new parameters.
"""
pass
|
03e607f6697c5fe6da13ae6b512a7e7851ac773fa198d59542b62960a0f422a4 | Python | 292 | 18 | import numpy as np
import hipsternet.constant as c
def l2_reg(W, lam=1e-3):
return .5 * lam * np.sum(W * W)
def dl2_reg(W, lam=1e-3):
return lam * W
def l1_reg(W, lam=1e-3):
return lam * np.sum(np.abs(W))
def dl1_reg(W, lam=1e-3):
return lam * W / (np.abs(W) + c.eps)
|
7fad801f1995dfbd8362f99789a11a73009328f30f5c56699336cd183567cf58 | Python | 292 | 15 | # Francois Nedelec, 05.02.2018 -- 06.02.2018
import bpy
# Shortcuts
bld = bpy.data
scene = bpy.context.scene
def remove_objects(name):
for obj in scene.objects:
if obj.name.startswith(name):
bld.objects.remove(obj)
remove_objects("actin");
remove_objects("link");
|
c44d523689673ad0e621d332d950265f1aa6b7692e992bb05d4071d79f33c32c | Python | 292 | 10 | """Calibration refinement helpers for MuscleX GUI integration.
Use :mod:`musclex.algorithms.calibration_refinement.adapter` for the callable
GUI-facing API. The ``refine_center`` name is reserved for the center
refinement package directory.
"""
from . import adapter
__all__ = ["adapter"]
|
12ba83047ed6ac5ffb27f235e244785646fe2eb705606793b0bfd630f6acbb1d | Python | 294 | 12 | from PyQt5.QtCore import QSettings
class Settings:
def __init__(self):
self.settings = QSettings("HZDR", "LyROI_GUI")
def set(self, key, value):
self.settings.setValue(key, value)
def get(self, key, default=None):
return self.settings.value(key, default) |
1449695cf95ad4155c446dfe2f4b3e757dcc138aa71de268600c8ca13dc6804c | Python | 294 | 11 | from .antspynet import rescale_intensity, skullstrip_with_antspynet
from .conform import conform, rescale
from .crop import crop_nifti_image_if_necessary
__all__ = [
'conform',
'crop_nifti_image_if_necessary',
'rescale',
'rescale_intensity',
'skullstrip_with_antspynet',
]
|
5597e2160d4dfbfce9625941d6fbe024d7bc7f883872b07c957ba23c7272878f | Python | 294 | 10 | import csv
import gzip
import json
def readCSV(inpFile,delimiter=","):
with open(inpFile, 'r') as read_obj: return list(csv.reader(read_obj,delimiter=delimiter))
def readCompressedJson(inputFile):
with gzip.open(inputFile, "rt", encoding="utf-8") as fIn:
return json.load(fIn) |
b8b789b1e61a678f5518a6488062d98c5f117f503fdb204747c51ef15f9fcd9d | Python | 294 | 15 | #!/bin/env python
import numpy as np
import sys
inp = sys.argv[1]
cut = float(sys.argv[2])
lines = np.loadtxt(inp, dtype=np.float, comments='#', usecols=(0,1,2,3), unpack=False)
for line in lines:
x, y, z, d = line
if d > cut:
print "%-10.5f %-10.5f %-10.5f %-10.5f"%(x, y, z, d)
|
2d56b1a44825c448989b2a7012d6072fcf89f102145a2247967661ab03f7b5c7 | Python | 295 | 14 | import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
from .utils import build_and_compile
from .utils import restore_ckpt
from .predict import predict_with_model
from .train import train_model
__all__ = [
"build_and_compile",
"restore_ckpt",
"predict_with_model",
"train_model"
] |
9407b4b75905a69e71e0d5697338acfcad1009da214214534ff9b48b5202faa7 | Python | 295 | 12 | from collections.abc import Callable
from torch import Tensor, nn
class Residual(nn.Module):
def __init__(self, func: Callable[[Tensor], Tensor]):
super().__init__()
self.fn = func
def forward(self, x, *args, **kwargs):
return self.fn(x, *args, **kwargs) + x
|
a6e9e0cd950c83164e8aff2fb4ad93a4fbb3aceb0c7f34fa032ff7a24409258f | Python | 295 | 16 | # Generated by Django 3.2.16 on 2023-02-02 18:50
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("engine", "0062_delete_previews"),
]
operations = [
migrations.DeleteModel(
name="JobCommit",
),
]
|
733980c63ba3f279c6e5cdc3d2d97df879984f839530960475adceadca7b97ce | Python | 296 | 12 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from rest_framework import routers
from .views import UserGrowthDataViewSet
router = routers.DefaultRouter(trailing_slash=False)
router.register("growth", UserGrowthDataViewSet, basename="growth")
urlpatterns = router.urls
|
739562c36309c5df2b3916fa11b0c54f3c1078226d84f9af84ec0d3762a15f9a | Python | 296 | 15 | # Generated by Django 4.2.1 on 2023-09-25 17:05
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("dataset_repo", "0006_gitdata_format"),
]
operations = [
migrations.DeleteModel(
name="GitData",
),
]
|
9e56ace8d9ae43abbaa5e9e6e418876750ac06a72a01be4e20018739da8672dc | Python | 296 | 12 | # Copyright (C) 2018-2022 Intel Corporation
#
# SPDX-License-Identifier: MIT
from rest_framework import routers
from . import views
router = routers.DefaultRouter(trailing_slash=False)
router.register("analytics", views.LogViewerAccessViewSet, basename="analytics")
urlpatterns = router.urls
|
df7d9da6bebc6eb881eff79e50b206d43d3de8220054040b3ac2dec9c15685bf | Python | 296 | 5 | from brainscore_vision import model_registry
from brainscore_vision.model_helpers.brain_transformation import ModelCommitment
from .model import get_model, get_layers
model_registry['kap'] = lambda: ModelCommitment(identifier='kap', activations_model=get_model('kap'), layers=get_layers('kap'))
|
4078cb12900e927990cec0b906dcdd83314f1bb0d02f9187548d26e9eb242f19 | Python | 297 | 14 | import pandas as pd
def main():
hc = pd.read_csv(snakemake.input["HC"], sep="\t")
fl = pd.read_csv(snakemake.input["FL"], sep="\t")
hc['Group'] = "HGC"
fl['Group'] = "FL"
concatenated = pd.concat([hc, fl])
concatenated.to_csv(snakemake.output["combined"], sep="\t", index=False)
main()
|
5dcf7eeb0cb003a78c40bc1886a4e15c65fb20b89c0201af02349255ed2d1376 | Python | 297 | 8 | from brainscore_vision import model_registry
from brainscore_vision.model_helpers.brain_transformation import ModelCommitment
from .model import get_model, LAYERS
model_registry['alexnet'] = lambda: ModelCommitment(
identifier='alexnet',
activations_model=get_model(),
layers=LAYERS)
|
6377bf6bac0f99d3be515b61179ef3864b590675d8b9d8b13d423fed84518c47 | Python | 297 | 15 | """
Various utilities.
"""
import bz2
import gzip
def open_compressed(filename, mode="r"):
if filename.endswith(".bz2"):
return bz2.BZ2File(filename, mode)
elif filename.endswith(".gz"):
return gzip.GzipFile(filename, mode)
else:
return open(filename, mode)
|
7252375858905b06f6bbd3abeca094571db72a4b7fbca755aafacf710268e512 | Python | 297 | 8 | import pytest
import brainscore_vision
@pytest.mark.travis_slow
def test_has_identifier():
model = brainscore_vision.load_model('effnetb1_cutmixpatch_augmix_robust32_avge4e7_manylayers_324x288')
assert model.identifier == 'effnetb1_cutmixpatch_augmix_robust32_avge4e7_manylayers_324x288' |
cd457e29af4410eddfdbc0dd80d120add5ea1b7057968d6a21336341c0725e52 | Python | 298 | 9 | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
from mmcv.utils import Registry, build_from_cfg
TRANSFORMER = Registry('Transformer')
def build_transformer(cfg, default_args=None):
"""Builder for Transformer."""
return build_from_cfg(cfg, TRANSFORMER, default_args)
|
3595db70ebc3acf5f15545c9a1011f349fdf8d98b83615ddac4b2999bc3e7995 | Python | 299 | 7 | import os
import ClearMap.Settings as settings
filename = os.path.join(settings.ClearMapPath, 'Test/Data/ImageAnalysis/cfos-substack.tif');
import ClearMap.Visualization.Plot as plt
import ClearMap.IO as io
data = io.readData(filename, z = (0,26));
plt.plotTiling(data, inverse = True, z = (10,16)); |
8a19ab920ed4d3cbe0094e1fc1eb0dec30bfc7add1e524524b2f1a0d696a64c9 | Python | 299 | 13 | """Perform test request"""
import pprint
import requests
DETECTION_URL = "http://localhost:5000/v1/object-detection/yolov5s"
TEST_IMAGE = "zidane.jpg"
image_data = open(TEST_IMAGE, "rb").read()
response = requests.post(DETECTION_URL, files={"image": image_data}).json()
pprint.pprint(response)
|
095a8f0827f9169b7894285053b3ebd6f516e723b855e0d1653d1b922c1c2db3 | Python | 300 | 9 | """Experimental features.
Note: these are not guaranteed to be stable. Names and parameters may change or be
removed in future releases. Use at your own risk.
"""
from .schema._guiclass import GuiBuilder, button, guiclass, is_guiclass
__all__ = ["GuiBuilder", "button", "guiclass", "is_guiclass"]
|
33d9dd477fb1c0305d448a7c58184f93cf4fac09978eb017705ef4787f27f4e7 | Python | 300 | 5 | from brainscore_vision import model_registry
from brainscore_vision.model_helpers.brain_transformation import ModelCommitment
from .model import get_model, get_layers
model_registry['kap1'] = lambda: ModelCommitment(identifier='kap1', activations_model=get_model('kap1'), layers=get_layers('kap1'))
|
722761c4078764a1ad0ae51ccfec36a74f9e66ae9a8f596b805747651c3d4d9b | Python | 300 | 5 | from dynamic_fusion_graph.model import DynamicFusionGraph as DynamicFusionGraph
from recurrent_fusion.model import RecurrentFusion as RecurrentFusion
from tensor_fusion.model import TensorFusion as TensorFusion
from multiple_attention.model import MultipleAttentionFusion as MultipleAttentionFusion
|
7624f7ba75ce25f1adf1d2247cfdbd4c38fdc8e09329cc2c01abc5e7048f9e26 | Python | 300 | 5 | from brainscore_vision import model_registry
from brainscore_vision.model_helpers.brain_transformation import ModelCommitment
from .model import get_model, get_layers
model_registry['kap2'] = lambda: ModelCommitment(identifier='kap2', activations_model=get_model('kap2'), layers=get_layers('kap2'))
|
bf0f428bef48159fbdcf23ad05e54786df562408ddfcfee2f45fc96187484a1f | Python | 300 | 6 | class PipelineException(Exception):
"""Base pipeline exception. Prints the message plus any specific info."""
def __init__(self, message, info=None):
info_message = '\nError info: ' + repr(info) if info else ''
super().__init__(message + info_message)
self.info = info |
1e57f33c53ec25fd4174ad9a9838471376784b6d96892ccd2285dccd3209b581 | Python | 301 | 6 | from brainscore_vision import benchmark_registry
from .benchmark import MajajHongV4PublicBenchmark, MajajHongITPublicBenchmark
benchmark_registry['MajajHong2015public.V4-reverse_pls'] = MajajHongV4PublicBenchmark
benchmark_registry['MajajHong2015public.IT-reverse_pls'] = MajajHongITPublicBenchmark
|
a817ca560a5900dceb34455308b1e0f1799b62ba957cd08c1894874044aaab1c | Python | 301 | 8 | import pytest
import brainscore_vision
@pytest.mark.travis_slow
def test_has_identifier():
model = brainscore_vision.load_model('effnetb1_cutmixpatch_SAM_robust32_avge6e8e9e10_manylayers_324x288')
assert model.identifier == 'effnetb1_cutmixpatch_SAM_robust32_avge6e8e9e10_manylayers_324x288' |
d8e8cf60fa43f91edeefb07cf36219f9bd1c4d3e9f3fef517a4505faf1569c84 | Python | 301 | 10 | # Module initialization
from .visualize import visualize_results, visualize_node_predictions
from .gif_generator import create_training_gifs, create_training_animation
__all__ = [
'visualize_results',
'visualize_node_predictions',
'create_training_gifs',
'create_training_animation'
] |
0621820126f89aab590c0924d96b2d97f94c4dc71bbf0f2a50234f8dffa5ea3c | Python | 302 | 16 | #!/usr/bin/env python
"""
Script to select random lines from a file. Reads entire file into
memory!
TODO: Replace this with a more elegant implementation.
"""
import random
import sys
ndesired = int(sys.argv[1])
for line in random.sample(sys.stdin.readlines(), ndesired):
print(line, end=" ")
|
22076cc743da9af4c3a7afe56140b8a168f37af6e8237bf213ff9ac38ed9cc82 | Python | 302 | 6 | from .sequence_tagger_model import SequenceTagger, FastSequenceTagger
from .dependency_model import SemanticDependencyParser
from .language_model import LanguageModel
from .text_classification_model import TextClassifier
from .controller import EmbedController
from .ensemble_model import EnsembleModel |
83d27476cbb563b8f15f027c2ef3fe0431f5f44233664f8ce8ebc936a6d0c40d | Python | 302 | 18 | #! /usr/bin/env python3
# Train ML models and predict PES
# Imports
import time
import modules.console
def main():
start_time = time.time()
modules.console.parse_all_args()
print(f"\nWall time to complete execution: {time.time() - start_time}")
if __name__ == "__main__":
main()
|
8517a2870fa8b9d4c6c847bffc6888c7ba46ebf9d41b8d7cf8aa6cec7c9ea010 | Python | 302 | 13 | from .evaluate import Evaluator
from .dataset import GraphPropPredDataset
try:
from .dataset_pyg import PygGraphPropPredDataset
except ImportError:
pass
try:
from .dataset_dgl import DglGraphPropPredDataset
from .dataset_dgl import collate_dgl
except (ImportError, OSError):
pass
|
326fb24797448fee573810e85a4551f4bc043964277e53f7966c9b94865895bf | Python | 303 | 14 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from django.apps import AppConfig
class LogViewerConfig(AppConfig):
name = "cvat.apps.log_viewer"
def ready(self) -> None:
from cvat.apps.iam.permissions import load_app_iam_rules
load_app_iam_rules(self)
|
37c3625ad5f168e63cd3147e01fc9dc251be53070c7dd0cb76b1483469f983d7 | Python | 303 | 5 | from brainscore_vision import model_registry
from brainscore_vision.model_helpers.brain_transformation import ModelCommitment
from .model import get_model, get_layers
model_registry['kapIT'] = lambda: ModelCommitment(identifier='kapIT', activations_model=get_model('kapIT'), layers=get_layers('kapIT')) |
4c76c17704cfa3e4588455fa3c5a01a58797d2dc94ca4e73d1e0ef0223b8e5ab | Python | 303 | 5 | from brainscore_vision import model_registry
from brainscore_vision.model_helpers.brain_transformation import ModelCommitment
from .model import get_model, get_layers
model_registry['kapv1'] = lambda: ModelCommitment(identifier='kapv1', activations_model=get_model('kapv1'), layers=get_layers('kapv1')) |
9d3f1f2212ef77a249214517bbf562e526af768f6803b4a353a106bc1b961a23 | Python | 303 | 11 | import pytest
from brainscore_vision import load_stimulus_set
@pytest.mark.private_access
def test_stimuli():
stimulus_set = load_stimulus_set('Islam2021')
assert len(set(stimulus_set["texture"])) == 5
assert len(set(stimulus_set["shape"])) == 20
assert len(stimulus_set) == 4369 * 5
|
ffffd1bcb47e8e8851674227b3a88a54090a538e0bc54de8e07ec4d01d1bdb9a | Python | 303 | 14 | from multiprocessing import Value
class SharedCount:
def __init__(self, epoch: int = 0):
self.shared_epoch = Value('i', epoch)
@property
def value(self):
return self.shared_epoch.value
@value.setter
def value(self, epoch):
self.shared_epoch.value = epoch
|
063f02aef81185b29e772ac70909a62cfe19532a2baf2fe5ece15e4bcf629c5f | Python | 304 | 11 | from __future__ import annotations
from chemgraph.academy.observability.event_log import CampaignEvent
from chemgraph.academy.observability.event_log import EventLog
from chemgraph.academy.observability.event_log import read_events
__all__ = [
'CampaignEvent',
'EventLog',
'read_events',
]
|
6898a33b09d062d41ade331aa0e064a82899109ae572cc3f3d4f292f5b6ebcf0 | Python | 304 | 9 | from AFQ.utils.path import drop_extension
def test_drop_extension():
assert "/my/.example/.path/to_file" == drop_extension(
"/my/.example/.path/to_file.nii.gz")
assert "C:\\Documents\\Newsletters\\Summer2018" == drop_extension(
"C:\\Documents\\Newsletters\\Summer2018.pdf.gz")
|
d2d28bdc2f5de42a9fc67ddf3f4e7806be59f9d4e1e4d82205a0dee06329bc65 | Python | 304 | 8 | class ExceptionHook:
instance = None
def __call__(self, *args, **kwargs):
if self.instance is None:
from IPython.core import ultratb
self.instance = ultratb.FormattedTB(mode="Plain", color_scheme="Linux", call_pdb=1)
return self.instance(*args, **kwargs)
|
43c31c217effd5ea76393eb97d9992567190095170085bc92fefc6e0e288bfa7 | Python | 306 | 12 | import elikopy.core
import elikopy.individual_subject_processing
import elikopy.utils
import elikopy.utilsSynb0Disco
import elikopy.registration
try:
import elikopy.modelSynb0Disco
except ImportError as e:
elikopy.modelSynb0Disco = None
print("Synb0Disco module not available: {}".format(e))
|
762a8d50b13e55d9c110b7260400871dd7f1b2ebc68a37dc187c079db9fd5b2d | Python | 306 | 7 | import os
import ClearMap.Settings as settings
filename = os.path.join(settings.ClearMapPath, 'Test/Data/ImageAnalysis/cfos-substack.tif');
import ClearMap.Visualization.Plot as plt
import ClearMap.IO as io
data = io.readData(filename, z = (0,26));
plt.plotTiling(data, x= (0,70), y = (0,50), z = (10,16)); |
788446db8397baf67d47d982e87ed70a5921657c4c5b4e51c9fe34a0e7aa3892 | Python | 306 | 14 | import sys
def critical(ref: str = 'pubplot::Unknown', msg: str = 'An unknown critical error was encountered.'):
'''
'''
sys.exit(f'[{ref}]: {msg}')
def warning(ref: str = 'pubplot::Unknown', msg: str = 'An unknown warning arose.'):
'''
'''
print(f'[{ref}]: {msg}')
|
e2135e5315fb434048da5e72ca1cfab554c13ed2a4d0657f85f003f48613b9a4 | Python | 306 | 15 | # -*- coding: utf-8 -*-
import numpy as np
def nan_array_equal(a, b):
a = np.asarray(a)
b = np.asarray(b)
nan_a = np.argwhere(np.isnan(a))
nan_b = np.argwhere(np.isnan(a))
a = a[~np.isnan(a)]
b = b[~np.isnan(b)]
return np.array_equal(a, b) and np.array_equal(nan_a, nan_b)
|
0b9331171439d24b60bbc7d6a8b34ecaa18e069785a520677493bf3aec3301cf | Python | 307 | 10 | from tests.utils import pytest_importorskip
def test_qtquick3d():
"""Test the qtpy.QtQuick3D namespace"""
QtQuick3D = pytest_importorskip("qtpy.QtQuick3D")
assert QtQuick3D.QQuick3D is not None
assert QtQuick3D.QQuick3DGeometry is not None
assert QtQuick3D.QQuick3DObject is not None
|
e1121a9e391f931163b09e7d92e12e2dd6873c003b5a022a15c250956e3243dc | Python | 307 | 11 | #!/usr/bin/env python
import storm_control.hal4000.testing.testActions as testActions
import storm_control.hal4000.testing.testing as testing
class GUITest(testing.Testing):
def __init__(self, **kwds):
super().__init__(**kwds)
self.test_actions = [testActions.Timer(timeout = 1000)]
|
f5535e18e76b9718493a3038b49f26fea4395bc5ca15bf61ff89890b6cc7f7c7 | Python | 307 | 7 | ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the gradunwarp package for the
# copyright and license terms.
#
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
from unwarp_resample import Unwarper
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.