sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
ea499563251480871c323e1fe022e399f76a4de7234b32ebc085befee4764b42 | Python | 26,967 | 854 | import itertools
import json
import os
import re
import string
import subprocess
from collections import defaultdict
import sys
import numpy as np
import scipy
from Bio import PDB
from matplotlib import pyplot as plt
from scipy.ndimage import gaussian_filter
from sklearn.cluster import KMeans
import torch
import torch... |
54069eec01995e90725f1d3581fbfe442810e65072bbc7ac807bf64492daee1f | Python | 26,980 | 457 |
import pathlib
from typing import Type
import numpy as np
from neuron import h
from neuron_interface.neurosim.cells import NeuronCell
from neuron_interface.neurosim.simulation.simulation import Simulation, WaveformType
from helper_functions.neuron_cell_functions_lib import syns_per_segment
from helper_functions.cell_t... |
e19794d4405cb8ddc2fb4a55b9c0896988a27e1b89848cd3c410c9f23d78f47e | Python | 26,991 | 749 | # Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
f112727710c6c1ed920b6fbda70fb69d911440300ced1666051ea0a29f8ec896 | Python | 27,028 | 562 | import os
import h5py
import yaml
import sys
import numpy as np
from scipy.stats import pearsonr,kendalltau
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
from sklearn.metrics.pairwise import cosine_similarity
pathpath = 'PATHS/filepaths_carlen.yml'
myrun_spont = 'runC00dMP3_brain'
nclust... |
5a2ac8fe5ad163655c3f62618d527c7a62479e73548e0de8c3b6058d7bd793ff | Python | 27,034 | 781 | #!/usr/bin/env python
"""
Captures pictures from a Thorlabs uc480 (software) series cameras.
FIXME: This only works with the uc480 Version 4.20 (or earlier) software.
It will appear to work, then crash if you try and run it using
ThorCam. If you install ThorCam you'll need to uninstall it
f... |
1755abe7915eee71a0432cb672b581c1fb2137eb0916945608cf2ed2889200a3 | Python | 27,050 | 546 |
import pandas as pd
from sklearn.metrics import adjusted_rand_score, accuracy_score, f1_score
from scipy.sparse import csr_matrix
import numpy as np
import random
class GraphData:
"""
Class for storing graph data and computing evaluation metrics.
Attributes:
adj_csr (scipy.sparse.csr_matrix):... |
ebc9a71d47affc9e0c9afdaf5aa6fb4b906dbb790325551f569889646aecc8da | Python | 27,067 | 546 | """
(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
... |
cc7907dee6f7b42ed1403361f23db05d19f05a136b4c2a5a7e593bda18075f24 | Python | 27,106 | 753 | from skimage.io import imread, imsave
from skimage.util import img_as_ubyte
from skimage.transform import resize
from skimage.util import view_as_blocks
from sklearn.model_selection import train_test_split
from scipy.ndimage import gaussian_filter
import albumentations as A
from tifffile import imwrite
import numpy as ... |
938493050d4552b89c00d194bf1eda2e4bb5768f2804d8eb348a53e788429bca | Python | 27,122 | 645 | # -*- coding: utf-8 -*-
# @Author : NaiChuan
# @Time : 2025/7/15 11:03
# @File : SwinTransformer.py
# @Software: PyCharm
# --------------------------------------------------------
# Swin Transformer
# Copyright (c) 2021 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ze Liu
# --... |
a13c105e4921c9501607456b78df59ebe6db0d14870c70fce56be38df1aea735 | Python | 27,122 | 508 | import torch.nn as nn
import torch
import sys
from timm.models.layers import trunc_normal_
import timm
import numpy as np
import os
import wget
from timm.models.layers import to_2tuple
from random import randrange
from matplotlib import pyplot as plt
import random
# override the timm package to relax the input shape ... |
4555a115d492e2f721110c9ee03a67c2e002d409aa1d83e8692a6450a2e0e3bb | Python | 27,130 | 566 |
# import dtiplayground.dmri.preprocessing as prep
import dtiplayground.dmri.common.dwi as dwi
import dtiplayground.dmri.common.module as module
import dtiplayground.dmri.common as common
import shutil
import yaml,sys,traceback,time
from pathlib import Path
def _num(s):
if s is not None:
if isinstance(s,... |
f74fdf7a9c53d10727875f8bcd23aae3193547992b88e58e9eb60e846c2ba65f | Python | 27,177 | 711 | # 该程序的作用是一个完整的Python脚本,用于对胰腺炎数据进行使用SMOTE对训练队列进行插值,以生成新的训练队列。
# 注意这个程序是同时读取外部的训练集和所有的原始数据
# 这些特征利用训练集原始数据,再进行SMOTE过采样,用于构建具有新训练队列的模型,包括逻辑回归 (LR)、决策树(DT)、朴素贝叶斯(NB)、支持向量机(SVM)、
# 多层感知器(MLP)、光梯度提升机(LightGBM)、极端梯度提升(XGBoost)、人工神经网络(Artificial Neural Network ANN)、
# 卷积神经网路CNN和长短时记忆网络(SLTM),以预测 SAP 患者。然后用所有的原始数据来进行验证,为了描述... |
75c4e3021fc41631ff4d4bff9827a7f2641326ea449c102ca0d7b83ab4bf4a8c | Python | 27,199 | 592 | import numpy as np
import importlib
from scipy.stats import norm
import pathlib
import sys
import warnings
from tqdm import tqdm
from joblib import Parallel, delayed
class OsipiBase:
"""
Comprehensive base class for OSIPI IVIM fitting algorithms.
The ``OsipiBase`` class defines a standardized framework f... |
8e5ea4d45f0539ef17a773418bd42d51ff6c3fd9fd8890209ee96c33be6a062b | Python | 27,202 | 768 | """Extracting ERAs from ROIs"""
import nibabel as nb
import numpy as np
import os
import glob
from imageio.v2 import sizes
from nilearn import signal
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
ROOT = "/Volumes/sDresBackUp/s1Anfunco/Nifti/derivatives"
# Set subjects to work on
subs = [... |
5e15f235531550ac04d1f4e24d7b104f37646bf78cca24413cdc35fdb8d5c246 | Python | 27,219 | 670 | #############################################################################
# Copyright (C) 2020-2026 MEmilio
#
# Authors: Martin J. Kuehn, Kathrin Rack
#
# Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complian... |
b11c3cbd40cbff2febe7ba0266cd649d3d635fe548560cb7a8f3ecb238cc5096 | Python | 27,256 | 733 | from typing import Tuple
import numpy as np
import pandas as pd
from mc_analysis.simulator.apply_irf import convolve_with_irf
from mc_analysis.simulator.mch_to_csv import mch_to_df
from mc_analysis.simulator.resample_lag_axis import resample_g1
class G1Simulator:
"""Example usage:
g1fitter = G1Fitter(df, s... |
a55b27b022af6e4dc4e1d6476715bd278ae7e79deddb4d47adf986f7500fe5ad | Python | 27,259 | 793 | import logging
from time import time
import dipy.tracking.streamline as dts
import nibabel as nib
import numpy as np
from dipy.io.stateful_tractogram import Space, StatefulTractogram
from dipy.io.streamline import load_tractogram
from dipy.segment.bundles import RecoBundles
from dipy.segment.clustering import QuickBun... |
ac40e45596317f8c6b221caba41b898cdf71f2c08760d712319b8c173d4cbf68 | Python | 27,263 | 478 | import numpy as np
def exclude_session_with_less_trials(neural_sig, arglist, cell_array):
"""
Exclude sessions if the number of trials for a given trial type is zero.
Parameters:
- neural_sig: list of ndarray
List of neural activity arrays for each trial type. Each array has shape [cel... |
4b224225c6271ecac0c119015019da98f063f5586be170817cd7164bf6b887f2 | Python | 27,306 | 594 | # /------------------------------------------------------------------------------+
# | 23-OCT-2022 |
# | Copyright (c) Bone Imaging Laboratory |
# | All rights reserved ... |
dc331f788932795f898e8b8c91a6ada3b151f81e4fe8a53850bc5326495fa576 | Python | 27,333 | 572 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
from pathlib import Path
from typing import Any
import numpy as np
import torch
from ultralytics.cfg import get_cfg
from ultralytics.data.build import load_inference_source
from ultralytics.engine.model import Mod... |
7142cdb91d3ed34f1122442b92f946509227987efd6e7b9174a145d4907fd6ef | Python | 27,339 | 818 | # For each session, plot the theta(actor, switch) on the x-axis
# and the slope (switch, history) on the y axis.
# Plot the Actor slope of one animal against Observer slope of the other.
import os
import sys
import pandas as pd
import glob
import numpy as np
import json
from scipy.stats import sem, t
import matplotlib... |
f4c61a0bd08652b97756f4cf7a99a54540526a80994641a367a347b5cd2e8111 | Python | 27,355 | 598 | import networkx as nx
import numpy as np
import torch
from typing import List, Optional, Union
from anndata import AnnData
from GEASO.alignment.dijkstra import con_K_geo
from GEASO.utils.utils import cal_distance, cal_probability
from GEASO.alignment.utils import con_K_euc, to_torch
from tqdm import trange, tqdm
'''
... |
c1d3425d7afd9584c19a8fbeaed0f2813a64b7058bb499f2650744e8ebc6ffd9 | Python | 27,367 | 752 | """
ImageData: Unified container for diffraction images.
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 lim... |
abb0534102f901dcd0c5ba4641d02af28f523ffccc827997f0666e3fb65083ae | Python | 27,375 | 708 | # 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 logging
import os
import warnings
from argparse import Namespace
from typing import Any, Callable, Dict, List
import torch
from fairse... |
5346c40ed0e811d1fe11a074297b5bcdea607b59f4a7c267b69e638170b0d5ff | Python | 27,380 | 739 | # -*- coding: cp1252 -*-
# Copyright (c) 2014, Durham University
# 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... |
33b579cd4d302ae23510812cf22124b678034e061affc059659de3a3a2749dae | Python | 27,393 | 744 | # Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
2f549662066cb3c4778596657522652bfe34b33683ae02d555689b1630900faa | Python | 27,410 | 636 | import sys
import os
import pandas as pd
import pyreadr
import torch
import glob
import functools
import random
import torch_geometric.transforms as T
import torch.nn.functional as F
import yaml
from math import ceil
from torch_geometric.data import InMemoryDataset, Data
from torch_geometric.loader import DenseDataLoad... |
9e7604842a43b210ce339769329fa3a6afcc870d86c1c4ccc9409a5eafb9af5b | Python | 27,417 | 664 | #!/usr/bin/env python
"""
This class handles most of the functionality of the camera
frame display. This includes:
1. Showing the frames from the camera.
2. Handling scaling.
3. Handling the color table.
4. Handling dragging.
5. Broadcasting the current image.
6. Handling the changing the feed.
7. Handling ... |
5b42b5e21e5bf6dee36bf9727f4a62b5b96b2cc3a1a529a499311d5f84804701 | Python | 27,430 | 815 | import reprlib
from collections import defaultdict
from collections.abc import Iterable, Mapping, Sequence
from pathlib import Path
from typing import (
TYPE_CHECKING,
Any,
Union,
)
import numpy as np
import polars as pl
import torch
from torch.utils.data import Dataset
from tqdm import tqdm
from eir.data... |
d2adf3d065cbb969e02a386657a60497fcd768dc21ecbf0ca9eb814796bbbe63 | Python | 27,439 | 639 | # Required libraries
import matplotlib
matplotlib.use('Agg') # Set globally for all matplotlib usage
import os
os.environ['PYTORCH_CUDA_ALLOC_CONF'] = "max_split_size_mb:100"
os.environ['KMP_DUPLICATE_LIB_OK']="True"
os.environ['CUDA_LAUNCH_BLOCKING']="1"
import random
import glob
import time
import matplo... |
86713c3699202bba9be10cd12fad2c22f964fd324ad5f6f38a843505a872cfd7 | Python | 27,445 | 625 | import sys
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
from sklearn.neighbors import KernelDensity
from .internals import *
from .components import __get_figax
from typing import Union, Callable, Dict
# grab module
__pub = sys.modules['pubplot']
def _bandwidth_botev(Y: np.ndarray) -> float:... |
1e326ba173362e363d96adf702f37c68d7b8315aebb112aa888b7f5ae76a616f | Python | 27,448 | 777 | """
Compares the coverage of simulated TIVITA spectral data against multiple real
simulation sets using either cosine similarity or MAE threshold of the nearest
neighbour as inclusion criterion.
This script evaluates how well different simulation datasets can represent
real-world spectral data by computing inclusion b... |
13f02942bd2c2d8450bef79e12832ec31cc186908e6d361209b678830d46918c | Python | 27,449 | 527 | #!/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
#... |
f0ac9b452ba3124239cbd034176f9c94d43abcf0c44d290ad105ff01ff1696ab | Python | 27,465 | 823 | import numpy as np
import pytest
import nelpy as nel
import nelpy.auxiliary._tuningcurve as tc
# Minimal mocks for dependencies
class DummyBst:
def __init__(self, n_units=2, n_bins=10):
self.unit_ids = list(range(1, n_units + 1))
self.unit_labels = [str(i) for i in self.unit_ids]
self.uni... |
8a3630943070e904252a7a51bd8f68fcfb645131acee0c7e76aaf29fbb212802 | Python | 27,496 | 719 | # Parent class for python wrapper to libczi file for accessing Zeiss czi image and metadata.
import io
import multiprocessing
from pathlib import Path
from typing import BinaryIO, Dict, Optional, Tuple, Union
from urllib.parse import urlparse
import numpy as np
import xml.etree.ElementTree as ET
from . import types
... |
0660f10aacf26a64b5bfaf64b44346b0fe8e13dc48f0dd5fec2724870d396c09 | Python | 27,519 | 521 | # Quality metrics of the preprocessed DWI (per volume tables and one-row summaries)
#
# eddy_motion : head motion from eddy (framewise displacement, translations/rotations) and its outlier slices
# eddy_cnr : b=0 SNR and CNR per shell from the eddy --cnr_maps output, mean inside the eddy mask
# tensor_fi... |
60b24397c52e8a08d838828967cd03f5d6066c1f7c3c433805bf11dcb0d5228e | Python | 27,527 | 775 | # BSD 3-Clause License
# Copyright (c) 2022, Zhao Xiaoming
# 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, this
# li... |
5fa2d917e3c3d83372d0ce45318c158b584dbc8e7f4bdabf555d6c4c29aaffab | Python | 27,541 | 799 | """Helpful functions related to observation models."""
from typing import Dict, List, Optional, Tuple
import numpy as np
import tensorflow as tf
import tensorflow_probability as tfp
from tensorflow_probability import bijectors as tfb
from osl_dynamics.inference import regularizers
from osl_dynamics.inference.initial... |
b64053cd7ce753aa9884d4043695c158f346f5d3ae53c5f3e9ba352e1e9e0e24 | Python | 27,543 | 606 | import networkx as nx
import numpy as np
import torch
from typing import List, Optional, Union
from anndata import AnnData
from GEASO.alignment.dijkstra import con_K_geo
from GEASO.utils.utils import cal_distance, cal_probability
from GEASO.alignment.utils import con_K_euc, to_torch
from tqdm import trange, tqdm
'''
... |
714e1330701f81dfe72123ef19ee219ecbe42054be26f80a6155e4a34e0a73d3 | Python | 27,544 | 706 | from pathlib import Path
import importlib
import cv2
import math
import numpy as np
from skimage.exposure import rescale_intensity
import tifffile
from napari.utils.notifications import show_info
from napari_dmc_brainmap.utils.path_utils import get_info
from typing import (
Callable,
Dict,
List,
... |
c69ec67990777a4d13df219ef9b254085b2df283fbe5fd283245b76d6b461b3c | Python | 27,549 | 554 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
import torch
from torch import nn
from . import LOGGER
from .metrics import bbox_iou, probiou
from .ops import xywh2xyxy, xywhr2xyxyxyxy, xyxy2xywh
from .torch_utils import TORCH_1_11
class TaskAlignedAssigner(nn... |
49227ec1494e7dac99b902affb4652da6b8c14fdfc33f80690d782aeb45a2b70 | Python | 27,579 | 708 | """Scientific regressions using EMT and controlled molecular vibrations."""
import json
from pathlib import Path
from unittest.mock import Mock
import numpy as np
import pytest
from pydantic import ValidationError
from ase import Atoms, units
from ase.calculators.calculator import Calculator, all_changes
from ase.cal... |
f6b1bd3c2e5051d4b48449f365dbb4733a7705691dffd0c70d8a6d1e32a2bad5 | Python | 27,591 | 497 | ### script for writing meta information of datasets into master.csv
### for link property prediction datasets.
import pandas as pd
dataset_dict = {}
dataset_list = []
### add meta-information about protein function prediction task
name = 'ogbl-ppa'
dataset_dict[name] = {'eval metric': 'hits@100', 'task type': 'link p... |
e31e64fefc556eb4cd6fd18f10d34385420ff4a87cdf9d18d210846c80157233 | Python | 27,601 | 604 | # This file is part of Zennit
# Copyright (C) 2019-2021 Christopher J. Anders
#
# zennit/composites.py
#
# Zennit is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 3 of the License, or (at ... |
6dc1e9a4f112f43b572d8fc48a62509a5565cbc6278f23b97707c1b1f8a064e0 | Python | 27,602 | 642 | """Test running a CAT-NAP batch from a remote source with bounded local disk.
Run from the repo root::
uv run python python/test_remote_pipeline.py
The claim phase 7 makes is a bound, not a speed-up: *peak local storage is one
or two recordings, whatever the size of the batch*. So the load-bearing check
samples ... |
da83cddbae899f5b3e1aa75bc2116325b63f685ce7f2252a7eac69421459f7f3 | Python | 27,602 | 732 | from typing import Optional, Union, List, Dict
from math import pi, sqrt
from scipy.spatial import Delaunay, distance
from scipy.sparse import lil_matrix, coo_matrix, csr_matrix
from matplotlib import colormaps
from matplotlib.colors import to_rgb
import numpy as np
from numba import cuda
import pickle
import os
from s... |
2caca2c476cc2bd99cca52ce1732de6cbe08838f12a36ff7505549279d3c7c6b | Python | 27,613 | 644 | #! /usr/bin/env python
"""Library of useful functions for statistical analysis of morphometrics data
If called as a script, this will assemble an Experiment object based on the config.yml file
Usage: python morphometrics_stats.py config.yml experiment_name"""
__author__ = "Benjamin Barad"
__email__ = "benjamin.barad@... |
09d9b731617a7c9ed79d5425c69485c7729ebd443de523d77d669cea5742e520 | Python | 27,614 | 636 | import sys
import os
import pandas as pd
import pyreadr
import torch
import glob
import functools
import random
import torch_geometric.transforms as T
import torch.nn.functional as F
import yaml
from math import ceil
from torch_geometric.data import InMemoryDataset, Data
from torch_geometric.loader import DenseDataLoad... |
97fa04349198a753982fc07a528d0b948938da572c519fcf938ed1d2f4e95efb | Python | 27,627 | 671 | import h5py
import numpy as np
import re
from glob import glob
import os
import yaml
from pfcmap.python.utils import file_helpers as fhs
from pfcmap.python import settings as S
import git
class SortedUnit(object):
def __init__(self):
pass
@property
def id(self):
return '%s__%i'%(self.reci... |
4fd8ca91227a9dafcdb535d540c3daaf1d3b7ee8f5dd9ed948ff089b9b45db27 | Python | 27,630 | 653 | import matplotlib as mpl
import numpy as np
from cdlib import algorithms
import networkx as nx
import leidenalg as la
import igraph as ig
from scipy.spatial.distance import pdist, squareform
from pfcmap.python.utils import category_matching as matchfns
import igraph
from netgraph import Graph
import string
def get_si... |
6781db7dc1a2fb87d6a9330df85e602fc9c8b1633984bd133a030d6ab04861e9 | Python | 27,633 | 799 | from __future__ import annotations
import base64
import json
import shutil
from collections.abc import Callable
from pathlib import Path
from typing import Literal
import pytest
from PySide6 import QtCore
from PySide6 import QtGui
from PySide6 import QtWidgets
from PySide6.QtCore import Qt
from pytestqt.qtbot import ... |
89bf7744e58d372be02f5cc4d4e63b92902ebbd0c1b28d661060c5d263f185d8 | Python | 27,657 | 780 | # codes from "Objective evaluation metrics for automatic classification of EEG events " by Saeedeh Ziyabari1, Vinit Shah1, Meysam Golmohammadi2, Iyad Obeid1 and Joseph Picone1
import os
import argparse
import yaml
from tqdm import tqdm
import numpy as np
import random
import math
import torch
from torch.autograd impo... |
e4b98135a8b8dd4c3e59e185b16addff7ffbc31c61cff9eb425bf5ab6c2ca810 | Python | 27,657 | 566 | #
# common/fibers.py
#
# Fiber bundle processing for fiber profiles. Python replacement of the parts of the NIRAL C++ tools
# fiberprocess (DTIProcessToolkit), FiberPostProcess and dtitractstat (DTIFiberTractStatistics)
# that are used to extract fiber profiles, with their known bugs fixed:
# - scalar value... |
d99e0a2922fadce4c0c452362a3f5633da30a7debb033e086845a4525667208b | Python | 27,663 | 604 | from typing import List
#from flair.datasets import CONLL_03, CONLL_03_DUTCH, CONLL_03_SPANISH, CONLL_03_GERMAN
from . import datasets as datasets
from .data import MultiCorpus, Corpus, Dictionary
from .list_data import ListCorpus
from . import embeddings as Embeddings
from .training_utils import EvaluationMetric
impo... |
c67d09036688d3dfe50f882d125c652079fc9499fde3418c284faa815746bde4 | Python | 27,701 | 595 | 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"
... |
a7f31f13a278b6aa6ee46eb3aa6a678529d55b3ab407d0b18b7993f525deac07 | Python | 27,702 | 958 | import enum
import logging
import os.path as op
import tempfile
import imageio
import numpy as np
import pandas as pd
from dipy.tracking.streamline import set_number_of_points
from PIL import Image
import AFQ.viz.utils as vut
try:
import plotly
import plotly.express as px
import plotly.graph_objs as go
... |
c94bd7f789a68641c13ee61a3b3638489ec0d7f5de1c023b8f14cdfdeda011f7 | Python | 27,702 | 757 | import numpy as np
from nems.registry import layer
from nems.distributions import Normal, HalfNormal
from .base import Layer, Phi, Parameter, ShapeError
from .tools import require_shape, pop_shape
# TODO: double check all shape references after dealing w/ data order etc,
# make sure correct dims are lined up.
... |
919f438ca4fa529d398b0c014e730092e2d354836df51e11ffb5614cf94e050b | Python | 27,737 | 725 | # -*- coding: utf-8 -*-
"""
Created on Mon Sep 4 16:11:37 2023
@author: axthi
"""
import numpy as np
import nibabel as nib
import gc
import os
import pickle
from copy import deepcopy
from scipy.spatial.distance import cdist
from simnibs import mesh_io, file_finder
from .preparation import create_cereb_surface, get_c... |
4e2aecc07f707a988d8100da10df7de296fe352623654363531a4ba8306cc4bc | Python | 27,744 | 753 | # -*- coding: utf-8 -*-
"""
Developmental space -> matrix construction
"""
import scanpy as sc
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import matplotlib as mpl
import os
import warnings; warnings.simplefilter('ignore')
import anndata
from scipy.stats ... |
84bdcd7f6d1175f815a3ae6a2fa644b525a60be45a04745108e0f77c8f2a9c38 | Python | 27,790 | 534 | ### Mc_GNN
class MultiMaskConv2d(nn.Module):
def create_circular_mask(self, size, number_of_kernels):
radius = size // 2
y, x = np.ogrid[-radius:radius, -radius:radius] # Remove the +1 to match size exactly
mask = x**2 + y**2 <= radius**2
mask = mask.astype(np.float32)
# En... |
ba349ad631b35419270699bd71e1bf6d16cdd1947a2e0d365d06631fb4b229c4 | Python | 27,812 | 291 | from brainvoice.data.estimates_loader_utils import load_beta_estimates, load_estimate_labels, load_latent_variables_estimates, load_CPC_estimates
import argparse
import pandas as pd
import rsatoolbox
from rsatoolbox import rdm
from rsatoolbox.vis.colors import rdm_colormap_classic as rdm_colormap
from scipy.spa... |
6639ca531b762ae015f1cdc7ef8e70865d9930577d3f851d1195c26373a46ce5 | Python | 27,832 | 601 | #!/usr/bin/env python3
"""
Main manuscript - Figure 4: Model fitting and anisotropy calculation of orientation-dependent qMRI for FA > 0.5 at 3T and 9.4T
Left column: Large cohort 3T dataset
Right column: Small cohort 9.4T dataset
Models fitted:
- Susceptibility model: y(theta) = a + b*sin²(theta) + c*sin⁴(theta)
- Cl... |
e38dc774b4984f8ffb9431a6b34dd60c14fda8fc486c79631d0f27fdc7f4ecd5 | Python | 27,834 | 785 | """Handle inference procedures for dannce and com networks.
"""
import numpy as np
import os
import time
import tensorflow as tf
import tensorflow.keras as keras
from tensorflow.keras.models import Model
import dannce.engine.processing as processing
from dannce.engine import ops
from typing import List, Dict, Text, Tup... |
7fae2004d9e55c6c4bd90aa117b3be731cc3ed8ab33d7bbb06c8a1216db171f5 | Python | 27,835 | 710 | """Cell-type subnetwork analysis for CAT-NAP.
A CAT-NAP recording comes with a *putative cell type* spreadsheet listing, for
each immunohistochemistry marker (``NeuN+``, ``GAD+``, ``PV+``, …), the suite2p
ROI ids that stained positive. MATLAB only uses that table cosmetically — as
concentric rings drawn around nodes i... |
685496a1dbecdc2fe52bac2736ee60b1a5f36f27dcb252fd4623edb073cf0d59 | Python | 27,840 | 838 | # imagecodecs/tests/test_zarr.py
# Copyright (c) 2026, Christoph Gohlke
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notic... |
27817918e4cba3a9f1888077e9abedef3503506d5577842f0f24dbd13103222b | Python | 27,873 | 585 | import h5py
import numpy as np
import sklearn.metrics as metrics
import matplotlib.pyplot as plt
import time
from six.moves import cPickle
import logging
import sys
from collections import Counter
import torch
from chinn.models import *
def get_data_batch(left_data, left_edges, right_data, right_edges, dists, labels, ... |
b27c5183f912c873e4d37b5c01b4dda89e5fd4fee52a316386a0c48ee4c07d1a | Python | 27,895 | 457 | import numpy as np
import sys
import argparse
import pandas as pd
from spike_utilities import find_notebook_file
from PatchAnalPlots import rows_columns, plot_hist, plot_peaks, plot_pairs
HEADSTAGE_I={'S1': 'H1', 'S2': 'H2'}
def ArgParserSyn(commandline,do_exit):
parser = argparse.ArgumentParser()
parser.add_... |
3cee2f16f589de0fdecd8e50e9e037dbe50f9d6099d4b4ad6087f6a919a6e393 | Python | 27,929 | 741 | """Iterative two-stage 2D background fitting for quadrant-folded SAXS patterns.
Headless fitting API (no Qt, no file I/O unless explicitly requested, no
plotting) used by :mod:`musclex.ui.BackgroundFittingDialog`.
Pipeline
--------
``step 0`` optional rough projection background ``B0`` (per-sector cone-model
... |
7b66750a84f29373bfe21e7aea455c9c42264049e885a0fafea534d7af480be9 | Python | 27,936 | 852 | # -*- coding: utf-8 -*-
"""
Interface to Elastix for alignment of volumetric data
The elastix documentation can be found `here <http://elastix.isi.uu.nl/>`_.
In essence, a transformation :math:`T(x)` is sought so that for a fixed image
:math:`F(x)` and a moving image :math:`M(x)`:
.. math::
F(x) = M(T(x))
Once... |
9675089eb68598034634567f2b05b06240a3a2a9f379f477f9c06448a87fde91 | Python | 27,956 | 469 | #!/usr/bin/env python3
"""Export the historical 41-source catalogue and its correspondence to OpenPlant.
Inputs are read-only. This tool requires openpyxl and writes only the four source
documentation outputs below -- never the input spreadsheets or original code.
DOI checks are optional and use Crossref's public API ... |
444900031d5dca46ff98ff0067269fb881ae97a09d9cbe4b894e45e2cbbe5ebb | Python | 27,965 | 626 | import h5py
from umap import UMAP
from scipy.spatial import distance_matrix
from scipy.stats import scoreatpercentile as sap
import sys
import yaml
import os
import numpy as np
from matplotlib import ticker
import matplotlib as mpl
import matplotlib.pyplot as plt
from sklearn.metrics.pairwise import cosine_similarity
f... |
e45ab6de940791bbcd6da35466493b733fef37caefbec261e3992f4a035ee380 | Python | 27,976 | 409 | """
Define a dictionary of 200 "normal" and "deuteranomaly" colors
"""
colors = {
"normal": [
(0.8567401647718771, 0.005665213328508778, 0.9347769926511403),
(0.0, 1.0, 0.0),
(0.006640993017987151, 0.5745449885858733, 0.9561049108599794),
(0.9479660083234648, 0.5313054609750606, 0.00... |
0700d09243a211edccbabd6e3300f169754052f2e35b8a0a6f4d29c4fbb8d2e2 | Python | 27,983 | 728 | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
import torch.nn as nn
import torch.utils.checkpoint as cp
from mmcv.cnn import build_conv_layer, build_norm_layer, build_plugin_layer
from mmcv.runner import BaseModule
from mmcv.utils.parrots_wrapper import _BatchNorm
from ..builder import BACKBONES
fro... |
e4882cd536f0c6e45258fa2c278d7e736096e77df4932d329b0ccb96e3e4e57e | Python | 27,986 | 735 | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
#!/usr/bin/env python
# coding: utf-8
"""
AGED Models Module
Neural network architectures for AGED deconvolution
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import math
from typing import Optional, Dict, Tuple
# ========... |
82a81dc9a50d7ffbb115c9a94a00411eea7c099940a6f58afe6f83d118fe8a37 | Python | 28,002 | 764 | # Copyright (C) 2022 Intel Corporation
# Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import io
import json
from functools import partial
from http import HTTPStatus
from typing import Any
import pytest
from cvat_sdk.api_client import ApiClient, models
from cvat_sdk.api_client.api_client import ... |
408fcfdfbb3108625ffed71172955dc6d9f3ee0ca054587da8481274d0770f2b | Python | 28,030 | 776 | import torch
import torch.nn as nn
import torch.nn.functional as F
from typing import Dict, Tuple, List, Union, Optional
import numpy as np
from deep_events.torch.training_functions import get_loss_function
class ConvLSTMCell(nn.Module):
"""
ConvLSTM cell implementation for PyTorch.
"""
def __init__(... |
6984fd68ae4c0b0965e77a9c34218667f2caaf1e943d5356857f16eb2616f99e | Python | 28,030 | 682 | import math
import numpy as np
import torch
from utils import common_functions as c_f
# input must be 2D
def logsumexp(x, keep_mask=None, add_one=True, dim=1):
if keep_mask is not None:
x = x.masked_fill(~keep_mask, c_f.neg_inf(x.dtype))
if add_one:
zeros = torch.zeros(x.size(dim - 1), dtype... |
9023a9d7cd9c27599937dc8e0d28a2ecdeffb55f6af3de0bffe3546594ce25be | Python | 28,043 | 513 | # Copyright (c) 2026 Rohit Jena. All rights reserved.
#
# This file is part of FireANTs, distributed under the terms of
# the FireANTs License version 1.0. A copy of the license can be found
# in the LICENSE file at the root of this repository.
#
# IMPORTANT: This code is part of FireANTs and its use, reproduction, or... |
d941f7c7b819010a6098a0f78248a66b4a7b69804caa51cd5577bd203ccd623b | Python | 28,059 | 726 | '''
'''
#
# Adapted from MATLAB code written by S. Nishimoto (see Nishimoto, et al., 2011).
# Anwar O. Nunez-Elizalde (Jan, 2016)
#
# Updates:
# Anwar O. Nunez-Elizalde (Apr, 2020)
#
#
# Implementation notes:
#
# The terminology here is "pyramid" and "filters".
# In moten.core, the termilogy is inconsistent.
#
# TODO:... |
f3d4e91282ec270f2230a435862f3f5c3d778240e21ebb333a58dcc0880bb6fd | Python | 28,061 | 719 | """Portable skill resources, source precedence, and checkpoint discovery."""
import asyncio
from pathlib import Path
import pytest
from deepagents.backends import (
CompositeBackend,
FilesystemBackend,
LocalShellBackend,
StateBackend,
StoreBackend,
)
from deepagents.backends.protocol import Execut... |
57c973e26ac2a70917b6dc9cce0c43ea20f57b9d214affb6ae48316c202f5bbc | Python | 28,092 | 629 |
import torch.backends.cudnn as cudnn
import torch.utils.data as Data
import random
import torch.nn as nn
from collections import defaultdict
import warnings
warnings.filterwarnings('ignore')
from pytorch_revgrad import RevGrad
from spotd.utils import *
import torch
import torch.nn.functional as F
import ma... |
036c187aca68c0243e2d450df279503b881099ddeaf55996b8837fc8744d6fd9 | Python | 28,141 | 744 | # Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
03bd399ea2dd6d188f59bf95893f467057ab57b421a42a2c04ac8bbfbf1f8a97 | Python | 28,141 | 850 | # FetMRQC: Quality control for fetal brain MRI
#
# Copyright 2023 Medical Image Analysis Laboratory (MIAL)
#
#
# 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/lice... |
24ee6f995b893612b1087a07e49c32183d147606df8fda90c0eecf6a932c5d63 | Python | 28,174 | 710 | import glob
import os.path
import subprocess
import sys
import unittest
import tests.bam
import tests.base_test
import tests.gtf
import tests.output_parser as output_parser
import tests.test_config
import tests.util
class Test(tests.base_test.BaseTest):
def setUp(self):
super().setUp()
self._tes... |
764f77901422f80ac3da70cfd761e534edf9e3c507c4923b0b884ed36e969ae4 | Python | 28,175 | 710 | #pylint: skip-file
#type: ignore
"""
Implementation of the
"""
import time
import math
import typing
import asyncio
import logging
import datetime
import numpy as np
import os
import stl
from ..qt import *
from . import task_context
from .widgets import Form, ListAsTabsWidget
from .util import wait_for, wait_for_ho... |
08eea8c21c2488af647ff38f8113806bf8f0786c080d27189b921ae8c8f997a9 | Python | 28,180 | 754 | """
Tests for ChemGraph agent session/memory integration.
Covers:
- Memory initialization options (enable_memory, custom store, db_path)
- uuid and session_id consistency
- _ensure_session idempotency
- _save_messages_to_store with LangChain and dict messages
- write_state file naming with uuid
- resume_from flow
- En... |
55184df0e31eb003ea31b9e3314e9b051d701acac99efb9192b40a11c1894be5 | Python | 28,195 | 831 | """Tests for mcmlnet.utils.metrics module."""
import numpy as np
import pytest
import torch
from mcmlnet.utils.metrics import (
compute_is_in_recall,
custom_correlation_coefficient_diagonal,
custom_r2_score,
mape,
nmae,
nrmse,
)
class TestMetrics:
"""Test cases for metrics module."""
... |
535fb6d23c2c07acb36fc3d3501506982172597a33b6380348f0a070419da178 | Python | 28,210 | 722 | #!/usr/bin/env python
"""
This class handles the lock display group box and it's widgets.
Hazen 04/17
"""
from PyQt5 import QtCore, QtGui, QtWidgets
# UI.
import storm_control.hal4000.qtdesigner.lockdisplay_ui as lockdisplayUi
class LockDisplay(QtWidgets.QGroupBox):
"""
The lock display UI g... |
105945c0319c289440f6002bf2cd229e23555756a8717e6ab108696afadea7d2 | Python | 28,223 | 562 | import os
import subprocess
import shutil
import nibabel as nib
import time
import numpy as np
import pandas as pd
from nipype import Node, Workflow
from nipype.interfaces.base import BaseInterface, BaseInterfaceInputSpec, TraitedSpec, File, Directory, traits, CommandLineInputSpec, File, TraitedSpec, CommandLine, Direc... |
9df3e6883b5b6839c173b0246c45399f9533abf09473b3528e799e742947c807 | Python | 28,271 | 302 | from os import path
# atlas labels
_ATLAS_LABELS_ = path.join(path.dirname(__file__),"../data/atlas_relabeled.tsv")
_ATLAS_FILE_ = path.join(path.dirname(__file__),"../data/atlas_relabeled.nii.gz")
# input data.frames
_BOCHUM_TABLE_ = path.join(path.dirname(__file__),"../data/bochum-sample/bochum_sample.csv")
_ESSEN_... |
b771006858f69a56418b1af962290592fa166a8bd275454c9292e9995eb9765c | Python | 28,288 | 754 | import numpy as np
import torch
from infopath.utils.functions import (
feature_pop_svd,
mse_2d,
session_tensor,
mse_2dv2,
feature_pop_avg,
)
from scipy.optimize import linear_sum_assignment
import torch.nn as nn
from sklearn.metrics import roc_auc_score
from scipy.stats import poisson
from torch.aut... |
bcba3ed3cf3b70853cbe1650b170c5a3d1146a23992e33813a50cf1d517f640c | Python | 28,299 | 701 | import torch
import dgl
import torch.nn as nn
import dgl.function as fn
import numpy as np
from dgl.nn.pytorch import HeteroGraphConv
from dgl.nn.pytorch import GraphConv, GATConv
from torch.autograd import Function
from torch.distributions import Normal
class GAE(nn.Module):
def __init__(self, encoder, decoder,... |
f18ccb45f8b1f7a422dfa0ce6a2d339faeebf84df520e0048a1ebacaf4e0d979 | Python | 28,302 | 1,013 | # imagecodecs/_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 not... |
1e6ec3e8f9ebf33ee00768704aa312768c2157609b12fbfd4472c9682d39522e | Python | 28,311 | 616 | 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"
... |
6f5190df6bfeaac1e0994866374ad2adf86a3f1dd75d54bc1144447fb2f707f0 | Python | 28,320 | 784 | # -*- coding: utf-8 -*-
from enum import Enum
from multiprocessing import Pool
import numpy as np
from dipy.io.stateful_tractogram import StatefulTractogram
from nibabel.streamlines import ArraySequence
from scipy.ndimage import map_coordinates
from scilpy.tractograms.uncompress import streamlines_to_voxel_coordina... |
5c48e6e7a1da30fe07ad51df41fa24a7a53d6d85630d4694b3f2cb2c0644380e | Python | 28,338 | 491 | import glob2
import pandas as pd
import seaborn as sns
import matplotlib
matplotlib.rcParams['pdf.fonttype'] = 42
matplotlib.rcParams['ps.fonttype'] = 42
import matplotlib.pyplot as plt
from matplotlib.colors import to_rgb
import os
from statannot import add_stat_annotation
import argparse
import pingouin as pg
import ... |
b06fe4240e1cf5985ffe38054b92776a59c91375bc94c1349b2d8963b1ee53f5 | Python | 28,418 | 436 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'steve.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.se... |
50749bdb80c2abe1b148bc095a7d65e61593f8f7ae571f329901180b06cc5cc2 | Python | 28,434 | 700 | # -*- coding: utf-8 -*-
import logging
from typing import Iterable
from dipy.core.sphere import HemiSphere, Sphere
from dipy.data import get_sphere
from dipy.direction import (DeterministicMaximumDirectionGetter,
ProbabilisticDirectionGetter, PTTDirectionGetter)
from dipy.direction.peaks im... |
c251b49f8c6941d29cfe46edcb6af366e4f3035cd1e8f82d9296c7574d4538b3 | Python | 28,447 | 690 | # (C) Copyright 2020 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... |
053a933633de43e93364fb53cce62d9f34ffa6587dea548529e4ec1fd40f1cff | Python | 28,450 | 686 | """
Main HarveST class providing the public API
"""
import os
import logging
import numpy as np
import pandas as pd
import torch
import scanpy as sc
from typing import Optional, Dict, Any, Union, List
from .preprocessing import DataPreprocessor
from .model import GraphNeuralNetwork
from .clustering import ClusterTrai... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.