sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
8040cbc58f833059b5e20e922edaa492a9899b4512450894c1eb6db1412f4118
Python
4,440
151
import matplotlib.pyplot as plt import numpy as np import pandas as pd import matplotlib.ticker as ticker from matplotlib.ticker import MaxNLocator import matplotlib.transforms as transforms import numpy as np from pathlib import Path from statistics import mean, stdev from fpdf import FPDF import math import sys sys...
4384ca4c99297904f5b9fddd7b9ccc2200bba0bf927c7353e0e503463017a94d
Python
4,446
144
import torch import torch.nn as nn from torch.nn import functional as F class BasicBlock(nn.Module): expansion = 1 def __init__(self, in_channel, out_channel, stride=1, downsample=None): super(BasicBlock, self).__init__() self.conv1 = nn.Conv3d(in_channels=in_channel, out_channels=out_channel...
df6bc8242f32aca420459273030d036dc6b81f4889a3cfa18836ebfe4494ac56
Python
4,446
111
#!/usr/bin/env python __author__ = 'etseng@pacb.com' """ Convert a SAM file into GFF3 format (https://uswest.ensembl.org/info/website/upload/gff3.html) that also includes additional information that GMAP GFF3 for the 'mRNA' type: --- coverage --- identity --- matches --- mismatches --- indels ex: fro...
574cb02b9406aa4a3e0e7411fbc8561114fe9d0adcc5e7bf4ae5274bd1ce9d94
Python
4,447
133
import argparse import pandas as pd import numpy as np import matplotlib.pyplot as plt import tensorflow as tf import seaborn as sns from tensorflow import keras import os #os.environ["CUDA_VISIBLE_DEVICES"] = "-1" # disables GPU #from tqdm import tqdm from ast import literal_eval from tensorflow.keras import layers i...
59a48e780355ff97753f67a05165e982b7a2651d5df6f0655763bb9dad249546
Python
4,449
141
""" Statistics calculation utility """ import time import math import sys from onmt.utils.logging import logger class Statistics(object): """ Accumulator for loss statistics. Currently calculates: * accuracy * perplexity * elapsed time """ def __init__(self, loss=0, n_words=0, n_cor...
3bc84126699dfc90a1bac2925503419f54995c5aada600c5ab80c30ca5fce927
Python
4,450
131
from xml.etree import ElementTree import glob from tensorflow import keras import tensorflow as tf import sklearn from skimage import draw from skimage.io import imshow, imread from skimage import morphology from skimage import transform from skimage import util import numpy as np from matplotlib import pyplot # from ...
8aa3a520319cf6bb20d19787153045d6e79cf0f1fc50a15a0c006e77adca3f25
Python
4,451
127
import numpy as np import matplotlib.pyplot as plt import matplotlib.cm as cm from matplotlib import gridspec from kcsd import csd_profile as CSD from kcsd import ValidateKCSD2D from figure_properties import * from kCSD_with_reliability_map_2D import make_reconstruction, matrix_symmetrization def set_axis(ax, letter...
3d7f11f1716e76f3c2b29392cc801ae917674aa869f9b526fd72c2164c54c34b
Python
4,452
138
import tensorflow as tf from const import * def decode(serialized_example): features = tf.parse_single_example(serialized_example, features={ 'dims': tf.FixedLenFeature([3], tf.int64), 'img'...
9b10259c9b31ea6112e3b7b01e153126f988e8cbd840f3ce913f42486020e461
Python
4,455
127
from PointSets import pointSets from Common import pointEvolution from Surfaces.surfaces import * from Common.kernelFunctions import * from Surfaces.secondOrderFiberMatching import * def compute(createsurfaces=True): if createsurfaces: [x,y,z] = np.mgrid[0:200, 0:200, 0:200]/100. ay = np.fabs(y-1)...
198615a0cfd367323c0e7541a48d2ebbb3268a1b260123496d03a560bac0531e
Python
4,456
128
# Time-stamp: <2024-10-11 11:11:00 Tao Liu> """Description: refine peak summits This code is free software; you can redistribute it and/or modify it under the terms of the BSD License (see the file LICENSE included with the distribution). """ # ------------------------------------ # python modules # ----------------...
93fc23923600f491def406b9aa0fb050153245185994dfe74e927a0e26564706
Python
4,456
107
#!/usr/bin/env python import os import sys import click import pandas as pd from DXGB.convert_file import RF20_main as RF20_main from DXGB.run_features import run_features as run_features from DXGB.run_models import * @click.command() @click.option("--model", default="DXGB", show_default=True, help="model name") @clic...
d108830472ef3d9f6139c408553b3f6499084f7d930d7cf1362a1287201c3724
Python
4,457
109
# https://github.com/ildoonet/pytorch-gradual-warmup-lr/blob/master/warmup_scheduler/scheduler.py # Modifications: # - Update self.last_epoch when self.finished __all__ = ["GradualWarmupScheduler"] from typing import Optional, Union from torch.optim import Optimizer from torch.optim.lr_scheduler import ReduceLROnPla...
1f65a9961b64a0727ea405108f9197946953c6565f262fb44af3d58f88c36048
Python
4,458
123
""" Utility functions and classes (including default parameters). Author: Sara Mathieson, Rebecca Riley Date: 9/27/22 """ # python imports import numpy as np from scipy.stats import norm class Parameter: """ Holds information about evolutionary parameters to infer. Note: the value arg is NOT the starting ...
7117aa9b82a76873533b2296943871abf33e3ed282e82db959105b8d4df7a288
Python
4,459
119
import numpy as np, matplotlib.pyplot as plt, sys import pumpprobe as pp plt.rc("xtick",labelsize=18) plt.rc("ytick",labelsize=18) plt.rc("axes",labelsize=18) shuffle_connectome = False shuffle_connectome_n = 1 for s in sys.argv: sa = s.split(":") if sa[0] == "--shuffle-connectome": shuffle_connectom...
cc6f499f266f8a2c31726418a099bf673ad78932a40052caf68daf285902649c
Python
4,460
158
# 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...
70a9d7feee8e02989b3943ce84ff6e2b7e0dce1c9708ff412b474072ff7d2074
Python
4,463
122
# 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...
aa8aa42073a67a2beb35056c6407d1fa9cd929372fa2e32fc2a25559259ba882
Python
4,464
125
import inspect import dask.dataframe as dd import pandas as pd import matplotlib.pyplot as plt from matplotlib.figure import Figure from matplotlib.axes import Axes from ..utils import skit from functools import wraps ## # todo: this is overcomplicated and should be removed # ## class ForceReturnException(Exception...
cc1fb9b64f1e2a5e6e8bfa8f77fc06d6e725abb0b6846808694b12e1e26d4574
Python
4,466
121
from rdkit.Chem import Draw import numpy as np import io from PIL import Image def show_png(data): bio = io.BytesIO(data) img = Image.open(bio) return img def draw_mol_with_highlight_varying_colour(mol,attribution_dict,absolute_scale=True,absolute_limit=1,label_values=False): """ funct...
53ef18fcf3ffe080ca2bb9cf1fec8484779345cc2570c234d7f261be1a314e3f
Python
4,467
126
import torch import numpy import matplotlib.pyplot as plt import bionetwork import pandas import seaborn as sns import copy #Load network networkList, nodeNames, modeOfAction = bionetwork.loadNetwork('data/macrophage-Model.tsv') annotation = pandas.read_csv('data/macrophage-Annotation.tsv', sep='\t') uniprot2gene = di...
fd88f846044696935876ad50e7c0eb647e0f260abc721bc1089977b184ca5796
Python
4,469
149
#!/usr/bin/env python3 from . import conf from .utils import PheWebError import sys, json import os import importlib import functools import math from typing import List,Dict,Callable if sys.platform.startswith('win'): raise Exception("PheWeb doesn't support Windows, because pysam doesn't support windows.") if ...
7f1c7f65fed5911d1e3dd993ca0d9cc093a534fa73c5a3483c02105d3e30d660
Python
4,470
121
from __future__ import absolute_import from __future__ import unicode_literals from __future__ import print_function from __future__ import division import torch import torch.nn as nn from torch.autograd import Variable import math from layers import ShuffleLayer, Conv, CondenseConv, CondenseLinear __all__ = ['Conden...
85969bc3edb72b86013dd703a5f981bb7e6785e97fd2df6f3b116223a8c7126f
Python
4,470
161
import pandas as pd fd2label = {0.5: "scrubbing.5", 0.2: "scrubbing.2"} group_name_rename = { "CONTROL": "control", "BIPOLAR": "bipolar", "SCHZ": "schizophrenia", } group_order = { "ds000228": ["adult", "child"], "ds000030": ["control", "ADHD", "bipolar", "schizophrenia"], } def lazy_demographic...
b35225d0a904cd7c8cfaa0cec0ee4067da5b89b5d8a7c11c4569701633449fb5
Python
4,470
121
import os import numpy as np from fastmri_prostate.data.mri_data import zero_pad_kspace_hdr from fastmri_prostate.reconstruction.utils import center_crop_im, ifftnd from fastmri_prostate.reconstruction.grappa import Grappa def t2_reconstruction(kspace_data: np.ndarray, calib_data: np.ndarray, hdr: str) -> np.ndarray...
0dc7a86a723990e1a42ca2dc75df1f362055c3eb4a6a30a228f39241477097c5
Python
4,471
106
#! /usr/bin/env python ############################################################################## ## DendroPy Phylogenetic Computing Library. ## ## Copyright 2010-2015 Jeet Sukumaran and Mark T. Holder. ## All rights reserved. ## ## See "LICENSE.rst" for terms and conditions of usage. ## ## If you use this wo...
79c8fed3df967d0d92ce1bb0bcd90c7d21dd7bc3f45ad59ae1b3646c3b0aa182
Python
4,471
112
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue May 9 2023 Script to test nonlinear registration of OpenPain after updating the DB and uploading the images to COS. @author: Eduardo Castro """ import ibm_boto3 from botocore.client import Config from os.path import join as opj import sqlalchemy as db...
a547d2fbeb57bdc88df73de6ca7071acb33914538ebe93555177b8fdd5337311
Python
4,471
113
# Copyright 2018-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...
ed12a6c35e63786988a1b21a05204f362b4073e85fe6d61c47d135a906ba0ee2
Python
4,471
118
# Copyright 2018-2020 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...
cd9bb4e08f19e1f6ffc5d698a09542285330f21f5e9c6a361c04f649ae4c2ff2
Python
4,473
106
# Filename: process_plate_image.py # Author: Alessandro Gerada # Date: 2023-01-27 # Copyright: Alessandro Gerada 2023 # Email: alessandro.gerada@liverpool.ac.uk """Pre-processing of agar plate images to extract individual colonies""" import cv2 # pylint: disable=import-error from imutils import contours from ty...
257901c8e647877e3263d8f7a4fd77cc8b2ca847d2dd4e792a27662994c1094e
Python
4,475
121
#!/usr/bin/env python import argparse import csv import os import pandas as pd from common import * import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import seaborn as sb import numpy as np sb.set(style="whitegrid") def main(): parser = argparse.ArgumentParser() parser.add_argume...
263a889f092f4b6ff3fc808ebdd21495512715673eb6534ce455e771101c19c5
Python
4,475
165
"""Pytest fixtures for samalg tests.""" from __future__ import annotations import numpy as np import pytest import scipy.sparse as sp from anndata import AnnData @pytest.fixture def random_seed() -> int: """Provide a consistent random seed for reproducibility.""" return 42 @pytest.fixture def small_expres...
4d18bb273a68952d2ffdd3a0b1094b049a5f253805ddba82db61fd12a3aa92eb
Python
4,478
126
''' Created on Apr 21, 2012 @author: robert ''' import neuron from . import reader from . import cell_parser from . import synapse_mapper as smap from . import sim_control import numpy as np '''anatomical parameters''' # ? look @ vpm -> L5tt mapping results # vpm -> L4 about 0.4; therefore 0.2 good guess convergence...
55ad2a56cc696a97af9680ce201240d56217dfbdcd0860a0fa2bb0a74af15d03
Python
4,478
111
import csv import argparse from Common import loggingUtils from Surfaces.surfaces import * from Common.kernelFunctions import * from Surfaces import surfaceMatching, surfaces, surfaceTimeSeries as match import threading import Queue def threadfun(q): while True: print str(q.qsize())+' jobs left' os...
d1ed272f7562642acc0ed8563f81c9778bae2ef1acf89312b656dc29555d3a87
Python
4,480
142
# cython: language_level=3 # Time-stamp: <2025-02-05 12:38:24 Tao Liu> """Utilities for reading and writing MACS3 bedGraph files. This code is free software; you can redistribute it and/or modify it under the terms of the BSD License (see the file LICENSE included with the distribution). """ # ----------------------...
35fc2cf15f9f8b83f6a8591201e5a906717f91497cb5ce11429cb8cb945e5d31
Python
4,483
153
from __future__ import annotations from typing import ( TYPE_CHECKING, ClassVar, Self, ) from uuid import ( UUID, uuid4, ) import numpy as np import pytest from pandas.core.dtypes.common import is_list_like from pandas.core.dtypes.dtypes import ( ExtensionDtype, register_extension_dtype, ...
c06704e878dc19aecdac756efce4749a3f970e66b39cff92f46cdf07ca0b6b1e
Python
4,486
125
from __future__ import absolute_import #__version__ = '0.0.0' #import from data_utils from data_utils import load_csv_data from data_utils import load_Xy_one_hot_data2 from data_utils import load_Xy_data_noheader from data_utils import drop_impute_and_scale_dataframe from data_utils import discretize_dataframe from d...
443984a87bf255d6062b39bc4217076b0616e9eb857612920d9d6c5122fe47a5
Python
4,489
91
import sys import os import argparse from cdr.config import Config base = """#!/bin/bash # #SBATCH --job-name=%s #SBATCH --output="%s-%%N-%%j.out" #SBATCH --time=%d:00:00 #SBATCH --mem=%dgb #SBATCH --ntasks=%d """ if __name__ == '__main__': argparser = argparse.ArgumentParser(''' Generate SLURM batch jobs t...
8ffb2ec74175cc608589a7cb28d54fc330148fd11843876b45c59ed9fb7a4eb1
Python
4,490
130
"""Scatter view.""" # ----------------------------------------------------------------------------- # Imports # ----------------------------------------------------------------------------- import inspect import logging import numpy as np from phy.plot.visuals import ScatterVisual from phy.utils.color import selec...
2451980f34b5e50738fe5534f2758146ec015fa31b4ecc8de82c000293dd16c8
Python
4,491
113
# 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...
30eb87359a96a356ca94273a308af3fc3f44f013aabcab848e7e49d5ac57f54a
Python
4,491
104
import torch from tnn.layers import View, LinearLayer from tnn.networks import FullyConnected, HamiltonianResNet from tnn.regularization import SmoothTimeRegularization, TikhonovRegularization, BlockRegularization from tnn.training.batch_train import train from tnn.utils import seed_everything, number_network_weights, ...
4d16880849d2c4edb989ab4a1ab98f1043013be742aa2ac970b2a7cdcb42661e
Python
4,492
152
#%% #Imports import numpy as np import os import matplotlib.pyplot as plt import matplotlib.animation as animation from matplotlib.gridspec import GridSpec import matplotlib.backends.backend_pdf plt.style.use('seaborn-talk') import pandas as pd from sklearn.preprocessing import StandardScaler from sklearn.decompositio...
5255621f3f95fcceb1d309cb53550082c1e52e096f99f5381be14f3d0a46d6cf
Python
4,494
157
import os import numpy as np import torch from sklearn.metrics import accuracy_score, roc_auc_score from sklearn.model_selection import train_test_split as split from roost.roost.data import CompositionData, collate_batch from roost.roost.model import Roost from roost.utils import results_multitask, train_ensemble t...
5b22008013138f8acb3a1239ddaf173fa251fa7f2f655152c2372aef644e7f9a
Python
4,494
114
import argparse import json import time import os import socket from pathlib import Path from uuid import uuid4 import numpy as np from distributed_computing.api import start_head_node, start_node from distributed_computing.api import Pool as WorkersPool from evolutionary_experiment.config import config from evolutio...
db12d9253ebabf612a30ba366a256d94c62fadbea18592265a65b6baf6713baa
Python
4,494
114
import numpy as np import pandas as pd import pickle from sklearn.model_selection import KFold import torch.utils.data as tdata import cvxpy as cp from raman_dataset import RamanSpectraSeqDataset, NMFRamanSpectraSeqDataset from imblearn.over_sampling import SMOTE from imblearn.under_sampling import RandomUnderSampler ...
c56559d7716e96e0a8ee932903bcaa4732ad00259d9206131b3406937a891510
Python
4,495
107
# download from https://github.com/benfulcher/AllenSDK/blob/master/MakeCCFMasks.py # modified by JKB on 2/6/23 import numpy as np import csv import os import nrrd import scipy.io as sio import pandas as pd import sys # import matplotlib.pyplot as plt # %matplotlib inline #---------------------------------------------...
3dc2033933e2f0aeee35468a5dc91fdfe611f6afd984bfab53cd3fa253d7249b
Python
4,497
144
import os import torch import torch.nn as nn import numpy as np import torch.nn.functional as F import matplotlib.pyplot as plt import matplotlib as mpl plt.style.use('ggplot') from src.models import NeuralKalmanFilter, KalmanFilter from src.utils import * device = "cuda" if torch.cuda.is_available() else "cpu" print(...
94e18aacf71dea402acff1aa5f7120acfd36e865e5a84effa70b367ec20e5852
Python
4,497
121
"""Base classes for the decode module.""" import logging from abc import abstractmethod from nimare.base import NiMAREBase LGR = logging.getLogger(__name__) class Decoder(NiMAREBase): """Base class for decoders in :mod:`~nimare.decode`. .. versionchanged:: 0.0.12 Moved from ``nimare.base`` to ``ni...
d5e599752587e9ffa11f044ae1c1f8ade94858356d2bee22b47d197b11ab175d
Python
4,498
126
"""Code for making expt_config files to describe experimental info.""" import pathlib from pathlib import Path from typing import Any import yaml from ruamel.yaml.main import round_trip_dump as yaml_dump from ruamel.yaml.main import round_trip_load as yaml_load def create_expt_config( expt_name: str | None = No...
aec81abb92fc55e7efd8d6a32df07383eea274e42d0ffad1d638d1a86abeca84
Python
4,499
105
import torch from torch import nn from torch_geometric.utils import scatter from e3nn import o3 from e3nn.nn import FullyConnectedNet # Typing from torch import Tensor from typing import List, Optional, Tuple class Interaction(nn.Module): """NequIP equivariant interaction/convolution layer. Refe...
027bf134091597de257cfcae73f048edc603fec878bfc9ae627da8b40d47c30f
Python
4,500
157
""" .. _metas_ibma: ==================================== Image-based meta-analysis algorithms ==================================== A tour of IBMA algorithms in NiMARE. This tutorial is intended to provide a brief description and example of each of the IBMA algorithms implemented in NiMARE. For a more detailed intro...
f22e27e018df5781e8e2aff959d88bc44a51c8af11dfbe7e4617dde2bee11169
Python
4,502
114
import sys import pandas as pd from .util import stderr def read_tabular_data(X_paths, Y_paths, series_ids, categorical_columns=None, sep=' ', verbose=True): """ Read impulse and response data into pandas dataframes and perform basic pre-processing. :param X_paths: ``str`` or ``list`` of ``str``; path(s)...
3eb0900d3b0f4cace3f931b683b034e4cb7a8bdcd9d571f543048f6c2e2790d8
Python
4,503
138
import numpy as np import pandas as pd import time import datetime from .esw_star import esw_star from ..utils.compute_pvalues import compute_pvalues from ..summarydata import SummaryData def _det(mean: pd.DataFrame, var: pd.DataFrame, n_cells: pd.DataFrame, verbose: bool=False): """Computes Differential Expressio...
7d9499a6e88aac0e40b58ee71f350c94bf6437372048daae98da291dcf024d6b
Python
4,504
126
# 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...
2a356a81a444ef38ade4637a6e0284c9aa1f51af0d6778d62843b9008db0acb3
Python
4,505
116
import argparse import logging def get_args(): """ Get arguments from command line with argparse. """ parser = argparse.ArgumentParser( prog='sam-merger.py', description="""Merge a series of SAM format files from a chunked alignment pipeline.""") parser.add_argument("-i", "--infile...
b5b61b168b807b0e0c5996abd05d9d3f0ff99a22d64e061e1590f75d14a6abc1
Python
4,506
131
import unittest from unittest import TestCase from evcouplings.utils import * class TestUtilsApp(TestCase): def setUp(self): self.config_file = "" def test_run_ExternalToolError(self): """ tests whether the ExternalToolError is properly raised assuming we are running on a un...
f77c342005ee5055b24d2f19c15f2c9c8c89bda4c82f029e2030fd7f68c06587
Python
4,506
124
""" .. _annotations_gclda: ==================== GCLDA topic modeling ==================== Train a generalized correspondence latent Dirichlet allocation model using abstracts. .. warning:: The model in this example is trained using (1) a very small, nonrepresentative dataset and (2) very few iterations. As ...
0943416ba70fa31804b60f116ab038a1105f020b9d7ea96c6addfe4d7a4402b0
Python
4,508
143
import argparse import hashlib import os from pathlib import Path from global_config import config # SeRANN are generated using multiple process, so the GPU cannot be used. os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" os.environ["CUDA_VISIBLE_DEVICES"] = "" from tensorflow import keras import numpy as np import pa...
f317604f33a5f8a2da2c93bc4cd91963654e272fd2f447cb786627beabbd5ba4
Python
4,508
115
import scipy.io as scio import numpy as np from scipy import sparse # 需要补充生成元图的函数 def get_Matrix(dataFileb, resMatrix): # d = sparse.load_npz(dataFileb)['permission'] d = sparse.load_npz(dataFileb) res=np.dot(d,d.T) print(res) # 依旧是稀疏矩阵 #res_new =res.todense() #scio.savemat(resMatrix, ...
aa0e669936306e7c55eed1d5e11d722af91173c7aa81931f38dbaee89816383c
Python
4,514
140
import numpy as np import pytest import pandas as pd import pandas._testing as tm def test_compare_axis(axis): # GH#30429 s1 = pd.Series(["a", "b", "c"]) s2 = pd.Series(["x", "b", "z"]) result = s1.compare(s2, align_axis=axis) if axis in (1, "columns"): indices = pd.Index([0, 2]) ...
fc6dcca2fabf304c2d022e75272cebc3cbcdc41cb1c0018f91a26765cbd7b89b
Python
4,516
159
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import math import torch.nn as nn from torch import Tensor from typing import Callable, Union, Optional,Tuple import torch import torch.nn.fu...
06d1a878469dbfa632878ffb8f4e62ceeb6cf6ce20cce303720dace7b17b9651
Python
4,518
135
"""Soft-dependency introspection helpers. Originally adapted from sktime; rewritten for PyCaret 4.0 to drop: - `distutils.version.LooseVersion` (removed in Python 3.12) - the `importlib_metadata` backport (stdlib `importlib.metadata` is enough on >=3.11) Versions are now returned as `packaging.version.Version` object...
5788ccb6107d298c0f6b80fca537dbf31559223c82a30014c4234c15eabccc1f
Python
4,518
116
"""Deterministic synthetic NIfTI + manifest generator. Produces a small, fake-but-structurally-realistic dataset (NIfTI volumes with a synthetic "brain" blob, plus a matching manifest CSV) so the full data path (`oasis`/`manifest` -> `labeling` -> `volumes` -> `augmentation` -> `splits`) is exercisable end to end with...
9f320f567ef62d70cd99baaf88b4848219d7d6d993f4da04680ab1e1ef31e10b
Python
4,519
170
import itertools import logging import math from contextlib import contextmanager from typing import Callable, Optional, TypedDict, Union import torch import torch.nn as nn class _Stats(TypedDict): variance_in: float variance_out: float n_samples: int IndexFn = Callable[[], None] def _check_consisten...
3dcc041bee98778e4e2f8580ae67ddb2981e802ea0f19cfa4535258e41c0ceb3
Python
4,520
111
# Copyright 2018-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...
ac7d48aaa964e022cfebd2c510d8286cc196c7ff72ca9f25d718b98d51a1d8be
Python
4,522
143
import numpy as np import tensorflow as tf import wandb from rl_toolkit.networks.models import DuelingDQN from ...core.process import Process class Tester(Process): """ Tester ================= Attributes: env_name (str): the name of environment render (bool): enable the rendering ...
21a3ec2972b572e3fc3b0e9341e2f8ee39dc7f8610071372e7f59b7ef061f74f
Python
4,523
136
import numpy as np # from scipy.io import loadmat # from scipy.io import savemat from hdf5storage import loadmat from hdf5storage import savemat import pandas as pd from sklearn.preprocessing import StandardScaler import os import pickle def process(domain, save=False, dat_perm_seeds=1234): data = {} ...
4e28506755f9e224d45d35b672b0bdfdba0974d4c6a1949cef7be73471d782c9
Python
4,525
151
import argparse import os import time from os.path import join from string import Template from subprocess import PIPE, Popen SBATCH_TEMPLATE_DEFAULT = ( "#!/bin/bash\n" "conda activate conda_env_name\n" "cd ~/project\n" ) def str2bool(v): if isinstance(v, bool): return v if isinstance(v...
00bd671bc753f61c6e7beeb1959247abb4f53d01e06cc1de20c86d78e9289b50
Python
4,526
136
#!/usr/bin/env python3 # 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...
81d793d512ad0c941dba5c4aba99e87d64992bc1b4d089051a931d34bbd6d133
Python
4,526
104
import torch from tnn.layers import View, LinearLayer from tnn.networks import FullyConnected, HamiltonianResNet from tnn.regularization import SmoothTimeRegularization, TikhonovRegularization, BlockRegularization from tnn.training.batch_train import train from tnn.utils import seed_everything, number_network_weights, ...
fd368557a0561d4fdb7a6aab006fcbf5adc7cc57b1060cc0fe87c3d540ce3e69
Python
4,526
103
import numpy as np import pandas as pd from copy import copy from msmfcode.core.logging import log from msmfcode.core.config import * from msmfcode.models.cann import Grid, FMSMF, DMSMF, DiffSolverError, EmptyFields from msmfcode.execution.parallel import ParallelExecutor from msmfcode.evaluation.data import load_expe...
54656c03925dde40a49ef6c3a4bdcd017ea51fa5e552d6ed52ee0092414ab6c7
Python
4,527
116
# License: see [LICENSE, LICENSES/legged_gym/LICENSE] import sys from isaacgym import gymapi from isaacgym import gymutil import numpy as np import torch # Base class for RL tasks class BaseTask(): def __init__(self, cfg, sim_params, physics_engine, sim_device, headless): self.gym = gymapi.acquire_gym() ...
3d0f1fb955f504c336e3d131dce3dbbe2cc174706287fa243fa5b3d509b78d14
Python
4,528
136
"""Generate fixtures for tests.""" import os from shutil import copyfile import nibabel as nib import numpy as np import pytest from nilearn.image import resample_img import nimare from nimare.tests.utils import get_test_data_path from ..utils import get_resource_path # Only enable the following once in a while for...
94b69152814fb6ea80af9e74b2aff8bd54bbb86c3aabffcea06437b76073c399
Python
4,532
135
"""Generate fixtures for tests.""" import os from shutil import copyfile import nibabel as nib import numpy as np import pytest from nilearn.image import resample_img import nimare from nimare.tests.utils import get_test_data_path from nimare.utils import get_resource_path # Only enable the following once in a while...
ae5b039a86b589a6f97d69773e0a5ae424174ee3989412d030ec3c4ec433d436
Python
4,532
119
from datetime import datetime import pytest from pandas._libs import tslib import pandas as pd @pytest.mark.parametrize( "date_str, exp", [ ("2011-01-02", datetime(2011, 1, 2)), ("2011-1-2", datetime(2011, 1, 2)), ("2011-01", datetime(2011, 1, 1)), ("2011-1", datetime(2011, ...
fb2273ebd04db573f12c79d941fec9ee2d297303b01fc4138df4b09b0562347f
Python
4,532
104
from typing import List, Literal, Union import pandas as pd from med_associates_utils.session import FieldList, SessionCollection def calculate_cumulative_events( df: pd.DataFrame, event: Union[str, list[str]], groupby: Union[str, list[str]], time_key: str = "time" ) -> pd.DataFrame: df = df.copy() # make a...
194a09f17a575c421803b271d6a56ed090fcb4b70f9093b28d2245b36eec485b
Python
4,533
135
import random from typing import Union import numpy as np import pytorch_lightning as pl import torch from scipy.ndimage import gaussian_filter from .datasets import SyntheticDataset class TAVRDataModule(pl.LightningDataModule): def __init__(self, dataset_name: str, dataset_kw...
262c3547b35212f23427c1f4edbd5ba61b8a0ca27d68c0222bc096a4aa7c9174
Python
4,534
137
"""Workspace CRUD. For v1, workspace visibility is determined by membership — users only see workspaces where they have a ``WorkspaceMember`` row. Admins (superuser) see all workspaces. """ from __future__ import annotations from typing import Annotated from fastapi import APIRouter, Depends, HTTPException, status ...
01164e88a5b21c5fa957d412622af86b68684dde6a381f23953c61215fdb5adf
Python
4,535
115
# Copyright (c) 2018-2023, NVIDIA Corporation # 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 source code must retain the above copyright notice, this # list of condit...
2b1898e68cbd03a5b2151ec397198f1290b32e1b9cf1109d3a0ab242b9f343bd
Python
4,537
149
import ctypes import zoneinfo import pytest import pandas as pd import pandas._testing as tm pa = pytest.importorskip("pyarrow", minversion="16.0") def test_series_arrow_interface(): s = pd.Series([1, 4, 2]) capsule = s.__arrow_c_stream__() assert ( ctypes.pythonapi.PyCapsule_IsValid( ...
d252f9dda91d8f23fe7003304d4c56405041f365355130b4b035c120bb833e76
Python
4,537
141
from viewContainer import viewContainer from StimulationSystem.StimulationProcess.StimulateProcess import StimulateProcess from StimulationSystem.StimulationProcess.FinishProcess import FinishProcess from StimulationSystem.StimulationProcess.IdleProcess import IdleProcess from psychopy import visual import copy i...
f9a76ad19a14b1f2ee0ba99bfb7a332a40a63e94291828c236dc4305ef9f1723
Python
4,539
100
# Copyright 2018-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...
b732a5d561065acff4c8705f81c25b4499268f46857dec913791db9852768c4b
Python
4,540
114
"""WASABI signal model for mapping of B0 and B1.""" from collections.abc import Sequence import torch from torch import nn from mrpro.operators.SignalModel import SignalModel from mrpro.utils.reshape import unsqueeze_right from mrpro.utils.unit_conversion import GYROMAGNETIC_RATIO_PROTON class WASABI(SignalModel[t...
90ce7d686f2c58635f007774343df5e4ebf9f565c2196053d1e8ccda3fcb0ecd
Python
4,545
131
# Time-stamp: <2024-10-02 16:55:48 Tao Liu> """Description: Random sample certain number/percentage of tags. This code is free software; you can redistribute it and/or modify it under the terms of the BSD License (see the file LICENSE included with the distribution). """ # ------------------------------------ # pyth...
e578647fe0dc6faf2dc56fdf2b0adc91f9a791e849053ef2cfd7ba7c64306568
Python
4,545
115
import torch from torch import nn from torch_geometric.nn import MessagePassing from torch_geometric.utils import scatter # Typing from torch import Tensor from typing import List, Optional, Tuple class GatedGCN(MessagePassing): """Gated GCN, also known as edge-gated convolution. Reference: https://arxi...
e8d60d67b1a1c4cd2341028c0449ea5ea7c7307349e6d8c9b94c9707b5f8c689
Python
4,545
141
# Copyright 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 agre...
7a7041bde5ec84fee78c8b77a68903dc3d36c5964201e785178c9ff141f5afa3
Python
4,553
143
"""Convenience methods to retrieve meta data from .rtdc files""" import functools import pathlib import dclab import numpy as np class dataset_monitoring_lru_cache: """Decorator for caching RT-DC data extracted from DCOR or files This is a modification of dclab.util.file_monitoring_lru_cache with an ex...
4a775876a4f014d34815daf7cee6c340689865eb099861c6c9641d00df2a96b4
Python
4,554
164
import contextlib import importlib.machinery import importlib.util import os import pathlib import sys import tempfile from unittest import mock import matplotlib import numpy as np from pandas import ( DataFrame, DatetimeIndex, Series, date_range, ) try: from pandas.plotting import andrews_curve...
71462c99b014845123b5063ee9420ddefb5f069187bed2512085b856dd8894dd
Python
4,554
85
# 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...
59da528aa90f77d1bfda671f27c74944be190b5ba0f5ffdc873cc82f1e18146b
Python
4,555
140
import numpy as np import pandas as pd import time import datetime from .esw_star import esw_star from ..utils.compute_pvalues import compute_pvalues from ..summarydata import SummaryData def _ges(data: pd.DataFrame, mean: pd.DataFrame, nnz: pd.DataFrame, n_cells_per_anno: pd.DataFrame, verbose: bool=False) -> pd.Data...
3fc32652be134c1985be206667fd3102dcb2b81db6c7dc9abefc03977a4f72a8
Python
4,557
128
# Copyright 2018-2023 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...
d2251e433088d075fa59ddfdbd8e3133474db85c0e5d9eabf3d4edee31b895c4
Python
4,557
113
import typer import torch import pkg_resources from dotenv import load_dotenv, find_dotenv load_dotenv(find_dotenv()) import pandas as pd from typing import List, Tuple from rxn_yields.core import SmilesClassificationModel import sklearn try: import wandb wandb_available = True except ImportError: wandb_a...
110352a48ccbc78b1ae3344c0ca452511c3ac08e127adf98fa87e86df6dc0ceb
Python
4,559
114
#!/usr/bin/env python __author__ = 'etseng@pacb.com' import os, sys from bx.intervals import IntervalTree, Interval from Bio import SeqIO from csv import DictWriter try: import BED except ImportError: print("Cannot find BED.py! Please make sure you have cDNA_Cupcake/sequence in $PYTHONPATH.", file=sys.stderr)...
abbd61c943f808cb81313fbe432b77826208f34da9d1c97c16a62362a9ba5cfd
Python
4,560
122
from sys import path as sys_path sys_path.append('..') sys_path.append('../base') from base.surfaceExamples import Sphere, Heart import os from base.surfaces import Surface from base.surfaceSection import Hyperplane, SurfaceSection from base.surfaceMatching import SurfaceMatchingParam from base.surfaceToSectionsMatchin...
d4f9435b71a2e30cb865b88d066c2263022aae187f2c0552735a671cda6df52b
Python
4,561
127
# -*- coding: utf-8 -*- # @File name: plot_utils.py # @Author: Alicia Garrido-Peña # @Date: 2023-08-18 14:09:53 # @Contact: alicia.garrido@uam.es # "Copyright (c) 2023 Alicia Garrido-Peña. All Rights Reserved." # Use of this source code is govern by GPL-3.0 license that # can be found in the LICENSE file # Code us...
6b46dcb876cb24f87231f11bc3bf2836db4085af00629f1332f5990697130fde
Python
4,562
132
"""Test the main CLI entry point.""" import logging import sys from importlib.metadata import version from pathlib import Path import pytest from lightning_pose.cli.commands import COMMANDS from lightning_pose.cli.main import _build_parser, _setup_logging, main _CLI_REFERENCE_DIR = ( Path(__file__).resolve().pa...
4092cd9c9449e67b91cd7e2f374841d04924f2941f7c4236228faf590e9742fa
Python
4,563
95
import numpy as np, matplotlib.pyplot as plt, sys import pumpprobe as pp plt.rc("xtick",labelsize=18) plt.rc("ytick",labelsize=18) plt.rc("axes",labelsize=18) ds_list = "/projects/LEIFER/francesco/funatlas_list.txt" matchless_nan_th = None matchless_nan_th_from_file = "--matchless-nan-th-from-file" in sys.argv match...
37e8af25733334d9505ba620dd2538c5aaf4ea9cac7dac8a733f086f74012f47
Python
4,564
124
"""Benchmark: Triton GAE vs PyTorch GAE. Compares the custom Triton kernel against the original Python loop implementation from a2c_common.py for correctness and performance. """ import torch import time import argparse def pytorch_gae(mb_rewards, mb_values, mb_dones, last_values, last_dones, gamma, tau): """Or...
f6c58fc1d392eb38ada949d875d4064b6b7aacc765db0206496eb9986a37eba5
Python
4,565
133
# 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...
5710f790e7b302e73aac7d4a0509cb9f41a24ca2a2b976f8d735bbcbfae007c2
Python
4,567
105
import numpy as np import dgl from dgl import DGLGraph import torch from rdkit import Chem def one_hot_encoding(x, allowable_set, encode_unknown=False): if encode_unknown and (allowable_set[-1] is not None): allowable_set.append(None) if encode_unknown and (x not in allowable_set): x = None ...
d42e277d44739daa4f34315dd59a3346d7ba72c9e8edf957fb85e57f89c7d546
Python
4,567
99
# ---------------------------------------------------------------------------- # Copyright (c) 2016-2026, QIIME 2 development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE, distributed with this software. # ------------------------------------------------...
20ce888f3e8ee7905a0469894fb62f7db5b4a2b81e3f9667892cf8818cf2a2cc
Python
4,570
125
"""Tests for Einsum Operator.""" from collections.abc import Sequence import pytest import torch from mrpro.operators.EinsumOp import EinsumOp from mrpro.utils import RandomGenerator from tests import ( dotproduct_adjointness_test, forward_mode_autodiff_of_linear_operator_test, gradient_of_linear_operato...