sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
011f6aed2252e7214068c233b7f46c10b0f24b287dc4891434839e216d4db461 | Python | 3,760 | 100 | # -*- coding: utf-8 -*-
# @Author : LG
import os
from pathlib import Path
import cv2
from PyQt5 import QtCore, QtWidgets
from ISAT.ui.video_to_frames import Ui_Dialog
from ISAT.utils.check import has_chinese
class Video2FramesDialog(QtWidgets.QDialog, Ui_Dialog):
def __init__(self, parent, mainwindow):
... |
445e02f4232e395728a5ac47de96f2f56e031a93669fd6a3443f1e8b24e913fc | Python | 3,760 | 84 | import os
import numpy as np
import pandas as pd
import scanpy as sc
from typing import Tuple, Dict, Any, Optional
import logging
from .spatial_distance import SpatialDistanceCalculator
from .mutual_information import MutualInformationCalculator
from .discretization import ExpressionDiscretizer
class DataPreprocesso... |
e2480eb11204031ce0ba7302fee89ed264624d75a4ba2668cd07e4b0351fdbad | Python | 3,760 | 107 | import numba
import numpy as np
import multiprocessing as mp
from functools import partial
import random
@numba.jit(nopython=True, parallel=True)
def get_bin_edges(a, bins):
bin_edges = np.zeros((bins+1,), dtype=np.float32)
a_min = a.min()
a_max = a.max()
delta = (a_max - a_min) / bins
for i in nu... |
12d6dd5b865dc41402d13f089e277bb983e1c109fc82e5d639883bd6e3009903 | Python | 3,761 | 174 | import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
import math
import random
import os
os.chdir(r'\\Connections')
N_branch=3
N_medial=N_branch*2
N_distal=N_branch*4
N_gc=1000
N_bc=50
N_ec=200
N_mossy=40
N_hipp=20
N_hicap=20
N_noise=30
N_noise_inh=60
#==================... |
d6a0e223278ab12ee92eaa5b3d8f57dd9fba732f8e6d0177e08aad8c6e1e4f7f | Python | 3,764 | 135 | from __future__ import division
from time import sleep
import numpy as np
import pandas as pd
import numpy.ma as ma
import os
import h5py
from sys import platform
from sklearn.utils.validation import check_array
from scipy import linalg
def _impose_f_order(X):
"""Helper Function"""
# important to access flag... |
30a98b533d7cadd07f9d24f0b6a2986378fc8abf7cfdf172d47b91f63ebdc4c7 | Python | 3,766 | 110 | from __future__ import annotations
import copy
from typing import Any, TYPE_CHECKING
import numpy as np
import seisbench
if TYPE_CHECKING:
import h5py
class ProbabilisticDASLabeller:
"""
Create supervised labels for DAS from picks with probabilistic representation.
"""
def __init__(
se... |
60c6a4d49a052f63339be887d32dec2a2ef3fcbc222c3c82b11f34da168c8b61 | Python | 3,766 | 100 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_geometric.nn import global_add_pool
from torch_geometric.nn import GATConv
class SumPoolingPyg(nn.Module):
def __init__(self):
super().__init__()
def forward(self, g, feat):
return global_add_pool(feat, g.batch)
... |
8bb0bf16f86d6c0e9916c80b7a104f7da2c2a864f71bc17a5f760506f7cf334c | Python | 3,767 | 85 | """
Copyright 1999 Illinois Institute of Technology
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publis... |
1bde600df1e388d4e60d87a5a45622437e84b87daef1e3c638b444fdfa702242 | Python | 3,769 | 107 | from collections import OrderedDict
import typing
from typing import Callable, List, Any, Dict
import logging
from brainscore_vision.model_helpers.utils import fullname
from .base import ActivationWrapper
from ..inputs import Stimulus
SUBMODULE_SEPARATOR = '.'
def default_process_activation(layer, layer_name, inp... |
6ee4fd2505553ad754e397ba882c82c2fa8bec84473c7eeb417412ec7f2ffa25 | Python | 3,770 | 93 | import pytest
from pytest import approx
from brainscore_vision import load_benchmark, load_model
# --- Registry tests: verify all 16 benchmark identifiers load correctly ---
@pytest.mark.private_access
class TestAllen2022fmriBenchmarkRegistry:
@pytest.mark.parametrize("region", ["V1", "V2", "V4", "IT"])
def... |
1e656f766339dec75537b74846fc6b97ccd5d05620482c021cb04d0a3b3f3ce7 | Python | 3,771 | 109 | # Generated by Django 5.2.14 on 2026-05-18 20:24
import django.db.models.deletion
from django.db import migrations, models
import cvat.apps.engine.models
class Migration(migrations.Migration):
dependencies = [
("engine", "0105_add_audio_mp3_chunk_type"),
]
operations = [
migrations.Alt... |
c6bbab922d335c1d289157c420b10b94f003f087c4cfb2ea608522e7dfc3d4e3 | Python | 3,771 | 91 | import sys
from torch.utils.data import DataLoader
from geoseg.models.MixerUnet import reparameterize_model
from geoseg.losses import *
from geoseg.datasets.ham10000 import HAM10000_Dataset
#from geoseg.models.MixerUnet import ConvMixer_UNET_down
from geoseg.models.MixerUnetcopy import Rep_UNET_down
from catalyst.contr... |
f101d74a5988c023c970862fa65b2c4868b9a170eb0817ab5fa2c7e292ac548f | Python | 3,771 | 117 | import torch.nn as nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
import torch.nn.init as init
import torch
class FCNBlock(nn.Module):
def __init__(self, in_dim, out_dim):
super(FCNBlock, self).__init__()
self.layer = nn.Sequential(nn.Linear(in_dim, out_dim),
... |
178b66535e82625f4eee11f766ef8be4baabd7cdda4b05188dac149e027ea632 | Python | 3,772 | 112 | import meshio
import torch
import numpy as np
from torch_cluster import radius
from torch_geometric.data import Data
PLOC_NEIGHBOR_RADIUS = 0.75
def single_case_handling(file):
computed_labels = None
if file.endswith('.npy'):
case = np.load(file, allow_pickle=True)
elif file.endswith('.vtk'):
... |
254e758b019d2733bb3f121b82a2ad81a4170c04e2e0dbfcceadffe3ba9d317c | Python | 3,772 | 145 | import os.path
import sys
os.environ['PYTORCH_JIT']='0'
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Project information ------------------------------------... |
b0709b5032453622eb8ea6b87845b0cc40eac1b5301deecc80aba530b64b16c4 | Python | 3,772 | 110 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import sys
from operator import itemgetter
from collections import defaultdict
import jieba.posseg
from .tfidf import KeywordExtractor
from .._compat import *
class UndirectWeightedGraph:
d = 0.85
def __in... |
c6c6d8404ecc2a986b2a303cb9e9ec742fcf6b80ae6be8cedff8f98a0d2b9651 | Python | 3,773 | 85 | # @String(value="<HTML>This script runs Strahler Analysis on an entire directory of reconstruction files.<br>Processing log is shown in Console.", visibility="MESSAGE") msg
# @File(label="Input directory:", style="directory", description="Input folder containing reconstruction files (.traces, .swc, json) to be analyzed... |
687cc7695c3761ccd45dafbab35e4cb22bcc9bc5835bcd70feeb60e59978eebd | Python | 3,774 | 114 | """
Module that defines the window that the tasks are rendered in.
"""
import typing
import os
import asyncio
from ..qt import *
from .canvas import Canvas
from ..config import ObservableCollection
#from .. import recorder2_pb2_grpc
from .. import ophanim_pb2_grpc
from .. import thalamus_pb2_grpc
from .util import T... |
8cb73b563223f9a45258705fe191d85dbccec1af176e60119ea5c9de11b32690 | Python | 3,774 | 105 | from typing import Any, Dict, Literal, Optional, Union
import numpy as np
import torch
from anndata import AnnData # type: ignore
from patsy import dmatrix # type: ignore
from torch.types import Device
from ..utils.design import _get_states
from .local_handler import SVILocalHandler
from .settings import DEFAULT
... |
a304a35cc94ddf06847864d95aae22b57cbaf08677b8d080adee34455958e486 | Python | 3,776 | 127 | #!/usr/bin/env python
"""
Test parsing of shutters files.
"""
import numpy
import storm_control.hal4000.illumination.xmlParser as xmlParser
import storm_control.test as test
data_dir = test.dataDirectory()
name_to_id = {"750" : 0,
"647" : 1,
"560" : 2}
def test_parser_1():
"""
Te... |
007c4b6f6810ce37390f934e7467f1fe38bd1a9dc6a3de2dfbd4cd5ca118b5d9 | Python | 3,777 | 114 | from typing import Literal, Any
import seaborn as sns
from matplotlib.axes import Axes
from argclz import argument, as_argument
from argclz.dispatch import Dispatch, dispatch
from neuralib.plot import plot_figure, diag_histplot
from neuralib.typing import PathLike
from neuralib.util.verbose import publish_annotation
... |
06341240fc5b60025640bbe635999f0a7129ec7c2d40c8c0483980f4315a44ff | Python | 3,778 | 88 | # -*- coding: utf-8 -*-
"""
Created on Mon Dec 2 21:46:44 2019
@author: Yoshi
"""
import warnings
warnings.simplefilter(action="ignore",category=FutureWarning)
import os
program_path = os.getcwd()
os.chdir(f"{program_path}/motion_corrector")
from motion_corrector import *
os.chdir(f"{program_path}/data_extracto... |
54c4c5dfa9209132cbf2be92b5ec206829fc56f69298b5b43a387f3f26879542 | Python | 3,778 | 64 | import functools
from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images
from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper
from brainscore_vision.model_helpers.check_submission import check_models
from efficientnet_pytorch import EfficientNet
from types import... |
691f8398e180fe45e8c0f0b85243d941561cbb60099bc036fb49e7051c6a4213 | Python | 3,779 | 90 | # Copyright 2024 Google LLC
# 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
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, sof... |
697974817877d449f59f93d7b96e18d91cd0454d80a11ed0221e5e60c6651d1a | Python | 3,779 | 36 | from testsetclass import TestsetClass
class INV24(TestsetClass):
def __init__(self):
self.weak = 1.0
self.molecules = ['H2O', 'PCl3_TS', 'H2S', 'Thioether', 'PMe3_TS', 'Tetrabenzopyracylene', 'Sumanene', 'BN_Corannulene_TS', 'BN_Corannulene', 'Pentahelicene', 'Corannulene', 'BN_Sumanene', 'Triinde... |
c487535c687c83054d5cc111a15e983c798254570b9b06266860e07588d6b184 | Python | 3,779 | 65 | import functools
from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images
from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper
from brainscore_vision.model_helpers.check_submission import check_models
from efficientnet_pytorch import EfficientNet
from types import... |
0cfa9d31c437ea03ea7849f3d4cfd1fc208c712fedf42ee0f028bd6ae34d3c80 | Python | 3,780 | 83 | import functools
from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images
from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper
from brainscore_vision.model_helpers.check_submission import check_models
from brainscore_core.supported_data_standards.brainio.s3 import... |
e651ba86d4a59a0a872e6ae40f4032e6d6dd6b9d1ee6d2cd247053cb474de015 | Python | 3,781 | 82 | from brainscore_vision import load_dataset, load_metric
from brainscore_vision.benchmark_helpers.neural_common import TrainTestNeuralBenchmark, average_repetition, filter_reliable_neuroids
from brainscore_vision.metrics.regression_correlation.metric import ALPHA_LIST
from brainscore_vision.utils import LazyLoad
BIBTEX... |
f4f757bf1a0135cd680693727f901fac8d5e69440456bcca1f82b90160a8130d | Python | 3,781 | 98 | import os
import torch
import random
import numpy as np
from multiprocessing import cpu_count
from tqdm import tqdm
from utils.deepinteract_utils import calculate_top_k_prec, calculate_top_k_recall
def setCpu(core: int = 8):
cpu_num = core
os.environ['OMP_NUM_THREADS'] = str(cpu_num)
os.environ['OPENBLAS_... |
318bd60d1cc5d80a8cc9624704a3fa55c6971ef1850337d7de54e0bc390eb385 | Python | 3,782 | 106 | import collections.abc as collections
import inspect
from collections.abc import Callable
from typing import Any, Union, cast
import torch
def _check_signature(
fn: Callable, fn_description: str, *args: Any, **kwargs: Any
) -> None:
# if handler with filter, check the handler rather than the decorator
if... |
647c512542b85ae568930cd24d80c95c0637ea7fa5f4d3835cf2be797c32cb93 | Python | 3,782 | 77 | """Average echoes for before registration.
NOTE: The average echo image is used to determine the registration
tranformations because it has better SNR in most cases than either of the
echos.
"""
import os
import numpy as np
import nibabel as nb
# =====================================================================... |
79b10991b5bcb7e104e342479590fd34cd1a88f83ee9cfc7e29f6e233132ab8b | Python | 3,782 | 88 | from torch.utils.data import DataLoader
# Import functions from our modules
from .data_processing import (
msp_to_dataframe_with_smiles,
msp_to_dataframe_without_smiles,
preprocess_spectra_with_smiles,
preprocess_spectra_without_smiles,
process_data_with_smiles,
process_data_without_smiles
)
f... |
ce30da8e1ab3f59a10b7f0c0fdfcaf04c1806111496a44578ca08c3a1d41a870 | Python | 3,782 | 99 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import random
import tensorflow as tf
from tensorflow.python.eager import context
from tensorflow.python.framework import ops
from tensorflow.python.ops import control_flow_ops
from tensorfl... |
8310153751a6d7e19b452b7904f864176e06ed2a43033bc510eb05da3cc579cf | Python | 3,783 | 119 | # basic
import glob
import itertools
import pandas as pd
import numpy as np
import os
# plotting
from nilearn import plotting
from scipy import ndimage
import matplotlib.cm as cm
import matplotlib.image as mpimg
import seaborn as sns
import matplotlib.pyplot as plt
# neuroimaging
from nilearn.connectome import Connec... |
3a7cb3ce29494b44a6448da3d1abf09a67193cea5838f84fb9a36f325f76b064 | Python | 3,784 | 65 | import functools
from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images
from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper
from brainscore_vision.model_helpers.check_submission import check_models
from efficientnet_pytorch import EfficientNet
from types import... |
844480233c7fa004bc4d25e88d3d4b280759ce940c8e8f9b7fa1f7aa03f0ed3d | Python | 3,784 | 65 | import functools
from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images
from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper
from brainscore_vision.model_helpers.check_submission import check_models
from efficientnet_pytorch import EfficientNet
from types import... |
db8c794a2a659ddc116d74e3000c07eb07084a86ca1d054ab31320dd083565af | Python | 3,784 | 108 | import torch.nn as nn
from initialization import (
attentive_weights,
gat_weights,
gin_weights,
mpnn_weights
)
from utils import set_seed
def attentive_resets(model, seed=42):
set_seed(seed)
for layer in list(model.mol_att_layers):
attentive_weights(layer.no... |
5c3919a8c7037ee9bd97b765312a97e6d2aca3378e0bc4a242ff9404a4f4e684 | Python | 3,786 | 109 | # 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.
import logging
import torch
logger = logging.getLogger(__name__)
class NanDetector:
"""
Detects th... |
8ee94df918d2fa613b8eb50474c1f5f5c79bf354489709360dedd2ef839f116a | Python | 3,786 | 117 | '''
H2OBr
'''
import numpy as np
import sys
def intro():
print("""
SHORT List of potential energy surfaces for H2OBr:
P: potential energy, G: Gradient, D: Nonadiabatic coupling vector
This is listed at the end of description to show the availability.
For example: P/G means both potential energy a... |
b8ff35d169440884406f0817e255ea57997cbef2e9ef3bdfd051b44656988d41 | Python | 3,786 | 86 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from typing import Any
from ultralytics.engine.results import Results
from ultralytics.solutions.solutions import BaseSolution, SolutionResults
class InstanceSegmentation(BaseSolution):
"""A class to manage instance segmentation in images or vi... |
c38dc94b6c982c17132e20f46afc14285747c3b49acb7675950413b1964e1da5 | Python | 3,786 | 139 | # The ImpedanceFitter is a package to fit impedance spectra to equivalent-circuit models using open-source software.
#
# Copyright (C) 2018, 2019 Leonard Thiele, leonard.thiele[AT]uni-rostock.de
# Copyright (C) 2018, 2019, 2020 Julius Zimmermann, julius.zimmermann[AT]uni-rostock.de
#
# This program is free ... |
894854b1b85699c4b25f5479fd226df07e2cb8800bd38383fae3a8623ec1a38e | Python | 3,787 | 112 | import os
from typing import List, Optional
import hydra
from omegaconf import DictConfig
from pytorch_lightning import (
Callback,
LightningDataModule,
LightningModule,
Trainer,
seed_everything,
)
from pytorch_lightning.loggers import LightningLoggerBase
from pli_cyto import utils
log = utils.get... |
04aec72b3ccf2f886305491a9dc8cf8e9a392d68065ce036424eb5d793e4e789 | Python | 3,788 | 126 | import torch
from torch.utils.data import DataLoader
from torchvision import transforms
import pytorch_lightning as pl
from pytorch_lightning.loggers.neptune import NeptuneLogger
from pytorch_lightning.callbacks import ModelCheckpoint
from torchmetrics import MetricCollection, MeanSquaredError
import yaml
import pan... |
c6068dceeea2a205345250960eca29034f77084041bf3dcdd85aef5a960fd6f4 | Python | 3,788 | 88 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
from pathlib import Path
from ultralytics.utils import IS_COLAB, LOGGER, YAML
def _check_rknn_return(ret, name: str):
"""Raise a RuntimeError if an RKNN API call failed."""
if ret not in {0, None}:
... |
927155e1d31ee0c829d38f1add37d196f467f85ccdbe58df49db948ca9bc2686 | Python | 3,789 | 117 | import math
import torch
from torch import nn
class Generator(nn.Module):
def __init__(self, scale_factor, in_channels=3):
upsample_block_num = int(math.log(scale_factor, 2))
super(Generator, self).__init__()
self.block1 = nn.Sequential(
nn.Conv2d(in_channels, 64, kernel_size=... |
983debb1c8510ea9e77112214956a79df2b2a427ee6b9fce3994e16641aaf24a | Python | 3,789 | 101 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Extracts the DWI volumes that are on specific b-value shells. Many shells
can be extracted at once by specifying multiple b-values. The extracted
volumes are in the same order as in the original file.
If the b-values of a shell are not all identical, use the --toleran... |
995cee83e1c41d006629eee6dbafeffb0cf320eb6ff885609100050fd05743c6 | Python | 3,789 | 113 | #!/usr/bin/env python
from sputils import *
nargs=len(sys.argv)
rezdirs=['dropping_accuracy_results','daf_results', 'dafm2109_results']
nmulticurves=(nargs-1)//3
labeldict={'B09P33': 'SubC', 'B10066P026': 'Crit', 'B101P00045': 'SupC'}
dirlabel={0: 'All', 1: 'Filter', 2: 'Filt/Subsamp'}
if nargs<3 or int((nargs-1)/... |
40e4e82421d977e488d960a84ff9db83fdc23294c93ff8f5546e2ae02a6d97a8 | Python | 3,790 | 104 | """Deprecated Parsl MCP entry point; retained for existing client configurations."""
import asyncio
from concurrent.futures import Future
import os
from pathlib import Path
import tempfile
import uuid
import warnings
from mcp.server.fastmcp import FastMCP
from chemgraph.execution.base import TaskSpec
from chemgraph.... |
e5d1a23829d4891548e568fa943469a6cf8be46dc7308c3967d81131d4258bc0 | Python | 3,790 | 126 | from typing import List, Tuple
import networkx as nx
import numpy as np
import itertools
from torch_geometric.data import Data as TGData
import torch_geometric as tg
__all__ = ['build_assgraph', 'to_node_ids', 'to_data']
TARGET_FEATURE_NAME = 'y'
def build_assgraph(g1: nx.DiGraph, g2: nx.DiGraph, include_target_feat... |
185c1f57281e33af29c8a632837d16fbcd4a655c2d4934af5072e6bec3b0e9c4 | Python | 3,792 | 96 | """
GeneratePCALabeledVideo
@2022Knowblesse
After PCA dimensionality reduction on the wholesessionunitdata, draw clustered label on the video.
"""
import cv2 as cv
from tqdm import tqdm
import numpy as np
from scipy.interpolate import interp1d
from scipy.io import loadmat
from Switching.SwitchingHelper import parseAll... |
431ab6a999e62420358f1b7d0a0004834812ad3cd5eb0928defd062d9f02a486 | Python | 3,792 | 84 | """Demonstrates several preprocessing utilities.
NOTE: This script may not actually work yet!
"""
import numpy as np
import matplotlib.pyplot as plt
from nems.preprocessing import (
indices_by_fraction, split_at_indices, JackknifeIterator)
from nems import Model
from nems.layers import LevelShift, WeightChannels, ... |
d97f4d889949fb2ba8212f7631daa8a88e7b5faf53a35360c97402c9d50dd836 | Python | 3,792 | 125 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from collections import defaultdict
from django import forms
from django.contrib import admin
from .event_type import AllEvents
from .models import Webhook
from .serializers import WebhookWriteSerializer
def grouped_event_choices() -> dict[str, l... |
db32a67420b0cfb3877e2ecac1de4c9db1dacf15e8e7c77818af4438a37ba756 | Python | 3,792 | 103 | # -*- coding: utf-8 -*-
# python standard library inputs
import os
# external inputs
import numpy as np
from nibabel.freesurfer.io import read_geometry, write_geometry
from cortex.polyutils import Surface
# local inputs
from ..segmentation.calculate_area import calculate_area
def calc_equivol_surf(file_white, file... |
464ec28702e89ace011732e5849b9424797304ae6a693a50ae5f4cd9b65b6d04 | Python | 3,793 | 96 | import argparse
import torch
from torch_geometric.nn import Node2Vec
from torch_geometric.utils import to_undirected, dropout_adj
from tqdm import tqdm
from ogb.nodeproppred import PygNodePropPredDataset
# save both node2vec embeddings and raw node features, labels, and split.
# Only save nodes that are labeled (spe... |
d6b864f4c139c840693bb63f42f5b3a8f66d619fe131fe8e802475964206b4c1 | Python | 3,794 | 118 | from __future__ import annotations
from pathlib import Path
import pytest
from PySide6.QtCore import QPoint
from PySide6.QtCore import Qt
from pytestqt.qtbot import QtBot
from ..conftest import close_or_pause
from .conftest import MainWinFactory
from .conftest import show_window_and_wait_for_imagedata
@pytest.mark... |
6a1650a3d45202f204502133696614b37dd74676346239b2bf6e59c13639b705 | Python | 3,795 | 106 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 10 12:15:20 2023
@author: rl05
"""
import sys
import os
import os.path as op
from mne import set_log_level
from mne.io import read_info
from mne.chpi import compute_chpi_amplitudes, compute_chpi_locs, compute_head_pos
from mne.preprocessing import... |
86608a3794faa4a09f7bf90e24acc3599f1d21a83bb39b5aa4d5124f4c3ebc7c | Python | 3,795 | 118 | #!/usr/bin/env python3
import arbor as A
from arbor import units as U
import pandas as pd
import seaborn as sns
import sys
from pathlib import Path
# Load a cell morphology from an nml file.
# Example present here: morph.nml
if len(sys.argv) == 1:
print("No NML file passed to the program, using default.")
file... |
70844326f718232b91ffd68d2a33adc23deefc207bd8384580a00d875689be41 | Python | 3,796 | 124 | """
Tests for `bx.binned_array`.
"""
import pytest
from numpy import (
allclose,
concatenate,
nan,
zeros,
)
from numpy.random import default_rng
from bx.binned_array import (
BinnedArray,
BinnedArrayWriter,
FileBinnedArray,
)
# Bigger values take longer, but excercise more bins
CHUNK_SIZE... |
8821f6816ad5e455b8a2d92cfb20c905d70b65ae38bf91506898cbd8c13a6507 | Python | 3,796 | 90 | """Check that a benchmark's stimulus identifiers can carry a plugin revision.
The shared activation cache keys on ``stimuli_identifier``. An identifier that
cannot be traced back to a registered plugin cannot carry a revision, and since
brain-score refuses to write an unrevisioned key to a shared cache, every
extracti... |
bcf05081a4f49118e3d8b9a98fdc7994b62b1494f71bf863de56ab64fd02ec92 | Python | 3,796 | 112 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 21 10:40:32 2014
@author: eladnoor
"""
import urllib
from src.obo_parser import GODag
import logging
import os
import gzip
import csv
if not os.path.exists('res'):
os.mkdir('res')
# file locations and URLs
GO_OBO_URL = 'http://geneontology.org/ont... |
d964edb3cc008d1fe9891eefb4ffef6a97b66478075bb23557f23ea99a849275 | Python | 3,796 | 109 | # coding=utf-8
"""
Tests for deepreg/dataset/util.py in
pytest style
"""
from os.path import join
import numpy as np
from deepreg.dataset.loader.h5_loader import H5FileLoader
from deepreg.dataset.loader.nifti_loader import NiftiFileLoader
from deepreg.dataset.loader.unpaired_loader import UnpairedDataLoader
FileLoa... |
12dcda8d064d16e0cc97bb334bf15029dff80f0766fbeed4bdd58e66f8eb1265 | Python | 3,797 | 116 | #!/usr/bin/env python
"""
This script is used for camera calibration. It records the sum of x and
the sum of x*x for every pixel in every frame.
Hazen 10/13
"""
import numpy
import sys
import time
import hamamatsu_camera as hc
if (len(sys.argv) != 3):
print("usage: <filename> <number frames>")
... |
c2ff01d00d2ce2f9bddbfa9c2512f6f335d296945f281e9b6c422c89f4505767 | Python | 3,797 | 155 | import unittest
import numpy as np
from numpy.testing import assert_array_equal
import heig.input.dataset as ds
def check_accepted_args(module, args):
"""
a similar version for easy test
"""
accepted_args = {
"heri_gc": {
"out",
"ld_inv",
"ld",
... |
3dded3e77ff424d5990db266061586346612290c46a954705f151c44eee9a9d1 | Python | 3,798 | 103 | """
Copyright 1999 Illinois Institute of Technology
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publis... |
81b70a0486ef6842048e95544f9b3ff739689b67f528ee1462c68b1b1776c2bc | Python | 3,799 | 106 | from pathlib import Path
import numpy as np
import pytest
import tifffile
def _spot_image_uint8() -> np.ndarray:
"""Return a deterministic synthetic image with three bright spots."""
y, x = np.indices((32, 32))
image = (12 + ((3 * y + 5 * x) % 16)).astype(np.uint8)
image[(y - 9) ** 2 + (x - 10) ** 2 ... |
5e67055fb10c8f9b4311d25c28c975c5e5195d0f655fa40bef572da137c58517 | Python | 3,800 | 124 | # Copyright (c) DP Technology.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
import contextlib
from typing import Optional
import numpy as np
from unicore.data import (
Dictionary,
MaskTokensDataset,
Ne... |
27932bdaaddaa5313439263c33beb0c51a45422b635c8ff198b763d20b8f894e | Python | 3,801 | 95 | import io
import os
import pandas as pd
import subprocess
import tempfile
def read_bed(x, **kwargs):
return pd.read_csv(x, sep = r'\s+', header = None, index_col = False, **kwargs)
def write_bed(df, fn, **kwargs):
df = df.copy()
df.iloc[:, [1, 2]] = df.iloc[:, [1, 2]].astype(int) # ensure coordinates are ... |
bddd702f1ca17145d00a5333cb01b9169601942d054a0dec258464fdf350d606 | Python | 3,801 | 104 | # /usr/bin/env python
import os
import utils as utils
from spaghetti import spaghetti_global as spaghetti
from spaghetti.mc_lif_group import McLifGroup
from spaghetti.poisson_pattern_group import PoissonPatternGroup
from spaghetti.rewiring_connection import RewiringConnection
from spaghetti.spike_monitor import Spike... |
2c749423f53e03e5fac28f5c79cecd9b29baed461758c467f0357dd160110270 | Python | 3,802 | 113 | import os
from copy import deepcopy
import numpy as np
import argparse
import innvestigate.utils as iutils
from keras.models import Model
from keras.preprocessing import image
from keras.utils import to_categorical
import keras
import tensorflow as tf
from numpy import average, dot, linalg
from utils import *
from lrp ... |
2f8804d2189137be6ea21e02fff3714e1cc5915ceed87fd045afcd436a6d4935 | Python | 3,802 | 84 | # Av's code with a bit of reformatting
# Adapted from Zahoor's mtbatchgen
import numpy as np
import shap
import tensorflow as tf
from deeplift.dinuc_shuffle import dinuc_shuffle
def combine_mult_and_diffref(mult, orig_inp, bg_data):
to_return = []
for l in [0]:
projected_hypothetical_contribs = ... |
46d7fd1b8dce2b0397f006197c8c838dc2a72c2fea060ca8991a0db5110eea09 | Python | 3,802 | 127 | # -*- coding: utf-8 -*-
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from tdt import read_block
from scipy.stats import pearsonr
# --- CONFIGURATION ---
# Base directory: folder where this script is located
base_dir = os.path.dirname(os.path.abspath(__file__))
# TANKS folder is one... |
74f2031c56f765978946e40967f0b2ffefe75f82ce7fb16c98b21f474f44daff | Python | 3,802 | 105 | import os
import re
import io
from contextlib import redirect_stdout
import numpy as np
from sklearn.ensemble import RandomForestClassifier
from xgboost import XGBClassifier
from pstimutils import PertStimDataSimple
from perturbation1 import get_ml_data, cv_metric
def compute_decoder_metrics(psd, dataset_i... |
6592eb9c4260171f6616965ded729b963cb4850565402c0f29dfcf62e5ce45e5 | Python | 3,803 | 118 | '''
H3ClO
'''
import numpy as np
import sys
def intro():
print("""
SHORT List of potential energy surfaces for H3ClO:
P: potential energy, G: Gradient, D: Nonadiabatic coupling vector
This is listed at the end of description to show the availability.
For example: P/G means both potential energy a... |
06094acbeadf0aeae7aaa09f5defa4c35a13e80016505c536d966d2b7edcf951 | Python | 3,804 | 128 | import json
import argparse
import yaml
import copy
from utils import logging
from algorithms import dict_merge
logger = logging.init_logger()
class Params(object):
"""
Parameters
"""
def __init__(self, params):
self.params = params
def __eq__(self, other):
if not isinstance(ot... |
5c17f2023b8518b05ec95f591933a373d2855305cacf5e9c9ed71c51a4987bbe | Python | 3,804 | 124 | import tempfile
from pathlib import Path
import polars as pl
import pytest
from eir.setup.config_validation import (
validate_input_configs,
validate_output_configs,
)
from eir.setup.schemas import (
InputConfig,
InputDataConfig,
OutputConfig,
OutputInfoConfig,
TabularInputDataConfig,
... |
6ffeee12e0c1c28a151619d0ebc0b8e1f0f96ed165bcf27cee3894c66d466947 | Python | 3,804 | 120 | import torch
import torch.nn as nn
import numpy as np
import ase
from ase.io import read
# utils imports
from utils.plot_corr import plot_corr
from utils.neuralnets.FFNet import FFNet
from utils.distances import get_bond_length_ABCC
from utils.kernels import get_1D_kernels_k33
from utils.symmetrize import ABCC_sym
tor... |
20512e1b4ac5a123fd5860974cd03da5ffa5ce71da49c2106bbcb740729dc501 | Python | 3,805 | 86 | from time import time
from typing import Union, List, Tuple
import numpy as np
import torch
from acvl_utils.morphology.morphology_helper import label_with_component_sizes
from batchgeneratorsv2.transforms.base.basic_transform import ImageOnlyTransform
class RemoveRandomConnectedComponentFromOneHotEncodingTransform(I... |
2fe8b0d39f98bd935e4f9ff9744d3ba5ae24e417db5805c4f581bce330f2030b | Python | 3,805 | 93 | import cv2
import numpy as np
def display_result(y_pred, label, wait=100, n_classes=3):
# prediction
seg = y_pred.detach().cpu().numpy()
batch_size = seg.shape[0]
for i in range(batch_size):
gm = seg[i, 1, :, :]
wm = seg[i, 0, :, :]
#border = seg[0, 2, :, :]
if n_classes... |
2fcf49aa17abad141974b837786cb35c22544ac85fecd42b0a06bf611a293eea | Python | 3,806 | 112 | import argparse
import os
import pickle
import pandas as pd
import yaml
def get_config(config_path="src/SWOW_prediction/config_features.yml"):
"""Load configuration from YAML file."""
assert os.path.exists(config_path), f"Config file {config_path} does not exist."
with open(config_path) as f:
con... |
41e809b981468220750be356cd772f237738ba37263c7d0be1d6d6d98990ac6a | Python | 3,806 | 111 | import pandas as pd
from functions import *
from model_functions import *
from the_model import *
from sklearn.metrics import mean_squared_error
matplotlib.rcParams['axes.prop_cycle'] = matplotlib.cycler(color=["#F4511E", "#FB8C00", "#FFB300", "#FDD835", "#C0CA33", "#7CB342", "#43A047", "#00897B", "#00ACC1","#... |
1abdc041c75c7e12c33d2cdbbdc2ce1d023f463ccc79c196c5e96ecf2557848d | Python | 3,808 | 101 | '''
in this script, I will read into the sam file and the barcode file, and then count the reads number per
barcode
'''
import sys
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
def samfile_barcode_count(sam_file, barcode_file):
#ge... |
07c6ab3c91d4bf0aa452792b20049cbed47f5d392280a7114e56d935a8b9a0ab | Python | 3,809 | 109 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Script to convert surface formats
Supported formats:
".vtk", ".vtp", ".ply", ".stl", ".xml", ".obj"
and FreeSurfer surfaces
> scil_surface_convert surf.vtk converted_surf.ply
-----------------------------------------------------------------
Reference:
[1] St... |
176f56abbfda83442d69db67b00b6127332d34f048e469cf249bd6c0011630bd | Python | 3,809 | 101 | #!/usr/bin/env python
"""
WARNING: bz2/bz2t support and file cache support are new and not as well
tested.
usage: %prog maf_files [options] < interval_file
-s, --species=SPECIES: Comma separated list of species to include
-p, --prefix=PREFIX: Prefix to add to each interval chrom (usually reference sp... |
486bf71d92115d94412485c237855a211d7831077332c598cb17485910d75706 | Python | 3,809 | 133 | """Static analysis of Nottingham movie data.
"""
print("Setting up")
import os
import numpy as np
from osl_dynamics.analysis import static
from osl_dynamics.data import Data
from osl_dynamics.utils import plotting
from osl_dynamics.analysis import power, connectivity
#%% Setup
run = 1
#subjects_dir = '/well/woolri... |
5f4c1289533af1a4a072bcb2ba2d2204f469cf70faa2638b4152ce4416062984 | Python | 3,809 | 98 | #!/usr/bin/env python
import os
join = os.path.join
import SimpleITK as sitk
import numpy as np
from collections import OrderedDict
from scipy.ndimage import distance_transform_edt
from scipy.interpolate import interp1d
def interpolate_labels(label_volume):
depth, height, width = label_volume.shape
# Cre... |
90d2d76591ca23f480f07248d594a0f172fa1c52d7328ff1fd422022254a8a2a | Python | 3,809 | 96 | #New:
from __future__ import print_function, absolute_import
import os.path as osp
import glob
import re
from ..utils.data import BaseImageDataset
class Brain_Segs(BaseImageDataset):
"""
Market1501
Reference:
Zheng et al. Scalable Person Re-identification: A Benchmark. ICCV 2015.
URL: http://www.... |
bb53972d447d5558131c3f3dc39210f74422bcc7f0230867a95888a2b558cbf2 | Python | 3,809 | 98 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import tempfile
from scilpy import SCILPY_HOME
from scilpy.io.fetcher import fetch_data, get_testing_files_dict
# If they already exist, this only takes 5 seconds (check md5sum)
fetch_data(get_testing_files_dict(), keys=['processing.zip'])
tmp_dir = tempfile.T... |
52968215a40a79233ebedde9618c13edb47c3a3e053b31daac7671e75e58a726 | Python | 3,810 | 73 | import numpy as np
from brainscore_core.supported_data_standards.brainio.assemblies import DataAssembly
from brainscore_vision.model_helpers.activations.temporal.inputs.video import Video
"""This module includes different time alignment strategies for the activations of a temporal neural network.
A time alignmen... |
b3831acdd42c324005bc8147abf1958813d5e20bb48d166085bd46c8c4d52307 | Python | 3,810 | 97 | #!/usr/bin/env python
"""
00-search-ols-ontology-terms.py
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Functions to automate OLS search to retrieve ontology terms/codes for cancer_group
"""
__author__ = ('Sangeeta Shukla (shuklas1@chop.edu)')
import sys
import os
import requests
import json
import re
import pandas as pd
import ... |
ecc349c507ad4903c143a8fd69f5dcfa621a0f2275ca777ba99e0f4528a6a077 | Python | 3,810 | 46 | from testsetclass import TestsetClass
class G21IP(TestsetClass):
def __init__(self):
self.weak = 1.0
self.molecules = ['IP_61', 'IP_66', 'IP_59', 'IP_68', '51', '34', 'IP_67', 'IP_60', 'li+', 'n+', 'be', 'al', 'mg', 'na', 'c+', 'na+', 'si+', '20', '18', '11', 'IP_73', 'IP_n65', 'IP_74', 'IP_80', '... |
13ff7fa8f0adabbdddc90b76f9125e52b9a62e25eea7e35a4b58ea2f1d1b51eb | Python | 3,811 | 128 | """Host-shell backend construction shared by the CLI and the Streamlit UI.
The experimental Deep Agent runs shell commands on the host and edits
files under a workspace directory. Both front ends build the same
``LocalShellBackend`` (virtual-mode paths, a minimal environment
allowlist, no inherited environment); the ... |
da79be6432c2a4e2ca4755945e382cea8c8d22f12d33b2b97073d6e2190f2061 | Python | 3,811 | 112 | #!/usr/bin/env python3
# scripts/metrics_summary.py
"""
汇总 10 折交叉验证结果,计算多指标的 Bootstrap 置信区间,
并可选地对比两组预测的 AUC 差异(DeLong 检验)。
用法:
python scripts/metrics_summary.py \
--cv-dir results/cv \
--thr-file best_thresholds.json \
[--method2 path/to/other_preds.npz] \
[--n_boot 2000]
"""
import sys
imp... |
1e0cb138f8758052601924fd838933922d7e0f8ebf11c4fcca1fd0b05980fca2 | Python | 3,812 | 94 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
from pathlib import Path
from typing import Any
import torch
from ultralytics.engine.model import Model
from ultralytics.utils import DEFAULT_CFG_DICT
from ultralytics.utils.downloads import attempt_download_asset... |
5bc796eadd80c7c6e39c8fad6d9a99e17bd8317717aebd7cfaff2a2caa14114d | Python | 3,812 | 109 | #!/usr/bin/env python3
import sys
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import matplotlib
matplotlib.rcParams['pdf.fonttype'] = 42
matplotlib.rcParams['ps.fonttype'] = 42
matplotlib.rcParams['svg.fonttype'] = 'none'
data = pd.read_csv('pcg.csv',sep='\t',header=0)... |
370c87e9c77b9c94a37c48a889c2603b75d81e7f3be00d943509c89f1fe2c08d | Python | 3,814 | 86 | """
GeneratePredictionVideo
@ 2022 Knowblesse
Using the regression data (predicted location), generate a new video with predicted animal location labelled.
Input :
TANK_location
RegressionResult Path
"""
import re
import numpy as np
from pathlib import Path
from scipy.interpolate import interp1d
import cv2 as... |
3723df75fed806017b6f0bebd50033927a30d4f26060190badd2f9914f4d70e6 | Python | 3,814 | 80 | from brainscore_vision import load_dataset, load_metric
from brainscore_vision.benchmark_helpers.neural_common import TrainTestNeuralBenchmark, average_repetition, flatten_timebins_into_neuroids
from brainscore_vision.utils import LazyLoad
import numpy as np
BIBTEX = """@article{gifford_large_2022,
title = {A large a... |
96a94c2f59850eab5679d4c62568a064eec351bdf89eb3b4259371d69f313b3b | Python | 3,814 | 110 | from ._kfold import BaseKFoldDataModule, kfold_masks
from pathlib import Path
from typing import Callable, List, Tuple
import torch
from torch.utils.data import Dataset, DataLoader, Subset
class LineageData(Dataset):
def __init__(self, dict_data: dict):
self.dict_data = dict_data
# self.transforms: List[Callable... |
d2d9e93f7182dd24e6d65c7f6840d2f890dd90a153c9812cd148e866ccb257f2 | Python | 3,814 | 127 | """
Load ephys and behavior data in tdr format.
Usage:
dataT, metadata = tdrLoadAccData(root_dir, event='fdbk', animal = 'O', Fd = 20)
dataT: ['unit', 'time']
dataT['unit']: array of trials
dataT['unit'][0]: dict of ['response','task_variable','dimension']
dataT['unit'][0]['response']:
[ntrials,ntimepoints] e.g. [... |
0551b5d948a3248e53b9256feb707c033a2d9edbd53c73ac2a0b68ff991a48bf | Python | 3,815 | 121 | #!/usr/bin/python
#
## @file
#
# Voltage control (using National Instruments DAQ) of a
# Mad City Labs piezo Z stage.
#
# Hazen 11/14
#
import storm_control.sc_hardware.nationalInstruments.nicontrol as nicontrol
## MCLVZControl
#
# Class for controlling MCL Z piezo stage via a DAQ.
#
class MCLVZControl(object):
... |
bf59afe4f5c92d381c25fa9ae6a6bd2ecd99205831de954a7602999b38e2ee63 | Python | 3,816 | 122 | from __future__ import annotations
import asyncio
import json
import pathlib
import time
from collections.abc import Mapping
from typing import Any
from academy.exchange.hybrid import HybridAgentRegistration
from academy.exchange.local import LocalAgentRegistration
from academy.exchange.redis import RedisAgentRegistr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.