sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
38d1ef05739faa165e08bcf5dff0105b796473fc86f067460c13c72c7470f5ec | Python | 6,236 | 160 | import numpy as np
import pandas as pd
from pgmpy.utils import preprocess_data
from ._base import BaseCITest, _CITestResult, _ResidualMixin
class GeneralizedCov(_ResidualMixin, BaseCITest):
r"""
Residual cross-covariance determinant CI test with permutation-based p-values [1].
This test first residuali... |
d0bdc44e295bdd5ab3c4159e5f5365dcb7ddda47e0fd12330c80f639ffbeaf85 | Python | 6,236 | 141 | import os
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from skimage import measure
import seaborn as sns
try:
from .functions import *
except ImportError:
from functions import *
def cycledegreesAuto(input, pxpermicron, filename, restrictdeg, outputimg, outputpath):
print("lets ... |
e93e70eea1287b0cd099a7ff965c6db49126e598dbee26877f4b0b6cc096a878 | Python | 6,236 | 95 | import numpy as np
from WeightModel.WeightClass import weightClass
from InitFunctions import gaussian
class STDP(weightClass):
parameters = {'save': False, 'Aprepost': 1., 'Apostpre': -0.5, 'tprepost': 10., 'tpostpre': 10.,
'nearest': False, 'alpha': 0., 'w_min': 0., 'w_max': 1., 'homeostasy': 0.... |
b04c94a42a1e6965535664ad093555a354458ea2c48f918534c94e0c16b3397b | Python | 6,239 | 207 | r"""A metric function module that is consist of a Metric class which incorporate many score and loss functions.
"""
from math import sqrt
import torch
from sklearn.metrics import roc_auc_score as sk_roc_auc, mean_squared_error, \
accuracy_score, average_precision_score, mean_absolute_error, f1_score, matthews_cor... |
6ac34bb72f6c9801e4759cd9d213e4a9ab596dcec1c0464926ec1e2f049fdcf8 | Python | 6,240 | 145 | """
Analyze subjects' estimate accuracy in terms of the closeness of their estimates
to the normative model estimate.
For plotting: The subject's estimates are aggregated by bin of model estimate
and averaged at the subject level, then statistics are computed at the group level.
For inferential statistics: The Pearson ... |
c0d83b70ccce25434acaf6d7df010d4f2e0a5b31e811056dfb98523593f59321 | Python | 6,240 | 131 | from pathlib import Path
import pytest
from cwas.core.annotation.vep import VepCmdGenerator
@pytest.fixture(scope="module")
def vep_path(cwas_workspace) -> str:
return str(cwas_workspace / "vep_mock")
@pytest.fixture(scope="module")
def input_vcf_path(cwas_workspace) -> str:
return str(cwas_workspace / "tes... |
f317d22b05c5e9e8b9dfe78d01dd79d2c1b92c5b27b3e0a5ce8c0869614e9d14 | Python | 6,246 | 178 | from collections.abc import Sequence
from typing import Any
from langchain_core._api import deprecated
from langchain_core.agents import AgentAction
from langchain_core.callbacks import BaseCallbackManager
from langchain_core.language_models import BaseLanguageModel
from langchain_core.prompts import BasePromptTemplat... |
8cc05c509ece28d6dabac03d9040de4a9862e00011237341392100110f22dc4f | Python | 6,247 | 180 | ####################################################################################
#
# STEPS - STochastic Engine for Pathway Simulation
# Copyright (C) 2007-2023 Okinawa Institute of Science and Technology, Japan.
# Copyright (C) 2003-2006 University of Antwerp, Belgium.
#
# See the file AUTHORS for d... |
df9089884e5263fb20ed5e068c2d7cf297a8d0ca23bef5b41436b6622e300f67 | Python | 6,248 | 180 | ####################################################################################
#
# STEPS - STochastic Engine for Pathway Simulation
# Copyright (C) 2007-2026 Okinawa Institute of Science and Technology, Japan.
# Copyright (C) 2003-2006 University of Antwerp, Belgium.
#
# See the file AUTHORS for detai... |
b5f665aabb9c89cfa9cda69231f356edf37e9b860ac11117b47597c929cdb358 | Python | 6,249 | 149 | """
This file collects all functions directly related to calculating
the four major components of ZephIR's loss function:
1. corr_loss: normalized correlation loss for image registration
2. reg_n: spring network maintaining flexible connections to nearest neighbors
3. reg_t: linear temporal smoothing across a small seq... |
c2075166bdd62184e8b80ccd0507c8fc1c4dcf3b1ea5d1bb3db514c854af3633 | Python | 6,249 | 110 | # 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... |
12c164ec9ff998d0b6c8211c10c56d31d37ef16274130c621b0a0fef3d864f7a | Python | 6,258 | 192 | """Additional axon processing options for all-active models"""
from neuron import h
from bmtk.simulator.bionet.pyfunction_cache import add_cell_processor
from bmtk.simulator.bionet.io_tools import io
from bmtk.simulator.bionet.default_setters.cell_models import fix_axon_peri, fix_axon_allactive, \
... |
1dd8a850ffb1d011b67397bfde98237b49c0251b2119d0acd03c616697cc6383 | Python | 6,258 | 154 | import unittest
import os
from EPI_MRI.EPIMRIDistortionCorrection import *
class TestEPIMRIDistortionCorrection(unittest.TestCase):
def setUp(self):
""" Initialize any common data or setup needed for the tests. """
torch.manual_seed(81) # reproducibility with randomness
self.device = 'cud... |
9f4df0a92fff3560db699eec83a497a4d48a2cd35c9456f3d41b58996c76c088 | Python | 6,259 | 235 | import json
import re
import tempfile
import time
import unicodedata
import uuid
from collections.abc import Iterable
from pathlib import Path
from typing import Union, List, Optional
from MRdataset.config import MRDS_EXT
def random_name() -> str:
"""
Function to generate a random identifier/name
Return... |
300fc2c2c66765c3cec830ffe3c866f57ca28997bc7e224601d14da441115bb1 | Python | 6,260 | 119 | import matplotlib
import matplotlib.pyplot as plt
import os
from Articles.Sequential_Learning_Striatum.Code.FigureSequential import *
name_Bernstein = ['IaF - Symmetric LTP','IaF - Hebbian','IaF - Symmetric LTD','IaF - Anti-Hebbian', 'Nonlinear - AH - No Inhibition', 'Nonlinear - AH - Inhibition']
name_single='single... |
32c71489d121b092c69f45110f37a23db386267a3062d57fd6784cd6adc4719e | Python | 6,260 | 165 | import math
import torch
from torch.optim import Optimizer
class RAdam(Optimizer):
def __init__(self, params, lr=1e-3, betas=(0.9, 0.999), eps=1e-8, weight_decay=0):
defaults = dict(lr=lr, betas=betas, eps=eps, weight_decay=weight_decay)
self.buffer = [[None, None, None] for ind in range(10)]
... |
def8103a8ecc4db0e7a9a98b693924d8d57519d4f7b00115425c14639e33efb9 | Python | 6,263 | 137 | import torch
import numpy as np
from nnsegnext.network_architecture.neural_network import SegmentationNetwork
import torch.nn as nn
import torch.nn.functional as F
class SegNet(SegmentationNetwork):
def __init__(self,input_nbr,label_nbr):
super(SegNet, self).__init__()
batchNorm_momentum = 0.1
... |
f122470a36ac925b0e1234952bb613867408aff9e5dfb40acb57090b91b9ba5e | Python | 6,265 | 169 | # This file is a part of the `allegro` package. Please see LICENSE and README at the root for information on using it.
from math import sqrt
import torch
from e3nn.o3._irreps import Irreps
from e3nn.util.jit import compile_mode
from nequip.data import AtomicDataDict
from nequip.nn import GraphModuleMixin, Seq... |
b63bf09b29cec0c9104a5b6e9805d95caa10f9b6855882930814e12bf205f48d | Python | 6,267 | 152 | """regression tests for two bugs that actually came up: uploading a textured
.obj failed with "no module named PIL", and meshes were rendering solid
black in the viewer.
root causes, checked directly rather than guessed at:
1. pillow wasn't in the dependency list - trimesh's OBJ/MTL loader needs it
to decode a refe... |
05ee6d45467f69dda3f235fc6807eefb14f35feb19c97fc53944bda79519a559 | Python | 6,269 | 113 | # New cli for testing
import logging
import os
import openmm.testInstallation
import click
import openmmtools.utils
# Setting logging level config
LOGLEVEL = os.environ.get("LOGLEVEL", "DEBUG").upper()
logging.basicConfig(
format="%(asctime)s %(levelname)-8s %(message)s",
level=LOGLEVEL,
datefmt="%Y-%m-%d... |
d48c330275cbd90bcce7b8904ebf599c7d7414a7bfe71e385b19ba71150436f4 | Python | 6,275 | 132 | import numpy as np
def prctile_norm(x, min_prc=0, max_prc=100):
y = (x-np.percentile(x, min_prc))/(np.percentile(x, max_prc)-np.percentile(x, min_prc)+1e-7)
y[y > 1] = 1
y[y < 0] = 0
return y
def read_mrc(filename, filetype='image'):
rec_header_dtd = \
[
("nx", "i4"), # N... |
c509e6730826af2ec6a60a58abe79d41e527f8b68256b78a3da36590a21d779f | Python | 6,281 | 135 | # 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... |
29585c0261c1381c9553092ad081bb9f588d0922c52c45968e187a49eb155978 | Python | 6,284 | 180 | """
Test storage layer.
"""
__author__ = 'John D. Chodera'
################################################################################
# IMPORTS
################################################################################
import os
import os.path
import tempfile
from functools import partial
from perses.s... |
7a978ca5898e0ed5a96cde966cd56d6c7a6491737ffa3b5034f4b9a322cb1bc5 | Python | 6,292 | 163 | import pandas as pd
import numpy as np
from numba import jit
import scipy.stats
# @jit(nopython=False)
def get_entropy(x):
entropy_list=[]
for i in sample:
arr=np.array(x[i])
if len(set(arr))==1:
entropy=0
else:
entropy=scipy.stats.entropy(arr[arr>0])
ent... |
5085b9b85b42b1e7c624995df4024b21de0eb5f86cffff225828b6c99e4ad96b | Python | 6,293 | 194 | import numpy as np
import warnings
from numbers import Number
from collections.abc import Iterable
from dataclasses import dataclass, field
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import matplotlib.lines as lines
@dataclass
class Box:
xy: tuple[int, int]
width: int
height: in... |
f41902438e6a1aa901a90b8b77bdf31ce6f850ccb1d2aeaf58ae155e15c6503b | Python | 6,294 | 192 | # -*- coding: utf-8 -*-
import serial
import time
import os
import sys
import numpy as np
import threading
import csv
import TriggerDevice
class hackkeySerialWin(serial.Serial):
def _reconfigure_port( self, *args, **kwargs ):
try:
super()._reconfigure_port( *args, **kwargs )
except ser... |
d96ef9d5f8a09839cb01baeeb35240a2fdf51d376b692c8223668c0be1da1d53 | Python | 6,295 | 208 | # Copyright 2021 AlQuraishi Laboratory
# Copyright 2021 DeepMind Technologies Limited
#
# 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
#
# U... |
feb1c9231101024e60eb3a19e26863cdc3564a801b50e3a07b657237b58ceada | Python | 6,295 | 157 | from typing import Union, Tuple
from torch_geometric.typing import OptPairTensor, Adj, OptTensor, Size
import torch
from torch import Tensor
from torch.nn import Parameter
from torch_geometric.nn.conv import MessagePassing
from torch_geometric.inits import zeros, glorot
from .get_edge_features import edge_pair_featur... |
aa1ae5eb2051f2c81f4e01b4d75db017a66d55e5d427e777facbfb6fee50565a | Python | 6,300 | 200 | import numpy
import torch
from utils import load_data, set_params, evaluate
from module import HeCo
import warnings
import datetime
import pickle as pkl
import os
import random
from utils.logger import setup_logger
warnings.filterwarnings('ignore')
import sys
import argparse
def train(args):
if not os.path.exists(... |
302bbe54879014d020a710d5783541b86b7a1422d061685d756338178b97a253 | Python | 6,305 | 147 | import argparse
import yaml
from os.path import join, basename
from sys import stderr
import numpy as np
def _load_and_setup_model(args, parsing=True):
from ccg.supertagger.parser import Parser
if parsing:
max_steps = args.max_steps
prune_beta = args.prune_beta
num_cpus = args.num_cpu... |
afa9a153aeb10f03bda7a9b196d8a5e1ef9e966161296b19962c9c611859c445 | Python | 6,306 | 128 | # 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... |
24b5862ae51f131ef79791802e6a4ca00f6ba45f549d9f598e9cbd17c0a0af68 | Python | 6,307 | 176 | from pathlib import Path
import shutil
import os
import pandas as pd
import pickle as pkl
import functools
import inspect
import hashlib
import copy
def hashfn(hashstr):
return hashlib.sha224(hashstr.encode('UTF-8')).hexdigest()
def run_exists(param_dict, output_dir):
"""
Check to see if a run matching ... |
70c9bdc0754d1965e7a0d84dcb3bf527d150b7b289e1794aeb344148c896c26b | Python | 6,311 | 103 | import numpy as np
from batchgenerators.utilities.file_and_folder_operations import *
from nnsegnext.dataset_conversion.utils import generate_dataset_json
from nnsegnext.paths import nnSegnext_raw_data, preprocessing_output_dir
from nnsegnext.utilities.file_conversions import convert_2d_image_to_nifti
if __name__ == '... |
5626714ce3b63eaddc7fcfa7db16b35444053944db56c28a3d9b438931e1ae55 | Python | 6,313 | 172 | """Single-directional boundary loss for weakly supervised training.
Adapted from the PyTorch3D Chamfer-distance implementation:
https://pytorch3d.readthedocs.io/en/latest/_modules/pytorch3d/loss/chamfer.html
PyTorch3D is required for this helper, but not for DDSurfer inference.
The PyTorch3D-derived code retains its ... |
bcf8eebbba3932c82a9892fc6ead665c1d902ef72923bd5c363c7ec76e1282b4 | Python | 6,317 | 173 | import torch
import torch.nn as nn
import numpy as np
class UNet(nn.Module):
def __init__(self, in_ch, out_ch, channels, skip_channels,
use_sigmoid=True, use_norm=True):
super(UNet, self).__init__()
assert (len(channels) == len(skip_channels))
self.scales = len(channels)
... |
42fecc885bf1fd9443e0bafaf7c9be16d63bf5b99e4dedfedfaf2f32630e6fb4 | Python | 6,320 | 182 | import sys
sys.path.append(".")
import os
import numpy as np
import random
import gzip
import argparse
import tarfile
import multiprocessing as mp
from tqdm import tqdm
try:
import cPickle as pickle
except ImportError:
import pickle
from crystallm import (
CIFTokenizer,
array_split,
)
def progress_li... |
5e014b61058f9e53b30eb0cc918b37422cf1b64c72de7a802c19c078ee1491a8 | Python | 6,320 | 161 | import pandas as pd
import numpy as np
from numba import jit
import scipy.stats
# @jit(nopython=False)
def get_entropy(x):
entropy_list=[]
for i in sample:
arr=np.array(x[i])
if len(set(arr))==1:
entropy=0
else:
entropy=scipy.stats.entropy(arr[arr>0])
ent... |
9e1425c3dbefa8775cd2773c2ba8d70d4a59c901de858a79966057c7eef38a96 | Python | 6,320 | 209 | # Copyright Generate Biomedicines, 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 applicable law or agreed to ... |
b8fa038c8bff3ce98b291b699d9172e69718d1bbc05c344ff0eb0b18b81af6ac | Python | 6,320 | 142 | # Imports
import sys
import os
import argparse
import inspect
from datetime import datetime
import numpy as np
import torch
import sklearn
import scipy
import tensorflow as tf
from tensorflow import keras
from scipy.integrate import odeint, solve_ivp
import umap
import pandas as pd
#from datagenerator import DataGen... |
af315ad28b84970534f7985da2f00e47f5afe4d50e5bbe5ab547ee82c22dba95 | Python | 6,322 | 180 | #!/usr/bin/env
"""
# Author: Kai Cao
# Modified from SCALEX
"""
import numpy as np
import torch
from torch.utils.data import BatchSampler, DataLoader, Dataset
from torch.utils.data import RandomSampler, SequentialSampler
from scipy.sparse import issparse
__all__ = ['SingleCellDataset', 'SingleCellDataset_vertical', '... |
aea30b092e40fe77cd54b6d2297980698a5793d4cca8c44319c4d29b9962eb2c | Python | 6,324 | 186 | """Transformer encoder and decoder for the de novo sequencing task."""
from collections.abc import Callable
import torch
from depthcharge.encoders import FloatEncoder, PeakEncoder, PositionalEncoder
from depthcharge.tokenizers import Tokenizer
from depthcharge.transformers import (
AnalyteTransformerDecoder,
... |
fdda01ac2b3ad71f53d503b5011c2f0416d09c9a41fb19862a1ad9972c1d0c12 | Python | 6,326 | 115 | # 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... |
c9962ff3d25477c8f5d35338fa9bbf97566fde9098a4c8e77f9cf10e5d0cbca6 | Python | 6,327 | 181 | """An agent designed to hold a conversation in addition to using tools."""
from __future__ import annotations
from collections.abc import Sequence
from typing import Any
from langchain_core._api import deprecated
from langchain_core.agents import AgentAction
from langchain_core.callbacks import BaseCallbackManager
f... |
db7af7449557697241f5985f6bd711f92ac475b70a0473bd05a78e07295a033c | Python | 6,328 | 170 |
import pandas as pd
import numpy as np
from PIL import Image
import torch
import pytorch_lightning as pl
from pytorch_lightning import seed_everything
import flash
from flash.core.classification import LabelsOutput
from flash.core.data.utils import download_data
from flash.image import ImageClassificationData, ImageCl... |
1a6c3652b114a09d5796d9ebe1aeaf97b580c8f2828670f82e75e5a3e3513d60 | Python | 6,329 | 170 |
import scanpy as sc, anndata as ad
import numpy as np
import pandas as pd
from sklearn.cluster import KMeans
from sklearn.metrics import adjusted_rand_score
if __name__ == "__main__":
path_rawdata_mouse = "./brain_human_mouse/human_brain_region_88_sparse.h5ad"
adata = sc.read_h5ad(path_rawdata_mouse)
... |
2c0f7218f115877d7a2733495e11bc6120066c8128531dad6ac47ad20b0187b3 | Python | 6,329 | 189 | """Chain that implements the ReAct paper from https://arxiv.org/pdf/2210.03629.pdf."""
from __future__ import annotations
from collections.abc import Sequence
from typing import TYPE_CHECKING, Any
from langchain_core._api import deprecated
from langchain_core.documents import Document
from langchain_core.language_mo... |
5185868bff4e0d0968f622d057caa94d9e70ea0875a0025f2656503af50249e7 | Python | 6,329 | 170 |
import scanpy as sc, anndata as ad
import numpy as np
import pandas as pd
from sklearn.cluster import KMeans
from sklearn.metrics import adjusted_rand_score
if __name__ == "__main__":
path_rawdata_mouse = "./brain_human_mouse/mouse_brain_region_67_sparse.h5ad"
adata = sc.read_h5ad(path_rawdata_mouse)
... |
747b2d13c049dd5da928f8187dea97370b28c420364dda01c7e8b23756505b91 | Python | 6,334 | 180 | import torch
from torch.distributions.categorical import Categorical
import numpy as np
from egnn.models import EGNN_dynamics_QM9
from equivariant_diffusion.en_diffusion import EnVariationalDiffusion
def get_model(args, device, dataset_info, dataloader_train):
histogram = dataset_info['n_nodes']
in_node_nf ... |
86a15c0c1dc99f664a5f3865b9e92fc0b014204fe5b06a043a41fc3dffb106ad | Python | 6,334 | 206 | import numpy as np
import torch
from torch.autograd import Variable
import torch.nn.functional as F
#%% Compute Statistics (Training Loss, Test Loss, Test Accuracy)
def compute_stats(X_train, y_train, X_test, y_test, opfun, accfun, ghost_batch=128):
"""
Computes training loss, test loss, and test accuracy eff... |
0c3c9a20e8c6f47f48e38f0c3fb64d490b28b4b16ca26fd41927b2eb933b5f2e | Python | 6,336 | 209 | import logging
import multiprocessing
import os
import random
from glob import glob
from pathlib import Path
from typing import List, Tuple, Union
import albumentations as albu
import cv2
import numpy as np
import pytorch_lightning as pl
from joblib import Parallel, delayed
from torch.utils.data import DataLoader, Dat... |
422339afec2d4a1521f4e246ff73c8b1afd97233d92e19a258dd1c280eee8111 | Python | 6,336 | 136 | import torch.nn as nn
import torch
from networks.utils import UnetConv3, UnetUp3_CT, UnetGridGatingSignal3, UnetDsv3
import torch.nn.functional as F
from networks.networks_other import init_weights
from networks.grid_attention_layer import GridAttentionBlock3D
class Attention_UNet(nn.Module):
def __init__(self, ... |
90f026b886567120b68327c95397e9b70f9978617fbf50e4091c72d8ce891c70 | Python | 6,341 | 179 | import sys
sys.path.append(".")
import os
import numpy as np
import random
import gzip
import argparse
import tarfile
import multiprocessing as mp
from tqdm import tqdm
try:
import cPickle as pickle
except ImportError:
import pickle
from mat2seq import CIFTokenizer
from crystallm import array_split
def progr... |
47151566de78bc73a9c4d2533f96ac329cd2a404a96028f32584e837e3b7b8fd | Python | 6,343 | 202 | '''
Author: Xiaoxiao Li
Date: 2019/02/24
'''
import os.path as osp
from os import listdir
import os
import glob
import h5py
import torch
import numpy as np
from scipy.io import loadmat
from imports.gdc import GDC
#from torch_geometric_data_hsm import Data
from torch_geometric.data import Data
import networkx as nx... |
9f50e37716a0485e4c2975bb98952e1ec980e0feda95a18a2926a8f43f9bd162 | Python | 6,346 | 202 | '''
Author: Xiaoxiao Li
Date: 2019/02/24
'''
import os.path as osp
from os import listdir
import os
import glob
import h5py
import torch
import numpy as np
from scipy.io import loadmat
from imports.gdc import GDC
#from torch_geometric_data_hsm import Data
from torch_geometric.data import Data
import networkx as nx... |
7adf85e2b2fe5a2d172b3d8e96095d92c73c680dbeaff3da276c700cc4e32e30 | Python | 6,351 | 198 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
np.random.seed(100)
get_ipython().run_line_magic('matplotlib', 'inline')
# %config InlineBackend.figure_format = 'retina'
import pingouin as pg
import matplotlib as mpl
mpl.rcP... |
5c45874a736257db02b00abd5d24231b8201a690ea62e108672ec529bd4fa366 | Python | 6,356 | 143 | """Functions for filtering, eg. removing low frequency component drift in data"""
################## MAY DEPRECATE THIS FILE IN THE FUTURE, get_freq_spectrum is moved
################## to preprocess.py, saving nodict version just in case we may need it.
from scipy.signal import lfilter, firls, decimate
import nitime.a... |
bf34dc173b3e7fe5babfd10e3411dc70497b4dd8f0902ad18d369d6ee293e3bf | Python | 6,359 | 192 | """
Code for interpolating missing slices from brains
"""
import os
from typing import Literal
import nibabel as nib
import numpy as np
from tqdm import tqdm
from scipy.interpolate import RegularGridInterpolator
BASEDIR = "/Users/mromano/research/data/rgan_data/"
def load_brain(fname: str, type_="Z") -> nib.Nifti1... |
fd96aa7766f2c3bb6251a79e335bb66a44e73bb92e290f6e681877cea72f0476 | Python | 6,364 | 165 | # Copyright 2026 DeepMind Technologies Limited.
#
# 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... |
2a314a318e30cc6235bf9337bb262fd2619e15f970b44a46041690609a7916f1 | Python | 6,366 | 156 | # Sconda conda activate ghmc1; cd /mnt/BioAdHoc/Groups/RaoLab/Edahi/Projects/09.TimeCourse5hmC/ForFerhatGit/GhmCN/reviewer_questions/plot_showing_significance_of_top_10_nearest_10; python
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from scipy.stats import ttest_rel
# Re-define the data se... |
08f2bf12d4810715a67c4860f43ca2b1b3023a1fa76e9dbbde09e1d522a8e2db | Python | 6,372 | 144 | import os
from copy import deepcopy
from collections import OrderedDict
from itertools import groupby
import warnings
import numpy as np
import matplotlib.pyplot as plt
def read_chronic_animal_npz(npzpath, keep_valid_only=True):
# TODO process keep_valid_only argument
npzdict = np.load(npzpath, allow_pickle=T... |
1291ca6be1736bb8fb109ab094b457ac6b0fb48533c7734cde01c558047a8f54 | Python | 6,378 | 193 | import json
import logging
import os
import time
from glob import glob
from typing import Generator, List, Tuple
import cv2
import hydra
import numpy as np
import torch
from omegaconf import DictConfig, OmegaConf
from PIL import Image
from tqdm import tqdm
from src import PROJECT_DIR
from src.models.smp.model import ... |
994760d655d39cdceab39c996e187a1927b3fee1e9e2446fda1855603f762996 | Python | 6,384 | 216 | import logging
import os
from pathlib import Path
from typing import List, Tuple
import cv2
import hydra
import numpy as np
import pandas as pd
from joblib import Parallel, delayed
from omegaconf import DictConfig, OmegaConf
from sklearn.model_selection import KFold
from tqdm import tqdm
from src import PROJECT_DIR
f... |
7ce865bc8a8c69bae959ab307cfe310ba742578786c5fd945eda0241d5bf84f6 | Python | 6,392 | 169 | import sys, os, time
sys.path.insert(0,os.path.join('..','..','..',))
from skimage.io import imread, imsave
import MLModel.train
import MLModel.io
import MLModel.predict
import DatasetTools.io
import scipy.ndimage as ndi
import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras imp... |
89157566599886584ca100e99eebb015292c6b49acb66abb6ea11b2db74f9d68 | Python | 6,395 | 213 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# perses documentation build configuration file, created by
# sphinx-quickstart on Sun May 14 17:09: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 this
# aut... |
c30f1a0b8a258d14930f0dc961de8eea217e73a755e6d32ac4c469eee32451a6 | Python | 6,395 | 162 | # Sconda conda activate abc; cd /mnt/BioAdHoc/Groups/RaoLab/Edahi/Projects/09.TimeCourse5hmC/ForFerhatGit/FCDNN/results/cross_validation_allsamples/; python
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import numpy as np
# Load the CSV file into a DataFrame
file_path = './FILTERED_cross_va... |
12645b42be4c4382c8576b518117b01f74593368305b0f2fea178027ca3ce379 | Python | 6,397 | 203 | """Tests for the time-weighted retriever class."""
from collections.abc import Iterable
from datetime import datetime, timedelta
from typing import Any
import pytest
from langchain_core.documents import Document
from langchain_core.embeddings import Embeddings
from langchain_core.vectorstores import VectorStore
from ... |
4dd93f1171445c09a5b5b622ac69874c82e3c90c7461a6ffa1062ab39c9677e4 | Python | 6,399 | 165 | import tensorflow as tf
from absl.flags import FLAGS
#import ipdb
@tf.function
def transform_targets_for_output(y_true, grid_size_w, grid_size_h, anchor_idxs):
# y_true: (N, boxes, (x1, y1, x2, y2, class, best_anchor))
N = tf.shape(y_true)[0]
#breakpoint()
# y_true_out: (N, grid, grid, anchors, ... |
36f7be76c166b2dbbccc5c538f02647b0d0e975d1cf511d14c352c2e35ecde69 | Python | 6,401 | 178 | import Bio.SeqIO as sio
import tensorflow as tf
import numpy as np
from sklearn.preprocessing import LabelBinarizer
from tensorflow.keras.utils import to_categorical
import random
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '3'
import tqdm
#load model
filterm = tf.keras.models.load_model(os.path.join(os.path.dirnam... |
bf6461c526d37ecc8016a6c0f5384d904dbae282697db30e453caf5e0ca2f3f5 | Python | 6,404 | 153 | # -*- coding: utf-8 -*-
"""
Created on Thu Apr 22 15:39:55 2021
@author: yw_ji
"""
import os
import numpy as np
import pandas as pd
import scanpy as sc
import anndata as ad
# import seaborn as sns
# import matplotlib.pyplot as plt
from tqdm import tqdm
os.chdir('C:/Users/yw_ji/Documents/MSc Thesis/dice/')
#%%
wu_m... |
e80dd5025ec882dcde47372b5e38759a74850def1e219cb0f7269449b694a06f | Python | 6,404 | 189 | from mpl_toolkits.axes_grid1 import make_axes_locatable
import matplotlib.gridspec as gridspec
from paths import TEST_DATA_PATH, EXAMPLE_PATH, TRAINING_DATA_PATH
from matplotlib_scalebar.scalebar import ScaleBar
import umap
from matplotlib.colors import LinearSegmentedColormap
from utils.io import preprocess_data
impor... |
dfb51f76e1e4f25c50849c042f4172d7fdf02db55400eb15277af5c9ed0d175e | Python | 6,412 | 173 | # coding: utf-8
""" MIT License """
'''
Project: Parenchymal Attention Network
Authors: Axel Masquelin
Description: Secondary Analysis showing the distribution of performance across all runs
'''
# Libraries
# ---------------------------------------------------------------------------- #
from sklearn.metrics... |
9fc7d4ba9edb734bbf7a0623d100662eab8a5e155f3d10984355865a030637d1 | Python | 6,413 | 171 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@Description: :
@Date : 2022/07/16 17:57:28
@Author : Zilan Yu
@version : 1.0
'''
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_geometric.nn import SAGEConv, HeteroConv, Linear, TransformerConv, FiLMConv
import torchm... |
8267817be3c52b5eb86af473647e6ee4d7b0482b79161da59f191d8fc946349a | Python | 6,414 | 183 | import numpy as np
import pyemma
from pyemma.util.contexts import settings
import MDAnalysis as mda
import matplotlib.pyplot as plt
from pensa.preprocessing import sort_coordinates, merge_and_sort_coordinates
def project_on_eigenvector(data, ev_idx, ana):
"""
Projects a trajectory onto an eigenvector of its P... |
faeff9a4bd347085c2376400461d061634c87cda76b07617c1319bd58a168854 | Python | 6,414 | 191 |
import scanpy as sc, anndata as ad
import numpy as np
import pandas as pd
from sklearn.cluster import KMeans
from sklearn.metrics import adjusted_rand_score
import matplotlib.pyplot as plt
import re, seaborn as sns
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.colors import ListedColormap
if __name__ =... |
0050c7d1873c0152ad4ae32973ee4515f9ec513bc7caf750b328228599a52929 | Python | 6,415 | 209 | from hummuspy.create_multilayer import Multixrank
import os
import numpy
import pandas
def compute_RandomWalk(
multiplex,
bipartite,
eta,
lamb,
seeds,
self_loops=True,
restart_proba=0.7,
pr=None,
save=True,
output_f=None,
return_d... |
e68952617b0d02eb6648f92c0da763d9e5111d5e1a60534e1564405eec67fb3f | Python | 6,416 | 133 | """ Import Proteome Discoverer Output
Proteome Discoverer (PD) allows user to export proteomic
quantitative data as .xlsx.
@author: Reis-de-Oliveira G <guioliveirareis@gmail.com>
"""
import numpy as np
import pandas as pd
class Input:
def __init__(self, Table, **kwargs):
""" Proteome ... |
644e49d61095072cbb0cd622e5d67dcc03facf041f636da2eeea40f15b691152 | Python | 6,417 | 156 | import importlib
from collections.abc import Callable
from typing import Any
from langchain_core._api import internal, warn_deprecated
from langchain_classic._api.interactive_env import is_interactive_env
ALLOWED_TOP_LEVEL_PKGS = {
"langchain_community",
"langchain_core",
"langchain_classic",
}
def cre... |
91d0ccec2b495698c16cce24eecc20364f9ade3b86bca14751b842b4695e44da | Python | 6,417 | 252 | """
:AUTHORS: Martin M. Müller
:ORGANIZATION: Department of Neurobiology, Bielefeld University
:CONTACT: martin.mueller@uni-bielefeld.de
:SINCE: Wed Nov 17 11:35:01 2021
"""
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import ticker
import matplotlib.colors as colors
from utilities import mle_vis... |
0f1807ffb0fd7fde9cf6ba9ee5c026d72200124d1f3cbf36ad138a7ed9c92c66 | Python | 6,418 | 213 | """Test PydanticOutputParser."""
import sys
from enum import Enum
from typing import Literal
import pydantic
import pytest
from pydantic import BaseModel, Field
from pydantic.v1 import BaseModel as V1BaseModel
from langchain_core.exceptions import OutputParserException
from langchain_core.language_models import Parr... |
fd02d436040c702e7417687e8a071a6a2a4d7bc3383a91147692c33723e33f42 | Python | 6,418 | 161 | import math
import h5py
import nibabel as nib
import numpy as np
import SimpleITK as sitk
import torch
import torch.nn.functional as F
from medpy import metric
from skimage.measure import label
from tqdm import tqdm
def test_single_case(net, image, stride_xy, stride_z, patch_size, num_classes=1):
w, h, d = image... |
d3c891a44de641bdf359e69ff6b7e2252f181eb5b1d07ff3720899e2a2d63d29 | Python | 6,425 | 167 | from copy import deepcopy
from itertools import product
from pathlib import Path
import pytest
from hypothesis import given, settings, HealthCheck
from MRdataset.tests.conftest import dcm_dataset_strategy, \
vertical_dataset_strategy
from MRdataset.utils import convert2ascii
THIS_DIR = Path(__file__).parent.reso... |
3611529d00b4cb59febbaa4d205660ce344493275ce0d1092484eff965b1b509 | Python | 6,426 | 154 | """
Plot the dynamics of the different normative model variables over the
course of a sequence for an example sequence.
"""
import argparse
import data_analysis_utils as dana
import itertools
import matplotlib.pyplot as plt
import matplotlib.ticker
import model_learner as model
import numpy as np
import os.path as op... |
ef8b71a71bfb95bf54a5b5dedb324f1e849d6e08892d8717b6de1318d5908840 | Python | 6,426 | 168 | import numpy as np
import os
import torch
import torch.nn as nn
from seq_des import *
import seq_des.sampler as sampler
import seq_des.models as models
import common.run_manager
import common.atoms
import sys
import pickle
import glob
from pyrosetta.rosetta.protocols.simple_filters import BuriedUnsatHbondFilterCrea... |
a318153c3ff672fc482500b7f1962a62eeba6b3aea0587f796c8fdfc6b0ff258 | Python | 6,427 | 116 | # New cli for testing
import logging
import os
import openmm.testInstallation
from cloudpathlib import AnyPath
import click
import openmmtools.utils
# Setting logging level config
LOGLEVEL = os.environ.get("LOGLEVEL", "WARNING").upper()
_logger = logging.getLogger()
_logger.setLevel(LOGLEVEL)
percy = """
MMMMMMMMMM... |
b775ba1ebd2d69f8183960bee0615ce54ca18d3d08de5d67c0ac167b29687624 | Python | 6,431 | 245 | # https://raw.githubusercontent.com/google-research/fixmatch/master/libml/ctaugment.py
#
# Copyright 2019 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... |
1f9ac405b51e37f8cbe1ec429b0ca1b749ac811e83a8a7c05fb6c2555fa666ee | Python | 6,432 | 160 | import zmq
import pyqtgraph as pg
from PyQt5.QtWidgets import QMainWindow, QFileDialog
from PyQt5.QtCore import pyqtSignal, QThread
from monitoring.spkmon.spkmon.ui.main_window_ui import Ui_MainWindow
from monitoring.spkmon.spkmon.settings.defaults import *
from monitoring.spkmon.spkmon.settings.con... |
612bdb7e39fe1ba3f78e115310c46d1f48b91057c9defba097bf5a930e47bf13 | Python | 6,433 | 142 | '''
preprocess rhd files into mda files;
called from <repo_dir>/main_runnables/preprop_and_sort.py
8/31/2022 jz103
'''
import os
import gc
import warnings
from copy import deepcopy
from time import time
import numpy as np
# import pandas as pd
# from scipy.io import loadmat, savemat
from .load_intan_rhd_format impor... |
b248a817d5e24f8af73a88f7f2c852e18bb3b1320ee5a4e1178bde8190faa534 | Python | 6,437 | 190 | """
L-BFGS Tests
Tests L-BFGS implementation on common unconstrained optimization test problems
from the CUTEst test problem set.
Implemented by: Hao-Jun Michael Shi and Dheevatsa Mudigere
Last edited 9/21/18.
Requirements:
- NumPy
- PyTorch
- CUTEst
- PyCUTEst (https://jfowkes.github.io/pycutest/_bu... |
b10da227d1eca5a511fb61d8992b7076fab17548981cb91ff3147f5c4ab8b013 | Python | 6,439 | 145 | import numpy as np
import torch
from omegaconf import OmegaConf
from scipy import ndimage
from dipy.data import fetch_stanford_hardi, read_stanford_hardi, read_stanford_t1, read_stanford_pve_maps
from dipy.denoise.localpca import mppca
from dipy.denoise.patch2self import patch2self
from dipy.align.reslice import resli... |
210df4ea058e80af753dff6e6888469f2e4132e30d0462fe6710630ad6da548c | Python | 6,440 | 184 | import torch
import torch.nn as nn
from h3xsemble.utils.rigid_utils import Rotation, Rigid, rot_matmul
import numpy as np
from h3xsemble.utils.residue_constants import rigid_group_atom_positions
from h3xsemble.utils.rigid_utils import Rotation, Rigid
def clone_rigid(input_r, do_detach=True):
if do_detach:
... |
fa0d22f29615cffa2904575cdb1278fa7863c2174073b2a7d24fca89e41df2d7 | Python | 6,445 | 201 | import numpy as np
from bernn.utils.mlflow_compat import mlflow
from scipy.spatial.distance import cdist, pdist
from scipy.stats import norm
from statistics import NormalDist
norm.cdf(1.96)
from scipy.stats import multivariate_normal
from scipy.stats import pearsonr, f_oneway
# https://stackoverflow.com/questions/32... |
14667bbf2865f3e05cc4e29b99a29c9b1655b375d2994000d479e5ba9a4a2f63 | Python | 6,451 | 151 | import matplotlib
import matplotlib.pyplot as plt
import numpy as np
from Simulator.SimulatorPatternDual import simulatorPatternDual
from FiguresFunctions.FiguresPattern import *
from matplotlib.lines import Line2D
font = {'size' : 16}
matplotlib.rc('font', **font)
custom_lines = [Line2D([0], [0], color=colors[c_l... |
af02925c422a2e10405fb98ac76c79f3ae043e819d613fd9b8245f8ab93765b7 | Python | 6,452 | 190 | import os
import sys
import re
import types
import itertools
import matplotlib.pyplot as plt
import numpy
import numpy.ma
import Stats
import Histogram
import cpgReport
from cgatReport.Tracker import *
from cgatReport.odict import OrderedDict as odict
##################################################################... |
69c5585a388389b89e46072111aba268f2fe1af0eaaa2a82bb75261a52604021 | Python | 6,453 | 183 | import tensorflow as tf
from anndata import AnnData
from scim.evaluate import score_divergence
def switch_obsm(adata, obsm_key, X_name='X'):
new = AnnData(X=adata.obsm[obsm_key],
obs=adata.obs,
obsm=adata.obsm,
uns=adata.uns)
new.obsm[X_name] = adata.X
... |
e8ccdb7169425f62e8072767725329c4d57d4f64c815792e02ec1a64778ade45 | Python | 6,454 | 138 | # 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... |
cb5f67c2667485258518e68ddb8a59c08aff4d1cf881e2c84fe78c5e284efdec | Python | 6,457 | 153 | from collections import Counter
import logging
import numpy as np
logging.basicConfig(
format='%(asctime)s : %(levelname)s : %(message)s',
datefmt='%d-%b-%y %H:%M:%S',
level=logging.INFO
)
def compute_i2c2(
y: np.array, n_subjects: int, n_scans: int,
demean: bool = True, twoway: bool = T... |
f09eb397a905c4c7730b592661dcf698b5216e31569f6cf6fb1697eeb25856dd | Python | 6,457 | 87 | """fig09: empirical coverage vs nominal coverage (calibration curves) for split vs shift-matched under P3 and P4.
fig12: density-ratio weight distributions and effective calibration size per held-out dataset (P4).
fig13: example cell trajectories (one per held-out dataset, P4) with split and shift-matched 90% intervals... |
1eb7fd7e54df72315f8df4ad8f28d7c81a344056fffc1b1ad56c8c994d30878e | Python | 6,466 | 179 | #!/usr/local/bin/env python
"""
Test storageinterface.py facility.
The tests are written around the netcdf storage handler for its asserts (its default)
Testing the storage handlers themselves should be left to the test_storage_iodrivers.py file
"""
# ================================================================... |
245e6582fcb8c0c066f0f9aab194070f61357344caf69481746fddab0dd712de | Python | 6,466 | 141 | import torch.nn as nn
import torch
import numpy as np
import torch.nn.functional as F
import torch.optim as optim
from torch.autograd import Variable
import os
import sys
from VGGgap_3D import VGGgap
import nibabel as nib
import scipy.io as io
from cams import Cams
import cv2
def backward_hook(module, grad_in, grad_ou... |
628ffbe321bf87adef84cbec5b319dc2ff68e0ec9648d42a50872e70f3aac466 | Python | 6,468 | 181 | # Copyright 2020 DeepMind Technologies Limited.
#
# 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.