sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
be4e6f5f8c1920f997fefe26f886c43c5e501d21f9d3686bfd46f974f55a1997 | Python | 24,378 | 655 | """
HMAX3 Model Implementation
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
import numpy as np
import random
from ._registry import register_model
def pad_to_size(a, size, mode='constant'):
"""Pad tensor to specified size."""
current_size = (a.shape[-2], a.shape[... |
bb338ab73c4ec4ebbe221db94c2b1c67fbb9ea57e987f336c5cce07d55c54eec | Python | 24,395 | 547 | # Copyright (c) 2026 Rohit Jena. All rights reserved.
#
# This file is part of FireANTs, distributed under the terms of
# the FireANTs License version 1.0. A copy of the license can be found
# in the LICENSE file at the root of this repository.
#
# IMPORTANT: This code is part of FireANTs and its use, reproduction, or... |
c05132f6f34922329a36cd6fd03690e8f2edc05428c5cf36b53f10010ce3aba2 | Python | 24,414 | 763 | import reprlib
from collections.abc import Generator, Iterable, Sequence
from copy import copy
from dataclasses import dataclass
from pathlib import Path
from typing import (
TYPE_CHECKING,
Any,
Optional,
)
import numpy as np
import polars as pl
from sklearn.preprocessing import KBinsDiscretizer
from tqdm ... |
2fa4cc629b7523ab18ffc0a3058406233df125e6d3c9db4118a102c11c6d9bc2 | Python | 24,422 | 480 | """
This module is an example of a barebones QWidget plugin for napari
It implements the Widget specification.
see: https://napari.org/stable/plugins/guides.html?#widgets
Replace code below according to your needs.
"""
from napari.qt.threading import thread_worker
from tqdm import tqdm
from joblib import Parallel, de... |
90d305f8739ce39a5a6945326fa37c9969f77700ab1b041cf4255cfb01cf0fb7 | Python | 24,436 | 492 | # -*- coding: utf-8 -*-
"""
Created on Wed May 14 10:20 2025
@author: Cristiana Pinheiro
"""
import sys
source_path = 'C:/Users/neuro/Desktop/Cristiana/paper_insula/githubINS/'
sys.path.append(source_path+'ft-insulaOS/ENIGMA')
print('You need to change these paths during first use')
import os
import matplotlib.pyplot ... |
af1a98f1de9767602647028ef649c6cc57575277871ba5113088e6aacc9e08ca | Python | 24,465 | 646 | #!/usr/bin/env python3
import os
import numpy as np
import json
import nibabel as nib
from functools import reduce
from scipy.ndimage import (
distance_transform_edt,
binary_dilation,
binary_erosion,
binary_closing,
binary_opening
)
from scipy.spatial import Delaunay, ConvexHull
import os
from nipy... |
ab35cc77afe806c7f79d005dc802c09b172bd3177c4309a31a40d87f762af327 | Python | 24,501 | 476 | # Scaling Up Your Kernels to 31x31: Revisiting Large Kernel Design in CNNs (https://arxiv.org/abs/2203.06717)
# Github source: https://github.com/DingXiaoH/RepLKNet-pytorch
# Licensed under The MIT License [see LICENSE for details]
# Based on ConvNeXt, timm, DINO and DeiT code bases
# https://github.com/facebookresearc... |
bdcb57162dc1553d1a06424f339ead7eff18d8ef188483b5a203a92e868d5c71 | Python | 24,501 | 439 | # Copyright (c) 2026 Rohit Jena. All rights reserved.
#
# This file is part of FireANTs, distributed under the terms of
# the FireANTs License version 1.0. A copy of the license can be found
# in the LICENSE file at the root of this repository.
#
# IMPORTANT: This code is part of FireANTs and its use, reproduction, or
... |
ee08180a693167d5d44e5224370f26dd3bb046e1758c84182eb60fb35dcf3037 | Python | 24,512 | 701 | '''Tests for core functionality in zennit.core.'''
from itertools import product, islice, compress, repeat
import torch
import pytest
from helpers import nograd, prodict
from zennit.core import stabilize, expand, ParamMod, collect_leaves, Stabilizer, uncompress
from zennit.core import Identity, Hook, BasicHook, Remov... |
de506d7e4ed2e3c2793854523e4456f6ac9d59775bb73683fdab8670c6bd8d73 | Python | 24,517 | 560 | """Choosing which MEA-NAP to run, and keeping the cutting edge current.
Opened from the version number beside the Mode selector. Two jobs:
**Stay current.** Someone following ``main`` gets new work as it lands, but only
if they pull it — and most MEA-NAP users do not live in a terminal. The window
checks GitHub when ... |
376f3d300d8fe530abf019819ed66b530b82e58de09a7a1cfd4b272c467a42c2 | Python | 24,519 | 649 | #pylint: skip-file
#type: ignore
"""
Implementation of the simple task
"""
import time
import math
import typing
import asyncio
import logging
import datetime
import numpy as np
import os
import stl
from ..qt import *
from . import task_context
from .widgets import Form, ListAsTabsWidget
from .util import wait_for, ... |
52c2caca0cbec9cdb6ec497928a9bf526f409b01bb56dd47201966aa3196f60d | Python | 24,519 | 565 | # Required libraries
import os
os.environ['PYTORCH_CUDA_ALLOC_CONF'] = "max_split_size_mb:100"
os.environ['KMP_DUPLICATE_LIB_OK']="True"
os.environ['CUDA_LAUNCH_BLOCKING']="1"
import random
import glob
import matplotlib.pyplot as plt
from dataset_patches import MyDataset
from dataset_patches import Custom3DAugmentation... |
abeef0160dc8cdeef3db3eeededd57cfb086887782c04e72341d56d40314fe7f | Python | 24,526 | 701 | # Kai Sandbrink
# 2022-10-30
# This script contains some analyses to run on traces of PeekTake Models
# %% LIBRARY IMPORTS
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import FormatStrFormatter
import pandas as pd
from utils import format_axis
# %% STACKPLOT FUNCTION
def policy_barplo... |
764da32b490b6305c7652fd3436f0f25a25028e36dad0329cbab120ef8e0e343 | Python | 24,554 | 622 | import abc
try:
import anndata
except ImportError:
anndata = None
import batchglm.api as glm
import logging
import numpy as np
import pandas as pd
from typing import List, Union
from ..stats import stats
from . import correction
from .det import _DifferentialExpressionTestMulti
logger = logging.getLogger("di... |
b81c85c3d57ed31cb57a162ad9e9dcbeff761a5b2890490b32987c294528244a | Python | 24,554 | 399 | # Copyright 2018 Google Inc. 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 required by applicable l... |
a72666eb1637f6525638b95727c78e59a869ada88c49d1cbbafba4fd4c8fd753 | Python | 24,581 | 599 | import os
import numpy as np
import torch
from torch import optim
from torch.utils.tensorboard import SummaryWriter
from tqdm import tqdm
import yaml
import cv2
from monai.data import DataLoader
from monai.losses import DiceLoss, GeneralizedDiceLoss, TverskyLoss, SSIMLoss
from monai.transforms import AsDiscrete
from t... |
17dd2ce0140940d674949f35a730daf236d7e1f9b50fd7d83cf9f9b1e9c9e594 | Python | 24,593 | 476 | # Scaling Up Your Kernels to 31x31: Revisiting Large Kernel Design in CNNs (https://arxiv.org/abs/2203.06717)
# Github source: https://github.com/DingXiaoH/RepLKNet-pytorch
# Licensed under The MIT License [see LICENSE for details]
# Based on ConvNeXt, timm, DINO and DeiT code bases
# https://github.com/facebookresearc... |
396a4f91fa14e58d6b67118c2379f3e849c0696cb1e7c51e513ed5365deb2a7e | Python | 24,602 | 708 | import colorsys
import logging
from collections import OrderedDict
import dipy.tracking.streamlinespeed as dps
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
import nibabel as nib
import numpy as np
from dipy.align import resample
from dipy.io.stateful_tractogram import StatefulTractogram
from d... |
15cb2237f97a88c978d6a39c4413d8bd55c134111d93d2cb2c6e19b6560d86e0 | Python | 24,622 | 846 | # -*- coding: utf-8 -*-
"""neutrosophic_xai_stereotactic_neurosurgical_simulation.ipynb
Automatically generated by Colab.
Original file is located at
https://colab.research.google.com/drive/1xwRtYKbi7syiBuEoOTxUP7xiFvhsbhyi
"""
try:
import scikit_posthocs as sp
except ImportError:
!pip install scikit-pos... |
959903ae6db8dbe734833d42e05650b43c56a1c443951ad8b1f9f0b7dbca2568 | Python | 24,660 | 587 | # Required libraries
import os
os.environ['PYTORCH_CUDA_ALLOC_CONF'] = "max_split_size_mb:100"
os.environ['KMP_DUPLICATE_LIB_OK']="True"
os.environ['CUDA_LAUNCH_BLOCKING']="1"
import random
import glob
import matplotlib.pyplot as plt
from dataset_patches import MyDataset
from dataset_patches import Custom3DAugmentation... |
2b88228093f952f74a7f3f77e1235067d10b996bb561370b3ef65f6d5b93f130 | Python | 24,661 | 627 | #pylint: skip-file
#type: ignore
"""
Implementation of the
"""
import time
import math
import typing
import asyncio
import logging
import datetime
import numpy as np
import os
import stl
from ..qt import *
from . import task_context
from .widgets import Form, ListAsTabsWidget
from .util import wait_for, wait_for_ho... |
ef78fbdcd8870f8d3d42246ba794d9b5d1e95523daea7546b5bf76e7259f018e | Python | 24,672 | 586 |
import numpy as np
from sklearn.manifold import TSNE
from openTSNE import TSNE
from sklearn.decomposition import PCA
from sklearn.neighbors import NearestNeighbors
import scipy
import pandas as pd
from umap import UMAP
import pickle
from pysnptools.snpreader import Bed
import alphashape
import seaborn as sns
from skl... |
0bddc3e05455869c8d2b20288dc6531b5fe7fc2872a030ac27e9e3234940735d | Python | 24,691 | 804 | import os
import numpy as np
import pandas as pd
from scipy.optimize import differential_evolution, minimize
from typing import Dict, Tuple, Optional, List
import matplotlib.pyplot as plt
from dataclasses import dataclass
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
from con... |
e1d479d492f032bc8de94fab953a5742abc49707fda26c3e6c61133a0478439d | Python | 24,691 | 712 | # -*- coding: utf-8 -*-
# @Author : NaiChuan
# @Time : 2024/12/7 14:23
# @File : Mobilenetv4.py
# @Software: PyCharm
from timm.models import register_model
from typing import Optional
import torch
import torch.nn as nn
import torch.nn.functional as F
# from torchsummary import summary
def make_divisible(
... |
13d171652c835505854f190dbda1dce8d953abb8a97455f8536429f1e3f809c4 | Python | 24,713 | 460 | # Kai Sandbrink
# 2022-10-01
# This script runs the decoding analyses for the Explore-Exploit Setting
# %% LIBRARY IMPORTS
import torch
import os, copy
import numpy as np
from sklearn.linear_model import Ridge
from sklearn.model_selection import train_test_split
from sklearn.metrics import r2_score, mean_squared_err... |
f312751ea53bd57e0f118cac161096ee548af0c67fac862c265388f58dc73c8f | Python | 24,714 | 751 | # imagecodecs/tests/test_image_layout.py
# Copyright (c) 2026, Christoph Gohlke
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyrig... |
836f969315e1599d79f728c0b3c750d06ba1bfdf66440747d27b7e0f9b42683e | Python | 24,737 | 729 | # -*- coding: utf-8 -*-
"""
Cell type - phenotype association
in zebrafish with anatomical phenotype ontology
"""
import scanpy as sc
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import warnings; warnings.simplefilter('ignore')
import anndata
from scipy.cluster.hierarchy import ... |
4d5f96583aab452d5feff429fb955f96dab8afaca5a62243280a983540c4bc67 | Python | 24,750 | 583 | # Graph activation code
import pandas as pd
import tensorflow as tf
from src import utils
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
import plotly.graph_objects as go
import plotly.io as pio
import numpy as np
def get_act_metric_per_feat(model, num_filters:int, num_patients:int, pat_df:pd.Da... |
dc5ab42ccf4615d1e580dcd2bf9137ac4a047950932eddaf37393c94f7350528 | Python | 24,753 | 604 | from pathlib import Path
import numpy as np
import pandas as pd
from scipy.io import loadmat
from laminar_rs.config import LaminarConfig
from laminar_rs.connectivity import (
within_layer_block_matrix,
fisher_z_to_r,
build_multiplex_adjacency,
thresh_and_binarize,
)
from laminar_rs.gradients import (
... |
6a60c4f113574d54e599c8bce0d16df6512da0bdff7629fd67d1c7f668bbf0d8 | Python | 24,815 | 469 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
# from exact import solve
import inspect
from metamdp import *
import os
## TF set-up:
# https://towardsdatascience.com/introduction-to-tf-agents-a-librar... |
06b0bd03700fabe0287d6ff4b764eee3ffc05eaa286d086cadeb9ac54231858c | Python | 24,827 | 534 | # This library contains helper functions for loading eyetracking data
# from the visual search in VR experiment.
#
# Authors: Bas van Opheusden, Angela Radulescu
import pickle
import numpy as np
import ast
import datetime as dt
import xml.etree.ElementTree as et
from xdf import load_xdf
import scipy.interpolate
import... |
563863b10fc177071ed1048354dde24c7656086f9b71612163e4650840b5191d | Python | 24,832 | 574 | import os
import torch
import json
import numpy as np
import matplotlib.pyplot as plt
from tqdm import tqdm
from ecg_utils import load_label_mappings, plot_ecg
def log_ecg_to_tensorboard_1d(
logger,
ecg_signal,
prototype_idx,
class_1,
class_2,
similarity_score,
save_dir,
save_val=False,... |
a12245a9c6f9f9779ad1fe91b617538050c23a954623160dc7da2b4588714c61 | Python | 24,879 | 680 | import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
from ipywidgets import interact
from sklearn.preprocessing import scale
from Helper_Functions.OrthoViewer import OrthoAxes
import itertools
from scipy.stats import percentileofscore as inv_quantile
import ipywidge... |
3cca5e1b6343c9f1e31c0fc8135eaa627d71793c79468dceb998c142033125ac | Python | 24,891 | 575 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
def LSregress(pred, gt, origin):
nb = pred.size(0)
origSize = pred.size()
pred = pred.reshape(nb, -1 )
gt = gt.reshape(nb, -1 )
coef = (torch.sum(pred * gt, dim = 1) / torch.cl... |
774ff6b295d33cbd583558fac8239b30745e07e855df83416fa0d5c92f47387e | Python | 24,895 | 795 | from pathlib import Path
from typing import TYPE_CHECKING
import numpy as np
import pandas as pd
import torch
from lifelines import KaplanMeierFitter
from matplotlib import pyplot as plt
from sklearn.preprocessing import KBinsDiscretizer
from torchsurv.metrics.auc import Auc
from eir.experiment_io.output_object_io im... |
8c5f2d00171b521cf172fdd561f5d69b28bb07cfbcdecb80572c3ae6b49b102e | Python | 24,901 | 385 | import os
class CactiConfig:
def __init__(self):
# content = f.readlines()
self.baseline_config = ['# power gating\n',
'-Array Power Gating - "false"\n',
'-WL Power Gating - "false"\n',
'-CL Power Gati... |
05fcf2bb23d0f1c45557bfdabc7535adf67ef6ebc795eb0ce4498ce928300fa7 | Python | 24,906 | 668 | import sys
import yaml
import os
from glob import glob
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
from scipy.stats import scoreatpercentile as sap
pathpath,myrun = sys.argv[1:]
'''
pathpath = 'PATHS/filepaths_carlen.yml'
myrun = 'runC00dMP3_brain'
'''
#myrun = runIBLPasdMP3_brain_pj
... |
7af543931fea4261a6a5a1093f5b860e9af775ba58d747105c226e636904e010 | Python | 24,909 | 561 | """
Visualization utility functions.
Author: florian.birk@tuebingen.mpg.de
"""
import sys
import matplotlib.pyplot as plt
from matplotlib.ticker import MaxNLocator
import numpy as np
from pathlib import Path
# Add the parent fop to the path for imports
sys.path.append(str(Path(__file__).parent.parent))
try:
from... |
d392470d62f25c70835e654c4193cc541e039933bce08784f1c2c61b8df6066f | Python | 24,909 | 586 |
#
# utils.py
# 2022-10-09
# Written by SK Park, NIRAL, UNC
#
# Atlasbuilding utilities
#
import os # To run a shell command : os.system("[shell command]")
import sys # to return an exit code
import shutil # to remove a non empty directory
import json
import argparse
import csv
import copy
import xml.etree... |
e50ed6b32ba9ebb8f38c7fb08d8733afc66189825480e794d728fc230e1da023 | Python | 24,910 | 727 | """Ignite training script.
from the repository root, run
`PYTHONPATH=$PYTHONPATH:. python alignn/train.py`
then `tensorboard --logdir tb_logs/test` to monitor results...
"""
from functools import partial
# from pathlib import Path
from typing import Any, Dict, Union
import ignite
import torch
from ignite.contrib.han... |
a84d4c866699e4e5c1075fcc53351fc172e72bc2bfa27f5caa56e120b6d3e09e | Python | 24,913 | 727 | """Ignite training script.
from the repository root, run
`PYTHONPATH=$PYTHONPATH:. python alignn/train.py`
then `tensorboard --logdir tb_logs/test` to monitor results...
"""
from functools import partial
# from pathlib import Path
from typing import Any, Dict, Union
import ignite
import torch
from ignite.contrib.han... |
da509523f9acd0c223aaa9aed77493aad89a675c60787c6a3ee4371fa379ec21 | Python | 24,915 | 545 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
from typing import Any
import numpy as np
from ..utils import LOGGER
from ..utils.ops import xywh2ltwh
from .basetrack import BaseTrack, TrackState
from .utils import matching
from .utils.kalman_filter import Kalm... |
3ca7abb8fd5fcb0526ec40fc4cf2817471aaddad61d66993ed78fdf4dc0eeb0b | Python | 24,924 | 659 | # coding: utf-8
from typing import Any, Dict, Optional
from zoneinfo import ZoneInfo
import numpy as np
import pytest
import lightgbm as lgb
from .utils import assert_datasets_equal, np_assert_array_equal
pd = pytest.importorskip("pandas")
# ------------------------------------------------------------------------... |
056f39979acf45b91f348d8f8173e0c0edf2e9e0394bc42244b66bf58f1a3647 | Python | 24,942 | 761 | import shapely
import shapely.ops
import numpy as np
import scipy.spatial.distance as distance
from functools import partial
from neuron_morphology.snap_polygons.geometries import (
Geometries, make_scale, clear_overlaps, closest_from_stack,
get_snapped_polys, find_vertical_surfaces, select_largest_subpolygon
)... |
b25d1cdbe7cabb94041236ae14fde60a1669d3dbd2a16cfc42ce8a57b348cb53 | Python | 24,956 | 729 | from collections.abc import Callable, Generator, Sequence
from dataclasses import dataclass
from pathlib import Path
from typing import (
TYPE_CHECKING,
Any,
Optional,
)
import numpy as np
import pandas as pd
import torch
from sklearn.preprocessing import LabelEncoder, StandardScaler
from eir.data_load.la... |
ba6938affcbb9dc34541b86eb2bf32c582f3c685919790cfb0d00fbae62fcce8 | Python | 24,956 | 571 | #!/usr/bin/env python
# coding: utf-8
'''
Functions related to density estimation from MERFISH slices
'''
# helper functions . py
import os
import matplotlib.pyplot as plt
import numpy as np
from scipy.spatial import Delaunay
import pandas as pd
def calculate_density_mm3(section, volume_single_cube_mm3, selected_reg... |
cf5abbd0b4f3d37e609b17b7ffb65c31f8d93ac4fbb8fe3997b4c5d0c30921c0 | Python | 24,960 | 657 | """
Implementation of the simple task
"""
import math
import typing
import logging
import datetime
import typing_extensions
import asyncio
import numpy
import scipy.signal
from ..qt import *
from . import task_context
from .widgets import Form, ListAsTabsWidget
from .util import wait_for, wait_for_hold, TaskResult, ... |
6d6b021957a396dc7ff1b98c2a19274ea5b7a7ca9c783be739e345b50739a41e | Python | 24,969 | 780 | #!/usr/bin/env python3
"""
Export sideviews of image stacks with band annotations.
This script loads image stacks and band annotation data from JSON files,
creates optical section "sideviews" (Y-Z cross-sections), and exports them
as multi-channel TIFF images with ON/OFF band annotations in separate channels.
Usage:
... |
ba666448da25124ba8ed699df4869fe63d0b028a7cd45aebe2bd57213fd3144b | Python | 24,973 | 759 | from __future__ import annotations
import functools
import os
from dataclasses import replace
from pathlib import Path
from typing import TYPE_CHECKING, Callable, List, Union
import importlib_resources
import PIL.Image
from brainglobe_atlasapi.list_atlases import get_all_atlases_lastversions
from magicgui import magi... |
b966cd441ca5437dbbe3239df08c60a36743ffa4fc7768d2fbcef750b4f94e5b | Python | 24,978 | 553 | from copy import deepcopy
from typing import Tuple, List, Union
import math
import SimpleITK
import numpy as np
import pandas as pd
import torch
from scipy.ndimage import fourier_gaussian, gaussian_filter
from torch import Tensor
from torch.nn.functional import grid_sample
from batchgeneratorsv2.helpers.scalar_type ... |
aec484c9aae2bc01c308dfdd5f767fae218de6e5914284842524e2b1384fb489 | Python | 24,980 | 762 | 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 numpy as np
import torch
from torch import nn
from eir.models.input.sequence.transformer... |
2ee258eaee13380c5435cf094f842b3ea6c659ca0137b01d379adf0a6a3a93da | Python | 24,987 | 718 | # --------------------------------------------------------
# TinyViT Model Architecture
# Copyright (c) 2022 Microsoft
# Adapted from LeViT and Swin Transformer
# LeViT: (https://github.com/facebookresearch/levit)
# Swin: (https://github.com/microsoft/swin-transformer)
# Build the TinyViT Model
# ------------------... |
a96818516790385d6e00892a1e4765c294bbc9ae3405ad09f763a01cd43b6c66 | Python | 24,994 | 678 | """
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... |
6efa349de9d0c85b1cc9243ede39e57405e10725ff2f0250cb82b2e7fb8ee5c1 | Python | 25,007 | 547 | """Regression tests for EpochByEpochAgreement against the SRI Analytical Pipeline.
Reference values are taken from AnalyticalPipeline_v1.0.0.html (v1.0.0) published at:
https://github.com/SRI-human-sleep/sleep-trackers-performance
https://doi.org/10.1093/sleep/zsaa170
Ground-truth values live in evaluation_sri_fu... |
02212a1aa2bc50a4ee452cbd1734f670f609143185bb0cf3a61181bde2cf92a5 | Python | 25,030 | 594 | """Test the functions in yasa/spectral.py."""
import unittest
from itertools import product
import matplotlib.pyplot as plt
import mne
import numpy as np
import pandas as pd
import pytest
from mne.filter import filter_data
from yasa.detection import (
_check_data_hypno,
art_detect,
compare_detection,
... |
0eee45b80fa3089e6469616d7ee43be9f349fb6089fa49c377ec5cb87766d2ce | Python | 25,032 | 636 | from typing import List, Set, Tuple, Dict
import numpy
from utils.checks import ConfigurationError
def decode_mst(energy: numpy.ndarray,
length: int,
has_labels: bool = True) -> Tuple[numpy.ndarray, numpy.ndarray]:
"""
Note: Counter to typical intuition, this function decodes the... |
db83c18d4443401623f3a1ee3ff317655f21bcbba052b4ec4b006f5a9fb7f536 | Python | 25,034 | 594 | #!/usr/bin/env python3
"""
Shared geometry/format helpers for oriented bounding boxes (OBB), used by the
annotation tools, Regenerate_annotations.py, and the classify/track/live pipelines.
Internal oriented-box convention: a box is defined by a head point, a tail point
(head-tail axis = the object's length), and a wid... |
58079ed613a3194074c44a4d6fcddf5da457ecae307af65ab21f37849e2b53af | Python | 25,038 | 636 | from typing import List, Set, Tuple, Dict
import numpy
from flair.utils.checks import ConfigurationError
def decode_mst(energy: numpy.ndarray,
length: int,
has_labels: bool = True) -> Tuple[numpy.ndarray, numpy.ndarray]:
"""
Note: Counter to typical intuition, this function decod... |
b6bb6ee4765019b0692454d1c333c07c92899a3bb2b98395e2c0d36ab2cf4816 | Python | 25,038 | 691 | # 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 math
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from .modules import (
TransformerLaye... |
69e0a667c2608420ca7b34e625929efb8a4996501683351291ca8f267fda2d78 | Python | 25,039 | 629 | # wfield - tools to analyse widefield data - allen tools
# Copyright (C) 2020 Joao Couto - jpcouto@gmail.com
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License,... |
974bdda852400fca1488003a21873ce091ab12f2f35e60029ab640185ca55d94 | Python | 25,076 | 578 | import os
import shutil
import subprocess
import re
import csv
from pathlib import Path
from typing import Dict, List, Optional, Tuple
import pandas as pd
import nibabel as nib
import numpy as np
from nipype.interfaces.base import File
from nipype.interfaces.freesurfer import ReconAll
from nipype.interfaces.freesurfer.... |
d7f9eb0e1f2c7283db593a3e7bba373a2ba77e8cf39fb3a2919ea3fd21b14530 | Python | 25,090 | 658 | # Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
"""
This evaluator is based upon COCO evaluation, but evaluates the model in a "demo" setting.
This means that the model's predictions are thresholded and evaluated as "hard" predictions.
"""
import logging
from typing import Optional
import nu... |
a8864eca364f31304a11fede7f42f0021f9133ab9eceed7d0f811ab32c7635a3 | Python | 25,103 | 561 | import random
from natsort import natsorted
import numpy as np
import pandas as pd
from typing import Dict, List, Optional, Tuple, Union
import matplotlib.colors as mcolors
from sklearn.preprocessing import MinMaxScaler
from skimage.transform import resize
from scipy.ndimage import gaussian_filter
from scipy.spatial.di... |
9010ab380d9ddab3b29f5a1a1ef86f63fae9ae59bce9da7487e64053ca1b596d | Python | 25,111 | 665 | """
Implementation of the simple task
"""
import math
import typing
import logging
import datetime
import typing_extensions
import asyncio
import numpy
import scipy.signal
from ..qt import *
from . import task_context
from .widgets import Form, ListAsTabsWidget
from .util import wait_for, wait_for_hold, TaskResult, ... |
2408c24cdb194e5da9bd82ec0c79a8861c98624013fd65778251fe6d485da121 | Python | 25,112 | 664 | # -*- coding: utf-8 -*-
"""
Created on Sun Sep 11 01:38:56 2022
@author: aka2333
"""
# In[ ]:
# Import useful py libs
import os
import itertools
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
import numpy as np
from numpy import genfromtxt
import scipy
from scipy ... |
0727ceaefa8bda12f83c9000fb8ebb1887387b42d9ee41d114e78a6375b1ea4c | Python | 25,126 | 668 | import math
from abc import ABC, abstractmethod
from copy import deepcopy
from random import Random
import numpy as np
from typing import Any, List, Tuple, Dict, Set, Generator, Iterable
import ipywidgets as widgets
from sklearn.manifold import TSNE
from sklearn.decomposition import PCA
from matplotlib import pyplot as... |
e600dc537f7d589fe95c8088e49a174d8337c7fe6ce4b352ac7846214b3d98d3 | Python | 25,126 | 631 | # coding: utf-8
import numpy as np
import pandas as pd
import pytest
from sklearn.model_selection import train_test_split
import lightgbm as lgb
from .utils import load_breast_cancer, make_synthetic_regression
@pytest.fixture(scope="function")
def matplotlib():
mpl = pytest.importorskip("matplotlib")
# use ... |
9c2c44a704f8673e0af6136f67108dd41ead7fe9d6b2b1f102cbaaf97f7922c0 | Python | 25,127 | 704 | import torch
import numpy as np
import os
from optparse import OptionParser
from datasets.dataloader import balance_trial_type, keep_trial_types_behaviour
from infopath.model_loader import load_model_and_optimizer
from infopath.config import get_opt, save_opt, config_vahid, config_pseudodata
from infopath.utils.functio... |
cbdace4a429cf8f035ff2965558a71a4cc02e60207f3675f60781a2b9cf5c42e | Python | 25,150 | 619 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
from collections.abc import Callable
from types import SimpleNamespace
from typing import Any
import cv2
import numpy as np
from ultralytics.utils import LOGGER, RANK, SETTINGS, TESTS_RUNNING, env_bool, ops
from u... |
844cb88232c96c62b1269a8f2b85d456fdbf6b2ba22228b47afc222b35906694 | Python | 25,152 | 619 | import numpy as np
import torch
from torch.utils.data import Dataset
from pathlib import Path
import random
from typing import Tuple, List, Optional, Union, Dict
import tifffile
import os
import logging
# Set seeds for reproducibility
random.seed(42)
np.random.seed(42)
torch.manual_seed(42)
if torch.cuda.is_available(... |
ac216db851c4c583dc97908a8552789875339aabf4f2089500edb38eb09767cd | Python | 25,168 | 496 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
import torch
from torch import nn
from ultralytics.nn.modules import MLP, LayerNorm2d
class MaskDecoder(nn.Module):
"""Decoder module for generating masks and their associated quality scores using a transform... |
db92d3c090985cc7a951c193eaec8d94ce98b99a5246f19397ca4ef2d29ad841 | Python | 25,175 | 773 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import json
from abc import ABCMeta, abstractmethod
from collections.abc import Callable, Hashable, Iterable, Iterator, Sequence
from copy import deepcopy
from http import HTTPStatus
from io import BytesIO
from time import sleep
from typing import An... |
132460faf1249cfdfc7a05b2329f4245526533b2d4da46056dc3702864f38433 | Python | 25,205 | 724 | """Test suite for MCP servers."""
from concurrent.futures import Future
import importlib.util
import inspect
import json
from pathlib import Path
import sys
from typing import Any
import pytest
try:
from fastmcp import Client, FastMCP as StandaloneFastMCP
from mcp.server.fastmcp import FastMCP as SDKFastMCP
... |
e4521a72cda4c571bd860aad5b575050097ce51dd87a1b455bd21b18bb83b3c6 | Python | 25,220 | 765 | """Tests for the reusable standalone Deep Agent workflow."""
import hashlib
import json
import os
import shlex
import subprocess
import sys
from types import SimpleNamespace
from typing import Any
import pytest
from deepagents.backends import CompositeBackend, LocalShellBackend, StateBackend
from langchain_core.messa... |
b23e592221205bd9ed08a8d81693ea8f689781f018c31ea5bd7b461c8fe51e6b | Python | 25,251 | 758 | # 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, ... |
035f0cdcdd6644c14945c464af609f310e2c89c3e1eea78d3727f826611c6c15 | Python | 25,255 | 479 | import matplotlib.pyplot as plt
import os
import nibabel as nib
from glmsingle import GLM_single
import glob
from sklearn.pipeline import make_pipeline
from nilearn.maskers import NiftiMasker
from ants import apply_transforms, image_read, from_nibabel
import pandas as pd
from random import sample
from nilearn import im... |
b72955a893c44be6134949f5c92a26ee98d197dc54718207a68ab8fc9847a6a4 | Python | 25,255 | 530 | """
Train the signaling model.
"""
from typing import Dict, List, Union, Literal
import time
import logging
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
import torch
from torch.utils.data import Dataset
from torch.utils.data import DataLoader
import torch.nn.functional as... |
65b575003e597ca7b0ae587baa9846a2f21f59280fd19dd2f9cab4e27ac112ea | Python | 25,262 | 614 | """
Generate all figures comparing Synthetic vs Aspen (Real) data.
This script produces publication-quality figures for both datasets.
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import json
from pathlib import Path
from scipy.optimize import curve_fit
plt.rcParams['font.family'] = 'ser... |
d5382b2f9ff4dd60be1418aaac36bd9b745816fbb3321859e6693a89808998b3 | Python | 25,267 | 664 | from __future__ import annotations
from dataclasses import replace
from pathlib import Path
from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union
import napari
import numpy as np
from napari.layers import Image
from napari.qt.threading import FunctionWorker, create_worker
from qtpy.QtCore import S... |
69d9eb8377244831ae8937e06bcc1ddd241a4625fcf630fe474a911c77790b7c | Python | 25,269 | 724 | # --------------------------------------------------------
# TinyViT Model Architecture
# Copyright (c) 2022 Microsoft
# Adapted from LeViT and Swin Transformer
# LeViT: (https://github.com/facebookresearch/levit)
# Swin: (https://github.com/microsoft/swin-transformer)
# Build the TinyViT Model
# ------------------... |
80248975c4305fcc55f6edaa9d31f8c5063ada575cdc10a25f1eb0dc9ce07cde | Python | 25,270 | 623 | '''
Fixation simulation
-------------------
A simulation of fixational eye movements including drift, tremor and
microsaccades.
'''
import numpy
import yaml
from scipy.optimize import fmin
from ERICA import ERICA_toolkit
class Fixation:
'''A Fixation class. Instances of this class are oculomotor objects... |
cb76fbd55bb9676f94a0dc266bf9baf6e4890dc3a469233dd7d5ac528b48f923 | Python | 25,277 | 639 | #!/usr/bin/env python
"""
Handles remote control (via TCP/IP of the data collection program).
Hazen 05/17
"""
import os
from PyQt5 import QtCore
import storm_control.sc_library.halExceptions as halExceptions
import storm_control.sc_library.tcpMessage as tcpMessage
import storm_control.sc_library.tcpServer as tcpServ... |
7fc162e2618baf16f6789abaed025040443d2a60fa440bb44aa44c898edeada5 | Python | 25,278 | 737 | from collections.abc import Callable, Generator, Sequence
from dataclasses import dataclass
from pathlib import Path
from typing import (
TYPE_CHECKING,
Any,
Optional,
)
import numpy as np
import pandas as pd
import torch
from sklearn.preprocessing import LabelEncoder, StandardScaler
from eir.data_load.la... |
34b00764073fa5c5fb2bac0844f767ce2c5640f51f8a8c0e7795f399a674afe2 | Python | 25,287 | 634 | #############################################################################
# Copyright (C) 2020-2026 MEmilio
#
# Authors: Kathrin Rack
#
# Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Licen... |
d22ace21a9da89df1f4baadeb6b38a13eed05f5b2793b186ee33d54d847e3b1f | Python | 25,293 | 739 | import warnings
from typing import Any
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import seisbench.util as sbu
from .base import ActivationLSTMCell, CustomLSTM, WaveformModel
# For implementation, potentially follow: https://medium.com/huggingface/from-tensorflow-to-pytor... |
01d4fba1e3145c5924bfd1d6c86af689e4b816d8ab68d3f17efdb48f806af554 | Python | 25,296 | 561 | from __future__ import annotations
import os
import csv
import os.path
import pickle
import datetime
from tqdm import tqdm
from metaphlan.utils.merge_metaphlan_tables import merge
from .utilities import run_cmd, ReadsData, check_conda_qiime2
import json
import shutil
from .generate_pathways import run_huma... |
0076f05e541a04730cdffd31482eeb03cdd1a2445b1c14c40d0f1ff124c3fbd4 | Python | 25,298 | 683 | # mapping = {
# "default": {
# "core_allocation": 1,
# "spatial_mapping": {"D1": ("C", 16), "D2": ("K", 16), },
# "temporal_ordering": (('OX', 56), ('OY', 56), ('FX', 3), ('FY', 3), ('C', 4), ('K', 3), ('T', 1), ('B', 1)),
# "memory_operand_links": {"O": "O", "W": "I2", "I": "I1"},
#... |
0125371c4c5000d1db9496c1facfcc9bc19307c264cb5c85b5f66c6d02dc5ae2 | Python | 25,298 | 683 | # mapping = {
# "default": {
# "core_allocation": 1,
# "spatial_mapping": {"D1": ("C", 16), "D2": ("K", 16), },
# "temporal_ordering": (('OX', 56), ('OY', 56), ('FX', 3), ('FY', 3), ('C', 4), ('K', 3), ('T', 1), ('B', 1)),
# "memory_operand_links": {"O": "O", "W": "I2", "I": "I1"},
#... |
06690e26d826e927e6a3e4cdeb79ec52ab748354c55d7efdd7c136bfe35d9c04 | Python | 25,298 | 683 | # mapping = {
# "default": {
# "core_allocation": 1,
# "spatial_mapping": {"D1": ("C", 16), "D2": ("K", 16), },
# "temporal_ordering": (('OX', 56), ('OY', 56), ('FX', 3), ('FY', 3), ('C', 4), ('K', 3), ('T', 1), ('B', 1)),
# "memory_operand_links": {"O": "O", "W": "I2", "I": "I1"},
#... |
095251eaabeffc87dc8e4e50777baa46c9d5ea5b839bdefc68a1898f3cec2231 | Python | 25,298 | 683 | # mapping = {
# "default": {
# "core_allocation": 1,
# "spatial_mapping": {"D1": ("C", 16), "D2": ("K", 16), },
# "temporal_ordering": (('OX', 56), ('OY', 56), ('FX', 3), ('FY', 3), ('C', 4), ('K', 3), ('T', 1), ('B', 1)),
# "memory_operand_links": {"O": "O", "W": "I2", "I": "I1"},
#... |
0a3b785e6e999d2ab139e4fefb2fa5bfbe6a0a19be2cc2978e735124cfdfaee0 | Python | 25,298 | 683 | # mapping = {
# "default": {
# "core_allocation": 1,
# "spatial_mapping": {"D1": ("C", 16), "D2": ("K", 16), },
# "temporal_ordering": (('OX', 56), ('OY', 56), ('FX', 3), ('FY', 3), ('C', 4), ('K', 3), ('T', 1), ('B', 1)),
# "memory_operand_links": {"O": "O", "W": "I2", "I": "I1"},
#... |
0b66b3aa9eb4937f976a1334ff03a4bcf720d6f3cf6396656f2905f67611f2e3 | Python | 25,298 | 683 | # mapping = {
# "default": {
# "core_allocation": 1,
# "spatial_mapping": {"D1": ("C", 16), "D2": ("K", 16), },
# "temporal_ordering": (('OX', 56), ('OY', 56), ('FX', 3), ('FY', 3), ('C', 4), ('K', 3), ('T', 1), ('B', 1)),
# "memory_operand_links": {"O": "O", "W": "I2", "I": "I1"},
#... |
0cd22df599b3545f58539de9ab601d79d26984f9163f0e04cba45a9548b28a5a | Python | 25,298 | 683 | # mapping = {
# "default": {
# "core_allocation": 1,
# "spatial_mapping": {"D1": ("C", 16), "D2": ("K", 16), },
# "temporal_ordering": (('OX', 56), ('OY', 56), ('FX', 3), ('FY', 3), ('C', 4), ('K', 3), ('T', 1), ('B', 1)),
# "memory_operand_links": {"O": "O", "W": "I2", "I": "I1"},
#... |
0e18352c500d83ff9cc1aa7c57266beb459b30ff9e754048227b7f785d88a2fd | Python | 25,298 | 683 | # mapping = {
# "default": {
# "core_allocation": 1,
# "spatial_mapping": {"D1": ("C", 16), "D2": ("K", 16), },
# "temporal_ordering": (('OX', 56), ('OY', 56), ('FX', 3), ('FY', 3), ('C', 4), ('K', 3), ('T', 1), ('B', 1)),
# "memory_operand_links": {"O": "O", "W": "I2", "I": "I1"},
#... |
175e1b79be239c586255ab87e5b12e08c401d870257e35ed973c645e8d4236f3 | Python | 25,298 | 683 | # mapping = {
# "default": {
# "core_allocation": 1,
# "spatial_mapping": {"D1": ("C", 16), "D2": ("K", 16), },
# "temporal_ordering": (('OX', 56), ('OY', 56), ('FX', 3), ('FY', 3), ('C', 4), ('K', 3), ('T', 1), ('B', 1)),
# "memory_operand_links": {"O": "O", "W": "I2", "I": "I1"},
#... |
18432e80f4e97694257abb0fed8f0e6ec0dcff66ac8bd1bf5c5b6c3f84d6d1a5 | Python | 25,298 | 683 | # mapping = {
# "default": {
# "core_allocation": 1,
# "spatial_mapping": {"D1": ("C", 16), "D2": ("K", 16), },
# "temporal_ordering": (('OX', 56), ('OY', 56), ('FX', 3), ('FY', 3), ('C', 4), ('K', 3), ('T', 1), ('B', 1)),
# "memory_operand_links": {"O": "O", "W": "I2", "I": "I1"},
#... |
1bf654173889109bb5b22edcb70414c70c7d780d51e42a3f0ea3c9d9ddc1749b | Python | 25,298 | 683 | # mapping = {
# "default": {
# "core_allocation": 1,
# "spatial_mapping": {"D1": ("C", 16), "D2": ("K", 16), },
# "temporal_ordering": (('OX', 56), ('OY', 56), ('FX', 3), ('FY', 3), ('C', 4), ('K', 3), ('T', 1), ('B', 1)),
# "memory_operand_links": {"O": "O", "W": "I2", "I": "I1"},
#... |
1cdca9c608d5ecce511a20d5b77e75aefe41bd4e0a58cdee7d7fa503b7342ad6 | Python | 25,298 | 683 | # mapping = {
# "default": {
# "core_allocation": 1,
# "spatial_mapping": {"D1": ("C", 16), "D2": ("K", 16), },
# "temporal_ordering": (('OX', 56), ('OY', 56), ('FX', 3), ('FY', 3), ('C', 4), ('K', 3), ('T', 1), ('B', 1)),
# "memory_operand_links": {"O": "O", "W": "I2", "I": "I1"},
#... |
1f072f1800217563549431c95692736597d3ca6255f395690a4ebcafa69fd411 | Python | 25,298 | 683 | # mapping = {
# "default": {
# "core_allocation": 1,
# "spatial_mapping": {"D1": ("C", 16), "D2": ("K", 16), },
# "temporal_ordering": (('OX', 56), ('OY', 56), ('FX', 3), ('FY', 3), ('C', 4), ('K', 3), ('T', 1), ('B', 1)),
# "memory_operand_links": {"O": "O", "W": "I2", "I": "I1"},
#... |
1f7784d6fcceaf724c7453fa492dbef1b2dc427952489d316ef1962912619f78 | Python | 25,298 | 683 | # mapping = {
# "default": {
# "core_allocation": 1,
# "spatial_mapping": {"D1": ("C", 16), "D2": ("K", 16), },
# "temporal_ordering": (('OX', 56), ('OY', 56), ('FX', 3), ('FY', 3), ('C', 4), ('K', 3), ('T', 1), ('B', 1)),
# "memory_operand_links": {"O": "O", "W": "I2", "I": "I1"},
#... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.