sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
c510bdcdee3bb883148887cdccdfcb2db9e36527572f4611578fd4c975021622 | Python | 5,278 | 147 | """
Iterates through a given collection of numpy arrays representing SLiM-produced
tree sequences, in a linear order.
Interfaces both the Generator class and the RealDataRandomIterator class.
The SlimIterator accepts a .txt file containing the paths to these numpy array files.
See process_slim.py for information on ge... |
9e3b258ee341921b086fa83d5fb9d16ba3b8fa6a53dae5bdf3c42de1c8e9b182 | Python | 5,279 | 132 | ###############################################################################
# This script reads scopus ids and retrieves the title, abstract, and publica #
# tion date for each of them. The script also compares the results with pubmed#
# results (that were previously organized using pubID2xls.py) and removes du- #
... |
37b56aabd8489364b1565fef4965471bcb65f76fdad251ff4c5b46f735d2444c | Python | 5,282 | 144 | """Model specification based on the attention-only paradigm."""
import tensorflow as tf
from ...hyperparams import ACTIVATION_FN_FACTORY, POSITIONAL_ENCODING_FACTORY
from ...layers import (
dense_attention_layer, embedding_layer, contextual_attention_layer
)
def ca_fn(features, labels, mode, params):
"""
... |
46a14b372d1ec6889a16fe934399af112f09ffd56c0badaa0a47d3792d687bcb | Python | 5,283 | 186 | import gzip
import sys
DEFAULT_ADAPTERS = [
"AGATCGGAAGAGCACACGTCTGAACTCCAGTCACACAGTGATCTCGTATGCCGTCTTCTGCTTG",
"AGATCGGAAGAGCGTCGTGTAGGGAAAGAGTGTAGATCTCGGTGGTCGCCGTATCATT"
]
class fileopen(object):
def __init__(self, path, mode='wt'):
self.close = False
if path == '-':
if any(... |
575f1e4828cd014152a21bb063fa0e121a07fea7cac4640f8858a0a49d03c156 | Python | 5,283 | 183 | """
.. _metas_cbma:
=========================================
Coordinate-based meta-analysis algorithms
=========================================
A tour of CBMA algorithms in NiMARE.
This tutorial is intended to provide a brief description and example of each of
the CBMA algorithms implemented in NiMARE.
For a more... |
123b7b62f3445530113ffe7eeb1b4fa33859e49833734f4a7355cfa45b63aeb6 | Python | 5,284 | 161 | import torch
import torch.nn as nn
import torch.nn.init as init
from torch.nn.parameter import Parameter
import math
from tnn.tensor_utils import mprod, mtran, t_eye
class tLinearLayer(nn.Module):
# only supports third-order tensors currently
def __init__(self, in_features, out_features, dim3, bias=True, act... |
2e763ad3b8997eedf03a80ebe085fa00773ec6db8d6234bb47452d8dd56ae886 | Python | 5,284 | 138 | # 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... |
af74968f0e56411c2112c9e9c2765182f143fe168fe5f4d22c8dba0793266c55 | Python | 5,287 | 123 | import pandas as pd
import numpy as np
from sklearn.neighbors import KernelDensity
from scipy.stats import norm
import matplotlib.pyplot as plt
import matplotlib.font_manager as fm
import seaborn as sns
import os
import sys
sys.path.append("prepare_data")
from create_drp_dict import *
if not os.path.exists('./Figures/... |
0c55ec608cc2c5f51e1b699c76d53fc9381c9f9f1ee7f14d369a7b20e52e5777 | Python | 5,288 | 149 | # 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... |
f0e440db406a37fbd69f4625f2a627bd9508d8faa116de0db0ba72e859ab917d | Python | 5,289 | 145 | # Time-stamp: <2024-10-02 16:48:17 Tao Liu>
"""Description: Filter duplicate reads depending on sequencing depth.
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).
"""
# ------------------------------------
#... |
3cf9607a8fed7e707216305b132a00122c8f9c9320c72ae2adb3649556654cac | Python | 5,294 | 152 | import argparse
from datetime import datetime
import matplotlib.pyplot as plt
import numpy as np
import os
from scipy.interpolate import RegularGridInterpolator
import windseer.utils as utils
import windseer.plotting as plotting
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description=
... |
c800f5e96b212fb1d8e18bd9637bedd9245a7f2d860ccc8b3fef6c1a0d8d5215 | Python | 5,298 | 155 | #!/usr/bin/env python
'''
Testcases for the neural network prediction
'''
import windseer.utils as utils
import windseer
import os
import torch
import unittest
windseer_path = os.path.dirname(windseer.__file__)
config_filename = os.path.join(
os.path.split(windseer_path)[0], 'configs', 'example.yaml'
)
cla... |
ce232542b35f577fa52a1ff46752bba00f0fad4f9e5ab89fa1ca556d310323b0 | Python | 5,298 | 159 | """Calculate degree of freedom"""
import argparse
from pathlib import Path
import pandas as pd
from fmriprep_denoise.dataset.timeseries import get_confounds
from fmriprep_denoise.dataset.fmriprep import (
get_prepro_strategy,
fetch_fmriprep_derivative,
generate_movement_summary,
)
def parse_args():
... |
49e8ae0dd66ea5fb0b4a00c68f46b3093451cf96f24d027e14b3929f0aabe71f | Python | 5,299 | 151 | # 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... |
c437debebb1047684c6ec7b327385b6d2f52abc2ffe10f51cae36f9c76bfe35a | Python | 5,301 | 164 |
import torch
import matplotlib.pyplot as plt
from tnn.utils import seed_everything, setup_parser
from examples.tensor_trajectories.utils import setup_circle_3D, setup_circle_3D_grid, split_data, DummyData
# setup parser
parser = setup_parser()
args = parser.parse_args()
# hard code some parameters
args.n_train = 120... |
d7dc5353350c57d8a1d31fa1fe6768fab4e67109ca26745aab16d768505d0f91 | Python | 5,301 | 156 | import numpy as np
from scipy.stats import rankdata
from scipy.spatial.distance import pdist, squareform
def compute_rank_matrix(data, metric="euclidean"):
"""
Computes the rank matrix of the input data.
Args:
data (np.ndarray or list(list(float))): dataset of shape (N,D), with N points and D fea... |
db5eeb05c963e5ab61829b076a7360ce9441deb0441cca7e08d214623cadce3c | Python | 5,301 | 116 | # SPDX-FileCopyrightText: Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of sourc... |
891208614f8cef9773f6d5300ab249673d0b49992c710164d319487989499506 | Python | 5,303 | 146 | """
Implementation of "Attention is All You Need"
"""
import torch.nn as nn
from onmt.encoders.encoder import EncoderBase
from onmt.modules import MultiHeadedAttention
from onmt.modules.position_ffn import PositionwiseFeedForward
from onmt.modules.position_ffn import ActivationFunction
from onmt.utils.misc import seq... |
dd20c897a1c396de1614ba96ec9b68dad34e819bad59c91931b98ae7e211d9f1 | Python | 5,303 | 175 | """
Shared methods for Index subclasses backed by ExtensionArray.
"""
from __future__ import annotations
from inspect import signature
from typing import (
TYPE_CHECKING,
TypeVar,
)
from pandas.util._decorators import cache_readonly
from pandas.core.dtypes.generic import ABCDataFrame
from pandas.core.index... |
3388185f0bdfff8c91504db85661911f6b91104350f2a756bd50592ae2923355 | Python | 5,305 | 166 | """generic datetimelike tests"""
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
class TestDatetimeLike:
@pytest.fixture(
params=[
pd.period_range("20130101", periods=5, freq="D"),
pd.TimedeltaIndex(
[
"0 days ... |
b9234fa4d47c9d2c4eb544fac84ff87cd9f33b4e951151dcdb47eb011e806a9a | Python | 5,305 | 163 | """Test nimare.workflows."""
import os.path as op
from nimare import cli, workflows
from nimare.tests.utils import get_test_data_path
def test_ale_workflow_function_smoke(tmp_path_factory):
"""Run smoke test for Sleuth ALE workflow."""
tmpdir = tmp_path_factory.mktemp("test_ale_workflow_function_smoke")
... |
e4e040abf522330a5d43e7efb3fd2afe7a4e431ce961158fbdc81554d9b8be19 | Python | 5,306 | 135 |
from tensorflow import keras
import cine
import tube2
import align2
import numpy as np
from skimage import transform, util, io as skio, morphology as morpho
from matplotlib import pyplot
import glob
from skimage import measure, morphology
import json
import itertools
BATCH = 8
model = keras.models.load_model("probos... |
97190e145b87294eace08cf4e2e40debb24db39fe02aef1b98179cccf370b5a5 | Python | 5,307 | 133 | from keras.callbacks import *
class CyclicLR(Callback):
"""This callback implements a cyclical learning rate policy (CLR).
The method cycles the learning rate between two boundaries with
some constant frequency, as detailed in this paper (https://arxiv.org/abs/1506.01186).
The amplitude of the cycle c... |
a2d6f975250d398fa35a65eff296cfdced6e4a7b351254de1638da50a08c49c6 | Python | 5,309 | 129 | #!/usr/bin/env python
__author__ = 'etseng@pacb.com'
"""
Demultiplex IsoSeq (SMRT Link 8.0) job output (without genome mapping)
"""
import os, re, sys
from csv import DictReader, DictWriter
from collections import defaultdict, Counter
from Bio import SeqIO
#hq1_id_rex = re.compile('(i\d+_HQ_\S+\|\S+)\/f\d+p\d+\/\d+'... |
dd22538cc6c656994b862e0a779e5678fe85e0f467d323134a714e6e1ed5674d | Python | 5,309 | 159 | # 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... |
ee12ae5084201754c19b7863bdba729accba7843015c2628f10d9b84678478eb | Python | 5,311 | 137 | import os
import logging
import argparse
import numpy as np
from .powderaverage.powderaverage import powder_average, normalize_sigma, save_data_as_npz
from .models.nexi_rm import NexiRiceMean
from .models.parameters.acq_parameters import AcquisitionParameters
from .models.parameters.save_parameters import save_estimati... |
241974ab3336d330c5c1c11b2d45e84b343783ec73c1069e50aa667db3e9b8b4 | Python | 5,315 | 111 | from tensorflow.keras import layers
import tensorflow as tf
from tensorflow import keras
from keras.applications import *
models = {
'Xception': (Xception, 'Xception', dict(include_preprocessing=True, method=xception.preprocess_input)),
'ResNet50': (ResNet50, 'ResNet50', dict(include_preprocessing=False, met... |
36ee2597a13fb1730a19199428d9d5aa5c074a6e3e92b4db5bbd2ad6309a7658 | Python | 5,315 | 169 | from functools import partial
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.tseries import offsets
def scoreatpercentile(a, per):
values = np.sort(a, axis=0)
idx = int(per / 1.0 * (values.shape[0] - 1))
if idx == values.shape[0] - 1:
retval = va... |
7d50a6e69b4857c821e4e6acf611a95da45451412d9446df0dbed3f4912a1cf9 | Python | 5,315 | 169 | 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])
... |
b1a18001ff6dbcab4610221cb1adda404e0c686f43e1b461783827a1b8209c31 | Python | 5,316 | 127 | import os
import sys
from copy import deepcopy
import torch.nn as nn
import torch
from evaluators.evaluator import Evaluator
from trainers.tf_trainer import TransformerTrainer, MyLogger
import pytorch_lightning as pl
from pytorch_lightning.callbacks import ModelCheckpoint
import datetime
from tables.generate_token_coun... |
10bed1ac74114761a6a9590e9e3decbe68925fbbca888ee6e93fac2de186d9b5 | Python | 5,317 | 174 | ''' bucket_status.py
Show status for every NeuronBridge library on AWS S3
'''
import json
import boto3
from aws_s3_lib import bucket_stats, get_objects, get_prefixes
def read_object(bucket, key):
''' Read a "counts_denormalized" object and return the number of objects
Keyword arguments:
buck... |
d094ae664a2a78c0298ee60fc3d81f5e4d44cc309c60c6344db68b9f4e8a1acc | Python | 5,320 | 117 | #!/usr/bin/env python
__author__ = 'etseng@pacb.com'
import os
import sys
try:
import vcf
except ImportError:
print("Cannot import vcf! Please install pyvcf!", file=sys.stderr)
sys.exit(-1)
from Bio import SeqIO
import phasing.io.SAMMPileUpReader as sp
import phasing.io.MPileUpVariantCaller as VC
from ph... |
297a52f9f486eaf2836ef6b8f5a2247c3e6e946357ca3f586614f0bc1844f0c6 | Python | 5,322 | 150 | # 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... |
c93846e59805d1a5a0cb6857e2c3242be5725674e3893d0c9e370064f9f3c0d8 | Python | 5,322 | 184 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
@pytest.fixture
def df1():
return pd.DataFrame(
{
"outer": [1, 1, 1, 2, 2, 2, 2, 3, 3, 4, 4],
"inner": [1, 2, 3, 1, 2, 3, 4, 1, 2, 1, 2],
"v1": np.linspace(0, 1, 11),
}
)
@p... |
619ceb4041de06cf66e837be5a1786790999a172da7bd93e09b19421bed1a27f | Python | 5,323 | 134 | from typing import Dict, FrozenSet, List, Optional, Tuple, Union
import numpy as np
import pandas as pd
from .. import utils
from ..logging import logger
from ..preprocessing.conversion import BASE_COLUMNS, CONVERSION_COLUMNS
def read_p_e(p_e_path: str, group_by: Optional[List[str]] = None) -> Dict[Union[str, Tuple... |
63b6c18de1f99eeb9cd40666c5e4a7053974e8dccb7b7e9c9a68e0eed6cca764 | Python | 5,323 | 126 | import pathlib
from typing import Union
import anndata as an
import pytorch_lightning as pl
from pytorch_lightning.callbacks import ModelCheckpoint, Timer, EarlyStopping
from scsims.lightning_train import DataModule
from scsims.model import SIMSClassifier
import pandas as pd
from sklearn.preprocessing import LabelEn... |
49b6d1cdcc817f957d8a22d29d8b0df5f9cf8181f09b735ae1daa71497e13a69 | Python | 5,324 | 126 | #!/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... |
6da4fddda3f35cd15d9f4b78c2e71b5e99586ea10db2afa8b84e09e6cddb167c | Python | 5,324 | 161 | from typing import (
Any,
)
from pandas.compat._optional import import_optional_dependency
from pandas.util._decorators import set_module
from pandas import DataFrame
from pandas.io._util import (
arrow_table_to_pandas,
suppress_pyarrow_values_warning,
)
@set_module("pandas")
def read_iceberg(
tabl... |
97b9a222dff8c1bed724233d3c6cdde24fc870b0c359802adc81cd881401211b | Python | 5,326 | 161 | # 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... |
e01021897eea1308e8d8a469bcdebbf8bfa32734dffe08e9945bbd99172bd6fc | Python | 5,326 | 5 | Lines = ['config = {\n', ' "experiment_folder": "/home/user/experiment", # Path to save outputs. Default: "/home/user/experiment"\n', '\n', ' "simulation_params": { \n', ' "scdata": "/home/user/experiment/data.h5ad", # Path to sc/snRNA-seq data, should be anndata\n', ' "n_samples": None, # Number... |
0e3de949fc8fb088a956788755421877b0287fed7638ae0796ae3c3695474565 | Python | 5,333 | 178 | """
Tests for values coercion in setitem-like operations on DataFrame.
For the most part, these should be multi-column DataFrames, otherwise
we would share the tests with Series.
"""
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
class TestDataFrameSetitemCoercion:
@pytest.ma... |
7d1d68893cff92df789be5edce76c07fa2a7dbaf707a281cfc4abc52d1336f73 | Python | 5,334 | 142 | """Description: Pileup alignment 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).
"""
# Time-stamp: <2025-02-15 14:33:43 Tao Liu>
# ------------------------------------
# python modules
# --------------... |
62028d8d79909387b904d8469438584dd82d9be29b1a96df107f1d3b1802997c | Python | 5,335 | 123 | from Environment import *
from contextlib import contextmanager
from distutils.version import LooseVersion
VERSION = '0.9.6'
class VISoRSample:
def __init__(self, filename=None):
self.transforms = {}
self.inverse_transforms = {}
self.column_spheres = {}
self.sphere = [[0, 0, 0], [0,... |
9cac8f45fbf4fd430024f6092f572ffa8277a94941db155d36dd543914d701b7 | Python | 5,335 | 129 | """
=====================================================================
Compute SESAME inverse solution on evoked data in volume source space
=====================================================================
In this example we shall compute SESAME inverse solution on evoked data in
a volume source space. Data ar... |
f07695bdbfc8348c23a427d954823095ef7e3fc0883720e6d8b44f173a35a2ae | Python | 5,336 | 93 | import sys
import argparse
import pickle
from cdr.baselines import anova
from cdr.config import Config
from cdr.util import nested, filter_models, get_partition_list, stderr
if __name__ == '__main__':
argparser = argparse.ArgumentParser('''
Performs pairwise likelihood ratio test for significance of d... |
74fca0d569c7fd0da4c69cda22e93a24f8353f6ad170cbbb44bf0d95cdf90441 | Python | 5,337 | 177 | import argparse
# Trains a new model using the same method described in our publication.
# We used a batch size of 16 and 20 epochs compared to the default params here.
def get_args():
parser = argparse.ArgumentParser(
description='Train UNet Model',
formatter_class=argparse.ArgumentDefaultsHelpF... |
ae08a1c6703154dfa20a5dafc11b89b3412965740c7e3eda4eb668d70bf7d6f8 | Python | 5,342 | 160 | # plot code for figureS7
# useful packages:
import matplotlib.gridspec as gridspec
from scipy import stats
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import scipy
import scipy.io as sio
import warnings
warnings.filterwarnings("ignore")
import pickle
from PIL import Image
from scipy.stat... |
5cefb5af743c92684b103c897c1decb116ce40416fe13b855e7dff64fcbac271 | Python | 5,343 | 130 | #!/usr/bin/env python
version = "v0.1.0.20220610"
import os,os.path,sys,re
from argparse import ArgumentParser
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '/home/hongxiaoning/pipeline/bin'))
import myc
import time
import pysam
def ReadCount(InputFile, OutputFile):
if not os.path.isfi... |
be7e02927e4f5e417bf54dac383ae9dd446e2f241ab6e7c7b0f1c78dbb4e82c4 | Python | 5,347 | 143 | import torch
from torch import Tensor
from torch.nn import Module
from torch.optim import Optimizer
import time
from tnn.training import optimizer_parameters, parameters_norm
from tnn.loss import tLoss
from copy import deepcopy
def train(net, criterion, optimizer, train_loader, val_loader, test_loader, scheduler=None... |
049ec27945e9288ec13f50075efb97e74b690f3ed58ac94723621e28c80fdc22 | Python | 5,348 | 141 | """Numerical phantom with ellipses."""
from collections.abc import Sequence
import torch
from einops import repeat
from mrpro.data.KData import KData
from mrpro.data.KHeader import KHeader
from mrpro.data.KTrajectory import KTrajectory
from mrpro.data.SpatialDimension import SpatialDimension
from mrpro.phantoms.phan... |
9eb4db494b2f0c2ec9419b8cf359a3caf8fc42390fd58e9fc3368254bb0493de | Python | 5,348 | 152 | import sys
import numpy as np
import mistofrutta as mf
import wormdatamodel as wormdm
import wormbrain as wormb
import matplotlib.pyplot as plt
import pumpprobe as pp
import savitzkygolay as sg
plt.rc('xtick',labelsize=14)
plt.rc('ytick',labelsize=14)
def rolling_window(a, window):
pad = np.ones(len(a.shape), dty... |
9c2549503a71953e74f74a9f640b3d3029557757e74e43a456cb47df9029f1ad | Python | 5,350 | 168 | """
Compute correlation between summary statistics and last hidden layer.
Author: Sara Mathieson
Date: 12/14/22
"""
# python imports
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import math
import numpy as np
import seaborn as sns
from sklearn.cluster import AgglomerativeClustering
import sys
TI... |
86eb5f64d68d1fafb169cbb2e9c2f499a5bfe260dae351c6d66c6c46460f8828 | Python | 5,352 | 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 logging
import os
import subprocess
import torch
import torch.distributed as dist
def setup(config):
if config["submit"]:
... |
13911de0b497cce81af7cd6291de777b193679201f59c3a9017ca9a400262bf8 | Python | 5,354 | 117 | #!/usr/bin/env python
'''
Testcases for the sparse evaluation
'''
import windseer.evaluation as eval
import windseer.utils as utils
import windseer
import numpy as np
import os
import torch
import unittest
windseer_path = os.path.dirname(windseer.__file__)
testdata_folder = os.path.join(windseer_path, 'test', 'testd... |
a98f9b18cd56ffb748c94ffe4d86366de9db932a7a769d33d62f83d31bb3847b | Python | 5,355 | 138 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
class TestDatetimeIndexFactorize:
def test_factorize(self):
idx1 = pd.DatetimeIndex(
["2014-01", "2014-01", "2014-02", "2014-02", "2014-03", "2014-03"]
)
exp_arr = np.array([0, 0, 1, 1, 2, 2], d... |
a7dab948498ca2dd33e476903b60552bf76fdaa661ed3e52e683f45ef93b5f70 | Python | 5,359 | 150 | __all__ = ["PeptideSpectralLibraryInMemory"]
from typing import Dict, Optional, Union, overload
import numpy as np
import numpy.typing as npt
import pandas as pd
from .abs import (
Columns,
Indices,
PeptideSpectralLibraryBase,
)
class PeptideSpectralLibraryInMemory(PeptideSpectralLibraryBase):
def ... |
5ab712ae26e9e9b7079b46d7328fd84dfd04eb79301817fdda652dff27a66f88 | Python | 5,364 | 267 | """Test Qt utilities."""
# ------------------------------------------------------------------------------
# Imports
# ------------------------------------------------------------------------------
from pytest import raises
from ..qt import (
AsyncCaller,
Debouncer,
QApplication,
QMessageBox,
Qt,
... |
82386330018d893e36abc25821e432628f6aadff5758e6a2672decce219914e7 | Python | 5,364 | 151 | """
The most famous integral in quantum mechanics is the Feynman path integral.
In principle, the quantum mechanics of any system (with a classical limit)
can be reduced to a problem in multidimensional integration. Normally there
are too many variables, and the integrand is too peaky to attempt using
something like ... |
8f904aecb1d7d0fdc1b5c83778b427f46f0d90d06b8f6880cff70378a2862a39 | Python | 5,364 | 167 | #!/usr/bin/env python
'''
Testcases for the neural network prediction
'''
import windseer.data as data
import windseer.utils as utils
import windseer.nn as nn
import windseer
import h5py
import numpy as np
import os
import torch
import unittest
windseer_path = os.path.dirname(windseer.__file__)
testdata_folder = os.... |
11b804ffa9873725abd769a47f895ba2b0913a17494b8f6efee6447b2cce8b7e | Python | 5,370 | 145 | from AYN_Package.Task.ObjectDetection.D2.YOLO.V4.Predictor import YOLOV4Predictor
from AYN_Package.Task.ObjectDetection.D2.YOLO.V5.Predictor import YOLOV5Predictor
from AYN_Package.Task.ObjectDetection.D2.YOLO.V4.Tools import YOLOV4Tool
from AYN_Package.Task.ObjectDetection.D2.YOLO.V5.Tools import YOLOV5Tool
from A... |
16b659ecd6830c9b3259d11343117fd165ff6941ee012cbc32c9b5994f415fea | Python | 5,370 | 120 | from PyQt5 import QtWidgets, QtCore
import pyqtgraph as pg
from brainflow import BoardShim, DataFilter, FilterTypes, DetrendOperations
import pandas as pd
from brainflow.board_shim import BoardShim, BrainFlowInputParams, BoardIds, LogLevels
from brainflow.data_filter import DataFilter, DetrendOperations
import time
# ... |
2f3427a1fec6186b62ff68de7782e5e3f0f4cb1d16be9c2845fce21eeefd0b91 | Python | 5,373 | 126 | """
===============================================================================
Compute SESAME inverse solution on evoked data with given source location prior
===============================================================================
In this example we shall apply SESAME on an evoked dataset,
corresponding t... |
3c377461264d5924b0bbd677823bfb6552f132c360586af910416bda8b923fe9 | Python | 5,376 | 155 | # 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... |
959d676cc7bc04524bf5d570f9cad5d59937cf9488dd270e2eff30696c6be083 | Python | 5,376 | 158 | #%%
#Imports
import numpy as np
from pathlib import Path
import matplotlib.pyplot as plt
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.decomposition import PCA
from scipy.s... |
a8e9bda1db6e837570da15e614c7854d48756378f60fad00febead83e4dbed2a | Python | 5,376 | 98 | import torch
from . import math, kinematic_model
rot_id = [1,2,3,4,5,6,9,12,13,14,15,16,17,18,19,0]
Jtr_parent = [-1, -1, -1, 0, 1, 2, 3, 4, 5, 8, 8, 8, 9, 10, 11, 13, 14, 15, 16]
Jtr_mask = [1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]
def glb2local(glb_pose):
global_full_pose = tor... |
a835674e91d8441f09434386b6eb3b388ac0401072699ecda779343a0b269836 | Python | 5,380 | 148 | # pyright: reportMissingImports=false
from __future__ import annotations
from typing import (
TYPE_CHECKING,
Any,
)
import warnings
from pandas.compat._optional import import_optional_dependency
from pandas.errors import Pandas4Warning
from pandas.util._exceptions import find_stack_level
from pandas.io.excel... |
39a1c4e2314156a9282a247f0cd7457d51d19827ed4ca4971133b4434c051439 | Python | 5,382 | 164 | from __future__ import annotations
from typing import (
TYPE_CHECKING,
NamedTuple,
)
from pandas.core.dtypes.common import is_1d_only_ea_dtype
if TYPE_CHECKING:
from collections.abc import (
Callable,
Iterator,
)
from pandas._libs.internals import BlockPlacement
from pandas._... |
650668653cd62ad1341e52dbd6aa28f7e8a8adbcd604d91640625c1d9563c0c3 | Python | 5,382 | 194 | # ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.15.0
# kernelspec:
# display_name: ol-connectome
# language: python
# name: ol-connectome
# ---
# %% [markdown]
# ### Plot the No. of cel... |
860d32e38b0dd4a8631acda5c5683e868ccd046a537887b7b3cdedcc04009f24 | Python | 5,387 | 162 | import pathlib
import shutil
import tempfile
import dclab
import numpy as np
from PyQt6 import QtCore, QtWidgets
import pytest
from shapeout2.gui.main import ShapeOut2
from shapeout2.gui.export.e2filter import ExportFilter
data_path = pathlib.Path(__file__).parent / "data"
@pytest.fixture(autouse=True)
def run_ar... |
ae4d6aae96928472f9e7b93d5a3916cf6f9582f38ce23770b9779a3c7181405a | Python | 5,388 | 137 | import numpy as np, matplotlib.pyplot as plt
import os, sys, json
import pumpprobe as pp
plt.rc("xtick",labelsize=18)
plt.rc("ytick",labelsize=18)
plt.rc("axes",labelsize=18)
merge = "--no-merge" not in sys.argv
print("Merge:",merge)
unc31 = "--unc31" in sys.argv
strain = "" if not unc31 else "unc31"
ds_tags = None i... |
19072062270fd1c5ad9127a6799ad79d89399b70f15cb86a265bed80e0365145 | Python | 5,390 | 151 |
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 16 17:09:27 2021
@author: Daniel Hulsey
this script aligns a ccf to an individual session, and extracts dff data for each indicated region.
Running it fully requires:
1. saved dff trace for the session being analyzed
2. saved points to align CCF to multim... |
82d3a2ac9e7e91230a5dcbcbb3ac86a8988e8eb9eac817ab652ee6852daf092b | Python | 5,392 | 77 | """Population-weighted spatial distributions, without smoothing or pseudo-replication.
An additional descriptive analysis after the initial manuscript. Quantiles are
the inverse weighted empirical CDF, not temporal quantiles or confidence limits.
"""
from pathlib import Path
from datetime import datetime, timezone
imp... |
1e4b75f24fafa511b4008f7737d0039ad0ee5ab8b693bd9d0d39b2c4baae4c89 | Python | 5,393 | 133 | import torch
import torch.nn as nn
import dgl.function as fn
class RGCNLayer(nn.Module):
def __init__(self, in_feat, out_feat, bias=None, activation=None,
self_loop=False, dropout=0.0):
super(RGCNLayer, self).__init__()
self.bias = bias
self.activation = activation
... |
fdc4c8d038056fe0da3c146316317d2dcf8f2a3e2477f6e18494745867cf8bd7 | Python | 5,394 | 143 | # -*- coding: utf-8 -*-
"""
Convert caiman processed data (hdf5 file) to NWB format.
@author: Hung-Ling
"""
import json
import numpy as np
from datetime import datetime
from dateutil.tz import tzlocal
from pynwb import NWBFile, NWBHDF5IO # TimeSeries
from pynwb.base import Images
from pynwb.image import GrayscaleImag... |
9b48a8569ad42d95e8ebce37da99d25b2b017318e79b391cdfe995b23ddd70ac | Python | 5,395 | 180 | from typing import Dict, List, Any, Optional, Union, Collection, Iterable, Sequence
import torch
import torch.nn.functional as F
import collections
from argparse import Namespace
import os
import random
import numpy as np
from .types import DeviceType
def set_seed(seed: Optional[int]) -> None:
if seed is not None... |
6e445104f531715a250de49f0b6fdb843ce40a3afb3aacc22fbb5be0741f5a21 | Python | 5,396 | 178 | """
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 os
import pathlib
from argparse import ArgumentParser
from pathlib import Path
import pytorch_lightning as pl
from data.mri_data impor... |
7a8fbbdc357fc40d04358f5de627e56ad068b86c6cb05052f19595dca664367f | Python | 5,399 | 177 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 12 16:57:38 2022
@author: rlevi
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import argparse
import os
import sys
script_path = sys.argv[0][:sys.argv[0].rfind('/')]
sys.path.append(script_path+'/../..')
import plot_util... |
a1f68fdc81bf659eab05ed7d4865e5b94fd7af8afccc9c7dc6fe60b7119b05f5 | Python | 5,399 | 127 | import pandas as pd
import numpy
import networkx
def getConnectionToTF(model, allTFs, affectedNodes):
g = networkx.from_pandas_edgelist(model, 'source', 'target', create_using=networkx.DiGraph())
allNodes = numpy.array(list(g.nodes))
includedTFs = numpy.intersect1d(allTFs, allNodes)
connectedToTF = nu... |
722d7d9fcb220bed65a0e8116ae46b7f809e5e38c22a9eb46f75b124a6ad6269 | Python | 5,402 | 157 | # 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... |
db0f5a5a300aa8f611fb6b484d66a66a8af0324741973675067bfbdbcdaab058 | Python | 5,402 | 174 | 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'... |
24a55acbd2307089eeff79479240b4b54fcd3f6fca03965699a98c2de5bc93ef | Python | 5,403 | 165 | import sys
import subprocess
import math
import copy
import os
import multiprocessing
from util.check_tools import get_input_file
configure_file = sys.argv[1]
out_dir = sys.argv[2]
discoal = sys.argv[3]
if not out_dir.endswith('/'):
out_dir += '/'
if not os.path.exists(out_dir):
subproc... |
9959c4f0dc8aee11646522676b19ec3b17fb4baa991b70d9a85f15a8c5d9634d | Python | 5,404 | 183 | # -*- coding: utf-8 -*-
"""
Created on Wed Apr 6 14:38:38 2022
@author: jeanbaptiste
"""
import pycromanager_tessie as pmt
from pycromanager_tessie.acquisitions import experiment
# Start platform:
platform = pmt.microscope.platform.Platform(load_synchronizer=True)
# Set LED ring
platform.neopixel.color(red=int(255... |
c4221294c596b79fb30ffc1597696f4e4553c2fa76b4cea1e8eb4dc2859a0436 | Python | 5,408 | 140 | # 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... |
d47e7bdddd62b23e2f406424576f33d36789ec55238d8dd1871ccb77c833ed93 | Python | 5,408 | 141 | import copy
import importlib.resources
from PyQt6 import uic, QtCore, QtWidgets
class BlockMatrix(QtWidgets.QWidget):
pipeline_changed = QtCore.pyqtSignal(dict)
quickviewed = QtCore.pyqtSignal(int, int)
filter_modify_clicked = QtCore.pyqtSignal(str)
plot_modify_clicked = QtCore.pyqtSignal(str)
s... |
a5306f64a3383b4301eee0f64af50038601b04df02c33a51c1f92c88cd42b1ea | Python | 5,409 | 121 | import torch
from torch_geometric.data import InMemoryDataset
from torch_geometric.utils.convert import from_networkx
import networkx as nx
import pandas as pd
from torch.nn.functional import one_hot
from torch.nn import init
from sklearn.model_selection import train_test_split, StratifiedKFold
import numpy as np
impor... |
f4c11aa9b742c1b030062109c9d2683bea6fa6530b86d15f99990a577e4f7368 | Python | 5,410 | 143 | from sys import path as sys_path
sys_path.append('..')
sys_path.append('../base')
import matplotlib
matplotlib.use("QT5Agg")
import numpy as np
from base import loggingUtils
from base import surfaces
from base.kernelFunctions import Kernel
from base.surfaceMatching import SurfaceMatching as SM, SurfaceMatchingParam as ... |
395683b26b33edaf6ffe7db654985e5dd3ffdfb27d1488034b0f4b706b71f13d | Python | 5,411 | 141 | import numpy as np
def generate_full_expression_matrix(iso_id_mapping_file, expression_file, expression_matrix_output_file, isoform_train_list, isoform_test_list):
isoform_train_list_array = np.load(isoform_train_list)
isoform_test_list_array = np.load(isoform_test_list)
isoform_list = np.hstack((isoform_t... |
a0c64a879909278abbc5c54afd480e5fe2d88f19b269c8116d6ab79c08928269 | Python | 5,417 | 161 | """Keep record of all filters used"""
import copy
import dclab
from ..util import hashobj
class Filter(object):
"""Handles filters in a pipeline"""
_instance_counter = 0
_instances = {}
def __init__(self, identifier=None, name=None):
Filter._instance_counter += 1
if identifier is No... |
b47c3508c61d44d82b8a1ba08d136d0ff3c6f2944dc51847b7378a250bd8b6cd | Python | 5,421 | 160 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 13 11:37:27 2020
@author: reisertm
"""
import numpy as np
#from PIL import Image
#import cv2
import tensorflow as tf
from random import sample
from .improc_utils import *
def Augmenter( morph_width = 150,
morph_strength=0.25,
... |
3df1698e37030061fb66816f0f111cabee13a9bf6216a92bab6eb8cc0024f863 | Python | 5,424 | 145 | import numpy as np, matplotlib.pyplot as plt
import pumpprobe as pp
# DATASETS WITH STIMULATION OF RID
ds_list = [
"/projects/LEIFER/francesco/pumpprobe/AKSxneuropal/20211102/pumpprobe_20211102_101248/",
"/projects/LEIFER/francesco/pumpprobe/AKSxneuropal/20211102/pumpprobe_20211102_152524/"
]
funa = pp.... |
658aaea29f293d4606c1752ea823593c3888e97dc2d6c94e05d271a75afb7fad | Python | 5,425 | 144 | """Run groups of experiments, hyperparameter sweeps, etc."""
import argparse
import os
import subprocess
import sys
import time
from os.path import join
def add_os_parallelism_args(parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
parser.add_argument("--num_gpus", default=1, type=int, help="How many l... |
9d3819137952ee4ff943ef0c2c5bcb92b9e200f583a0e4d67dbc94dc3cb7315b | Python | 5,428 | 137 | """Session 29 — drain the user-facing data accessor properties.
After session 28 finished the modeling-verb drain, the only `self._legacy.<x>`
reads remaining for *user-facing* APIs were the seven data accessor
properties (``X``, ``X_train``, ``X_test``, ``y``, ``y_train``, ``y_test``,
``preprocess_pipeline``). Sessio... |
808bc229604011291c2ebe347b9e2b0f34b25998feeb540c59e4b296c1e1497d | Python | 5,432 | 183 | """
Tests dtype specification 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
skip_pyarrow = pytest.mark.usefixtures("pyarrow_skip")
@skip_pyarrow # CSV parse error: Empty CSV file or block
d... |
ec0e7c5d8067ccb1a340f33daefae97b6327bd5ea4d4e979fc2c707b78efa1f4 | Python | 5,432 | 113 | # 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... |
d359493ed34a19c21acf10409f602165495d843f7ec3c3f0d46be2b2cfaf881c | Python | 5,433 | 164 | #! /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... |
ae573ca0879e93c800eca7cf2220218a8d16b6a9b42b9fb30515f93628d0d27c | Python | 5,434 | 138 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Get summaries of head movement in scanner per group.
@author: mikkel
For information please refer to the paper :
Vinding, M. C., Eriksson, A., Low, C. M. T., Waldthaler, J., Ferreira, D., Ingvar, M., Svenningsson, P., & Lundqvist, D. (2021). Different features of... |
a39749f09810345f09ec0e0354844eef2967f4d1f7c28e2b9b28cf68bd19b5ed | Python | 5,435 | 126 | # Copyright (c) 2012-2021, NECOTIS
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# - Redistributions of source code must retain the above copyright notice,
# this list of conditions and th... |
7e136ab2de74cfc5addad42b199c66bb7675a400308663735bf12ef50e45b133 | Python | 5,436 | 131 | import argparse
import os
import shutil
import pandas as pd
def get_args():
"""
Get arguments from command line with argparse.
"""
parser = argparse.ArgumentParser(
prog='Copy-consolidated-bins.py',
description="""Copy consolidated bins to final directory.""")
parser.add_argument("-... |
858add71f04d04ab2e438a8720ffb85cde6e6e28cd176f3edc789fbeeb49e684 | Python | 5,436 | 167 | ''' backcheck_publishedurl.py
This program will backcheck publishedURL to neuronMetadata
'''
import argparse
from operator import attrgetter
import sys
from colorama import Fore, Style
import jrc_common.jrc_common as JRC
# Database
MONGODB = 'neuronbridge'
DATABASE = {}
def terminate_program(msg=None):
''' ... |
14a27c161f0d52c8ea6e77a734b4f933807447e69fe6e1f1c97467d41f5781ac | Python | 5,437 | 112 | # -*- coding: utf-8 -*-
"""
preprocess DSC
"""
import os
import numpy as np
import nrrd
from app.utils import get_exitcode_stdout_stderr, end_execution, wrap_string
import logging
logger = logging.getLogger(__name__)
def sk_strip_perf(imp,noStrip):
from skimage import morphology, filters
th_forep = filters.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.