sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
d40247070a7a305a866082ee376fca436cab7ba2856db45d10d1cbf2d24ddf44 | Python | 18,258 | 505 | # -*- coding: utf-8 -*-
"""
train the image encoder and mask decoder
freeze prompt image encoder
"""
# %% setup environment
import numpy as np
import matplotlib.pyplot as plt
import os
join = os.path.join
from tqdm import tqdm
from skimage import transform
import torch
import torch.nn as nn
from torch.utils.data impo... |
dc89dac1188ac81d57d1f426519e27f58d788b17e56938ad3799e6b11ff8c45b | Python | 18,260 | 473 | import argparse
import h5py
import os
import pathlib
import time
import torch
import yaml
import matplotlib.pyplot as plt
import numpy as np
import torch.nn as nn
import torch.optim as optim
from deepdwi import util, prep
from deepdwi.dims import *
from deepdwi.models import mri
from deepdwi.recons import zsssl
from ... |
9f83f651bcccb1cc4ebaafa71567a2935b3a8c7b3ef91847452e71a42058aea3 | Python | 18,263 | 429 | """
(C) Copyright 2019 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
... |
d58888148830aa888191eab2618c36c7d2be06f6279d4a130119d6f7786b1bfb | Python | 18,263 | 456 | """
ResNet3D Baseline Training Script
Train ResNet3D model with T2W or FLAIR single modality input
Single GPU training
"""
import os
import json
import time
import argparse
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from data.dataset import MRIDataset
from models.resnet3d import R... |
e94fcf6b6c52ca8b9e590cced86840c72bef97bccc973f2b59674622b8ea322e | Python | 18,265 | 347 | """A module that contains processors for embedding algorithms."""
import typing
from collections.abc import Callable
from typing import Annotated, Literal, TypeAlias, TypeGuard, get_args
import numpy
import sklearn.base
from scipy.sparse.linalg import eigsh
from sklearn.decomposition import PCA
from sklearn.manifold ... |
00b2fb70cd4249c9189b8e6fe658da44c028f50893e3d075137c46afb285ea52 | Python | 18,266 | 330 | # # predict something from one multi-modal nifti images
# Tested with Python 3.7, Tensorflow 2.7
# @author : Philippe Boutinaud - Fealinx
# modified by Youjie Wang, 2025-01-20
import os
import pandas as pd
import subprocess
import nibabel as nib
import numpy as np
import gc
import time
from pathlib import Path
#impor... |
4fad3e15e75b6ef8f6044a221fe2e74a3cd074eb500dda976c932edd9a139aff | Python | 18,266 | 443 | import time
import argparse
import pickle
import os
import datetime
import torch
import torch.optim as optim
from torch.optim import lr_scheduler
from utils import *
from modules import *
os.environ['CUDA_VISIBLE_DEVICES'] = "1, 2, 3"
parser = argparse.ArgumentParser(
'Neral relational inference for molecular dyna... |
1bec154c6f2b50ad1c44c5f345b28b24f701923b733524fca773ac554584d85d | Python | 18,272 | 612 | from __future__ import annotations
import math
import numpy as np
import pytest
from loguru import logger
from labelme import _shape
from labelme._shape import Shape
from labelme._shape import ShapeType
def _make_oriented_rectangle(points: list[tuple[float, float]], /) -> Shape:
return Shape(
shape_typ... |
1f73eb73ffb11a3aa622e20e86579b696e96445ed2ad4fcd7d58aaf54b76e7a2 | Python | 18,280 | 550 | #!/usr/bin/env python3
"""
=============================================================================
Austin Dibble
University of Glasgow
2026
neurofm/layers.py
Custom Keras layers used in the NeuroFM architecture.
SSFAdaLayer and deconstructed layer variants (fn_BottleNeck, fn_PooledBottleNeck)
have been intenti... |
bebff9def036d2907d288971208381271c9a1eb397e4aadc0cf4e3bc794901df | Python | 18,292 | 514 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Convert a final aggregated json file to an Excel spreadsheet.
Typically used during the tractometry pipeline.
"""
import argparse
import json
import logging
import numpy as np
import pandas as pd
from scilpy.io.utils import (add_overwrite_arg, add_verbose_arg,
... |
57f697c4f370b0ba46cd92450d8bd6b46fef8ba99cd15e3b0a6f67e4e2c5b3dc | Python | 18,299 | 429 | import argparse
import os
import numpy as np
import nibabel as nib
from scipy.stats import norm, t
from datetime import datetime
from time import time
import matplotlib.pyplot as plt
from tqdm import tqdm
def parse_arguments():
parser = argparse.ArgumentParser(description="Threshold-Weighted Overlap Mapping (TWOM)... |
0cbff992e8fbfc31ee2748e2bb06c4bd55b81fc6a7df24c1ccb737f9a3c0b682 | Python | 18,306 | 553 | from __future__ import annotations
import json
from pathlib import Path
from typing import Final
import pytest
from labelme import _config
from labelme._config._migration import migrate_config
def _steer_home(*, monkeypatch: pytest.MonkeyPatch, home: Path) -> None:
monkeypatch.setenv("HOME", str(home))
# n... |
022a05eeb2cdc29dd845c501583b5d5040d5bac51f89167f16da255cfd58f64d | Python | 18,310 | 509 | """
this script is used to plot the activation and angles of the neural network
it loads snapshots of RNNs for each variant, and makes plots of the activations
and angles
"""
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import numpy as np
import matplotlib.pypl... |
acae45bf9e8aa43f8a02a8f0b5a60d93682413447f025192b8a09ea996fb8cb7 | Python | 18,335 | 568 | """
This script generates scatter plot and histograms of ROC selectivity
"""
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
import pandas as pd
from tls_regression import tls_regression
... |
3c61acef6215cf152137ae6dd64eb99c0bf83db66c3feca79273d58a6de56157 | Python | 18,349 | 448 | # -*- coding: utf-8 -*-
import gc
from itertools import product, repeat
import json
import logging
from multiprocessing import Manager
import multiprocessing
import os
from time import time
import warnings
from dipy.io.streamline import save_tractogram, load_tractogram
from dipy.io.stateful_tractogram import Stateful... |
cee5dd598f0bfda61ec5d4968dff00ba3d24e720a52bb12d17d4eb7211b7f91f | Python | 18,353 | 458 | """lasagna.plugins.annotation_plugins.add_line_plugin
This Lasagna plugin is used to annotate image stacks by allowing the user to
add lines and points interactively to the image stack.
For hints on plugin writing see the tutorial plugins.
Author
Antonin Blot, Basel
"""
import numpy as np
from... |
915738ac7ab03915296c0666d79e86c1eb5847dd32033134e9b20b178c7fd123 | Python | 18,355 | 472 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
import os
import shutil
import sys
import time
import unicodedata
from functools import lru_cache
from typing import IO, Any
from typing_extensions import Self
@lru_cache(maxsize=1)
def is_noninteractive_console(... |
93a47cdb52048d3b1c851aa60067a43c86080484c05abe133c76c8f122e4ff93 | Python | 18,358 | 482 | """Base PyTorch Lightning model for MCMLNet, inherited by all other models."""
import gc
from typing import Any
import lightning as pl
import torch
import torch.nn as nn
from hydra.utils import instantiate
from omegaconf import DictConfig
from mcmlnet.training.data_loading.data_augmentation_classes import (
appl... |
f9007781a2f6b2b6f6d788e3216b689438fd0952814ac78225d02999516d7d1a | Python | 18,364 | 487 | import sys
import os
import pandas as pd
import numpy as np
import pyreadr
import torch
import glob
import functools
from math import ceil
from sklearn.metrics import confusion_matrix
from torch_geometric.loader import DataLoader
import torch.nn.functional as F
from torch.nn import Linear
from torch_geometric.nn import... |
436813a716f74e3273be36362f0d06bcce6419a3c2c909493b038d2acf050e36 | Python | 18,370 | 421 | #############################################################################
# Copyright (C) 2020-2026 MEmilio
#
# Authors: Manuel Heger
#
# 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... |
01f03abb0483a1074b2ac1bf7f377ebc134dda0d37bf79f7e5652cd314f1d47b | Python | 18,383 | 448 | """Tests for mcmlnet.utils.loading module."""
import copy
import os
import tempfile
import numpy as np
import pandas as pd
import pytest
import torch
from mcmlnet.utils.loading import SimulationDataLoader
class TestSimulationDataLoader:
"""Test cases for SimulationDataLoader class."""
def setup_method(sel... |
90f496a9e8ef9a30931d740691a85b932bbf5ac166744b199b98570672ec925d | Python | 18,384 | 411 | # Using: EIANN\optimize\optimize_config\spiral\nested_optimize_EIANN_2_hidden_dend_EI_contrast_fixed_bias.yaml
# Based on: EIANN\optimize\nested_optimize_EIANN_1_hidden_mnist.py
import torch
import os
import sys
import numpy as np
import time
import gc
from EIANN.network import Network
from EIANN.utils import read_f... |
9ac419078f78519c3580a9d96af546a74b2221908e9046f62d2f42de2331ebe0 | Python | 18,397 | 519 | """
A/B runner: replay a directory of captured :class:`FitCase` pickles through
one or more :class:`FitterAdapter` implementations and produce a long-format
``pandas.DataFrame`` of per-(case, adapter, trial) results.
Usage (programmatic)
--------------------
>>> from musclex.tests.fitting_ab.runner import run_ab, load... |
3426d31be3adba9596aa21090fffeabc97c96e7a2656e78d39377bb5694b4232 | Python | 18,401 | 418 | #!/usr/bin/env python
"""
Illumination control.
Hazen 04/17
"""
import os
from PyQt5 import QtCore, QtWidgets
import storm_control.sc_library.halExceptions as halExceptions
import storm_control.sc_library.parameters as params
import storm_control.hal4000.halLib.halDialog as halDialog
import storm_co... |
32359a6fea92b5d0fb79b8df00981a579456567eaa818a672115746d85d194cc | Python | 18,403 | 481 | """Quantifying the peaks and troughts across layers from the center surround analysis"""
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
ROOT = '/Users/sebastiandresbach/data/s1Anfunco/Nifti/derivatives'
digits = ['D2', 'D3', 'D4']
subs = ['sub-05', 'sub-06', 'sub-07', '... |
5c70f039165fb7eb82bf3f3b802120e01631e306d618f356e7acaedd567535a8 | Python | 18,406 | 365 | # 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... |
612e2014e86732e0ecb454cfbd1d7c143c9735a4f1c5e0c819a452f546efafa3 | Python | 18,407 | 425 | import copy
import warnings
from collections import defaultdict, deque
from typing import Any, Dict, Optional, Tuple, Union
import torch
from torch.nn import Module
from torch_geometric.nn.dense.linear import is_uninitialized_parameter
from torch_geometric.nn.fx import Transformer, get_submodule
from torch_geometric.... |
40be371d7f1b41f99673a14a5ae158832e8e7e429bf2d72bb5fea2b43ec05e4d | Python | 18,417 | 445 | import os
import time
import random
import torch
import torch.nn as nn
import torch.optim as optim
from torch.nn.utils import clip_grad_norm_
from datetime import datetime
from torch_geometric.loader import DataLoader
import numpy as np
from tqdm import tqdm
from .evaluation import *
from visualization.visualize impo... |
b0e20f636c70619c0761316189a116a9e0e770a6a47e3fbd9c7a279da2633b15 | Python | 18,418 | 357 | import colorsys
import copy
import time
import cv2
import numpy as np
import torch
import torch.nn.functional as F
from PIL import Image
from torch import nn
from nets.deeplabv3_plus import DeepLab
from utils.utils import cvtColor, preprocess_input, resize_image, show_config
#---------------------------------------... |
1de722fd715f651f16b7bf15f0cdd9366ac6d8ea089c9fd968c8e9adbe5a5ec2 | Python | 18,424 | 431 | """Test running several saved analyses back to back.
Run from the repo root::
uv run python python/test_run_queue.py
A queue exists so nobody has to be awake for the handover between runs. That
makes its failure behaviour the interesting part, not its success behaviour:
- **one bad run must not end the night.... |
0aeab18761d8d1bc00e00431bc654bae65aefd5c718036941aff3718d13462a1 | Python | 18,427 | 592 | # 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 shutil
import struct
from functools import lru_cache
import numpy as np
import torch
from fairseq.dataclass.constants import DATASET_I... |
1317b6d7d93f8bbe068026c9324853d4e80248bfd5b255d22b9fafdf18aaf614 | Python | 18,427 | 476 | # 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 sys
import math
from tqdm import tqdm
import random
import numpy as np
import scipy.sparse as ssp
from scipy.sparse.csgraph import shorte... |
babf94e7e8b4413e1c3dd036b820225ecb1bb44a5f4f972413ff3426cb66fb78 | Python | 18,431 | 511 | """
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... |
cab097bd648d1742d9273a85a9e7871ab66f6cac218fb909cb20cfeb48225ec6 | Python | 18,440 | 434 | """
Analysis of visual tuning: receptive fields, tuning curves, pixelwise maps
"""
import numpy as np
from scipy.interpolate import interp1d
from scipy.signal import convolve
from scipy import linalg, stats
import io
import imageio
import datajoint as dj
from . import preprocess
from pipeline import experiment
from . i... |
0b3287fce955e664d91ed9cdd099e4038719b6a0eb128eabc9a9d8979fc2d252 | Python | 18,445 | 454 | # 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.
# Adapted from https://github.com/facebookresearch/segment-anything/blob/main/segment_anything/automatic_mask_generator.py... |
adf10c35ac7d31628595452a27bc50922ddc9122c6deb463a66a42d743be91a3 | Python | 18,448 | 354 | import numpy as np
import pandas as pd
import network_flow_tracker.FlowGraph as FG
from .utils import util
class TraceGenerator():
def __init__(self, fg: FG.FlowGraph, inflow_el, in_flow_num_entr_per_frame,
int_mean=1e4, int_std=2e3):
self.fg = fg
self.inflow_el = inflow_el
... |
ed5caac7082f5f62beda661f8940a4b110e720d119cf26b8107f9d7d625c151b | Python | 18,448 | 520 |
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains t... |
fcfcc4a62c1421b0143de6aba86f41e51f461726ee27d8f762fd6df6d35b35af | Python | 18,452 | 377 | #!/usr/bin/env python
import warnings
warnings.filterwarnings("ignore", message="numpy.dtype size changed")
warnings.filterwarnings("ignore", message="numpy.ufunc size changed")
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.externals import joblib
from PAINTeR import global_vars
fr... |
813514b8ec2b8042402d3bf448e8af6a5f21495efa028e20458de14cf96a02da | Python | 18,454 | 400 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from __future__ import annotations
import io
import unittest
from enum import Enum
from typing import NamedTuple
import av
import numpy as np
from cvat.apps.engine.media_extractors import AudioReader, Mp3ChunkWriter
from cvat.apps.engine.media_io.... |
0e22dd3ecae4c5b201bb118d7392fb7f55345cd16c73f3448b01ab683d8e9354 | Python | 18,459 | 558 |
"""
An implementation of HMAX:
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import scipy as sp
import time
from ._builder import build_model_with_cfg
from ._manipulate import checkpoint_seq
from ._registry import register_model, generate_default_cfgs
def get_gabor(l_si... |
4796083ec74e43311f63effbf7c4948948f252fc3ccdc15b53c80c7ba27337b3 | Python | 18,465 | 538 | import logging
import immlib
import nibabel as nib
import numpy as np
from dipy.align import resample
from dipy.core.gradients import unique_bvals_tolerance
from dipy.data import get_sphere
from dipy.reconst.mcsd import (
mask_for_response_msmt,
multi_shell_fiber_response,
response_from_mask_msmt,
)
from ... |
e86e1c4df579453b634bb1f707ee5781f0cb82ebafdf16391092dede7cc3d430 | Python | 18,467 | 562 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
import os
import tempfile
import nibabel as nib
import numpy as np
import pytest
from scilpy import SCILPY_HOME
from scilpy.io.fetcher import fetch_data, get_testing_files_dict
# If they already exist, this only takes 5 seconds (check md5sum)
fetch_data(get... |
5fac7f427ba1018b1ba22f273484caab3435049aa095eadd501f69da8d1e2149 | Python | 18,478 | 564 | import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from typing import Dict, Tuple, Optional
from dataclasses import dataclass
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader, TensorDataset
from sklearn.model_selection import train_tes... |
de03d6439d70a0d8eaa27a58c50dc04f2ceb74bf23d6bbb78ccd9e649a87d02f | Python | 18,480 | 387 | import pytest
pytest.importorskip("fireants_fused_ops")
import torch
from time import time
from torch import nn
from torch.nn import functional as F
from fireants.interpolator.fused_grid_sample import fused_grid_sampler_3d, fused_grid_sampler_2d
from fireants.interpolator.grid_sample import torch_grid_sampler_3d, torc... |
b97e4b1579eff43ff94ec0f179b2543ef7755d753a95f31ffd9f22fa6a2952d0 | Python | 18,482 | 556 | # This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains th... |
afd7af1ac5b341e35196f1529b6a1d113e054fd883eac8368033d028e51d5eeb | Python | 18,489 | 395 | #!python
import shutil
import os
from pathlib import Path
import traceback
import yaml
import re
from dtiplayground.config import INFO as info
import dtiplayground
import dtiplayground.dmri.common as common
import dtiplayground.dmri.common.module as module
from dtiplayground.dmri.common.appbase import AppBase
impor... |
917a0c7eb9c55648278fca3604e4d8e2d143b9ef8b8c5902798b73c453f3f1b4 | Python | 18,497 | 416 | alg_name = 'sign'
import os
os.environ["OMP_NUM_THREADS"] = "2" # export OMP_NUM_THREADS=1
os.environ["OPENBLAS_NUM_THREADS"] = "2" # export OPENBLAS_NUM_THREADS=1
os.environ["MKL_NUM_THREADS"] = "2" # export MKL_NUM_THREADS=1
os.environ["VECLIB_MAXIMUM_THREADS"] = "2" # export VECLIB_MAXIMUM_THREADS=1
os.environ... |
819d3165f261582cba9c5d7626e81ca1614dfaeda093b7f759a2a9f438678ee4 | Python | 18,508 | 460 | import torch
from torch import nn
import torch.nn.functional as F
import numpy as np
import copy
from torchsummary import summary
def conv_bn(in_channels, out_channels, kernel_size, stride, padding, groups=1):
result = nn.Sequential()
result.add_module('conv', nn.Conv2d(in_channels=in_channels, out_channels=o... |
e48d8491b9b6442973cfd9a267cf9e86a9d60c89c54f32d964616ab03a05ae22 | Python | 18,511 | 405 | import datajoint as dj
import pandas as pd
from . import aodpre
import warnings
from IPython import embed
import glob
import numpy as np
import dateutil.parser
from . import utils
import cv2
import os,shutil
try:
from pupil_tracking.pupil_tracker_aod import PupilTracker
except ImportError:
warnings.warn("Failed... |
ddd51d8e5750a07b79d106e1b064d492a2603d3249fced6b0d0992c4730940d9 | Python | 18,514 | 392 | import ANNarchy as ann
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import os
plt.rcParams.update({'font.size': 40})
plt.rc('axes', labelsize=30)
plt.rc('xtick', labelsize=20)
plt.rc('ytick', labelsize=20)
plt.rcParams["font.family"] = "serif"
plt.rcParams["mathtext.fontset"] = "dejavuserif"
... |
03c169ec84bc3269ccf497899f011687de0eca3accb9658a49efbfbd238b3846 | Python | 18,515 | 507 | from __future__ import annotations
import contextlib
from collections.abc import Callable, Iterable, Mapping, MutableSequence, Sequence
from itertools import chain
from typing import (
TYPE_CHECKING,
Any,
Generic,
NoReturn,
TypeVar,
cast,
overload,
)
from psygnal import Signal
from magicg... |
4b1a67147d8d85882b1a216dd56c74f3207f669ef6aeb2fa0db0ee559264a81c | Python | 18,523 | 485 | import hail as hl
import numpy as np
from functools import reduce
from heig.wgs.wgs2 import RVsumstats, get_interval, extract_chr_interval
from heig.wgs.vsettest import VariantSetTest, cauchy_combination
from heig.wgs.utils import PermDistribution
from heig.wgs.utils import *
OFFICIAL_NAME = {
"plof": "putative l... |
b5f66bc0ec5832deeb24495f1d8f2ede6a9194b35b0b0e3b4722e8d6303888a5 | Python | 18,528 | 479 | # 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 sys
import math
from tqdm import tqdm
import random
import numpy as np
import scipy.sparse as ssp
from scipy.sparse.csgraph import shorte... |
5b1423f4423efdfa22d1ebbfc94b1c816e600173d684bbb9792a273cf0914540 | Python | 18,543 | 482 | # -*- coding: utf-8 -*-
"""
Created on Fri Apr 7 10:28:45 2023
@author: axthi
"""
import os
import numpy as np
from copy import deepcopy
from .simu_settings import get_simu_template
from simnibs import mesh_io, sim_struct, __version__
from simnibs.utils.file_finder import SubjectFiles
from simnibs.utils.simnibs_lo... |
5f9f871dcf49ea8955e1436ad96207ae6e90731156a3967787ed4c8214acf44d | Python | 18,556 | 390 | import matplotlib.pyplot as plt
from model import *
import jax
import jax.numpy as jnp
from jax import vmap
def plot_2D_activity(p_init, p_final, hp, mis, key):
fig, axs = plt.subplots(1, 3, figsize=(18, 5))
E_init = p_init.E
E_final = p_final.E
axs[0].scatter(E_init[:, 0], E_init[:, 1], alpha=0.7, la... |
c61d9f0fd22eb539db34085c98ec0bccc98d569bf6f69565ed1d1422b08599df | Python | 18,561 | 536 | #!/usr/bin/env python3
"""
=============================================================================
Austin Dibble
University of Glasgow
2026
neurofm/io.py
Input resolution, preprocessing, and output writing.
Accepts a single file, directory, or CSV with an 'input' column.
Output modes
------------
flat All ... |
de8e6935b52de424512c425f4fbf2215ec3e6c82a352400e258b9d1274e9f3fb | Python | 18,567 | 343 | 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)
from argparse import ArgumentParser
import torch
from torch.nn import functional as F
from torch.optim.lr_scheduler import CosineAnnealingLR, ReduceLROnPlateau
import pytorch_ligh... |
bbca3ddbfec8d7953c6b329878eabc76e0a523507259da518a20ba6f348e71a7 | Python | 18,572 | 485 | # Imports
import sys
import pandas as pd
import numpy as np
import random
from scipy.integrate import odeint, solve_ivp
from lmfit import minimize, Parameter, Parameters, report_fit
def Step(t, stim=5, inter=10, amp=1.0, base=0, k=0, delay=0, decay_f=0):
"""
Feedback (FB) input:
-------------------------... |
38549a452d0300923cb758e2499fafa84662a7d45588dda7b616f7b682f4856b | Python | 18,586 | 486 | # Imports
import sys
import pandas as pd
import numpy as np
import random
from scipy.integrate import odeint, solve_ivp
from lmfit import minimize, Parameter, Parameters, report_fit
def Step(t, stim=5, inter=10, amp=1.0, base=0, k=0, delay=0, decay_f=0):
"""
Feedback (FB) input:
-------------------------... |
848413529b820ebab5e2ea381f72fc91273cec322e8803a961ec662d664c84c0 | Python | 18,588 | 548 | #!/usr/bin/env python
"""
A ctypes based interface to the Photometrics PVCAM library.
Hazen 10/17
"""
import ctypes
import numpy
import sys
import storm_control.sc_library.halExceptions as halExceptions
import storm_control.sc_hardware.photometrics.pvcam_constants as pvc
pvcam = None
def check(value, fn_name = "??"... |
7dc00395ae9e5d598cb69ba661c8f1aa081a354c77ec4c148dec167c92b32cf4 | Python | 18,606 | 428 | # Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
import numpy as np
import torch
import torch.nn.functional as F
from numpy.typing import NDArray
from typing import Tuple
from .edt import edt_triton
def sample_box_points(
masks: torch.Tensor,
noise: float = 0.1, # SAM default
no... |
f3f5000204914a6ac497dfc472036f1e2b76107d09890c4402a38ea7fc5d0690 | Python | 18,607 | 541 | import numpy as np
import torch
from collections import OrderedDict
from skimage import img_as_ubyte
from ..util.util import get_device
import cv2
from skimage import measure
import pandas as pd
import traceback
__all__ = ['to_tensor', 'transpose_spatial', 'universal_dict_collate_fn', 'normalize_percentile', 'random_c... |
b1a0e315247ac819603e7fa024302415670c46ddcffb3920d6d88b5c3e48aace | Python | 18,608 | 486 | # Imports
import sys
import pandas as pd
import numpy as np
import random
from scipy.integrate import odeint, solve_ivp
from lmfit import minimize, Parameter, Parameters, report_fit
def Step(t, stim=5, inter=10, amp=1.0, base=0, k=0, delay=0, decay_f=0):
"""
Feedback (FB) input:
-------------------------... |
e4a4c22026241884ccfd69834043ba07bdf7c97a54c8204f6965c975167ec535 | Python | 18,608 | 596 | import inspect
import math
from collections.abc import Callable, Sequence
from dataclasses import dataclass
from functools import partial
from typing import (
Literal,
Protocol,
Union,
)
import torch
from torch import Tensor, nn
from torch.nn.functional import pad
from transformers import PretrainedConfig,... |
2bc2076825f6d060d2e580713caf996db4298056f0799976ec458fc8070c2ff6 | Python | 18,634 | 474 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 2 19:15:50 2017
@author: ajaver
"""
from tierpsy.analysis.stage_aligment.alignStageMotion import isGoodStageAligment, _h_get_stage_inv
from tierpsy.helper.params import read_fps, read_microns_per_pixel, read_ventral_side
from tierpsy import AUX_FIL... |
6a3535657fb0bafd12b9b9927b571757fe16c51b467deb5b05026bd9e7e06cac | Python | 18,638 | 575 | import math
import torch
from torch import nn, einsum
from inspect import isfunction
from functools import partial
from itertools import islice, cycle
import torch.nn.functional as F
from torch.utils.checkpoint import checkpoint
from math import sqrt
from einops import rearrange, repeat, reduce
from einops.layers.tor... |
d95f3f712b6c8494d3cb8243c016f2da9b760ab453de39b953fb37dc5ef2a181 | Python | 18,654 | 525 |
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains t... |
7050dd52ce55a106688799914887053327b96376510a22dcc0c5e6b514db0a58 | Python | 18,657 | 455 |
""" lasagna plugin for exploring the Allen Brain Atlas:
1. Display of average template brain.
2. Reporting of brain area name
more stuff...
plugin under construction
"""
import lasagna.utils.preferences as lasPref # Module the provides a variety of import functions (e.g. preference file handling)
from PyQt5.QtWidg... |
b552b06664299c358000909bb1ff59495df74ac76882d5ac98dbbc6350ec3ad8 | Python | 18,657 | 274 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 12 09:42:32 2020
@author: jacobb
"""
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
import numpy as np
import torch
from scipy.special import comb
import json
""""
parser = ArgumentParser(
prog='parameters.py',
descripti... |
074fde50c184c0733637811c4c70079b3e3531fecfe8c68eb986a4995eea96e6 | Python | 18,661 | 443 | 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 (
QFileDialog,
QLabel,
QMessageBox,
QPushButton,
QW... |
96f34d5b4ee3bd54aa397b4d0817e93b2da7b832e794a9ecace7d06f4375df93 | Python | 18,667 | 493 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... |
bc354d06222320ffffb156b50faeed571175901a5acac0641449a020dfaa578d | Python | 18,690 | 491 | # Imports
import sys
import pandas as pd
import numpy as np
import random
from scipy.integrate import odeint, solve_ivp
from lmfit import minimize, Parameter, Parameters, report_fit
def Step(t, stim=5, inter=10, amp=1.0, base=0, k=0, delay=0, decay_f=0):
"""
Feedback (FB) input:
-------------------------... |
c2399bb7702d1529cffac6093ed7411bf01d40fa33a973e9f553653df2adb1ed | Python | 18,693 | 365 | """Represents the configuration for Sphinx, which is executed at build time and can be used to configure Sphinx's input and output behavior."""
# pylint: disable=invalid-name
import inspect
import os
import re
import sys
import typing
from collections.abc import Iterator, Sequence
from datetime import datetime
from s... |
897afda14da769fbf55d21bcb78b083e1f8e921b3c8bac94aa02f1f9b3cb6816 | Python | 18,697 | 466 | """
Implementation of the simple task
"""
import time
import enum
import typing
import logging
import datetime
import numpy as np
from ..qt import *
from . import task_context
from .widgets import Form, ListAsTabsWidget
from .util import (
wait_for, wait_for_hold, TaskResult, TaskContextProtocol, CanvasPainterProto... |
9fde97476e414e8366cff780a058f30a0e44720239be797b4a146426eef5e38d | Python | 18,729 | 420 | """Normative IIT and subject-specific lesion disconnection workflow.
The pipeline locates one MNI152NLin6ASym lesion mask in a BIDS derivatives
folder and runs all four lesion-connectivity models exposed by :class:`IITDisconnection`.
"""
from __future__ import annotations
import os
import re
from pathlib import Path
... |
fadfcb6cd5ffbbe91a07ebcb7e179e48f758c77a5452d24c0097e692936280ca | Python | 18,730 | 354 | from brainvoice.data.estimates_loader_utils import load_estimate_labels, load_latent_variables_estimates
import argparse
import numpy as np
from tqdm import tqdm
import pandas as pd
from sklearn.preprocessing import StandardScaler, RobustScaler
from sklearn.linear_model import LogisticRegression
from sklearn.metrics i... |
99c94ed6bc16e5c8013c6cc1704f336001307abcb7850427ea50708692ac8099 | Python | 18,741 | 466 | import os
from typing import Tuple
import numpy as np
import nibabel as nib
import dask.array as da
import matplotlib.pyplot as plt
from util.io import make_dir_if_not_exists
# NOTE due to the normalization, when creating nuances (non binary) headmasks the values
# need to be multiplied with a big number again or with... |
b0984b8f0075b482c76adf7fe190d119b76b235dbb213d1a6c842eb95d7f379e | Python | 18,742 | 309 | import pandas as pd
import os
import torch
import torch.nn as nn
import lightning.pytorch as pl
from enformer_pytorch.finetune import HeadAdapterWrapper
from enformer_pytorch import Enformer
from torchmetrics.regression import PearsonCorrCoef,R2Score
from warnings import warn
def masked_mse(y_hat,y):
"""
remov... |
b7c5dcbdad03c76e2fe1dd7f4b24b6d4dda514e907f8eee4d322d61e7d7de906 | Python | 18,748 | 565 | import argparse
import base64
import gc
import io
import os
import random
import threading
import time
from concurrent.futures import ThreadPoolExecutor
from queue import Empty, Queue
from threading import Lock
from typing import Any
from datasets import load_dataset
from fastapi import FastAPI, WebSocket, WebSocketDi... |
b5c01049fcbfa50a96daae9253d3b76e5a359e1e9d4b59745ac18c260ea685c8 | Python | 18,760 | 414 | #!/usr/bin/env python
# This is a pipeline doing resting-state fMRI preprocessing and calculates the RPN-siganture
# that is, makes a guess for pain sensitivity
#
# This is the BIDS version.
# See:
# https://spisakt.github.io/RPN-signature/
#
# The pipeline performs:
# - a standard anatomical image processing (AnatProc... |
c3e1e0b747350833c068a74ebc5dcee5075ababd6f9ec861d60503f4ca9793b8 | Python | 18,760 | 558 | import abc
import shutil
from pathlib import Path
from typing import get_args, Final, Literal, Iterable
from neuralib.atlas.ccf.matrix import load_transform_matrix
from neuralib.atlas.typing import HEMISPHERE_TYPE, PLANE_TYPE
from neuralib.typing import PathLike
from neuralib.util.utils import joinn, uglob, ensure_dir... |
cb93c05b296b44c7907dbf1d950e37f709962a91fc29da49b431f9a37ebc3e87 | Python | 18,762 | 370 | """Tests for the pure fitting/alignment helpers in _thickness_worker (numpy/scipy)."""
import numpy as np
import scipy.optimize as opt
from surface_morphometrics import _thickness_worker as tw
def _fit_bilayer(dat, x):
"""Mirror the dual-Gaussian offset fit used in fit_triangle_chunk_offsets."""
mid = len(da... |
899dce38c9f7c8cac381df7f97a8649c598ac769c7dd0ebcfaf58cf73191b2ad | Python | 18,763 | 509 | from abc import ABC
from pathlib import Path
from typing import Any
import datetime
import pandas as pd
import numpy as np
import h5py
import copy
import seisbench
from .base import AbstractBenchmarkDataset, MultiWaveformDataset
NPArrayOrHDF5Dataset = np.ndarray | h5py.Dataset
class DASDataset:
# File path for... |
0a1c436e2701ad9d18f8593afdce415f193c40712f16fc33138198e0afdae1e0 | Python | 18,768 | 514 | """
Molecular structure analysis and visualization for TChemGNN paper.
This script analyzes molecular properties and creates visualizations
comparing isomers as shown in Figures 2 and 3 of the paper.
FIXED VERSION: Handles RDKit Draw module import issues
"""
import os
import pandas as pd
import numpy as np
import mat... |
70ebef999005de244e3554cbd207febf7bb4867287d6b7d075cc19cc3f155317 | Python | 18,787 | 602 | import inspect
import math
from collections.abc import Callable, Sequence
from dataclasses import dataclass
from functools import partial
from typing import (
Literal,
Protocol,
Union,
)
import torch
from torch import Tensor, nn
from torch.nn.functional import pad
from transformers import PretrainedConfig,... |
a8f24618f1a16051f90c4f09fdbdd5ab04a6b735bfc7def035f438d84be6ca21 | Python | 18,787 | 529 | """
Data Preprocessing Utilities for PAH Removal Analysis
Author: [Your Name]
Date: 2025
Description: Comprehensive data preprocessing, cleaning, and transformation utilities
"""
import pandas as pd
import numpy as np
from sklearn.preprocessing import StandardScaler, MinMaxScaler, RobustScaler
from sklearn.preprocessi... |
0822ef8f72c608d69159234403cc2cf1bf70a05805764b9cfe58dfe9c8dbb0f1 | Python | 18,789 | 485 | #!/usr/bin/env python
# Copyright (c) 2015 Tobias Neumann, Philipp Rescheneder.
#
# This file is part of Slamdunk.
#
# Slamdunk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
#... |
7e817b1e4127dd7476df5483ea7bbbdd73458e6aa6d5dafffb01c59a19fb19c4 | Python | 18,801 | 560 | import logging
import torch
import torch.nn as nn
from unicore import utils
from unicore.models import (
BaseUnicoreModel,
register_model,
register_model_architecture,
)
from .layers import (
AtomFeature,
EdgeFeature,
SE3InvariantKernel,
MovementPredictionHead,
EnergyHead,
Linear,
... |
0ad62ed45809d4a62787b56a22792720e3bd43d8998f859fe4061f0d790dfea5 | Python | 18,806 | 464 | """
PoseProcessingPipeline: end-to-end kinematic feature extraction from COCO-17 pose CSVs.
Accepts output from sam3d-video-pose or any other COCO-17 CSV source.
"""
import warnings
from datetime import datetime
from multiprocessing import Pool
from pathlib import Path
from typing import Dict
import numpy as np
impo... |
c848879352fcd3716e4caa1664549c3e869f749ac8f6642eeb09d40b68362692 | Python | 18,808 | 484 | #pylint: skip-file
#type: ignore
"""
Implementation of the suppressed reach 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 ... |
57fcad256dff8a1fc0a363dec29dda18fd113a16e3260da8a44fc32ec9e0f050 | Python | 18,816 | 554 | from itertools import product, chain
from typing import Union
from warnings import warn
import numpy as np
import torch
def get_pos_labels(v):
labels = np.unique(v)
return labels[labels > 0]
def vec2matches(v):
a_vec, b_vec = v
return list(set(product(get_pos_labels(a_vec), get_pos_labels(b_vec))))
... |
6e3989e55aa86d03e731e574b31723dc914a8320b3d30e5f5a8f032fede428c1 | Python | 18,821 | 518 | #!/usr/bin/python
#
## @file
#
# A ctypes based interface to Andor SDK3.
#
# Note: In order for this to work you need the Andor SDK directory and the
# Bitflow directories in your path. Typical these are something like:
#
# 1. C:\Program Files\Andor Solis\
# 2. C:\BitFlow SDK 5.70\Bin64\
#
# George ?/... |
8e0cbf1980ede704361c6c6c822ac93d61ca5f70502c7ebd131eed87108e4317 | Python | 18,831 | 332 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed May 10 13:05:51 2017
@author: goel
"""
import argparse
from syri import __version__
def syri(args):
# Check that correct version of python is being used
import logging
import logging.config
import os
import sys
logger = loggi... |
02ac0c5876ba048784eaad62704691032e24421c1f50223b85099ee460107f3a | Python | 18,846 | 456 | import random
import numpy as np
import nlpaug.augmenter.audio as naa
import torch
from torchvision.utils import _log_api_usage_once
from torchvision.transforms import transforms
from torchaudio import transforms as T
from .time_warping import sparse_image_warp
__all__ = ['augment_raw_audio', 'SpecAugment']
def aug... |
8d845b1e0b4b5022cbc9b58a405e19a6425103c68763671eef5ff0ccc6e9385d | Python | 18,847 | 340 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import plotting_related_functions
import KC_population_calcium_rate_model_functions as mdl
import os
import pandas as pd
import scipy.stats as st
from statsmodels.stats.multicomp import pairwise_tukeyhsd
from statsmodels.f... |
8065ab17a86404d6cc1c3eda065d428fc6c84f8c904fca45987cb339a10a310e | Python | 18,852 | 534 | import math
import numbers
import random
import warnings
from typing import List, Sequence, Tuple, Union
import torch
import torchvision.transforms.functional as F
try:
from torchvision.transforms.functional import InterpolationMode
has_interpolation_mode = True
except ImportError:
has_interpolation_mode =... |
a12fbcaa3c7673e38148e2f27faf50ed89ce4fdd19a55a5298502be46622f768 | Python | 18,859 | 264 | #!/usr/bin/env python
"""
01-cnv-frequencies.py
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Functions to create copy number variation (CNV) cancer type and study gene-level frequencies for OPenPedCan analyses modules
"""
__author__ = ('Eric Wafula (wafulae@chop.edu)')
__version__ = '1.0'
__date__ = '12 July 2021'
import os
i... |
35f29eaad5683ae74f65c835c25b479ddc69f27633fa11eea07108f36e007dcb | Python | 18,861 | 405 | # =========================
# App - Visualizing markers of EEG compexity
# Lina Jeantin, Nov. 2025
# lina.jeantin@proton.me
# =========================
# app.py
import os
from pathlib import Path
import numpy as np
import pandas as pd
import streamlit as st
import plotly.graph_objects as go
import mne
# =============... |
f51a7ddc96022092541a0a5af64d6e6ef5cb2127e531d5fca3c63c8fa873073b | Python | 18,864 | 593 | # -*- coding: utf-8 -*-
"""Cut surface mesh."""
import os
import sys
import nibabel as nb
import numpy as np
from nibabel.freesurfer.io import read_geometry, read_label, write_geometry
from numpy.linalg import norm
from ..surface.mesh import Mesh
from ..surface.smooth import mris_smooth
__all__ = ["cut_mesh"]
# p... |
07e573c797d30bf124ea41a54afff7be46493d0dd2f29f4ae1b76c72cbcce798 | Python | 18,879 | 344 | """
Authors: Jesper Browall, Jonathan Arvidsson, Sahlgrenska University Hospital and Gothenburg University, Gothenburg, Sweden
This file contains plot functions called by the class AutoAifSel when input variable 'doPlot' is set to True.
"""
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib imp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.