sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
3b624e471b833d75d11ea57948f9f8a7f8cc21d49edb5881f17b01d6aef83d05 | Python | 7,570 | 253 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# MagellanMapper documentation build configuration file, created by
# sphinx-quickstart on Tue Oct 3 13:11:48 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in th... |
a682912b08b24bc2445a8763e8c4e3ccdd44e8716de764d521abb768df8b66f6 | Python | 7,575 | 167 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import Tensor
from mmengine import Config
from mmseg.apis import init_model
from mmseg.models.utils import resize
from typing import Tuple
class Mask2Former(nn.Module):
def __init__(self, cfg):
super(Mask2Former, self).__init__(... |
2921b3062efd36c76471ad615877fffea216ae46c74a804cc8cf524bad87e696 | Python | 7,576 | 181 | import tensorflow as tf
import numpy as np
from grid_cell.manifold_fitter import GP_Fitter
from sklearn.model_selection import train_test_split
from sklearn.covariance import GraphicalLasso
from global_setting import *
def create_train_test_split_indices(num_samples, test_size=0.33):
indices = np.arange(num_sample... |
5730dcdf897a3b5022a5f6f6a53d301c0661659ccab3f46d930d77ef397bb105 | Python | 7,579 | 208 | # -*- coding: utf-8 -*-
import compileall
import gc
import subprocess
import sys
from typing import List
import timeit
from django.conf import settings
class PerformanceTest(object):
"""
Test query performance for a set of views. It will create a new database
that has the some content as a template data... |
e14203cb58c8ad1f6353af41eb6b68043352d689176ba2aa7263efb12e13e4e9 | Python | 7,579 | 180 | from __future__ import print_function
import numpy as np
import pytest
import string
from keras.utils.test_utils import get_test_data
from keras.utils.np_utils import to_categorical
from keras.models import Sequential
from keras import layers, optimizers
import keras.backend as K
import keras
def test_temporal_class... |
d695767b027b04cc18cb997f715d0bf33bd8b7761d87be7f29c87d4d965f9902 | Python | 7,582 | 185 | import argparse
import dataclasses
import logging
import os
import urllib.request
from typing import Any, Dict, List, Optional, Union
import torch
from mace.cli.fine_tuning_select import select_samples
from mace.tools.scripts_utils import (
SubsetCollection,
dict_to_namespace,
get_dataset_from_xyz,
)
@d... |
cee3ba3c20f4c0ee6a8a1e1c5ec3dfd0dca0ef9a0c87c03f7f19db9f8975a4a0 | Python | 7,583 | 217 | import os
import numpy as np
class LinearTransform:
'''Linear transformer that wraps an affine matrix.'''
class Type:
vox = 0
ras = 1
physvox = 2
def __init__(self, matrix=None, source=None, target=None, type=None):
'''
Constructs a linear transform from a 4x4 aff... |
c887f119910022e2badbe19d8f90f78e5af97f9ec95dc611d69f404ae00d7865 | Python | 7,586 | 229 | import numpy as np
import math
import os
import sys
import gmsh
# gmsh.model.occ.addBox(x, y, z, dx, dy, dz, tag = -1)
# gmsh.model.occ.addBox(x, y, z, dx, dy, dz, tag = -1)
# gmsh.model.occ.addCone(x, y, z, dx, dy, dz, r1, r2, tag = -1, angle = 2*pi)
# gmsh.model.occ.addCylinder(x, y, z, dx, dy, dz, r, tag =... |
f8444df7974b0ceb767c9933b65c86edeaea22876495b3b3eb985e73b4789524 | Python | 7,586 | 166 | from textwrap import dedent
import pytest
import numpy as np
import pandas as pd
from neuprint import Client, default_client, set_default_client, NeuronCriteria as NC, NotNull, IsNull
from neuprint.queries.neuroncriteria import where_expr
from neuprint.tests import NEUPRINT_SERVER, DATASET
@pytest.fixture(scope='mo... |
c0e6c1730ecad61f5fbc3c8986289a07909c7a18f6865b3212a1d370eb87d7ff | Python | 7,591 | 231 | # -*- coding: utf-8 -*-
#
# CATMAID documentation build configuration file, created by
# sphinx-quickstart on Sat Dec 10 20:48:29 2011.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All... |
8d18a4a5a7aedb6e94926e56826d58a5304af04d3a8011745d0a7d6560c8de84 | Python | 7,597 | 213 | from docker.errors import APIError
import pandas as pd
import requests
import yaml
from migration_cube import MigrationCube
import hashlib
import docker
import os
import synapseclient
from synapseclient.core.exceptions import SynapseNoCredentialsError
import json
UID_KEY = "UID"
SYNAPSE_PREFIX = "synapse:"
def get_... |
ed99feb2bc3a9fc867f130a95cc0b719f9c3b0362521a0dd1a644bf4c5d46975 | Python | 7,604 | 184 | """Unit tests for tax scope filtering via the new LineageFilter delegate API.
The refactored ``LineageFilter`` is a thin facade over
``TaxScopeCeilingResolver``. Tests here validate that delegation works
correctly and that the biological invariants still hold:
- Metazoa ceiling includes humans but excludes bacteria ... |
0c24ab3693e78226a5216e9c23bcf8ff3908cad3c8a14f45a0e1879b3ae6387c | Python | 7,605 | 197 | # import the necessary packages
from torch.utils.data import Dataset
import torch
from caltrig.core.backend import open_minian
import numpy as np
from ml_training import config
from torch.nn import ConstantPad2d
class CustomDataset(Dataset):
def __init__(self, paths_to_unit_ids, section_len=200, rolling=50, slack=... |
dd312103f956c6a29047b32ae569d14e056aa14cfbf48bbd33a2b931d1133c3d | Python | 7,608 | 229 | # -*- coding: utf-8 -*-
import logging
from typing import Any, Dict, List
from django.db import connection
from django.http import HttpRequest, JsonResponse
from django.utils.decorators import method_decorator
from rest_framework.views import APIView
from rest_framework.decorators import api_view
from catmaid.contr... |
fb8f071aaa3f7121d00b43517c157e022020ea16c8c1cebc0dfb15c26ded50f9 | Python | 7,608 | 197 | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
import torch.nn as nn
from mmcv.cnn import ConvModule
from mmengine.model import BaseModule
from torch.nn.modules.batchnorm import _BatchNorm
from mmseg.registry import MODELS
from ..utils import InvertedResidual, make_divisible
@MODELS.register_module... |
84153940d8156ae254b701905734ad8ffa83e0216e4f1c8398b0f29d4104cbb0 | Python | 7,610 | 175 | #!/usr/bin/env python3
import os, sys, time, traceback
import argparse, multiprocessing
# get the path of this script and add it to the "pythonpath"
SCRIPT_PATH = os.path.split(os.path.realpath(os.path.abspath(__file__)))[0]
sys.path.insert(0, SCRIPT_PATH)
from eggnogmapper.emapperException import EmapperException
f... |
ede1e3c73a1a242477d3f594a49d575e9ed41515c01bd00db036dc4945d4bf50 | Python | 7,610 | 274 | import os
import yaml
import string
import pickle
import pathlib as pl
from myphdlib.general.ephys import SpikeSortingResults
class SessionBase():
"""
"""
def __init__(self, sessionFolder, resolve=False):
"""
"""
# Public attributes
self.sessionFolderPath = pl.Path(session... |
fd86716cf9d08b38751f619e928c9e01e5e18ca26710411178aaabe94d6a8c18 | Python | 7,610 | 274 | #!/usr/bin/env python3
import argparse
import faiss
import pickle
import sys
import numpy as np
import process_hits
from Bio import SeqIO
from typing import NamedTuple, Optional, TextIO
import time
class Args(NamedTuple):
"""Command-line arguments"""
query_embeddings_path: str
target_embeddings_path: str... |
ab7e9ba095e92d33f74649d691352a22c6dec35c24f3a4963d0183facd3a1223 | Python | 7,611 | 183 | from django.db import migrations
forward = """
-- Remove all deleted nodes and their contributed cable length from
-- skeleton summary and delete the edge reference.
CREATE OR REPLACE FUNCTION on_delete_treenode_update_summary_and_edges()
RETURNS trigger
LANGUAGE plpgsql AS
$$
BEGI... |
f7501cb98920d2dd708fc91e817fd08e835084106d8fe442d77d69e58c4bf57c | Python | 7,613 | 149 | from catmaid.control.exporter import FileExporter, ConnectorMode
from catmaid.control.tracing import known_tags
from catmaid.models import Project
from catmaid.util import str2bool, str2list
from django.core.management.base import BaseCommand, CommandError
from .common import set_log_level
import logging
logger = log... |
4f617f83de8551803e11b971294782fac94fe13ee463544fbbe41517696d5541 | Python | 7,614 | 215 | import argparse
import os
import shutil
import sys
sys.path.append(".")
import torch
from tqdm import tqdm
torch.multiprocessing.set_sharing_strategy("file_system")
import torch.utils.tensorboard
from torch.nn.utils import clip_grad_norm_
from torch_geometric.loader import DataLoader
from models.bond_predictor impo... |
c6effb9cd3e746bce096db9cc976960d42705b816b0f41abb11fbe56cb69d1bc | Python | 7,618 | 246 | import numpy as np
import torch
import matplotlib.pyplot as plt
from rde.utils.protein.constants import chi_pi_periodic, AA
from rde.utils.misc import BlackHole
def get_optimizer(cfg, model):
if cfg.type == 'adam':
return torch.optim.Adam(
model.parameters(),
lr=cfg.lr,
... |
6ca6a81d9b0fb5bca27d6facba286d33f0a6a62f7e9faeede723325d6746527e | Python | 7,621 | 193 | # -*- coding: utf-8 -*-
from collections import namedtuple
import logging
import networkx as nx
import numpy as np
from numpy import array, float32
from numpy.linalg import norm
from typing import Any, DefaultDict, Dict, List, NamedTuple, Tuple
logger = logging.getLogger(__name__)
try:
from scipy.sparse.csgraph ... |
8a785e16b6dbf53e317ff04611954e47f56b73b7392b0a0d5850abe340df6363 | Python | 7,622 | 224 | """Tests for ephys.efeatures"""
import os
import pytest
import numpy
import bluepyopt.ephys as ephys
@pytest.mark.unit
def test_EFeatureObjective():
"""ephys.objectives: Testing EFeatureObjective"""
recording_names = {'': 'square_pulse_step1.soma.v'}
mean = 1
efeature = ephys.efeatures.eFELFeat... |
a3d13c5cb775fe9d5976ab5ae543bea33b72aaeaa1d92b51debc18b64f55491f | Python | 7,625 | 219 | import functools
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from rde.modules.encoders.single import PerResidueEncoder
from rde.modules.encoders.pair import ResiduePairEncoder
from rde.modules.encoders.attn import GAEncoder
from rde.modules.flows.spline import ContextualCircul... |
d24a2bea84fb98f1a14c7738539f7b2c694bc691a0e610abae68b4d7e13a3303 | Python | 7,627 | 206 | """Integration tests for parameterized output directories (issue #323).
Verifies that step 1 honours an explicit ``run_name`` and that downstream
steps respect ``selected_runs`` so multiple parameter sets can coexist for the
same session without overwriting each other.
"""
import shutil
from pathlib import Path
impo... |
173939bfad1d093eef4f70ebb7dcb6c4124ac4059d5e62089da0f0ff3e3e7cdc | Python | 7,628 | 234 | 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
cp = pytest.importorskip("cupy")
def test_array_interface() -> None:
arr = cp.array([[1, 2, 3, 4], [1, 2, 3, 4]])
i_arr = arr.__cuda_array_interface__
... |
da61e77a571c7ab9dce9ef6b510e9e33f228cb8ae1f97726543fada9a458d6d3 | Python | 7,630 | 268 | # A module for statistical analysis
# imports
import numpy as np
import os
from scipy.stats import ttest_ind, f_oneway
from sklearn.decomposition import PCA
from umap import UMAP
from sklearn.preprocessing import StandardScaler
import matplotlib.pyplot as plt
import random
from .visualization import plot_pca
def f... |
a4b8570a6eb97acf39711340e312183387de6843bc609e2be61a644abf92bf79 | Python | 7,632 | 180 | import json
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import scienceplots
import matplotlib.gridspec as gridspec
import seaborn as sns
from matplotlib.lines import Line2D
from scipy import stats
gs = gridspec.GridSpec(2, 2, width_ratios=[0.5, 0.5])
def get_performance(file_name):
with... |
388ccbfc69f8778d547126f073221ae83ff06b2ea5584ab61e1340edec9760c1 | Python | 7,640 | 212 | import logging
import googleapiclient.discovery
# ---------------------------------------------------------------------------
# Helper functions
# ---------------------------------------------------------------------------
def get_testable_permissions(resource):
if resource.startswith("//cloudresourcemanager"):... |
28c74907a963dba3bd6063a86d8706a535c356129757054407065275409cefea | Python | 7,641 | 226 |
'''
Script for training the neural code converters using brain loss.
'''
import os
import warnings
import itertools
from time import time
import numpy as np
import scipy.io as sio
import pandas as pd
import bdpy
from bdpy.distcomp import DistComp
from bdpy.util import makedir_ifnot
from bdpy.dataform import save_ar... |
5a4fb5617098bad737110c219a8685979142213498b6d8af4dc598a618ad3527 | Python | 7,641 | 332 | import docker
import pytest
from neo4j import GraphDatabase
from kgx.graph.nx_graph import NxGraph
NEO4J_CONTAINER_NAME = "kgx-neo4j-integration-test"
DEFAULT_NEO4J_URL = "neo4j://localhost:7687"
DEFAULT_NEO4J_USERNAME = "neo4j"
DEFAULT_NEO4J_PASSWORD = "test"
def check_neo4j_container():
try:
client = ... |
9e6bf48e1ba0d3241798841954c01bd1dd119f4e7a7f221c6fde146d47d061b2 | Python | 7,641 | 239 | # coding=utf-8
# Copyleft 2019 project LXRT.
import json
import os
import pickle
from tqdm import tqdm
import numpy as np
import torch
from torch.utils.data import Dataset
import os.path as osp
from .utils import load_obj_tsv
import numpy as np
import pdb
import random
from itertools import groupby
from transformers i... |
5fe2dc8c61af419e92031d26e3bce34cddd3ba3fe818eabb222e43403602d1b1 | Python | 7,642 | 224 | """Functions for loading and writing mesh files."""
import os
import h5py as h5
import nibabel as nb
import numpy as np
import pandas as pd
global freesurfer_ext
freesurfer_ext = [
".orig",
".pial",
".white",
".sphere",
".inflated",
".curv",
".sulc",
".thickness",
".annot",
".l... |
f1d2261d9ccf2f3f009bcb72b23ce36add69c95e0b5faafb3a6987f4f3276975 | Python | 7,643 | 184 | import numpy as np
import pytest
from guppy.analysis.transients import (
analyze_transients,
calculate_freq_amp,
createChunks,
processChunks,
)
def test_create_chunks_raises_when_padded_length_not_multiple_of_window(monkeypatch):
"""The padding logic normally guarantees padded length divides even... |
e4f4ce5876ac9a8845c9ea27312a5921a5d40c1f88e70eb819608d551b8b5fa6 | Python | 7,649 | 145 | #!/usr/bin/env python
"""Replay create_typed_sets() over a completed build's Food.txt to check the #935 type vote.
Issue #918 typed a chemical clique as ``biolink:Food`` whenever *any* member carried DrugBank
food evidence, overriding the per-identifier type vote entirely. That was asserted to be safe
because "every c... |
6a23605f29ac1e18446eb8523477e809fca4a9c2f8b7d8c7ceead18e6122ce4e | Python | 7,653 | 237 | from medperf.exceptions import InvalidArgumentError, CleanExit
import pytest
from medperf.tests.mocks import TestCube
from medperf.tests.mocks.benchmark import TestBenchmark
from medperf.tests.mocks.dataset import TestDataset
from medperf.commands.dataset.submit import DataCreation
from medperf.entities.dataset import ... |
0dde199c7e7222a9d8327c3915a49e389d44dcbc8caae0365a99e6fb18bf8131 | Python | 7,657 | 248 | """
Miscellaneous plotting functions.
Note:
These functions require additional dependencies,
which aren't listed by default dependencies of neuprint-python.
(See docs for each function.)
"""
import numpy as np
import pandas as pd
from .client import inject_client
from .skeleton import skeleton_df_to_nx
... |
2f57a595dac86387c5e2c8ed3d6c27d53ad3a3f07972334a912d16a473e3c735 | Python | 7,662 | 245 | """
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 math
from typing import Dict, Union
import numpy as np
import torch
from scipy.special import binom
from ocpmodels.common.typing impo... |
17f0dd9757c4334ff74f97e8a3a377599e5be6359c5edb5dd74d7b742d976d95 | Python | 7,663 | 232 | import argparse
import json
import os
from collections import OrderedDict
import nearl.data
import numpy as np
import nearl
from nearl.io import Trajectory
def parser():
parser = argparse.ArgumentParser(description="Featurize the trajectories")
parser.add_argument(
"-f",
"--trajfiles",
... |
4a1ee378e9bd608718d20cfd01bd9c3826b849d8b8ccddb3b25463e11a795451 | Python | 7,667 | 185 | from grid_cell.manifold_fitter import GP_Fitter
import numpy as np
from sklearn.covariance import graphical_lasso, GraphicalLasso
from grid_cell.higham import nearestPD, isPD
from global_setting import *
class GGPR_Fitter():
'''
Double Gaussian Process Regression Fitter. One is for fitting the mean (manifold),... |
30d6426f0b336ef9424fb1c6978af7b37d427353d9d5efe5ae04f9da95da9d88 | Python | 7,668 | 251 | import os
import subprocess
import sys
import tempfile
import pytest
import xgboost
from xgboost import testing as tm
pytestmark = tm.timeout(30)
DEMO_DIR = tm.demo_dir(__file__)
PYTHON_DEMO_DIR = os.path.join(DEMO_DIR, "guide-python")
CLI_DEMO_DIR = os.path.join(DEMO_DIR, "CLI")
def test_basic_walkthrough() -> N... |
6ce9f503d0ec557e93a0048deb3d5075ee2e83708d2193c820c382b65f42c7b9 | Python | 7,668 | 279 | import torch
from torch.nn import Module
import torch.nn as nn
from torch.autograd.function import Function
from torch.utils.checkpoint import get_device_states, set_device_states
from beartype import beartype
from beartype.typing import List, Tuple
from einops import rearrange, reduce
from equiformer_pytorch.utils ... |
e89eacc277ba842b3b4d8de20dfb285ff0dd5d91411f644acddc5a2283e7b2a6 | Python | 7,674 | 152 | # -*- coding: utf-8 -*-
import json
import logging
from typing import List
from argparse import FileType
from sys import stdin
from django.core.management.base import BaseCommand, CommandError
from catmaid.apps import get_system_user
from catmaid.models import Project, Stack, User, Group
from catmaid.control.importer... |
feadcfa1932eaf64143e21dbf7e95516cf20826e1b6e353d2ddcc44d2ba20686 | Python | 7,683 | 164 | import os
import tqdm
import torch
import torch.nn as nn
import numpy as np
import argparse
import json
import cv2
import scipy.io as sio
import pandas as pd
import time
from scipy.interpolate import interp1d
from skimage import io
from nns.model import ISOSNet
from utils import fix_random_seeds
from data.datasets impo... |
4c723267cfbdf7dbf95a2bb4ef1e0e9483ed90e1c4a9efb2a8ac7768766e6aea | Python | 7,688 | 180 | import math, os
from time import time
import numpy as np
import pandas as pd
import collections
import joblib
import h5py
import scanpy as sc
import scanpy.external as sce
import scipy.sparse as sp
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch.nn import Parameter
import torch.nn.fun... |
818cb94d50185161ca8ca574872f6adb4eb0a53e8b70aa533c0aa010926086dc | Python | 7,688 | 259 | """
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 os
import pytest
import torch
from ase.build import molecule
from ase.io import read
from ase.lattice.cubic import FaceCenteredCubic
... |
8f58a545248df246953c9c701437ad8d37283ab601fd6434c3d88f0bd58dd2a2 | Python | 7,689 | 172 | import SimpleITK as sitk
from natsort import natsorted
import numpy as np
from pathlib import Path
import pandas as pd
from collections import defaultdict
from shutil import copyfile
import os
from os.path import join
from tqdm import tqdm
import gc
import multiprocessing as mp
from nnunet_mednext.dataset_conversion.ut... |
7e7a82ff00723de71157f53299f7ae7bd29bac88c4fbb528bc7597b37fbc2c04 | Python | 7,690 | 193 | #!/home/preclineu/hansav/.conda/envs/py38/bin/python
"""
Created on Thu Aug 29 11:16:53 2024
@author: hansav
"""
"""
####################
#Elastic Net Regression classification STAI score --> PERMUTATION
####################
"""
import pandas as pd
import numpy as np
import os
import sys
from pcntoolkit.dataio.fil... |
6edcff4e34d68a0ace3b10a5ec6a419eaf63f17c04625c936411a147730c6ac0 | Python | 7,691 | 222 | # #############################
#
# Copyright (C) 2018
# Jennifer Dreiling (dreiling@gfz-potsdam.de)
#
#
# #############################
import numpy as np
import logging
from BayHunter import Targets
logger = logging.getLogger()
rstate = np.random.RandomState(333)
class SynthObs():
"""SynthObs is a class fo... |
f9a6baddd1e3120d3c222ceadeacb0f6ab2c134a740f74d3c949847a7b231da4 | Python | 7,695 | 215 | from ReactBench.utils.find_lewis import return_formals
from ReactBench.utils.taffi_functions import bondmat_to_adjmat
import numpy as np
def to_xyz_string(elements,geo,comment=''):
'''
Simple wrapper function for creating xyz string
Inputs elements: list of element types (list of strings)
... |
4987c4a473581e60b8ec2f37707edf50e97dd965a276b6a3de6ddad718987cd4 | Python | 7,696 | 224 | """bluepyopt.ephys.simulators tests"""
"""
Copyright (c) 2016-2020, EPFL/Blue Brain Project
This file is part of BluePyOpt <https://github.com/BlueBrain/BluePyOpt>
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License version 3.0 as publis... |
9532974f704cccb38aede0733b6b768660398c95171284992e82fe3a5ee9e4b1 | Python | 7,701 | 159 | from pathlib import Path
import numpy as np
import pandas as pd
import pytest
from guppy.analysis.io_utils import read_hdf5
from guppy.analysis.standard_io import (
read_binned_covariates_from_hdf5,
read_binned_metrics_from_hdf5,
read_covariate_correlations_from_hdf5,
)
from guppy.testing.covariate_sessio... |
556fbb209755494a7d50be2256de80a3d865db0145945e9c022f2d8d801b44b9 | Python | 7,705 | 168 | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import os
CSV_READ_PATH = '8.csv' # Please ensure this path is right
CSV_WRITE_PATH = 'detect_spikes_8.csv'
UPPER_THRESHOLD = 0.404
LOWER_THRESHOLD = 0.29
MIDDLE_THRESHOLD = 0.30
def detect_spikes(signal, lower_threshold, middle_thresho... |
53f1bfd631fc85d48327a6de876c8e981009b0cbb14cfdbded805c429722e563 | Python | 7,707 | 217 | # This file to simulate single cell RNA-seq reads based on real bulk RNA-seq
# expression profile and input dropout rate and number of reads.
import os
import sys
import time
import subprocess
import numpy as np
from optparse import OptionParser, OptionGroup
# import pyximport; pyximport.install()
from utils import ... |
c0d0458596b1a7117d4337600823a232b35a51502cb57bfb4ec314cd887aa2c8 | Python | 7,713 | 188 | # 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.
# Borrowed from https://github.com/facebookresearch/segment-anything
from typing import Any, Dict, List, Tuple
import to... |
23c7544de0bd4a1764b1b1d7c42a087a40e3f1e90f1bbb969804d4b16f270b67 | Python | 7,714 | 264 | from functools import partial
import torch
import torch.nn.functional as F
from torch import nn
def get_inplanes():
return [64, 128, 256, 512]
def conv3x3x3(in_planes, out_planes, stride=1):
return nn.Conv3d(
in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False
)
def con... |
f9e022564414e3c3af29171c029adcc382e3ade5d4e31448b86dc1492d4f58c9 | Python | 7,717 | 216 | import logging
from copy import deepcopy
from pathlib import Path
from typing import Literal, Union
import numpy as np
import torch
from torch.utils.data import DataLoader, TensorDataset, WeightedRandomSampler
from torch.utils.tensorboard.writer import SummaryWriter
from DiastereomericResolutions.Helper_funs import t... |
14164c47978fe1f692e0bb1b097f5fa8861e70f3d43a48bd13adeec23ed6442a | Python | 7,719 | 170 | ## Restormer: Efficient Transformer for High-Resolution Image Restoration
## Syed Waqas Zamir, Aditya Arora, Salman Khan, Munawar Hayat, Fahad Shahbaz Khan, and Ming-Hsuan Yang
## https://arxiv.org/abs/2111.09881
##--------------------------------------------------------------
##------- Demo file to test Restormer on ... |
ba407d6908df2bdc5d43c8f6a11de092d6566079320dc5b6300ab79270c5e55d | Python | 7,723 | 153 | # pytest unit tests for sct_label_vertebrae
import os
import logging
import pytest
from spinalcordtoolbox.image import Image, compute_dice
from spinalcordtoolbox.labels import check_missing_label
from spinalcordtoolbox.utils.sys import sct_test_path
import spinalcordtoolbox.scripts.sct_label_vertebrae as sct_label_v... |
a685f1c63307cd7c6be755eaede5cb7b5f1d999f71c18ebc73eff6a851bd6204 | Python | 7,729 | 139 | # 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... |
2e65250f83de90e266d13071c92ad2487741040d58ca06fac040f707fd4127c2 | Python | 7,730 | 264 | def get_image_size_for_backbone(backbone: str):
"""
Get the expected image size for different topologies.
The images are expected to be squares, so this will return only
a single number, indicating both height and width.
"""
img_size = 224
if backbone in ['eff4']:
img_size = 380
... |
f1ba80f953a9498f04d15850243fd6eff347b93e23e0c2afc3937f0bb7175d15 | Python | 7,733 | 132 | """
Functions to interpolate metrics (from sct_process_segmentation) into the PAM50 anatomical dimensions
Copyright (c) 2023 Polytechnique Montreal <www.neuro.polymtl.ca>
License: see the file LICENSE
"""
import numpy as np
from spinalcordtoolbox.image import Image
from spinalcordtoolbox.aggregate_slicewise import Me... |
44211d905cce7a7bb68ed5aa40ea04e7bc5d79aec5e3f29053c13dbe122f604e | Python | 7,735 | 242 | # Copyright (c) 2017 Kensho Hara
#
# 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, publish, distrib... |
f33dc64bce31ff51dca9bdfc077c6cd4a938751bf6e071c96e8731d5cb1713b9 | Python | 7,737 | 243 | from rest_framework import status
from medperf.tests import MedPerfTest
from parameterized import parameterized, parameterized_class
class CertificateTest(MedPerfTest):
def generic_setup(self):
# setup users
cert_owner = "cert_owner"
ca_owner = "ca_owner"
other_user = "other_user... |
bb58b75a1a27a257bbf126813f59e3f3b1bd224cac762454373ddebaafdb3eda | Python | 7,744 | 275 | import h5py
import numpy as np
from matplotlib import pyplot as plt
from myphdlib.figures.analysis import AnalysisBase
class UnitFilteringAnalysis(AnalysisBase):
"""
"""
def __init__(self, **kwargs):
"""
"""
super().__init__(**kwargs)
self.y = None
self.peths = {
... |
bbef96c3c587a721a95d5974c66f40eb2b6c425602e78b6c46babc8d1759f0ad | Python | 7,746 | 177 | import zntrack
from mace_models import LoadModel, XYZReader
project = zntrack.Project()
with project:
LoadModel(
model_path="data/ani500k_small_DFT.model",
name="ani500k_small",
info="""
You're using the ani500k_small MACE model. The model is released under the MIT license.
... |
f0009d000f210b1186d260e5f4d6a167a15f85f302229334984dbcf3d17d390b | Python | 7,749 | 252 | #!/usr/bin/env python
"""
MetaWIBELE: abundance_smoothing module
Zero values were additively smoothed by half the smallest non-zero measurement on a per-sample basis and log transform
Copyright (c) 2019 Harvard School of Public Health
Permission is hereby granted, free of charge, to any person obtaining a copy
of th... |
ed6771ec59d241528c602b194deee416c878a25283c1afc65c26d871948ce535 | Python | 7,755 | 232 | from builtins import range
import neurom as nm
from neurom.core.dataformat import COLS
from neurom.morphmath import point_dist2
from neurom.viewer import draw
from neuron import h
import neuron
import numpy
import matplotlib.pyplot as plt
""" Authors: Michael Gevaert, Armando Romani, Christian Rossert, Sara Saray"""
... |
dc0c6cba1d2c9e89b028e27ae5b14a186cbf92b07203cec9d35e91f125fee502 | Python | 7,760 | 197 | """Unit tests for pull_via_wget()'s recursive, timestamping download.
This is the mechanism that makes preloading PubMed downloads from a previous run work (see
docs/RunningBabel.md, "Preloading PubMed downloads"): a recursive `wget --timestamping` fetch
must leave already-present files alone and download only the one... |
55dfe3226e7e66ce12a6b59ae6bc4c10ebea5bbfcb1358110fe0c115dd3ef087 | Python | 7,761 | 255 | #!/usr/bin/env python3
"""
Create a PRIVATE, BLINDED visual-review packet for final-label IC flips from
the locked held-out CICADA smoothing validation.
Input:
heldout_11mm_ic_level_PRIVATE.csv
The blinded folder contains neutral IDs only:
Review_001_ICmap.nii.gz
Review_001_timeseries.txt
...
BLINDED_SCORIN... |
ef7d264bc1d069644b4c6cab9e04284a355af8b98d08bdf252810ecb3885990f | Python | 7,771 | 212 | """Run simple cell optimisation"""
"""
Copyright (c) 2016-2020, EPFL/Blue Brain Project
This file is part of BluePyOpt <https://github.com/BlueBrain/BluePyOpt>
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License version 3.0 as published
... |
03df6d17a4b689d69b251e7d61829efd6743d884745b8038b07e1ec8f5126b23 | Python | 7,773 | 210 | """Visualize a CWL workflow."""
from collections.abc import Iterator
from importlib.resources import files
from typing import cast
from urllib.parse import urlparse
import pydot
import rdflib
from packaging.version import Version
if Version(pydot.__version__) > Version("3.0"):
quote_id_if_necessary = pydot.quote... |
8be0857a38c12fc03e9156ab41bbe3cc644d0b00963803f61138e199dfa1c9e1 | Python | 7,774 | 202 | """
Copied (and improved) from:
https://github.com/fadel/pytorch_ema/blob/master/torch_ema/ema.py (MIT license)
"""
from __future__ import division, unicode_literals
import copy
import weakref
from typing import Iterable, List, Optional
import torch
from ocpmodels.common.typing import none_throws
# Partially base... |
fdd3655c5318ab19ecbb12ab43892148022ab692b2fefa65595ed92252ee294c | Python | 7,774 | 203 | import pytest
import librosa
import numpy as np
import torch
from torchaudio_contrib.functional import (stft, phase_vocoder, magphase, amplitude_to_db, db_to_amplitude,
complex_norm, mu_law_encoding, mu_law_decoding, apply_filterbank
... |
18607a2c9cfe415573c75fa44b7b561ef9b130fbd5f0f3b63e993d4bab74bd49 | Python | 7,775 | 139 | # 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... |
293734b66cfcb311228d5b9f17f5e3aab69744dcdc8e63e424f2158d68546bcc | Python | 7,777 | 160 | """
Labeling functions used during registration
Copyright (c) 2022 Polytechnique Montreal <www.neuro.polymtl.ca>
License: see the file LICENSE
"""
import numpy as np
from spinalcordtoolbox.image import Image, add_suffix
from spinalcordtoolbox.centerline.core import get_centerline
from spinalcordtoolbox.types import ... |
885487b7111c8b87b0261185fc7a88e1e6c3c1faf50d3623a678db7d3bed2704 | Python | 7,780 | 236 | """bluepyopt.ephys.simulators tests"""
"""
Copyright (c) 2016-2020, EPFL/Blue Brain Project
This file is part of BluePyOpt <https://github.com/BlueBrain/BluePyOpt>
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License version 3.0 as publis... |
1b4594cab0e288725f755bab3864648c48ddd7bf2d540fb13a8ee97b436f0ac3 | Python | 7,781 | 220 | from typing import Union
import torch
from .constants import RegularizationMode
from ..utils.utils_new import scatter
class GeometricLoss:
def __init__(
self,
mode: RegularizationMode,
neighbour_loss_weight: float = 0.0,
repulsion_weight: float = 0.01,
outlier_weight: flo... |
509d0762cb756dc78bd747ab66423628e80493f2fb64d3e4d79b26e6353e3e6c | Python | 7,784 | 216 | #!/usr/bin/env python3
"""Setup for the reference implementation of the CWL standards."""
import glob
import os
import sys
import warnings
from typing import TYPE_CHECKING, Any
from setuptools import Extension, setup
if TYPE_CHECKING:
from typing import TypeGuard
if os.name == "nt":
warnings.warn(
"... |
1ae3cc8cc24459823f779678a7d5c61b5cae6e134b20bdf0d8e3f406adb30b85 | Python | 7,788 | 255 | #!/usr/bin/env python
"""
MetaWIBELE: psortb_protein module
Extract predicted peptides based on PSORTb results
Copyright (c) 2019 Harvard School of Public Health
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
... |
a2b03ccf10ea744f1799b4a7e53642960f0c214f04a0dd8e0b9cc44d7cdb2344 | Python | 7,790 | 210 | """Generate the figures for the "Custom plots from GuPPy outputs" tutorial.
Unlike the ``*_explainer.py`` scripts in this directory, which draw synthetic data, this one runs
against real GuPPy output: it copies the sample CSV session, runs Steps 1-4 headlessly, and then
loads the resulting run folder with the same cal... |
29aea8d7e46ecbf11cef405148823802b8ad7961897c229b55821e66d9df5985 | Python | 7,791 | 164 | import holoviews as hv
import numpy as np
import pytest
from guppy.extractors.npm_recording_extractor import DEFAULT_NUM_CHANNELS
from guppy.frontend.store_labeling_instructions import (
StoreLabelingInstructions,
StoreLabelingInstructionsNPM,
)
class TestStoreLabelingInstructions:
def test_widget_first_... |
f7a78840f02355645247ec6c3222869711b1a92738b075904ce483d514115ad2 | Python | 7,793 | 227 | import os
import time
import cPickle
import datetime
import logging
import flask
import werkzeug
import optparse
import tornado.wsgi
import tornado.httpserver
import numpy as np
import pandas as pd
from PIL import Image
import cStringIO as StringIO
import urllib
import exifutil
import caffe
REPO_DIRNAME = os.path.abs... |
e65171e085a35a7e8114032e9c1ee0040a1d5d20e004fdb64180aff10693f3df | Python | 7,794 | 237 | """
Perform benchmarking on the pre-trained models.
"""
import argparse
import json
import os
import random
import time
import numpy as np
import torch
from scipy.stats import pearsonr, spearmanr
from torch import nn
# Import my models
import nearl
import nearl.io
import nearl.models
import nearl.utils
tensorboard_... |
a97c609cb08b958e4dc54fb57bb9532262c8cc70bd57ba9d3a4208689d846295 | Python | 7,796 | 272 | #!/usr/bin/env python3
import os
import sys
import numpy as np
import matplotlib.pyplot as plt
from multigrid import get_shift_csr
import scipy.sparse as sp
def get_path(ext, suff=''):
return os.path.splitext(os.path.basename(
sys.argv[0]))[0] + suff + '.' + ext
def savefig(fig, suff='', ext='pdf', pat... |
87334ab6e721ddbd20fafaa178ee0462d5ed4742194e19dcd12cc4659f1aebba | Python | 7,799 | 216 | import os, sys, io, datetime
import h5py
import numpy as np
import cProfile, pstats, time
import multiprocessing as mp
def extract(fname, file_path = None, file_path_output = None ,t_intervals = 1, t_chunks = 'matched',
compression = 'lzf', _profile = False, _verbosity = True):
'''
Extracts a BrainWave f... |
e8ac69ceaa7c6bee435ffc513bf35f5e2179815412a18c3f510fb935f78488b3 | Python | 7,805 | 237 | #!/usr/bin/env python3
"""
Summarize CICADA Smoothing_Retention as an isolated feature across smoothing
scales using PRIVATE FIX-training development-set results.
Input:
smoothing_grid_ic_level_PRIVATE.csv
produced by evaluate_smoothing_grid_fixtraining.py
For each dataset/candidate, reports:
- manual signal/nois... |
c431043fe763bc84e430d324dd3ed33c59d9e60e24a6fb215dd22f815275366a | Python | 7,811 | 185 | import h5py
import numpy
import numpy.testing
import pytest
from .common import ut, TestCase, make_name
class TestWriteDirectChunk(TestCase):
def test_write_direct_chunk(self):
filename = self.mktemp().encode()
with h5py.File(filename, "w") as filehandle:
dataset = filehandle.create... |
3011e1cbc5c6b5994ddd04ce4194d2092847e2cd03f8951f7f9acc067fa46166 | Python | 7,813 | 252 | import pandas as pd
import numpy as np
from pathlib import Path
from typing import Dict, Any, List, Optional, Tuple
from ..logger import logger
# Import shared utility functions for general processing
from .postprocessing import (
get_var,
get_bic_gauss,
merge_adjacent_bins
)
# Additional libraries for nu... |
84a77e543ea480c22a6c8abb5d4713a5944f45065b5ff8009dfdabce71c9ec41 | Python | 7,813 | 210 | from types import SimpleNamespace
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy as sp
import seaborn as sns
from sklearn.decomposition import PCA
import sklearn.utils
def get_explained_variance(components, X):
C = np.cov(X.T)
return np.diag(components @ C @ components.T)... |
20be17c89b0e9e48cd7c2a6a5b6153d09561cadf01110a07a61d62a0959dd01e | Python | 7,814 | 234 | """Bootstrap significance testing for PSTH curves.
Computes a bias-corrected and accelerated (BCa) bootstrap confidence interval on the mean
PSTH, or on the difference between two mean PSTHs, at every timepoint, and marks the
timepoints whose interval excludes zero. Isolated significant timepoints are discarded so
tha... |
d6f04a87d0b8ccad6d684d0bdf94387f915b39d698646791d6b1c185ca5bf6b3 | Python | 7,818 | 220 | import warnings
import numpy as np
import torch
from neuralpredictors.measures.np_functions import corr, fev
from neuralpredictors.training import eval_state, device_state
from .submission import get_data_filetree_loader
def split_images(responses, image_ids):
"""
Split the responses (or predictions) array ... |
9739ef8d990c02b07b471e3443d47d63db24167391db8348bf6371a83c3e0bf9 | Python | 7,820 | 176 | import requests
import os
from .ProvenanceObject import ProvenanceObject
from .transformation import Transformation
from .attribute import Attribute
from .attribute_type import AttributeType
from .set import Set
from .set_type import SetType
dfa_url = os.environ.get('DFA_URL', "http://localhost:22000/")
class Dataf... |
bd7c6c023b5c94be49caa4e89714371aa5bfd294465e19e76d19852ed8bfa2c8 | Python | 7,824 | 189 | import dash
from dash import html, dcc
import dash_bootstrap_components as dbc
from dash.dependencies import Input, Output, State
import plotly.graph_objects as go
import pandas as pd
import numpy as np
import plotly.colors as colors
# Brain region name mapping (English to English with abbreviations)
brain_r... |
13038bd81b6efdd6a990263449c303d7403dd225dd62c5b7f2462108c9ec42bc | Python | 7,825 | 240 | """
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
from collections import deque
from pathlib import Path
from typing import Optional
import ase
import torch
from torch_geometr... |
1c63861d5da3f0a5e116bab6ea765b4ad3c837993e8daee9f1e13d1ed817e4b5 | Python | 7,832 | 206 | # coding=utf8
from torch.utils.data import Dataset, DataLoader
from tqdm import tqdm
from transformers import AutoTokenizer
import json
import torch
import pytorch_lightning as pl
import os
class AbstractCollator:
"""
collector for summary task
"""
def __init__(self, tokenizer, max_enc_length, max_de... |
4e5b820ecce111cc99d705f3b8b3a9a39741cd70fddfec805c3e8391aca2bd16 | Python | 7,832 | 184 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoader
from torch_geometric.data import Data
from torch_geometric.nn import GATConv
from torch_geometric.utils import to_undirected
from torch_geometric.loader import NeighborLoader # Added import
from anndata i... |
fbf13f4db94948af18cd1e14f12d2ff06eb34ae92bf843217723bfd3502e31ad | Python | 7,836 | 168 | import numpy as np
import matplotlib.pyplot as plt
import SimpleITK as sitk
import scipy.ndimage
from scipy.ndimage import map_coordinates
def formula(value):
G_read_percentFLASH = 5.563298 / 100
PVM_GradCal = 42797.5
new_value = value / (G_read_percentFLASH * PVM_GradCal)
return new_value
... |
887acbd3e40e4710c31d41d88b8cf31b4a3fa18bc7b183f12f352ec47f26ca45 | Python | 7,837 | 206 | # Authors: Pierre Ablin <pierre.ablin@inria.fr>
#
# License: BSD (3-clause)
import warnings
import numpy as np
from scipy import linalg
from sklearn.decomposition import FastICA
from sklearn.utils import check_random_state, as_float_array
from sklearn.utils.validation import FLOAT_DTYPES
from .solver import picard
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.