sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
4613085d468d54c1a3737ae1b036a1590e0c6afbc440376a5ea82af85e9fa70f | Python | 5,122 | 153 | import fnmatch
import os
import os.path
import random
import sys
from contextlib import contextmanager
from tempfile import NamedTemporaryFile
from typing import Any, BinaryIO, Generator, List, Union, cast
from pip._vendor.tenacity import retry, stop_after_delay, wait_fixed
from pip._internal.utils.compat import get_... |
7ae624c9f1ea05154fc72392aad1473ea9c6330c436ca1407c725a10c0a67cf3 | Python | 5,123 | 115 | '''
Average node properties at nodes using the simplicial structure
Author(s): Daniela Egas S.
Last update: 02.2024
'''
# General
import numpy as np
import pandas as pd
import pickle
from scipy import stats
# Connectomes and network analysis
import conntility
from connalysis.network import stats as nstats
# Specif... |
ad37a59b67e38a26fac2215b2f4e46c209e320a42604e40ec08922d8de6c07d3 | Python | 5,123 | 158 | # Node-group asset "Plexus" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHECKING
from b... |
f05aecac68047cae90c7c73394ee5a6ddd7f628bd4a8ea21c8151c0492ae6d62 | Python | 5,123 | 183 | """
Module for I/O related methods
"""
import hashlib
import logging
import os
import urllib
import ants
import h5py
import numpy as np
from bifrost.util import package_path
def write_affine(h5_handle, name, transform):
"""Write ANTs affine transform to h5
Args:
h5_handle: open file handle - h5py.Fi... |
73c87b8df2945c1f64b381bef14b21f129520f1b55e3c009d4f2ec82ff30f78c | Python | 5,124 | 131 | """Build a MERFISH cell-density template in Allen CCFv3 space (Zhuang whole-brain).
Unlike the other atlas downloads, MERFISH is per-cell data, not an image volume -
so there is nothing to download as a template directly. This BUILDS one: it fetches
the CCF-registered cell coordinates of the Zhuang lab whole-mouse... |
a3b60fc9ad5a1e78486a96126c10aaaf6aa63acf0ef8fc482c1fc3b3cc8a668a | Python | 5,124 | 170 | # -*- coding: utf-8 -*-
"""
Created on Fri Jun 4 14:23:45 2021
@author: Divyoj Singh
"""
## importing libraries:
import numpy as np
import matplotlib.pyplot as plt
import os
from numba import njit
from scipy.integrate import solve_ivp
import matplotlib.lines as mlines
from collections import OrderedDict
import seabo... |
fedf42c7bd2119520332898029a102edb46285981ed623cc8de80ed95fea76db | Python | 5,124 | 144 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
23cf1292a78434a5e4709c5ffc27ec262474cde7b974e1ac6686338abf5c4480 | Python | 5,125 | 144 | import numpy as np
from elasticai.creator.file_generation.savable import Path
from elasticai.creator.file_generation.template import (
InProjectTemplate,
module_to_package,
)
from elasticai.creator.nn.integer.ram.design import Ram
from elasticai.creator.vhdl.auto_wire_protocols.port_definitions import create_p... |
2468995b99f80a1879521da4d7dee3529aeec4cb901d6f79846fd86d7a5cd643 | Python | 5,125 | 141 | ##
# \file evaluate_slice_residual_similarity.py
# \brief Evaluate similarity to a reference of one or more images
#
# \author Michael Ebner (michael.ebner.14@ucl.ac.uk)
# \date Feb 2018
#
import os
import numpy as np
import pandas as pd
import SimpleITK as sitk
import pysitk.python_helper as ph
import... |
a5295896c21a19f8f6625641b90c3e7e44db38fc2d0386a409bccdd6cb8068dc | Python | 5,127 | 149 | # Parameters
import argparse
# Create an ArgumentParser object
parser = argparse.ArgumentParser(description='Logistic regression models for pseudobulk data')
# Add parameters to the parser
parser.add_argument('--inPath', type=str, help='Folder with the input data')
parser.add_argument('--resultsPath', type=str, help=... |
3e7624686ed56295b97c157d8092b487cf98ebfbf23a98978dcae877dfdf421e | Python | 5,128 | 88 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from downward import suites
from lab.reports import Attribute, gm
from common_setup import IssueConfig, IssueExperiment
try:
from relativescatter import RelativeScatterPlotReport
matplotlib = True
except ImportError:
print 'matplotlib not availabe, scatter pl... |
0bbf727a2c31016d78ae21b8c0fa7c9e87aace7c107ef192168f038a4e3123d5 | Python | 5,129 | 141 | from collections import defaultdict
from cv2 import imread
import numpy as np
class ReyFigure:
"""
Figure class with attributes:
- filename (*.jpeg)
- dict of Assessment instances for the figure
"""
def __init__(self, figure_id, filepath):
self.figure_id = figure_id
se... |
e3ee0493a7c3ffe11be5086071b9665669c9993f19284db07ffd33581a43c6bd | Python | 5,129 | 158 | # Node group ".MN_chi_atom_names" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# Shared by several assets, which import it; not an asset itself.
# _build_group() is the source of truth: the docstring, __init__ and accessors are regen... |
779550e6099d12155f36bb1ce0ac0ce4fa3397da82fa86842b808473b5c6660c | Python | 5,130 | 172 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
31d0bc684bf433730acae0d96f74226d9916514fdf1018f4d9f4324d1b685937 | Python | 5,132 | 139 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
aba4de113ef29ea4e1ed244fe098f006bba9f0ef165a17635cb6110d5d02adc2 | Python | 5,132 | 164 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
ce14d4a125b2a279e5b7315ac03a5c9fc42d26ac5c21be410f9ae21e5ff627f8 | Python | 5,132 | 115 | #! /usr/bin/env python
# ==============================================================================
# Copyright (c) 2020, Ko Sugawara
# 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. Re... |
0012ca10b3c98c42059ce17f54ed40dcd0843c9cb9aa0b2edc450df453376d88 | Python | 5,134 | 122 | # Node-group asset "Index Mix Vector" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHECK... |
89ca2c41171ccb88c978eb020d152ac7fe9523b4cf2ac1ad46e9984940bcb5b8 | Python | 5,135 | 74 | from typing import List
import torch.nn as nn
from .dann_like import _DANNLikeTrainer
class DANNTrainer(_DANNLikeTrainer):
r'''
The individual differences and nonstationary of EEG signals make it difficult for deep learning models trained on the training set of subjects to correctly classify test samples fr... |
80f2967ea9797a6d8b4ca4d9e243701e562cdb5274ab52f8087099a24cfa5e9b | Python | 5,136 | 146 | # Node-group asset "Sub Group Info" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHECKIN... |
ab4e0a896f391a3fd8cd0a7558400c2d783bd051876f6951aa93091efc5d7d26 | Python | 5,136 | 137 | #!/usr/bin/env python
# Copyright (c) 2015 Daniel Stonier
# Copyright (c) 2020 Intel Corporation
#
# License: BSD
# https://raw.githubusercontent.com/splintered-reality/py_trees/devel/LICENSE
"""
This module provides a backport from newer py_trees releases (> 1.0)
To use certain features also within ScenarioRunner,... |
ba34f8a8afa4c0580f296255f1cdaa710e2cf9cd4f420b4472c95b97fb7708a5 | Python | 5,137 | 162 | #
# MIT License
#
# Copyright (c) 2022 GT4SD team
#
# 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,... |
c4e5e4b0867ae622877c2fb96c7367d5f3a191ca77091aeb6f68676e4efe463b | Python | 5,137 | 141 | import torch
import torch.nn as nn
from elasticai.creator.nn.integer.design_creator_module import DesignCreatorModule
from elasticai.creator.nn.integer.hadamardproduct.design import (
HadamardProduct as HadamardProductDesign,
)
from elasticai.creator.nn.integer.math_operations.math_operations import MathOperations... |
953c498383bb9453764fd577846ca75069038669ea9f9c66fd5cbf6311229293 | Python | 5,138 | 121 | import warnings
from typing import Optional
import numpy as np
import torch
import torch.nn
from . import ArrayOrTensor, OptionalArrayOrTensor
from .base import BaseModel
class Pairwise(BaseModel):
def __init__(self, n: int, factors: OptionalArrayOrTensor = None, normalize: bool = False, device: str = 'gpu',
... |
c27a90d440a94077454f61bf27dade4a05a9c71ec77da9c92d7ade4191505982 | Python | 5,139 | 82 | """REAL_SCAN_OFFICIAL.py 2026-10-03. Pre-registration: 04-NOTES/PREREG-2026-10-03e-REAL-SCAN-OFFICIAL.md
REAL_SIGN_SCAN (29 Sept, rebuilt network, simulator before its 30 Sept correction) replicated on the antennal-lobe cut-out of
Shiu et al.'s own file with the corrected simulator: Seki et al. 2017 receptor input, lab... |
21caf6209d90b47eefbc007dbc2e56449f4a068683c896bb294b3c31cb913b3a | Python | 5,140 | 170 | import abc
import io
import itertools
import pathlib
from typing import Any, BinaryIO, Iterable, Iterator, NoReturn, Text, Optional
from ._compat import runtime_checkable, Protocol, StrPath
__all__ = ["ResourceReader", "Traversable", "TraversableResources"]
class ResourceReader(metaclass=abc.ABCMeta):
"""Abstr... |
4de87e3f9252ed80b57a29069bf584baecfa42b2c91c8abbc6bac4ae3afc32c1 | Python | 5,140 | 171 | # -*- coding: utf-8 -*-
"""
Created on Fri Jun 4 14:23:45 2021
@author: csb
"""
## importing libraries:
import numpy as np
import matplotlib.pyplot as plt
import os
from numba import njit
# import plotting
from scipy.integrate import solve_ivp
import matplotlib.lines as mlines
from collections import OrderedDict
im... |
87adf1127193bf574158588048a68b93b79694c13737b21a24384c339c73c4e0 | Python | 5,140 | 123 | import time
import os
os.environ["PATH"] = "path_to\\vips-dev-8.11\\bin" + ";" + os.environ["PATH"]
os.environ["PATH"] = "/path_to/openslide-win64-20171122/bin/" + ";" + os.environ["PATH"]
# os.environ["PATH"] = "E:\\Histology\\WSIs\\vips-dev-8.11\\bin" + ";" + os.environ["PATH"]
os.environ["PATH"] = "/path_to/f... |
a436b0f0de51ccdba27d9bae974c70cc4e9cb64eb38c7f92522560684331b7e2 | Python | 5,140 | 117 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 12 11:32:51 2018
@author: Carlos Atico Ariza, PhD
"""
# Creation of pandas DF with features for each image at botleneck
# imports the FeatureGen class found in the generate_features.py module
import os
from generate_features import FeatureGen
from p... |
a8235a0c3b995c7f2ae0068d24c12ea26f123caa5070778674f2cf579e5e7e45 | Python | 5,140 | 134 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import os
from scipy.special import softmax
import sys
net_name_mapping = {'Costanzo-2016.txt': 'GI Network', 'Hu-2007.txt':'COEX Network', 'Krogan-2006.txt': 'PPI Network'}
def parse_netscale_file(net_scale_file, noise):
with open(n... |
038bbc37799e9b982a849985a02a186f21dc3a021e52653ec6c2ea6c4b4197b3 | Python | 5,141 | 165 | """Plot decoding times."""
from __future__ import annotations
import csv
from enum import Enum
from pathlib import Path
from typing import Literal
import numpy as np
import pandas as pd
import pte_decode
import scipy.stats
from matplotlib import pyplot as plt
import motor_intention.plotting_settings
import motor_int... |
5d501aff2c3b05fd54639a5a3e872256794ab2d85fc76194093e8b860d2a2032 | Python | 5,141 | 129 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 4 15:49:53 2023
@author: emma
code for model training with reweighing bias mitigation -- must load datagenerator_3d_reweigh
"""
SEED=1
import os
os.environ['TF_DETERMINISTIC_OPS'] = '1'
import tensorflow as tf
tf.random.set_seed(SEED)
import ran... |
f202f34ced7cc012799ebae81c720b25237dd2b1d8a1638e79f8ba88a9ee3cc2 | Python | 5,141 | 176 | from nose.tools import *
from frozendict import frozendict
from pyccg.logic import Expression, Ontology, TypeSystem, Function
from pyccg.model import *
def _make_mock_ontology():
def fn_unique(xs):
true_xs = [x for x, matches in xs.items() if matches]
assert len(true_xs) == 1
return true_xs[0]
type... |
2ae7e8a53a14254894caa7c87beb48596ec056481cf01d8e7d17421e11d0a3fd | Python | 5,143 | 134 | #
# MIT License
#
# Copyright (c) 2022 GT4SD team
#
# 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,... |
5617c8330ea8e9624f099b85dadbb25c8a419d702bcef24d539a700cde903172 | Python | 5,145 | 181 | from pathlib import Path
from types import SimpleNamespace
import numpy as np
import openmm
import pytest
from calvados import sim
from calvados.cfg import Components, Config
TEST_DATA = Path(__file__).parent / "data"
def test_maps_custom_restraints_across_multiple_components() -> None:
simulation = sim.Sim.__... |
a07d96677afa2f3bd3dc491ed2586e760362bd6594d5256b5ee299d5fef2d875 | Python | 5,146 | 203 | """
===========================
Source data set to EEG BIDS
===========================
Put EEG data into a BIDS-compliant directory structure.
Authors: José C. García Alanis <alanis.jcg@gmail.com>
License: BSD (3-clause)
"""
# %%
# imports
import sys
import os
from pathlib import Path
import pandas as pd
from mn... |
7331a26cbfb8a0fa1fc75a424adfe1ae8ccd6c794e3eba86bfa9bed1dfa24dda | Python | 5,148 | 188 | import contextlib
import re
from dataclasses import dataclass
from typing import Dict, Iterator, NoReturn, Optional, Tuple, Union
from .specifiers import Specifier
@dataclass
class Token:
name: str
text: str
position: int
class ParserSyntaxError(Exception):
"""The provided source text could not be ... |
31e640eddc2d978279d1ea7ce4c1c78f19fc861c5f219dbee0491ee7bf2de201 | Python | 5,149 | 123 | """
Created on Thu Apr 28 18:03:07 2022
@author: Haotian Teng
"""
import torch
import itertools
import numpy as np
import timeit
def sparse_multiplication(transition,log_alpha):
idxs = transition.indices()
vals = transition.values().log()
update_check = torch.zeros((batch_size,n_kmers),dtype = torch.bool)... |
361fa81a751d1bad94f1918d6f2ded9b0b70e8cdb9bcf77deac18d2c9c017ca3 | Python | 5,149 | 142 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
7c67a8d6d0b0b8fb9f2fee79bfd9fb765ed3859abecd9de28c49a6d1ade95806 | Python | 5,149 | 174 | # -*- coding: utf-8 -*-
"""
Created on Sat Aug 22 16:11:11 2020
@author: au571303
"""
from random import shuffle
from psychopy import prefs
prefs.hardware['audioLib'] = ['sounddevice']
#prefs.hardware['audioLib'] = ['pyo']
from psychopy import visual, core, sound, event, gui, logging
import os
import numpy as np
from ... |
f57e121945ebd3b97ae758f4344197127533b15f6bde5e5d20f3d005c7859b51 | Python | 5,149 | 164 | import os
from os import listdir
from os.path import isfile, join
import pandas as pd
import librosa
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
import numpy as np
from sklearn.model_selection import train_test_split
from timeit import default_timer as timer
from sklearn.metrics import cla... |
7d0bdd221c685e74ad8c128e16089c0f034df701d1c59356062272d775b8e8fe | Python | 5,151 | 161 | """Plot decoding performance."""
from __future__ import annotations
import csv
from enum import Enum
from pathlib import Path
from typing import Literal
import numpy as np
import pandas as pd
import pte_decode
import scipy.stats
import motor_intention.plotting_settings
import motor_intention.project_constants as con... |
6383d3c1b27de814b235bf1cef9a50104e2f2845aa6d373d2dc85a84867e44a1 | Python | 5,152 | 136 | """Batch-2D napari button: column present, disabled until success, launches subprocess."""
import pytest
@pytest.fixture(scope="module")
def _qapp():
try:
from PySide6.QtWidgets import QApplication
except Exception as exc: # pragma: no cover
pytest.skip(f"PySide6 unavailable: {exc}... |
76fcf42c0a0f5b31c0ac16c6abc3252b0d3776ed02f2c865e13920711292f151 | Python | 5,152 | 134 | import os
import torch
import pandas as pd
import numpy as np
from sklearn.metrics import accuracy_score, recall_score, precision_score, matthews_corrcoef, roc_auc_score, f1_score
from torch.utils.data import DataLoader
from utils import set_seed, create_predict_dataset
from model import RNASeqClassifier
import RNA
imp... |
c3ece7a1ed0186612b823268c2fdad0c5c31c8ffd27062956f43133871a27656 | Python | 5,152 | 103 | import contextlib
import copy
import io
import os
import shutil
import tempfile
import unittest
from hed import load_schema, load_schema_version
from hed.errors import HedFileError
from hed.schema import HedKey
from hed.scripts.add_hed_ids import main
from hed.scripts.schema_script_util import get_prerelease_path
SCH... |
ca530b47760e17ec88ef9b5b7f94523781c6b2018d1f001f3795d15c3cdbb117 | Python | 5,152 | 118 | import random
from ..utils import get_ik_limits, compute_forward_kinematics, compute_inverse_kinematics, select_solution, \
USE_ALL, USE_CURRENT
from ...pr2_utils import PR2_TOOL_FRAMES, get_torso_arm_joints, get_gripper_link, get_arm_joints
from ...utils import multiply, get_link_pose, link_from_name, get_joint_p... |
f1b30cf12713256fcd8966c763dc795708e547b294229e6b4416504e2f8f96ea | Python | 5,152 | 135 | import os
import csv
import glob
import torch
from torch.utils import data as torch_data
from torchdrug import data, utils
from torchdrug.core import Registry as R
@R.register("datasets.EnzymeCommission")
@utils.copy_args(data.ProteinDataset.load_pdbs)
class EnzymeCommission(data.ProteinDataset):
"""
A set ... |
5d9c1416941950444f1b14d1a2330c7ee14436ac7604902613059e3f2fc060a5 | Python | 5,154 | 161 | import pickle
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
for cancerType in ["Bladder","Kidney","Prostate"]:
for cancerType2 in [cancerType]:
pickleFile = "/home/fruitdragon/workspace/NeuralClassifier/old/data/MIXED/"+cancerType+"_Tree10.pkl"
if(can... |
d114fa0f69373b2a7530c5a065934552785a7e3294d5ac7a662037a7c5874992 | Python | 5,155 | 127 | from typing import Dict, Tuple, Union
from scipy.signal import hilbert
import numpy as np
from ..base_transform import EEGTransform
class CorrelationTransform(EEGTransform):
def __init__(self, apply_to_baseline: bool = False):
super(CorrelationTransform,
self).__init__(apply_to_baseline=a... |
7ab26106a468b468a72065a24228b87e39880db4dae4aca6692c9918ba57e5ca | Python | 5,156 | 125 | import torch
import torch.nn as nn
import copy
from .so3 import SO3_Embedding
from .radial_function import RadialFunction
class EdgeDegreeEmbedding(torch.nn.Module):
"""
Args:
sphere_channels (int): Number of spherical channels
lmax_list (list:int): List of degrees ... |
ae25c03ccb569c4b8a157d5638d9d7f71400172b0172b4ce9bfe04a3f5737367 | Python | 5,157 | 57 | """FIG_CRASH_TEST.py 2026-10-02. Report figure F14 (crash test): (a) single sign errors ranked by the first-order theory
against the damage each one does (rate theory, sealed table); (b) spiking model: healthy glomeruli after single errors;
(c) every attack (21 of BREAK_IT, 20 fresh) breaks no later than the step at ... |
1b4add3aefc45df6f80be5899c2af31d7bd7c0207cd68e7e456e26d13537f21b | Python | 5,158 | 181 | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as colors
from burst_space import BurstSpace
from help_funcs import load_exp_variables
# ----- #
# Hyperparameters.
metric = "rocauc"
if metric == "rocauc":
metric_str = "score"
elif metric == "accuracy":
metric_str = metric
band = ... |
59049fd7903be5f2bbc23e347df27546e105096a6eb231ed882b9f175f867644 | Python | 5,158 | 149 | #! /usr/bin/env python
"""
shuffle rows of a big file, rewrite to a new file
"""
import argparse
import os
import gc
import numpy as np
def str2bool(v):
# susendberg's function
return v.lower() in ("yes", "true", "t", "1")
def count_line_num(sl_filepath, fheader=True):
count = 0
wit... |
ce952fbe03582725e48b1c692aaad8807bad0ec32b8bf47e377872ed3381b235 | Python | 5,159 | 153 | from __future__ import annotations
import itertools
import os
from collections.abc import Iterable
from ..wheelfile import WheelFile
from .pack import read_tags, set_build_number
def _compute_tags(original_tags: Iterable[str], new_tags: str | None) -> set[str]:
"""Add or replace tags. Supports dot-separated tag... |
f90d44423edbe6695e4c52318ebdd9d97c1b549c78683d2110da938b1450b518 | Python | 5,159 | 109 | from typing import Any, Callable, List, Optional, Tuple
import numpy as np
import pandas as pd
from torch.utils.data import Dataset
from .base_dataset import BaseDataset
class PairDataset(Dataset):
r'''
A dataset class for pairing multiple datasets. This class combines multiple datasets based on a specified... |
9b20e4afb92287a08d543f7fd31027f8469865a65fd31a90a03f39d65f099ff8 | Python | 5,160 | 123 | from src import settings
import src.data.handler as data_handler
import os
import numpy as np
import albumentations as A
import albumentations.pytorch as APT
import cv2
from sklearn.preprocessing import StandardScaler
import glob
# TRANSFORMATIONS
def get_train_transform():
return A.Compose(
[
... |
e599164fd40a7c20a57c1db80aa5329897a8b7e77d26ecfcebdd9f3876592fe4 | Python | 5,160 | 155 | import copy
import unittest
import logging
import numpy as np
import pytest
from neurolib.models.aln import ALNModel
from neurolib.models.fhn import FHNModel
from neurolib.models.hopf import HopfModel
from neurolib.models.thalamus import ThalamicMassModel
from neurolib.models.wc import WCModel
from neurolib.models.ww ... |
077a25b6656cf5a6345db0d81edcba03fb5370e8968c0e6d34f05d1fccaf9a27 | Python | 5,162 | 130 | # coding=utf-8
# Copyright 2020 The Trax Authors and The HuggingFace Inc. team.
#
# 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 r... |
5615e1c0696d5b91d2a2d448729b319b0e3078c6cbdf34cd93c795d24ab84de1 | Python | 5,162 | 122 | import os
import os.path as op
import pandas as pd
import numpy as np
import nibabel as nib
import requests
from connectivity.macm import macm_workflow
from connectivity.macm import macm
from connectivity.rsfc import rs_workflow
from glob import glob
from ibma import fishers_workflow
def niconn_workflow(mask_img=None... |
70412f54358a79647bde974d101efd556a8c5b71a14b739a75dfdf322b535f42 | Python | 5,162 | 137 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Figure 2 of paper Functional subnetworks
@author: felipe
"""
import sys
import os
sys.path.append(os.path.abspath('../../'))
import analysis.frequency as frequency
import analysis.synchronization as synchronization
import numpy as np
import scipy.io as sio
import sci... |
996384f82ba4d9f111c4b4c8c0ddedc1a4c603c51e742e2783c01104bb2f2768 | Python | 5,164 | 182 | import random
import torch
import torchvision
import torchvision.transforms as transforms
import time
import tvm
from tvm import relay, transform, runtime
from tvm.contrib import graph_runtime
from PIL import Image
import numpy as np
batch_size = 256
num_workers = 4
cifar_train = torchvision.datasets.CIFAR10(
r... |
d4ae8b04eacdbfd38760ba541eaf12743c04585e2cd4320a3c0fd8fb4e4bb33f | Python | 5,165 | 132 | # -*- coding: utf-8 -*-
"""ASE calcualtor for to use with PiNN"""
import numpy as np
import tensorflow as tf
from ase.calculators.calculator import Calculator
from pinn.models.base import (
dtype_from_params, set_infer_dtype, tf_dtype_from_name,
)
class PiNN_calc(Calculator):
def __init__(self, model=None, a... |
efed3cd1bc72ef254a4b9f83558838ad16bebcc26a0a92406d953007b03bc1a5 | Python | 5,165 | 126 | #%%
import torch.nn as nn
from types import SimpleNamespace
import tltorch
# from coral_pytorch.layers import CoralLayer
# from src.models.components.resnetblock import ResNetBlock
from resnetblock import ResNetBlock
# from src.models.components.preactresnetblock import PreActResNetBlock
from preactresnetblock ... |
7863fbee8bcf320906c7f27ab82480036dc089d2d42e73eceec2dd5f3f8a5945 | Python | 5,166 | 204 | import os
import numpy as np
import scipy.sparse as sp_sparse
from click.testing import CliRunner
from scbs.cli import cli
from scbs.prepare import (
_get_cell_names,
_human_to_computer,
_iter_chunks,
_load_csr_from_coo,
)
def test_prepare_cli(tmp_path):
runner = CliRunner()
p = os.path.join... |
fb24c0eb2791221dcccfd8ed553115bf05dec479c3cf8d71a531941bbb96abf2 | Python | 5,166 | 116 | """
CROSS_DATASET_AMBIGUITY.py - written 2026-09-17.
THE SIMPLEST DECISIVE TEST IN THE WHOLE PROJECT, AND IT NEEDS NO NULL MODEL.
If the classifier's hesitation on a cell type is a property of the PICTURES - section
quality, staining, local density, proofreading - then it belongs to the dataset, and two
differe... |
b7c4a65bc56670b20e5b213de831aae4a401fba0ca4565cd322ec9a4aa7a237a | Python | 5,167 | 153 | try:
from Tkinter import Tk, Canvas, Toplevel, LAST
#import TKinter as tk
except ModuleNotFoundError:
from tkinter import Tk, Canvas, Toplevel, LAST
#import tkinter as tk
import numpy as np
from collections import namedtuple
from ..utils import get_pairs, get_delta, INF
Box = namedtuple('Box', ['low... |
20dac9cf68d028e3bd01ab8274c2ddc6ab574a584ebb4e37d705ae3ba9edcf06 | Python | 5,168 | 173 |
# colour conversion stuff ported from:
# https://github.com/boxerab/dcmtk/blob/master/dcmiod/libsrc/cielabutil.cc
# Initialize white points of D65 light point (CIELab standard white point)
D65_WHITEPOINT_X = 0.950456
D65_WHITEPOINT_Y = 1.0
D65_WHITEPOINT_Z = 1.088754
nice_colours_rgb = [(0, 0, 0),
... |
93167b6f0fd9879aa138333f5182920168293bf63af93255f63a384c0d9f2507 | Python | 5,168 | 141 | """
Script for applying Random Walk with Restart to a SynGraphMCF
Input: - List of paths to SynGraphMCF pickles
- Path to XML file with sources groups
Output: - SynGraphMCF with RWR properties added
"""
###### Global variables
import pyseg as ps
__author__ = 'Antonio Martinez-Sanchez'
##... |
f6b73dec0f83e989e03e22e492fdba138902675f98c974e7f2604a372ad0aca6 | Python | 5,168 | 123 | import argparse
import getpass
from pathlib import Path
import pandas as pd
from tqdm import tqdm
from wsilearn.wsi.wsd_image import ImageReader
from wsilearn.utils.cool_utils import can_open_file, ensure_dir_exists, write_yaml_dict
from wsilearn.utils.df_utils import print_df, df_save
from wsilearn.utils.files_utils... |
a30ba3a1be1d938e528b2e0462d6c2291eb0705a61ec4d386bfbff3ae01a7010 | Python | 5,169 | 182 | # __
# /__) _ _ _ _ _/ _
# / ( (- (/ (/ (- _) / _)
# /
"""
Requests HTTP Library
~~~~~~~~~~~~~~~~~~~~~
Requests is an HTTP library, written in Python, for human beings.
Basic GET usage:
>>> import requests
>>> r = requests.get('https://www.python.org')
>>> r.status_code
200
>... |
cf46158beaf739df80715995c1879575f442049f9f6b1fabd2f094f572b9ac13 | Python | 5,170 | 102 | import scanpy as sc
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
from pca import pca
import warnings
warnings.filterwarnings('ignore')
from sklearn.preprocessing import LabelEncoder
from utlis import softmax, reduce_dimensions, cal_ratio
from sklearn.metrics.pai... |
175f30a48668317efe44990dc56403ce11f485126f83b3b0c71c547e1bfd034f | Python | 5,171 | 137 | from elasticai.creator.file_generation.savable import Path
from elasticai.creator.file_generation.template import (
InProjectTemplate,
module_to_package,
)
from elasticai.creator.nn.integer.ram.design import Ram
from elasticai.creator.vhdl.auto_wire_protocols.port_definitions import create_port
from elasticai.c... |
e1123d6a747cf729707b2b56f56fb8c49b0ad6c0a3599fb249cd8f25ad0502cb | Python | 5,171 | 139 | # coding=utf-8
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless re... |
665da544da999a33807d20b317fafc0a47a4549d7ee42758f2a14801315e15af | Python | 5,172 | 178 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
f78a241c848e39824472930bc87dd7b09de1ef0e22c9567acc23a4653dc68140 | Python | 5,173 | 131 | """
Correct PU with real damages (3 classes: Healthy / Outer ring / Inner ring)
"""
import os
import pandas as pd
from scipy.io import loadmat
from sklearn.model_selection import train_test_split
from datasets.SequenceDatasets import dataset
from datasets.sequence_aug import *
from tqdm import tqdm
signa... |
a5e655b40b5e299b4f5b2f6c7e4b3a4470cef1d7d2c3c4dbcf4aab5754641572 | Python | 5,175 | 165 | import click
import h5py
import numpy as np
import os
##########
# inputs #
##########
@click.command()
@click.option('--satmut',
'satmut_file',
required=True,
type=click.Path(exists=True, readable=True),
help='satmut file in TSV format')
@click.option('--start... |
ee47e474e2431762c338313cb3f3c2e1b30090ad454eab48e9ee4784c76fca45 | Python | 5,175 | 124 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import os
import pickle as pkl
import numpy as np
from DiscRisk_constants import dir_NHANES_dataset, dir_merged_datasets, year_slot_names, data_collections_names
# directory for the merged csv files
dir_merged_... |
20c346e725820f604d0b0b0071e5d9b7e4c8616963796b058328de01e891783a | Python | 5,176 | 120 | import argparse
from matplotlib import pyplot as plt
import pandas as pd
import pytorch_lightning as L
import seaborn as sns
import sys
from statsmodels.stats.descriptivestats import sign_test
# local imports
sys.path.append("..")
from shapelearningtheory.datasets import make_dataset
from helpers import format_table, t... |
98fbf1a9114cad7ab1026d6ac1cb550b0ce0545147bfb644e004169b5740563e | Python | 5,177 | 127 | from unittest import TestCase
from pyseg.globals import *
from pyseg.graph import SkelGraph
import vtk
import numpy as np
__author__ = 'martinez'
class TestSkelGraph(TestCase):
def test_Class(self):
# Reading the DISPERSE skeleton
print('Loading skeleton...')
reader = vtk.vtkXMLPolyData... |
0c1e01d838e52e9b7273e778825cf603204299695f337ccbc9149601dfa521fa | Python | 5,178 | 223 | """Utility functions for dealing with Atoms."""
from __future__ import annotations
from copy import deepcopy
from hashlib import md5
from logging import getLogger
from typing import TYPE_CHECKING
import numpy as np
from ase.filters import Filter
from ase.io.jsonio import encode
from pymatgen.io.ase import AseAtomsAd... |
2bcc6d3787040c3ca509b23cb163dc6184158aac15347093195c5f10f056e295 | Python | 5,181 | 130 | import os
import os.path as op
import numpy as np
import mne
import matplotlib.pyplot as plt
from params import PLOT_DIR as plot_dir
from params import BIDS_ROOT as bids_root
from params import TEMPLATE as template
from params import SUBJECTS as subjects
from utils import load_raw, bipolar_reference, load_df, reject... |
d230434d54ea36b276af0ab030f229948517edb42235ff470c133b3d764d5db3 | Python | 5,181 | 177 | #!/usr/bin/python
# Gogulan Karunanithy, UCL, 2021
# Code for performing 3D decoupling of HNCA and HN(CO)CA spectra using FID-Net
import copy
import os
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3"
import nmrglue as ng
import numpy as np
import tensorflow as tf
from tensorflow import keras
def build_model(num_blocks=... |
c466fa3585aa74f677dafbb8b022ed8c6891d32951b931c6908fc7faebbded0d | Python | 5,183 | 90 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
import suites
from lab.reports import Attribute, gm
from common_setup import IssueConfig, IssueExperiment
try:
from relativescatter import RelativeScatterPlotReport
matplotlib = True
except ImportError:
print 'matplotlib not availabe, scatter plots ... |
05915f0c1845b6a3efeaade712bb0869f558093d5d439738cb1880c836a73404 | Python | 5,184 | 107 | import numpy as np
import numba
def simulateBOLD(Z, dt, voxelCounts=None, X=None, F=None, Q=None, V=None):
"""Simulate BOLD activity using the Balloon-Windkessel model.
See Friston 2000, Friston 2003 and Deco 2013 for reference on how the BOLD signal is simulated.
The returned BOLD signal should be downsa... |
14343af1b7042eb9beefc30a2ab990446b9b6ddf04e1d2945c91abc901603619 | Python | 5,184 | 147 | """Each encoder should have following attributes and methods and be inherited from `_base.EncoderMixin`
Attributes:
_out_channels (list of int): specify number of channels for each encoder feature tensor
_depth (int): specify number of stages in decoder (in other words number of downsampling operations)
_... |
c884e310caade1bbdd221524cbe1a50680d8310f1f36c827a23751c610cdfe48 | Python | 5,185 | 165 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
22cd030de6cb9f76bb59329ce29de16bcad109dfbc3585b9f18e9756480f6f50 | Python | 5,186 | 162 | """
https://github.com/MIPT-Oulu/Collagen/blob/master/collagen/modelzoo/segmentation/decoders/_fpn.py
"""
import torch
import torch.nn.functional as F
from torch import nn
from model_utils.modules import Module
from model_utils.modules import ConvBlock
class FPNBlock(Module):
"""
Extended implementation fro... |
cbd72759823b84050383fe0204569e65e1a7ef94cba070a09be50e7d1a0ff89d | Python | 5,186 | 144 | """Tests for validate_hed_string script."""
import io
import os
import unittest
from unittest.mock import patch
from hed.scripts.validate_hed_string import main
class TestValidateHedString(unittest.TestCase):
"""Test validate_hed_string script functionality."""
def test_valid_string(self):
"""Test ... |
186c7aa8a26ac0a8b2a55dd9368afc6b50c7969d38e1c31a6b9edd720827b4de | Python | 5,188 | 130 | from __future__ import annotations
import re
from typing import Any
from wikibaseintegrator.entities.baseentity import BaseEntity, TermsEntity
from wikibaseintegrator.models import Claims
from wikibaseintegrator.models.aliases import Aliases
from wikibaseintegrator.models.descriptions import Descriptions
from wikibas... |
30798fe260d27d19dc8ea5e24833b3edc8b1018aed0a9d994c23a135ed3ed721 | Python | 5,189 | 128 | """Utilities supporting the validation of HED strings."""
from hed.errors.error_reporter import ErrorHandler
from hed.errors.error_types import ValidationErrors
class StringValidator:
"""Runs checks on the raw string that depend on multiple characters, e.g. mismatched parentheses"""
OPENING_GROUP_CHARACTER ... |
6ee1dcaab5b21a799bfd16a4a2fa653b11de4ff8cf48b48631126f42dcafa1d0 | Python | 5,189 | 119 | import streamlit as st
from PIL import Image, ImageEnhance
import numpy as np
import cv2
import os
from tensorflow.keras.applications.mobilenet_v2 import preprocess_input
from tensorflow.keras.preprocessing.image import img_to_array
from tensorflow.keras.models import load_model
import detect_mask_image
# Setting cust... |
80fc70478c8764ffcb274eddf23c10526bfa524f35d5ffa1fc60ed93885255a4 | Python | 5,191 | 150 | """
Optuna example that optimizes multi-layer perceptrons using Tensorflow (Eager Execution).
In this example, we optimize the validation accuracy of hand-written digit recognition using
Tensorflow and MNIST. We optimize the neural network architecture as well as the optimizer
configuration.
"""
import urllib
impor... |
848a6872c8558c7bd6846a6a6fe4da5179dfccfefee974672dc7ad4063701f55 | Python | 5,192 | 145 | """Attention layers (some modules are copied from https://github.com/Diego999/pyGAT."""
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
class DenseAtt(nn.Module):
def __init__(self, in_features, dropout):
super(DenseAtt, self).__init__()
self.dropout = dropout... |
9680d2c261a9e5b7b5ca4445ee6ed806bd7ebe268514a03f8472dbab2be8ed81 | Python | 5,192 | 111 | import numpy as np
from matplotlib import pyplot as plt
from matplotlib.ticker import MultipleLocator
import pandas as pd
import os
def plot_track(data_fp, predictions_fp, metadata, num_clusters, unsupervised, eval_dict, start_sample = 0, end_sample = 20000, vars_to_plot = None, target_fp = None):
input_data = pd.... |
b9a15ad15580cbfc3622a4df237c9f26d15aca36c7e0d8ed50b34102dd58ac2f | Python | 5,193 | 96 | import os.path
from collections import defaultdict
import zipfile
from ckg.graphdb_builder import builder_utils, mapping as mp
import re
#######################################
# The Cancer Genome Interpreter #
#######################################
def parser(databases_directory, download=True):
variant_re... |
8c6c885a0b12adb769039278764e2973b34bbb3c5735b78f3f2ebc929b6bfd64 | Python | 5,194 | 137 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 6 18:04:53 2023
@author: felipe
"""
import sys
import os
sys.path.append(os.path.abspath('../../'))
sys.path.append(os.path.abspath('../'))
import plot.networks as pltn
import analysis.connectivityMatrices as connectivityMatrices
import numpy as n... |
af366e998c8c0595d2d8f18baa8302f7d8aa4dc5f4d028a88ec733ef0063f013 | Python | 5,194 | 137 | import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Function
from torch.cuda.amp import custom_bwd, custom_fwd
from .backend import _backend
class _hash_encode(Function):
@staticmethod
@custom_fwd(cast_inputs=torch.half)
#@custom_fwd
def forward(ctx, inputs, embeddings, ... |
edcf3e6315bd5f08bb38e94624fc21c2d172f8ea6f3b7bdc0a58a07bccaf5971 | Python | 5,194 | 117 | #%%
import torch.nn as nn
from types import SimpleNamespace
# from coral_pytorch.layers import CoralLayer
# from src.models.components.resnetblock import ResNetBlock
# from src.models.components.preactresnetblock import PreActResNetBlock
from src.models.components.sfcnblock import SFCNBlock
# from sfcnblock import SFCN... |
2d53bdc5cbedcc30337d585a467d20cfe32bad358fb904c546013bd5e50b898c | Python | 5,195 | 107 | # set QT_API environment variable
import os
os.environ["QT_API"] = "pyqt5"
import qtpy
# qt libraries
from qtpy.QtCore import *
from qtpy.QtWidgets import *
from qtpy.QtGui import *
# app specific libraries
import control.widgets as widgets
import control.camera as camera
import control.core as core
import control.c... |
8c2cfd255b2557f52e77fa9058ad0730cf30cc8fdd8e84feb8ba64eefa4de52b | Python | 5,195 | 185 | import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.manifold import TSNE
import numpy as np
import colorcet as cc
import matplotlib.cm as cm
from steps.methods.reducer_factory import PcaReducer, UmapReducer, TsneReducer
def plot_factory(X: np.ndarray, df: pd.DataFrame, red: str, ra... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.