sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
83c0af72a735aca4cdc86db74a998deb3e68dbd36ded5365b8da4a00d23e8dff | Python | 14,002 | 397 | import numpy as np
import pytest
from nelpy.analysis import ergodic
class TestSetSelfTransitionZero:
"""Test the set_self_transition_zero function."""
def test_set_self_transition_zero_basic(self):
"""Test basic functionality of set_self_transition_zero"""
# Create a test matrix
matr... |
31a24f2c7d2a7852a72ed8b9d519b774ce7b630ab166214fcf242095b642b2b7 | Python | 14,003 | 404 | """
This script computes the predicted switch based on neural activity for each
session.
"""
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import numpy as np
import os
import json
from copy import deepcopy
from pyTdr.tdrLoadAccData import tdrLoadAccData
from py... |
c3d88e3d56516df2208a9925100cfee6b510a692fe17c4045146902156f6df08 | Python | 14,007 | 394 | import math
import warnings
import logging
from pathlib import Path
from typing import List, Union
import torch
import torch.nn as nn
import flair.nn
import flair.embeddings
from flair.data import Dictionary, Sentence, Label
from flair.datasets import DataLoader
from flair.file_utils import cached_path
from flair.tra... |
73165d963eff8c9b7fb3617beaa301ed684215c3cf2d255a0ef8d9fb22f4f190 | Python | 14,011 | 373 | """SeqNN regression metrics."""
import pdb
import numpy as np
import tensorflow as tf
from tensorflow.python.keras import backend as K
from tensorflow.python.keras.utils import losses_utils
from tensorflow.python.keras.losses import LossFunctionWrapper
from tensorflow.python.keras.utils import metrics_utils
#########... |
be933b02b94aff7a5adc5f80c0dcf0536506539005b5c5562f325ecb75be3d62 | Python | 14,011 | 415 | from __future__ import annotations
import argparse
import contextlib
import io
import multiprocessing
import os
import sys
import traceback
import types
import warnings
from pathlib import Path
from typing import AnyStr
from typing import Final
from loguru import logger
from PySide6 import QtCore
from PySide6 import ... |
87f7c6a944772e351dbdfd39f244ba5f65657a7c61c20c3a709a1205aeba5996 | Python | 14,012 | 434 | import os.path as op
import pytest
import numpy as np
from conftest import load_data
from pydesigner.fitting.dwipy import DWI
from pydesigner.fitting.dwidirs import dirs30
DATA = load_data(type="hifi")
PATH_DWI = DATA["nifti"]
PATH_BVEC = DATA["bvec"]
PATH_BVAL = DATA["bval"]
PATH_MASK = DATA["mask"]
def is_all_non... |
a645aab1fccea508b8d829ce4871eea50cd1f0470457636987d14e8a88418a2b | Python | 14,012 | 373 | # Info: originates from SEAL_OGB: https://github.com/facebookresearch/SEAL_OGB
# 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
from tqdm import tqdm
import random
import numpy as ... |
352102742a55c27c273aff60fb1260f609fb451a0d74c0c4f02359f26a89a37d | Python | 14,014 | 424 | import sys
sys.path.append("./src")
from napari_dmc_brainmap.utils.atlas_utils import xyz_atlas_transform
from napari_dmc_brainmap.utils.atlas_utils import get_decimal
from napari_dmc_brainmap.utils.atlas_utils import coord_mm_transform
from napari_dmc_brainmap.utils.atlas_utils import sort_ap_dv_ml
from napari... |
cd7edac9fcedc09bdb0df81a9c4836f1bfb4a297f440f08294bbfa0be48ada5d | Python | 14,014 | 264 | '''
embeddings::func.py
General purpose functions for semantic embeddings we are creating as well
as stimulus creation functions (primarily math & classification related).
Available as embedding.*
'''
from .internal import *
import numpy as np
import pandas as pd
import sklearn
from sklearn.cluster import... |
1ee555c9455a2cd3d4a860aa8fe85d122d1f77caec4373ed3883c71845fad26e | Python | 14,017 | 403 | """
Base GUI class for MuscleX image applications.
Provides common initialization flow and UI components for all MuscleX GUI applications.
Uses Template Method pattern to allow subclasses to customize specific steps.
This is a minimal framework class. For image processing GUIs, use ProcessingWorkspace.
For image view... |
ea90d75a289a4c11abaf0655359eaa4ea30416d2e833d665131030945c6d8272 | Python | 14,018 | 223 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'camera-params-detached.ui'
#
# Created by: PyQt5 UI code generator 5.10.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_GroupBox(object):
def setupUi(self, GroupBox):
... |
0c49ff6d3b73abd057710a049927add9a50a217abb35bd54ab4ea27291395b40 | Python | 14,020 | 359 | import os
import re
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from util.config_vars import config
from util.io import make_dir_if_not_exists
class FinalDatasetPreprocesser:
"""Processor for final data preparation with settings for feature-amount,
whether to k... |
e74c4fb23073dea8a47c60fa21a616e894abaebea704a7d4d5fe0b8cc580cc2d | Python | 14,028 | 445 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the PyMVPA package for the
# copyright and license terms.
#
### ### ### ### ###... |
39404b6c3cb5ddadb01c9b3d474f48367f9aca4d4e2ca463b49915d17d3ac5ac | Python | 14,032 | 440 | #!/usr/bin/env python
import os
import subprocess
import ruamel_yaml as yaml
import configure_seaborn as cs
import matplotlib.lines as mlines
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
import seaborn as sns
import utils as utils
from matplotlib.gridspec import GridSpec
from matplotlib.p... |
458e5ac5b652e659d1548a526a43183e91d61a365e990b78226b43a309bb5117 | Python | 14,034 | 311 | import os
import cv2
from os.path import join
import pickle
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression
from labellines import labelLine, labelLines
import numpy as np
from skimage import io, color
from statannot import add_stat_annotation
import pandas as pd
import seaborn as s... |
b081ef412b0b6a5df1f4c43a1e99170d460008da0c475a286e3146eb4a1203e1 | Python | 14,038 | 327 | MIT License
Copyright (c) 2023 Renaud Bastien
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, publish, di... |
1decd9687e2181d94f46bc74fa0b55cb149e9e6a1409ecb9613750146f9a5e19 | Python | 14,043 | 325 | # import gymnasium as gym
import json
import math
import os
import random
import time
from collections import deque, namedtuple
from itertools import count
import gym
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
... |
7392cf86a1a2382e7de734fd88744200c573bac4586f1a65dbb37313e2f617b5 | Python | 14,043 | 332 | # ========================
# 📦 Imports & Setup
# ========================
import os
from datetime import datetime
import bibtexparser
import pandas as pd
import streamlit as st
import yaml
from src.utils.app_utils import footer, set_mypage_config
from src.utils.config import data_dir, file
from src.utils.data_loader... |
3cabb27981e49fc46a76f42b8358ec29eebeda5edd6ad58878369cc2d5aa9512 | Python | 14,049 | 352 | """
Simplified graph utilities for SphereGraphDataset.
Contains only the essential functions needed without external dependencies.
"""
import numpy as np
from pathlib import Path
from typing import List, Optional, Tuple
import torch
from torch_geometric.data import Data
from torch_geometric.nn import radius_graph
de... |
e249d229b132e46a6b9d2cd290927c7827e145835b08b6dd3de3da6df6457b1d | Python | 14,054 | 308 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import tempfile
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_testing_files_dict(), keys=['ihMT.zip'])
tmp_dir = tempfile.Tempora... |
f8261a9b5724ee3df9cfc08629aa610a76186e3c11e75622c8980afcd8505a27 | Python | 14,055 | 299 | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from functools import partial
from modules.utils import *
import os
from tqdm import tqdm
from PIL import Image
from diffusers import DDPMScheduler, DDIMScheduler, DDIMInverseScheduler
import cv2
class DDPM(nn.Module):
def __init... |
da17a356281680b5431c5fc241103d9156c332640c8189a904b4c25a78252bf9 | Python | 14,062 | 334 | #############################################################################
# Copyright (C) 2020-2026 MEmilio
#
# Authors: Manuel Heger, Henrik Zunker
#
# 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... |
4fce2c8aea6f0451793b93c5cba13161dc74e82d167644cfff8944fe58cabc8a | Python | 14,066 | 220 | import os
import pandas as pd
import json
import nibabel as nib
import numpy as np
import re
from nipype import Node, Workflow, MapNode
from nipype.interfaces.utility import IdentityInterface, Merge, Function
from cvdproc.pipelines.smri.freesurfer.synthstrip import SynthStrip
from cvdproc.bids_data.rename_bids_file i... |
8677dbe632092fce817f6787b06177f212377547b5fb9549ee3f3d32d35b018d | Python | 14,068 | 335 | import os
import os.path as osp
import pathlib
from typing import Any, Sequence
import torch
import torch.nn.functional as F
from rdkit import Chem, RDLogger
from rdkit.Chem.rdchem import BondType as BT
from tqdm import tqdm
import numpy as np
import pandas as pd
from torch_geometric.data import Data, InMemoryDataset,... |
d1cc4d378d44c8bccc366e06e969f08f5a134541d800fb36e073e9969771f6d0 | Python | 14,069 | 397 | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import Functional_Fusion.atlas_map as am
from Functional_Fusion.dataset import DataSetMDTB
import os
import OptimalBattery.util as ut
from scipy.stats import ttest_1samp, ttest_rel
from OptimalBattery.global_config import data_dir, save_dir
from mat... |
16f56dd8aaa87974fce9eb2a157c9649055785a60a09c385884f9b95ce185745 | Python | 14,073 | 408 | import logging
import random
from collections import defaultdict
from collections.abc import Callable, Generator, Sequence
from dataclasses import dataclass
from pathlib import Path
from typing import (
TYPE_CHECKING,
Any,
)
import numpy as np
import pandas as pd
import seaborn as sns
import torch
from captum.... |
d5c1f83ec230d6b4528087b79710d6e470f37825bff9a8f49c92a34a39f3eebc | Python | 14,077 | 370 | import numpy as np
import csv
from . import plotting_basics as pb
get_n_elecs = lambda myhand: myhand['processing/LFP/data'].shape[1] #myhand['/general/extracellular_ephys/electrodes/id'].shape[0]
is_npx = lambda myhand: get_n_elecs(myhand)>150
def get_probetype(myhand,npx_thr=383,silicon_val=32):
n_elecs = get_n... |
1b7a31faf06e06e80e61fca985cd6cce90c83d35200f89da1a92b9a4d842aa3c | Python | 14,079 | 383 | """Plot the analyses results for individual NSD-core's ID/OOD and
NSD-synthetic's test splits.
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 features.
... |
b082cea727709f3f84d37a14aa0f13a0520b9c37a52be5aef4cb8fe75b52f34c | Python | 14,079 | 370 | # -*- codingraph: utf-8 -*-
'''#### Set of functions to construct shapes in a network(i.e, subgraphs of a
#### particular shape)
'''
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
import scipy as sc
def barbel_graph(start, n1, n2, role_start=0, plot=False):
'''Creates a Barbell-graph (tw... |
e70757ea47d3998f1b99c0631f6bff565e8a158e6b53bdbb97d7c73e2be241eb | Python | 14,079 | 301 | """
Rewitten registration pipline for HiP-CT from Joseph Brunet's codes
"""
import registration_config as config
import helper
import glob
import natsort
import os
import loading
import skimage.io as skio
import numpy as np
import SimpleITK as sitk
import skimage as ski
import math
import matplotlib.pyplot as plt
impor... |
4279e5c3c860f3501d910d28e4bd5f696d529316e9715759333dd17ff1f6c646 | Python | 14,082 | 419 | # -*- coding: utf-8 -*-
import os
import tempfile
import nibabel as nib
import numpy as np
from dipy.io.gradients import read_bvals_bvecs
from numpy.testing import assert_equal, assert_almost_equal
from scilpy import SCILPY_HOME
from scilpy.image.volume_operations import (apply_transform,
... |
348169a840479e746aee5535bdd36a3226c59d3fcc6234246a352ada569e9378 | Python | 14,084 | 425 | import logging
import os.path as op
from time import time
import bibtexparser
import immlib
import nibabel as nib
import numpy as np
import pandas as pd
from dipy.align import resample
from plotly.subplots import make_subplots
import AFQ
import AFQ.utils.streamlines as aus
from AFQ.tasks.utils import get_fname, get_t... |
525cb706ac314d001d2ffe991811131d0b06d89e55bfdc48096daf804f0ddb45 | Python | 14,091 | 358 | # -*- coding: utf-8 -*-
from flair.parser.modules import CHAR_LSTM, MLP, BertEmbedding, Biaffine, BiLSTM, TrilinearScorer
from flair.parser.modules.dropout import IndependentDropout, SharedDropout
import torch
import torch.nn as nn
from torch.nn.utils.rnn import (pack_padded_sequence, pad_packed_sequence,
pad... |
65cf38ebaaefc9b5bcc73e490ba29a75c5ebc87431f34723d69090c7e0c569d8 | Python | 14,095 | 369 | from turtle import forward
import torch
from torch import nn
from torch.nn import functional as F
import torchvision
from pathlib import Path
import os
script_dir = Path(__file__).parent
project_root = Path(__file__).resolve().parent.parent
class cats_net(nn.Module):
def __init__(
self,
symbol_si... |
2639ae2ca1d980097a83d2910dd344eee4d844c8a90741528011058cb63d1a72 | Python | 14,096 | 467 | # -*- coding: utf-8 -*-
"""
Processing Brain Samples - Test Image Processing Parameters
Created on Thu Jun 4 14:37:06 2015
@author: ckirst
"""
import os
import numpy
import sys
# path to illastik installation
sys.path.insert(1, '/home/ckirst/programs/ilastik-05')
from iDISCO.Parameter import *
from iDISCO.IO imp... |
8be0d2850c167c5be3bb3153c2d0027f136593f47eea477409ada31edaf178e0 | Python | 14,101 | 349 | from logging import raiseExceptions
import os.path as osp
import warnings
from collections import OrderedDict
from functools import reduce
import mmcv
import numpy as np
from mmcv.utils import print_log
from prettytable import PrettyTable
from torch.utils.data import Dataset
from depth.core import pre_eval_to_metrics... |
f1638d74668598e3057c3b89455cb7db9c3af18068d5b20fbc3e470d444a3dca | Python | 14,105 | 361 | #libraries
import os
import time
import h5py
import argparse
import numpy as np
import pandas as pd
import multiprocessing
import skimage.io as io
from functools import partial
from skimage.transform import resize
from sklearn.model_selection import train_test_split
from scipy.stats import mode
from PIL import Image
Im... |
08a2844d8d6f10be44978c09141de50b3892eee2ab8eb00aff806ba9427c0f80 | Python | 14,108 | 390 | """Registry for ChemGraph worker graph constructors."""
from __future__ import annotations
import importlib
import inspect
from collections.abc import Callable, Iterable, Mapping
from dataclasses import dataclass, field
from typing import Any
from deepagents.middleware.subagents import CompiledSubAgent
from chemgra... |
6eef1ce3ba479116ed2d8b443ebec42f268cb0507d21fe953111399ac7881f69 | Python | 14,111 | 319 | """
Simulation utility functions.
Author: florian.birk@tuebingen.mpg.de
"""
# %% import
import sys
import h5py
import os
from pathlib import Path
import numpy as np
nib_dtype, nib_cdtype = np.float32, np.complex64
# Add parent directory to path for utils import
sys.path.append(str(Path(__file__).parent.parent))
try:... |
77b735c650232ed0df0c8b5cd32b91bb3082a3871d0a4966200596141f89e5e9 | Python | 14,112 | 398 | import numpy as np
import pandas as pd
import random
import torch
import esm
import torch.nn.functional as F
import torch.nn as nn
from sklearn.metrics import mean_squared_error
from scipy.stats import pearsonr, spearmanr
import random
from sklearn.metrics import root_mean_squared_error,mean_absolute_error, accuracy_sc... |
7ad35d1b97997be21f8675a452cc9a7c8400983994a0332fe6a074d3433729bf | Python | 14,113 | 387 | 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, \... |
bacfbedf361d59833b00ae69c3b944cbbd102da3daca588748f7156ed2940501 | Python | 14,114 | 319 | """
Authors: Jesper Browall, Jonathan Arvidsson, Sahlgrenska University Hospital and Gothenburg University, Gothenburg, Sweden
The file AIF_selection_automatic contains the fully automatic whole-brain AIF-selection method for DSC-MRI concentration data
orignially published by Mouridsen et al. 2006 titled "Automatic s... |
d1e02fb9b743d7e7d112831ef5c51c746ead6b1e397f1cd5b3c865a80c2783d4 | Python | 14,116 | 285 | #!/usr/bin/env python3
import pandas as pd
import numpy as np
import argparse
import os
def args():
p = argparse.ArgumentParser(description="Genome-wide rare SV pool discovery")
p.add_argument("--input", required=True, help="Input collapsed SVs")
p.add_argument("--sample", required=True, help="Sex and gro... |
9cc234b715f070ba105883ac5395284e7b192ee3c3618c151b68ed8293b922f1 | Python | 14,124 | 343 | # TODO add typing and docs
from __future__ import annotations
import datetime
import shutil
from pathlib import Path
from typing import Any, Dict, List, Optional, Union
import ants
from brainles_preprocessing.registration.registrator import Registrator
VALID_INTERPOLATORS = [
"linear",
"nearestNeighbor",
... |
c799eb2223e1fb519714c7829056811347857b7c217ab9321a90063210ab9f3a | Python | 14,126 | 399 | # 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
# distributed under th... |
362c4697f4e52e99f706309a00901f08c69e3fbbc11c2cf997aa4ba1e5838bac | Python | 14,128 | 324 | import numpy as np
from matplotlib import pyplot as plt
import matplotlib as mpl
def get_cdict_and_vec(cmap_clust,labels):
ncl = len(np.unique(labels))
cmap = mpl.cm.get_cmap(cmap_clust)#
norm = mpl.colors.Normalize(vmin=labels.min(), vmax=labels.max())
cdict_clust = {lab:cmap(norm(lab)) for lab in n... |
b69b0776522451ce9aac93d2076ba61ec2036b3e889d3fcfe222556d0af56b57 | Python | 14,129 | 340 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Local streamline HARDI tractography including Particle Filtering tracking.
WARNING: This script DOES NOT support asymmetric FODF input (aFODF).
The tracking is done inside partial volume estimation maps and uses the
particle filtering tractography (PFT) algorithm. Se... |
00f6e509c2476259df6880459ceb3b9a92bbe1f9d4c94406ee5d1b83aa14d026 | Python | 14,131 | 355 | import numpy as np
import numpy.linalg
import scipy.sparse
import scipy.stats
import sys
from typing import Union
def likelihood_ratio_test(
ll_full: np.ndarray,
ll_reduced: np.ndarray,
df_full: int,
df_reduced: int
):
"""
Perform log-likihood ratio test based on already fitted... |
b57803a05d9218c02b356bf0bf0e65812917e19ebee6653e7e8f865da5426795 | Python | 14,131 | 370 | #!/usr/bin/env python
"""
Base class / functionality for controlling a motorized stage.
Hazen 04/17
"""
from PyQt5 import QtCore
import storm_control.hal4000.halLib.halMessage as halMessage
import storm_control.sc_hardware.baseClasses.hardwareModule as hardwareModule
import storm_control.sc_library.parameters as pa... |
c62cd39f6cc0dda64eb6a929d3e5a3d50e992f0882ad947460a68281752e6caa | Python | 14,131 | 410 | """Tests for the human-in-the-loop interrupt/resume functionality.
Tests cover:
- The ``ask_human`` tool (interrupt mechanism)
- The ``PlannerResponse`` schema with ``ask_human`` next_step
- The ``human_review_node`` in the multi-agent graph
- The ``planner_agent`` returning ``ask_human`` routing
- Single-agent and mu... |
5f9560e8ba197dbb33126da032684d7ec0f6eea334a00ccdbba3111b5fe086c4 | Python | 14,137 | 329 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Divide a tractogram into its various connections using a brain parcellation
(labels). Allows using our connectivity scripts. See for instance:
>>> scil_connectivity_compute_matrices
The hdf5 output format allows to store other information required for
connectivity, su... |
b7d7b812036e280879b024a4bfd39609eb90522c92cb22fa8e7b5cd5ea19d6f6 | Python | 14,138 | 420 | # Source: https://github.com/Extrality/ICLR_NACA_Dataset_V0/blob/main/models/GUNet.py
import torch
import torch.nn as nn
import torch_geometric.nn as nng
import torch.nn.functional as F
from torch import Tensor
from torch.nn import BatchNorm1d, Identity
from torch_geometric.nn import Linear
class MLP(torch.nn.Modul... |
6196596b25c92ea777ef7c5cb33597e5259cf0aa3d159755ca06491696d7a3ac | Python | 14,139 | 321 | # -*- coding: utf-8 -*-
"""Untitled55.ipynb
Automatically generated by Colab.
Original file is located at
https://colab.research.google.com/drive/1eyM1KeJCgb60xwNEa9UBVoEkpJq4XS5k
"""
# === Imports ===
from Crypto.Cipher import Blowfish
from Crypto.Random import get_random_bytes
from Crypto.Util.Padding import p... |
63752a27a69eb6640c296b8d5f34f5e22697ca2097666a565ae227850287c500 | Python | 14,140 | 447 | import nibabel as nb
import numpy as np
import os
import glob
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from scipy import stats
from collections import Counter
subs = ['sub-02', 'sub-05', 'sub-06', 'sub-07', 'sub-09', 'sub-10', 'sub-12', 'sub-15', 'sub-16', 'sub-17', 'sub-18']
# for su... |
fdf456bcd03c0b8fb3e0566c16450aa72810e27ac5fbc077fe2c6adde1b1a2af | Python | 14,141 | 408 | import logging
from math import radians
from time import time
import dipy.data as dpd
import nibabel as nib
import numba
import numpy as np
from dipy.align import resample
from dipy.core.sphere import HemiSphere
from dipy.io.stateful_tractogram import Space, StatefulTractogram
from dipy.reconst import shm
from dipy.re... |
ff247827245a5aaae18e45435b817df35b1cf030414915a2e4667e25224fc37b | Python | 14,141 | 382 | """Mixins for plotting.
To work the mixin requires the class to implement `get_data_for_plot` with the
supported plot names. See .data_extractors for examples. """
from . import plots
class WeightPlotterMixin:
"""Mixin to add members to for weight estimation plotting.
Class must implement:
* `get_dat... |
2c5663c6ae8a059b79e9cf0bce789ccde92d0bd156ca3c5d214ee403f3bb7bdd | Python | 14,148 | 357 | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from nets.xception import xception
from nets.resnet import ResNet, resnet101, resnet50, resnet34, resnet18
from .eca_module import eca_layer
from functools import partial
from timm.models.layers import DropPath
class Mlp(nn.Module):
... |
b0644ed4714a2de0048598e27ba9f2822955219b0509a772ccaa3206684688e1 | Python | 14,149 | 411 | import logging
import pandas as pd
import pyfocus as pf
from sqlalchemy import create_engine
__all__ = ["import_fusion", "import_predixcan"]
# TODO: implement exporting to predixcan/fusion
COUNT = 250
def import_fusion(path, name, tissue, assay, use_ens_id, from_gencode, session):
"""
Import weights from... |
192f9d6c4fa156eaa2d129364cee5ac91f10c8d8a73a95179fe71a70867ae826 | Python | 14,156 | 303 | '''
Author: Mikhail Milchenko, mmilchenko@wustl.edu
Copyright (c) 2026, BMRL, Washington University School of Medicine
Redistribution and use in source and binary forms, for any purpose, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must ... |
b66263f3e19c0f11a59341884cca9aa8d018c47f5fdcac6794e0ba58a985ab3d | Python | 14,164 | 424 | # Copyright 2025 BDP Ecosystem Limited. 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 applicab... |
2dd11675fb6ea04f85c5acee62d612b789248a01af464a499b34f31911bd32bc | Python | 14,178 | 347 | """Prepare the NSD-core betas in fsaverage space. The betas are then divided
into train and test split for encoding models training and testing.
The train split consists of the fMRI reponses for the (up to) 9,000 subject-
unique images. The test split consists of the fMRI responses for 284 NSD-core
shared images that ... |
8505e68b623c388245283e675ebde45af4f816f0283610e731c7cb54e6fd496a | Python | 14,178 | 357 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Long-term fiber photometry batch analysis script (GitHub-ready)
(For lock-in demodulated CSV files)
This version is intended to reproduce the same results as the "paper-used" code:
- Uses pandas Series mean/std behavior (std uses ddof=1 by default)
- No extra f... |
f5e09227dc8641a453d685395438dad99224e65f8a51d67c27fe6dee63e0fc02 | Python | 14,181 | 337 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Local streamline HARDI tractography.
The tracking direction is chosen in the aperture cone defined by the
previous tracking direction and the angular constraint.
WARNING: This script DOES NOT support asymmetric FODF input (aFODF).
Algo 'eudx': select the peak from t... |
9c0f7245967b2ed4bb0c0f8c688d2703fc289153aea9d16b824befd6fcba3b0c | Python | 14,185 | 345 | """ Model Registry
Hacked together by / Copyright 2020 Ross Wightman
"""
import fnmatch
import re
import sys
import warnings
from collections import defaultdict, deque
from copy import deepcopy
from dataclasses import replace
from typing import Any, Callable, Dict, Iterable, List, Optional, Set, Sequence, Union, Tuple... |
d818beff196c18851428378e3bb061693a827399fafe2c5bbbf30ef6982532db | Python | 14,192 | 370 | r"""Pooling package."""
import warnings
from typing import Optional
from torch import Tensor
import torch_geometric.typing
from torch_geometric.typing import OptTensor, torch_cluster
from .avg_pool import avg_pool, avg_pool_neighbor_x, avg_pool_x
from .glob import global_add_pool, global_max_pool, global_mean_pool
f... |
ca64583f64fc8578d357ff9562580d6c2d1a3361e1bcfc029779b0d9f436df93 | Python | 14,203 | 375 | ## ------------------------------------------------------------
## IMPORTS
## ------------------------------------------------------------
## ----- OS ----- ##
import os
import gc
import io
## ----- MATH / STATS ----- ##
import cv2
import heapq
import random
import natsort
import scipy.io
import numpy as np
from scip... |
90d11f145b1f6d02da8a483acea96fab30b7c1c14da15faa73adc80462e3f80a | Python | 14,208 | 375 | """Backend-agnostic MACE MCP server.
Uses :class:`~chemgraph.mcp.cg_fastmcp.CGFastMCP`. Tool functions are
plain computation -- the framework handles backend submission, future
resolution, and async job tracking.
Transport (local-file embedding, pre-staged remote-path passthrough)
lives in a single pre-submit hook so... |
01031880ea0f9884d36724589b36c38bf064fe65c18f5efbc7b3143d1e700079 | Python | 14,211 | 360 | """
Supplementary Figure S8: Corpus callosum segmentation and regional qMRI analysis based on large cohort 3T dataset
Three-part figure showing corpus callosum (CC) anatomical segmentation and regional parameter variation:
(A) Anatomical overlays: CC segmentation overlaid on FA maps in sagittal, axial, and coronal vie... |
2e7c392e01b2d961692ab953fd36fa2bf922972113677b95ec75c421692112f3 | Python | 14,214 | 150 | from testsetclass import TestsetClass
class W411(TestsetClass):
def __init__(self):
self.weak = 1.0
self.molecules = ['hcn', 'n2', 'hocl', 'hcno', 'methanol', 'ch2-trip', 'honc', 'hocn', 'alh', 'p4', 't-hono', 'oxirene', 'hnnn', 'c2h3f', 'c2h2', 'bf', 'alh3', 'co2', 'f', 'c2', 'hcnh', 'cs2', 'ch3n... |
e3eff928d92c6ae00b61be38fe90b7f4464b23e93fcc6d6c4451f5c639987650 | Python | 14,218 | 409 | import os
import time
import shutil
import numpy as np
import pandas as pd
from tqdm import tqdm
from scipy.stats import chi2
import heig.input.dataset as ds
from heig.wgs.gwas import DoGWAS
from heig.wgs.null import fit_null_model
from heig.wgs.relatedness import LOCOpreds
from heig.wgs.utils import read_genotype_data... |
b9b2c0c5a2f8dae12e4c2f4a6e6c17cb774806f96f21d3147677fe0dd47988cf | Python | 14,219 | 287 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 20 14:57:45 2020
@author: jacobb
"""
#sbatch run_sbatch.sh --env_file ./envs/11x11_square_obs45_act5.json --n_train_iterations 1000000 --load_existing_model False --nodelist gpu2 --gres gpu:2
# Standard library imports
from argparse import ArgumentP... |
18b3d1f7f796cecdf518643bf810380f656106b592cf64989115d6cc2bfc36d0 | Python | 14,227 | 298 | import argparse
from argparse import Namespace
import torch
from torch.utils.data import DistributedSampler
import torch.utils.data
from mdanalysis.dataset import MDAnalysisDataset, collate_mda
from model.eghn import EGHN
import os
from torch import nn, optim
import json
import time
import random
import numpy as np
f... |
239d6271e3d92d95f3c066b790157b2b9f08282a051b920a122220ca20cd395a | Python | 14,229 | 448 | import logging
from unittest.mock import patch
import numpy as np
import obspy
import pytest
import torch
from obspy import UTCDateTime
from obspy.core.inventory import Channel, Inventory, Network, Station, Site
import seisbench.models
def test_homogenize_station_name():
assert (
seisbench.models.depthp... |
befcf22c116df3299a2f020fa7c3866ed236a927e160be0611823388d65adcca | Python | 14,234 | 355 | import numpy as np
import time
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.autograd as autograd
from UBSIM.blind_SIM_functions import reshape_psf, convolve_with_psf, forward_model, calc_residual, calc_obj_grad, calc_ill_grad
def Iterative_Blind_SIM(M, psf, num_frames, n_iter, alph... |
c8f1e1009bf26034670ebe98ef32183c42437b81cf68f464fb9de8292d4c5722 | Python | 14,238 | 343 | import numpy as np
import matplotlib.pyplot as plt
import pyedflib as pyedf
import pickle as pickle
import os, csv, glob, json, hdf5storage
from os import mkdir, path
from pyxdf import load_xdf
from random import sample
import h5py
def save_variable(variable, name):
final_name = name + '.pickle'
with open(fi... |
ed10106c0e850095ea25bb31ee2f51afdadc96d2d2a4aa1f30a7589a1d3a0b16 | Python | 14,238 | 336 | import numpy as np
def dx_manifold(manifold, idx):
"Backwards difference of manifold co-ordinate idx along the x-axis"
dx = np.empty(manifold.shape[:-1] + (1,), dtype=manifold.dtype)
dx[1:,:, :, 0] = manifold[1:, :, :, idx] - manifold[:-1,:, :, idx]
dx[0, :, :, 0] = 0.
return(dx)
def dy_manifold(m... |
19a6da3d1bd49e916b649b312cc501636120cf1f7819382c3317a02ffa93b5b9 | Python | 14,239 | 348 | import warnings
from typing import List, Optional, Tuple, Union, cast
import torch
from torch import Tensor
from torch_geometric import EdgeIndex
from torch_geometric.data import HeteroData
from torch_geometric.data.datapipes import functional_transform
from torch_geometric.transforms import BaseTransform
from torch_... |
2a22bc5c60ef76a27e80f20adb43f421cee3365b5173e3ae52e2aded427286a0 | Python | 14,239 | 338 | #############################################################################
# Copyright (C) 2020-2026 MEmilio
#
# Authors: Martin J. Kuehn
#
# 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 Li... |
7919588b2a500b9f3d55f317188f12e3d9998a69c5c378b448f43a3654ac0531 | Python | 14,240 | 350 | #!/usr/bin/env python3
"""
Example: CSV (chromophore SMILES + solvent SMILES) -> RDKit conformer -> LMDB for UniProp inference.
The UniProp `pcq` task expects each LMDB entry (gzip-compressed pickle) to contain:
- atoms: array/list of atom symbols (WITHOUT hydrogens)
- input_pos: list of conformer coordinate array... |
4a1d5ea9b10c8e45691fd1df1b25bed6ee28e0bb26623995bae433520c91820d | Python | 14,245 | 363 | #!/usr/bin/env python
"""
This class handles focus lock control, i.e. updating the
position if the focus lock is locked, etc.
Hazen 04/17
"""
from PyQt5 import QtCore
import tifffile
import storm_control.hal4000.halLib.halMessage as halMessage
class LockControl(QtCore.QObject):
controlMessage = QtCore.pyqtSign... |
7b234b3739e86842d816666f73f3ba2dbdcd95788523f78ffbcd0d795c92c5e6 | Python | 14,246 | 324 | # Copyright (c) 2020, Soohwan Kim. 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 la... |
57a1964a6ffac7a1e76a1812af4f4ac3a68028dd51dca1427b313e5f590e4026 | Python | 14,248 | 457 | import os
from datetime import datetime
from flask import Flask, render_template, request, url_for
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import cv2
import imageio
import scipy.ndimage as ndi
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
from... |
d4dd299d3307bd4d85cffbb437551f6e300da92331f55edd2b2c19193e2b935a | Python | 14,251 | 534 | # tifffile/examples/earthbigdata.py
# Copyright (c) 2021-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... |
f2a46a757876a6a211bcc18a80ac86d2728c98f17a65a9c1bb449611de9f5736 | Python | 14,251 | 251 | """
January 2022 by Paulien Voorter
p.voorter@maastrichtuniversity.nl
https://www.github.com/paulienvoorter
Code is uploaded as part of the publication: Voorter et al. MRM DOI:10.1002/mrm.29753 (2023)
requirements:
numpy
tqdm
scipy
joblib
"""
# load relevant libraries
from scipy.optimize import curve_fit, nnls
impo... |
9769a69c1b411ae94ef7c625c8717e5c84fda925c822a5c1d8229da7e66c1084 | Python | 14,254 | 2 | standard_train_fold=['W_GrHtwZez8','3wIejfT9l30','gcDnKQul_c8','qr69jLeQdRA','lo0R1mvjDT8','vKkpvQlHEG8','B6p6X1LSjiA','8m_3eBsy22Y','gfA1xa-BMCg','EqXKrS3gPN4','LTUojzYVUUI','FJF56lmDqQo','QC_4iR0tyvE','E0TBOKN8J2E','g67e0hDT1oQ','s3Czwcz3E-o','D56yCIgqqgk','QQpIBRLlJzo','4pYqIEQow2s','72ltfGTYqpQ','ofvOXABptcY','YlVk... |
8c7f0a7e281a62a7fb0ed8f7d152f9b91119518e740866c06228f6b288ed83f0 | Python | 14,255 | 316 | '''
Quick script to collect data from rERP knock-outs in the learning task
and perform statistical inference.
All options supported by `subject_rerp_mt1_knockout.py` are
also available here, of course.
NOTE: The output report created by this script isn't
necessarily going to include the prettiest figures; it's
mostly... |
4b8f882796943416d7d7213e9a75350b51d335a84189a47e390abb529eed7d1a | Python | 14,256 | 300 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This script computes four myelin indices maps from the Magnetization Transfer
(MT) and inhomogeneous Magnetization Transfer (ihMT) images. Magnetization
Transfer is a contrast mechanism in tissue resulting from the proton exchange
between non-aqueous protons (from macr... |
eefc72f28ccc1869f1075e44a5ededd8eb23b5a175dc8bd8dd74eaa4cae9537a | Python | 14,258 | 357 | """Test the GUI's routes into a ``.meanap`` bundle: View report, and drag-drop.
Run from the repo root::
uv run python python/test_gui_bundle_viewer.py
Express mode leaves almost no figures on disk, so the old View report — which
built a static page from whatever PNGs it found — showed an express run as a
near-e... |
05a1a9e76214489fedd87ea4ef9fe94f77f41d9101ed1c4250b6e8d2ee7e0076 | Python | 14,259 | 305 | ######################################################################################
### Recursively moves through directories to extract parameters, firing rates, and ###
### the recall quality measures Q and MI from spike raster data ###
###########################################################... |
9c7f06a5321c7267975e31b157dcaecf508a55232aeab5cc8234b1629e457ad8 | Python | 14,260 | 433 | import pickle
from collections.abc import Callable
from copy import deepcopy
from dataclasses import dataclass
from pathlib import Path
from typing import TYPE_CHECKING, Optional, Protocol, Union
import numpy as np
import pandas as pd
from aislib.misc_utils import ensure_path_exists
from eir.interpretation.interpreta... |
4c6e24bd2c2a45b7e89c7184a39c4b9c5c5f87034c0484c435f17c1491ecedbb | Python | 14,266 | 269 | from sklearn.metrics import accuracy_score, f1_score, precision_score, recall_score, roc_auc_score
from torch_geometric.nn import HGTConv
import pytorch_lightning as pl
from torch import nn
import torch
from torch_geometric.loader import HGTLoader, NeighborLoader
import argparse
from torch.optim.lr_scheduler import Cos... |
40ee3f14441b72006eec0b8761fb6fb0acd1ba765b449d80c3aa517eaa194afa | Python | 14,278 | 326 | import sys
sys.path.insert(0, './..')
import os
import numpy as np
import matplotlib.pyplot as plt
from HopfiledNetwork import *
from utils import *
import json
from skimage.filters import threshold_mean
from tqdm import tqdm
import configargparse
import pickle
global args
parser = configargparse.ArgParser()
parser.ad... |
e7c4bd8b893e94a54b4a2c752c30d927834623d5ab2bc44d555169b167f64285 | Python | 14,278 | 461 | #!/usr/bin/python3
#
import os
import sys
import argparse
import shutil
from copy import deepcopy
import numpy as np
import vtk
from vtk.util.numpy_support import vtk_to_numpy
from sklearn.neighbors import NearestNeighbors
from uac.element import Element
from uac import utils
import uac.vars as var
# Create the parse... |
c14177d6e86c8f7dcfaaecc3910c913351cf85496aa14455d2c2932207d3bfc0 | Python | 14,279 | 474 | import logging
import os.path as op
from time import time
import nibabel as nib
import numpy as np
from dipy.align import affine_registration, syn_registration
from dipy.align.streamlinear import whole_brain_slr
import AFQ.registration as reg
from AFQ._fixes import get_simplified_transform
from AFQ.definitions.utils ... |
6407d59806f4c779dc4127e430a5b0753622a56bbdbc6e6f29ca7b1d24ae059a | Python | 14,280 | 347 | #!/usr/bin/python3
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import json
import logging
import os
import random
import numpy as np
import torch
from torch.utils.data import DataLoader
from model import KGEModel
from dataloader impo... |
601dd703134cba69282a0f9ca8c205af01a94759be41167789b6807b2c1c05da | Python | 14,281 | 427 | """
Class for opening and converting a CMRR DICOM physiology log object to a TSV text file
AUTHOR : Mike Tyszka
PLACE : Caltech Brain Imaging Center
REFERENCES:
Original CMRR Matlab log parsing script
https://github.com/CMRR-C2P/MB/blob/master/extractCMRRPhysio.m
David Warren's summary of CMRR Physiolog contents... |
7b697d6c0f73569f02f4f95344bfdd96d57b5950a4134bc25352c0f524f155d5 | Python | 14,283 | 404 | # custom_pinn_utils.py
import numpy as np
import tensorflow as tf
from deepxde import optimizers, config
from deepxde.nn import activations, initializers, regularizers
from deepxde.display import TrainingDisplay
from deepxde import Model, config, optimizers
from deepxde.nn import regularizers, activations, initializer... |
a56d99a596576465102d85a58df02a00b5a5d760e97e43d787a86a28399112bf | Python | 14,283 | 416 | import os
import lightning as pl
import matplotlib.colors as mcolors
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import torch
from matplotlib.colors import LinearSegmentedColormap
from omegaconf import DictConfig
from scipy.stats import sem
from mcmlnet.experiments.plotting import setup_plo... |
aae0b93cf1775033cd0bc9868b827e3c14b5ddec99a7c3ed5274441eb206dcb6 | Python | 14,283 | 319 | import argparse
import torch
import torch.utils.data
from n_body_system.dataset_nbody import NBodyMStickDataset
from n_body_system.model import GNN, Baseline, Linear, EGNN_vel, Linear_dynamics, RF_vel, GMN
import os
from torch import nn, optim
import json
import random
import numpy as np
parser = argparse.ArgumentPar... |
e632cd713944e535132f131338e71fc8b3646f692d517c62139cf677ceadcee5 | Python | 14,291 | 453 | from __future__ import annotations
from collections.abc import Callable
import numpy as np
import osam
import pytest
from numpy.typing import NDArray
from labelme._automation import Detection
from labelme._automation import _ai_assist
from labelme._automation._ai_assist import AiAssistProposal
from labelme._automati... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.