sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
b26da516706c0dbef28f29e158f2843ae00e7b6adafbfae8bed270ff7d7d9f96 | Python | 4,988 | 122 |
import numpy as np
import pandas as pd
import matplotlib.pylab as mpl
import matplotlib.patches as patches
from matplotlib import gridspec
import scipy
def plot_zscore_psth(data, xlims, bin_size, colors, labels = None):
mpl.close('all')
num_subplots = len(list(data.keys()))
fig = mpl.figure(figsize = (17... |
0bf32bd74d9a932402f75a582d906491f966c3cb38e276958dca07ac733a97c5 | Python | 4,990 | 156 | # Created by G. Peter Lepage (Cornell University) in 12/2013.
# Copyright (c) 2013-14 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
# an... |
0036f36df8d5ded5047580b9c4aee11485564818e4c3c41be41ccc823acd021c | Python | 4,992 | 132 | """`ClassificationExperiment` — the PyCaret 4.0 classification engine.
Canonical import:
from pycaret.tasks import ClassificationExperiment
# or (backward-compat):
from pycaret.classification import ClassificationExperiment
Example
-------
>>> from pycaret.datasets import get_data
>>> from pycaret.tasks... |
c132d612a64e01874634ac838b6712ac31bd5cdb181599354e0436fafa899c97 | Python | 4,992 | 106 | #todo: scores based on variable inpupt
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as LDA
from sklearn.metrics import roc_curve, roc_auc_score
import pandas as pd
def make_groups_equal_size(X,y):
X_true = X[y == 1]
... |
546fc3261060f89b8b991c75db9562c8b0515e79718f5e97ee1a50c1b9d30488 | Python | 4,994 | 155 | __all__ = ["GlycoPeptideMS2SpectrumAnnotator"]
from typing import Union
import numpy as np
import pandas as pd
from ....chem.gpep.glycans import GlycanNode
from ....chem.gpep.gpmass import (
GlycoPeptideMassCalculator,
GlycoPeptideMzAnnotation,
)
from ....chem.pep.mods import ModifiedSequence, modified_seque... |
84f046c3fbf4b07c6845a89ee88eb18461c74c2891f82873314929b406635291 | Python | 4,997 | 152 | #!/usr/bin/env python3
"""
Check that every dependency the test suite gates on is installed somewhere in CI.
``pytest.importorskip("foo")`` and ``td.skip_if_no("foo")`` silently skip when
``foo`` is missing. If ``foo`` is not installed in *any* environment that runs
the test suite, the tests behind that gate never ru... |
87a67037f38ea3b545a847bb622ca7c0c9852d9983e3943dcd00519a69bdcb09 | Python | 4,997 | 189 | # coding: utf-8
from atropos.util.colorspace import encode, decode
from atropos.commands import execute_cli
from .utils import run, datapath
# If there are any unknown characters in the test sequence,
# round tripping will only work if all characters after the
# first unknown character are also unknown:
# encode("TNGN... |
b501a54eb2c7cb3c3840471ba53ed41107661bfb6816f06bf89f9279f6d7f050 | Python | 5,002 | 177 | # encoding: utf-8
# JN 2014-12-27
"""
script to concatenate spikes from various h5 files
useful for interrupted recording sessions
"""
from __future__ import print_function, division, absolute_import
import os
import glob
from argparse import ArgumentParser
import tables
def get_h5_fnames(folders, cscrange=None):
... |
175faa36aaa4f85d063b712e18ccb044e06cafd31361aea9f411d57228297ce8 | Python | 5,005 | 132 | import argparse
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
import seaborn as sns
from tensorflow import keras
import os
from ast import literal_eval
from tensorflow.keras import layers
import logomaker as lm
from sklearn.model_selection import StratifiedKFold
import ... |
ad73c705421a9bdd26c069c54ba0610193d2e521ea40459ca307a17a6f5b3fbf | Python | 5,007 | 133 | import sys
import pandas as pd
import numpy as np
import numpy.linalg as la
from scipy import stats
from collections import Counter
def quantile_normalization(data):
'''
This function does quantile normalization to input data. After normalization, the samples (rows) in output
data follow the same distribut... |
40f1335729b9b7933bc013e05998dd1bcc5e12e1f745202707b4f61e34008075 | Python | 5,008 | 185 | #!/usr/bin/env python3
# JN 2015-02-18
# pylint: disable=E1101,star-args
"""
plot all clusters from a channel in one overview figure
"""
from __future__ import print_function, division, absolute_import
import logging
logger = logging.getLogger(__name__)
import os
import numpy as np
import matplotlib.pyplot as mp... |
94e99ba696638b01bf1d08e4495bc62373db2d844da16f484684bd7aecadc732 | Python | 5,008 | 131 | import operator
from treeshrink._vendor.dendropy import Tree
from copy import deepcopy
from treeshrink.Tree_extend import MPR_Tree, MV00_Tree,MVDF_Tree
def filter_branch(a_tree,root_method=None,unit_length=None,low_percentile=0,high_percentile=1,factor=1):
a_tree.deroot()
branch_list = list_branch(a_tree)
... |
e35442be12efef8869c84d83357581601b92c39864b55ed4fb68a4ba92774135 | Python | 5,008 | 136 | # 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... |
c81a49b21a4d1516ebd9cdb208b68f4255d0dcbc669c47281bb4690934398509 | Python | 5,012 | 125 | from sqlalchemy import create_engine
import pandas as pd
from contextlib import contextmanager
import numpy as np
class ExperimentDB(object):
def __init__(self, db_path):
self._db_path = db_path
@contextmanager
def db_connection(self):
db = create_engine(f'sqlite:///{self._db_path}'... |
5b09a9b0063700a698155f1744d063da42afe1c80aa7690ceeb5e0f1689ea333 | Python | 5,013 | 112 | """
.. module:: image_nifti
:platform: Linux, Windows
:synopsis: I/O utils for volume data in NIfTI format
.. moduleauthor:: Fredrik Nysjo
"""
import numpy as np
import struct
import gzip
def load_nii(filename):
"""Load volume stored in NIfTI format on disk. Currently only
supports single-file .nii a... |
e735171791c447d437638db5aec8b00cffc197a3ccb21f55a57af9ea5307b745 | Python | 5,015 | 101 |
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
from pathlib import Path
plt.rcdefaults()
from matplotlib.backends.backend_pgf import FigureCanvasPgf
matplotlib.backend_bases.register_backend('pdf', FigureCanvasPgf)
if __name__ == "__main__":
data_dir = '/Users/eghbalhoss... |
ea72f38574b46ff7b932b41c99161cc5a371b0138cb0aecaa61838b2f730d29f | Python | 5,018 | 125 | # 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... |
07db0c60cf054c8edd103dc2dd3f52de89027dbd0669331f51ff96e40be64a83 | Python | 5,019 | 125 | """Environment-driven configuration via pydantic-settings."""
from __future__ import annotations
from functools import lru_cache
from pathlib import Path
from pydantic import Field
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
"""Server configuration. Read from en... |
96dd29f19b9397fa8bb0803d5445725b7fbe68c44692ebdcc97391f5bf335f15 | Python | 5,022 | 116 | # -*- coding: utf-8 -*-
"""
Created on Thu Dec 16 11:30:51 2021
@author: admin
"""
import os
import glob
import numpy as np
import matplotlib.pyplot as plt
from skimage import io
from skimage.measure import block_reduce
from skimage.transform import PiecewiseAffineTransform, warp
from skimage.filters impo... |
55c8bc9951d3ebe62ce042feabaa268b43a4d096629813e07e97b6144045f53d | Python | 5,024 | 133 | #%%
import time
import math
import pickle
import argparse
import numpy as np
import pandas as pd
from pathlib import Path
import matplotlib.pyplot as plt
import seaborn as sns
from skrvm import RVR
import sklearn.gaussian_process as gp
from sklearn.model_selection import RepeatedStratifiedKFold
from julearn.model_sel... |
514a6b91567fa6e8062f986b6bd2338253d79ecc52b67b97e9b255d1e635f3fe | Python | 5,025 | 148 | import os
import pickle
import numpy as np
from tqdm import tqdm
import math
class TrainingProcess():
def __init__(self, config, dataStreaming) -> None:
self.personName = config.personName
# 默认保存在Operation里
self.fatherAdd = 'OperationSystem/ResultStored'
self.prep... |
c24699808f5b8824dc2dd907ae289441e4eb51ade916b35696cec30172f3221e | Python | 5,026 | 104 | """add llm provider settings and consultations
Revision ID: d582b350c276
Revises: 9f9b7c770df0
Create Date: 2026-04-24 16:28:59.660824+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... |
6acda1959952bfb8bc814b6064dcc7c4564d31415c2cd7b3bff527ec1028c697 | Python | 5,027 | 132 | # -------------------------------------------------------------------------------------------------------------------------------------
# Following code curated for GCPNet (https://github.com/BioinfoMachineLearning/GCPNet):
# ----------------------------------------------------------------------------------------------... |
a0058980fa888bfa40b98f7082df3d523c8fa8bb53f3a7fc8f2c257ceee2df65 | Python | 5,028 | 88 | """
Methods to query zenodo's REST API.
Separate datasets are uploaded for each normative model, with versions corresponding to the software used to process the data used for training.
This allows keeping track of the different models trained with different processing software versions, without having files all over th... |
a045be9c11971a620fe8515181fccd45d59b9fd7f4d2d896e4474fdf674baa6e | Python | 5,029 | 129 | import numpy as np
import pytest
import pandas.util._test_decorators as td
import pandas as pd
import pandas._testing as tm
class TestUpdate:
def test_update(self):
s = pd.Series([1.5, np.nan, 3.0, 4.0, np.nan])
s2 = pd.Series([np.nan, 3.5, np.nan, 5.0])
s.update(s2)
expected = ... |
e80de4a63634de06566d1c6bf058ebe190a14c0db0a207d5b79a986f6ed66b43 | Python | 5,030 | 149 | from __future__ import annotations
import numpy as np
import pytest
from pandas.core.dtypes.cast import find_common_type
from pandas.core.dtypes.dtypes import (
ArrowDtype,
)
import pandas as pd
import pandas._testing as tm
pa = pytest.importorskip("pyarrow")
def test_concat_timestamp_tz_aware_and_naive():
... |
a5350c5071231839ce84753f3edbf77b8aa09ad4c9c5498463de406154a046f7 | Python | 5,031 | 125 | # 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... |
30c8cb3c3a66df399546aa9269b51e19d05349cc2d132f7b93433dc637265714 | Python | 5,036 | 132 | 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... |
9250ad5d7e05beecac92a4da4ca69b0b5f19f40af9b0dfc78f7cfec7b64db6fe | Python | 5,036 | 100 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 21 23:41:22 2020
@author: Mehmood Ali Khan
"""
import os
import csv
import numpy as np
class DataReader:
def readData(self):
print('Initiated reading data files from the following path: \n'+
os.getcwd()+" "+... |
994e20b8a3181c5db30540973d1ea148c15333a5571b95d9e9ef027fc48fa656 | Python | 5,037 | 144 | from datetime import datetime
import numpy as np
import pytest
from pandas.errors import Pandas4Warning
import pandas as pd
import pandas._testing as tm
from pandas.tests.groupby import get_groupby_method_args
@pytest.mark.parametrize(
"obj",
[
tm.SubclassedDataFrame({"A": np.arange(0, 10)}),
... |
547b9da6b9eaac8563e0dabc3e023a74de7744039589d33539fbf6b1e7f2abeb | Python | 5,039 | 117 | # -*- coding: utf-8 -*-
"""
Created on Tue Jun 15 22:22:41 2021
@author: Wladek
"""
import numpy as np
import pylab as py
from scipy.signal import filtfilt, butter, detrend, argrelmax, argrelmin
from scipy.stats import pearsonr
from kcsd import oKCSD3D
from mayavi import mlab
from basicfunc import model_data, kaji_s... |
b32d906988ab7b1b2b2da0538eea3db94257a568ece28c6f2fc96462250b5d38 | Python | 5,039 | 149 | import pytest
from pandas.errors import Pandas4Warning
import pandas as pd
import pandas._testing as tm
from pandas.api.types import is_bool_dtype
@pytest.mark.parametrize(
"data, index, drop_labels, axis, expected_data, expected_index",
[
# Unique Index
([1, 2], ["one", "two"], ["two"], 0, ... |
d60bb83918cfaec10c550a98bbb2e44e8294216e44058c7ff4aaf2b5e31ed11d | Python | 5,039 | 141 | #!/usr/bin/env python3
import numpy as np
import pandas as pd
import time
import json
import os
import sys, getopt
import copy
import pickle
import tensorflow as tf
from tensorflow.keras.models import model_from_json
import jax
import jax.numpy as jnp
from diffrax import diffeqsolve, ODETerm, Euler, SaveAt
import ut... |
8868df680472ff120c4179928992a55c14f5be53a3575f85800357dffe5c71da | Python | 5,041 | 144 | # -*- coding: utf-8 -*-
"""
Created on Mon May 22 13:20:21 2023
@author: Jonas Hartmann @ Mayor lab @ UCL CDB
@descript: Simulation engine for simple_cell_sim.
"""
# Imports
import warnings
import numpy as np
from simple_cell_sim import force_funcs
def get_dists(pos):
"""Get pairwise Euclidean and vector... |
20065b1157ac7d25ef277172cc4145d0703d30bbb9d89c5f04ada723fd1f9189 | Python | 5,043 | 129 | import itertools
from math import isclose
try:
from math import comb # N choose K, requires python 3.8
except:
from scipy.special import comb
import numpy as np
def calc_naive_shapley_values(v: callable, N: int, players=None, verbose=False):
"""
Calculate the Shapley value for a value function v, gi... |
81377c3212d9876711b7952fc53641ef6f80bad55e445d3326a51ee9129b50c1 | Python | 5,043 | 114 | """Tests for RegularizedIterativeSENSEReconstruction."""
import pytest
import torch
from mrpro.algorithms.reconstruction import RegularizedIterativeSENSEReconstruction
from mrpro.data import CsmData, DcfData, KData
from mrpro.operators import DensityCompensationOp, FourierOp
def test_regularized_iterative_sense_auto... |
87a722eadebb5e6702bd3722701f5c1f26b1e52bab48ca635a496b9f6a72e200 | Python | 5,043 | 182 | from typing import Union
import glob
import numpy as np
kwarg_savefig = {
"facecolor": "white",
"dpi": 300,
"bbox_inches": "tight",
"pad_inches": 0.05,
"transparent": True,
}
eda_longitudinal_args = {
"split_by_days": True,
"set_labels": ("HGF+", "control"),
"dim_idx": 0,
"flip":... |
0774c90f9deca1bde54cc0e300db2dc3633e78803bdf036f1a37383a4e919a3e | Python | 5,046 | 132 | import numpy as np
import pumpprobe as pp
def dyson(h,time=None,omega=None,domain_in="omega",domain_out=None,
direction="direct",return_all=False,*args,**kwargs):
'''Solves the Dyson equation
$$ F_{ij} = f_{ij} + \\sum\\limits_{\\mu\\neq j} f_{i\\mu}*F_{\\mu j}$$
to either return F given f (dire... |
4cafe34197e79bc09b00bdcc8afce09ea0c8943d951b742ddb84be757bd02593 | Python | 5,048 | 114 | import argparse
import os
CURR_DIR = os.getcwd()
DATA_DIR = DIR = os.path.dirname(os.path.realpath(__file__))
# %%
files_list = ['0.5x0.5x2.0mm_R3x2_coil.h5',
'0.5x0.5x2.0mm_R3x2_coil_pat.h5',
'0.5x0.5x2.0mm_R3x2_JETS_slice_000_pat.h5',
'0.5x0.5x2.0mm_R3x2_kdat_slice_000.h5',... |
a906ba7e1ef26a504a3e64bb3d342e7199d519893bd04df087c9e7ff9e328077 | Python | 5,050 | 152 | """
This file contains a minimal set of tests for compliance with the extension
array interface test suite, and should contain no other tests.
The test suite for the full functionality of the array is located in
`pandas/tests/arrays/`.
The tests in this file are inherited from the BaseExtensionTests, and only
minimal ... |
4cdc91fae5e6ec9ffec14d022e921ff6287f6eaf29e5a06e52fe8eff8d7028af | Python | 5,051 | 183 | """
Utility functions and objects for implementing the interchange API.
"""
from __future__ import annotations
import typing
import numpy as np
from pandas._libs import lib
from pandas.core.dtypes.dtypes import (
ArrowDtype,
CategoricalDtype,
DatetimeTZDtype,
)
import pandas as pd
if typing.TYPE_CHEC... |
2d574d508eeba4fc6cfcfa9e9cca3d2b2437b731f29d011b3743834dab64c94b | Python | 5,052 | 163 | # -------------------------------------------------------------------------------------------------------------------------------------
# Following code curated for GCPNet (https://github.com/BioinfoMachineLearning/GCPNet):
# ----------------------------------------------------------------------------------------------... |
7605c7e2892fc07602fef4089024ff50e6b75b0e76f2e7f032573e3675fc496e | Python | 5,052 | 145 | import os, sys, re
ops = {
"Aa": 0,
"Ab": 0,
"Ma": 0,
"Mb": 0,
"Ca": 0,
"Cb": 0,
"E": 0,
"V": 0,
"Z": 0,
"EnoVnoHO": 0,
"EnoVhNoHO": 0,
"EnoVHO": 0,
"PredPos": 0,
"PredPosAOnly": 0
}
for i in {"", "g", "h"}:
for j in {"", "arg", "mod"}:
for k in {"",... |
547ad81a5a161ac5fad1db23b39df6d3b4b757441d03b61db95194d3702b9d62 | Python | 5,056 | 161 | from dipy.tracking.distances import bundles_distances_mdf
import read_write_bundle as bt
import numpy as np
from operator import itemgetter
import os
from subprocess import call
import argparse
from scipy.spatial.distance import cdist
import math
from joblib import Parallel, delayed
import multiprocessing
from collec... |
6e5ef7faf8096d29349c0ce0e531eb50a4c8f5ec0bab2d2e252b10293af42f05 | Python | 5,059 | 124 | """Radial phase encoding (RPE) trajectory class."""
import torch
from mrpro.data.KTrajectory import KTrajectory
from mrpro.data.traj_calculators.KTrajectoryCalculator import KTrajectoryCalculator
from mrpro.utils.reshape import unsqueeze_tensors_left
class KTrajectoryRpe(KTrajectoryCalculator):
"""Radial phase ... |
f0a7db6eb2f1becb05e9ebdbd987303f289acaa1a81c71f5a284aaaa5a401143 | Python | 5,059 | 150 | ######################
### Import Library ###
######################
# general library
import numpy as np
import pandas as pd
import seaborn as sns
import math
import matplotlib.pyplot as plt
from sklearn.decomposition import PCA
from sklearn.manifold import TSNE
# import umap
# import umap.plot
# rdkit
from rdkit.Che... |
1118f84d8ca9e4d4c16334c036b3bcf830cee81363ad8026b42dfb57124121fd | Python | 5,060 | 125 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
class TestCategoricalSort:
def test_argsort(self):
c = pd.Categorical([5, 3, 1, 4, 2], ordered=True)
expected = np.array([2, 4, 1, 3, 0])
tm.assert_numpy_array_equal(
c.argsort(ascending=True), ... |
59693950e6c4dbb95a5ebc866101316ee1102340cdceb9ca193ef80dbc42e4c1 | Python | 5,061 | 54 | """Clean scientific profiles; all explanatory titles remain in DOCX captions."""
from figure_style import *
C=pd.read_csv(RES/'cumulative_area_profiles.csv');R=pd.read_csv(RES/'outcome_specific_health_profiles.csv')
F=pd.read_csv(ROOT/'evidence/health_profile_functions.csv')
order=C[C.area!='Midlands Province'].sort_va... |
bb148db237dd202478502587d1f2ed2f704f9cf581138fdfdc2ca6335f42e06c | Python | 5,061 | 130 | # 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... |
bee99fdd4e979867bc7a03cb5343428836661840f4735f26cd04fe105faf604a | Python | 5,061 | 123 | """PCA Compression Operator."""
import einops
import torch
from einops import repeat
from mrpro.algorithms.varimax import varimax
from mrpro.operators.LinearOperator import LinearOperator
class PCACompressionOp(LinearOperator):
"""PCA based compression operator."""
def __init__(
self,
data:... |
49a0f4d4361fa58d7b4e589a6bd7ffad6301b7d0c1d74d73924ab76b8f1ecee7 | Python | 5,063 | 112 | """
.. module:: image_utils
:platform: Linux, Windows
:synopsis: I/O utils for image data (2D images and VTK volumes)
.. moduleauthor:: Fredrik Nysjo
"""
import numpy as np
import PilLite.Image
def create_dummy_volume():
"""Create an empty dummy volume (and header) in right format"""
volume = np.zeros... |
d2b2e1d88fc08e3da956271c2e6123747adea31bd2caab63e2c1d7272dd04b55 | Python | 5,066 | 169 | # JN 2017-04-07 adding scaling factor for matfiles
# JN 2020-03-06 Python3 compatibility
from __future__ import division, print_function, absolute_import
import logging
logger = logging.getLogger(__name__)
import os
from argparse import ArgumentParser, FileType
import tables
from .mp_extract import mp_extract
from ... |
e005b5a7ec4c353df2ac9fdb40aa022f73af2633336e46eb631f45ca4797dad5 | Python | 5,066 | 175 |
import os
from typing import Any, Callable
import pytest
from pcntoolkit.dataio.norm_data import NormData
from pcntoolkit.math_functions.basis_function import (
BsplineBasisFunction,
)
from pcntoolkit.normative_model import NormativeModel
from pcntoolkit.regression_model.blr import BLR
from test.fixtures.norm_da... |
16729321eeaac89160532230026ae1af3d320bae74ab5e70105d32580345a8e0 | Python | 5,067 | 175 | """
Missing data handling for arithmetic operations.
In particular, pandas conventions regarding division by zero differ
from numpy in the following ways:
1) np.array([-1, 0, 1], dtype=dtype1) // np.array([0, 0, 0], dtype=dtype2)
gives [nan, nan, nan] for most dtype combinations, and [0, 0, 0] for
th... |
dca5d338190f7ebea7c69585be65c754953bb20217cc4bb7dfe97af0a4a0200f | Python | 5,071 | 153 | """DockerManager — spawns one JupyterLab container per session.
Talks to the host Docker daemon via the ``docker`` CLI. Picks an
ephemeral port; passes ``--memory`` / ``--cpus`` for resource caps;
mounts the workspace's artifact dir into ``/data`` so notebooks read
the same files as the API process.
The image default... |
f6d11e9f74e006251b5a1a022cb0a9d34dec3314378aa563d06a458ed4ba95e9 | Python | 5,073 | 98 | import typer
import torch
import pkg_resources
from dotenv import load_dotenv, find_dotenv
load_dotenv(find_dotenv())
import pandas as pd
from typing import List, Tuple
from rxnfp.models import SmilesClassificationModel
from rxn_yields.data import generate_buchwald_hartwig_rxns
import sklearn
try:
import wandb
... |
1b9442b804993063ea53ec5edfb859ae702ae8e0a45b0abf73fcf3960d94058e | Python | 5,075 | 170 | #!/usr/bin/env python
'''
Testcases for the HDF5Dataset
'''
from windseer.data import HDF5Dataset
import windseer
import argparse
import copy
import numpy as np
import os
import random
import torch
import unittest
windseer_path = os.path.dirname(windseer.__file__)
testdata_folder = os.path.join(windseer_path, 'test'... |
480567b0e16af1f4413bb61cd8257a053e469fe5e02170c5e8ba1b76d37abe41 | Python | 5,076 | 123 | #!/usr/bin/env python3
################################################################################
# utils.py 1.0.1 #
# Authors: V. Laigle (Institut Curie) #
# Contact: myproms@curie.fr ... |
ea1f457938669c58c42e3e7f6929dd820760c414113ea783857c0a4c7a77aa95 | Python | 5,078 | 117 | # Prerequisite:
# conda install -c anaconda pillow
import argparse
import math
import numpy as np
from PIL import Image
import sys
def surface_value(args, r, d_sq):
result = 0
lo_sq = (r - args.thickness) * (r - args.thickness)
hi_sq = (r + args.thickness) * (r + args.thickness)
if (lo_s... |
57975b5bff9b8e8f2c2588a7ecd0e7e1c17b651c627a5f8da6af4db094a58426 | Python | 5,079 | 149 |
import numpy as np
import pytest
from pcntoolkit.dataio.norm_data import NormData
from pcntoolkit.normative_model import NormativeModel
from pcntoolkit.regression_model.blr import BLR
class TestNormativeModel:
"""Test normative model functionality."""
@pytest.fixture(autouse=True)
def setup(self, synth... |
15d003b971c7583e65e2a62ae7c795c837a2818a2c7ba43f3a49cf65a6676215 | Python | 5,081 | 134 | import pickle
import numpy as np
from sklearn.model_selection import KFold
import Load as Load
import Funciones
import Models
import Plot
import Processing
# Figures
Display = True
Save = True
# Define Parameters
# Standarization
Stims_preprocess = 'Normalize'
EEG_preprocess = 'Standarize'
# Stim... |
73e5084ea5c9775983cc46ffaf4243494040b2dfa4c102716e4e6d6801eafb0f | Python | 5,083 | 147 | import pandas as pd
import numpy as np
from numpy.random import default_rng
import os.path as op
import tensorflow as tf
from primary_match import auc_score, formal_or_names, print_delong_table, make_roc_plot
from sklearn.metrics import roc_auc_score, roc_curve
pheno_of_interest = "glauc_sec"
dataframe = pd.read_csv(f... |
bc0436e8fb7cf92d37eeaec43e8f80b228e91840c7cdc6e13a9889be227ad829 | Python | 5,083 | 166 | """
Orchestrate a Lightning Pose hyperparameter sweep on Lightning AI.
Run from within a Lightning AI studio:
python run_sweep.py [--config sweep_config.yaml] [--dry_run]
Run from outside Lightning AI (set LIGHTNING_API_KEY env var first):
LIGHTNING_API_KEY=<key> python run_sweep.py [--config sweep_config.yam... |
c18c5226bce9a4c3f83974c3b0fe79c7f5f14eb023d8281f57a675fc3a19b2a9 | Python | 5,084 | 123 | """Convert a DeepLabCut project directory into a Lightning Pose project directory."""
from __future__ import annotations
import logging
import shutil
from pathlib import Path
from typing import cast
import pandas as pd
from lightning_pose.utils.io import fix_empty_first_row
logger = logging.getLogger(__name__)
d... |
0896fc2cdb14c4fb176574075a45a28089ed06067d9a74df238e4baa9a771aa2 | Python | 5,085 | 167 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 13 19:04:15 2023
@author: tomas
"""
import glob
import pathlib
import multiprocessing as multi
import random
from skimage import filters, measure, util, morphology as morpho
from sklearn.ensemble import IsolationForest
from matplotlib import pyplo... |
5418942e047d1ce61b6a65aa4520a28c640f28d0053b9f9ae8da972494ee8783 | Python | 5,086 | 145 | # Copyright 2019 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... |
e3c1c360df7e1f096f32d1a1ccd8817e6b0934df62e06830c4c9f23033810f55 | Python | 5,087 | 170 | """
Tests for values coercion in setitem-like operations on DataFrame.
For the most part, these should be multi-column DataFrames, otherwise
we would share the tests with Series.
"""
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
class TestDataFrameSetitemCoercion:
@pytest.ma... |
aeb48953fb9af3b59638288e900eb52e280847518fe1639640d5788482633745 | Python | 5,089 | 132 | """Drift analyst — interprets a DriftReport and recommends an action.
6th / final copilot in SPEC § 12.2. Takes a ``DriftReport`` row (feature
drift scores + prediction drift + window + sample size) + the parent
``Deployment`` + the origin ``Pipeline`` snapshot, and produces a verdict
in the same spirit as the deploym... |
630f9f04ea0480f1e17772adeb01b18337a3f04e516568b001c818398fd0d8d5 | Python | 5,091 | 149 | # 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... |
fcfcadc6c7c3156de4b6399db342017d277a0f80a55320eb6a93af2f41d76cd7 | Python | 5,091 | 140 | import pandas
import datetime
from spycon import coninf
from spycon.spycon_tests import load_test
from spycon.spycon_inference import SpikeConnectivityInference
class ConnectivityBenchmark(object):
"""Benchmark object, that gets a list of datasets and methods, and tests each method on each dataset.
Args:
... |
b72bd1c73e13d62886b412ab180b26335514bf6255ae95ed9c17a0bc5ccf01b8 | Python | 5,093 | 133 | 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):
im = ax.... |
1e17437a93b872de6c0967403e32c2640fc2d0fb0ae809ba8c2c8fdb0ce07edc | Python | 5,094 | 171 | ## 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... |
1ebbdcdf3f667f4f448c1ac7665e1584d2a4aed611786482766cfb1ad943792f | Python | 5,099 | 166 | # Copyright 2018-2026 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or... |
80d17d625b8d1a2abeac3ed19b8993fde223a98fa708c320048360533e61fd74 | Python | 5,099 | 168 | """
Module containing utilities for NDFrame.sample() and .GroupBy.sample()
"""
from __future__ import annotations
from typing import TYPE_CHECKING
import numpy as np
from pandas._libs import lib
from pandas.core.dtypes.generic import (
ABCDataFrame,
ABCSeries,
)
if TYPE_CHECKING:
from pandas._typing i... |
78ba260941d22f6cfd8539a05dfa730eb30577aa56f745708269a9f63a9abb09 | Python | 5,101 | 156 | import os
import pandas as pd
from deepglyco.chem.common.elements import ElementCollection
from deepglyco.chem.gpep.fragments import GlycanFragmentTypeCollection
from deepglyco.chem.gpep.glycans import MonosaccharideCollection
from deepglyco.chem.gpep.gpmass import GlycoPeptideMassCalculator
from deepglyco.chem.pep.a... |
a1b4cb767fd750f9cf8a1ea3fe1f509b83f6f16b8f0aec8e0883b58d833333dc | Python | 5,104 | 144 | # 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... |
ff91fbdf405c6909802e515e05953d7e0918332324e429cd9cb4c86f52898b2f | Python | 5,106 | 123 | """
======================================================================
Compute SESAME inverse solution on evoked data with source constraints
======================================================================
In this example we shall apply SESAME on an evoked dataset,
corresponding to the response to an audito... |
6ca9aac9a5ae2969925ac9ab01179eddddf2da3ed456301a41884d8e95c283be | Python | 5,111 | 164 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
def test_unstack_preserves_object():
mi = pd.MultiIndex.from_product([["bar", "foo"], ["one", "two"]])
ser = pd.Series(np.arange(4.0), index=mi, dtype=object)
res1 = ser.unstack()
assert (res1.dtypes == object).all()
... |
74bcd95a5cd3637f62bb59a09caef0df8b76527741c99426e118e06916ab5a88 | Python | 5,111 | 158 | # -*- coding: utf-8 -*-
# Author: Gianvittorio Luria <luria@dima.unige.it>
#
# License: BSD (3-clause)
import numpy as np
import itertools as it
import scipy.spatial.distance as ssd
from ..utils import initialize_radius
def compute_mld(src, pmap_tot, true_pos):
"""Compute the Map Localization Discrepancy
P... |
9406c321ba7968ac68220a346e98dabb9a4157d06c1fdead616d298d0222e31a | Python | 5,111 | 173 | # 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... |
23151e177224a6116aa6d71a489f3b62d657971e0672d79cd5da8aaa93914973 | Python | 5,112 | 169 | #!/usr/bin/env python
import argparse
import torch
from torch.utils.data import DataLoader
from tqdm import tqdm
from MCMG_utils.data_structs import MolData, Vocabulary
from models.model_MCMG import transformer_RL
from torch.optim import Adam
from MCMG_utils.Optim import ScheduledOptim
from MCMG_utils.early_stop.pyto... |
2566466ba47decc711d623b314fb4b0394aff6c321573ccc566540ea36fb3e41 | Python | 5,112 | 222 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
def test_get():
# GH 6383
s = pd.Series(
np.array(
[
43,
48,
60,
48,
50,
51,
50,
... |
c1c843a3cf6c21e85f6c1532cfd597f60f8da275b022bfbb96d8969583faf93b | Python | 5,112 | 169 | # JN 2015-04-20 refactor
# JN 2016-09-06 introduce faster create_groups
"""
read a total sorting file and group the classes
"""
from __future__ import absolute_import, print_function, division
import logging
import tables
import numpy as np
from .. import SortingManager, options, CLID_UNMATCHED, GROUP_ART, GROUP_NOCL... |
f37222edd4eaea68f13b15af960e87886bb88a166204f8635e5afd021198abe9 | Python | 5,112 | 128 | from itertools import product
import pandas as pd
from fmriprep_denoise.visualization import degrees_of_freedom_loss, motion_metrics
from fmriprep_denoise.visualization import utils
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.collections import PatchCollection
strategy_order = list(utils.GRID_L... |
b4a5628903bc64ca8cfae014a469b07b313053aba93cba12b62b973b6ec9542f | Python | 5,116 | 137 | """FastAPI dependencies for authenticated routes.
Two authentication shapes are accepted by every protected route:
1. **Bearer JWT** — the primary path used by the web UI. Short-lived access
token in the ``Authorization: Bearer <jwt>`` header, with refresh rotation
via ``/auth/refresh``.
2. **API key** — progr... |
ed38fdcddeaa29b6c0cd81b0e07996f6dcd58ba5c47aae627d3f14f7b7b2fc65 | Python | 5,116 | 157 | #%%
from src.experiment import ExperimentBuilder
from src.analyzier import StatsAnalyzer
from src.plotter import Plotter
from src import plotting
from pathlib import Path
from sklearn.linear_model import BayesianRidge
import argparse
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import stats... |
729d8fd3fecbfcde562adca98da8b174b59bea65c9ac5e9e9ec2f8ee81b64446 | Python | 5,117 | 119 | #####################################################################################################################
# Date created : 10/21/2022
# Date modified: 10/21/2022
# Purpose : To generate Cb-Cb contact/distance map from PDB for a threshold
##############################################################... |
2cf391e8c69e8f7b7ce02f3c2b5c8b63e8ae2e93bb5388de7b1c02cb4dbc480b | Python | 5,118 | 172 | """
Tests for helper functions in the cython tslibs.offsets
"""
from datetime import datetime
import pytest
from pandas._libs.tslibs.ccalendar import (
get_firstbday,
get_lastbday,
)
import pandas._libs.tslibs.offsets as liboffsets
from pandas._libs.tslibs.offsets import roll_qtrday
import pandas as pd
@p... |
7b099f7c83edf80f80ff49f7bc0fcf2a34b27987547ddac3089eb36260d93839 | Python | 5,118 | 139 | """Test the function convert (and its helper _load_labels_for_video_dir)."""
from unittest.mock import patch
import pandas as pd
import pytest
from lightning_pose.converters.dlc import _load_labels_for_video_dir, convert
def _make_dlc_project(dlc_dir, video_dir_name='vid1', keypoints=('nose', 'tail')):
"""Buil... |
f3642de458569a9bf3ea8c721719790d795b91bed8263d0a4b24687681989b66 | Python | 5,122 | 137 | import argparse
import matplotlib.pyplot as plt
import numpy as np
import time
import torch
import windseer.utils as utils
import windseer.plotting as plotting
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description=
'Plot the measured wind during the flight in the same grid as th... |
7543abf2dde10f598fdaa57dce25f92f32a5ce511114a2fa81ad3bc3c1dff72c | Python | 5,123 | 156 | """
Sessions class for sorting sessions for guisort
"""
from __future__ import print_function, division, absolute_import
import logging
logger = logging.getLogger(__name__)
import numpy as np
from scipy.io import savemat
from .cluster import Cluster
from .group_list_model import GroupListModel
from .. import GROUP_ART... |
1d811014bb0ac08b58237bdaa9ce4e255cca4d63c0c77553917357fe9e09e0c9 | Python | 5,125 | 171 | # ThorLink
# Lloyd Russell 2017
# simple utilities to load Thor files into python
import os
import time
import numpy as np
import glob
import h5py
# import matplotlib
# matplotlib.use('TkAgg')
# import sys
# sys.path.append("tools")
# from tools import training
# try:
# # for Python2
# import T... |
74e80458aa033f53b813a8e9a55aac2f0a743af87002ee303c4b1785478600c0 | Python | 5,128 | 168 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
class DotSharedTests:
@pytest.fixture
def obj(self):
raise NotImplementedError
@pytest.fixture
def other(self) -> pd.DataFrame:
"""
other is a DataFrame that is indexed so that obj.dot(other) is... |
d0bf66ea64ca440e4cd8e0e2ed197a1aac0588bba7544733737882f2b46f8c90 | Python | 5,128 | 152 | import os
import numpy as np
from PIL import Image
from torch.utils import data
from src.network.utils import image_helpers
class_colors = {
"BG": [255, 255, 255],
"REF": [66, 146, 197],
"INS": [251, 246, 180],
"DEL": [253, 229, 217],
"INV": [127, 106, 187],
"DUP": [235, 150, 0],
"invDUP":... |
60571df8741d94a78ec69a7ceeb0b29deb62f247b9687fee7df9fbee8e4f4b39 | Python | 5,131 | 165 | import argparse
import pandas as pd
from pathlib import Path
from joblib import Parallel, delayed
from fmriprep_denoise.dataset.fmriprep import get_prepro_strategy
from fmriprep_denoise.features.derivatives import (
compute_connectome,
get_qc_criteria,
)
from fmriprep_denoise.features import qcfc, louvain_mo... |
ebb626a5bfd11a4c2e603ac6bc8fd9cd152d9443c38e3c4722b5dcde507c609d | Python | 5,131 | 124 | """
For a comparasion, we reachieved the CNN and MLP of Bo et al;
https://www.sciencedirect.com/science/article/pii/S096399692200031X#f0005
written by Yi He, May 2023
"""
import os
import pandas as pd
import numpy as np
from PIL import Image
import torch
from torch import nn
from torch.nn import functional as F
from ... |
be7dec203f76e6a377778f83e8b05a1bde76271acbb45024478502d4e2faed7b | Python | 5,132 | 148 | ''' delete_duplicate_neurons.py
Find searchable_neurons files in multiple partitions, and delete the duplicates
'''
import argparse
import json
import sys
import boto3
from tqdm import tqdm
import jrc_common.jrc_common as JRC
import neuronbridge_common.neuronbridge_common as NB
# pylint: disable=broad-exception-c... |
55f1db17742d0bd02ee583bc6319778ae5f2af865cb3dee90b146c8359f02468 | Python | 5,134 | 146 | #!/usr/bin/env python
"""Given rows from a parse job script, generates tables/figures for certain
performance metrics. Each output from the parse job script is expected to have
one header row and one metrics row. The first 5 columns are expected to be the
task profile information.
"""
import argparse
from common impo... |
67dabaea4e3040f73c8ff70722b1d4ca3c1a0a83433cbb4e12a9da5ee15cad95 | Python | 5,134 | 168 | import random
import time
from deepglyco.chem.common.elements import ElementCollection
from deepglyco.chem.pep.aminoacids import AminoAcidCollection
from deepglyco.chem.pep.fragments import PeptideFragmentTypeCollection
from deepglyco.chem.pep.losses import NeutralLossTypeCollection
from deepglyco.chem.pep.mods import... |
9d4d44536a62c85dff87f89122124a945ba2c9972fde205a1706f7aa007cd333 | Python | 5,136 | 90 | from Environment import *
from torch.utils.data import DataLoader
from tqdm import tqdm
from Network.dataset_whole_brain import Whole_brain_dataset
from Network.utils import test_each_brain
from Network.model.swin_transform import swin_tiny_patch4_window8_256, swin_base_patch4_window8_256
from Parameter import *
parse... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.