sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
4b86012bfa13c8e2ef908ac58a429cdc5979e6bfbbc2f2eee6df867f921dd857 | Python | 15,573 | 434 | # important note:- Do not change any print stings if you intended to use pyOS5 GUI
#@ Author : Sampath
#This script is to run DMTP (Delayed Matched Response) working memory task and for more deatils look at Task_desription.ppt
#SP => Sample Phase
#CP => Choice Phase
import random as rnd
import hardware_definition as h... |
5d2a3cdb772b69c689c98cb657fb55c7dac4196275474101efaea9e602677883 | Python | 15,576 | 434 | # important note:- Do not change any print stings if you intended to use pyOS5 GUI
#@ Author : Sampath
#This script is to run DMTP (Delayed Matched Response) working memory task and for more deatils look at Task_desription.ppt
#SP => Sample Phase
#CP => Choice Phase
import random as rnd
import hardware_definition as h... |
7b5a3853e249ffedddef9f8b25396ea22c50ea21eb53a72e33716563eef0614e | Python | 15,592 | 434 | # important note:- Do not change any print stings if you intended to use pyOS5 GUI
#@ Author : Sampath
#This script is to run DMTP (Delayed Matched Response) working memory task and for more deatils look at Task_desription.ppt
#SP => Sample Phase
#CP => Choice Phase
import random as rnd
import hardware_definition as h... |
c6bf2bac79ca64b1a69226786b98295bc6f3a3270cd09eacf2c9c9c86e375763 | Python | 15,593 | 363 | import numpy
import zarr
from ..constants.image import MD_SIZE_S, MD_SIZE_C, MD_SIZE_Z, MD_SIZE_T, MD_SIZE_Y, MD_SIZE_X, MD_SERIES_NAME
from ..constants.reader import ZARR_FILETYPE
from ..reader import Reader
import os
import re
import logging
from lxml import etree
LOGGER = logging.getLogger(__name__)
FORMAT_TES... |
c7d4a48e7de8d3d51680a97edee55e061091fb8980beaa413f2fddf3c5c74224 | Python | 15,595 | 434 | # important note:- Do not change any print stings if you intended to use pyOS5 GUI
#@ Author : Sampath
#This script is to run DMTP (Delayed Matched Response) working memory task and for more deatils look at Task_desription.ppt
#SP => Sample Phase
#CP => Choice Phase
import random as rnd
import hardware_definition as h... |
28605cfcf2e1d2f1637d61a1bbeaf4a02cd1e8802da164ec940f45b1f11c477d | Python | 15,603 | 395 | """
IN DEVELOPMENT
Module to compute energy of systems based in pair interactions
Need the folder 'pot'.
Created by © Rodrigo Carvalho 2019
Mainteined by © Rodrigo Carvalho
"""
import math
import os
import sys
import numpy as np
import pandas as pd
import pymatgen as mg
from lib.representations import Coulomb_Matrix... |
195aa00a724a27aacc8c11f94edc12831019a457034b8cae374f5ab4b653db43 | Python | 15,616 | 434 | # important note:- Do not change any print stings if you intended to use pyOS5 GUI
#@ Author : Sampath
#This script is to run DMTP (Delayed Matched Response) working memory task and for more deatils look at Task_desription.ppt
#SP => Sample Phase
#CP => Choice Phase
import random as rnd
import hardware_definition as h... |
5b56d60d134e4322f9fad9df67534136252fd71ca0f46758505eeb2683f9ff76 | Python | 15,619 | 434 | # important note:- Do not change any print stings if you intended to use pyOS5 GUI
#@ Author : Sampath
#This script is to run DMTP (Delayed Matched Response) working memory task and for more deatils look at Task_desription.ppt
#SP => Sample Phase
#CP => Choice Phase
import random as rnd
import hardware_definition as h... |
c8e8473e227447fd40cde6e9f4d461871f7df14834092d485082695a93c32e25 | Python | 15,631 | 289 | # Fundamental libraries
import os
import re
import sys
import time
import glob
import random
import datetime
import warnings
import itertools
import numpy as np
import pandas as pd
import pickle as cp
import seaborn as sns
import multiprocessing
from scipy import stats
from pathlib import Path
from ast import literal_e... |
0a943a9773453f1e5b5906f2467973ee0002ce629238f14fc41c9e8ad03cb4b0 | Python | 15,657 | 352 | import os
import glob
import random
import torch
import yaml
import json
import argparse
import numpy as np
import pandas as pd
from tqdm import tqdm
from pprint import pprint
import torch.nn as nn
from sklearn.model_selection import LeaveOneGroupOut, GroupKFold, KFold
import asteroid
#from asteroid.metrics import get... |
2fad47445b204dc38810b5954cac2a2a7bc47c48f7252eff00ef21bd41027e64 | Python | 15,663 | 451 | import json
import math
from pathlib import Path
import numpy as np
import pytest
import xgboost as xgb
from xgboost import testing as tm
from xgboost._c_api import _parse_version
from xgboost.core import _parse_eval_str
dpath = "demo/data/"
rng = np.random.RandomState(1994)
class TestBasic:
def test_compat(se... |
4e9d5ae1430fcf097ee9a33dd6b05e33a8538962bdb3cddb7117081b57a45af5 | Python | 15,681 | 362 |
# 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 modify it under
# the terms of the GNU General Public License 2.... |
a4b6049bbf3365794c8769b9e1cf0614e7b2b0d3a1471878d6b37fe4fd7c022a | Python | 15,693 | 395 | """
This file is subject to the terms and conditions defined in
file 'LICENCE', which is part of this source code package.
Author: Leo Guignard (leo.guignard...@AT@...univ-amu.fr)
"""
from qtpy.QtWidgets import QWidget, QVBoxLayout
from ._utils import error_points_selection, safe_toarray
import matplotlib as mpl
impor... |
15efcbc0e6841302103da013cadf0dcfaa9500904435b0ffca63fc533e0894c1 | Python | 15,697 | 404 | # -*- 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... |
be41e07b7069d26ebe5fb0c8947aef7dc6efe5425582326569e11c7a5da2f72f | Python | 15,698 | 427 | from __future__ import annotations
from dataclasses import dataclass
from pathlib import Path
import tempfile
from typing import Optional
import prov.model as pm
import pytest
from nidm.core import Constants
from nidm.experiment import (
Acquisition,
AssessmentAcquisition,
AssessmentObject,
Project,
... |
5df9318f035e63e58ea661a7b8515ec6ce6620f07af44b6784eafba33449a26e | Python | 15,712 | 369 | #!/usr/bin/env python3
import unittest
import logging
import importlib
import copy
import os
from docopt import docopt
from unittest.mock import patch
import pytest
import ciftify.utils
logging.disable(logging.CRITICAL)
ciftify_recon_all = importlib.import_module('ciftify.bin.ciftify_recon_all')
class ConvertFreesu... |
0e2f987eba343050cd01374a4ff8086464e47f513666412069571b3e3369bdd4 | Python | 15,762 | 475 | from dataclasses import dataclass
import json
from os.path import join
from pathlib import Path
import pandas as pd
import pytest
from nidm.experiment.Utils import map_variables_to_terms, write_json_mapping_file
@dataclass
class Setup:
data: pd.DataFrame
reproschema_json_map: dict
bids_sidecar: dict
b... |
456b1a29042e34b57fa3d04f7cae47eb3c83a3f932b485daec1b1419dccc4c73 | Python | 15,762 | 403 | # -- coding: utf-8 --
"""
pysteps.verification.detcatscores
=================================
Forecast evaluation and skill scores for deterministic categorial (dichotomous)
forecasts.
.. autosummary::
:toctree: ../generated/
det_cat_fct
det_cat_fct_init
det_cat_fct_accum
det_cat_fct_merge
de... |
5cf0fd1a61479b79a8921488d2299aed41e23584573168136baedae7460932b2 | Python | 15,771 | 362 | # -*- coding: utf-8 -*-
import sys
import collections
from .utilities import to_string, InputError
class ReadBed(object):
"""
Reads a bed file. Based on the number of fields
it tries to guess the type of bed file used. Current options
are bed3, bed6 and bed12
Example:
bed = ReadBed(open("file... |
7b021788efac3e31e4ef4673b49a1072204662377fd0540a9359a0b5ce0c6b2d | Python | 15,776 | 486 | import numpy
import six.moves
import cellprofiler_core.image
import cellprofiler_core.measurement
import cellprofiler_core.measurement
from cellprofiler_core.constants.measurement import (
M_LOCATION_CENTER_X,
M_LOCATION_CENTER_Y,
FF_COUNT,
FF_PARENT,
COLTYPE_FLOAT,
M_NUMBER_OBJECT_NUMBER,
... |
dce43efd0cf1b31df6b318b831f8be2700f253dd0095f2801bf72d24f286ab6a | Python | 15,780 | 441 | """Blocks: the shape each algorithm family actually wants.
A block is derived from a view, read-only, and knows nothing about the model that
consumes it. Each is what one :mod:`~nimare.studyset.requirements` requirement
resolves to, so :meth:`~nimare.studyset.view.View.resolve` hands every algorithm
its inputs aligned... |
eb0fcd7809452dc4aeaa69f2746e73833db51460dd9203abf2b9631f57d82e47 | Python | 15,789 | 416 | from functools import partial
from collections.abc import Iterable
from collections import defaultdict
import re
from pathlib import Path
# from IPython.display import display
import pandas as pd
import numpy as np
from tqdm import tqdm_notebook
# import matplotlib as mpl
# import matplotlib.pyplot as plt
# import s... |
8953423ba805e9daa5c2c7f51dd59d4f52ad2827fc67b0675c6c75a59ece9a47 | Python | 15,795 | 351 | #!/usr/bin/env python3
import os
import unittest
import logging
import shutil
import tempfile
import ciftify.config
from ciftify.utils import run
import pytest
from pytest import raises
from unittest.mock import patch
import pandas as pd
import numpy as np
def get_test_data_path():
return os.path.join(os.path.dirn... |
4c6af4c33ac350e23ec5fcef297f441005864e5911fb88c7355b35e1217ff2db | Python | 15,809 | 414 | import numpy as np
import os
import time
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.decomposition import NMF
from scipy.stats import spearmanr, pearsonr
from sklearn.metrics import mean_squared_error, r2_score
from statannotations.Annotator import Annotator
from sklearn import metrics
from sklearn... |
400a122c7c38a22804aa6e594fb06643451d619a0d3370f679704fa8e2c04a4e | Python | 15,812 | 382 | #!/usr/bin/env python3
"""
Will use nilearn.image.clean_img to do filtering and confound regression according
to user settings. Optional smoothing can also be added
Usage:
ciftify_clean_img [options] <func_input>
Options:
--output-file=<filename> Path to output cleaned image
(defaul... |
784717962176c4d913dfa068ef190d361ee5d9819b4aa92aa6cb383bb45bc1a3 | Python | 15,862 | 399 | """
CorrectIlluminationApply
========================
**CorrectIlluminationApply** applies an illumination function,
usually created by **CorrectIlluminationCalculate**, to an image in
order to correct for uneven illumination/lighting/shading or to
reduce uneven background in images.
This module applies a previously ... |
59a1000ade7c492c545b9bf2dee6fa7f51a97736ca62ccd63fd2525eaa34d189 | Python | 15,905 | 345 | # -*- coding: utf-8 -*-
"""
Created on Wed Feb 7 19:39:03 2018
@author: saskiad
"""
import numpy as np
import pandas as pd
import os, h5py
import scipy.stats as st
from scipy.optimize import curve_fit
import core
def do_sweep_mean(x):
return x[28:35].mean()
def do_sweep_mean_shifted(x):
return x[30:40].mea... |
3ed18433454849ce804715cb19d69163550834cb7eb5180636a2183e52d57eab | Python | 15,914 | 379 | import h5py
from unnatural_movie_analysis import unnatural_movie_analysis
from natural_movie_analysis import natural_movie_analysis
import os
import numpy as np
import sys
from gabor_wavelet_preprocessing_linquad import gabor_wavelet_preprocessing_linquad
from threshgrad import threshold_grad_desc_cv, lsq, dotdelay, so... |
bc03c42464aff35c711f5a92ffb4d4014a7e5481230df131ed3d06f5df0a2e65 | Python | 15,921 | 457 | # -*- 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... |
8fca8b5a00e9fb3ce9a3b8917053aae6f0123a1922321a623c1dbb810ba8580a | Python | 15,956 | 317 | """
This python script will generate two files:
- docs/content/all_default_properties_rst.txt
This file is a rst table with all the defaults values for each parameter
for each track class or vtype. This table is included in the readthedocs
- docs/content/all_possible_properties.txt
This file is a markdown list with pos... |
db673af8401d238d13f7c0120fffe1892fa793d16ba6c8c0877ac7a2552aab1a | Python | 15,966 | 499 | # -*- 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... |
fea0a0bc85c7656fe4fc85182d4f791b92f9ca8a33c42442631a3ae5323ef795 | Python | 15,983 | 428 | from typing import List, Optional, Tuple, Union
import os, pathlib, math, copy
from enum import Enum
import numpy as np
import SimpleITK as sitk
import torchio
import cv2
from skimage.io import imsave
from .generic import get_filename_extension_sanitized
def resample_image(
input_image: sitk.Image,
spacing: ... |
9bb656c1918a11896b5709fb5c9d99334a3908fd45e5edaaf563145dba5d42c7 | Python | 15,996 | 456 | """
pysteps.visualization.utils
===========================
Miscellaneous utility functions for the visualization module.
.. autosummary::
:toctree: ../generated/
parse_proj4_string
proj4_to_cartopy
reproject_geodata
get_geogrid
get_basemap_axis
"""
import warnings
import matplotlib.pylab a... |
8375420418cb5c705092ef426087e23809f563edb850a7ca9ca92399cd7a9279 | Python | 16,002 | 467 | import os
import tempfile
import time
import warnings
from os.path import expanduser
import datalad
import datalad.api as dl
import numpy as np
import pandas as pd
# --------------------------------------------------------------------------- #
home = expanduser("~")
get_exc = datalad.support.exceptions.IncompleteResu... |
672e2306760e9b9b3bbe863ff21d54cdbbec42665f723084d511f54f679752d2 | Python | 16,005 | 285 | #! /usr/bin/env python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
## Basics
import sys, os, glob, gzip, time, traceback
## Verbosity of tensorflow output. Filters: (1 INFO) (2 WARNINGS) (3 ERRORS)
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
## Math
impor... |
7cd6d0ebd573800b2f0139259bf575203230a1cef1121b861cc9036c22ed1afc | Python | 16,022 | 399 | from __future__ import print_function
import numpy as np
# from FastLZeroSpikeInference import fast
# from scipy.signal import medfilt
from scipy.ndimage.filters import median_filter
import sys
from allensdk.core.brain_observatory_cache import BrainObservatoryCache
import cPickle as pickle
import warnings
import os
imp... |
4065358d3345c3fa64924eb5b51c4bce469c0524cecc0c0cca06723daf792aad | Python | 16,023 | 458 | """ Pytorch Inception-V4 implementation
Sourced from https://github.com/Cadene/tensorflow-model-zoo.torch (MIT License) which is
based upon Google's Tensorflow implementation and pretrained weights (Apache 2.0 License)
Papers:
* `Inception-v4, Inception-ResNet and the Impact of Residual Connections on Learning` - http... |
fe62e634c63682414084a5fb3dd5799f03e36fcd91152ab6faa3c7792ebb423c | Python | 16,024 | 487 | # coding=utf-8
"""errordialog - dialog box for reporting error.
"""
import functools
import io
import logging
import os
import platform
import sys
import traceback
import urllib
import urllib.parse
import urllib.request
from urllib.error import HTTPError, URLError
from urllib.request import urlopen
from cellprofiler... |
993a66b36a0b3e9664c7d3d59d9887354047d2256e61988436972313f6a37ce0 | Python | 16,032 | 437 | #!/usr/bin/env python3
# Copyright 2021 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
#
# Unless required by applicable law o... |
88832138d9188d76b474608b18012ca068e88ebbae759aa82a5fe8f8cfee9d89 | Python | 16,044 | 327 | import random
import numpy as np
import pandas as pd
import torch
import os
from . datasetgenemap import wrap_gene_location
from . datasetgenemap import wrap_gene_layer
from . datasetgenemap import wrap_gene_domain
from . DNN import DNN
from . DNN import DNN5
from . DNN import DNNordinal
from . DNN import DNNdomain
fr... |
008a8c76041d9323c0f17b4c8293a8fcc81d0007fe94d8a1dc08b088b005c097 | Python | 16,046 | 420 | import os
from pathlib import Path
from shutil import copytree
import pytest
from click.testing import CliRunner
from ..cli import main
from ..context_url import CONTEXTFILE_URL
from ..jsonldutils import _is_url, load_file
from ..models import Activity, Item, Protocol, ResponseOption
from ..redcap2reproschema import ... |
7ae4294877c53698d27817cf1b87e547d2b04fc1cfb84ae181ceeeebe935c255 | Python | 16,063 | 475 | # -*- coding: utf-8 -*-
"""
Blended forecast
====================
This tutorial shows how to construct a blended forecast from an ensemble nowcast
using the STEPS approach and a Numerical Weather Prediction (NWP) rainfall
forecast. The used datasets are from the Bureau of Meteorology, Australia.
"""
import os
from d... |
e4d63d9294d77b93d7b681a65f928419f9d34bf5d3ace90de8315a89b6fb6cb9 | Python | 16,074 | 404 | import torch
from torch import nn, einsum, broadcast_tensors
from einops import rearrange, repeat
def exists(val):
return val is not None
def safe_div(num, den, eps=1e-8):
res = num.div(den.clamp(min=eps))
res.masked_fill_(den == 0, 0.)
return res
def batched_index_select(values, indices, dim=1):... |
3aec219e1cfd94493ac4d61dab79d48ca38d40786be399ba20147a89997b78d9 | Python | 16,103 | 384 | #!/usr/bin/env python3
import os
import unittest
import copy
import logging
import shutil
import random
import importlib
import pandas as pd
import json
import pytest
from unittest.mock import patch
from nibabel import Nifti1Image
import numpy as np
import nilearn.image
import ciftify.bin.ciftify_clean_img as ciftif... |
b822916798c6252edd987cfe3087704b56635c6a78e98de9496e0d5d7619d325 | Python | 16,108 | 327 | import random
import numpy as np
import pandas as pd
import torch
import os
from . datasetgenemap import wrap_gene_location
from . datasetgenemap import wrap_gene_layer
from . datasetgenemap import wrap_gene_domain
from . DNN import DNN
from . DNN import DNN5
from . DNN import DNNordinal
from . DNN import DNNdomain
fr... |
0fd99e78884265fb3090ea8e3400e37659e144c0869c170644bba60288fefde3 | Python | 16,146 | 356 | import csv
import os
import sys
import tempfile
import click
import matplotlib.pyplot as plt
import pandas as pd
import scipy.cluster.hierarchy as sch
from sklearn import preprocessing
from sklearn.cluster import AgglomerativeClustering
from sklearn.preprocessing import MinMaxScaler
from nidm.experiment.Query import Ge... |
2ba56013ac13e12a40279a65b226f9d0c39f03e4df45de5babeb8638a17ec5bf | Python | 16,200 | 376 | # -*- coding: utf-8 -*-
"""
Created on Thu Jan 4 10:53:07 2018
@author: saskiad
"""
import numpy as np
import pandas as pd
import os, h5py
import scipy.stats as st
from scipy.optimize import curve_fit
import core
def do_sweep_mean(x):
return x[30:].mean()
def do_intersweep_mean(x):
return x[:30].mean()
# ... |
1893620ef99d60911f05a1811926c7aff2f1d8b4a89180bd757e0a4ed6ed78a1 | Python | 16,208 | 368 | import torch
import numpy as np
from collections import OrderedDict, defaultdict
from torchmeta.utils.data.task import Task, ConcatTask, SubsetTask
from torchmeta.transforms.utils import apply_wrapper
__all__ = ['Splitter', 'ClassSplitter', 'WeightedClassSplitter']
class Splitter(object):
def __init__(self, spl... |
a00e4c1ae60fea6b750f83635b583cb83bb33048f7b253436fce299fb0db28a0 | Python | 16,214 | 440 | from os import chmod, getcwd
from os.path import join, basename
from shutil import copyfile
import nibabel as nib
import numpy as np
from traitlets import Dict, Instance, Unicode, Enum, Bool
from traitlets.config.loader import ConfigError
from mrHARDI.base.application import (mrHARDIBaseApplication,
... |
d245ceefdce52ffe8e45e5da5d40592234de1fee3f0373f4b916b2df86dd0c4a | Python | 16,229 | 361 | from functools import partial
import unittest
import warnings
import torch
import torchdiffeq
from problems import (construct_problem, PROBLEMS, DTYPES, DEVICES, METHODS, ADAPTIVE_METHODS, FIXED_METHODS, SCIPY_METHODS)
def rel_error(true, estimate):
return ((true - estimate) / true).abs().max()
class TestSolv... |
bed9a1249724c3b1e2917e21bce1be2c904f4c3670ebbe75be95337afd8077aa | Python | 16,245 | 527 | import os
import tempfile
import traceback
import numpy
import six.moves
import cellprofiler_core.image
import cellprofiler_core.measurement
from cellprofiler_core.constants.measurement import GROUP_NUMBER, GROUP_INDEX, COLTYPE_FLOAT, COLTYPE_INTEGER
import cellprofiler.modules.measureobjectskeleton
import cellprofi... |
cc281c70e636421e80cf51a629199e5a3b420c3d1072c29c63c27706511edfd6 | Python | 16,253 | 407 | '''
Created on 2016.7.6
@author: liangqian
'''
from Areas.pfc import PFC
from Areas.pac import PAC
from conf.conf import *
import random
import numpy as np
class Cortex():
'''
This class is used to control areas in the cortex, just cortex controlling
'''
def __init__(self, neutype, dt):
sel... |
f4f7783e110c8ee899c4f29ce44686e100475fcd7a1fa5cc5bfba03fbdafa180 | Python | 16,284 | 470 | """ EvoNorm in PyTorch
Based on `Evolving Normalization-Activation Layers` - https://arxiv.org/abs/2004.02967
@inproceedings{NEURIPS2020,
author = {Liu, Hanxiao and Brock, Andy and Simonyan, Karen and Le, Quoc},
booktitle = {Advances in Neural Information Processing Systems},
editor = {H. Larochelle and M. Ranzato ... |
9954385b8068e573a41367814a301b2eb1007aca7ae61d7a94afc38f8947cab0 | Python | 16,287 | 378 | # -*- coding: utf-8 -*-
import torch
import torch.nn as nn
import function
from module import FA_wrapper, TrainingHook
import utils
import numpy as np
# thresh = 0.5
# randKill = 0.1
# lens = 0.5
# decay = 0.2
spike_args = {}
class NetworkBuilder(nn.Module):
"""
This version of the network... |
b9a7864e6c2f66e4c48a52b87ffdc411e4128046fb321d4a35e2fea133f04c19 | Python | 16,303 | 305 | import os
import time
import numpy as np
import matplotlib.pyplot as plt
import math
import shutil
import torch
from model import WTFTP, WTFTP_AttnRemoved
from torch.utils.data import DataLoader
from dataloader import DataGenerator
from utils import progress_bar, wt_coef_len, recorder
import argparse
import logging
imp... |
db99a5ee109ba91e6509db6d4b54a7cb302dea04bafa29c12d3e262f3528c0b6 | Python | 16,338 | 447 | # -*- 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... |
b13d15038d05f9c1ba2c25d15de8482fcaa9362330603342c8fb4e582934f8a9 | Python | 16,344 | 377 | import logging
import numpy
from cellprofiler_core.constants.measurement import COLTYPE_FLOAT, COLTYPE_INTEGER
from cellprofiler_core.module import Module
from cellprofiler_core.setting import Binary, ValidationError, Divider
from cellprofiler_core.setting.text import Text
from cellprofiler_core.setting.subscriber imp... |
feb3756c03d5615a40f1e717e98288da694a7d7fefaba3c5a9ec596d47275a8a | Python | 16,369 | 356 | # types
from typing import List
# pytorch geometric
try:
import torch_geometric
from torch_geometric.nn import MessagePassing
from torch_geometric.typing import Adj, Size, OptTensor, Tensor
except:
Tensor = OptTensor = Adj = MessagePassing = Size = object
PYG_AVAILABLE = False
# to stop thro... |
7cd16771372fd2138dc4f35a23a1477309b5d91cd8f505a44fa50cb0ee354d4b | Python | 16,410 | 307 | import datetime
import logging
from copy import deepcopy
from os import makedirs
from os.path import join, exists
from posixpath import abspath
import argparse, math, random, sys, time
import numpy as np
#np.random.seed(0) # set random seed for keras neural nets
#import xgboost as xgb
import tensorflow as tf
from kera... |
a2c45e36aa45640c881fe6d5cd8d74c625a7d227777c76cecc9606028de9b2db | Python | 16,425 | 404 | #!/usr/bin/env python
__author__ = "Marc Steffen Seibel and Thomas Jochmann"
"""Script for training the Spatio-Temporal CNN.
# Start script:
import settings
settings.seed = 1
settings.gpu = 0
settings.experiment = 'gratton'
%run train.py
"""
import numpy as np
import os
import shutil
import pandas a... |
4d8ad8614bd8ef5f3b99e095bc53c7476c81d835220eb7fa364359c5364121f2 | Python | 16,447 | 349 | """ Exponential Moving Average (EMA) of model updates
Hacked together by / Copyright 2020 Ross Wightman
"""
import logging
from collections import OrderedDict
from copy import deepcopy
from typing import List, Optional
import torch
import torch.nn as nn
_logger = logging.getLogger(__name__)
class ModelEma:
"""... |
004057329cf6b8f1e3cf79fd1cd5b163a48356db6a9d9bbd6131828af2e328cd | Python | 16,448 | 426 | """
MeasureImageOverlap
===================
**MeasureImageOverlap** calculates how much overlap occurs between
the white portions of two black and white images
This module calculates overlap by determining a set of statistics that
measure the closeness of an image to its true value. One
image is considered the “groun... |
0a64ae1d1b5b05e0e99710dcac16034216f874f773726aba10133bc46e4673fb | Python | 16,468 | 437 | """
created by: Donghyeon Won
Modified codes from
http://pytorch.org/tutorials/beginner/data_loading_tutorial.html
https://github.com/pytorch/examples/tree/master/imagenet
"""
from __future__ import print_function
import os
import argparse
import numpy as np
import pandas as pd
import time
import shutil
from i... |
52230e127d0ac0179f6eb8805f1c033a3ede54cf1c1ff7ff2909f0778a04e752 | Python | 16,472 | 386 | # from data.pathways.pathway_loader import get_pathway_files
import itertools
import logging
from os.path import join, realpath, dirname, isfile
import numpy as np
import pandas as pd
from keras.layers import Dense, Dropout, Activation, BatchNormalization, multiply
from keras.regularizers import l2
# from data.pathway... |
4e5a5453ec99d362d8fbb1c71efebeec4712dde94e503b65a0d8805e4ea4f260 | Python | 16,489 | 366 | import csv
import os
import sys
import tempfile
import click
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
from sklearn import metrics, preprocessing
from sklearn.cluster import AffinityPropagation
from sklearn.preprocessing import MinMaxScaler
from nidm.experiment.Query import GetProjectsUU... |
2e922aee0d74452a90e266271e97115a91d28e91172725ce76e1a8d7fd0b1d1b | Python | 16,497 | 419 |
import torch.optim as optim
import torch.nn as nn
import torch
import copy
import time
import scipy.stats
import pandas as pd
import os
import numpy as np
import munch
import matplotlib.pyplot
import matplotlib
import json
import imgaug as ia
import imgaug as ia
import imgaug
import h5py
import glob
import gc
import ... |
96d518728d3cc94a2ab630e2d3c5e163ee202eb35bcfb9d5b1f3a5ef27d7a6ab | Python | 16,513 | 310 | import glob
import os.path as op
import importlib
import sys
import nibabel as nib
import numpy as np
from scipy.spatial.distance import pdist, cdist
from src.utils import utils
from src.utils import preproc_utils as pu
from src.utils import labels_utils as lu
from src.preproc import anatomy as anat
mmvt_code_fol = u... |
219458c3ab0e0f0c65f2efb821f2234650c4490900ac5041aee20e0b50532827 | Python | 16,555 | 480 | from collections import Counter
import pytest
import torch
from PIL import Image
from torch.utils.data import Dataset, DistributedSampler, SequentialSampler
from timm.data import FastCollateMixup, ScheduledBatchSampler, ScheduledTransformDataset, create_loader
class _ImageDataset(Dataset):
def __init__(self, le... |
75e62f4074b7a1692cf824c33639a9feb339e8c64f29c0469cbc11807e50471d | Python | 16,560 | 356 | """ Mixup and Cutmix
Papers:
mixup: Beyond Empirical Risk Minimization (https://arxiv.org/abs/1710.09412)
CutMix: Regularization Strategy to Train Strong Classifiers with Localizable Features (https://arxiv.org/abs/1905.04899)
Code Reference:
CutMix: https://github.com/clovaai/CutMix-PyTorch
Hacked together by / Co... |
5eed301dfb81c0ce1436fa2d928e456a46cb0964f093b9b68dd220672f991ba2 | Python | 16,626 | 708 | #!/usr/bin/env python
"""
Last update: 02/02/2016
author: jun ding
usage: python TarPmiR.py -a<miRNA> -b<mRNA> -m<model> -p <probability_cut>
"""
import pdb,sys,os,re,math,getopt
try:
from urllib2 import urlopen
except:
from urllib.request import urlopen
import urllib
import subprocess
import pickle
import uuid
i... |
96e9c790a9435e303bcefeba6aed4c381f93cd2c8f23c4ffa691f50741838247 | Python | 16,637 | 576 | # 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... |
7a76c450890ddf6bfd53bb9a754a7daf2b9f7554bf3763c689e32e69b1e4953b | Python | 16,640 | 428 | #!/usr/bin/env python
__author__ = "Marc Steffen Seibel and Thomas Jochmann"
__email__ = "seibelsteffen@web.de"
'''
Iterate through EEG data and apply Autoreject to find sections with high data quality
'''
import pandas as pd
import numpy as np
import os
os.environ['MNE_USE_NUMBA'] = 'false'
import mne
impor... |
e8927ee7fe801aca50b2eefbe59ae9f86c2ccf6c5edb442b805c3fb5a8ed3e6f | Python | 16,653 | 420 | # -*- 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... |
7d82464e8941c076fa3bc9f09a4633793fdeb52a25656039006dbf1505241eae | Python | 16,673 | 445 | import torch
from torch.autograd import Variable
import torch.nn.functional as F
from torch.utils import data
from torch.utils.data import SequentialSampler
from torch import nn
from tqdm import tqdm
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from time import time
from sklearn.metrics impo... |
3f3a4215a73b21f2aeb3d22b917db9440c9b8465553433ea1a601f8fadeeab07 | Python | 16,689 | 648 | import numpy
import numpy.testing
import pytest
import cellprofiler_core.image
import cellprofiler_core.measurement
from cellprofiler_core.constants.measurement import FF_CHILDREN_COUNT, FF_PARENT
import cellprofiler.modules.resizeobjects
import cellprofiler_core.object
instance = cellprofiler.modules.resizeobjects.... |
757bf51168c847f7b5b93094ed01e7a218d211b8fa23405e1166e5d75d3bb019 | Python | 16,724 | 372 | # The setup suppose to run *before* installing python libs, so only python vanilla can be used here
import os
import os.path as op
import shutil
import traceback
from src.utils import setup_utils as utils
import glob
TITLE = 'MMVT Lite Installation'
def copy_resources_files(overwrite=True, only_verbose=False):
... |
7b5d68c98d7f23205aed02a4663fecd890cc25fee7649b2e7acb47f3d9d5f90d | Python | 16,726 | 416 | import csv
import re
from scipy import ndimage
# CONSTANT WHERE TO FIND THE DATA
from config import ISLES2018_DIR
import os
from .dataset import Datasets, EuclideanDataset
import torch
import numpy as np
from lib.process.progress_bar import printProgressBar
from lib.utils.csv import csv_to_dict
import nibabel as nib
... |
bb532cb93c8426ad865479e5429e53106eeb976153a97ef8f52dd07a63987069 | Python | 16,732 | 510 | """
File name: models.py
Author: Esra Zihni
Date created: 21.05.2018
This file contains the Model metaclass object that is used for implementing
the given models. It contains a class object for each individual model type.
"""
import os
import pickle
from abc import ABCMeta, abstractmethod
from typing import Dict, Li... |
c2fb15007e8f042b4a4798e3bb5142873881abc57a6cad0a01f6dedd76e94e9e | Python | 16,734 | 429 | """ PyTorch implementation of DualPathNetworks
Based on original MXNet implementation https://github.com/cypw/DPNs with
many ideas from another PyTorch implementation https://github.com/oyam/pytorch-DPNs.
Papers:
* `Dual Path Networks` - https://arxiv.org/abs/1707.01629
This implementation is compatible with the pret... |
981a13f7fef9a7dfced1668609e6a0fd9ffda5a4dba4321b0d72afe342c510e5 | Python | 16,735 | 414 | import torch
from torch import nn
from torch.utils.data import Dataset
import torchvision.models as models
from torchsummary import summary
import os
import numpy as np
from sklearn import metrics
from tqdm import trange,tqdm ### for py file
import matplotlib.pyplot as plt
import utilities as UT
import p... |
8ab185071e028ec2ecab80341a50ecbcf42ab92da7927ae193142b21c49b588a | Python | 16,755 | 453 | """
TResNet: High Performance GPU-Dedicated Architecture
Papers:
* `TResNet: High Performance GPU-Dedicated Architecture` - https://arxiv.org/abs/2003.13630
* `ImageNet-21K Pretraining for the Masses` - https://arxiv.org/abs/2104.10972
Original model: https://github.com/mrT23/TResNet
"""
from collections imp... |
30d029b43ad890d02f3cb6b9a33aa69321ed2fbdf8ef36918aa35be5421465ed | Python | 16,821 | 331 | # TODO August 06 version
import torch
import itertools
import numpy as np
from util.image_pool import ImagePool
from .base_model import BaseModel
from . import networks
class AxialToLateralGANAthenaModel(BaseModel):
"""
This class implements the model for super-resolution for OT-LSM images from a badly calibr... |
9b9c8da4a73c0af0a7209fadb4d3fbfed28e768721aae3e8cbde66d182c77b2f | Python | 16,849 | 427 | """
This the spike_tools submodule provides functions to analyse the
Brian2 SpikeMonitors and Brian2 StateMonitors. The code provided here is
not optimized for performance and there is no guarantee for correctness.
Relevant book chapters:
- http://neuronaldynamics.epfl.ch/online/Ch19.S2.html#SS1.p6
"""
# This fil... |
14edcbbfb0bb4cc1b9a4f0a40e938f896b3dc9deff199f8632f0d46d5cdd3db8 | Python | 16,864 | 384 | # coding=utf-8
import itertools
import logging
from cellprofiler_core.constants.measurement import C_SERIES_NAME, C_C, C_SERIES, C_Z, C_T
from cellprofiler_core.pipeline import ImagePlane
from cellprofiler_core.constants.module import FILTER_RULES_BUTTONS_HELP
from cellprofiler_core.constants.modules.images import FIL... |
7bf2cb8338dff11042b10a4a60a785f8e96a26c53b37599102dbee2007afc81f | Python | 16,872 | 439 | # coding=utf-8
"""
Align
=====
**Align** aligns images relative to each other, for example, to correct
shifts in the optical path of a microscope in each channel of a
multi-channel set of images.
For two or more input images, this module determines the optimal
alignment among them. Aligning images is useful to obtai... |
c1fe5b1df1ff620705542b7d17c606560ddd9537cb2508f6d4855ab84ec73de7 | Python | 16,886 | 534 | #!/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 t... |
6b68eea890f42678cc57bcb1b950ede2f52eabab4ba19e10f2187cae209d26b8 | Python | 16,912 | 595 | import json
import os
import shutil
from pepars.utils import utils
from . import Library
from . import Alignment
from . import Template
from . import FASTQ_File
def load_database(new_path):
global path
global metadata
global library_db
global template_db
global alignment_db
global metadata_... |
f0f3841a9fece938eb01bc3fec2ee14f6889b05798b58af06c111be0acb6d895 | Python | 16,923 | 522 | import numpy
import cellprofiler_core.constants.measurement
import cellprofiler_core.image
import cellprofiler_core.measurement
import cellprofiler_core.module
import cellprofiler_core.module.image_segmentation._image_segmentation
import cellprofiler_core.module.image_segmentation._object_processing
import cellprofile... |
289b7a8104454b847dab67c584243e4bfa49ae0fdc32f7c04b8c390e0c99c548 | Python | 16,974 | 467 | # -- coding: utf-8 --
"""
pysteps.verification.salscores
==============================
The Spatial-Amplitude-Location (SAL) score by :cite:`WPHF2008`.
.. autosummary::
:toctree: ../generated/
sal
sal_structure
sal_amplitude
sal_location
"""
from math import sqrt, hypot
import numpy as np
from ... |
43caa331f4bfc4358a79694c0da35ccdb520962278c63717f3593e2985ea2776 | Python | 16,975 | 391 | """Model-agnostic LLM interface for the AFIDs guided learning mode.
Configure via environment variables:
LLM_API_KEY — API key. If unset, defaults to local Ollama (free, no key needed).
LLM_BASE_URL — Base URL of any OpenAI-compatible endpoint.
Defaults to Groq (https://api.groq.com/openai/v1)... |
d0f07bb0648b1d4ab617ab721d8ab17a9994d5e05c712c02cc1ac3ed099cdbcd | Python | 16,987 | 548 | import sys
import logging
import torch.nn as nn
import torch.nn.functional as F
from collections import OrderedDict
import numpy as np
from .modelBase import ModelBase
from GANDLF.utils import getBase2
class ResNet(ModelBase):
"""
A class to define the Resnet model architecture.
Args:
parameters... |
027a381925e5267978d3a5d090e1607eacaf9c8e37cd0dfd48bc4017a388b15b | Python | 16,992 | 435 | """Block segmentation: slice each packet into parallel martensite blocks.
A packet is sliced by planes normal to a random direction through its centre. Slice spacing is
either a single user-given mean thickness ('user' mode) or sampled per slice from a measured EBSD
block-thickness distribution ('file' mode), which re... |
054bb6641766010a6b5eca75a69a6f8011e401c175fb33e3478d391c1e4336e9 | Python | 17,023 | 443 | import math
from collections import namedtuple
from pathlib import Path
from typing import Optional, Tuple, Union
import numpy as np
import pytest
import xgboost as xgb
from xgboost import testing as tm
from xgboost.callback import _aggcv
from xgboost.testing.callbacks import (
run_eta_decay,
run_eta_decay_le... |
61997804f99a2d6ad1e56e98122db3a72348a297c027c1a204bdd0970f3cd60c | Python | 17,027 | 487 | #!/usr/bin/env python3
"""
A collection of utilities for the epitome pipeline. Mostly for getting
subject numbers/names, checking paths, gathering information, etc.
"""
import os
import sys
import copy
import datetime
import subprocess
import tempfile
import shutil
import logging
import math
import yaml
import ciftif... |
fec3b3919142758ec8361c4a6d60a37ad7f21d7ba0e4d706adee9d71b4bec123 | Python | 17,053 | 391 | import sys
import time
import numpy as np
import matplotlib.pyplot as plt
import random
import datetime
from scipy.ndimage import convolve
from tqdm import tqdm
from dragen.utilities.Helpers import HelperFunctions
from dragen.utilities.InputInfo import RveInfo
class DiscreteRsa3D(HelperFunctions):
def __init_... |
212aafaf453413649025de834d872c890d5e2815d5dca5367197179fb08e2611 | Python | 17,068 | 480 | import numpy as np
from scipy.signal import argrelextrema
from typing import Tuple, Optional, Iterable
VALID_CURVE = ["convex", "concave"]
VALID_DIRECTION = ["increasing", "decreasing"]
try:
import matplotlib.pyplot as plt
except ImportError:
_has_matplotlib = False
_matplotlib_not_found_err = ModuleNotFo... |
4185ea03127893540996b882f333441ec0c0e711b1b64acb11653cce67784da9 | Python | 17,076 | 339 | #### Master Script 4a: Train dynamic all-predictor-based models ####
#
# Shubhayu Bhattacharyay
# University of Cambridge
# email address: sb2406@cam.ac.uk
#
### Contents:
# I. Initialisation
# II. Create grid of training combinations
# III. Train APM_deep model based on provided hyperparameter row index
### I. Initia... |
17460d4151eb875e1bbb5ee68542a47f2f0aab0cacff88aa883c465f81668c2f | Python | 17,151 | 389 | import torch
from torchgan.losses import DiscriminatorLoss, GeneratorLoss
import torch.autograd as autograd
from betaVAE import betaVAE
from sklearn.preprocessing import StandardScaler
def reduce_vae(x, reduction=None):
r"""Applies reduction on a torch.Tensor.
Args:
x (torch.Tensor): The tensor on whic... |
3434e73bde806cdce13ad3d2f2e809f7b5d336e8c1c8c0afb22e61d10da116fb | Python | 17,171 | 493 | """
API for the image classification package
Date: September 2018
Author: Ignacio Heredia
Email: iheredia@ifca.unican.es
Github: ignacioheredia
Notes: Based on https://github.com/indigo-dc/plant-classification-theano/blob/package/plant_classification/api.py
Descriptions:
The API will use the model files inside ../mo... |
a249815d2e1960b12f339029fbaed18bffb171259fb3e55e7db20888cb275998 | Python | 17,192 | 488 | # -*- 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.