sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
1d2770183be5c3ba532b8df00afb3e53556386c4a562b6234a510e373ed2e0b0 | Python | 5,141 | 183 | # JN 2015-02-13 refactoring
from __future__ import absolute_import, print_function, division
import logging
logger = logging.getLogger(__name__)
from collections import defaultdict
from multiprocessing import Process, Queue, Value
import numpy as np
np.seterr(all='raise')
import tables
from .. import DefaultFilter
... |
d63830b0a9df89cb9f0a659e70e7bba990aab1b86c9e786a9c4b73f049f3b72e | Python | 5,142 | 201 | import numpy as np
import pandas as pd
from pandas import (
NA,
Categorical,
DataFrame,
Float64Dtype,
MultiIndex,
Series,
Timestamp,
date_range,
)
try:
from pandas.tseries.offsets import (
Hour,
Nano,
)
except ImportError:
# For compatibility with older vers... |
f3a5035ad2452dce8debb8229866f1abec6676300f686cdc98403a19522bdb2d | Python | 5,142 | 143 | import numpy as np, os, matplotlib.pyplot as plt
from matplotlib import cm
import pumpprobe as pp
q_th = 0.3
ds_list = "/projects/LEIFER/francesco/funatlas_list.txt"
funa = pp.Funatlas.from_datasets(
ds_list,merge_bilateral=True,merge_dorsoventral=True,
merge_numbered=False,signal="gr... |
1cb7ec6d54a1d365fee78bcc94223a1167b907b249403a63ce27fd969803e80c | Python | 5,145 | 153 | # 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... |
eaf529b0566adac1dda4d63ffed7f54eb1ede6844ffff2b7402d63f9decc9eec | Python | 5,146 | 157 | __all__ = [
"GlycoPeptideRTData",
"GlycoPeptideRTDataBatch",
"GlycoPeptideRTDataConverter",
"GlycoPeptideRTDataset",
]
from typing import Any, List, NamedTuple, Optional, Protocol, Union, cast
import dgl
import numpy as np
import pandas as pd
import torch
from torch.nn.utils.rnn import pad_sequence
f... |
a532cfbc1184701996bda24c4598022c1067383e661d74966334367abbd16c9e | Python | 5,149 | 126 | # 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... |
c64a080575fee1b21c9d773ee267409b4589bb905d8e906cd8417d44c66291c1 | Python | 5,149 | 158 | # 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... |
4d1d866c626027a0de39e02bea3cea780266aab4556b977a67c1b2350e588f33 | Python | 5,152 | 129 | import numpy as np
import sys
import os
import argparse
import re
from tqdm import tqdm
def get_clocktime(log_file):
with open(log_file, 'r') as fh:
for line in reversed(list(fh)):
xt = re.search('ClockTime = (\d+)', line)
if xt is not None:
return int(xt.group(1))
... |
5af3a89241e4f8b479348b02f50fce07405caa641f27351ccff1aa57dbec5e54 | Python | 5,152 | 138 | """
Script to determine the number of
"""
import torch
from tables.table_globals import RESULT_TABLES_DIR
import os
import numpy as np
from tqdm import tqdm
import matplotlib.pyplot as plt
from datasets.scar_bow import StemTokenizer
def count_bert_tokens(model_name, config, dataset):
train_data = dataset.train... |
7049312702263b3e7760dc39d9665d1bd80c30bfadfa6fe17f5d0d9e263cd09c | Python | 5,155 | 163 | """
Copyright (c) 2014-2017 Alex Forencich
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, publish, distr... |
c4b23181511aeb05dc0ccbb2857e227e326c79c1c903e9be9a39e5c3a4979dbb | Python | 5,156 | 129 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
@pytest.mark.parametrize("f", [lambda v: pd.Series(v).sum(), np.nansum])
def test_expanding_apply_consistency_sum_nans(all_data, min_periods, f):
expanding_f_result = all_data.expanding(min_periods=min_periods).sum()
expanding_... |
097864068139fa04e3b90750410ed812227f6277d43c4b34bc917f7a51706860 | Python | 5,157 | 138 | """Adapter for a locally provided OASIS-3 directory layout.
**This module never downloads, mirrors, or redistributes OASIS-3 data.** It
only reads CSV metadata and scan files that the user has already obtained
under OASIS-3's own data use agreement and placed on local disk. See
https://sites.wustl.edu/oasisbrains/ for... |
33d1da81f897604d40928825bf872c5f847a14630051082550fd46bb07ccb1e0 | Python | 5,157 | 133 | # 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... |
1ad32a58f5546ad804636c67c423fb57877260b1ca84aae1ed644301629f0453 | Python | 5,159 | 135 | import jax
import jax.numpy as jnp
def lif_delay_forward(state, input_spikes):
w, delay_buffer, out_spikes, I_in, V_mem, delays = state[0]
tau_mem, max_delay, timestep, _, _, _ = state[1]
# Implementing the FIFO replacement mechanism for the delay buffer
delay_buffer = jnp.concatenate(
[jax.lax... |
1dff6a222756b0c780735cc4f717d58aec397e0e908aad24dd851913e13eb87e | Python | 5,159 | 90 | import argparse
from prepare_data.DRP_loader import *
from train_model.train_test_GeoMVP_5_fold import *
from torch_geometric.data import Batch
from torch_geometric.nn import graclus, max_pool
import argparse
from prepare_data.create_cell_feat import *
import warnings
warnings.filterwarnings('ignore', category=UserWar... |
295c25d0f2b2afdcf459628e9a5430b091298b892626c81288a72247b3a03dee | Python | 5,159 | 150 | # 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... |
0cd50ef6a1601fe9948d32d0ad1d5fe98594abadd14bcee5dee7d3743b6f9766 | Python | 5,162 | 115 | from src.workflow import WorkflowResults
from src.statistics import CorrelatedTTest
from src.experiment import ExperimentResults
import pandas as pd
from sklearn.metrics import mean_absolute_error, r2_score
class Analyzer():
""" """
def __init__(self, results: ExperimentResults) -> None:
self.experime... |
65d43e24a032cd4cb954c12a53d750b162a01f0168c8552dc75f451eebf8fa2a | Python | 5,162 | 162 | # Created by G. Peter Lepage (Cornell University) in 12/2013.
# Copyright (c) 2013-19 G. Peter Lepage.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any... |
c0d8a4a7eba92485005ace833b62e063d6a3dc613f925ac7aeb30484ea334201 | Python | 5,162 | 161 | import bionetwork
from line_profiler import LineProfiler
import types
import torch
import scipy.sparse
import numpy.random
import numpy
from scipy.sparse.linalg import eigs
from numpy.linalg import eig
import time
#Generate random test data
batchSize = 6
networkSize = 800
networkList, nodeNames = bionetwork.getRandom... |
3277b8c68dbfd53135e10bdc7bd614fa9cedb3b8fc9ec4e480556a7151e6363a | Python | 5,163 | 109 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 9 11:26:40 2023
@author: nrq2
"""
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
import sys
import os
import scenicplus
scenicplus.__version__
import pickle
import scanpy
# Load functions
from scenicplus.scenicplus_c... |
9db17d6807ef5c75f72c12e36a325225960aaf50a65f85bee745e94964f2bab3 | Python | 5,164 | 137 | """ADAM for solving non-linear minimization problems."""
from collections.abc import Callable, Sequence
import torch
from torch.optim import Adam, AdamW
from mrpro.algorithms.optimizers.OptimizerStatus import OptimizerStatus
from mrpro.operators.Operator import OperatorType
def adam(
f: OperatorType,
initi... |
e4d6151c97ba0023958a194da56e68a7efb2cbee9211fed23ffe6a9314182699 | Python | 5,169 | 125 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: mbejtka
"""
import numpy as np
import h5py as h5
import matplotlib.pyplot as plt
import os
from traub_data_kcsd_column_figure import (prepare_electrodes, prepare_pots,
do_kcsd, set_axis)
import kCSD2D_reconstruction_f... |
bf277174ddf558ea88df421df28ee4cb8dc13958e46ea81e664a957fb53063ec | Python | 5,173 | 140 | """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, sequence_attention_layer
)
def sa_fn(features, labels, mode, params):
"""
Im... |
78a91705ce5e5cb933d185731eb2e84a34d35adcf1c79576f40a871afb24d4d9 | Python | 5,174 | 175 | # 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... |
f647d98eb9ccf13c9c97c69beccaf3eacbba2ca4166261b3d4b135aa943adecd | Python | 5,174 | 135 | import argparse
import os
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
def get_args():
"""
Get arguments from command line with argparse.
"""
parser = argparse.ArgumentParser(
prog='Filter-Complete-Contigs.py',
description="""Identify long complete contigs f... |
0937389be02433ec357b16252d48d6acd9de1a664a496d76cbad7f014e300bb8 | Python | 5,176 | 157 | ''' This program will update janelia-neuronbridge-published-stacks
'''
import argparse
from copy import deepcopy
from operator import attrgetter
import sys
import boto3
from colorama import Fore, Style
import MySQLdb
from tqdm import tqdm
import jrc_common.jrc_common as JRC
# Configuration
TEMPLATE = "An exception o... |
aa5deb9c30c518b5ec3ce3084342bda520a24491f051cfa0f1b23ed283c58094 | Python | 5,176 | 178 | """
Numba 1D min/max kernels that can be shared by
* Dataframe / Series
* groupby
* rolling / expanding
Mirrors pandas/_libs/window/aggregation.pyx
"""
from __future__ import annotations
from typing import (
TYPE_CHECKING,
Any,
)
import numba
import numpy as np
if TYPE_CHECKING:
from pandas._typing imp... |
e82092b12e9b0fe38e48a67c4df398fe4d18231ae4aaceed070cd774aaeccf48 | Python | 5,178 | 185 | import re
import pytest
import pandas as pd
import pandas._testing as tm
pa = pytest.importorskip("pyarrow")
pc = pytest.importorskip("pyarrow.compute")
def test_struct_accessor_dtypes():
ser = pd.Series(
[],
dtype=pd.ArrowDtype(
pa.struct(
[
("in... |
4bea8081440a27cba798a9d2bed55a5509c8869c8afb054297d91ef000bcf7f1 | Python | 5,179 | 138 | import torch
import numpy as np
import lightning.pytorch as pl
####################### Dataset #######################
import ase.io
from pathlib import Path
from torch_geometric.data import Data, Dataset
from sklearn.preprocessing import OneHotEncoder
from scipy.spatial.transform import Rotation
from graphite.nn im... |
f75f01f20138f12c6f496f517bb449e9021274642b117f14ca07c4030573fe87 | Python | 5,179 | 147 | #!/usr/bin/env python
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from MCMG_utils.utils import Variable
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
class MultiGRU(nn.Module):
""" Implements a three layer GRU cell including an embedding layer... |
ec9559acac30b0d87a66fceba84f16a02c761ef9123a61e2f5f6ec06da9b3361 | Python | 5,185 | 159 | #!/usr/bin/env python3
"""Plot inference-speed results produced by run_benchmark.sh / benchmark_single_config.py.
Globs every *.csv in --input_dir (one CSV per model panel, as written by
run_benchmark.sh) and draws one subplot per panel: grouped bars of fps,
grouped by variant, with one bar per decoder actually presen... |
337840bde01380f311cd478d1ac1b4e9556a05c05a1f2639287755d5f09b9981 | Python | 5,186 | 143 | import numpy
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn.preprocessing import StandardScaler
from sklearn.decomposition import PCA
def updateIndexName(df, dictionary):
allIndex = df.index.values
for i in range(len(allIndex)):
if allIndex[i] in dictionary:
... |
747c7257356510c69b2b4a770a01a5425a35016d832078502f56b30ec8bb3c13 | Python | 5,186 | 125 | #! /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... |
35cdee1641c0d16637c7d81a720f75d1242a99efe876526936fd4494c28336da | Python | 5,187 | 120 | #
# Python module to implement equivariant neural network
# based on Clebsch-Gordan networks. This module uses linearity.py
# and nonlinearity.py to implement the linear and nonlinear operations
# of CG networks. Then it implements a dense layer at the end to
# classify the scalar output of every layer in the CG netwo... |
c2e383b8d81f680c7fd3d20326e65a9a6a0ba78e610ddb577af52116221356f9 | Python | 5,187 | 151 | """Module contains 3D-specific plotting functions."""
from typing import Optional
import matplotlib as mpl
import numpy as np
import seaborn as sns
from matplotlib import pyplot as plt
from matplotlib.patches import FancyArrowPatch
from matplotlib.text import Annotation
from moseq2_lda.stats import compute_3D_kde, comp... |
7885627de1038fadd3f44c69937bea3764985b0cd67d3a85e6523ba5a100dec5 | Python | 5,188 | 113 | import sys
import os
import pandas as pd
import numpy as np
from collections import defaultdict
from matplotlib import pyplot as plt
from matplotlib_venn import venn2
from matplotlib.backends.backend_pdf import PdfPages
def make_true_dtu_sets(exps, tx_2_gene_dict, base_dir):
exp_dtu_genes_dict = defaultdict()
... |
0c8ef0eb7864c4e98b8de9abce06301e95186b5480bf156251d9413c4e8c6212 | Python | 5,189 | 128 | # Calculate structure searching performance
import torch
from torch.nn.functional import normalize
import numpy as np
import os
from random import sample
dataset_dir = "../../dataset"
esm_embedding_size = 2560
def scop_fold(fam):
return fam.rsplit(".", 2)[0]
def scop_sfam(fam):
return fam.rsplit(".", 1)[0]
... |
159ede4622a006a8efd126a382f5d39817732b8f7639427c98e5cc7293270640 | Python | 5,190 | 133 | import torch
import torch.nn as nn
from sequence_models.constants import PROTEIN_ALPHABET, PAD, MASK
from sequence_models.convolutional import ByteNetLM
from sequence_models.gnn import BidirectionalStruct2SeqDecoder
from sequence_models.collaters import SimpleCollater, StructureCollater, BGCCollater
CARP_URL = 'http... |
205f95b556e54940fdd9bfd60bb315ae3e61f8516bb0b0599582227b49450673 | Python | 5,191 | 154 | import Bio.PDB
import json
import random
import pickle
from tqdm import tqdm
import numpy as np
from sklearn.cluster import DBSCAN
from .readPDB import readPDB, readPDB2Pd
def calc_residue_dist(residue_one, residue_two) :
"""Returns the C-alpha distance between two residues"""
diff_vector = residue_one["CA"... |
f97556e0e9c8b7f2d55c48537c056ae5ab06a20c70f760d78e2da1e51a10fd13 | Python | 5,192 | 162 |
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... |
6ad2b22704247ecdb2960fa6242cf50cdababb862ecffa864661d7d9e83c5a3e | Python | 5,193 | 176 | import re
from itertools import chain
"""
This file contains functions that parse Siemens protocol headers (in ASCONV
and XPROT format).
Acknowledgement:
Most of the string parsing code is taken from William Clarke's pymapvbvd
project (https://github.com/wexeee/pymapvbvd).
"""
def parse_twix_hdr(file):
import r... |
7110469c630eb0dffc2fab7522713e05e09c41986cdc6acdba10808752fef04a | Python | 5,195 | 155 | """
Tests shared by MaskedArray subclasses.
"""
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.tests.extension.base import BaseOpsUtil
class ComparisonOps(BaseOpsUtil):
def _compare_other(self, data, op, other):
# array
result = pd.Series(op(data, o... |
b085150fc7232a6d30c43a58e2d47591b5fa43581e0bf91c8ac32b059eca83d5 | Python | 5,195 | 150 | import pytest
import pandas as pd
import pandas._testing as tm
@pytest.mark.parametrize("n, frac", [(2, None), (None, 0.2)])
def test_groupby_sample_balanced_groups_shape(n, frac):
values = [1] * 10 + [2] * 10
df = pd.DataFrame({"a": values, "b": values})
result = df.groupby("a").sample(n=n, frac=frac)
... |
bb106e95709603a0488beb99f34b643625fa8ee55b639d3cac1145f4dc85d329 | Python | 5,197 | 121 | #!/usr/bin/env python
version = "v0.1.0.20220721"
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
def Parser_HighQuality(input_bed, output_bed):
output = open(output_be... |
80dc40092ff55cbb9cc25e93ecb01d5fe1a6073f984561ef0b4ff793df9f97e6 | Python | 5,198 | 152 | # -*- coding: utf-8 -*-
"""
Created on Mon Jul 25 16:04:54 2022
@author: fm02
"""
### Author: federica.magnabosco@mrc-cbu.cam.ac.uk
### Plot results from LDvsSD individual ROIs accuracy
import numpy as np
import pandas as pd
import pickle
import seaborn as sns
import matplotlib.pyplot as plt
from scipy.stats import ... |
25be148910d8b9378c9c4366fb5fcbf0496d3e3f08fef09980ed1a0e74c23660 | Python | 5,200 | 164 | """
Pickle compatibility to pandas version 1.0
"""
from __future__ import annotations
import contextlib
import datetime
import io
import pickle
from typing import (
TYPE_CHECKING,
Any,
)
import numpy as np
from pandas._libs.arrays import NDArrayBacked
from pandas._libs.tslibs import (
BaseOffset,
Ti... |
cf538bf27c6e289543c9b20f29c3488879e298c8da193a854a1f70d4c0b6c28d | Python | 5,200 | 214 | import torch
import torch.nn as nn
from torch_scatter import scatter_add, scatter_max, scatter_mean
class MeanPooling(nn.Module):
"""Mean pooling"""
def __init__(self):
super().__init__()
def forward(self, x, index):
return scatter_mean(x, index, dim=0)
def __repr__(self):
r... |
2c22f9f5e76db95f319acbbc0d70fe252526d25e61217f91d0d20df54e255882 | Python | 5,202 | 150 | import numpy as np
from .curves import Curve
from .surfaces import Surface
from matplotlib import pyplot as plt
def peanut(r = (1,1), delta = 0.5, sigma = .25, theta = 0, tau = (0,0), d = 100):
[x, y] = np.mgrid[0:2*d, 0:2*d] / d
y = y - 1
x = x - 1
dx = delta*np.cos(theta)
dy = delta*np.sin(theta)... |
f5af8bbf6a266ca26bcd67bfa4c16fbeb95173f1d9ef851521b31ec802566248 | Python | 5,202 | 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... |
03232437f31be4d1e29d3bd85e0a2be563f1a1b795e71db6a39439942b625c3f | Python | 5,203 | 177 | """Test colors."""
# ------------------------------------------------------------------------------
# Imports
# ------------------------------------------------------------------------------
import colorcet as cc
import numpy as np
from numpy.testing import assert_almost_equal as ae
from pytest import raises
from ..... |
cac7e087c05a63d2aa8d45020034838e4580c9a5e1fc06f8e6edc6e4476b3a1b | Python | 5,206 | 165 |
import re
########################################
#
# Model class
#
########################################
# define distribution to map value tuples to probabilities (or frequencies or scores, if not normalized)
class Model(dict):
# init with model id
def __init__(self,i=''):
self.id = i
# de... |
a2187b2cc560839c8a82e6087f7868b9ef109eded3ad9ae3e1c13d2e24ae28da | Python | 5,208 | 134 | # Based on: https://github.com/KarenUllrich/binary-VAE
import numpy as np
import tensorflow as tf
import tensorflow_probability as tfp
import tensorflow.keras.backend as K
tfd = tfp.distributions
class GeneticAutoencoder(tf.keras.Model):
def __init__(self, genotype_length, max_phenotype_length, vocabulary_size,... |
af938a95ee0c194fd7ab7fca5f2cbd41f30deaed931487c56e6c5a418a15b906 | Python | 5,208 | 148 |
# -*- 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... |
598724f205ce2420fb98f70e9c45d3430e96f04e767542530c7e3daaa8f3c718 | Python | 5,213 | 110 | """add drift_reports and audit_logs
Revision ID: 0cd9d5ea2e17
Revises: d582b350c276
Create Date: 2026-04-24 19:29:32.002947+00:00
"""
from __future__ import annotations
from collections.abc import Sequence
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "0c... |
c4369b09cd9d7fdf0a3f5491f97f05d46693c156d0d5a992e5b6d34fa41e8aeb | Python | 5,219 | 159 | #!/usr/bin/env python3
# Copyright 2017 Google Inc. All rights reserved.
#
# 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... |
9778991cbd91fbe3c90a927b1a763dbde3ec79d706baf22d7dc3f2322bbf51a9 | Python | 5,222 | 134 | """Topic modeling with latent Dirichlet allocation."""
import pandas as pd
from sklearn.decomposition import LatentDirichletAllocation
from nimare import references
from nimare.annotate.text import generate_counts
from nimare.base import NiMAREBase
from nimare.due import due
@due.dcite(references.LDA, description="I... |
ba683a8b4459f0009bbbfa26b9066a018cd2ae563577559944785b369b356b1a | Python | 5,222 | 171 | # 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... |
6fac71183ed37656f509cc2e994d82d9c3e93d4d26bfb2901641971aa0025cfe | Python | 5,224 | 195 | import re
import pytest
import pandas as pd
import pandas._testing as tm
pa = pytest.importorskip("pyarrow")
@pytest.mark.parametrize(
"list_dtype",
(
pa.list_(pa.int64()),
pa.list_(pa.int64(), list_size=3),
pa.large_list(pa.int64()),
),
)
def test_list_getitem(list_dtype):
... |
68cbc021781c49e0873a8718da631b3fd8e720aa6d6043ac64a55c2915aa9b6e | Python | 5,225 | 158 | # 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... |
1d4fe05d1bd1beb8fb1568a84e3029ac09f2a125d8fbedbe810417247bf52b99 | Python | 5,226 | 150 | import lightning as L
import torch
import torchmetrics
from torch.nn import BCELoss
import torch.nn.functional as F
from monai.networks.nets import BasicUNet
from ranger21 import Ranger21
class LightningUnet(L.LightningModule):
def __init__(self, learning_rate=1e-4, batch_size=4, epochs=100, len_dataloader=1)... |
9e56b791030f9d1a877e1a9e47b933c24fdb97498143dd58f6cb243847e85fcc | Python | 5,228 | 171 | """
Miscellaneous visualization functions
Authors:
Thomas A. Hopf
"""
import matplotlib as mpl
import matplotlib.pyplot as plt
def plot_context(font="Helvetica", size=12,
axis_label_size=12, axis_title_size=14,
axis_line_width=1, tick_label_size=12,
tick_directio... |
9d4fd69c199fd73089f241f1d5f0aa23237d6f6ecd0e14df616917bf4c72ca43 | Python | 5,230 | 165 | """API key CRUD — personal programmatic-access tokens.
Routes under ``/api/v1/auth/api-keys``:
POST /auth/api-keys mint a new key (plaintext returned ONCE)
GET /auth/api-keys list this user's active keys (no plaintext)
DELETE /auth/api-keys/{id} revoke a key
Keys are scoped to the issui... |
09865a53cc46db37525ad603ee8de225ad8c4810eb8568238dfed2ddbbb5ab08 | Python | 5,233 | 197 | import sys
import dependency
from DepsTools import readDepsFromFile
def addCorFile(deps):
newDeps = []
for s in deps:
sDeps = addCor(s)
newDeps.append(sDeps)
return newDeps
def addCor(ds):
newdeps = []
for d in ds:
newdeps.append(d)
for d in ds:
if d.label == "c... |
d6b1757009c09eba00b65b799ebfb649e3abd6d072d719875ac069b3484ea8f1 | Python | 5,234 | 156 | """
Check that test names start with `test`, and that test classes start with `Test`.
This is meant to be run as a pre-commit hook - to run it manually, you can do:
pre-commit run check-test-naming --all-files
NOTE: if this finds a false positive, you can add the comment `# not a test` to the
class or function d... |
31c4e627250cffe5d755094231ace24a27897deb9ac9c098ecd11363d1fe5eac | Python | 5,235 | 135 | import random
import os
import pandas as pd
import numpy as np
import argparse
def getSample(x, num=None):
if x is None:
return 0, None
n = x.shape[0]
if num is not None and num>=0:
select_num = num
else:
select_num = random.randint(0, n)
if select_num == 0:
return 0... |
07f1be8132bcdbe8bb64f20a7c4894c340ffdbb5a64c5de87a328fafcbc01ca7 | Python | 5,237 | 166 | # 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... |
df9f38549fdfff8d9732a332cec055a3ddd7593f15e2ff448066a954934e3ab8 | Python | 5,240 | 166 | # -*- coding: utf-8 -*-
import numpy as np
from Bio import SeqIO
import pickle
from tensorflow.keras.preprocessing.sequence import pad_sequences
from tensorflow.keras.utils import to_categorical
from tensorflow.keras.models import load_model
#%%
class Data_inference():
def __init__(self, data_p... |
dc2a097a2d7486e3eb8760a19f0843bf1548a1bd506b6853daab1d939a9a87fb | Python | 5,245 | 158 |
from skimage import feature, measure, transform, exposure, util
import numpy
#from cine_profiler import print_time
import logging
logger = logging.getLogger(__name__)
fh = logging.FileHandler("align.log", "a")
logger.addHandler(fh)
import datetime
class SiftAligner:
# based on
# https://stackoverflow.com/... |
11da01fffab39f48ab7580558089e955b805acc6d7afb9fe3be4448b6bee8146 | Python | 5,246 | 214 | # 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... |
d6b57453194880260ca3298515c64694f04c51379172f65e22305021d5407f0e | Python | 5,247 | 148 | """S3 model checkpoint upload callback (optional, requires ``boto3``).
Install with::
pip install scsims[s3]
Usage::
from scsims.contrib import UploadCallback
cb = UploadCallback(
desc="my_run",
bucket="my-bucket",
endpoint_url="https://s3.us-west-2.amazonaws.com",
uploa... |
26666f3eb49f07394e14aab3d466a1d1cb9f3ebd2badbfe4c52f5e6168f3d324 | Python | 5,248 | 143 | from __future__ import annotations
from abc import ABC, abstractmethod
from os import PathLike
from pathlib import Path
from typing import TYPE_CHECKING, cast
import numpy as np
import pandas as pd
import xarray as xr
# Import heavy toolkit types only during static type checking.
if TYPE_CHECKING:
from pcntoolki... |
d50f8491105a2483567e0513f9298e01d7aaa5c706281084fe53d6e14aa344c2 | Python | 5,248 | 133 | """NeuroMRF (EPG) signal model."""
import torch
from mrpro.operators.models.EPG import EPGSequence, FispBlock, InversionBlock, Parameters
from mrpro.operators.SignalModel import SignalModel
def _delics_flipangles() -> torch.Tensor:
"""Generate flip angles for the DeliCS dataset."""
def triangular_segment(n... |
eda3b216d2e276f21ab890e8a64c0d02a39e5f0e9be12fef6642db67847d02c8 | Python | 5,251 | 160 | """
Tests for ExtensionArray.__array_function__ beyond the extension base tests.
"""
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.arrays import (
NumpyExtensionArray,
SparseArray,
)
def test_delete_with_extension_array_obj():
# GH#26380 the ExtensionArray... |
ad0a320d855b6eec272ad4356cd6e1741b16d2d22208fb8b7303f0958432c6f4 | Python | 5,252 | 198 | """References to be imported and injected at relevant places throughout the library."""
from .due import BibTeX, Doi
TEXT2BRAIN = Doi("https://doi.org/10.1007/978-3-030-00931-1_67")
WORD2BRAIN = Doi("10.1101/299024")
BOLTZMANNMODEL = BibTeX(
"""
@article{DBLP:journals/corr/MontiLLAM16,
author = {Ric... |
2244b71d20058eb2c9e79d2729d56584f685faa03363ef775fbf0cee36788683 | Python | 5,253 | 216 | """Tests of history structure."""
# ------------------------------------------------------------------------------
# Imports
# ------------------------------------------------------------------------------
import numpy as np
from .._history import GlobalHistory, History
# -------------------------------------------... |
b8f6768a527acb5554be37470e8aca78b609bc583ab57906410ee8ea265d8138 | Python | 5,253 | 149 | import pytest
import pandas as pd
import pandas._testing as tm
@pytest.mark.parametrize("c", [None, [1, 2, 3, 4, 5]])
def test_categorical_equal(c):
c = pd.Categorical([1, 2, 3, 4], categories=c)
tm.assert_categorical_equal(c, c)
@pytest.mark.parametrize("check_category_order", [True, False])
def test_cate... |
322b2958e1f50ce048f3adae47499ca556abc64dcff017c8227b9d189641eedb | Python | 5,255 | 141 | import torch
import numpy
import bionetwork
import plotting
import pandas
import argparse
#Get data number
parser = argparse.ArgumentParser(prog='Macrophage simulation')
parser.add_argument('--selectedCondition', action='store', default=None)
args = parser.parse_args()
curentId = int(args.selectedCondition)
testCon... |
5cb413c0daadf668be1684252f4e63aebe6535b032356f33a65968a3810d934f | Python | 5,255 | 126 | # 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... |
9d683af30b7b3cdbd3c1fbba0f0a348108ed93d2b5fd482941f81e811c50dc40 | Python | 5,255 | 128 | # 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... |
b3684ff84c4c4534988f52e9c39a150cb752360a57d437dd7feca7fb5a8678ab | Python | 5,256 | 134 | import numpy as np
from kcsd import KCSD2D
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from scipy.signal import filtfilt, butter
from figure_properties import *
plt.close('all')
#%%
def make_plot_spacetime(ax, xx, yy, zz, Fs, title='True CSD', cmap=cm.bwr_r, ymin=0, ymax=10000, ylabel=True, label=''):
... |
e0acde05f143b9c4d1d6bcd36a96a971abf5dfa1281a030a871520fd37a7e628 | Python | 5,256 | 142 | # 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... |
b4b34f691ec668d92fc0594a4a36244187bb1f816eb433277aa21163a80d5fe7 | Python | 5,258 | 198 | """References to be imported and injected at relevant places throughout the library."""
from nimare.due import BibTeX, Doi
TEXT2BRAIN = Doi("https://doi.org/10.1007/978-3-030-00931-1_67")
WORD2BRAIN = Doi("10.1101/299024")
BOLTZMANNMODEL = BibTeX(
"""
@article{DBLP:journals/corr/MontiLLAM16,
author ... |
7645aa40c6dc0e8e700c8714cd0c996ea2b17e3a249243c1d037b265c4150014 | Python | 5,260 | 140 | # Copyright 2018-2022 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or... |
c186ab7d46aa04dc2da0074d8a81f2bb01d43b671d08a1de2271aa31b6885195 | Python | 5,263 | 138 | # 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... |
3cd677ed225e0007adcd95c90148f0bab2d6941a6f589153877f86a0d9d5a625 | Python | 5,264 | 116 | # -*- coding: utf-8 -*-
"""
utilities
"""
import os
import traceback
import sys
import numpy as np
from subprocess import Popen, PIPE
import shlex
def end_execution():
sys.exit()
class Tee(object):
def __init__(self, filename, mode):
self.file = open(filename, mode)
self.stdout = sys.stdout
... |
78bceb179e949ff246a128f66d28e530eed2ece2039ca21473a4f855fc31b25d | Python | 5,264 | 120 | # 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... |
c9a35503766de804ea91333077a2c4799cca4251c78b81931d4f3bc8c673eb6f | Python | 5,264 | 147 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
class TestMultiIndexSorted:
def test_getitem_multilevel_index_tuple_not_sorted(self):
index_columns = list("abc")
df = pd.DataFrame(
[[0, 1, 0, "x"], [0, 0, 1, "y"]], columns=[*index_columns, "data"]
... |
15b3bf0ed7034833b1bad1dfcbd7bd1c4d6999f39e4829b0a252440f6541afa1 | Python | 5,266 | 178 | # 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... |
b74f0473121ae8d64af2cf04345f0645af9632d89543e756673a40e0fede829b | Python | 5,267 | 135 | #######################################################################
#
# Tests for ask_if_modify() function
#
# RUN BY:
# python -m pytest -v tests/test_ask_if_modify.py
#######################################################################
import os
import pytest
from unittest.mock import patch
from manual_corr... |
d823d25feb84dfdc245063d8825588592f3a82b0020d24710d2d745d5799f8ea | Python | 5,269 | 137 | import copy
import numpy as np
import pandas as pd
from tqdm.auto import tqdm
from scipy.spatial.distance import cdist, pdist
import warnings
def generate_random_compositions(materials, n_comps=30, n_sources_per_comp=None,
random_state=None, return_df=True,
... |
b20b7ba711329ae7358ca591ee334dfb2a23614c661a007d43e73b028e7868d8 | Python | 5,270 | 229 | #!/usr/bin/env python
# coding: utf-8
# In[202]:
# # import libraries
import numpy as np
import pandas as pd
from pandas import DataFrame
import itertools
import csv,codecs,nltk,re
from nltk.stem.isri import ISRIStemmer
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
import itertools
impor... |
85a25aed20d431612c17002e43d2222360933ee930a9c9fc78e5e03d10a8c230 | Python | 5,271 | 178 | ## Works the best so far! Curve fits nicely and ymin/ymax don't have to be 0 and 1!
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from scipy.optimize import curve_fit
import sys
import matplotlib.ticker as ticker
import matplotlib.transforms as transforms
from pathlib import Path
from statisti... |
b24e73a41730de6d08f8b51510526307a0676029f9e050362182b4301644b067 | Python | 5,271 | 166 | import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
from glob import glob
from tqdm import tqdm
from datetime import datetime
from matplotlib import colors
from matplotlib import ticker
from tools.cnt2par import counts2mol
import time
root_folder = ''
data_path = root_folder + '/pickle/'
plot_p... |
9cd1ea442c045803616462403819ac06540240a622ad6e32e2dce2c0c7f74076 | Python | 5,272 | 180 | import numpy as np
from kcsd import KCSD2D
from pathlib import Path
from openpyxl import load_workbook
from DemoReadSGLXData.readSGLX import readMeta, SampRate, makeMemMapRaw, GainCorrectIM, GainCorrectNI, ExtractDigital
import matplotlib.pyplot as plt
from matplotlib import gridspec
def eles_to_rows(eles):
rows ... |
5ccad7a69f236c4d151a6a6dbe54cec94c9cae2a2f97d8aad54d8f32caf5082d | Python | 5,273 | 144 | import re
import argparse
import numpy
import random
import math
def get_args():
parser = argparse.ArgumentParser(description="Find Regions of the Genome wihin 1% GC content of target sequence. Also avoids rDNA (project specific criteria)")
#parser.add_argument("-rbed")
parser.add_argument("-assembly")
... |
a81aa51537ca0325d9b29a99e6a748542bb98b87fa424e047a5724ecfc97519a | Python | 5,273 | 145 |
import torch
from torch.utils.data import DataLoader
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... |
e110147cf3e0cd4877ff0146dead3ede871398892f80678241c19d9566b4b5a7 | Python | 5,274 | 137 | import torch
import numpy
import argparse
import bionetwork
import plotting
import pandas
#Get data number
parser = argparse.ArgumentParser(prog='Macrophage simulation')
parser.add_argument('--leaveOut', action='store', default=None)
args = parser.parse_args()
curentId = int(args.leaveOut)
testCondtions = pandas.read... |
5beb9576200a030f30e6113af073a98ef491c08660da49a755d2c9254db4d5ed | Python | 5,275 | 189 | # 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... |
44cc9744906914f5e8b4c4bee304ea26b28d079382cf4bcf8b31467771a48839 | Python | 5,277 | 152 | # -*- coding: utf-8 -*-
"""
Created on Wed Apr 19 10:31:16 2023
@author: lonya
"""
#%% preset
import tkinter as tk
import tkinter.filedialog as fd
from tkinter import messagebox
import os
import matplotlib.pyplot as plt
import pandas as pd
import scipy.io as sio
import my_funcs as mf
import numpy as np
#... |
5c9c9bc1647d2a24bf8b74acdec7611d16146f3cc556e0afe026748771d714a8 | Python | 5,277 | 146 | #!/usr/bin/env python3
import numpy as np
import tensorflow as tf
import scipy.optimize as sopt
class OptimizationProblem():
def __init__(self, variables, loss_train, loss_test):
self.variables = variables if isinstance(variables, (list, tuple)) else [variables]
self.loss_train = loss_train
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.