sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
a6bf2af4c9480b51db650f10db0b71e4f3114d1f867d577fe315fdd68b2870f9 | Python | 11,468 | 188 | # 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... |
d734cbb1d2afbb737470f02f2c160d773993570ddc99a2cf7550dacbf823eea8 | Python | 11,468 | 273 | from typing import Tuple
import torch
from einops import rearrange, repeat
from einops.layers.torch import Rearrange
from torch import nn
def _pair(t):
return t if isinstance(t, tuple) else (t, t)
class PreNorm(nn.Module):
def __init__(self, in_channels: int, fn: nn.Module):
super(PreNorm, self).__... |
4f393d4a206ade1e164591f902fead7d00279a99ffaa66d517d11efdf88e7a4e | Python | 11,469 | 317 | """
Collection of functions for helping to segment microtubes in tomograms
# Author: Antonio Martinez-Sanchez (Max Planck Institute for Biochemistry)
# Date: 1.07.17
"""
import csv
import vtk
from .utils import *
from sklearn.cluster import MeanShift
__author__ = 'Antonio Martinez-Sanchez'
# Clean an directory con... |
241e681e1cbf73ba91860a9cbe7505c71165cb687f54bea2c9e2058fc03ca325 | Python | 11,471 | 292 | """Implement domain transformation.
In particular, this provides a base transformer class and a sequential domain
reduction transformer as based on Stander and Craig's "On the robustness of a
simple domain reduction scheme for simulation-based optimization"
"""
from __future__ import annotations
from abc import ABC,... |
9825aaf38c8da74ac4d04a57e95f9a3782d98dad6db063e30f87546e6e8f839a | Python | 11,471 | 319 | from abc import abstractmethod
import warnings
import os
from typing import Literal
from pathlib import Path
import pandas as pd
import pytorch_lightning as pl
from pytorch_lightning import loggers as pl_loggers
from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint
from pytorch_lightning.profilers imp... |
3a4b6d20e098c05eda3b280e4593fe3d3e37399052ba469d5c312037df3bcb13 | Python | 11,474 | 258 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Created on Fri Apr 8 11:29:57 2022
# @author: caroline
"""
Compute logistic regressions of the weights of priors and sensory likelihood for each subject
for both tasks at the same time having the tasks(=context) as a predictor
"""
import argparse
import numpy as np
f... |
a0ce1c2e94dc0b9ca289394f40c4cd486c5cbc2cbb8da2bc7842d1d77e5eae76 | Python | 11,476 | 251 | # -*- coding: utf-8 -*-
"""
Created on Fri May 3 13:09:28 2024
@author: yorub
"""
import numpy as np
import matplotlib.pyplot as plt
import os
from skimage.filters import threshold_minimum
from scipy.ndimage import binary_dilation
import pandas as pd
from skimage.segmentation import flood
import bigfi... |
64e706228287376c55fe95be801f2c3a27616b71b305c331e11d38af27cfbbf7 | Python | 11,477 | 262 | # -*- coding: utf-8 -*-
from typing import List, Tuple
import torch
import torch.nn as nn
from supar.config import Config
from supar.model import Model
from supar.utils.common import INF
class TetraTaggingConstituencyModel(Model):
r"""
The implementation of TetraTagging Constituency Parser :cite:`kitaev-kle... |
7401cf48326562f650a1869c1f4a5e4e2b2da43d818f1cf066b41a9556c0fe3c | Python | 11,480 | 378 | """
Cog SDK type definitions.
This module provides core types for defining predictor inputs and outputs:
- Path: File path type that supports URL inputs
- Secret: Secure string type that masks its value
- File: Deprecated file type (use Path instead)
- ConcatenateIterator: Streaming output iterator
- AsyncConcatenateI... |
24fdc9beee3e6c49aed1e8c023760dbc0d5ab430d8ba6ffc72d5352b820e54f6 | Python | 11,482 | 229 | import matplotlib.pyplot as plt
import networkx as nx
import pandas as pd
import os
import scipy.io as sciio
import numpy as np
from Functions.f_AnalysisFunctions import *
from Functions.f_AnalysisGraphs import *
from Functions.f_ComplexNetworks import *
import matplotlib.pylab as pl
import matplotlib
matplo... |
4493f173d6b98f8596dc034467f7988f4adbb86977e893d6a32a55e4b4b70fe2 | Python | 11,483 | 324 | """
DeepLabCut2.0 Toolbox (deeplabcut.org)
copyright A. & M. Mathis Labs
https://github.com/AlexEMG/DeepLabCut
Please see AUTHORS for contributors.
https://github.com/AlexEMG/DeepLabCut/blob/master/AUTHORS
Licensed under GNU Lesser General Public License v3.0
"""
import os
import numpy as np
import ruamel.yaml
import... |
4790ccb74305b8f9355d7d5538aaec547406dc8fb3c6b332a2e2f7b71e6c9481 | Python | 11,488 | 248 | """
Downstream task: BBBP: Binary labels of blood-brain barrier penetration(permeability)
Dataset source: DeepChem
"""
import os, sys, argparse, time
import json
from tqdm import tqdm
from rdkit import Chem
import deepchem as dc
import torch
import torch.nn as nn
import torch.nn.functional as F
import tor... |
fa6ad37932af752ee2bb3e7bfde5c87e87be6ab9b323acd1d83303594c415e7d | Python | 11,492 | 265 | """
Generates all the import files: Ontologies, Databases and Experiments.
The module is reponsible for generating all the csv files that will
be loaded into the Graph database and also updates a stats object
(hdf table) with the number of entities and relationships from each
dataset imported. A new... |
af8a8d1fbb54514a454a2abbe81716d4093a5ac0cdfbed8ce3832f8c6ce9c4fd | Python | 11,495 | 255 | """
DeepLabCut2.0 Toolbox (deeplabcut.org)
copyright A. & M. Mathis Labs
https://github.com/AlexEMG/DeepLabCut
Please see AUTHORS for contributors.
https://github.com/AlexEMG/DeepLabCut/blob/master/AUTHORS
Licensed under GNU Lesser General Public License v3.0
"""
import wx
import os
import sys
import pydoc
import de... |
cb5aac55d32ef4e819fa4f6bf7a9f0102d780373a53f44ae0ca03c0ea6ebe691 | Python | 11,500 | 330 | # -*- coding: utf-8 -*-
#
# Helper methods for testing routines
#
# Builtin/3rd party package imports
import subprocess
import sys
import os
import h5py
import tempfile
import time
import numpy as np
import dask.distributed as dd
# Local imports
from syncopy.datatype import AnalogData
from syncopy.shared.filetypes im... |
7ec5bda21e206d8eba774649481a6b7d0550fed85caf735ec6dbd3ef0dadef5d | Python | 11,504 | 365 | # 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... |
1418732a8b2121ac5e2452c984208d08d947c2a884bafb8c0e707be6cb9aa012 | Python | 11,506 | 258 | import copy
import os
import time
import numpy as np
import torch
from colorama import Fore, Style
from torch.autograd import Variable
from torch.utils.data import DataLoader
from tqdm import tqdm
from src.common import (get_camera_from_tensor, get_samples,
get_tensor_from_camera)
from src.uti... |
e43880a6078607e14e09be2626ab83591e44d244f538f75cc028d57816881c6f | Python | 11,511 | 308 | #RobustFillPrimitives
from dreamcoder.program import Primitive, prettyProgram
from dreamcoder.grammar import Grammar
from dreamcoder.type import tint, arrow, baseType #, t0, t1, t2
from string import printable
import re
from collections import defaultdict
#from functools import reduce
disallowed = [
("#", "has... |
50abf7a5c4a03a3c2e502a31866a7fa0d9a378e28599b0bc291244aa9c8ad765 | Python | 11,514 | 253 | from PIL import Image, ImageEnhance, ImageOps
import numpy as np
import random
class ImageNetPolicy(object):
"""Randomly choose one of the best 24 Sub-policies on ImageNet.
Example:
>>> policy = ImageNetPolicy()
>>> transformed = policy(image)
Example as a PyTorch Transform:
>>> transform=tr... |
84a3aade546a0c6c9b10c7959101d7d584f996b242580aa405b8ff18dc589438 | Python | 11,515 | 302 | # import libraries
import numpy as np
import pandas as pd
import time
import matplotlib.pyplot as plt
from sklearn.metrics import euclidean_distances
# ----------------------------------------------------------
# ----- SIMPLE HELPER FUNCTIONS (WITH COMPLEX NUMBERS) -----
# ---------------------------------------------... |
ab3b76d85373d2020ce999321024fcdca414652a1d6516effdc079cfcd3db2bd | Python | 11,515 | 249 | import argparse
from datetime import datetime
from pathlib import Path
from warnings import filterwarnings
import lightning.pytorch as pl
import pandas as pd
import torch
import yaml
from lightning.pytorch.loggers import CSVLogger
from tqdm import tqdm
from dataset import TCGA_Program_Dataset
from datasets_manager imp... |
d29cb698f4e9f67b2d99fa313eaffae33be0f7f8f0008f2acf98f02cefc24d1a | Python | 11,520 | 244 | """
Script to run mutation status classification experiments for a given (fixed) lasso
penalty, using L1 penalty only.
Output files are identified by {gene}_{cancer_type}, in this order.
"""
import sys
import argparse
import itertools as it
from pathlib import Path
import numpy as np
import pandas as pd
from tqdm imp... |
e43567a2d1bb256f2a6e4ea7d73c0f3a0f47aa14885ca420b2836b788b44166e | Python | 11,521 | 256 | import torch
from torch_geometric.loader import DataLoader
from imports.ABIDEDataset import ABIDEDataset,MergedDataset
from imports.utils import train_val_test_split,train_val_split,GHMC
import torch.optim as optim
from torch.optim import lr_scheduler
import torch.nn.functional as F
from GAT import GAT
from torch.utils... |
a61512fbd3a9a6b5427bd6605463d5f2b47d71c3411cc41553c4d38b5121212a | Python | 11,523 | 255 | # coding=utf-8
# Copyright 2021 The Facebook AI Research Team Authors 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/LIC... |
e93bf9e2946463161c1f8ff46f786c8ebe7e7ef162c7d500156952ebf86f3e1f | Python | 11,524 | 354 | """Module to read and return anatomical information, such as:
- surfaces, with class Surf
- brains, with class BrainSurf (both hemispheres)
"""
from collections import Counter
from logging import getLogger
from os import environ
from pathlib import Path
from re import compile
from struct import unpack
from num... |
ffa99517f09eaa46262ed3abec9ec064aedc62a615e751e3560f6ffb9ff0a986 | Python | 11,527 | 333 | # 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... |
ab2cdb26ffd96334b3c5ac1e94422f1560bae86b99b7ed36f15f13ffa7d814ae | Python | 11,529 | 259 | import numpy as np
from scipy.integrate import cumtrapz
from utilities import sparsify_rate_matrix, eval_params_in_array
### CLAMP MODEL BUILDER ###
def clamp_model_builder(architecture, fusion_model='clamp_exponential', replenishment_model=None):
"""Build sparse stochastic version. Markov model from speci... |
f6a6b534e639dd2e3e984ec6b0297dae7b101f8a8b989cc1b2c6851cbb05f423 | Python | 11,532 | 337 | # -*- coding: utf-8 -*-
import itertools
import os
import platform
import subprocess
import sys
from lab.experiment import ARGPARSER
from lab.steps import Step
from lab import tools
from downward.experiment import FastDownwardExperiment
from downward.reports.absolute import AbsoluteReport
from downward.reports.compa... |
2aa4d9a1513a2ebd01b25011f2ca1bb1c43e98166ee759809b7d03d5fddbc313 | Python | 11,533 | 341 | from copy import deepcopy
import itertools
from nltk.ccg import chart as nchart
from nltk.parse.chart import AbstractChartRule, Chart, EdgeI
from nltk.tree import Tree
import numpy as np
from pyccg import Token
from pyccg.combinator import *
from pyccg.logic import *
printCCGDerivation = nchart.printCCGDerivation
... |
ae57e7e047a5a0a2c1d8afb841f734df85b73e8a473afd47266552bb7df9379e | Python | 11,537 | 441 | import warnings
from functools import partial
import pytest
import autograd.numpy as np
import autograd.numpy.random as npr
from autograd import (
checkpoint,
elementwise_grad,
grad,
grad_and_aux,
hessian,
hessian_tensor_product,
jacobian,
make_ggnvp,
make_hvp,
make_jvp,
te... |
e52c58d69d859943440b40e421836c7b904337ba6f6f58255523d28c3c043f7b | Python | 11,539 | 299 | """Expectation-Maximization estimator for HMP models."""
import multiprocessing as mp
from warnings import resetwarnings, warn
import numpy as np
from hmp.patterndata import PatternData
from hmp.utils import _get_mp_context
from .base import BaseEstimator, EstimationResult
_WORKER_DATA = {}
def _init_worker(patte... |
67ba607eec143e3ef0ddfcc75c648bf75acfda8d1076f0601a640b01698775ae | Python | 11,540 | 193 | """
Load assemblies from (either from 2 HDF5 files, or from different prefixes) and compare them
last modified: András Ecker 04.2023
"""
import os
import numpy as np
import pandas as pd
from scipy.sparse import csr_matrix
from scipy.spatial.distance import cdist
import assemblyfire.utils as utils
from assemblyfire.co... |
150012b639eb9706442c4656a8d22842e05281a6144c3977e67fca76e643dd8a | Python | 11,543 | 290 | ## Restormer: Efficient Transformer for High-Resolution Image Restoration
## Syed Waqas Zamir, Aditya Arora, Salman Khan, Munawar Hayat, Fahad Shahbaz Khan, and Ming-Hsuan Yang
## https://arxiv.org/abs/2111.09881
import torch
import torch.nn as nn
import torch.nn.functional as F
from pdb import set_trace as stx
impor... |
55312d059f5074ce9bf055a19733d30deccb95bc5df1d27c577d508c105ff0e3 | Python | 11,544 | 267 | import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import pyabf
import sys
import os
import datetime
from scipy.signal import find_peaks
from scipy.signal import peak_widths
from scipy import optimize
from ABFbot_functions import *
from ABFbot_det... |
a5fe38fd90a0d35175dc8e07ee48e721843277fa5f2865da3b757e9433857d32 | Python | 11,545 | 325 | import math
import random
import sys
import networkx as nx
import numpy as np
import pandas as pd
from scipy.optimize import minimize
from scipy.stats import beta
def cmf_discrete_log_logistic(x, d, l):
return 1 / (1 + ((x + 1) / l) ** -d)
def pmf_discrete_log_logistic(x, d, l):
return cmf_discrete_log_log... |
79639f55d9d8724a73672c7d32e5d7e615849bd329f18a70388715dd4d5eb89b | Python | 11,547 | 544 | # 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... |
412d00cb1e6d36267b4398b83422f3c825ac37963336aff8978a7af5634c9e69 | Python | 11,548 | 388 | # 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... |
ef050501ab2cff48b4878eb73927d10ecfff4a786a529f18f450c254ee3b3ee1 | Python | 11,550 | 350 | import logging
import numpy as np
import scipy.signal
import numba
"""Collection of useful functions for data processing.
"""
def kuramoto(traces, smoothing=0.0, distance=10, prominence=5):
"""
Computes the Kuramoto order parameter of a timeseries which is a measure for synchrony.
Can smooth timeseries i... |
080e56d321d76da7ab915fb22fa98b1737d5d8cab326f04424fb56a91feb1b7b | Python | 11,551 | 255 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from functools import reduce
import operator
from pathlib import Path
import random
import subprocess
import click, pinn, os
from pinn.report import report_log
from typing import List
import numpy as np
from collections import defaultdict
os.environ['TF_CPP_MIN_LOG_LEVEL... |
858893b733f923ce37e1ac1964c521bf8eeef2805d5783a5b8df9ac599949302 | Python | 11,555 | 283 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2022/6/21 15:50
# @Author : piaoyang cao
# @File : prop_pred.py
# from data_loader import GetLoader, get_data_list
import argparse
import torch
from torch_geometric.loader import DataLoader
from torch.optim.lr_scheduler import StepLR
import numpy... |
b20355ca699cee33dd9f1e707e157b7513c0e3f19fd670b6bcaa354997ea80aa | Python | 11,556 | 352 | import tqdm
import torch
import torch.nn as nn
import torch.nn.init as init
import torch_geometric
import torch_geometric.transforms as T
from torch_geometric.loader import NeighborLoader
from torch_geometric.nn import RGCNConv, GCNConv, Linear
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
c... |
23492ea72417cf9b0b9edb9f4971e29af11dd241716e1ea1218efcf727f0f163 | Python | 11,559 | 345 | from __future__ import annotations
import numpy as np
from SurvivalEVAL.evaluations.util import (
align_curve_and_time_coordinates,
check_monotonicity,
)
def _interp_cdf_row(
F_i: np.ndarray,
t_grid: np.ndarray,
t_eval: np.ndarray,
left_fill: float | None = None,
) -> np.ndarray:
"""
... |
cc9634907544feed515a37b0da23df02e60f59f341f70826878f748f56c6d973 | Python | 11,562 | 402 | """
==========================================================================
Fit single subject linear model to voltage evoked by stimulus presentation
==========================================================================
Mass-univariate analysis voltage data.
Authors: José C. García Alanis <alanis.jcg@gmail.c... |
cb1c5fcf883f8c313558296e5ccccc7cf1a06e133d3489c5ca89b07a50b8fe8f | Python | 11,564 | 257 | import pandas as pd
import numpy as np
import os
import sys
from Bio.PDB import PDBParser, MMCIFParser
from Bio.PDB import Superimposer
from Bio.PDB import PDBIO, Select
from Bio.PDB.Polypeptide import protein_letters_3to1
from scipy.spatial.distance import cdist
from collections import defaultdict
import rdkit.Chem ... |
0a32a358129ca0981a9b411224194c09f51edefc3b97fb7544abc85e40acfbad | Python | 11,568 | 518 | from __future__ import annotations
# MG_RESUME_PREPROCESSING_V2
from ..checkpoint import (
CheckpointJournal,
file_identity,
fingerprint,
source_digest,
)
from ..io.preflight import (
canonicalize_raw_storage_2d,
preflight_metadata_input,
)
from dataclasses import dataclass
from pathlib impo... |
023150ea37d41b5694114fb223b53ac7491fb82eceb259e71ada46b7dcc1151b | Python | 11,569 | 238 | from tensorflow.keras import Model, activations, layers
from tensorflow.keras.layers import Input, Conv1D, MaxPooling1D, Flatten, Dense, Dropout, BatchNormalization, Activation, GlobalAveragePooling1D, add
from tensorflow.keras.regularizers import l2
def standard(input_shape, output_shape):
inputs = Input(shape=(i... |
101c56172393f7da657c43e71b16f5463731844d3a577027bd9e7730b56d2138 | Python | 11,570 | 297 | import torch
from torchvision import transforms
from torch.optim import *
from models import *
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, mkdir_p, savefig
import... |
7799174ef3502e79961f2bc6a64cfcb75a9256044cf9f6b1aabd117e1649b1e1 | Python | 11,571 | 276 | """
Script for extracting particles from membranes by looking for low pass filtering + non-maximum suppression
Input: - Directory with the _imod.csv files with reference picked particles for each microsome
- Directory with offsets for each microsome in a tomogram
- Directory with the ... |
160fd29262cde52dbc4410d6fbbe73178969309006f1f6cc9a37d3ae7520158d | Python | 11,580 | 331 | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
# Modified from github.com/openai/CLIP
from collections import OrderedDict
import numpy as np
import timm
import torch
fr... |
b6bc0d983483124906b0e98706ece6a0e7294830f15ba0074146cd07c0173f3f | Python | 11,581 | 300 | """Smoke tests for rerun_laplacian_with_appended_points boundary-load path.
The function is complex (150+ lines, real ANTs + Laplacian solver). These
tests focus exclusively on the boundary-condition loading logic by mocking
the heavy solver and volume I/O, while exercising the paths that the recent
use_original... |
2eba57f8872bec3f123e342941f1285e4c7cc789c732c7a3fba197f1ad38319a | Python | 11,583 | 423 | import netket as nk
import numpy as np
import jax.numpy as jnp
import jax
from functools import partial
import netket.jax as nkjax
from netket.utils import mpi
import tqdm
import matplotlib.pyplot as plt
import json
import os
# def device_count():
# return sharding.device_count()
def device_count():
return ... |
ef139487803ec26a58cf34cbd4b374cad460c2565ed1b9c2a9e324fa06c67855 | Python | 11,584 | 219 | import os
import unittest
import numpy as np
from pandas import Categorical, DataFrame
from hed.errors.exceptions import HedFileError
from hed.tools.util.data_util import (
add_columns,
check_match,
delete_columns,
delete_rows_by_column,
get_key_hash,
get_new_dataframe,
get_row_hash,
g... |
5dd928c17f82cebdca97f7f97f02f28a8130061008fe8f17c23e0d8eb1a5df4c | Python | 11,586 | 265 | from typing import Any, Optional
import torch
from torch import nn
__all__ = ['UNET', 'NESTEDUNET', 'U2NET']
# Originally contained own implementation of was changed because of weight init
# and adopted from https://github.com/ShawnBIT/UNet-family/blob/master/networks/UNet.py
from models.unet_super import UNetsuper... |
15d0ab9113eacf85d0b974329e5ca220a515ae65e8e081c637815b68cfa34b43 | Python | 11,587 | 323 | from __future__ import absolute_import, print_function, division
import numpy as np
import scipy.stats
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
def autoencoder_loss(model, X):
X = X.unsqueeze(1)
z = model.features(X)
score = model.classifier(z... |
c59a5acca35dfd0f0a990e7c20dfdf334dfb6e975a6248cdb07672c73b861b48 | Python | 11,589 | 306 | """
Performs Univariate 2nd order analysis and comparison again a model from a ListTomoParticles
Input: - The path to the pickled ListTomoParticles object
- Parameters to set up the model simulation
Output: - Plots with the analysis
- Matrix with the analysis for further post-pro... |
0e2c61cdfd6c93e17daa3c8212a068570a6b7c7fa9533033299204c5005e1b11 | Python | 11,591 | 245 | import os
import neuron
import argparse
import numpy as np
from neuron import h
import os.path as path
import matplotlib.pyplot as plt
class ChannelTester(object):
"""Test dynamics of ion channel model"""
def __init__(self, channel_name, g):
super().__init__()
self.channel_name = channel_name
... |
f2a30e103ea23ab49ed55b0fee6aea49973a4d2f3ab60acea3330f16fa55aa7f | Python | 11,592 | 273 | ##
# \file motion_updater.py
# \brief Class to apply stack and individual slice motion transformations
# from a 'motion_correction' directory.
#
#
# \author Michael Ebner (michael.ebner.14@ucl.ac.uk)
# \date Nov 2018
#
import os
import re
import numpy as np
import SimpleITK as sitk
import p... |
6ea834540f69cab10b58bc2469511f032cffde545cf3d084aeaca19ae0da3e6f | Python | 11,596 | 312 | #!/usr/bin/env python3
try:
from PyQt5.QtWidgets import QApplication
except ImportError:
raise ImportError('You need to install PyQt5 to run GUI')
from argparse import ArgumentParser
from logging import getLogger, StreamHandler, Formatter, INFO, DEBUG
from datetime import datetime
from types import MethodTyp... |
7c06d16bbdd67c2689be05505e8b2a04167695710679a84a84abc6e0d8d2391d | Python | 11,596 | 380 | import os
import boto3
import botocore
from google.cloud import storage
from google.cloud import exceptions
from urllib import parse
from abc import abstractmethod, ABC
from typing import List
from time import sleep
class DataPortal(ABC):
"""
A superclass for reading files within a specified directory from a... |
3527264fb2f0a2db88c4bde1a87de3e4d38be0e287d593d499f713bb8eeece2d | Python | 11,600 | 358 | from __future__ import absolute_import, division, print_function
import json
import multiprocessing as mp
import os
import sys
from typing import List
import numpy as np
import scipy.stats
import torch
from topaz.utils.data.loader import load_image
from topaz.utils.image import downsample, save_image
def pixels_gi... |
b1a7dd637fd9b8fdb8b566d6d159b5ae1149b371a6a7d411d1cd7c5f5e6faeeb | Python | 11,601 | 314 | import warnings
from io import StringIO
import biotite.structure as struc
import numpy as np
from biotite import InvalidFileError
from biotite.structure import (
BadStructureError,
annotate_sse,
connect_via_residue_names,
spread_residue_wise,
)
from biotite.structure.io import pdb
from .assembly import ... |
344803cbd51f6a018738015c7a762fa0100753be8773bd479efe6cbae3d443bd | Python | 11,603 | 350 | """DenseNet models for Keras.
# Reference paper
- [Densely Connected Convolutional Networks]
(https://arxiv.org/abs/1608.06993) (CVPR 2017 Best Paper Award)
# Reference implementation
- [Torch DenseNets]
(https://github.com/liuzhuang13/DenseNet/blob/master/models/densenet.lua)
- [TensorNets]
(https://github.c... |
ca63cb3129c910c91c3bce1ce0b10668f5aed9a09cef732a85ca879766754bf4 | Python | 11,605 | 306 | '''
Modified by Mayank Kabra
Adapted from deeplabcut
Adapted from DeeperCut by Eldar Insafutdinov
https://github.com/eldar/pose-tensorflow
'''
import os
import logging
import random as rand
import numpy as np
from numpy import array as arr
from numpy import concatenate as cat
import pickle
import scipy.io as sio
fro... |
3f0faa04d32f572d37ea21cf3200d4e54ef9688e11badb746b7a5381929b986d | Python | 11,615 | 327 | # 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... |
990d6f5d7074272732382d96c53503b3b6cf794814c6bb2657275ee6567eceed | Python | 11,617 | 394 | #!/usr/bin/python
# Gogulan Karunanithy, UCL, 2021
# Code for performing reconstructions using FID-Net
import copy
import sys
import os
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3"
import matplotlib.pyplot as plt
import nmrglue as ng
import numpy as np
import tensorflow as tf
from tensorflow import keras
from pathlib ... |
953595ac681de20ce5d87397beaf272d241ee83111de511af1fb651e2dc9ef84 | Python | 11,619 | 301 | # -*- coding: utf-8 -*-
"""
Created on Mon 24 Jan 2022
@author: meine
"""
from tensorflow.python.keras.saving import hdf5_format
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Dropout, Input
from tensorflow.keras.optimizers.legacy import Adam
from tensorflow.keras import backe... |
8eafc905892ed5e4c08d89bf5dfa90459fa5d9bb321e811856cbb6771bd7815d | Python | 11,622 | 324 | import copy
import logging
from collections import deque
import torch
from torchdrug import core
from torchdrug.core import Registry as R
logger = logging.getLogger(__name__)
@R.register("transforms.NormalizeTarget")
class NormalizeTarget(core.Configurable):
"""
Normalize the target values in a sample.
... |
a189db4aed024b0e211206399e6e9bb764e6c04e9f9a8220e539e73100ee86b7 | Python | 11,624 | 287 | import re
import os
import pandas as pd
import seaborn as sns
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
def extract_info_from_filename(filename):
"""
Uses filename to extract information of the form
(fingerprint_dimension, used_invariants, fingerprint_diameter, used_pool... |
6710ee0ed531f3fcf2e01b899a0d32a7b84366e730fc45d2814961b282bb5e2b | Python | 11,627 | 319 | """A wrapper around ASE's Vasp calculator that makes it better suited for high-throughput DFT."""
from __future__ import annotations
import os
import subprocess
from pathlib import Path
from typing import TYPE_CHECKING
import numpy as np
from ase.calculators.vasp import Vasp as Vasp_
from ase.calculators.vasp import... |
e9ba84dc3ced3210edb6591d1da6703f1ed1d8fc685e4d771306feedc5b81aed | Python | 11,629 | 253 | # -*- coding: utf-8 -*-
import torch
import torch.nn as nn
from supar.config import Config
from supar.models.dep.biaffine.model import BiaffineDependencyModel
from supar.models.dep.biaffine.transform import CoNLL
from supar.modules import MLP, Biaffine, Triaffine
from supar.structs import (DependencyCRF, DependencyLBP... |
2b62dd2b99c84f356c6dd1c4ef9267859d48e130cc905ea5e1d6d2ecd25b65eb | Python | 11,631 | 262 | import random
import numpy as np
from itertools import cycle, count
from control_tools.execution import ArmTrajectory
from perception_tools.common import get_type
from plan_tools.common import Control, Conf, get_reference_pose, STIR_QUATS, \
lookup_orientation, get_urdf_from_center, LIQUID_QUATS, compute_base_dia... |
5148e86f678c6877dcca84d52977084c03dc1bec2754e26ebcdd3336c1787775 | Python | 11,631 | 364 | # Author: Zi Wang
from __future__ import print_function
import os
import pickle
import shutil
import numpy as np
import scipy
import scipy.optimize
from functools import partial
from scipy.stats import truncnorm
try:
user_input = raw_input
except NameError:
user_input = input
def safe_rmdir(dir):
if o... |
536ab48b59fc84f4b681087ca9ca1c020e5da2f1806bf6d1db86a4997333ae4e | Python | 11,632 | 348 | import contextlib
import errno
import logging
import logging.handlers
import os
import sys
import threading
from dataclasses import dataclass
from io import TextIOWrapper
from logging import Filter
from typing import Any, ClassVar, Generator, List, Optional, TextIO, Type
from pip._vendor.rich.console import (
Cons... |
93c2c5cae029c9eeea34e668f5541c24fa9870a6485ac4921f68821ae7ed003b | Python | 11,642 | 276 | from __future__ import division
from nipype.interfaces import fsl as fsl # fsl
from nipype.interfaces import utility as util # utility
from nipype.pipeline import engine as pe # pypeline engine
import nipype.interfaces.io as nio
import os
import os.path as op
import shutil
from glob import glob
im... |
9f6567f440b9fbb2667116397ab20f4388545a71149e01b4a184b7256df15d9a | Python | 11,642 | 299 | import functools
import logging
import os
from typing import TYPE_CHECKING, Dict, List, Optional, Set, Tuple, cast
from pip._vendor.packaging.utils import canonicalize_name
from pip._vendor.resolvelib import BaseReporter, ResolutionImpossible
from pip._vendor.resolvelib import Resolver as RLResolver
from pip._vendor.r... |
aadba1513578ad06f16eb91e42f2781c23f7d5a357219a76781ee64e4b5f5c3e | Python | 11,643 | 283 | """
Created on 10/08/2017
@author: Niklas Pallast
Neuroimaging & Neuroengineering
Department of Neurology
University Hospital Cologne
"""
from __future__ import print_function
import os
import sys
import numpy as np
import nibabel as nib
import nibabel.nifti1 as nii
import pv_parseBruker_md_np as pB
import P2_IDLt... |
ba0dc82ed79d88c279905e805f2c4be0195588ef3a701e78edfa21355f02fad2 | Python | 11,644 | 280 | # -*- coding: utf-8 -*-
"""
Created on ***
@author: ***
"""
#! /usr/bin/python
# -*- coding: utf-8 -*-
"""
Training script for VGG-Net (CNN 1) with quantization level k=2 on CIFAR10.
Links
-------
.. https://www.tensorflow.org/versions/r0.9/tutorials/deep_cnn/index.html
.. https://github.com/tensorflow/tensorflow/tre... |
d73951ff95fe46408de3901b96b6979a7514b1ff4dbc0abcf420c37d62f31178 | Python | 11,644 | 374 | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under th... |
979cab3ca3ad2b5d2576456ef3c1672fbbfb7e89f48bae7994787ef1e915fe07 | Python | 11,649 | 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... |
5bd96f5aa91cc9f0ef40e88ef826473aaca9dd7f00abcaee8a7e662f094a1e7a | Python | 11,650 | 301 | #!/usr/bin/env python3
"""5-Base real-data concordance vs DRAGEN (#787 GA graduation harness).
Two subcommands, both pure stdlib (gzip + math), reading plain or .gz:
methyl --ours <cytosine_report> --dragen <CX_report.txt.gz>
Per-CpG methylation concordance. Both inputs are Bismark-format CX
cy... |
09fc68cc524236475f769ee0eaae362ca10c02c50a5bdcbd9374a472dfac4360 | Python | 11,656 | 172 | """
FIGURES_KNIFE_CHOIR.py written 2026-09-22. Two report/poster figures, as plain SVG (no plotting library).
06-OUTPUT/figures/fig_knife.svg label drift along the cutting axis (z) vs a control axis (x)
06-OUTPUT/figures/fig_choir.svg (a) left vs right hemisphere twins; (b) one choir cell, one single v... |
e63a2fbc5234cdfb029a349cb09a294c1eb432266761739f592d09ac7adcb8ab | Python | 11,663 | 341 | import tensorflow as tf
import tensorflow.experimental.numpy as tnp
'''genformer trial losses'''
def poisson_multinomial(y_true, y_pred, total_weight=0.15, epsilon=1e-6, rescale=True):
## copied from the basenji suite
seq_len = tf.cast(tf.shape(y_true)[1],dtype=tf.float32)
# add epsilon to protect against ti... |
9f2e171e0e03d6190389e4d01354d241b544d0ee457dd840e72479a92c4d6b3d | Python | 11,667 | 267 | from functools import partial
from collections import OrderedDict
import torch
import torch.nn as nn
import copy
from .customized_linear import CustomizedLinear
from einops import rearrange
import random
import numpy as np
import pandas as pd
def drop_path(x, drop_prob: float = 0., training: bool = False):
... |
e79def040e4b01890cc5e45170a8fe86ae15226ae7aa46e8e2f5fb494d04f17f | Python | 11,670 | 245 | import tensorflow as tf
from tensorflow.keras.layers import Input, Dense, Flatten, Conv2D, MaxPooling2D, Lambda, GlobalMaxPooling2D, GlobalAveragePooling2D, Dropout
from tensorflow.keras import Model, Sequential
from tensorflow.keras.regularizers import l2
from tensorflow.keras.backend import abs
W_init = tf.keras.ini... |
ecd0ec933d1d7d7495ba0ee92347ef66a4663a59d9cab0b08ab2bcddbcd6925a | Python | 11,670 | 317 | """Plot decoding times on brain surface."""
from __future__ import annotations
import os
import pathlib
import re
from typing import Literal
import matplotlib as mpl
import mne
import numpy as np
import pandas as pd
import trimesh
import trimesh.exchange.gltf
from matplotlib import axes, figure
from matplotlib import... |
34bd30ed1a991e33a2b4befc229c7694481b07cea9aa8d0431922b0eea06045d | Python | 11,672 | 289 | """"""
"""
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 softw... |
a0ce2efb072124347e411e4e5e1da3c5b3c958eb097d30b935737d4db81a4a69 | Python | 11,672 | 240 | import os
import unittest
from hed import load_schema_version
from hed.errors import ValidationErrors
from hed.models import ColumnType, HedString
from hed.models.column_mapper import ColumnMapper
from hed.models.sidecar import DefinitionDict, Sidecar
class Test(unittest.TestCase):
@classmethod
def setUpClas... |
e365ca1f1962250a628f07bcda410e3f4a9e6229b4bbfe19983f1871bd4d99ea | Python | 11,674 | 304 | #
# MIT License
#
# Copyright (c) 2022 GT4SD team
#
# 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,... |
bc29ada60d7b8f7818d3b0890b8be8f9b0ec454a63ab957e688c91e0bcea05a8 | Python | 11,679 | 385 | """
General functions: array manipulation, data i/o, etc
"""
import time
import logging
from datetime import datetime
from typing import Any, Callable, Dict, List, Union
import dolfin as d
try:
import ufl_legacy as ufl
except ImportError:
import ufl
from pytz import timezone
from termcolor import colored
fr... |
1ea7ea2d4a6aba9e81880a3c57589a46c53dd2c1e6f89184849701ce87cbf09a | Python | 11,681 | 364 | # 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... |
c156beb8b66327fd6be7e2242215d418624ea66598becd5137c69ab98c1306c4 | Python | 11,681 | 410 | import torch
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import pickle
import pandas as pd
from scripts.convert_to_gpu import gpu
from scripts.convert_to_gpu_and_tensor import gpu_t
from scripts.convert_to_gpu_scalar import gpu_ts
from scripts.convert_to_cpu import cpu
import os
matplotlib.use... |
5fa4eac32405f522b9208100a746849781f382b82005da74c6ce756ba8287015 | Python | 11,684 | 359 | #!/usr/bin/env python
# Written by Minh Nguyen and CBIG under MIT license:
# https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
from __future__ import print_function
import argparse
from dateutil.relativedelta import relativedelta
from joblib import Parallel, delayed
import pandas as pd
import numpy as np
im... |
887341ee76cebfe8c4567a6929b6df71aa0281b18cfdf2ab961d6ab11ac0e54c | Python | 11,684 | 277 | # 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... |
65b068a0f8879af96cd267db7adcf1b55be18c11fab64458a5f5b58f94d1a0dd | Python | 11,685 | 391 | # 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... |
c26d92b46621fddedcc025d1c111d663a0c748bffe2566891603df663292f5da | Python | 11,685 | 276 | import numpy as np
import torch
from torch import nn
from torch.nn import functional as F
from torch_scatter import scatter_add, scatter_mean, scatter_max, scatter_min
from torchdrug import layers, data
from torchdrug.layers import functional
class DDGAttention(nn.Module):
def __init__(self, input_dim, output... |
b07785f9451cb9fa16cd9fc54ff6cea14abbb16716f9224a8c34c398efeefd04 | Python | 11,688 | 295 | 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 fastglioma.datasets.srh_dataset import SlideDataset, slide_collate_fn
from fastglioma.datasets.improc import get_sr... |
c168e92e3fb07cb01625392898a7c807e6bbb7cb941f6130cbbfe7871754bcc2 | Python | 11,689 | 357 | from os import remove
import numpy as np
import pandas as pd
import torchdiffeq as ode
import torch
import torch.nn as nn
import scipy.io as scio
import networkx as nx
import random
def list_to_array (x):
dff = pd.concat([pd.DataFrame({'{}'.format(index):labels}) for index,labels in enumerate(x)],axis=1)
retur... |
bcae9224dedf3733bbefba1fbf89459598a6a526e2456a44134f7f6d49a35f6c | Python | 11,692 | 444 | #!/usr/bin/env python
# coding: utf-8
# ## Analysis of feature selection for cell line mutation prediction; single-cancer holdouts
#
# This script is very similar to `02_cancer_type_classification/plot_univariate_fs_results.ipynb`, for analyzing the results of purity prediction on held-out cancer types. We analyze th... |
183b48073d5646462939bdb0980094534704cf54d27345d5e555096b586a73d2 | Python | 11,698 | 370 | #!/usr/bin/env python3
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 pybedtools as pybt
import tensorflow as tf
import time
from scipy import stats
from scipy.signal import find_... |
8baaa3bcac61e583e0aa5c322838c9b91e8196300cad16f37b21e7fad0306f9c | Python | 11,698 | 268 | import os
import time
from configparser import ConfigParser
import numpy as np
import torch
from e3nn.o3 import Irreps
from .utils import orbital_analysis, refine_post_node
class BaseConfig:
def __init__(self, config_file=None):
self._config = ConfigParser(inline_comment_prefixes=(';',))
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.