sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
a11f88380b98e43639f1678959eab01d7b1a818973b2237723685de66fc2b8e7 | Python | 19,469 | 516 | """Implements DataSet container for use by Model.evaluate.
TODO: May be a better place to put this?
"""
import numpy as np
from nems.tools.arrays import broadcast_dicts, concatenate_dicts, apply_to_dict
class DataSet:
# Use these names if `input_name`, `state_name`, etc. are not specified
# in DataSet.__i... |
a0055e8ed542c5b9f03b4ba37f13a0319df6cf4348e7cd8a2254e2e091fcc771 | Python | 19,485 | 635 | import os
from pathlib import Path
import pytest
from typing import List
import flair.datasets
from flair.data import Sentence, Label, Token, Dictionary, Corpus, Span
def test_get_head():
token1 = Token("I", 0)
token2 = Token("love", 1, 0)
token3 = Token("Berlin", 2, 1)
sentence: Sentence = Sentenc... |
e97737b2c30eff3390f0c9e5608ea1cad36ff74f71fe739b8ca539c91687dba1 | Python | 19,489 | 463 | import torch
from torch import nn, einsum, broadcast_tensors
import torch.nn.functional as F
from einops import rearrange, repeat
from einops.layers.torch import Rearrange
# types
from typing import Optional, List, Union
# pytorch geometric
try:
import torch_geometric
from torch_geometric.nn import MessageP... |
0767d74ea5c76cbd7370e49e193989a9e452c15bc42672964eb379af876c6556 | Python | 19,490 | 515 | import os
import re
import glob
import nibabel as nib
import numpy as np
import pandas as pd
from scipy.io import loadmat
from nipype.interfaces.base import (
BaseInterface,
BaseInterfaceInputSpec,
TraitedSpec,
File,
InputMultiPath,
Directory,
traits,
)
from neuromaps import transforms
from ... |
b60a4e2168fe5e43da58c415fb93222ddb0f63e246cc91b67c99c83610bc4554 | Python | 19,490 | 554 | # Copyright (c) DP Technology.
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import itertools
import logging
import math
import operator
import os
import queue
import time
from threading i... |
ddb864c613ad40a5c7a1289ed36e17fc85b669b67a6456a7dd29bb8fbb7330e0 | Python | 19,492 | 480 | """Combined AAL cortical and subcortical statistical plate.
The output layout follows a compact 2 x 3 publication plate::
left lateral | left medial | left subcortex in glass brain
right lateral| right medial| right subcortex in glass brain
One structure-name CSV drives both domains and one colour scale is s... |
751a837e240766cbb6f714a5aa5ac890cbcdf80a6117a8d635a71847adaa5d4d | Python | 19,497 | 572 | from dataclasses import replace
from pathlib import Path
from typing import List, Tuple, Union
from unittest.mock import MagicMock, Mock, patch
import numpy as np
import pandas as pd
import pytest
from PIL import Image
from brainways.pipeline.brainways_params import (
AtlasRegistrationParams,
BrainwaysParams,... |
661329620eba91d54f6a7ffc803189d6741f27140e8ab953db2d23e82fa57f7e | Python | 19,498 | 463 | import torch
from torch import nn, einsum, broadcast_tensors
import torch.nn.functional as F
from einops import rearrange, repeat
from einops.layers.torch import Rearrange
# types
from typing import Optional, List, Union
# pytorch geometric
try:
import torch_geometric
from torch_geometric.nn import MessageP... |
5001e152fc570fe134ddbe6e1ae56da2febc69d7715bc932cb3231ea117cb860 | Python | 19,508 | 586 | """
EQCCT P- and S-wave phase pickers as SeisBench :class:`~seisbench.models.base.WaveformModel` classes.
EQCCT uses separate models for P and S phase picking. Load the P-branch with
:py:class:`EQCCTP` and the S-branch with :py:class:`EQCCTS`, each via
:py:meth:`~seisbench.models.base.SeisBenchModel.from_pretrained`.
... |
f6e05e15518bb967ce5c49a76eb8962528d298489147b4950504710c46f3eb7f | Python | 19,513 | 558 | """
Copyright 1999 Illinois Institute of Technology
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, publis... |
a4d552b795c756f62935365469db49b430e0c9e449f47c92a44c6e6318595764 | Python | 19,514 | 463 | import os.path
import unittest
import tests.bam
import tests.base_test
import tests.gtf
import tests.output_parser as output_parser
import tests.test_config
import tests.util
class VariableReadLengthBaseTest(tests.base_test.BaseTest):
def setUp(self):
super().setUp()
self._test_base_dir = tests.... |
ce33df09712952a9fb69131fcf35fbb3ecc32f440e997d6311dc35d6aee7effc | Python | 19,525 | 458 | alg_name = 'cluster_gcn'
import os
os.environ["OMP_NUM_THREADS"] = "2" # export OMP_NUM_THREADS=1
os.environ["OPENBLAS_NUM_THREADS"] = "2" # export OPENBLAS_NUM_THREADS=1
os.environ["MKL_NUM_THREADS"] = "2" # export MKL_NUM_THREADS=1
os.environ["VECLIB_MAXIMUM_THREADS"] = "2" # export VECLIB_MAXIMUM_THREADS=1
os.... |
6262e32b6810991d9e39c9bc3eb48c2be8d192d283c97a7cc07313ff19bd09ca | Python | 19,528 | 508 | from functools import partial
from typing import Any, Dict, Literal, Optional, Sequence, Union
import numpy as np
import torch
from anndata import AnnData # type: ignore
from numpy.typing import NDArray
from .models import dpca_guide, dpca_model, scpca_guide, scpca_model
from .train import DEFAULT, FactorModel, SVIL... |
510926ed10a74b428a764dac449a388f60e2e3f6deb593b5ae18d86a9d1d4485 | Python | 19,530 | 445 | import torch
import torch.nn.functional as F
from deepcardio.neuralop_core.models.base_model import BaseModel
from deepcardio.neuralop_core.models.fno import FNO
from deepcardio.neuralop_core.layers.embeddings import SinusoidalEmbedding2D
from deepcardio.neuralop_core.layers.spectral_convolution import SpectralConv
f... |
7c403d33b7ae07eebb3c4f6efcf9ec77765f6878a456d1830bd11689f899b877 | Python | 19,530 | 445 | import torch
import torch.nn.functional as F
from deepcardio.neuralop_core.models.base_model import BaseModel
from deepcardio.neuralop_core.models.fno import FNO
from deepcardio.neuralop_core.layers.embeddings import SinusoidalEmbedding2D
from deepcardio.neuralop_core.layers.spectral_convolution import SpectralConv
f... |
e49e584e3ba62fbe273916ac5565e5bcb576953ad7e6bec2ca5ef5d222450bca | Python | 19,532 | 488 | import torch
import torch.nn.functional as F
def conv(batch_norm,
in_channels,
out_channels,
kernel_size=3,
stride=1,
dilation=1,
activation='LeakyReLu'):
# the basic structure of the network.
if batch_norm:
return torch.nn.Sequential(
t... |
c2ad2affc12e652aa7e0368a4424373cb8770db40746003be4985f87d36a5105 | Python | 19,546 | 440 | from mmsdk.mmdatasdk import log, computational_sequence
import sys
import numpy
import time
from tqdm import tqdm
import os
#specified for numerical inconsistencies within floating points - if abs l1 distance two numbers is less than this, then they are the same.
#only use for interval comparison.
epsilon=10e-6
clas... |
d006d98f69d1642ad52896deac3556f8893bdff8a35dab48d87ed75c978409fb | Python | 19,547 | 595 | from collections.abc import Callable, Sequence
from copy import copy
from dataclasses import dataclass
from functools import partial
from typing import (
TYPE_CHECKING,
Literal,
Protocol,
Union,
cast,
)
import torch
from torch import nn
from eir.models.input.sequence.transformer_models import Posi... |
e15b2cfb09fbbb95b58a1c6d14ec15ac6e113dbedbe8981eb89369e2122b8572 | Python | 19,551 | 597 | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
# Function to reconstruct the tables with the acquisition information
from dipy.core.gradients import gradient_table
# Functions to sample the diffusion-weighted gradient directions
from dipy.core.sphere import disperse_charges,... |
aa9dbb73119d5b2222da82203ca36cb4ab9bad5cade33078086e44845c2b8f19 | Python | 19,563 | 538 | import sys
import time
import getopt
import json
import numpy as np
import scipy.ndimage as nd
from skimage import io as skio
from multiprocessing import Pool
from PIL import ImageFile
from PIL import Image
ImageFile.LOAD_TRUNCATED_IMAGES = True
Image.MAX_IMAGE_PIXELS = None
def get_fujiyama(param : str) -> np.matr... |
15f5b9b63e2354521d5d7200e40f6d0dc3166a25444fad2c04408d0ebad09dd1 | Python | 19,566 | 458 | # Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import logging
from typing import List, Optional, Tuple, Union
import numpy as np
import torch
impo... |
3b1c18a638c645be80066044344be3cd79c4f09ab9dd0d672ad10abe57e3df85 | Python | 19,569 | 571 | # -*- coding: utf-8 -*-
"""Coordinate mapping representing image deformations."""
import os
import random
import nibabel as nb
import numpy as np
from ..io.affine import apply_affine_chunked
from ..io.filename import get_filename
__all__ = [
"clean_coordinate_mapping",
"crop_coordinate_mapping",
"genera... |
442704b6e5562f6f46e9937a07aff00605f5eb41961cad9f95747d7121e9be52 | Python | 19,585 | 451 | import h5py
from umap import UMAP
from scipy.spatial import distance_matrix
from scipy.stats import scoreatpercentile as sap
import sys
import yaml
import os
import numpy as np
from matplotlib import ticker
import matplotlib as mpl
import matplotlib.pyplot as plt
from sklearn.metrics.pairwise import cosine_similarity
f... |
6d2e70af0d9d250627e350b9d12d3402716e3953c1fa88de6c8b9ad0e8adef18 | Python | 19,585 | 463 | # alg_name = 'gnn'
import os
os.environ["OMP_NUM_THREADS"] = "2" # export OMP_NUM_THREADS=1
os.environ["OPENBLAS_NUM_THREADS"] = "2" # export OPENBLAS_NUM_THREADS=1
os.environ["MKL_NUM_THREADS"] = "2" # export MKL_NUM_THREADS=1
os.environ["VECLIB_MAXIMUM_THREADS"] = "2" # export VECLIB_MAXIMUM_THREADS=1
os.enviro... |
5def982aaeaa64b2d8be5aa3e974e4d7106e758071f5a23890b63d91e970dab5 | Python | 19,593 | 597 | """Durable checkpoint and transcript tests for the main-agent workflow."""
import os
import sqlite3
import stat
import threading
import pytest
from langchain_core.messages import AIMessage, HumanMessage, ToolMessage
from chemgraph.agent.main_session import (
IncompatibleCheckpointError,
MainAgentSession,
... |
3277dd9fb2bc1851e06a29a62499243e1c9d9fe4765d3efe628f935ca8d07fea | Python | 19,607 | 344 | #ARGS are optional, see ignore = for how they are used
#if using ARGS, from within python, type
#ARGS="-bt heat -Rt 4.5 -Rtmax 6.8 -geno D1+ -cell MSN"
#execfile ('GrpAvgPatchMultiGroups.py')
#from outside python, type
#python GrpAvg.py -s M -p 21 -bt RT
#Needs to be updated to use plot_groups from grp_utl
#N... |
5a74a307566d01d3ec10f1114e3e5f4e7e24629fd2aa79c6159c1dc2918a986c | Python | 19,623 | 535 | # -*- coding: utf-8 -*-
"""
Process a image stack in parallel or sequentially
In this toolbox image processing is parallized via splitting a volumetric
image stack into several sub-stacks, typically in z-direction. As most of
the image processig steps are non-local sub-stacks are created with overlaps
and the result... |
862b8a461f51c770797d1454029dcc38c074bb6892b639b9244327406702253a | Python | 19,624 | 411 | #!python
import shutil
import os
from pathlib import Path
import traceback
import yaml
import re
from dtiplayground.config import INFO as info
import dtiplayground
import dtiplayground.dmri.common as common
import dtiplayground.dmri.common.module as module
from dtiplayground.dmri.common.appbase import AppBase
impor... |
daf0a9bcf34f224d999a7134fef8e2a24d4085fcc5e99644ad1bbbcfc3a98380 | Python | 19,635 | 460 | import tensorflow as tf
from tensorflow import keras
import numpy as np
from scipy import stats
from sklearn import metrics
######################################################################
# DEGU class
######################################################################
class DEGU():
"""
Deep Ensemb... |
d8e742f7d115af5a3eef59acfc6d190c7ce81c7ba58575dddb21cccb714d26ee | Python | 19,639 | 544 | """Hidden Markov Model (HMM) with a Multivariate Normal observation model.
See the :doc:`documentation </models/hmm>` for a description of this model.
See Also
--------
- D. Vidaurre, et al., "Spectrally resolved fast transient brain states in
electrophysiological data". `Neuroimage 126, 81-95 (2016)
<https://www... |
bab16b1b0228eff05371737883e087f6c5ac5c39e73e2abff170f340ea7ea133 | Python | 19,640 | 514 | import sys
sys.path.insert(0, '../')
sys.path.insert(0, '../../')
sys.path.insert(0, '../../../')
sys.path.insert(0, '../../../../ogb')
import os
os.environ["OMP_NUM_THREADS"] = "2" # export OMP_NUM_THREADS=1
os.environ["OPENBLAS_NUM_THREADS"] = "2" # export OPENBLAS_NUM_THREADS=1
os.environ["MKL_NUM_THREADS"] = "2" # ... |
3fd432eecfb7822b72c3777f9850b8c4b4ba0420f550577828b0f8aefe314b90 | Python | 19,647 | 379 | """Reconstruct exactly the samples and splits in a frozen OpenPlant manifest."""
from __future__ import annotations
import argparse
import hashlib
import io
import json
import os
import re
import sys
import tempfile
from collections import Counter
from pathlib import Path
from PIL import Image, __version__ as PILLOW_... |
f9be441720638f782545988f4f99b37126ea2657378969e3e16fb076eefc33e6 | Python | 19,652 | 467 | import torch
from torch import nn, einsum, broadcast_tensors
import torch.nn.functional as F
from einops import rearrange, repeat
from einops.layers.torch import Rearrange
# types
from typing import Optional, List, Union
# pytorch geometric
try:
import torch_geometric
from torch_geometric.nn import MessageP... |
b061ca141d7d4cf2f09a448c69dd5493744a45d8e2b1a3c66fa0eb16f9e04592 | Python | 19,662 | 357 | # -*- coding: utf-8 -*-
#
# train.py
#
# Copyright 2020 Amazon.com, Inc. or its affiliates. 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/... |
c455ff230a138a0dcbdd26d99f49ee7fa8b760b2f83c4f0b4be59ed09630c7e7 | Python | 19,677 | 614 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from __future__ import annotations
import operator
from collections.abc import Collection, Sequence
from functools import cached_property
from typing import Any
import attrs
from rest_framework.exceptions import ValidationError
from cvat.apps.data... |
3fb45bcdf22f20181dd14403504316911738e115366cc1065906d5692b22332e | Python | 19,680 | 640 | # -*- coding: utf-8 -*-
"""
Created on Sun Jul 19 11:42:52 2015
Test Processing Chain with Synthetic Data
@author: ckirst
"""
##############################################################################
# Test Resampling / Make Reference
###########################################################################... |
61290dee8dcf18b21a8f74af72c003f8e9c6a78389c8e33fbf9e04ebcbdda6f1 | Python | 19,684 | 522 | import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import os
import os.path
import shutil
from glob import glob
import openslide
import PIL
from PIL import Image
PIL.Image.MAX_IMAGE_PIXELS = 933120000
from PIL import ImageDraw, ImageFont
import cv2
import json
from tqdm impo... |
911d467ac80f62007bbe71c87c3088d62c8aa2f292cfd45ff6e28cca489d5eac | Python | 19,694 | 551 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from __future__ import annotations
import itertools
from abc import ABCMeta, abstractmethod
from collections.abc import Collection, Iterable, Sequence
from typing import ClassVar, TypeAlias
import attrs
import datumaro as dm
import datumaro.compone... |
5fdfbb73368f6beca741adbada3cdf147fb5bdc2b25393cca482bd13c57f02ba | Python | 19,710 | 424 | import numpy as np
import brainscore_vision
from brainscore_core.supported_data_standards.brainio.assemblies import DataAssembly
from brainscore_vision.benchmarks import BenchmarkBase, ceil_score
from .screen import place_on_screen
from brainscore_vision.model_interface import BrainModel
from result_caching import sto... |
3378bc4115253343edcf0d8efdceba46ad6c97763fec99102288f424df2b67bf | Python | 19,716 | 660 |
import os
os.environ['OPENCV_IO_MAX_IMAGE_PIXELS'] = pow(2, 40).__str__()
import sys
import copy
from pathlib import Path
from collections import Counter
import numpy as np
import pandas as pd
import cv2
import bioformats.formatreader
import cellprofiler_core.pipeline
import cellprofiler_core.preferences
import cell... |
e4ad8663ce0d023db7f9e3c804cfe35a5d00930417dc8269ea81a537b9cd1b75 | Python | 19,720 | 484 | """ PyTorch Feature Extraction Helpers
A collection of classes, functions, modules to help extract features from models
and provide a common interface for describing them.
The return_layers, module re-writing idea inspired by torchvision IntermediateLayerGetter
https://github.com/pytorch/vision/blob/d88d8961ae51507d0... |
01d85718d2f838979518cf370f9e7b1362dc1852b17fecd8a33f5bf2dc457432 | Python | 19,733 | 455 | """Performs a meta-analysis on an attribution database and writes them into an analysis database, from which a ViRelAy project can be created."""
import argparse
import json
import typing
from collections.abc import Sequence
from typing import Annotated, SupportsIndex
import h5py
import numpy
from scipy.spatial.dista... |
9f8f13b2ab0969c3722ca6ba38efe5dceba7379fcf47d6b800b138d38bce9ae1 | Python | 19,737 | 498 | # Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
import fnmatch
import inspect
import itertools
import logging
import types
from typing import (
Any,
Callable,
Dict,
Iterable,
List,
Mapping,
Optional,
Set,
Tuple,
Type,
Union,
)
import hydra
import t... |
5695ac64a3865be5221155bae3cf704abb5524de498f749b5430302de4dfe63b | Python | 19,738 | 614 | import os, math
import numpy as np
import bpy
import mathutils
VL = 'ViewLayer'
def angle2rad( theta, unit ):
return math.radians(theta) if unit=='DEG' else theta
def rad2angle( theta, unit ):
return math.degrees(theta) if unit=='DEG' else theta
def expand_rgb( rgb, alpha=True ):
if np.isscalar(rgb):
... |
0be2ad99a365beff57e4a4b28d0a273e237bd72491b19dadbca2eeea6490260a | Python | 19,748 | 533 | # Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
from __future__ import absolute_import, division, print_function, unicode_literals
import math
from typing import List, Tuple
import torch
# from detectron2.layers.rotated_boxes import pairwise_iou_rotated
from .boxes import Boxes
def pairw... |
418b7b051f1de1b6e039049d8faf2b579bdcf9b8e45690dee4dcbe4533416a4e | Python | 19,750 | 611 | import os, math
import numpy as np
import bpy
import mathutils
def angle2rad( theta, unit ):
return math.radians(theta) if unit=='DEG' else theta
def rad2angle( theta, unit ):
return math.degrees(theta) if unit=='DEG' else theta
def expand_rgb( rgb, alpha=True ):
if np.isscalar(rgb):
rgb = 3*(rg... |
5d570a8d4cda07a01e62ce3626f0c3fe0b7b9a2ccf819ef6be4090aac3d682f5 | Python | 19,753 | 503 | from PUMI.engine import QcPipeline, GroupPipeline
from PUMI.interfaces.HDBet import HDBet
from PUMI.utils.plotting import segmentation_qc_plot
from nipype.interfaces import fsl
from nipype.interfaces.utility import Split
from matplotlib.colors import LinearSegmentedColormap
from nipype import Function
from PUMI.engine ... |
885c43e680fcb888e8ea88633a428d53eb34f736c9c2eb132fec385c41cf9bae | Python | 19,760 | 622 | #!/usr/bin/python
#
## @file
#
# Handles viewing (and parsing) sequence xml files and generating DaveActions.
#
# Hazen 06/14
#
from xml.etree import ElementTree
from PyQt5 import QtCore, QtGui, QtWidgets
import storm_control.dave.daveActions as daveActions
DaveActionType = QtGui.QStandardItem.UserTy... |
7043deb8738ac836e18f833795027194ef10c527b23b418c44b6702bbcd2139a | Python | 19,778 | 478 | from PySide6.QtCore import QAbstractTableModel, QModelIndex, Qt
from PySide6.QtWidgets import (
QTableView,
QAbstractItemView,
QHeaderView,
QColorDialog,
QInputDialog
)
from PySide6 import QtGui, QtCore
from typing import Optional, List
from bannotator.state import GuiState
from bannotator.data impo... |
dc8971b2094158d4cce6cdcf8206233df0afae0daf9acc059ced9c6834b15cbb | Python | 19,787 | 475 | #!/usr/bin/env python
import os
import argparse
import numpy as np
from os.path import join as pth
from src.tri_io import write_tri, load_tri
from src.transform_to_ctf import transform_to_ctf, apply_transform
from src.pca_warp import shortest_dist, elec_warp
from src.tri2nii import tri2nii
from src.nii_postprocessing ... |
81130b3725438fee2d7aa1527ed1e5646d66144c8284bf2aeda7961e76b93310 | Python | 19,800 | 582 | import numpy as np
import sys
import pickle
import os
import yaml
import argparse
import ast
from scipy.io import savemat
from dannce.engine.io import load_sync, load_com
from dannce.engine.processing import prepare_save_metadata
from dannce import (
_param_defaults_shared,
_param_defaults_dannce,
_param_de... |
a3bd8e02376085decfa3b9d16c4e525d90eff16532f1b2cbc22935db04833c42 | Python | 19,800 | 489 | import sys
import importlib
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.data import DataLoader, Dataset
import pandas as pd
import joblib
import copy
from tqdm import tqdm
import numpy as np
import matplotlib.pylab as plt
def init_nets... |
d4c4aafb10db9f9831800a4fc98237a45575f8a3a3827d1d92f466ef5cfeee50 | Python | 19,805 | 535 | from typing import Union, Tuple, List, Dict
from pathlib import Path
import numpy as np
from skimage.exposure import rescale_intensity
from skimage.transform import resize
from skimage.util import view_as_windows
from skimage.morphology import remove_small_objects
import pandas as pd
import matplotlib.pyplot as plt
fr... |
b47cefcfd0bf683b0c708c1de0328df83be2c35264637c442106e79d739fb7f3 | Python | 19,809 | 619 | from __future__ import absolute_import, unicode_literals
__version__ = '0.42.1'
__license__ = 'MIT'
import marshal
import re
import tempfile
import threading
import time
from hashlib import md5
from math import log
from . import finalseg
from ._compat import *
if os.name == 'nt':
from shutil import move as _rep... |
82446bcc1b113db21de976daef7fd9a3a1cdd258b97e6a9fefea70135cacf4db | Python | 19,810 | 656 | '''
Misc utilities
'''
import abc
import enum
import time
import queue
import struct
import typing
import pathlib
import logging
import asyncio
import datetime
import threading
import functools
import contextlib
from ..qt import *
LOGGER = logging.getLogger(__name__)
import stl.mesh
import typing_extensions
from .... |
de0f85e7348cf75e75fc0af2e8ca4e366909c8220e7163032357acd3755c439e | Python | 19,833 | 487 | """
pistoia.py
Generate tables of standard post-processing quantities.
Copyright (c) 2010-2016, Numerics88 Solutions Ltd.
http://www.numerics88.com/
See LICENSE for details.
"""
import sys
#from N88ReportedError import N88ReportedError
from n88tools.N88ReportedError import N88ReportedError
import numpy
from numpy.c... |
cb3950b556382d629d55cc4f9d5aed49770e89afb74e61af613abb31767edce4 | Python | 19,840 | 447 | """ Lookup tables shared among multi-photon pipelines. """
import datajoint as dj
import numpy as np
from scipy.signal import hamming, convolve, medfilt
from .exceptions import PipelineException
schema = dj.schema('pipeline_shared', locals(), create_tables=False)
@schema
class Field(dj.Lookup):
definition = """ ... |
9d275142bca4089450839675189230144912bc1be4f3e5f82844a461e88ca1b3 | Python | 19,848 | 438 | #########################################################
# Whole-genome variant processing pipeline
#########################################################
import hail as hl
import time
import os
from functools import reduce
def quality_control_wgs(vcf_path, output_dir, chr_name, lcr_bed_path):
start = time.t... |
88c1aaaa4b8454ed18c93aa9d843aba9169a43330dc6a08025da79e214b853a1 | Python | 19,862 | 510 | #!/usr/bin/env python
"""
Handles communication with a bluetooth device, an Android phone
for example. It is recommended that your devices support at
least Bluetooth version 2.0 if you want to send the current
camera display from HAL to the device.
Hazen 06/18
"""
import bluetooth
import io
from PyQt5 import QtCor... |
4324ab500e0d0880b160baa6fc3a6add1d89700a61d11d879079265cd8b09f80 | Python | 19,864 | 528 | # Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
"""Dataset class for modulated detection"""
import json
import os
import random
import sys
import traceback
from collections import Counter
from dataclasses import dataclass
from enum import Enum
from typing import Any, Callable, Dict, List, Opt... |
39e51a61d39bc35e9b4eb951407301e720c8fe835a48ca26721732ed7b7ba247 | Python | 19,865 | 616 | import os, math
import numpy as np
import bpy
import mathutils
VL = "View Layer"
def angle2rad( theta, unit ):
return math.radians(theta) if unit=='DEG' else theta
def rad2angle( theta, unit ):
return math.degrees(theta) if unit=='DEG' else theta
def expand_rgb( rgb, alpha=True ):
if np.isscalar(rgb):
... |
6d803faecaf9e25f17bc72a8415ef4fd2b288de9232231fb519f61b11a867c11 | Python | 19,870 | 462 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
"""
import os
import sys
import argparse
import numpy as np
import json
from vidfeats.mediaio import Video
from vidfeats.utils.io_helpers import str2bool
# List of available features for extraction
features_base = ['getinfo', 'count_frames', 'saveinfo']
features_e... |
786ff926da3ca9933af801a8897adc1e040e61d1bf1fe04a8bc6fbac3b01c490 | Python | 19,870 | 449 | import types
import logging
import numpy as np
from nems.visualization.metrics import jackknife_est_error
from nems.models.dataset import DataSet
log = logging.getLogger(__name__)
def indices_by_fraction(data, fraction=0.9, axis=0):
"""Get indices that split `data` into two parts along one axis.
Parameter... |
b59ea232a573be69c942ad40374f6253702ababb1b25331439b8890d78360e6d | Python | 19,879 | 463 | import dataclasses
import logging
import os
from copy import deepcopy
from typing import Any, Callable, Dict, List, Optional, Tuple
from torch import nn as nn
from torch.hub import load_state_dict_from_url
from timm.models._features import FeatureListNet, FeatureDictNet, FeatureHookNet, FeatureGetterNet
from timm.mod... |
364eb392e69af4bc10ff5e800777fb99685902350700636d65fb362615a20576 | Python | 19,890 | 452 | import torch
import torch.nn.functional as F
from deepcardio.neuralop_core.models.base_model import BaseModel
from deepcardio.neuralop_core.models.fno import FNO
from deepcardio.neuralop_core.layers.embeddings import SinusoidalEmbedding2D
from deepcardio.neuralop_core.layers.spectral_convolution import SpectralConv
f... |
e1e9663f39e8db1af337e0e331d513ba934b44871cd30a1b0e73c30072eedd40 | Python | 19,896 | 441 | """
This module provides functions to generate MR signal and corresponding Jacobians based on IVIM
parameters.
"""
import numpy as np
import numpy.typing as npt
from ivim.constants import Db, y
from ivim.seq.lte import MONOPOLAR, BIPOLAR, G_from_b
NO_REGIME = 'no'
DIFFUSIVE_REGIME = 'diffusive'
BALLISTIC_REGIME = ... |
a6c96705353bb5c3dcbb7470bfbbeca0500d5c1ebfb48c0c23fddcb4cf1a1edc | Python | 19,910 | 593 | # coding=utf-8
"""
Tests for deepreg/dataset/loader/interface.py
"""
from test.unit.util import is_equal_np
from typing import Optional, Tuple
import numpy as np
import pytest
from deepreg.dataset.loader.interface import (
AbstractPairedDataLoader,
AbstractUnpairedDataLoader,
DataLoader,
FileLoader,
... |
0c4e48b181ee8a9f5a7d0947ba0f603bb25cba0f238ce2a6d1cb3858acbba388 | Python | 19,922 | 562 | """Atomistic LIne Graph Neural Network.
A prototype crystal line graph network dgl implementation.
"""
from typing import Tuple, Union, List
import dgl
import dgl.function as fn
import numpy as np
import torch
from dgl.nn import AvgPooling
# from dgl.nn.functional import edge_softmax
try:
from pydantic.typing im... |
1a798a0a25919f2b2f2a14783167ceb1806d69167b8a87cb8cbe1c5734539d25 | Python | 19,949 | 483 | from monai.utils import (
ensure_tuple
)
from monai.transforms import (
AsDiscrete,
EnsureChannelFirstd,
Compose,
LoadImaged,
ScaleIntensityRanged,
Spacingd,
EnsureTyped,
EnsureType,
)
from monai.handlers.utils import from_engine
from monai.networks.nets import UNETR
from monai.netwo... |
44f5cf6c0c205e6aa39f035f54d6f335ab18969152107bf5f24551aec128e514 | Python | 19,951 | 527 | # Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
c37fe217dfb8b1ebe3c62311d97aade19298f630bf44c9898f58bfe81b02d20e | Python | 19,955 | 408 | import os
import sys
import numpy as np
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../code')))
from train_gtex import *
from eval_enformer_gtex import slice_enformer_pred
from ism_performer import tss_centered_sequences, get_window_around_TSS,load_model, one_hot_encode, IsmDataset,LitModel... |
77463471e336febf422aefca07dcadb223e7859cb5a63685444cbb1c069f4cff | Python | 19,965 | 456 | """Performs a meta-analysis on an attribution database and writes them into an analysis database, from which a ViRelAy project can be created."""
# pylint: disable=duplicate-code
import argparse
import json
import typing
from collections.abc import Sequence
from typing import Annotated, SupportsIndex
import h5py
imp... |
5e41bfce95c9463bebdd9487613ac26d899c5021aa9276f7be47c50ed3497936 | Python | 19,966 | 355 | import pandas as pd
import numpy as np
from collections import defaultdict
import tensorflow as tf
from tensorflow.keras.callbacks import ModelCheckpoint, ReduceLROnPlateau, EarlyStopping
from sklearn.metrics import (
log_loss, roc_curve, roc_auc_score, confusion_matrix
)
from sklearn.model_selection import... |
e89e5577e27e33e4ea46808d4216040bc023ed58e8d53c3a57f4f4c52b5b5dbf | Python | 19,966 | 503 | """Guided coach-mark tutorial for the MEA-NAP GUI.
The tutorial dims the whole window and highlights one real tab/field at a
time, walking the user through every required setting for the pipeline they
pick (MEA-NAP, MEA-Stim or CAT-NAP) and landing them on the Run tab
ready to run. The dimming scrim is purely visual: ... |
4b862fdc8423e1dc3cfdc51ecf8013207c32fe9aa621bf96e716c2daf1e6bce9 | Python | 19,973 | 537 | """
Copyright 1999 Illinois Institute of Technology
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, publis... |
a2b7d6e80cea82bc5b596e92798c9f2da12debd5ce767a9de41835149986eb58 | Python | 19,983 | 469 | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import logging
from typing import List, Optional, Tuple, Union
import numpy as np
import torch
from PIL.Image import Ima... |
19c09429864f56053336b2c5410e973db0b929c2a474fa9be44e38356c4b4b28 | Python | 20,012 | 535 | import sys, math, os, re
sys.path.append('..')
from typing import Iterator, Sequence, Optional
import torch
from torch.utils.data import Dataset, WeightedRandomSampler, DistributedSampler
import torch.nn.functional as F
import torch.distributed as dist
from torch_geometric.data import Data, Batch
import dgl
import nump... |
b4c8a49af17f86a00e966ed553ff247d412745a5a0b4aa0bec73640854a3a5b6 | Python | 20,014 | 638 | from functools import wraps
import re
import warnings
import numpy as np
import pandas as pd
import logging
log = logging.getLogger(__name__)
def check_result(f):
@wraps(f)
def wrapper(*args, **kwargs):
result = f(*args, **kwargs)
if result.size == 0:
mesg = 'Result is empty'
... |
e3ff95fda8cde02af2f4bb9b70d8817e484176100933951ed95e14a6ff30c7d4 | Python | 20,016 | 611 | import math
import torch
from torch import nn, einsum
from inspect import isfunction
from functools import partial
from itertools import islice, cycle
import torch.nn.functional as F
from torch.utils.checkpoint import checkpoint
from math import sqrt
from einops import rearrange, repeat, reduce
from einops.layers.tor... |
772b52189fcfffa5da02d8cf57e999dd320ca08261e536767fa08d90bdc78868 | Python | 20,018 | 564 | """Atomistic LIne Graph Neural Network.
A prototype crystal line graph network dgl implementation.
"""
from typing import Tuple, Union, List
import dgl
import dgl.function as fn
import numpy as np
import torch
from dgl.nn import AvgPooling
# from dgl.nn.functional import edge_softmax
try:
from pydantic.typing im... |
dabec9d6e5838df8440eb31011c91c7ffd8f34ffb1a4c92cb2a08fe2009a2b1e | Python | 20,018 | 624 | #!/usr/bin/python3
#
import os
import sys
import argparse
import numpy as np
from sklearn.neighbors import NearestNeighbors
from uac import utils
import uac.vars as var
# Create the parser
my_parser = argparse.ArgumentParser(description="Calculation of new atrial coordinates")
# Add the arguments
my_parser.add_argum... |
9ce816ab93f3017008d412de1a76639c26335a1b1916cbaff63e302015616c2b | Python | 20,023 | 480 | import csv
import json
from contextlib import ExitStack
from datetime import datetime, timedelta, timezone
from http import HTTPStatus
from io import StringIO
from time import sleep
import pytest
from cvat_sdk.api_client import exceptions, models
from cvat_sdk.api_client.api_client import ApiClient, Endpoint
from deep... |
3f932c20612fce403555066682b1bf496238c654ffe6439adf497e0986a1ee44 | Python | 20,037 | 360 | """A module that contains processors for clustering algorithms."""
import io
import os
import typing
from collections.abc import Callable
from typing import Annotated, Literal, SupportsIndex, TypeAlias, TypeGuard, get_args
import numpy
import scipy.cluster.hierarchy
import sklearn.base
import sklearn.cluster
from mat... |
603ffb2009a97b23dc578a670ee8a53ddbd9abf3e3b25f9113f7d73713d81cac | Python | 20,037 | 561 | # Copyright 2024 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, sof... |
36d30bed77589107827b862338300fe8489585f18db9fd63d51b80034cf9bcd2 | Python | 20,044 | 587 | """
Molecular Fingerprint Analysis for PAH Compounds
Author: [Your Name]
Date: 2025
Description: Generate and analyze molecular fingerprints (ECFP4, MACCS, Atom Pairs) for PAH prediction
"""
import numpy as np
import pandas as pd
import tensorflow as tf
from tensorflow.keras.models import Sequential, load_model
from t... |
99aeb91801c712862266a1ecfc290c18063179ea46735069d133179a2a087c2b | Python | 20,044 | 516 | r"""This class defines the abstraction for a backend-agnostic feature store.
The goal of the feature store is to abstract away all node and edge feature
memory management so that varying implementations can allow for independent
scale-out.
This particular feature store abstraction makes a few key assumptions:
* The fe... |
3825c63963a5fa43aaef13fdc4348b05ac64a869ba42e09b9ae271260045ade5 | Python | 20,059 | 345 | ### script for writing meta information of datasets into master.csv
### for node property prediction datasets.
import pandas as pd
dataset_dict = {}
dataset_list = []
### add meta-information about protein function prediction task
name = 'ogbn-proteins'
dataset_dict[name] = {'num tasks': 112, 'num classes': 2, 'eval ... |
f55fd0363febbd5e982f467adf9771d50e9b81c007061a4ac35999f97a2f3b7e | Python | 20,060 | 528 | # -*- coding: utf-8 -*-
"""Preprocessing utilities to prepare fmri time series for the decoding analysis. This
module does not provide a complete preprocessing pipeline for fmri data (e.g. no tools
for motion correction, distortion correction or slice-time are provided here and are
assumed to be applied beforehand if n... |
600b448d1ca85ee513b0f049ebf495a912e2834e5d07e48dcad087644e6bcc4c | Python | 20,062 | 537 | from PyQt5.QtGui import QFontMetrics, QIcon
from PyQt5.QtWidgets import (
QMainWindow, QWidget, QVBoxLayout, QHBoxLayout,
QPushButton, QLabel, QLineEdit, QTextEdit,
QFileDialog, QComboBox, QRadioButton, QGroupBox,
QMessageBox, QProgressBar, QGridLayout, QSizePolicy, QAction, QStyle
)
from PyQt5.QtCore i... |
1db297ba220d3cc78c99b9b2935c5af011505a08ef283bc3edad8ca8112ee115 | Python | 20,075 | 560 | # Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
import copy
import itertools
from typing import Any, Iterator, List, Union
import numpy as np
import pycocotools.mask as mask_util
import torch
from torch import device
from .boxes import Boxes
from .memory import retry_if_cuda_oom
from .roi_a... |
89323097b803f45647c8c6ce92be8e88aaca48c8c62a88f945d6033fab4fb494 | Python | 20,079 | 418 | #!/usr/bin/env python
# coding: utf-8
import os
import random
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import DataLoader, Dataset
from torch_geometric.nn import GCNConv
from tqdm import tqdm
from sklearn.model_selection import StratifiedKFold
from skl... |
afc25add2fe81429ea667eac15cc024a6b144a532a113f344182013ae3cd5afa | Python | 20,084 | 567 | """Adds utilities for the command-line interface"""
import json # decode
import logging
import os
import os.path as op # dirname, basename, join, splitext
import pprint # pprint
import subprocess
import warnings
import numpy as np
from pydesigner.preprocessing import mrinfoutil
log = logging.getLogger(__name__)
... |
7cf7f86f73b5510c562f9a831070f9d63950bd69ef399f4b60e420c6c0ff659a | Python | 20,096 | 612 | """
Unified progress reporting interface for CLI and Python APIs.
This module provides a consistent interface for progress tracking across all
feature extraction modules, with automatic TTY detection, logging integration,
and graceful fallbacks.
Example usage:
>>> from utils.progress import get_progress_manager, ... |
d373287832006ba46037fb9c78bef7db142c8469f5a0c266d71a27ffe170a387 | Python | 20,105 | 528 | """Tests for mcmlnet.training.data_loading.preprocessing module."""
from itertools import product
from unittest.mock import Mock, patch
import numpy as np
import pytest
import torch
from mcmlnet.training.data_loading.preprocessing import (
PreProcessor,
collate_variable_tensors,
collate_variable_tensors_... |
84165e014c7c1d092df252d6c11eab4ea1a39a0584499023fef9aec1bd2072d0 | Python | 20,110 | 591 | import os
import logging
import h5py
import concurrent.futures
from abc import ABC, abstractmethod
from filelock import FileLock
from tqdm import tqdm
import numpy as np
import pandas as pd
import nibabel as nib
import heig.input.dataset as ds
class ImageReader(ABC):
"""
An abstract class for reading images
... |
32898b2df28b5e44c29a0bcbd0b8659cc1c4c2ad2f66a96017f19d4c39776b1f | Python | 20,119 | 562 | """
(C) Copyright 2021 IBM Corp.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dis... |
f99e5659569268a1f54d22af679dfbd4def195291adc3f37ce1625c844f9ddca | Python | 20,128 | 599 | import atexit
import json
import shutil
from collections.abc import Sequence
from copy import deepcopy
from pathlib import Path
from typing import Any, Literal
from urllib.parse import urlparse
import numpy as np
import pandas as pd
import websocket
from aislib.misc_utils import ensure_path_exists
from PIL import Imag... |
0a4d3b8a6664a11ed830faf1bb33953c980ab741c3f33d9d3c74386873b03695 | Python | 20,130 | 517 | #!/usr/bin/env python3
"""
EEG Preprocessing Pipeline for Deep Lightweight CNN (DLCNN)
A comprehensive pipeline for preprocessing EEG data for deep learning-based artifact detection.
Handles variable sampling rates, channel configurations, and implements standardized steps
for optimal model performance.
Key Features:... |
d3986b66ad65ae47f523e69cbe68e748ee3785451861e14114f013f4988e7f1f | Python | 20,155 | 503 | """A module that contains unit tests for the :py:mod:`corelay.processor.base` module."""
import typing
from collections.abc import Callable
from typing import Annotated
import pytest
from corelay.io import NoStorage
from corelay.base import Param
from corelay.processor.base import Processor, FunctionProcessor, ensur... |
09d2978431b20d883de2cb7d72d52304ed58c21a7bbd83a901ab4cfb2cd1356d | Python | 20,161 | 504 | # -*- coding: utf-8 -*-
"""
Created on Fri Dec 11 23:39:22 2015
@author: ajaver
"""
import os
import warnings
import numpy as np
import pandas as pd
import tables
from scipy.stats import chi2
from sklearn.covariance import MinCovDet
from tierpsy.helper.params import min_num_skel_defaults
from tierpsy.helper.misc im... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.