sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
b23f3630cb8274941bf1a623a12acbaae8146b6bb8a527062217a5e186506825
Python
7,513
204
import math from typing import Callable, Iterable, List, Optional, Tuple import torch from torch import Tensor from torch.optim import Optimizer class AdEMAMix(Optimizer): r"""Adapted from https://github.com/frgfm/Holocron/blob/main/holocron/optim/ademamix.py Implements the AdEMAMix optimizer from `"The...
21e2258a21d4f87a031028b856f6e237d6a2a09666ba9ec942aa73e277ee570e
Python
7,526
155
import torch from .base_model import BaseModel from . import networks class Pix2PixModel(BaseModel): """ This class implements the pix2pix model, for learning a mapping from input images to output images given paired data. The model training requires '--dataset_mode aligned or np_array_aligned' dataset. ...
931628b7765f3f8576a51f6aeaefb58fe6dae81e9681895966aa1ce555aed8c4
Python
7,527
254
#!usr/bin/env python # -*- coding: utf-8 -*- import argparse import ast import os from typing import Optional import click from deprecated import deprecated from GANDLF.cli import ( deploy_targets, mlcube_types, run_deployment, recover_config, copyrightMessage, ) from GANDLF.entrypoints import app...
e7546e8183645e43abc435131687aa111862f7e0bd3aa7972b6b44f1282a79af
Python
7,530
197
#!/usr/bin/env python3 # Copyright 2019 Christian Henning # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
6b6b5ed33d2defacbfacdd051569a4f1e16965847eb74af5a21025f66c790488
Python
7,531
236
""" DisplayDensityPlot ================== **DisplayDensityPlot** plots measurements as a two-dimensional density plot. A density plot displays the relationship between two measurements (that is, features) but instead of showing each data point as a dot, as in a scatter plot, the data points are binned into an equally...
eae957094bedec5a082e2daadd05f321649a8dc3229314b646a0e510d594eb5e
Python
7,537
211
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 ...
7bab9e0d90d4f9971262526d53f39db6c40ba9be3119204f91f1bbf5c8b2fef1
Python
7,539
184
import collections import numpy import imageio.v3 from ..constants.image import MD_SIZE_S, MD_SIZE_C, MD_SIZE_Z, MD_SIZE_T, MD_SIZE_Y, MD_SIZE_X from ..preferences import config_read_typed from ..reader import Reader SUPPORTED_EXTENSIONS = {'.png', '.bmp', '.jpeg', '.jpg', '.gif'} # bioformats returns 2 for these, i...
753954255bcd50fd3aa602194af39719241680858f8fb48385a8500cf440e295
Python
7,544
139
from collections import namedtuple # a label and all meta information Label = namedtuple('Label', [ 'name', # The identifier of this label, e.g. 'car', 'person', ... . # We use them to uniquely name a class 'id', # An integer ID that is associated with this label. # The IDs are used to represent th...
7b47e4f82d6af847a7127b3b9faa6a9d9d23e002e0ff806424793b1aa9321a7c
Python
7,545
216
# -*- coding: utf-8 -*- """ Data transformations ==================== The statistics of intermittent precipitation rates are particularly non-Gaussian and display an asymmetric distribution bounded at zero. Such properties restrict the usage of well-established statistical methods that assume symmetric or Gaus...
7c7b83d011e17af77fa4683bd6138bb76d8203b92ce647ded703108b028a9ee3
Python
7,546
212
from abc import ABC, abstractmethod from functools import partial import numpy as np import bayesflow as bf from scipy.stats import beta from likelihoods import sample_static_diffusion_process, sample_random_walk_diffusion_process from priors import sample_scale, sample_ddm_params, sample_random_walk class DiffusionM...
145767129f2c17f8b5e8a9ca1638b6a3efc5acce1c3e622709b32b80766c0d8a
Python
7,554
197
#!/usr/bin/env python3 # Copyright 2019 Christian Henning # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
df3acd9ef32e37d6e364b9021d125640ed18566c53715d49ab092e2a2a7a8472
Python
7,554
197
#!/usr/bin/env python3 # Copyright 2019 Christian Henning # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
797b32b4a26538d489b5d76fe6e518c5895b9d0e88684f712cf69efe3c5873d1
Python
7,556
197
#!/usr/bin/env python3 # Copyright 2019 Christian Henning # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
e52ac9f3994223a5f4a11c2b40de146d1f4c68fbc5f2fbd6870330f3ca445d85
Python
7,565
221
""" pysteps.blending.clim ===================== Module with methods to read, write and compute past and climatological NWP model skill scores. The module stores the average daily skill score for the past t days and updates it every day. The resulting average climatological skill score is the skill the NWP model skill ...
f0bd42e59bb46df9d577fc64cf65faf2fe81e0402a9d2b4264ed7292903dc829
Python
7,574
199
#!/usr/bin/env python3 # Copyright 2019 Christian Henning # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
84fed0b84602da8c85edb258d0f0fd00565963110799d9cf77a5dad563a0ae20
Python
7,578
208
import os.path as osp import sys, os # sys.path.insert(0, '..') import time import numpy as np import matplotlib.pyplot as plt import torch import torch.nn as nn import torch.nn.functional as F from torch_geometric.datasets import MNISTSuperpixels import torch_geometric.transforms as T from torch_geometric.data impor...
faf376f5a1c7729faeff80eb92943d7f5a312cf16b6adc3efc999d262ae077da
Python
7,583
203
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Nov 8 18:12:28 2018 @author: Nikolai M Chapochnikov the point of this file is just to read the connectivity data and to export it into formats that are readable. So basically i would do it just once and then i would only use the exported datasets, whi...
75a1c4e7c86ad00a9a4c5a3a2f43072d03552159643dc36e345f5c29c9c7317c
Python
7,584
167
# -*- coding: utf-8 -*- import torch.multiprocessing torch.multiprocessing.set_sharing_strategy('file_system') # https://github.com/facebookresearch/maskrcnn-benchmark/issues/103 import numpy as np import torch import random from torch.utils.data import DataLoader from src.utils.db5_data import Unbound_Bound_Data fr...
4fd65e86c537e63e91149412dc5fac11f6d22bd0351c739c279fc0f16593f54f
Python
7,589
198
#!/usr/bin/env python3 # Copyright 2019 Christian Henning # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
54984820b2f2ed33888c19185142649448e6bd0c8ecfbb0744bb143d4f89b513
Python
7,591
190
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Oct 5 15:58:38 2021 @author: filtsem This script caluclates the explain variance of phoneme features by subtstracting the acoustic+freq model from the full model for both low and high entropy word models. Then plot the language vs word entropy graphs...
36121f9c855d06da92e8fd6cc0b711b20d1b5848dfab0985d67246db69480e09
Python
7,593
243
''' JHK Python script for computing PDF ratio *PDF ratio = [PDF of total period] / [PDFs of each decade] ''' from netCDF4 import Dataset import numpy as np import os, pathlib #========================================================== # Set main directory #========================================================== h...
53830f66a2fbc74b5f3811c89e6f17cdef8173d193c1fddad5bb9986864c04ca
Python
7,595
161
""" File name: evaluate_feature_importance.py Author: Esra Zihni Date created: 10.08.2018 This is the main script to evaluate the importance of predictors. It reads the implementation and path options from the config.yml script. It loads the training and test sets, loads the specified trained model(s) and calculates...
57db756b85cb1460319c3a9790a38a614682117aa6fe042e642876a9ac13935d
Python
7,598
241
# -*- coding: utf-8 -*- """ pysteps.utils.reprojection ========================== Reprojection tools to reproject grids and adjust the grid cell size of an input field to a destination field. .. autosummary:: :toctree: ../generated/ reproject_grids """ from pysteps.exceptions import MissingOptionalDependenc...
e5b85816cc861fd7b42d3da50245ec7a582b36dcecc00a4ddde751a4e2df7d97
Python
7,598
198
#!/usr/bin/env python3 # Copyright 2019 Christian Henning # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
9c896e614d8cf5a699be9b05917479751edf18d16d5e24e151c0e1776ffe355e
Python
7,599
245
# -*- coding: utf-8 -*- import os import numpy as np import pytest import pysteps from pysteps.timeseries import autoregression, correlation pytest.importorskip("pyproj") def test_estimate_ar_params_ols(): R = _create_data_univariate() for p in range(1, 4): phi = autoregression.estimate_ar_params...
602b5842254c7f810e165499e9a050302b78b9cb177603141687dc64c83a6c22
Python
7,602
208
import os.path as osp import sys, os # sys.path.insert(0, '..') import time import numpy as np import matplotlib.pyplot as plt import torch import torch.nn as nn import torch.nn.functional as F from torch_geometric.datasets import MNISTSuperpixels import torch_geometric.transforms as T from torch_geometric.data impor...
8d69ef008643dc831be6045bd6ba9fa38dd628fa36ce124132d8af08190f5094
Python
7,604
100
import numpy as np from pydantic import validate_call, Field, ConfigDict from typing import Annotated, Optional, Tuple, Union from cellprofiler_library.types import ObjectSegmentation, Image2DGrayscale, ParentsOf from cellprofiler_library.measurements.measurement_model import LibraryMeasurements from cellprofiler_libra...
4185110713d0048cfded77bf0463cc76bd44837fc4c347c4db14a06fce16a856
Python
7,605
242
import numpy as np import pdb2sql class SASA(object): def __init__(self, pdbfile): """Simple class that computes Surface Accessible Solvent Area. The method follows some of the approaches presented in: Solvent accessible surface area approximations for rapid and accurate protein...
d76e6ca57d4fca81c148e30c007e9981d21cfeb17b84f6a020ac265363f36af4
Python
7,611
209
from turtle import pos import matplotlib.pyplot as plt import tensorflow as tf import tensorflow_probability as tfp from tensorflow_probability.python.distributions import kullback_leibler from sklearn.preprocessing import MinMaxScaler import matplotlib.pyplot as plt from scipy import interpolate import os import Metri...
7268133e8819b66f08e267e13c2a0bce6d4e83a7b920b8571811137dbbb31361
Python
7,613
188
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Oct 5 15:58:38 2021 @author: filtsem This script caluclates the explain variance of acoustic features by subtstracting the phoneme features+freq model from the full model for both low and high entropy word models. Then plot the language vs word entro...
c8274ca09d84233eaa9912e3fdcafa7fdb708add66eec8712cb4f33aec8ecbb6
Python
7,614
201
#!/usr/bin/env python3 # Copyright 2019 Christian Henning # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
1b2b50a1bf053cea703cecb16a60fef07621fbb30dd82180f5e411ddc1d9f1d9
Python
7,618
247
# -*- coding: utf-8 -*- """ Implementation of UNet with Inception Convolutions - UInc """ import torch.nn.functional as F import torch from GANDLF.models.seg_modules.ResNetModule import ResNetModule from GANDLF.models.seg_modules.InceptionModule import InceptionModule from GANDLF.models.seg_modules.IncDownsamplingModu...
cf102ad65b3fd7e3d7edd9436db08ec7cbfbc1ebf75e67885ddc823cbc8e1694
Python
7,618
174
import argparse import json import os import numpy as np from sklearn.manifold import MDS from utils import get_dataset, timer def get_mds(dissimilarity_matrix, is_euclidean=None, random_state=6): embedding = MDS(n_components=2, dissimilarity="precomputed", random_state=random_state) retur...
6b09c41ef68a0ee40cf51e73f6c4b64dfbe77c26e32b467e8c0c9c0f8b404c71
Python
7,625
239
import itertools import numpy as np import pandas as pd from matplotlib import pyplot as plt from sklearn.metrics import accuracy_score, f1_score, roc_auc_score, matthews_corrcoef from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler from DCiPatho_config import...
b09c15992ea042c412f17c28bb5145660d20483c10750c6edc8ac04bb00887d1
Python
7,626
185
""" Bottleneck Self Attention (Bottleneck Transformers) Paper: `Bottleneck Transformers for Visual Recognition` - https://arxiv.org/abs/2101.11605 @misc{2101.11605, Author = {Aravind Srinivas and Tsung-Yi Lin and Niki Parmar and Jonathon Shlens and Pieter Abbeel and Ashish Vaswani}, Title = {Bottleneck Transformers f...
1940b0d7d2e985c8839c4984f42623f56cc92fd8e730595024bd8e6a23af1594
Python
7,637
199
#!/usr/bin/env python3 # Copyright 2019 Christian Henning # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
37c31bf7ddcfc710f424bf1e0bf0d8a82a163e84a4a1b776f030041799484734
Python
7,650
196
import logging from pdb2sql import pdb2sql import re import os from typing import List import h5py from scipy.spatial import distance_matrix import numpy import torch import torch.cuda from torch_scatter import scatter_sum from deeprank.config import logger from deeprank.models.pair import Pair from deeprank.operate....
26d211e37c0992912e6b6a2031accb0e1cc3d783972413a890583b0339b73cba
Python
7,654
191
#!/usr/bin/env python3 # Copyright 2019 Christian Henning # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
d5d87dba0d91a91909dde95c84e1d00194b494721ad683db5daea2e5951baf67
Python
7,667
180
import tensorflow as tf import bayesflow as bf import bayesloop as bl import numpy as np import sympy import os from custom_network import OneDimensionalAmortizer from configuration import default_settings class NeuralCoalMiningExperiment: """Wrapper for estimating the dynamic model of coal mining disasters usin...
94152e7339bc59d4734a0a7b0673f0bf0cd468ffe762bb466b52041a11966cd5
Python
7,675
203
import argparse import os from pathlib import Path import warnings import numpy as np import random import pandas as pd import pytorch_lightning as pl import torch import yaml from torch.utils.data import DataLoader from classifier import ClassifierLightning from data import MILDataset, get_multi_cohort_df from optio...
6a1c273078adefc0691b16bc562a15b8928777791109567bf33a7c9ae0f49cc2
Python
7,679
214
# -*- 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...
e447ef40b28e62991bd6e0c28ffa8b5d83f744c47a4fb75731ddf55ea7371cae
Python
7,679
242
from datetime import timedelta import os import numpy as np import pytest from pysteps import io, motion, nowcasts, verification from pysteps.nowcasts.linda import forecast from pysteps.tests.helpers import get_precipitation_fields linda_arg_names = ( "timesteps", "add_perturbations", "kernel_type", "...
f5b2b32f793f6974cb7bd1a3a7404a740787d29a20e3c8fd80c09c6f6ecfa3c0
Python
7,696
192
""" Training runfile Date: September 2018 Author: Ignacio Heredia Email: iheredia@ifca.unican.es Github: ignacioheredia Description: This file contains the commands for training a convolutional net for image classification. Additional notes: * On the training routine: Preliminary tests show that using a custom lr mu...
c4095d456d41804bb994a625be41614b48ec1676f468728e219f4d83aa41a528
Python
7,702
205
from asteroid_filterbanks import make_enc_dec from ..masknn.attention import SepFormer, SepFormer2 from asteroid.models.base_models import BaseEncoderMaskerDecoder class SepFormerTasNet(BaseEncoderMaskerDecoder): """SepFormer separation model, as described in [1]. Args: n_src (int): Number of masks t...
ad1cb188c0cc7c9e097b51d176ee424259730b55bf86b7470f562e39b72433be
Python
7,705
181
import pandas as pd import torch import torch.utils.data as Data from sklearn.model_selection import KFold from torch.utils.data import DataLoader from DCiPatho_config import Config from DCiPatho_network import DCiPatho from DCiPatho_trainer import Trainer from Utils.tool import roc, acc, F1, mcc, data_reprocess_from_...
1ca77af001f9735271cae16f4ce49b22fa215b198849c6b1758f7018f0a701fc
Python
7,719
224
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 ...
e5644190e2e42c35d2e2377e3aa7ade751f13b54fbf104661513517642162f64
Python
7,721
211
# # nate berry # 2023-04-01 # # --------------------------------------------------------- # NOTES: # - produce vizualizaitons for sample entropy # # --------------------------------------------------------- # --------------------------------------------------------- import numpy as np import pandas as pd import m...
0573b4eebaf867c72b6a8b2e92c163936d261de6af116e93437cbad90086966a
Python
7,723
210
import csv import numpy as np # R_kCal = 1.986e-3 # kCal/(K*mol) R_kCal = 1.987191683e-3 # kCal/(mol*K) R = 8.31e-3 # kJ/(K*mol) F = 96.48 # kC/mol J_per_cal = 4.184 default_T = 298.15 # K default_I = 0.25 # mM default_pH = 7.0 default_c0 = 1 # M default_pMg = 10 default_nMg = 0 # added AJG default_RT = R * def...
8e25d0553f775edbf3ba8c56c23550999f6d452ce5d5f1dff3a1c6d13c28ff26
Python
7,737
238
from scipy.ndimage.filters import gaussian_filter1d from sklearn.utils import resample ### PATH VARIABLES ############################## cache_directory = '/mnt/nvme0/ecephys_cache_dir_2' code_directory = '/home/joshs/GitHub/neuropixels_platform_paper' ################################################### df = pd....
5e429237a383265eb7740cc0c054a4dc1d074e64c8bf4bd6cc6b2b3a08b621a1
Python
7,739
171
import cv2 import numpy as np import skimage import tqdm.auto as tqdm from .utils import enforce_4D def _get_occlusions(image, num_patches=25, percent_overlap=0.5, background_value=0, **kwargs): image = enforce_4D(image) if percent_overlap >= 1 or percent_overlap <= 0: raise ValueError("Overlap must ...
051e4e0be9cd706458131ce23be64097737b65df5e76b18fd42566d93acb934a
Python
7,740
180
# -*- coding: utf-8 -*- """ @author: bartulem Concatenate NPX recordings (ap|lf) into one .bin file. This script should be run if multiple sessions need to be merged (before running Kilosort2). The primary reason for merging is the desire to keep the same cell IDs across the recorded sessions. It should be said tha...
c9ec6d9a2fee912e33ae83369733f1484b6545c113374f3f77838901b70924f2
Python
7,741
210
import torch.nn as nn import torch.nn.functional as F import math from torch.nn import init def conv3x3(in_planes, out_planes, stride=1): return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False) class PreActBlock(nn.Module): '''Pre-activation version of the BasicBlock.'''...
bc652adb543f506a42dfa56e9183cc399c0d15a9f530b1c357468e43bd052c4e
Python
7,743
186
# 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...
d378b28a1b3a1fcca7cd3cc3a1cb99cbd23657a76659460291fedf97fbddd7df
Python
7,744
229
import re from copy import deepcopy import nibabel as nib import numpy as np from traitlets import Instance, Unicode, Dict from traitlets.config import Config from mrHARDI.base.application import (mrHARDIBaseApplication, required_file, ...
24a4ce1c02db76abeda01b06563b2fee4aaf204d0f98b88479b50b3065602c9b
Python
7,756
213
import os from glob import glob import argparse from itertools import product from datetime import datetime import numpy as np import SimpleITK as sitk from helpers import * from dbx import * import wetransfer from sklearn.model_selection import KFold from tensorflow.keras.utils import get_custom_obj...
bbe80c9381a83565fc7ef87d6e082543d0e3272ed96eb834278e0dcf1679a6c1
Python
7,764
259
__all__ = ['imread', 'imsave'] import numpy as np from PIL import Image from ...util import img_as_ubyte, img_as_uint def imread(fname, dtype=None, img_num=None, **kwargs): """Load an image from file. Parameters ---------- fname : str or file File name or file-like-object. dtype : numpy ...
5771c4e5433b11e9fdc66f108821488dcff225bee2659ab679385068aef6b909
Python
7,775
187
import numpy as np import pytest import cellprofiler_core.utilities.grid import cellprofiler_core.image import cellprofiler_core.measurement import cellprofiler.modules.definegrid import cellprofiler_core.object import cellprofiler_core.pipeline import cellprofiler_core.workspace GRID_NAME = "grid" INPUT_IMAGE_NAME ...
a0b9c42e81a0fcd3603abb04ce53ee2e8137772a6845d9ed4bccce722929d763
Python
7,777
180
import numpy import scipy.ndimage from typing import Annotated, Optional from pydantic import Field, validate_call, ConfigDict from cellprofiler_library.types import ObjectSegmentation, ObjectSegmentationIJV from cellprofiler_library.functions.segmentation import center_of_labels_mass, relate_children from cellprofile...
3dab1b26773bf29df00ea2d51e33afc0b3decd4aab9ba5616e95af514264803c
Python
7,779
200
# -*- 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...
5df4a827cedd77a2bb1f658fe17eac4c49a6923721bfeacda7426dcbe5eb2ae0
Python
7,780
234
# Neural Oblivious Decision Ensembles # Author: Sergey Popov, Julian Qian # https://github.com/Qwicen/node # For license information, see https://github.com/Qwicen/node/blob/master/LICENSE.md """Dense ODST Block""" import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Function fr...
4dbce8944ee606014ed4faada2648fbf0019d4877753c173634ee1cf5e1912ec
Python
7,784
217
from __future__ import absolute_import from __future__ import division import numpy as np import scipy.sparse import scipy.ndimage from .cpmorphology import minimum_enclosing_circle, fixup_scipy_ndimage_result from .cpmorphology import fill_labeled_holes, draw_line from centriole._np_compat import np_cumproduct def ...
e6083f70fd6fa5df12460cd034d9550bc8ee2a785706c54318de30606b67772b
Python
7,786
203
"""Tests for the check that rejects redundant alignments. When bowtie2 looks for more than one alignment per read (-k, -a), it rejects a new alignment that shares a dynamic-programming cell with one it has already found for the read: the same read position aligned to the same reference position on the same strand. The...
6222ca4f9a072f33e9b057546e0a26b0cc791f593d9e6d0a7af6b44ff15e34bd
Python
7,787
209
""" PyTorch MARS Optimizer Code simplified from https://github.com/AGI-Arena/MARS Paper: MARS: Unleashing the Power of Variance Reduction for Training Large Models - https://arxiv.org/abs/2411.10438 @article{yuan2024mars, title={MARS: Unleashing the Power of Variance Reduction for Training Large Models}, author=...
0d96e1d0b822505b3ffb1a11382b8a8c2e75cc837e68462d3e0f3c456f100abd
Python
7,789
176
import argparse import json import os import numpy as np from sklearn.manifold import MDS from utils import get_dataset, timer def get_mds(dissimilarity_matrix, is_euclidean=None, random_state=6): embedding = MDS(n_components=2, dissimilarity="precomputed", random_state=random_state) retur...
476d0ebd1025cedf6e0bbab1cfce526589d6875c99423805c8498b3925fc5101
Python
7,793
192
import numpy as np from scipy import ndimage from .dataset import Datasets, Dataset # CONSTANT WHERE TO FIND THE DATA from config import VESSEL_DIR import SimpleITK as sitk import os import matplotlib.pyplot as plt from matplotlib.pyplot import Normalize # import pyqtgraph as pg import pandas as pd from .download impo...
2308ae1090c9266ad64bc947c3cd6aca32ca42f038956230061e7cf1227a85e6
Python
7,794
180
import inspect import re from typing import Optional, Tuple, List import torch def _torch_version() -> Tuple[int, int]: major, minor = re.match(r'(\d+)\.(\d+)', torch.__version__).groups() return int(major), int(minor) def onnx_forward(onnx_file, example_input): import onnxruntime sess_options = o...
c636d325ae535d8d5aab5d24d1459d776e0da93745da60052e31ac3eed652872
Python
7,802
240
# -- coding: utf-8 -- """ pysteps.visualization.motionfields ================================== Functions to plot motion fields. .. autosummary:: :toctree: ../generated/ motion_plot quiver streamplot """ from pysteps.visualization import utils VALID_PLOT_TYPES = ("quiver", "streamplot", "stream") ...
ed05384f8c0a6469f7fa9e36e4202969e7f8e29e3478e66c12c47cc8d3eda673
Python
7,803
199
import numpy as np import seaborn as sns import matplotlib.pyplot as plt from matplotlib import animation from tqdm.notebook import tqdm from scipy import stats from sklearn.metrics import r2_score def true_vs_estimated(ground_truths, post_means, post_sds, param_names, dpi=300, figsize=(20, 4), s...
c771c70e0767c1aa689af3a6f88e8dab3c6a6081bafb95f3c8538ae7f8eec0e7
Python
7,810
156
import numpy from numpy.typing import NDArray from typing import List, Union, Optional, Annotated, Tuple from cellprofiler_library.types import ImageGrayscale, ImageGrayscaleMask, ObjectLabel, ObjectSegmentation from pydantic import validate_call, Field, ConfigDict, BaseModel from cellprofiler_library.functions.measure...
590006e5370b5adb48c68485a8bb5b3b8b4924494de7f7ec748b12f0a435242a
Python
7,813
136
""" ClinicalASL - Clinical Arterial Spin Labeling processing pipeline ASL data preparation 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: Functions for preparing...
2729531b4ebe668ca037fd16d473002ac7975fd5fe42b257f6fe91fff51ab7c1
Python
7,829
236
import os import pickle import h5py import numpy as np from deeprank.tools import sparse class NormalizeData(object): def __init__(self, fname, shape=None): """Compute the normalization factor for the features and targets of a given HDF5 file. The normalization of the features is done ...
a7b5f033b12e22a60b240fa23f48ecd1ea0ebbda31c286152d783a5b36f5ca18
Python
7,832
239
"""Regression tests against the ptsa 3.0.6 baseline. Each fixture in `tests/data/regression_fixtures/*.npz` was generated by running a load-bearing PTSA operation (Morlet, Butterworth, Resample, MonopolarToBipolar) against a deterministic seeded input in the reference env. This module loads each fixture and asserts th...
d502fed6d115ba6a2e846b9d8720b77e27ea442701d2368b2660e523068857e7
Python
7,851
182
# -*- 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...
a5e431e1a7ea574c732c5668e816b8b98edd896d3331b108c39e23fa15be4ab0
Python
7,854
204
from hashlib import sha256 from tensorflow.keras import backend as K import numpy as np import tensorflow as tf import settings # # LRP calculation # from tensorflow.keras import backend as K import utils def estimate_relevance(save_dir, network_params, name='intuitive', relevance_params={}): print(n...
9e6527d7331a24502e2075d3997da85ba380e478930e7ffc108d3b5f86aa7a64
Python
7,858
237
# -*- coding: utf-8 -*- """ Created on Tue Aug 9 01:19:05 2022 @author: Manuel """ __author__ = "Manuel R. Popp" #### parse arguments----------------------------------------------------------- import argparse import urllib.request # in case it isn't loaded properly by arcgis def parseArguments(): parser = argpa...
a2afd27b4dca93baf3473ac0f5f501bc798f6a205249bc3d5eb2cebd4e2cd814
Python
7,862
291
import os import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns ############################################################################## # Constants dataset = "hcp" parcellation = "schaefer200x17" idiff_path_combined_bins = os.path.join( ".....
4c3a14d66f0e33e21fcff8108d4dec4439d6cb4c0eded7edf42949e2ec2b50d9
Python
7,869
198
import numpy as np from utils import DepthNorm from io import BytesIO from PIL import Image from zipfile import ZipFile from tensorflow.keras.utils import Sequence from augment import BasicPolicy def extract_zip(input_zip): input_zip=ZipFile(input_zip) return {name: input_zip.read(name) for name in input_zip.n...
4509a0532e2f65763302fb13bcb27492dba778ecbc45540d7fcab886e91ad6d2
Python
7,870
212
import tensorflow as tf import tensorflow_addons as tfa import matplotlib.pyplot as plt import numpy as np from matplotlib import cm from matplotlib.colors import ListedColormap , Normalize from mpl_toolkits.axes_grid1 import make_axes_locatable from scipy import interpolate from matplotlib.collections import LineColle...
d9183f9d943519f96f003be5ada7421008f3797330be1f9f980e133ed00e3c30
Python
7,872
162
""" HardCoRe-NAS Papers: * `HardCoRe-NAS: Hard Constrained diffeRentiable Neural Architecture Search` - https://arxiv.org/abs/2102.11646 """ from functools import partial import torch.nn as nn from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD from ._builder import build_model_with_cfg from ._builder ...
1a931f2a85185822cae74dbb0c6c0cafc38c780c3af2940f852a775b515dd0ab
Python
7,874
182
# -*- 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...
6433e68c1d45d1b6d9fb4e3c4d41f052ce6b4baab2abf3f0f129e26f5e53da14
Python
7,874
222
#!/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 ...
822f28f262a1a221935a5d8234b3a150e58f5dddcd25e75b0edd1d846afa26df
Python
7,884
174
from . BedGraphTrack import BedGraphTrack from . GenomeTrack import GenomeTrack import numpy as np from matplotlib import cm DEFAULT_BEDGRAPHMATRIX_COLORMAP = 'viridis' DEFAULT_BEDGRAPHMATRIX_INDIVIDUAL = 'grey' DEFAULT_BEDGRAPHMATRIX_SUMMARY = '#1f77b4' # mpl.rcParams["axes.prop_cycle"].by_key()["color"][0] class ...
2c85ed4d509324dc2f654861b5ff1fc8a6125e2a6486a26e325a60244f47f498
Python
7,901
198
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', '-': '...
0e891dce4fb51e7e3f8082500b9be3e93b2f0618fa7433b2c8d7143806f49590
Python
7,905
234
''' Skivi is written/maintained/developed by: S. Chris Colbert - sccolbert@gmail.com Skivi is free software and is part of the scikit-image project. Skivi is governed by the licenses of the scikit-image project. Please report any bugs to the author. The skivi module is not meant to be used directly. Use skimage.i...
31522ab1d27d60b6fcb36aa13f15f97d598b92fe5c32fa3657e77bf74c83a5cb
Python
7,905
199
"""Adopt a published registry snapshot in all four clients.""" from __future__ import annotations import argparse import gzip import hashlib import io import json import re import sys import urllib.request from pathlib import Path from typing import cast from jsonschema import Draft202012Validator, ValidationError ...
a3be0047cc745ab6bd61f4d765fbcfd94031fc4f30af25414435c7e96933347f
Python
7,907
202
""" Base Class for all WGANs Create other WGANs by inherite from the upper WGAN Class and overwrite __init__ and plot_results """ import torch import numpy as np import pandas as pd import matplotlib.pyplot as plt import copy from torch.utils.data import DataLoader import torch.optim as optim import seaborn as sns impo...
5984d57c088d55bc303adc1e7c6e03bdffb8432f0aa25def257a15597460b0b2
Python
7,921
196
""" Readers are modular classes designed to read in image data. Like modules, readers can also be added as plugins using this template class. Place readers into the plugins directory to load them on startup. A typical reader plugin will add support for a specific file format or protocol. N.b. readers should not assum...
05b790e88ebda902d1e92008b8570cbda34d2224f06bffe4f14568536d85b2b6
Python
7,939
157
import numpy from numpy.typing import NDArray from typing import Optional, Tuple, Annotated, Union, List from pydantic import Field, validate_call, ConfigDict, BaseModel from cellprofiler_library.types import ObjectSegmentation, ObjectLabelMask from cellprofiler_library.measurements.measurement_model import LibraryMea...
e16a496143e0edc8bbfb7aabebdbf61dd2024d17ac3c476695bd870701326629
Python
7,943
248
import numpy import scipy.ndimage from cellprofiler_core.constants.measurement import FF_CHILDREN_COUNT, FF_PARENT from cellprofiler_core.module.image_segmentation import ObjectProcessing from cellprofiler_core.object import Objects from cellprofiler_core.setting.choice import Choice from cellprofiler_core.setting.subs...
c5d6cb6bbbaf263888fa93e1c28e2f3d2387c69600316085a9c5939437ea7859
Python
7,948
154
from pathlib import Path import os os.environ['MNE_USE_NUMBA'] = 'false' VERBOSE = True dataset_dir = Path(r"../../data/tuh_eeg_abnormal") output_dir = Path(r"output") try: os.mkdir(output_dir) except: pass meta_dataframe_path = output_dir / "df_meta.pkl" ica_meta_dataframe_path ...
7ebd3ed1376c448622b04cc372c648c63fa139af27ae16de70726aeea4035d43
Python
7,951
218
import copy import math import torch import torch.nn as nn import torch.nn.functional as F def Molformer(data, vocab, dist_bar, depth=2, embed_dim=32, ffn_dim=128, head=4, dropout=0.1, aggregate=True, knn=0): c = copy.deepcopy attn = MultiScaleMultiHeadedAttention(head, embed_dim, dist_bar, knn...
85ff1a104b23c17abda014d05093443002769add5b2e88dcff200ec2d049bb7a
Python
7,953
222
# -*- coding: utf-8 -*- """ Created on Mon Apr 11 11:16:14 2022 @author: Katharina Waury (k.waury@vu.nl) """ import matplotlib.pyplot as plt import numpy as np import pandas as pd import pickle import os import seaborn as sns from Bio.SeqUtils.ProtParam import ProteinAnalysis from imblearn.under_sampling import Rando...
1a7820d0f901b8bd0e597eb289136d7978486b6cc1bd566c8a6ca2cc7e622805
Python
7,958
194
import TCDF import argparse import torch import torch.optim as optim from model import ADDSTCN import pandas as pd import numpy as np import networkx as nx import pylab import copy import matplotlib.pyplot as plt import os import sys # os.chdir(os.path.dirname(sys.argv[0])) #uncomment this line to run in...
ac20cd3817fbd8615950f08e68510f4d04e203264e2c322eeb073a5e7aea3525
Python
7,977
261
import pickle import numpy as np import ray import torch import yaml from yaml.loader import SafeLoader import pdb import os import matplotlib import matplotlib.pyplot as plt from tqdm import tqdm from scipy.stats import gaussian_kde matplotlib.rcParams.update({'font.size': 16}) torch.set_default_dtype(torch.float32...
bf8afa7ef6cf40937d73fd1d49815770c6f0386762b6c3a5e68773a4d0888f14
Python
7,979
256
# -*- coding: utf-8 -*- import matplotlib.pyplot as plt import numpy as np import pandas as pd import os df = pd.read_csv(os.path.join(os.getcwd(), 'data', 'unit_table.csv'), low_memory=False) area_list = [['VISp', 'VISl', 'VISrl', 'VISam', 'VISpm', 'VIS', 'VISal','VISmma','VISmmp','VISli'], ['LGd','LD...
e0d96dd62d2866240e166998dc4200fefffd6a7cfdd54d9f0767500f76851f56
Python
7,979
243
""" Top-level trial data pre-processing Authored by Eric Easthope """ import os import warnings import numpy as np from pathlib import Path from pynwb import NWBHDF5IO from utils import overlap # Filter warnings warnings.filterwarnings("ignore") DATA = "data" DERIVED = "derived" subjects = ["EC2", "EC9", "GP31", "...
1f09acb260ac3bff64618845b2e031f06bc74b29c3576e37eb3118dbb7562b78
Python
7,986
182
import torch from torch import nn import torch.utils.data as Data import torch.nn.functional as F from torch.autograd import Variable import numpy as np import copy import math import collections torch.manual_seed(1) np.random.seed(1) class LayerNorm(nn.Module): def __init__(self, hidden_size, variance_epsilon=1e...
ad73246567299251b43eb1b5f8f3bb73a73fefb7086549dd38cb20d97e45d567
Python
7,994
244
# -*- coding: utf-8 -*- # # DEEP-OC-image-classification documentation build configuration file, created by # sphinx-quickstart. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All config...
1c33832033077ad3ff4ed420df3acaa4694495828115a63fcfe573018a4397e5
Python
7,995
224
import wx from cellprofiler_core.preferences import get_background_color from cellprofiler_core.setting import BinaryMatrix from ._module_view import ModuleView from ..utilities.module_view import edit_control_name class BinaryMatrixController: """A controller for the BinaryMatrix setting """ def __init...
9c236b64efe920a7f0ef4e51b8b689f67efcddccabd67a025dbc8bfacde9ef21
Python
7,996
208
""" @author: Johanna Rahm Research group Heilemann Institute for Physical and Theoretical Chemistry, Goethe University Frankfurt a.M. Handle widgets of ImageSumming Jupyter Notebook. """ import tkinter as tk import os from tkinter.filedialog import askopenfilename from ipywidgets import widgets from IPython.display ...