sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
f38ea7c3665a7cb025a8872501ff7e9f83e448cabf2556ccd4e697a2449b906c
Python
11,076
244
#--------------------------5-CSRTT Protocol---------------------- # important note:- Do not change any print stings if you intended to use pyOS5 GUI # Task file for 5-CSRTT task which can be used for training stages 1-5, and all challanges, by adjusting task variables as described below. # One of the five_poke LEDs t...
a1d7d885b9c72c6898bd5750130418ff2bc2577e70c439b0b5dfb166c2e2d475
Python
11,077
244
#--------------------------5-CSRTT Protocol---------------------- # important note:- Do not change any print stings if you intended to use pyOS5 GUI # Task file for 5-CSRTT task which can be used for training stages 1-5, and all challanges, by adjusting task variables as described below. # One of the five_poke LEDs t...
1fee5f01407115d1b3936c404a567f4d1bb13aecdbb970c0ddaf83bb75b54142
Python
11,081
211
""" Test unit suffix functionality for length-based options. This module contains tests for the unit suffix parsing feature added to Filtlong. To run them, execute `python3 -m unittest test.test_unit_suffixes` from the root Filtlong directory. """ import unittest import os import subprocess class TestUnitSuffixes(u...
a48d86e7f5147eca05f73ba2fa967a19810e1fda888d27ebe0a58e2e4ae6a4fb
Python
11,089
305
import matplotlib import matplotlib.pyplot as plt import numpy as np import torch from torchvision import models from utils import load_ground_truth, save_images from torchvision.io.image import read_image from torchvision.transforms.functional import normalize, to_pil_image from torchvision.models import resnet50 from...
c94df0fb4354f1ed7f913864e7f510622ad103ec47547b8aa47f115d4161021b
Python
11,093
266
from __future__ import print_function import torch import torch.nn as nn from types import MethodType import models from clb_utils.metric import accuracy, AverageMeter, Timer class NormalNN(nn.Module): ''' Normal Neural Network with SGD for classification ''' def __init__(self, agent_config): '...
385b5cf3ae8c355fcfb35c4d7fb4751bb3bf8155591460b1851a2289e041ef5a
Python
11,095
195
from dataclasses import dataclass, field from typing import Optional from src.models.tabular.pytorch_tabular.repository.config import ModelConfig @dataclass class NodeConfig(ModelConfig): """Model configuration Args: task (str): Specify whether the problem is regression of classification.Choices are:...
88b769556726b15992b947943b79cf4177029ce958affef0a7be035b616dbd28
Python
11,098
223
""" Copyright 2017 Ryan Wick (rrwick@gmail.com) https://github.com/rrwick/Filtlong This module contains some tests for Filtlong. To run them, execute `python3 -m unittest` from the root Filtlong directory. This file is part of Filtlong. Filtlong is free software: you can redistribute it and/or modify it under the ter...
e8cc54cc5b255de9af60130a0497428327da6061771173f110735e724e455609
Python
11,139
266
from __future__ import print_function import torch import torch.nn as nn from types import MethodType import models from clb_utils.metric import accuracy, AverageMeter, Timer class NormalNN(nn.Module): ''' Normal Neural Network with SGD for classification ''' def __init__(self, agent_config): '...
d16e4fb8611602b768d5f5e665d418fcf58fcb889b3ed9d5fb9d9d7d7d38d521
Python
11,153
343
#!/usr/bin/env python import numpy as np import argparse import torch import torch.optim as optim from torch.cuda.amp import autocast from torch.cuda.amp import GradScaler from pytorch_metric_learning import samplers import logging import time import pdb import os import json import random from tqdm import tqdm impor...
8f4185bcc76b5809ea056f4d19d2aceb2a7fb9a690b6e57b8cf0d9a8c5635056
Python
11,156
316
import numpy as np import os, sys import pickle import h5py from keras.applications.vgg16 import VGG16 from keras.applications.vgg16 import preprocess_input as preprocess_input_16 from keras.applications.vgg19 import VGG19 from keras.applications.vgg19 import preprocess_input as preprocess_input_19 from keras.applica...
8e9ae4debd68f4a30e303ef4b5ef78e320a606c1044d7635f087ecde84bc7074
Python
11,169
310
""" This file is a copy of the useful function from Christophe Gohlke's amazing package transformations that can be found there: https://pypi.org/project/transformations/ For a reason that I don't really understand, the package does not install on newer version of Python therefore I decided to, for the time being at l...
44c1a427f597c960bcab751bf5ab93a9e4b49661c2b13eaef61b78e8529c6399
Python
11,183
268
#!/usr/bin/env python3 """ Makes pictures for quality assurance of fmri data and pastes them together into a html pages. Usage: cifti_vis_fmri snaps [options] <task_label> <subject> cifti_vis_fmri subject [options] <task_label> <subject> cifti_vis_fmri index [options] Arguments: <task_label> Nam...
7e44a5a470a59f2b7cb6fb5480f30d56456e46e1a794f6faa8c4eeab703cdad2
Python
11,183
329
# -*- coding: utf-8 -*- """ pysteps.downscaling.rainfarm ============================ Implementation of the RainFARM stochastic downscaling method as described in :cite:`Rebora2006` and :cite:`DOnofrio2014`. RainFARM is a downscaling algorithm for rainfall fields developed by Rebora et al. (2006). The method can repr...
174d88ebb1c4d05a60a16479bcb120b01f2470a29276713f5b394bf1c4eb9291
Python
11,192
306
# 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...
def999f4466e9de3c11a2f4471d1b1f0b696fef1020ce5ec1745827a0fbc9736
Python
11,192
243
# -*- coding: utf-8 -*- """ molvs.fragment ~~~~~~~~~~~~~~ This module contains tools for dealing with molecules with more than one covalently bonded unit. The main classes are :class:`~molvs.fragment.LargestFragmentChooser`, which returns the largest covalent unit in a molecule, and :class:`~molvs.fragment.FragmentRem...
b34e50cc42e3f01df81c47648b279ed70c52485092dc35e94860a60643410c98
Python
11,208
288
# 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...
07a00d1393c1047b7f5414f75528e1e889257ff019233fd621a4e48e90c8d864
Python
11,212
304
import os import warnings import numpy as np import pdb2sql from deeprank import config from deeprank.features import FeatureClass ######################################################################## # # Definition of the class # ######################################################################## class ...
176229cbbc402fe634bc4b59eb56c0fe5be3f3c08e29daf23b65e2f837c87bb2
Python
11,218
354
#!/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 th...
4aa0f44b8da2ce9566d5c8dd70b2cc22621e908f5a5e57960b6ee463b67722be
Python
11,219
278
import getopt from sys import argv, exit import multiprocessing import pysam import pybedtools ## capture the arguments required for the annotations; ## 1) the annotation file ; 2) the VCF to be annotated ; 3) the name of the output file [O] otherwise, same name + anno.vcf ## if further arguments are necessary we will...
16ae1e563d2df68122f394e962c636953748f028c11d6d8f431836a40b63fa9f
Python
11,245
306
import logging import mmap import os from pathlib import Path from typing import BinaryIO, Optional, Union import numpy as np import imctools.io.mcd.constants as const from imctools.data import AblationImageType, Acquisition from imctools.data.acquisitiondata import AcquisitionData from imctools.io.mcd.mcdxmlparser i...
02e655ddd2133f450fb5672bd333c6f0d3c6d908192593c0784afeb235461302
Python
11,246
250
import os import torch os.environ['DGLBACKEND'] = 'pytorch' from datetime import datetime as dt from src.utils.protein_utils import preprocess_unbound_bound, protein_to_graph_unbound_bound from biopandas.pdb import PandasPdb from src.utils.train_utils import * from src.utils.args import * from src.utils.ot_utils imp...
111923e9157149ef9c532a5ea836f9d8aa81e2ae7f09b5ae2044133f7bb7c22c
Python
11,276
268
import os import os.path as op from collections import defaultdict import glob import traceback import shutil import collections import logging import re import warnings from src.utils import utils from src.utils import args_utils as au LINKS_DIR = utils.get_links_dir() SUBJECTS_DIR = utils.get_link_dir(LINKS_DIR, '...
ec75bad27499dc02a851f4a32f44440968db3b0d2b32cf15c81d4b7258f8abe9
Python
11,282
382
"""Utilities for generating AFIDs-related graphics""" import plotly.graph_objects as go from afidsvalidator.model import EXPECTED_DESCS # Landmark abbreviations grouped by neuroanatomical region. # Each abbreviation matches the attribute name on the Afids object (desc[-1]). LANDMARK_REGIONS = { "Commissural": ["...
92004f714db2de073848ab3c19e09bfae5220f9776beaaeade13eb41fcdc267d
Python
11,296
337
import warnings from torchmeta.datasets import Omniglot, MiniImagenet, TieredImagenet, CIFARFS, CUB, DoubleMNIST, TripleMNIST from torchmeta.transforms import Categorical, ClassSplitter, Rotation from torchvision.transforms import Compose, Resize, CenterCrop, ToTensor __all__ = [ 'omniglot', 'miniimagenet', ...
cf1b50c9d574a38693ffe97d9bb3859011f6676c1cd9b2690293d9147d9159a0
Python
11,300
247
import re from pathlib import Path from typing import Any, Dict, Optional, Tuple, Union from torch import nn from timm.layers import set_layer_config from ._builder import resolve_pretrained_cfg from ._helpers import load_checkpoint from ._input import _requested_input, _spatial_size from ._hub import load_model_conf...
b4bec00ae857705c481c9e64e9efbae17d419200830e39f3c232ed04f2aae290
Python
11,307
319
# -*- 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...
35990be4a9ba828b8d0382f6884eb034ea264466eb48459ebc61d235945abc66
Python
11,318
262
# # nate berry # 2023-04-01 # # --------------------------------------------------------- # NOTES: # - this script produces plots of the time series, the # false nearest neighbors data from <03_fnn.py>, and # the state space reconstructions for the COM and EEG # data (band-wise & aggregated) # # ------...
dd13a55ad9b6b72c30d5adad0e1f56c8d07913d62b8e98744f2285a1830487b3
Python
11,331
430
# -*- coding: utf-8 -*- import unittest import matplotlib as mpl from matplotlib.testing.compare import compare_images from tempfile import NamedTemporaryFile import os.path import pygenometracks.plotTracks mpl.use('agg') ROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "test_data") ...
36e8202aae45301979768396f879315991d8121fac1c1c5cfb0b40217437ae87
Python
11,336
256
#!/usr/bin/env python """ PentaMind: predict global cognition from drawings of intersecting pentagons. Runs the 10 released VGG19-bn models on every image in a folder and averages them. Works on CPU or GPU with a current PyTorch. Model weights are downloaded from Hugging Face (stasaking/pentamind) on first use, or rea...
53f3e2b3b221f1abfdf230af7494df5dbeb65aa2b4868fa84738ba052db0332f
Python
11,336
298
import logging import os, csv from typing import Type from pathlib import Path from typing import Dict from typing import List from typing import Union import SimpleITK as sitk import cv2 import numpy as np import torch from matplotlib import pyplot as plt from matplotlib.backends.backend_agg import FigureCanvasAgg ...
23149475fc8737ac8e5da63336378a5c2bd7229dce3c17a9ab41fe508fa23ec2
Python
11,339
342
# -*- 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...
eec883fbde1bf76ea24c4f57d4c1efb7aa12462cc74b25f7bbecf119b3d26fb1
Python
11,346
241
""" 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 unittest import numpy import pandas import json impor...
06ab312e0c11fcfcc82cea7c41c70c6feada783b92dbcfeb7f00ea33800228e9
Python
11,350
348
import time import copy import gc import os from tqdm import tqdm import numpy as np import torch import torch.nn as nn from torch.nn import functional as F from torch.cuda.amp import GradScaler, autocast from sklearn.metrics import mean_squared_error from types_ import * from utils import * class RNAEncoder(nn.Mod...
e106ea58f8bdc44cbb7be74f2977f18a8710fc37710ae99d4e32ebaa382e3714
Python
11,358
256
import os import torch from collections import OrderedDict from abc import ABC, abstractmethod from . import networks import sys class BaseModel(ABC): """This class is an abstract base class (ABC) for models. To create a subclass, you need to implement the following five functions: -- <__init__>: ...
3140a31eec202c9c86b88c47d0d6f28a641caa4273d1e2ff6ddb477efaba790d
Python
11,374
335
#!/usr/bin/env python3 """ A collection of utilities for ciftify functions mostly for loading data into numpy arrays """ import os import sys import logging import numpy as np import pandas as pd import nibabel as nib import nibabel.gifti.giftiio from ciftify.utils import run, get_stdout, TempDir def cifti_info(file...
11df9a94876558cb5ba5d08346fa2fb22fd0504e4cbe39356499ae92235e4d73
Python
11,376
316
# 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...
ce6485889f782f4d6aebb153f5034887b44fdb41056e90a0f0eb043dfa8566f0
Python
11,382
413
# -*- coding: utf-8 -*- import numpy as np import pytest from numpy.testing import assert_array_almost_equal from pysteps.blending.linear_blending import _get_ranked_salience, _get_ws, forecast from pysteps.utils import transformation # Test function arguments linear_arg_values = [ (5, 30, 60, 20, 45, "eulerian"...
ea79701053c804f4baa8f8010b154dcb8ac41886a2f6ae88f46fe71c65a8b01f
Python
11,407
315
import numpy as np import os import os.path as op import nibabel as nib from src.utils import utils def snap_electrodes_to_surface(subject, elecs_pos, grid_name, subjects_dir, max_steps=40000, giveup_steps=10000, init_temp=1e-3, temperature_exponent=1, ...
543174e2cb80be261b897c7a1d0bf1ecde0d28031f657546adcaa357b7c39414
Python
11,416
407
import os from itertools import combinations 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_co...
86fd36b6786f695e744304ff4f97690fd40dc3e65af7577c4f9924d97d62bf72
Python
11,434
303
# -*- coding: utf-8 -*- """ pysteps.blending.skill_scores ============================== Methods for computing skill scores, needed for the blending weights, of two- dimensional model fields with the latest observation field. .. autosummary:: :toctree: ../generated/ spatial_correlation lt_dependent_cor_n...
835c5123b103a7062c159952575746ad3996682aa0ed979fbbdd4d1ff78a1b0a
Python
11,435
323
# -*- 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...
01995ff9f97b280c19832adef3ed0ce6503299ae8dbed8865fa5d3e750097715
Python
11,436
298
import os import yaml # codacy ignore python-use-of-pickle: Pickle usage is safe in this context (local data only). import pickle import shutil import pandas as pd from pathlib import Path from warnings import warn import lightning.pytorch as pl from lightning.pytorch.profilers import PyTorchProfiler from lightning.p...
ded42955e080fb6753e511ecc8a52770b28d3adc00e6010e8ae8bce53acb2e91
Python
11,439
283
import itertools import re import numpy as np import scipy.special import xgboost as xgb from xgboost import testing as tm class TestSHAP: def test_feature_importances(self) -> None: rng = np.random.RandomState(1994) data = rng.randn(100, 5) target = np.array([0, 1] * 50) featur...
ed14b6ccbae3d171943f9aeb2da8371b93407124fb3c7dfba8bbcf339df7293e
Python
11,441
263
#steroid is based on PyTorch and PyTorch-Lightning. #import comet_ml import torch import torch.nn as nn from torch import optim from utils import get_logger, parse, save_opt #device, from torch.optim.lr_scheduler import ReduceLROnPlateau import pandas as pd from pytorch_lightning import Trainer, seed_everything from p...
7b14861c5cb81c2e86ada21ab496f792a1654d1cfc826bd28a9c3c9b109e0b94
Python
11,443
279
import torch import torch.nn as nn import torch.nn.functional as f from torch.nn import init from .submodules import ConvLayer, UpsampleConvLayer, TransposedConvLayer, RecurrentConvLayer, ResidualBlock, ConvLSTM, ConvGRU def skip_concat(x1, x2): return torch.cat([x1, x2], dim=1) def skip_sum(x1, x2): return...
4cf1c054f1805942291b7c9eb61b88bd0ace98f4e042276ba882a53fe8bb2ac5
Python
11,451
319
""" Adan Optimizer Adan: Adaptive Nesterov Momentum Algorithm for Faster Optimizing Deep Models[J]. arXiv preprint arXiv:2208.06677, 2022. https://arxiv.org/abs/2208.06677 Implementation adapted from https://github.com/sail-sg/Adan """ # Copyright 2022 Garena Online Private Limited # # Licensed under the Apache L...
1dd9b4a1a52d06decdd4e5ce7411f710d22a4dfd0bee546ff8b15efb6d4926a6
Python
11,453
311
# -*- 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...
cbaa100ca7efd0cf2f9ffdd824d53aa295b11a3dced7091141a3289ae461bc79
Python
11,464
327
#!/usr/bin/env python3 ''' @author: Adam Olesiński ''' from dict2xml import dict2xml import cv2 import os import glob def signals2dict(signals): objs = [] for signal in signals: rois = signal.get_rois() for roi in rois: obj = { 'name' : signal.name, ...
a1e492a265f116c5f1467636130d5399653eed7e4e35c104441e1c82b6b9a7fd
Python
11,474
356
# -*- 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...
2dd3b98748d4403b1071cbfee506e9b4525926e8d4637add8fa45b2a5f7f802d
Python
11,485
354
# Inheritaed from open-mmlab/mmclassification # Modified by Hangyu LIN import collections.abc import functools import itertools import subprocess import warnings from collections import abc from importlib import import_module from inspect import getfullargspec from itertools import repeat # From PyTorch internals de...
8504f6e024463c4d140987823949c2591ce2108d14be24827f0536e268f19aee
Python
11,485
288
import logging import numpy as np from keras import Input from keras.engine import Model from keras.layers import Dense, Dropout, Lambda, Concatenate from keras.regularizers import l2 from data.data_access import Data #from data.pathways.gmt_pathway import get_KEGG_map from model.builders.builders_utils import get_pn...
277874da9262df3c2ed528877c7aabfbe21659ee805472c0a556c8f642d3bf5b
Python
11,487
332
#!/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 ...
119b10e65000f78dfb0e6ef242d7ef5d4bec13eb50d832d82e129c01ecc015ba
Python
11,494
320
# -*- 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...
2f6854a6d3091bcc668471495460bb076f1b25b108b2216b9fc0fffa4aae1956
Python
11,495
291
# JHK # Python script for generating Figure 4. import numpy as np from netCDF4 import Dataset import matplotlib.pyplot as plt import matplotlib as mpl from mpl_toolkits.basemap import Basemap, cm from pylab import * #========================================================== # Set main directory #===================...
6b06d69e6f591a76f9da1ee18912b86df85c6e4f53fd571ea918450e95fa5b1f
Python
11,501
270
""" Halo Self Attention Paper: `Scaling Local Self-Attention for Parameter Efficient Visual Backbones` - https://arxiv.org/abs/2103.12731 @misc{2103.12731, Author = {Ashish Vaswani and Prajit Ramachandran and Aravind Srinivas and Niki Parmar and Blake Hechtman and Jonathon Shlens}, Title = {Scaling Local Self...
f4e44d6e624372e15789fe88507404e2a59cdefb673cf56358484c217420ecfe
Python
11,506
392
import re import os import glob import numpy as np import random import random import pandas as pd import json from torch.utils.data import Dataset import logging from tqdm import tqdm LOGGER = logging.getLogger(__name__) class QueryDataset_COMETA(Dataset): def __init__(self, data_dir, load_full...
6ed958c036585a4a631801ce7769395eb8d1ab3e0e89e0cc949b6d08f9f32f54
Python
11,507
291
# JHK # Python script for generating Figure 4. import numpy as np from netCDF4 import Dataset import matplotlib.pyplot as plt import matplotlib as mpl from mpl_toolkits.basemap import Basemap, cm from pylab import * #========================================================== # Set main directory #===================...
d8d04f6e536412a4030ac601685e73a57158e4ec91022275a4b6d65c32c0d898
Python
11,513
333
""" Performs various GLM-related computations. @author: JingyiGF """ from .toolkits import * def linear_predictor(beta, x_mat, fit_intercept): """Compute linear predictor. eta = beta0 + X*beta""" if x_mat is None: if not fit_intercept: raise ValueError('When x_mat is None, we will fit int...
58a8f3b9b859cfc6eef55aae824606a7b3094d8518e82f8ea31f67db72483456
Python
11,519
217
# -*- coding: utf-8 -*- """ @author: bartulem Estimate how well different data streams (tracking/IMU) are synced with neural recordings. This script utilizes the LED timestamp occurrences across different data streams and estimates how well they are linearly related. Specifically, the tracking/IMU data is split (tr...
d13c05dd57512aea76dc61f0caea3b5fb715f6e88d30d58454dbee9b5ae54787
Python
11,521
342
# -*- 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...
b6755298c0daef334f576dfa74265f7f7f82febb6042b7c5e72915b54f6bcd57
Python
11,522
291
from typing import Any, List, Dict from torchmetrics import MetricCollection import wandb import pytorch_lightning as pl import torch from src.tasks.metrics import get_cls_pred_metrics, get_cls_prob_metrics, get_reg_metrics import numpy as np import shap import pandas as pd def get_model_framework_dict(): model_f...
b2faf9b353c21beed3fa179baa900c7cd8c5715f013e70d1897669c9f52a169f
Python
11,525
305
""" [spacer] # This will add a space between two tracks. No options are required, but # for finer control, the amount of space required can be given # height value in centimeters height = 1.5 [bigwig] file = /data/manke/group/ramirez/HiC-ThomasLing/data/external/Graveley_mRNA-seq/GSM390060_Kc167-4_spa.bw title = Kc RN...
2be4d833e5d8cc0ae5a59c2fb276bf536b97650eb8a058e1be14f47a79aae71b
Python
11,534
277
import numpy import pytest import cellprofiler_core.image import cellprofiler_core.measurement import cellprofiler.modules.correctilluminationapply import cellprofiler_core.modules.injectimage import cellprofiler_core.object import cellprofiler_core.pipeline import cellprofiler_core.workspace from cellprofiler_libra...
4c57aeee9dd549dc8bab44e166cec62a46cdcee01bf002401dd90403e5ade833
Python
11,540
294
from os import getcwd from os.path import basename, join import numpy as np from traitlets import Instance, Unicode from traitlets.config import ArgumentError, Dict from mrHARDI.base.application import (mrHARDIBaseApplication, MultipleArguments, ...
791ccdb4bf0a18f3018347e67cce6c2c0ac308bab16247f6d0767a3ef49682a6
Python
11,552
288
import logging import numpy as np from keras import Input from keras.engine import Model from keras.layers import Dense, Dropout, Lambda, Concatenate from keras.regularizers import l2 from data.data_access import Data #from data.pathways.gmt_pathway import get_KEGG_map from model.builders.builders_utils import get_pn...
33dddb7b07efd91635da9862f102d84e05af94371ee0866a81a23e7202c7e4dd
Python
11,560
266
import numpy as np from typing import Tuple, Optional, List, Union, Annotated from pydantic import Field, validate_call, ConfigDict, BaseModel from cellprofiler_library.opts.align import CropMode, AlignmentMethod, AdditionalAlignmentChoice, MEASUREMENT_FORMAT from cellprofiler_library.types import Image2D, Image2DMas...
3102ecd6d828cd7c79d4fe72af9eefd76cacc87f1da520d5096a5f4933a11298
Python
11,561
327
#!/usr/bin/env python3 import io import sys import unittest from unittest.mock import MagicMock, mock_open, patch from ciftify import html import ciftify.qc_config if sys.version_info[0] == 3: builtin_open = 'builtins.open' else: builtin_open = '__builtin__.open' @patch('ciftify.utils.check_output_writable'...
ae7587d24ab593bb2453ff4fee38d999731b84ca98ce1493b49ac788f9f26bc6
Python
11,573
350
import numpy as np import os from matplotlib import pyplot as plt from matplotlib.patches import Rectangle from tensorflow.keras import callbacks from tensorflow.python.keras.callbacks import Callback from lib.pinn import PINN from lib.network import Network import pandas as pd import tensorflow as tf from helper impo...
15532c1406f0bb74bcec430ce2ce5c4a29e6d1d059a39bd0b5c88dee24a6393a
Python
11,584
346
from abc import abstractmethod from copy import deepcopy import numpy as np from traitlets import Float, Integer, List, TraitType, Unicode, default from traitlets.config.loader import ConfigError from mrHARDI.base.ListValuedDict import MagicDict from mrHARDI.base.application import (DictInstantiatingInstance, ...
9eb32c2b167d957c4698fd501f1dea4b8fcecd88ae67bd2e48c69a230c17b507
Python
11,596
254
import numpy as np import time import nengo import sys, os import argparse sys.path.insert(1, os.path.dirname(os.getcwd())) #os.chdir("..") import sspslam from sspslam.networks import get_slamview_input_functions import sspslam.utils as utils parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHe...
a73298714a908208e53da8a6cfb8c56fa3747342a9d3481d0a9288d70415a31c
Python
11,610
423
# -- coding: utf-8 -- """ pysteps.verification.probscores =============================== Evaluation and skill scores for probabilistic forecasts. .. autosummary:: :toctree: ../generated/ CRPS CRPS_init CRPS_accum CRPS_compute reldiag reldiag_init reldiag_accum reldiag_compute ...
a2188289187b4aae9f33e38386c1575c621d12e646c1df9cd1f998cf9d609a46
Python
11,612
273
import json import os import warnings from typing import TYPE_CHECKING, Any, Iterable, Union import numpy as np import pandas as pd import traits.api from ptsa.data.readers import BaseReader __all__ = [ 'TalReader', 'TalStimOnlyReader', ] class TalReader(BaseReader, traits.api.HasTraits): """ Reade...
7b3e06363e4ed402bfbf012eaa43bf1f3ba5d4a0711ff12bb051ed5cca561fb5
Python
11,615
276
import numpy as np import torch from torch.nn.functional import one_hot from torch import nn import datetime import pytest from tests.utils import reset_seed, reset_layers, run_forward_pass, setup_training_pipeline from utils import args from utils import train_utils as tu import networks.dfc_network_utils as dfcu fro...
fff9020b8665e18b72888b7d1e72b7753105160a2521330ed99cdde0606b5af5
Python
11,626
343
"""analysis_worker.py - Run pipelines on imagesets to produce measurements. The analysis worker listens on a ZMQ port for work announcements. It then requests jobs from the announcer and executes them. As an application, the analysis worker runs three threads: * Main thread - spawns the worker and monitor threads and...
cb2fe03c30d4f83fee17f5ebcbd2f35588976ed6bbbe88668f921b568cd4d4c1
Python
11,628
294
""" Scheduler Factory Hacked together by / Copyright 2021 Ross Wightman """ from typing import List, Optional, Union from torch.optim import Optimizer from .cosine_lr import CosineLRScheduler from .multistep_lr import MultiStepLRScheduler from .plateau_lr import PlateauLRScheduler from .poly_lr import PolyLRScheduler...
ed1795a9ec98e92b83e938f812b01bdc76db738823c14cd377b6f6d3ed7c9670
Python
11,630
333
# from https://gist.github.com/lukauskas/f2f43aad6078a8b5d71b986174487b8c from seaborn.matrix import _HeatMapper from matplotlib import pyplot as plt import numpy as np import pandas as pd #from seaborn.external.six import string_types from seaborn.utils import despine, axis_ticklabels_overlap, relative_luminance, to...
132ba059f295f50e41827b56f2f80b717b7049b56d208cff54fe52702f64f62f
Python
11,643
284
from cellprofiler_core.constants.measurement import C_LOCATION, COLTYPE_FLOAT from cellprofiler_core.module import Module from cellprofiler_core.setting import Divider, ValidationError from cellprofiler_core.setting.subscriber import ( ImageListSubscriber, LabelListSubscriber, ) from cellprofiler.modules import...
7f044f721feedd6cd8e7becf5099848e2e7ba7276e82e9e42600e0863aed48ab
Python
11,667
241
# Pytorch Tabular # Author: Manu Joseph <manujoseph@gmail.com> # For license information, see LICENSE.TXT """AutomaticFeatureInteraction Config""" from dataclasses import dataclass, field from typing import Optional from src.models.tabular.pytorch_tabular.repository.config import ModelConfig @dataclass class FTTrans...
0afa857071508015c5ca3922cf030b89789ef00e2e96c2701e640d4c3b0bc4cb
Python
11,672
340
# -*- coding: utf-8 -*- # # PTSA documentation build configuration file, created by # sphinx-quickstart on Wed Jun 1 17:36:58 2016. # # 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 ...
209dae6acf7c28bc914e03812755009343f4ea2ba5a1cd77e68998088bb602d1
Python
11,673
236
""" 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 from servalcat.utils import logger...
d729bf5876a445650a7f055b1c34f5322429012a0d7c7fcf09734f969af8002e
Python
11,674
314
# Ignore future warning import sys import warnings import datetime import random warnings.filterwarnings("ignore", category=FutureWarning) import argparse import os import torch print('Parsing args') parser = argparse.ArgumentParser(description='Docking') parser.add_argument('-debug', default=False, action='store...
83e6832abad544c6f5acd6c26c1420f9df7e91b0a50b073d1482ec45f4739203
Python
11,682
246
import os.path as op import numpy as np import shutil import csv import nibabel as nib # from mne.label import _read_annot from collections import Iterable import glob from src.utils import utils from src.utils import preproc_utils as pu from src.utils import args_utils as au from src.utils import freesurfer_utils as ...
9a4004ce1972fc2e9c5d0d25666e709b8f2338fabf8e6808e781a726951a1eec
Python
11,696
297
"""Convert pinned UCI Madelon matrices into lossless, named CSV splits.""" from __future__ import annotations import argparse import csv import gzip import hashlib import io import json import platform import shutil import sys import zlib from collections import Counter from pathlib import Path from urllib.request im...
ee62f4c37a40394f221971c77feeee407db4a6549254bdb39404a7cb52b65bc6
Python
11,700
384
# -*- coding: utf-8 -*- """ pysteps.utils.transformation ============================ Methods for transforming data values. .. autosummary:: :toctree: ../generated/ boxcox_transform dB_transform NQ_transform sqrt_transform """ import numpy as np import scipy.stats as scipy_stats...
6d320e7b6b10e988540145dcf4ac5618a5bdda8511947eb5f01c1310e96ae75b
Python
11,701
296
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Jun 16 10:25:51 2022 @author: Manuel Predict classes using trained model Run from terminal: python3 LeleNet_prd.py /path/to/orthomosaic /path/to/output /path/to/model """ __author__ = "Manuel R. Popp" #### parse arguments--------------------...
37226069e09daf20651ccce23cf2e65ad224e39d2ed38d8d59082cfea87b927c
Python
11,744
342
from typing import Optional, Union, Dict import os, datetime, subprocess, sys from copy import deepcopy import random from packaging.version import Version import numpy as np import torch import SimpleITK as sitk from contextlib import contextmanager, redirect_stderr, redirect_stdout from os import devnull @contextm...
13eaf344db06e043dd4b4d01f0bb40c34a7e83eff7653944297c9eb8908f1659
Python
11,782
282
""" Custom optimizers to implement lr_mult as in caffe Date: September 2018 Author: Ignacio Heredia Email: iheredia@ifca.unican.es Github: ignacioheredia References ---------- https://github.com/keras-team/keras/issues/5920#issuecomment-328890905 """ from tensorflow.python.keras import optimizers from tensorflow.pyt...
52cb7b45c97f6138a934265d46b6dbfff0ad5aceae987a634762b16dbba9b74b
Python
11,793
324
""" SGD with decoupled weight-decay. References for added functionality: Cautious Optimizers: https://arxiv.org/abs/2411.16085 Why Gradients Rapidly Increase Near the End of Training: https://arxiv.org/abs/2506.02285 Hacked together by Ross Wightman """ from typing import List, Optional import torch from tor...
397128634a98197aeccd3ed5f36a101263f3ae9a5510176e7832e43e3bf614d4
Python
11,839
268
""" Dataset reader for HF IterableDataset """ import inspect import logging import math import os from typing import Optional import torch import torch.distributed as dist from PIL import Image try: import datasets from datasets.distributed import split_dataset_by_node from datasets.splits import SplitInf...
f68faf25a28d7f1b5d85cf2eef54df29e9702f577fda99fbd369aa8f5f65239a
Python
11,848
309
# adapted from https://github.com/kenshohara/3D-ResNets-PyTorch import sys import torch import torch.nn as nn import torch.nn.functional as F from collections import OrderedDict from .modelBase import ModelBase class _DenseLayer(nn.Sequential): def __init__(self, num_input_features, growth_rate, bn_size, drop_r...
d33fad75773e4801c6be511b7289b243213c09ab916c805953603e2e7bb88168
Python
11,854
340
import math from collections import OrderedDict from functools import partial from typing import Any, Callable, Dict, List, NamedTuple, Optional import torch import torch.nn as nn from torchvision.ops.misc import Conv2dNormActivation, MLP import torch.nn.functional as F # __all__ = [ # "VisionTransformer", # ...
62e50d48a72e80df04ee069477eea80bfb5c157323dd9adab4190a8538694ac5
Python
11,877
325
import json import math import os import argparse 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: ...
d974732354de5c2e653878e58a42519a5b385961b16e4bd8e31dd6c54894d370
Python
11,880
287
import numpy as np import scipy.stats as sps import matplotlib.pyplot as plt import matplotlib.gridspec as gs import pickle from scikits.bootstrap import bootstrap as boot import seaborn as sns ############################################################################## # FUNCTIONS FOR PLOTTING AND STATISTICAL TE...
570f62aa4ee3382a163b7a8508894db840983758f4419e31aff9c9d4637cd43b
Python
11,884
358
"""Run simple cell optimisation""" """ Copyright (c) 2016, EPFL/Blue Brain Project This file is part of BluePyOpt <https://github.com/BlueBrain/BluePyOpt> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 3.0 as published by t...
983fb5e12153cb608fbf7d1e3eaaa7b34ffce099cfd2b1853b314f4148f37d33
Python
11,899
291
from pathlib import Path import weakref import cv2 import h5py import numpy as np import torch from torch.utils.data import Dataset import torchvision.transforms as transforms from PIL import Image from DSEC.dataset.representations import VoxelGrid from DSEC.utils.eventslicer import EventSlicer import albumentations ...
bd302e72427406cf677ded86d272884aa831580ac861d338a681a94e4e7a4182
Python
11,906
276
# -*- coding: utf-8 -*- # adapted from https://github.com/qubvel/segmentation_models.pytorch from typing import Optional, Union, List import torch import torch.nn as nn from segmentation_models_pytorch.base import SegmentationHead, ClassificationHead from segmentation_models_pytorch.encoders import get_encoder from se...
9d809f02cb4b74e6b9f70e93fd988cb2853cac0ef2280ae153c0dc6df3c5415d
Python
11,913
280
from collections import defaultdict import os.path import warnings from typing import Callable, DefaultDict, List, Optional, Tuple, Type import numpy as np import numpy.typing as npt import xarray as xr import traits.api from ptsa.data.readers.edf import EDFRawReader from ptsa.data.readers.binary import BinaryRawRead...
9617d89ce256154668d782d86a0779caea2ec9e2eb2cf0a3e9609208a416c585
Python
11,945
282
# -*- coding: utf-8 -*- import torch import torch.nn as nn import function from module import FA_wrapper, TrainingHook import utils spike_args = {} class NetworkBuilder(nn.Module): def __init__(self, topology, input_size, input_channels, label_features, train_batch_size, train_mode, dropout, ...
f7edf2492a0cf53d4fbc9e84fb177422b27c1f7fde985e753b24bd330f701c76
Python
11,945
300
"""Prepare Scheetz2006 regression data from the authors' GEO submission.""" from __future__ import annotations import argparse import csv import gzip import hashlib import json import os import shutil import subprocess import sys import tempfile import zlib from datetime import UTC, datetime from pathlib import Path ...
1972c558a27621673bc508b706864666cfe8b0678afe89469640dfad102a65c2
Python
11,957
248
from pathlib import Path import yaml import itertools from tqdm import tqdm import pytorch_lightning as pl import torch from torch.utils.data.dataloader import DataLoader from torch.utils.data import RandomSampler, WeightedRandomSampler import torch.multiprocessing as mp class BaseDataModule(pl.LightningDataModule...