sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
b5fbdbf29f6af8f9c3c06d19c1a0cf32aaefeba1476a93dc7b0b4b408741880f | Python | 12,841 | 276 |
# This file is part of the Firmware project to interface with small Async or Neuromorphic chips
# Copyright (C) 2023 Ole Richter - University of Groningen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the... |
809c3e45c10f23b2c70e8736c0245571ef04a3a42b4f7d77d634161afb2510f4 | Python | 12,851 | 339 | """
This script is used to run the bootstrap analysis to finalize the
details of stimulus design for data collection. Specifically,
it is meant to run two types of analyses:
1. Bootstrapping on the training set, where the proportion of training data
to be used to fit the regression is specified as N_sents.
N_... |
960c6ef5df82da1cec369b0f843bcc566e9c6289336b604d4d064d62635887de | Python | 12,851 | 223 | import numpy as np
import os
from freesurfer.samseg.Samseg import Samseg
from freesurfer.samseg.utilities import Specification
from freesurfer.samseg.SamsegUtility import *
from freesurfer.samseg.io import kvlReadSharedGMMParameters
from freesurfer.samseg.VAE import VAE
from freesurfer.samseg.merge_alphas import kvlGe... |
ef9ec594bc1ba8cc59e4a35373234a3494f9c4c0bf433b3617dda08bda0ea14b | Python | 12,854 | 342 | """Design system for the Step 6 NWB metadata form ("Clean clinical" register).
Light theme, restrained palette: tinted-cool neutrals carrying one calm blue
accent. Panel renders every widget in its own shadow root, so internals can only
be reached through a per-widget ``stylesheets=[":host ..."]`` injection; custom
te... |
33a6a86a39660b9407984bd1743679abdfdf160dfd6b621d2f87aebe4ba196be | Python | 12,856 | 287 | import json
from pathlib import Path
import numpy as np
import pandas as pd
import pytest
from guppy.analysis.standard_io import (
write_covariate_correlations_to_hdf5,
write_tonic_to_hdf5,
)
from guppy.orchestration.group_analysis import (
_clear_group_results,
_filter_stores_list_to_averaged_events,... |
5ae1b89fc26ea7b9b5576ccbc45af7c2010a6af03582afd3acbf6c9f348cb048 | Python | 12,859 | 346 | ###########################################################################################
# This program is distributed under the MIT License (see MIT.md)
###########################################################################################
import argparse
import logging
from typing import List
import ase.dat... |
66cc1c088b3f7d528f1c7a6571d138d10c769d3d5ce84a1e60a9840b80c7c596 | Python | 12,863 | 377 | """
Parameter grid expansion utilities for automation.
Handles expansion of parameter combinations for grid search,
folder name generation, and tracking of parameter variations.
"""
# Category prefixes for folder naming (ensures no overlap between categories)
CATEGORY_PREFIXES = {
'general': 'g',
'cofiring': ... |
f57fb947af4ba7fddb1dc67a4c1c79c839394cc5cc03c1901e0c466a314cea7f | Python | 12,869 | 322 | import pytest
import pytest_mock
import networkx as nx
from random import choice as rand_choice
from CybORG import CybORG
from CybORG.Simulator.State import State
from CybORG.Simulator.Scenarios.EnterpriseScenarioGenerator import SUBNET
from CybORG.Simulator.Actions.GreenActions.GreenAccessService import GreenAccessS... |
f1c77fae6a8e302e2609095028f34566cd6737bc788ae48a69cfdcd856c17ccb | Python | 12,877 | 358 | import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import numpy as np
import pandas as pd
from rdkit import Chem
import torch
import dgl
import random
from rdkit.Chem.BRICS import FindBRICSBonds, BreakBRICSBonds
from rdkit.Chem import ChemicalFeatures
from rdkit.Chem impo... |
7dad8474f7352f9222fb8d7f21937617038778a70d5358048d0b39f077ff6472 | Python | 12,880 | 347 | # Author: Hauxu Yu
# A module for data visualization.
# imports
import random
import numpy as np
import os
import re
from tqdm import tqdm
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
import matplotlib.transforms as transforms
from matplotlib.patches import Ellipse
from .annotation import ext... |
55f5004511a793f5b5fba2e7b158fc8203c5d137a0c307ff090122723fe33cfa | Python | 12,890 | 299 | """
script to train the network
training is performed from the configuration.json file in the project's directory
run 1_define_training_configuration.py to configure training and create configuration.json accordingly
"""
import os
import numpy as np
import pandas as pd
from utilities import printdt, denoise_volume_gaus... |
8ec33b4df21dfb22531266ea91e5fb2313b5cb3462a0edc2890df6abf8addd71 | Python | 12,899 | 398 | import json
import numpy as np
import pytest
import xgboost as xgb
from xgboost import testing as tm
from xgboost.testing.data import run_base_margin_info
cudf = pytest.importorskip("cudf")
def dmatrix_from_cudf(input_type, DMatrixT, missing=np.nan):
"""Test constructing DMatrix from cudf"""
import pandas ... |
b92fe3419c329f952b323a51b8ca901216cb2f35708664343b3bac0b3ecf288e | Python | 12,910 | 315 | #!/usr/bin/python3
import argparse
import itertools
from torch.autograd import Variable
import torch
import random
import concurrent
from concurrent.futures import ProcessPoolExecutor
from models import Converter
from utils import fastl2lir_parameter, dnn_chunk_get
from utils import LambdaLR, PathBuilder
from utils imp... |
84750088a39fc7cfa8be5d9d408904ef4eca4edbb608232d0714243b64d58afc | Python | 12,916 | 351 | # Standard Library Imports
import os
import shutil
import tempfile
import warnings
from collections import OrderedDict
from math import pi
# Third Party Imports
import MDAnalysis as mda
import mdtraj as md
import numpy as np
from MDAnalysis.analysis.align import AlignTraj
from MDAnalysis.analysis.base import AnalysisB... |
adde23ab9a38a2ce436122a75956f7080b7fdfb90609317c6ec41db088666f21 | Python | 12,916 | 210 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 27 11:15:18 2023
@author: george
"""
import numpy as np
from qtpy.QtCore import *
import pandas as pd
test = np.array([ 4.447, 4.938, 6.548, 5.553, 7.464, 12.944, 13.145,
15.046, 18.277, 15.322, 17.704, 18.098, 19.105, 18... |
c3410f08ca580ea0ba8e8d40c86f7b1505318dcdb1c0341c64aa4733e7c3cd9f | Python | 12,918 | 257 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://w... |
cb4ea6922006d1fcc714c33aaa06d12f5ce98bd7fe2e63bf4ecdc398e52fc702 | Python | 12,926 | 381 | ##
## CPCantalapiedra 2021
import shutil
from sys import stderr as serr
from collections import defaultdict
from ..common import get_version, colorify
from ..annotation.output import ANNOTATIONS_WHOLE_HEADER
DECORATE_GFF_NONE = "no"
DECORATE_GFF_GENEPRED = "yes"
DECORATE_GFF_FIELD_DEFAULT = "ID"
##
def run... |
4be8721cf5f3f45ba9cff77d30a9d4b45eab07a93748efa5a7983beb6fa11a73 | Python | 12,937 | 331 | import pickle
import torch
import matplotlib.pyplot as plt
import os
import numpy as np
import random
def getWeightFromUniqueId(uniqueId, objFolder='./data/obj'):
print('ATTEMPTING TO LOAD: '+objFolder+'/'+uniqueId)
fileList = os.listdir(objFolder)
filePath = [i for i in fileList if uniqueId in i][0]
w... |
f4431cfddf741ec6cc13a04d9eb007ff2d1d7c25f489e751fc3e5f035dc102b6 | Python | 12,939 | 354 | # Microscope profile settings
# Author: David Young, 2020
"""Profile settings for processing regions of interests.
These setting typically involve high-resolution such as microscopy images.
"""
from typing import Dict, Optional, Tuple
from magmap.settings import config
from magmap.settings import profiles
class ROI... |
81203f9c8985507a3a0601f1413a74455e54c35964fe853b6c08768ce3258a70 | Python | 12,941 | 246 | import argparse
import os
import platform
import sys
from pathlib import Path
import torch
FILE = Path(__file__).resolve()
ROOT = FILE.parents[1] # YOLO root directory
if str(ROOT) not in sys.path:
sys.path.append(str(ROOT)) # add ROOT to PATH
ROOT = Path(os.path.relpath(ROOT, Path.cwd())) # relative
from mod... |
bacef0e88bf6cf4e5be9e39b3a48150dc98bce14681b75bdba887256f949eb55 | Python | 12,962 | 414 | """
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 torch
from torch_geometric.nn import SchNet
from torch_scatter import scatter
from ocpmodels.common.registry import registry
from ocp... |
f9e978ced8fe6c9d63cb61c9a63164234cfde2a28091323f95d34805849edcc4 | Python | 12,974 | 379 | from itertools import product
from typing import Any, Dict
import numpy as np
import pytest
from hypothesis import assume, given, note, settings, strategies
import xgboost as xgb
from xgboost import testing as tm
from xgboost.testing.params import (
cat_parameter_strategy,
exact_parameter_strategy,
hist_c... |
49245e9221b6909d542e04da1cf2575572dee81ab5fbbc4f004afb4d386ee47a | Python | 12,979 | 461 | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from mmseg.models.utils.embed import AdaptivePadding, PatchEmbed, PatchMerging
def test_adaptive_padding():
for padding in ('same', 'corner'):
kernel_size = 16
stride = 16
dilation = 1
input = torch.rand(1... |
9db0a5eaf7ba96189bf2874adeef4df907e3aeab284276a350abb4856dd77d11 | Python | 12,993 | 329 | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from mmcv.cnn import build_activation_layer, build_conv_layer, build_norm_layer
from mmengine.model import BaseModule
from mmseg.registry import MODELS
from ..utils import resize
class DownsamplerBlock(BaseModule):
"""Downsampler ... |
1a7b2d4c53cdd86706b70cf5dcb4d15f7eaf70072fd019c5ea9098ab96114179 | Python | 13,000 | 431 | """Geometry REST API endpoints for room geometry management."""
import json
from functools import lru_cache
from typing import Any
from fastapi import APIRouter
from pydantic import ValidationError
from sqlmodel import select
from zndraw.broadcast import broadcast_to_room
from zndraw.dependencies import (
Access... |
85eff364dfd26fe698710abdbac582b0eac95b140e707440530e897436288416 | Python | 13,002 | 392 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Data fetchers
"""
import os.path as op
from pathlib import Path
import shutil
import numpy as np
from neuromaps import datasets, images
import nibabel as nib
from .utils import (get_data_dir, _groupby_match,
get_dataset_info, _match_files)
from ei... |
4c41b5b278eee7f9785a288bfccf14963f5fda8d217e9607ef22ff6e8e1cf86a | Python | 13,005 | 235 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://w... |
8787878716864d833908f2765778a996533055d33831f0e22c0265c36f02d1b5 | Python | 13,006 | 293 | """
Miscellaneous utilities for wrangling data from neuprint for various purposes.
"""
import pandas as pd
import numpy as np
def syndist_matrix(syndist, rois=None, syn_columns=['pre', 'post'], flatten_column_index=False):
"""
Pivot a synapse ROI counts table (one row per body).
Given a table of synapse ... |
6c600fe1e1c1baa9baa86d8fdb4b9d71ae2d55079c7ca7d504b9cf34ffc33af0 | Python | 13,007 | 352 | ##################################################################
# Getting coefficient values for size 2,3,4 motifs
# Reproducibility for Figure.3MNO
##################################################################
import pandas as pd
import numpy as np
from scipy.spatial import Delaunay
from itertools import comb... |
d6c841c0b8ce3bc079ecf268e8099f05ec60421f2cc5a087c03ecac9a0246041 | Python | 13,011 | 281 | #!/usr/bin/env python
# ----------------------------------------
# scikit-ribo
# ----------------------------------------
# a module for fitting the GLM of TE
# ----------------------------------------
# author: Han Fang
# contact: hanfang.cshl@gmail.com
# website: hanfang.github.io
# date: 3/31/2016
# ---------------... |
3fa780154a6c71ec652638611c2af88b2d198a688a539ef4d9137c899806dc3d | Python | 13,029 | 337 | """
Eigenmode resampling on the cortex. Use fit.surface_fit() to determine how many
modes to use to capture the empirical variogram.
"""
from eigenstrapping import (
SurfaceEigenstrapping, VolumetricEigenstrapping, compute_psd, utils,
)
import matplotlib.pyplot as plt
import numpy as np
from netneurotools.stat... |
ce5e337106c683ed29caa59164c6431a10e4811d08b444b7d455309048a18321 | Python | 13,031 | 406 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://w... |
a86418fa57af85ef497375e66194301b415c4a902c9f1dcceb8964cda10fa03d | Python | 13,036 | 411 | """
Base classes for creating GUI objects to create manually selected points
The definition of X,Y axis is the following:
xmin,ymin o---------o xmax,ymin
| |
| |
| |
| |
xmin,ymax o---------o xmax,ymax
Copyright (c) 2017 Polytechniqu... |
c288181a4cb8ea9a2a83e5f02cb5e70f3c8c92de3bf40c4b7246749c7418ab06 | Python | 13,043 | 399 | from rest_framework import status
from medperf.tests import MedPerfTest
from parameterized import parameterized, parameterized_class
class ResultsTest(MedPerfTest):
def generic_setup(self):
# setup users
data_owner = "data_owner"
model_owner = "model_owner"
bmk_owner = "bmk_owner... |
6c88c874c0259ae6a23fe119696b366e89ce33e2d4912fc77fdbe1e81d2fd204 | Python | 13,052 | 234 | # -*- coding: utf-8 -*-
# @Time : 6/10/21 5:04 PM
# @Author : Yuan Gong
# @Affiliation : Massachusetts Institute of Technology
# @Email : yuangong@mit.edu
# @File : ast_models.py
import torch
import torch.nn as nn
from torch.cuda.amp import autocast
import os
import wget
PRETRAIN_ROOT = '/mnt/d/MART-main/mod... |
60392133c25fb1f5f20fcfcc05d46af589ccbe6944a0ad3ed4cd61a080067949 | Python | 13,057 | 244 | #!/usr/bin/env python2.7
import os, sys
os.environ["OMP_NUM_THREADS"] = "1"
os.environ["OPENBLAS_NUM_THREADS"] = "1"
os.environ["MKL_NUM_THREADS"] = "1"
os.environ["VECLIB_MAXIMUM_THREADS"] = "1"
os.environ["NUMEXPR_NUM_THREADS"] = "1"
import argparse
from subprocess import Popen
import chisel
src = os.path.dirna... |
3b86bc9648b66786e57fb8734bac497cc51a87cdc80863c0e90d81c122bad83e | Python | 13,058 | 355 | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
# https://github.com/facebookresearch/segment-anything
import math
from copy import deepcopy
from itertools import produc... |
100fcf22e173f1d8db3be5d88233d04ba166e17357a790ce870af19bd02cd1f7 | Python | 13,070 | 400 | """E2E tests for per-room scoped jobs.
Per-room jobs are registered with room=vis.room and are only visible
to clients in that room. Cross-room isolation is a key property.
"""
import ase
from zndraw import ZnDraw
# =============================================================================
# Registration & Isola... |
3bfa0ddd91cd7e5baae480f933a681b779919d5c7fe2ee1c55fee2f456fd41cc | Python | 13,070 | 362 | import numpy as np
import random
import torch
import torch.nn as nn
class FCN8s(nn.Module):
def __init__(self, n_class=3):
super(FCN8s, self).__init__()
# conv1
self.conv1_1 = nn.Conv2d(3, 64, 3, padding=100)
self.relu1_1 = nn.ReLU(inplace=True)
self.conv1_2 = nn.Conv2d(64,... |
c77b1921a7f3c3df86f57a0d26bf87130de48be48db99bbc9d61044dc7c02b66 | Python | 13,075 | 310 | import json
import os
import pytest
from src.node import NodeFactory
from src.util import get_config
# ---------------------------------------------------------------------------
# TSV output assertion helpers (used by both datahandler and pipeline tests)
# -----------------------------------------------------------... |
dd923bdba14588d2654e6a2fb088b59b1e6c73482af64a3b8db39eb8aa46d22c | Python | 13,079 | 389 | import numpy as np
import skimage.io
from scipy.ndimage import zoom
from skimage.transform import resize
try:
# Python3 will most likely not be able to load protobuf
from caffe.proto import caffe_pb2
except:
import sys
if sys.version_info >= (3, 0):
print("Failed to include caffe_pb2, things mi... |
b1222d539f99e05afa1f231697af420011a605a9ab04b732e3938da437cf2e08 | Python | 13,082 | 357 | import torch
import numpy as np
import dgl
import os
import math
import pickle
import json
import copy
import random
import torch.utils.data as data
from collections import defaultdict, Counter
from tqdm import tqdm
from utils import get_enc_len, int2onehot, \
batch_convert_tensor_to_tensor, batch_convert_array_to_... |
436fbf6ab32f3476dca0376e700bdc6e53dd0c8da17f6d47f78ec044e322542e | Python | 13,084 | 384 | import pytest
import numpy as np
from numpy.testing import assert_allclose
import keras
import keras.backend as K
from keras.utils.test_utils import layer_test
import time
skipif_no_tf_gpu = pytest.mark.skipif(
(K.backend() != 'tensorflow' or
not K.tensorflow_backend._get_available_gpus()),
reason='Requi... |
01600c01c161cd079d7106fb1d4da845cf91aa31ab2bcecaf8cb151b6d6d20a2 | Python | 13,090 | 349 | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import os
import warnings
from threading import Thread
import numpy as np
import torch
from PIL import Image
from tqdm im... |
9cf2fdba128cfba6a8c822866b8ddfa418f6622e1f11819c19ed89934d1c5a9e | Python | 13,118 | 399 | """Unit tests for the DLPack interop of the ``*_dlpack`` commands.
Each command has two destinations and both are covered here:
out=None allocate a ``DeviceArray`` and hand it back; the caller adopts it
with ``torch.from_dlpack`` (or cupy, or jax -- nothing here is
torch-specific, which ... |
4e3b3629e3a7d0369f3a0d371d050321f0c6322fc5f8143c34f5b52ba647a53c | Python | 13,124 | 252 | import re
import jellyfish
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from sklearn.metrics import confusion_matrix, roc_curve, auc, accuracy_score, precision_score, recall_score, f1_score
import matplotlib.pyplot as plt
import seaborn as sns
def calculate_jaro_wi... |
6807d8d5c4ff2ff6c9a9af3bcd19c0c134ac3c0c8125dcefab1afccd9aac54e8 | Python | 13,124 | 361 | # 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 itertools
import logging
import os
import sys
from typing import Any, List, Optional, Union
import numpy as np
import torch
import to... |
90bf642b05f15e9084e70fed960859f580625d173cf5fb642af0f70fa1468eff | Python | 13,127 | 344 | import os
import re
import numpy as np
import matplotlib.pyplot as plt
from tensorflow.keras.models import load_model
import tensorflow as tf
def load_models(models_dir, pattern):
"""Load .hdf5 models matching pattern from models_dir."""
all_files = os.listdir(models_dir)
model_files = [
fname for... |
3f3f56ecd0c26ad4c55b139a3dfe00dab7403a86d96987c5381487adf78ce625 | Python | 13,139 | 355 | """
Hermetic multi-producer parity tests.
These tests verify that the R1 multi-producer concurrency path
(``producer_threads > 1``) schedules *exactly* the same set of GPU tasks as the
single-producer path (``producer_threads == 1``).
Why this matters
----------------
The multi-producer path splits the trajectories a... |
354da98fdb6b3d5dfdd38ef6d5be787cfd61037ffa5c973e0144173fd1bff491 | Python | 13,157 | 283 | import shutil
from pathlib import Path
import numpy as np
import pandas as pd
import pytest
from guppy.analysis.io_utils import PSTH_SIGNIFICANCE_DIRNAME
from guppy.analysis.standard_io import read_psth_significance_from_hdf5
from guppy.testing.api import group_analysis, label_groups, step1, step2, step3, step4
from ... |
611d38f2565b7666893f5ad302517d1f64a3d61835dedb0be4c7394809668f67 | Python | 13,160 | 356 | # -*- coding: utf-8 -*-
import base64
from contextlib import closing
from io import BytesIO
import logging
import numpy as np
import os
import math
from django.conf import settings
from django.http import HttpRequest, HttpResponse
from catmaid.models import UserRole, TileSourceTypes, Stack
from catmaid.control.commo... |
5f0453ded1692ac044a4c6bb33ebb96effa579a7712085c8e21b96dc20f63240 | Python | 13,161 | 409 | import dgl
import copy
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from utils import get_func
from dgl import function as fn
from functools import partial
from torch.nn import Sequential, Linear, ReLU, BatchNorm1d
# dgl graph utils
def reverse_edge(tensor):
"""Implement edge rev... |
4a95984a464f5367d5cb476d1a8b274fef6133fe9e30b65b757c4efe3471ba0c | Python | 13,162 | 384 | """
Date: 2021-11-30 13:55:07
LastEditors: yuhhong
LastEditTime: 2022-11-30 13:33:16
"""
from typing import Sequence
import torch
from torch.utils.data import Dataset
import numpy as np
import math
import pickle
from rdkit import Chem
from rdkit.Geometry import Point3D
from rdkit.Chem import AllChem
from rdkit.Chem.... |
8760e63ff89a7eea3505ab4d040876adc4a42d0c90da5cb668c76a869f2c155e | Python | 13,166 | 384 | # Author: Huaxu Yu
# A module for normalization
# There are two types of normalization:
# 1. Sample normalization - to normalize samples with different total amounts/concentrations.
# 2. Signal normalization - to address the signal drifts in the mass spectrometry data.
# imports
import numpy as np
from statsmodels.n... |
d9abac40fbc3eec21f51ef7731e4cbc671f918b5d73a57f19a1f2d6e1a1ddec0 | Python | 13,173 | 294 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://w... |
e35bbf13bc2e544a0272cd3f9539af38a752676ac3cd744be31cd8220afee804 | Python | 13,173 | 323 | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import copy
from typing import Tuple
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as... |
f3a7331912be6dcd49f3de3c2bb843f21390cf18edb225c491f5af5617b8b125 | Python | 13,173 | 366 | import os
import gzip
import shutil
import csv
from fpdf import FPDF
import pandas as pd
from tqdm import tqdm # for progress bar
import matplotlib.pyplot as plt
import random
from Bio.SeqIO import parse
from Bio.Seq import Seq
from Bio import pairwise2
from Bio.SeqIO.QualityIO import FastqGeneralIterator
def gz_ext... |
3c19504d22a16b35df53159014bf55a75aaa00f43c927a6b6eade61880f9c612 | Python | 13,182 | 353 | """Blob classifier."""
from enum import Enum, auto
from time import time
from typing import Tuple, Sequence, Optional
import numpy as np
from magmap.cv import chunking, detector
from magmap.io import cli
from magmap.plot import plot_3d
from magmap.settings import config
_logger = config.logger.getChild(__name__)
d... |
0ed3814bb57189e0f85a27fce67215d1dfa01737a511332f6938a1ead55ad464 | Python | 13,183 | 270 | import os, subprocess, re, sys, ast
from utils import runCmd, mkdirs, fileExist, rm, mkdir, rm_capital_for_render, mv, load_pos_vel
import json
import numpy as np
import random
import torch
import argparse
from shutil import copyfile
import shutil
import fnmatch
"""
####################################################... |
9b1a71c1b607735f69e3086a9a3b482b8133c6460f07649de2e48ac659cda6a8 | Python | 13,190 | 286 | import os
import re
import src.datahandlers.mesh as mesh
import src.datahandlers.obo as obo
import src.datahandlers.umls as umls
from src.babel_utils import Text, glom, read_identifier_file, write_compendium
from src.categories import PROTEIN
from src.metadata.provenance import write_concord_metadata
from src.prefixes... |
f4d275f6c3fd6b5fd7bbf3e762cb954625e823ac4cf216566def64504ae3fe0f | Python | 13,199 | 352 | """Test functions in heudiconv.convert module."""
from __future__ import annotations
from glob import glob
import json
import os.path as op
from pathlib import Path
from typing import Optional
import pytest
from heudiconv.bids import BIDSError
from heudiconv.cli.run import main as runner
import heudiconv.convert
fr... |
c7dbf9ece2870a8dca92d7736285017ff1b2c4005f57f34edbc7afb5575e2ad4 | Python | 13,204 | 347 | """Wrapper for using the Scikit-Learn API with Keras models.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import copy
import types
import numpy as np
from .. import losses
from ..utils.np_utils import to_categorical
from ..utils.generic_utils import... |
5b3acfbd6829e80ad6b238c58907c451eb130fdfff9e38fa57a7d325f4861c11 | Python | 13,207 | 399 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Data fetchers
"""
import os.path as op
from pathlib import Path
import shutil
import numpy as np
from neuromaps import datasets, images
import nibabel as nib
from .utils import (get_data_dir, _groupby_match,
get_dataset_info, _match_files)
from ei... |
6f09b8312d492a6aa9d70277702522941c6f6a52affd272fd8bda61e1a114e90 | Python | 13,207 | 370 | import os, time, argparse
import h5py
import numpy as np
import open3d as o3d
from pytraj import Trajectory
from matplotlib import colormaps
from siesta.scripts import view_obj
element_color_map = {
# BASIC ELEMENTS
12: [0.5, 0.5, 0.5],
1: [1, 1, 1],
14: [0, 0, 1],
15: [1, 0, 0], # TODO: Need to co... |
9c0d963968a395a134f0185450d86f07d374a7f7cdd7632a68629f9f4dd550ed | Python | 13,209 | 495 | #!/usr/bin/env python
# coding: utf-8
# In[18]:
import pandas as pd
import numpy as np
from datetime import date
import os
from tqdm import tqdm # for progress bar
import matplotlib.pyplot as plt
import matplotlib
import seaborn as sns
import random
from Bio import pairwise2
import csv
import sys
from sklearn.linea... |
483cdc88ad0a5c4fac82e8ca99860692e70c7922b70a5679f612ad5af3a18246 | Python | 13,221 | 396 | # ----------------------------------------------------------------------------
# pymdfa
#
# Copyright (c) 2014 Peter Jurica @ RIKEN Brain Science Institute, Japan
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to d... |
ce65a803721860371b5bde9e3d5677d83d9d95bb53f17de7cf15be5c21ad2b41 | Python | 13,225 | 419 | # -*- coding: utf-8 -*-
"""
Created on Wed Jun 12 17:33:41 2013.
Utility functions for calcium-based STDP using simplified calcium model as in
(Graupner and Brunel, 2012).
@author: Giuseppe Chindemi
@remark: Copyright © BBP/EPFL 2005-2016; All rights reserved.
Do not distribute without further notice.
"""
#... |
2c621c83b7e27d25f4cf3994a529cd610f35c2e8fee10cff8c35be8690ec5cd6 | Python | 13,226 | 340 | #!/usr/bin/env python
"""
Module for loading RELION particle datasets
"""
import os
import sys
from glob import glob
from typing import Optional
import numpy as np
from ..handlers.particle_dataset import ParticleDataset
from ..handlers.star_file import load_star
def is_relion_abort(directory: str) -> bool:
re... |
344f36dc7c513c8c6e2256973ca2967ada14a4e13bf0e9c34ef2391ca4d284df | Python | 13,226 | 360 | from concurrent.futures import ThreadPoolExecutor
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from pathlib import Path
from typing import List, Dict, Any, Optional, Tuple
from ..logger import logger
# Import preprocessing utilities
from ..utils.preprocessing import (
prep_input_table,
... |
5b9915617feee657064e1061753846aeea0f2211c1e4cdc3706dbb3d02385505 | Python | 13,226 | 407 | """Socket.IO server with room support."""
import json
from uuid import UUID
import socketio
from fastapi import Depends
from fastapi_users.jwt import decode_jwt
from jwt import InvalidTokenError
from zndraw_socketio import EventContext, wrap
from zndraw.broadcast import broadcast_to_room, room_channel
from zndraw.de... |
ac1bee28d370fc0339be5bc3c42bbc2d29baced25bb5f5704335cbce829845ec | Python | 13,244 | 289 | from typing import Callable
import torch
import torch.nn.functional as F
from torch_scatter import scatter_max
from tqdm import tqdm
from .diffusion import log_sample_categorical
from .model import MolDiff
class ScaffoldedMolDiff(MolDiff):
@torch.no_grad()
def sample(
self,
n_graphs,
... |
70735d34aa302ae990dbfb40e1107f45d1867cab937e45a3b3508b289fdc21df | Python | 13,248 | 352 |
import numpy as np
from scipy.stats import zscore
def fev_nan(spks):
"""
Calculate the fraction of explainable variance (FEV) for each neuron.
Parameters:
----------
spks : list of numpy.ndarray
List of n_images arrays, each of shape (n_repeats, n_neurons), where
different images... |
476258fcd21654646777e35b2100ba5c5a9c9b93a297bdac54695c62a0075efa | Python | 13,249 | 360 | from concurrent.futures import ThreadPoolExecutor
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from pathlib import Path
from typing import List, Dict, Any, Optional, Tuple
from ..logger import logger
# Import preprocessing utilities
from ..utils.preprocessing import (
prep_input_table,
... |
7519c3b55c9970e9c1844999c9a91405ab6290dc26713761473bef037922295c | Python | 13,251 | 294 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-05-08 02:03
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
"""Make the foreign keys in different tables deferrable. This can be useful
to data ingestio... |
81d0cdf947354f82a7058df21828c51d065955733f94f124d2558d1ec8cb6375 | Python | 13,253 | 308 | from pytorch_lightning import (
LightningModule,
Trainer,
)
from pytorch_lightning.callbacks import (
LearningRateMonitor,
)
from fengshen.models.clip import (
TaiyiCLIPModel,
TaiyiCLIPProcessor,
)
from fengshen.models.model_utils import (
add_module_args,
configure_optimizers,
get_total... |
75d2b54e40b1a321da6e52658e096f54ed203e626698e99b2740ed20d6608b17 | Python | 13,254 | 304 | import os
import shutil
from pathlib import Path
from unittest import TestCase
import numpy as np
from pyalfe.image_processing import ImageProcessor, Convert3DProcessor, NilearnProcessor
from tests.utils import create_nifti, get_nifti_data, get_nifti
def get_image_processor_test(image_processor: ImageProcessor) -> ... |
584617c6fc8bcb6edbbf20866d15b5eb18439b3b2d4cb1d6a49910642968a9f5 | Python | 13,264 | 344 | # -*- coding: utf-8 -*-
import json
import time
from django.db import connection, transaction, InternalError
from django.test import TestCase, TransactionTestCase
from django.test.client import Client
from guardian.shortcuts import assign_perm
from catmaid import history
from catmaid.control import tracing
from catma... |
16992a2de0dac10914663804c5cebf50ac7a8b2d7dfe042b1c9868ebda09b036 | Python | 13,269 | 362 | """
Utility functions for managing configuration files.
License: BSD-3-Clause
Author: Hanna M. Tolle
Date: 2024-10-31
"""
import os
import json
import itertools
from typing import List, Dict
from collections.abc import Mapping
import numpy as np
import pandas as pd
import copy
def clean_config(data):
"""
Re... |
ab3ec64fa13561065f826bb25ed095e77357bd6e860685758e427e4039ce7d65 | Python | 13,269 | 328 | import time
import argparse
import numpy as np
import pandas as pd
import pickle
import os.path
import scipy.sparse as sp
import scipy.io
parser = argparse.ArgumentParser(description='Main Entrance of scGNN')
parser.add_argument('--datasetName', type=str, default='481193cb-c021-4e04-b477-0b7cfef4614b.mtx',
... |
cf2d84ed04a945f29a98c5959ac567beb85366212fb1c7341266cc541cdafef3 | Python | 13,280 | 347 | """
A place to dump all of the big plotting functions from the geography
notebook.
"""
import numpy as np
import matplotlib.pyplot as plt
# For two_grids_and_diff:
import matplotlib.gridspec as gridspec
# For circle_plot:
from matplotlib.path import Path
from matplotlib.patches import PathPatch
from matplotlib impo... |
85b35f52dc81b9a474415cceddd32a00827f0f0654cbde67cceffa8c34b36375 | Python | 13,289 | 255 | import pandas as pd
import matplotlib.pyplot as plt
# Import the CSV file as a Pandas DataFrame
data_table_1 = pd.read_csv('Results_2_comp_1.csv')
data_table_5 = pd.read_csv('Results_2_comp_5.csv')
data_table_20 = pd.read_csv('Results_2_comp_20.csv')
# avec epsilon 0.6
# data_table_epsilon0595= pd.read_csv('... |
cd419fa50b796c624827f7ba2aadc4d31fa9915b1516c1849123ab2b7da62948 | Python | 13,289 | 392 | """Functions to run ANTs commands."""
import os
from os.path import basename
from re import sub
from shutil import copy
from typing import List, Optional, Tuple, Union
import numpy as np
import SimpleITK as sitk
from scipy.ndimage import gaussian_filter
from skimage.filters import threshold_otsu
import brainbuilder.u... |
a1fd747e85df4cc83df3fc6369631e9d62a62ad7a9b1845ca76e36df38174ffe | Python | 13,292 | 359 | """Tests for ephys.efeatures"""
import os
from os.path import join as joinp
import pytest
import numpy
from bluepyopt.ephys import efeatures
from bluepyopt.ephys.responses import TimeVoltageResponse, TimeLFPResponse
from bluepyopt.ephys.serializer import instantiator
@pytest.mark.unit
def test_EFeature():
"""e... |
6e6b7e3867a46965cb5f3a17297a7b37edee121fbf19b883651c0bbe4cc845d4 | Python | 13,301 | 338 | # -*- coding: utf-8 -*-
import json
from typing import Dict, Tuple
from django.db import connection
from django.http import HttpRequest, JsonResponse
from django.core.exceptions import ObjectDoesNotExist
from catmaid import state
from catmaid.models import UserRole, Project, Relation, Treenode, Connector, \
... |
e3c0e73f57d22335f89eda05957352b81b5a2d6e476364171b1c741e94e00016 | Python | 13,306 | 264 | #!/usr/bin/env python
"""Regenerate the two DrugBank food-and-extract audit CSVs in this directory (issue #828).
This is the committed generator for the sibling files:
- ``food-and-extracts.csv`` (File A) — every structureless DrugBank food/material this PR retypes,
with the type it ships now (``biolink:Food`` ... |
ad727698f3ed3f92081f86216d345692fb1092c1128d8842def994df7f46919b | Python | 13,322 | 370 | import numpy as np
import pandas as pd
import random
import re
import pickle
from rdkit import Chem
import sys
import time
import torch
from torch.utils.data import Dataset
from .utils import Variable
class Vocabulary(object):
"""A class for handling encoding/decoding from SMILES to an array of indices"""
d... |
6522971ea18fe0e911f5cd765cb60bd6ed11e8c0dcb8240e5eebbc6b6ca5cf61 | Python | 13,333 | 372 | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
import torch
import torch.nn as nn
import torch.utils.checkpoint as cp
from mmcv.cnn import ConvModule, build_conv_layer, build_norm_layer
from mmengine.model import BaseModule
from mmengine.utils.dl_utils.parrots_wrapper import _BatchNorm
from mmseg.reg... |
e5efefd156716e7bd992d6735ff3ee74372223b798dd0a7a4ee7f4fabecba5eb | Python | 13,340 | 378 | import os
import sys
root_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(root_dir)
from rdkit import Chem
import torch
import dgl
from rdkit.Chem.BRICS import FindBRICSBonds, BreakBRICSBonds
from rdkit.Chem import ChemicalFeatures
from rdkit.Chem import MACCSkeys
from rdkit import R... |
743345732b743fa59279b1f6d82fb848ab2bc4f440f271fe91de576418989894 | Python | 13,343 | 275 |
import quantities
import pkg_resources
try:
import cPickle as pickle
except:
import pickle
import gzip
from hippounit import plottools
import matplotlib.pyplot as plt
import os
import numpy
from quantities import mV, nA, ms, V, s
import json
import collections
# adding the result data to dictionary
data_dict... |
e31f987198443be76a951b15aad69419cde7ed1574ec2150aed377356c537565 | Python | 13,359 | 308 | import numpy as np
import os
import sys
import math
import torch
import json
import random
from torch import nn
from torch.utils.data import TensorDataset, Dataset, DataLoader
import argparse
from sklearn.metrics import (
precision_recall_fscore_support,
roc_auc_score,
average_precision_score,
auc,
... |
0ff2d851a7890ba3a30c9b77554a0c9c9ad48f4fe0173fb283da99861f27d998 | Python | 13,361 | 323 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 3 10:41:12 2023
@author: schwab
"""
import torch
import numpy as np
from ..models.constants import ConsensusInitializationMode
from ..models.losses import GeometricLoss
from ..utils.utils_new import frc, fourier_loss, points2bild
from ..data.han... |
b2dda25ce633aeaa6d320886b56a241a1d13d32d2cbe6c3ecff69adfb93474f6 | Python | 13,367 | 275 |
import quantities
import pkg_resources
try:
import cPickle as pickle
except:
import pickle
import gzip
from hippounit import plottools
import matplotlib.pyplot as plt
import os
import numpy
from quantities import mV, nA, ms, V, s
import json
import collections
# adding the result data to dictionary
data_dict... |
a1788e2c9f95c62f2f6fdf02174f9949bcaefa21309babd433984f22eb961772 | Python | 13,373 | 295 | import pandas as pd
import numpy as np
import zipfile
import torch
from functools import lru_cache
import os
from copy import deepcopy
from synergy.combination import MuSyC, BRAID, Zimmer
from utils import *
from torchmetrics import AUROC
from functools import lru_cache
from src import *
from utils import *
from torch ... |
9b94987059d0b05ce3140118cb946751bb108992b5098edf39130226f0525dbc | Python | 13,374 | 269 | """This code runs an export function on the kinetic model
We need from model.get_kinetic_model() the Jaxkmodel.func before jit compiling """
import libsbml
import jax
import jax.numpy as jnp
from typing import Union
from jaxkineticmodel.load_sbml.sympy_converter import SympyConverter, LibSBMLConverter
from jaxkineticm... |
d1e21a43741ec1c463b71d68ba448f20dc648ec5afd6ca68a1e432a7de215c53 | Python | 13,374 | 288 | #!/usr/bin/env python
"""convert behavioral file into event lists and singletrial format
- regressor of interest per task
- duration of epoch
- rating onset
- potential covariates?
"""
import numpy as np
import pandas as pd
import os, glob, re, json
from os.path import join
from pathlib import Path
import logging
# ... |
fa2c1957244343e27d7cc391c4ad9c358a032ac4b94dbb5bad0cbeadd65ad65f | Python | 13,374 | 438 | # tests/conftest.py
"""Shared test fixtures for DRY tests."""
import asyncio
import uuid
from collections.abc import AsyncGenerator
from contextlib import asynccontextmanager
from typing import ClassVar
from unittest.mock import MagicMock
import httpx
import pytest
from fastapi import FastAPI
from fastapi.testclient ... |
7fea12d88d7f07a65f2a18d93b0ff2d5e8bfb9856ab7bc5da67efeaba81d3bf8 | Python | 13,397 | 422 | #
# Tests for reproin.py
#
from __future__ import annotations
import re
from typing import NamedTuple
from unittest.mock import patch
import pytest
from . import reproin
from .reproin import (
filter_files,
fix_canceled_runs,
fix_dbic_protocol,
fixup_subjectid,
get_dups_marked,
get_unique,
... |
c5423399e647e0e3b3a9b8b6ab6258093e17e42de7a3d46070db0eed0228c164 | Python | 13,405 | 369 | """Utility functions for model"""
import torch
import numpy as np
from torch import Tensor
from torch_scatter import scatter, segment_coo, segment_csr
def move_by_com(pos):
return pos - torch.mean(pos, dim=0)
def coord2cross(x, edge_index, norm_constant=1):
row, col = edge_index
cross = torch.cross(x[ro... |
6d9e8378b5819f44c2b7d53a59ecf80361430740d30b67d6baae163ac2f3888e | Python | 13,407 | 412 | from rest_framework import status
from medperf.tests import MedPerfTest
from parameterized import parameterized, parameterized_class
class BenchmarkTest(MedPerfTest):
def generic_setup(self):
# setup users
bmk_owner = "bmk_owner"
prep_mlcube_owner = "prep_mlcube_owner"
ref_model_... |
7b810ab3191459c25df89c3b7f60dbdaef62c302ec948b95bcff929489bdb893 | Python | 13,408 | 308 | import numpy as np
import pandas as pd
import sys
sys.path.insert(0, ".")
from .backend import DataInstance
from .advanced_summary import advanced
from .traditional_summary import calculations
import random
DNA_PREBINNUM_SIZE = 4
DNA_POSTBINNUM_SIZE = 4
DNA_BINSIZE_SIZE = 5
DNA_PREBINNUM_BOUND = [0,9]
DNA_POSTBINNUM... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.