sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
4fc21cddd7db225bb0c5cbfa18c6ddc75204b067a1fb24c741c0d4373fd3f303
Python
7,998
225
# 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...
8ea9121519539732b16e6b44a323b54238a7741cebb516791417ff78ed227e7e
Python
7,998
179
"""CLI interface for imctools library""" import argparse from imctools.converters import ( export_acquisition_csv, mcdfolder_to_imcfolder, omefile_2_analysisfolder, omefile_to_histocatfolder, omefile_to_tifffolder, omefolder_to_histocatfolder, v1_to_v2, ) from imctools.converters.exportacq...
09d77d55be7d5f4f7382755e6f4ac948fb9bc07a87986fda0372ecc1e0da9df6
Python
8,004
196
import torch import numpy as np from importlib import import_module from .default import NormalNN from .regularization import SI, L2, EWC, MAS from clb_dataloaders.wrapper import Storage class Naive_Rehearsal(NormalNN): def __init__(self, agent_config): super(Naive_Rehearsal, self).__init__(agent_config)...
b3e443d57c808ce95da5eeb53efe23e08e2ba96cae299708c05f0b4351cc646a
Python
8,006
170
from __future__ import print_function import svgwrite import sys import os import logging logger = logging.getLogger('root') logger.propagate = False boxWidth = 10 box_size = 15 v_spacing = 3 colors = {'G': '#F5F500', 'A': '#FF5454', 'T': '#00D118', 'C': '#26A8FF', 'N': '#B3B3B3', 'R': '#B3B3B3', '-': '#FFFFFF'} d...
f53005e7cc8c6f1cdcc5dbd2ac03c23d68386e553a9a2afdc73d4b456a7be1cc
Python
8,016
250
import pickle import numpy as np import deeprank.learn.modelGenerator import torch.optim as optim from deeprank.learn import NetworkGenerator, NeuralNet, DataSet class saved_model(object): def __init__( self, conv_layers_params=None, fc_layers_params=None, reward=...
b79a52b23e8d6accab10fe4d810d26dfef79f4122b5f30526405182748a4c18f
Python
8,017
212
import math import logging import typing import numpy as np class RveInfo: """ This class stores all the constant values which are needed for the current RVE-Generation. If one of theses Parameters is needed in any of the following classes/modules/functions for generating the RVE it can be called by i...
781606805fed38bb39b98f7f6f8cff642eaed970de583df67c21c4dcbf173f9d
Python
8,018
207
import numpy as np from numba import njit from configuration import default_lower_bounds, default_upper_bounds @njit def _sample_diffusion_trial(v, a, tau, beta=0.5, dt=0.001, s=1.0, max_iter=1e5): """Generates a single response time from a Diffusion Decision process. Parameters: ----------- v ...
bccd7c0e8655d1c0635fc34c3fe32946a77db9f701efba569110c70070932d32
Python
8,022
226
from typing import Optional, Tuple from pandas.util import hash_pandas_object import torch from torch.utils.data import DataLoader from abc import ABC, abstractmethod from dataclasses import dataclass from GANDLF.models import get_model from GANDLF.schedulers import get_scheduler from GANDLF.optimizers import get_optim...
a3f35065e3ea9e885c0ba563740f7542dff37d852190ff88ab5e77be7b028fae
Python
8,047
177
# -*- coding: utf-8 -*- # Some code in this file is from https://github.com/jiesutd/LatticeLSTM import torch import torch.autograd as autograd import torch.nn as nn import torch.nn.functional as F import numpy as np from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence # from kblayer import GazLayer ...
03bffb86be73e7c06e99e6a00c4332c8657ba195a092872fe51684e5ef831443
Python
8,048
180
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed May 27 10:43:05 2020 @author: nozais """ import os import glob import h5py import nibabel as nib import sys import argparse class MyParser(argparse.ArgumentParser): # Used to diplay the help if no argment is given def error(self, message): ...
f39d7baf2c3b32e1ae3ea9531b01a376322e92a1eca45e0ec7ecc61eb4a015fe
Python
8,049
212
from __future__ import annotations import importlib.util import json import shutil import sys from pathlib import Path import pytest import yaml ROOT = Path(__file__).resolve().parents[3] TOOLS = ROOT / "tools" if str(TOOLS) not in sys.path: sys.path.insert(0, str(TOOLS)) SPEC = importlib.util.spec_from_file_loc...
a74250a15340a5979a61e0db30c86f6e2b3791a68a310a3edf8659ced72f1ba9
Python
8,061
189
# -*- coding: utf-8 -*- """ Created on Sat Aug 7 18:23:18 2021 @author: Jing Li, Small steps make changes. dnt_seq@163.com """ from sklearn.manifold import TSNE # from sklearn.datasets import load_iris from sklearn.decomposition import PCA import matplotlib.pyplot as plt import seaborn as sns import pand...
09695be610e50133c6be069109a2e5f8b0ea7546a9a11d9b748f70b0a7a49b39
Python
8,066
295
import numpy import pytest import scipy.sparse.coo import cellprofiler_core.image import cellprofiler_core.measurement import cellprofiler_core.module import cellprofiler.modules.convertobjectstoimage import cellprofiler_core.object import cellprofiler_core.pipeline import cellprofiler_core.workspace OBJECTS_NAME =...
b9f703cbeb99eee23bc965446d490fe7ddc56d8846f7477fd172e2698e3d113a
Python
8,069
237
import numpy import cellprofiler_core.image import cellprofiler_core.measurement import cellprofiler.modules.invertforprinting import cellprofiler_core.object import cellprofiler_core.pipeline import cellprofiler_core.workspace I_RED_IN = "RedInput" I_GREEN_IN = "GreenInput" I_BLUE_IN = "BlueInput" I_COLOR_IN = "Co...
1539d08824093c250304436920f39eac51b3b350ce9403c7d10a42dcaef82e76
Python
8,083
216
from __future__ import annotations import bz2 import copy import gzip import hashlib import json from pathlib import Path from typing import Any import pandas as pd import pytest from conftest import CORPUS from test_dm_index import dm_index, make_release, prepare_root from datamonger import DatasetSplits, FetchResu...
17221bdffe29eb0c25cef53e631356418d9bd9a997b67056ecb2308a751911ac
Python
8,090
218
import h5py from unnatural_movie_analysis_lsn import unnatural_movie_analysis_lsn 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, dotd...
e990585cdb75d09b8961e750dc7e3f776d7709d2145c7112083bc5ab354e4fcd
Python
8,092
192
""" File name: train_models.py Author: Esra Zihni Date created: 21.05.2018 This is the main script for training models. It reads the implementation and path options from the config.yml script. It loads the dataset, splits the data into training and test sets, creates the specified model(s), runs gridsearch to select ...
18b46c5e35dfb2372d69a5268b9ea6277e6c96a6d703daaead9e4fc368a51bf8
Python
8,093
242
import gzip import numpy as np from lib.datasets.download import maybe_download_and_extract import math import random import numpy as np from .dataset import Datasets, Dataset DEFAULT_SOURCE_URL="http://yann.lecun.com/exdb/mnist/" def _read32(bytestream): dt = np.dtype(np.uint32).newbyteorder('>') return np.from...
ecf683d141c4f9c77cafdfcb9694f5f07c1dc4940ef9665068814d71a2c3065a
Python
8,094
173
from cellprofiler_core.preferences import INTENSITY_MODE_HELP, INTERPOLATION_MODE_HELP C_CHOOSER = 0 C_COLOR = 1 C_SHOW = 2 C_REMOVE = 3 WORKSPACE_VIEWER_HELP = f""" The workspace viewer is a flexible tool that you can use to explore your images, objects and measurements in test mode. To use the viewer, select *View ...
b93281944e52872ea20647534b2ccf596a1d58a7397a3cfb22d826e0efb0fb51
Python
8,115
193
from enum import Enum import centriole.zernike def get_zernike_indexes(): """The Zernike numbers measured by this module""" return centriole.zernike.get_zernike_indexes(10) class ObjectSizeShapeFeatures(str, Enum): """The category of the per-object measurements made by the MeasureObjectSizeShape module"""...
cdec798e76457c90465e9919da50b6b5d268c0ef0cba917ed6164578db676a6c
Python
8,115
119
# -*- 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....
bf2aad82ed2ac2f257d3b8bde6265612041648b5b7a13f594169259029707419
Python
8,119
289
import sys from itertools import pairwise import numpy as np import pytest from hypothesis import given, settings, strategies import xgboost as xgb from xgboost import testing as tm from xgboost.testing import no_cupy from xgboost.testing.data_iter import ( check_invalid_cat_batches, check_iterator_gc, ch...
f29790cf7895d5e37d969576f82e43bf3976ca107270a2da171e44ba78ff972a
Python
8,119
225
""" This file implements a leaky intergrate-and-fire (LIF) model. You can inject a step current or sinusoidal current into neuron using LIF_Step() or LIF_Sinus() methods respectively. Relevant book chapters: - http://neuronaldynamics.epfl.ch/online/Ch1.S3.html """ # This file is part of the exercise code repository...
bb8d466d1bafafec7317e4d3c46f3b58a3de16f0b23dc7309ea5d56b5e3ab021
Python
8,131
261
# Evaluate segmentation results import colorsys import itertools import json import os import pickle import matplotlib.pyplot as plt import numpy as np import pycocotools.mask as mask import scipy.ndimage as ndimage from PIL import Image RESULT_PKL = "./results.pkl" # path to results .pkl file IMGS_PATH = "./csb-1/...
20784f825614aa30e22e09d36c35f0ce33ad4dc1b5367b70bca86bdc3a2513cc
Python
8,139
169
""" Per-class loss weights derived from label frequencies Class stats (per-class positive counts and the sample count, written by `class_weights.py` in the repo root) are loaded with `load_class_stats()`. `compute_class_weights()` turns them into BCE / ASL `pos_weight` or `class_weight` vectors, `load_class_weights()`...
0adbc7cfc2cbae38e7a3de86fc3aa92553f24d58d77e2ec366ec369939cf8bd7
Python
8,149
224
from rdkit.Chem import AllChem import pandas as pd import sys from module.pair_generation_top import Generator from module.pair_generation_all import Generator as Generator_all from module.paired_dataset import Dataset from torch.utils.data import DataLoader from rdkit import DataStructs from rdkit import Chem import...
99ec9cf208e3ee0db1600b97b2052006e34daa11f9c821c0028f080999006840
Python
8,159
202
from __future__ import division from unittest import TestCase import numpy as np from numpy.testing import assert_equal import scipy.sparse as sp from .coarsening import (coarsen_adj, _coarsen_adj, _coarsen_clustered_adj, _compute_perms) from .adjacency import points_to_adj from .distortion ...
e7f8495d76d3f1043bcd1d2ea445a5bcb5ca50417095e1382f64ba328687453f
Python
8,162
253
import sys import functools from typing import Any, cast import numpy as np from numpy.typing import DTypeLike from .MatlabIO import * # mapping from python type specification (scipy loadmat will report those) to numpy dtype string abbreviation if sys.platform.startswith('win'): numpy_type_dict = { ty...
8060aacded4370684dba503b0810438f643fb596c2525ac5df1444a228510f86
Python
8,177
178
import time import numpy as np from scipy.linalg import solveh_banded class NewtonMethod: def __init__(self, theta0=None, g_log_prior=None, h_log_prior=None, gh_log_prior=None, gh_log_likelihood=None, banded_h=False, theta_independent_h=False, learning_rate=1e-1, initial_learning_rate=1e-2, ...
ddaeae9e1fd9ad4e4767c690cf7ca56a1e72aaf405cedb7405499670fa789a59
Python
8,184
199
import numpy as np import torch import ttach as tta from typing import Callable, List, Tuple from pytorch_grad_cam.activations_and_gradients import ActivationsAndGradients from pytorch_grad_cam.utils.svd_on_activations import get_2d_projection from pytorch_grad_cam.utils.image import scale_cam_image from pytorch_grad_c...
3e38efb531230e3377951c0149e1cfa63825883bf27ecbe947f73ebcd30095d3
Python
8,202
215
# unrefined: .features # filter_by: score mcrl_score dot revdot prob percentile # equivalence_by: inchikey inchik name mzrt # FDR: True False # MAX_FDR: 100 # IF_NO_FDR_WHAT_MIN_SCORE: 900 # RT_TOL: 2.0 # PPM: 20.0 # MatchPolarity: True False # Keep_Decoy_Hits: False True # output: .features import sys import time imp...
ca3b800fd2415e81fe7ae10d22187e25cc820292dbfc4cff247efbfb530f84c0
Python
8,203
238
from glob import glob from os import path import os from time import sleep import numpy as np from tensorflow.keras.optimizers import Adam, RMSprop from tensorflow.keras.utils import get_custom_objects from tensorflow.keras.models import load_model from config import * from dbx import download_and_extract ...
9c01672607a848bc73d748156d204bab40e6ce9cad139d4be9cbfed308f53611
Python
8,210
170
""" ClinicalASL - Clinical Arterial Spin Labeling processing pipeline DICOM to NIfTI conversion 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: Function for conve...
2ebfa869c14aa5aaf38e185bd57f557907c33df3d79df3af35e1d00166a04b68
Python
8,216
274
# -- coding: utf-8 -- """ pysteps.verification.ensscores ============================== Evaluation and skill scores for ensemble forecasts. .. autosummary:: :toctree: ../generated/ ensemble_skill ensemble_spread rankhist rankhist_init rankhist_accum rankhist_compute """ import numpy as n...
978421f49e04ca18b25d9e6773e4cd5385e1280bb59c3b14a51c133f5042788c
Python
8,231
214
#!/usr/bin/env python3 """ A collection of functions used by ciftifies report generation functions i.e. ciftify_peaktable and ciftify_dlabel_report """ import os from ciftify.utils import run import ciftify.config import numpy as np import pandas as pd import logging import logging.config def define_atlas_settings()...
c31d1d6d75ecf9c2f91aeb1af4ee96541dab86748d996c6c510de401edd1995a
Python
8,233
220
# -*- coding: utf-8 -*- """ Created on Sat Aug 7 18:23:18 2021 @author: Jing Li, Small steps make changes. dnt_seq@163.com """ from sklearn.manifold import TSNE # from sklearn.datasets import load_iris from sklearn.decomposition import PCA import matplotlib.pyplot as plt import seaborn as sns import pand...
5b4d844f6d793d324a02688d7fe4131005a1bc2542158423922a4cf3f432b8b5
Python
8,238
230
""" ConvMixer Papers: * `Patches Are All You Need?` - https://arxiv.org/abs/2201.09792 """ from typing import List, Optional, Tuple, Type, Union import torch import torch.nn as nn from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD from timm.layers import SelectAdaptivePool2d, get_device_dtype from ._r...
eeea0b65433e1b4ae6fcabe730164b64a0c0608304dbcce3c2ada3d7499d9295
Python
8,240
220
# -*- coding: utf-8 -*- """ Created on Sat Aug 7 18:23:18 2021 @author: Jing Li, Small steps make changes. dnt_seq@163.com """ from sklearn.manifold import TSNE # from sklearn.datasets import load_iris from sklearn.decomposition import PCA import matplotlib.pyplot as plt import seaborn as sns import pand...
c66cc09fb3f492a25dfc671fd7b9cc715efce29a16daaa62dc0638f374e4da4a
Python
8,247
235
import hashlib, os from typing import Any, Dict, Optional, Tuple import torch from ..version import __version__ from .generic import get_unique_timestamp, get_git_hash # these are the base keys for the model dictionary to save model_dict_full = { "epoch": 0, "model_state_dict": None, "optimizer_state_dic...
edcc7fc76f4731cf454c50726e7d9751bf66f3c5aedaa87354f7a0e87c97d3e7
Python
8,251
191
#!/usr/bin/env python3 """ Takes a atlas or cluster map ('dlabel.nii') and output a nifti image in a particular participants space Usage: ciftify_dlabel_to_vol [options] --input-dlabel <input.dlabel.nii> --left-mid-surface <input.L.surf.gii> --volume-template <voltemplate.nii.gz> --output-nifti <output.nii.gz> Ar...
f58f6b41a504553aa6a306bc39ed1b847cf3c9d54ec5207b3b26ba8a7bef3f92
Python
8,252
230
import sys from os import path sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) from sklearn.metrics import confusion_matrix, ConfusionMatrixDisplay, classification_report import matplotlib.pyplot as plt from knn import * from inference import * import cv2 import time from datetime import timedelt...
4a1efa18bdbc4fa15076a7dae8b138593cfef882d9b4e08b1f89e532ac03a6c1
Python
8,254
243
################################# # # Imports from useful Python libraries # ################################# import numpy import os import skimage import subprocess import uuid import shutil import logging import sys from your_dependency_with_a_long_and_improbable_name import somefunction ########...
227d608fc5373c148506837839518a7290da0ece5cd6b4d0e56344fb2ca8c48b
Python
8,263
252
from typing import Tuple, Dict import numpy as np from scipy import linalg as LA from functions import general as FG, olfactory as FO, nmf as nmf def generate_samples(D: int = 50, N: int = 100, K: int = 10, method: str = 'spiked_covariance', options: dict = {}, scale_data: ...
142c765bab10eda8fabccaefa55a1aea2427e0c6d8c7ac40b9e1890a9adfee97
Python
8,272
182
import warnings warnings.filterwarnings("ignore") import logging import platform import sys import matplotlib from argparse import ArgumentParser import pytorch_lightning import torch from utils import load_state_dict_greedy from pytorch_lightning.strategies import DDPStrategy import numpy as np from functools import ...
34964de12efa44c2dee4c857a40e0e7c71effdf1ef67f368317d76139aa7c7dd
Python
8,274
177
import os.path as osp from typing import Any, Tuple import h5py import numpy as np import numpy.typing as npt from ptsa.data.readers import BaseRawReader __all__ = [ 'H5RawReader', ] class H5RawReader(BaseRawReader): """Class for reading raw EEG data stored in HDF5 format.""" def __init__(self, **kwarg...
9adb46f653be719054ea93cd86d6033e9c4e7be497da7da3a40b10cccaefe634
Python
8,277
186
"""Configuration object for the substructure pipeline. Every knob the pipeline uses lives here. `SubsConfig.from_rve_info()` is the only place that reads `RveInfo`, so the pipeline modules themselves stay free of global state and are directly testable. """ import os from dataclasses import dataclass, field, asdict fro...
da1b04f1de5765c4e968cc55b5fb28828efe563d248600c87acab760e7f92c30
Python
8,278
226
from glob import glob import sys import random as rd import numpy as np import scipy.io as scio from joblib import Parallel, delayed import multiprocessing as mp import time as tme ############################################################################## # FILES ...
011c3645c970adbd3ee20b117e9d94d9194a16ba134f1cc89c4a6d3b041be0f9
Python
8,282
290
"""Utilities for generating AFIDs-related graphics""" import plotly.graph_objects as go from afidsvalidator.model import EXPECTED_DESCS def gen_connecting_lines(ref_afids, user_afids): """Assemble points from each fcsv into pairs. Parameters ---------- ref_afids : Afids Reference AFiDs obje...
cfce26328d5ca15b89036f17dcde49e12a6d883a902e56ec8b349564ac0e57f4
Python
8,283
247
# -*- coding: utf-8 -*- """ pysteps.postprocessing.interface ==================== Interface for the postprocessing module. Support postprocessing types: - ensmeblestats - diagnostics .. currentmodule:: pysteps.postprocessing.interface .. autosummary:: :toctree: ../generated/ get_method """ import ...
4b99f376119ba7b2fee9a85bcf1f8cc5a02b79d937a5236ab28d7839d15c6ade
Python
8,285
211
"""Write the substructured RVE back out as a DAMASK material.yaml + grid.vti. One DAMASK material per block for substructure cells, one per grain for everything else, so each block carries its own orientation. The phase definitions and the homogenization from the material.yaml that dragen/generation/spectral.py alread...
230e09af999e83c99971630d5c81cba360ac519fa46339715e490879b278b03e
Python
8,290
185
# -*- coding: utf-8 -*- """ @author: bartulem Convert the labeled tracking .csv to .pkl for loading into the GUI. The Jython GUI we use to visualize the behavior of the animal requires the labeled .csv data to have a certain format (in order to be loaded). This script performs those modifications and when the proce...
8059b82deaa1f9e16d421ae89a397d34ac9a93f110d79cc3a54b7f43bda15997
Python
8,290
226
import os import numpy from deeprank.models.variant import PdbVariantSelection from deeprank.tools import sparse from deeprank.domain.amino_acid import amino_acids def get_variant_group_name(variant): """ Args: variant (PdbVariantSelection): a variant object Returns (str): an unique n...
33b6f42b2a2377e28d4446434236b499fd35e98d819a7dd77ad344e0d9336191
Python
8,291
234
# encoding: utf-8 # Author : Floyed<Floyed_Shen@outlook.com> # Datetime : 2022/7/26 18:56 # User : Floyed # Product : PyCharm # Project : BrainCog # File : vgg_snn.py # explain : from functools import partial from torch.nn import functional as F import torchvision from timm.models impor...
2367e41b46c1f20682823a82461a249048158559dae936efb52bd5d28b422a93
Python
8,300
185
# Fundamental libraries import os import sys import time import glob import copy import random import datetime import warnings import itertools import numpy as np import pandas as pd import pickle as cp import seaborn as sns import multiprocessing from scipy import stats from pathlib import Path from ast import literal...
9529e097a30f833589bd621931cfdc515c55e7f072a44b38392987f73c7fc8ff
Python
8,310
181
""" ClinicalASL - Clinical Arterial Spin Labeling processing pipeline DICOM parameter extraction 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: Function for extr...
1f58453f3fce965596430db582ccf158032cfea6ae19f6c1da659c2cde4d0207
Python
8,319
211
# -*- 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...
a6e57da83f1e460b717cd630266b252d37a12f249a139b435d620da4092bda48
Python
8,324
154
from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import sys, os import tensorflow.compat.v1 as tf tf.disable_v2_behavior() import tensorflow_probability as tfp from tensorflow.python.framework import constant_op from tensorflow.python.fram...
cc45b7052ef34f34835ba075c10ab4c4d8db7626a3f132abc2fa62d94cf579ac
Python
8,332
227
import json import math import os import numpy as np import matplotlib.pyplot as plt from sklearn.cluster import KMeans from sklearn.metrics import silhouette_score from utils import timer from distance_calculation import get_mds def get_dataset(datafile): with open(datafile, "r") as json_file: return np...
c2e8637665be4420b5b5677e03add592518eed816fef4096dde2421c6aeae399
Python
8,348
203
from typing import Any import os import numpy as np import torch import yaml def set_args(args): config_name = f"config_{args.dataset}.yaml" with open(config_name, 'r', encoding='UTF-8') as f: config = yaml.safe_load(f.read()) args.prefix = config['prefix'] args.ratios = config['ratios'] ...
3ddf6aa5a7f37a5acecb88bd0071844442e3a5ec39647ceee348c6fca8f7f395
Python
8,350
230
"""Numerical-correctness tests for ButterworthFilter and ResampleFilter. Hand-coded ground-truth tests complementing the regression suite in ``tests/test_regression.py``. Asserts mathematical properties that hold for any correct implementation: stopband attenuation, passband flatness, zero-phase (filtfilt), frequency ...
50f83f386651015f76d0954c9c6e0c63a14f8c882d0eb5b90c0b4e3083cb912b
Python
8,351
243
import centriole.cpmorphology import centriole.outline import numpy import cellprofiler_core.image import cellprofiler_core.measurement import cellprofiler_core.module import cellprofiler.modules.expandorshrinkobjects import cellprofiler_core.object import cellprofiler_core.pipeline import cellprofiler_core.workspac...
d55685193f57f7e6fef605143e26fbec672cf259b984cc80c5a1c3ba673c8a63
Python
8,351
199
ASSIGN_ALL = "All images" ASSIGN_GUESS = "Try to guess image assignment" ASSIGN_RULES = "Images matching rules" LOAD_AS_GRAYSCALE_IMAGE = "Grayscale image" LOAD_AS_COLOR_IMAGE = "Color image" LOAD_AS_MASK = "Binary mask" LOAD_AS_MASK_V5A = "Mask" LOAD_AS_ILLUMINATION_FUNCTION = "Illumination function" LOAD_AS_OBJECTS...
3b3c73773ff79f1bb4d208243a210f383ce4ba43973f0a3f29dce4300a146c61
Python
8,352
223
# -*- coding: utf-8 -*- from . GenomeTrack import GenomeTrack from . BedGraphTrack import BedGraphTrack from matplotlib.patches import Rectangle from matplotlib.collections import PatchCollection from matplotlib.path import Path import matplotlib.patches as patches import numpy as np DEFAULT_NARROWPEAK_COLOR = '#FF0...
0b3f4662c0537a776eb6c7caa52c1c7f14a4c4a4a8845c91c5a0c691bfad6e3d
Python
8,353
288
#!/usr/bin/env python3 # coding: utf-8 """ 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...
26d4aad2fddd9c312d9fa1d65c750286dd5d937537833dc3d049bf718f919eb8
Python
8,355
196
"""Current model traits and construction arguments, separate from source checkpoint metadata.""" from typing import Any, Dict, Optional, Sequence, Tuple, Union from torch import Tensor, nn def _spatial_size(size: Union[int, Sequence[int]]) -> Tuple[int, int]: if isinstance(size, int): size = (size, size...
6c20e6c2ba50c34a2624f9b9b0ddc37d680034d74b0ae805a80db9544cf40b22
Python
8,356
214
import glob import sys import os.path import logging import jinja2 import importlib.resources import wx import wx.html2 from cellprofiler_core.preferences import set_startup_blurb import cellprofiler.gui.help.content import cellprofiler.gui.html import cellprofiler.gui.html.utils import cellprofiler.gui.utilities.ic...
e4116bb8650332a8fd0fc2ac1e8f75729824fb8d60eb7ad2a796ced787e48465
Python
8,358
269
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 from Helper import calcY import math import argparse from itertools import product import sys SLRUM_ARRAY_TASK_ID = int(sys.argv[1]) nu_list = [1.4e-6,1....
c40e3ddde58b0dc37344380bf2d311b7917dea6301d632c842eb70f6117dad55
Python
8,367
251
""" FindMaxima ========== **FindMaxima** isolates local peaks of high intensity from an image. The returned image will feature single pixels at each position where a peak of intensity was found in the input image. This can be useful for finding particular points of interest, identifying very small objects or genera...
b7d0e9711a6d1abfc86ecde64c23a988005663f60ba1621f7c68b8b2271ca986
Python
8,368
236
""" DisplayHistogram ================ **DisplayHistogram** plots a histogram of the desired measurement. A histogram is a bar plot depicting frequencies of items in each data range. Here, each bar's value is created by binning measurement data for a set of objects. A two-dimensional histogram can be created using the...
1738fba7830b0b8a24d7297cf88e8548fd643e64740ab1da3f3a846dbe849aa9
Python
8,382
216
from unittest import TestCase import torch from .losses import DCS, DiceLoss, FocalLoss, GeneralizedDiceLoss, DiceCoeff from .evaluation import dice_coeff import matplotlib.pyplot as plt from torch import sigmoid class DCS_mixed(object): def __init__(self, pre_sigmoid=False): self.pre_sigmoid = pre_sigm...
e60eb8af21e584b4ea9f1d2d13773f057a06405ebcca270ec9fe12dd7d0a5776
Python
8,384
181
# -*- coding: utf-8 -*- import os import pickle import subprocess import sys import time import numpy as np import scipy.io as sio import scipy.io.wavfile as wav import torch import torchvision from python_speech_features import fbank from sklearn import preprocessing from sklearn.preprocessing import no...
f31f1fb29707efa6d202827c0773239430bc8652cfcffa20394fca632d824927
Python
8,395
161
import datetime import logging from copy import deepcopy from os import makedirs from os.path import join, exists from posixpath import abspath import argparse, math, random, sys, time import numpy as np #np.random.seed(0) # set random seed for keras neural nets #import xgboost as xgb import tensorflow as tf from kera...
7b810a9a9452390e69f0e2b55fb2828217ea86409bd31f02bee2557bdaabb06a
Python
8,404
221
import numpy as np import pandas as pd import torch import lightgbm as lgb import hydra from omegaconf import DictConfig from pytorch_lightning import seed_everything from src.datamodules.tabular import TabularDataModule from src.utils import utils import matplotlib.pyplot as plt import seaborn as sns import xgboost as...
b6eab12fd1b42d9ca440de4a2398dc1b3ad23369c68d9aa4060fad211f25a511
Python
8,404
143
from multiprocessing import Process, Queue, cpu_count import pysam, sys import getopt import fileinput from sys import argv # Used to bring in the feature argv, variables or arguments def main(scriptname, argv): vcf = '' ; tbam = '' ; nbam = '' ; slop = 1000; ## Default values try: opts, args ...
2cd8ece29c805711294c2e0e83590dbd5d0b7a42cb9fade088c580699d9b176f
Python
8,407
229
import json import math import os import numpy as np import matplotlib.pyplot as plt from sklearn.cluster import KMeans from sklearn.metrics import silhouette_score from utils import timer from distance_calculation import get_mds def get_dataset(datafile): with open(datafile, "r") as json_file: return np...
fcb92636080015121ed4f74b459a0922f192f928dfdafbdc2875b0f8069af151
Python
8,410
162
from tensorflow.keras.models import Model from tensorflow.keras.layers import concatenate from tensorflow.keras.layers import BatchNormalization, Activation, Conv2DTranspose from tensorflow.keras.layers import Input, Dropout, Conv2D, MaxPooling2D, dot, add import tensorflow as tf # 3 res with 3*3 + true skip + tr...
2a513d2754437fa0bd90ae01fac26413cf6f4b060d24260a8d72c04d519f20dd
Python
8,417
274
#!/usr/bin/env python3 import os from itertools import product import matplotlib import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns # -------------------------------------------------------------------------- # # Prepre input paths dataset = "hcp" model = "kernelridge_scik...
d3f9409571bd1d1615464ff3351c92a7c771e7b5dbbad912c1028b661fef478f
Python
8,424
248
import re from pathlib import Path from typing import Any, Dict, List import yaml from bs4 import BeautifulSoup from .context_url import CONTEXTFILE_URL from .jsonldutils import get_context_version from .models import Activity, Item, Protocol, write_obj_jsonld PROTOCOL_KEYS_REQUIRED = [ "protocol_name", "pro...
c99eacbd56f6d34252e06a5aea2557c83b39f52f9cef494d642b1d74a7eab666
Python
8,428
175
import os from time import time import torch import torch.optim as opt from sklearn.model_selection import train_test_split from torch.utils.data import DataLoader, TensorDataset from torch.nn.functional import l1_loss from einops import rearrange from model.egnn import EGNN_Network from model.molformer import Molform...
b7bdd15e51f2f0ecced2a46be29b255086148650d87d674d3d3864c46cae66c3
Python
8,432
242
#!/usr/bin/env python # -*- coding: utf-8 -*- import logging import os import argparse from typing import Optional import click import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from pathlib import Path from deprecated import deprecated from GANDLF.cli import copyrightMessage from GANDLF.entry...
e867015478f38e3de30deeb342003625854eabe8c4002352507b04c67052b352
Python
8,443
193
import pandas as pd import numpy as np from openslide import OpenSlide from multiprocessing import Pool, Value, Lock import os from IPython.display import display import matplotlib.pyplot as plt from skimage.color import rgb2hsv from skimage.filters import threshold_otsu from skimage.io import imsave, imread from skima...
cac0a9c2b0405453fc930683c77c7b0f3e227ce897a742b1c9529878ef3e267b
Python
8,445
266
# -*- coding: utf-8 -*- # All configuration values have a default; values that are commented out # serve to show the default. import os import subprocess import sys from datetime import datetime import json from jsmin import jsmin # If extensions (or modules to document with autodoc) are in another directory, # add...
f9e805829b3dd7676e80222b5a96b7378fd2e2b48e28ab82073569a4ad1125d3
Python
8,447
196
import os import uuid from datetime import datetime, timezone import xmltodict from dateutil.parser import parse import imctools.io.mcd.constants as const from imctools import __version__ from imctools.data import Acquisition, Channel, Panorama, Session, Slide from imctools.io.utils import sort_acquisition_channels ...
00a0b01815178a318d86a112c014a5da9a21dd0369a510dda5197f8da7ffd29c
Python
8,450
281
# -*- 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...
fddd9f6fdb7e5909e4a2ca3910f61d86894688e654c97ea3ff5f4cf9f15ff7a0
Python
8,454
150
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Oct 5 15:58:38 2021 @author: filtsem """ from pathlib import Path import numpy as np import eelbrain import re import utils import os ANOVA_results_path = '/project/3027007.02/Scripts_for_publication/TRFs/Weights_ANOVA/Dutch_part1/' language = 'F...
15618d4c19fada7c961426993e164d534cfb6aa6a036e2ab46f3d4f0766aca7c
Python
8,462
272
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Feb 20 17:04:32 2020 @author: joshs """ # %% df = pd.read_csv(os.path.join(os.getcwd(), 'data', 'unit_table.csv'), low_memory=False) import matplotlib matplotlib.rcParams['pdf.fonttype'] = 42 matplotlib.rcParams['ps.fonttype'] = 42 # %% from scipy....
7eb8091bfd4dee6d286bdc801b4e639f418ec60f97761ceff844b0a101143206
Python
8,470
242
# -*- 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...
f2bc1b8841ae01ff782ffd768335d27f95ccf7e8ef1d1ad7e930e38580600e0b
Python
8,471
260
""" 'Fast' Normalization Functions For GroupNorm and LayerNorm these functions bypass typical AMP upcast to float32. Additionally, for LayerNorm, the APEX fused LN is used if available (which also does not upcast) Hacked together by / Copyright 2022 Ross Wightman """ from typing import List, Optional import torch f...
d47a24cae0ed1f3b2d20558e045a8acc794434d4d8275d8c3b898e1cdb78c75e
Python
8,480
185
import torch import cv2 import numpy as np from e2vid.model.model import * from e2vid.utils.inference_utils import CropParameters, EventPreprocessor, IntensityRescaler, ImageFilter, ImageDisplay, \ ImageWriter, UnsharpMaskFilter from e2vid.utils.inference_utils import upsample_color_image, \ merge_channels_into...
68a61733c30b16878bd17c427213afa6a7346216f8132bd734b65b08eb108fe9
Python
8,482
234
# -*- 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...
a703e517f8fac4d5a6138616cf9c0241ae62105a3456126e0b6c25e183714968
Python
8,492
222
#!/usr/bin/env python3 """ Runs all posible ciftify functions on some test data Usage: run_ABIDE_NYU_tests [options] <testing_dir> Arguments: <testing_dir> The directory to run the tests inside Options: --outputs-dir PATH The directory to write the gerated outputs into --stages LIST s...
1e7f3ef53069c840aed02c6bab4097308f7fd43d75a7cf9d7f7ab482b09429eb
Python
8,505
233
""" Educational Use License This software is provided solely for educational purposes. Any use of this software for commercial or non-educational purposes is prohibited. If you use this software in an academic setting, you must cite the following paper in any resulting publications or presentations: [Sanaullah, Ko...
74e80f6927746b90d73468632ae7fb6af892a6625773dcf8ae9ce56bbd488cc5
Python
8,505
235
"""Canonical-form version 1 encoder.""" from __future__ import annotations import hashlib import io import struct from collections.abc import Callable, Iterable from typing import Any, cast import numpy as np import numpy.typing as npt from datamonger._models import ( LogicalComponent, LogicalDenseMatrix, ...
e79c4a52cdb5b797e3404874a3bd05721128af3e6e21b3ffb8fb0264ffcc8386
Python
8,508
253
#!/usr/bin/env python # coding: utf-8 # In[1]: import tensorflow.compat.v1 as tf tf.disable_v2_behavior() import numpy as np import sys from pandas_plink import read_plink#1_bin import pandas as pd import matplotlib.pyplot as plt from sklearn.decomposition import PCA from sklearn.linear_model import LogisticRegressi...
135d6eb90d7798e470da929345d4c189fe74930dce13550e01d9a690fb9baa67
Python
8,509
237
# -*- coding: utf-8 -*- """ Implementation of TransUNet """ from GANDLF.models.seg_modules.DownsamplingModule import DownsamplingModule from GANDLF.models.seg_modules.EncodingModule import EncodingModule from GANDLF.models.seg_modules.InitialConv import InitialConv from GANDLF.models.seg_modules.out_conv import out_co...
330ae525d72a00e299c36ba5d83e30eacbb40d1bcd548d80576b01f8cd97a6a7
Python
8,510
232
import pandas as pd import pytorch_lightning as pl import seaborn as sns import torch import torchmetrics import wandb from matplotlib import pyplot as plt from utils import get_loss, get_model, get_optimizer, get_scheduler class ClassifierLightning(pl.LightningModule): def __init__(self, config): super(...
476a4668b867eaec591663fbb62bded3f5e92f57e11913389cd10d38fb6f6ee4
Python
8,510
250
""" Res2Net and Res2NeXt Adapted from Official Pytorch impl at: https://github.com/gasvn/Res2Net/ Papers: * `Res2Net: A New Multi-scale Backbone Architecture` - https://arxiv.org/abs/1904.01169 """ import math from typing import Optional, Type import torch import torch.nn as nn from timm.data import IMAGENET_DEFAULT...
cb96003f4b607fa21461487f3cbf28de25bf18fab2488c74f26962b23b652a1f
Python
8,513
287
from __future__ import division import pandas as pd from matplotlib.mlab import find from numpy import * from matplotlib.mlab import * from matplotlib.pylab import * from scipy.io import savemat import sys from scipy.stats import * from scikits import bootstrap from scipy.stats import spearmanr import seaborn as sns fr...
23d956c26bc78e970015a1be8d258f5d6eca7393719dd97331c87ab6ef516b73
Python
8,532
299
# -*- coding: utf-8 -*- """ pysteps.visualization.basemaps ============================== Methods for plotting geographical maps using Cartopy. .. autosummary:: :toctree: ../generated/ plot_geography plot_map_cartopy """ from matplotlib import gridspec import matplotlib.pylab as plt impo...
890532a114b7797d7fdbbcfa2e1928d0ae10de249d2df836403b498c423f76ab
Python
8,532
180
from pydantic import Field, validate_call, ConfigDict from typing import Optional, Tuple, Annotated, Any, Union from ..functions.image_processing import ( get_adaptive_threshold, get_global_threshold, apply_threshold, ) from ..opts.threshold import ( Scope, Method, Assignment, AveragingMeth...