sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
29a564d516716f1d311f5cf97ce178bf972d5f5d783381728fba6f88aaf346f8 | Python | 3,520 | 98 | from src.model_builder import ModelBuilder, ModelRepresentation
from src.pipeline import PipelineBuilder, PipelineRepresentation
from sklearn.pipeline import Pipeline
import pandas as pd
from pathlib import Path
class WorkFlowSpecs():
def __init__(self, pipe_file, model_file, pipe_name, model_name, rois):
... |
d01373d2cc5304d6c40db9f59e19659e9a93591ab1440343c8dd73c89028bc6c | Python | 3,522 | 86 | import time
from StimulationSystem.StimulationProcess.BasicStimulationProcess import BasicStimulationProcess
from psychopy import core, event
import math
class StimulateProcess(BasicStimulationProcess):
def __init__(self) -> None:
super().__init__()
def change(self):
sel... |
8ddea9517dac75d60fc1879c874abb518176ba4c3c8882f80c2d85ee1710ed11 | Python | 3,523 | 86 | # Copyright (c) 2021-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... |
a3505716d4b42bc4e6ccc090effaac424dad734ea93cad642aa3ef9a11c34eec | Python | 3,523 | 118 | """Script used to simulate a waiting MLC tracking socket connection."""
import argparse
import socket
import struct
import numpy as np
import matplotlib.pyplot as plt
HOST = "localhost"
PORT = 31000
def parse_cmd_args() -> dict:
"""
Function to utilise argparse to extract the user's paramete... |
4aa42ddaae922c0df3ca5e10a138dcf086b5cd6110f8cfa6ee7084784925fb9a | Python | 3,526 | 89 | ###############################################################################
# This script runs meta-analysis using NIMARE. #
# #
# Author: ana.trianahoyos@aalto.fi #
... |
4be10932da85f36f1a9571e04a71918ea21cf94901cff9e794ab895a562082b6 | Python | 3,526 | 63 |
import pandas as pd
import os
import sys
from pathlib import Path
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..")))
from load_db.AIBL import extract_symptoms, get_aibl_dx
from app import create_app, db
fro... |
0700e60f5c4ebc895855c6881c5b8b174a3deb9be9553f8baca634d256eb9c5c | Python | 3,532 | 81 | import math
import types
import torch
from rl_games.algos_torch.models import apply_sigma_parametrization
def _net(**kw):
return types.SimpleNamespace(**kw)
def test_softplus_without_cap_unchanged():
net = _net(min_sigma=0.2, sigma_parametrization='softplus', max_sigma=0.0)
raw = torch.tensor([-1.05, ... |
238f746ac49f0d31bf7ed1f864092b44114b0d05cdb73004bb60c7a7b12795b6 | Python | 3,533 | 106 | from indices.base import BaseComparisons
class SokalSneath2(BaseComparisons):
"""Class to calculate the Sokal-Sneath 2 index.
n=2 formula:
(2 * a + 2 * d)/(p + a + d)
Attributes
----------
fingerprints : np.ndarray
Numpy array with the fingerprints that will be compared.
... |
616a1a3198b15751348eda2ff50577b58a18aa03089a7208b88a14357c99337b | Python | 3,533 | 109 | import numpy as np
import pandas as pd
from pandas import offsets
class DatetimeStrftime:
timeout = 1500
params = [1000, 10000]
param_names = ["nobs"]
def setup(self, nobs):
d = "2018-11-29"
dt = "2018-11-26 11:18:27.0"
self.data = pd.DataFrame(
{
... |
71932a93e8d504282c539abcb1a8e71226fd401869336a5a41e962704c57710d | Python | 3,535 | 79 | """Proteomic clocks converted from their original authors' releases."""
import torch
from ._base_models import pyagingModel
class HPS(pyagingModel):
"""Kuo et al. Healthspan Proteomic Score from 86 NPX proteins and age.
Inputs use the original lowercase protein names and age in years. The
returned prob... |
d396f825d79088eb8016f66448049655db35bd0d9f6fa49aa5621f3829f7edfc | Python | 3,536 | 146 | import ctypes
import ctypes.util
import time
from ctypes import Structure, c_long, pointer
from datetime import datetime
TIMEVAL_LEN = 16 # bytes
TIMESPEC_LEN = 16 # bytes
TIMER_ABSTIME = 1
libc = ctypes.CDLL(ctypes.util.find_library('c'))
class timespec(Structure):
"""
timespec struct from sys/time.h
... |
880646f597c02cc1ffdbc7a9fe88ce413a7d1708701c44af42eabedd9337b8d7 | Python | 3,539 | 76 | import os
import shutil
import gzip
import pdb
def read_s3_contents(cos_client, bucket_name, key):
response = cos_client.Object(bucket_name, key).get()
return response['Body'].read()
def upload_directory(directory_upload, dataset_name, cos_client, bucket):
try:
cos_client.head_object(Bucket=bucket... |
3df447115a12e69733288d0a5bbdcc1d066a7faeff61a982dc2bb74d797c1af0 | Python | 3,541 | 93 | # 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... |
d1a7b93e44d898a5267d2d469e0635a54b55706782ead950a94260628d5c3ae0 | Python | 3,543 | 85 | from __future__ import print_function
import numpy as np
import pandas as pd
import glob
import os
import argparse
WINDNX = 128
WINDNZ = 64
NRECORDS = WINDNX*WINDNZ
def read_wind_csv(infile):
types = {"p": np.float32,
"U:0": np.float32,
"U:1": np.float32,
"U:2": np.float32,
... |
0a68bbfd552376eedd3f72fc3d0ebd95f0f669c22837ce3d89e19feade9ab668 | Python | 3,545 | 135 | from collections.abc import Generator
import contextlib
import weakref
import pytest
from pandas.errors import Pandas4Warning
import pandas as pd
import pandas._testing as tm
from pandas.core import accessor
def test_dirname_mixin() -> None:
# GH37173
class X(accessor.DirNamesMixin):
x = 1
... |
40f4f8c18a70d17530677440b257c3a1afcf87d52a9e25f66d39ab5eb92f8be6 | Python | 3,546 | 97 | class SGBlock(nn.Layer):
def __init__(self, inp, oup, stride, expand_ratio, keep_3x3=False):
super(SGBlock, self).__init__()
assert stride in [1, 2]
hidden_dim = inp // expand_ratio
if hidden_dim < oup / 6.:
hidden_dim = math.ceil(oup / 6.)
hidden_dim... |
7545eb2a33f7683e49d0387451735f330614358ce9a4f57e93d4c68bf4fbe0bd | Python | 3,546 | 96 | import argparse
import torch.cuda
from tqdm import tqdm
import pandas as pd
import numpy as np
from sequence_models.utils import parse_fasta
from sequence_models.pretrained import load_model_and_alphabet
from sequence_models.pdb_utils import parse_PDB, process_coords
parser = argparse.ArgumentParser()
parser.add_ar... |
ab25daf2b94156342921981f7c9d541106abf5ea83e29fd2bac3a6e3476218f1 | Python | 3,546 | 93 | import torch
from tnn.layers import View
from tnn.layers import LinearLayer
from tnn.training.batch_train import train
from tnn.utils import seed_everything, number_network_weights, get_logger, makedirs, setup_parser, matrix_match_tensor_single_layer
import os
import datetime
import argparse
import time
from copy impor... |
fa7d3574ed12e7b93a7c3f7b54cbddf9abeee441f65480573de77022c4870a08 | Python | 3,546 | 73 | """Independent author-source checks for the 0.5.4 linear-clock additions."""
from pathlib import Path
import numpy as np
import pandas as pd
import torch
from pyaging.models._author_extensions import DNAmPhenoAgeNonPRC, DNAmPhenoAgePRC, IntrinClock370
from pyaging.models._base_models import LinearModel
DATA = Path(... |
90bc1d3edb70106b89f4f5935848ba7e0baf470b618a09d7b08c05f6a678a008 | Python | 3,547 | 114 | from matplotlib import pyplot as plt
from matplotlib import pyplot as plt
import math
import os
import numpy as np
import scipy as sc
import pylab as pl
import seaborn as sns
from scipy.stats import ranksums
import random
def plot_memory():
x_axis = ["5x", "10x", "20x", "40x"]
memory_hifi = [0.89, 1.28, 1.7... |
0b88e7e3aad7c3ef9ebc3297cf7f2519e4ea33410a035853c503e5088d866f1c | Python | 3,548 | 111 | """
Tests for the MACE (Mean Absolute Centile Error) metric.
Verifies that MACE is computed per combination of
batch-effect dimensions (Cartesian product), not per
individual batch-effect level.
"""
from unittest.mock import patch
import numpy as np
import xarray as xr
from pcntoolkit.dataio.norm_data import NormDa... |
2756be500487d519899cbbb5d70705898a9aab0bfb62f031ee2bc9c89620f373 | Python | 3,548 | 105 | """
Validate that the exceptions and warnings are in appropriate places.
Checks for classes that inherit a python exception and warning and
flags them, unless they are exempted from checking. Exempt meaning
the exception/warning is defined in testing.rst. Testing.rst contains
a list of pandas defined exceptions and wa... |
f65ad78c47cb0fb8503065eeb7d8ddc1ffb2ee4bfa83c04546ea44d81c9f5cfd | Python | 3,549 | 132 | from unittest.mock import ( # noqa: TID251
mock_open,
patch,
)
import pytest
import requests
from web.pandas_web import (
Preprocessors,
main,
)
class MockResponse:
def __init__(self, status_code: int, response: dict) -> None:
self.status_code = status_code
self._resp = response... |
090ae22616ec365eea131743a14cb13a81cba44e6aedbcb6f7dad3084c47c486 | Python | 3,550 | 139 | import argparse
import os
#####################################################################################################
# #
# Functions #
# #
##############################################################################################... |
d378b311d24ecff53bea92ec584c6b44dfeb9711bb9d0609eb2579ac86b262f2 | Python | 3,551 | 105 | import os, csv
import scipy.stats as ss
import pandas as pd
import numpy as np
def correct_p_values(pvalues, method = 'BH'):
"""Corrects p-values for multiple testing using various methods.
Arguments
---------
pvalues : array
List of p values to be corrected.
method : str
Optional method to use:... |
250311b966d0ba4ca7ffdc9db6370847f19f0f4a6b3afb84a2aaa8173b5560ab | Python | 3,553 | 99 | # 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... |
d7cf88e4f484ef74c4e38c647a9bae7f44fe9d0a3e0cbbf3655ba8fab70b620c | Python | 3,554 | 93 | # 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... |
e5190677ab91c14f1c4911a6b36efca35a8e8d20e8e315cca8a7db985aecd12f | Python | 3,554 | 107 | from math import log
from indices.base import BaseComparisons
class ConsoniTodeschini1(BaseComparisons):
"""Class to calculate the Consoni-Todeschini 1 index.
n=2 formula:
log(1 + a + d)/log(1 + p)
Attributes
----------
fingerprints : np.ndarray
Numpy array with the fingerprints ... |
289b2c11889530385896a8c674dbd2874b5580222f6b8ac5b5f30631bbff6cc5 | Python | 3,556 | 108 | from indices.base import BaseComparisons
class Gleason(BaseComparisons):
"""Class to calculate the Gleason index.
n=2 formula:
(2 * a)/(2 * a + b + c)
Attributes
----------
fingerprints : np.ndarray
Numpy array with the fingerprints that will be compared.
The fingerprints... |
7e29f6f01293fa40c1070ba33486c6b0bcfd93534a4c4d92c73478f8a08afbe4 | Python | 3,557 | 95 | from __future__ import absolute_import
import os
from .model_data_base import ModelDataBase, MdbException
from .model_data_base_register import get_mdb_by_unique_id
from .utils import cache
def resolve_mdb_path(path):
# This has the purpose to map projects, that robert has run on the CIN cluster, to local paths
... |
f810c0b0de56aca31765fb7425c41f6d223b4e9a1ada097bcbe436c101d866df | Python | 3,558 | 119 | # -*- coding: utf-8 -*-
"""
Created on Thu Jan 26 18:06:05 2023
@author: jeanbaptiste
"""
import os
import json
import sys
import glob
import time
import numpy as np
import matplotlib.pyplot as plt
# Make sure the proper path is used:
dcc_repo_path = './../'
sys.path.insert(0,dcc_repo_path)
import deepcellcontrol as... |
312bdb685955cb118840b7ef5db9b5e876494412b61732d6146589b0c76ccd1a | Python | 3,559 | 80 | # MIT License
#
# Copyright 2026 Broad Institute
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, ... |
d28f2288d6adde5a1c85428c09d46fede069f8ef29bad76d1d742681ba8cec82 | Python | 3,559 | 129 | import string
import numpy as np
import pandas as pd
from pandas import (
DataFrame,
Index,
)
import pandas._testing as tm
from pandas.api.types import (
is_extension_array_dtype,
pandas_dtype,
)
from .pandas_vb_common import (
datetime_dtypes,
extension_dtypes,
numeric_dtypes,
string... |
6e6d73295f418b2e5ca4d1806874a7931070c00b21ab9b019f002b9ee3e7b766 | Python | 3,560 | 94 | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
63ac3885d8780605eb05dda48f85e5cf9c8005c603e026e605db56480eb11bfe | Python | 3,561 | 81 | """Immutable internal performance defaults, with units in field names.
These are development defaults, not per-job settings. Compiled consumers
copy them into typed values once at import, before entering native loops.
Rebinding module attributes cannot configure an already imported extension.
"""
from dataclasses imp... |
aa55cb1e935c015937da6d395e32544276b1acf55871ec971659fbf9b9f19581 | Python | 3,561 | 121 | from argparse import ArgumentParser, Namespace
import requests
from pydantic_settings import BaseSettings, SettingsConfigDict
from pathlib import Path
import json
import os
import warnings
class PLOSSSettings(BaseSettings):
"""Settings for the PennyLane OSS service."""
model_config = SettingsConfigDict(env_p... |
7e36ef2655750d3c375437f66f738fb2ace2edf69fb73d17a9ce8b6833a857e1 | Python | 3,563 | 74 | """Return-type contracts for tracker loss-input methods.
Each ``TypedDict`` here documents the exact keys and tensor shapes produced by one tracker's
``get_loss_inputs_labeled``/``get_loss_inputs_unlabeled`` method (see
:class:`~lightning_pose.models.base.BaseSupervisedTracker` and
:class:`~lightning_pose.models.base.... |
48289cc6456629ca14ec63b2a279b4022ce0e533adae8e5e7ecb57a1e2b3e458 | Python | 3,564 | 127 | #
# File for protein sampling functions
#
import sys
import Bio.PDB as pdb
import numpy as np
import protein_holography.hologram.sample_protein as sample_protein
from protein_holography.utils.protein import *
amino_acids = list(aa_to_ind.keys())
def sample_equally(pdb_list,pdb_dir,instances):
# get a list of a... |
3ec752f016d0ca825b9dea7617f5a702effaa8a271f3d18707e844c88dc7d270 | Python | 3,566 | 116 | from numba import njit
import numpy as np
import torch
from torch.nn.functional import conv1d
import math
from tqdm import trange
@njit()
def compute_CCG(st1, st2, tbin = 1/1000, nbins = 500):
st1 = np.sort(st1)
st2 = np.sort(st2)
dt = nbins * tbin
T = np.maximum(st1.max(), st2.max()) - np.minimum(... |
539fcda6421187f1aa99b16bd5a5d376d6fe4680fdc775093465cfa40d07f0ad | Python | 3,567 | 104 | """
Tests that apply to all groupby operation methods.
The only tests that should appear here are those that use the `groupby_func` fixture.
Even if it does use that fixture, prefer a more specific test file if it available
such as:
- test_categorical
- test_groupby_dropna
- test_groupby_subclass
- test_raises
""... |
1a4f9d84544de32d671a270df50f6240c939c91c23f74ff84d3a58fe5b78a486 | Python | 3,571 | 105 | import torch
from torch import nn
import copy
from ..mlp import MLP
from ..convs import MeshGraphNetsConv
from ..basis import GaussianRandomFourierFeatures
# Typing
from torch import Tensor
from typing import List, Optional, Tuple
class Encoder(nn.Module):
"""MeshGraphNets Encoder.
"""
def __init__(self... |
56f3619372df8d1191fb7a1e8ca33559c19d0b501dc9f0e81776dfb252bfc765 | Python | 3,571 | 109 | from math import log
from indices.base import BaseComparisons
class ConsoniTodeschini3(BaseComparisons):
"""Class to calculate the Consoni-Todeschini 3 index.
n=2 formula:
log(1 + a)/log(1 + p)
Attributes
----------
fingerprints : np.ndarray
Numpy array with the fingerprints that... |
e6b9815d195d2bb88de40ddbd9b21f03f3afe06d8b3cfa0d3f5a70bf0fec9cd1 | Python | 3,573 | 109 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.tests.copy_view.util import get_array
def test_consolidate():
# create unconsolidated DataFrame
df = pd.DataFrame({"a": [1, 2, 3], "b": [0.1, 0.2, 0.3]})
df["c"] = [4, 5, 6]
# take a viewing subset
subs... |
b065c7318b441a7ca10252a4c31586180dc7200e2c2be2420a379f9b996896b3 | Python | 3,574 | 135 | from __future__ import annotations
import gzip
import io
import tarfile
from typing import (
TYPE_CHECKING,
Any,
)
import zipfile
from pandas.compat._optional import import_optional_dependency
import pandas as pd
from pandas.io.pickle import to_pickle_internal
if TYPE_CHECKING:
from collections.abc imp... |
b762e24a17a2ca2f440ef22501f253bb163b40d5e8aaba3abd0c30594c7fbfb3 | Python | 3,574 | 119 | from typing import FrozenSet, List, Optional
import numpy as np
import pandas as pd
from ..logging import logger
from .conversion import BASE_IDX, COLUMNS
def read_rates(rates_path: str) -> pd.DataFrame:
"""Read mutation rates CSV as a pandas dataframe.
Args:
rates_path: Path to rates CSV
Retu... |
cee8e4af8ccf3720bf4785427ede1d88ebb775da02038175c962f4580395097d | Python | 3,575 | 120 | """
Create dataframes/csv-files for CellProfiler's LoadData module
"""
import textwrap
import pandas as _pd
from cptools2 import utils
from parserix import parse as _parse
def create_loaddata(img_list, is_new_ix=False):
"""
create a dataframe suitable for cellprofilers LoadData module
Parameters:
-... |
35deabad64db0a1c172b531e625e5bbfac316520dd61d463e9a9a52e2223a96e | Python | 3,576 | 101 | """Linear operators (such as FourierOp), functionals/loss functions, and qMRI signal models."""
from mrpro.operators.Operator import Operator
from mrpro.operators.LinearOperator import LinearOperator
from mrpro.operators.Functional import (
FunctionalType,
ProximableFunctional,
ElementaryFunctional,
El... |
7d7cb48abf6e057aa62a1eae38cb36fcf935799f5488f965b80de267c799c8f7 | Python | 3,577 | 98 | #! /usr/bin/python3
# -*- coding: utf-8 -*-
# @FileName: main.py
# @Author: Li Chengxin
# @Time: 2023/7/2 19:51
import argparse
import logging
import os
import sys
import time
import imagesize
from SCTrack import track, config
def main():
logging.basicConfig(format="%(asctime)s %(levelname)s: %(message)s", dat... |
848c382eb458cfc17362ec968a77f97990b809eee1fd5059c4faa7b222145a8e | Python | 3,578 | 148 | import numpy as np
from pandas import (
DatetimeIndex,
Index,
MultiIndex,
Series,
Timestamp,
date_range,
)
def no_change(arr):
return arr
def list_of_str(arr):
return list(arr.astype(str))
def gen_of_str(arr):
return (x for x in arr.astype(str))
def arr_dict(arr):
return... |
b58f2f0c41e20eb3bfaae85525f1f5db07fb8494769e6146ec61526277bc8963 | Python | 3,578 | 107 | import numpy as np
from indices.base import BaseComparisons
class AustinColwell(BaseComparisons):
"""Class to calculate the Austin-Colwell index.
n=2 formula:
(2/pi) * arcsin(sqrt((a + d)/p))
Attributes
----------
fingerprints : np.ndarray
Numpy array with the fingerprints that w... |
dfdcbf2b14e5a938573bebd5e41d9d6d032be6ab438e1409c50430a6690eab4c | Python | 3,578 | 99 | # Threads.py: run per-chromosome work of a track on threads
"""Run the independent per-chromosome steps of a track on threads.
FWTrack, PETrackI and PETrackII run finalize and filter_dup chromosome by
chromosome. A chromosome of fewer than MIN_THREADED_SIZE elements they
run on the spot; the others they hand to map_ch... |
bdcb72c3a65e16c6af517a816c7eef448f9f89b7e2df71e7efb12d6da67bff44 | Python | 3,579 | 93 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
@pytest.fixture(params=[True, False])
def allow_fill(request):
"""Boolean 'allow_fill' parameter for Categorical.take"""
return request.param
class TestTake:
# https://github.com/pandas-dev/pandas/issues/20664
def te... |
be1c9a71c9bba82bb39d7c682f5e8f37daa53b7c36176cdce20aa0bde734ed7a | Python | 3,579 | 107 | import numpy as np
import pandas as pd
import sys
import argparse
def parse_args(args):
parser = argparse.ArgumentParser(description="Permute genotypes for each SNP in bed file.")
parser.add_argument("--bfile", help="Plink bfile prefix to permute.")
parser.add_argument("--out", help="Permuted output bfile ... |
2e74140b83b7cdd0a29eb2e7a93b5b451e9554f7d7457fe8c16e312227fd28ee | Python | 3,580 | 115 | """Tests for Identity Linear Operator and MultiIdentity Operator."""
import pytest
import torch
from mrpro.operators import IdentityOp, MagnitudeOp, MultiIdentityOp
from mrpro.operators.LinearOperator import LinearOperator
from mrpro.utils import RandomGenerator
from typing_extensions import assert_type
def test_ide... |
7069401b30be4c299263a022165626cb3f016b0eb9e5d0a260f6a5bc5058cccb | Python | 3,580 | 113 | from utils.dice_loss import dice_loss, calculate_iou
from utils.training_utils import AverageMeter
import time
import torch
from torchmetrics import JaccardIndex
def train(train_loader, model, criterion, schediuler, optimizer, epoch, cpu=False):
"""
Runs one train epoch
:param schediuler:
:param cpu: ... |
8a8848becfeab3225e5a62c56663c7d07688e43a49c2e2aaed975e3d6ae9284e | Python | 3,581 | 95 | import sys, os, re, getopt
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'resource-gcg', 'scripts'))
import tree
import pdb
def smallestContainingCat ( tr, targbeg, targend, catbeg=0 ):
catmid,lfind = smallestContainingCat ( tr.ch[0], targbeg, targend, catbeg ) if len(tr.ch)>0 and len(t... |
fcf9d7d5701f20c2d1f3696c7bcae0354a6bed3a2c173d7dd5c0b7cbc5eeb771 | Python | 3,581 | 111 | import pathlib
from PyQt6 import QtCore
from shapeout2.gui.main import ShapeOut2
from shapeout2 import session
import pytest
data_path = pathlib.Path(__file__).parent / "data"
@pytest.fixture(autouse=True)
def run_around_tests():
# Code that will run before your test, for example:
session.clear_session()
... |
98713fd164f121a9e22add8ca5907547877386f85a995203da1d1cdc1433e6aa | Python | 3,584 | 119 | # -*- coding: utf-8 -*-
"""
These are the default options for Combinato.
Use setup_options.py to automatically insert the path to the
clustering binary.
"""
# pylint: disable=no-member, invalid-name
from __future__ import division, print_function, absolute_import
import numpy as np
from matplotlib import cm
# set... |
d463191a755c61cb04b4fe165d41153d3d587324a9ead180861f97d92c39146b | Python | 3,584 | 125 | #cell_identifier.py
# Functions for finding cells that meet a criteria, or random ones.
#test#
# from cellPLATO.cellPLATO.initialization.config_trackmate import *
from initialization.config import *
from initialization.initialization import *
import os
import numpy as np
import pandas as pd
def get_random_cell(df):
... |
dfe2d46ad691ccd3325f3ecdcd15c409fd573778594c048ebf6f9495d7830b46 | Python | 3,586 | 92 | #!/usr/bin/env python
import os
from nipype.pipeline import engine as pe
from nipype.interfaces import io as nio, utility as niu
def init_tract_output_wf(subject_id, session_id):
op_wf = pe.Workflow(name="output_wf")
# Outputs are tckgen, atlas_diff_space, conmat1, conmat2, prob_weights
inputnode = pe... |
072738d73db48f67c36bce49adc70519957274373e50b364fbc93c92800a7143 | Python | 3,588 | 115 | from datetime import datetime
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.tseries.holiday import (
AbstractHolidayCalendar,
Holiday,
Timestamp,
USFederalHolidayCalendar,
USLaborDay,
USThanksgivingDay,
get_calendar,
)
@pytest.mark.parametrize(
"transfor... |
8e7e4ad1af1e29f38d84331e5812a7425022b0a9be41562f741e4c3cfee93a0e | Python | 3,589 | 95 | from typing import Dict, FrozenSet, List, Optional, Tuple, Union
import numpy as np
import pandas as pd
def read_alpha(alpha_path: str,
group_by: Optional[List[str]] = None) -> Union[float, Dict[str, float], Dict[Tuple[str, ...], float]]:
"""Read alpha CSV as a dictionary, with `group_by` columns ... |
ea25e70c4b99abe528d0682e8c80a28e7fe98e1e6f52c5fdb83cbe923540a0c7 | Python | 3,589 | 93 | import numpy as np
import pytest
import pandas as pd
class TestEquals:
def test_equals_categorical(self):
ci1 = pd.CategoricalIndex(["a", "b"], categories=["a", "b"], ordered=True)
ci2 = pd.CategoricalIndex(["a", "b"], categories=["a", "b", "c"], ordered=True)
assert ci1.equals(ci1)
... |
2b8b8495439d4a297a4a8faa4fe56a53804573f430125f6fc9cba5fa3f227630 | Python | 3,590 | 105 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 1 13:59:02 2023
@author: simon
"""
import hashlib
import os
import pyzenodo3
import requests
from tqdm import tqdm
import settings
def get_free_space(path):
"""return the current free space in the cache dir in GB"""
import shutil
os... |
820f161c91b359b971bff614f172ae20619bfe9a37e797abc6d14b2c764db049 | Python | 3,590 | 110 | #!/usr/bin/env python
import scvi
import scanpy as sc
import argparse
import pandas as pd
parser = argparse.ArgumentParser(description="Parser for SOLO - Doublet finding")
# arguments mainly for solo
parser.add_argument(
"--rna_matrix_dir", help="Input folder to RNA expression matrix in 10x format."
)
# for solo.t... |
ffa4be60504c61775e599740a1acdd3e19ea2f5cd1d42ac1149e0faa0c76767e | Python | 3,592 | 155 | from datetime import (
UTC,
datetime,
)
import zoneinfo
import numpy as np
from pandas import Timestamp
from .tslib import _tzs
class TimestampConstruction:
def setup(self):
self.npdatetime64 = np.datetime64("2020-01-01 00:00:00")
self.dttime_unaware = datetime(2020, 1, 1, 0, 0, 0)
... |
40de6ac85cf78694c8733f5b8d4ac0c82b66ac12052385ee1d0e2862c1e19e34 | Python | 3,593 | 90 | # 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... |
135af0946f2cfe5c8d35529554700db68ae17579c000662b0dd281b93f38bdba | Python | 3,594 | 98 | """Tests for Zero Pad Operator class."""
import pytest
import torch
from mrpro.operators import ZeroPadOp
from mrpro.utils import RandomGenerator
from typing_extensions import Unpack
from tests import (
dotproduct_adjointness_test,
forward_mode_autodiff_of_linear_operator_test,
gradient_of_linear_operator... |
1b48a7c7e729a65c7a3ba127fd1f96b72b69661ee59526e26f34d91363ef5690 | Python | 3,594 | 64 | import argparse
import math
def setup_parser():
parser = argparse.ArgumentParser()
parser.add_argument('--seed', type=int, default=42, help='random seed')
parser.add_argument('--max_epochs', type=int, default=10, help='maximum number of epochs')
parser.add_argument('--M', type=str, default='dct', help=... |
2719462240ac80232c408dbe03019d131e9d46ed9f154eadccf54050304ddb4f | Python | 3,594 | 85 | # 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... |
de1100fa059bb02e069ca0462bebfa4271758f1373d862af8d8ae9862b60aeae | Python | 3,594 | 88 | """DNA-methylation clocks of cellular replication from the authors' releases."""
import torch
from ._base_models import pyagingModel
class CellDRIFT(pyagingModel):
"""CellDRIFT with its two PCA projections folded into the linear weights.
The original authors set supplied NaNs to zero. Entirely absent CpGs ... |
109774f6cdd65e4e7af7fc49f5a82261abad77394d032c2201a09b0461a4625e | Python | 3,595 | 93 | # 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... |
7938af6e95667e20b60b44b89c395ad9bb647642d1567f262af1336b8fb99fb4 | Python | 3,596 | 97 | #!/usr/bin/env python
import sys, os, re, math, argparse
from argparse import RawTextHelpFormatter
###################################################
### 0. script description and parsing arguments ###
###################################################
synopsis1 = "\
parse .tsv format results of 'mmseqs cluster' a... |
a2ee76deaf445d57480cadcc806fffb59489b024c07d785b65531f241283ff19 | Python | 3,597 | 81 | from dask import dataframe as dd, array as da
import pandas as pd, numpy as np, warnings
from .files import import_data, save_data
from .wavenet import matrix_G, normalize
from .plotting import plotting
from numba import njit
from tqdm import tqdm
@njit(cache=True, fastmath=True, nogil=True)
def generate_oscillatory(d... |
1a93722d00b367b88c60d853fc96b40cd4ad157ae4d21449ec1d7fa033558937 | Python | 3,598 | 112 | # Copyright (c) 2021-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... |
7d41c9d2b52338fe70dae8d755987bfd60d18a97de8eb0c79609e1786d211cbe | Python | 3,598 | 84 |
from ..utils import get_phenolist
from .. import conf
from ..file_utils import write_json, write_heterogenous_variantfile, get_filepath, get_pheno_filepath
import json
from pathlib import Path
from typing import Dict,Any,List,Iterator
# TODO: It'd be great if each peak also included a list of all the associations th... |
4352fb294ac4db6cc4c72195bd329c79326adff708b3443bf4fc458f5742771b | Python | 3,601 | 100 | #!/usr/bin/env python
# encoding: utf-8
from kcsd import sample_data_path
from kcsd.sKCSD_utils import LoadData
import os
import unittest
import numpy as np
try:
basestring
except NameError:
basestring = str
class testData(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.path = os.path... |
93943d58b74d4e7f9421dd608c12f3e5db65fbeb7761a5369c03cc8f8f85be9d | Python | 3,601 | 126 | import numpy as np
import pytest
from pandas._libs.tslibs import (
iNaT,
to_offset,
)
from pandas._libs.tslibs.dtypes import PeriodDtypeBase
from pandas._libs.tslibs.period import (
extract_ordinals,
get_period_field_arr,
period_asfreq,
period_ordinal,
)
import pandas._testing as tm
def get_... |
b33610801b6f7307d0b096699847a8d2c8d5241a28d92244f206f85c3fe5aa40 | Python | 3,603 | 106 | #!$HOME/.pyenv/shims/python
# coding: utf-8
import os
from pathlib import Path
if 'PYTHONPATH' not in os.environ:
print("Error: Run `source env.sh` to be able to run `/scripts/*.py`")
exit(1)
import ecgdigitize
from ecgdigitize import visualization
from ecgdigitize.image import BinaryImage, ColorImage, openI... |
d61c58cbfddc2e1c2360fadbee9d5579cb212dd38127339ff85cb5059e67ae82 | Python | 3,603 | 98 | import numpy as np
from importlib.metadata import version
from packaging.version import parse as parse_version
scipy_version = version("scipy")
if parse_version(scipy_version) >= parse_version("1.14.0"):
from scipy.integrate import cumulative_trapezoid as cumtrapz
else:
from scipy.integrate import cumtrapz
def... |
d25261e7c49dcd6a3ce5b6f252057e4755192dbfcf8101ea7490ea1f3dc9d0b5 | Python | 3,604 | 120 | import torch
import torchvision
from torch.utils.data import DataLoader
from torchvision import datasets
from torchvision import transforms,utils
from torch import nn, optim
import numpy as np
import torchvision.models as models
import skimage
from skimage import io,transform,util
from PIL impor... |
edf5b61b476127b71d56fcfb318eb1e136a938a7e7eb92f997c4e423b951d3f6 | Python | 3,606 | 112 | from tensorflow import keras
from tensorflow.keras import layers
import tensorflow as tf
from keras import utils
def conv2plus1d(x, filters, kernel_size, maxpool=True, padding='same'):
t = layers.Conv3D(filters, (kernel_size[0], 1, 1), padding=padding)(x)
t = layers.BatchNormalization()(t)
t = layers.Activ... |
3127843967b9c0b189d55a64eff1ee666fa357ceb60ebe9df14e1b1dbde0fc9a | Python | 3,608 | 104 | # 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... |
2f52fa7b132cb9afe3f5f357c3919db25a0201ce6521def8ab55901df702d6ce | Python | 3,614 | 187 | # 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... |
eca4d3d1a56a26b0f9145a052bb57248345b34427b8d009f2ebb6d4e7fb3ed16 | Python | 3,614 | 130 | __all__ = [
"SpectralLibraryBase",
"IndicesNonSlice",
"Indices",
"Columns",
]
import abc
import itertools
from typing import Generic, Iterable, List, Optional, TypeVar, Union
import numpy as np
import numpy.typing as npt
import pandas as pd
from .spec import MS2SpectrumProto
IndicesNonSlice = Union[... |
76b9b96da0c66c756c1d1f9c9c54f7676032d85532e0b95abad71e3d9025c0d3 | Python | 3,615 | 106 | from keras.preprocessing import sequence
import numpy as np
from sys import argv
def domain_id_map():
fr = open('../data/raw_data/domain_data/domain_id_mapping.txt')
entry = fr.readline().split('\n')[0]
domain_dic = {}
while entry != '':
value, key = entry.split('\t')
domain_dic[key] =... |
e6f073914e1de15093ff16b9cb4ad3278731db2d2b51e471a47df310d32eee30 | Python | 3,615 | 113 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
sys.path.append("/home/reisertm")
sys.path.append("/home/reisertm/nora/src/python")
import numpy as np
import tensorflow as tf
import math
from tensorflow.keras import Model
from tensorflow.keras import layers
from timeit import default_timer as timer
imp... |
aa3f4680cb0cd1d1bec71a6619ce610cd6f0104fabfb655c0453da3e67ab0270 | Python | 3,618 | 115 | #%%
import cluster4seed
import rsfc
import rsw
import numpy as np
import matplotlib.pyplot as plt
# %%
mask = np.load('demodata/mask.npy')
plt.imshow(mask)
plt.title("Brain mask")
plt.colorbar()
# %%
files = [['demodata/pv_p14_data_1.npy',
'demodata/pv_p14_data_2.npy'],
['demodata/pv_p28_data_1.npy... |
b812fff145ebe23386b2b3fc1ee10e0520ae2b6caa17a2f3095bc3b61beb20e4 | Python | 3,620 | 80 | '''
'''
import numpy as np
import pandas as pd
from ipywidgets import interact
import matplotlib.pyplot as plt
from .histogram import histogram
def get_slice_by_x_value(array, xmin, xmax, x):
step = (xmax-xmin) / float(array.shape[1] - 1)
nr = list(np.arange(xmin, xmax + step ,step))
#nr = nr.index(min(... |
3373d9d6f13ca3c5de75a4c67c1ec1b66421cea9ed4060acc0c884c445479d3c | Python | 3,623 | 91 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
class TestAstype:
def test_astype_float64_to_uint64(self):
# GH#45309 used to incorrectly return Index with int64 dtype
idx = pd.Index([0.0, 5.0, 10.0, 15.0, 20.0], dtype=np.float64)
result = idx.astype("u8"... |
5565cf36708ff03fed7a8b2404ca700f38d4e04f426f4156b291ca83f4204090 | Python | 3,624 | 94 | from base.surfaces import Surface
from base.pointSets import savelmk
import numpy as np
import scipy.linalg as la
import vtk
from base import diffeo
def compute():
fv0 = Surface(filename='/Users/younes/Development/Data/sculptris/shape1.obj')
fv0.updateVertices(10*(fv0.vertices-fv0.vertices.mean()))
J = np... |
671b828a12faf99c7cb4af7f1d779051504f0d7711dae87ed1693aeaa98fa42b | Python | 3,626 | 92 | from PyQt5 import QtWidgets, QtCore
import pyqtgraph as pg
from brainflow import BoardShim, DataFilter, DetrendOperations
from brainflow.board_shim import BrainFlowInputParams, BoardIds, LogLevels
import pandas as pd
import time
import sys
# ------------------- Graph Class with QThread ------------------- #
class Grap... |
0af234138cd9a6d3a522e72eb36c8dda6abee614d8fd60612155aef405b11388 | Python | 3,628 | 124 | # Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master... |
06243fd47813dfc89585c35e2808bfa44d17fe4c6c21842630f833f6ad821c1a | Python | 3,635 | 109 | from math import log
from indices.base import BaseComparisons
class ConsoniTodeschini4(BaseComparisons):
"""Class to calculate the Consoni-Todeschini 4 index.
n=2 formula:
log(1 + a)/log(1 + a + b + c)
Attributes
----------
fingerprints : np.ndarray
Numpy array with the fingerpri... |
67c5b41608aa7e2cb2e6489173533367e5303d6c09db120b1df01dc6d4044285 | Python | 3,635 | 114 | """
.. _segmentation:
====================================================
Segmentation of the Cortical Gradient
====================================================
Gradec provides two methods for splitting the gradient spectrum.
"""
# Download HCP S1200 principal gradient
from gradec.fetcher import _fetch_gradie... |
13846e34b18ebd7326a9b70724959f28fef1e95bf794922d076c8918c010defd | Python | 3,637 | 108 | #!/usr/bin/env python
"""
Test script to verify base64 encoding/decoding works correctly for rsync commands
with special characters in paths.
This script:
1. Creates a complex rsync command with spaces and special characters
2. Encodes it using base64
3. Writes it to a temporary file
4. Generates a shell script to dec... |
64c91d53fc6be968ca4db517b71ac92ce94506f5c1749a6bbef7bc756ee3ab5e | Python | 3,637 | 107 | from math import log
from indices.base import BaseComparisons
class ConsoniTodeschini2(BaseComparisons):
"""Class to calculate the Consoni-Todeschini 2 index.
n=2 formula:
(log(1 + p) - log(1 + b + c))/log(1 + p)
Attributes
----------
fingerprints : np.ndarray
Numpy array with th... |
aa5218861e9d66bbe031b9a0fe86eb0a580be608d2d842359dffd95eb9013e31 | Python | 3,640 | 111 | # emacs: -*- mode: python-mode; py-indent-offset: 4; tab-width: 4; indent-tabs-mode: nil -*-
# ex: set sts=4 ts=4 sw=4 et:
"""
.. _metas_cbma:
==============================
Coordinate-based meta-analysis
==============================
Perform CBMAs on a toy dataset.
Collection of NIDM-Results packs downloaded from... |
5642825b02e0d95eb98a1f313d2d2633a10a490c63cdba84e0f35b8d72debb6c | Python | 3,641 | 80 | # Synthetic 3d brain slices were cut into 70 patches.
from Environment import *
from Parameter import *
def single_cutting(files, index, save_path, cut_size, cut_index_x, cut_index_y, patch_weight_num, patch_hegiht_num):
image = sitk.ReadImage(files)
image_ROI = image[cut_index_x : cut_size*patch_weight_num +... |
eac05175d0f717b6a39198f0b0c203826b99d49dbb7a1dd234dae14dbd497bef | Python | 3,641 | 88 | """
.. _metas_macm:
============================================
Meta-analytic coactivation modeling analysis
============================================
Perform a MACM analysis with Neurosynth data.
Meta-analytic coactivation modeling (MACM) is a common coordinate-based
analysis in which task-independent "connect... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.