sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
329a990b957b4528c208319f015a60389ce7d717ec27c834ce8a06293a9808e4 | Python | 557 | 17 | # This file is autogenerated by the command `make fix-copies`, do not edit.
from ..utils import DummyObject, requires_backends
class SpectrogramDiffusionPipeline(metaclass=DummyObject):
_backends = ["torch", "note_seq"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["torch", "note_seq"... |
388b7a1972b2149d784d1e745daa2abdfd89feb55945c82bcd8e203436bc9de9 | Python | 557 | 22 | import random
import numpy as np
import torch
def set_random_seed(seed):
"""Set a given random seed to Pytorch's random number generator
torch.manual_seed() seeds the RNG for all devices (both CPU and CUDA)
See https://pytorch.org/docs/stable/notes/randomness.html for more details
Args:
se... |
39f122b566fa5d95aa857f3ffdd9023901ecdbd876991df34912a8871fa76514 | Python | 557 | 18 | from setuptools import setup, find_packages
setup(
name='basenet',
packages = find_packages(),
version='1.0',
description='BaseNet: A Transformer-Based Toolkit for Nanopore Sequencing Signal Decoding',
author='Qingwen Li',
author_email='li.qing.wen@foxmail.com',
url='https://github.com/liqi... |
a873f634f353ba972a34deeb26006a0ae3946df1f7e06217cbf65727b0617fdd | Python | 558 | 19 | import logging
from datetime import datetime
from agent.pipeline.review_level_mgmt import update_sentence_review_level, update_item_review_level
logging.basicConfig(format='%(levelname)s : %(message)s', level=logging.INFO)
if __name__ == "__main__":
logging.info("Launching review level updater 5...")
star... |
8635543500ebcf49879a11c619444b6608ff0c0c74156fffa0a16be6317388b4 | Python | 559 | 18 |
class hyperParas:
def __init__(self):
sequence_length = [10, 12, 14, 16]
embed_size = [None]
hidden_size = [16, 24, 32, 48]
num_layers = [1]
batch_size = [1]
LR = [0.005, 0.001]
optimizer = ['Adam']
self.paras = {'sequence_length': sequence_length,
... |
d4d0342747ee67cb01e6a10ac055317decec7b0207a900f94521046513674e5b | Python | 559 | 14 | r"""``ov.epi.upstream`` — FASTQ → BAM → bigwig / pairs → cool pipelines.
Passthrough to :mod:`epione.upstream`: aligner wrappers (bowtie2,
bwa-mem2), samtools/BAM utilities, MACS2 peak calling, Tn5 shifting,
reference preparation, and the Hi-C ``pairs``/``cool`` chain. These call
external command-line tools, so they a... |
d7e65e7b96a5ce05c933796420f55b389590654e2d0e2e94f3e7fec93c374a50 | Python | 560 | 18 | import torch
from torch import nn
from torch.nn import functional as F
class FCNHead(nn.Sequential):
def __init__(self, in_channels: int, channels: int) -> None:
inter_channels = in_channels // 4
if inter_channels==0:
inter_channels = 1
layers = [
nn.Conv2d(in_channe... |
40acc9cb1738c9a572d2dddd75929bac5025fb06cac150e35d9d3d289e792bbc | Python | 561 | 27 | # __anti_pattern_start__
import ray
import time
@ray.remote
def f():
return 1
@ray.remote
def pass_via_nested_ref(refs):
print(sum(ray.get(refs)))
@ray.remote
def pass_via_direct_arg(*args):
print(sum(args))
# Anti-pattern: Passing nested refs requires `ray.get` in a nested task.
ray.get(pass_via_ne... |
0781f48566ec53bab45fe2ec6a946fec632cfed8afed48679791340be3399970 | Python | 562 | 24 | import gym
class Render(gym.Wrapper):
"""Render env by calling its render method.
Args:
env (gym.Env): Env to wrap.
**kwargs: Keyword arguments passed to the render method.
"""
def __init__(self, env, **kwargs):
super().__init__(env)
self._kwargs = kwargs
def res... |
0e5f0bc483085b4d0034ce8defa01dfa4116a99ce9dc15d4b3f70b39cc1f85a5 | Python | 562 | 18 | import ray
@ray.remote
def echo_and_get(x_list): # List[ObjectRef]
"""This function prints its input values to stdout."""
print("args:", x_list)
print("values:", ray.get(x_list))
# Put the values (1, 2, 3) into Ray's object store.
a, b, c = ray.put(1), ray.put(2), ray.put(3)
# Passing an object as a n... |
bbb92880ead16f4a03f695a507175ecb686138301fa8daad2b10ac66c4e061d0 | Python | 562 | 23 | #!/usr/bin/env python
import numpy.testing as npt
import numpy as np
from caiman.source_extraction import cnmf
def test_make_G_matrix():
g = np.array([1, 2, 3])
T = 6
G = cnmf.temporal.make_G_matrix(T, g)
G = G.todense()
# yapf: disable
true_G = np.matrix(
[[1., 0., 0., 0., 0., 0.],
... |
f498c1de8e7681b43c3f1b6be5078d5ff38b17455b699899ebf32cc733b9ec91 | Python | 562 | 8 | from agent.data.entities.config import EXTERNAL_ITEM_FILTER, EXTERNAL_LABEL
from agent.classifiers.data.transformer_text_fd_dataset_mgmt import get_datasets_from_filter
def get_datasets(pretrained_model, max_lenght, val_split=0.8, binary_classifier=False,
_expand_tokenizer=False, _use_saved_model=True... |
78c9a549046b709a2858b4d09c0452ee12bdaae26a2f3b0ad1847e3522505402 | Python | 563 | 12 | """CytoSignal: cellular-resolution spatial ligand-receptor signalling.
NumPy/SciPy port of the R package cytosignal 0.5.1 (Liu et al., Nat Genet
2026; GPL >= 3). ``_core.run_pipeline`` reproduces the R vignette workflow
(neighbour graphs, LR-scores, permutation p-values with R's RNG, spatial FDR,
significant cells); `... |
13616a890f4fd1ffcf89c0cdf85c98afe40028b6edaa22cf23d58e01ac9f8929 | Python | 564 | 13 | import os
import argparse
from .ultramnist import CreateUltraMNIST
ap = argparse.ArgumentParser()
ap.add_argument("--root_path", type=str, default="../data/", help="path to the root directory where the generated data will be stored")
args = ap.parse_args()
obj_umnist = CreateUltraMNIST(root=os.path.join(args.root_pat... |
f5c094f062067b80feb0ecc63c9aa63cbaef3f8eaa04c5a0c67a08ef2b7b2f20 | Python | 565 | 15 | import argparse
from rotation import rotation
from mesh import mesh
parser = argparse.ArgumentParser()
parser.add_argument("--merged_path", type=str)
parser.add_argument("--rotated_path", type=str)
parser.add_argument("--mesh_path", type=str)
parser.add_argument("--alpha", type=float, default = 5e-4)
parser.add_argume... |
c1d9acfd3f38c641af8d1f51d636eda70a88e9ef19e6cc51fd983bbb7e64bd14 | Python | 566 | 17 | def parse_arguments(default_subjects: list) -> list:
""" Argument parser for parsing from command-line.
"""
import argparse
parser = argparse.ArgumentParser(description='Parsing subjects for encoding analysis.')
parser.add_argument('-s', '--subjects', type=str, help='Subject numbers separated by c... |
2544b75b502969a343ee7e40111d8f5a20e7eb02ace4d5c8435925b9b1b4da9a | Python | 567 | 13 | import numpy as np
#adopted from https://github.com/sebp/survival-cnn-estimator
def generate_times(n=100, mean_time=6000, risk=0, prob_censored=.5):
risk_score = np.full(n, risk)
baseline_hazard = 1 / mean_time
scale = baseline_hazard * np.exp(risk_score)
u = np.random.uniform(low=0, high=1, size=len(r... |
0664c3e33b2cdd8a406fca033afb81de810485f34773fd71bdaf851d6e657545 | Python | 568 | 13 | # -*- coding: utf-8 -*-
# (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#... |
4b45b2b3adfe575c65f551ae31c1578596e1a7bff05239d5caedecae69bd929f | Python | 568 | 19 | import unittest
from tests.objects import test_morphology_large
from neuron_morphology.feature_extractor.feature_extractor import FeatureExtractor
from neuron_morphology.features.default_features import default_features
from neuron_morphology.feature_extractor.data import Data
class TestDefault(unittest.TestCase):
... |
5f569f3f2c2297c55aa285f24647e9de7ff90041506daeb7ef9b2bb964ea3f19 | Python | 568 | 16 | """FastCCC: permutation-free cell-cell communication p-values.
Re-implementation of FastCCC 1.0.1 (https://github.com/Svvord/FastCCC, MIT)
by Hou, Ma & Zhou, *Nat Commun* 16, 11428 (2025), without the scanpy and
file-based I/O dependencies of the original package. See ``NOTICE``.
"""
from ._core import (
FastCCCRe... |
ddb1b8823e25805709cfacefe7d090a5cde4444a72dd49042528c4c292e39045 | Python | 568 | 23 | from neuron_morphology.validation.result import NodeValidationError as ve
def validate_children_nodes_appear_before_parent_nodes(morphology):
result = []
nodes = morphology.nodes()
for node in nodes:
parent = morphology.parent_of(node)
if parent and node['id'] < parent['id']:
... |
5d06d4edcf4763f0fb25e2fb3fa51908fc93763fea2770a7feeb8184620407f9 | Python | 569 | 19 | import numpy as np
import nibabel as nb
file = '/Users/sebastiandresbach/data/neurovascularCouplingVASO/Nifti/derivatives/sub-06/ses-04/anat/megre/veinsPlusPeri.nii.gz'
nii = nb.load(file)
data = nii.get_fdata()
np.unique(data)
trueveins = np.zeros(data.shape)
trueveins = np.where(data == 1, 1,0)
gmVeins = np.where... |
e14e0386f68224df046f2c1c655c04681766baa9c68a6283b0735ee9a864e949 | Python | 569 | 13 | # -*- coding: utf-8 -*-
# (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#... |
15d9bed774b88a233470a10d2e9e7aa2cc428dd7c5b2bf36633dd869a23b79fd | Python | 571 | 23 | import torch
import sinabs.layers as sl
def test_morph_same_size():
data1 = (torch.rand((100, 1, 20, 20)) > 0.5).float()
data2 = (torch.rand((100, 1, 20, 20)) > 0.5).float()
merge = sl.Merge()
out = merge(data1, data2)
assert out.shape == (100, 1, 20, 20)
def test_morph_different_size():
d... |
f1e96066e4233dd8ec8736a9f93e9b0bfb9828e8fb9f74fdb314a62e8af5559a | Python | 571 | 25 | import numpy as np
def equal_bin(data, n_bins):
"""
Bins ``data`` into ``n_bins`` bins, with an equal number of points in each
bin.
https://stackoverflow.com/a/40895507
Parameters
----------
data : np.ndarray
The data to bin.
n_bins : int
The number of bins to bin int... |
796f17278b27d6676eff419e800845f33ce9a725161cd9dfe3b1ed5ada3fd781 | Python | 572 | 18 | from pdfminer.high_level import extract_text
import re
#text = extract_text('article.pdf')
with open('article-frontiers-onefile-filtered.pdf','rb') as f:
text = extract_text(f)
#print(text)
text_lines = text.split("\n")
with open("textonly.txt", "a") as f:
for line in text_lines:
if not re.match("^[0-9][0-9][... |
dccbdfb024f01a44e156ed786ac34171493b1978d2b6bd4d58d7a233aece344f | Python | 572 | 13 | # -*- coding: utf-8 -*-
# (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#... |
48c475d3feebedf0d64f332bf20a534969ded0308587181ebccf2745f6a3b835 | Python | 573 | 13 | # -*- coding: utf-8 -*-
# (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#... |
e94a6c9fcb9984561aa788c5241b643583a914a6b1640b11cee3b363d7e01868 | Python | 574 | 19 | import numpy as np
def normalize(x, percentile = True, pmin=4.0, pmax=96.0, axis=None, clip=False, eps=1e-20):
"""Percentile-based image normalization."""
if percentile:
mi = np.percentile(x,pmin,axis=axis,keepdims=True)
ma = np.percentile(x,pmax,axis=axis,keepdims=True)
out = (x - mi)... |
ee9b4f859074251f0fc8cdb7109fa8c93899ecce71e52b13262be9334890c070 | Python | 574 | 19 | from __future__ import print_function
import sys
def eprint(*args, **kwargs):
"""
Drop-in replacement for ``print()`` that prints to stderr instead of stdout.
Parameters
----------
args, kwargs : args, kwargs
All args and kwargs will be passed through to ``print()`` except for the
... |
1f6067abc177ec63fae2df22866be4618f8f40ee1ce94fd73dc9560c1fbe5083 | Python | 575 | 13 | # Copyright 2026 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
4dcb6b31b4d247906e8d76bea3101eefbd8211379ca4f0e242e3ba61cba8909d | Python | 576 | 14 | # Copyright 2026 Google LLC.
#
# 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 agreed to in writing, ... |
5a65a982388b0415e67c8198614582e07aae61c2f729efc8f743a587c30238f5 | Python | 576 | 22 | """
Test for issue 100:
https://github.com/Data-Centric-AI-Community/data-profiling/issues/100
"""
import numpy as np
import pandas as pd
from data_profiling import ProfileReport
def test_issue100():
df = pd.DataFrame(np.random.randint(0, 1000, size=(1000, 4)), columns=list("ABCD"))
df[["B", "C"]] = df[["B",... |
ab3978b8e39fe337c0f24838b27b314f333ef04decc0c5de573afd95b31ad78d | Python | 577 | 15 | from pathlib import Path
base_dir = '/Volumes/diedrichsen_data$/data/FunctionalFusion'
if not Path(base_dir).exists():
base_dir = '/srv/diedrichsen/data/FunctionalFusion'
if not Path(base_dir).exists():
base_dir = '/Users/lshahsha/Documents/data/FunctionalFusion'
conn_dir = '/Volumes/diedrichsen_data$/data/Ce... |
586d1e8ce925775f061ede74aa085453c1165b9811070504c7d10b27329f3237 | Python | 578 | 23 | from . import datasets
from . import utils
from . import eval_utils
from . import resources
from .utils import data_preparation
from .cell_lineage_GRN import NetModel
from .driver_regulators import driver_regulators, highly_weighted_genes
__version__ = '0.2.0'
__url__ = 'https://github.com/WPZgithub/CEFCON'
... |
9a211a9a4675bb5891a401836a0b30298c42f1900dd6b02cd9a3c5b735167dd7 | Python | 578 | 11 | def ensembl_to_symbol(gene_list):
import mygene
mg = mygene.MyGeneInfo()
return mg.querymany(gene_list, scopes='ensembl.gene', fields='symbol', as_dataframe=True,
species='human').reset_index().drop_duplicates(subset='query')['symbol'].fillna('0').tolist()
def symbol_to_ensembl(gene_list):... |
169c68a61089ec498c5f2144b258dd478fc640eb9067ce8a979389e75cbf8d5d | Python | 579 | 14 | from .bincov_matrix import main as bincov_matrix
from .gt_cutoffs import main as gt_cutoffs
from .vcf import main as vcf
from .medcov import main as medcov
from .merged_depth import main as merged_depth
from .metrics_file import main as metrics_file
from .baf_file import main as baf_file
from .ped_file import main as p... |
1079e63c955c6ca0ae5c7db7da287220da613c602f428111a256d8d6e4c7889b | Python | 580 | 24 | from __future__ import annotations
from typing import Union
import numpy as np
AnyRandom = Union[int, np.random.RandomState, None]
def str2list(value: Union[str, list]) -> list:
return [value] if isinstance(value, str) else list(value)
def spatial_connectivity_key(key: str | None = None) -> str:
return ... |
3df2e646f56918e18b8ce0482f6aa10f36ef01b4642be715dcd6d039f0942c18 | Python | 580 | 11 | from case2 import *
import time,os,warnings; warnings.filterwarnings("ignore"); t0=time.time(); fn="c2_ss.json"
d=json.load(open(fn)) if os.path.exists(fn) else {}
for n in [10,20,30,50]:
rows=d.get(str(n),[])
while len(rows)<40 and time.time()-t0<240:
G=design(n); p=TRUE.copy(); p[4]=0.; Y,E=run(p,G,"W... |
8813cd39fe5165684e2e2d7b3c44458c82d8afb3b39f3426ce3d54eb5487d35f | Python | 580 | 13 | from data_profiling.report.presentation.core.correlation_table import CorrelationTable
from data_profiling.report.presentation.flavours.html import templates
class HTMLCorrelationTable(CorrelationTable):
def render(self) -> str:
correlation_matrix_html = self.content["correlation_matrix"].to_html(
... |
995cd85f53c1f835a3ef88d7faf31495d91985b2f78ea9fae01fbd4117c38dd2 | Python | 580 | 20 | from pathlib import Path
import pandas as pd
from data_profiling import ProfileReport
from data_profiling.utils.cache import cache_file
if __name__ == "__main__":
file_name = cache_file(
"websites.csv",
"https://raw.githubusercontent.com/berkmancenter/url-lists/master/lists/et.csv",
)
df... |
e404a19497f5eecd628855358d4c1992a38260a3e0e5bf141fc6aca31bc39855 | Python | 580 | 28 | """
Module to train a bioFAM model
"""
from ..core.BayesNet import BayesNet
def train_model(model):
# Sanity check on the Bayesian Network
assert isinstance(model, BayesNet), "'model' has to be a BayesNet class"
####################
## Start training ##
####################
print("\n")
... |
4bcb02544b471aa91680a36c91260ab978cf55d6190ff6b9d0e4ea1699831f8c | Python | 581 | 23 | #!/usr/bin/env python
# coding: utf-8
import torch
import torch.nn as nn
import torch.nn.functional as F
from Actor1 import init_weights
class Actor(nn.Module):
def __init__(self, EKF_STATE_DIM, ACTION_DIM, FC_SIZE):
super().__init__()
self.l1 = nn.Linear(EKF_STATE_DIM, FC_SIZE)
self.l2 =... |
730a3d333e3f544b450fdd4d428ed544f901d6ca77e50601c82a3ea85c370929 | Python | 581 | 25 | """Utilities for validating queries used in the research pipeline."""
from OvIntelligence.query_manager import QueryManager
def validate_query(query: str) -> None:
"""Validate a query string.
Parameters
----------
query:
The query string to validate.
Raises
------
ValueError
... |
8931a273688ae9b8d0006377b1362ee7a84616fb59ad71dca6bf181d903e684e | Python | 581 | 24 | # -*- coding: utf-8 -*-
#
"""
std_scramble.py
Standardize a Scramble record.
"""
from .standardize import VCFStandardizer
@VCFStandardizer.register('scramble')
class ScrambleStandardizer(VCFStandardizer):
def standardize_info(self, std_rec, raw_rec):
"""
Standardize Scramble record
"""
... |
a2a356ddef6fcca4f6ffe048153a06c1a3bf22197b7353ca922f326d82aad2eb | Python | 581 | 20 | import typing
import numpy as np
from numpy.typing import NDArray
VcgT = typing.TypeVar("VcgT", np.uint8, np.uint32)
IntegerT = typing.TypeVar("IntegerT", bound=np.integer)
UnsignedIntegerT = typing.TypeVar("UnsignedIntegerT", bound=np.unsignedinteger)
class StatisticsDict(typing.TypedDict):
voxel_counts: NDArr... |
32986fca05798ffd86faac7c3759e25ac6b930419d7517a6e739c51e6a7f84de | Python | 582 | 17 | from .Alpha_nodes import AlphaW_Node, AlphaZ_Node
from .Tau_nodes import TauD_Node
from .Theta_nodes import ThetaW_Node, ThetaZ_Node
from .W_nodes import W_Node, SW_Node
from .Y_nodes import Y_Node
from .Z_nodes import Z_Node, SZ_Node
from .Z_nodes_GP import Z_GP_Node
from .Z_nodes_GP_mv import Z_GP_Node_mv
from .multi... |
76f72e7c16bc00c91926c39b8b0bde31742e29d1e13d4348dc55dabeac713bac | Python | 583 | 11 | import case3
from case3 import *
case3.EXT = len(sys.argv)>3
import time,os,warnings; warnings.filterwarnings("ignore"); t0=time.time()
models=["S","C","N"]; gi=int(sys.argv[1]); R=int(sys.argv[2]); gm=models[gi]
fn=f"c3_gen{gi}{'_ext' if case3.EXT else ''}.json"; rows=json.load(open(fn)) if os.path.exists(fn) else []
... |
c389979082ceb2c9a50aaa6189ee2542a4403c6446a4cb58ca23c3de4e7bbf02 | Python | 583 | 20 | import torch
from torch.autograd import gradcheck
from gcn.layers.GConv import GOF_Function
def gradchecking(use_cuda=False):
print('-'*80)
GOF = GOF_Function.apply
device = torch.device("cuda" if use_cuda else "cpu")
weight = torch.randn(8,8,4,3,3).to(device).double().requires_grad_()
gfb = torch... |
d3c25d5c8b5673c30f8c4e7015238f2601c34748c069ba13edcba91929af66d2 | Python | 583 | 21 | from .cross_validate import GR_pKa_train, cross_validate, TRAIN_LOGGER_NAME
from .evaluate import evaluate, evaluate_predictions
from .make_predictions import GR_pKa_predict, make_predictions
from .molecule_fingerprint import GR_pKa_fingerprint
from .predict import predict
from .run_training import run_training
from .t... |
eb5e1f92eda17d636be5d4282a263866e4230760885dc193753eff7023502271 | Python | 583 | 24 | #!/bin/python
#------------------- Description & Notes --------------------#
#------------------- Dependencies ---------------------------#
# Standard imports
# Third-party imports
# Internal imports
#------------------- Constants ------------------------------#
#------------------- Public Classes & Functions --... |
95142d10276c609cd258aa6919c83ff68087351c23629ae09880db276d4a79cd | Python | 584 | 13 | from .alif import ALIF, ALIFRecurrent
from .channel_shift import ChannelShift
from .crop2d import Cropping2dLayer
from .exp_leak import ExpLeak, ExpLeakSqueeze
from .iaf import IAF, IAFRecurrent, IAFSqueeze
from .lif import LIF, LIFRecurrent, LIFSqueeze
from .merge import Merge
from .neuromorphic_relu import Neuromorph... |
7568f1186221a590c49d68eb469d21c64dd4b7b05a62e8d84fef038650a704c2 | Python | 585 | 14 | # 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 agreed to in writing, software
# distributed under th... |
960b60663c9c1de2d1c060b595d26ecfb0c718130fdf1818bdb28325efaf11e0 | Python | 585 | 22 | """
Test for issue 353:
https://github.com/Data-Centric-AI-Community/data-profiling/issues/353
"""
import numpy as np
import pandas as pd
from data_profiling import ProfileReport
def test_issue353():
df = pd.DataFrame(np.random.rand(100, 5), columns=["a", "b", "c", "d", "e"])
# make one column categorical
... |
c3c99955166c88e3ce4362d99f9ba569fc4b10e2b2b3c76649436eecdbe3ad26 | Python | 585 | 19 | from pathlib import Path
import pandas as pd
from data_profiling import ProfileReport
from data_profiling.utils.cache import cache_file
if __name__ == "__main__":
file_name = cache_file(
"reviews_Musical_Instruments_5.json.gz",
r"http://snap.stanford.edu/data/amazon/productGraph/categoryFiles/rev... |
ded20035ff8dea12fb7298ebe83c61de3f81812f8468115f04f7cf5913498661 | Python | 585 | 15 | # -*- coding: utf-8 -*-
# (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#... |
fdce071c3aba88311c364aca9a10313b99cb5ba34b33cca598478d9ba88e36e7 | Python | 585 | 20 | from bottle import Bottle
from bottle_cors_plugin import cors_plugin
from algo import Client
from local_run import runWorkflow
from web import applyWebServerRoutes
client = Client()
server = Bottle()
server.install(cors_plugin('*'))
# add the api implementation
applyWebServerRoutes(server, client, client, None)
# r... |
46e1af73e2aa567fdb55827a530e42ac9e078cc179bef8bd2bdd1bb977260139 | Python | 586 | 13 | # -*- coding: utf-8 -*-
# (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#... |
d5c8a0917f9e6603aaaaae525e8ef6f400305c02994385247a74e51642d91bac | Python | 586 | 13 | # -*- coding: utf-8 -*-
# (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#... |
7b222602c3bea74430aaa1a91b5e3a1f69fba95f4fb4e13710640461922d92b0 | Python | 587 | 21 | from . import stl
class Mesh(stl.BaseStl):
"""Primary user-facing class for STL mesh operations.
Inherits all functionality from
:class:`~stl.stl.BaseStl` and
:class:`~stl.base.BaseMesh`. Use class methods
like :meth:`from_file` and :meth:`from_multi_file`
to load STL files, or pass a structu... |
bc4c4d99974b743827c9e46b86eb2baf686db566cfc0c2fdfe895d29df2a9e26 | Python | 587 | 20 | import pandas as pd
import os
def main():
SEQ_LEN = "800"
bam_juncs = pd.read_csv('../ALL_JUNCS/junctions.bed', sep="\t", header=None)
print("Printing all juncs from the BAM file")
print(bam_juncs)
neg_1_juncs = pd.read_csv('./NEG_rev_junctions/'+SEQ_LEN+'bp/d_a/d_a.bed', sep="\t", header=None)
... |
d4b3e2dae4200b8274a882494700745ec23c961fbf9b9740af94a410db94834f | Python | 587 | 18 | import logging
from agent.data.entities.config import ROOT_LOGGER_ID
from agent.data.sql.sql_mgmt import get_connection
from agent.nlp.metamap_mgmt import parse_and_update_annotate_sentences, update_common_terms
logging.basicConfig(format='%(levelname)s : %(message)s', level=logging.INFO)
logger = logging.getLogger(R... |
f5e9da5690ec17059315f4c4c450b536a181b4a37a1f5a5a379f1521dbc62a66 | Python | 588 | 21 | r"""I/O utilities for spatial omics datasets."""
from ._atera import read_atera
from ._nanostring import read_nanostring
from ._stereoseq import bin_stereoseq, read_stereoseq
from ._visium import read_visium
from ._visium_hd import read_visium_hd, read_visium_hd_bin, read_visium_hd_seg, write_visium_hd_cellseg
from ._... |
3f8a2a815526305a88e6cfe3d8e7dd5b4ccfa60b886458c6325e1ea000c38db1 | Python | 591 | 25 | #!/bin/python
#------------------- Description & Notes --------------------#
#------------------- Dependencies ---------------------------#
# Standard library imports
# External imports
import pytest
from pyspark.sql import SparkSession
# Internal imports
#------------------- Constants ---------------------------... |
4a092a212d90b3e05beafaa46c9188e8328c5bff7a4f9c930e4bedf794f1a114 | Python | 591 | 9 | from pfrl.wrappers.cast_observation import CastObservation # NOQA
from pfrl.wrappers.cast_observation import CastObservationToFloat32 # NOQA
from pfrl.wrappers.continuing_time_limit import ContinuingTimeLimit # NOQA
from pfrl.wrappers.monitor import Monitor # NOQA
from pfrl.wrappers.normalize_action_space import No... |
6448910a74b40f41f46ceb9381d2d483684e636651c49a903888d72922d62173 | Python | 591 | 19 | import os
import os.path
def build_datafiles(prefix, datadir):
'''
Return a data_files like structure for distutils for a given
data dir that
datadir is relative to setup.py
:param str prefix: Where to install into
:param str datadir: The datadir to iterate through
:return: [(prefix, [fi... |
24d5c7a864a351839125956f5082b8212fddf0e019c66877498504b954511f0b | Python | 592 | 18 | from collections import namedtuple
SEED = 4000002
DataRecord = namedtuple('DataRecord', 'x_train y_train x_val y_val x_test y_test masks_train masks_val masks_test')
TrainingRecord = namedtuple('TrainingRecord', 'data_params model_path keras_path train_loss val_loss train_accuracy val_accuracy test_preds')
# Usages... |
3540de3ea627b0c61e1e347e5620d7f36c456280eb9ccfac28deedce045129e6 | Python | 592 | 15 | # -*- coding: utf-8 -*-
# (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#... |
6b055a496f0bdb6f6adf84fa767ce30e85082206e3a7ee221aeb8158bb1b87c2 | Python | 592 | 21 | _base_ = 'faster-rcnn_r50_fpn_1x_ruod.py'
model = dict(
backbone=dict(
depth=101,
init_cfg=dict(type='Pretrained',
checkpoint='torchvision://resnet101')))
# add WandbVisBackend
# vis_backends = [
# dict(type='LocalVisBackend'),
# dict(type='WandbVisBackend',
# ... |
75b59d1549618a26233972c6f260e090df5c70ee95cefa5d3f94d9e24a1a6a73 | Python | 592 | 15 | #
# Copyright (c) 2022, NVIDIA CORPORATION.
#
# 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 agreed ... |
0e218d78050b3b8d364c6e56a5d9cf7035b305c4b45286222c6895e7f4dcbf6b | Python | 593 | 16 | import logging
from agent.data.entities.config import ROOT_LOGGER_ID
from agent.data.sql.sql_mgmt import get_connection
from agent.data.entities.sentence import export_annotate_sentences
from agent.data.entities.config import METAMAP_INPUT_PATH
logging.basicConfig(format='%(levelname)s : %(message)s', level=logging.I... |
e5844295a359fa5c7784ad48827197f1f36643dcb1907cc6db3127f22cbef55e | Python | 593 | 13 | from tensorflow.keras.models import load_model
from ml4h.TensorMap import TensorMap, Interpretation
from ml4h.models.model_factory import get_custom_objects
from ml4h.tensormap.ukb.ecg import ecg_rest_median_raw_10
custom_dict = get_custom_objects([])
ecg_model_file = '/home/sam/hypertuned_48m_16e_ecg_median_raw_10_a... |
0cc7e9a71a4616d8115bc5f7e98cad752b47167976befe0a72a2234813939018 | Python | 594 | 21 | _base_ = 'faster-rcnn_r50_fpn_2x_duo-coco.py'
model = dict(
backbone=dict(
depth=101,
init_cfg=dict(type='Pretrained',
checkpoint='torchvision://resnet101')))
# add WandbVisBackend
# vis_backends = [
# dict(type='LocalVisBackend'),
# dict(type='WandbVisBackend',
# ... |
597e075519b89a58800bffcf735eaa752d6c58eedb780d2f33b121b412839b8b | Python | 594 | 21 | _base_ = 'faster-rcnn_r50_fpn_1x_duo-coco.py'
model = dict(
backbone=dict(
depth=101,
init_cfg=dict(type='Pretrained',
checkpoint='torchvision://resnet101')))
# add WandbVisBackend
# vis_backends = [
# dict(type='LocalVisBackend'),
# dict(type='WandbVisBackend',
# ... |
84d3674f2136e2bbf13bb6aefbe86caa0fa17cd7bd3d532fffa4ef9773f6e5c9 | Python | 594 | 13 | # -*- coding: utf-8 -*-
# (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#... |
bc693824c2e3a9b9cabf43872e2633085d82fbbdbd653292be8923135d31acdc | Python | 595 | 13 | # -*- coding: utf-8 -*-
# (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#... |
47c9628ca700c415403a4bf3c4a5673f2b371ca3531a2ffede73d21007ed73b9 | Python | 596 | 23 | import torch.nn as nn
class MyLinear(nn.Module):
def __init__(self, input_size, num_outputs=1):
super(MyLinear, self).__init__()
"""
A linear network
"""
# initialize the weights
self.fc1 = nn.Linear(input_size, num_outputs)
nn.init.kaiming_uniform_(self.fc1... |
978c0d60cbcb62f9911f4267854bf47d65a02f55eee55d334c295701b47f80f4 | Python | 597 | 17 | import numpy as np
from siapy.entities import Pixels, SpectralImage
from siapy.utils.plots import display_image_with_areas
# Create a mock spectral image
rng = np.random.default_rng(seed=42)
image_array = rng.random((50, 50, 4))
image = SpectralImage.from_numpy(image_array)
# Create predefined areas manually
area1 =... |
cc64ff01aef654c10432bdfebf3970b0a3ca5477906dd926a4b1a52f5f0008ee | Python | 598 | 23 | # Generated by Django 4.1.6 on 2023-02-09 17:35
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("infer", "0014_alter_proteinembedding_vector"),
]
operations = [
migrations.AddField(
model_name=... |
11f27a11fa76a94d588213aeed44e457fd09bd573eaa3d407dd0c6629418e93c | Python | 599 | 21 | import numpy as np
from siapy.utils.images import rasterio_create_image, rasterio_save_image
# Create sample data
rng = np.random.default_rng(42)
image = rng.random((100, 150, 5))
# Save as GeoTIFF with Rasterio
rasterio_save_image(
image=image,
save_path="output/rasterio_image.tif",
metadata={"descripti... |
191b1d8447cc1e99b9578efdca9a80921beed2ebcf7c62ce4b5139b6bc9b29ec | Python | 599 | 22 | KEEP_COLs = ["responseN",
"participant",
"blockOrder",
"age",
"sex",
"date",
"frameRate",
"imageFile",
"trials.thisN",
"index"
"trials.thisIndex",
"blocks.thisN",
"... |
e7836388057915af5baf4b31cec80640f7f292c2b9ebb48f6899987b796a8c21 | Python | 600 | 16 | import numpy as np
def compute_resolution(zoom, size_px):
""" Function to calculate resolution from Labview 2p software data.
Zoom and size in pixel must refer to the same axis
:param zoom: zoom parameter from Labview software
:param size: image size on matching axis
:return: Pixel size in microns... |
3cc972384d5ff24d0000d31ffaf1d15e618168062332ba76460b8c2a986d11bc | Python | 601 | 15 | """Legacy three-point differences used by bundled SpatialDE/SOMDE.
Preserves scipy.misc.derivative's default dx=1/order=3 numerics for the
first and second derivatives used here; no global SciPy monkey patch.
"""
def derivative(func, x0, dx=1.0, n=1, args=(), order=3):
if order != 3 or n not in (1, 2) or dx <= 0... |
468491fb27f22d0de4fb24635cdf69e77f7ee9286d007363020462bded37c987 | Python | 603 | 13 | # Modified from https://github.com/dbolya/tide
# This work is licensed under MIT license.
from .error import BestGTMatch, Error
from .main_errors import (BackgroundError, BoxError, ClassError,
DuplicateError, FalseNegativeError,
FalsePositiveError, MissedError, OtherE... |
c906a5a292d92445c39ed2bbf6fb036d6b1800e72068f49b30b84176369938bd | Python | 604 | 21 | import common
from nose.tools import eq_, raises
class TestUnitAmbTable(common.BaseClass):
modulepath = 'ngs_mapper.alphabet'
functionname = 'iupac_amb'
def test_permutations( self ):
from ngs_mapper.alphabet import AMBIGUITY_TABLE
import itertools
for k, v in AMBIGUITY_TABLE.items... |
e1471d493357f004bcc4e1c584b6e92b4e21ca024b9b66a6340b6a2a021dec06 | Python | 604 | 24 | def test_maxpool2d():
import torch
from sinabs.layers import SpikingMaxPooling2dLayer
inp = torch.zeros((2, 2, 10, 10))
maxpool = SpikingMaxPooling2dLayer(pool_size=(2, 2), strides=(2, 2))
# Verify output shape
assert maxpool(inp).shape == (2, 2, 5, 5)
def test_maxpool_function():
impor... |
fbb72b77437b012483f2dbb7dba74e775c8bfa736ad9b8c7240c04700ed7b19f | Python | 605 | 23 | import numpy as np
from scipy.cluster.hierarchy import to_tree
def cluster_id_search(tree):
nodes_list = []
if tree.is_leaf():
nodes_list.append(tree.get_id())
else:
nodes_list += cluster_id_search(tree.get_left())
nodes_list += cluster_id_search(tree.get_right())
return nodes... |
4e9195d49521b7c1e48ca5009954a430016221321572efa9ef713de81af0563b | Python | 606 | 21 | from os import path
from setuptools import setup
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='ddw',
setup_requires=['setuptools_scm'],
python_requires='>=3.7.0',
author='Sim... |
8be007f93a7871a30a1dd97b65fd8639a2479b88799ee28fee5fedf1b07a81a3 | Python | 606 | 16 | #!/bin/bash
#SBATCH --job-name=multinomial # Job name
#SBATCH --mail-type=END # Mail events
#SBATCH --mail-user=benweinstein2010@gmail.com # Where to send mail
#SBATCH --account=ewhite
#SBATCH --nodes=1 # Number of MPI ran
#SBATCH --cpus-per-task=1
#SBATCH --mem=20GB
#SBATCH --time=48:0... |
667a57c6dfe512b32e5d5e2a6cc1bf48e9859aaa246ce4c1d87c68f3dd7f8167 | Python | 608 | 25 | def test_abi_connectivity_map(tmp_path):
from samri.fetch.model import abi_connectivity_map
abi_connectivity_map('ventral_tegmental_area',
invert_lr_experiments=[
"127651139",
"127796728",
"127798146",
"127867804",
"156314762",
"160539283",
"160540751",
"165975096",
"166054222",
"17102... |
7d5dad57ecacc259dc4dbf44f79e5761ed53cd4470839a459cf2bc685cd6adec | Python | 608 | 32 | import os
import socket
import sys
import time
# trainer.py
from collections import Counter
import ray
num_cpus = int(sys.argv[1])
ray.init(address=os.environ["ip_head"])
print("Nodes in the Ray cluster:")
print(ray.nodes())
@ray.remote
def f():
time.sleep(1)
return socket.gethostbyname("localhost")
# ... |
a73013c80940d5ae7393af70bc33d2e99c3e00358c430ac0f630490a7e59fb91 | Python | 609 | 19 | #!/usr/bin/env python
from setuptools import setup
setup(name='svtest',
version='0.1',
description='Test package for the GATK SV pipeline',
classifiers=[
'Development Status :: 3 - Alpha',
'Programming Language :: Python :: 3.8',
],
url='https://github.com/talkowski-l... |
a992367ca968325b74ce13b3ff4b92bbba49ca9eb7c8a6a583b4fb884c9ee4e4 | Python | 610 | 13 | # -*- coding: utf-8 -*-
# (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#... |
2d27dd2ed8fb98c468718a6c8ecf4bd0eaba074703f3adf81ba405c3b46924e9 | Python | 611 | 26 | import argparse
import pysam
import random
def parse_arguments():
parser = argparse.ArgumentParser()
parser.add_argument('-i', '--input', required=True)
parser.add_argument('-o', '--output', required=True)
return parser.parse_args()
if __name__ == '__main__':
args = parse_arguments()
bam = py... |
e482943f205a2e73b01bfe5fd7b48e8f0e592396a7d45be2d1b70444ccf63965 | Python | 611 | 22 | import torch
def bound_by_tanh(x, low, high):
"""Bound a given value into [low, high] by tanh.
Args:
x (torch.Tensor): value to bound
low (numpy.ndarray): lower bound
high (numpy.ndarray): upper bound
Returns:
torch.Tensor: bounded value
"""
assert isinstance(x, t... |
23e742f5be3f8666a4651ad6bb85ca0481c75088468f96043b893df7b55c9903 | Python | 612 | 23 | # ttl_cache.py
import time
from collections import OrderedDict
import os
class TTLCache(OrderedDict):
def __init__(self, maxsize=1000, ttl=3600):
super().__init__()
self.maxsize = maxsize
self.ttl = ttl
def __getitem__(self, key):
value, timestamp = super().__getitem__(key)
... |
2b96284451b05f5d2c6a86e481873577da99593e0242f1b08a0dbac73f771e54 | Python | 612 | 14 | #!/usr/bin/python
import subprocess
import os
directory = 'S1ULp'
input_directory = '/gpfs/bbp.cscs.ch/project/proj83/visualization-SSCXDIS-178/synaptome/trial-8-09.03.2021-exc_inh/' + directory + '/results'
output_directory = '/gpfs/bbp.cscs.ch/project/proj83/visualization-SSCXDIS-178/synaptome/trial-8-09.03.2021-ex... |
4576d93a59a81259fdbf15930d02b76ca75a9b1d24382e365e18144c8b653cc6 | Python | 612 | 22 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils
import torch.distributions
import numpy as np
def positional_encoding(coords, enc_dim, sigma):
freqs = (
2 * np.pi * sigma ** (torch.arange(enc_dim//2, dtype=torch.float, device=coords.device) / enc_dim)
)
freqs =... |
87612d4734f1d503a144819d0c158dba8de56442320452abafdffdf876a64124 | Python | 612 | 20 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from __future__ import annotations
import pytest
from fairchem.core import FAIRChemCalculator
from fairchem.core.units.mlip_unit import l... |
01af772c9b3bd182619cd61f74069527a5c37b98bfeffffdc102b62e509c3327 | Python | 613 | 14 | ##download wigs from https://www.synapse.org/#!Synapse:syn21785741
from tqdm import tqdm
import subprocess
wig_path = '/home/janaya2/Desktop/tmb_survival/files/wigs/'
bed_path = '/home/janaya2/Desktop/tmb_survival/files/beds/'
cmd = ['ls', wig_path]
p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
files = [str(i, 'utf... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.