sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
8afe1d6fdad42e523e5dd679b0ea19c4995a8e48520c03b44a907cdcc626669e
Python
1,938
57
# -*- 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...
d34f06a981d408d29148783e0bbf206c86fe2c981bca2a661dfc5b88247c2171
Python
1,941
61
# -*- coding: utf-8 -*- import numpy as np import pytest from numpy.testing import assert_array_almost_equal from pysteps.noise.motion import generate_bps from pysteps.noise.motion import get_default_params_bps_par from pysteps.noise.motion import get_default_params_bps_perp from pysteps.noise.motion import initializ...
cd23d7adb1ccffab7473179bde9c6d31ef9ad3631fbf7c48b4742f2c979aad9e
Python
1,946
57
import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable ###################################################################### # # Model automatically generated by modelGenerator # ###################################################################### # ----------------...
5b8d5197c31ce891b8d9ca8c2dc15e62b0f625c1a729e43cd51a232af6dbb1e3
Python
1,947
56
import numpy as np from .dataset import Datasets, Dataset from .download import maybe_download_and_extract import os URL = 'https://transfer.sh/GeGJ8/m2nist.zip' class M2NIST(Datasets): def __init__(self, data_dir='data/M2NIST', batch_size=32, test_rate = 0.2, validation=False): maybe_download_and_extract(U...
2161f54231addbcfc7c68a94c4238d5d8828899708001e0fc889da30e09e1406
Python
1,950
54
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html import os # -- Path setup -------------------------------------------------------------...
467560d7aeb4205b880f82a3b47fcaf9101bc2e9d96fa2c5c5c170d97e47daa1
Python
1,950
62
""" MIT License Copyright (c) 2022 Pawan Goyal 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, publish, ...
a8a60cfe56567a3fc0ca40a4710e0e4398bb633d0f85fd954ccfcd988d53b4dd
Python
1,951
65
#!/usr/bin/env python3 # Copyright 2021 Alexander Meulemans, Matilde Tristany, Maria Cervera # # 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 ...
7993c2071901362d7630bb1b56777050c255b2a2f232be3294a89855a5b2fb13
Python
1,952
62
import torch import torch.nn as nn from ..models.base import Model from .activation import ExU from .activation import LinReLU class FeatureNN(Model): """Neural Network model for each individual feature.""" def __init__( self, config, name, *, input_shape: int, ...
3718a0fa333e6be68a94ad3d3cd8b5ce136e944a4b4f28e7b18fe819029d8e14
Python
1,953
53
import yaml from typing import Union from dicomanonymizer import anonymize from .convert_to_nifti import convert_to_nifti # from .slide_anonymizer import anonymize_slide def run_anonymizer( input_path: str, output_path: str, parameters: Union[str, list, int], modality: str ) -> None: """ This function pe...
f491605800c8a44548de68ebb800efcbf350e5de964f7a07ffd492967c12d556
Python
1,955
49
import torch import torch.nn as nn from torch_geometric.nn import TransformerConv from network import Multi_layer_locally_feature_extraction, Nonlinear_feature_interaction class GECNVNet(nn.Module): def __init__(self, GE_dim, LF_stride, LF_input_shape, ...
2f0560e92deae214c68fd60563e7431894aa066087c44e19d35968cb6b2a48c4
Python
1,958
65
#!/usr/bin/env python3 # Copyright 2021 Alexander Meulemans, Matilde Tristany, Maria Cervera # # 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 ...
0e5f1e9f7cbdef4db3c6fd41fed5d6418a572ce8b5d98857d855a1ef1a0568eb
Python
1,961
55
from breaststudies.models import BasicModel import monai.networks.nets as nets class nnUNet(BasicModel): def __init__( self, in_ch, out_ch, roi_size, spatial_dims=3, kernel_size=[[1,3,3], [1,3,3], 3, 3,3], strides= [ 1, [1,2,2], [1,2,2],2,2]...
8cc042e8d15dada14b0d25bf85d34b8e0dd030634fbc3967ce0d944398220dd9
Python
1,963
91
from numpy import (allclose, append, apply_along_axis, isclose, mean, moveaxis, sqrt, std, vstack, zeros, ones, absolute) def _fa(evals, axis=0): ...
9282dda13d4e2891a04f89a109252b42282389ac87689449f745bd9c5c90e813
Python
1,963
59
import os from ._does_not_predicate import DoesNotPredicate from ._does_predicate import DoesPredicate from ._file_predicate import FilePredicate from ._filter import CONTAINS_PREDICATE from ._filter import CONTAINS_REGEXP_PREDICATE from ._filter import ENDSWITH_PREDICATE from ._filter import EQ_PREDICATE from ._filte...
e0bc63f093130d3f1d52af2a104809377c33baca136d5a1cfaab4a491a0ab66a
Python
1,970
72
########################################################################## ### Load Fly & Worm Data and Prepare X, Y, Corr for Manifold Alignment ### ########################################################################## import pandas as pd from os import sys datOrtho = pd.read_csv(sys.argv[3]) # Modencode.merged....
0881950c80fcc5b5ed265ce75a92d8dfdd4b2f970740b76ab241c949c3509811
Python
1,971
54
#!/usr/bin/env python3 import unittest import logging import importlib import random import pytest from unittest.mock import patch, MagicMock, mock_open recon = importlib.import_module('ciftify.bin.cifti_vis_recon_all') logging.disable(logging.CRITICAL) class TestUserSettings(unittest.TestCase): def test_exits...
378a175af19e5264eb15a78e25d5f9b666a58a6b0f2426c6dc4b67a7a9c68f23
Python
1,971
60
# -*- 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...
410aefe1ae8555d90561effddddf02199affe04fec68c17e00780626b6bdac6c
Python
1,971
58
import argparse import glob import os def assembly(input_pathnames, output_pathname): with open(output_pathname, 'w') as o: o.write('[') for p in input_pathnames[:-1]: with open(p, 'r') as f: o.write(f.read()) o.write(',\n') with open(input_pathn...
88b1331cdc87a8c4ba29f48807b80309faf81964b870621975988f561dc4ca07
Python
1,974
57
import torch from torchvision import models import numpy as np from utils import Normalize, load_ground_truth model_1 = models.resnet50(pretrained=True).eval() model_2 = models.inception_v3(pretrained=True, transform_input=True).eval() model_3 = models.densenet121(pretrained=True).eval() model_4 = models.vgg16_bn(pret...
f4efe24ed6d4fa08235d40a7ca04d684171bcdf65c7f3890b1146d509f78dea9
Python
1,974
52
""" Test Time Pooling (Average-Max Pool) Hacked together by / Copyright 2020 Ross Wightman """ import logging from torch import nn import torch.nn.functional as F from .adaptive_avgmax_pool import adaptive_avgmax_pool2d _logger = logging.getLogger(__name__) class TestTimePoolHead(nn.Module): def __init__(sel...
2cb5bb6151805f4358f98df66caf8374d153e3577b13b7adacf345ad162e6fec
Python
1,977
73
from __future__ import division import numpy as np import scipy.sparse as sp import numpy_groupies as npg def zero_one_scale_adj(adj, scale_invariance=False): """Normalize adjacency matrix to interval [0, 1]. Can choose between global or locale normalization.""" data = adj.data if data.size == 0: ...
05fc00f3a56bfb9980c180800a9c88183a454518e11fa2e5cf34cd6fc8f7c435
Python
1,978
31
import scipy.ndimage from typing import Optional, Annotated, Union from pydantic import validate_call, ConfigDict, Field from cellprofiler_library.types import ImageAny, ObjectSegmentation, ImageBinary from cellprofiler_library.opts.findmaxima import BackgroundExclusionMode from cellprofiler_library.functions.image_pro...
94de3eaea834f663881fa5608b2cf96fed848637c0e1f5b158b7f194f0890309
Python
1,979
68
# Copyright (C) 2014 SWIPO Project # # Authors (this file): # Stefan Schinkel <stefan.schinkel@gmail.com> """ Weave tests to check that python and weave implementations give the same results """ import numpy as np from pyunicorn import ResNetwork res = ResNetwork.SmallTestNetwork() resC = ResNetwork.SmallComplexNe...
f1346cab949c9a87c95ee992f8c11667459ed04a58557e38af32aa2da77db848
Python
1,980
66
import torch.nn as nn import torch.nn.functional as F class GlobalAveragePooling2D(nn.Module): """ Global average pooling operation for 2D tensors. """ def __init__(self): super(GlobalAveragePooling2D, self).__init__() def forward(self, x): """ Forward pass for global ave...
5b58f442b425e3c0511302f76e6cc3ad3b6a0f8f00116c95dde2c455b061477e
Python
1,983
71
import os import shutil import yaml from click.testing import CliRunner from ..cli import main CSV_FILE_NAME = "HBCD_LORIS.csv" YAML_FILE_NAME = "hbcd-loris.yml" CSV_TEST_FILE = os.path.join( os.path.dirname(__file__), "..", "example", "loris", CSV_FILE_NAME ) YAML_TEST_FILE = os.path.join( os.path.dirname(_...
c1af15249c4cafd333af0ed1f38ef597d5c061bce6eb3259ac121d81d70fa342
Python
1,985
64
import numpy as np from numpy import pi,linspace import cmath, random from pylab import * from exp_errors import * from exp_forward_backward import * # hamitonian for H2 g0 = -0.4804 ; g1 = +0.3435; g2 = -0.4347; g3 = +0.5716; g4 = +0.0910; g5 = +0.0910; Hamiltonian = g0 * tensor(qeye(2), qeye(2)) + g1 * tensor(sigma...
6c9c1094af8b45985a2002020abecd0fc2d5dd64baecc42bbcbf3176edd7da66
Python
1,987
64
##################################################################################################################### # Date created : 10/21/2022 # Date modified: 10/21/2022 # Purpose : To generate features from PSSM ###############################################################################################...
f27f39b7367b8273e41426baa38deaa0305f6ac5e965ba12ec69faad50329c65
Python
1,987
77
#!/usr/bin/python3 import multiprocessing autocount = multiprocessing.cpu_count def autopooler_caller(a): return a[0](*a[1], **a[2]) def autopooler(n, it, *a, chunksize=1, dummy=False, return_iter=False, unordered=False, **ka): """Uses multiprocessing.Pool or multiproce...
e12e4222187b0b2a857c1e962f446576d7705f043e469acd85e33e3a37b214fc
Python
1,988
42
from src.models.tabular.widedeep.base import WDBaseModel from pytorch_widedeep.models import FTTransformer class WDFTTransformerModel(WDBaseModel): def __init__(self, **kwargs): super().__init__(**kwargs) def build_network(self): self.model = FTTransformer( column_idx=self.hparam...
e8c6b4ad4dbdd44195fe2ab68ab636453254f801ff847003b737f965bb7c3f90
Python
1,989
55
import argparse import os def get_outdir(path): with open(path, "r") as c: for line in c: if "outdir" in line: return line[line.index("=")+1:].replace("'", "").rstrip() def read_names(path, sep="\t"): names = set() with open(path, "r") as f: for line in f: ...
52d77cfbff084be0e32410d60d1ea3691ff5dd8846a3f37e2ee49a6cbd54eb25
Python
1,990
62
# -*- coding: utf-8 -*- import pytest from numpy.testing import assert_array_almost_equal from pysteps.tests.helpers import get_precipitation_fields from pysteps.verification import spatialscores R = get_precipitation_fields(num_prev_files=1, return_raw=True) test_data = [ (R[0], R[1], "FSS", [1], [10], None, 0....
ede8685e4c48b89a9ac8befb08eb506021ef0132d3f351bf3c02565c9d0f1a23
Python
1,991
77
from pyControl.utility import * import hardware_definition as hw # State machine. states = ['state1', 'state2','state3', 'state4','state5', 'state6'] events = ['poke_1', 'poke_1_out', 'poke_2', 'poke_2_out', 'poke_3', 'poke_3_out', 'poke_4', 'poke_4_out', 'poke_5'...
58c7c99284510076b62698ebf197b1fa91ccaa28acccd5279eaf47e17650605b
Python
1,992
64
import torch from torch import nn from .loss_interface import AbstractRegressionLoss class CrossEntropyLoss(AbstractRegressionLoss): """ This class computes the cross entropy loss between two tensors. """ def _initialize_loss_function_object(self): return nn.CrossEntropyLoss(reduction=self.re...
8f19b10f3e3177b41ca08bb53019edb4cd5dcbea6dd3202e7a61997564e055e6
Python
2,000
61
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed May 13 02:24:48 2020 @author: andrey Code for computing spherical harmonic expansion of a magnetic field. Based on Taulu and Kajola 2005 doi:10.1063/1.1935742, Hill 1954 doi:10.1119/1.1933682 This is a quick-and-dirty proof-of-concept. It is (a) very c...
8e0800d5f2cfe9b34698cb16793314ded1e67165c8a1365a696568c3f7f0df52
Python
2,001
52
"""test_namesubscriber.py - test the name subscriber classes from settings""" import unittest from cellprofiler_core.setting.subscriber import ( ImageListSubscriber, LabelListSubscriber, ) class TestListNameSubscriber(unittest.TestCase): def test_load_image_list_empty(self): s = ImageListSubscri...
87fc94ff05581392ef1412b1e1038360df3afae8c512c166624cb9c2154c8cc6
Python
2,002
52
# -*- coding: utf-8 -*- """ @author: bartulem Run Kilosort2 through Python. As it stands (spring/summer 2020), to use Kilosort2 one still requires Matlab. To ensure it works, one needs a specific combination of Matlab, the GPU driver version and CUDA compiler files. On the lab computer, I set it up to work on Matla...
c992525eb09c84d3f76067b78ab039ea48a73bcc10fd498fc52cbe8dfe119051
Python
2,003
74
from prov import Error __author__ = "Trung Dong Huynh" __email__ = "trungdong@donggiang.com" __all__ = ["get"] class Serializer: """Serializer for PROVONE documents.""" document = None """PROVONE document to serialise.""" def __init__(self, document=None): """ Constructor. ...
5d8d1f4daf09a10855ee77e5755a124b34c55b2ca77f629dc45c23bf11f34efd
Python
2,005
62
import matplotlib.pyplot as plt parameters = [1, 8, 35, 150, 650, 300000] # M relation = {'gvp': [0.6875, 0.7183, 0.7820, 0.8267, 0.8544, 0.8703], 'egnn': [0.7336, 0.7532, 0.7968, 0.8205, 0.8456, 0.8637], 'molformer': [0.3921, 0.4228, 0.4773, 0.5546, 0.6210, 0.6683]} def ablation_cu...
57975f5a7191791db0311440821be1cee6796eb1963f90a1a3ae7aff08bacb21
Python
2,006
61
# -*- 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...
898bd2dd3139f4d2088d727f0f8a23be99d78ba5541b85a797fa5538736c968b
Python
2,007
81
""" MedianFilter ============ **MedianFilter** reduces salt-and-pepper noise in an image while preserving borders. | ============ ============ =============== Supports 2D? Supports 3D? Respects masks? ============ ============ =============== YES YES NO ============ ============ =============== """...
7ec41b26caf8d6f4de6411644af65d4c5058e7c071e3f185d33c8da3ab7264ed
Python
2,008
67
import os from itertools import product import numpy as np import pkg_resources from etspredict.job_submission import HTCSubmissionTemplate def load_subject_list(dataset): path = os.path.join("..", "etspredict", "data", f"{dataset}_subjects.txt") stream = pkg_resources.resource_stream(__name__, path) ...
f870f58bfe3719d7c0d2c4e5cdbf2d6557f08cfbbe7988f905743052f108fc8f
Python
2,018
73
"""Semantic errors exposed by the Datamonger client.""" class DatamongerError(Exception): """Base class for expected Datamonger failures.""" class RegistryError(DatamongerError): """Base class for registry failures.""" class RegistryIntegrityError(RegistryError): """The registry bytes do not match the...
b8c81ce4c1354a841fef3383faba8d52cdefbeff96dc2ba4371175063de62bad
Python
2,020
58
import numpy as np from PIL import Image import pickle import os.path as osp class LoadData(object): ''' Class to laod the data ''' def __init__(self, data_dir, dataset, cached_data_file): ''' :param data_dir: directory where the dataset is kept :param cached_data_file: locatio...
b89e55b61b8f2f6ddac8462dd68168a981414a34da9995ce1c356d6617483f3b
Python
2,023
49
import os from typing import Optional from .reader_image_folder import ReaderImageFolder from .reader_image_in_tar import ReaderImageInTar def create_reader( name: str, root: Optional[str] = None, split: str = 'train', **kwargs, ): kwargs = {k: v for k, v in kwargs.items() if v is...
20f1866d6c19024b126447af069e522bc620ced714935a699821d00849886106
Python
2,024
67
import os.path from data.base_dataset import BaseDataset, get_transform from data.image_folder import make_dataset from skimage import io import re def numericalSort(value): numbers = re.compile(r'(\d+)') parts = numbers.split(value) parts[1::2] = map(int, parts[1::2]) return parts class CubeDataset...
27f5202e1ddf7db789442616c57717862909f90fac451709c384d0eaa48ed4a6
Python
2,024
69
import os import glob import shutil from tqdm import tqdm import pydoc import numpy as np import omegaconf def flatten_dict(d, top_level_key="", sep="_"): flat_d = {} for k, v in d.items(): if isinstance(v, (dict, omegaconf.DictConfig)): flat_d.update(flatten_dict (v, top_level_key=(k + sep...
2ade2401d415b35c06b684bf704539c07b156deb1412fd0115cb90a1f4aae7ab
Python
2,025
63
# -*- 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...
bcc39abbb3b5f9c8d4de2d12b1b8804bfbf25fad35e9347fffe9a5603fc166a4
Python
2,026
58
# -*- coding: utf-8 -*- import pytest import numpy as np from pysteps.utils import pca pca_arg_values = ( (10, 10), (20, 20), (10, 5), (20, 15), ) pca_arg_names = ("len_y", "n_components") @pytest.mark.parametrize(pca_arg_names, pca_arg_values) def test_pca(len_y, n_components): pytest.importo...
3dc75a68c7f75914a5d2d68aaca64d02530c39985e712719b5e059b470133565
Python
2,029
62
from unittest import TestCase import numpy as np from numpy.testing import assert_equal, assert_almost_equal from .augment import (flip_left_right_image, random_flip_left_right_image, adjust_brightness, random_brightness, adjust_contrast, random_contrast) class AugmentTes...
56bed9cc2039dd8ce5965f75dfef71a0196690ca704415725e08fbc89b02866c
Python
2,029
65
import pandas as pd import matplotlib.pyplot as plt import matplotlib as mpl import numpy as np ''' This script generates Fig 8C from the paper. 8.11.23 GCG ''' params = {'axes.labelsize': 8, 'axes.titlesize': 8, 'legend.fontsize': 8, 'xtick.labelsize': 8, 'ytick.labelsize'...
652bd2b7400f4eaa80b2cc3cb65aae80f0a977819fac2ad34884c50d1e4bd5b4
Python
2,029
58
""" ClinicalASL - Clinical Arterial Spin Labeling processing pipeline Main pipeline script for processing ASL MRI data. Repository: https://github.com/JSIERO/ClinicalASL Author: Jeroen Siero Institution: UMC Utrecht (University Medical Center Utrecht), The Netherlands Contact: j.c.w.siero@umcutrecht.nl Description: ...
bbd91e6cedfde69b5c376bbb984859b10bbaab743be09ff6fd69ca793c515d78
Python
2,031
65
# coding=utf-8 """CellProfilerGUI package The CellProfilerGUI package holds the viewer and controller portions of the cell profiler program """ import sys BV_DOWN = "down" BV_UP = "up" def draw_item_selection_rect(window, dc, rect, flags): """Replacement for RendererNative.DrawItemSelectionRect window - d...
317f5b87295967d40e5204fda9c20f99b39367db40643444b6fc11653c40f282
Python
2,032
42
## Run: # python preprocess_raw_data.py -n_jobs 40 -data db5 -graph_nodes residues -graph_cutoff 30 -graph_max_neighbor 10 -graph_residue_loc_is_alphaC -pocket_cutoff 8 # If you want to use less DIPS data, then: python preprocess_raw_data.py -n_jobs 60 -data dips -graph_nodes residues -graph_cutoff 30 -graph_max_neighb...
b2dc6c12b52cba5dd12a238285e6b2f841a2334c9feb8d8642c1659f098cab47
Python
2,033
65
import os import numpy as np import pkg_resources from ptpython.ipython import embed from etspredict.data.hcp_aging_pheno.load import load_hcp_aging_pheno from etspredict.data.hcp_ya_pheno.get_data import load_behavioural_data def load_subject_list(dataset, sc=False): path = os.path.join("..", "etspredict", "d...
adc334c7337875e54dce2af695f60363ef8f139c0268eb2048f9dde774bbcbd5
Python
2,036
82
import numpy import numpy.random import pytest import cellprofiler_core.image import cellprofiler_core.measurement from cellprofiler_core.constants.measurement import M_LOCATION_CENTER_X, FF_COUNT, M_LOCATION_CENTER_Y, \ M_LOCATION_CENTER_Z, M_NUMBER_OBJECT_NUMBER import cellprofiler.modules.convertimagetoobjects...
6ff9a9322529d1c7409f2bf8c38d21ecb0cd8557d8190b91359212c118aa66ae
Python
2,037
48
class Config: def __init__(self): ################################################################# # settings for train and eval ################################################################# # set the npy or csv data path here self.patho_path = '' self.no...
b123302388de67762755b76786b571591175a83101512b6746534780097649ff
Python
2,037
88
# 20 standard amino acids # https://www.ncbi.nlm.nih.gov/Class/MLACourse/Modules/MolBioReview/iupac_aa_abbreviations.html _aa_standard = [ ('ALA', 'A'), ('ARG', 'R'), ('ASN', 'N'), ('ASP', 'D'), ('CYS', 'C'), ('GLN', 'Q'), ('GLU', 'E'), ('GLY', 'G'), ('HIS', 'H'), ('ILE', 'I'), ...
bffc6cc49086fa8f296077150ece85538586851cc1977758b9b112c2d7736a07
Python
2,038
82
# # nate berry # 2023-04-01 # # --------------------------------------------------------- # NOTES: # - this file contains a variety of parameters needed # throughout the processing of the EEG and COM data. # # --------------------------------------------------------- import numpy as np # smapling frequency ...
dbc4e7e925e9888cac9ea273c8eb9cfcbfe98ca1b6b4a00a711608f720ecc1e1
Python
2,042
63
from packaging.version import Version import cellprofiler_core.constants.pipeline import cellprofiler_core.measurement import cellprofiler_core.pipeline import cellprofiler_core.utilities.core.pipeline from cellprofiler_core import __version__ as core_version def dump(pipeline, fp, save_image_plane_details, sanitize...
66833d8df37a69d1c7a7a264536a91efb98a8ee350ee0a3c63ec5196caf239a9
Python
2,045
65
import cellprofiler_core.setting from ._does_not_predicate import DoesNotPredicate from ._does_predicate import DoesPredicate from ._filter import CONTAINS_PREDICATE from ._filter import CONTAINS_REGEXP_PREDICATE from ._filter import ENDSWITH_PREDICATE from ._filter import EQ_PREDICATE from ._filter import STARTS_WITH_...
3ce2780af9ad949c0e4694667c7b03847c64c2b26d704300cb006d46fb9d6cb3
Python
2,046
79
""" GaussianFilter ============== **GaussianFilter** will blur an image and remove noise. Filtering an image with a Gaussian filter can be helpful if the foreground signal is noisy or near the noise floor. | ============ ============ =============== Supports 2D? Supports 3D? Respects masks? ============ ============...
e32970f776bfd7dd476e4f1319ebaa9198eb3043b209672c79d24d3bf231d374
Python
2,046
64
from pathlib import Path from rdflib.namespace import RDF, RDFS from nidm.core import Constants from nidm.experiment.Utils import _rdflib_graph_from_prov_graph, read_nidm def _fixture_path(*names): base = Path(__file__).resolve().parent / "data" / "read_nidm" for name in names: p = base / name ...
78cc5db5f4db806d7c996f1206853b014f9f99a016ceb1d4be7f35916b437604
Python
2,047
54
import subprocess import shutil import os """ Versions are built from PyPi rvt-py. First from PyPi we build win-64 for each python version. Then from win-64 version we create versions for other platforms (for each python version). """ BUILDS_DIR = "./rvt-py_builds" # Builds for each python version PLATFORM_BUILDS_DI...
f9ed125490496a74f667710d9709944b1feb9ac323254975ca7e651680d03b1c
Python
2,047
62
import torch.nn as nn class DownsamplingModule(nn.Module): def __init__( self, input_channels, output_channels, conv=nn.Conv2d, conv_kwargs=None, norm=nn.BatchNorm2d, norm_kwargs=None, act=nn.LeakyReLU, act_kwargs=None, ): """ ...
7ec586646874bb1ee5063a0dd04ad340bbf0464620fc8a2d74cac5ec69fddc24
Python
2,052
66
""" """ import subprocess import psutil import shutil import os tmp_input_dir = 'tmp_inputs' tmp_output_dir = 'tmp_outputs' cfmid4_folder = '$HOME/cfmid4' def split_file(mfile, num): with open(mfile) as infp: if os.path.exists(tmp_input_dir): shutil.rmtree(tmp_input_dir...
cd93fba1e710de62c808570456c4fc4ad235b206bd3b6cdb7002cf8adf2074e0
Python
2,052
65
from qutip import* import numpy as np from qutip.qip.circuit import QubitCircuit, Gate from qutip.qip.operations import phasegate, rx, gate_sequence_product, cnot, sqrtswap, csign from scipy import optimize,integrate list = [ [[1,3], [2,3], [1,4], [2,4]], [[3,5], [4,5], [3,6], [4,6]] ] ; depth = 3 ; width =...
13a82873a56ebb22c03c1197f0e8117ba4e46cbb71d1888eec0944e49ec695cc
Python
2,053
81
from Bio import SeqIO import os import sys box_size = "12" # this code aligns a protein sequence alignment reference to the wild type sequence in the CNN output def get_reference_from_CNN_data(name): aaCodes = {'ALA':'A', 'ARG':'R', 'ASN':'N', 'ASP':'D', 'CYS':'C', 'GLN':'Q', 'GLU':'E', 'GLY':'G', 'HIS':'H', 'ILE'...
cef151fb57c762f2742926fb47d191c63e6c2ccc430e0cc3eb661a21b78e7d0f
Python
2,057
65
""" Tools for working with NIDM-Experiment files """ import os.path import click from nidm.experiment.Utils import read_nidm from nidm.experiment.tools.click_base import cli # adding click argument parsing @cli.command() @click.option( "--nidm_file_list", "-nl", required=True, help="A comma-separated...
11571a75e03ec5c5a86e43af257afabbfbcaa73b473aa6156fd44eee43521dbe
Python
2,058
69
from pathlib import Path from typing import Union import tifffile from imctools.data import Session from imctools.data.acquisitiondata import AcquisitionData from imctools.io.utils import OME_TIFF_SUFFIX, SCHEMA_XML_SUFFIX, SESSION_JSON_SUFFIX class ImcParser: """IMC folder parser.""" def __init__(self, in...
9ed7c5163a306f10365e51e473aceffbf866c4346278c71eb9d43d380f6733b7
Python
2,058
66
from qutip import* import numpy as np from qutip.qip.circuit import QubitCircuit, Gate from qutip.qip.operations import phasegate, rx, gate_sequence_product, cnot, sqrtswap, csign from scipy import optimize,integrate list = [ [[1,3], [2,3], [1,4], [2,4]], [[3,5], [4,5], [3,6], [4,6]] ] ; depth = 3 ; width =...
8242377afac827d04007c41d664456c32d4ae0bbe40e1e071f619e032a6b9242
Python
2,059
56
# -*- coding: utf-8 -*- import numpy as np import pytest from pysteps.tests.helpers import get_precipitation_fields from pysteps.verification.salscores import sal from pysteps.utils import to_rainrate, to_reflectivity test_data = [ (to_rainrate, 1 / 15), (to_reflectivity, None), ] @pytest.mark.parametrize(...
8e153485173d8d3d0ab340dd5850bf096486f6e16fc1f87664fcf266d1c03266
Python
2,060
60
import os import sys import numpy as np sys.path.insert(0, os.path.dirname(__file__)) from PIL import Image from handlers import model_builder from utils import utils # config _BASE_MODEL_NAME = 'MobileNet' _ROOT = os.path.dirname(__file__) _AESTHETIC_WEIGHTS_FILE = os.path.join( _ROOT, 'models', _BASE_MODEL_N...
b16797d65aa792f26357822eb8a0649dc7e8aa6e6f9bc032f9755b2ec4ec00b1
Python
2,060
45
from src.models.tabular.pytorch_tabular.base import PTBaseModel from src.models.tabular.pytorch_tabular.repository.models.autoint.autoint import AutoIntModel from omegaconf import DictConfig class PTAutoIntModel(PTBaseModel): def __init__(self, **kwargs): super().__init__(**kwargs) def build_network...
dc6b18cacf04b3716a87a67eb00ea45d894555832298d07b4e0dbbcf94291f74
Python
2,060
44
from src.models.tabular.pytorch_tabular.base import PTBaseModel from src.models.tabular.pytorch_tabular.repository.models.node.node_model import NODEModel from omegaconf import DictConfig class PTNODEModel(PTBaseModel): def __init__(self, **kwargs): super().__init__(**kwargs) def build_network(self)...
fe540d7462a2e9031b3c3a941a5fa9ad37c1a89043e65d71109b3044336ac156
Python
2,062
81
""" Norm Layer Factory Create norm modules by string (to mirror create_act and creat_norm-act fns) Copyright 2022 Ross Wightman """ import functools import types from typing import Type import torch.nn as nn from .norm import ( GroupNorm, GroupNorm1, LayerNorm, LayerNorm2d, LayerNormFp32, La...
26a63bff6b8573e1826d8679214c49940348151eb1d219dd805dd4acbeab32e0
Python
2,063
59
import numpy as np class HH: def __init__(self, v_init=-65.0, n_init=0.3177, m_init=0.0529, h_init=0.5961): self.v = v_init self.n = n_init self.m = m_init self.h = h_init self.C = 1.0 self.g_Na = 120.0 self.g_K = 36.0 self.g_L = 0.3 self.E_Na...
81ee575238405b8b92f5ead4f841f6af00719375751cec774abc791b7bb23c10
Python
2,063
78
import numpy as np from coeff import Coeff from grid import Grid from scipy import sparse from scipy.sparse import linalg from matplotlib import pyplot as plt import time import pandas as pd from concurrent.futures import ProcessPoolExecutor import os bulk_A = 1.0 def simulation(sigma): #start and end poten...
01df67d271d480c427d27f5048c1df22f0e4b809116f9457f69a61b7a12e7e67
Python
2,068
64
import tempfile import os import h5py import numpy from deeprank.domain.amino_acid import cysteine, serine from deeprank.features.gnomad import __compute_feature__, AF_FEATURE_NAME from deeprank.models.environment import Environment from deeprank.models.variant import PdbVariantSelection def test_dbnsfp(): env...
aa9863885f753a42dcda9cb43114b4c2cf39f64c2634627e9dd59fdf5d4b9f23
Python
2,070
53
#!/usr/bin/env python from rgbmatrix import RGBMatrix, RGBMatrixOptions from PIL import Image import urllib2 as urllib import io from samplebase import SampleBase class StillViewer(SampleBase): def __init__(self, *args, **kwargs): super(StillViewer, self).__init__(*args, **kwargs) self.parser.add_a...
14dbf1bee9ae59d4ed4789d5375817941929a8735fcc52c3fcb7e7c7651eeab0
Python
2,071
41
import glob import cv2 as cv import numpy as np from models.epu import EPUNet from models.subnetworks import Subnet from tensorflow.keras.optimizers import SGD from tensorflow.keras.callbacks import LearningRateScheduler, EarlyStopping train = [cv.imread(img) for img in glob.glob("../data/banapple/train/*.jpg")] trai...
04a357eec86b115e3a12420f144c37e418a7eb5e4e2f6bb4356c17703b92d7d4
Python
2,072
75
"""Instantiate Flask and set up plugins.""" import os from flask import Flask from flask_migrate import Migrate from afidsvalidator.config import ( DevelopmentConfig, ProductionConfig, TestingConfig, ) from afidsvalidator.model import db, login_manager from afidsvalidator.orcid import orcid_blueprint fro...
b1cce62f9bf6a9631108e1b76751548408b30dc4c71233a38c5d19a5089cac5c
Python
2,072
66
""" MIT License Copyright (c) 2022 Pawan Goyal 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, publish, ...
4e9abbde166c133fda385c65b1a72e8f7f65d49a439e51ecf25499ed97680799
Python
2,074
74
from torch.utils.data import DataLoader from torch.utils.data import Dataset import torch import pdb from typing import Any class WDNDataset(Dataset[Any]): """Dataset for processed WDN data.""" def __init__( self, data_path: str, sample_ids: int, include_leak_area: bool = F...
2a4563dbf37e5c3afd9a3857e08f2e03d9e58f87d6a9b1f38baf2099d289069c
Python
2,077
73
import torch import torch.nn as nn import os import tifffile import numpy as np from model import UNet from dataset import * from config import * from torchvision import transforms from collections import OrderedDict dirc_data = args.dirc_data dirc_ckpt = args.dirc_ckpt dirc_result = args.dirc_result if not os.path.ex...
d3859c692ce098fa51a91289146b89c8212e0c75febe25a827e2b4fe3c337e8b
Python
2,077
78
import numpy as np from coeff import Coeff from grid import Grid from scipy import sparse from scipy.sparse import linalg from matplotlib import pyplot as plt import time import pandas as pd from concurrent.futures import ProcessPoolExecutor import os bulk_A = 1.0 def simulation(sigma): #start and end poten...
db9e501fef859d7c974a8b40c79888f70fbda2c502d03c36dd0e90cf3e99a199
Python
2,078
75
#!/usr/bin/env python from evaluate_results import pearson_confidence from matplotlib import pyplot as plt from math import sqrt import numpy as np plt.switch_backend("agg") # Generate a figure showing the relationship between correlation, number of datapoints and # the confidence interval def generate_points(r_s...
dff26e415e33482f1a4a453d1e495322e02747bbf1efc8c8dfbb3b020e82e4a3
Python
2,081
58
import numpy as np from numpy import pi,linspace import cmath, random from pylab import * from training_data import * from forward_backward import * eps = 0.15 ; iters = 60; def mean_fidelity(X): total_fidelity = 0 ; for i in range(size_train): phiout, _ = forward_th(X, train_psi[i]) ; t...
f5ae43cdd465b192ca4316c86a06df3ab02adfe6a1a6304972619c477f9c135d
Python
2,081
52
### list of npy file import glob import random import numpy as np import os train_flist_main1 = [] valid_flist_main1 = [] test_flist_main1 = [] random.seed(259) save_path = "./five_cross_valid" nii_path = "data_prepro" npy_path = "./five_cross_valid" subj_ad = glob.glob(os.path.join(nii_path,"FLAI...
8ad576ec1ce1edaf5eaf75ac7a79edbe59f308cd192c1c355de9edb38fb0b807
Python
2,084
58
import torch.nn as nn import sys import torchvision import traceback def brainage(parameters): """ This function creates a VGG16-based neural network model for brain age prediction. Args: parameters (dict): A dictionary containing the model parameters, including: - model: a sub-dictio...
f1b642dc09d0bf7be952b3529cbbdc73fb3413e3fadd76eb7f032fece64d8ede
Python
2,084
40
from typing import Annotated, Optional from pydantic import Field, validate_call, ConfigDict from cellprofiler_library.opts.correctilluminationapply import Method from ..types import Image2D from ..functions.image_processing import apply_divide, apply_subtract, clip_low, clip_high @validate_call(config=ConfigDict(arb...
81cb88d77e11f9ccb48d34295da6f289999367cc392b19574162aa3475c90966
Python
2,085
59
import matplotlib.pyplot as plt import torch def strength_order_training(data='qm7', n_sample=10, fontsize=28): J_ = [] for data in ['qm7', 'qm8', 'hamiltonian', 'newtonian']: J_.append(torch.load(f'../save/J_{data}_egnn.pt')) fig, ax = plt.subplots(1, 4, figsize=(32, 7)) plt.rcParams.updat...
3a9d48133cb2d742d62c9bfd8bf7cf09df073274f8a6a3d170e7545138918a73
Python
2,091
65
import os from collections import namedtuple import torch import torch.nn as nn from sklearn.metrics import classification_report from torch.optim import Adam from tqdm import tqdm from data import DataIterator from loss import FocalLoss from model import CNN from torchtext import data, vocab from args import get_ar...
bf0b1e061360563cf442521508c951c42fb7bc2b850c47bbd66162c2a837ada8
Python
2,095
38
from torch.utils.data import DataLoader from asteroid.data import LibriMix, WhamDataset from .utils import MultiTaskDataLoader def make_dataloaders(corpus, train_dir, val_dir, train_enh_dir=None, task="sep_clean", sample_rate=8000, n_src=2, segment=4.0, batch_size=4, num_workers=None,): if c...
6da65deae4d16442907648ae05a5f379a534d05ac7f7f65f289fe02ebe17174c
Python
2,096
60
''' behavior for Barbosa, Stein et al. (Nat Neuro, 2020) created by H Stein, Mar 2020 input: ../data/behavior.pkl output: ./serial_bias.pkl ''' import numpy as np import scikits.bootstrap as boot import pandas as pd import pickle import sys sys.path.insert(0, '../../helpers/') import heike_helpers as hf #########...
23980fb66cff450dc23e59690798813b4c0be5e078f91d9a86fa030a6d8b81e8
Python
2,105
72
""" Convert TIFs of selected markers into pixel x markers matrix Author: Candace Liu Date: 3/18/21 """ import pandas as pd import numpy as np import os import matplotlib.pyplot as plt from PIL import Image import scipy.ndimage as ndimage # sigma for Gaussian blur s = 2 # Markers for clustering markers = ["Abeta","A...
bf6f18ad22db287e4f8d03377c4df5b7f0928729252222d1d85ad342e7e2b1ac
Python
2,105
63
""" Generate a plot of noise vs R and number of sensors for regularly-spaced barbutes """ import numpy as np from mayavi import mlab import matplotlib.pyplot as plt from megsimutils.arrays import BarbuteArraySL, noise_max N_SENS_RANGE = np.arange(135, 241, 5) R_RANGE = np.linspace(0.15, 0.25, 20) #N_SENS_RANGE = np....
d04b97fa42b4664fde108943cd0c464f06b6b033103c9a5d4bfc6ccbbefc4455
Python
2,107
82
from ._module import Module from ..image import Image from ..setting.subscriber import ImageSubscriber from ..setting.text import ImageName class ImageProcessing(Module): category = "Image Processing" def create_settings(self): self.x_name = ImageSubscriber( "Select the input image", doc=...
8c30dcab453af3458bd61daad0853cebad9ee861a8da764e87be46e3a45b70c0
Python
2,109
51
import numpy as np import torch class EarlyStopping: """Early stops the training if validation loss doesn't improve after a given patience.""" def __init__(self, patience=7, verbose=False, delta=0, path='checkpoint.pt', trace_func=print): """ Args: patience (int): How long to wait a...
72e3ea506ac571321f853ebb940c699f2c2df2df72ae5ab21d497ac23af5f2aa
Python
2,111
56
import os from pathlib import Path from typing import Optional from GANDLF.compute import create_pytorch_objects from GANDLF.config_manager import ConfigManager from GANDLF.utils import version_check, load_model, optimize_and_save_model def post_training_model_optimization( model_path: str, config_path: Optional[...
88c8b784bb9948ef51e3d617f8b2d20b1b266b52b775f1314b9a135f0984d83d
Python
2,112
62
import os from manifest import prepare_manifest, test_json_files from allensdk.core.brain_observatory_cache import BrainObservatoryCache def get_boc_json_files(manifest_file): # We need 'base_uri' until all of the data is publicly released boc = BrainObservatoryCache(manifest_file=manifest_file, base_uri="ht...