sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
adfb6333dd91546e42d9875c019e6aad78e2b0f30193666c54fb33657014e519
Python
7,695
241
#!/usr/bin/env python # coding: utf-8 # # RNA Velocity analysis using velocyto, Seurat, and scVelo (Part 2: Analysis) # ## For KNOCKOUT (ko) sample GLIA+NEURONS -- VERSION 1.1 # ### Kat Beigel (beigelk@chop.edu) # #### 7/21/23 # See the following pages for guides on how to combine Seurat and velocyto data for scVelo ...
4643049073368c0c3928606ec2e5f04b3ec4be51bf7d30e92dda777626cbe9fa
Python
7,696
174
import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import numpy as np import os from scipy.stats import ttest_rel # Using a paired t-test since we're comparing the same models DATA_PATH = '../Extracted_Selectivity/VGG/PretrainedOnImageNet/NAPS/Tuning/' emotion_FILE = '1002_BestModels0912_SI_byR...
5f4fa2f4bccd995b7636559e7a88a5a1fc21bb8f50aa0c8e2182b5091411b401
Python
7,698
183
import numpy as np import pytest import pandas as pd import pandas._testing as tm class TestGetIndexer: def test_get_indexer(self): index = pd.RangeIndex(start=0, stop=20, step=2) target = pd.RangeIndex(10) indexer = index.get_indexer(target) expected = np.array([0, -1, 1, -1, 2, ...
b316e00624fdd319de973f5ed5c168f4931d84697f084cdf5e8d40232421885f
Python
7,698
234
# -*- coding: utf-8 -*- '''iCSD toolbox demonstration script''' import matplotlib.pyplot as plt import numpy as np import icsd from scipy import io import neo import quantities as pq #patch quantities with the SI unit Siemens if it does not exist for symbol, prefix, definition, u_symbol in zip( ['siemens', 'S', 'm...
f185921128a6295bf9f611fe9f09d0040011d3dab023e4f343a63fbdc3ca1380
Python
7,701
220
"""This script produces a table summarising first level distributions.""" import os from copy import deepcopy import glmtools as glm import h5py import matplotlib.pyplot as plt import mne import numpy as np import osl import sails import lemon_plotting from glm_config import cfg from lemon_support import (get_eeg_da...
0ac8b2283695a56cf376cd794b6d04100837d8df0a01eb515a5c9af7e31adf67
Python
7,702
186
import os import torch import torchvision from torch import nn, optim from torch.utils.data import DataLoader from torchvision import transforms # from matplotlib import pyplot as plt import time # from tqdm import * from torch.utils.tensorboard import SummaryWriter from torchvision.models import ViT_B_16_Weights impo...
c39ad9c3485fdaf05e1bfa48b75b844fca71fa21d317063892fb6a007bd727d2
Python
7,702
200
from keras.callbacks import Callback from keras import backend as K import numpy as np def clr_check_args(args): req_keys = ['clr_mode','clr_base_lr','clr_max_lr','clr_gamma'] keys_present = True for key in req_keys: if key not in args.keys(): keys_present = False return keys_prese...
4529b3c87c39b18065b9c2ffdac6a5f5b5a2ca9e5ed5bc3a5b20ce1a26caaf38
Python
7,705
184
import torch, random, os import torch.nn as nn import numpy as np config = { 'hidden_unit': 64, 'fc_layer': 2, 'self_atten_layer': 2, 'attention_heads': 4, 'num_neighbor': 30, 'fc_dropout': 0.2, 'attention_dropout': 0, 'class_num': 1 } class Self_Attention(nn.Module): def __init_...
5be12697e20c6591c2f7962c1ee458e4c5acb0d997946f43f4341a40e2341169
Python
7,705
191
## Script: determine_inv.py ## Description: Determine the status of inversion. ## Author: Kevin Lee ## Date: 2022.01.12 # NOTE: Criteria used to determine inversion form was revised (2022-02-22) import argparse from utils import InputStream from utils import PathType import sys,os import numpy as np impor...
54f1f6567efdf55e554114f0b98eb195931aa14b28efe69db534e0c5ac5c8230
Python
7,711
252
""" :func:`~pandas.eval` source string parsing functions """ from __future__ import annotations from enum import Enum from io import StringIO from keyword import iskeyword import token import tokenize from typing import TYPE_CHECKING if TYPE_CHECKING: from collections.abc import ( Hashable, Itera...
961758ae300a34a96351a22be1fafb1991821f58e7b7d98fc99f4161e566383c
Python
7,711
239
#!/usr/bin/env python # coding: utf-8 # # RNA Velocity analysis using velocyto, Seurat, and scVelo (Part 2: Analysis) # ## For WILD-TYPE (wt) sample GLIA+NEURONS -- VERSION 1.1 # ### Kat Beigel (beigelk@chop.edu) # #### 7/21/23 # See the following pages for guides on how to combine Seurat and velocyto data for scVelo...
c144bf5f55b203070c31391669bf428c84089fc24a6bfd7315bc15b802628ee0
Python
7,711
187
# 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...
7fb300fc3b626bd425b249f32c02e71a06169b1d389c2aa9c6cd871b76315b6b
Python
7,712
181
#%% # -*- coding: utf-8 -*- import os import numpy as np import pickle as pkl from scipy.optimize import minimize from scipy.interpolate import interp2d import matplotlib import matplotlib.pyplot as plt from matplotlib.patches import Polygon as matplotlib_polygon import imageio factor1 = 15 #1e+5 #1e+10 ...
3eb77eaaab1661900fcdeca05a437a83d4d8b822f92187d94ffac22dcec7a95b
Python
7,716
225
"""Test data export""" import pathlib import tempfile from unittest import mock import dclab import numpy as np from PyQt6 import QtCore, QtWidgets import pytest from shapeout2.gui.main import ShapeOut2 from shapeout2.gui import export from shapeout2 import session data_path = pathlib.Path(__file__).parent / "data" ...
70e0a5a94d10273bcb7349d4daf418a6a12c6217a9c142f5e74789f580c416a1
Python
7,717
240
""" 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 logging from collections import deque from pathlib import Path from typing import Deque, Optional import ase import torch from torch_...
7b16f5880e558695569392738a37b2980671a19e652a2019d31b346a994d15b1
Python
7,717
205
# 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...
4f475d0212e26c38e9b0d3c9e1525df84d7888c24afb13893b1772995d57d627
Python
7,718
222
"""Hermetic checks for Clock Explorer generation and committed artifacts. The generator test uses temporary input and output paths; committed-artifact checks validate docs/_static without network access. """ import csv import importlib.util import json import os import sys from unittest.mock import Mock import torch...
d30835705780af1d5a12ccf83836a8c4cff62500bb118aac31f301ac7de956b5
Python
7,719
134
#! /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...
2e0bb969d035e837253151b6434551097b74f7b0c5085c29077d4021f5d36411
Python
7,721
228
# MOFTransformer version 2.2.0 import torch from torch.optim import AdamW from transformers import ( get_polynomial_decay_schedule_with_warmup, get_cosine_schedule_with_warmup, get_constant_schedule, get_constant_schedule_with_warmup, ) from moftransformer.gadgets.my_metrics import Accuracy...
8c787b4101e3ed1c0c3ea1d54c2f607396d6f55a3d6a317db6d2bc75ce1c8ba1
Python
7,721
279
import gc import numpy as np from pandas import ( DatetimeIndex, Index, IntervalIndex, MultiIndex, RangeIndex, Series, date_range, ) class SetOperations: params = ( ["monotonic", "non_monotonic"], ["datetime", "date_string", "int", "strings", "ea_int"], ["inte...
c181aad0d8ad338f5714883e8d11698dd4acd5b2219bbbf7f71f4e3c1f2116ba
Python
7,721
193
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, CGConv, DiffGroupNorm ) from torch_scatter ...
e585c72f5d1d89a08cfa340ef21d6c32569b0e050827c26620834ec281989c4d
Python
7,721
212
import os.path from torch.utils.data import DataLoader import torch from torch.utils.data import Dataset from tqdm import tqdm import re import pytorch_lightning as pl class SCARTransformerDataset(Dataset): def __init__(self, consults, labels, tokenizer, max_len): self.tokenizer = tokenizer self.c...
34c7406896ec6be92c648fe1de05ec4efc8816849492b4e83aa37ca5c3f1773d
Python
7,722
195
from typing import ( Any, final, ) import pytest import pandas as pd import pandas._testing as tm class BaseReduceTests: """ Reduction specific tests. Generally these only make sense for numeric/boolean operations. """ def _supports_reduction(self, ser: pd.Series, op_name: str) -> bool:...
2315dab415a86c782ff1c0915d74c51cff0e76b7513b047b3e0404949883f604
Python
7,723
199
import numpy as np import pytest import pandas as pd def test_is_monotonic_increasing_lexsorted(lexsorted_two_level_string_multiindex): # string ordering mi = lexsorted_two_level_string_multiindex assert mi.is_monotonic_increasing is False assert pd.Index(mi.values).is_monotonic_increasing is False ...
fe6b442765dd7204d59091cfb33c0bbe75f70664b8e356c1d5725fdf515ab2c8
Python
7,723
213
''' update_dynamodb_published_skeletons.py Update a janelia-neuronbridge-skeletons DynamoDB table. ''' import argparse import collections from operator import attrgetter import sys import boto3 import inquirer from inquirer.themes import BlueComposure from tqdm import tqdm import jrc_common.jrc_common as JRC # py...
e445c21a07719ea08a257bf15fed9e3088b3afb13de4f3c4e6d1763ae14af705
Python
7,728
194
# 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...
df0c2d194ee967840ac0191b1933dba7bc4ac3c16bcf80d24f1f581bb64c6394
Python
7,730
206
import numpy as np import os from kcsd import csd_profile as CSD from kcsd import KCSD2D from scipy.integrate import simps from scipy.interpolate import griddata from figure_properties import * import matplotlib.pyplot as plt import matplotlib.cm as cm import matplotlib.gridspec as gridspec def integrate_2d(csd_at, t...
2f6cc6aa6daac8e6af61c2d1e9aa97b698062dad5528c1038290b0812c3470d5
Python
7,732
235
from typing import * import numpy as np import pytorch_lightning as pl import torch from pytorch_tabnet.tab_network import (EmbeddingGenerator, RandomObfuscator, TabNetDecoder, TabNetEncoder) # ALL THIS IS FLATTENING THE API FROM https://github.com/dreamquark-ai/tabnet class N...
340a26f20d9bec790c075b01c8ccca1292d707b768b0f36a80d041186755eedf
Python
7,733
221
import operator import re import numpy as np import pytest import pandas as pd import pandas._testing as tm class TestDataFrameLogicalOperators: # &, |, ^ @pytest.mark.parametrize( "left, right, op, expected", [ ( [True, False, np.nan], [True, Fal...
7a448a8f06dbba3ce83533519214f96d01658c612464143724de227ebb7a167b
Python
7,736
251
import h5py import numpy as np import os import pandas as pd import sys from .summarydata import SummaryData from . import preprocessing from . import metrics from . import utils from cellex import ES_METRICS class ESObject(object): """A class that integrates the CELLEX workflow to compute ES Workflow: filte...
ac19989299c9f6f405894bf0883ded591795a3325aa54e52a8887b853aab5f49
Python
7,737
206
"""Bounded BED/BEDPE EOF regressions for #804 / #757 item 7.""" import gzip import subprocess import sys import pytest from conftest import macs3_env from MACS3.Utilities.Constants import READ_BUFFER_SIZE SCRIPT = r''' import sys from MACS3.IO.Parser import BEDParser, BEDPEParser, StrandFormatError from MACS3.Sign...
cca062ff50cc9752db4b14980cf3993d377b11c77642cf6ee366386c3b42bcac
Python
7,739
230
from io import BytesIO import os import pathlib import tarfile import zipfile import numpy as np import pytest from pandas.compat.pyarrow import pa_version_under17p0 from pandas.errors import Pandas4Warning import pandas as pd import pandas._testing as tm from pandas.util import _test_decorators as td @pytest.fixt...
56110a2a71fbd16a032c470780b73ad543721f5a353b7c3466a6ff2e5f82ae5e
Python
7,741
265
import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl # 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 linewidt...
617a4ac7d62a10bcefd123785768b52d1f59323cb14db15e6d0514f35cff8207
Python
7,744
200
# 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...
a2570686bc305357cfa0972b4f6687df79b68a1d4b8dc4e9a684a6aa83bbd78c
Python
7,744
182
"""EnvPool vectorized environment wrapper for rl_games. Uses envpool's native gymnasium API. Requires envpool >= 1.2.6 on Python 3.12+ (randomized MyoSuite resets; wheels start at cp312) with an envpool 1.2.5 fallback on Python 3.11 — both verified against numpy 2.x: 1.2.6 + numpy 2.4.4 (CartPole, HalfCheetah and the ...
5843cd1c8d0690a99d9ec83f5a74c6cccaab91fe0135b7a0a221d07058733dbe
Python
7,750
205
import socket import serial import time import schedule import smtplib import threading import queue from datetime import datetime from email.mime.text import MIMEText gmail_user = '' gmail_password = '' arduino_timeout_s = 1500 mailing_list = [''] # ['me@gmail.com', 'bill@gmail.com'] mail_q = queue.Q...
980fbf6a5bf87e9ef816a986979484ae36202986044b401d7f0aa733338296e5
Python
7,751
269
import inspect import linecache import pathlib import warnings from functools import cache, cached_property, partial from itertools import chain from typing import * import anndata as an import numpy as np import pandas as pd import torch from scipy.sparse import issparse from sklearn.model_selection import train_test...
d6b9a379499909043cfa740f7f8370ae6f0ecd5630bf0e18d797b44288570a89
Python
7,758
239
import re import numpy as np import pytest from pandas.errors import Pandas4Warning import pandas as pd import pandas._testing as tm @pytest.fixture def left(): return pd.DataFrame({"key": ["a", "c", "e"], "lvalue": [1, 2.0, 3]}) @pytest.fixture def right(): return pd.DataFrame({"key": ["b", "c", "d", "f...
54dee2b085c308332f9f5831ef905c09fadbbb64f7118cfe902cb0a9a591d254
Python
7,759
207
""" Utility functions for other submodules """ import warnings import itertools import logging import numpy as np from bids.layout import BIDSLayout mod_logger = logging.getLogger(__name__) def is_hemispherical(vecs): """Test whether all points on a unit sphere lie in the same hemisphere. Parameters ...
1f31650bb8345ae852da1bf522f92d402b5b1607aef493fd39ca52685b023454
Python
7,761
261
"""Test views.""" # ------------------------------------------------------------------------------ # Imports # ------------------------------------------------------------------------------ import numpy as np from numpy.testing import assert_allclose as ac from phylib.io.mock import artificial_waveforms from phylib.u...
6ba676e3a21206291c2c80132e4755bb58c9ca9e2498665d3eeaba70e39829c8
Python
7,765
223
# 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...
24e3123b918caa11336c55b5bb50ab43db9e36b58f4d87a932b8798f0fefb28e
Python
7,772
238
# -*- coding: utf-8 -*- # @File name: plot_waveforms_from_pkls.py # @Author: Alicia Garrido-Peña # @Date: 2023-08-10 22:38:38 # @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 f...
c9e4c618e85b02e16f47545d8bcbc971f0c62993edfa370919779732d1c9f1e3
Python
7,774
260
""" Tests for offsets.BDay """ from __future__ import annotations from datetime import ( date, datetime, timedelta, ) import numpy as np import pytest from pandas._libs.tslibs import iNaT from pandas._libs.tslibs.offsets import BDay import pandas as pd import pandas._testing as tm from pandas.tests.tse...
4be2c7c580fae39c72dc732f4de9e5932bd61baa77a1d2d6e1138234d44db6f2
Python
7,783
202
import numpy as np import pytest from pandas.errors import Pandas4Warning import pandas as pd import pandas._testing as tm from pandas.io.sas.sas_xport import ( XportReader, _parse_float_vec, ) from pandas.io.sas.sasreader import read_sas # CSV versions of test xpt files were obtained using the R foreign li...
7ee3dd9c9dd70bff27b3ebea3e2121edfcf19951e16fd7289d67bfa8a949dac5
Python
7,786
138
#!/usr/bin/env python # -*- coding: UTF-8 -*- # Created by Roberto Preste HEADERS_MAIN = ( ("Locus", "locus", "Locus to which the variant belongs"), ("FunctionalLocus", "func_locus", "Functional locus to which the variant belongs"), ("CodonPosition", "codon_position", "Codon position of the variant"),...
c791556db149e82bf506e4ac920bdb473ea565063d9cb935e58ff61fc47b2751
Python
7,786
123
# 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, ...
807f0cdedfde398109e5208570d8527611104e0a3499478e55280d151b948115
Python
7,788
211
# 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...
0d15dce17dbf6789712a0a993a564f6f7ea3997eb62d3739d96d534947f8ef0d
Python
7,789
217
#!/usr/bin/env python import os, sys, numpy, math, argparse from argparse import RawTextHelpFormatter ################################################### ### 0. script description and parsing arguments ### ################################################### synopsis1 = "\ report number of nodes in OrthNets that ...
6d1b4887d58d5130f05321bdd3c188f41c33f3f296a08cb679a406077a00ba47
Python
7,789
186
import os import sys from botocore.client import Config import ibm_boto3 import pandas as pd from pathlib import Path from shutil import rmtree import numpy as np import json import re import nda_helper as ndh sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.append(os.path.abspath(o...
c85bdb69b4f027d4f1c708735c8cfebfb495bef4a6caea21a48c2429c6480e89
Python
7,794
183
# 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...
ffd80adb6e59d25c78607a9dcf4f771152c7e4d85a25b096aebf44467034c19e
Python
7,794
230
"""Classes for formatting and writing trimmed reads to output. """ import sys from atropos.io import STDOUT, xopen, open_output from atropos.io.compression import splitext_compressed from atropos.io.seqio import create_seq_formatter from .filters import NoFilter class Writers(object): """Manages writing to one or ...
c241e6d78c168c326eabc97e0b3f2575615f7c029624b9d5af5e583c5532e532
Python
7,795
223
"""Test the recommend CLI command argument parsing.""" import argparse from unittest.mock import patch import pytest from lightning_pose.cli.commands.recommend import ( _resolve_output_path, get_parser, handle, ) class TestGetParser: """Test the get_parser function.""" def test_returns_argumen...
96992a616b766f405b695de53e4b7150b80cc4fc727ead167c31841880c3c9c4
Python
7,796
270
# -*- coding: utf-8 -*- """ Created on Tue Jan 31 14:57:55 2023 @author: jeanbaptiste """ import json import matplotlib.pyplot as plt import numpy as np import deepcellcontrol as dcc # Optogenetic input sequence # light_sequence = [0]*24 + [1]*180 + [0, 1]*180 + [0] * 180 + [0, 1] * 180 light_sequence = [0]*4*12 + ...
fd8c47b5ec31d59cb6b8f6fe0275241de11779c9f1d0f83271286d2a32324a61
Python
7,796
218
#!/usr/bin/env python import os, sys, subprocess, math, numpy, argparse from argparse import RawTextHelpFormatter ################################################### ### 0. script description and parsing arguments ### ################################################### synopsis1 = "\ combine CLfinder results for...
981c6f57a056bd175206edf6f365c36f1f1b7cdb3ed890ae1907fb4c5f61dded
Python
7,797
188
import numpy as np, matplotlib.pyplot as plt, sys import pumpprobe as pp, wormdatamodel as wormdm from scipy.optimize import curve_fit import matplotlib.ticker as ticker ds_list = "/projects/LEIFER/francesco/funatlas_list.txt" ds_tags = None ds_exclude_tags = "mutant" ds_exclude_i = [] inclall_occ = "--inclall-occ" in...
4948dad82db51d3241903a0bf0c516e8e9fbb08adf631842d1675fd275ad28ec
Python
7,798
204
''' Methods for fast binning of synapse activation dask dataframe. Exemplary use: groupby = ['EI'] values = synapse_activation_postprocess_dask(mdb['synapse_activation'], groupby = groupby, prefun = prefun, applyfun = applyfun, postfun = postfun) values = values.compute(get = c.get) print 'save' ...
01c5d12e7549dc4a8ffae94998c24c81e49ef92880e76b4219d58484beb3a3de
Python
7,799
177
"""Regressions for #799 / #757: pileups after sampling empties a chromosome.""" from pathlib import Path import random import subprocess import sys import textwrap import MACS3 import pytest from conftest import macs3_env, no_core_dumps def run_probe(tmp_path, source): script = tmp_path / "probe.py" script...
1d671abc60bae7e6774a4584ba27fc929be63edf4b04bd711f57721e0064337d
Python
7,803
202
""" Copied (and improved) from: https://github.com/fadel/pytorch_ema/blob/master/torch_ema/ema.py (MIT license) """ from __future__ import division, unicode_literals import copy import weakref from typing import Iterable, Optional import torch # Partially based on: # https://github.com/tensorflow/tensorflow/blob/r...
796de4ece1a1a49a9ae7668c556dc504e93edebe6ea071bd135eacd6573ad936
Python
7,810
186
"""Original-author oracle regressions for PCBrainAge and PCGrimAge proxies.""" import importlib import importlib.util import pytest import torch MODEL_NAMES = [ "PCBrainAge", "PCGrimAgePackYrs", "PCGrimAgeADM", "PCGrimAgeB2M", "PCGrimAgeCystatinC", "PCGrimAgeGDF15", "PCGrimAgeLeptin", ...
94a731dac8081e7c8ed401c8a7736314f3f1e98d053f3f38113c68d176df4102
Python
7,814
209
import glob import numpy as np import os import tifffile import pathlib from image_registration.czi import get_image from image_registration.registration import get_tiffiles, get_aligned_images, get_aligned_tiffiles, final_image, pyramidal_final_image from sys import getsizeof import gc import pandas as pd from datetim...
eb258d74bbf2eace4c29ddad39f7181574aafef55653002ab837a9719396d766
Python
7,814
232
""" Atropos version {} usage: atropos [--config <config file>] <command> [options] commands -------- {} optional arguments: -h, --help show this help message and exit --config <config file> provide options in a config file Use "atropos <command> --help" to see all options for a specific comman...
7e8e984e5265e93f6d40d1cdb196533fe820af51de3f6a94ffbd5528f3a40b83
Python
7,815
193
# 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...
6c629310112e06f278d50f5b116e4cad885f5b8fe31d1273dedc2b33f4689d2a
Python
7,822
191
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, DiffGroupNorm ) from torch_scatter import scatte...
de005123a3374fccf0cb1c1e038677ecd71c96be38fe2e3dbde7d92c4c8216b6
Python
7,822
197
from typing import ( Any, final, ) import pytest import pandas as pd import pandas._testing as tm class BaseReduceTests: """ Reduction specific tests. Generally these only make sense for numeric/boolean operations. """ def _supports_reduction(self, ser: pd.Series, op_name: str) -> bool:...
96da9727879e9c888f04d16324019d15dddd2e7267612b769e3f9440be074a50
Python
7,826
177
from tensorflow.keras.layers import BatchNormalization, Layer, InputSpec from tensorflow.keras import initializers, regularizers, constraints from tensorflow.keras import backend as K import tensorflow as tf from tensorflow.python.keras.backend import _regular_normalize_batch_in_training class BatchNormalizationF16(L...
9ba9942806e3f2cebee3ac8fa1bfca6d195ffbb32f6d0499af2ab9c7924099b5
Python
7,827
227
"""Global attention modules (Luong / Bahdanau)""" import torch import torch.nn as nn import torch.nn.functional as F from onmt.modules.sparse_activations import sparsemax from onmt.utils.misc import aeq, sequence_mask # This class is mainly used by decoder.py for RNNs but also # by the CNN / transformer decoder when ...
81247b7a48604d2e7f88cfbc7f0be0aa6574104d27959b971170e197bc8abc79
Python
7,829
232
""" Tests that comments are properly handled during parsing for all of the parsers defined in parsers.py """ from io import StringIO import numpy as np import pytest import pandas as pd import pandas._testing as tm @pytest.mark.parametrize("na_values", [None, ["NaN"]]) def test_comment(all_parsers, na_values): ...
6078b9e6edec2da97d3e94e814fed3f80d308ba6766c7a84a651a4d6161c3edd
Python
7,832
211
# -*- coding: utf-8 -*- import torch from itertools import accumulate from onmt.constants import SubwordMarker def make_batch_align_matrix(index_tensor, size=None, normalize=False): """ Convert a sparse index_tensor into a batch of alignment matrix, with row normalize to the sum of 1 if set normalize. ...
f829364a2a2fc35660f62bb0b767cfd4277e67ea05f2ddd4ae2b14c83c89a96f
Python
7,832
221
"""Scatter view.""" # ----------------------------------------------------------------------------- # Imports # ----------------------------------------------------------------------------- import logging import numpy as np from phylib.io.array import _index_of from phylib.utils import emit from phy.plot.visuals i...
41952cd2b2e5705d7d74a68d52e15bcf8f1cbf2df9038e62345ddb32599f882b
Python
7,833
249
"""Chromosight's plotting submodule contains utilities to visualize the pileup of detected patterns or the input matrix. It also implements an interactive map recording the coordinates of double clicks.""" import os import sys import numpy as np from matplotlib import pyplot as plt def pileup_plot(pileup_pattern, ou...
1691755cdcc20bf7646c66836e88f8a05f10358e429da78ed116c588e0cff19e
Python
7,836
185
import subprocess from pathlib import Path import numpy as np import nibabel as nib from multiprocessing import Pool import pandas as pd import re def nda_s3_download_single_file(pkg_id, s3_path, out_dir, username, passwd): cmd = (f'downloadcmd --package {pkg_id} {s3_path} -u {username} ' f'-p {passwd} ...
c0f9a1016bccbf750711c0247d2b047eb5e5326b7e70404e16b9804cafc6b89b
Python
7,845
240
import h5py import numpy as np import sigpy as sp import torchvision.transforms as T from sigpy.mri import app, muse, retro, sms import os DIR = os.path.dirname(os.path.realpath(__file__)) print('> current directory: ', DIR) HOME_DIR = DIR.rsplit('/', 1)[0].rsplit('/', 1)[0] DAT_DIR = HOME_DIR + '/data' print('> da...
7a5fdf5c2009ba17ebb87df4707ddf55eba51a5fb6d66227470b04fd9ef8ac9a
Python
7,852
215
# cython: language_level=3 """Internal, caller-owned pileup storage; no scoring or caller imports. The parent owns the directory until destroy(). Forked workers inherit its path and write private copies of the chromosome-file mapping. Returned paths are registered by the parent; directory-wide cleanup also finds unret...
63d829304ff0188a96d7f5ef5dd4b922d168588a855e6e269f7e05182ec02cb6
Python
7,855
242
# # File to train networks built from the hnn.py class. # # This file establishes the clebsch gordan coefficients, sets up an hnn with given parameters, # loads holograms from .npy files, and then tests the network via a function call. # from argparse import ArgumentParser import logging import os import sys import k...
a217ac4e9fec965c288d9d74f57d8ab610f53eb9652d36b22e197ecfba03ffb1
Python
7,859
206
import math import random import numpy as np import os import json from tqdm import tqdm from math import ceil, floor, sqrt from .readPDB import readPDB, readPDB2Pd def resize_data(xyz, content, edge_length, relaxed=True): if relaxed: chainAchar = 'A' chainBchar = 'B' else: chainAcha...
6be53b65456a7d681d53fc1e0d402c61e6e0463b0142e08221beaaccef7caa9f
Python
7,861
259
import random import re def gen_headers(cv_file): """Generate the headers that will be used in the ANOVA. Arguments --------- cv_file : str File containing the results of the resumed CV analysis. Raises ------ TypeError If cv_vile is not a resumed CV file. Returns ...
bab1cc18a0cedd2862c47908455ea3e945d7574684f168eacc20dc13437c314c
Python
7,864
248
# 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...
88262246d2b5b927cdc83894a5a0fcacae94a43dad10e64f20fc8db1e3fed4c8
Python
7,866
212
# 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...
c257a76f0b646c7e09092b6c0e71eef3250ab17f5a1ee17453d5c5b4d603e80a
Python
7,869
265
from collections import defaultdict from datetime import datetime import pandas as pd import yaml from bokeh.embed import components from bokeh.layouts import row from bokeh.models import ( ColumnDataSource, CrosshairTool, HoverTool, PanTool, Range1d, ResetTool, SaveTool, ) from bokeh.palet...
7323d23968bc491aca47dd62e7f7633da163eff1b42501e9f2d637b7b34717e0
Python
7,871
238
""" Tests for DatetimeIndex timezone-related methods """ from datetime import ( UTC, datetime, timedelta, tzinfo, ) import zoneinfo from dateutil.tz import gettz import numpy as np import pytest from pandas._libs.tslibs import ( conversion, timezones, ) import pandas as pd import pandas._tes...
7898d0f96204f9e8c441a30affc2a98655f6b0fa10862514a249e2bce86c8687
Python
7,871
252
# ---------------------------------------------------------------------------- # Simulation general parameters data.dt = 0.2 lb.h.dt = data.dt lb.h.steps_per_ms = 1.0 / lb.h.dt data.recordDend = True data.recordGDend = False if data.actType == 'passive': data.recordGDend = False if data.actType == 'aSoma': data.recordG...
0268147e8a0ef9d43d12229fb8e92a74b22c5cedef84df019d0383e283d8510b
Python
7,873
192
"""Session 39 — native setup() phase 5a: time-series accessor parity. The supervised + unsupervised tabular tasks landed full native setup in phases 1-4 (s35-s38). Phase 5 is the time-series drain — the most involved because TS uses sktime, has its own data shape (univariate Series with PeriodIndex / DatetimeIndex), i...
9048402ec4b4493b351e0e53af08c7468872892bd3ee82d3897ffe94ff42946e
Python
7,877
191
# 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...
a00afa9480044fa932c9ef65715e2ac0e52b99556d5e007019cfd15ff060ad06
Python
7,878
186
"""Conjugate Gradient for linear systems with self-adjoint positive semidefinite linear operator.""" from collections.abc import Callable, Sequence import torch from typing_extensions import Unpack, overload from mrpro.algorithms.optimizers.OptimizerStatus import OptimizerStatus from mrpro.operators.LinearOperator i...
8c998c15c398f24edca65ae4330c6f467e9c132296046f1f508aa7a2314c3c41
Python
7,880
219
"""Sync per-clock Hugging Face repositories under the pyaging organization. Each clock gets its own model repo (``pyaging/<clock_name>``) containing the weight file, a ``config.json`` with the audited clock metadata (also the file the Hub counts as a download), and a generated model card. A clock whose preprocessing n...
95cbf55563defc08e2fd732da3f8c5283bcef1dc15e6e527870dffda55d322fc
Python
7,887
203
import numpy as np import scipy as sp import scipy.linalg as la from base.curves import Curve, remesh from base import kernelFunctions as kff, pointEvolution as evol import matplotlib.pyplot as plt Npts = 200 def diffusion(c0, t1, K, dt = 0.1, iso_par = 1., area_par=1., peri_par = 1.0, stdev=1., K2=Non...
ea2b3c78f83a7f03264339c6daeab1e041c571c64653c340418edaa02a99babc
Python
7,887
236
from pathlib import Path import shutil import os import pytest import torch from kilosort import io from kilosort.utils import download_probes, DOWNLOADS_DIR @pytest.fixture(scope='session') def gpu(request): return request.config.getoption('--gpu') @pytest.fixture(scope='session') def download(request): r...
c264acea79981f53c822273f7735169326bb913e34af762bfc18e5519797261f
Python
7,894
218
import logging import socket import struct import socket import numpy as np import gadgetron from modules import parser, socketmaker, structmaker class MLCImageArrayParser(parser.Parser): """ Child class for extract relevant meta data from the acquisition/connection that needs to be sent...
9455e91f0aa5a99b358556c59e48764e6e739d8bf7eeebc8cabd9e866c8cb394
Python
7,895
209
# 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...
e24c4e212e7d41ef10b8c2604b934897d09fb6bfb38ed352e65bb65b0d6f15df
Python
7,896
224
# -*- coding: utf-8 -*- from functools import partial import torch from torchtext.data import Field, RawField from onmt.constants import DefaultTokens from onmt.inputters.datareader_base import DataReaderBase class TextDataReader(DataReaderBase): def read(self, sequences, side, features={}): """Read tex...
5c0dfd976798437612b4f9810ef079c730391bacaea74ee4e7cee43dce750ef4
Python
7,901
204
import tensorflow as tf import subprocess import sys import numpy as np from halo import Halo from const import SIZE, LABELS, FILTERED_LABELS, LABEL_MAP, FREQ_LIST, FREQ_PROP from dataset import load_all_datasets def model(img, labels, dims): init = tf.contrib.layers.xavier_initializer() training = tf.plac...
7b3f13fd4c02a79eed42ec3d4364e218afd676bcb070e8e82893893de4c54177
Python
7,902
243
""" Simulate data for training or testing using msprime. Author: Sara Matheison, Zhanpeng Wang, Jiaping Wang, Rebecca Riley Date: 9/27/22 """ # python imports import math import msprime # our imports import global_vars import util ################################################################################ # SIM...
f50b4595dbcf8f07b2ba8df78b60f5181c698b8497e9e07a64e9ffc567a4c054
Python
7,902
236
import functools import os import numpy as np import pandas as pd import torch from pymatgen.core.composition import Composition from torch.utils.data import Dataset from roost.core import Featurizer import pickle class CompositionData(Dataset): """ The CompositionData dataset is a wrapper for a dataset data...
a27b2cb6768f8a0a0feec8b8b79aac96d0e0443c602faa3f03d50adf377e3a1f
Python
7,905
223
import datetime import numpy as np import pytest from pandas.errors import DataError from pandas.core.dtypes.common import pandas_dtype import pandas as pd import pandas._testing as tm # gh-12373 : rolling functions error on float32 data # make sure rolling functions works for different dtypes # # further note tha...
9df6b57eef1c9b9321a4faab5be57ce2256c2ed8043e74cb2859cc7fb15e5eab
Python
7,907
144
import sys as sys import numpy as np import itertools from scipy.spatial.distance import cdist from scipy.stats import multivariate_normal from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt import numpy as np import time from MM2SF.basics.functions import * def angular_selector(trjname=None, rcut=...
da172545145d4af046e9523e702f82becd32046e903bfb0ee33161ee97711e27
Python
7,907
179
"""Build PCBrainAge and eight PCGrimAge proxies from author-derived coefficients. Normal deterministic rebuild (no R or network required):: uv run python clocks/build_pc_extensions.py Regenerate the compact coefficients and independent R oracle first:: uv run python clocks/build_pc_extensions.py --source-di...
9aac07d8289f6ac88ea9ae7a404b50389f294668b6210e255ce49f19a098205f
Python
7,911
245
"""Computation of the dissimilarity representation of a set of objects (streamlines) from a set of prototypes (streamlines) given a distance function. Some prototype selection algorithms are available. See Olivetti E., Nguyen T.B., Garyfallidis, E., The Approximation of the Dissimilarity Projection, http://dx.doi.org/...
ab7bf85bf4f1016530a59e67e9e89b196c0da3b69961bb24d52adf284e8c31be
Python
7,916
223
import torch import torch.nn as nn import time import numpy as np from tqdm import tqdm def to_np(x): return x.cpu().detach().numpy() def to_torch(x, device): return torch.from_numpy(x).to(device, torch.float32) class Tanh(nn.Module): def forward(self, inp): return torch.tanh(inp) def deri...
49dc14dd6019261a3cc6e629988d7758c4ef34e732700207886a9bb97086e2a6
Python
7,919
195
# %% # Imports from sklearn.preprocessing import StandardScaler from sklearn.decomposition import PCA from scipy.stats import gaussian_kde import numpy as np import os from pathlib import Path import matplotlib.pyplot as plt import matplotlib.backends.backend_pdf # plt.style.use('seaborn-talk') matplotlib.rc...
c3886e689efe79a7d5d66c68d38d33d92873e11f1d16f44180ad2981b37b45ce
Python
7,920
256
# Copyright 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 agre...