sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
770799d961a863848b30720e86c829ae9c5087a57335a8b5ea020d3ecdfc74a9
Python
10,398
273
import torch from base.base_fits_manager import BaseFitsManager from .tracker import MetricTracker class Baseline_Fits_Manager(BaseFitsManager): ''' Baseline fits managers ''' def __init__(self, config, train_data_loader, valid_data_loader=None, test_data_loader=None): ''' Initialize t...
34140fdde39ff3995da4f63824d882ec5d64f81fae6cbc30594770c288492e1a
Python
10,403
230
"""Output parity for the midsagittal-fitter speedups. The optimisations here are pure caching: work that was repeated on an array that never changes within a fit is done once and passed down. The whole value of that is conditional on the answer being IDENTICAL, so the parity claim is tested directly rather than a...
640433c5a68de45942dec48cc86345751fffdcf29fa61005eeb3ecda6f6e3497
Python
10,403
243
# -*- coding: utf-8 -*- """ Created on Dec 12 2022 @author: BIONICS_LAB @company: DZNE """ import sys sys.path.append('../') import matplotlib.pyplot as plt from scipy.signal import butter, lfilter import h5py import pandas as pd import LFP_Denoising as LFP_denoising import Spikes_Denoising as Spikes_Denoising import...
ddc01439fcd4fb7fc35ea87c85bd3f655fc5d9987bc78a68713ec18bf6b9bf20
Python
10,403
198
# -*- coding: utf-8 -*- """ Created on Dec 12 2022 @author: BIONICS_LAB @company: DZNE """ import numpy as np import os import h5py import matplotlib.pyplot as plt """change these parameters based on different datasets""" SpikesMax = 15 # (Hz) - maximum acceptable Spikes Rate(Spikes events/min) SpikesMi...
63a6274da2d38554adf84321b17bc26b0f964e819b866f3578e06d6cd16043eb
Python
10,404
246
import pandas as pd import numpy as np import math from copy import deepcopy from kipoi.data import Dataset, kipoi_dataloader from kipoi_conda.dependencies import Dependencies from kipoi.specs import Author from kipoi_utils.utils import default_kwargs from kipoiseq.transforms import ReorderedOneHot deps = Dependencie...
ca5604fcc4d5a13e7d24352c537738fc177516b8ec48ea9f41585e7979cd7a63
Python
10,404
271
import os import yaml import numpy as np from tqdm import tqdm from typing import Dict, Any, List import logging import torch import tensorflow as tf from tensorflow import keras import numpy as np from huggingface_hub import hf_hub_download from fastglioma.inference.run_inference import FastGliomaInferenceSystem fro...
1cc0053afe9091087a9314db9e29f773a0dd0fedbe3c542c43ee5ef2b64deaf7
Python
10,405
270
"""Aalen–Johansen estimation for right-censored competing risks.""" import numpy as np from numpy.typing import ArrayLike from SurvivalEVAL.nonparametric_estimator.util import _predict_step class AalenJohansenCompetingRisks: """ Estimate survival and cause-specific cumulative incidence functions. The e...
65d7aa9e885c43d1f2a898b8eccc78a3d034a3a9925f7e375e551ae079b18170
Python
10,405
254
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
63d93346f1be3b4720a46b4e25fbc3ef284060ee3920019a77d8c55c30ad87f0
Python
10,410
239
"""Module for PREP pipeline.""" import mne from mne.utils import check_random_state from pyprep.find_noisy_channels import NoisyChannels from pyprep.reference import Reference from pyprep.removeTrend import removeTrend from pyprep.utils import _set_diff, _union # noqa: F401 class PrepPipeline: """Early stage pr...
1bf5d39e7a9a6c4983191e98ea0260bd7aa51f0e210a7e562829c8b63474aa8a
Python
10,411
229
from __future__ import print_function,division import sys import os import glob import pandas as pd import numpy as np import argparse import topaz.utils.star as star import topaz.utils.files as file_utils from topaz.utils.conversions import mirror_y_axis from topaz.utils.data.loader import load_image name = 'conve...
d205138f820405ad3eacb5a0b38bc6ce94d3a8ea5783d3a4ecfbe67a105af571
Python
10,411
268
""" Generates a ListTomoParticle object from a input STAR file Input: - STAR file for pairing STAR files with particles and particles shapes Output: - A ListTomoPaticles pickled object for every STAR file row """ ################# Package import import os import numpy as np import scipy as sp import ...
542f6478d9be8945a4de375d0ced64d95af832dea398bfcc50dbb7dbc0140f29
Python
10,415
267
import sys, gzip, bisect def sortedFlankingPositionsByDistToTargSite(targetPos, flankingPositionsToExamine, desiredNumPositions, physLen): i = 1 sortedFlankingPositions = [] while len(sortedFlankingPositions) < desiredNumPositions: lPos = targetPos - i rPos = targetPos + i if lPos >...
726119f16dc544b8f0e3aa4385500b7147ff921fd01301e4399a8bf0484533cc
Python
10,416
293
import logging import math import os import pandas as pd from cirrocumulus.diff_exp import DE from cirrocumulus.ot.transport_map_model import read_transport_map_dir from cirrocumulus.util import dumps from .data_processing import get_filter_str, get_mask, get_selected_data from .envir import ( CIRRO_DATABASE_CLA...
3addb3bd85cef8f9acf8f113f9bcec4241194583bcbce3f4f5dbd5244f2e5700
Python
10,418
246
#!/usr/bin/env python # ================================================================ # Copyright (C) 2022 Yufeng Liu (Braintell, Southeast University). All rights reserved. # # Filename : find_break_crossing.py # Author : Yufeng Liu # Date : 2022-04-01 # Description : # # =========...
dc5791ef6b32d5e9e82021b47c0699ab1468a8447cb60ff536b3c0ef2b5cd32c
Python
10,418
330
"""HDL generators for VHDL and Verilog code generation. This module provides concrete implementations for generating VHDL and Verilog code. Each generator encapsulates language-specific factories and provides a unified interface. """ from enum import Enum, auto from typing import Literal, Protocol, overload from ela...
6e06db7b14054afb84cd2e733f5cd4e43381a4992cd6497932c220aae004974b
Python
10,419
284
## import APT_interface import h5py import tensorflow as tf from multiResData import * import localSetup import os import PoseUNet import subprocess import copy import json import copy from matplotlib import cm import matplotlib.pyplot as plt import APT_interface import datetime import ast import argparse import pic...
becf67ec683ebe03bdb35973b1dd15206f40288fd5ac72090d9bc7ef269286e8
Python
10,426
266
"""Tests for regtools.ccf_boundary_editor.io.""" from pathlib import Path import numpy as np import pytest def _two_region_annotation(): ann = np.zeros((3, 30, 30), dtype=np.int32) ann[:, :, :15] = 1 ann[:, :, 15:] = 2 return ann def _dragged_state_for_slice(annotation, z): fro...
e989727029d1314cfd1f0cf3cdd97bd94fc9d564190ea242456bec32f84f241c
Python
10,426
281
import torch from torchvision import transforms from torch.optim import * from models import * import numpy as np from torchvision import datasets from torch.utils.data import DataLoader from torch.autograd import Variable import torch.nn.functional as F import os from utils import Logger, AverageMeter, accuracy, mkdi...
271c046f55850a06764833ba51fbbc8049faee5027e55ec8f9da806fad41a058
Python
10,427
266
import SimpleITK as sitk import pandas as pd import tempfile import numpy as np import boto3 import nibabel as nib import os import botocore from data.constants import * from exceptions.exceptions import * def readCSVS3(data_key): ''' args: data_key - string containing path to csv file within the ...
a4cca2d67da77dda3bc732d586674ebc8cb520db76ec76ea849363eef31c5a52
Python
10,429
292
"""Cache Management """ import hashlib import json import logging import os from pathlib import Path from typing import Any, Dict, List, Optional from pip._vendor.packaging.tags import Tag, interpreter_name, interpreter_version from pip._vendor.packaging.utils import canonicalize_name from pip._internal.exceptions i...
a6ddf0520f75c03091d7db8fbee7d298f5e774d4ea3f9c8ad2cb3175fd07ceba
Python
10,432
248
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon May 22 12:39:05 2023 @author: felipe """ import sys import os directoryKNP='../../' sys.path.append(os.path.abspath(directoryKNP)) import plot.networks as pltn import analysis.connectivityMatrices as connectivityMatrices import numpy as np import matpl...
7fd9c62563517795ad42525c2e4410e43fa7d7501da5b18a691f3406bc769df4
Python
10,434
311
import os import numpy as np from scipy.spatial.distance import squareform, pdist from scipy.stats import spearmanr import seaborn as sns import matplotlib.pyplot as plt import matplotlib.cm as cm from utils import build_morpho_dict, make_dir, mannwhitneyu_print, \ null_color, pickle_load, plot_mor...
808a4cc9cd5888ad815cb9f6b9e2e78e569403e1a3a2cd31adb4d3ff610f98db
Python
10,434
355
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
f9dce5440758b3951d421b90e3d80a7da9e0d6b54972bc465aee6a47c83abb94
Python
10,434
259
# Node-group asset "ID Outline" (CompositorNodeTree), dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump. from typing import TYPE_CHECKING ...
ba26fcdcf4eab5cf3eb86ae87b178f347503121c865c903908cc68384d22b132
Python
10,436
268
""" Generates a ListTomoParticle object from a input STAR file Input: - STAR file for pairing STAR files with particles and particles shapes Output: - A ListTomoPaticles pickled object for every STAR file row """ ################# Package import import os import numpy as np import scipy as sp import ...
607c1175d24f67749420130ba04e694857d5ff42352ed578698f2969eca1503d
Python
10,437
281
#!/usr/bin/env python #================================================================ # Copyright (C) 2023 Yufeng Liu (Braintell, Southeast University). All rights reserved. # # Filename : ds_matrix_condense.py # Author : Yufeng Liu # Date : 2023-02-08 # Description : # #============...
215566012c0ffc8dd843666ec5e9f434be3c717f35e978971c9da733bc3e5084
Python
10,439
288
import logging import os import random import string import time import unittest import neurolib.utils.paths as paths import neurolib.utils.pypetUtils as pu import numpy as np import pytest import xarray as xr from neurolib.models.aln import ALNModel from neurolib.models.fhn import FHNModel from neurolib.models.multim...
7baa2889cbfed16d00e72af3198476b5b540ad0afec6280156cc30145e3a9b2e
Python
10,439
179
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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 # # ht...
716f8ef7ee6e775a809ad06db6b3b3859cdecbc9f338d96bba5f862b6c61bf3f
Python
10,441
251
print("GRAF is running..") import os import torch import argparse import errno import warnings base_path = os.getcwd() + '/' dataset_name = 'sampledata' folder_ext = 'GRAF_results/' device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') warnings.filterwarnings("ignore", category=FutureWarning) warnings....
886b273369f12a5a7bd3632550ca49e88f9e953c89f0f2ab1d2ab5d7868b8223
Python
10,443
362
# -*- coding: utf-8 -*- # # louvain documentation build configuration file, created by # sphinx-quickstart on Fri Oct 21 11:26:44 2016. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # A...
69395e7625190671e0a155674d21afd9ccd3bf8d4fc02d08ee0d6ef8a71faebf
Python
10,446
212
from typing import Callable, List, Dict, Optional, Literal, Tuple import torch from torch import nn from .base import AtomicModule from ..layer import EmbeddingLayer, RadialLayer, ReadoutLayer from ..layer.equivalent import NonLinearLayer, GraphConvLayer, SelfInteractionLayer from ..utils import find_distances, _scatte...
9137c7229966820094f396cc5f96dc57ee16ca43102e886e9d001a49a33ab84d
Python
10,448
312
import torch import torch.nn as nn import torch.utils.model_zoo as model_zoo model_urls = { 'resnet18': 'https://download.pytorch.org/models/resnet18-5c106cde.pth', 'resnet34': 'https://download.pytorch.org/models/resnet34-333f7ec4.pth', 'resnet50': 'https://download.pytorch.org/models/resnet50-19c8e357.pt...
791db4d3da9382da98bc0a3a12c459e7e080eb6912e102a06bc863de55d00ed5
Python
10,449
335
from cgi import print_arguments from statistics import mode from traceback import print_tb from matplotlib.pyplot import axis import tensorflow.keras as keras import tensorflow as tf from function import * from model import call_model import argparse from scipy.stats import pearsonr ''' 入力を受け取る ''' parser = argparse....
eb9f959d2659b25ddd0a5a42c089b4e9f87a242cf73b84baebff50c6e06e77ba
Python
10,453
260
import os import argparse from tqdm import tqdm import pickle import torch import torch.nn as nn import torch.optim as optim import numpy as np import math import random import pandas as pd from sklearn.metrics import mean_absolute_error, r2_score, accuracy_score, roc_auc_score, f1_score from dataset import MicroData...
f5fee5d3ad9a9aebd1005efe0969f1e96672fbec9b25c82236fac5df8c2befa8
Python
10,453
340
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
23c6f3ff8600371545def7a3eecc6684fe604439d89b09d2503b23392aec7fcf
Python
10,454
227
"""Singleton checker that validates reserved HED tag usage rules loaded from reserved_tags.json. ``hed/validator/data/reserved_tags.json`` is a verbatim copy of ``reserved_tags.json`` as published by the HED specification (section 3.2.8, defined in Appendix A.6). The ``reserved_tags.yaml`` workflow fails when the copy...
86dafb3007dffa1ec4c06a8217be74d7571165028c204b90f789dd8c103f1670
Python
10,458
328
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
9977937f0a100e39c8ebf0f50c60feb921f04c4f1b7ac723d38f3526c289b953
Python
10,458
283
import os import os.path as op from functools import reduce import numpy as np import matplotlib.pyplot as plt import seaborn as sns import mne from scipy import stats from params import BIDS_ROOT as bids_root from params import TEMPLATE as template from params import PLOT_DIR as plot_dir from params import EXTENSION...
4d9efd011e3c1711e04f23d1bef2db3f9a22624221e59bca7bdba2de0cebdf9d
Python
10,459
268
""" Generates a ListTomoParticle object from a input STAR file Input: - STAR file for pairing STAR files with particles and particles shapes Output: - A ListTomoPaticles pickled object for every STAR file row """ ################# Package import import os import numpy as np import scipy as sp import ...
af297c7d8d6e2b19831bac516600b17396d76a00386bff0c9d34284593c505f0
Python
10,459
347
#!/usr/bin/env python # coding: utf-8 # ## Analysis of feature selection results # # We tried a few different feature selection methods for mutation prediction: # # * mean absolute deviation # * pan-cancer univariate f-statistic (on training data, separate samples into mutated/not mutated and do an f-test) # * media...
4f8e85bc2252bd82f2b906b94f608973a73661eb627475f627c2268481d634c1
Python
10,463
314
import numpy as np import pandas as pd import pytest import scanpy as sc from anndata import AnnData import pertpy as pt @pytest.fixture def adata(rng): X = rng.random((69, 50)) adata = AnnData(X) perturbations = np.array(["control", "target1", "target2"] * 22 + ["unknown"] * 3) adata.obs["perturbati...
6eb1348616506a5f89e6af7af1eec9617a6620fe34945b06a6da68582fe59d61
Python
10,463
267
# -*- coding: utf-8 -*- from __future__ import annotations from typing import List, Optional, Tuple import torch import torch.nn as nn from supar.modules.dropout import SharedDropout from torch.nn.utils.rnn import PackedSequence, pack_padded_sequence class CharLSTM(nn.Module): r""" CharLSTM aims to generat...
9b96a9fb04df3e11f111f28da45e4e6f04611debd17cc56736458e17b5896486
Python
10,467
271
import csv import os import numpy as np import matplotlib.pyplot as plt import pandas as pd import seaborn as sns from matplotlib.colors import LogNorm, Normalize # Given a dataset stats and results path, load in the DataFrame, merge and filter def extract_dataset(stats_path, results_path, filter_by, parseparams_f,...
50e11bf0ffef5bac72a96d05378e97a91e2471637a37bec833fafacd470d93a9
Python
10,471
375
from __future__ import division import numpy as np import scipy import scipy.signal import scipy.optimize import scipy.special from scipy.special import factorial __all__ = ["Morlet", "Paul", "DOG", "Ricker", "Marr", "Mexican_hat"] class Morlet(object): def __init__(self, w0=6): """w0 is the nondimensio...
1c8aecf3684993582c796caa2b3a0fad1dc84be80e9d827f8673a6fbb8cab6fc
Python
10,473
257
import torch from torch.utils.data import Dataset, random_split, DataLoader from pytorch_lightning import LightningDataModule from typing import Any, List, Type # local imports from ..colors import Color, Grey from ..textures import Texture from ..stimuli import Stimulus from ..shapes import LShape, TShape, PlusShape, ...
2f9665135a1b61e162d4be2dce19065928e9b9f2fe71f3b24cca914c41140a64
Python
10,474
219
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
5b5aa5c213dff21d836bb8b88ccc44fdfdbd3701b09a37c8d44a42730fb8d622
Python
10,475
313
################################################################################ # Copyright (c) 2021-2024, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # Written by D. Jones <djones@llnl.gov> and UCSD collaborators in listed in CONTRIB.md # # All rights reserved....
36a6e2a65e74edf16e475f8cfc56d734442959a3ef6f340b61e275660af70032
Python
10,477
317
import dill import numpy as np import argparse from collections import defaultdict from sklearn.metrics import jaccard_score from torch.optim import Adam import os import torch import time from models import SafeDrugModel from util import llprint, multi_label_metric, ddi_rate_score, get_n_params, buildMPNN import torch...
bbdafcd76cdbad726e8050f1ac8a3f191c2f3356fd250787361e15e0fc858ca5
Python
10,477
257
import torch from torch.utils.data import Dataset, random_split, DataLoader from pytorch_lightning import LightningDataModule from typing import Any, List, Type # local imports from ..colors import Color, Grey from ..textures import Texture from ..stimuli import Stimulus from ..old_shapes import LShape, TShape, PlusSha...
2add8cbfd29353eb63a1403c9ab865b359624045643287090c39144e917437cd
Python
10,481
265
""" Dispatch logic for all BIFROST tools Execute using the 'bifrost' executable installed by setuptools """ import argparse import sys from bifrost.util import SubcommandHelpFormatter def main(): parser = argparse.ArgumentParser( description="BIFROST: template building and cross-modal registration", ...
120ef8dd40ffbbf25c52a2aeb8fbf5e2d9605da94a0b412b445aab747e5655fd
Python
10,484
327
import numpy from collections import namedtuple from time import sleep import sys import time #@@@ import numpy as np from scipy import misc import cv2 import os try: import gi gi.require_version("Gst", "1.0") gi.require_version("Tcam", "0.1") from gi.repository import Tcam, Gst, GLib, GObject except I...
9b5c9b6e4181d2099af8eb18edc343cc8fdb3532e89465ddaafcef31e4a90dea
Python
10,484
253
#!/usr/bin/env python import os import argparse import sys sys.path.append(os.path.dirname(__file__)+'/..') from maggie import score, utils, visual import numpy as np import pandas as pd from Bio import Seq import requests if __name__ == "__main__": parser = argparse.ArgumentParser(description='MAGGIE framewo...
077ae8b588c0ecf606e7b050d80f8a353bf4025ef6b960c6e34104377ee1b972
Python
10,489
304
#!/usr/bin/env python import sys import re from datetime import datetime,timedelta import argparse from enum import IntEnum import getpass parser = argparse.ArgumentParser(description='summary matlab proceeses in top log.') parser.add_argument('top_log') args = parser.parse_args() topfile = args.top_log # ========...
6c2a43043df97277084c2f658df87136a6881717c1b278ee17782438942639f7
Python
10,489
261
from Functions.f_SignalProcFuncLibs import * def confidence_ellipse(x, y, ax, color, n_std): import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import Ellipse import matplotlib.transforms as transforms """ Create a plot of the covariance confidence ellipse of *x*...
6777549ee441aa6eeeec1eb68ced12a07ba1c8d74d6abfba9bd9a4fdcc3c4e8b
Python
10,492
238
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
6c712bf2da3410814f034fc3848c1e69702fade82508a92e3fb712b3d448496c
Python
10,493
289
# # Tests for argument_processor module # # Copyright © 2026 Ernst Strüngmann Institute (ESI) of the Max Planck Society # # SPDX-License-Identifier: BSD-3-Clause # from unittest.mock import patch, MagicMock from acme.argument_processor import ArgumentProcessor class TestArgumentProcessor: """Test suite for Argum...
49eb809ffe24940d43fd0bb650b10103a9b135605435f734fc5c37d530676867
Python
10,496
191
import cv2 import numpy as np import matplotlib.pyplot as plt import pandas as pd from matplotlib.patches import Ellipse from scipy.spatial.distance import cdist class mol_property: def __init__(self, img, pixel=None, offset_x_nm=0, offset_y_nm=0, len_nm=None) -> None: if pixel is No...
da454171f49476ae168410599c6bf56837e5cc950bb14896796a4820c34ee0d9
Python
10,496
238
#!/bin/env python3 """ Command Line Interface ----------------------- Perform some common tasks for analysing ``ithildin`` results from the command line. """ import click import warnings from typing import Union @click.group() def tools(): pass @tools.command() @click.argument("stem", required=True, type=str) ...
b8203131db3303a208c4f1e94bc58c72bff663f4a28a1aa1e4bf7578c6e1ff7d
Python
10,500
331
""" ================= Run the full PREP ================= In this example we show how to run PREP with ``pyprep``. We also compare :class:`~pyprep.PrepPipeline` with PREP's results in Matlab. We use sample EEG data from Physionet EEG Motor Movement/Imagery Dataset: `https://physionet.org/content/eegmmidb/1.0.0/ <htt...
b5068084b779945113a1e9cb6f00cff526827eb90ac3be9d1b0ee3af9713f0c4
Python
10,504
346
import cocotb import pytest from cocotb.clock import Clock from cocotb.triggers import RisingEdge, Timer from cocotb.types import LogicArray from cocotb.utils import get_sim_time import elasticai.creator_plugins.adders as adders import elasticai.creator_plugins.mac_delta as mac_delta import elasticai.creator_plugins.m...
753e704ee0e69466048425de416611456cdaa509c627818dcb093df9e75db89c
Python
10,507
233
import torch from core.utils import convert2cpu def parse_cfg(cfgfile): blocks = [] fp = open(cfgfile, 'r') block = None line = fp.readline() while line != '': line = line.rstrip() if line == '' or line[0] == '#': line = fp.readline() continue ...
78671bad014aa3d3ecba95932845c3448e2eeb1531688f4f6db06ad220b2acde
Python
10,509
515
from __future__ import annotations from typing import Iterable import numpy as np import pandas as pd # ====================================================================== # DEFAULT COLUMN NAMES # ====================================================================== DEFAULT_CLUSTER_COLUMN = "cluster" DEFAULT_P...
5bf4166a7a1de81cebec565ac27349c9537a7b98a1276e79f16297b9d8c54f6a
Python
10,511
315
from __future__ import annotations from typing import Iterable import pandas as pd from joblib import Parallel, delayed from sklearn.base import BaseEstimator from sklearn.utils._estimator_html_repr import _VisualBlock from sklearn.utils.metaestimators import _BaseComposition from cuppa.constants import DEFAULT_FEATU...
553d96deb5f649c36cc5f6ff9f36b1732d82a05da9271add88a77030e10a7aa6
Python
10,515
274
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
ba5a3a6d632ae482f36d270b7ac24bedc55708c1d2b02df063d06f7e72be414b
Python
10,515
357
from __future__ import annotations import logging from pathlib import Path from typing import TYPE_CHECKING import numpy as np from quacc.utils.dicts import Remove if TYPE_CHECKING: from typing import Any from ase.atoms import Atoms from quacc.types import Filenames, SourceDirectory LOGGER = logging....
e71c162696862c6326edf2cf8998b8f7b9ecea848e4842925bb37147d87d78e7
Python
10,520
282
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Jan 31 15:56:34 2023 @author: daltonm """ import numpy as np import pandas as pd import matplotlib import h5py from scipy.ndimage import gaussian_filter from functools import reduce # forward compatibility for Python 3 import operator from importlib i...
961d3a856225729bc80bb48be573b9292b950365324f9c670eb31ca3342f531d
Python
10,525
285
""" Unit tests for regtools/registration/core/laplacian/utils.py Covers: - laplacianA1D - laplacianA2D - laplacianA3D """ import numpy as np import scipy.sparse import pytest # =========================================================================== # laplacianA1D # ========================...
fb5cfde6da10056294c2b9015df23b6eeb863a0eb294f21f5fb3275bd89e02bd
Python
10,529
255
import os,sys os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' import tensorflow as tf import logging logging.getLogger('tensorflow').setLevel(logging.ERROR) # # define my own activations to help the gradient optimizer def dfh_tanh(x): return tf.math.tanh(x)*tf.constant(0.98, dtype=x.dtype) + x*tf.constant(0.02,dtype...
685fd4642a47fdcd57563e3aeadf1c3cb0484d16aa877525b5d810f0c1a26032
Python
10,530
260
""" Set of tests for Wong-Wang model. """ import unittest import pytest import numpy as np import xarray as xr from jitcdde import jitcdde_input from neurolib.models.multimodel.builder.base.constants import EXC from neurolib.models.multimodel.builder.wong_wang import ( WW_EXC_DEFAULT_PARAMS, WW_INH_DEFAULT_PAR...
40cf824a95c2bbbb92231e14bca4f852a55172136acc598adf94f1066642a410
Python
10,532
262
# -*- coding: utf-8 -*- import numpy as np def calc_point2point(predict, actual): """ calculate f1 score by predict and actual. Args: predict (np.ndarray): the predict label actual (np.ndarray): np.ndarray """ TP = np.sum(predict * actual) TN = np.sum((1 - predict) * (1 - actu...
d321b789403aca5b850fe2860b06e2f2db84e24c45407f1217acc413d49ab362
Python
10,532
238
#!/bin/env python3 """ Command Line Interface ----------------------- Perform some common tasks for analysing ``ithildin`` results from the command line. """ import click import warnings from typing import Union @click.group() def tools(): pass @tools.command() @click.argument("stem", required=True, type=str) ...
bfd86a61637111aef54669add4a0506c5996c164ce2d55ef2f75600e3934d51c
Python
10,536
339
""" (*)~--------------------------------------------------------------------------- Pupil - eye tracking platform Copyright (C) 2012-2020 Pupil Labs Distributed under the terms of the GNU Lesser General Public License (LGPL v3.0). See COPYING and COPYING.LESSER for license details. ------------------------------------...
b9b1f610b2ea6f428948a2468966834ba7bf1d3d10c545be4827c0f66349b957
Python
10,539
323
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
b53432b2d0184359138a6432c1f5a27d243af41703cd76cb7aacc210e4d26f8b
Python
10,542
225
"""Download the Allen Mouse Brain CCF **2022** annotation and register it as a selectable atlas variant. Allen published a revised annotation in 2022 (finer/relabelled structures on the SAME CCFv3 reference space as the 2017 release). Unlike 2017, they distribute it ONLY at 10 µm - ``annotation/ccf_2022/annotatio...
4c7ff74d667d6b7b4b46882e10a81ed5c99f5019f916baf4e680ba559e410c4e
Python
10,545
365
from tqdm import tqdm import copy import jax import jax.numpy as jnp import numpy as np from tqdm import tqdm import scipy.stats as ss from collections import namedtuple import pickle import logging from hippo.models.cscg import rargmax logger = logging.getLogger(__name__) eps = 1e-14 HMMParams = namedtuple( ...
88c1d91441be2a7bb5a72ace93f9b2645d513fad557fb8f608e47b2942e0194e
Python
10,545
287
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
05c7ecf638bf0155e9c9b7596219097233e107ccb5fecbbc307530aa9d4d86bb
Python
10,547
252
import torch import os from pytorch_lightning import LightningDataModule import numpy as np from lib import utils import pandas as pd from torch.utils.data import DataLoader, Subset def encode_features(df, scaler): # df must has time index, and sensors as columns t = df.index num_sensors = df.shape[1] ...
7e45265d3d2965a6627b34920c2ffcf2d91e981c96ec4462e948ca7fc8f88b3f
Python
10,547
283
"""Patch SSL with HiDisc pretraining script. Copyright (c) 2024 University of Michigan. All rights reserved. Licensed under the MIT License. See LICENSE for license information. """ import yaml import logging from functools import partial from typing import Dict, Any import torch import pytorch_lightning as pl impo...
dc0824e717730d48432bf8a0c0d2801dbef097636ab541237f1ceb53b94893db
Python
10,547
276
# coding: utf-8 import torch import numpy as np def point_form(boxes): """ Convert prior_boxes to (xmin, ymin, xmax, ymax) representation for comparison to point form ground truth data. Args: boxes: (tensor) center-size default boxes from priorbox layers. Return: boxes: (tensor) Conve...
eaeb449f3455457b37095a7daacc804d0fbf7f521fa2041e7e7230d09a2e1eae
Python
10,549
339
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
da660b717ab2596179f71fdbbe9496167735f204d13579522988a1a4ce7de9d0
Python
10,554
285
# encoding: utf-8 import _init_paths import fire import time import pandas as pd import os import numpy as np import torch import torch.nn as nn import torch.backends.cudnn as cudnn import torchvision import torch.nn.functional as F from tqdm import tqdm from collections import OrderedDict from torch.utils.data impo...
969c26a41db37c30e930ec9755c3964c537ad11b22d595ccc54067e5069eb236
Python
10,556
262
""" Generates a ListTomoParticle object from a input STAR file (light particles version) Input: - STAR file for pairing STAR files with particles and particles shapes Output: - A ListTomoPaticles pickled object for every STAR file row """ ################# Package import import os import vtk import n...
27c5624ae7f9e6a515dac0c7ff4db91acd4082234c7ea904c132edcbfd4720c4
Python
10,561
325
# Node-group asset "Simulate on Faces" (GeometryNodeTree), dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump. from typing import TYPE_CHEC...
2fe9771d5171614ca7069a8f07b6b5c94a8f0d7f70f1b4d71a86fa0aafb9fc71
Python
10,562
349
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
a13f10d8dbb46cfb9b05a93be7f9a78f9ef935efb5cfc00aec642124fed5869b
Python
10,563
251
# Node group "Score View Directions" (GeometryNodeTree), dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # Shared by several assets, which import it; not an asset itself. # _build_group() is the source of truth: the docstring, __init__ and accessors are re...
d42f699374a42970808d404150ded59b7f3e025bf2d67a51013d09faaafc3f72
Python
10,565
265
""" Joint image+points transforms for the point-reorient tool. The functions in this module always transform an image array AND a matching (N, ndim) point array by the same operation, so the spatial relationship between them is preserved. Convention ---------- - Image axis ``a`` (i.e. ``image.shape[a]``) cor...
1f820791864e3522e34c267af02e039d31b1f8d60ed22645d22518dceefde80f
Python
10,566
287
"""Testing CLI command check.""" import os import subprocess def test_no_file(): """Tests for missing file.""" os.chdir(os.path.dirname(__file__) + '/data') proc = subprocess.Popen(['swc', 'check', 'fail_no_file.swc'], stdout=subprocess.PIPE, stderr...
31a8eba6d491c99d4ac34bfa4b216824e64a31debb26f4805192abd39acb4cf3
Python
10,566
288
# -*- coding: utf-8 -*- """ Created on Tue Mar 29, 2016 Module: poibin - Poisson Binomial Distribution Author: Mika Straka Description: Implementation of the Poisson Binomial distribution for the sum of independent and not identically distributed random variables as described in the reference [Ho...
3b9861d334f65165eb324ecf8cbd170466bdb4ae131f441d80311e927902416e
Python
10,566
290
import pytest from torch import nn from elasticai.creator.file_generation.in_memory_path import InMemoryFile, InMemoryPath from elasticai.creator.nn.integer.sequential.sequential import Sequential @pytest.fixture def sequential_instance(linear_layer_0, relu_layer_0, linear_layer_1): layers = nn.ModuleList() ...
a23367654ff7c0db92de52bb2fbc2bda17020c8a5b8e2e595192732cd3adbad7
Python
10,572
237
from collections.abc import Sequence import torch from torch import nn from torch import autograd from torch_scatter import scatter_add from torchdrug import core, layers, utils from torchdrug.layers import functional from torchdrug.core import Registry as R from . import layer, geometry @R.register("models.BindM...
c0631ee3427c2821a04283342f28d112b986224bf66ec600ef54425d3843d311
Python
10,574
308
from typing import TYPE_CHECKING, Optional from .align import AlignMethod from .box import ROUNDED, Box from .cells import cell_len from .jupyter import JupyterMixin from .measure import Measurement, measure_renderables from .padding import Padding, PaddingDimensions from .segment import Segment from .style import Sty...
e6f39aa56002368d23f2202284e2e9d96cbbd9f33e17689e24f2b420b7ffbafa
Python
10,574
300
#!/usr/bin/env python3 """ Script to process aromatic 13C-1H correlation maps. Spectra should be recorded with the dedicated pulse programme Written by D Flemming Hansen April 2024, flemming.hansen@crick.ac.uk / d.hansen@ucl.ac.uk Citation: VK Shukla, G Karunanithy, P Vallurupalli, DF Hansen bi...
92fe193510822aba863876db196943c6c606fbee1fe24c854e779a699edcee11
Python
10,576
266
import torch.nn as nn import math import torch import torch.nn.functional as F from einops import rearrange from einops.layers.torch import Rearrange class PatchEmbedding(nn.Module): def __init__(self, num_electrodes: int, hid_channels: int = 40, dropout: float ...
337adaf38e8db40af77a683390016a44fe70c35d6fdf45490feec078ed7780f6
Python
10,578
294
""" Utilities for computing per-image evaluations on a FiftyOne dataset using the Tensorflow Object Detection API. **Note** importing this module requires an environment variable `TF_MODELS_RESEARCH` that specifies the path to the tensorflow [models/research directory](https://github.com/tensorflow/models/tree/master/...
b3179b4602709b1034eb0aad9e8b3d3874e9a3a216772e4195cd7601684f9b0f
Python
10,581
288
"""Testing CLI command check.""" import subprocess import os def test_no_file(): """Tests for missing file.""" os.chdir(os.path.dirname(__file__) + '/data') proc = subprocess.Popen(['swc', 'check', 'fail_no_file.swc'], stdout=subprocess.PIPE, stderr...
428c05a60ee2b5c152d07ec1107e5621a45a70ae66476763034174eb0ad3b1fb
Python
10,590
250
import torch import random import sys import time import os import argparse import numpy as np class Tee: def __init__(args, fname, mode="a"): args.stdout = sys.stdout args.file = open(fname, mode) def write(args, message): args.stdout.write(message) args.file.writ...
20489e07a1cc5b4f37795d828d3afd4a15857b79a3306880d8b0c9a20621dae9
Python
10,592
202
from pddlstream.algorithms.algorithm import parse_problem from pddlstream.algorithms.common import add_facts, add_certified, SolutionStore, UNKNOWN_EVALUATION from pddlstream.algorithms.constraints import PlanConstraints from pddlstream.algorithms.downward import get_problem, task_from_domain_problem from pddlstream.al...
941d80fe8a7dc47ed1c24a724abe53da2312aca45cffa0cb1d4e7fc7ba10932a
Python
10,592
265
"""Validation of the HED tags as strings.""" from hed.errors.error_reporter import ErrorHandler from hed.errors.error_types import ValidationErrors from hed.schema.hed_schema_constants import HedKey from hed.validator.reserved_checker import ReservedChecker from hed.validator.util.dup_util import DuplicateChecker cl...
fde4b08ff2a4942832e08b787ee5198ce23acbc99a827a972d8d2066215a361b
Python
10,592
265
import torch import torch.nn.functional as F import numpy as np import ABIDEParser as Reader import argparse import random from torch_geometric.data import Data from sklearn.model_selection import StratifiedKFold from scipy.spatial import distance from model_RGAT import RGAT from sklearn.metrics import roc_au...
2d5f8562fc1431fef0ab2f27085cb811e53671975c688979a4fed00f0ac475a3
Python
10,594
462
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Create db from gdf files to be able to then select neuron spike times. Best use case: 1. run simulation 2. create sqlite db of spike times with indexing 3. use this db many times Creating index for db will dominate insertions for larger set of spike times. [TODO] Che...