sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
be377713d11365123f89d781250a45a387c5cfdeaabaaced60ecdb6c46acec60 | Python | 13,456 | 301 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
import sys
import time
import torch
from ultralytics.utils import LOGGER
from ultralytics.utils.metrics import batch_probiou, box_iou
from ultralytics.utils.ops import xywh2xyxy
def non_max_suppression(
prediction,
conf_thres: float = 0.25... |
69e12f5b870eeeacb8559910e0dad5c259624c3402e4bf2fab3c1e1f90bdc571 | Python | 13,457 | 291 | import torch
import torch.nn as nn
import models.snn_type as snn_type
from conf import global_settings as conf_set
import torch.cuda.nvtx as nvtx
class basic_block(nn.Module):
expansion = 1
def __init__(self, in_channels, out_channels, stride=1, has_bn=False):
super(basic_block, self).__init__()
... |
480969c7ad971a949b226494d7b930129b4623995153670da67367e8352265d0 | Python | 13,463 | 344 | # The ImpedanceFitter is a package to fit impedance spectra to equivalent-circuit models using open-source software.
#
# Copyright (C) 2018, 2019 Leonard Thiele, leonard.thiele[AT]uni-rostock.de
# Copyright (C) 2018, 2019, 2020 Julius Zimmermann, julius.zimmermann[AT]uni-rostock.de
#
# This program is free ... |
78c371564bd9b79a10fe02518265a6d4d057ef3536b5923f04f697781d30bb29 | Python | 13,465 | 334 | import copy
import os
import os.path as osp
import sys
from dataclasses import dataclass
from typing import List, Literal, Optional
import torch
import torch.utils.data
from torch import Tensor
import torch_geometric.typing
from torch_geometric.data import Data
from torch_geometric.index import index2ptr, ptr2index
f... |
9a6b8e22b41285894ac6a7a8d7eab56f83b81700c9c992dc78cf4a82687cf110 | Python | 13,469 | 271 | from dtiplayground.dmri.common.pipeline import *
from dtiplayground.dmri.common.pipeline import _num
# from dtiplayground.dmri.common.pipeline import _generate_exec_sequence, _generate_output_directories_mapping
def _generate_exec_sequence(pipeline,file_paths:list,output_dir,modules, io_options): ## generate sequence ... |
d0fa46cf25d8934dc22895f1dbf1e7d79aa366bde9345c038795c0950deb2e98 | Python | 13,469 | 364 | """
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... |
48a99a96a30b9ed62114790c584273426d9b12400153112eb55ae20e2de07bc0 | Python | 13,470 | 420 | # 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, ... |
1f56825d82ff7691de87df63f28ec48e7fd041d07a75307dec7a7a086ea49657 | Python | 13,472 | 312 | import torch
import numpy as np
import pandas as pd
from unicore import metrics
from unicore.losses import UnicoreLoss, register_loss
@register_loss("unimol_plus")
class UnimolPlusLoss(UnicoreLoss):
"""
Implementation for the loss used in masked graph model (MGM) training.
"""
@staticmethod
def a... |
5c6d9cd1e5142e4218aa618a421dcfeb37ca40c6376d3e045e0d2115f5f2e739 | Python | 13,476 | 380 | # -*- coding: utf-8 -*-
"""
This module defines the NormalizedWorm class
"""
import numpy as np
from scipy.interpolate import interp1d
from scipy.signal import savgol_filter
def _h_resample_curve(curve, resampling_N=49, widths=None):
'''Resample curve to have resampling_N equidistant segments
I give width a... |
6a45660079fac31f48ea3ab91c0b6727bcdf66bf224c7c2d162d512ec766eefd | Python | 13,478 | 278 | import sys
from pathlib import Path
p_dir = str(Path(__file__).absolute().parents[1])
if p_dir not in sys.path: sys.path.insert(0, p_dir)
import random
import time
import numpy as np
import nibabel as nib
from monai.transforms import AddChannel, Compose, RandRotate90, Resize, ScaleIntensity, ToTensor
from monai.tra... |
9b9420c2298316376ec80431653aca6a535d57fbacbcb28f4a4932a818b9704c | Python | 13,479 | 268 | from typing import Union, Tuple, List
from batchgeneratorsv2.helpers.scalar_type import RandomScalar
from batchgeneratorsv2.transforms.base.basic_transform import BasicTransform
from batchgeneratorsv2.transforms.intensity.brightness import MultiplicativeBrightnessTransform
from batchgeneratorsv2.transforms.intensity.c... |
16ec53ea18eb11155bea736fb7abda54b133fe8baa50725494d59ed42d7c4487 | Python | 13,480 | 298 | import logging
import os
import atom3.case as ca
import numpy as np
import pytorch_lightning as pl
import torch
import torch.nn as nn
from dgl.data import DGLDataset
from torch.utils.data import DataLoader
from project.utils.deepinteract_constants import NODE_COUNT_LIMIT, RESIDUE_COUNT_LIMIT
from project.utils.deepin... |
940816c4357197ec6ceb81df25cb516ea1feb759adaa4c18ac2c8b7537eca695 | Python | 13,484 | 417 | # -*- coding: utf-8 -*-
"""Utilities for time series noise removal."""
import copy
from pathlib import Path
import matplotlib.pyplot as plt
import nibabel as nb
import numpy as np
from nilearn.maskers import NiftiMasker
from scipy.ndimage import binary_erosion
from sklearn.decomposition import PCA
__all__ = ["CleanT... |
c6bdce819760210bebbcc3c2028219d6fe3e5637758d5e463533a13d22bf985e | Python | 13,488 | 347 | """
Density sampling for surface morphometrics pipeline.
This script samples tomogram density values along normal vectors for each triangle
in a surface mesh. The resulting density profiles can be used for thickness measurements,
membrane analysis, and other downstream analyses.
Pipeline Citation: Barad BA*, Medina M... |
5734ab0daa74381599bf01b7b3c6ceb9b29907fc05160d1e2f28327e109de1a8 | Python | 13,491 | 281 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
from typing import Any
import torch
import torch.nn.functional as F
from torch import nn
from ultralytics.utils.metrics import bbox_iou
from ultralytics.utils.ops import linear_sum_assignment, xywh2xyxy, xyxy2xywh... |
78eb15a972600060483d90fca48ef419ef6eab41d77ce5a31862837c476dd8e4 | Python | 13,492 | 356 | import glob
import os
import torch
import nibabel as nib
import numpy as np
import scipy.ndimage as ndi
import matplotlib.pyplot as plt
from model_Vnet import VNet
os.environ["CUDA_VISIBLE_DEVICES"] = "0" # Only use GPU 0
os.environ["PYTORCH_CUDA_ALLOC_CONF"] = "max_split_size_mb:256"
torch.cuda.empty_cache()
torch.c... |
1a2c8fd23cc899532ae9f24b3c8e222f7261ab2092d2ddc3c1c9b8f388e8fde1 | Python | 13,499 | 428 | """VGG models."""
from typing import Any
import numpy as np
import torch
from torch import nn
from modules.activation import LIF
from modules.conv2d import SpikingConv2d, SpikingEiConv2d
from modules.linear import SpikingLinear, SpikingEiLinear
from modules.norm1d import SpikingBatchNorm1d, SpikingEiNorm1d
from modu... |
a70f71850e6e2f44ffd0dbd448d8a79f9b697dac78083061337107fe34667370 | Python | 13,499 | 373 | # Source: https://github.com/neuraloperator/neuraloperator/blob/main/neuralop/layers/fno_block.py
from typing import List, Union
import torch
from torch import nn
import torch.nn.functional as F
from .mlp import MLP
from .normalization_layers import AdaIN, InstanceNorm
from .skip_connections import skip_connection
f... |
b103a5eefe1bc10f40699e368057b68d13694e4551dc847e229dd8959be85210 | Python | 13,500 | 421 | #!/usr/bin/env python
# coding: utf-8
import math
from collections import OrderedDict
import torch
from torch import nn
from torchvision import transforms
from torchmetrics.functional import pearson_corrcoef, spearman_corrcoef
import torch.utils.model_zoo
import os
from PIL import Image
from torch.utils.data import Da... |
3acbeffe39c35c35b2d9651057e68d7f0ac05e5bb9f539bee4d360f3594a2c1f | Python | 13,503 | 376 | import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader, Dataset
import numpy as np
import os
import argparse
from tqdm import tqdm
import matplotlib.pyplot as plt
from config import Config
from model import SMoE_DOA_Estimator
from data_generator import DataGe... |
02b8aadf91893008460c51b18013e39efc21db9bd93dd34497258010d559e0a1 | Python | 13,504 | 307 | #!/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... |
349dc0fd90aecc1a1aba24225558f3677b9b33e0623785e6a0fbcdab65ed93c4 | Python | 13,504 | 381 | import pandas as pd
import numpy as np
from tqdm import tqdm
from nest.cci.spatial import compute_spatial_transport_matrices
from nest.data import load_database
from scipy.stats import mannwhitneyu
from scipy.stats.mstats import gmean
try:
from scipy.sparse import csc_array
except ImportError:
# scipy 1.7 c... |
46104983d77368170f0ce50e66f94b851aeefc5881b40bc117488bc0ed7150da | Python | 13,505 | 344 | # -*- 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/... |
97c71d5833bd0dfa9b802432d4a7314761630a7d3f164d21d69c1014ef70dd3d | Python | 13,506 | 361 | import sys
sys.path.append('..')
import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
from dgl.nn import SumPooling, SetTransformerEncoder, SetTransformerDecoder, WeightAndSum
from common.utils import get_interface_nodes, get_cdr_interface, mdn_message, mdn_score
class Parametization(nn.Module... |
1effb3e550236d63b79743d0e59902bf70102d252d003a25fb86953180178c42 | Python | 13,508 | 311 | """
Unit tests for AVPENet components.
Run with: pytest tests/ -v
"""
import pytest
import torch
import numpy as np
# ──────────────────────────────────────────────────────────────────────────────
# Audio Encoder
# ──────────────────────────────────────────────────────────────────────────────
class TestAudioEncode... |
19c667484e284851ebb1c2dfeb6a7d3cd5f5b3a5d9d458577eb1cce760fc0ab9 | Python | 13,514 | 305 | """
This schema copies recent data from common_psy for uploaded to the cloud
"""
import datajoint as dj
from pipeline import mice # needed for referencing
import numpy as np
schema = dj.schema('pipeline_vis', locals())
schema.spawn_missing_classes()
@schema
class Session(dj.Manual):
definition = """ # Visual ... |
ca55f89aabd9d8889babdcd78159699b75f257dde054e4c520552966add2c59a | Python | 13,516 | 367 | import sys
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
plt.switch_backend('agg')
from sklearn.decomposition import PCA
from util import read_expr, read_list, read_symbols, get_symbol
import argparse
import os
import matplotlib as mpl
mpl.rcParams['axes.spines.left'] = True
mpl.rcParams['axes.... |
66775dbdd724eb4cec917828e96dc96726a4a9199dfa501b4cae51c099c7ed1a | Python | 13,519 | 394 | """Registry for ChemGraph's in-process LangChain tools."""
from __future__ import annotations
import importlib
import importlib.util
import os
from collections.abc import Iterable
from dataclasses import dataclass, field
from pathlib import Path
from typing import Literal
from langchain_core.tools import BaseTool
f... |
d2ecba4d67a3624c5b740965766aaac27a6fdd002eebeda9f0f98d41ab80410c | Python | 13,520 | 332 | """A local cache for remote files, bounded by a byte budget.
This is what lets a batch larger than the disk run at all: fetch a recording,
analyse it, drop it, fetch the next. The pipeline already works one recording at
a time and — since :mod:`meanap.catnap.derived` — reads each one exactly once,
so peak usage is one... |
30da504d0d60350d6671ab7dab357dcc3a267a38a5353e297dfeb0d1f6329ee1 | Python | 13,522 | 307 | #Lucas Sancéré -
import glob
import os
import numpy as np
from skimage.measure import regionprops
from tqdm import tqdm
def count_cells(classmap_folder: str,
instancemap_folder: str) -> tuple[int, list, np.ndarray]:
"""
Count number of cells for each class, for each classmap in a folder. It... |
9bb832bfc78128a0c78f4c6c28daf91241e765aa5eff67377e1eb1c6fd8e12fd | Python | 13,522 | 480 | import os
import numpy as np
from numpy import zeros
import time as time
import torch
def batchloader(Output,Target,batch_size,idx0):
# Input: Output = [x,y,z,te], Target = [x,y,z,unknowns], batch_size = [bx,by,bz], idx0 = [cx,cy,cz] in batch center
# Output: Output_batch = [1,te,bz,by,bx] Target_batch = [1,u... |
664fcd1cb4aa3ed09df3908c6483e7e229082452fec8b484cbe5532a264f7222 | Python | 13,523 | 398 | #!/usr/bin/env python
# author: Jannes Spangenberg
# github: https://github.com/JannesSP
# website: https://jannessp.github.io
import multiprocessing as mp
import pysam
import signal
import sys
import zstandard as zstd
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, Namespace
from collections impor... |
9395c605ddd07c32e538c7c38c377cb47efe955ed703c566c4ffa25584480d68 | Python | 13,525 | 393 | from typing import List, Union
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import Tensor
from skoots.lib.morphology import binary_erosion
from skoots.lib.utils import crop_to_identical_size
def tversky_graphable(pred, gt, alpha, beta):
true_positive: Tensor = pred.mul(gt).sum()... |
f3a9cf7042badfadca96452557b564f8beb0c6c818102913de4ef662a6969020 | Python | 13,529 | 361 | """
Rotation Settings Widget for Quadrant Folding
This widget provides UI controls for setting the rotation angle of images,
including interactive rotation, manual angle entry, and auto orientation configuration.
"""
from PySide6.QtWidgets import (
QLabel,
QPushButton,
QGridLayout,
QDialog,
QVBoxL... |
cac872340acc55dba8bff8ae62d471dd4ac6cbc36c51d262b3eedbe65a1b17c5 | Python | 13,535 | 380 | from __future__ import annotations
from dataclasses import replace
from typing import TYPE_CHECKING, Optional, Tuple, Union
import napari
import napari.layers
import numpy as np
from PyQt5.QtWidgets import QApplication
from brainways.pipeline.brainways_params import BrainwaysParams, CellDetectorParams
from brainways... |
6aa1291c89080fb5e8c47c54179ad7c90d1cf430ed20f4d7f8af62115245302c | Python | 13,536 | 329 | import sys
from matplotlib import pyplot as plt
import yaml
import os
import numpy as np
import h5py
import git
n_tints_min = 6 #minimum number of tints needed to calculate mean and std
nmin_per_block = 3 #minimal number of tints per block to calculate quantity
mininput_ifn = 4 #min_nspike_per_trial = mininput_ifn+2#n... |
1355a361a5e8afcd05ef61766fb2617d29265536876c114745e5e4c065e3337d | Python | 13,538 | 253 | from .HRCHYCytoCommunity import HRCHYCytoCommunity,HRCHYCytoCommunityGrand
from sklearn.metrics import fowlkes_mallows_score, mean_absolute_percentage_error
from .dataset import SpatialOmicsImageDataset
from ..visualization.visualization import load_base_data, vis_heatmap
from collections import defaultdict
import nump... |
5a2497aadc452593a1dfea2431d7f94131cf1d5cb150d982850af185a5ba5fd4 | Python | 13,538 | 308 | import torch
import torch.nn.functional as F
import numpy as np
from torch import nn
from .utils import gaussian_kernel, circular_kernel, gabor_kernel
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
EPSILON = 1e-4
class Identity(nn.Module):
def forward(self, x: torch.Tensor, *args) -> torc... |
650ebe1e9fa0c25835f01852cdbb190a68b9004d1a60ac8530d4840406877e0f | Python | 13,538 | 198 | from nipype.interfaces.base import (CommandLine, CommandLineInputSpec, traits, TraitedSpec,
BaseInterface, BaseInterfaceInputSpec, File)
from nipype.interfaces.matlab import MatlabCommand
import re
import os
import shlex
import subprocess
from traits.api import Directory, Str, List, ... |
4dfc2b110d7f9c75b8e69b2574a9cb534548c012a582860ba6d4422cbacc4bd4 | Python | 13,541 | 353 | import glob
import os
import torch
import nibabel as nib
import numpy as np
import scipy.ndimage as ndi
import matplotlib.pyplot as plt
from model_Vnet import VNet
from monai.networks.nets import BasicUNet, DynUNet
from monai.networks.layers import Norm
os.environ["CUDA_VISIBLE_DEVICES"] = "0" # Only u... |
9272a0c08754ede13ac868f87f066fba8493a008f49763b9f88f1493f3a25ba8 | Python | 13,541 | 326 | # -*- coding: utf-8 -*-
import gc
import logging
from time import time
import warnings
from dipy.align.streamlinear import (BundleMinDistanceMetric,
StreamlineLinearRegistration)
from dipy.segment.fss import FastStreamlineSearch, nearest_from_matrix_col
from dipy.segment.clusterin... |
1a77ffe44ae70906a600ed03b65122f37ee6ef7181f01bf092be285cc27ea80b | Python | 13,545 | 370 | # -*- coding: utf-8 -*-
import numpy as np
import logging
import inspect
import os
import tempfile
import contextlib
import warnings
import scilpy
from dipy.utils.optpkg import optional_package
cl, have_opencl, _ = optional_package('pyopencl')
@contextlib.contextmanager
def _redirect_fds_to_devnull(*fds):
"""Tem... |
0c1c954379649f1a51d8e1b77564b70fb18416365bc604909d61cbe4b96d2822 | Python | 13,551 | 346 | import torch
import torch.nn as nn
__all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101',
'resnet152', 'resnext50_32x4d', 'resnext101_32x8d',
'wide_resnet50_2', 'wide_resnet101_2']
model_urls = {
'resnet18': 'https://download.pytorch.org/models/resnet18-5c106cde.pth',
'r... |
c4008dddd44320d4041ae1d001b504cb16b8c07f48adc6faea54495d237d7d99 | Python | 13,551 | 361 | ##################################################################################
### Module : filebrowser.py
### Description : Remote(Local) File browser
###
###
###
### Written by : scalphunter@gmail.com , 2022/10/07
### Copyrights reserved by NIRAL
#################################################################... |
befa3ad2222203bb02d7b6a0f076817524c13394f543d0caeaeab465606441f5 | Python | 13,554 | 354 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
import itertools
from glob import glob
from math import ceil
from pathlib import Path
from typing import Any
import cv2
import numpy as np
from PIL import Image
from ultralytics.data.utils import exif_size, img2la... |
ad3262bf7f8f90391dbb2b913c18d19001acdc67cd7248d35766fbe797df067f | Python | 13,556 | 293 | # -*- coding: utf-8 -*-
"""
Created on Sat Mar 30 15:13:03 2024
@author: aka2333
"""
#%%
import time
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
import numpy as np
import pandas as pd
from functions import Get_trial, Get_spikes, spike_selection, spike2freq, bslFreqV, ... |
2c69cabd00840f3c1bf9081d9c10cc8b2e595b64344f9fadfcfc628486db9fb2 | Python | 13,558 | 375 | from pathlib import Path
import pandas as pd
from tqdm import tqdm
from transformers import RobertaTokenizer, RobertaModel
import torch
import numpy as np
import os
from torch_geometric.data import Data, HeteroData
def get_data_dir(server_id):
if server_id == "206":
return Path("/new_temp/fsb/Twibot22-base... |
86564ca44a6517e49f6511637d19bca92a60a342f2285de0bf6e69259cdf5aff | Python | 13,563 | 421 | from __future__ import annotations
import json
from pathlib import Path
from typing import Final
import pytest
from PySide6.QtCore import QPointF
from PySide6.QtCore import Qt
from PySide6.QtWidgets import QMessageBox
from pytestqt.qtbot import QtBot
import labelme._app
import labelme._save_request
from labelme._app... |
b1e5e1c7b158a0a7e0b5919425819664fe219b3122c595bcd833509ba5da3f89 | Python | 13,569 | 363 | import argParser as ARG
ARG.initArgs() #init arguments before loading other modules
import torch
import torch.nn as nn
from torch.amp import GradScaler, autocast
from torch.utils.data import Dataset, DataLoader
from ChexpertDataset import ClassificationChexpertDataset
from NetworkModel import getModelClass
from tqdm i... |
c82f9baba7c61046b1f5d743ea9b281ea3345e200a832e9d44987b4f551ebdf0 | Python | 13,574 | 376 | """
Training script for AVPENet.
Implements the two-stage training protocol from the paper:
Stage 1 (epochs 1–30): Freeze encoders, train fusion + head only
Stage 2 (epochs 31–100): Unfreeze all, differential learning rates
Usage:
python scripts/train.py --config configs/avpenet_base.yaml
torchrun --... |
a62ebf305ecba828eba672e6dc4d7bf59060974fa4eb2f8fd4aeb23b5d33f568 | Python | 13,575 | 482 | import json
from collections.abc import Sequence
from pathlib import Path
import matplotlib.patheffects as pe
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from docs.doc_modules.experiments import (
AutoDocExperimentInfo,
get_data,
run_capture_and_save,
)
from docs.doc_modules.h_s... |
bba20b383bccf2fe4cedbe6db0c431d3a7ec2c29af2cb4a46a2895863ae979f5 | Python | 13,579 | 222 | #!/usr/bin/env python3
"""
03-methyl-tpm-correlation.py
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Calculate representative probe-level correlations between rna-seq (tpm) and methylation (beta/m-vlaues) for patients who have samples in both datasets
"""
__author__ = ('Eric Wafula (wafulae@chop.edu)')
__version__ = '2.0'
__date__... |
37161a6c16827521bc682ea6fca6351188294e2dfd9721ef17df5b67f6380e02 | Python | 13,580 | 312 | """
Unsupervised movement surprise scoring.
Three modes (in order of preference):
1. jepa (default when full checkpoint available)
Mean MSE between predictor output and target encoder embeddings over
N random spatiotemporal masks. Directly measures what the model finds
hard to predict. Requires cont... |
435950f8e42105dbc9d3e31a02db9ea951369edc4c720e341ad2deff5f0ad9c1 | Python | 13,584 | 420 | # 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, ... |
6de89cbd625b1133e18e951d04885819712e1df5568dbe8f39be7596787e6b52 | Python | 13,588 | 409 | import qt
import vtk
from slicer.util import VTKObservationMixin
import json
import slicer
import CurveToBundle
class MultiHandleSliderWidget(qt.QSlider, VTKObservationMixin):
def __init__(self):
qt.QSlider.__init__(self)
VTKObservationMixin.__init__(self)
self.setOrientation(qt.Qt.Horizo... |
6a94ecfb3162c864959ff34899d30eaf2e95f888606f452e0f8fc49b12d5e591 | Python | 13,591 | 347 | import os
import re
import pprint
import shutil
import logging
import sys
import argparse
from collections import defaultdict
import torch
from torch.utils import data as torch_data
import torchdrug
from torchdrug import core, data
from torchdrug.utils import comm, plot
import pandas as pd
import os
import json
im... |
4c1682f5c9c77bfef62d9306eb439eca4f393fdf7fe51ea9db2238a4522087f9 | Python | 13,594 | 433 | #!/usr/bin/env python
# Example utilizing the **`LFPykit`** module (https://lfpykit.readthedocs.io,
# https://github.com/LFPy/LFPykit) for predictions of extracellular
# potentials using the line source approximation implementation
# `LineSourcePotential` with a passive neuron model set up in Arbor
# (https://arbor.re... |
89458884c77535418e9133ffc483c18fc8ddd8efb073f3de5b937544ac5242b6 | Python | 13,595 | 347 | 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" #... |
68d69c77cd4e3189aa3485126b6d6590f1482847cc1353b1788768d400788132 | Python | 13,598 | 390 | import torch
import torch.nn as nn
from einops import rearrange
from einops.layers.torch import Rearrange
from torch.utils.checkpoint import checkpoint
from functools import partial
def apply_dropout(*, tensor, rate, is_training, broadcast_dim=None):
"""Applies dropout to a tensor."""
if is_training and rate ... |
148e816aadc249c7fc2f93fe516ea7273bc937c2bc550ab44aa537d66df196a4 | Python | 13,599 | 314 | """Model registry: a single fit/predict_proba interface over every comparator."""
from __future__ import annotations
import logging
import warnings
from contextlib import contextmanager
import numpy as np
import torch
import torch.nn as nn
from .models.anfis import ANFIS
from .models.nn import RGNFT, SingleBranch
fr... |
bcd2e6c082932af94d3c7a7b380574308b93dd9545d52f48c206e87503d6201e | Python | 13,599 | 334 | #!/usr/bin/env python
"""
HAL module for controlling a Tiger controller.
Hazen 05/18
"""
import math
from PyQt5 import QtCore
import storm_control.sc_library.halExceptions as halExceptions
import storm_control.hal4000.halLib.halMessage as halMessage
import storm_control.sc_hardware.baseClasses.amplitudeModule as am... |
3119a81e56fb586168995293373445fdc084fcce8401b16ff38126f4ea51e72a | Python | 13,600 | 340 | # 1. Standard library imports
import os
import shutil
import time
import json
# 2. Third-party imports
import torch
from torch import nn
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
import torch.utils.data as Data
import torch.optim as optim
from model import GP_WAITER as ... |
547fb9425c1331741877e5ed1b8237b76017fef8ebeb5507ebe6ae63703513d7 | Python | 13,600 | 319 | """Provider-reported usage accounting, independent of conversation snapshots."""
from __future__ import annotations
from copy import deepcopy
from datetime import datetime, timezone
import logging
import threading
import time
import uuid
from typing import Any
from langchain_core.callbacks import BaseCallbackHandler... |
5a139a4af5f16996a72e87bef7913adc97ec3734830c9bd73e9da2e32963fde9 | Python | 13,602 | 398 | import argparse
import re
import Levenshtein
import json
import numpy as np
from tqdm import tqdm
parser = argparse.ArgumentParser()
parser.add_argument('--datasets')
args = parser.parse_args()
datasets = args.datasets
if datasets in ('Twibot-20', 'cresci-2017', 'cresci-2015'):
path = f'../../datasets/{datasets}... |
10d1daf1d9a8ee885b790450920a45e66fd014a582573b1c6a1626ada340797e | Python | 13,603 | 473 | import collections
import glob
import logging
import os
import re
import numpy as np
import scipy.stats
import torch
NUMPY_RANDOM = np.random
class Identity(torch.nn.Module):
def __init__(self):
super().__init__()
def forward(self, x):
return x
def pos_inf(dtype):
return torch.finfo(d... |
7866659570237870c48ea4cd236d282a52f112737dc92636a7bf4b8d4fc8fdf5 | Python | 13,607 | 353 | import os
import matplotlib.pyplot as plt
import numpy as np
from scipy.optimize import linear_sum_assignment
from seaborn import heatmap
######################
### METRICS
######################
def get_fast_pq(true, pred, match_iou=0.5):
"""
From Hovernet paper code.
https://github.com/vqdang/hover_net/blob/... |
5a8d4021d16a0d3b0154ce847dfb409b0487700378d775e33c7a2cc0273ae0d4 | Python | 13,608 | 406 | # Copyright (C) 2022 Intel Corporation
# Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import json
from copy import deepcopy
from http import HTTPStatus
from typing import Any
import pytest
from cvat_sdk import models
from cvat_sdk.api_client.api_client import ApiClient, Endpoint
from deepdiff im... |
426cbad9b855a6918b1fb70255542292de8e247d81f9e2817579ec9f77e6a999 | Python | 13,612 | 262 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
import io
import os
import cv2
import torch
from ultralytics import YOLO
from ultralytics.utils import LOGGER
from ultralytics.utils.checks import check_requirements
from ultralytics.utils.downloads import GITHUB_... |
84e85b359c4cd0e93412bb09d630bf2adee3d543caaadfc6e8c358c871ec1288 | Python | 13,612 | 244 | """Portable, epoch-resumable CNN/ViT training for the released OpenPlant splits."""
from __future__ import annotations
import argparse
import random
import time
from pathlib import Path
from .train_utils import (boolean, choose_device, config_dict, create_model, file_sha256,
load_checkpoint,... |
f561d69e295623f8a5e59a304120d9d0366fe5a94512c886eb7202c408417847 | Python | 13,614 | 362 | """Classes for simulating Hidden Semi-Markov Models (HSMMs)."""
from typing import Optional, Union
import numpy as np
from osl_dynamics.simulation.obs_mod import MVN
from osl_dynamics.simulation.base import Simulation
from osl_dynamics.utils import array_ops
class HSMM:
"""HSMM base class.
Contains the pr... |
a0857fa6c69cf262c9cde8fbc8c557565483115109646ecc5ef07a6480fdc1e5 | Python | 13,615 | 395 | import ast
import re
from typing import List, Dict, Tuple, Optional, Any
from dataclasses import dataclass, field
import numpy as np
@dataclass
class ValidationResult:
is_valid: bool
violations: List[str] = field(default_factory=list)
warnings: List[str] = field(default_factory=list)
syntax_errors: Li... |
76c95c9fec4c12ad7c94aefe8c27fdc9af38a71e9e58b247a55de67c2166b712 | Python | 13,623 | 242 | import datetime
import os
import time
import h5py
import signal
import argparse
import numpy as np
import psutil
import pathlib
# from memory_profiler import profile
from neuron_interface.neurosim.cells import L23_PC_cADpyr, L4_LBC_dNAC, L4_LBC_cSTUT, L4_LBC_cACint, L4_NBC_dNAC,\
... |
2c35b1c2498efee1396dcef34e7a9f743d1caf92bd961a2a701c61673e82541d | Python | 13,627 | 322 | ################## PURPOSE #################
# This script is to do PAIR comparisons using the three 3 caller CNVs files
# This script takes in the 3 caller CNVs files and put their content in to a nested dictionary.
# There are 3 dictionaries within the bigger dictionary , each dictionary is the content of a singular... |
c63d6c69fe9112e1cce837e8b6d7ea23bdbcc5b5f0b2576a4855f84d5d47fd41 | Python | 13,632 | 358 | from brainscore_core.supported_data_standards.brainio.assemblies import BehavioralAssembly
from brainscore_vision import data_registry, stimulus_set_registry, load_stimulus_set
from brainscore_core.supported_data_standards.brainio.s3 import load_assembly_from_s3, load_stimulus_set_from_s3
BIBTEX = """@article{geirhos... |
011b2e3d6b513107279fa837f57898d3892345cd98d4d9b1d293cafeee77a8f3 | Python | 13,639 | 272 | import qt, slicer
import numpy as np
import re
import json
from datetime import datetime
from DICOMLib import DICOMUtils
import pydicom as dicom
import StereotacticPlan
from .importerBase import ImporterDialogBase
class ImporterDialog(ImporterDialogBase):
def __init__(self):
ImporterDialogBase.__init__(s... |
8aeba117c71036ba6ea121da7d6185225c457b3e6f62e8e2b15516c302ccba92 | Python | 13,641 | 472 | """Helper functions for manipulating `NumPy \
<https://numpy.org/doc/stable/user/index.html>`_ arrays.
"""
from typing import Callable, List, Optional, Tuple, Union
import numpy as np
def get_one_hot(values: np.ndarray, n_states: Optional[int] = None) -> np.ndarray:
"""Expand a categorical variable to a series... |
71876179c72e7aa8bf08558013bd1fa5f7ca35a204b2784fa12532872086a6e4 | Python | 13,652 | 412 | """
Created on 2025.04.23
Updated on 2026.02.16
Author: Lina Jeantin
Code used for plotting 3D Brain surfaces using mne.viz Brain objects.
Requirements:
subjects_dir: path to fsaverage data for 3D plotting
results: dict containing the results of spectral and complexity analysis (see get_complexity_results.py... |
203391d5d383bad00e6922e8f1ea74360d336e717cca6ee50aabd3c0f9bc18f8 | Python | 13,653 | 246 | from train_gtex import *
class RefAvgModel(LitModelHeadAdapterWrapper):
def __init__(self, tissues_to_train,save_dir,train_dataset,learning_rate,alpha,genes_for_training,genes_for_valid,genes_for_test,eval_test_gene_during_validation = False):
super().__init__(tissues_to_train,save_dir,train_dataset,learni... |
0c32c4adf5245a7688e3d2d350926eb5110db03abade0fbaf42d5bd1024047f4 | Python | 13,658 | 334 | from psychopy import visual, core, event
import pickle
import os
import math
import random
import numpy as np
import pandas as pd
from const import (
STIMULUS_SEQUENCES,
N_BLOCKS,
DISTANCE_FROM_STIMULUS,
TIME_BLOCK,
TIME_WAIT,
STIMULUS_LIST,
TRIGGER_KEY,
ITI,
TERMINATION_KEY,
FIX... |
b3dd49f485ca4b2c0fcf1b1a1dc0bfa25343f86f4e7114c5e07b7a4bd99915a9 | Python | 13,661 | 349 |
"""
This module implements a multi-modal classification system that combines audio and accelerometer data.
It uses a dual-stream architecture where each modality (audio and accelerometer data) is processed
by a separate feature extractor, and then the features are fused for final classification.
The architecture supp... |
66949397d7c4bccc4c4270ccfa69f4b4b50948ff38b5397d59ff6a5d3db61760 | Python | 13,662 | 481 | import json
from collections.abc import Sequence
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from docs.doc_modules.experiments import (
AutoDocExperimentInfo,
get_data,
run_capture_and_save,
)
from docs.doc_modules.h_survival_analysis.utils import get_co... |
d3e8d48c9b4f46fbfa57c231ba95650f36f776bf83fb80002c7c129d1ba1950b | Python | 13,663 | 374 | import os
import glob
import numpy as np
import pandas as pd
import nibabel as nib
import matplotlib.pyplot as plt
import seaborn as sns
from scipy.stats import ttest_rel, wilcoxon
from statsmodels.stats.multitest import fdrcorrection
from nilearn import image, masking, glm, datasets
from ants import apply_transforms, ... |
eeb338ed7e3bd3170e5687fc5ea55b654dc7ec7b552c6897ce98b37e112de13c | Python | 13,663 | 212 | import os
import pandas as pd
import subprocess
from nipype import Node, Workflow
from nipype.interfaces.utility import IdentityInterface, Merge, Function
from cvdproc.pipelines.smri.anat_seg.avp_seg.avpseg import AvpSeg
from cvdproc.pipelines.smri.anat_seg.cp_seg.chpseg import ChPSeg
from cvdproc.pipelines.smri.frees... |
0dc77b5f2d54faa4397d155bc6754540da856cbd9049953b4a391e297984900f | Python | 13,665 | 457 | # 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, ... |
8e99c1cd9b43f430f6438c149777d8fd721f7833e980b90dc584b88dc0b5207e | Python | 13,665 | 261 | from sklearn.metrics import accuracy_score, f1_score, precision_score, recall_score, roc_auc_score
from layer import RGTLayer
import pytorch_lightning as pl
from torch import nn
import torch
# from Dataset import BotDataset
# from torch.utils.data import DataLoader
import argparse
from torch.optim.lr_scheduler import C... |
0d892010bdd3cc2a477b0661079977d4e09efa6921e19e279c9d98dad245cce0 | Python | 13,676 | 360 | import time
import json
import math
import enum
import struct
import typing
import threading
import queue as thread_queue
import random
import logging
import datetime
import asyncio
import functools
from ..config import *
import pathlib
import grpc
from .. import util_pb2
from .. import thalamus_pb2
from .. import tha... |
9d850d019e9cd5b53d72941d3c754a68bf8ba882cfd81f653249ab1b67405ffe | Python | 13,676 | 369 | # based on standard Pytorch and Dali examplary code
import argparse
import os
import builtins
import torch
import torch.backends.cudnn as cudnn
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
import torch.utils.data.distributed
import yaml
# from thop import clever_format
from thop import profi... |
b86fdab84977a144a183498f8b92c2df99587a67d250a87dd61b5347de1f1c5b | Python | 13,676 | 320 | # /------------------------------------------------------------------------------+
# | 28-OCT-2023 |
# | Copyright (c) Bone Imaging Laboratory |
# | All rights reserved ... |
4b4170192525694fd1ecf2a055649d280c6b38ba4116f5bbeac4258799cebc9c | Python | 13,679 | 447 | import numpy as np
from scipy.spatial import KDTree
import torch
import scanpy as sc
from itertools import product
from collections import Counter
from warnings import warn
import random
import scipy
import torch_geometric as pyg
from torch_geometric.data import Data
from torch_geometric.nn import MessagePassing
fro... |
76ae94fa49b687df8c963b84f19d14ba092f8de3d96908b149ee2da414e8abf1 | Python | 13,679 | 460 | from __future__ import annotations
import importlib
import os
import shutil
from collections.abc import Iterator
from pathlib import Path
from typing import Final
from unittest import mock
import osam
import pytest
from PySide6.QtCore import QPoint
from PySide6.QtCore import Qt
from PySide6.QtCore import QTimer
from ... |
7084967a0c19e4b52088dad6d6ff829e1b3604589c856a75abbdcfd3cca152aa | Python | 13,687 | 319 | import anndata
try:
from anndata.base import Raw
except ImportError:
from anndata import Raw
import batchglm.api as glm
import numpy as np
import pandas as pd
import patsy
import scipy.sparse
from typing import List, Tuple, Union
# Relay util functions for diffxpy api.
# design_matrix, preview_coef_names and ... |
8825b5293e5c18eca6ddabdd0d6dfcbe2a3f89b32edc7567c74ccabbbb8536be | Python | 13,688 | 406 | #!/usr/bin/env python
"""
Communicates with the Crystal Technologies AOTF (via USB).
To work around the lack of a 64 bit version of the
AotfLibrary.dll file we handle a aotf communication
using the AOTF32Bit.py script which needs to be
run in 32 bit Python. Then we communicate with it
using basic IPC.
Hazen... |
5743e620e5a9a6c74ae4609499db69edf7939b8332eac712b536b85f59bc8238 | Python | 13,694 | 437 | """Tests for the Table widget."""
import os
import sys
import pytest
from magicgui.widgets import PushButton, Slider, Table
attr_xfail = pytest.mark.xfail(
bool(os.getenv("CI")), reason="periodic AttributeError", raises=AttributeError
)
_TABLE_DATA = {
# column-dict-of-lists
"list": {"col_1": [1, 4], "... |
a3e442dd7cefb77f697a51afb452e7020c168b3034f9ac33383518cc036121f8 | Python | 13,699 | 363 | import base64
from typing import TYPE_CHECKING, Any
import numpy as np
import torch
from scipy.special import softmax
from sklearn.preprocessing import StandardScaler
from eir.models.model_setup_modules.input_model_setup.input_model_setup_sequence import ( # noqa
get_sequence_model,
)
from eir.models.model_setup... |
af5e11a6101b344275c9d1945c5a9ef5124cce832e52128b0d51c498c36e9e08 | Python | 13,708 | 281 | import argparse
from pl_models import *
from datasets import *
import yaml
import wandb
import lightning.pytorch as pl
from lightning.pytorch.callbacks import EarlyStopping, ModelCheckpoint
from lightning.pytorch import Trainer
from lightning.pytorch.loggers import WandbLogger
from torch.utils.data import DataLoader
im... |
85c9de598359291972862df1135dec350656a35425810acd2aa30d2478797ce6 | Python | 13,710 | 313 | """
SPDX-License-Identifier: MIT
SPDX-FileCopyrightText: © 2022 Renaud Bastien, Stephane Sanchez <stephane.sanchez@ut-capitole.fr>
Université Toulouse Capitole - Institut de Recherche en Informatique de Toulouse
Real Expression Artificial Life (REVA) Research Team
https://www.irit.fr/departement/calcul-intensif-simulat... |
ea7ccd2c09baab005caacda3aae5d9f52208d6c66e183ea4a1a9b472233b92de | Python | 13,710 | 331 |
"""
Transformix plugin for Lasagna
Rob Campbell
"""
import os
import re
import subprocess # To run the transformix binary
import time
from PyQt5 import QtGui, QtCore, QtWidgets
import lasagna.utils.path_utils
from lasagna.plugins.lasagna_plugin import LasagnaPlugin
from lasagna.plugins.registration_plugins impo... |
e91cf568bf29859b3643f24eea01eb2cb9d6a3a3c2bbbe401fb9b7e6bec963b8 | Python | 13,713 | 275 | """The CAT-NAP activity rasters — plain and z-scored per cell.
MATLAB draws a ``3_Raster`` for every suite2p recording; the Python port drew
nothing population-wide, only per-cell traces. These checks cover the four
things the new figures depend on: the binning is right (counts per second for
``peaks``, the mean of ea... |
fdceb28f57c16834bfecdc922921da6b0f6ffc5f1fa2022da7badc8e27c14fc4 | Python | 13,713 | 366 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from __future__ import annotations
import contextlib
import itertools
import tempfile
import zipfile
from collections.abc import Iterable, Sequence
from concurrent.futures import ThreadPoolExecutor
from pathlib import Path
from typing import Any, Ge... |
8ca5d177b340c68ddf3567a7d6a74422843fd7c0a0942d76a720762a4d1747c7 | Python | 13,717 | 377 | from collections.abc import Callable
from dataclasses import dataclass
from functools import partial, update_wrapper
from typing import Any
import numpy as np
import polars as pl
import torch
from PIL.Image import Image
from polars.datatypes import DataTypeClass
from polars.datatypes.classes import NumericType
from e... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.