sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
53905bf6e1904edda1a12bb558a5b5f7c59dd6698339f855af8e01e5759e92cf
Python
5,871
164
"""Code in this file is heavily based on the code from the following repository: https://github.com/CompVis/invariances""" import warnings import torch import torch.nn as nn from torchvision import models from ldctinv.utils.distributions import DiagonalGaussianDistribution from ldctinv.vae.blocks import ActNorm, Den...
b0f1fa0d457bfd9c7ce86b6e73dcd6c64483530f8be46e4c659ea21f83b291e2
Python
5,871
157
def dr_seed_fc(): import numpy as np from os import path from labbookdb.report.tracking import treatment_group, append_external_identifiers from samri.plotting.overview import multiplot_matrix, multipage_plot from samri.utilities import bids_substitution_iterator from samri.analysis import fc db_path = '~/syncd...
120963c7982a07bf01f18d8dc8b87386fa3b537ae3a6a7ddece616a247dde8b3
Python
5,873
114
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
c1530d70a4eff358c4aec83e62e43e2c3bb45a8280a0c750134b618fbe2d8dd6
Python
5,875
134
from glob import glob from os import path import pandas as pd import numpy as np import copy def get_timing_correction(filey): problematic_files = ['s568_motorSelectiveStop.csv', 's568_stroop.csv', 's568_surveyMedley.csv', 's568_DPX.csv', 's568_discountFix.csv', ...
5ae44e0782bebd11215dc8cebd1ce9029aed8b90e27eb9a2fa7bfef502ae713c
Python
5,880
194
from dataclasses import dataclass, field from typing import Any, Dict, Optional import numpy as np from .node import NIRNode @dataclass(eq=False) class CubaLIF(NIRNode): r"""Current based leaky integrate and-fire-neuron model. The current based leaky integrate-and-fire neuron model is defined by the fo...
84cd860a8bc9308649f5a0cb2225fb3192403bddacd849786c63ee5d81d9891b
Python
5,880
165
import numpy as np import torch from torch import nn from sinabs.from_torch import from_model class NestedANN(nn.Module): def __init__(self): super().__init__() seq = [ nn.Conv2d( 2, 8, kernel_size=(2, 2), stride=(2, 2), padding=(0, 0), bias=False ), ...
9c34d870df7de2ef75f1f3fda45df50d5333a66c7c5a3487bd8af7a44d1f0de2
Python
5,880
141
r"""SBOL — the Synthetic Biology Open Language interchange standard. `SBOL <https://sbolstandard.org/>`_ is the community standard for exchanging genetic-design data (parts, devices, constructs) between tools and registries (iGEM, SynBioHub, Benchling…). These helpers bridge an ``ov.synbio`` construct (a sequence + a ...
8fc2a100b29fc1eb4fc097d9c30b49c29ca0cc8c64e104067eb28acbe28dfa45
Python
5,881
142
# -------------------------------------------------- # load options for CNN lesion segmentation # # Options are loaded from a configuration file # # -------------------------------------------------- def load_options(default_config, user_config): """ map options from user input into the default config """...
ddeb06757010b250c0d4ead74c3e46d41e7c1d4e3b8f3f95b432e3763e08e5b5
Python
5,881
179
from __future__ import annotations from dataclasses import dataclass from pathlib import Path from typing import Any, ClassVar, Iterable, NamedTuple, Sequence, TypeAlias import numpy as np import pandas as pd from numpy.typing import NDArray from siapy.core.exceptions import InvalidInputError, InvalidTypeError __al...
0f7664c667dfdae55053f2ef26e4ea6c8c87f04668b49704986930cf27b1e0c3
Python
5,882
131
import optuna import pandas as pd import pytest from sklearn.base import BaseEstimator from sklearn.svm import SVR from siapy.core.exceptions import InvalidInputError from siapy.datasets.schemas import RegressionTarget from siapy.entities import Signatures from siapy.optimizers.configs import OptimizeStudyConfig, Tabu...
8cfb7b3643b2fd98ad3be608ff106effed585291e5f93df2d26495dcdbaed19e
Python
5,884
199
''' Code coming from https://github.com/lucidrains/vit-pytorch ''' import pdb import torch from torch import nn from einops import rearrange from einops.layers.torch import Rearrange # helpers def posemb_sincos_1d(patches, temperature = 10000, dtype = torch.float32): _, n, dim, device, dtype = *patches.shape...
a571f8d7019399c3429606f9a3967ae7bcd5e547ff0935d273822487b7bcb576
Python
5,884
141
# Copyright 2021 Division of Medical Image Computing, German Cancer Research Center (DKFZ) # and Applied Computer Vision Lab, Helmholtz Imaging Platform # # 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 L...
636da2b57efbe07409859c13ccec6dee8c92c51456fd51b71bc75a7b9a1a822a
Python
5,885
143
#!/usr/bin/python # This file is NOT licensed under the GPLv3, which is the license for the rest # of YouCompleteMe. # # Here's the license text for this file: # # This is free and unencumbered software released into the public domain. # # Anyone is free to copy, modify, publish, use, compile, sell, or # distr...
3ae712bea5355703c8f72e524772133f6fde80c7bc9e5d04be752ed15836a9be
Python
5,886
157
"""Keep the per-file prose doctest lists in doc/BUILD.bazel complete and live. Doc prose is tested by `doctest_each()` over explicit lists of pages, not directory globs, so that every target tests something. Each library (Core, Data, RLlib, Serve, Train, and Tune) has its own list, and prose that no library owns is in...
43ba53f3b54f6f2479f149bb95d007de2d4341bba9eb0e7e54011384d6d7f492
Python
5,886
187
import argparse import sys import samtools import re import shutil import os.path from ngs_mapper.bam import sortbam, indexbam import log logger = log.setup_logger('tagreads',log.get_config()) # Exception for when headers exist class HeaderExists(Exception): pass # The next 3 tuples have to be the same length and ea...
45517ddbd62d2126e7f724af2b4d6a3016518f247b399e145d76f4410c0eccce
Python
5,886
166
import os import time from pathlib import Path import pandas as pd try: from anndata.io import read_h5ad as _anndata_read_h5ad except ImportError: from anndata import read_h5ad as _anndata_read_h5ad from ..._registry import register_function def _log_rust_read(path: str, size_mb: float | None, elapsed: flo...
e73241e29a151c8ffe4d10b4047b73aead2696bc11d53327639bb686ef87fdde
Python
5,886
152
# External dependencies import argparse import glob import logging import os from merlin.core.compat import cupy, numpy from merlin.io import Dataset # we can control how much memory to give tensorflow with this environment variable # IMPORTANT: make sure you do this before you initialize TF's runtime, otherwise # TF...
3f734d6c232b2165a6c08fc5020702ebc8c8f2640debdef903d3663591c72022
Python
5,887
159
import subprocess from subprocess import Popen, PIPE import os import sys import time from typing import List import psutil import pynvml import time import copy import signal from urllib import request, parse UNIT = 1024 * 1024 pynvml.nvmlInit() stop = False def my_handler(signum, frame): global stop stop = ...
bb44686d0256661b3880fc357392be61f004312347f344f9c508e97ef36bde82
Python
5,889
157
import unittest import numpy as np from neuron_morphology.morphology_builder import MorphologyBuilder from neuron_morphology.transforms.affine_transform import ( AffineTransform, rotation_from_angle, affine_from_translation, affine_from_transform, affine_from_transform_translation) class TestAffine(unittest...
d144f8a048ca4145c214319a669d55811aeb59ef6302c6738a6f22d7a6c04bdd
Python
5,889
124
import numpy as np from scipy.optimize import linear_sum_assignment from sklearn.metrics import matthews_corrcoef, accuracy_score, f1_score, \ precision_score, recall_score def kuhn_munkres_algorithm(true_lab, pred_lab): """ Function that implements the Kuhn-Munkres algorithm method. It selects the be...
3b33dd54089af1a0f7a493d18e013717273936a16a80724175140b90d3477dbd
Python
5,891
164
import numpy as np import torch from ..base import Transform, as_range, randint, to_batched, uniform from ..ops import fill def neurokit_peaks(signal, fs): """Detect R peaks with neurokit2 (install with `pip install ecg-augmentations[peaks]`).""" try: import neurokit2 as nk except ImportError as ...
93878a7a83a18e7e8280431727ae711d5182b4b79cb641d0141b94de5e1c22cd
Python
5,891
110
import numpy as np import sys import os import scipy.io as sio import time from scipy import sparse sys.path.insert(1, '../SUNS2') # the path containing "suns" folder from suns.PostProcessing.combine import piece_neurons_IOU, piece_neurons_consume from suns.PostProcessing.evaluate import GetPerformance_Jaccard_2 # da...
d26b60a119d3b2c0d7723a1a4a95efca2165ccc2faefac4cc654d924c446b816
Python
5,891
142
"""Thin wrapper around ``pyscdblfinder`` for omicverse's QC pipeline. Exposes a single ``scdblfinder(adata, ...)`` function used by ``ov.pp.qc`` with ``doublets_method='scdblfinder'``. Writes two columns to ``adata.obs`` so the existing `filter_doublets` codepath (which keys off ``predicted_doublet``) works unchanged:...
e215c6ff33f33e79f3b1fe1a5a3b9d4fad5ea3b5885dbf5a84ce99bdb5485e65
Python
5,891
147
#!/usr/bin/env python # import from __future__ import print_function ## batteries import os import shutil import argparse import logging ## package from bin import __version__ import gtdb2td # argparse desc = 'Convert GTDB taxonomy to input for "diamond makedb --taxonmap"' epi = """DESCRIPTION: Convert Genome Taxonomy...
6c49ac3b69e7b1e7b877c9785fb34da902e59f2aee0abf0c17b27359b79a1412
Python
5,893
146
# -*- coding: utf-8 -*- """Utility functions for differential phase contrast (DPC) imaging. This module contains the utility functions for differential phase contrast (DPC) imaging. The functions include loading illumination patterns, generating source patterns, generating transfer functions, and conventional Tikhonov...
39f5c33dee5f270deede7ce802fcb82f66a8cf2a9e79d846486e1e782c687e5a
Python
5,898
139
import matplotlib.pyplot as plt import pickle import numpy as np import os import sys # from Step_7_util import * from sklearn.metrics import accuracy_score, confusion_matrix, roc_auc_score, roc_curve, precision_recall_curve def main(): # SUBSET = 9900 # TARGETS = ["pos_MANE", "pos_ALTS", "neg_1", "neg_rando...
7d3a95074f169ad379611bd97d57c2432a82a7f0e3bb0cca441f787af92f5775
Python
5,899
192
""" Implementing "a complex network structure" example in https://github.com/synsense/sinabs/issues/181 """ import torch import torch.nn as nn from sinabs.activation.surrogate_gradient_fn import PeriodicExponential from sinabs.layers import IAFSqueeze, Merge, SumPool2d class SNN(nn.Module): def __init__(self, b...
b347989813f8cadfdc7a3a25aa8711c478db64396bd7e8c96a230750cd6c09ec
Python
5,899
141
#!/bin/env python import argparse from collections import Counter import json import gzip import pysam import sys from typing import List, Text, Optional import numpy as np def load_json(path): with open(path) as f: training_sites = json.load(f) return { s: {'good_variant_ids': set(training_...
1cf446a73798b94b7d060bf648f6c8da4d1d03944d7a6a2230d9443a08e91a12
Python
5,902
127
# Modified from https://github.com/open-mmlab/mmdetection/blob/main/mmdet/utils/setup_env.py # noqa: E501 import datetime import logging import os import platform import warnings import cv2 import torch.multiprocessing as mp from mmengine import DefaultScope from mmengine.logging import print_log from mmengine.utils ...
6e1f9d4a6fd5a2816753bb4e8fa3e8aae53c0b157bb3dfc53cd9a77a267c87a4
Python
5,903
154
import sys import torch sys.path.append("../utils") class GAT(torch.nn.Module): def __init__(self, node_dim, n_head, pair_dim): super().__init__() self.node_dim = node_dim self.n_head = n_head self.head_dim = node_dim // n_head # * to alpha self.query = torch.nn...
d09894c4f3dc348c9326b3c7e5b7c76d656089d1433105aa654aa65477c4f1d2
Python
5,904
166
# compare SOTA algorithms from sklearn.naive_bayes import GaussianNB from sklearn.ensemble import RandomForestClassifier from sklearn.linear_model import RidgeClassifier from sklearn.neighbors import KNeighborsClassifier from sklearn.linear_model import LogisticRegression from sklearn.neural_network import MLPClassifi...
6cb4917516550272ac6004d05afe686dba85d5318841d35091361ee1a71d2e78
Python
5,905
139
# -*- coding: utf-8 -*- import numpy as np import numpy.random import keras import csv import keras.layers from sak.disambiguator import select_kernel_initializer from sak.modules import StemModule from sak.modules import AtrousMiddleModule from sak.modules import LevelModule from sak.modules import PoolingModule from...
153a8764282f01e1c9b09cc2f38c2be2b7416d01f4b8e3b79e6ba02dffbc6fb8
Python
5,908
197
from functools import partial import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable def conv3x3x3(in_planes, out_planes, stride=1, dilation=1): # 3x3x3 convolution with padding return nn.Conv3d( in_planes, out_planes, kernel_size=3, ...
dd17972a14bd1048c30266890464d0a6306098630b9d23e42ac55b4b6f63b114
Python
5,913
193
import numpy as np from data_assimilation.forward_model import BaseForwardModel from data_assimilation.model_error import BaseModelError from data_assimilation.observation_operator import BaseObservationOperator import pdb import matplotlib.pyplot as plt class ModelError(BaseModelError): def __init__(self, params...
d5948bfceb1799009f9283a6d037471834a098b606b8be961c4f14730dbeb267
Python
5,914
167
# Copyright (c) 2017-present, Facebook, Inc. # # 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...
9583eb2ddfe8153c2caa7a306bda70f58413b139e549d79d9015eb6b4369abb6
Python
5,917
181
from collections import defaultdict from functools import lru_cache import boto3 from boto3.exceptions import ResourceNotExistsError from boto3.resources.base import ServiceResource from botocore.client import BaseClient from botocore.config import Config from ray.autoscaler._private.cli_logger import cf, cli_logger ...
a3daec32838e2074ac023ff2fec6d24207c751b014dad90aaecb399a9a5d0399
Python
5,917
167
import basetest_dqn_like as base import numpy as np import pytest import torch # IQN does not support the actor-learner interface for now # from basetest_training import _TestActorLearnerTrainingMixin from basetest_training import _TestBatchTrainingMixin from torch import nn import pfrl from pfrl.agents import iqn fr...
3ad0cccef5c17a0c9e61bb9d5a8be79c075634ebaedca37b3555b2ec6f041623
Python
5,918
114
import os import numpy as np from permutations_stats.permutations import friedman from scipy.stats import wilcoxon import pandas as pd import ivim root = '/path/to/root' input_root = os.path.join(root,'data') results_root = os.path.join(root,'results') subs = [sub for sub in os.listdir(results_root) if sub.startswith...
81722af8e3a4e48b4d89da6d71abcf12b8bdab7d27837987118dea73d9154cdd
Python
5,918
151
import unittest import numpy as np from neuron_morphology.morphology import Morphology from neuron_morphology.morphology_builder import MorphologyBuilder from neuron_morphology.feature_extractor.data import Data from neuron_morphology.feature_extractor.feature_extractor import FeatureExtractor from neuron_morphology...
844556cb1af33bbd02200ef5ee28f3cb4e6d9ad9b88e5fc13e194ef01d3a5200
Python
5,920
179
import tempfile import unittest from unittest import mock import pytest import pfrl class TestTrainAgent(unittest.TestCase): def test(self): outdir = tempfile.mkdtemp() agent = mock.Mock() env = mock.Mock() # Reaches the terminal state after five actions env.reset.side_...
fdcdea7904da713e32e392e09638e58011897a3269b6e5024de0a75be37ce0cb
Python
5,922
151
import torch from torch import nn from math import sqrt def call_reinit(m, i, o): m.reinit() def log_features(m, i, o): with torch.no_grad(): if m.decay_rate == 0: m.features = i[0] else: if m.features is None: m.features = (1 - m.decay_rate) * i[0] ...
1866b45427121d5dc99a39450583abaa8dcb2c5d6944cff10a8cfdff7d175ce4
Python
5,925
132
import pandas as pd import numpy as np import matplotlib.pyplot as plt def extract_patient_info(version, output_dir): cols = {} # column names cols["pd_features"] = ["PATNO", "SXMO","SXYEAR", "PDDXDT", "INFODT", "EVENT_ID"] # first symptom onset month, year, diagnosis date, SC event date # Subject Characte...
664d77e4fca9943e6e3ab777e8c585e3377e8d588e771362b83d1844a57a017a
Python
5,926
142
import os import numpy as np from scipy import ndimage import glob import pydicom # https://pydicom.github.io/ import dicom_numpy # https://dicom-numpy.readthedocs.io/en/latest/ import numpy as np import nibabel as nib # https://nipy.org/nibabel/ import pandas as pd import datetime from config import config from ut...
91804bbf279ff722559eddf6bbdebcfb7d0e52b81922b1c57272495e92d60649
Python
5,927
205
import importlib import torch import numpy as np from collections import abc from einops import rearrange from functools import partial import multiprocessing as mp from threading import Thread from queue import Queue from inspect import isfunction from PIL import Image, ImageDraw, ImageFont def log_txt_as_img(wh,...
fdf92bbb0e5250a2d2f0f220fb2a477c822c24e733645f30fac14b5ac31c2879
Python
5,928
150
# coding=utf-8 # Copyright 2023 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 by applicable...
4a13e6556789805ae8753a58ff32591943441edb14d549e480fe40aa35d09df0
Python
5,929
90
proj_dir = "/path/to/main_project_folder/" # edit this line import numpy as np import pandas as pd import xarray as xr import dask.array as da import glob as glob from functools import partial import os import sys sys.path.append(proj_dir) from project_fxns import load_region from project_fxns import fxns import impor...
59cbcca5cb2dcc26e7b93c94e09e2632048044508fcd8b47e1f47e9c82388660
Python
5,929
155
import numpy as np import torch import torchvision import torch.nn as nn from collections import OrderedDict from torch.autograd import Variable from utils.prune_utils import ConvLayerRotation, LinearLayerRotation def print_model_param_nums(model=None): if model == None: model = torchvision.models.alexne...
d14ba377060e1fa3068986b84a2410d12010569cfdc154264a614f9edc6bc31f
Python
5,929
126
import os import numpy as np from basicsr.data.data_util import paired_paths_from_folder, paired_paths_from_lmdb from basicsr.data.transforms import augment, paired_random_crop from basicsr.utils import FileClient, imfrombytes, img2tensor from basicsr.utils.registry import DATASET_REGISTRY from torch.utils import data ...
7224865f105ad184641fe382f54439bee598fae79591ca8e7903c96d1d9fe87b
Python
5,934
145
import numpy as np import struct from spinnaker2.neuron_models.application import BaseApplication from spinnaker2.configuration import PEConfig from spinnaker2.neuron_models.common import (add_log_memory_region, collect_routing_targets, format_routing_targets) from spinnaker2.coordinates import ByteAddr, align...
c5263ab0c89ee2628f9038ed6a87bb8352d6b2a599959f0ac185cf38343d012c
Python
5,936
179
r""" The role of mozaik is to coordinate the workings of number of tools to provide a consistent workflow experience for the user. Consequently the root mozaik package is very light, and majority of functionality is in the number of subpackages each addressing different parts of the workflow. In future the number of ...
8a49eb8e55de63aaaf880fb60ce09b929b2de395e200e0a131b1430445df8a71
Python
5,937
174
#%% load data and compute metrics import seaborn as sns import matplotlib.pyplot as plt import pandas as pd import numpy as np from statannotations.Annotator import Annotator from scipy.stats import ks_2samp from matplotlib import rc, rcParams from sklearn.metrics import accuracy_score, roc_auc_score, average_precision...
e860b4b4220c00a65eaddac426c351a7a8ab5411c0767d80b35faac9bb8455db
Python
5,939
149
import csv from typing import List, Optional, Union import torch from tqdm import tqdm from GR_pKa.args import PredictArgs, TrainArgs from GR_pKa.data import get_data, get_data_from_smiles, MoleculeDataLoader, MoleculeDataset from GR_pKa.utils import load_args, load_checkpoint, makedirs, timeit, load_scalers, update_...
59a7e2439625dd9db1d1e507f537b68520eb7a23c05254f4d8950294aea81f33
Python
5,940
177
"""This file is a fork from ChainerCV, an MIT-licensed project, https://github.com/chainer/chainercv/blob/master/chainercv/utils/download.py """ import hashlib import os import posixpath import shutil import sys import tempfile import time import urllib import zipfile import filelock _models_root = os.environ.get( ...
7b8bb1ef29dd622cb4bd1b0eb6cf6f52ae0e8f149ec4200d79bbd32b72af4393
Python
5,941
140
import exputils as eu import numpy as np import rlexp.utils as utils import torch class DND_SF(torch.nn.Module): """ Implementation of a differentiable neural dictionary as introduced in Neural Episodic Control (Pritzel et. al, 2017) with values being successor features (SF) """ @staticmethod ...
ea4bcadd707ba609f8a20da23c79874446d8357116318c416fe65d154c0b3cc2
Python
5,943
186
# In[] import numpy as np import os import numpy as np import tensorflow as tf import keras from keras import backend as K import matplotlib.pyplot as plt import pickle # In[] # In[] import os folder= "/media/sam/internal_2/behavior/dualNet/v051122_STAGE3_deepScreen/" folder_restrict= "/media/sam/internal_2/behavio...
7e28747f9a437dca27ab29febd0d99253deaf99731233aabbd27b69b2f7f4bfd
Python
5,944
183
import numpy as np from scipy.optimize import minimize_scalar from scipy.special import gammaln from hic3defdr.util.scaled_nb import inverse_mvr, equalize from hic3defdr.util.binning import equal_bin from hic3defdr.util.lowess import lowess_fit def qcml(data, f=None, max_iter=10, tol=1e-4): """ Estimates the...
41032e0552a280e9337724a8f7f5ec1fde8513bf7b403f039181b0deeb960ac9
Python
5,945
131
import numpy as np from sklearn.metrics import zero_one_loss from reval.utils import kuhn_munkres_algorithm import logging logging.basicConfig(format='%(asctime)s, %(levelname)s %(message)s', datefmt='%H:%M:%S', level=logging.INFO) class RelativeValidation: """ This cl...
67dfb9ed123bf7c57e44eecf007359138ba3fe2543f16ebb999096087fde0116
Python
5,946
142
"""Thin wrapper around ``doubletfinder-py`` for omicverse's QC pipeline. Exposes a single ``doubletfinder(adata, ...)`` function used by ``ov.pp.qc`` with ``doublets_method="doubletfinder"``. Writes two columns to ``adata.obs``: * ``predicted_doublet`` — bool, for downstream compatibility with the scrublet ...
37021554416dcc01a21c22bdb946ec88379555c5e170d3f0289570596a256627
Python
5,947
148
# ------------------------------------------------------------------------------------------------------------------------------------- # Following code curated for Bio-Diffusion (https://github.com/BioinfoMachineLearning/bio-diffusion): # --------------------------------------------------------------------------------...
68c9dd4c57ebdee674d3344bcdbbdd6be4ed67d5da763084d57b5f931ef3a90f
Python
5,947
172
import tensorflow as tf from utils.nn import linearND, linear from mol_graph import atom_fdim as adim, bond_fdim as bdim, max_nb, smiles2graph from models import * import math, sys, random from optparse import OptionParser import threading parser = OptionParser() parser.add_option("-t", "--train", dest="train_path") p...
7a38ec2601aa4c59f155ed8106c6521398dc8051337f9bb6bb99c37074cbc7bc
Python
5,947
150
# Copyright 2023 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
f98825678cd5f628d4dd67836370f18d8290087ecf6dc71a107f0dc9703ea0ea
Python
5,947
141
import scipy.io as sio import os import numpy as np import h5py import sys # from skimage import filters from scipy.ndimage import gaussian_filter from scipy import sparse from IoU_2 import IoU_2 import multiprocessing as mp sys.path.insert(1, '../SUNS2') # the path containing "suns" folder from suns.PreProcessing.pre...
d5f5596238b745d66029887105cd4b5c52a1b3c4180caf6745aa98b15690e3fd
Python
5,950
177
#!/usr/bin/env python # -*- coding: utf-8 -*- # """ """ import sys import datetime import numpy as np import scipy.stats as ss import pandas as pd import svtk.utils as svu class PESRTest: def __init__(self, medians=None, common=False): self.medians = medians self.common = common def test(s...
af627ef820d9df0180694016330fd7f59bf8ae85a0a3edece04d40bc6c15c520
Python
5,951
167
import os import pickle import sys import numpy as np # with open("./spliceai_result_"+SPLICEAI_VERSION+"/"+output_file+"/d_scores_"+TYPE+".pkl", 'rb') as fw: # pickle.dump(donor_scores, fw) # with open("./spliceai_result_"+SPLICEAI_VERSION+"/"+output_file+"/a_scores_"+TYPE+".pkl", 'rb') as fw: # pickle.dump(...
ee3088099395eeaa039e862c06f7021be8c07a3d9482cfb19c8656e6f5d5c321
Python
5,952
106
from tkinter import * """ Specifes CLEAR'S user input parameters. CLEAR sets the input parameters as global variables whose values are NOT changed in any other module (these are CLEAR's only global variables). Tkinter is used to provide some checks on the user's inputs. The file 'Input Parameters for CLEAR.pdf' ...
03c210b807722b7655f8273de96f3617ce389e9eb1170a5af5a87f476ea210b1
Python
5,953
178
import pytest import ray from ray.air.execution.resources.fixed import FixedResourceManager from ray.air.execution.resources.request import ResourceRequest from ray.util.scheduling_strategies import PlacementGroupSchedulingStrategy REQUEST_2_CPU = ResourceRequest([{"CPU": 2}]) REQUEST_4_CPU = ResourceRequest([{"CPU":...
dc39aa5aea55bafd878d33475a15efb7cbfc67a09bfb31b69349b9b32dc46ab4
Python
5,954
123
""" From https://github.com/ehoogeboom/e3_diffusion_for_molecules/ """ import torch import os import src.datamodules.components.edm.build_geom_dataset as build_geom_dataset from omegaconf import DictConfig from functools import partial from torch.utils.data.dataloader import DataLoader as TorchDataLoader from torch...
6f154d27785b13a7cb5fcbabcb3bd227442994d78f883cc977e3756e42ea7519
Python
5,955
156
""" Compare behavioral vs. neural dprimes """ import os rdir = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) import sys sys.path.append(rdir) from helpers.path_helpers import local_results_file from settings import RESULTS_DIR import scipy.stats as ss import pandas as pd import numpy as np import matplot...
78dc1f306aff461d157b4358cd473a051464cf1983189f36c92d70b0c9402806
Python
5,956
169
# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
6752609753abe71857e99dafb7d64556886b9f9b5e60f16549e38373c74fa894
Python
5,957
237
#!/usr/bin/env python3 # SPDX-License-Identifier: BSD-2-Clause # Copyright (c) 2018 Jakub Červený def gilbert3d(width, height, depth): """ Generalized Hilbert ('Gilbert') space-filling curve for arbitrary-sized 3D rectangular grids. Generates discrete 3D coordinates to fill a cuboid of size (width x h...
9111038d1271a67236b6b7151a29af403a77828598b73d9997b26a7e28dacb56
Python
5,957
181
# -*- encoding: utf-8 -*- from __future__ import division, print_function import numpy as np from .core import algo from . import utils class SegModel(object): def __init__(self, S, edgemask=None): self.edgemask = edgemask if edgemask is not None and np.any(edgemask): self.score_matri...
b2d926304f72c493e3fb94f2aec89352cc7eef53e83bc04e81b7e3c0d0015ff2
Python
5,958
157
from neuron_morphology.validation.result import NodeValidationError as ve from neuron_morphology.constants import * valid_types = {SOMA, AXON, BASAL_DENDRITE, APICAL_DENDRITE} def validate_count_node_parent(morphology, node_type, parent_type, expected_count): """ This function validates the number of nodes that...
c4c486c5939d0d89923316610d085184f514352804862585ca8f03626cd5c7ab
Python
5,959
139
import numpy as np from sklearn.metrics import cohen_kappa_score from statsmodels.stats.inter_rater import fleiss_kappa if __name__ == "__main__": las = ["NF", "FR", "FNR", "FRN", "FRN", "NF", "NF", "NF", "NF", "NF", "NF", "NF", "NF", "NF", "FR", "FR", "FNR", "FNR", "NF", "NF", "FR", "NF", "NF", "FNR", "...
3311c7faba9ead2c75fe87be85fc3679f62aed4cab3f3e3dbef794a424b7ac2b
Python
5,960
189
# Copyright 2023 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
6fefabb4d0198c8002535b3feeb080b31f78dc49718bc742192bb63516fdd32c
Python
5,962
112
import argparse import cloudpickle import json import os import numpy as np import tensorflow as tf from experiments.utils.data_partitioning import DataPartitioning from experiments.keras.models.fashion_mnist_fc import FashionMnistModel from projectmetis.python.driver.driver_session import DriverSession from projectm...
ee9a26a42f9ce5412e6f03496a134b416d2e1ab2fa419100532bc123b45082b9
Python
5,963
183
# # CEBRA: Consistent EmBeddings of high-dimensional Recordings using Auxiliary variables # © Mackenzie W. Mathis & Steffen Schneider (v0.4.0+) # Source code: # https://github.com/AdaptiveMotorControlLab/CEBRA # # Please see LICENSE.md for the full license document: # https://github.com/AdaptiveMotorControlLab/CEBRA/bl...
dff7acdc364493838a16624fd4fb8e826a01c815e2decfea4be03156660efcc3
Python
5,964
173
import matplotlib.pyplot as plt from matplotlib.animation import FuncAnimation, PillowWriter import numpy as np def get_init_theta(): return np.array([0.9, 0.9]) def Q_batch(theta): """Returns the true function value for a batch of parameters with size (B, 2)""" return 1.2 - (3 / 4 * theta[:, 0] ** 2 + ...
b9866cadb1c94e5229e007fb12d3b132c5ac7124a77bbfa433d488acab27e017
Python
5,968
178
''' Averages runs with the same stimulation protocol to boost SNR. ''' import os import glob import nibabel as nb import numpy as np import sys sys.path.append('./code/misc') from computeT1w import * DATADIR = '/Users/sebastiandresbach/data/neurovascularCouplingVASO/Nifti' SUBS = ['sub-07'] SESSIONS = ['ses-01',...
dca1414753af9b571d1bf21951e532be9afb3b8e8bd7cb2f87f9fefefd59fe57
Python
5,973
220
hier_struct = { "exercising": { "performing_cardio_exercises": [ "jump_rope", "perform_jumping_jacks", "do_stair_steps" ], "performing_resistance_exercises": [ "bicep_curls", "shoulder_press", "push_ups", "si...
2f5d187fc111ce541659a1d42477e3ba252c72a2749db8a4d8e020f7c25ea687
Python
5,974
201
import numpy as np from data_assimilation.numpy.forward_model import BaseForwardModel from data_assimilation.numpy.model_error import BaseModelError from data_assimilation.numpy.observation_operator import BaseObservationOperator import pdb import matplotlib.pyplot as plt class ModelError(BaseModelError): def __i...
102f3166868fd834b2009c81389b2cd4b578710e543d4a201214a02b82e75260
Python
5,976
151
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.utils import spectral_norm from torch.optim import Adam import math import numpy as np from utils import * from lookahead import Lookahead class ProteinInteractionNet(nn.Module): def __init__(self, protein_dim, hid_dim, dropout, g...
3575074272c61d09c11b2e369d4af6df517dce782f2774415caaa1f3fe98de1d
Python
5,981
137
import tensorflow as tf import pandas as pd import matplotlib.pyplot as plt from sklearn.metrics import precision_recall_curve, average_precision_score, auc import numpy as np def main(): spliceai_versions = ['1', '2', '3', '4', '5'] spliceai_input_dir = '/ccb/cybertron/khchao/splam-analysis-results/train/resu...
249606d61dd4c052e04ece62b14e810722e1bf7dec682480c0ea473ca6ff1302
Python
5,982
208
# -*- coding: utf-8 -*- # (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. #...
42888693f458106c7a1ff84fdddd06af367583bc730f06c952f9feadd1cd0150
Python
5,984
124
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
4b2c9476caaa52d9116bdee87e7e510f0049bf8df12ea8e2167a3c66fe0bcc7f
Python
5,984
189
from typing import Any, Dict, List from data_profiling.config import Settings from data_profiling.report.formatters import fmt, fmt_bytesize, fmt_percent from data_profiling.report.presentation.core import ( Container, FrequencyTable, Image, Table, ) from data_profiling.report.presentation.core.variabl...
7ce1b8334a490911eb04f4fb79d3dc007ecbdfc5d09dad32da7e7af8b80b8722
Python
5,986
129
import numpy as np import argparse import pickle from typing import List from lib.data_utils.dynamic_data_util import JitteredMovieBatchDataloader from lib.dataset_config_parser.dataset_config_parser import read_config_file import lib.dataset_config_parser.dataset_config_parser as dcp import lib.data_utils.dynamic_da...
82a8262990b463e08f403956928b498652948e75f6722345b395a538be4b1377
Python
5,986
184
''' Home page w/ interactive TWAS table. Nhung, Jan 2024 ''' import numpy as np import pandas as pd import os import dash from dash import Dash, callback, Input, Output from dash import html, dcc from dash import dash_table import dash_bootstrap_components as dbc ################################################...
2bf92fdf1a2cf9bd4f95bb64a8d7c17e8e258e290360009f52bead4703433311
Python
5,990
193
from utils.grid_funcs import ( gridpop_clustering, gridpop_repsupp, gridpop_conj, gen_offsets, traj_star, traj_star_delay ) from utils.utils import get_hexsym, get_pathsym, convert_to_rhombus import numpy as np import pickle import os import settings data = { "path": {}, "conj": {}, ...
58af6b7c9187e4edd6d9dc5454f37190be558dadd3f7fd071b8f6bb8e38512a8
Python
5,991
165
import numpy as np import tensorflow as tf # from official.common import flags as tfm_flags from official.vision.beta.projects.movinet.modeling import movinet, movinet_model learning_rate = 0.0001 hidden_units = 256 dropout_rate = 0.5 temperature = 0.05 class DDGenerator: def __init__(self, input_dd, output_dd,...
064fdbdd7ed01c8cda1db59826fbb386974fc1d79324f129f3244756d512b135
Python
5,993
149
import os import re import subprocess import sys from pathlib import Path from setuptools import Extension, setup from setuptools.command.build_ext import build_ext VERSION = "1.0.10" # Convert distutils Windows platform specifiers to CMake -A arguments PLAT_TO_CMAKE = { "win32": "Win32", "win-amd64": "x64",...
1c584cda9da33e22b48c5137613a28c6fccb0db7e500cc38f90ee395d4756bbc
Python
5,993
148
import tensorflow as tf from utils.nn import linearND, linear from mol_graph import atom_fdim as adim, bond_fdim as bdim, max_nb, smiles2graph_list as _s2g from models import * from ioutils import * import math, sys, random from collections import Counter from optparse import OptionParser from functools import partial ...
980d0ae98c66007c038a30e44e89882aba311bd34b05560a021503c6bb6347b8
Python
5,994
195
# built-in dependencies from typing import List, Optional, Union, cast # 3rd party dependencies import torch from torch import nn, Tensor # project dependencies from deepface.commons import weight_utils from deepface.models.facial_recognition.pytorch.TorchFacialRecognition import ( TorchFacialRecognition, loa...
9df4b7df48633dfc11651c79b3a9a29c8eb916d0ea84a1007502edb4d6b6de5f
Python
5,995
169
# built-in dependencies from typing import List, Union, cast, Any # 3rd party dependencies from numpy.typing import NDArray # project dependencies from deepface.commons import package_utils, weight_utils from deepface.modules import verification from deepface.models.FacialRecognition import FacialRecognition from dee...
7e05d7cc0669c427d48fd0a37ee63465b75111fefd7db5bd31ebd32aed0f55ca
Python
5,997
191
import numpy as np import matplotlib.pyplot as plt import torch.nn as nn import torch.optim as optim import torch import pdb from torch.nn.utils import spectral_norm import time import math import torch.nn.functional as F class PositionalEmbedding(nn.Module): def __init__(self, embed_dim, max_len=1000): ...
20a1c7dc7dee167103d998d63f976a6d9fa3ce13240c4522689a1279b1a47016
Python
5,998
231
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Nov 1 16:29:42 2023 @author: Saad Idrees idrees.sa@gmail.com jZ Lab, York University """ # %% primate cones def fr_cones_fixed(): pr_params = {} pr_params['sigma'] = 2.2 pr_params['sigma_scaleFac'] = 10. pr_params['sigma_train...
969bc41206cef481545cb3012405caa0293e29dcb92e440d06b85b69991217b4
Python
5,998
153
import numpy as np import scipy import time import warnings warnings.filterwarnings('ignore') import pandas as pd import numpy as np import pickle import os import argparse from glmsingle.glmsingle import GLM_single import nibabel as nib #compute glm using glmsingle # https://github.com/cvnlab/GLMsingle def interpola...
8e4674d26645c1665cd1ee945a20126f2d7aec91c93396cd30f3cd1fbf6ab39f
Python
5,999
131
import matplotlib.pyplot as plt import numpy as np import os import numpy as np import statsmodels.api as sm import matplotlib.pyplot as plt import json import ivim root = '/path/to/root' input_root = os.path.join(root,'data') results_root = os.path.join(root,'results') subs = [sub for sub in os.listdir(results_root...
23f41999a48c7e76aa875bede183fefb3012f0c7d5ed075a673f4699f077c72c
Python
6,000
143
import numpy as np from matplotlib import pyplot as plt import os import shutil from tqdm import tqdm import argparse import time def str2bool(v): if isinstance(v, bool): return v if v.lower() in ('yes', 'true', 't', 'y', '1'): return True elif v.lower() in ('no', 'false', 'f', 'n', '0'): ...
f3703a482ee212505e946001f55f6025c4268f02813f24d7ee925ed45b907cc0
Python
6,001
116
__author__ = "Simon Andermatt" __copyright__ = "Copyright (C) 2017 Simon Andermatt" import logging from copy import deepcopy from mdgru.helper import compile_arguments, generate_defaults_info from mdgru.model_pytorch.crnn import CRNNCell import torch as th from torch.nn.parameter import Parameter from torch.nn import ...
c198c316d9e08430873176ad9e81a3246f91189acacfad234969592443fbc081
Python
6,003
149
import tensorflow as tf from utils.nn import linearND, linear from mol_graph import atom_fdim as adim, bond_fdim as bdim, max_nb, smiles2graph_list as _s2g from models import * from ioutils import * import math, sys, random from collections import Counter from optparse import OptionParser from functools import partial ...