sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
52c922f1608909f7a40d40b9284a9658846ab36fd23dfebea0744447b5a90ba0
Python
16,817
359
#!/usr/bin/env python """ Camera control specialized for a Point Grey (Spinnaker) camera. Tested on : GS3-U3-51S5M GS3-U3-41C6NIR Hazen 01/19 """ import storm_control.sc_hardware.pointGrey.spinnaker as spinnaker import storm_control.sc_library.parameters as params import storm_control.hal4000.camera.cameraCont...
cdd3339600695260643e8be96108797cc3704d92c3ab63a77aa5f8ed0131ef39
Python
16,818
477
import copy import inspect import typing from collections import defaultdict from dataclasses import dataclass, field, make_dataclass from typing import Any, Callable, Dict, List, Optional, Tuple, Union import torch EXCLUDE = {'self', 'args', 'kwargs'} MAPPING = { torch.nn.Module: Any, torch.Tensor: Any, } ...
ce0f90bb43ee14db2f6bf2d2832e34a77622e78bdbe3f2aca236c61757a27c7c
Python
16,821
337
# /------------------------------------------------------------------------------+ # | 27-NOV-2022 | # | Copyright (c) Bone Imaging Laboratory | # | All rights reserved ...
55df1049d8ee1fcaf3d96e3fbddb7518abceced6e1169a6a02da329fc73325c3
Python
16,832
428
""" (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 ...
122524a9df222638a0bfae37b94b414f15ac8aa439342a6f5def782bde851cda
Python
16,840
471
import unittest import abc from copy import deepcopy import numpy as np import pandas as pd from sklearn.ensemble import GradientBoostingRegressor, GradientBoostingClassifier from sklearn.linear_model import LinearRegression, LogisticRegression from sklearn.model_selection import GridSearchCV, RandomizedSearchCV from...
4b560c9ebcf9c50e672b2c5b854938dc1957c561a63f5734f46eacd7a859259a
Python
16,843
396
"""Gabor-filter entropy features for arbitrary image sets. This is a standalone Python port of the descriptor behind the GaborFilterEntropy4x4Cosine model from the EntropyReanalysis MATLAB scripts. The default settings match that model: 256x256 grayscale images, six octave frequency bands [1, 2, 4, 8, 16, 32], six ori...
bcc91b8546123c547005754a65582bc7ec1d35ef602fe1223c58541d55341b10
Python
16,864
396
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 os import sys from pathlib import Path import json import warnings import shutil import random import string import torch from torch.nn import functional as F import nibabel...
ef2c45422525d2ddaaee10c02365aeaedf9028cc91765b471bead9fa819e541e
Python
16,878
365
#!/usr/bin/env python """ Handles all interaction / communication with the parameters widget. This widget is responsible for keeping track of the various different parameter files that the user has loaded as well as editting and saving these parameters. Unlike in Python2/PyQt4 HAL there is no longer a single current ...
5bbf54df4444984e0841222cad80ea493823982dee44c9b3b65c0597ac44fde1
Python
16,882
407
#!/usr/bin/env python """ Spot counter. This performs real time analysis of the frames from camera. It uses a fairly simple object finder. It's purpose is to provide the user with a rough idea of the quality of the data that they are taking. Hazen 05/17 """ import sys import time from PyQt5 import QtCor...
b1095286db089394e16265383cfdd078225b6c14b501b1707ed173267789e354
Python
16,884
388
import concurrent.futures import json from pathlib import Path import cv2 from typing import Dict, List, Tuple, Union from magicgui import magicgui from magicgui.widgets import FunctionGui from superqt import QCollapsible from qtpy.QtWidgets import QPushButton, QWidget, QVBoxLayout from matplotlib.backends.backend_qt5a...
c4865296cd6248d01dc23921e02490fab204a834b42d1408b9f15098889d1d4e
Python
16,892
410
import matplotlib.pyplot as plt from matplotlib.patches import Rectangle, ConnectionPatch import figure_properties as fp import numpy as np seed = 11 # 20 Hz, 20AP c_reg_fn = '100_regular_20Hz_7_Control.npz' l_reg_fn = '100_regular_20Hz_7_MCUKD.npz' # 10 Hz, 10AP c_reg_10 = '100_regular_10Hz_7_Control.npz' l_reg_10 ...
1762acc6bbd8973cb625d61d2eba179c0adabecdef6e262c58ec9414f433ce53
Python
16,893
610
# tifffile/_imagecodecs.py # Copyright (c) 2008-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 copyright notice...
3618b995d592bc31477564468c23fad3c39dd93d85c1c9d5062cf06ad169cd0b
Python
16,894
411
import matplotlib.pyplot as plt from matplotlib.patches import Rectangle, ConnectionPatch import figure_properties as fp import numpy as np seed = 11 # 20 Hz, 20AP c_reg_fn = '100_regular_20Hz_7_Control.npz' l_reg_fn = '100_regular_20Hz_20_Letm1.npz' # 10 Hz, 10AP c_reg_10 = '100_regular_10Hz_7_Control.npz' l_reg_10...
2197e9ad952ed5624fcdedaa3cc2bcdc7c045e2d9ab19e5f39dba4e1019cf9e7
Python
16,898
448
""" Classes and functions for fitting ivim model """ import numpy as np from scipy.optimize import shgo from dipy.reconst.base import ReconstModel from dipy.reconst.multi_voxel import multi_voxel_fit from dipy.utils.optpkg import optional_package cvxpy, have_cvxpy, _ = optional_package("cvxpy") class IvimModel...
d211cedc611f33ccc67a81c7375dc502f07c3b8382eeabefa33a2bb7f51df995
Python
16,905
495
""" (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...
25806e5a2783f3bd207973f52214e738dcc4680a0891d239aa88ee066835d011
Python
16,913
393
import torch from pathlib import Path import numpy as np import pickle import pandas as pd from collections import defaultdict from typing import Tuple, Optional, Union, Dict, List from collections.abc import Callable import os def pre_normalization(x: torch.Tensor) -> torch.Tensor: """ Prenormalization used...
406c14338d084465d77f98dc0f3903633efb21882774644214d8094aaf289d8a
Python
16,930
352
import torch import numpy as np import pandas as pd import json import os from transformers import pipeline from datetime import datetime as dt from torch.utils.data import Dataset from tqdm import tqdm class Twibot20(Dataset): def __init__(self,root='./Data/',device='cpu',process=True,save=True): self.ro...
a7b2353003394ab433f909c0dbd7e5a06b7ae1289939857245ae3062f1eb5901
Python
16,930
418
import typing from typing import Optional, Tuple, Union import torch import torch.nn.functional as F from torch import Tensor from torch.nn import Parameter from torch_geometric.nn.conv import MessagePassing from torch_geometric.nn.dense.linear import Linear from torch_geometric.nn.inits import glorot, zeros from tor...
937c3a9dfa138172b34a91a491c6a680b33df1080a970f6befce2d79121e4c81
Python
16,931
379
""" Modified from ConvNeXt official repo: https://github.com/facebookresearch/ConvNeXt/blob/main/models/convnext.py """ # 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. ...
c2732fac485c2ed9edc816f4277d01575319e0b70d6f0fa3d831b6192a9fe6ff
Python
16,931
427
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ """ # ------------------------------------------------------------------------------ # Reference: https://github.com/facebookresearch/detectron2/blob/main/detectron2/utils/visualizer.py # Modified by Jitesh Jain (https://github.com/praeclarumjj3) # -------------------...
9a4a2b166e31f1bad64ec6dbe3395be291fdd0bbb497a391e55041ad9eeeb2db
Python
16,934
462
# https://github.com/takyamamoto/Hopfield-Network from dataclasses import dataclass import numpy as np import warnings from matplotlib import pyplot as plt import matplotlib.cm as cm import random from tqdm import tqdm from nilearn import image, plotting from nibabel.processing import resample_from_to import nibabel a...
60a8c3de9b958c1801d3725a95438afef1e8bc926a3c880b3097c3895862e6c6
Python
16,936
295
import numpy as np from matplotlib import colors as mcolors import matplotlib import matplotlib.pyplot as plt from matplotlib.collections import LineCollection import os import colorsys import sys def get_axis_size(ax=None): """ ax: matplotlib axis to measure Returns width, height in inches """ ...
2aa9255449caf179e6b3543b84d66227cc63669fec86190000468b52b37e9797
Python
16,937
386
import torch import torchvision import torchvision.transforms as T from torch.utils.data import DataLoader import os, sys, math from copy import deepcopy import numpy as np import h5py import gc import click import matplotlib.pyplot as plt from EIANN import Network from EIANN.utils import (read_from_yaml, write_to_yam...
04e727f8fc3122fc6436ffef22e644faac1b5be58074d7ad8623c78b4d6e0821
Python
16,944
470
""" This module implements Zero-Shot Self-Supervised Learning """ import torch import torch.nn as nn from deepdwi import lsqr, util from deepdwi.models import mri, resnet, unet from typing import Callable, List, Optional, Tuple, Union # %% def uniform_samp(mask: torch.Tensor, rho: float = 0.2, acs_...
4bdd54f7b0fd68aa4bd483470386e21640f935989449adac2d3cfba279650f14
Python
16,947
466
""" Dataset reader for webdataset Hacked together by / Copyright 2022 Ross Wightman """ import io import json import logging import math import os import random import sys from dataclasses import dataclass from functools import partial from itertools import islice from typing import Any, Callable, Dict, List, Optional...
1824f6c00915fb934226d8f17b2c249cad87e88bb8dd47a89f8a72d65effad41
Python
16,948
430
# Copyright 2024 Image Analysis Lab, German Center for Neurodegenerative Diseases (DZNE), Bonn # # 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...
26fde721d5af8fdb76ffd707e94c9e285ee74c3a06991fc098d59802a2962286
Python
16,955
368
""" drawLDAGraph @2022 Knowblesse 2022NOV07 This script is for the testing or drawing one session data. All the code used in this script is replicated in the `LDABatchTesting.py` for whole session statistics. """ import numpy as np import matplotlib.pyplot as plt from Switching.SwitchingHelper import parseAllData, get...
625dec998bd404a22bc077328564a4ad1ba479ee2d5febe60a621902921106c3
Python
16,956
534
# Copyright 2019 Calico 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, ...
4209438efe435e024c33edfb3b3820b73d892dc318bc9817bbb419321a07bf04
Python
16,972
436
import logging from typing import List, Optional, Tuple, Union import numpy as np import torch from torch import Tensor from torch_geometric.explain import ExplainerAlgorithm from torch_geometric.explain.config import ModelMode, ModelTaskLevel from torch_geometric.explain.explanation import Explanation from torch_geo...
bfc7ee086cb76584d01565986c9bb8452cc7e0e7067088c35526eccdea822a8e
Python
16,976
352
import torch import numpy as np import pandas as pd import json import os from transformers import pipeline from datetime import datetime as dt from torch.utils.data import Dataset from tqdm import tqdm class Twibot22(Dataset): def __init__(self,root='./Data/',device='cpu',process=True,save=True): self.ro...
39316b577e62f896dbb23b9c708f32e418e4cedf9290a74bbd7d295e015c73c5
Python
16,992
470
""" This script computes three dimensions from neural activity: switch evidence, actor outcome, and observer outcome, using TDR Based on these dimensions angles between these are computed. Each calculation is repeated resulting in a distribution of angles. """ import sys import os sys.path.insert(0, os.path.dirname(o...
6d393b176fcbcbcfea7ac6606b5db9af4c4e7187cbc08605cd0dd9fa76ea0c25
Python
16,997
677
#!/usr/bin/python3 # import os import sys import argparse import shutil import numpy as np from sklearn.neighbors import NearestNeighbors from uac.element import Element from uac import utils # Create the parser my_parser = argparse.ArgumentParser(description="UAC fibre mapping") # Add the arguments my_parser.add_ar...
55065d453499e85b74ba80f16e253faade62ff1229dcf3ecb4f9d95359528f56
Python
17,002
268
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'dave.ui' # # Created by: PyQt5 UI code generator 5.7 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.set...
f36d954daa5407e483c16e8e75f85d9990218a12ba5c5d22037e3888f04ad013
Python
17,009
395
# flake8: noqa import os import time import traceback from functools import partial from multiprocessing.pool import Pool import numpy as np from . import _timing, utils from .metrics import Count from .utils import TrackEvalException try: import tqdm TQDM_IMPORTED = True except ImportError as _: TQDM_...
6ad5dfb132b5e0d7043c8049ae4f7353116f605092d396dad919fb62c461ed49
Python
17,016
467
import numpy as np from numba import njit from nems.registry import layer from nems.layers.base import Layer, Phi, Parameter from nems.layers.tools import require_shape, pop_shape from nems.tools.arrays import one_or_more_negative from nems.distributions import Normal, HalfNormal, Uniform class ShortTermPlasticity(L...
c564bb5f1ccd633dc399f281510c92902789b2d2887ef69ead815cc153f322b8
Python
17,016
380
import torch import torchvision import torchvision.transforms as T from torch.utils.data import DataLoader import os, sys, math from copy import deepcopy import numpy as np import h5py import gc import click import matplotlib.pyplot as plt from EIANN import Network from EIANN.utils import (read_from_yaml, write_to_yam...
5e211c7a99bd60cda68fb3dc886e8d59efb25bc6f6fd93f4344f9a76cfaffa7e
Python
17,024
614
# -*- coding: utf-8 -*- """ Created on Sat Jun 4 22:17:13 2022 @author: DELINTE Nicolas """ import numpy as np from dipy.io.streamline import load_tractogram, save_tractogram def tract_to_ROI(trk_file: str): ''' Returns a binary mask of each voxel containing a tractography node.The voxels containing st...
e9f756945bb3a09365adf7c4619ecfd62f3ab8f8ec90f4ad99a0a89a44e5a1fd
Python
17,024
363
"""Test the encoding model's prediction accuracy ID and OOD on NSD-core, and OOD on NSD-synthetic. Parameters ---------- subjects : list List of the used NSD subjects. data_ood_selection : str If 'fmri', the ID/OD splits are defined based on fMRI responses. If 'dnn', the ID/OD splits are defined based on DNN featur...
a5107f58adce8a56f7d6c6d74cae295030754730beda244d9f99b168310b35ec
Python
17,027
411
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved import copy import gc import logging import os from collections import defaultdict from operator import xor from pathlib import Path from typing import List, Optional import numpy as np import pycocotools.mask as mask_util import torch from pycoc...
6297ea5ca9615a7dec0743106803159fd2b6ea55d605bcb400818758cec0d451
Python
17,029
574
from .util import dict_hash, Dict, tweak_module_, lookup_nn, print_to_file from ..optim import lr_scheduler import json from itertools import product from collections import OrderedDict from torch.nn import Module from torch import optim import inspect from typing import Callable, Union import albumentations as A from ...
0b9aa4f5fc6e64af39e57041035b1e0170e453a70ea022a3bfd50f617250b11b
Python
17,030
311
from PyQt5.QtWidgets import QMainWindow, QMenu, QAction, QFileDialog, QApplication from napari_dmc_brainmap.probe_visualizer.probe_vis.probe_vis.view.MainWidget import MainWidget # from napari_dmc_brainmap.preprocessing.preprocessing_tools import adjust_contrast, do_8bit from napari_dmc_brainmap.utils import get_bre...
ab85b213c9a0705eec557439f6f19ac6d57b25ac6ef50cf0e83f35c4cbb74004
Python
17,031
381
""" Modified from ConvNeXt official repo: https://github.com/facebookresearch/ConvNeXt/blob/main/models/convnext.py 这个版本,要把Conv2Former进行改造,使其输入支路为两路,作为融合特征用 """ # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in...
e3fd8a6bf9bbde1ca1a7f58cb89f5f5c49ab3c5846687016a171c7a3cb9c2c14
Python
17,032
311
from PyQt5.QtWidgets import QMainWindow, QMenu, QAction, QFileDialog, QApplication from napari_dmc_brainmap.probe_visualizer.probe_vis.probe_vis.view.MainWidget import MainWidget # from napari_dmc_brainmap.preprocessing.preprocessing_tools import adjust_contrast, do_8bit from napari_dmc_brainmap.utils import get_bre...
f8a159dde41a8fff6507312525eb09649881e628ba75688638f1878c6d59b638
Python
17,047
353
import torch import numpy as np import pandas as pd import json import os from transformers import pipeline from datetime import datetime as dt from torch.utils.data import Dataset from tqdm import tqdm class Twibot20(Dataset): def __init__(self,root='./Data/',device='cpu',process=True,save=True): self.ro...
804bef19899f2f53f482fef612013d242c4b78636e785af4d4043eb10c565962
Python
17,053
522
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,...
87553bebd7fc4d0b54b4a9241934b1c719043fa0db8b036d5af227f97b49aa84
Python
17,053
523
import argparse import types from collections import Counter from collections.abc import Generator, Iterable, Mapping, Sequence from copy import copy from dataclasses import dataclass, field from pathlib import Path from typing import ( Any, Literal, ) import configargparse import yaml from eir.models.fusion....
0eee87d1ce4a040f8a3bfd1e3493043460754c0012f5521a8344bf2c96c826db
Python
17,056
527
from typing import Any, Dict, List, Optional, Tuple, Union import matplotlib.collections as collections # type: ignore import matplotlib.pyplot as plt # type: ignore import numpy as np import scanpy as sc # type: ignore from anndata import AnnData # type: ignore from matplotlib.colors import ( # type: ignore ...
bb41f09c42479f60a42d49f51a1fe5535336280684b4c38dd48423655ab3a912
Python
17,059
438
from Models.Help_func import * import matplotlib.pylab as plt np.set_printoptions(precision=2) # --------------------------------------------------------------------------------- # The SCILD method # ---------------------------------------------------------------------------...
93568106815dcd7add18116622c741034f31354e46c726e7226d4cd3d6ac02fc
Python
17,060
473
""" This module implements the VAE training for DW-MRI Authors: Julius Glaser <julius.glaser@fau.de> Zhengguo Tan <zhengguo.tan@gmail.com> """ from __future__ import division import argparse import copy import h5py import os import pathlib import torch import yaml import numpy as np import torch.utils.data a...
11f03a69576d56b7ba0cad045ce3ecfada8549ab995ecb83e75274e476896400
Python
17,070
540
"""Position class for 1D and 2D position AnalogSignalArrays""" import copy import numpy as np from .. import utils from ..core import _analogsignalarray, _epocharray from ..utils_.decorators import keyword_deprecation class PositionArray(_analogsignalarray.AnalogSignalArray): """ PositionArray for 1D and 2...
552773d6fe1ecfa370dc189f3302fec142e210732967b1ab76fffc7ba36f1ec0
Python
17,072
533
"""Color palettes for use with nelpy. Some of these functions are Copyright (c) 2012-2016, Michael L. Waskom """ import colorsys from itertools import cycle import matplotlib as mpl import numpy as np from matplotlib.colors import to_rgb from . import ( colors, utils, # import get_color_cycle, desaturate )...
8f2d17b341b86f120f3f7b60cc553d20773216a3bf78193189be4dae26760d7b
Python
17,072
438
# -*- coding: utf-8 -*- """ GO terms associated with pleio and non pleio genes We need to download in the same directory and run great_library_phenotypes.py """ import obonet import numpy as np import os import networkx as nx import matplotlib.pyplot as plt import pandas as pd import matplotlib as mpl...
ed08a19cd02588c97eeb7fb9d1de4049758161ab12d3e8aeb46edf0317e1ce9e
Python
17,072
462
# index_annotations.py # Helper class to list annotated images and load saved labels/masks / find video files. # This duplicates the logic used in your inspector verbatim (so behaviour stays identical). import os import cv2 import numpy as np import box_geometry as bg class AnnotationIndex: def __init__( self, s...
6bcced1b27f13d496db2b679980a4d8bab0c189c3ec26b62970d9e69056a328f
Python
17,073
513
from typing import List, Optional, Union import torch from torch import nn from torch_harmonics import RealSHT, InverseRealSHT import tensorly as tl from tensorly.plugins import use_opt_einsum from tltorch.factorized_tensors.core import FactorizedTensor from deepcardio.neuralop_core.utils import validate_scaling_fac...
ada985291ecc18f53dd10c33b732cadc1a80c54c40a63974b06e8ca810ed015e
Python
17,073
371
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license """Scale-only calibration for monocular depth models. The log-depth head predicts relative scene structure (shape); absolute scale is a separate two-parameter log-affine ``d' = exp(a·log d + b)`` stored in the head's ``cal_a``/``cal_b`` buffers. This ...
d361fe3d2aae15985aca82d7affb45c48ce6ab31fc6ec764ae9ea107d6948c27
Python
17,085
322
#!/usr/bin/python #----------------------------------------------------------------------- # File : fim+psf+psr.py # Contents: Pattern Spectrum Filtering and Pattern Set Reduction # (for transactional data/frequent item set mining) # Author : Christian Borgelt # History : 2014.05.06 file created from file...
2a40f5c50f249e937e2cf6fd3e0a872f2b546292a5955e9e443a97c5bada8c5f
Python
17,086
480
"""Tests for mcmlnet.training.data_loading.data_augmentation_classes module.""" import pytest import torch from mcmlnet.training.data_loading.data_augmentation_classes import ( BezierContrast, BrightDarkVariation, DataAugmentation, NoiseAddition, NoiseAdditionWithExponentialDecay, RandomOrder,...
e4def5fbb8f19e0c05db22ae4fe690cb53b3a68bdc31bf328328dd95c70a67a3
Python
17,086
450
""" Functions for preprocessing """ import numpy as np import mne #====================================================================================== # PROCESSING TRIGGERS #====================================================================================== """ Filters the trigger signals s...
2d36ef31439f00598c388c86a8132b23e59f1d6e344d4b73645b2956038cf74f
Python
17,089
409
""" 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...
9e06073ca3a44d73421fcdae78d304f865674297bea080d0c4243e61481deebc
Python
17,101
433
#!/usr/bin/env python """Map features from the target species to the query species of a chain alignment file. This is intended for mapping relatively short features such as Chip-Seq peaks on TF binding events. Features that when mapped span multiple chains or multiple chromosomes are silently filtered out. TODO: (1)fo...
c9c914ec461cf3983d15f62be924137d304018888d289cd8d7f3c8595dff779d
Python
17,102
425
"""Doublet detection in single-cell RNA-seq data.""" import collections import warnings import anndata import numpy as np import phenograph import scipy.sparse as sp_sparse import tables import scanpy as sc from scipy.io import mmread from scipy.sparse import csr_matrix from scipy.stats import hypergeom from sklearn....
f28de0eb53477321fd3440cd93a4649f8d941308f4703516fa194b4d6bde2782
Python
17,109
459
import os import tempfile from collections import namedtuple from collections.abc import Callable from unittest import TestCase, mock from unittest.mock import Mock import numpy as np from datumaro import AnnotationType, Bbox, LabelCategories from datumaro.components import media from datumaro.components.dataset impor...
4ee64ea492eab888ab7297a5b88ae91cb96b69fa247c2d1771615ba75813c060
Python
17,111
480
# 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...
70efd2d3afc4a3fb747bbe6b8935d39909cb6c9d3a0f6bb6ca754f0e1cc2fb54
Python
17,124
384
"""A module that contains unit tests for the :py:mod:`corelay.io.storage` module.""" import typing from io import BytesIO from pathlib import Path import h5py import numpy import pytest from corelay import io from corelay.io.storage import DataStorageBase, HashedHDF5 @pytest.fixture(name='data', scope='module') de...
02068fab99479d22e2446dc55b24478b41cee10c2783f0b04206e48a6b3f2847
Python
17,126
565
""" Read MHD stacks (using the vtk library) or TIFF stacks @author: Rob Campbell - Basel - git<a>raacampbell.com https://github.com/sainsburywellcomecentre/lasagna """ import imp # to look for the presence of a module. Python 3 will require importlib import os import re import struct import warnings import numpy as ...
c1349ef199aebe6c5173d53021fae4106e71adf2b5b6a05980d3e5e84820f489
Python
17,127
398
import numpy as np import torch import torch.nn as nn import my_setup from torch import Tensor from custom_layers.attention import Attention from custom_layers.dense import Dense from custom_layers.multihead_attention import MultiHeadAttention from custom_layers.transformer import TransformerEncoder class Transform...
7b451271cd10fdda93d83608355317c58659a46abc53bdf31da7108abacc08a1
Python
17,128
392
import numpy as np import pandas as pd import distinctipy import matplotlib.pyplot as plt from skspatial.objects import Line, Points # scikit-spatial package: https://scikit-spatial.readthedocs.io/en/stable/ from napari_dmc_brainmap.utils import get_animal_id, get_info, get_bregma, coord_mm_transform from napari_dmc_br...
208e005839a317d2ff4f78d847ff08eaf75273abc4dc34d50a81d7417d327b78
Python
17,134
312
from PyQt5.QtWidgets import QMainWindow, QMenu, QAction, QFileDialog, QApplication from napari_dmc_brainmap.results.probe_vis.probe_vis.view.MainWidget import MainWidget # from napari_dmc_brainmap.preprocessing.preprocessing_tools import adjust_contrast, do_8bit from napari_dmc_brainmap.utils.atlas_utils import get_...
95c01cd43367563df35edcae21cf4a48c6d3957846654b7c4003afc5d8ccbfcf
Python
17,134
451
""" patchlib (python version) Library for working with N-D patches. Modelled after the MATLAB patchlib (https://github.com/adalca/patchlib) """ # built-in import sys from pprint import pformat from random import shuffle import random # third party import numpy as np # local import pynd.ndutils as nd from imp impor...
8081984511b7f504f07a6ebe550c33714eb540bf9336fa0d505f34a91fbb1c7c
Python
17,138
396
"""What each computer does in a shared run, from joining to done. Two roles. A **helper** waits until the main computer has started the run, analyses the recordings it was given into its own corner of the shared folder, and reports progress there as it goes. The **main computer** does the same for its own share, then ...
7af20e7ed0bf38b6594c94e70d42d972d3186d8621fdf174167ede11bb0e37fa
Python
17,140
547
import ast import datetime import os.path as op import platform from AFQ.api.bundle_dict import * # interprets bundle_dicts loaded from command line # noqa F403 from AFQ.api.bundle_dict import BundleDict from AFQ.api.utils import kwargs_descriptors from AFQ.definitions.image import * # interprets masks loaded from c...
9f0fce8ae9abc0d606c0fd4ef76bb7b09de0df11fdcf1ad36db90a74478aeab2
Python
17,143
387
# -*- coding: utf-8 -*- from __future__ import print_function, absolute_import import argparse import os.path as osp import random import numpy as np import sys import collections import time from datetime import timedelta import torch from torch import nn from torch.backends import cudnn from torch.utils.data import ...
fc0a57100623c8560121bc61e69d9e0308c8acceb753424efb98f0eeea7fea1c
Python
17,164
416
import torch import math import numpy as np import os import json import h5py import time from glob import glob from matplotlib import pyplot as plt import scipy.constants as sc from scipy.ndimage import zoom from data_prepare import Dataset_exp from DS_network import Network from func import frankotchellappa, prCo...
159437927c0baf2de414be2dc7c19673c55f4dc793310fb58536729723c6b9e8
Python
17,169
498
import pandas as pd import numpy as np from collections import defaultdict from scipy import sparse from copy import copy complements = { 'A': 'T', 'C': 'G', 'G': 'C', 'T': 'A', 'N': 'N' } def reverse_complement(input_seq): """ Get the reverse complement of a sequence """ rev_input...
3e07dcd170ae75841b8549b3424575fab0732786446b78e23f61966ca16efaf4
Python
17,174
391
''' Because we have morphs in the learning task but would still like to estimate semantic effects that must technically be in reference to word_a or word_b within the morph (e.g., for morph /_i:/ between /si:/ and /ti:/, we must compute surprisal either for /si:/ or /ti:/), we would like to use an LLM as a surrogate mo...
454cc3bab446f08dcc57a269794d6f5716f0b94e67070c2f5869d8dab7033835
Python
17,174
573
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from itertools import repeat import os import pathlib import shutil import ants import json import pandas as pd import numpy as np import mbflim.shared as sha import mbflim.utils as ut import mbflim.image.image_processing as pro import mbflim.flim.flim_processing as fl ...
88b7db4c57983822503ee1528555709c3f9924a6109478aed92fc95a3496d8cf
Python
17,178
469
import torch from torch.nn import functional as F import numpy as np import math from dgd.utils import PlaceHolder def sum_except_batch(x): return x.reshape(x.size(0), -1).sum(dim=-1) def assert_correctly_masked(variable, node_mask): assert (variable * (1 - node_mask.long())).abs().max().item() < 1e-4, \ ...
ef8ac7312d1e1d45201ad9a05d61717f6f8b33f3b5c9b63bb4ce48f244596b67
Python
17,188
413
import h5py import numpy as np import os import matplotlib as mpl from pfcmap.python import settings as S from pfcmap.python.utils import unitloader as uloader from pfcmap.python.utils import som_helpers as somh nmin_per_block = 3 def get_units(detailfile,metricsfile,somfeats,split_dict={},chop_to_blocks=False,nperblo...
205d6f4159c4da25086dc4f9390eef4502d61aa1bc2e6be62dbf6128c605b102
Python
17,192
473
from PySide6 import QtGui, QtWidgets, QtCore from PySide6.QtWidgets import QWidget, QMenuBar, QMainWindow, QVBoxLayout, QLabel, QHBoxLayout, QGridLayout, QPushButton, QCheckBox, QSlider, QTableWidget, QTableWidgetItem, QTabWidget, QGroupBox, QSpinBox, QFileDialog, QMessageBox from PySide6.QtGui import QAction, QIcon, Q...
2bf41f94c453be5e4c6261c51ee3b35c004dc4aa324a46fa47f8e43f5d119b76
Python
17,197
581
import functools import inspect import logging import os import os.path as osp import warnings from collections.abc import Iterable from dataclasses import asdict from typing import Any import torch_geometric.graphgym.register as register from torch_geometric.io import fs try: # Define global config object from ...
3a8878ca549e404956bb89a456869f0612c421de3892549899c76f7f54b91645
Python
17,200
456
""" Schema validation for EBM model inference data. This module provides comprehensive validation of inference data against the model's expected schema, ensuring correct feature names, types, and order. """ from dataclasses import dataclass, field from enum import Enum from typing import Any, Dict, List, Optional, Se...
542c4bb46dc5c45c6fbd7aa79735597e55521544cb7a552913bf331fb0be1db4
Python
17,201
459
""" MEG: Preprocessing, Source Reconstruction, Parcellation ======================================================= This tutorial walks through the full MEG processing pipeline step by step: 1. Preprocessing — Filter, downsample, detect bad segments/channels, ICA artefact rejection. 2. Surface Extraction — Extract sk...
9384aeb84760dac134511c48d919fc0e3792b7fbcccb8f64a2b711f51dbb2f1f
Python
17,204
372
"""Binned correlation on the ``F`` / ``spks`` / ``denoised F`` paths. These paths never involved a lag: they correlate whole traces at zero lag, and the number in the output folder was only ever the frame period, filed under a name (``30mslag``) that read like a 30 ms STTC window. So the number is now a real, user-cho...
978997427b0f3d33aa8667116c791de6cd33697e413b515c556c4a3356618aa1
Python
17,204
467
import os import os.path from functools import partial from statistics import mean from typing import Callable, Union, Dict import torch import torch.nn as nn import torch.optim.lr_scheduler import torch.optim.swa_utils from torch import Tensor from torch.cuda.amp import GradScaler, autocast from torch.utils.data impo...
4e24cf530480543481ff077f6836ad50b3d8d12bf99e187800a9c357acfe639c
Python
17,208
467
"""Helper functions for iterative 2D background fitting. Headless (no file I/O, no matplotlib) support code for :mod:`musclex.utils.background_fitting`: * image geometry -- center crop to a fit size and reconstruct model backgrounds at the original full resolution; * wedge-based initialization of the general-backgr...
24357429a81ff6ae905a161bcd635f3474b21a096312a110411c9b48ab6e9845
Python
17,211
390
import torch import torchvision import torchvision.transforms as T from torch.utils.data import DataLoader import os, sys, math from copy import deepcopy import numpy as np import h5py import gc import click import matplotlib.pyplot as plt from time import time from EIANN import Network from EIANN.utils import (read_f...
5d4d874cf6e0249ffa853fbe5f4276c645e58826edefffa1b9bf67b8851096e8
Python
17,213
320
import os import os.path as osp import sys from typing import Callable, List, Optional import torch from torch import Tensor from tqdm import tqdm from torch_geometric.data import ( Data, InMemoryDataset, download_url, extract_zip, ) from torch_geometric.io import fs from torch_geometric.utils import ...
73979c440d1296ddd81664278d6f8b046e48a8194091712350743684abe52163
Python
17,220
492
#!/usr/bin/env python """ Communicates with the National Instrument card(s). Hazen 4/17 """ import ctypes import numpy import time import traceback import threading import PyDAQmx import storm_control.sc_library.halExceptions as halExceptions timeout = 1.0 def getLock(): return threading...
2d0aad0c09aa452d74e0eb958423090bdcf4494be3f33e988abc6426968fde4b
Python
17,230
493
# 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 os from typing import Sequence, Tuple, List, Union import pickle import re import shutil import torch from pathlib imp...
3f3a636a2e4a2d5ff492090090af32013d31b9f37f29eea81f8b1d0865d03dd7
Python
17,236
628
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import json import operator from collections import defaultdict from collections.abc import Generator, Iterable from copy import deepcopy from pathlib import Path import pytest from shared.utils.config import ASSETS_DIR, SHARE_DIR class Container...
13ebabe243e33c3502b9de54220b100efc211cff0b7ce05b9c44c25104688c91
Python
17,237
430
import os import time import cv2 import matplotlib import matplotlib.pyplot as plt import numpy as np from skimage.morphology import remove_small_holes, remove_small_objects from EvaluationCNN.detect import predict_image_quality from keypoint.detect import key_detect from mol_segment.detect import segmente...
63b54e16063936289bbfed56b069ef95ca6dfa8c9efdd2da8efef3f55d7246d0
Python
17,244
437
from euler_gpu.grid_search import grid_search from euler_gpu.preprocess import (initialize, max_intensity_projection_and_downsample) from euler_gpu.transform import (transform_image_3d, translate_along_z) from evaluate import calculate_gncc from tqdm import tqdm from typing import Dict, List, Tuple, Callable from d...
6eb285ce8eab42060c9b9249279afb20ce803058fc5ccd8b6bd009b24b08b6a0
Python
17,248
490
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: avelinojaver """ # %% import os import glob import datetime import tables import pandas as pd import numpy as np from functools import partial from multiprocessing import Pool, Lock, cpu_count from tierpsy.helper.misc import TimeCounter, print_flush from tie...
95f22e42479ec04984543de04638629f2cc4b9504c5a3839d62b10d9c73412dc
Python
17,254
367
"""CAT-NAP adjacency-matrix construction. Port of ``Functions/twoPhoton/suite2pToAdjm.m`` (everything after the denoising call — the loading/denoising itself lives in ``loader.py`` / ``denoising.py``). Takes a loaded :class:`~meanap.catnap.loader.Suite2pData` and produces the functional-connectivity adjacency matrice...
ced32d9998dd5f980ac6851e8b0c473d5cd02aa848be71bb0484ee8272962b64
Python
17,259
413
# This file is part of connectome-manipulator. # # SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2024 Blue Brain Project/EPFL """Main module for model building: - main(...): Main function for running model building, given a model building config dict * Loads a SONATA connectome * Extracts connectivity speci...
313b43efd1a03f3fc7d188f68d55d5d44e5bf21aaae5fa1e66e3ca3d82de3fe3
Python
17,265
515
from dataclasses import replace from pathlib import Path from typing import List from unittest.mock import Mock, patch import numpy as np import pandas as pd import pytest from brainways.pipeline.brainways_params import AtlasRegistrationParams from brainways.project.brainways_project import BrainwaysProject from brai...
f5c33b9b3f5b79ff340600fc1d1a28ba4ff937e29b47b3ffafdfb3bd336965af
Python
17,265
423
import argparse, math, sys, scipy.sparse, gzip, random, numpy as np, joblib, linecache, pandas as pd, itertools, copy from collections import OrderedDict from sklearn.tree import DecisionTreeClassifier from sklearn.metrics import roc_curve, auc, average_precision_score, mean_squared_error import torch import torch.nn...
ce9ff86a0c3a1890e35ae7c0f1e8a2253e6d8604dd4b32347b9edff8e06a60d8
Python
17,273
445
""" Pose-JEPA pretraining script. Two usage modes: 1. Named datasets via $KINESCOPE_DATA_DIR: kinescope pretrain --datasets humoto amass --output ./checkpoints/ --epochs 100 Datasets are loaded from $KINESCOPE_DATA_DIR (default: ~/kinescope_data/): ~/kinescope_data/amass/ → AMASS .npz files ~...
7da996ba01f0cdfca0e56899a5130703783e3be35a30c74637f5040b84b40b01
Python
17,274
461
""" Normalization + Activation Layers Provides Norm+Act fns for standard PyTorch norm layers such as * BatchNorm * GroupNorm * LayerNorm This allows swapping with alternative layers that are natively both norm + act such as * EvoNorm (evo_norm.py) * FilterResponseNorm (filter_response_norm.py) * InplaceABN (inplace_a...
489d71ede446b8c7e7c51ec406d4074dd60c3b791af0870b5c10322932b0c949
Python
17,276
506
'''Some helper functions for PyTorch, including: - get_mean_and_std: calculate the mean and std value of dataset. - msr_init: net parameter initialization. - progress_bar: progress bar mimic xlua.progress. ''' import os import time import torch import torch.nn as nn from functools import reduce import opera...