sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
d7c112d3a18d149a86375dcdd5fc3ded8bf1e9d9256c9675012122086e498445
Python
10,944
223
from zigzag.classes.hardware.architecture.accelerator import Accelerator from zigzag.classes.hardware.architecture.core import Core from zigzag.classes.hardware.architecture.memory_hierarchy import MemoryHierarchy from zigzag.classes.hardware.architecture.operational_array import OperationalArray from zigzag.utils impo...
8759d8fcb4de6228d40c91be48727750efbd37c6c9ea27cd21a3ac421573d588
Python
10,947
261
import numpy as np import pytest import nelpy as nel def test_valueeventarray_construction(): events = [[0.1, 0.5, 1.0], [0.2, 0.6, 1.2]] values = [[1, 2, 3], [4, 5, 6]] veva = nel.ValueEventArray(events=events, values=values, fs=10) assert veva.n_series == 2 assert all(n > 0 for n in veva.n_valu...
4f2769366ccaaf0a7474454378f9ce725c56fe9355ac0d2b801de7caee8a4c8d
Python
10,949
303
#!/usr/bin/env python # Python version of the evaluation script from CoNLL'00- # Intentional differences: # - accept any space as delimiter by default # - optional file argument (default STDIN) # - option to set boundary (-b argument) # - LaTeX output (-l argument) not supported # - raw tags (-r argument) not support...
41df96355eaa2ceefe3f296917fbc0a63ebd008e1fa4726858e887a93a29ab79
Python
10,950
376
"""Building blocks for ResNet.""" import numpy as np import torch from torch import nn from modules.activation import LIF from modules.conv2d import SpikingConv2d, SpikingEiConv2d from modules.norm2d import SpikingBatchNorm2d, SpikingEiNorm2d from utils.dim import MergeTemporalDim, SplitTemporalDim class SpikingStan...
80ec24f1f9e4eddf26a074d0e34f53b8c084bba0ba9cda1d9e818519c220c42e
Python
10,950
310
import argparse import sys sys.path.insert(0, '../') sys.path.insert(0, '../../') sys.path.insert(0, '../../../') sys.path.insert(0, '../../../../ogb') import torch import torch.nn.functional as F from torch.utils.data import DataLoader import torch_geometric.transforms as T from torch_geometric.nn import GCNConv, SAG...
ac762385f5f4ba3ab7ce171b4ba0c7964ac1a3683914076fa868689b6a8069e6
Python
10,951
303
import abc import matplotlib.colors as mcolors import numpy as np from matplotlib.axes import Axes from matplotlib.image import AxesImage from typing import Literal, Iterable from argclz import argument, AbstractParser, as_argument from neuralib.plot import plot_figure, scatter_binx_plot from neuralib.plot.colormap im...
ebe0edd476c8c3519cfd414ee3e564d3c4b5edf4944867475b36b3efc8398135
Python
10,952
347
"""Contains vcf scoring functions.""" import os import re import numpy as np import pysam def score_geno(record, variant_row, samples, mode): effect_allele = variant_row["effect_allele"] beta = variant_row["beta"] if isinstance(record, dict): if record.get("type") != "synthetic_ref": ...
6ee8d2a0b8561bc8fdea0b487f0d96b1bc8c1a4afcadb8d86a4e8eb61278d9d5
Python
10,953
223
#! /usr/bin/env python # -*- coding: utf-8 -*- """ Compute response functions for multi-shell multi-tissue (MSMT) constrained spherical deconvolution from DWI data. The script computes a response function for white-matter (wm), gray-matter (gm), csf and the mean b=0. - In the wm, we compute the response function i...
4b2e378ddf4249b6a1eac58a5a7d18a902c109903557ee857f5a83945de8e68d
Python
10,956
267
from brainscore_vision.model_helpers.check_submission import check_models import functools from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images import torch import numpy as np from brainscore_vision.model_he...
2159318fa0634715d37fdfe44ede96d0911cf78ef84f9aec5aca272bd67ce53b
Python
10,957
315
""" Test the sensitivity of nest results on input parameters """ import numpy as np import scanpy as sc import pandas as pd import os import matplotlib.pyplot as plt import seaborn as sns from sklearn.metrics import jaccard_score, normalized_mutual_info_score from scipy.optimize import linear_sum_assignment import sy...
57d2c7870ade53c484dc860151e09e26d764236d9691c049e0f47f1f78e3db7c
Python
10,957
330
# The ImpedanceFitter is a package to fit impedance spectra to # equivalent-circuit models using open-source software. # # Copyright (C) 2021 Julius Zimmermann, # julius.zimmermann[AT]uni-rostock.de # # This program is free software: you can redistribute it and/or modify # ...
9d5ee42f205258c49120587f2266ac4eaec7a82525227af5fc3ae60e62e3962f
Python
10,963
380
# Kai Sandbrink # 2024-03-08 # This script aggregates settings for import by the various analysis scripts. # %% LIBRARY IMPORT import os # %% HUMAN DATA human_data_file_base = '../data/humans' # %% TASK 1 MODELS #### WITH BIAS = 0.4 ## 04/08/24 pepe_nn_ape_models = [ 20230922164924, 20230922164923, 2...
d42a44a93a6a8a9e3d84fd936e13dd5fb9093ce3c4dc0da0627ea354a93e21e1
Python
10,964
264
#!/usr/bin/env python3 import os import sys import time import json import getopt import numpy as np import pandas as pd import scipy.ndimage as nd from skimage import io as skio from skimage import img_as_ubyte def apply_registration_usage(): print(""" Usage : GEM_toolkit.py apply_registration \\ -o ...
51799c05915b076245051f03e8667e41f1b18eee6ec5d3c609d99d82631e426b
Python
10,965
250
# add the path of custom functions import sys from pathlib import Path import os script_dir = Path(__file__).parent project_root = script_dir while not (project_root / 'Deps').exists() and project_root.parent != project_root: project_root = project_root.parent # Add project root to the Python path if it's not alre...
1fa21dc7c4bb410b93f8bffd139a31ce7021b6f4c46fdaeb0ca2014eef090244
Python
10,968
239
#!/usr/bin/env python """ HAL module to interface with the W1 Spinning Disk from Yokogawa/Andor. Jeffrey Moffitt 5/16 Hazen 5/17 """ import storm_control.hal4000.halLib.halMessage as halMessage import storm_control.sc_hardware.baseClasses.hardwareModule as hardwareModule import storm_control.sc_hardware.andor.w1Spin...
269ea434c7fa0edab070632cda6a684d23ef06eae14f914a5716492fcf4c797d
Python
10,969
257
import torch import os, sys sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from preTrain_IT_network.IT_NN import IT_NN from Value_lNN import Striatum_lNN import logging import matplotlib.pyplot as plt import matplotlib.colors as mcolors import numpy as np from torch.distributions import Be...
58d147211ddcf04d8b8c0ada091f9d9704a9612571ee404b68956bc6eff6ef77
Python
10,970
376
"""Building blocks for ResNet.""" import numpy as np import torch from torch import nn from modules.activation import LIF from modules.conv2d import SpikingConv2d, SpikingEiConv2d from modules.norm2d import SpikingBatchNorm2d, SpikingEiNorm2d from utils.dim import MergeTemporalDim, SplitTemporalDim class SpikingStan...
c48e3006523594f38b7421411fee9629aa4883c0e32811079d70d4dcbbd98f15
Python
10,970
275
import pandas as pd import re from pyhpo.ontology import Ontology import numpy as np import itertools import math ontology=Ontology() NullList=["none", "none documented", "nil", "(borderline)", "no concerns"] def check_and_set_nan(strg: str, NullList: list = ["none", "none documented", "nil", "(borderline...
2d32795b01ea4d892be0be715045d9d67cadc0e98aa03c71a9d098cf40291868
Python
10,971
245
import pytest import torch import SimpleITK as sitk import numpy as np from pathlib import Path import logging from torch.profiler import profile, record_function, ProfilerActivity from typing import Dict, Any, List, Tuple from fireants.registration.greedy import GreedyRegistration from fireants.registration.syn impor...
7a5ce617b1050e76c4a3d289844bdf0c444b3398952f2f3a0070b8ff88352aa5
Python
10,972
355
#!/usr/bin/env python3 """ Fig4Sup1_DecoyTitrations.py Analyzes EC50 dose-response curves for GABA and various decoy ligands. Reads CSV/Excel files, fits 4-parameter sigmoid, and saves figures + EC50 table. Usage: python Fig4Sup1_DecoyTitrations.py # Process all CSV/XLS files python Fig4Sup...
7d3a0dc953aa1e32427625d221b730609636c45f5b67d11a92dc39ea9dfbd911
Python
10,974
303
"""Row-mapping strategies for AddIntensities windows. Both AddIntensitiesSingleExp and AddIntensitiesMultipleExp need to translate a table row index into an image name, a FileManager index, and vice versa. The mapping rules differ: * **SingleRowMapper** – identity mapping where ``row == fm_index`` and the image nam...
9a9e5fec84033ef3993b14a8c412eb656f0b48a196ab7c95247453efedc5aeda
Python
10,981
288
"""Tests of the fixture factory itself. If the factory is wrong, every test built on it is wrong in the same direction and none of them notice. These check that the structural properties the rest of the suite relies on actually hold, and that an invalid override fails with a readable message rather than deep inside li...
b5c6a198fc2d5443e783146e4f098b937db6e4602148e2d1ab64136e6b6da480
Python
10,981
191
import os import zipfile from glob import glob from pathlib import Path import boto3 import pandas as pd import xarray as xr import mkgu_packaging from brainscore_core.supported_data_standards.brainio.assemblies import BehavioralAssembly from brainscore_core.supported_data_standards.brainio.stimuli import StimulusSet...
d234cc3bd4f9bfc843db96a8fb4fa62fa5000a1fea06cfc475a3573969d0fd0a
Python
10,982
252
import numpy as np import xarray from brainscore_core.supported_data_standards.brainio.packaging import package_data_assembly import h5py from brainscore_core.supported_data_standards.brainio.assemblies import DataAssembly DATA_DIR = '/braintree/data2/active/users/tmarques/bs_datasets/FreemanZiemba2013_V1V2data.mat' ...
974ebceaea2645ef689dfbe935fecdda0efda3df93cc49293173e4ddde0b8927
Python
10,983
311
# SMIntegration: Spatial Multi-omics Integration Platform # ============================================================================== # # Purpose: # Performs KNN-based interpolation to align metabolomics data with spatial # transcriptomics spots. It constructs a network relationship between the two # modal...
555a6d37484e374b441c5cf6867def0def488d944086d6bb328818da55d5aaf8
Python
10,985
303
from typing import Tuple, List, Dict, Optional import torch from torch import Tensor import torch.nn.functional as F from yacs.config import CfgNode def make_gaussian_kernel_1d(sigma: float, device: torch.device): """ Generates a one dimmensional guassian kernel based on a single parameter - sigma. The ...
f04b70946b6461da627c45c941c96d5b31a50b08874e3ab84a2950da92e4d5be
Python
10,991
300
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...
e362df1103307a0ced3766716a072b3cfb3f2d5b2ea2fc3a1725121197d08f58
Python
10,993
232
import logging import numpy as np from tqdm import tqdm from typing import Union from brainscore_vision.utils import fullname # do not import tensorflow at top level to avoid forcing users to install it if they don't use this metric class MaskRegression: """ Klindt et. al, NIPS 2017 https://papers.nip...
ae870c44a92f81c94d82292cd3e8d9d5efc647c2dd9feaebaa59913cec524e1e
Python
11,002
287
#This is just a hacky version of the evalClassification.py script to generateImages import imgRetrivalUtil import torch from torch.utils.data import DataLoader import matplotlib.pyplot as plt from tqdm import tqdm from PIL import Image import torchvision from torchvision.transforms import v2 from pytorch_grad_cam impo...
f04d2775a091879163eaa357af6829b7c17aec0798a98de22839305c95b8e99f
Python
11,005
254
#!/usr/bin/env python # author: Jannes Spangenberg # e-mail: jannes.spangenberg@uni-jena.de # github: https://github.com/JannesSP # website: https://jannessp.github.io import h5py import numpy as np import read5_ont import pysam import pywt import multiprocessing as mp import sys from argparse import ArgumentDefaultsH...
ac2651af09f0c86b639e368da3f78a8b0cef1141aca527045c087f40e4adcb47
Python
11,006
325
from typing import List import torch from ..scatter import scatter from mlcg.data import AtomicData from mlcg.data._keys import ENERGY_KEY from mlcg.neighbor_list.neighbor_list import ( atomic_data2neighbor_list, validate_neighborlist, ) from ..blocks import RANGEInteractionBlock from ..utils import calc_wei...
4fb2b31c0ca5c3525dc59da773ca36c3fc4670a493aa965bc7bfab2b9f02f3e2
Python
11,011
302
"""Spawn per-rank MCP server subprocesses, wait for readiness, connect.""" from __future__ import annotations import asyncio import contextlib import logging import os import shlex import socket import subprocess import time from pathlib import Path from typing import Any import httpx from langchain_core.tools impor...
e42457a66d155596f6d9f30f6cc31da90821f7b45888a8948191aade1afb19bc
Python
11,011
283
import math from typing import Optional import torch from torch import Tensor from torch.nn import Parameter from torch_geometric.nn.aggr import Aggregation from torch_geometric.utils import softmax class SumAggregation(Aggregation): r"""An aggregation operator that sums up features across a set of elements. ...
cbfd1adcac3f0f7f03b434d18d169c613547a31437398e5d5669d92d9e133fb1
Python
11,012
216
# Datasheet of EXTRACT_Profile detected from a folder (dmrifiberprofile run -i <folder>, make-datasheet) # # The files are found anywhere below the folder and grouped by case id, the part of the file name before '_dwi' # (e.g. sub-100619_ses-017m_acq-dir79select_dir_run-004). Known names, after <id>_dwi[...]: # #...
466f85f2ddd63ca07068e5e68bf9724a640b09dc76164e3ab14827330d906515
Python
11,013
322
from langgraph.graph import StateGraph, START, END from langchain_core.messages import ToolMessage import json from langchain_openai import ChatOpenAI from langgraph.checkpoint.memory import MemorySaver from chemgraph.tools.ase_tools import ( run_ase, save_atomsdata_to_file, file_to_atomsdata, ) from chemgr...
d683c6fabc05941e503657079dd2b3c36e2e9a2037cbf30a38ab7dd3fa47058e
Python
11,013
340
from dataclasses import dataclass import os import pandas as pd from sklearn.metrics import ( make_scorer, accuracy_score, roc_auc_score, f1_score, precision_score, recall_score, ) from sklearn.utils import compute_class_weight from sklearn.ensemble import RandomForestClassifier from sklearn.ne...
d9432bcec2843c48ca3eb51548ec785811dc74e63f6fa491c42076c065635c3f
Python
11,018
313
# coding: utf-8 import difflib import filecmp import os import pickle from functools import lru_cache from inspect import cleandoc, getfullargspec from pathlib import Path import cloudpickle import joblib import numpy as np import sklearn.datasets from sklearn.utils import check_random_state import lightgbm as lgb S...
99eaa25d0047cdef45fb052f680eaf8538edcd8038c9130d4401eeada7847a8d
Python
11,019
336
"""Atomistic LIne Graph Neural Network. A prototype crystal line graph network dgl implementation. """ from typing import Tuple, Union, List import dgl import dgl.function as fn import numpy as np import torch from dgl.nn import AvgPooling # from dgl.nn.functional import edge_softmax from pydantic.typing import Lite...
486c741f43613ac83b84cbf897b0b9b9583df6b0b14c71ebcfa505fdbaaf4348
Python
11,022
276
import logging import numpy as np import matplotlib.pyplot as plt from scipy.ndimage import zoom, gaussian_filter1d from .base import Model from nems.registry import layer from nems.layers.tools import require_shape, pop_shape from nems.layers import ( WeightChannels, WeightChannelsGaussian, FiniteImpulseResponse...
c41ad4c211caa0dec7825fa0f26ffc24ff1fbf79d7861dd06728684a86a25481
Python
11,022
292
""" Support for reading and writing genomic intervals from delimited text files. """ from bx.bitset import ( BinnedBitSet, MAX, ) from bx.tabular.io import ( ParseError, TableReader, TableRow, ) class MissingFieldError(ParseError): pass class FieldFormatError(ParseError): def __init__(s...
6e0cac90b6be300c3be26e78f3a2e6e6bcdc1c8dc7fd5b52836be41f1370a14e
Python
11,025
279
import torch from torch import nn from eir.models.input.array.models_cnn import CNNResidualBlock from eir.models.layers.mlp_layers import MLPResidualBlock from eir.models.layers.projection_layers import ( get_1d_projection_layer, get_lcl_projection_layer, ) from eir.models.tensor_broker.projection_modules.cnn ...
baef6c4e3271b158eb0c16005a07c7607cb6c41678601a96f5bc8b68ec7882c1
Python
11,026
336
import os import string from distutils import dir_util from typing import NamedTuple, Optional import anndata as ad import numpy as np import pandas as pd import pytest import scanpy as sc from numpy.typing import NDArray from scipy import stats from scipy.sparse import csr_matrix class SimulatedData(NamedTuple): ...
82249eb4b2e28472a1c3613a60175dbd6f11f996c626e2c8454d35fec22074d7
Python
11,030
299
"""VGG Adapted from https://github.com/pytorch/vision 'vgg.py' (BSD-3-Clause) with a few changes for timm functionality. Copyright 2021 Ross Wightman """ from typing import Any, Dict, List, Optional, Union, cast import torch import torch.nn as nn import torch.nn.functional as F from timm.data import IMAGENET_DEFAUL...
04416dffa4d0a916fd4cccb2b6babd5ec2aaa396bb9ced6e6841eaeca201d795
Python
11,031
254
#!/usr/bin/python # ---------------------------------------------------------------------------------------- # pumpControl: A wrapper class for the a generic pump # ---------------------------------------------------------------------------------------- # Jeff Moffitt # 2/15/14 # jeffmoffitt@gmail.com # ---------------...
4f82112dc2d55a9af3fb219737c0ff11262d0a51cd3849354b83686e7ef5d8b6
Python
11,043
337
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jun 19 14:51:07 2017 @author: ajaver Get the food contour using thresholdings and morphological operations. """ import tables import numpy as np import cv2 from skimage.transform import hough_circle, hough_circle_peaks from skimage.morphology import ...
3dfcc1df0954b125fa91d8e51052dfebaee014bec72290884debb40a2908181d
Python
11,045
256
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.parameter import Parameter from torch.nn.modules.module import Module from sklearn.cluster import KMeans import torch.optim as optim from random import shuffle import pandas as pd import numpy as np import scanpy as sc from . layers import...
13a4ee56ca8a138af933f140cb0161f0cfaaef2d0804831c5aa963ebc0214a97
Python
11,048
269
"""Search Space Macro-architecture.""" import torch import torch.nn as nn import torch.nn.functional as F import operator import functools def round_(filter): return round(filter / 3) class ResidualBranch(nn.Module): def __init__(self, in_channels, out_channels, ...
402db3f5998917c22d97d0190e2423d375228aec11a7a2779911a2625ed3be7c
Python
11,049
265
import numpy as np import task_setups as setup import matplotlib.pyplot as plt import matplotlib as mpl from scipy.stats import multivariate_normal from scipy.stats import scoreatpercentile as sap from scipy.stats import percentileofscore as pofs def complete_input(cond_dict,reg_prob_dict,cat_labels): cats_in_con...
281b616a795d17ae517d048a48da2b75db247f7b691b6761f724bd12d8f85255
Python
11,051
313
# Copyright 2014-2015 Numenta Inc. # # Copyright may exist in Contributors' modifications # and/or contributions to the work. # # Use of this source code is governed by the MIT # license that can be found in the LICENSE file or at # https://opensource.org/licenses/MIT. from collections import namedtuple import logging ...
b5171608653ca44d3b25c125365363f70fc0b8081384d279f2fe7ade698040e1
Python
11,056
244
# %% import pandas as pd from torch_geometric.data import HeteroData import torch import torch_geometric.transforms as T import numpy as np import random # %% SEED = 666 random.seed(SEED) np.random.seed(SEED) torch.manual_seed(SEED) torch.cuda.manual_seed(SEED) torch.backends.cudnn.deterministic = True # Extracting ...
ee8aed167f59db0b2e50abedd2a4959e6dd334e051c7ccd7d20b981b5c453aae
Python
11,056
350
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import json import os import zipfile from pathlib import Path import pytest from cvat_sdk.api_client import exceptions from cvat_sdk.core.proxies.tasks import ResourceType, Task from PIL import Image from sdk.util import generate_coco_json from sha...
ffdc2d8e1b5205bafb73a2f309b7317a5ab7c6a536a8e97e06ad6ae4473efd50
Python
11,063
185
import os import yaml import argparse import torch seed_list = [0, 1004, 911, 2021, 119] ### CONFIGURATIONS parser = argparse.ArgumentParser() # General Parameters parser.add_argument('--seed', type=int, default=10) parser.add_argument('--seed-list', type=list, default=[0]) # parser.add_argument('--seed...
91c5d1f6e5c34407d59d377b05dd662faae5c2a9fa9350933c02ec4d995e3c89
Python
11,065
306
############################################################################# # Copyright (C) 2020-2026 MEmilio # # Authors: Patrick Lenz, Annette Lutz # # 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 ...
c05e965e0487272b514df02331c3a3d5dcac8334c60f606d3df976b5229acb8d
Python
11,067
238
# These imports are tricky because they use c++, do not move them from rdkit import Chem try: import graph_tool except ModuleNotFoundError: pass import os import pathlib import warnings import torch import wandb import hydra import omegaconf from omegaconf import DictConfig from pytorch_lightning import Train...
1809f698bad1a0123490ba6561e539df1da09d1ed7ab2d8e00f6c2642cb4d75e
Python
11,068
295
import argparse from tqdm import tqdm import torch import torch.nn.functional as F from torch.utils.data import DataLoader from torch_geometric.data import NeighborSampler from torch_geometric.nn import SAGEConv from torch_geometric.utils import to_undirected from ogb.linkproppred import PygLinkPropPredDataset, Eval...
7cf79234e64d71d43b26a49e067246821f355f984ef2b7409a58f3808cd0d82f
Python
11,068
338
#!/usr/bin/env python import defopt import logging from pathlib import Path from typing import Optional import pandas as pd import polars as pl import numpy as np import polars.selectors as cs import gzip import sys # from numba import njit ROLLING_FIRE_SCORE_WINDOW_SIZE = 200 def is_gzipped(path): with open(pat...
a1880009a0572238f7657d43cddd20d6afc4209d5c56ef18782bc2f05f27bc14
Python
11,068
264
import time import sys from nab.detectors.base import AnomalyDetector from nab.detectors.earthgecko_skyline.algorithms import ( histogram_bins, first_hour_average, stddev_from_average, mean_subtraction_cumulation, median_absolute_deviation, stddev_from_moving_average, least_squares) #### #...
7af0cafd530866a103b4582eac0bfca5c07874c2065da2431178e24daf23b602
Python
11,076
299
""" This script makes a plot of the rate differences between 1R, 1NR, and 2NR conditions for Actor and Observer trials. """ import sys import os sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import matplotlib.pyplot as plt import seaborn as sns import numpy as np import pandas as pd...
1faf58d3511073bce7ab11210d827ebad84e20ce736ee5b0a2848bdece09cd64
Python
11,077
265
#!/usr/bin/env python """ Listview containing a variable number of elements representing all of the currently available parameters files. Hazen 04/17 """ import os from PyQt5 import QtCore, QtWidgets import storm_control.sc_library.parameters as params import storm_control.hal4000.halLib.halDialog a...
2b0001c6133174aa23a58ef01ed24ddc7334cead631a6cd38b7d31890af056ee
Python
11,080
274
import torch import torch.nn as nn from torchsummary import summary from collections.abc import Sequence import numpy as np from .utils import ConvLayer, SkipConnection, ParallelConnection, DoubleSkipConnection from .unets import EncoderBlock, DecoderBlock, InputBlock3d device = torch.device("cuda:0") if torch.cuda.i...
d1fe23b85e8f7a447f9e8ee4f2834a628e6683b19517432964f0f7857cc18770
Python
11,086
351
import math from collections.abc import Iterable, Sequence from dataclasses import dataclass, field from typing import ( TYPE_CHECKING, Any, Literal, ) import torch from sklearn.preprocessing import LabelEncoder, StandardScaler from torch import nn from eir.models.layers.mlp_layers import MLPResidualBlock...
a5588723d69b6fd61dddf8a635eba97b1256e019066e0a82b5710d5df98983d2
Python
11,092
333
"""Tile-grid layout helpers for rigid-overlap stitching.""" from __future__ import annotations from dataclasses import dataclass from enum import Enum from typing import Mapping, Sequence import numpy as np TILE_SIZE_PX = 2048 # This is intentionally a fixed compatibility value, not recalculated at run time. TILE_...
c28c21caec9eadb3a1dddebb854e1b20329339f078237a08afae4f09ad745534
Python
11,093
314
""" Data processing utility functions. Author: florian.birk@tuebingen.mpg.de """ import numpy as np from pathlib import Path import sys from scipy.ndimage import gaussian_filter # Add the parent fop to the path for imports sys.path.append(str(Path(__file__).resolve().parent.parent)) # Import required modules try: ...
6f7f57ec497d89a665b153a084d085352649ea67917538f56c48ab3c1a05f387
Python
11,095
294
import torch import torch.nn as nn import torch.nn.functional as F from torch_geometric.nn import SAGEConv from torch_geometric.data import Data import torch.nn as nn class SetConv(torch.nn.Module): def __init__(self, nb_feat_in, nb_feat_out): super(SetConv, self).__init__() self.fc1 = torch.nn.C...
9b7a3233702ceccfd0c09745b043fa1b8d30029593c44f10a313e671ea83099e
Python
11,096
228
from zigzag.utils import pickle_deepcopy from zigzag.classes.hardware.architecture.operational_array import OperationalArray from zigzag.classes.hardware.architecture.memory_hierarchy import MemoryHierarchy from zigzag.classes.hardware.architecture.accelerator import Accelerator from zigzag.classes.hardware.architectur...
845cdf0023153506e0a752672f128a8202f87f75bba6a1710b779ecc35510e55
Python
11,097
320
""" Copyright 1999 Illinois Institute of Technology Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publis...
180d06fa86d22ff3e9d14cd744d926b75b7480679ec59c2ea75cb00fc69fe8cd
Python
11,103
195
import argparse import os import pathlib import time import datetime import h5py import csv import numpy as np from enum import Enum from helper_functions.get_dendritic_current import STEADY_STATE_CURRENT from helper_functions.multiprocessing_chunks_complete import all_chunks_complete from helper_functions.load_cell_...
73831318a7c9118b5f303c9dfeb1212dfdd5fad72113bede75849539f6e5bf4d
Python
11,106
286
#!/usr/bin/python # # Utility for calculating z calibration curves. # # Hazen 02/13 # import os, sys from PyQt5 import QtCore, QtGui, QtWidgets # UIs. import storm_control.zee_calibrator.mainwindow_ui as mainwindow_ui # Plotting import storm_control.zee_calibrator.plot as plot # Calibration fitting import storm_con...
35a6518d9b950c4ffbe051affa22d7c4cccbfc9ed26bae4bfa12ff3e2dd349cc
Python
11,108
300
""" OutputDirDialog: Qt dialog for confirming or selecting the output directory. 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 restrictio...
086c9c295881078291b238a3e9e3a30d8bf16555b9a901e9839f51fcd695e28e
Python
11,109
261
import argparse import logging import multiprocessing import os import pickle import time from functools import partial import h5py import numpy as np import pandas as pd import tensorflow as tf from data_reader import DataReader_mseed_array, DataReader_pred from model import ModelConfig, UNet from postprocess import ...
17911e51c415ab511920153922d341ff0d21064036346ccb6dfc3c5a2aad3449
Python
11,110
324
from copy import copy import argparse from tqdm import tqdm import torch import torch.nn.functional as F from torch.nn import ModuleList, Linear, ParameterDict, Parameter from torch_sparse import SparseTensor from torch_geometric.utils import to_undirected from torch_geometric.data import Data, ClusterData, ClusterLoa...
65069f8f8131e2a637f9d4d460e63515314068ced59ecf3249986cafd77a3864
Python
11,110
274
# -*- coding: utf-8 -*- """ MPM <-> MP2RAGE registration The purpose of the following script is to compute the deformation field for the registration between MPM and MP2RAGE T1-maps. The script consists of the following steps: 1. make folder structure 2. scale PD-map (MPM) 3. skullstrip MP2RAGE and MPM ...
685f0b47664848cb73596678c1400ec8203e3f539f14edde5a2a46f179d416a8
Python
11,110
366
#!/usr/bin/python # file: matdocparser.py # author: Andrea Vedaldi # description: Utility to format MATLAB comments. # Copyright (C) 2014-15 Andrea Vedaldi. # All rights reserved. # # This file is part of the VLFeat library and is made available under # the terms of the BSD license (see the COPYING file). """ MatDocP...
70b164c4d4570d211e4a016041c0491e0ae653d3b5e4420f758054642ac9f12a
Python
11,110
301
from argparse import Namespace from pathlib import Path from typing import TYPE_CHECKING import numpy as np import pandas as pd import torch from eir.setup.output_setup_modules.survival_output_setup import ( ComputedSurvivalOutputInfo, ) from eir.setup.schemas import SurvivalOutputTypeConfig from eir.train_utils....
7b7e3f04fff59cc616a4010898a49a94ec1c3baa1ee7121209de340d77467f55
Python
11,110
366
#!/usr/bin/python # file: matdocparser.py # author: Andrea Vedaldi # description: Utility to format MATLAB comments. # Copyright (C) 2014-15 Andrea Vedaldi. # All rights reserved. # # This file is part of the VLFeat library and is made available under # the terms of the BSD license (see the COPYING file). """ MatDocP...
2ef1fc1b2de5a62a0ee3a83a70ef8d16af8bf2c79e3700cdd095bf1cb1f52096
Python
11,112
350
import scanpy as sc import numpy as np from typing import List import anndata from typing import Optional, Union from sklearn.neighbors import kneighbors_graph import scanpy as sc import numpy as np from scipy.sparse import issparse from sklearn.utils.extmath import randomized_svd from scipy.sparse import csc_matrix, c...
53dc7c4f14a750a93f859cc56e1f8449669f9fa731d0a3348edc6846e60b3da9
Python
11,112
262
''' Author: Laurent Guerard Group: IMCF Email: laurent.guerard@unibas.ch Email bis: l.guerard42@gmail.com Creation Date: Monday, 21st October 2019 4:39:24 pm ----- Last Modified: Wednesday, 20th November 2019 18:50:35 Modified By: Laurent Guerard ----- HISTORY: Date By Comments ---------- -- ...
7cbe7f1fe1891ac178b9ce4a0a39a428c3de81f7d1d6fbb95ff8b7bab14eab80
Python
11,112
343
# -*- coding: utf-8 -*- """Skull stripping tools.""" import os import nibabel as nb import numpy as np from scipy.ndimage import binary_fill_holes from scipy.signal import argrelextrema from .. import execute_command from ..io.filename import get_filename from ..registration.transform import apply_header from ..segm...
931f9a602283b043936ae63ce260158eceb822ad44fd38b389e4bbef8327919c
Python
11,114
353
"""RAG (Retrieval-Augmented Generation) tools for ChemGraph. Provides tools to load documents (.txt and .pdf) into a FAISS vector store and query them for relevant context. Supports OpenAI and HuggingFace embeddings with automatic fallback. """ import os import logging from typing import Optional from langchain_core...
b865006173ab25d2fd8823918fc24e38fe5a015a16dbefdaaa53de1a9ef72051
Python
11,116
243
#Lucas Sancéré - import os script_dir = os.path.dirname(os.path.abspath(__file__)) import joblib import numpy as np import yaml from attrdictionary import AttrDict as attributedict from histo_miner.feature_selection import SelectedFeaturesMatrix ############################################################# ## Load...
65c9eb0ed84bc1696d03328df423eaceee2fdf664d21007a4800614971de4962
Python
11,118
288
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license """ Ultralytics YOLO26 Pose Estimation with optional Multi-Object Tracking using Axelera Voyager SDK. Standalone example using the axelera-rt pipeline API. No ultralytics dependency at runtime. Exported with nms=False, YOLO26 is NMS-free: the model o...
3325b504549ccb6cfb67b6a68895526e7d6b56a1d5239d345fe555a54a52c6ef
Python
11,122
307
from __future__ import annotations from typing import Any import numpy as np import obspy import torch from obspy.core import Trace import seisbench from .base import GroupingHelper from .phasenet import PhaseNet from seisbench.util.dkpn_shared import ( _DKPN_ANNOTATE_DEFAULTS, _DKPN_FEATURE_DEFAULTS, _...
df9e9b76f0906c74d2a760d01a73c7fb0688638239fae078280fada63581350f
Python
11,126
388
# -*- coding: utf-8 -*- """EPI <-> EPI The purpose of the following script is to compute the deformation field for the registration between different epi time series. The script consists of the following steps: 1. set output folder structure 2. n4 correction epi 3. clean ana (remove ceiling and normalise) ...
ddaa619e5aa00bcb1902c5e6b42f2ebc227b4f0818d03c423f99b1107db6dd67
Python
11,127
223
#!/usr/bin/python3 # -*- coding: utf-8 -*- # from PyQt5.QtPrintSupport import QPrintDialog from PyQt5.QtWidgets import QMessageBox, QMainWindow, QMenu, QAction, QFileDialog, QApplication from napari_dmc_brainmap.registration.sharpy_track.sharpy_track.view.ModeToggle import ModeToggle from napari_dmc_brainmap.registrat...
9d3e010b746f8c6af7ad6ddda81aefa504d1ef567b661f7b0605b5f26ab0281a
Python
11,129
285
""" HCTSA """ import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from matplotlib.colors import LinearSegmentedColormap from palettable.colorbrewer.sequential import (PuBuGn_4, PuRd_4, ...
4ac8318db1ef393dd909d44a1dd4f91258d58a34963db3d5ff3357cf3517e305
Python
11,131
353
import os import numpy as np import pandas as pd from scipy.optimize import least_squares, minimize from typing import Dict, Tuple, Optional, List import matplotlib.pyplot as plt from dataclasses import dataclass import sys sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) from config.physi...
ef171b2a6e8ca6fac8ac11f894795caf4a99d4322d89aac73f13c7b522aa7d17
Python
11,131
293
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Author: Yong Bai, yong.bai@hotmail.com @License: (C) Copyright 2013-2022. @Desc: """ import numpy as np import pandas as pd import scanpy as sc from scipy.stats import ranksums from statsmodels.stats.multitest import multipletests from tqdm import tqdm def detect_...
8d5c4ee30667c97e67beb32462b8eb99119f63fbf77c8cbed0e8c86b4eb41c6e
Python
11,133
341
import os from collections import defaultdict, namedtuple from datetime import datetime, timedelta from json import dumps from typing import Any, AnyStr, Dict, List, NamedTuple, Union, Optional import numpy as np import requests import tensorflow as tf from fastapi import FastAPI, WebSocket from kafka import KafkaProd...
9901f0259346a002c865a3234687d90d7ad03c42664d3d7897764d7bd0a5a5d2
Python
11,133
268
# %% [markdown] # # Prediction of Foraging States of *P. pacificus* # # The single steps of this pipeline are the following: # 1. additional feature calculation # 2. pipeline loading # 3. prediction # 4. analysis and plotting # %% IMPORTS # lib imports import os import time import tqdm import sys import numpy as np ...
8a4b42fab5eebffb402abe47506866cb308432917655fabf73e941c75159756e
Python
11,142
334
"""Skill inference task. Project for Setayesh Radkani and Michael Yoo. """ #pylint: disable=import-error, no-name-in-module import numpy as np import pdb from moog import action_spaces from moog import observers from moog import physics as physics_lib from moog import game_rules from moog import tasks from . import...
d8d2d2a7c723e7ac76e5649ca45aa484f5336021e5afae95faa65de0fa8616f7
Python
11,142
328
# -*- coding: utf-8 -*- import logging from matplotlib.font_manager import findfont import numpy as np from PIL import Image, ImageDraw, ImageFont from scilpy.viz.color import generate_n_colors def any2grayscale(array_2d): """ Convert an array to `uint8` grayscale so that it can be appropriately handled...
2a93d1b6ed4e7cfdaa617ef3a11f0586a7f72172f1e6d152980ab07d52036937
Python
11,143
334
"""Skill inference task. Project for Setayesh Radkani and Michael Yoo. """ #pylint: disable=import-error, no-name-in-module import numpy as np import pdb from moog import action_spaces from moog import observers from moog import physics as physics_lib from moog import game_rules from moog import tasks from . import...
9322bb3ade29e15e112980fc020cd3c26b049461532f3cad956be4f7a96ae38e
Python
11,143
372
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import matplotlib import matplotlib.colors as mcolors import numpy as np from skimage.morphology import disk def get_registration_parameters( metrics, affine_iterations, syn_iterations, shrink_factors, smoothing_sigmas, th...
9d7e151ad7a91987c5794472fcdf6d90dc1d707cd2b24ca059bbdad9b61cb2c5
Python
11,143
342
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from __future__ import annotations import argparse import textwrap from collections.abc import Sequence import cvat_sdk.auto_annotation as cvataa from cvat_sdk import Client, models from cvat_sdk.core.helpers import DeferredTqdmProgressReporter fro...
cfb8158c9ff46356816748ea4de594b045418cff2c6b6049344c55f248461728
Python
11,146
231
from dataclasses import dataclass from neuron_interface.neurosim.cells import L23_PC_cADpyr, L4_LBC_dNAC, L4_LBC_cSTUT, L4_LBC_cACint, \ L4_NBC_dNAC, L4_NBC_cACint, L4_SBC_bNAC, L4_SBC_cACint, \ L5_TTPC2_cADpyr i...
8fe99a1bca3d07d35afd8cebfab0d4e666f8e623b05ec166b1174f863ddf5fad
Python
11,147
261
from dtiplayground.dmri.common.tools.base import ExternalToolWrapper from dtiplayground.dmri.common import measure_time import dtiplayground.dmri.common from pathlib import Path import subprocess as sp import os import re _options_cache={} # binary path -> set of option names listed in its usage text class FSL(Ex...
dcacba12d1839ff5a521604edaf96be8d3c0af64078c64beb8f78df0f41a49bb
Python
11,147
312
""" Hypergraph Neural Network (HGNN) for learning node and hyperedge embeddings. This module implements the HGNN architecture for disease-hypergraph representation learning, where diseases are modeled as hyperedges connecting metabolites, proteins, and GO terms. References ---------- .. [1] Feng Y, You H, Zhang Z, et...
8708c98a0be4a595ebe43ab20591377547ec5039fd382eaa8bbe42a1d9ba02e1
Python
11,150
305
from scipy import stats import torch from tqdm import tqdm from smart.model import SMART from smart.layer import SAGEConv_Decoder, SAGEConv_Encoder import torch.nn.functional as F import numpy as np def laplacian_regularization(x, edge_index): """ Compute Laplacian regularization loss. This loss enforces...
b46f1a08b4d75f83d0ad20fbed9c4e6ec581a5ce825e4546f66afa9253fb31dd
Python
11,151
278
# -*- coding: utf-8 -*- import os import re import sys def extract_reference_values(ref_pcr_path): values = { 'zero': '', 'bg_coeffs': [], 'scale': '', 'u': '', 'v': '', 'w': '' } try: with open(ref_pcr_path, 'r') as file: lines = file....
b4eb548c739602753eff434e3b2022fd31948728127f6178e0fd3693813fd3fc
Python
11,151
311
import numpy as np from scipy.sparse import issparse, lil_matrix from scipy.spatial import Delaunay, distance try: import cupy as cp except ImportError: cp = None def pre_cal1(N): degree = np.diag(np.sum(N, axis=1)) L = degree-N L_inv = np.linalg.pinv(L, rcond=np.finfo(float).tiny) n = len(N) ...