sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
a9275fdd8c78d287c24959d9a16867718fb4ddbdbbb30186d3a20b7408a6bc30 | Python | 4,231 | 131 | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import copy
import os
import os.path as osp
import time
import warnings
import yaml
import shutil
import torch
import torch.distributed as dist
from utils.parallel import get_dist_info, init_dist, setup_multi_processes
from apis import init_random_seed... |
4b45c07c6bff60f209329705778e8e0be83a391471cca7b63dc9972777ef07c7 | Python | 4,235 | 139 | import numpy
from packaging.version import Version
from cellprofiler_core import __version__ as core_version
IMAGE_NUMBER = "ImageNumber"
GROUP_NUMBER = "Group_Number"
GROUP_INDEX = "Group_Index"
GROUP_LENGTH = "Group_Length"
CURRENT = "Current"
NUMBER_OF_IMAGE_SETS = "NumberOfImageSets"
NUMBER_OF_MODULES = "NumberOf... |
552562c25f0a2a0aa775d3ed9ad60541c4f6ead62430692dbf8de0ad4b5a2f09 | Python | 4,235 | 89 | import argparse
import torch
import torch.backends.cudnn as cudnn
from torchvision import models
from data_aug.contrastive_learning_dataset import ContrastiveLearningDataset
from models.resnet_simclr import ResNetSimCLR
from simclr import SimCLR
model_names = sorted(name for name in models.__dict__
... |
b4bbd06bb22bb233aa3b6ed6eeb2c5f06bfa6ba806252e2ab12abdd80a8262e5 | Python | 4,235 | 144 | """
Top-level trial data bandpower statistics
Authored by Eric Easthope
"""
import os
import gc
import numpy as np
from pathlib import Path
from utils import log_scale_bands
subjects = ["EC2", "EC9", "GP31", "GP33"]
SUBBANDS = (
log_scale_bands(12, 35, 2)
+ log_scale_bands(35, 70, 2)
+ log_scale_bands(70... |
bb730796b9ab0e18e75424ea859339f92e40c8477e0ddb43f704a22b968b1237 | Python | 4,239 | 108 | from sigma.GraphData import *
from sigma.model import *
import pandas as pd
from pandas import DataFrame
def Model_prediction(ifile,ParameterPath,mfileh5,ofile,Isevaluate = 0):
'''
* Predict
*
* Attributes
* ----------
* ifile : File path for storing the data of smiles and adduct
* ... |
d4220d43999c6e9e50aa220e4af340f1c01a1b62d536e1400d109dbc3f036315 | Python | 4,241 | 96 | import json
import logging
import os
import random
# import coordinate_conversion as cc
import numpy as np
import torch
import torch.utils.data as tu_data
class DataGenerator:
def __init__(self, data_path, minibatch_len, interval=1, use_preset_data_ranges=False,
train=True, test=True, dev=True, tr... |
77a4c595d5f6da1004d76eaf02d103d8fe6ecfcb9cc8ae81d5def842c6ebc403 | Python | 4,249 | 122 | import pickle
import numpy as np
from ..signals import shift_mask
from ..utils.time import get_dt
class SRM:
def __init__(self, vr=None, kappa=None, eta=None, vt=None, dv=None, gamma=None):
self.vr = vr
self.kappa = kappa
self.eta = eta
self.vt = vt
self.dv = dv
s... |
055a618380446caeeb881689a06ef4bf9aa111a19347e09c0eb00da908b03c93 | Python | 4,251 | 131 | """
Module the implements functionality to compute oversegmentation metrics given
an input segmentation and a ground truth segmentation
- number of small segments in other segmentation
- ratio of number of segments in ground truth vs number of segments in other segmentation
- segment split: number of segments in othe... |
a06b7baa17ee09f7f71722b71a0483257b1cc0d95fd88cb983ce6154dab71895 | Python | 4,253 | 164 | import pandas as pd
from rdkit import Chem
from rdkit import DataStructs
import matplotlib.pyplot as plt
from rdkit.Chem import RDKFingerprint
import numpy as np
from tqdm import tqdm
import os
from multiprocessing import Pool, cpu_count
import math
import time
import itertools
import datetime
from rdkit.Chem import ... |
b0a28af75a2fe53d4eb9869e8ef5fcaccfd493eda081b9003d18e2ddcb8bdd23 | Python | 4,259 | 109 | import gc
import threading
import uuid
from ._runner import Runner
from ..measurement import Measurements
class Analysis:
"""An Analysis is the application of a particular pipeline of modules to a
set of images to produce measurements.
Multiprocessing for analyses is handled by multiple layers of thread... |
20f636e28a5e735fa026645d444ce89bd3d991492c3b9de664380e4b7bacc3a1 | Python | 4,260 | 149 | #@ ImagePlus imp
#@ Integer(label="Peak tolerance",value=50) tolerance
#@ Integer(label="Window radius", value=7) window_radius
#@ Integer(label="Pixel size in nm", value=20) pixel_size_nm
#@ File(label="Select output directory", style="directory") out_dir
# author: Christoph Sommer, christoph.sommer@ist.ac.at
import ... |
d1df96ce277adeb2ecac1884ec5e4fdfb8ee595e46e626778e0edd26fe6fb47a | Python | 4,264 | 152 | #!/usr/bin/env python3
import os
import random
import sys
import tempfile
import time
from itertools import product
import numpy as np
import pandas as pd
from nilearn import image, maskers, masking
sys.path.append(os.path.join("..", ".."))
from datalad_helpers import HCPAging
######################################... |
dd0ea6fdb50fed2d4b7fd3d64f04af488444d0c9a8f58049b7fd862c140239ae | Python | 4,264 | 117 | # -*- coding: utf-8 -*-
# (C) Copyright 2020, 2021, 2022, 2023 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.
#
# Any... |
34cb49d3e41545c037e0e85f58e588e7a0ee18c00b647751c6f6b669aa9b5c5f | Python | 4,267 | 131 | from __future__ import annotations
import json
import os
import subprocess
import sys
from pathlib import Path
import pytest
import yaml
ROOT = Path(__file__).resolve().parents[3]
WORKFLOW = yaml.safe_load((ROOT / ".github/workflows/publish-registry.yml").read_text())
ATTACH = next(
step["run"]
for step in W... |
eb9c381b7a76d82c78618356f9bc16f21ac3f026516fe20f24d79cb253e57626 | Python | 4,267 | 150 | # -*- coding: utf-8 -*-
import numpy as np
import pytest
from numpy.testing import assert_array_almost_equal
from pysteps.verification import det_cont_fct
# CREATE A DATASET TO MATCH
# EXAMPLES IN
# http://www.cawcr.gov.au/projects/verification/
obs_data = np.asarray(
[7, 10, 9, 15, 22, 13, 17, 17, 19, 23.0, 0,... |
5ea5566fa417ced7a87a39313e63666acb1d4e9eb1d222ab2f99875c48ce5940 | Python | 4,268 | 105 | """ Gather-Excite Attention Block
Paper: `Gather-Excite: Exploiting Feature Context in CNNs` - https://arxiv.org/abs/1810.12348
Official code here, but it's only partial impl in Caffe: https://github.com/hujie-frank/GENet
I've tried to support all of the extent both w/ and w/o params. I don't believe I've seen anoth... |
cc223ff49377790223e0823da2e5b6738cbfcb43244fbb6d4ea1d3ea099fe438 | Python | 4,270 | 122 | import os
import sys
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from neuron import h
import Functions.globalFunctions.morphology_v2 as mphv2
import Functions.support as sprt
from Model import Cells
h.nrn_load_dll("./Model/Mods/nrnmech.dll")
print("succes load nrnm... |
92ab3f3ae6ca3380a18b7800508a97578f6df8e8eda878e4122a86afe1f67c11 | Python | 4,273 | 114 | # coding=utf-8
# Copyright 2020 The SimCLR 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 applicable law or... |
7fd551a1d68b8128a3d9220b3b0bbadb57ed8d078fe29a54c952ca1e4cecba78 | Python | 4,279 | 98 | from torchvision.transforms import ColorJitter
from typing import Optional, Tuple, Union
from torchio.transforms.augmentation import RandomTransform
from torchio.transforms import IntensityTransform
from torchio import Subject
def colorjitter_transform(parameters):
return RandomColorJitter(
brightness=par... |
8a919e2873c86ccbe4c09d0da579d889ef104f11e91e2023e7d41cbab75fd550 | Python | 4,280 | 202 | import torch
from .default import NormalNN
from .regularization import SI, EWC, EWC_online
from .exp_replay import Naive_Rehearsal, GEM
from modules.criterions import BCEauto
def init_zero_weights(m):
with torch.no_grad():
if type(m) == torch.nn.Linear:
m.weight.zero_()
m.bias.zero_... |
67d18060865f16eee10f93be238c80af259d49ef6252fce03195b5f489996cd3 | Python | 4,284 | 127 | from enum import Enum
from typing import Optional
from deeprank.models.amino_acid import AminoAcid
class VariantClass(Enum):
BENIGN = 0
PATHOGENIC = 1
@staticmethod
def parse(s: str):
s = s.strip()
if s.upper() == "BENIGN":
return VariantClass.BENIGN
elif s.uppe... |
dd2c2c916a27456d4076e3dee826105ae714f1906491f254a44177e08d0d58fd | Python | 4,286 | 128 | # Import the different model architectures and functions
from .unet import unet, resunet
from .light_unet import light_unet, light_resunet
from .unet_multilayer import unet_multilayer, resunet_multilayer
from .light_unet_multilayer import light_unet_multilayer, light_resunet_multilayer
from .deep_unet import deep_unet,... |
2bad127479198796711ae2205add0bcdb90364651d0a671490425456e65fa16f | Python | 4,289 | 117 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_guideseq
----------------------------------
Tests for `guideseq` module.
"""
import yaml
import unittest
import os
import shutil
import utils
from guideseq import guideseq
TEST_SAMPLE_BARCODES = {'AGGCATGAGATCGC': 'mysample', 'GACTCCTGCGATAT': 'sample2'}
TEST_U... |
7b25717c8b8201878fda538ccaa503ad4d8f687077ae7cdd8d51afe9302d9986 | Python | 4,289 | 127 | #
# nate berry
# 2023-04-01
#
# ---------------------------------------------------------
# NOTES:
# - vizualizations for cross sample entropy
#
# ---------------------------------------------------------
# ---------------------------------------------------------
import pandas as pd
import matplotlib.pyplot as ... |
0db48405b1244bf287a660c2483dd3691e61b8e7eac860447acb8404801a39df | Python | 4,291 | 83 | # rvt.blend quick TEST
import rvt.default
import rvt.vis
import rvt.blend
import numpy as np
# test blend combination archeological (VAT), general
#####
# manual blending, custom raster numpy arrays
# if you create_layer and don't input image or image_path then if vis_method is correct it automatically
# calculates... |
215811b1e34f47e184d2b75d266cca176342a7bf19975a3774f4b18bddf5d476 | Python | 4,293 | 106 | # This file is part of pyunicorn.
# Copyright (C) 2008--2026 Jonathan F. Donges and pyunicorn authors
# URL: <https://www.pik-potsdam.de/members/donges/software-2/software>
# License: BSD (3-clause)
#
# Please acknowledge and cite the use of this software and its authors
# when results are used in publications or publi... |
58a5ada9e3359baa1616bd3171c100e891524b58c691b363ac0f6ea9a698915a | Python | 4,293 | 108 | import torch
import torch.nn as nn
import numpy as np
import torch.nn.functional as F
from ..repository.sparsemax import Entmax15
def initialize_glu(module, input_dim, output_dim):
gain_value = np.sqrt((input_dim + output_dim) / np.sqrt(input_dim))
torch.nn.init.xavier_normal_(module.weight, gain=gain_value)
... |
3f330652b8b35e0b171111a913efdc127a83b21f8d921e0e159da17003cb73e7 | Python | 4,298 | 107 | import numpy as np
from config import VESSEL_DIR
import SimpleITK as sitk
import os
import matplotlib.pyplot as plt
import pyqtgraph as pg
import pandas as pd
from matplotlib.colors import Normalize
from imageio import imread, imsave
def load_itk(filename):
''' Reads scan with coordinates frame Z,Y,X with origin ... |
e77ed586694a6aa6e890124a1a0447ce06d77ecc5d696db477541e37559ea946 | Python | 4,306 | 146 | """
Implementation of a Hodging-Huxley neuron
Relevant book chapters:
- http://neuronaldynamics.epfl.ch/online/Ch2.S2.html
"""
# This file is part of the exercise code repository accompanying
# the book: Neuronal Dynamics (see http://neuronaldynamics.epfl.ch)
# located at http://github.com/EPFL-LCN/neuronaldynamics-... |
9dbd792992310688a7ebb6834c672468bbeb3c725447f4e3db78cf4fcb82f9fa | Python | 4,308 | 133 | from __future__ import division
from six.moves import xrange
import numpy as np
import numpy_groupies as npg
import scipy.sparse as sp
from .clustering import normalized_cut
from .distortion import perm_adj
from .adjacency import points_to_adj
def coarsen_adj(adj,
points,
mass,
... |
74d10ca70900216b1b7d7fb013987b0ffc2bc45c7d77c88578f83477f75fbb7b | Python | 4,310 | 114 | import logging
from pathlib import Path
import numpy as np
import pandas as pd
import monai.metrics as mm
import torchio as tio
from breaststudies.utils import one_hot
from breaststudies.metrics import compute_surface_distances, compute_average_surface_distance
from breaststudies.data import BreastDatasetCreator,... |
554d74b2c1d3926c0d5e61e48d1d807223e5cbba3c5f7e4d62a940c27904e621 | Python | 4,311 | 120 | import sqlite3
import collections
from datetime import datetime, timedelta
import numpy as np
import matplotlib.pyplot as plt
plt.style.use('ggplot')
def get_engine_data():
"""Main"""
path = '../.ipython/profile_ipyparallel.362991/tasks.db'
#path = '/gpfs/bbp.cscs.ch/home/migliore/singlecell-optimizatio... |
e1e1610fb8410721767722d0bc0408ca58a6caff2aed645d8b6287c3a57700df | Python | 4,312 | 141 | import numpy as np
def _printif(string, cond): return print(string) if cond else None
class FLANgrid(object):
def __init__(self, sparse=None, index=None, value=None, shape=None):
"""Flat Array sparse matrix.
Args:
sparse (bool, optional): Sparse or Not
index (list(int),... |
fd98c656242b1abb4e4582a209defc00e7f4ec0610f71b36fecbbc77354c921b | Python | 4,316 | 161 | """
GUI for tiled processing with RVT_py
Created on 6 May 2024
@author: Nejc Čož, ZRC SAZU, Novi trg 2, 1000 Ljubljana, Slovenia
"""
from tkinter import Tk, filedialog
import ipywidgets as widgets
import traitlets
from IPython.display import display
from tiled_multiprocess import run_main
class SelectFilesButton(wi... |
40d2657579597703ec8a9bdda0f7957f8ee68c656b7dd523b507ce92bd4d0600 | Python | 4,317 | 155 | '''
frequently used functions for Barbosa, Stein et al. (Nat Neuro, 2020)
created by H Stein, Mar 2020
'''
import numpy as np
import scipy as sp
import scipy.stats as sps
import scipy.signal as spsi
import scipy.ndimage as spnd
import matplotlib.pyplot as plt
import math
import cmath
import pdb
#####################... |
e13eed45b7fc11cf5977cd2bae5b3c5a97f18e2b49d537e9603b8f8863303dc0 | Python | 4,331 | 134 | from __future__ import annotations
import json
from pathlib import Path
import pytest
from datamonger import BUNDLED_REGISTRY, DataInfo, Registry, _api, data_info, list_data
from datamonger.errors import UnknownDatasetError
def bundled_index() -> dict[str, object]:
return json.loads(
(
Path... |
e3aa77d9690553bbd38132ad2496eac71d96ff98b77ad6776c6ee42f5856a21a | Python | 4,331 | 124 | import os.path
import pytest
from click.testing import CliRunner
from GANDLF.entrypoints.anonymizer import new_way, old_way
from . import CliCase, run_test_case, TmpDire, TmpFile, TmpNoEx
# This function is a place where a real logic is executed.
# For tests, we replace it with mock up, and check if this fu... |
f88d662d543d80f05f6df37015d55695b2412d809378b2add2c7bced64fb72dd | Python | 4,340 | 120 | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
import mmcv
import numpy as np
import torch
from mmcv.parallel import collate, scatter
from mmcv.runner import load_checkpoint
from mmcls.datasets.pipelines import Compose
from mmcls.models import build_classifier
def init_model(config, checkpoint=None... |
aa7199a2d879d437ca344f53e6783b931edcd1acfb9f96d5d1cfa66a574a60b4 | Python | 4,344 | 137 | import os
import json
import argparse
import datetime
import pickle
import numpy as np
from sklearn.model_selection import train_test_split
from model import *
from betaVAE import *
from read_data import *
from utils import *
parser = argparse.ArgumentParser(description='betaVAE generation of RNA-Seq data')
parser.a... |
21b692b377533783977b20116d877c81278d1a5dda46aa1f2ab11be3c2d98c93 | Python | 4,345 | 140 | from os import getcwd
from os.path import join, basename
import nibabel as nib
import numpy as np
from traitlets import Unicode, Bool, Instance, Dict
from mrHARDI.base.application import (mrHARDIBaseApplication,
required_file,
mask_arg,
... |
b989a126ec177d49ee8d58555064d82d05dcb4529011a717e26b3849f9e6033d | Python | 4,346 | 97 | """Helpers for resolving target fields, including multi-field binary targets (one on/off field per label)."""
from typing import Dict, List, Optional, Sequence, Tuple
TARGET_FORMATS = ('indices', 'multihot')
def check_target_format(target_format: Optional[str], target_keys: Optional[Sequence[str]] = None) -> str:
... |
09e261de56495dbf1eafdb167475c4a71a8083587516c0ded71808bc004be352 | Python | 4,349 | 101 | import os
import numpy as np
import pandas as pd
import scipy.io as sio
from os.path import join as pjoin
from sklearn.preprocessing import StandardScaler
from scipy.stats import ttest_ind, ttest_1samp
from nod_utils import get_roi_data, save_ciftifile, prepare_imagenet_data
# change to path of current file
os.chdir(... |
818349406be6c2a0638f70114718fecb74753cc38fe2a4f07301524416e48749 | Python | 4,352 | 118 | from typing import Optional
from pathlib import Path
from GANDLF.training_manager import TrainingManager, TrainingManager_split
from GANDLF.inference_manager import InferenceManager
from GANDLF.config_manager import ConfigManager
from GANDLF.utils import (
populate_header_in_parameters,
parseTrainingCSV,
p... |
f855db4f94bf55286216644676fb7c91d8ae617583cb25ba019bc6fb5bd97b87 | Python | 4,352 | 120 | #!/usr/bin/env python3
import os
import unittest
import logging
import yaml
import random
import pytest
import ciftify.qc_config
# Silence logging output for tests
logging.disable(logging.CRITICAL)
# A default qc mode defined in ciftify/data/qc_modes.yaml, tests should
# pass even if changed.
QC_MODE = 'fmri'
clas... |
2d5d123399fa2a458a11d883d7ec2a9961c7000f9841acb29ea665d91d74d342 | Python | 4,353 | 140 | #!/usr/bin/env python3
# -------------------------------------------------------------------------- #
import os
import pandas as pd
import pkg_resources
def load_info_targets(category=None, column=None):
"""A function to retrieve and display some information about 58
pre-selected possible targets from the ... |
d5172ac9a6db194f03b5589dfc5a96967f73c6020904d9bebbed9481e58d615f | Python | 4,353 | 129 | # -*- coding: utf-8 -*-
# (C) Copyright 2020, 2021, 2022, 2023 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.
#
# Any... |
fa294e32a9aeb4f111f49838155982919111c30ea7518262508edc2a74109731 | Python | 4,356 | 119 |
import keras
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation, Flatten
from keras.layers import Conv2D, AveragePooling2D, BatchNormalization
from keras.callbacks import EarlyStopping, ModelCheckpoint
from keras.models import load_model
import numpy as np
import matplotl... |
0c2e7c3c52828f517811303dbb73c6e7c1d7219f8421440c1a26cf339d56fb64 | Python | 4,360 | 99 | import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import pandas as pd
import os
import scipy.stats as stats
from sklearn.neighbors import KernelDensity
from dragen.utilities.InputInfo import RveInfo
class PostProcVol:
def __init__(self):
if not os.path.isdir(RveInfo.store_path + '/Post... |
0880e75b35084ec31d4898051ca2ccb9eb5994d8c7388376ee63952269710f8d | Python | 4,365 | 174 | import os
import n2v
import json
import z5py
import json
import numpy
import argparse
from matplotlib import pyplot as plt
def string_to_slice(slice_string):
return slice(
*[
{True: lambda n: None, False: int}[x == ""](x)
for x in (slice_string.split(":") + ["", "", ""])[:3]
... |
1e5d77e1e90fcb4672e785d1179f12678993472b13f2c441e964c45af2b1de3f | Python | 4,375 | 140 | import sys
class Thing:
def __getitem__(self, key):
return getattr(self, key)
def __setitem__(self, key, value):
setattr(self, key, value)
def enum(options):
values = options.split(" ")
def __effectively_enums_are_strings__(element):
if element in values:
return... |
81bf8e8b6de5d1c8c84f3377fcce0938f35071994f54ac1d509daa33d92bd184 | Python | 4,377 | 139 | #!/bin/env python
"""
Extrapolation nowcast
=====================
This tutorial shows how to compute and plot an extrapolation nowcast using
Finnish radar data.
"""
from datetime import datetime
import matplotlib.pyplot as plt
import numpy as np
from pprint import pprint
from pysteps import io, motion, nowcasts, rcp... |
c83f342201d0fb5c46e54a32b6bd56cc14bef2137269880bca190ea7449b7357 | Python | 4,378 | 140 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 6 15:01:45 2021
@author: obernauer
"""
import numpy as np
from model import Model
class Green(Model):
'''
A subclass to calculate the Green's function for a toy model of
bilayer graphene.
Attributes
----------
frequency ... |
3d69b1f0a42edeb540c3e72ea611b9f5f656a0c3f02a6b071cdeb659c991f98f | Python | 4,379 | 132 | #!/usr/bin/python3
import numpy as np
import matplotlib.pyplot as plt
import scipy.signal as signal
import math as math
from scipy.interpolate import interp1d
import scipy.stats as stats
import researchdata1258
import noise_wall
import snr
import sys
import getopt
subjectsOK = [1,3,4,6,7,8,9,10,11,12,13,14,15,16,17,1... |
237f78b237d43770525a0fd0787d5ace3ed318aafc6e536b55fce7a1871eb687 | Python | 4,380 | 110 | """
ClinicalASL - Clinical Arterial Spin Labeling processing pipeline
ASL T1-from-M0 computation module.
Repository: https://github.com/JSIERO/ClinicalASL
Author: Jeroen Siero
Institution: UMCU (University Medical Center Utrecht), The Netherlands
Contact: j.c.w.siero@umcutrecht.nl
Description:
Funct... |
36a300dbe467879e051cca272053137ce7eeecb71865479daa17983409e60a46 | Python | 4,381 | 103 | from viconnexusapi import ViconNexus
from sklearn import preprocessing
import numpy as np #conda install numpy==1.18.5
from vicon_utils import ic_pred, fo_pred, reshape_data, resample_data
import threading
import sys
#import argparse
# marker names which are used for the algorithm
# adapt names to how they ar... |
1871f35dd0ffbfa5f66329f454ba7fd65f7af012119714d12eeb9f02030ac3f7 | Python | 4,384 | 121 | import sqlite3
import collections
from datetime import datetime, timedelta
import numpy as np
import matplotlib.pyplot as plt
plt.style.use('ggplot')
def get_engine_data():
"""Main"""
path = '../.ipython/profile_ipyparallel.806545.r000u17l01/tasks.db'
#path = '../.ipython/profile_ipyparallel.384110/task... |
65d3e74371fe5ef98ad484ff9c093ce5b3574d0a14515dcc89a6c8441b7d5679 | Python | 4,388 | 134 | """
Plot noise amplification factor and channel information capacity as a function
of optimization iteration.
"""
# %% Initialize
from pathlib import Path
import numpy as np
import matplotlib.pyplot as plt
from megsimutils.utils import uniform_sphere_dipoles, comp_inf_capacity
from megsimutils.arrays import noise_ma... |
093d7615c6fdb061f687d33502d2339e2c7fbe4c78e5126e35dd48190180cd22 | Python | 4,389 | 111 | # -*- coding: utf-8 -*-
"""
Created on Thu Aug 26 17:06:06 2021
@author: Jing Li, Small steps make changes. dnt_seq@163.com
"""
import pandas as pd
import numpy as np
import torch
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
import os
nt_table = ['t','c', 'a'... |
161b95e33b9a5915a978136dcc472ddc7903d52bb4c99f58f7b5ed2be4e5bf95 | Python | 4,391 | 107 | # -*- coding: utf-8 -*-
"""
------------------------------------------------------------------------------
Copyright (C) 2019 Université catholique de Louvain (UCLouvain), Belgium.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.... |
bbb9527ae11143a3e784cd0da610d79cc39b71b15beb8c5de65ffc6aece3d2a5 | Python | 4,391 | 134 | import numpy as np
def pol2cart(angle, r):
"""
Conversion from polar coordinates to cartesians
:param angle: Degrees of the speaker from [1, 0] vector in degree
:param r: radius of the arena
:return: [x, y] of the speaker, in cm relative to the center of the arena = [0, 0]
"""
theta = np... |
c9fe54e6333a1dc53f896af5ad795c37f432c93f86cf08a615b6f01045558cb0 | Python | 4,391 | 133 | from __future__ import annotations
import json
from collections.abc import Callable
from pathlib import Path
from typing import Any
import pandas as pd
import pytest
from conftest import CONFORMANCE_ARTIFACTS_BY_SHA256, CORPUS
from datamonger import Registry, data_info, fetch_artifact, fetch_data
from datamonger.err... |
050a07caae849051da7709a6a0f5b2831e6c3d5a58f16b8d5cf3e0640327dcd1 | Python | 4,393 | 130 | """
Author: "Keitaro Yamashita, Garib N. Murshudov"
MRC Laboratory of Molecular Biology
This software is released under the
Mozilla Public License, version 2.0; see LICENSE.
"""
from __future__ import absolute_import, division, print_function, generators
import argparse
import sys
import traceback
import platform
... |
c570577169a6817e235c97b900b53e42e759fddd3b30be960a48a944811103f5 | Python | 4,396 | 150 | # -*- coding: utf-8 -*-
from datetime import datetime, timedelta
from os.path import join, exists
import pickle
import random
import numpy as np
from numpy.testing import assert_array_equal
import pytest
from pysteps.blending.clim import save_skill, calc_clim_skill
random.seed(12356)
n_cascade_levels = 7
model_nam... |
b4560089e989d1717db800aeb2acfba740e9f135d071bdce09b1be9da265afe7 | Python | 4,397 | 111 | # -*- coding: utf-8 -*-
"""
Created on Thu Aug 26 17:06:06 2021
@author: Jing Li, Small steps make changes. dnt_seq@163.com
"""
import pandas as pd
import numpy as np
import torch
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
import os
nt_table = ['t','c', 'a'... |
fef5a2c9f0dfa81fa959c91429873f8703f082763ddbf4ee0af6ecb7177a8cee | Python | 4,400 | 131 | '''
Primary Auditory Area
'''
from braincog.base.brainarea.BrainArea import BrainArea
from Modal.sequencememory import SequenceMemory
from Modal.notesequencelayer import NoteSequenceLayer
from Modal.temposequencelayer import TempoSequenceLayer
import numpy as np
import math
class PAC(BrainArea,SequenceMemory):
... |
1becfb3b97e1d5b6a9f68b6e80b1fee436163fac2485b862fafa2636ef2dce76 | Python | 4,404 | 114 | """Bring a meshed RVE into the single internal format the substructure pipeline works on.
Internal format: a `pyvista.UnstructuredGrid` with two int32 cell_data arrays,
GrainID -- 1-based parent (austenite) grain id
phaseID -- DRAGen phase id, see RveInfo.PHASENUM
Everything downstream only ever sees this,... |
6d20fef439515fe5c74e5420e71c473c49b125d1960218a8d39149e94618356a | Python | 4,405 | 159 | import tensorflow as tf
import numpy as np
from lib.network import Network
from lib.pinn import PINN
import matplotlib.pyplot as plt
import pandas as pd
import os
linewidth = 4
fontsize = 20
font = {'family' : 'monospace',
'weight' : 'bold',
'size' : fontsize }
plt.rc('font', **font) # pass in t... |
d48dbe9f5d6fe6d92b9c2a6a6f3c6a925a4add64f032d0790f90948226948fd3 | Python | 4,407 | 123 | import logging
import numpy as np
import pandas as pd
from config_path import *
from sklearn.model_selection import train_test_split
data_path = DATA_PATH
diabetes_path=DIABETES_DATA_PATH
class DiabetesData():
def __init__(self,feature='gene_1p', data_type='mut', account_for_data_type=None, cnv_levels=5,
... |
68f494a6880c9c5dbe4769e4c0bb20ac05078c3e753c60c322b7566e7c3bb98e | Python | 4,413 | 115 | import os
import numpy as np
import tensorflow as tf
from tensorflow.contrib.session_bundle import exporter
from model.deeplab_v3 import DeepLabV3
from utils.evaluation import Evaluation
class NetFrame(object):
"""Basic framework for constructing model pipeline.
"""
def __init__(self, cfg, data, mode):... |
64332ae4c37866194de2e942685ad94e7986c1302f226bbdb6e0557f7a76fe67 | Python | 4,417 | 145 | from re import A
import unittest
import otscomics
import pandas as pd
import numpy as np
import anndata as ad
import torch
import ot
from scipy.spatial.distance import cdist
def ot_distance(a, b, C, eps):
cost = torch.from_numpy(C)
K = torch.exp(-cost/eps)
_, wass_log = ot.sinkhorn(
a.contiguous()... |
0fe602b354b0d01675f2b29088fa44ecd31d2196f8451385c74676241c350552 | Python | 4,420 | 127 | import torch
import torch.autograd as autograd
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import numpy as np
import pickle
import copy
import os
import configure
from .data import Data
def save_data_setting(data, save_file):
new_data = copy.deepcopy(data)
##... |
aeb97ea1c1eb812d3eb559f6dc6f7a9da0423b4aa114ebf7b07594a0eb946676 | Python | 4,434 | 135 | import os
import nixio as nix
import numpy as np
import matplotlib.pyplot as plt
import requests
def show_file_info(filename):
f = nix.File.open(filename, nix.FileMode.ReadOnly)
print("file: %s \n\tformat: %s \n\tformat version: %s \n\tlibrary version %s"
% (filename, f.format, f.version, nix.__vers... |
f46d6e1dba2f99a8adca827618b263dd181d349e5fb15f53d34e0ddcd7bc8972 | Python | 4,435 | 109 | import logging
import os
import sys
import torch
import torch.nn.functional as F
from torch.cuda.amp import GradScaler, autocast
from torch.utils.tensorboard import SummaryWriter
from tqdm import tqdm
from utils import save_config_file, accuracy, save_checkpoint
torch.manual_seed(0)
class SimCLR(object):
def _... |
f93bed580f76147e6a79375b9fab0ccff77f9545dac5b2eae4704c37d588f365 | Python | 4,435 | 107 | import torch, cv2, time, os
from PIL import Image
import os.path as osp
import numpy as np
import torch.nn.functional as F
from argparse import ArgumentParser
from utils import SalEval, Logger
parser = ArgumentParser()
parser.add_argument('--data_dir', default='./Data', type=str, help='data directory')
parser.add_arg... |
35ddcd0e1e13e7b9695b9ba9e5ac755872fc318a2de810a9b48b7f9a65ac8414 | Python | 4,443 | 119 | import lightning.pytorch as pl
from GANDLF.compute.generic import (
TrainingSubsetDataParser,
ValidationSubsetDataParser,
TestSubsetDataParser,
InferenceSubsetDataParserRadiology,
)
from torch.utils.data import DataLoader as TorchDataLoader
from copy import deepcopy
class GandlfTrainingDatamodule(pl.L... |
4d30f4fad70942d13b4ebe63e9eed37079c3f17c062b17ec89c7e4f28db11b20 | Python | 4,446 | 173 | UIC1_TAG = 33628
UIC2_TAG = 33629
UIC3_TAG = 33630
UIC4_TAG = 33631
C_MD5_DIGEST = "MD5Digest"
C_SCALING = "Scaling"
C_HEIGHT = "Height"
C_WIDTH = "Width"
MS_EXACT_MATCH = "Text-Exact match"
MS_REGEXP = "Text-Regular expressions"
MS_ORDER = "Order"
FF_INDIVIDUAL_IMAGES = "individual images"
FF_STK_MOVIES = "stk movies"... |
e880fd340820455ca0644435bc9535681a4559467c59bf4a2ec48e76e7380636 | Python | 4,449 | 176 | #!/usr/bin/python3
def nodiag(d, split=False):
"""Removes diagonals from 2D matrix.
Parameters
-----------
d: numpy.ndarray(shape=[n1,n2])
Input matrix
split: bool
Whether to output list of 1D arrays for each row instead of a single concatenated 1D array.
Returns
---------
If split: List of numpy.ndarr... |
08c96226944e10fca5a129691c7d5a83227b0f1877da1a940fc8c06da2baad37 | Python | 4,450 | 126 | # This file is part of pyunicorn.
# Copyright (C) 2008--2026 Jonathan F. Donges and pyunicorn authors
# URL: <https://www.pik-potsdam.de/members/donges/software-2/software>
# License: BSD (3-clause)
#
# Please acknowledge and cite the use of this software and its authors
# when results are used in publications or publi... |
fa499bf5a4acec3bb61b6a7f5d4c5752eadb73525d51e951f997190d8d53cdd9 | Python | 4,451 | 139 | import os
import shutil
import csv
import sys
def getMax(list):
aaList = ["A", "R", "N", "D", "C", "Q", "E", "G", "H", "I", "L", "K", "M", "F", "P", "S", "T", "W", "Y", "V"]
ind = 0
max = 0
for i in range(0,len(list)):
if(float(list[i]) > max):
ind = i
max = float(list[i])
return [aaList[i... |
e12add069068c8694ed5e73c10adc1818598e39bcf5d0c0a097ea70bca14eae3 | Python | 4,457 | 116 | import h5py
from unnatural_movie_analysis import unnatural_movie_analysis
from natural_movie_analysis import natural_movie_analysis
import os
import numpy as np
import sys
from gabor_wavelet_preprocessing_linquad import gabor_wavelet_preprocessing_linquad
from threshgrad import threshold_grad_desc_cv, lsq, dotdelay, so... |
bb7cc4b27d7e22a484e3ab49068ae21c209a0b9d7371b027edb86ad50ee5b0f6 | Python | 4,463 | 154 | import sys
import numpy as np
from scipy.misc import imresize
from allensdk.core.brain_observatory_cache import BrainObservatoryCache
from allensdk.brain_observatory.stimulus_info import BrainObservatoryMonitor
from allensdk.brain_observatory.stimulus_info import make_display_mask
Y, X = np.where(make_display_mask()... |
3250125df9b3f1c27adc643876f6ce78e8c4dc9850734a59ef58555a4e062d17 | Python | 4,470 | 117 | import pytest
from click.testing import CliRunner
from GANDLF.entrypoints.collect_stats import new_way, old_way
from . import CliCase, run_test_case, TmpNoEx, TmpDire, TmpFile
# This function is a place where a real logic is executed.
# For tests, we replace it with mock up, and check if this function is cal... |
93cc5ca6e8e9520db6477de478e50d7adceb2e71921ec10098296415e0c76717 | Python | 4,470 | 148 | """
All the metrics are to be called from here
"""
from warnings import warn
from typing import Union
from GANDLF.losses.regression import MSE_loss, CEL
from .segmentation import (
multi_class_dice,
multi_class_dice_per_label,
hd100,
hd100_per_label,
hd95,
hd95_per_label,
nsd,
nsd_per_l... |
0950333b7e061fe346d31fcbb2445ca91dc5d0eba830d3fe928024fbad1a5a3a | Python | 4,471 | 121 | import tensorflow as tf
import tensorflow_probability as tfp
tfd = tfp.distributions
tfpl = tfp.layers
class OneDimensionalAmortizer(tf.keras.Model):
"""This network is only usable for a 1D dynamic estimation problem and used
for the Poisson toy example."""
def __init__(
self, hidden_units_local... |
d7669940d047a1c121e8df11802029552aa01cdd12d810beecd59853c3d7b9fa | Python | 4,479 | 98 | import os
import pandas as pd
import numpy as np
import argparse
import episcanpy as es
import subprocess
parser = argparse.ArgumentParser()
parser.add_argument('--path_data', default="./data/",
help='Location with pseudobulks data')
parser.add_argument('--name', default="pseudobulks",
... |
05c9d3d0047c855855bcf4cc819cbc7e69ba9c0112aebfe231d1a57f9778114f | Python | 4,486 | 123 | from __future__ import annotations
from typing import Sequence
import numpy as np
import numpy.typing as npt
import traits.api
from ptsa.data.timeseries import TimeSeries
from ptsa.data.filters import BaseFilter
class MonopolarToBipolarMapper(BaseFilter):
"""Object that takes as an input time series for monopo... |
560658bce1ecdfc4ce25798b6b27f2f7009cf305c0fa4a59999d722bb2f31f68 | Python | 4,491 | 137 | """SVAE model
Author: Hikari Sorensen - Vector Engineering Team (hsorense@broadinstitute.org)
Notes:
- this model uses TensorFlow's functional API
"""
import tensorflow as tf
from tensorflow.keras import backend as K
from tensorflow.keras.layers import Input, Dense
from tensorflow.keras.models import Model
# activat... |
dd9d1b1b1d061b1dc6416b692cccbdc28011da770de59ed59c1aa2b99a9cb708 | Python | 4,493 | 88 | import numpy as np
from numpy.typing import NDArray
from typing import List, Annotated, Optional, Tuple, Union
from pydantic import Field, validate_call, ConfigDict, BaseModel
from cellprofiler_library.functions.measurement import measure_image_intensities
from cellprofiler_library.opts.measureimageintensity import Tem... |
55b85ce1e8b2cd1ab42aeea3c1fc62bd7e7ccda7721c4bf783ede1355272dada | Python | 4,501 | 166 | import os
import n2v
import z5py
import json
import numpy
import argparse
from skimage.transform import resize
from matplotlib import pyplot as plt
def get_args():
description = """CAREless Noise2Void: command line script for predicting new BS-BDV N5 images"""
parser = argparse.ArgumentParser(description=d... |
16679f437e477cc305f162be1ffcdbc0510b9f26ea17aeef9357b851dbc3f587 | Python | 4,502 | 139 | #
# nate berry
# 2023-04-01
#
# ---------------------------------------------------------
# NOTES:
# - this script performed recurrence quantificaiton analysis
# on the univarate time series...
# - comparisons of alternative parameters is not performed here
#
# -----------------------------------------------... |
fe3d1a455de9ba2208b49d5638744d54823f4e4189b87f5ea7a4aec0f6e57277 | Python | 4,502 | 125 | import yaml
from typing import List, Optional, Union
from pathlib import Path
from copy import deepcopy
def generate_new_configs_from_key_and_value(
base_config: dict,
key: str,
value: Union[str, list, int],
upper_level_key: Optional[str] = None,
) -> List[dict]:
"""
Generate new configs based... |
0f3b0031afa50af1af6f1ab8d29b38fda0c619d465303342d0f30c8959bdea32 | Python | 4,507 | 125 | # -*- coding: utf-8 -*-
# (C) Copyright 2020, 2021, 2022, 2023 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.
#
# Any... |
ade45516bf383a55390660f2abf9819295e8e65c12c6866a7595a139216bdc98 | Python | 4,508 | 109 | from pathlib import Path
import pytest
from nidm.core import Constants
from nidm.experiment import (
AssessmentAcquisition,
AssessmentObject,
DemographicsObject,
MRAcquisition,
MRObject,
Project,
Session,
)
# dj TODO: adding more tests; I only put the Dave's pipeline to a function
def main... |
495d0f8a22819c63820c64876f4634b0fc6ed826bf95938502138c70beed8ef9 | Python | 4,517 | 143 | """This module contains simple helper functions """
from __future__ import print_function
import torch
import numpy as np
from PIL import Image
import os
def tensor2im(input_image, imtype=np.uint8):
""""Converts a Tensor array into a numpy image array.
Parameters:
input_image (tensor) -- the input i... |
447598243c41cd912e557dd8b891b8e49418e33f3677d045cfffceb93ca71a81 | Python | 4,519 | 167 | import numpy as np
from copy import deepcopy
import torch
from tqdm import tqdm
args = None
epoch = []
delta_bias = {
"mnist_classIL": 0.2,
"cifar_classIL": 0.1,
"gesture_classIL": 0.2,
"alphabet_classIL": 0.2,
"mathgreek_classIL": None
}
bias = {
"mnist_classIL": None,
... |
fbfc1c89f29f81d59d1a20319ef1797bb4cfe07be0ff78b03b5aadf99c20a961 | Python | 4,520 | 124 | """
Exponential Integrate-and-Fire model.
See Neuronal Dynamics, `Chapter 5 Section 2 <http://neuronaldynamics.epfl.ch/online/Ch5.S2.html>`_
"""
# This file is part of the exercise code repository accompanying
# the book: Neuronal Dynamics (see http://neuronaldynamics.epfl.ch)
# located at http://github.com/EPFL-LCN/n... |
c6b2b2fbe9658db097ed4d9e623a45640ebd0baaa51e60395be7c47243c1965e | Python | 4,534 | 140 | # -*- coding: utf-8 -*-
"""
Implementation of Light UNet
"""
import torch
from torch.nn import ModuleList
from GANDLF.models.seg_modules.DownsamplingModule import DownsamplingModule
from GANDLF.models.seg_modules.EncodingModule import EncodingModule
from GANDLF.models.seg_modules.DecodingModule import DecodingModule
f... |
65016d8740b2e2d298c67fab87e21f56c05961e1689174ce11e9e27a56afc056 | Python | 4,540 | 121 | import os
import warnings
import cv2
import torch
import torch.distributed as dist
import torch.multiprocessing as mp
def setup_multi_processes(cfg):
"""Setup multi-processing environment variables."""
# set multi-process start method as `fork` to speed up the training
# if platform.system() != 'Windows'... |
48615978ad2eb328ff58c9f47638813b971872b196eaeb387badfb09c77ff1ea | Python | 4,541 | 83 | #!/usr/bin/python
# encoding=utf-8
import datetime
import os, sys
import threading
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--type', type=str, default=None)
args = parser.parse_args()
def execCmd(cmd):
try:
print("命令%s开始运行%s" % (cmd, datetime.datetime.now()))
... |
7164489c62eb136078b2cae89c022b6f87acd13134ed0ebc0fc8f227b9a07da6 | Python | 4,541 | 115 | import torch
from torch.nn import ReLU
import copy
class Visualisation(object):
"""Base class for all Visualisations.
Every Visualisation subclass has to provide a generate gradients method.
"""
def __init__(self, model):
self.model = copy.deepcopy(model)
self.gradients = None
de... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.