sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
d0771643ed874a78083212fef1fbd54011301e44fe79775e9a687cf17b89e791
Python
17,548
518
"""Schemas for storing ASE-based data.""" from __future__ import annotations from typing import TYPE_CHECKING import numpy as np from ase.io import read from ase.vibrations.data import VibrationsData from emmet.core.symmetry import PointGroupData from pymatgen.io.ase import AseAtomsAdaptor from quacc import QuaccDe...
6301ff433255d8638a931e9fd2c26bc1c6437d427ff2295fa08342abaa263b51
Python
17,567
360
import copy import unittest import pandas as pd from hed import HedFileError, load_schema_version from hed.schema import HedKey from hed.schema.schema_io import df_constants as constants, df_util, hed_id_util from hed.schema.schema_io.df_util import get_library_name_and_id from hed.schema.schema_io.hed_id_util import...
82f9b121dd432b025565b4ff8d17154a8b923a1338e8ab91690b0b54cf3d9407
Python
17,567
489
"""Custom Espresso calculator and template.""" from __future__ import annotations import os import re from logging import getLogger from pathlib import Path from typing import TYPE_CHECKING, cast import numpy as np from ase.atoms import Atoms from ase.calculators.espresso import EspressoProfile from ase.calculators....
5f9e21e657c209f2b5aafb72e533e8064aaa97b1f9ae5565bfc2c07e5766ca25
Python
17,572
396
import os from typing import Any, Callable, Dict, Tuple, Union import joblib from torcheeg.io import EEGSignalIO, MetaInfoIO from ...constants.emotion_recognition.bci2022 import ( BCI2022_ADJACENCY_MATRIX, BCI2022_CHANNEL_LOCATION_DICT) from ..base_dataset import BaseDataset FIRST_BATCH_CHANNEL = [ 'FP1', '...
6bec0acdf1164f6940f532a6f59a647d65b7a1a5b570404c3982a095386f76d0
Python
17,573
424
# -*- coding: utf-8 -*- # # Test Welch's method from user/frontend perspective. import pytest import syncopy as spy import numpy as np import inspect import dask.distributed as dd import matplotlib as mpl import matplotlib.pyplot as plt from syncopy.shared.errors import SPYValueError from syncopy.shared.const_def imp...
058b390003abc1ad0f8b4994e67ffcd78e3ef91c680cbfdd9be7dffdbc7cb76a
Python
17,575
442
from collections import OrderedDict from typing import Tuple import torch import torch.nn as nn import torch.nn.functional as F class SSTEmotionNet(nn.Module): r''' Spatial-Spectral-Temporal based Attention 3D Dense Network (SST-EmotionNet) for EEG emotion recognition. For more details, please refer to the f...
0f009c995dca7506c018a2fc9458a065ea72ddc8d323ee4b644aa349c02fd42c
Python
17,583
383
"""Classes responsible for basic character validation of a string or tag.""" import datetime from semantic_version import Version from hed.errors.error_reporter import ErrorHandler from hed.errors.error_types import ValidationErrors from hed.schema.schema_io.schema_util import schema_version_greater_equal from hed.v...
1af1de1b864e64c867cb4aa1d1728c8f595ded526b3367a202290beca23f6874
Python
17,587
468
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Apr 17 18:21:00 2022 @author: haotian teng """ import os import copy import toml import torch import itertools import torchvision import numpy as np import torch.utils.data as data from xron.utils.seq_op import findall from typing import List,Dict,Calla...
9df54dd7d34057e0e4023dc6b907ae718886137de603b250de20b5bd0296978e
Python
17,588
451
from datetime import datetime import time import subprocess import os import json import sys ZONE = None ## Azure configuration flags. # Approximate conversion between similar VMs on Amazon and Azure. AMAZON_TO_AZURE_SIZING = { "n1-standard-64" : "Standard_E64_v3", "n1-highmem-64" : "Standard_E64_v4", "n1...
6d1adc6e00dbbf4180b85351931ddf685fbe7b2cab689a94cc359d34554a4e9d
Python
17,592
481
#!/usr/bin/env python import gzip import os from collections import Counter from itertools import combinations import networkx as nx import numpy as np from scipy.sparse import lil_matrix from irescue.em import run_em from irescue.misc import get_ranges, getlen, run_shell_cmd, writerr from irescue.network import bui...
92826556cbe5a4ae9d7172173bdd82d66426cd4d78521232b689f7189e16088f
Python
17,595
272
import itertools import math import os import pickle import random from argparse import Namespace from functools import partial import copy import numpy as np import pandas as pd import torch import yaml from torch_geometric.data import Dataset, Data from torch_geometric.loader import DataLoader from tqdm import tqdm ...
33ce9e301651f8392a046866082b11a79a26cf8a7646911eb53ea5090824d04e
Python
17,604
505
# 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...
3dd86a8a8bbb4c4c076d82e108ed45d09467c7d920c6b031f7812b4a0cc83af7
Python
17,604
505
# 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...
7ae54f5f14a7ee758ed0ecc55eb812210ea3a54b7734f53e84efd8ada61094e5
Python
17,607
505
# 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...
448e69a815ca7ce5d5cd9f32944cd4c6d476e7d3aadfae7972f1c041d0c6ea11
Python
17,618
558
"""Meta FAIR recipes""" from __future__ import annotations from importlib.util import find_spec from math import ceil from typing import TYPE_CHECKING, cast from monty.dev import requires from quacc import job from quacc.calculators.vasp.params import MPtoASEConverter from quacc.recipes.vasp._base import run_and_su...
d8c95b41919134f785327173fcb46aff52a1d10d3a9493b904a9ec5c3db8b388
Python
17,618
384
# -*- coding: utf-8 -*- """ Created on Thu Oct 28 21:00:17 2021 @author: CY """ import torch import torch.nn as nn import torch.nn.functional as F from torch.distributed import get_world_size import numpy as np class BaseModel(nn.Module): """ Base model with: a encoder """ def ...
a7d9cf42c3462453834597a8d7a5c950530339a1e5a8076c025cbc4f14139e0f
Python
17,633
552
# -*- coding: utf-8 -*- # # Load data from Field Trip .mat files # # Builtin/3rd party package imports import re import h5py import numpy as np from scipy import io as sio from tqdm import tqdm # Local imports from syncopy.shared.errors import SPYValueError, SPYInfo, SPYWarning from syncopy.shared.parsers import io_p...
24708a94a93037e0d8f92ee9a710807a44194be8524a0368d9138d5d865cfa18
Python
17,637
419
#!/bin/env python3 """ Phase Defect Lines (PDLs) ------------------------- For a periodic process in a medium, for which a phase can be defined, we call (large) discrete jumps from one value to another value *phase defect*. A *phase defect line* (PDL) is a line at such an interface in 2D. In 3D, we would observe *phas...
33a38b343d96f55b17cb11d77319cee593488d0d964bda6ffeba5caf68f2fe50
Python
17,641
384
import argparse import collections import gzip import math import os import random import shutil import subprocess import sys import time import numpy as np import pandas as pd import utils import tabix as tb import tensorflow as tf import pybedtools as pybt import pyximport; pyximport.install() import cython_fxn f...
053d2423daa527ff125ad86e3a1a645bee39a86ed6b2556fc717f4343e622534
Python
17,667
416
""" Utilities for processing MCF graphs # Author: Antonio Martinez-Sanchez (Max Planck Institute for Biochemistry) # Date: 27.11.14 """ __author__ = 'martinez' import operator import copy as pcopy # import pyseg.graph as gp # import pyseg.vtk_ext from . import visitor from pyseg.globals import * # import pyseg.dispe...
32fb2d3212b000ed1762b198e59c2355e2f8679db0e7c7c4d6ed78851e63e69d
Python
17,680
475
# A nodal network module import numpy as np import scipy as sp import scipy.special as special DEFAULT_LD = 0.05 EPSILON_FP = 1e-300 #----------------------------------------------------------------------------------------------------------------------- def ksd(X, *args, **kwds): # Kolmogorov-Smirnov distances (sor...
334c5d662ddca161c821cbc7fdf6ed086ca4c8160aadc7f62ffa41b975947347
Python
17,682
325
import numpy as np import pandas as pd import re import os from sklearn.preprocessing import StandardScaler, MinMaxScaler import networkx as nx from sklearn.model_selection import train_test_split from joblib import Parallel, delayed def standardize_gene_id(gene_id): # 正则表达式去除版本号和其他后缀 match = re.match(r"(ENSG...
4d9288553604c1c54f1104bf253bc0447e6f16a2b415285236556985925d2617
Python
17,683
491
import site from typing import Callable, List, Dict, Optional, Literal, Tuple import torch from torch import nn from hotpp.layer.radial import ChebyshevPoly from .base import AtomicModule from ..layer import EmbeddingLayer, RadialLayer, ReadoutLayer from ..layer.utils import ElementLinear from ..layer.equivalent impor...
c258df9b215f5d4f93102e344692904ced23d3b56971c0542231ba3b512cd858
Python
17,691
362
import os from typing import Callable, Dict, Tuple, Union import numpy as np import scipy.io as scio from ....utils import get_random_dir_path from ..base_dataset import BaseDataset class DREAMERDataset(BaseDataset): r''' A multi-modal database consisting of electroencephalogram and electrocardiogram signal...
28f860b5a37757792be3ce2a043f9a88ea582fb6841dde7fe28cbc3322d881d3
Python
17,693
456
import sys import igraph as _ig from . import _c_louvain from ._c_louvain import ALL_COMMS from ._c_louvain import ALL_NEIGH_COMMS from ._c_louvain import RAND_COMM from ._c_louvain import RAND_NEIGH_COMM from collections import Counter # Check if working with Python 3 PY3 = (sys.version > '3') def _get_py_capsule(g...
0582d1c6bbd6ac487b80ca7509d72731c34ce94f7f509b9b719fbb9bc08e3905
Python
17,695
477
from __future__ import division, print_function import operator import numpy as np from scipy.stats import gamma from scipy.ndimage import convolve1d import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap from matplotlib.patches import Rectangle def compute_joint_isi(spike_train1, spike_train...
8768d94bdc95749790d1b8cd94c77d6c90101cf113cc6c98a852b52258c9cb89
Python
17,698
457
# Copyright (C) 2019 Computational Science Lab, UPF <http://www.compscience.org/> # Copying and distribution is allowed under AGPLv3 license # # This script implements a Wasserstein GAN (WGAN) with weight clipping (WGAN-CP) # for generating 3D voxel data using a Generator and Discriminator model. # It includes functi...
44d6e559c37ca1e53393abd0033181840ddbe1d6038fff7632395a4a941c734f
Python
17,713
422
"""Lightweight HED search operating directly on raw HED strings. Provides a string-based search system that sits between the fast but limited :mod:`basic_search` (flat regex on pandas Series) and the full :class:`~hed.models.QueryHandler` (requires :class:`~hed.models.HedString` objects with a loaded schema). Key cla...
3b98738df4073a1dc4a7adfda6c16af8e061417b0f1a0b04cd1660b8288794d4
Python
17,714
523
# 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...
b56b9460026a03c8c99717c3db035fe6b0fd751e548a28b6326dd09ee3aa169b
Python
17,717
368
""" Created on Tue Apr 19 16:19:13 2022 @author: Haotian Teng """ import os import sys import time import toml import torch import argparse import numpy as np from tqdm import tqdm from typing import List, Dict from functools import partial from xron.utils.seq_op import length_mask from xron.nrhmm.hmm import RHMM,Gaus...
6d7552b4417da00dd4e9f9a1779057f52b4a0ec78cca76a83b90e6c4fe0e1669
Python
17,721
515
# 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...
6e84b498d0be0f370861428d46ae880ad8e5b603d5b7008e284d85515e765a5a
Python
17,722
434
from __future__ import division from __future__ import print_function import datetime import json import logging import os import pickle import time import numpy as np import optimizers import torch import torch as th from config import parser from models.base_models import LPModel from utils.data_utils import load_d...
499b3567355f51e3ee77c316fcaa4b74c12170b575251a64bcb10029c717cfa0
Python
17,726
482
import logging from pathlib import Path import torch import torch.nn as nn from elasticai.creator.nn.integer.addition import Addition from elasticai.creator.nn.integer.concatenate import Concatenate from elasticai.creator.nn.integer.design_creator_module import DesignCreatorModule from elasticai.creator.nn.integer.gr...
a184699e8192a8d0af3d039c57ee1f2c0ef9beede43bc8dc67e4ddc13f1c2941
Python
17,729
270
"""IDENTITY.py 2026-10-08. Pre-registration: 04-NOTES/PREREG-2026-10-08c-IDENTITY.md Is v2LN30 what I say it is? Checks against published real data, not against the model: D2 Liu & Wilson 2013 (Fig. 2): 29 dye-filled OK371 glutamatergic local neurons — 11 many-glomerulus, 8 one ventral glomerulus, 10 posterior t...
7349ef6f6847d753e71dffe89e564d128fda38e6efa2ecf8ed82b09d0489e33f
Python
17,731
492
import numpy as np import seaborn as sns import matplotlib.pyplot as plt from matplotlib import cm import os import colorcet as cc import math import random import networkx as nx def describe_dataset(data): # Number of classes print(f'The dataset contains {len(data.label_key)} classes. Here are the classes an...
e73ec915db94063dfb2352f04d7740e193ad342f2e7f86c37c53844e362c97a2
Python
17,735
496
from pkg_resources import resource_filename import pandas as pd import numpy as np from pyfaidx import Fasta import torch from torch.nn import functional as F import gffutils import argparse import logging import vcf as pyvcf from model.model import SpTransformer from pyensembl import Genome from model.SpliceAI import ...
0e78942f2bd0d5b6cbb96c337eef8afa380c0f728cfec8d7db695cdd7e322b15
Python
17,743
405
from __future__ import annotations from typing import TYPE_CHECKING, Literal import numpy as np import pandas as pd import scanpy as sc from anndata import AnnData from fast_array_utils.conv import to_dense from sklearn.cluster import HDBSCAN, KMeans from pertpy._logger import logger from pertpy._types import cast_f...
aebc47e0bc94a90b5462d43fb542b592b5f817ae7190ae69d4baac857613d786
Python
17,750
485
# -*- coding: utf-8 -*- # # computeFunctions and -Routines to post-process # the parallel single trial computations to be found in ST_compRoutines.py # The standard use case involves computations on the # trial average, meaning that the SyNCoPy input to these routines # consists of only '1 trial' and parallelising over...
3a0134a65d5e59c5d8e7187266a14ebc7c1fb6e3dc633d06485263977e30fe08
Python
17,753
367
import time import os import subprocess import sys import re import argparse import collections import gzip import math import shutil import matplotlib.pyplot as plt import wandb import numpy as np import time import pandas as pd from datetime import datetime import random #import logging #from silence_tensorflow impo...
40654bfeaf66c13e4bdb12782539575590a499bd4f88147f7f2ef0d064b67e1c
Python
17,757
375
""" Script for extracting particles from a filament network of a oriented single membrane graph Input: - A STAR file with a list of graphs (MbGraphMCF) as it is returned by by mb_fils_network.py script: + Density map tomogram + Segmentation tomogram + M...
93ef2996ede783c6b1530c82fb671dc011ceafe8f023464c872c12003488ac32
Python
17,769
391
import os import csv import glob import pickle from tqdm import tqdm import numpy as np import pandas as pd from copy import deepcopy from Bio.PDB import PDBParser import torch from torch.nn import functional as F from torch.utils import data as torch_data from torchdrug import core, data, datasets, utils from tor...
7cfa1b0b5fa8b4c6731b43a6d2cb8a96d0037e16d980e7b02c6b5265dd81422e
Python
17,777
411
from __future__ import annotations from typing import Any import flax.linen as nn import jax import jax.numpy as jnp import numpy as np import optax import pandas as pd from anndata import AnnData from fast_array_utils.conv import to_dense from flax.training import train_state from jax import random from sklearn.mode...
afd2bad77f602dd7b4cc78d11df4b306f1cecc2890c9191427648df14995ebdc
Python
17,777
444
''' Description: Use scNODE predictions to help recover smooth and continuous cell trajectories. Author: Jiaqi Zhang <jiaqi_zhang2@brown.edu> ''' import scanpy import torch import numpy as np from benchmark.BenchmarkUtils import loadSCData, tunedOurPars from plotting.__init__ import * from plotting.PlottingUt...
f3cd09c96671ab8941de8cb1196d63d5ff2095fd6aa678bfa9187372a64f925b
Python
17,780
445
""" Code to process output of DeepLabCut Attention: now possible to select whisker data based on time of CNO dropping; can select either before or after drop time""" # Import modules & packages from pathlib import Path import numpy as np import pandas as pd # for phase extraction from scipy.signal import buttord, bu...
6d7c9d7e5e0f75ebebc1944b5a09ed1cc80227e6e3aac7fac7244ee3b69e9614
Python
17,786
485
import os, sys, yaml, importlib, datetime, argparse from utils.train_utils import * for _path in path_to_pad: sys.path.append(_path) import numpy as np import pandas as pd from utils.utils import * import tensorflow as tf from sklearn.model_selection import train_test_split os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2...
22bc93b023f9de6a25451830857c0109805ba69a33742e045be32184325df03e
Python
17,790
560
# 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...
eaab9a9ed63edecc9c096cfe3b0ca6c9507ab163a5d369a9415b93b7d7344770
Python
17,792
455
#!/bin/env python3 """ Visualisation with ParaView using XDMF ====================================== Functions for creating files in the eXtensible Data Model and Format (XDMF). For information about this format, visit: https://www.xdmf.org/index.php/XDMF_Model_and_Format XDMF files generated with this submodule sho...
15da276de79bbd83829702db6f364aeedd94c87a67b8cc37bc1251329b6d6dd6
Python
17,806
426
import argparse import os import time from collections import defaultdict from collections import namedtuple import numpy as np from learn_tools.active_gp import ActiveGP, POUR_MLP_HYPERPARAM_3000, SCOOP_MLP_HYPERPARAM_3000 from learn_tools.collect_simulation import start_task, complete_task, sample_task, get_paramet...
88e0d3bcc5cfb13cdae3c3a65260c6a42c580336f341f9217af687f1c7806d27
Python
17,807
427
"""Warp + writer tests - kept apart from the pure-function tests because these touch ANTs and the filesystem.""" import os import numpy as np import pytest nib = pytest.importorskip("nibabel") def _mod(): from regtools.registration import segmentation_quantification as sq return sq def ...
6469d93fbdf83918e2ba91cb5a6e9d079669cf4bbd3242a016bebf2e011ee43f
Python
17,815
526
"""Generate E3FP fingerprints. Author: Seth Axen E-mail: seth.axen@gmail.com """ from __future__ import division, print_function import os import logging import argparse import sys from python_utilities.scripting import setup_logging from python_utilities.parallel import ( make_data_iterator, Parallelizer, ...
46708fea8fc0acbd505c6f31891735e16368812d72015627296ac81380bb425a
Python
17,832
460
# -*- coding: utf-8 -*- """ Created on Mon Jun 15 11:28:26 2020 @author: David Quiroga-Martinez """ #################### Load libraries and set directories ####################### from random import shuffle from psychopy import prefs prefs.hardware['audioLib'] = ['sounddevice'] from psychopy import visual, core, sound...
407c61704e8a242c03072a6950e61fcf5310e961b566ce9168a1a3a5e9088c57
Python
17,839
397
# OWNER : SUBINOY ADHIKARI # EMAIL : subinoyadhikari@tifrh.res.in import sys import os import pickle import numpy as np import tensorflow as tf tf.compat.v1.disable_eager_execution() from tensorflow.keras import Model from tensorflow.keras import backend as K from tensorflow.keras.optimizers import Adam fro...
650ce29bc57c28032aa0f79d60f25d537af9866f5ba8b38cddbf2425887d638b
Python
17,841
469
"""Pure data model for manual contour correspondence editing. ``ContourCorrespondenceStore`` holds all mutable state for a contour registration session - control points, curve->target links, sampled correspondence points, the undo stack, and dirty/save tracking - with no matplotlib, Qt, or Tk dependencies. The...
4aa853199220948fa44bfa02cdc0eb3641c0761793ff67a6b950e4a1dd31487d
Python
17,847
329
import tensorflow as tf from tensorflow.keras.layers import Input, Dense, GlobalAveragePooling2D, Flatten, GlobalMaxPooling2D, AveragePooling2D from tensorflow.keras.layers import * from tensorflow.keras import Model from tensorflow.keras import regularizers import logging import sys from tensorflow.keras.regularizers ...
3dc8dc66ccee9e5070d05448088afadcb00073c954428aa26bd1912de3f3a9cd
Python
17,861
435
"""distutils.cmd Provides the Command class, the base class for the command classes in the distutils.command package. """ import sys import os import re import logging from .errors import DistutilsOptionError from . import util, dir_util, file_util, archive_util, dep_util from ._log import log class Command: "...
e561cc12275bd674704c3d9389fab2436c4dc65428121ebad92c638d2bf4676b
Python
17,861
402
"""A group of BIDS files with specified suffix name.""" import csv import json import logging import os import re import pandas as pd from hed.errors.error_reporter import ErrorHandler, check_for_any_errors from hed.errors.exceptions import HedFileError from hed.models.model_constants import NAME_WHITESPACE from hed...
607510d6e9d27b68ceeba5195d2aaf88ceb31b0df33a5c2a796aa553acbced76
Python
17,862
456
# ---------------------------------------------------------------------- # Copyright (C) 2014-2015, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This program is free software: you can redistribute it and/...
64efe8e10e152dd3c7da27bd93b2c4c2daa0ab3e912530aa8ff9055cf392afbc
Python
17,863
460
# 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...
7ed2f11cb9e2f68227e208d508be640bb84f1ffe6cf48a236e98239b8b8ade44
Python
17,866
473
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
e4f08ee069c3127504362163e2f0ffd509803231cdb6f37a1d76c44d9f541a89
Python
17,872
552
""" Requirements file parsing """ import logging import optparse import os import re import shlex import urllib.parse from optparse import Values from typing import ( TYPE_CHECKING, Any, Callable, Dict, Generator, Iterable, List, Optional, Tuple, ) from pip._internal.cli import cmd...
8e0d2fccf685fcb357268c42ee49b56a091d5eb94b03fa5f89032fc2b9119f02
Python
17,875
573
""" Loss functions scvi-tools distributions: https://github.com/scverse/scvi-tools log likelihood loss: https://github.com/YosefLab/scVI/blob/6c9f43e3332e728831b174c1c1f0c9127b77cba0/scvi/models/log_likelihood.py#L206 """ import os import sys import functools from typing import * import torch import torch.nn as nn ...
b9d25799e56358db2558d5b1ff8eb9fb002c3133ef703d8b6ee34d6c9764dbf0
Python
17,875
589
from scipy.signal import savgol_filter from scipy import sparse from scipy.linalg import norm import pandas as pd import numpy as np from scipy.stats import binned_statistic from maldi_nn.utils import topf import matplotlib.pyplot as plt import h5torch import torch class SpectrumObject: """Base Spectrum Object cl...
2982d55b839573636df40cc9c7b6e9db1c7924e44f6011b9ca350b5396fc97fb
Python
17,885
450
from dolfin import * import numpy as np import matplotlib.pyplot as plt import sys import time import os import argparse parser = argparse.ArgumentParser() parser.add_argument("--order", type=int, default=1) parser.add_argument("--variation", type=str, default="base") parser.add_argument("-res", "--resolution", type...
172ad7adf2452a740f7c39fbf0094fae5023c6e4805d87ed9cc9c870dec18aa6
Python
17,891
403
import numpy as np import nibabel as nib from pandas import DataFrame from joblib import Parallel, delayed from sklearn.preprocessing import minmax_scale from pyrelimri.icc import sumsq_icc from nilearn import image from nilearn.maskers import (NiftiMasker, NiftiMapsMasker, NiftiLabelsMasker) from nilearn.datasets impo...
9cfcd18d85d232135cab5a86bce3e4963263a9cd41b30e3bae6809d6c345f70c
Python
17,895
455
""" Generate a synthetic set of microsomes with different membrane bound proteins Input: - Data set parameters: + Number of tomograms (one microsome each) + Tomogram size + Resolution (pixel size) + SNR range + Missing wedge (sem...
a709a6ac7f8a6cfba5c2c0b09b79bee671e243ac21a6fe0530a523a314f0edc9
Python
17,897
455
"""Integrated calibration indices and calibration curves at a specified time.""" from __future__ import annotations import matplotlib.pyplot as plt import numpy as np from scipy.optimize import minimize from scipy.special import logsumexp from SurvivalEVAL.evaluations.calibration.single_time.util import ( _clogl...
38dc1b60a8509133c399f790404dad528f9c69a0c27d581eb603074c56892096
Python
17,898
468
# -*- coding: utf-8 -*- import numpy as np from scipy import stats, integrate import pandas as pd from itertools import product from data_loader.microcircuit import p as p_PD from data_loader.microcircuit import K_ext as K_ext_PD from data_loader.hcp_dti import HcpDesikanKilliany, VolumesDK from data_loader.synapse_cel...
9e3bf6d1b3d528abac2116ecf0c77560d5a5199415d665b97d63cd91d631f902
Python
17,899
470
"""distutils.fancy_getopt Wrapper around the standard getopt module that provides the following additional features: * short and long options are tied together * options have help strings, so fancy_getopt could potentially create a complete usage summary * options set attributes of a passed-in object """ im...
07a7cdd028e28042609377282f3c80ad0b3e913bb252255b4886835b16e46297
Python
17,906
393
""" Prosper_nn provides implementations for specialized time series forecasting neural networks and related utility functions. Copyright (C) 2022 Nico Beck, Julia Schemm, Henning Frechen, Jacob Fidorra, Denni Schmidt, Sai Kiran Srivatsav Gollapalli This file is part of Propser_nn. Propser_nn is free software: yo...
718756404ce1aa8e5d89e4e61ac02d560b7a01696ad9f8089222a7ab0ddc8f19
Python
17,914
624
# 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...
340723ee5a2e68ba1369b3df5679b9e2fb309d4913a3d75c611a2bd2e3916b6c
Python
17,915
411
import torch, numpy as np import os, sys, yaml from torchvision.datasets.utils import download_url MODEL_CODE_DIR = os.path.dirname(os.path.abspath(__file__)) _download_dir = MODEL_CODE_DIR sys.path.append(MODEL_CODE_DIR) # ImageNet Transforms -------------------------------------------------------------------------...
71aecd1fa64351abcd7a3e02ea1fbe43118dc55b801cbd24f990df594a53beae
Python
17,922
539
"""""" from itertools import combinations from queue import Queue, Full from threading import Lock import logging import cv2 import numpy as np from pupil_recording_interface.decorators import process from pupil_recording_interface.process import BaseProcess from pupil_recording_interface.externals.methods import gen...
7792b5994a83f91610e59777ac28943caf20e086730c3b89b99658c4fff8e994
Python
17,923
596
#!/usr/bin/env python # coding: utf-8 # # LIT-PCBA # this dataset is a proposed "more difficult" test than DUD-E. I used a 75/25 (sklearn default) stratified split. The dataset is heavily imbalanced, like DUD-E. # In[1]: import pickle from sklearn.metrics import roc_auc_score import numpy as np import seaborn as s...
6458e0cc1602a9e4cae10065827ad5ef2f42e8c3832e7e997a7d56cee1e72a1b
Python
17,925
453
# Copyright (c) MONAI Consortium # 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, so...
8eb7aa4ab117df0e9406a43a2318a22e5902ef6042dd6861d9c0b92af8f812c2
Python
17,943
408
# 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...
9cad7d1e50c981f6c051d0b7fff59bad02cdb3231f1d38655b307fc4f292c3e2
Python
17,961
499
#!/usr/bin/env python import sys import os from pyclamp.dsp.strfunc import isnumeric from pyclamp.dsp.lsfunc import * DEFLBWUSE = 'qt' def use(_LBWUSE = None): if _LBWUSE is None: _LBWUSE = DEFLBWUSE global LBWUSE try: lbwuse = LBWUSE # force error for when setting default LBWUSE = _LBWUSE.lower() ...
6ce7833ed76781e4f1d578176e0345531633007988248ec69bcc0cdd9237af8e
Python
17,964
538
""" All combinations except those that do not produce some sort of chimeric protein are commented out """ import itertools import os agfusion_db = os.path.join(os.path.split(__file__)[0], "data", "agfusion.db") AGFUSION_DB_URL = "https://s3.amazonaws.com/agfusion/agfusion." # this is mostly contigent on the maximum...
a6ef97b131750ff77c300b1ad044b968cf81cd9f7244ec89123b1cfc40d268b2
Python
17,965
521
import ctypes from ctypes import * from control.TUCam import * import numpy as np import threading import time from control._def import * def get_sn_by_model(model_name): TUCAMINIT = TUCAM_INIT(0, './control'.encode('utf-8')) TUCAM_Api_Init(pointer(TUCAMINIT)) for i in range(TUCAMINIT.uiCamCount): ...
e96f977893be0941ee29f6ee2822433f55c0848f18fc2659a6cc31c7011ed52d
Python
17,971
387
import os.path from collections import defaultdict import pandas as pd import re from ckg.graphdb_builder import mapping as mp, builder_utils ######################### # UniProt # ######################### def parser(databases_directory, import_directory, download=True, updated_on=None): config = bui...
d86a97f0fef7159898e02040212adbe6235960a95d5c7dece8adce10b0e44d05
Python
17,981
483
# coding=utf-8 # Copyright 2020 Microsoft and the HuggingFace Inc. team. # # 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...
07832377dd215bca9b8ce51caf01d1b41e55ca333f01a35c1b6a17f770ff3063
Python
17,983
503
import os import sys import string import re import json import collections voltage_scales={"V":0.001,"mV":1,"uV":10**3} current_scales={"uA":10**(-3),"nA":1,"pA":10**3} features_scales={"V":0.001,"mV":1,"uV":10**3, "uA":10**(-3),"nA":1,"pA":10**3} scales={"voltage" : voltage_scales, "current" : current_scales, "featu...
d7f12172545694cc97179ccfd956134c24dcfe274c29cadc7f35cd71b5e7fa8f
Python
17,990
569
import numpy as np import pandas as pd from pandas.api.extensions import ExtensionScalarOpsMixin from pandas.core.arrays import ExtensionArray from pandas.core.dtypes.base import ExtensionDtype class Trace: def __init__(self, val, meta=None, orig=None): # print(orig) if meta is None: m...
9cd65d1651af723cea11eb69848d86f1e173f57da892c0954d1e575c9784f75a
Python
17,993
538
# 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...
53b798f89bdfabbb5a1fb44d85515f547f6f2fb14400e007618d201aea2af564
Python
18,011
619
""" cli.py Command line interface """ import argparse import gzip import shutil import sys from os import mkdir, remove from os.path import exists, join, split from pathlib import Path from urllib.error import HTTPError from urllib.request import urlopen import pyensembl from agfusion import __version__, database, ...
24f3e2d2f07770c76967bc14635de0c6b9c67996402d2ae67f42b89a22a4f925
Python
18,015
341
# dataset/data_handling/protein_dataset.py # Import custom modules import os import functools import torch import collections import numpy as np import pandas as pd from pathlib import Path class ProteinDataset(object): def __init__(self, gnn_model_id, data_dir='./data'): # Assign inputs to class attribut...
cc1ecd8c9badb5911097750e54b597c0679d8639d844c062d8920f4ee603e71d
Python
18,018
490
# 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...
94e4560d6174797ee491ac702e3c8f608a6392e1db0d24a9cbac2166e7a0012d
Python
18,023
404
#!/usr/bin/env python # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. """ Object crash without prior vehicle action scenario: The scenario realizes the user controlled ego vehicle moving along the road and encountering a cyclist ahead. """ from __fu...
99bcae6c9d528a8967d0ade668ecf8ccfc7eb29050e9d082d1b4b60e302de774
Python
18,028
416
"""Rectangle-drag multi-label selection + deletion mixin for the CCF Boundary Editor. Drives the ``ToolMode.SELECT_DELETE`` mode. The user drags a rectangle on the canvas to add region IDs under it to a transient selection set; Ctrl-drag removes them. A "Delete N selected" button commits the set into the existin...
a7a973c03dddce22e1654633b41176bec93f7a4cf8d4afc63e881c3c5e1cdcbe
Python
18,029
410
""" Generates a ListTomoParticle object from a input STAR file (translocon project 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 impor...
5ca752f8ce7d04f8212636e0f442f0641b5777a80267c89ebeac65c6fee05e6d
Python
18,031
352
import glob import neurokit2 as nk import pandas as pd import numpy as np import scipy import matplotlib.pyplot as plt from scipy.interpolate import interp1d from scipy.stats import zscore def castToList(x): # Casts x to a list if isinstance(x, list): return x elif isinstance(x, str): retu...
69a4a49b7b9b3062daeaaf3871256453dd8fcef9e8529ba8ec7b8c2d7786e601
Python
18,031
448
"""Test the find_noisy_channels module.""" # Authors: The PyPREP developers # SPDX-License-Identifier: MIT import numpy as np import pytest from pyprep.find_noisy_channels import NoisyChannels from pyprep.ransac import find_bad_by_ransac from pyprep.removeTrend import removeTrend # Set a fixed random seed for repro...
c949c227abfa120f5f6db15c92e0b694aee75b57f6dd7f2337322f3a9513c25d
Python
18,032
517
"""Unit tests. """ import unittest from os.path import abspath, curdir, join import pyensembl from Bio import Seq, SeqIO from agfusion import database, model, parsers data = pyensembl.EnsemblRelease(84, "mouse") db = database.AGFusionDB(abspath(join(curdir, "agfusion.mus_musculus.84.db"))) db.build = "mus_musculus_8...
bb72227cbf101e79864aeb82dc79c7379df2f7846438bf476494580b54b75253
Python
18,035
483
#!/usr/bin/env python import os from collections import OrderedDict from timm.models.layers import DropPath import torch from torch import nn import torch.nn.functional as F import torch.utils.checkpoint as checkpoint from .attention import MultiheadAttention import logging logger = logging.getLogger(__...
e643c7ab1739efb1e59725c6c3c004e482cf3673f43f6bf73adfdd337b901372
Python
18,035
504
#!/usr/bin/env python """ This tool will extract the docstrings from the meep package and add them to the hand-written documentation tree. It is expected that the docstrings will be Markdown compatibile and will not need to be massaged in any way. One reason for this is to help ensure that the Look and Feel of the API...
a1a1144ef49a1786d49ded346b651b355f616a08b71614109f6adc3f66459db8
Python
18,040
424
"""Evaluation of event-time point predictions.""" from __future__ import annotations import numpy as np from lifelines.statistics import logrank_test from SurvivalEVAL.evaluations.custom_types import Numeric, NumericArrayLike from SurvivalEVAL.evaluations.discrimination import concordance from SurvivalEVAL.evaluatio...
c72e3f49a6e2f3c320eff0ee5cd5d50a95920b217e950e3eeee2769947501dfe
Python
18,040
449
from __future__ import annotations import logging from copy import copy from typing import TYPE_CHECKING, Any from wikibaseintegrator import wbi_fastrun from wikibaseintegrator.datatypes import BaseDataType from wikibaseintegrator.models.aliases import Aliases from wikibaseintegrator.models.claims import Claim, Claim...
9dfd14badf0429704c73bbe13499301537d54cfcef819dcec11f122fb76055b7
Python
18,041
415
""" Batch 2D Registration Script ============================= Register multiple 2D slices from a directory to their corresponding CCF template slices, driven by a CSV mapping file. CSV format (no header row required, but one is allowed): slice_index, ccf_index 0, 264 5, 270 12, 300 - slic...
00fc7173fbfd4a5bc51b6f5da5f1dea28518e3a9f94f800e83c62654cf8e2b72
Python
18,046
427
import pytorch_lightning as pl from torch.utils import data import pandas as pd from utils.logger import get_logger from utils.util import check_cache_files import numpy as np from torch import from_numpy import dgl import torch import shutil from torch.utils.data import DataLoader, TensorDataset, RandomSampler, Weight...
69e404c4558456d8d418fbd2c65a6bbe54c3594083ae9234e100f63e47484149
Python
18,053
394
# Implementation: https://github.com/alexandrosstergiou/keras-DepthwiseConv3D import keras.ops as kops from keras import backend as K from keras import initializers from keras import regularizers from keras import constraints from keras import layers from keras import InputSpec from keras.src.legacy.backend import _pr...
5d16ad436d3742aaf0091a10ea18a3ff2780acd34ed486878be5ba4105859d65
Python
18,055
463
import os import os.path as op import numpy as np import pandas as pd from tqdm import tqdm import mne import nibabel as nib import matplotlib.pyplot as plt import matplotlib.patches as mpatches from matplotlib.colors import Normalize from scipy import stats from params import PLOT_DIR as plot_dir from params import...