sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
4db33df3872eae6f6893c807c7546b3ae8d6ae64bb77f268f5e246484f8e4594 | Python | 6,890 | 160 | import logging
import numpy as np
from tqdm import tqdm
import itertools
from joblib import Parallel, delayed
from ..models.functions.rician_mean import rice_mean
def find_nls_initialization(
signal, sigma, nb_estimates, acq_param, microstruct_model, grid_search_param_lim, debug=False
):
"""
Find the init... |
4abaae09fb7192ca11a898d98abff8edaf47908a67b6ce77d1d67154ace5e946 | Python | 6,891 | 167 | #!/usr/bin/env python
import sys, argparse
from argparse import RawTextHelpFormatter
#######################################################
### 0. script description, arguments, and functions ###
#######################################################
## 0.0 synopsis
synopsis1 = "\
- add <file2> to <file1>, by matc... |
da829a0f7a4668f91a9d642a934fca52cfd9fb6a1ad933f2b23706397bab3ecc | Python | 6,892 | 195 | import torch
import torch.nn as nn
import numpy as np
import scipy.ndimage as snd
from torch.autograd import Variable
from dataset import VolumeDataset, BlockDataset
from torch.utils.data import DataLoader
from model import UNet2d
import os, sys
import nibabel as nib
import pickle
import argparse
class MyParser(argpar... |
28aa1eabecc9c678302d05e7bbebcfded517c327fc4a7fab5288d2ef0017df3f | Python | 6,893 | 167 | """Test nimare.meta.kernel (CBMA kernel estimators)."""
import nibabel as nib
import numpy as np
import pytest
from scipy.ndimage.measurements import center_of_mass
from nimare.meta import kernel
from nimare.utils import get_masker, get_template, mm2vox
@pytest.mark.parametrize(
"kern, res, param, return_type, k... |
272c37a0901d33279ebb67ebcf773be1d0835eb0760f489502fc75b0c7b55e10 | Python | 6,897 | 159 | """Public BAMPE regressions for #806, including bounded native probes."""
import json
import struct
import subprocess
import sys
import pytest
from conftest import macs3_env
from test_Parser_bam_truncation import write_bam
HEADER = (b'BAM\1' + struct.pack('<ii', 0, 2)
+ struct.pack('<i', 5) + b'chr1\0' +... |
afb25bb7c460b6d36dcec781ad1ba92eac7f3247905c2c7c20b78c987c650176 | Python | 6,897 | 192 | import argparse
import json
import logging
import os
import sys
from concurrent.futures import ProcessPoolExecutor
from functools import reduce
from pathlib import Path
logger = logging.getLogger(__name__)
def _define_args():
args_parser = argparse.ArgumentParser()
args_parser.add_argument('--what',
... |
e91269921699dd09d5e4b87b23b08aca951815bee2e6ae2cf4c8211fd4b9b989 | Python | 6,900 | 203 | import io
from concurrent.futures import ThreadPoolExecutor
import pytest
from rich.console import Console
from pyaging.logger._live import ClockRunDisplay, SimpleStep, display_enabled
@pytest.fixture
def hf_progress_settings():
"""Restore the public HF settings touched by the progress tests."""
from huggin... |
01ef99806f379837369757c5c776c5e638c8a07bdb12c41e3e345c90ea4de1ca | Python | 6,901 | 173 | """
Main training script
"""
import pandas as pd
import os
import torch.nn as nn
import torch.backends.cudnn as cudnn
import torch.utils.data
from utils.utils import set_seed
from utils.segmentation_training_utils import validate, train
from datasets.skinSegmentationDatasetOptical import SkinSegmentationDataset, get_... |
9d34c31493c0f99ac094ee4e68c876ca9249e9f3ef7224eea9fdf455e1d15285 | Python | 6,904 | 185 | """Tests for Fast Fourier Operator class."""
from collections.abc import Sequence
import numpy as np
import pytest
import torch
from mrpro.data import SpatialDimension
from mrpro.operators import FastFourierOp
from mrpro.utils import RandomGenerator
from tests import (
dotproduct_adjointness_test,
forward_mo... |
d6446ba3c65a49dc5543e53528b1015d5d21d8bd6c81b04234af8fc0ffea2571 | Python | 6,904 | 183 | """feather-format compat"""
from __future__ import annotations
from typing import (
TYPE_CHECKING,
Any,
)
import warnings
from pandas._libs import lib
from pandas.compat._optional import import_optional_dependency
from pandas.util._decorators import set_module
from pandas.util._validators import check_dtype_... |
8581ed2249fdb73c591341cc981e0fd2d7eda5887daaa00c598308e4efa78fd3 | Python | 6,905 | 191 | import numpy as np
import pytest
from pandas.errors import Pandas4Warning
import pandas as pd
import pandas._testing as tm
from pandas.tseries.offsets import (
Day,
Second,
)
class TestTimedeltas:
def test_timedelta_range_unit(self):
# GH#49824
tdi = pd.timedelta_range("0 Days", periods... |
e2c940d12ba26fe0eb553f954f9bcb52d8981cb808f15603f1d68f94d82aef93 | Python | 6,912 | 173 | import torch
from torch import Tensor
import torch.nn.functional as F
from torch.nn import Sequential, Linear, BatchNorm1d
import torch_geometric
from torch_geometric.nn import (
Set2Set,
global_mean_pool,
global_add_pool,
global_max_pool,
GCNConv,
)
from torch_scatter import scatter_mea... |
a541bc77e5ced760ebff381d963ad252aa80278f3a008749c872ed61eedd150e | Python | 6,913 | 172 | import torch
from torch import Tensor
import torch.nn.functional as F
from torch.nn import Sequential, Linear, BatchNorm1d
import torch_geometric
from torch_geometric.nn import (
Set2Set,
global_mean_pool,
global_add_pool,
global_max_pool,
)
from torch_scatter import scatter_mean, scatter_add, scatter_m... |
cd61f4cfc72bc987d7be43ee358bf464c570a2c081d14d8976ead7fc37b31795 | Python | 6,913 | 201 | import sys
import multiprocessing
import time
import os
import subprocess
import warnings
import copy
import setproctitle
setproctitle.setproctitle("DASDC")
import numpy as np
from script_real_fev import readtools
from script_real_fev import write_real_fev
from util import window_tools
from util.tools_... |
f461d5266137ae603db88d2a639af4abfa3b41ff0f1d8f9b7af6f3f2f5506d13 | Python | 6,914 | 222 | # Copyright 2018-2024 Xanadu Quantum Technologies 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... |
8964c344430e538ef6d57e57f274ffbc606949cd37f752aed96136ea35fcc560 | Python | 6,916 | 172 | import run_LFP
import numpy as np
import matplotlib.pyplot as plt
import sys
import os
from kcsd import sKCSD, sKCSDcell, KCSD3D
from kcsd import sKCSD_utils as utils
import kcsd.validation.plotting_functions as pl
import sKCSD_utils
import run_LFP
n_src = 1024
dt = 0.5
tolerance = 10e-6
cmap = plt.cm.bwr_r
n = 100
xmi... |
a3ea9e1314c8ca8e6b063068e649839d219a3748e8e4845a9bf295682fed46fc | Python | 6,918 | 219 | """
Unit tests of some functionality in ensemble.py when the parameters are named
"""
import string
from unittest import TestCase
import numpy as np
import pytest
from emcee.ensemble import EnsembleSampler, ndarray_to_list_of_dicts
class TestNP2ListOfDicts(TestCase):
def test_ndarray_to_list_of_dicts(self):
... |
c59c239e7f946becbce7b52d4fb97a7bf3aba11887585a72af5ccbffebb1955e | Python | 6,919 | 188 | from torch.utils.data import Dataset
import numpy as np
import os, cv2, time, math
from PIL import Image
from datasets.data_io import *
# the DTU dataset preprocessed by Yao Yao (only for training)
class MVSDataset(Dataset):
def __init__(self, datapath, listfile, mode, nviews, ndepths=192, interval_scale=1.06, *... |
5231153cb7bae8b114f40f77665cc2b7a075aa8eb29a4d2677aadea0950ac727 | Python | 6,920 | 187 | # Copyright 2018-2022 Xanadu Quantum Technologies 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... |
86fe6afc8611b9fa34623f5a37bca2949cb0f102b488672880e85c0b7bdf6e1e | Python | 6,922 | 195 | # Copyright 2022 Xanadu Quantum Technologies 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 agre... |
78cd29890516bf64b5128f553d68a685e7a454899ca7fd4efd76c521cb4fb539 | Python | 6,923 | 213 | import os
from os.path import join
from itertools import chain
import argparse
import yaml
import pandas as pd
import numpy as np
import sklearn
import sklearn.model_selection
import sklearn.preprocessing
import sklearn.ensemble
import sklearn.manifold
import sklearn.linear_model
import sklearn.svm
import torch
impo... |
f22ba93ee68837a46c48356e64fdcbd243e866d509d1da6b499e5384da3f2108 | Python | 6,923 | 168 | # Copyright 2018-2021 Xanadu Quantum Technologies 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... |
94daed644834868abe1a802bef3c2af29c920bbde3b58a6c9d8de1029d9390f7 | Python | 6,927 | 167 | # Copyright 2026 Xanadu Quantum Technologies 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 agre... |
e1d705a68f4f9b9decc60c061a1b4a02e5101dba117fc36e6f713435936167c0 | Python | 6,928 | 199 | #!/usr/bin/env python3
import argparse
import os
import platform
import shlex
import yaml
os.environ["MPLCONFIGDIR"] = "./tmp/mpl"
os.environ["NUMBA_CACHE_DIR"] = "./tmp/numba"
import matplotlib
import pandas as pd
import scanpy as sc
import scanpy.external as sce
class Arguments:
# adopted from mygene module... |
8361494c10e54c7d5c76eb78c47c59944279796823bf8bc3a7f9961d971539cb | Python | 6,929 | 198 | import numpy as np
import pytest
from pandas.core.dtypes.cast import construct_1d_object_array_from_listlike
from pandas.core.dtypes.common import is_extension_array_dtype
from pandas.core.dtypes.dtypes import ExtensionDtype
import pandas as pd
import pandas._testing as tm
from pandas.api.extensions import ExtensionA... |
562c74bdff92016a460a12e76a3fed75a1dc90c856b6f099d59bddced4d32989 | Python | 6,931 | 190 | """Session 30 — drain internal training-state attrs off self._legacy.
After session 29 promoted user-facing accessors to ``self._fit_state``,
six *internal* legacy reads remained inside the drained verbs:
- ``self._legacy.X_train_transformed``
- ``self._legacy.y_train_transformed``
- ``self._legacy.X_transforme... |
d564ce9875ae86f62550b1827eb691a8b33d942e28ae13d28aaec8b311b0d539 | Python | 6,936 | 160 | # Copyright 2018-2022 Xanadu Quantum Technologies 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... |
954e63b6f3f8967b185fbcc6a984e36dc8ce816ae832ac23584cabe91efc09cb | Python | 6,938 | 210 | import logging
from typing import List, Optional, Tuple, cast
import torch
import numpy as np
from .registration import SliceToVolumeRegistration
from .outlier import EM, global_ncc_exclusion, local_ssim_exclusion
from .reconstruction import (
psf_reconstruction,
srr_update,
simulate_slices,
slices_scal... |
fe008c2773df63389ca5c322096fe3ad99f0f7da38a7bbb78ff97788dccf1bf4 | Python | 6,941 | 197 | """
Main network configuration and hyperparameters
Copyright (c) Pedro F. Proenza
"""
import math
import numpy as np
# Base Configuration Class
class Config:
"""Base configuration class. For custom configurations, create a
sub-class that inherits from this one and override properties
that need to be ch... |
9646bcf22e95e490df22a45c446d4be7e872b989cd8ceea4f08a265222d8b128 | Python | 6,942 | 172 | from __future__ import print_function
import tensorflow as tf
import tensorflow.contrib.slim as slim
import os
import sys
from absl import flags
import numpy as np
npa = np.array
DEFAULT_IMAGE_SHAPE = (1, 299, 299, 1)
class Model(object):
def __init__(self, checkpoint_path, model_name, image=None, num_classes=10... |
9e774e9f687eadf4ede95fb5d658d5057858f2620985c997822ddafe61bc928a | Python | 6,945 | 162 |
import os
os.chdir('/gpfs/data/brownrlab/radhika/solo-learn-main')
import sys
sys.path.append('/gpfs/data/brownrlab/radhika/solo-learn-main/')
import numpy as np
import torch
import torch.nn as nn
from torchvision.models import resnet18, alexnet
import torch.nn.functional as F
import yaml
import warnings
import types
... |
071d822e9eb71ed25ecc2c0993e9e16a58c86755aff13b51f67481a5fa0601b5 | Python | 6,946 | 186 | import dataclasses
from typing import List, Literal, Tuple, Union
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib.figure import Figure
from matplotlib.cm import ScalarMappable
from .common import Palette
@dataclasses.dataclass(init... |
73924bf843567ed2646dde61d50b1bb36330643fd53e395a1dc9683539ceb5b5 | Python | 6,946 | 179 | """RMS advantage normalization (normalize_rms_advantage) revival tests.
The feature was dead since #315: the first statistics update assigned plain
tensors to nn.Parameter attributes (TypeError), the mask argument was
silently ignored, and PpoDiagnostics referenced attribute names from the
pre-#231 predecessor class. ... |
a00edeb3f532f7ea970ad052d4ebba936aa9665e21c61ea3e0746c508625cf21 | Python | 6,946 | 215 | """
This is a wrapper of MONAIfbs.
See https://github.com/gift-surg/MONAIfbs for more details.
"""
import torch
from typing import List
import os
import tarfile
import importlib
import torch.nn.functional as F
from math import ceil
import numpy as np
import logging
from skimage.morphology import dilation, disk
from s... |
6493f97c1e2e4e1b79eb4eb4d8cd3aa864191f48b5a6ebf046ecb562b6e6a96d | Python | 6,948 | 184 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
class TestDataFrameSetItem:
def test_isetitem_ea_df(self):
# GH#49922
df = pd.DataFrame([[1, 2, 3], [4, 5, 6]])
rhs = pd.DataFrame([[11, 12], [13, 14]], dtype="Int64")
df.isetitem([0, 1], rhs)
... |
d08b4e9680675d7751189f894fb8016a8eb63430e32141171bb8559c3c3afb51 | Python | 6,949 | 184 | # -*- coding: utf-8 -*-
# Copyright (C) 2019 Andrea Vázquez Varela
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#... |
0368717ca0fa973458a4b86acf19482f2de35a98707cebe1936c10dc32e8e1c9 | Python | 6,954 | 255 | # Copyright 2018-2024 Xanadu Quantum Technologies 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... |
4ee5e6072b0035eb72bfe8ba212b1bbfc6897f245c0bad8904b2133901a74ba1 | Python | 6,959 | 266 | """
Common statistical testing routines
Designed to accompany the paper "Network-level encoding of local
neurotransmitters in cortical astrocytes" (DOI: TODO)
"""
## ------------------------------------------------------------------------ ##
## Imports
## -------------------------------------------------------------... |
02d49600ab6fa179fcd99e172ddcd07d1a5b2f3ee6a070f5ed1c2fbe29f156ae | Python | 6,961 | 132 | import scipy.io as scio
import numpy as np
from sklearn.preprocessing import MinMaxScaler
from scipy import sparse
#import scipy.io as scio
# 封装归一化函数
def Normalize(filename,normalize_file_list):
i=0
for per_file in filename:
feature=scio.loadmat(per_file)['permission']
scaler = MinMaxS... |
a3a477b04b0ee80a0f0386559484bd5f10ff01c8cbf86e449a8fe41649e44160 | Python | 6,962 | 162 | from torch import nn
import torch
from src.math import r6d_to_rotation_matrix
def nn_block(input,hidden,output):
return nn.Sequential(nn.Linear(input, hidden),
nn.LeakyReLU(),
nn.Linear(hidden, output))
class bm(nn.Module):
def __init__(self)... |
3553289cda596ec3f09279d8056fe31ddcaa90bddf08f2134534095fed464e6c | Python | 6,964 | 175 | # verify that we're using the correct version of StellarGraph for this notebook
import stellargraph as sg
import warnings
warnings.filterwarnings("ignore")
try:
sg.utils.validate_notebook_version("1.2.1")
except AttributeError:
raise ValueError(
f"This notebook requires StellarGraph version 1.2.1, but ... |
f58e9915a78078ca273794fe2a007e81342a1ee88d993cb6c8c0bd1343373882 | Python | 6,964 | 287 | #!/usr/bin/env python
import numpy as np
import io
import linecache as lc
import time
import os
import torch
import argparse
batch = 'batch02_F_109_S15x15_W08_t00430.npy'
zMax = 1200
parser = argparse.ArgumentParser(description='Script to create IC for OF')
parser.add_argument('-batch', dest='batch', default=batc... |
cb67c519d8c32dc86b00239edfad526d48cf6f498b7201b0f65255c253b75a4b | Python | 6,965 | 254 | from typing import Optional, Sequence
import logging
from torch.autograd import Function
import torch
from .slice_acq_torch import slice_acquisition_torch, slice_acquisition_adjoint_torch
USE_TORCH = False
if not USE_TORCH:
try:
import nesvor.slice_acq_cuda as slice_acq_cuda
except ImportError:
... |
ff1bb3fd9dde6ef8134051268f1bcbec9a9e4f00157d08f37b09c79e2f46c8e9 | Python | 6,966 | 142 | # MIT License
#
# Copyright 2026 Broad Institute
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, ... |
0e3137cfd7584a56645833a579f7674e73f325de51c09d5c8800e4f7d24e2df0 | Python | 6,968 | 225 | # Author: Leland McInnes <leland.mcinnes@gmail.com>
#
# License: BSD 3 clause
import time
from warnings import warn
import numpy as np
import numba
from sklearn.utils.validation import check_is_fitted
import scipy.sparse
@numba.njit(parallel=True)
def fast_knn_indices(X, n_neighbors):
"""A fast computation of k... |
d13719466ec9563d8af6c9440cb1635075596f3f8f3ee9de2623216fac1a8fe9 | Python | 6,968 | 258 | import numpy as np
import matplotlib.pyplot as plt
# increase the figure size
plt.rcParams["figure.figsize"] = [12, 10]
# remove the top and right spines from plot in the global plt setting
plt.rcParams["axes.spines.top"] = False
plt.rcParams["axes.spines.right"] = False
# change the linewidth of the axes and spines
... |
a3e8593c55212f31708f2bf9264b75aa38ea6f1faa5464c7cff53c6c096500f6 | Python | 6,970 | 222 | # Copyright 2025 Xanadu Quantum Technologies 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 agre... |
fc291cee9040cd3a14d184e035a11b5318a895a1e025d7eda594975c049bf10f | Python | 6,970 | 207 | # -*- coding: utf-8 -*-
"""
Created on Thu Dec 2 14:46:18 2021
@author: jeanbaptiste
"""
import gc
import time
import sys
# Append paths to delta-dev and deep cell control before import:
sys.path.append('C:/DeepLearning/DeLTA_dev')
sys.path.append('C:/Users/System 6/Documents/deepcellcontrol')
sys.path.append('C:/Use... |
1da8732ecda775dc6cb30cfc67bda09c5aea9cb41973f3e7fc862fef43356a44 | Python | 6,974 | 179 | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import random
import sys
import math
from torch.distributions.categorical import Categorical
from torch.distributions.beta import Beta
from collections import defaultdict
device = torch.device('cuda' if torch.cuda.is_available() else ... |
8e9ddfca543aebec8e558e9c93c9d8f5692ddc77d95ba5f9805d1846b875c6a9 | Python | 6,976 | 162 | # Copyright 2019 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... |
b9b9c986c44efa86bf70be049250b0d8dbdcec3545652834bd2b90ad83b449f6 | Python | 6,978 | 166 | ###############################################################
################################################################
import numpy as np
from scipy.stats import pearsonr
import matplotlib.pylab as plt
import matplotlib.gridspec as gridspec
import matplotlib
matplotlib.rcParams.update({'text.usetex': False, '... |
a8a125c84ec2643ceed2b5ab2ad44d54515d72c21ef8e782e8bda425f0358735 | Python | 6,979 | 247 | import numpy as np
import matplotlib.pyplot as plt
# increase the figure size
plt.rcParams["figure.figsize"] = [12, 10]
# remove the top and right spines from plot in the global plt setting
plt.rcParams["axes.spines.top"] = False
plt.rcParams["axes.spines.right"] = False
# change the linewidth of the axes and spines
... |
ab0b5fd6cb8ffbdbdf21f2b7a0a6529cc12981c0df33bf1dfe08a90c152a2015 | Python | 6,979 | 214 | # -*- coding: utf-8 -*-
# JN 2014-09-24
# JN 2015-01-08
"""
prepare clustering jobs
"""
from __future__ import print_function, division, absolute_import
import logging
import os
import numpy as np
from .. import options, DataManager, create_session
logger = logging.getLogger(__name__)
DEBUG = options['Debug']
def ma... |
3fb781ff31db17a0f7aed21e6bd6de7bccc7b4ad8976dd12e3e397985fe696d9 | Python | 6,981 | 196 | # Copyright 2018-2024 Xanadu Quantum Technologies 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... |
2b63d8b6abee613295c3c4cffe80236335a1eadb315a603dc89251c51a47f844 | Python | 6,984 | 221 | from typing import Union
import numpy as np
import pandas as pd
from anndata import AnnData
from liftover import get_lifter
from tqdm import tqdm
def liftover(
data: Union[AnnData, pd.DataFrame],
torlerance: int = 10,
original_genome: str = "mm10",
new_genome: str = "hg38",
) -> Union[AnnData, pd.Dat... |
5d417c88e45acfcded10fbd359ccff82eb177d4354bd6594807cc6d139d0cdb3 | Python | 6,984 | 166 | import os
#from six import BytesIO
#from StringIO import StringIO as BytesIO - commented by Rieke during python 2to3 transition, looks weird so I keep it here for reference in case something breaks
#import six.StringIO as BytesIO
import six
import numpy as np
import pandas as pd
from model_data_base.utils import conver... |
aeeed300dcd1cb0618ccc8e313a6162816512117cf30dabc786110ae89c2d93b | Python | 6,984 | 148 | from pathlib import Path
from reportlab.lib import colors
from reportlab.graphics.shapes import Drawing, Line
from reportlab.lib.pagesizes import letter
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import inch
from reportlab.platypus import Paragraph, Spacer, SimpleDocTe... |
2fb6d88cb41c649f1e2395d06f2997cb4060df9a286cb0f2e4d255a6ab74c015 | Python | 6,985 | 220 | import numpy as np
import pytest
import pandas as pd
pytest.importorskip("jinja2")
from pandas.io.formats.style import Styler
@pytest.fixture(params=[(None, "float64"), (pd.NA, "Int64")])
def df(request):
# GH 45804
dtype = request.param[1]
item = np.nan if dtype == "float64" else pd.NA
return pd.D... |
658ae334672d1fb2330df65e845e9911e5aba7bfb8e91975f96646d8628e1fb1 | Python | 6,986 | 183 | '''
This script is used to test Current Source Density Estimates,
using the kCSD method Jan et.al (2012)
This script is in alpha phase.
This was written by :
Chaitanya Chintaluri,
Laboratory of Neuroinformatics,
Nencki Institute of Exprimental Biology, Warsaw.
'''
import os
import numpy as np
from scipy.integrate i... |
86557c6e19d52db5decb0c3d39eb19e403216377d6cc8e7ef71d9a1209df1b05 | Python | 6,986 | 266 | import warnings
import config
import numpy as np
from tensorflow.keras import Sequential, layers, optimizers
from tensorflow.keras.callbacks import ModelCheckpoint, ReduceLROnPlateau
from tensorflow.keras.models import model_from_json
from utils import (accuracy, change_output, create_input_array, create_labels,
... |
a4185aa12d4b176962b0c300b3a15ae2307bcf3868623510e10b53bd4fa602d7 | Python | 6,986 | 151 | # import modules
import numpy as np
import os
import torch
import torch.nn.functional as F
import torch.utils.data as data
from torch.autograd import Variable
import random
import matplotlib.pyplot as plt
import pandas as pd
import shutil
from utils.augmentation_slice_level import augment_image_t2
from utils.image_util... |
ef7f5d3038ceab16bdf868fb27ce8ad952743fbb2582d000f2f27be41a9e1fcb | Python | 6,988 | 233 | import json
import os
import random
import time
from typing import Literal, Optional
import numpy as np
import pandas as pd
import requests
_reference2 = Optional[Literal["hg38", "mm10", "sacCer3"]]
def qbed_to_bedgraph(expdata, number=4):
chrm = list(expdata["Chr"].unique())
chrnew = []
startnew = []... |
6540cdf88c9fca99cf0ac7e6d3d8a83ea52090fd8376b27332fb8fbe08cbe407 | Python | 6,989 | 209 | # Copyright 2018-2024 Xanadu Quantum Technologies 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... |
c34287c5936da549c5bdd81514ce4306a53eebf73b687e9c98cf83ebf0594bed | Python | 6,994 | 155 | #!/usr/bin/env python
__author__="etseng@pacb.com"
"""
After running UMI_BC_error_correct.py with --bc_rank_file and --only_top_ranked parameters,
take the (1) .annotated.correct.csv file, and
(2) short read cluster (cell type) csv file
(3) fasta, gff, [faa]
to de-duplicate the FLNC re... |
4cf892d7a169406cd17c93053c80cbd1113399de3fa9da8d8e67449af58bb7f6 | Python | 6,998 | 188 | # Copyright 2018-2021 Xanadu Quantum Technologies 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... |
c4f1b3b4d4153c6cacfb15c41fada164a7705ec2ce0fc06788527170cde92542 | Python | 6,999 | 265 | import warnings
import config
import numpy as np
from tensorflow.keras import Sequential, layers, optimizers
from tensorflow.keras.callbacks import ModelCheckpoint, ReduceLROnPlateau
from tensorflow.keras.models import model_from_json
from utils import (accuracy, change_output, create_input_array, create_labels,
... |
83f64787f561153b985816d5e37a43283906c14cd3303edb7c4d537d95830d76 | Python | 7,005 | 198 | # Copyright 2018-2021 Xanadu Quantum Technologies 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... |
4692ee79b5dd5663bc1baedf8f4a736b09168076c9e7a78692ba3ec3c5edd627 | Python | 7,009 | 202 | import torch
import torch.nn as nn
import torch.nn.functional as F
from darts.api import Model
from darts.modules.linear.cell import Cell
from darts.modules.classifier import MultitaskClassifier
from darts.genotypes import LINEAR_PRIMITIVES, Genotype
class Hyperparameters:
c = 100
num_nodes = 2
num_cells... |
44b35231b73868004c66aee88c01f275e819822619c1a3ff6efb9ecb4162f9a9 | Python | 7,010 | 255 | """
masked_reductions.py is for reduction algorithms using a mask-based approach
for missing values.
"""
from __future__ import annotations
from typing import (
TYPE_CHECKING,
Any,
)
import warnings
import numpy as np
from pandas._libs import (
lib,
missing as libmissing,
)
from pandas.core.nanops ... |
45b9f8fc4ded619066d55fa0e718b8232fc6782861e3f1e66903020c7747fb27 | Python | 7,010 | 148 | """Replication clocks checked against original-author R reference predictions."""
import importlib
import importlib.util
from pathlib import Path
import numpy as np
import pandas as pd
import pytest
import torch
from anndata import AnnData
from pyaging.logger import Logger
from pyaging.predict._pred_utils import che... |
51788f81f0b697720439f1eb5061c0a4c5e0294ac057d5b6792be6fb378b47ef | Python | 7,012 | 217 | import itertools
import numpy as np
from copy import deepcopy
from torch.utils.data.dataset import Dataset
''' Utility function for datasets '''
def get_bb(mask):
"""
:param mask:
:return:
"""
idx = np.where(mask)
bb = tuple(
slice(min_i, max_i)
for min_i, max_i in zip(
... |
8b17bfa17ff36ed9de27c39894f385e41b39741124b28a6186d4a5cfed895ec9 | Python | 7,012 | 201 | import numpy as np
import matplotlib.pyplot as plt
import sys
import os
from kcsd import sKCSD, sKCSDcell, KCSD3D
from kcsd import sKCSD_utils as utils
import kcsd.validation.plotting_functions as pl
import sKCSD_utils
n_src = 1024
dt = 0.5
tolerance = 5e-6
cmap = plt.cm.bwr_r
n = 100
scale_factor = 1000**2
R = 32e-6
l... |
fe778dd1e14c8ee9c379746bebe59453c6fcc2180005628418bfffc884adc992 | Python | 7,012 | 197 | from copy import deepcopy
from operator import methodcaller
from typing import Literal
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
class TestDataFrame:
@pytest.mark.parametrize("func", ["_set_axis_name", "rename_axis"])
def test_set_axis_name(self, func):
df = p... |
cdd7ba74ccc0d68329bcea81dea127d6242609fd4a9b5d8d1a53b64db375fb18 | Python | 7,013 | 196 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input/output utilities
"""
import logging
from turtle import color
logger = logging.getLogger(__name__)
import os
import nrrd
from app.utils import cast_to_type
import SimpleITK as sitk
import numpy as np
def split_filename(filepath):
""" split a filepath into t... |
46f6ef7340d56870d194f45a99d2f241642a0ec7b047909ea8a8342fcfc3b96e | Python | 7,014 | 134 | # Copyright 2019 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... |
d41d34d7a838880569f7cb0ba7fa656bdfd94b337cabb500d1a02a12df379be6 | Python | 7,016 | 161 | import numpy as np, matplotlib.pyplot as plt, sys
import pumpprobe as pp
plt.rc("xtick",labelsize=14)
plt.rc("ytick",labelsize=14)
plt.rc("axes",labelsize=14)
top_n_opt = 14
merge = "--no-merge" not in sys.argv
add_s = "" if merge else "_no_merge"
to_paper = "--to-paper" in sys.argv
shuffle = False
shuffle_n = 0
matc... |
3e55119ad6c4d9a3ff8e5f8d712e8f576f94f1bffd450ba006fc8509ccd2acd5 | Python | 7,017 | 217 | # Copyright 2018-2021 Xanadu Quantum Technologies 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... |
5453e7a32d115c0b94ce70aab67b1d14e63673e8554ac508317237f54a134dca | Python | 7,021 | 188 | # Copyright 2025 Xanadu Quantum Technologies 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 agre... |
cf2a510852d632f605e907b4bf416133858fcdbf173cf060226ef2e7dae223c2 | Python | 7,023 | 216 | ''' process_check.py
This program will check the NeuronBridge backend process.
'''
import argparse
from operator import attrgetter
import os
import re
import sys
from colorama import Fore, Style
import requests
import jrc_common.jrc_common as JRC
from aws_s3_lib import get_prefixes
# pylint: disable=R1710, W0703... |
913dcab08c4a8a3093b5d3a856f7107679383e2f1aa3f54b93cf2a1048496733 | Python | 7,027 | 184 | # Copyright 2018-2021 Xanadu Quantum Technologies 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... |
dc3b5c0ca4ea77bb6fd1a8f032211dbf8c7d2c75af935670d2fd49e683c87576 | Python | 7,027 | 204 | # Copyright 2018-2021 Xanadu Quantum Technologies 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... |
d1c8d84c7b69100fca1d1a852c8faac69fdd7b9495cae412c3cd6a16f7b544fb | Python | 7,037 | 227 | import torch
from torch.nn import functional as F
"""
Probabilistic losses (training)
"""
def focal_loss(pred, target, alpha=0.25, gamma=2.0):
"""
Function to compute the focal loss based on:
Tsung-Yi Lin, Priya Goyal, Ross Girshick, Kaiming He, Piotr Dollár. "Focal
Loss for Dense Object Detection".... |
1c01a9f6992d834d3beda9f304c2476fefa5db6fe4bc34b2ec0ecd4bfb1568c6 | Python | 7,041 | 168 | # -*- coding: utf-8 -*-
"""
Created on Sun Dec 20 17:02:31 2020
@author: Wladek
"""
import numpy as np
import matplotlib.pyplot as py
import matplotlib as mpl
from matplotlib.colors import LogNorm
from figure_properties import *
import matplotlib.patches as mpatches
from scipy.signal import welch, argrelmin, butter,... |
4621402ee6f3e795591a859a0b75b59d0de3c96500d776343d6681e1b5897335 | Python | 7,047 | 176 | # Copyright 2025 Xanadu Quantum Technologies 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 agre... |
c225cb2dc30890f801f515282a44ffb76d7116d4b77ae5bc04a289074f9a85e4 | Python | 7,050 | 252 | import torch
import torch.nn as nn
from torch.optim import Adam
from torch.utils.data import DataLoader
from torchvision import transforms
from tqdm import tqdm
from pathlib import Path
import os
import numpy as np
from losses import DiceLoss, dice_coeff
def train_model(
model,
train_dataset,
val_datase... |
97fec62d3dad1d9291817cc113a87684785f0cec209e7ef5eceeab2c546e5aa6 | Python | 7,052 | 161 | #EXAMPLE INVOCATIONS :
#author@VirtualTasteTeam
#VirtualTasteapiscript
#Python version: 3.6 and above
#Customized example : query server for all model data, based on a smiles-string, and output to out.csv.
#PLEASE NOTE : As seen below, do add quotation marks if you include a SMILES string, since otherwise the = wil... |
72a3010b6c3b4f9fff23f6e929cab43ddb8d935782322485f0cba7ed4522b994 | Python | 7,054 | 206 | # Copyright 2018-2021 Xanadu Quantum Technologies 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... |
a54042ac75dfc23760fbb832dd361c578cb81d48e20655d15824034def123654 | Python | 7,055 | 185 | #! /usr/bin/env python
# -*- coding: utf-8
#
# Copyright (c) 2023 Kenneth Atz, Clemens Isert & Gisbert Schneider (ETH Zurich)
import argparse
import warnings
import h5py
import numpy as np
import torch
from Bio import PDB, BiopythonWarning
from rdkit import Chem
from rdkit.Chem import Crippen, rdMolDescriptors
from sc... |
30a3b5a13a28840b29285225d267923a35535906c3393a3bc4cbfa94a785a621 | Python | 7,058 | 245 | import pandas as pd
import numpy as np
import sklearn
import pickle
import os
from scipy.signal import savgol_filter
def subt_back(s, lam=1e6):
x = np.arange(s.size)
subtracted, base = rampy.baseline(x, y, np.array(
[[0., x[-1]]]), method="als", lam=smoothness)
return subtracted
def densenet_blo... |
df37ebc6163b02e868afb3282c36021f7185950e170448266385a5e51b01a84a | Python | 7,060 | 251 | """
Numba 1D var kernels that can be shared by
* Dataframe / Series
* groupby
* rolling / expanding
Mirrors pandas/_libs/window/aggregation.pyx
"""
from __future__ import annotations
from typing import TYPE_CHECKING
import numba
import numpy as np
if TYPE_CHECKING:
from pandas._typing import npt
from pandas.c... |
2c0365c8f7a0f767ff4c013b4062aa495c4e20da215c3c0158abb78279a41b67 | Python | 7,061 | 165 | """
Calculates LLM surprisal from the following LLM families:
GPT-2 family:
"gpt2", "gpt2-medium", "gpt2-large", "gpt2-xl"
GPT-Neo family:
"EleutherAI/gpt-neo-125M", "EleutherAI/gpt-neo-1.3B", "EleutherAI/gpt-neo-2.7B",
"EleutherAI/gpt-j-6B", "EleutherAI/gpt-neox-20b"
OPT family:
"facebook/opt-125m", "facebook/opt-3... |
d02ba7772caa15d2f067a1244ab46407e2dfc8cd3f2febb468ddc48abf434160 | Python | 7,061 | 200 | # Copyright 2025 Xanadu Quantum Technologies 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 agre... |
bab16698fc65dff3ad704d65f95389a44ad67d4dee20710cef11a338ea863933 | Python | 7,062 | 271 | """
This script demonstrates some basic functionalities of the microscope
sub-package. That package deals with the hardware side of things: snap images,
retrieve them, change equipment settings, load images into DMD etc...
"""
import time
import cv2
import numpy as np
import matplotlib.pyplot as plt
#%% Load plat... |
fa002f94ce7b241d64e15ce296eaecb94bea820335414ccb7649151e50569dc7 | Python | 7,062 | 165 | #
# Equivariant batch normalization module for taking
# batch norm of a given L
#
from keras import backend as K
from keras.engine import InputSpec
from keras.layers import BatchNormalization
import tensorflow as tf
class LBatchNorm(BatchNormalization):
def __init__(self,axis=-2,momentum=0.99, epsilon=1e-3, ce... |
042dd26cb29ee74de284c8f939c352b50dfbdec163dcfc64a7b1c2cf593a9040 | Python | 7,065 | 187 | """Tests for the Constraints Operator."""
import pytest
import torch
from mrpro.operators import ConstraintsOp
from mrpro.utils import RandomGenerator
from tests import autodiff_test
BOUNDS = pytest.mark.parametrize(
'bounds',
[
((None, 1.0),), # case (-inf, 1.)
((1.0, None),), # case (1, i... |
af48eb137ee79c1460dac708abcde8eb42c533e86e9b6c15f94fda0cf9ad35eb | Python | 7,065 | 214 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.core.arrays import IntervalArray
def test_arrow_extension_type():
pa = pytest.importorskip("pyarrow")
from pandas.core.arrays.arrow.extension_types import ArrowIntervalType
p1 = ArrowIntervalType(pa.int64(), "... |
e16fc00575a94e88d7b6e4248ab1863cd8c4e16e64fe310111751eda33eab313 | Python | 7,065 | 218 | # Copyright 2018-2026 Xanadu Quantum Technologies 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... |
a2ad8ef8e9629b56527f1b7aa271087374088eeb2d1fd06f8e84a1498fb19436 | Python | 7,068 | 241 | """
Tests for the Apache Iceberg format.
Tests in this file use a simple Iceberg catalog based on SQLite, with the same
data used for Parquet tests (``pandas/tests/io/data/parquet/simple.parquet``).
"""
import collections
import gc
import importlib
import pathlib
import pytest
import pandas as pd
import pandas._tes... |
d9859930530a389927c1fa089e02750dce63fa398c807e5793175d713a4a5046 | Python | 7,069 | 218 | """
Protocols for mapping Uniprot sequences to EMBL/ENA
database for extracting genomic location, so that genomic
distance between putatively interacting pairs can be
calculated.
Authors:
Anna G. Green
Thomas A. Hopf
Charlotta P.I. Schärfe
"""
from copy import copy
import pandas as pd
from collections import def... |
c352c2ed09b15d77ac2c9c11d012bd7fbaf8fcbfdebd3d575e066ece8f72fe79 | Python | 7,070 | 202 | # Copyright 2026 Xanadu Quantum Technologies 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 agre... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.