sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
721590dafc20df2860065d8a8133a2cefd4c54ca1b6cccf70f63003872ad9402 | Python | 13,435 | 331 | import mne
import math
import pandas as pd
import seaborn as sns
import microstates.micro_constants as cs
import base.base_constants as b_cs
import numpy as np
import matplotlib.pyplot as plt
from pycrostates.io import ChData
from sklearn.preprocessing import normalize
from pycrostates.cluster import ModKMeans
from pyc... |
c1653dedd8678f23cd17d7c57eef7e564f899dc0ccab4470573790fd527e8ad2 | Python | 13,441 | 355 | import json
import logging
from pathlib import Path
import panel as pn
from . import nwb_form_style as style
from .store_labeling_config import StoreLabelingConfig
pn.extension(notifications=True)
logger = logging.getLogger(__name__)
class StoreLabelingSelector:
"""Panel widget for selecting, naming, and savi... |
0b857c9c4fecda14f697b29bc6219dcd54ae2e0dd07457162e7b419adb9d7fe8 | Python | 13,449 | 310 | import numpy as np
import pandas as pd
import pytest
from guppy.analysis.psth_average import (
average_psth_for_group,
psth_shape_check,
read_Df_area_peak,
)
from guppy.analysis.psth_utils import (
create_Df_for_cross_correlation,
create_Df_for_psth,
)
def test_psth_shape_check_all_same_length_re... |
6fa187e1d6e29af7ae31966893dc0daef60604fd95b309377e83f358708eb74d | Python | 13,449 | 379 | ###########################################################################################
# Part 1
# Funpack
# Separately take out ICD 9 and ICD 10 stuff
###########################################################################################
# I may be missing import statements, so add if you find something I ... |
1f698bfb02d44141d6c427ca65739d781a100ace650fbb5b8359e8dd7ceaea28 | Python | 13,450 | 357 | import os
from typing import List, Optional
from medperf.account_management.account_management import get_medperf_user_data
from medperf.commands.execution.execution_flow import ExecutionFlow
from medperf.entities.execution import Execution
from tabulate import tabulate
from medperf.commands.execution.utils import filt... |
b77ed8fd7cd5a7fbc999b26134787927c71a929ed5d10393a974809ea8ba554a | Python | 13,450 | 368 | import numpy as np
import random
import re
import pickle
from rdkit import Chem
import sys
import time
import torch
from torch.utils.data import Dataset
from fragment_utils.mol_utils import split_molecule, join_fragments
from MCMG_utils.utils import Variable
class Vocabulary(object):
"""A class for handling encod... |
740754240d02ca3b482e748ba47a0b62e66e7708ff7767ad274147b4707f10ea | Python | 13,452 | 397 | from .mixin import scviMixin, adjMixin
from .module import GraphVAE, iGraphVAE
from .module_refined import GraphVAE_r
import torch
import torch.nn.functional as F
from torch_geometric.data import Data
import numpy as np
from typing import List, Tuple, Optional
class _BaseTrainer(scviMixin, adjMixin):
"""Ba... |
5aff5523a7db3b9912fbb8b29cf9ed2d2c03255f9dd452d93e1d3caf0558cd20 | Python | 13,455 | 532 | from typing import Dict, Any, Optional, List, Generator
from kgx.graph.base_graph import BaseGraph
from networkx import (
MultiDiGraph,
set_node_attributes,
relabel_nodes,
set_edge_attributes,
get_node_attributes,
get_edge_attributes,
)
from kgx.utils.kgx_utils import prepare_data_dict
class... |
241a75e1f6d7c1b7af36bc70bc762952f253e1bb202d695cb554145d742852cb | Python | 13,481 | 320 | import pylidc
import csv
import functools
import glob
import os
import typing
import pandas as pd
import numpy as np
import SimpleITK as sitk
from luna.paths import get_paths_config
XYZ = typing.NewType('XYZ', typing.Tuple[float, float, float])
class CandidateInfo:
# metadata class for candidate nodule informa... |
b307d78b8b82596f3e7cfe4de49eae242a78be0759b7cd93cfcde07a44a97137 | Python | 13,487 | 339 | from pathlib import Path
import struct
import numpy as np
from scipy.spatial.distance import cdist
import torch as th
from torch.utils.data import Dataset, DataLoader, WeightedRandomSampler
import time
import pandas as pd
import sys
from torch_geometric.utils import remove_self_loops
import torch
from joblib import Par... |
38d9f0c7247924c301c38ef4c0e3377e17d32f81603e95f3ae27b0a5d87be9e4 | Python | 13,498 | 355 | from tqdm import tqdm
import os
import yaml
import argparse
import csv
from utils import get_file_basename, get_file_extention, get_video_fps
from utils import LabelsParser
class DataPreparation:
def __init__(self, data_path, labels_path, params_file, output_path):
"""A class wrapper for preparing the da... |
86964e617ef733cda8a2a48a6969906b286e8f38c97804fa09b036fd08888a68 | Python | 13,499 | 338 | """Fitting the control channel to the signal channel.
The fitted control is the estimated baseline the signal is measured against: dF/F divides by it,
and everything downstream is derived from the result. Two independent choices shape it:
* **Which regressors.** The control alone, or the control plus an exponential d... |
dfd4ff8be5dbd72418f5949b28b07daa799fdfd022c13d27ef6af8aee02f9685 | Python | 13,500 | 319 | # %% -------------------------------------------------------------------
# libraries
# ----------------------------------------------------------------------
import pandas as pd
import matplotlib.pyplot as plt
import os, glob, sys, re
from os.path import join
from nilearn import image
im... |
28a01d96ad11a22c599a027bde845365523efd81a9fa2401b7831ba1afc9ef7c | Python | 13,501 | 374 | import shutil
import numpy as np
import pathlib as pl
from myphdlib.general.labjack import filterPulsesFromPhotologicDevice
from myphdlib.interface.session import SessionBase
from myphdlib.pipeline.stimuli import StimuliProcessingMixin
from myphdlib.pipeline.events import EventsProcessingMixin
from myphdlib.pipeline.sa... |
a56f5a5fa30f6ce9556cae55fafb6743d49f882e4af6ba950c3e58e8b1ced587 | Python | 13,506 | 338 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from pathlib import Path
from typing import Dict, Any
from ..logger import logger
from hmmlearn import hmm
import pickle
import scipy
import os
def get_vaf_by_chrom(chrom, vaf, depth_filter=5, aggregate_every_k_snp=False, k=1)... |
beb87c376cbd6cc1bc8ee4a019564dbd1d2a82e0cff5cda0dff47b61ae60997a | Python | 13,511 | 379 | import gzip
import typing
from itertools import chain
from typing import Optional, Tuple, Dict, Generator, Any
import ijson
import stringcase
import inflection
from bmt import Toolkit
from kgx.error_detection import ErrorType, MessageLevel
from kgx.prefix_manager import PrefixManager
from kgx.config import get_logger
f... |
5ad54d4300e593a251e0b8df748a8a7b75118ec06bf88b985e09e0c2ffa95414 | Python | 13,515 | 433 | import yaml
import numpy as np
import pandas as pd
import pathlib as pl
from myphdlib.interface.session import SessionBase
from myphdlib.pipeline.stimuli import StimuliProcessingMixin
from myphdlib.pipeline.events import EventsProcessingMixin
from myphdlib.pipeline.saccades import SaccadesProcessingMixin
from myphdlib.... |
dc7516e37df7ab0058560eefd1014955851f59cd18772205e19f79f865d5a08c | Python | 13,517 | 376 | import math
import numpy as np
# Color palette generated via main method of ColorScheme.py
DEFAULT_PALETTE = [
[0.7, 0.15, 1.0], # luminosity=0.32830
[0.3, 0.65, 0.0], # luminosity=0.52866
[1.0, 0.725, 0.0], # luminosity=0.73112
[0.7, 0.05, 0.0], # luminosity=0.18458
[0.6, 0.375, 0.5], ... |
40c9397a44119972dd811efacd0d7ac07c12f9286874c2ab8c956423f8f368b0 | Python | 13,520 | 414 | """Create thickened volumes for each acquisition and each chunk."""
import os
import re
from typing import Tuple
import numpy as np
import pandas as pd
from scipy.interpolate import interp1d
from scipy.ndimage import label
import brainbuilder.utils.ants_nibabel as nib
from brainbuilder.utils.utils import (
get_th... |
da42b2bf4efb24e99a5dc8078064671212288d8fd485b32e769f78f0d5ba14fb | Python | 13,521 | 240 | # pytest unit tests for sct_register_to_template
import os
import shutil
import glob
import logging
from contextlib import nullcontext
import numpy as np
import pytest
from spinalcordtoolbox.image import Image, compute_dice
from spinalcordtoolbox.utils.sys import __sct_dir__
from spinalcordtoolbox.utils.sys import s... |
e84178c16a63feb719a7a0b32b6e3ac12409268ef75b8b03964c8558f4763762 | Python | 13,533 | 465 | """Group CRUD and membership endpoints."""
from uuid import UUID
from fastapi import APIRouter, status
from sqlalchemy.exc import IntegrityError
from sqlmodel import select
from zndraw.access import GroupRole
from zndraw.dependencies import (
CurrentUserDep,
SessionDep,
fetch_group_role,
)
from zndraw.ex... |
630f296a3df266e223cbcd027fcc38d40b046a1b4306a063a372f18b4c806739 | Python | 13,550 | 396 | """Parameter classes"""
"""
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
by the Fre... |
818006464ce847cd50c232dcec6d43a1a3111d4c2ec3e3fb16efd138ab797dc3 | Python | 13,560 | 392 | #!/usr/bin/env python
"""
MetaWIBELE: summary_function_annotation module
Summary function annotations
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
in the So... |
43e257134fb8c5290700b804814afa3ed4f945235389e94a29a86dcdad221f44 | Python | 13,565 | 336 | 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.orchestration.psth_significance import (
comparison_name,
compute_comparison,
execute_compute_psth_significance,
execute_one_comparison,
plan_compa... |
ec7778cd17c79128c1ef05986997611d08660cbe521bbf6afc48815b20755eac | Python | 13,566 | 325 | from typing import List, Any
import jax.lax
import jax.numpy as jnp
import diffrax
import pandas as pd
import sympy as sp
from jaxkineticmodel.kinetic_mechanisms.JaxKineticMechanisms import Mechanism
from jaxkineticmodel.utils import get_logger
logger = get_logger(__name__)
class BoundaryCondition:
"""Class to... |
5ac14d6d0a1f4d5f3eae36bacfaae7ef37237cebb45e67c7fc8159dbceb0c20f | Python | 13,569 | 263 | import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
import dgl.function as fn
import copy
import numpy as np
from functools import partial
from dgl.nn.pytorch.conv import RelGraphConv
from basemodel import GraphAdjModel
from utils import map_activation_str_to_layer, split_and_batchif... |
3fbad469812bf64a4e873630ac91dc1d1965a95b6f3972ef7d569e2fecddf963 | Python | 13,571 | 393 | """CMA Optimisation class"""
"""
Copyright (c) 2016-2022, 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
by th... |
d235e5c507b6b9495e5dc5b57f1883287a047d67d4d785aa6585a4ecf19cdc17 | Python | 13,586 | 404 | """
Class to hold clinical outcome model.
Predicts probability of good outcome of patient(s) or group(s) of patients.
Call `calculate_outcome_for_all(args)` from outside of the object
Inputs
======
All inputs take np arrays (for multiple groups of patients).
mimic: proportion of patients with stroke mimic
ich: pro... |
33ed2900d888f8a2830f83a3d96af7a9a70b33087af0ae2ca1260c60b2a5451e | Python | 13,599 | 380 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 2 15:18:37 2023
@author: george
"""
from qtpy.QtCore import *
from qtpy.QtGui import *
from qtpy.QtWidgets import *
import numpy as np
import pandas as pd
import pyqtgraph as pg
import os
# import pyqtgraph modules for dockable windows
from pyqtg... |
64f0dbc2c44bb90342bb9b669b4976cee32e45cdc49e79f1d3e8c972f8a2bbb9 | Python | 13,599 | 336 | print("It works!")
import pandas as pd
import scanpy as sc
import numpy as np
import os
import json
import anndata as ad
### reading the data that we want to apply the clock to
adata = ad.read('./external_data/velmeshev_fc_adult.h5ad', backed='r')
# reading dictionary mapping gene ids to gene names
mapping_df = pd.r... |
01f64906ae107e3fc1ec89dd0b45d4501237b4c3dad1c2fdbcffe6b4a3673a08 | Python | 13,604 | 490 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# PROV Database Connector documentation build configuration file, created by
# sphinx-quickstart on Mon Oct 24 11:47:37 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are pres... |
d47c617bc7a221c5acd975c58265e2161e3c559a840abae74f4a058e4aa6f4d2 | Python | 13,605 | 333 | #!/usr/bin/env python
#
# Analyse texture
#
# Copyright (c) 2017 Polytechnique Montreal <www.neuro.polymtl.ca>
# License: see the file LICENSE
import os
import sys
import itertools
from typing import Sequence
import numpy as np
from skimage.feature import graycomatrix, graycoprops
from spinalcordtoolbox.image import... |
61ce5352d8bf8b8a3eff58b120d8602467603b0baa2a8daea6cc906010416906 | Python | 13,616 | 326 | """Tests for DandiNwbRecordingExtractor and its helper functions.
The extractor streams NWB files from the DANDI Archive in production. For offline
unit testing, ``_stream_nwb`` is monkeypatched to open local mock NWB files from
``stubbed_testing_data/nwb/``. This lets us exercise the full
BaseRecordingExtractor contr... |
42f9d4a0a923a8c9e49f25d46843934c8730a48823cb4c17eec662b35caf56dc | Python | 13,617 | 225 | # 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... |
da5175ba160546668e176b9800ff270a6c2b3159118645e71237d61750cf8d17 | Python | 13,626 | 333 | import torch
import torch.nn as nn
import math
import copy
from torch.nn import Linear
from .so3 import SO3_Embedding
from .radial_function import RadialFunction
class SO2_m_Convolution(torch.nn.Module):
"""
SO(2) Conv: Perform an SO(2) convolution on features corresponding to +- m
Args:
... |
5360e2af319451cc9b3a00b360c290ae509f26eb4a19df900e68f68d84c341a3 | Python | 13,634 | 363 | # -*- coding: utf-8 -*-
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.model_selection import cross_val_score
from sklearn.preprocessing import MinMaxScaler
from sklearn.ensemble import RandomForestClassifier
from sklearn.naive_bayes import GaussianNB
from skle... |
b0814c16ccefda29f2eefad321bb73026e45c9bce79d0c80841e4c02c5b89abb | Python | 13,646 | 265 | import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
import dgl.function as fn
import copy
import numpy as np
from functools import partial
from dgl.nn.pytorch.conv import RelGraphConv
from basemodel import GraphAdjModel
from utils import map_activation_str_to_layer, split_and_batchif... |
aa39a6f680fdbea49b31d9442c065cf31d8336cf6df53eaf6b0383fbad0184f5 | Python | 13,663 | 344 | import argparse
import json
import multiprocessing as mp
import os
import time
import feater
import feater.utils
import feater.voxelize
import numpy as np
import pandas as pd
np.random.seed(1543)
MASS2RADII = {
16: 1.52, # O
12: 1.70, # C
14: 1.55, # N
1: 1.20, # H
32: 1.80, # S
31: 1.80... |
3b63f8b995ca6f24b62a00845e9cbfdd561e9df3ba2ee049e26bc7872e726ff3 | Python | 13,666 | 348 | import ast
import torch
import torch.nn as nn
import numpy as np
import torch.nn.functional as F
def pd_to_pth(df, values, keys=['participant', 'task', 'trial']):
column_names_list = [keys + [value] for value in values]
wide_arrs = {}
for column_names in column_names_list:
arr = df[column_names].va... |
7589539cbaac045638399c3af63e23ca46ae539c03986551032148fe3299c4e4 | Python | 13,670 | 290 | import sys
sys.path.append("/home/lab-macbook/LabExperiment/Codes/TIS/SnapAnImageAndConverttoOpenCV/")
import os
import cv2
import numpy as np
import math
import random
import time
import TIS
import csv
from datetime import datetime
from screeninfo import get_monitors
from collections import deque
# コマンドライン引数の処理
if l... |
72f1e214717b680eff45f64a61c97180f21b617b55740f05bc6de59ccdb7257e | Python | 13,677 | 245 | from src import *
import optuna
import argparse
import re
parser = argparse.ArgumentParser(description="Run inference on triplets")
parser.add_argument(
"--setting",
type=str,
required=False,
default = "drug_combination_discovery",
help="The partition strategy you want to use."
)
parser.add_argu... |
c17abf495698df9d07a0e977f0480253723ee903614302144b1280e29c24c9d3 | Python | 13,691 | 402 | """Module to adapt AIS/soma scale by matching rho factors."""
# Copyright (c) 2022 EPFL-BBP, All rights reserved.
#
# THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS''
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTI... |
944c3802b95abdf72b2104cd113317564b887f5499aa0a2b9860b705f54bde33 | Python | 13,723 | 391 | import os
from pprint import pprint
import pytest
from kgx.source import RdfSource
from kgx.transformer import Transformer
from tests import RESOURCE_DIR
from tests.unit import load_graph_dictionary
def test_read_nt1():
"""
Read from an RDF N-Triple file using RdfSource.
"""
t = Transformer()
s ... |
980e46f15fc8d9086d0695d92e4a814bb9c36573a9e6323a0f093b664135958c | Python | 13,731 | 346 | import ast
import torch
import torch.nn as nn
import numpy as np
import torch.nn.functional as F
def pd_to_pth(df, values, keys=['participant', 'task', 'trial']):
column_names_list = [keys + [value] for value in values]
wide_arrs = {}
for column_names in column_names_list:
arr = df[column_names].va... |
10c447c1320966864d6e0a50bcfd2c0863b50f7ddfb0b3749eb3bc12b5921dae | Python | 13,741 | 250 | import os
import numpy as np
from scipy.ndimage.interpolation import affine_transform
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
class VAE:
def __init__(self, atlasDir, transform, imageSize):
self.sess = tf.Session()
self.imageSize = imageSize
VAEModelPath = os.path.join(... |
63baea0a1854286900f28a820968f9a1f7d7a4b7f8ffd28f387bb51439621db7 | Python | 13,741 | 391 | # -*- encoding: utf-8 -*-
'''
@File : t5_gen_datasets.py
@Time : 2022/10/24 19:29
@Author : He Junqing
@Version : 1.0
@Contact : hejunqing@idea.edu.cn
@License : (C)Copyright 2022-2023, CCNL-IDEA
'''
from logging import exception
from transformers import (
BertTokenizer,
MT5Config,
MT5To... |
0095b6cb513f4a0eab72157fd0c8a1d775d070414e91d4b6d8c7fde9e39e650e | Python | 13,747 | 361 | import math
import numpy as np
import torch
def cubic(x):
"""cubic function used for calculate_weights_indices."""
absx = torch.abs(x)
absx2 = absx**2
absx3 = absx**3
return (1.5 * absx3 - 2.5 * absx2 + 1) * (
(absx <= 1).type_as(absx)) + (-0.5 * absx3 + 2.5 * absx2 - 4 * absx +
... |
42453b8eb503b211780a58a350e177a1b503704c899429d7afa41bc08f190d72 | Python | 13,756 | 356 | '''create a hoc file from a set of BluePyOpt.ephys parameters'''
# pylint: disable=R0914
import os
import re
from collections import defaultdict, namedtuple, OrderedDict
from datetime import datetime
import jinja2
import bluepyopt
from bluepyopt.ephys.locations import (NrnSeclistCompLocation,
... |
3f2efd0351a7f2ba4396a8d5499f21f6dfcb2f5f536d2ef09dd92c3c020020f4 | Python | 13,758 | 334 | import numpy as np
from scipy.ndimage import gaussian_filter # for smoothing grid cell tuning
import matplotlib.pyplot as plt
from scipy.signal import gaussian
from scipy.signal import correlate2d
from scipy.ndimage import rotate, correlate
from scipy.stats import binned_statistic_2d
from scipy.stats import zscore
# fr... |
b50f366be24b0bb1a131c56ab78ddfb99a2d9a41e08d860c9676701a07bf6b9e | Python | 13,767 | 385 | """Batch annotation for v7+ integer-encoded eggnog.db.
Thin adapter over eggnogmapper.annotator.e7.AnnotationEngine: emapper parses
hits from DIAMOND/MMseqs, calls the engine for all annotation logic
(orthologs, annotations, OG resolution, taxonomic filters, caches), and
re-shapes the result into the tuple that emappe... |
b89d66e60b74f6b20667222dd4933479ac8a05202f09f4eb354e2324b4f94d0f | Python | 13,771 | 295 | #!/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... |
a4f2f8961c64b9d0d29e6f7c16a0d3577e8d79344181aabf3e08ecaf71559f38 | Python | 13,775 | 395 | #!/usr/bin/env python
"""
MetaWIBELE: ddi_DOMINE_protein_family module
Summary the results of DDI for families
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
... |
d371dcf5897da809b0980160c283a47c4429ad24f730b3db74839d814f18e3e8 | Python | 13,790 | 331 | from PyQt5 import QtGui, QtWidgets, QtCore
import pyqtgraph as pg
import numpy as np
from util import colors
def removeExportFromContextMenu(contextMenu):
contextMenuLen = len(contextMenu)
if contextMenuLen > 0:
for i in range(contextMenuLen):
action = contextMenu[i]
if 'Export... |
d34640fc0978872a68ca8889df0539db6b5b4e214d770b5fd0052c51a5608165 | Python | 13,794 | 302 | import re
import torch
import torch.nn.functional as F
from torch.nn.utils.rnn import pad_sequence
import numpy as np
import json
import jsonlines
from tqdm import tqdm, trange
def set_seed(args):
np.random.seed(args.seed)
torch.manual_seed(args.seed)
if args.n_gpu > 0:
torch.cuda.manual_seed_all(a... |
dd660a2301010e836b2c68e64eb8cf0cf3e4de44876ace3335bc3411950191c7 | Python | 13,798 | 506 | """Parameter classes for Bayesian optimization."""
from __future__ import annotations
import abc
from collections.abc import Sequence
from inspect import signature
from numbers import Number
from typing import TYPE_CHECKING, Any, Callable, Union
import numpy as np
from sklearn.gaussian_process import kernels
from b... |
4f7629fd137e31e6048df1a99085d3ba2d1877f7d55d127f68541c02e12aa0dd | Python | 13,806 | 275 | from __future__ import print_function, division
import os
import numpy as np
from .utils import get_channel_axis, reorient_3d_image
class InputGenerator(object):
EXTENSIONS = None
def __init__(self, pad_size=None, patch_size=(128, 128), flip=False, access='random', random_orient=False,
... |
7b0eb1c91d6637a721965b72119563163aeec221d6148a1ec4d37ba2bbee30c6 | Python | 13,821 | 418 | """Tests for admin functionality.
Tests cover:
- User management endpoints (list, get, update, delete)
- Server settings endpoints (get, set, unset default room)
- Room creation with @-prefixed presets (@empty, @none)
- Auth required protection
"""
import uuid
import pytest
import pytest_asyncio
from helpers import ... |
9f7aabd89a0dc16065180f2ecfeed3c093d759b42fae23ae20e56a66bddb7c57 | Python | 13,821 | 331 | import dgl
import torch
from torch import nn
import torch.nn.functional as F
from dgl import function as fn
from functools import partial
import copy
import math
from model.util import get_func
# dgl graph utils
def reverse_edge(tensor):
n = tensor.size(0)
assert n%2 ==0
delta = torch.ones(n).type(torch.l... |
6b5824d9322535a2ab581c05acda49251a9af6ae3aae456de45ffacc24a73a16 | Python | 13,826 | 356 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
# pyre-strict
import copy
import os
import random
import string
import typing
import unittest
from collections import OrderedDict
from tempfile import TemporaryDirectory
from typing import Tuple
from unittest.mock import MagicMock
import torch
f... |
e58226027317a950cca1f1179febc44625dddb02ceb5cd796d79daef697fb4bb | Python | 13,826 | 352 | import holoviews as hv
import numpy as np
import pytest
from bokeh.models import BoxSelectTool, Plot
from guppy.visualization.preprocessing import (
build_control_signal_fit,
build_markable_trace,
make_spans_pipe,
set_drag_gesture,
)
from guppy_test_data import resolve_plot
def image_extent(image):
... |
d6e14535633364cc5a775ce19b7fdcc9880453fb6378f2fd83b55ae11de8ca8a | Python | 13,831 | 400 | # Author: Hauxu Yu
# A module for feature detection
# imports
import numpy as np
from scipy.signal import find_peaks
from scipy.ndimage import gaussian_filter1d
from copy import deepcopy
import bisect
from .feature_evaluation import calculate_noise_score, calculate_gaussian_similarity, calculate_asymmetry_factor, sq... |
bdbaa344251a728dbc10b2970a8bcb7b4f71f33e88449c4b377d9ee50d0334db | Python | 13,857 | 366 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import os
from . import util, fileio, mupack, modeling
from . import motif_fit as mf
from tqdm import tqdm
import wandb
def model_pipeline(hyperparameters, tags=None):
# tell wandb to get started
with wandb.init(project="NN", config=hype... |
735274ec69f2ba0523c35763e83a6c21b101b1ff5b5979be5372e3623d09c777 | Python | 13,860 | 330 | import warnings
from collections import defaultdict
import pyoxigraph
from src.babel_utils import make_local_name, pull_via_ftp
from src.categories import ANATOMICAL_ENTITY, CELL, CELLULAR_COMPONENT
from src.prefixes import MESH
MESH_IRI_PREFIX = "http://id.nlm.nih.gov/mesh/"
def get_mesh_id_from_iri(iri) -> str:
... |
6431dacdb34f0b0591818bfdb6866a7fb524efe1959c78f41143af07d35ecd88 | Python | 13,871 | 323 | 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 ... |
a5722c11214c0ba7a67d554ab8ba3db908ec28c37fd4f19f7281744c50a5cdbe | Python | 13,871 | 266 | #!/usr/bin/env python3
"""
conflate-synonyms.py is a Python script for conflating synonym files using one or more
conflation files.
"""
import gzip
import json
from collections import defaultdict
from src import util
from src.babel_utils import get_numerical_curie_suffix
logger = util.get_logger(__name__)
# click... |
d398baeb702218e2709dbc85a70736fb702777c6cbf203f5d2758c0c52b367cc | Python | 13,880 | 342 | #!/usr/bin/env python
#
# Detect Ponto-Medullary Junction
#
# The models were trained as explained in (Gros et al. 2018, MIA, doi.org/10.1016/j.media.2017.12.001),
# in section 2.1.2, except that the cords are not straightened for the PMJ disc detection task.
#
# To train a new model:
# - Install SCT v3.2.7 (https://gi... |
463cc1be9676bb3c1dc1766ee668671ef8756ded4daa31200032437823f50818 | Python | 13,885 | 323 | 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 ... |
7e2bbcb82e51d84309e780ed9ea3a484085e4878843227c3fc3aa4bc6f4d2946 | Python | 13,886 | 513 | """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... |
33d83aead1689848a52647b2c3002895e5d14233b2028ada781a84e8d36b4342 | Python | 13,888 | 299 | #!/usr/bin/env python
# encoding: utf-8
# %% libraries _________________________________________________________________________________________
import argparse
import datetime
import glob
import itertools
import json
import logging
import os
import sys
from os.path import join
from pathlib import Path
from statistics... |
42219a7dca438f9c3fdfb0218b5ee1399ea2a523d00ef1ada97db62dfaa16ad4 | Python | 13,900 | 322 | #################################
#Test VF2 in identifying occurrences of CC motifs in diverse simulated data sets
#Reproducibility for Figure.2F
#################################
import torch
import os
import numpy as np
import dgl
import logging
import datetime
import math
import sys
import gc
import j... |
e990931f63e2b64088cf365400f123f4e98557da3521178ae8ed340fe3cf807b | Python | 13,902 | 370 |
import os
import subprocess
from tempfile import NamedTemporaryFile, mkdtemp
import uuid
from collections import defaultdict
from ...common import *
from .hmmer_seqio import iter_fasta_seqs
from .hmmer_search_hmmpgmd import iter_seq_hits, iter_hmm_hits, QUERY_TYPE_SEQ, QUERY_TYPE_HMM, DB_TYPE_SEQ, DB_TYPE_HMM
SCA... |
482fd7fd3938d32ec340e4260aa25fa2529353c71fa15448dcc95cef306b2ff4 | Python | 13,913 | 327 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 27 20:32:36 2022
@author: george
"""
import numpy as np
import pandas as pd
from tqdm import tqdm
import os, glob
from sklearn.neighbors import KDTree
import math
from scipy import stats, spatial
from matplotlib import pyplot as plt
# Radius o... |
ce1bbe028d036ba7656990fdc9402d2712cb4365332f7aaf9452592f39898bbb | Python | 13,919 | 366 | # coding=utf-8
# Copyright 2021 The IDEA Authors. All rights reserved.
# 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://www.apache.org/licenses/LICENSE-2.0
# Unless required by a... |
6f6718d656ea4aaa3ea242f159b987b0da68dae42cf886a116e449efe6901497 | Python | 13,925 | 339 | 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',
... |
c5344ac9b1e09987b336cd6e79dd2cb46313054b0408c0a8eeb1c02517220571 | Python | 13,926 | 147 | #!/usr/bin/env python
import argparse
from isorefiner import trans_struct_wf, filter, refine, trim, map, run_bambu, run_espresso, run_isoquant, run_stringtie, run_rnabloom
from.common import get_version
def main():
parser = argparse.ArgumentParser(description="IsoRefiner, a tool to filter, merge, and refine tran... |
bd69aeb210d65e62d18abdbdc3c88ce3e50bf2a75dbbdfb6d8ba48e9b9dc744e | Python | 13,941 | 477 | from pathlib import Path
from types import SimpleNamespace
import numpy as np
import pytest
from masscube import workflows
from masscube.feature_detection import Feature, detect_features
from masscube.feature_evaluation import calculate_noise_score
from masscube.params import Params
from masscube.raw_data_utils impor... |
5c596840ec124576016da253c403f234e99103f393760ec2b60081f95249e482 | Python | 13,942 | 392 | #!/usr/bin/env python
#
# Copyright 2015, Daehwan Kim <infphilo@gmail.com>
#
# This file is part of HISAT 2.
#
# HISAT 2 is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (a... |
110319f49608a79972a47001b198b934708fff3917c4208ba6deb3fcd6ad2022 | Python | 13,948 | 291 | import os
import pickle
from pathlib import Path
import numpy as np
from PyQt5.QtCore import QThread
from lib import OFlowCalc, helpfunctions, Filters, PeakDetection, plotfunctions
from lib.Config import Conf
from lib.video import videoreader
class Analysis:
def __init__(self, config: Conf):
self.motion... |
665f2fffe10ac82cef912cd94e99f4c35e292bfa52819385a47fd4f7ff0aefd4 | Python | 13,949 | 413 | #!/usr/bin/env python3
# @Author: ChangXu
# @E-mail: xuchang0214@163.com
# @Last Modified by: ChangXu
# @Last Modified time: 2021-04-22 08:42:54 23:22:34
# -*- coding: utf-8 -*-
import os
import psutil
import time
import torch
import math
import numpy as np
import pandas as pd
import scanpy as sc
... |
b7ac774d0b8aeae050479ff57aef7b0c6f95267eeb806f42d46cd574faf2f220 | Python | 13,959 | 347 | import numpy as np
import cv2
import sys
import os
import pickle
import torch
import torch.nn as nn
import SimpleITK as sitk
from torch import optim
from torch.utils.data import DataLoader, Subset, Dataset
from PIL import Image
import random
from albumentations import (
GridDistortion,
ElasticTransform,
Com... |
0261883edba5b7c82450901f622894c28eb4b721b876b2bdd696d422a48d740a | Python | 13,964 | 280 | #!/usr/bin/python
"""
This file to test the Classification part of the ABC-DLS file
"""
import sys
sys.path.append("..")
from pathlib import Path
from src.Classes import ABC
from src.Classes import Misc
from SFS import Class as SFS_Class
from collections import Counter
import pandas
import numpy
import joblib
import... |
d8281b2b6f08ab615dc526c9c1ee6720ea892cf70c6b6df215206bb0fa1dc765 | Python | 13,964 | 493 | """
Logger copied from OpenAI baselines to avoid extra RL-based dependencies:
https://github.com/openai/baselines/blob/ea25b9e8b234e6ee1bca43083f8f3cf974143998/baselines/logger.py
"""
import os
import sys
import os.path as osp
import json
import time
import datetime
import tempfile
import warnings
from collections imp... |
ef1cc3ef8eebdd105d5b5dface021ab311e6f0d5107b98d5f0edbf1226af0e52 | Python | 13,978 | 236 | import argparse
# We will be syncing training across many nodes who independently preprocess data
# In order to do this we will need to sync the training plans (defining the model architecture etc.)
# NNUnet does this by overwriting the plans file which includes a unique alternative plans identifier other than the def... |
3075ad12c4f2412a7cd7db69c87a3b525072944964f0c10bd26dd1084b36cba2 | Python | 13,980 | 412 | from numpy import float32
import torch
import torchvision
from torch import Tensor, dropout, nn
import torch.nn.functional as F
import math
import torchinfo
from torchvision.models.feature_extraction import get_graph_node_names
from torchvision.models.feature_extraction import create_feature_extractor
import torchvisio... |
1beca2bf6e78abd2ff85c987ffaa8547816480404e9441db99f35fac538e3d77 | Python | 13,985 | 342 | """Phase 1 correctness audit on the engine side.
Verifies that AnnotationEngine._collect_orthologs correctly transforms
sp_events into the (orthologs, ortholog_types) tuple downstream code relies
on, by recomputing the expected result directly from the SQLite tables and
comparing.
Properties under test
--------------... |
0fa87945c9b823a27086c9214d796241eaf3c6d255bc0b0c0bb2247cdfa88f70 | Python | 14,000 | 312 | # -*- coding: utf-8 -*-
from glob import glob
from os.path import join, relpath
def argwrapper(args):
return args[0](*args[1:])
def work(cmd,env):
import subprocess
return subprocess.call(cmd, env=env)
def create_job_sequence(total_process,n_jobs):
import numpy as np
job_sequence=np.arange(0,(in... |
3d66a5ec84aa6c04f0f0d6a4e089564e837105927f02f055ff52871e7e8ec94e | Python | 14,004 | 340 | from copy import deepcopy
from functools import partial
from turtle import forward
import numpy as np
from pip import main
import torch
import torch.nn as nn
import torch.nn.functional as F
from timm.models.layers import drop_path, to_2tuple, trunc_normal_
from timm.models.registry import register_model
from collection... |
60481fe0f2bb00c5428e175915f2b04cc3fee29b353c78f434a90d2133604f2f | Python | 14,005 | 325 | # coding=utf-8
# Copyright 2021 The IDEA Authors. All rights reserved.
# 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://www.apache.org/licenses/LICENSE-2.0
# Unless required by a... |
340fbc2af45f52097925dea9e379d65195db57ec1aa8a4b7a5fc240cb80c06a1 | Python | 14,013 | 334 | import dgl
import torch
from torch import nn
import torch.nn.functional as F
from dgl import function as fn
from functools import partial
import copy
import math
from model.util import get_func
# dgl graph utils
def reverse_edge(tensor):
n = tensor.size(0)
assert n%2 ==0
delta = torch.ones(n).type(torch.l... |
aa503bf82d823599da7641457e741fd9b910235f7dbc0ced5ed01fea8fa651b9 | Python | 14,021 | 330 | # -*- coding: utf-8 -*-
# Export functions for NeuroML NetworkML 1.8.1
# TODO Should have been implemented in the client side in javascript
# given that the amount of data to transfer would have been smaller,
# and no computations would bog down the server.
# TODO Synapses are potentially incorrect: the properties of... |
17dd458f584b2f20534925da70a3f61e8e327ee491346298371e561f7b4d2f46 | Python | 14,028 | 388 | 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
from fragment_utils.mol_utils import split_molecule, join_fragments
class Vocabulary(object):
"""A class for han... |
198f355f45ddca897448ee0f1619726ec6d6e0bfa88035ff44f175c5946174c6 | Python | 14,052 | 284 | #!/usr/bin/env python
## ----------------------------------------
## scikit-ribo
## ----------------------------------------
## a module for processing gtf/bed files
## ----------------------------------------
## author: Han Fang
## contact: hanfang.cshl@gmail.com
## website: hanfang.github.io
## date: 10/28/2016
##... |
93fd53ca3ef1f06dd63be1c732dc583ecf9183159e52f548587bd299d4908ad0 | Python | 14,056 | 461 | """Tests for Socket.IO event Pydantic models."""
from datetime import UTC, datetime
from uuid import UUID, uuid4
import pytest
from pydantic import ValidationError
from zndraw.socket_events import (
BookmarksInvalidate,
FigureInvalidate,
FramesInvalidate,
FrameUpdate,
GeometryInvalidate,
Lock... |
4ac0bea3ad5a49547c97c51134f89f5b77a9bdcdd6ee5afdc90becde23c40a00 | Python | 14,071 | 319 | from collections import defaultdict
from typing import List
import pytest
from pytest_mock import MockerFixture
from CybORG.Simulator.Actions import Sleep
from CybORG.Simulator.SimulationController import SimulationController
from CybORG.env import CybORG
from CybORG.Tests.test_cc4.cyborg_env_creation import create_cyb... |
def432c74d13f76a8c81dc83d3140a0bb2b53e6b0ef6260ef538095162dd2817 | Python | 14,077 | 271 | # pytest unit tests for sct_compute_compression
import pytest
import logging
import numpy as np
import tempfile
import nibabel
import csv
from spinalcordtoolbox.scripts import sct_compute_compression
logger = logging.getLogger(__name__)
@pytest.fixture(scope="session")
def dummy_3d_compression_label():
data = ... |
bed74389f73ba510ad677c216b3b8003a45e47d46bfb5accad09b70a25e66483 | Python | 14,078 | 307 | import logging
from collections.abc import Callable
from contextvars import copy_context
from importlib.metadata import version
from pathlib import Path
from threading import Thread
import panel as pn
from .artifact_view import open_artifact_view
from .export_nwb import run_export_nwb_step
from .group_analysis import... |
31617163e5b6b5349ea604f3363fa8b3dde81293ab2ffb59e9494385bb3dd8a9 | Python | 14,095 | 401 | # This file is part of h5py, a Python interface to the HDF5 library.
#
# http://www.h5py.org
#
# Copyright 2008-2013 Andrew Collette and contributors
#
# License: Standard 3-clause BSD; see "license.txt" for full license terms
# and contributor agreement.
"""
Implements support for HDF5 compression filt... |
2de1f02b15d1fdf5a664fed35886ba52a150daa41becf7f2bd6b72ae8a3ac4cb | Python | 14,096 | 410 | """
Date: 2022-12-13 15:47:53
LastEditors: yuhhong
LastEditTime: 2022-12-13 15:47:53
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
from typing import Tuple
# ------------------------------------------------------
# decoder
# ------------------------------------------------------
class FCResB... |
12bead04aa5d863d9c138b94a2291fb7b91f948c19a5e9699a800b0c09cf229a | Python | 14,129 | 385 | from .GODEVAE_env import GNODEVAE_Env_r, GNODEVAE_Env_Subgraph
from anndata import AnnData
import numpy as np
import pandas as pd
import torch
import tqdm
from typing import Optional
import time
import psutil
from torch_geometric.data import Data
class GNODEVAE_agent_base:
"""Base class for GNODEVAE agents, provi... |
ebe143c098cbdf0e86cc0d1feda04e22fbd009f0636d0d78aa5dfd89e1e06c65 | Python | 14,131 | 366 | '''create a hoc file from a set of BluePyOpt.ephys parameters'''
# pylint: disable=R0914
import os
import re
from collections import defaultdict, namedtuple, OrderedDict
from datetime import datetime
import jinja2
import bluepyopt
from bluepyopt.ephys.locations import (NrnSeclistCompLocation,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.