sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
1d7797d509fb62a760904d2debeb91e24212de449247933494e967df5e5405ad
Python
5,131
176
from sklearn.ensemble import RandomForestRegressor from sklearn.datasets import make_regression import argparse from rdkit.Chem import AllChem import pandas as pd from rdkit import Chem from rdkit import DataStructs import numpy as np import matplotlib.pyplot as plt import math import random import os from ...
7fd352cff9511980f985a56b27cef92570d7bd458d801c0bfa3a24fd9aa54dc6
Python
5,135
155
import csv import math import os import sys #get_natrial_stats_all #This program takes in multiple sequence alignments and calculates the entropy for each aa position ''' 1) Calculates aa freq (20 values) for each col in alignment 2) Calculates entropy for each col (H) 3) Calculates e^H 4) Records into CSV for each co...
c29db54295cdaf2ef8af8172f26a46ea439fc53310095a6730f9099cd70b0b31
Python
5,137
148
# 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 import torch.multiprocessing as mp from utils.parallel import auto_select_device, get_dist_info, init_dist, s...
3b002df60bb4d2e8e7be660a9430f4de6b21581d7736d165a745d3c2c0f073ae
Python
5,141
160
import torch from torch.optim.optimizer import Optimizer import pytorch_lightning as pl #from ..losses import SinkPITLossWrapper class BaseScheduler(object): """Base class for the step-wise scheduler logic. Args: optimizer (Optimize): Optimizer instance to apply lr schedule on. Subclass this an...
5551cbd36581f57c23b1a4d5b3d6b6c3b52344e49d18e07d8736cde8389de8e9
Python
5,153
66
import pandas from deeprank.models.residue import Residue from deeprank.config.chemicals import AA_codes_1to3 # >>> pandas.read_hdf("GPCR_variantsv2_increased_coverage.hdf5", "conservation") # sequence_residue_number amino_acid alignment_position alignment_name sub_sequencecount ... sub_consv_W sub_...
2b98a32a7403a6f449fb8a1bfbcc5670f4ccf8f2e2c9448d1bcc7bc72af38ade
Python
5,156
151
""" AdamP Optimizer Implementation copied from https://github.com/clovaai/AdamP/blob/master/adamp/adamp.py Paper: `Slowing Down the Weight Norm Increase in Momentum-based Optimizers` - https://arxiv.org/abs/2006.08217 Code: https://github.com/clovaai/AdamP References for added functionality: Cautious Optimizers:...
d2b250b497e03e1d3d9a6dce85222af0d670d62fe4f0fb4189bc2ebbd25e926c
Python
5,156
120
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Mon Apr 9 10:23:18 2018 @author: saskiad """ import numpy as np import pandas as pd import os, h5py import scipy.stats as st import core from allensdk.core.brain_observatory_cache import BrainObservatoryCache def get_movie_correlations(): save_path = ...
6d4071975c158046262e59974c1dd55ed360ae9638cd1e484c7cf45ed250fe0a
Python
5,159
81
import skimage.measure import numpy as np from typing import Annotated, Optional, Tuple, List, Union from pydantic import Field, validate_call, ConfigDict, BaseModel from cellprofiler_library.types import ImageBinary, ObjectSegmentation, ImageAnyMask from cellprofiler_library.functions.measurement import measure_area_o...
846acbaadfae796505350963a9942ec9d2da64f95777a99b96f1a5d15e852903
Python
5,161
128
#!/usr/bin/env python3 """ Will concatenate PINT output summaries into one concatenated file. Also, calculates all distances from template vertex on standard surface Usage: ciftify_postPINT1_concat [options] <concatenated-pint> <PINT_summary.csv>... Arguments: <concatenated-pint> The concatenated PINT output...
a9abf66c8ab4d93e3b992b7cdae93484035a5973bf83e286728561691075478a
Python
5,163
157
#!/usr/bin/python3 def qc_reads(reads, n_gene, nc_gene, ncp_gene, n_cell, nt_cell, ntp_cell): """Quality control by bounding read counts. Quality control is perform separately on genes based on their cell statisics and on cells based on their gene statistics, iteratively until dataset remains unchanged. A gene or ...
5e07eb4dec81799d71f1fd3d55eb1575b512337526e6516dcb3cf439f1758934
Python
5,166
137
#!/usr/bin/env python3 """ Makes pictures of standard views from ciftify_recon_all outputs and pastes them together into a html page for quality assurance. Usage: cifti_vis_recon_all snaps [options] <subject> cifti_vis_recon_all subject [options] <subject> cifti_vis_recon_all index [options] Arguments: ...
8ee9a9760c517b2579c731786176568647a2f4243d1ad583f95502b8587e1593
Python
5,168
154
import os import numpy import skimage def save_object_image_crops( input_image, input_objects, save_dir, file_format="tiff8", nested_save=False, save_names = {"input_filename": None, "input_objects_name": None}, volumetric=False ): """ For a given input_objects array, save crop...
a14ba410aafeab2e9fabe5a49147e2ba63d8c5bdd3b776db40026b709e426af8
Python
5,171
116
import time import numpy as np import pandas as pd from dragen.utilities.InputInfo import RveInfo import cv2 class shape: def __init__(self): pass def thresh_callback(self, img, max_id, phaseID): #cv2.imwrite(f'{RveInfo.fig_path}/test_{time.time()}.png', img) if phaseID in [6,7]: #Rv...
9b2c225ba53b464d98b57bbd3a9e41523394d8d8fb8146e9d904053f6c6408e8
Python
5,174
144
import io import pickle from ._image_set import ImageSet from ..utilities.image import make_dictionary_key class ImageSetList: """Represents the list of image sets in a pipeline run """ def __init__(self, test_mode=False): self.__image_sets = [] self.__image_sets_by_key = {} sel...
40700bc7bc00896f6ca7e822e8f662f13f5803ab5a44e6a93ed2a9327411eb64
Python
5,177
135
import torch import torch.nn as nn ## Channel Attention Layer class CALayer(nn.Module): def __init__(self, n_feat, reduction=16, bias=False): super(CALayer, self).__init__() self.avg_pool = nn.AdaptiveAvgPool2d(1) self.conv_du = nn.Sequential( nn.Conv2d(in_channels=n_feat, ...
d1165f63d50767b9562a797b7fbaa24b9c41de93e29c7d3ff52042775ddbdf9f
Python
5,177
173
#!/usr/bin/env python import os from time import time import numpy as np from cleandata import * from deeprank.generate import * ########################################################################## # # GENERATE THE DATA BASE AT ONCE # --> assemble the pdbs # --> compute the features on the fly # --> c...
ffe39e8f3c6d7a872247834cef1aed38a7d605f5268d1bcdaff48c99d7190987
Python
5,179
131
from typing import Union from pydantic import BaseModel, model_validator, Field, AfterValidator from GANDLF.configuration.default_config import DefaultParameters from GANDLF.configuration.differential_privacy_config import DifferentialPrivacyConfig from GANDLF.configuration.nested_training_config import NestedTraining ...
95ee984323388d37a78b7a3dd990126bd19254b96691bd1449a4659105c27947
Python
5,184
169
""" Created on Tue Dec 19 14:55:23 2017 @author: Nikolai M Chapochnikov This is what is present in this file: - calculating the PCA - calculating the correlations and the significance tests for each correlation coefficient independently (no multi-hypothesis testing in the first place) - exporting the corr and sign d...
22829724c6c32c46c569fe6f2fa7db2dbe3203554d5404dc2fca79ebe5c52faf
Python
5,185
145
# -*- coding: utf-8 -*- """ pysteps.extrapolation.interface =============================== The functions in the extrapolation module implement the following interface:: ``extrapolate(extrap, precip, velocity, timesteps, outval=np.nan, **keywords)`` where *extrap* is an extrapolator object returned by the initia...
2bfd2dbd4ac0be8821d1ef5bb0aeca117e6b9fc849e417c914cbd7a4a0e5bab1
Python
5,185
178
from attr import dataclass from torch import nn import torch import pdb from DT_for_WDN_leak_localization.optimizers import GANOptimizers class GANTrainStepper(): def __init__( self, model: nn.Module, optimizer: GANOptimizers, gradient_penalty_regu: str, num_critic_steps: ...
c4aa5864361282a61477b9b59173920119850a6ee4e389ad70c03908f1c42164
Python
5,189
141
""" ClinicalASL - Clinical Arterial Spin Labeling processing pipeline Repository: https://github.com/JSIERO/ClinicalASL Script Author: Jeroen Siero Institution: UMCU (University Medical Center Utrecht), The Netherlands Contact: j.c.w.siero@umcutrecht.nl Algorithm code author: Thomas Kirk, Quantified Imaging Descript...
d635be4fd1d33978dce55055c358bf79fb6e81e503f9fd234cb5260480895c7c
Python
5,192
144
import os import pickle import numpy as np import torch from torch.utils.data import Dataset from tqdm import tqdm class Mathgreek(Dataset): def __init__(self, train_or_test, transform=None, target_transform=None): super(Mathgreek, self).__init__() roots = '../../Dataset/mathgreek' ...
5ba1b86885931c04bdeb0352fe50b5a41351b5c64dbd74cd8fac7b9ea66980c1
Python
5,194
158
from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt from matplotlib.ticker import MultipleLocator import numpy as np from scipy.stats import gaussian_kde from matplotlib import rc import numpy as np import sys import zipfile import pandas as pd import os from matplotlib import cm import seaborn as ...
55c6b2e62f39df309710df84fec532d765f3bc216c110c00748dfea2b7b334cb
Python
5,198
111
# -*- coding: utf-8 -*- """ pysteps.motion.interface ======================== Interface for the motion module. It returns a callable optical flow routine for computing the motion field. The methods in the motion module implement the following interface: ``motion_method(precip, **keywords)`` where precip is a (T...
d21d7125775cba315d964ccb53cb31823d8494a117c550a1c09c63ebb0f9ef4b
Python
5,204
144
# 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...
37d26ef9795707972d20441c63588bdd60cc991f9a5ac75bcea15321b8cfc6eb
Python
5,206
163
import torch import random from braincog.base.node import node import numpy as np import pylab as pl class LIFNeuron(node.LIFNode): def __init__(self, tau_ref = 0, vthresh = 5, Rm = 2, Cm = 0.2,dt = 0.1,*args, **kwargs): super().__init__(threshold=vthresh, tau=Rm*Cm, dt=dt, *args, **kwargs) self.la...
23883d8d1240ba60dfe7b33ea9786b6451545dce69481ac78153a5f16051eed3
Python
5,208
152
# -*- 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...
6d45bc824a71872e0035c25b2efe32feced5180ef5f702e46b39fb675065d4e5
Python
5,208
135
""" Squeeze-and-Excitation Channel Attention An SE implementation originally based on PyTorch SE-Net impl. Has since evolved with additional functionality / configuration. Paper: `Squeeze-and-Excitation Networks` - https://arxiv.org/abs/1709.01507 Also included is Effective Squeeze-Excitation (ESE). Paper: `CenterMa...
a3f6ce5da3d04a549397fd64cf582d993f5941f1425d6ef094cad83cde097ab5
Python
5,212
154
# -*- 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...
ed9353e510b0cca3348cc5ce1ab5a80b0f9716411dfa2efc5d1207a36f5fd32f
Python
5,212
180
import torch import torch.nn as nn import torch.nn.functional as F from rdkit.Chem import AllChem import pandas as pd from rdkit import Chem from rdkit import DataStructs import numpy as np import matplotlib.pyplot as plt import math import random import os from torch.utils.data import DataLoader from tqdm import tqdm ...
2c93e403c387de0c36ce9f14d8716c394ed7513ccdfb6b6f29da6aabe2995907
Python
5,215
127
import numpy import numpy as np import torch def generate_input_representation(events, event_representation, shape, nr_temporal_bins=5, separate_pol=True): """ Events: N x 4, where cols are x, y, t, polarity, and polarity is in {-1, 1}. x and y correspond to image coordinates u and v. """ if event...
d4fe3470960051a9c6ca877166ec031ab26b28e1fdab1df35d95b60c613c87b4
Python
5,217
134
import numpy import cellprofiler_core.image import cellprofiler_core.image.abstract_image._callback_image class TestImageSetList: def test_init(self): x = cellprofiler_core.image.ImageSetList() assert ( x.count() == 0 ), "# of elements of an empty image set list is %d, not zer...
0f14e4b849403489b9c232b9ccbdd9490000fab3d40b5fe533411546f11257a8
Python
5,225
141
import lzma import os import csv from typing import List, Tuple, Any from math import sqrt from torch import argmax, tensor from torch.nn.functional import cross_entropy from torch.utils.tensorboard import SummaryWriter from sklearn.metrics import roc_auc_score class MetricsExporter: "The class implements an obj...
b78088b5fc4413d8e294ca4762b97f3dc95b11fc9e1a20af20751baedb5132f7
Python
5,225
143
#!/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 ...
d745daf8893df2c879a7c5fb7f3cc058e1135036204dabc67f3252c9833feb66
Python
5,231
128
"""Tools for working with NIDM-Experiment files""" import re import click from rdflib import Graph, Literal, Namespace, URIRef, util from rdflib.namespace import RDF, split_uri from nidm.core import Constants from nidm.experiment.Core import getUUID from nidm.experiment.Query import GetProjectsMetadata, getProjectAcq...
9d307aba94357d4d235e86b7995e5a20e2085254ac28717ed573dd79ffc455e3
Python
5,237
146
#!/usr/bin/env python """ test_haralick -- tests for centriole.haralick """ import unittest import centriole.haralick as haralick import numpy as np gray4 = np.array([[0, 0, 1, 1], [0, 0, 1, 1], [0, 2, 2, 2], [2, 2, 3, 3]]) gray = gray4 / (1.0 * gray4.max()) labels = np.ones((4, 4), dtype="int32") # labels = np.arr...
fc0c5c3837b4109c615f7c057af51810fc27ef1a33cb315b006b6c48259d3d10
Python
5,237
106
# Place this file in src/ of the DIPS folder preprocessed as in # https://github.com/amorehead/DIPS-Plus up to and including the step prune_pairs.py (but not beyond that step). import logging import os import random from pathlib import Path import atom3.pair as pa import click import pandas as pd from atom3 import da...
f2d7806b2d80e61888481b0274108d872a11af196453d6cdad9b6cba7fa3300f
Python
5,251
146
from ._integer_range import IntegerRange from .._range import Range from ..._validation_error import ValidationError class IntegerOrUnboundedRange(IntegerRange): """A setting that specifies an integer range where the minimum and maximum can be set to unbounded by the user. The maximum value can be relati...
bccf4db31b14f718818fb9d363cd131e451f52b35970b493173294a242627a13
Python
5,253
184
# # nate berry # 2023-04-01 # # --------------------------------------------------------- print(''' \n\n # ------------------------------------------------- author: nate berry (nberry11 at gmail dot com) citation: <tbd> # ------------------------------------------------- ...
e59fbc8e70b70eff42adaf1a2e75324f9d95a0cd84b426da9a826be17e3ca021
Python
5,253
156
""" Helper tools to visualize patterns and network state """ # 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-exercises. # This free software: you can redistribute it and/or mod...
c473c514c31aca2062deff04dd9557d2ad41f83ce53f6d30af4eba6be4e4e16f
Python
5,254
114
# python -m src.test_all_methods.eval_pdb_outputset import os from biopandas.pdb import PandasPdb import numpy as np import torch from src.utils.eval import Meter_Unbound_Bound import scipy.spatial as spa def get_CA_coords(pdb_file): ppdb_model = PandasPdb().read_pdb(pdb_file) df = ppdb_model.df['ATOM'] ...
f62563d04fbd315740e902edbf3c1414dc587916e1f3fc13c2b7983cf94be155
Python
5,260
123
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jan 13 13:45:49 2021 @author: andrey """ import numpy as np from megsimutils.utils import xyz2pol from megsimutils.arrays import BarbuteArray from mne.preprocessing.maxwell import _get_n_moments class BarbuteArraySL(BarbuteArray): """ Single ...
4b7615150dd11d7ea6000b9be43d8c3df489e38d1d8a9c54c491f0171712211a
Python
5,263
181
#!/usr/bin/env python import os from time import time from cleandata import * from deeprank.generate import * ########################################################################## # # GENERATE THE DATA BASE AT ONCE # --> assemble the pdbs # --> compute the features on the fly # --> compute the targets o...
9b8df89ce77676b02940dba8e94de4edd071099327cc87506e3ad0f9fc7aa1af
Python
5,269
144
import numpy as np from PIL import Image def DepthNorm(x, maxDepth): return maxDepth / x def predict(model, images, minDepth=10, maxDepth=1000, batch_size=2): # Support multiple RGBs, one RGB image, even grayscale if len(images.shape) < 3: images = np.stack((images,images,images), axis=2) if len(imag...
6cab795dd3fdc78c60d26e188256e167ae5a39885983770b4096a9ee83b7af9d
Python
5,276
176
# study: .sqlite3 # fragment: 136.0618 # PPM: 20.0 # RT_TOL: 0.5 # output: .features import sys import time import bisect import sqlite3 start_time = time.time() __version__ = "0.5" class Thing: def __getitem__(self, key): return getattr(self, key) def __setitem__(self, key, value): setattr...
da318698f5f26a4bf4a466fed46aa620a660950303e4ede76b0699964e71f3f0
Python
5,285
83
import argparse from config import VESSEL_DIR, ENDOSTROKE_DIR, ISLES2018_DIR def str2bool(v): if isinstance(v, bool): return v if v.lower() in ('yes', 'true', 't', 'y', '1'): return True elif v.lower() in ('no', 'false', 'f', 'n', '0'): return False else: raise argpars...
52fd6fe91d7d8965ef9f4e8c46f7157fea9fa6128fc6bcdb555136dbefefbb57
Python
5,286
113
import numpy as np from .base import BayesianSpikingModel from .srm import SRM from ..masks import shift_mask from ..utils.time import get_dt class VGLM(SRM, BayesianSpikingModel): def __init__(self, kappa=None, eta=None, gamma=None, vr=None, vt=None, dv=None, lam=None): super().__init__(vr=vr, kappa=ka...
729f20a95deac88708dc7128ef0a4955fa7e18ba2308082df10cdd426dceb56b
Python
5,291
126
from pathlib import Path import rvt.tile import rvt.vis import rvt.default import numpy as np # pytest rvt.tile.save_visualization_tile_by_tile dem_path = Path(r"test_data\TM1_564_146.tif") tile_size_x = 100 tile_size_y = 100 def test_slope_tile_by_tile() -> None: out_slope_path = Path(r"test_data\TM1_564_146_t...
9cb010551b3c6b3dd686a9f4d2f0e45fbd0128665de50bd244bdfa54a4344cb6
Python
5,292
152
import pandas as pd import numpy as np import torch from torch.utils.data import Dataset, DataLoader from torchvision import transforms, utils from PIL import Image from io import BytesIO import random def _is_pil_image(img): return isinstance(img, Image.Image) def _is_numpy_image(img): return isinstance(img,...
5c7545995a9eaeb205f2c2b6d70e6e3e51c4c319b44a9d8e1e0d9323d43e9b08
Python
5,295
126
""" PolyLoss (Poly-1) Paper: `PolyLoss: A Polynomial Expansion Perspective of Classification Loss Functions` - Zhaoqi Leng, Mingxing Tan, Chenxi Liu, Ekin Dogus Cubuk, Xiaojie Shi, Shuyang Cheng, Dragomir Anguelov - ICLR 2022, https://arxiv.org/abs/2204.12511 Poly-1 adds epsilon * (1 - p_t) to the loss, adjus...
1c590ae5fc6e62d9421e0535d13b76ba40c2a205760a3f70610bf6c37bc48d44
Python
5,300
121
import os import random import torch import argparse import numpy as np from util import (clamp, seed_torch, prepare, PairIoHandler, PlayerIoHandler, SampleIoHandler, set_args) def gen_pairs(grid_size: int, pair_num: int, stride: int = 1) -> np.ndarray: """ Input: grid_size: int, th...
b212e2bd05710014233b73d54cf085eecbf7ec506be300bf131cb34c88318554
Python
5,303
150
#!/usr/bin/env python """The setup script.""" import sys, re, os from setuptools import setup, find_packages try: with open("README.md") as readme_file: readme = readme_file.read() except Exception as error: readme = "No README information found." sys.stderr.write("Warning: Could not open '%s' ...
e5bd66d75b6d1fb1feadbf5453f7da7c1adb71ebf688a7aa20cf02015f9714ca
Python
5,318
141
from pathlib import Path from .utils import pass_method, map_values import numpy as np from skimage.io import imsave import os # from pathlib import Path from zarr.core import Array class Patch: def __init__( self, slide_path: str, slide_object: Array, manager, coordinates...
e90d7e9d1cdf2156e666ce55223b168607550c46048514168204edda4b29a208
Python
5,323
156
# Utility functions for the plasclass module import numpy as np import itertools complements = {'A': 'T', 'C': 'G', 'G': 'C', 'T': 'A'} nt_bits = {'A': 0, 'C': 1, 'G': 2, 'T': 3} def readfq(fp): # this is a generator function ''' Adapted from https://github.com/lh3/readfq ''' last = None # this is a bu...
b9aa2128362b0f80efa5c603be987a44a5f57af4c2477138cd0a7ef4e81e0807
Python
5,324
142
import json import time from datetime import datetime import numpy as np from ..globalFunctions.utils import MyEncoder, applysigniftoall, get_size def SaveResults(input, cell, t, vsoma, traces, apcounts, aptimevectors, apinfo, totales, totalos, iOptogenx, succes_ratio, amps_SDeVstim, amps_SDoptogenx, pos_VTAeVstim,...
2573e83b2091d3b1ed5e7351af18ab6545d1fb01f130c0d894828fd74d1a8f4c
Python
5,327
137
# 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...
53c74aedfd0b1bc9039384ec395ad9a02962948436c10e6aaee57557882f8d35
Python
5,327
128
""" 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 gemmi import numpy import scipy.integrate import os i...
07ac60b236af04deb19ed9402669ff96e8cec6bca2136e2a45ef4e8ce39539ad
Python
5,335
124
import numpy as np import tensorflow as tf import tensorflow_probability as tfp from lib.utils import * import tqdm tfd = tfp.distributions def random_gaussian_initializer(shape, dtype): n = int(shape / 2) loc_norm = tf.random_normal_initializer(mean=0., stddev=0.1) loc = tf.Variable( initial_val...
d5ec9336d192f3713b3eec5ded3c9ead9997847498b6572bbeb967db81403d0c
Python
5,339
212
import numpy import numpy.testing import pytest import skimage.morphology import cellprofiler.modules.fillobjects instance = cellprofiler.modules.fillobjects.FillObjects() @pytest.fixture(scope="module") def image_labels(): labels = numpy.zeros((20, 20), dtype=numpy.uint8) labels[2:8, 2:8] = 1 labels[...
0b74cba70557c32b612aa4f28f112cf03a5ff894c017d8e84139fbef3aab7bcd
Python
5,344
140
import numpy as np import matplotlib.pyplot as plt import random import datetime import logging from scipy.ndimage import convolve from dragen.utilities.Helpers import HelperFunctions from dragen.utilities.InputInfo import RveInfo class DiscreteRsa2D(HelperFunctions): def __init__(self, a, b, alpha): se...
251be1c898f55a0f3c7a674a381d4f99c394c778a325473982812cdf2c411490
Python
5,345
162
# -*- 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...
47d3899e863bb847c4bd2d33f31d321a7a92b21f80086445bb893346ed24eae2
Python
5,346
167
# -*- 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...
a0911b47c69db681b1810333e2d9bbb9d5fe99da4944b554c1584b455a42d860
Python
5,350
140
import numpy as np from netCDF4 import Dataset import os #========================================================== # Set main directory #========================================================== hdir = '/home/jhkim/model/deep_detection' #========================================================== # Set output path ...
d437e159f023b19b35b305e13587c9070a2e50ac2430098727cc737377241a9f
Python
5,356
183
"""Data processing functions module for pulldown assay data and SVAE model Author: Hikari Sorensen - Vector Engineering Team (hsorense@broadinstitute.org) Notes: """ import random import numpy as np import pandas as pd import tensorflow as tf AAs = np.array( [ "A", "C", "D", "E", ...
a557fe116f8db091c32e1b8d638ae80093f90439eb27ca31bbf5b3b5c49e4970
Python
5,366
149
from netCDF4 import Dataset import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap, cm import os #========================================================== # Set main directory #========================================================== hdir = '/home/jhkim/model/deep_detection' o...
a610d260d83826468ab802f7857865c394ef1e07375965cd39541b9d1aba0733
Python
5,388
186
#!/bin/env python """ LINDA nowcasts ============== This example shows how to compute and plot a deterministic and ensemble LINDA nowcasts using Swiss radar data. """ from datetime import datetime import warnings warnings.simplefilter("ignore") import matplotlib.pyplot as plt from pysteps import io, rcparams from...
f9a643b3c6673de0bab1d73468a483a7a53eff3b4d108d73e18222eb466f7e3d
Python
5,393
160
from cellprofiler_core.setting.subscriber import LabelSubscriber from ._image_segmentation import ImageSegmentation from ...constants.measurement import COLTYPE_INTEGER from ...constants.measurement import C_CHILDREN from ...constants.measurement import C_NUMBER from ...constants.measurement import C_PARENT from ...co...
56a4a1e32883d0c6e56b066843b45d4c72ec856c16dc734af33078e5c50e253e
Python
5,399
146
""" ClinicalASL - Clinical Arterial Spin Labeling processing pipeline Figure saving utility 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: Utility function to sa...
87a5a2d055e2c9e0125faf29af6b0b15b495b3f4836b6591977c82e12efaab8f
Python
5,399
110
# TODO Sep 08 version """General-purpose training script for image-to-image translation. This script works for various models (with option '--model': e.g., pix2pix, cyclegan, colorization) and different datasets (with option '--dataset_mode': e.g., aligned, unaligned, single, colorization). You need to specify the dat...
34e8a021436470c381fc1a4f117f0098fdb214f337f06ca5ffb747568d7bcf8c
Python
5,411
170
"""test_fastemd.py test the FastEMD library wrapper CellProfiler is distributed under the GNU General Public License, but this file is licensed under the more permissive BSD license. See the accompanying file LICENSE for details. Copyright (c) 2003-2009 Massachusetts Institute of Technology Copyright (c) 2009-2015 Br...
43f0f049524b835a08b0491e66177c7858a4d6bc1c00f3aba47fcdffe94ddd8a
Python
5,412
192
# -*- coding: utf-8 -*- import numpy as np import pytest from pysteps.utils import cleansing def test_decluster_empty(): """ Decluster an empty input""" X = np.empty((0, 2)) V = np.empty((0, 2)) X_dec, V_dec = cleansing.decluster(X, V, 20, 1) assert X_dec.ndim == 2 assert V_dec.ndim ==...
87f480544507fd86db5b320c8e56d661602a4dcf2321ecc09c76e5becdbfcfa7
Python
5,416
127
import numpy as np import scipy.io import os.path as osp import sys sys.path.append('..') from nilearn import plotting from functions.def_ROIs_DorsalEarlyVisualCortex import roi as ROI from functions.def_ROIs_EarlyVisualAreas import roi def polarAngle_plot(subject_id, path, dorsal_only=False, binarize=False, save=Fa...
d91eec1bf0551fde92d5c227013e0e7e8b6e991ba8d52bc2727da5cc93caa0d3
Python
5,416
129
# -*- coding: utf-8 -*- import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import torch.utils.data import models from tqdm import tqdm from torch.autograd import Variable from tensorboardX import SummaryWriter import os loss_function = nn.MSELoss() def train...
46aa51460166adb8517937ae938beab20b29fdde5a8ac447eea3e1466ed1d7a3
Python
5,417
161
import numpy as np import os.path as osp import scipy import matplotlib.pyplot as plt import seaborn as sns import sys import pandas as pd import os sys.path.append('..') from numpy.random import seed from sklearn.metrics import jaccard_score from functions.def_ROIs_EarlyVisualAreas import roi as ROI from functions.d...
59b1394de288a666546e5f897eb37fdc8019d85c85e525f3e9aea68eae06ed7e
Python
5,417
128
import logging from typing import Annotated, Optional, List, Dict, Any from pydantic import validate_call, Field, ConfigDict from ..opts.morph import MorphFunction from ..functions.image_processing import ( apply_branchpoints, apply_bridge, apply_clean, apply_convex_hull, apply_diag, apply_dis...
5de7dd27cb9b3653dc47657a4934a417ab52ef065c234c710f7d93c9123cf3ea
Python
5,417
145
import collections import json import warnings from os.path import abspath, basename, dirname, isfile, join, splitext from typing import TYPE_CHECKING, Any import traits.api from ptsa.data.readers import BaseReader __all__ = [ 'ParamsReader', ] class ParamsReader(BaseReader, traits.api.HasTraits): """ ...
675a9680ef3c769229482a8b36c3662b0faa022c710ac44a19a855dc0ed25ae7
Python
5,420
153
''' JHK Python script for generating ED figure 5. ''' from netCDF4 import Dataset import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap, cm import os #========================================================== # Set main directory #=================================================...
a17a65e5f72c7938cdcd2ca7e54e779548e49c06af8f488c1666bf8c174cc60b
Python
5,427
208
""" Activations (memory-efficient w/ custom autograd) A collection of activations fn and modules with a common interface so that they can easily be swapped. All have an `inplace` arg even if not used. These activations are not compatible with jit scripting or ONNX export of the model, please use basic versions of the...
8f44870af8548a42bba8e4aa7f00b1fa3b0274080ba5d5e28b254f1457bdbedf
Python
5,431
182
# study: .sqlite3 # PPM: 20.0 # RT_TOL: 2.0 # MIN_SIGNAL: 100000.0 # MIN_RANGE: 10.0 import sys import time import bisect import sqlite3 start_time = time.time() batchmode = True __version__ = "0.7" # # Based on: https://github.com/suzaku/plain_obj # def make_constructor(fields): assignments = "\n".join([f" ...
c7a147fe96bccf3f66ab70dc13cbfc38c3524a7dc93d40cb8dd420b78f7ccf6d
Python
5,438
144
''' JHK Python script for calculating the ratio between dSTD and dClim. of HF PRCP. ''' import numpy as np from netCDF4 import Dataset import os #========================================================== # Set main directory #========================================================== hdir = '/home/jhkim/model/deep_de...
2d18520aa2905d23e3bd5cce62fef3b41ba795b2d41e2ac04fa0bc08028a0759
Python
5,439
144
import torch import torch.nn as nn import torch.nn.functional as F import time from tqdm import tqdm from utils import WarmUpLR, downLR, custom_loss, get_time_dif import numpy as np from sklearn.metrics import classification_report,confusion_matrix,\ precision_score, f1_score, accuracy_score, recall_score,\ r...
07298baec0e23a376bfa5de40e420dc3e4dd8f8804caba4563695ade5916445f
Python
5,442
150
import keras.backend as K import theano from keras.layers import TimeDistributed, RepeatVector, Permute from os.path import join, realpath, dirname from model.layers_custom import AttLayer theano.config.openmp = False from keras.layers.core import Flatten, Reshape, Lambda from keras.layers import Dense, merge def ge...
67926235cc9ed3758ef8d0c69a47cc4ff9ac248340e1ef56f7bc6a01ff40e147
Python
5,445
146
import numpy as np import scipy.io import os.path as osp import sys import argparse sys.path.append('..') from nilearn import plotting from functions.def_ROIs_EarlyVisualAreas import roi as ROI from functions.def_ROIs_DorsalEarlyVisualCortex import roi def topographic_map_plot(subject_id, path, modality, hemisphere,...
f72225dec1b8996f3515c786c04cb7d6d11c4feecb96cfbf21b6cb827d0bae2e
Python
5,446
134
"""Compare every converted Gisette value and label with the pinned UCI archive.""" from __future__ import annotations import argparse import hashlib import json import sys from pathlib import Path from zipfile import ZipFile import numpy as np import yaml ROOT = Path(__file__).resolve().parents[3] sys.path.insert(0...
bb9f7803d48f8e18a3733970123ac5304f929a47e0295b1ed5218f1293775725
Python
5,447
155
import cv2 import faiss as f import numpy as np import pyarrow.parquet as pq from configs import * def build_index(emb): xb = emb d = emb.shape[1] # res = faiss.StandardGpuResources() # flat_config = faiss.GpuIndexFlatConfig() # flat_config.useFloat16 = False # flat_config.device = 0 #check num...
55bcd468dec9cf285783daedaebd7d56b856ad637736e844fe7f08027177d75e
Python
5,451
160
# -*- 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...
be10fe8e1796e71781df9ec5536324ffd1bd3efb3c4592fffdbb6e11ea85c683
Python
5,451
164
import itertools import multiprocessing as mp import time from multiprocessing import Manager import numpy as np from Utils.cal_utils import count_kmers, readfq, mer2bits, get_rc def compute_kmer_inds(ks): ''' Get the indeces of each canonical kmer in the kmer count vectors ''' kmer_list = ...
7bee5054fb3d54098305e79b0feb080c3782cce5fb5c1342d25c6c0221139f05
Python
5,456
149
import unittest import numpy as np import pkg_resources from deeprank.features import AtomicFeature class TestAtomicFeature(unittest.TestCase): """Test StructureSimialrity.""" @staticmethod def test_atomic_haddock(): # in case you change the ref don't forget to: # - comment the first l...
e27f26d6ff471dd2e8320a93de2c1a50a42225e9af2abb392d1240ff15f4d5d3
Python
5,456
126
#!/usr/bin/env python3 """ 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@umcut...
93130031a42c5e57fb6d6a426e7bb26007ac72a5664ca8e7de488caea9074226
Python
5,457
178
import json import os from pathlib import Path import pytest from pyld import jsonld from ...jsonldutils import load_file from ...utils import start_server, stop_server from .. import Activity, Item, Protocol, ResponseOption from ..utils import write_obj_jsonld contextfile_url = "https://raw.githubusercontent.com/Re...
fbfbd8362d5a33654196952426ea71be8da6023f9e7f47b0bd9c490eaee3d6f9
Python
5,462
188
from email.mime import base import pdb from re import S from unittest import TextTestRunner import numpy as np import os import wntr import networkx as nx import copy import pandas as pd import matplotlib.pyplot as plt from scipy.optimize import newton, curve_fit import torch import ray def get_demand_time_series_noi...
b22d81fe0a8aaa429efd54e6b2762b66f5323d4556430511afd71b132bc080a2
Python
5,464
163
from ._fx import ( create_feature_extractor, get_graph_node_names, register_notrace_function, register_notrace_module, is_notrace_module, is_notrace_function, get_notrace_modules, get_notrace_functions, ) from .activations import * from .adaptive_avgmax_pool import ( adaptive_avgmax_...
e0e4b65ee0cc0ca4a9eb077911b9b20308a7797fde441726d3d7033b69576e90
Python
5,466
117
import matplotlib.pyplot as plt import numpy as np from ..spiketrain import SpikeTrain from .spiketrain import SpikeTrainsPlotter from ..utils.time import get_dt, searchsorted class DecodingPlotter: def __init__(self, t=None, model=None, optimizer=None, mask_spikes=None, neurons=None, files=None, stim_dec=None, ...
6b685e2b53ddb8e27775afe9b16c6910cf08cce6076c1ff8298821216ed260a3
Python
5,480
140
# Pytorch Tabular # Author: Manu Joseph <manujoseph@gmail.com> # For license information, see LICENSE.TXT """Tabular Model""" import logging from typing import Dict import pytorch_lightning as pl import torch import torch.nn as nn from omegaconf import DictConfig from ..base_model import BaseModel from . import utils...
cfe85e75001d9695e1817ed424031d2c37ce581934d5021ec701f6320b9494de
Python
5,480
154
''' This script was a quick hack to make simulated Illumina and PacBio reads for circular sequences. PBSIM and Wgsim do not seem to have a 'circular reference' option, nor did it have an option for different depths for different references. This script simply runs PBSIM over and over, each time randomly rotating the r...
c12fa118d6e61cfc47d3a805b32fc7a393a99c0adaca61a4210d0055011a22f4
Python
5,489
138
# -*- coding: utf-8 -*- """ @author: danielm Allen Institute Software License - This software license is the 2-clause BSD license plus a third clause that prohibits redistribution for commercial purposes without further permission. Copyright (c) 2018. Allen Institute. All rights reserved. Redistribution an...
d8f868f4e517206575cf66a00ab861979d90249006a7da489685e579046012a9
Python
5,492
131
from tensorflow.keras import backend as K from tensorflow.keras import Input, Model from tensorflow.keras.layers import Conv3D, Activation, Dense, concatenate, add from tensorflow.keras.layers import Conv3DTranspose, LeakyReLU from tensorflow.keras import regularizers from tensorflow_addons.layers import InstanceN...
de223d0d53f9335ceb60c184a9f4b7bc3c78ebe03952e7fbdc7d76dcfd8b78da
Python
5,497
153
import torch from torch import nn from abc import ABC, abstractmethod from typing import List class AbstractLossFunction(nn.Module, ABC): def __init__(self, params: dict): nn.Module.__init__(self) self.params = params self.num_classes = len(params["model"]["class_list"]) self._init...
1860f476e583a05a8700fcaf39f964477fd91821d9a86b3ed69f54dc94e05ad2
Python
5,501
137
import PyDSTool import numpy as np import pickle import matplotlib.pyplot as plt from matplotlib.ticker import FormatStrFormatter,ScalarFormatter import matplotlib as mpl from matplotlib.lines import Line2D ''' ANT flux at steady state. This script generates the figure 4a in the paper 08.11.23 GCG ''' params = {'axes....
5736148321a66189e9f95214ffe588c40b74d01ace9f21cb466f35c6f4aef24d
Python
5,502
154
""" Implementation of the Adaptive Exponential Integrate-and-Fire model. See Neuronal Dynamics `Chapter 6 Section 1 <http://neuronaldynamics.epfl.ch/online/Ch6.S1.html>`_ """ # This file is part of the exercise code repository accompanying # the book: Neuronal Dynamics (see http://neuronaldynamics.epfl.ch) # located...