sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
359279534decb25966ac45f15080219e20b82f4ea568b85f4b3746813fab6a25 | Python | 7,998 | 233 | import math
from typing import List, Union
import os
import seaborn as sns
import pandas as pd
import numpy as np
import torch
import torch.nn as nn
from torch.optim import Optimizer
from torch.optim.lr_scheduler import _LRScheduler
from tqdm import tqdm, trange
from rdkit import Chem
from rdkit.Chem.Draw import Simil... |
f456d7dc5bd9f733824ce9fc4481f9cc7035a0c92f7d072822135ae299a91c52 | Python | 7,998 | 173 | import os, sys
import time
import multiprocessing
import numpy as np
import pandas as pd
from functools import partial
# Define path
path_results = "../../Data/results"
path_simulation_general = os.path.join(path_results, "curve_fits", "compare_fitting_methods")
path_output = os.path.join(path_simulation_general, "te... |
41c269d0859822876d01731689daa7b788d7c029a26b81e1a822328976547fd3 | Python | 7,999 | 219 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
"""
Apply final FILTER cleanup and QUAL score recalibration
"""
import argparse
import sys
import pysam
import csv
from numpy import median
from svtk.utils import is_biallelic
# Define global variables
filts_for_info = 'PESR_GT_OVERDISPERSION HIGH_SR_BACKGROUND BOTHS... |
4b9f29dbd7c1134c1074511e959ab64266f59bbae42e760cc82a4356a9760126 | Python | 8,001 | 200 | from typing import Callable, Optional
import numpy as np
import torch
from sinabs.activation import MembraneSubtract, MultiSpike, SingleExponential
from .lif import LIF, LIFRecurrent
from .reshape import SqueezeMixin
class IAF(LIF):
"""Integrate and Fire neuron layer that is designed as a special case of
:... |
799246f3299d45f3826825a186b59d6867aa4d8165509f9940a8b00ddbfdb7bd | Python | 8,001 | 183 | import pickle
from mozaik.tools.misc import result_directory_name
from mozaik.storage.datastore import PickledDataStore
from parameters import ParameterSet
from mozaik.storage.queries import *
import sys
import os
import time
def load_fixed_parameter_set_parameter_search(simulation_name,master_results_dir,filter=None)... |
61b82c5e0dcff8cb74682d48cab6333df1da6d3820cfd257c3fa80818dee19d6 | Python | 8,005 | 158 | import os
from sklearn.model_selection import KFold
from param import *
from utils import *
args = parse_args()
def loading_similarity_feature(args):
path = args.path
device = args.device
similarity_feature = {}
"MiRNA Sequence Similarity"
m_seq_sim = np.loadtxt(os.path.join(path... |
e1c05ca5ed725240f027bf8c577529a422ad6412048f7c95fb275b0309503160 | Python | 8,007 | 157 | import sys
import logging
from typing import Optional
import numpy as np
import pandas as pd
import math
from pathlib import Path
import click
import yaml
logging.basicConfig(
format="[%(asctime)s] %(levelname)s:%(name)s: %(message)s",
level="INFO",
stream=sys.stdout,
)
logger = logging.getLogger(__name__)... |
ed3000d914f00f7f351a295d973f47e8955e61f70f4a668935df4b8b49cc72ec | Python | 8,007 | 200 | import numpy as np
import os
import re
import argparse
import json
import pickle as pk
from math import ceil
from sklearn.metrics import r2_score
from src.data.load_data import (
load_params,
load_data,
make_input_labels,
make_seq,
load_darts_timeseries,
)
from src.tools import check_path
from src.... |
03de94898461d24605f3b0bd41b6104f9ede3d82a6b4de9a072e5d1324e88974 | Python | 8,008 | 235 | """
An implementation of Context dependent GRU.
the gru uses the implementation from:
https://github.com/emadRad/lstm-gru-pytorch/blob/master/lstm_gru.ipynb
"""
import math
import torch
import torch.nn as nn
import numpy as np
from utils import to_pth, to_np
from torch.nn.functional import softmax
class CGRU_v2(nn.Mod... |
c3560a9e95b0c6b0ded85f6c95aacce41d0d878e26da034d8bf42f2ed8fc0d80 | Python | 8,008 | 248 | from __future__ import annotations
import argparse
import logging
from pathlib import Path
from typing import Any
import attrs
from snakebids import bidsapp
from snakebids.bidsapp.args import ArgumentGroups
from snakebids.plugins.base import PluginBase
logger = logging.getLogger(__name__)
import json
try:
from... |
45696be40e64cf18d39fd7741dc8623657b688923ac357314c607a75fc1b717c | Python | 8,009 | 153 | import os
from sklearn.model_selection import KFold
from param import *
from utils import *
args = parse_args()
def loading_similarity_feature(args):
path = args.path
device = args.device
similarity_feature = {}
"MiRNA Sequence Similarity"
m_seq_sim = np.loadtxt(os.path.join(path... |
8d82323e21b9938e6bba6afb8da104cd014f2b7be534e348730697e9523af645 | Python | 8,013 | 212 | ####################################################################################################
# Copyright (c) 2016 - 2024, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# This program is fre... |
7b392d6d148388e8fe2efa8c14cb455b4f3cdc021dbd6b6d7d006e2d1d611267 | Python | 8,015 | 156 | import os
import numpy as np
import ivim
root = '/path/to/root'
input_root = os.path.join(root,'data')
results_root = os.path.join(root,'results')
subs = [sub for sub in os.listdir(input_root) if sub.startswith('sub-')][-4:]
scans = ['sIVIM','IVIM-10b','IVIM-FC','IVIM-NC']
runs = ['run-{}'.format(r+1) for r in range(... |
27e7e2e9e25f260c8d78b938538351499e7cf707d0fc94c01eddc44caae2bfa2 | Python | 8,018 | 205 | from dataclasses import asdict, dataclass
from functools import cached_property
from typing import Any, Dict, List, Mapping, Optional, Tuple
import numpy as np
import pyarrow as pa
import pyarrow.compute as pc
from ray.data._internal.table_block import TableBlockAccessor
from ray.data.block import Block, BlockAccesso... |
29f227ec75bc2e506535db9252d820f4cda4fdae6cfdba2a3b2f15b2d6fa517b | Python | 8,019 | 187 | """
Code taken from: https://github.com/aliutkus/torchinterp1d
BSD 3-Clause License
Copyright (c) 2019, Inria (Antoine Liutkus)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of sou... |
0af585570ddf546523a2de674cf743a6f824efa525b20cc4ca27749e9e2308b7 | Python | 8,020 | 266 | conda activate scenic_protocol
cd /mnt/d/Brain_region_project/SCENIC
python
import scanpy as sc
adata=sc.read_csv("Inh_counts_matrix_1000.csv")
#adata.obs.to_csv("Inh_counts_matrix_1000_metadata.csv")
import os
import numpy as np
import pandas as pd
import scanpy as sc
import loompy as lp
from MulticoreT... |
33829e800e8b620e1ca9f724e3a00218ee5062e7384bcce32cd7357b36788f01 | Python | 8,021 | 156 | import os
from sklearn.model_selection import KFold
from param import *
from utils import *
args = parse_args()
def loading_similarity_feature(args):
path = args.path
device = args.device
similarity_feature = {}
"MiRNA Sequence Similarity"
m_seq_sim = np.loadtxt(os.path.join(path... |
906acbc17162ab4c62f977db7419a7c84fb6cd46e41f1ca0b5be37b981c79840 | Python | 8,022 | 250 | import multiprocessing as mp
import numpy as np
import nibabel as nib
import pandas as pd
from copy import deepcopy
from joblib import Parallel, delayed
from nilearn.input_data import NiftiMasker
from os import path
try: FileNotFoundError
except NameError:
class FileNotFoundError(OSError):
pass
def roi_df(img_path,... |
c3403dd1caeb38526abc66796f3adc5d8093fe9e5c2397c0068373596e4485c8 | Python | 8,023 | 234 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from __future__ import annotations
import os
import tempfile
import uuid
import warnings
from dataclasses import dataclass, field, replace... |
184abf0b483f131578fd476c3dcc71233c9fd4bbf3fbace684a3bde0c81106d4 | Python | 8,025 | 152 | import os
from sklearn.model_selection import KFold
from param import *
from utils import *
args = parse_args()
def loading_similarity_feature(args):
path = args.path
device = args.device
similarity_feature = {}
"MiRNA Sequence Similarity"
m_seq_sim = np.loadtxt(os.path.join(path... |
2aab42d53dbb175ef812504f494e8cc0bcd002f0d34a962147825017a591f9f9 | Python | 8,030 | 198 | from typing import Optional, Sequence, Union
import torch
import torch.nn as nn
from monai.networks.blocks import Convolution, UpSample
from monai.networks.layers.factories import Conv, Pool
from monai.utils import deprecated_arg, ensure_tuple_rep
from monai.networks.nets.basic_unet import TwoConv, Down, UpCat
from... |
6d192077a21f64ea83238d4f80b5974f5e06adad4136f681865b1b601ad1cfc2 | Python | 8,030 | 196 | import tensorflow as tf
gpus = tf.config.list_physical_devices('GPU')
if gpus:
try:
# Currently, memory growth needs to be the same across GPUs
for gpu in gpus:
tf.config.experimental.set_memory_growth(gpu, True)
logical_gpus = tf.config.list_logical_devices('GPU')
print(len(gpus), "Physical GPU... |
425c394c29d0650e50b2df058b785dfd9263060eebc68035cbd10f593dfa933d | Python | 8,032 | 237 | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.preprocessing import normalize
from mpl_toolkits.axes_grid1.inset_locator import mark_inset, inset_axes
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils
import torch.distributions
from .dp_related... |
eeae50d0ffad279ec3f0c5b17384e9d95511cac122ea3200ad85f34870bfee0b | Python | 8,035 | 159 | import numpy as np
import oddt
from oddt.utils import is_openbabel_molecule
from oddt.interactions import close_contacts
"""
The code in this module is mostly modified versions of the ODDT implementations of PLEC and ECFP/Morgan.
"""
def get_interacting_atoms(ligand, protein, distance_cutoff=4.5, ignore_hoh=True):... |
084028fabe7514b473c952c2fc367fe680795eee81947e8b84823671bd07f803 | Python | 8,038 | 241 | import copy
import numpy as np
import pytest
from parameters import ParameterSet
import mozaik
from mozaik.models import Model
from mozaik.models.vision.spatiotemporalfilter import SpatioTemporalFilterRetinaLGN
from mozaik.space import VisualRegion
import mozaik.stimuli.vision.topographica_based as topo
from mozaik.t... |
0b2fe310b73a57b9d37da0b5660b8bd58a327fc725edfd6336217504597b3eac | Python | 8,041 | 238 | import torch
import pandas as pd
import numpy as np
import math
import pickle
from torch.utils.data import Dataset, DataLoader
def load_pickle(f):
with open(f, "rb") as inFile:
return pickle.load(inFile)
def split_interval_string(interval_string):
"""chrom:start-end -> (chrom, start, end)"""
ch... |
22a33ededa1067c78aebb22efb0106f424cb30ea4e2a74242015358f6b4921fc | Python | 8,043 | 209 | from copy import deepcopy
import torch
def test_deepcopy_iaf():
from sinabs.layers import IAF, IAFSqueeze
input_current = torch.rand(10, 10, 10)
kwargs = dict(min_v_mem=-0.4)
layer = IAF(**kwargs)
layer_squeeze_nts = IAFSqueeze(**kwargs, num_timesteps=10)
layer_squeeze_batch = IAFSqueeze(**... |
c6f2c5c6a51d95385e6d2a5868f71c24b9d12a8818ebbe7d34c67645254e4bac | Python | 8,044 | 214 | """Map changed documentation files to the exact doc example tests they feed.
This backs the `docs-example-test` pull-request label. A doc-side edit runs no
docs example tests by default. With the label, the opt-in step in
.buildkite/others.rayci.yml runs only the Bazel test targets that name a
changed file directly, f... |
ec69e8d59866bcdcfab9b6a32f4ee36a18a6436cd4d9c31e1ca4a983e52ef417 | Python | 8,054 | 208 | import numpy as np
import scipy.sparse as sparse
def kr_balance(array, tol=1e-6, x0=None, delta=0.1, ddelta=3, fl=1,
max_iter=3000):
"""
Balances a matrix via Knight-Ruiz matrix balancing, using sparse matrix
operations.
Parameters
----------
array : np.ndarray or scipy.sparse.... |
a5e8cc53b11f7fd10d81fec3f4ab3930ce8a7575b774cef35838f22ef9d0205a | Python | 8,057 | 196 | import argparse
import pickle
from typing import List
import numpy as np
import torch
import tqdm
import lib.data_utils.data_util as du
import lib.data_utils.dynamic_data_util as ddu
import lib.dataset_config_parser.dataset_config_parser as dcp
from lib.data_utils.matched_cells_struct import OrderedMatchedCellsStruct... |
2effa057b08071030ee5bd8a35e8f0d68318ad81cd15a69db13e3d1011e4a03b | Python | 8,063 | 227 | # Caution: This simulation runs for 1 day on GPU
import torch
import torchvision
import torchvision.transforms as transforms
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import numpy as np
if torch.cuda.is_available():
dev = "cuda"
else:
dev = "cpu"
device = torch.de... |
b52165f3869cc4453aeb4658af4923f69b83d9575ede65e325458a55dbb3fcad | Python | 8,064 | 194 | # Copyright 2021 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, sof... |
e026de1de822dcb0aa8ede9191754477e188dfee3c885ec0ef670ab733ce546e | Python | 8,067 | 273 | from __future__ import print_function, unicode_literals, absolute_import, division
from six.moves import range, zip, map, reduce, filter
from ..utils import _raise, consume, normalize_mi_ma, axes_dict, axes_check_and_normalize, move_image_axes
import warnings
import numpy as np
from six import add_metaclass
from ab... |
1cf4addf836beeb92cd3fdc646253c7cce071803ea14c17bfccbc129b13f336d | Python | 8,069 | 186 | import scanpy as sc
import pandas as pd
import os
import numpy as np
import anndata
from sklearn.neighbors import KNeighborsTransformer
from .._registry import register_function
#These function were created by Lisa Sikemma in scArches
@register_function(
aliases=["KNN训练器", "weighted_knn_trainer", "knn_trainer", "... |
758f1204b9e3d4abb93c0f00bc365b01bfff161eaf47548baefb6a2fcdc6991f | Python | 8,069 | 224 | #!/usr/bin/env python
# Copyright (c) 2017-present, Facebook, Inc.
#
# 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... |
88284666fcd4b7c1efdb163a4ffe6eec81539ff7b3aab7a5a11e91b315326671 | Python | 8,070 | 182 | ####################################################################################################
# Copyright (c) 2023, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# This program is free softw... |
f8888a11bc28630453237523634ff9ba96dd5150b19ddb4d29fac72c082053e8 | Python | 8,071 | 220 | # Luciano A. Masullo, Philipp R. Steen
# Jungmann Lab
# Max Planck Institute of Biochemistry, 2023
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
import math
import h5py
def matrix_from_points(v0, v1, shear=True, scale=True, usesvd=True):
v0 = np.array(np.transpose... |
9d0ee6ccf73ebba06ac6aece323909caaf3928c4c77137ea1d8d48fc379b4b5a | Python | 8,072 | 206 | import nengo
import numpy as np
import nir
class IF(nengo.SpikingRectifiedLinear):
def step(self, dt, J, output, voltage):
voltage += J * dt
output[:] = (self.amplitude / dt) * np.where(voltage > 1, 1, 0)
voltage[output > 0] = 0
def nir_to_nengo(n, dt=0.001):
nengo_map = {}
pre_m... |
a47118661fe16f40109986414502eca819099933d1ad9de0066588fdb8986b76 | Python | 8,072 | 257 | """Data validation utilities."""
import re
import logging
from typing import Any, Dict, List, Optional, Union
from pydantic import BaseModel, Field, field_validator, ValidationError
logger = logging.getLogger(__name__)
class SequenceValidator:
"""Validator for biological sequences."""
# Valid amino a... |
83262bb87d5e25422d61a0b0b2a42c563966436af0963022e35ccdc464599c4b | Python | 8,074 | 226 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
# pylint: disable=too-many-locals
"""Exporting utilities"""
from typing import Optional, Dict, Tuple, Union, OrderedDict
from copy import deepcopy
from collect... |
d142e2623bee332581a13fc87faf8ca14fd7ec9a5cb609ca0a8b8558849bf7b0 | Python | 8,076 | 256 | import random
from tkinter import W
import brainrender as b
import numpy as np
from brainrender.actors import Point
from brainrender import _utils
#Find cell coordinates
import csv as c
file = open("CN_neuron_coordinates_allcells.csv")
csvreader = c.reader(file)
# Skip first line to get to get to data
next(csvreade... |
ae08679d0cb4478441e12acc497d18bdb8314c88733d05371f35b9a6c8be92e1 | Python | 8,079 | 214 | from PIL import Image
import numpy as np
from ctypes import *
import torch
import torch.nn as nn
import torch.nn.functional as F
import os
import matplotlib.pyplot as plt
from dataset import OCFlowerdata, NLOSdataMNIST_PCA, NLOSdataMNIST_PCA_C
from tqdm import *
import matplotlib.pyplot as plt
from tensorboardX import ... |
3f5274c76d9d8f2c132ceb02dd4b038f8647cde21cda7aaa13b0e50475f458c2 | Python | 8,081 | 205 | """MultiDecoder deployment - CPU-based classification, retrieval, and scene detection."""
import io
import logging
import os
import aioboto3
import numpy as np
from ray import serve
from constants import (
S3_EMBEDDINGS_PREFIX,
SCENE_CHANGE_THRESHOLD,
EMA_ALPHA,
)
from utils.s3 import get_s3_region
log... |
ffce09ba13a89add8fff5781d721135e9cd1c0b9e0f291caed4d7ace85fe9507 | Python | 8,081 | 166 | import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2' # reduce TF verbosity
os.environ['CUDA_VISIBLE_DEVICES']='0' #'-1' for CPU only
import argparse
import pickle as pkl
from Dataset import Dataset
from model import *
import time
start_time = time.time()
tf.keras.backend.set_floatx('float64') #to avoid numerical... |
2272a02d45cb6eaa60c8949d3430425ac44dc7107889af9c9e2c2f26c11568f9 | Python | 8,082 | 275 | #!/usr/bin/env python3
# coding: utf-8
# In[2]:
import json, os, shutil
import numpy as np
import tensorflow as tf
from tensorflow import keras
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
from tensorflow.keras.optimizers import SGD
from sklearn.metrics import... |
2c2c50866b3efdf1b8a3486b12068ddb2b098362ece6b0548827c1da3767d210 | Python | 8,082 | 228 | # Copyright 2023 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, sof... |
46e438a82888dadd4525056e6c89c81302e2b5fb263507903b7e47f7240d4ffb | Python | 8,083 | 243 | # Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
96460dfbac4df30bcde74b1322e6e0b731f0ef7498eddd4ebe80794f68f58175 | Python | 8,085 | 194 | import numpy as np
from scipy.stats import gaussian_kde
import matplotlib.pyplot as plt
from .._registry import register_function
from ._plotdata import get_values
@register_function(
aliases=["基因密度计算", "calculate_gene_density", "gene_density", "密度计算", "表达密度"],
category="pl",
description="Calculate weigh... |
cd2c308cd942536861d8839d8dc9c87d4b6d5bf777c99f7446fe7510b2690662 | Python | 8,085 | 176 | # Copyright (c) DP Technology.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import absolute_import, division, print_function
import logging
import copy
import os
import argparse
import json
import numpy as np
import pandas ... |
8dc28d2d2c1c35aad5f47bfad84e0762080e250b4e63be98bb59acab9e94d5e8 | Python | 8,086 | 182 | ####################################################################################################
# Copyright (c) 2023, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# This program is free softw... |
991063b54016eb8f1798df995d667bd6667c0978536852b5a3f9cdeb9970cff4 | Python | 8,086 | 190 | import sys
import numpy as np
import scipy.sparse as sp
import pandas as pd
import torch
import snf
from sklearn.neighbors import kneighbors_graph
from utils import sparse_mx_to_torch_sparse_tensor, normalize, encode_onehot, prepare_data, diffusion_fun_improved_ppmi_dynamic_sparsity
from runR2 import get_mat_pa... |
3de11a6e5d3be20aaa18402f6342bc8614d2fc730440c6929d7783d13eeb54fd | Python | 8,089 | 217 | import csv
import time
import urllib.parse
from pathlib import Path
from typing import Dict, Iterable, Set, List, Any
import tables as tb
from ppi_origami.sources.utils import canonical_interaction_id, upkb_query
from rich.progress import track
def dscript_rapppid_equivalence(
dscript_path: Path,
rapppid_pat... |
993250abca5d8d190dde2124e973f6b43a2d279423c361ae9f4c85d48211947b | Python | 8,089 | 183 | from time import time
import numpy as np
import tensorflow as tf
from ray import tune
from ray.tune.search.hyperopt import HyperOptSearch
from tensorflow.keras.metrics import RootMeanSquaredError
from tensorflow.keras.regularizers import l1, l2
name = "RegressorTools"
classical_ml_models = ["xgboost", "svr", "random_... |
29d6534317df90d975d15ff81db59ccaabac218678df33910cc4591421e6e928 | Python | 8,090 | 229 | import gc
import unittest
import torch
from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer
from diffusers import (
AutoencoderKL,
DDIMScheduler,
DDPMScheduler,
PriorTransformer,
StableUnCLIPPipeline,
UNet2DConditionModel,
)
from diffusers.pipeline... |
ff85785233c8a1c61528f27b666e68941f4ec91eea488c97dbf439bba7f240c2 | Python | 8,093 | 234 | ####################################################################################################
# Copyright (c) 2024, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# This program is free softw... |
c5982f6630964f99e9f3effbbc156fd035c1d15597d57e7f86784eee003fd52d | Python | 8,094 | 218 | import logging
from typing import List
from collections import defaultdict
import numpy as np
import pandas as pd
from torch.utils.data import DataLoader
from ml4ht.data.data_loader import SampleGetterIterableDataset, numpy_collate_fn, shuffle_get_epoch
from ml4h.TensorMap import TensorMap
from ml4h.defines import T... |
28677603aa62b016ac2871da0e04048da8bc2e270ac8b423531e69d4a0e36cea | Python | 8,098 | 234 | import math
import tempfile
import unittest
from unittest import mock
import pytest
import pfrl
@pytest.mark.parametrize("num_envs", [1, 2])
@pytest.mark.parametrize("max_episode_len", [None, 2])
@pytest.mark.parametrize("steps", [5, 6])
@pytest.mark.parametrize("enable_evaluation", [True, False])
def test_train_ag... |
db29dbcfaf83c40d53b3aa3fb981c7376b7f261019b6a16b9e535e08c773df73 | Python | 8,098 | 196 | import pandas as pd
import numpy as np
from tqdm import tqdm
from adrd.nn import UNet3DModel
from icecream import ic
import torch
from .imgdataload import ImageDataset
from torch.utils.data import DataLoader
from monai.networks.nets.swin_unetr import SwinUNETR
import os
import random
import functools
from monai.utils.t... |
4631debe538ebcac2611aff2ea31a49982ba5ebff4ece137ff82af5dd4402033 | Python | 8,099 | 200 | import argparse, os, sys, glob
import cv2
import torch
import numpy as np
from omegaconf import OmegaConf
from PIL import Image
from tqdm import tqdm, trange
from imwatermark import WatermarkEncoder
from itertools import islice
from einops import rearrange
from torchvision.utils import make_grid
import time
from pytorc... |
78aa0df837959ee74613e3b736523a9490f47212ed859b8a38b8a327f3461a39 | Python | 8,101 | 132 | from tests.objects import test_marker, test_node, test_tree
from neuron_morphology.validation import marker_validation as mv
from tests.validation.validation_test_case import ValidationTestCase
from neuron_morphology.constants import *
import unittest
from mock import patch
class TestMarkerValidationFunctions(Validat... |
8e037ab2eac5800c5813ab78e769d3eac13502e3c4848b68c30d1162aa137c66 | Python | 8,101 | 204 | import numpy as np
import scipy.sparse as sparse
import scipy.stats as stats
import scipy.ndimage as ndimage
from lib5c.util.distributions import freeze_distribution
from hic3defdr.util.scaled_nb import mvr
from hic3defdr.util.printing import eprint
def perturb_cluster(matrix, cluster, effect, respect_zeros=True):
... |
f611a2b9faeeac19c132d47c9b3a49c43988ba736dee8b72d8584dcc7de69325 | Python | 8,102 | 232 | """Deterministic random streams that reproduce SecAct's permutation tables.
Three generators feed one Fisher-Yates kernel, so a permutation table here is
bit-identical to the one the reference implementation builds:
* ``"mt19937"`` -- GSL ``gsl_rng_mt19937`` with seed 0 (GSL maps 0 to 4357).
This is what R SecAct (... |
c5b48b4f901118ce3d5cf8083cb94e9741b1104b9f4bfdf6b313e7414d035478 | Python | 8,104 | 194 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from __future__ import annotations
import logging
import ase.units
import numpy as np
import pandas as pd
from ase.io.jsonio import decod... |
358727a5b5c20faa2f17d85b97cbd778bfefd775f0dcf6834de939e377cf8162 | Python | 8,105 | 232 | # This file is part of the INTREPPPID programme.
# Copyright (c) 2023 Joseph Szymborski.
#
# This programme is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, version 3.
#
# This programme is distributed i... |
4d47779749ae2337a1ede62df53191d5aa3602d7284ae932580aeff7c5e991f0 | Python | 8,105 | 205 | ####################################################################################################
# Copyright (c) 2016 - 2024, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# This library is fre... |
3300e4f22601ad51247eafa28f5f1439e3b7e88388109826043a6201af68f0b3 | Python | 8,107 | 236 | # -------------------------------------------------------------------------------------------------------------------------------------
# Following code adapted from GCPNet (https://github.com/BioinfoMachineLearning/GCPNet):
# ---------------------------------------------------------------------------------------------... |
133d25083d77ce5965f890d013817a0f99f8acc8912c6e547f841d0db29a1455 | Python | 8,109 | 243 | import math
import numpy as np
import torch
from flyvis.datasets.augmentation.augmentation import Augmentation
from flyvis.datasets.augmentation.hex import (
ContrastBrightness,
HexFlip,
HexRotate,
PixelNoise,
)
from flyvis.datasets.augmentation.temporal import (
CropFrames,
# InterpolateFrame... |
16d20da7cb6ba8fe69605d12a67135f14f80355df2c018138fc23ea178775b74 | Python | 8,109 | 259 |
import numpy
import h5py
import os
import torch
from tqdm import tqdm
from torch.utils.data import Dataset, DataLoader
def load_data(path, trial=0, scale=False, gridsearch=False, slc=slice(None, None)):
"""
Loads the data from the given path
:param path: A `str` of the path
:param trial: An `int` of... |
d94dbd5ae3961da3b8aa5f0d8b3bd01b077b6c89962dcd1bfff1205ab85175a2 | Python | 8,111 | 240 | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
##Statistical comparison of the Hybrid ROIs w/ ResNet-18 model with the rest of the models trained and reported in the paper
#"Predicting recovery following stroke: Deep learning, multimodal data and feature selection using explainable AI" by White et al.
#In order fo... |
7c3de6e91732243af2bd833e7309318a9c080cb20c7254d0c5767d64c47660ac | Python | 8,116 | 202 | import numpy as np
import argparse
import subprocess
import datetime
import time
import os
import pandas as pd
import glob as glob
def check_if_any_running_sbatch_jobs():
user = get_current_user()
process = subprocess.Popen(['squeue', '-u', user], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
running_... |
00a65283a88684d4ef58903b38f6b44e96e59fdaa28410a12bbf206d171c7045 | Python | 8,122 | 212 | # Modified from https://github.com/open-mmlab/mmdetection/blob/main/mmdet/utils/memory.py # noqa: E501
import warnings
from collections import abc
from contextlib import contextmanager
from functools import wraps
import torch
from mmengine.logging import MMLogger
from mmengine.structures import BaseDataElement
def ... |
eb1ea2b595f222ed018b67775584900092925b9440a63ec4268d6b75eb3703e6 | Python | 8,124 | 208 | import os
import signal
from PyQt5 import QtWidgets, QtCore, QtGui
from PyQt5.QtWidgets import QApplication,QLabel,QDesktopWidget,QHBoxLayout, QCheckBox, QVBoxLayout, QFileDialog
import socket
import time
import sys
from subprocess import Popen
from PyQt5.QtCore import QTimer, Qt
#Initializign variables
front_proc = N... |
53308b99e6457d7489fb8b61c327cd6e1f7aae46c41af9398cc7380112d4c363 | Python | 8,126 | 215 | #%%
from time import time
from copy import deepcopy
import pandas as pd
import numpy as np
import toml
from tqdm import tqdm
# from adrd.nn import ImageModel
from icecream import ic
import torch
import ast
import os
import glob
import nibabel as nib
import json
#%%
def get_train_split(df, random_state, labels):
i... |
fcb6f977709a153e58848ad9c921923ab7a671948da5011415fbf28afff99ddb | Python | 8,126 | 222 | # Copyright 2026 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
76fccefa56ae58fdce437e4fabe15b39e68006dd13a8f8458b522091b016af4f | Python | 8,128 | 248 | #!/usr/bin/env python
import numpy
import numpy.random
import time
import pytest
import random
import string
from typing import Iterator, Tuple, Union
from sv_utils import common, parallel_tools
BasicTask = numpy.ndarray
StarTask = Tuple[BasicTask, str]
Task = Union[BasicTask, StarTask]
@pytest.fixture(scope='se... |
df818787316ea6964782bd4b1133500f9e994a5f9c7fc2f2a94b5a8920bbaf7f | Python | 8,129 | 191 | r"""Reference-free segmentation quality metrics.
The subset of the CellSPA metrics used by Martinez-de-Morentin et al.
(Nat. Methods 2026) that needs no single-cell reference: segmentation yield
and transcript recovery (overall characteristics), transcripts and genes per
cell (cell-level QC), and cell morphology (area... |
e5817e14ab032df1a80916f6b159d865ba88f917548bb47c2431921920548e63 | Python | 8,132 | 235 | import pandas as pd
from pathlib import Path
import zarr
import numpy as np
from scipy.sparse import coo_matrix, spmatrix
import scipy.stats
import statsmodels.api as sm
import pickle
from plotnine import *
from deeprvat.data import DenseGTDataset
import copy
import click
import sys
import os
import logging
import yaml... |
427a9409920bfd86c8bafe4a00af3d094922240c96a04bc9c1bd1ff11ad0ccba | Python | 8,134 | 228 | """Reference-database helpers for 16S / amplicon pipelines.
Every function requires an explicit ``db_dir`` — no ``$HOME`` or other
implicit defaults. Downloads land directly under the caller-supplied path.
"""
from __future__ import annotations
import hashlib
import os
import shutil
import urllib.request
import warni... |
a6e1d76ebd4fb6eab294ea567bd21e90acd7ef418ab1682e92af0ce159156f92 | Python | 8,134 | 195 | import numpy as np
from numpy import linalg
import visionloader as vl
from typing import List, Tuple, Dict, Sequence, Optional, Set
import functools
def get_minmax_significant_ei_vectors (dataset : vl.VisionCellDataTable,
good_cell_list : Sequence[int],
... |
12e97b8308f33f1bc1f901af27047f04d2e4fceba84a8b0f743ecdc05040854a | Python | 8,136 | 267 | from __future__ import annotations
import sys
import warnings
from functools import cache, partial, wraps
from importlib.util import find_spec
from typing import TYPE_CHECKING, Literal, ParamSpec, TypeVar, cast, overload
from packaging.version import Version
from scipy import sparse
if TYPE_CHECKING:
from collec... |
cafa17dfae7b2ebddd968ac796b63087cb089ceb4b56708b466c5ab0f4319242 | Python | 8,139 | 221 | import torch
import torch.optim as optim
from torch.utils.data import Dataset, DataLoader
import pandas as pd
import numpy as np
import os
import random
from collections import defaultdict, Counter
from itertools import combinations
import json
import torch.nn as nn
import torch.nn.functional as F
from sklearn.model_se... |
0710f0e00304637d2ff7f3ef1b30dfa721e27889a7d640dec32cd786a7e3fe42 | Python | 8,141 | 230 | import os
import re
from typing import List, Optional, Set
from ci.ray_ci.doc.api import (
_SPHINX_AUTOCLASS_HEADER,
_SPHINX_AUTOSUMMARY_HEADER,
API,
)
_SPHINX_CURRENTMODULE_HEADER = ".. currentmodule::"
_SPHINX_TOCTREE_HEADER = ".. toctree::"
_SPHINX_INCLUDE_HEADER = ".. include::"
# A MyST landing page... |
f2c4144c3a0354a98ebc4098fcc1a9e120941fcc1193dc42a91c951b848c4567 | Python | 8,141 | 214 | import math
import itertools
import numpy as np
from torch import nn
from tqdm import tqdm
from math import sqrt
from torch.nn import Conv2d, Linear
import torch
from scipy.linalg import svd
def net_init(net, orth=0, w_fac=1.0, b_fac=0.0):
if orth:
for module in net:
if hasattr(module, 'weight... |
4b153f753dc5f78201748f84f8f0b1f860abecdee18e36692fae1ea42673feb6 | Python | 8,142 | 180 | #!/usr/bin/env python3
# FICLE
# Authors: Szi Kay Leung
__author__ = "S.K.Leung@exeter.ac.uk"
__version__ = '1.1.4' # Python 3.7
## Load Libraries
import gtfparse
from gtfparse import read_gtf
import pandas as pd
import numpy as np
import collections
from collections import Counter
import csv
import sys
import sys
... |
abac8e85c978680aef01b5754634a786152758d1e61a38d6b0f4191a9ed53620 | Python | 8,142 | 213 | #!/usr/bin/env python3
import os
import re
import sys
import copy
import argparse
import numpy as np
from aptnn.box import Box
from aptnn.io... |
fcd05aba03d169416d24a761653e4bc34691171a96f1aa7bc367645645d73ed0 | Python | 8,142 | 202 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Python version: 3.10.9
pandas version: 1.5.0
numpy version: 1.23.3
seaborn version: 0.11.0
matplotlib version: 3.6.3
pingouin version: 0.5.3
ptitprince version: 0.2.6
scipy version: 1.11.4
"""
#%% Import Modules
import pandas as pd
import numpy as np
import glob
impo... |
b647fb2707fe3698f4b2174cdd74abe50b90572e963d235f8c2680fb0eaefd45 | Python | 8,144 | 152 | import numpy as np
import scanpy as sc
import scvelo as scv
import anndata as ad
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.metrics.pairwise import cosine_similarity
from scipy.stats import spearmanr, pearsonr, sem
import pandas as pd
from ..utils import paired_cosine_similarity, average_velocity... |
575cd1fa2a1bc437142443b23f70ac6cd2b271e6700e12a3117168a560753432 | Python | 8,145 | 190 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Python version: 3.10.9
numpy version: 1.23.3
scipy version: 1.9.1
pandas version: 1.5.0
matplotlib version: 3.6.3
seaborn version: 0.11.0
pingouin version: 0.5.3
"""
#%% Import Modules
import os
import glob
import numpy as np
from scipy.interpolate import RegularGridI... |
89140bfa2d64a2aeacbac1066630a0fa50bc7aa81725c7da279edb46c07c863e | Python | 8,145 | 234 | __doc__ = """Estimate depths from BAM files of reads mapped to contigs.
Usage:
>>> bampaths = ['/path/to/bam1.bam', '/path/to/bam2.bam', '/path/to/bam3.bam']
>>> rpkms = Abundance.from_file(bampaths, metadata, True, 0.1, 3)
"""
import pycoverm
import os as _os
import numpy as _np
from math import isfinite
from vamb.p... |
a6a1d4418039bfbe7853d564256c04a70e5432014bb46707f8295f130ed46579 | Python | 8,147 | 223 | import os
import sys
from typing import Dict, Tuple
from unittest.mock import patch
import numpy as np
import pytest
import ray
from ray import train
from ray.train import ScalingConfig
from ray.train.constants import TRAIN_DATASET_KEY
if sys.version_info >= (3, 12):
# Tensorflow is not installed for Python 3.12... |
09aad0d0384e0d2d24adb58ddaf387b0ccd1860748725d7c3492028a3b523fc1 | Python | 8,148 | 262 | r"""Computes quantiles in a Dataset.
Example of getting quantiles of temperature by latitude, longitude, and level.
So we reduce over all other dims (in this case, "time").
```
export BUCKET=my-bucket
export PROJECT=my-project
python scripts/compute_quantiles.py \
--input_path=gs://weatherbench2/datasets... |
1375c2e765981b4b17e9e9bab129bd22708bef947210fd01498de80e7ed7688f | Python | 8,148 | 232 | """
This script calculates, then prints and plots the attenuation in firing rates
when moving between adjacent grid firing fields under the repetition
suppression hypothesis for different values of the adaptation parameters w_r
and tau_r. This is done for both aligned and misaligned runs. The attenuation
values were us... |
20cb854c9f8f710367f0eee95031dd8b068b6a405b764095deb6f969c700fb43 | Python | 8,149 | 210 | ####################################################################################################
# Copyright (c) 2016 - 2024, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# This program is fre... |
243c90cf1fbfc8d2beed75c01b921b72e65eee5dec5bd1f3307091d5eeb98005 | Python | 8,151 | 263 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
Test-only Triton kernel launchers.
These launchers directly invoke Triton kernels (bypassing @triton_op wrappers)
and use num_edges as GRID_E_... |
c4de4e29eb4c493f2e51f78e0b0fbe1200553b9f1f4033747461d8430a4e63b1 | Python | 8,151 | 193 | r"""Pathway search / retrosynthesis over a genome-scale reaction network.
Given a genome-scale model (the reaction database) and a target metabolite,
find routes that produce it — the design step of "which enzymes do I need to
express to make X?". A backward breadth-first search over the bipartite
metabolite–reaction ... |
0eaf23729f4896d9248b534b07418ff693516eee9625733628024c4b92e441d3 | Python | 8,153 | 199 | import torch
from ..utils import common_functions as c_f
from ..utils import loss_and_miner_utils as lmu
from ..miners.base_miner import BaseTupleMiner
class BatchEasyHardMiner(BaseTupleMiner):
HARD = "hard"
SEMIHARD = "semihard"
EASY = "easy"
ALL = "all"
all_batch_mining_strategies = [HARD, SEMI... |
11a81ab264d893b7d930d3215a76db045251b64c69c5f698dfd37e8e1ef92b18 | Python | 8,153 | 215 | # -*- coding: UTF-8 -*-
from datetime import datetime
import argparse
import logging
import os
import sys
root_dir = os.path.abspath(os.path.dirname(__file__))
sys.path.append(root_dir)
sys.path.append(os.path.join(root_dir, "models"))
from models.FCN import FCNs,VGGNet
from models.UNet_5 import UNet
from models.segn... |
1e383f5044c41cb783762bca057fa65f51325db0e04183f16b1e708c41ea1ecc | Python | 8,154 | 296 | import numpy as np
import matplotlib.pyplot as plt
import settings
import os
from scipy.stats import mannwhitneyu
###############################################################################
# Functions #
############################################... |
8cc56550cffe20cd07ffbe44a5d112e642e864211a4d6714a6f55b43d64a4845 | Python | 8,154 | 247 | # -*- coding: utf-8 -*-
from matplotlib import pyplot
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
# from openpyxl import Workbook
# tf.compat.v1.disable_eager_execution()
# from matplotlib_venn import venn3
#%%################################################... |
68a1f5aab5800f28666b8688d794fdd2e6f7cdd7ab38d9065ef5c1ba21a085c0 | Python | 8,155 | 176 | # This script generates a figure showing the correspondence between the spinal and vertebral levels.
# It also generates a CSV file with the distances from the PMJ to the middle of each spinal level.
# The script was inspired by script '03a_generate_figure_inter_rater_variablity-PMJ_COV.py':
# https://github.com/ivado... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.