sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
5173d3e9f97f57249c0f6e99710fe777b814c9945cb6d268f5e4e342305f4618 | Python | 17,213 | 568 | import sys
import torch.nn as nn
import torch.nn.functional as F
from collections import OrderedDict
import math
import numpy as np
from .modelBase import ModelBase
class _MBConv1(nn.Sequential):
def __init__(
self,
num_in_feats,
num_out_feats,
kernel_size,
stride,
... |
534d7dce1a814f4ff0213ef2132d1e0146c426116d933f11c80140c030860ef2 | Python | 17,218 | 443 | 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, dotde... |
98c2ae55bc6b1968a4b5f2517b076a7b2ff8fa3fb322c24352e83db4c5a07cd6 | Python | 17,237 | 418 | import math
from typing import Any, Dict, List, Optional, Tuple, Union
import torch
from torch import Tensor
from torch.optim.optimizer import Optimizer
from ._helpers import _foreach_chunked, _foreach_lerp_, _load_state_dict_preserving_dtypes, _resolve_foreach
_LOW_PRECISION = (torch.float16, torch.bfloat16)
clas... |
34667d72cd78a1f604a4b617f0fcd6af812dbf6afeedf3b3cb735c38d4358140 | Python | 17,242 | 477 | import json
from pathlib import Path
import numpy as np
import pytest
import xgboost as xgb
from xgboost import testing as tm
from xgboost.core import Integer
from xgboost.testing.basic_models import run_custom_objective
from xgboost.testing.updater import get_basescore
class TestModels:
def test_glm(self):
... |
1c07679b72122d424400f62addbeb9042e6fb612f6229be889b7b00fab93de3c | Python | 17,306 | 333 | 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_slam_input_functions, get_slam_input_functions2
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpForm... |
7816318aa7fd3768188d88270152f54362b9693fe1706ce3e14d2c6d4eb24e24 | Python | 17,324 | 510 | from __future__ import print_function
# Unlike the rest of the PyTorch this file must be python2 compliant.
# This script outputs relevant system environment info
# Run it with `python collect_env.py`.
import datetime
import locale
import re
import subprocess
import sys
import os
from collections import namedtuple
t... |
4223b63d3bf85c991428692678cc300fb9f21ce102e2b8190f759f82ae1237da | Python | 17,327 | 354 | import torch
import itertools
import numpy as np
from .base_model import BaseModel
from . import networks
class AxialToLateralGANApolloModel(BaseModel):
"""
This class implements the model for super-resolution for simulations, CFM images, and semi-synthetic images from OT-LSM.
The model takes a 3D image c... |
e9bceefeb57630404ba36ee14fbe8c3aa9b8e50cb1dfc13f84a67515c7176214 | Python | 17,331 | 464 | pretrained = '../swin_large_patch4_window12_384_22k.pth'
conv_cfg = dict(type='ConvWS')
norm_cfg = dict(type='GN', num_groups=32, requires_grad=True)
dataset_type = 'CocoDataset'
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
train_pipeline = [
dict(type='LoadImag... |
b127bb86406819a41c22a56b85d04a2731759fcf7e26b8722933d10bc1ffb9b0 | Python | 17,333 | 471 | """
Resize
======
**Resize** resizes images (changes their resolution).
This module is compatible with 2D and 3D/volumetric images.
Images are resized (made smaller or larger) based on your input. You can
resize an image by applying a resizing factor or by specifying the
desired dimensions, in pixels. You can also ... |
8d7edc62de74fa61db518404d7a6c967be3f4cddde209e81446fe0d2b8753a5e | Python | 17,351 | 285 | import tensorflow as tf
import tensorflow.contrib.layers as li
from tensorflow.contrib.layers import xavier_initializer as xi
from ipdb import set_trace as st
dtype = tf.float32
d_form = 'channels_first'
d_form_ = 'NCHW'
ch_dim = 1
def C(x, ch_out, name,k=3,s=1, reg=None, use_bias=False):
return tf.layers.conv2d... |
ea4ba529a2c9dd5cde4500d6c77dd45020b3d6658c978629c5935d4029f452d2 | Python | 17,381 | 412 | import csv
import re
import numpy as np
from scipy import ndimage
from .dataset import Datasets, Dataset
# CONSTANT WHERE TO FIND THE DATA
from config import ISLES2018_DIR
import SimpleITK as sitk
import os
import pandas as pd
import os
from .dataset import Datasets, Dataset, GraphDataset
import torch
from torch_geom... |
01cfc7147125e6657b9dc4a1adcbe4f416ea94e357c562ff177e4c9252b32b7b | Python | 17,404 | 307 | """
Educational Use License
This software is provided solely for educational purposes.
Any use of this software for commercial or non-educational purposes is prohibited.
If you use this software in an academic setting, you must cite the following paper in any resulting publications or presentations:
[Sanaullah, Kor... |
d512eafb43967f06761a9f1afb7826cf5678399574be36c75e6e045d890781e5 | Python | 17,505 | 327 | # -*- coding: utf-8 -*-
"""
molvs.tautomer
~~~~~~~~~~~~~~
This module contains tools for enumerating tautomers and determining a canonical tautomer.
"""
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
import copy
import logging
from rdkit import Chem
fro... |
24ecd3b741fc011e03fca3f7cf75b7cc357811fd990467185b1de41a230ce4af | Python | 17,515 | 613 | import math
import matplotlib.pyplot as plt
import numpy as np
import pytest
from kneed.data_generator import DataGenerator as dg
from kneed.knee_locator import KneeLocator
from kneed.shape_detector import find_shape
@pytest.mark.parametrize("interp_method", ["interp1d", "polynomial"])
def test_figure2(interp_method)... |
c0a8a20b37f022e4541701be86507f740035c07a7f88d8882008ab82dccb8a85 | Python | 17,517 | 443 | #!/usr/bin/env python3
import os
import json
import sys
import requests as requests
import base64
import argparse
from random import randint
from time import sleep
# ADD THE PREFIX FOR EACH FILE TYPE BASED ON FIELD NAME WITHIN the TGen LIMS
fileTypes = {
"picard_alignment_summary_metrics": {
"prefix": "pi... |
face300e4e83c07f4b64aa81bbd1da6d8b436d3fe0a5479904d33c31af20241e | Python | 17,538 | 402 | from cellprofiler_core.constants.measurement import COLTYPE_FLOAT
from cellprofiler_core.module import Module
from cellprofiler_core.setting import Divider, Binary, ValidationError
from cellprofiler_core.setting.subscriber import LabelListSubscriber
import cellprofiler.gui.help.content
from cellprofiler_library.modul... |
5602a76323b4ace589317e6accab8a5223ec46ab4327ecd106559f53596cf03f | Python | 17,594 | 517 | import io
import numpy
import numpy.testing
import skimage.color
import skimage.segmentation
import cellprofiler_core.image
import cellprofiler_core.measurement
import cellprofiler_core.module
import cellprofiler.modules.overlayoutlines
import cellprofiler_core.object
import cellprofiler_core.pipeline
import cellprof... |
0cf32d100f57c62e42cd6675cdda9a4c5f021b35da612c97b56a338eba45aa0d | Python | 17,625 | 482 | import csv
import os
import warnings
from pathlib import Path
import numpy as np
import pytest
import scipy.sparse
from hypothesis import given, settings, strategies
from scipy.sparse import csr_matrix, rand
import xgboost as xgb
from xgboost import testing as tm
from xgboost.testing.data import IteratorForTest, np_d... |
0e14f1af7479b6632592ad884581de5f7eeddb0e682ede2c45a3a6eabb291ded | Python | 17,642 | 587 | # -*- coding: utf-8 -*-
import matplotlib as mpl
mpl.use('agg')
from matplotlib.testing.compare import compare_images
from tempfile import NamedTemporaryFile
import os
import shutil
import pygenometracks.plotTracks
from pygenometracks.utilities import InputError
ROOT = os.path.join(os.path.dirname(os.path.abspath(__fi... |
ccfa9051ad79bd8d5682cfa387f60e1b4fc840526e23184c9980dc5c7242713e | Python | 17,646 | 505 | """
pysteps.nowcasts.anvil
======================
Implementation of the autoregressive nowcasting using VIL (ANVIL) nowcasting
method developed in :cite:`PCLH2020`. Compared to S-PROG, the main improvements
are using an autoregressive integrated (ARI) model and the option to use
vertically integrated liquid (VIL) as t... |
ee5380ed74640ab77ddf0816f3896aa99996089ce8f8f87f9a8ded0f445232d4 | Python | 17,684 | 555 | # -*- coding: utf-8 -*-
"""
pysteps.visualization.precipfields
==================================
Methods for plotting precipitation fields.
.. autosummary::
:toctree: ../generated/
plot_precip_field
get_colormap
"""
import copy
import warnings
import matplotlib.pylab as plt
import numpy as np
from mat... |
0f602af3a1c3bc9aba5f73d9140b0ccfe587356047fbc51a3f0b00ea554c7d40 | Python | 17,724 | 466 | # 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... |
15773543c79c476f862ad9b2474a8a2f65cf3859642341e5f1885ba5e6295dae | Python | 17,732 | 427 | import pandas as pd
import numpy as np
import scipy
import os
import scanpy as sc
from tqdm import tqdm
# from skimage.metrics import structural_similarity as ssim
# import pickle
from math import floor
import json
from sklearn.metrics import confusion_matrix
from sklearn.metrics import classification_report
# from sea... |
8a7fd450b285350eb9d7380e1177b5b63d878720a610f424090c2f1663ed0196 | Python | 17,743 | 367 | import faulthandler
faulthandler.enable()
import argparse
from collections import defaultdict
from functools import partial
import numpy as np
import os
import sklearn.metrics as sk_metrics
import time
import torch
import torch.nn as nn
import torch_geometric
import tqdm
from atom3d.datasets import LMDBDataset
from a... |
1163bcefe4e4aedc3e905807426abb079f29b948c6edc1d9dacb304faffb1b12 | Python | 17,766 | 539 | """
UnmixColors
===========
**UnmixColors** creates separate images per dye stain for
histologically stained images.
This module creates separate grayscale images from a color image stained
with light-absorbing dyes. Dyes are assumed to absorb an amount of light
in the red, green and blue channels that increases prop... |
e499b9ae5801095edfb62a7e1d3df96f37da06401e9b71708c32a346ee77d742 | Python | 17,771 | 467 | import numpy
import pytest
import cellprofiler.modules.combineobjects
import cellprofiler_core.image
import cellprofiler_core.measurement
import cellprofiler_core.object
import cellprofiler_core.pipeline
import cellprofiler_core.workspace
@pytest.fixture
def image():
data = numpy.zeros((10, 10))
return cel... |
609578a4f29c8012439709319812f81acb88ebdaa31441b6553785a08c9e2681 | Python | 17,781 | 540 | import pytest
import numpy
import skimage.io as io
import tifffile
from cellprofiler_core.reader import fill_readers, filter_active_readers
from cellprofiler_core.constants.reader import ALL_READERS, AVAILABLE_READERS
from cellprofiler_core.image import MonochromeImage
from cellprofiler_core.utilities.pathname import p... |
a9a53499714783a286e74494d1809aa46b80925fe8debf35f5e2738c3f62202d | Python | 17,790 | 480 | """ Pytorch Inception-Resnet-V2 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`... |
e48febe851b86fe9e19a5b198077035c4523d2131a100b7a322e7edaf0455924 | Python | 17,790 | 391 | """
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 os
import gemmi
import numpy
import pandas
from serva... |
3a524f61f799f929167dface3000fa46225a5ef009da0b51bda53a23fe262f1c | Python | 17,796 | 246 |
from pathlib import Path
import numpy as np
import eelbrain
from matplotlib import pyplot
import re
import os
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from cycler import cycler
from matplotlib.ticker import MaxNLocator
Results_path = '/project/3027007.02/Scripts_for_publication/New_r... |
0b439ff39cde5ffea837216566b7c57038b7c0822761d63de5e5cc362b02b6ac | Python | 17,845 | 524 | import pytest
import torch
import torch.nn as nn
import timm.layers.fast_norm as fast_norm
from timm.layers import (
Attention2d,
AttentionPool2d,
BatchNormAct2d,
ClassifierHead,
ClNormMlpClassifierHead,
HybridEmbed,
MultiQueryAttentionV2,
NormMlpClassifierHead,
PatchEmbed,
Patc... |
1d39498edd9c45a0c7eb57ae66611f882adaa50dfe872d26715dd51f74d31271 | Python | 17,847 | 665 | # -*- coding: utf-8 -*-
import matplotlib as mpl
mpl.use('agg')
from matplotlib.testing.compare import compare_images
from tempfile import NamedTemporaryFile
import os.path
import pygenometracks.plotTracks
ROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)),
"test_data")
tracks = """
[t... |
d277beedfcea15732e0c6b9f024953e902eb3d42881705bc85d08c0adefb01d1 | Python | 17,848 | 522 | from __future__ import annotations
import bz2
import copy
import gzip
import hashlib
import importlib.util
import sys
import threading
from collections.abc import Callable, Iterator
from dataclasses import dataclass, field
from datetime import date
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
fr... |
40c961ff78e580962ca44a50d3e7ccc2ce5e0ce262e07ce53fd1f42a98381cb2 | Python | 17,874 | 334 | import pickle # nosec B403
import pytest
from click.testing import CliRunner
from GANDLF.entrypoints.deploy import new_way, old_way
from . import CliCase, run_test_case, TmpDire, TmpFile, TmpNoEx
# This function is a place where a real logic is executed.
# For tests, we replace it with mock up, and check... |
5eb8402630466bfa80ee0c646020142bf0b78b1c1901dca7c694720191c65763 | Python | 17,878 | 439 | # Model of neuronal network derived from hiPSCs on MEA
# Using a HH-type model including an after-hyperpolarization current and membrane noise.
# Connected into a network with N neurons, with choice of topology.
# Connected via AMPAr and NMDAr mediated synapses, subjected to short-term plasticity.
# Choice of distribut... |
82772da93a16a42636a01dca50b418a1e4a7d7643b7febe7fa48d8e640f7b426 | Python | 17,916 | 435 | """A view: which analyses, which foci, and the execution context.
A view is ``(store, analysis index, point mask, context)`` and nothing else.
Narrowing is index arithmetic, so it never touches the data columns.
Two selection levels rather than one, because they are both real: estimators
select *analyses*, while :cla... |
5dea520fa03bdbe641d8766b61a4c5ddb6ac1de0e1d8db29439750480cc90784 | Python | 17,988 | 503 | 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... |
c9a3bcf05ab7b14b4334786ccf762c10c03b6b55ef21ea5f40e446c9c167b8ed | Python | 18,026 | 426 | """
EnhanceOrSuppressFeatures
=========================
**EnhanceOrSuppressFeatures** enhances or suppresses certain image
features (such as speckles, ring shapes, and neurites), which can
improve subsequent identification of objects.
This module enhances or suppresses the intensity of certain pixels
relative to the ... |
798d9c22fa98748b606c073f77d3285738c2faba1a58f15c8581f9997edcc71c | Python | 18,042 | 519 | # coding=utf-8
# Copyright 2020 The SimCLR Authors.
#
# 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 or... |
669eb6d59ee96d3175a60d7988701bfefe7facc7b8f2453d1563b76fad80eb16 | Python | 18,059 | 370 | from typing import Tuple, Optional, Annotated, Dict, Any, Union, List
import numpy
import centriole
import centriole.cpmorphology
from pydantic import validate_call, ConfigDict, Field, BaseModel
from cellprofiler_library.types import ObjectLabelsDense
from cellprofiler_library.measurements.measurement_model import Libr... |
5f82fe8ad31a3281806f6834b6f5da4d4e4ed2baf63be985e0792635af7fe8b8 | Python | 18,110 | 488 | import sys
import os
import gzip
import numpy as np
from tqdm import tqdm
from intervaltree import IntervalTree, Interval
import pybedtools
import tempfile
import warnings
import logging
from matplotlib.ticker import Formatter
import math
FORMAT = "[%(levelname)s:%(filename)s:%(lineno)s - %(funcName)20s()] %(message)... |
00c75cbe657c4c87bda64f5b5d6283ebafad34d9e56503e8dd6b228ce08d9e7f | Python | 18,111 | 426 | #!/usr/bin/env python3
"""
Takes a cifti map ('dscalar.nii') and outputs a csv of results
Usage:
ciftify_peaktable [options] <func.dscalar.nii>
Arguments:
<func.dscalar.nii> Input map.
Options:
--min-threshold MIN the largest value [default: -2.85] to consider for being a minimum
--max-threshol... |
e0217a0b6a2e07fe4df63d8f460cb712451d605a1214cc33bacdc98488925aae | Python | 18,114 | 552 | import ast
import numpy as np
#################################
#
# MODEL GENERATOR
#
#################################
class NetworkGenerator(object):
def __init__(
self,
name='_tmp_model_',
fname='_tmp_model_.py',
conv_layers=None,
fc_layers=None):... |
891b97f9865a0e6c23415267b8e74ff74237745b46082e291178ce677a046d74 | Python | 18,161 | 512 | """Compare the native backend with the independent pre-migration Python code."""
from __future__ import annotations
import bz2
import csv
import gzip
import hashlib
import importlib.machinery
import io
import json
import os
import subprocess
import sys
from collections.abc import Callable, Mapping
from pathlib import... |
2307cb605fba793e005b97d6b45ef3fa24521dc5cc8c83232707ed06853c5896 | Python | 18,171 | 647 | """
Hacked together from https://github.com/lucidrains
"""
import math
from functools import wraps
from math import ceil, pi
from typing import Optional
import dgl.function as fn
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from einops import rearrange, reduce
from torch impor... |
cff21513056d64083e3e2c73569c93b086d5795cfc447e72a70f3e31d02d38c5 | Python | 18,180 | 464 | import unittest
import os.path as osp
import pytest
import xarray as xr
import numpy as np
from numpy.testing import assert_array_equal, assert_array_almost_equal
from ptsa.data import timeseries
from ptsa.data.filters import (
BaseFilter, ButterworthFilter, DataChopper, MonopolarToBipolarMapper,
MorletWavele... |
0676d182abe6fca0accb13a005a83796f031f0433f04fa9e37c5825eca64ac7f | Python | 18,194 | 318 | import pickle
import numpy as np
from torch import as_tensor as as_torch_tensor, float as torch_float
from collections import OrderedDict
from torch.utils.data import Dataset
from scipy.sparse import csr_matrix
from frozendict import frozendict
from HiSiNet.reference_dictionaries import reference_genomes
from skimage.t... |
8c73c77f018b6f13267ee97c90fa24b978597bb11f97f7b3910b2490d44e59fc | Python | 18,220 | 519 | # coding=utf-8
# Copyright 2020 The SimCLR Authors.
#
# 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 or... |
f271fd52761b765b7f7fe21297c14d0d1ca12de5252d2727056e02b9bb8e4552 | Python | 18,225 | 469 | # -*- coding: utf-8 -*-
"""
pysteps.tracking.tdating
========================
Thunderstorm Detection and Tracking (DATing) module
This module was implemented following the procedures used in the TRT Thunderstorms
Radar Tracking algorithm (:cite:`TRT2004`) used operationally at MeteoSwiss.
Full documentation is publish... |
50b2c8afb0bb33dcc68594f3af53b253edcd7c28cd3e55b9fc5c0e2aa1108c82 | Python | 18,239 | 492 | import numpy
from cellprofiler_core.constants.measurement import (
FF_PARENT,
FF_CHILDREN_COUNT,
IMAGE,
COLTYPE_INTEGER,
R_PARENT,
)
from cellprofiler_core.module import Module
from cellprofiler_core.object import Objects
from cellprofiler_core.setting import Binary
from cellprofiler_core.setting.su... |
e195ca9a04e1e5de420f5473a45ec90c18615ec9aa9e3b9db38bf36bde2f4671 | Python | 18,259 | 515 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import math
from functools import partial
import numpy as np
def normal_wrapper(normal_method, in_ch, in_ch_div=2):
if normal_method == "bn":
return nn.BatchNorm3d(in_ch)
elif normal_method == "bnt":... |
877fe4f311116f45a68a991ffc95db7ef0527774b7d22e7f882bdf71eb75c460 | Python | 18,300 | 421 | # -*- coding: utf-8 -*-
#
import os
import time
from src.utils.io import create_dir
os.environ['DGLBACKEND'] = 'pytorch'
from datetime import datetime as dt
from src.utils.train_utils import *
from src.utils.args import *
from src.utils.ot_utils import *
from src.utils.eval import Meter_Unbound_Bound
from src.utils.e... |
ff6001f9ca8157b5380d0196f79c1e6b8b2fdc45a3da188f5e1ff1b6df86d16e | Python | 18,325 | 317 | import pickle
import numpy as np
from torch import as_tensor as as_torch_tensor, float as torch_float
from collections import OrderedDict
from torch.utils.data import Dataset
from scipy.sparse import csr_matrix
from frozendict import frozendict
from HiSiNet.reference_dictionaries import reference_genomes
from skimage.t... |
28e85db422c1d6dae45ade4af2c0b9546945c4a017583df7b7963cffcecaa4b2 | Python | 18,338 | 298 | # Pytorch Tabular
# Author: Manu Joseph <manujoseph@gmail.com>
# For license information, see LICENSE.TXT
"""Mixture Density Head Config"""
from dataclasses import dataclass, field
from typing import List, Optional
from src.models.tabular.pytorch_tabular.repository.models.autoint import AutoIntConfig
from src.models.t... |
7220822433be464c71718a36f1cd7f126dc637e9dce7cde708ef8e45b31b3cbf | Python | 18,340 | 390 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 2 09:58:18 2018
@author: saskiad
with paw_plot code from davidf and savefig from dougo
"""
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.patches as mpatch
from matplotlib.collections import PatchCollection
import matplotlib... |
37f3bd7e5fc480e7bbfc9313f2705b95ab25039aaca956409b2f87ae0070a61e | Python | 18,342 | 539 | # 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... |
c42d9991611ff0cbb8f0559d00772f699bc4e20bcee57d8368ee42d3d7a4b8a6 | Python | 18,457 | 410 | import argparse
import pickle
from pathlib import Path
import time
import re
from multiprocessing import Pool, TimeoutError
from functools import partial
from tqdm import tqdm
import logging
import pandas as pd
import numpy as np
from pyxtal.structure import Xstruct
from pyxtal.crystal import random_crystal, Lattice
... |
a38d0f5a6f06ecba317e1f6befc4a31f38581249db580e8a88d28688d307992c | Python | 18,463 | 354 | """
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... |
80ef2d1eff5548119de52c800c4d29b43ad9b406c0353fc0e95e0450747c6932 | Python | 18,472 | 576 | from abc import ABCMeta
from shutil import copyfile
import nibabel as nib
from numpy import (absolute,
array,
cbrt,
einsum,
float32,
indices,
isclose,
moveaxis,
prod,
... |
4d345f525273ae94464aff1cfc0cd89c941e2c68b611822eabea434726baeb0c | Python | 18,504 | 448 |
#####################
# https://github.com/deepmind/surface-distance
#######################
# Copyright 2018 Google Inc. All Rights Reserved.
#
# 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 a... |
2637318d13b0ec9fb9af8c5bd1589dd2ea30cefe96b19a9d0bde4612bf22ae56 | Python | 18,523 | 504 | """PyTorch SelecSLS Net example for ImageNet Classification
License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/legalcode)
Author: Dushyant Mehta (@mehtadushy)
SelecSLS (core) Network Architecture as proposed in "XNect: Real-time Multi-person 3D
Human Pose Estimation with a Single RGB Camera, Mehta et al."... |
475b561c4c10657217dc41ed7d02cf3ec28c1a577f3b2f72313b10badcf06bca | Python | 18,531 | 461 | 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, dotde... |
4aa3a7fde401d27d2404f003182228c094cd1bf1f2480e12b2f7ddc1ac71db4a | Python | 18,532 | 437 | import shutil
import keras
import numpy as np
import torch
from torch import optim, sigmoid
import torch.nn as nn
import os
import re
import matplotlib.pyplot as plt
from torch_geometric.data import Data
from lib.utils import savefigs, get_npy_files, upload_training
from .losses import check_label_not_unique, calcula... |
6f7c0b269a635e614c6c900e773b40bb8be39735a3df670a95a1f6fa4bec3357 | Python | 18,563 | 399 | import os
import copy
import random
import argparse
import torch
import numpy as np
import torch.nn.functional as F
from configs import config_from_file
from datasets import build_datasets, build_dataloader
from models import build_models
from scipy.stats import pearsonr
from utils.evaluation.nc_measure import (genera... |
d19f37174a3fde2efab30488d6022296ef112c2215d2ce9d405adf2821c5e4a0 | Python | 18,576 | 406 | # -*- coding: utf-8 -*-
import torch
import torch.nn as nn
import utils
from numpy import prod
import numpy as np
from torch.distributions.beta import Beta
spike_args = {}
class NetworkBuilder(nn.Module):
def __init__(self, topology, input_size, input_channels, label_features, train_batch_size, dro... |
568ac7c086d3ea3af8e60a49b80335fb5f9308fe64f929285e923f579ecbf75b | Python | 18,587 | 404 | import numpy as np
import nengo
from . import PathIntegration, AssociativeMemory, CircularConvolution, Product
class SLAMViewNetwork(nengo.network.Network):
r""" Nengo network that performs simultaneous localization and mapping (SLAM)
Parameters
----------
ssp_space : SSPSpace
S... |
a18b201d88282a37654f38057e4757155068a5466ee2f2324b2d35f4bb522de6 | Python | 18,595 | 487 | import math
from math import ceil
import warnings
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.modules.activation import MultiheadAttention
from asteroid.masknn import activations, norms
from asteroid.utils import has_arg
from asteroid.dsp.overlap_add import DualPathProcessing
cl... |
ce216f9eda9545038dd7b204eef639eccb67dee8ea7489c89b834b70be6e6ebc | Python | 18,680 | 330 | import numpy
import pytest
import six.moves
import cellprofiler_core.image
import cellprofiler_core.measurement
import cellprofiler.modules.colortogray
import cellprofiler_core.modules.injectimage
import cellprofiler_core.object
import cellprofiler_core.pipeline
import cellprofiler_core.workspace
import tests.fronte... |
01fc2a566e095a11e168173276ffa70eb48e60de014caf8c89e74e7820e81155 | Python | 18,698 | 557 | """Verified content-addressed cache publication and object leases."""
from __future__ import annotations
import hashlib
import http.client
import os
import re
import tempfile
import urllib.error
import urllib.request
import zlib
from collections.abc import Callable, Iterator, Sequence
from contextlib import contextma... |
56e59963af0c5751fd8861217a459777c878db07dd6f094980dba47a5c136384 | Python | 18,705 | 414 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 2 10:38:25 2018
@author: saskiad
with save_figure code from dougo
"""
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import core
area_dict = {}
area_dict['VISp']='V1'
area_dict['VISl']='LM'
area_dict['VISal']='AL'
area_di... |
f0a2b2939c27de295365539c6e0d6f1be5fbdd2d6a37b8302acd75e9066bf1c9 | Python | 18,713 | 315 | import os
from PIL import Image
import numpy as np
def load_images(fig_dir, seed, tag, metric_tag, iter_tag, config_names):
images = []
for config_name in config_names:
fig_path = os.path.join(fig_dir, config_name, tag)
fig_name = seed + '_' + tag + f'{metric_tag}{iter_tag}.png'
fig_... |
3d836813b12e009dd7a1267a69ebcdad7c1fd5bcbe3840c4e3cabdafcf9973df | Python | 18,718 | 380 | """
ClinicalASL - Clinical Arterial Spin Labeling processing pipeline
DICOM saving utility module (MONOCHROME2 - quantitative grayscale output).
Repository: https://github.com/JSIERO/ClinicalASL
Author: Jeroen Siero
Institution: UMCU (University Medical Center Utrecht), The Netherlands
Contact: j.c.w.siero@umcutrech... |
21a02531445b34cebc318993f3eedccffce9fc780c3d3096ed5f84ffd5fe04bc | Python | 18,720 | 429 | #!/usr/bin/env python3
"""
Takes a cifti map ('dscalar.nii') and outputs a csv of results
Usage:
ciftify_statclust_report [options] <func.dscalar.nii>
Arguments:
<func.dscalar.nii> Input map.
Options:
--min-threshold MIN the largest value [default: -2.85] to consider for being a minimum
--max-t... |
cdd9b10998d0ae8c318435ec6959b4909853b1414ebade9562e28276063d776e | Python | 18,734 | 554 | import sys, os
from typing import List, Optional, Tuple
from pathlib import Path
import numpy as np
import skimage.io
# from skimage.filters.rank import maximum
from skimage.filters import gaussian
# from skimage.morphology.footprints import disk
from skimage.morphology import remove_small_holes
from skimage.color.co... |
034310fb52d72ae8ca5404f7b6db57f308c57df1d6c83cb1afbb219bf8613aa6 | Python | 18,741 | 519 | """VGG
Adapted from https://github.com/pytorch/vision 'vgg.py' (BSD-3-Clause) with a few changes for
timm functionality.
Papers:
* `Very Deep Convolutional Networks for Large-Scale Image Recognition` - https://arxiv.org/abs/1409.1556
Copyright 2021 Ross Wightman
"""
from typing import Any, Dict, List, Optional, Tupl... |
ab18999b3853e9141412aea1e449b86377f6ecc6b0fc8a34801b0ccf623f2428 | Python | 18,750 | 551 | import math
from functools import partial
from collections import Iterator, Iterable
from typing import Any, cast, Callable, List, Optional
import torch
import torch.nn.functional as F
from torch import nn, Tensor
from torchvision.ops import MLP, Permute
from torchvision.ops.stochastic_depth import StochasticDepth
#... |
b46c9e79c36d1fecaef5cea7fa68021e07d030e012cd3c9bd107972276191ee6 | Python | 18,772 | 498 | import os
import random
import pickle
import numpy as np
from torch.utils.data import Dataset
from torchvision.io import read_image
import pandas as pd
from PIL import Image
import torch
from tqdm import tqdm
from sklearn.preprocessing import StandardScaler, MinMaxScaler
import lmdb
import lz4framed
import cv2
from t... |
6844a68c57dd829d097e485a397a7154235d3377f3ce592c64942f03f11f302b | Python | 18,789 | 472 | """ PyTorch Lamb optimizer w/ behaviour similar to NVIDIA FusedLamb
This optimizer code was adapted from the following (starting with latest)
* https://github.com/HabanaAI/Model-References/blob/2b435114fe8e31f159b1d3063b8280ae37af7423/PyTorch/nlp/bert/pretraining/lamb.py
* https://github.com/NVIDIA/DeepLearningExample... |
61b97f193862b48f8e4c61430dd15704794b44d68ae8284f12f8bfbcb420ebbe | Python | 18,806 | 441 | __author__ = 'tylin'
__version__ = '2.0'
# Interface for accessing the Microsoft COCO dataset.
# Microsoft COCO is a large image dataset designed for object detection,
# segmentation, and caption generation. pycocotools is a Python API that
# assists in loading, parsing and visualizing the annotations in COCO.
# Pleas... |
886dfdd35c24eef7da90a8a1c86f063d64051a111bdb7e49b1bf5f7719f144ea | Python | 18,880 | 500 | """
Relief Visualization Toolbox – Visualization Functions
Contains core functions for blending.
Credits:
Žiga Kokalj (ziga.kokalj@zrc-sazu.si)
Krištof Oštir (kristof.ostir@fgg.uni-lj.si)
Klemen Zakšek
Peter Pehani
Klemen Čotar
Maja Somrak
Žiga Maroh
Nejc Čož
Copyright:
2010-2020 ... |
e69cb5e0a34ef9d8a1c16ecdd0365b108a79017c9d5c490685a249e02d617f78 | Python | 18,881 | 441 | import logging
import numpy
from cellprofiler_core.constants.measurement import COLTYPE_FLOAT
from cellprofiler_core.module import Module
from cellprofiler_core.setting import Divider, Binary, ValidationError
from cellprofiler_core.setting.subscriber import (
ImageListSubscriber,
LabelListSubscriber,
)
from cel... |
4d494fd22d2e3ac754c5d68957f43d3c74070046e85a4800685d4ec8ef43dcde | Python | 18,906 | 424 | from functools import partial
from collections.abc import Callable
from typing import Any, Tuple, Optional, Annotated, Union, cast
from typing_extensions import TypeAlias
from numpy.typing import NDArray
from pydantic import validate_call, ConfigDict, Field, BaseModel
import numpy as np
from cellprofiler_library.types ... |
4161789160416427f044cf2dfd8f110f0b81cd34dbd97ba9ce97e28f4a857533 | Python | 18,907 | 583 | from copy import copy
from tempfile import mkdtemp
from functools import partial
import os.path as osp
from tempfile import mkdtemp
import shutil
import sys
import warnings
import h5py
import numpy as np
from numpy.testing import assert_equal, assert_allclose
import pytest
import xarray as xr
import pandas as pd
from... |
688dd484686ea6b2129ef453a71f88ab7eb82e3a8d2ea07be3a202d72987c167 | Python | 18,908 | 367 | """
Author: "Keitaro Yamashita, Garib N. Murshudov"
MRC Laboratory of Molecular Biology
This software is released under the
Mozilla Public License, version 2.0; see LICENSE.
"""
from __future__ import absolute_import, division, print_function, generators
import gemmi
import numpy
import pandas
import os
import shu... |
6a94b3f53389495bb94746ef8b7155c024c97d2465b03589f729e1f70762f78f | Python | 18,934 | 525 | import matplotlib.cm
import numpy
import scipy.ndimage
from cellprofiler_core.constants.measurement import (
COLTYPE_INTEGER,
FF_PARENT,
FF_CHILDREN_COUNT,
)
from cellprofiler_core.module import Identify
from cellprofiler_core.object import Objects
from cellprofiler_core.preferences import get_primary_outli... |
9759bcf8681623031652ec7c467c60410218ea51bc15f9a039b9b245c85af2d4 | Python | 18,941 | 410 | """
RunImageJMacro
==============
**RunImageJMacro** exports image(s), executes an ImageJ macro on them and
then loads resulting image(s) back into CellProfiler.
To operate, this module requires that the user has installed ImageJ (or FIJI)
elsewhere on their system. It can be downloaded `here`_.
You should point the... |
b47c975e299b684ed1fa9a266d678d0de10b26ea26edf84628b4c4c5eb246f95 | Python | 18,943 | 465 | """ NAdamW Optimizer
Based on simplified algorithm in https://github.com/mlcommons/algorithmic-efficiency/tree/main/baselines/nadamw
Added multi-tensor (foreach) path.
References for added functionality:
Cautious Optimizers: https://arxiv.org/abs/2411.16085
Why Gradients Rapidly Increase Near the End of Trai... |
44bd25c573719121f47f871144f54309ebd5ee52d24444630d9339d72c52beac | Python | 18,953 | 456 | """ Model Registry
Hacked together by / Copyright 2020 Ross Wightman
"""
import fnmatch
import re
import sys
import warnings
from collections import defaultdict, deque
from copy import deepcopy
from dataclasses import replace
from typing import Any, Callable, Dict, Iterable, List, Optional, Set, Union, Tuple
from ._p... |
ed9e5e38f61a817d198ec256970c91ea361c719590a9497548e0fdec5064a19e | Python | 18,957 | 468 | import dill as pickle
import matplotlib.pyplot as plt
import numpy as np
from scipy.stats import kstest
from models.srm import SRM
from .iclamp import IClamp
from .kernels import KernelFun
from .spiketrain import SpikeTrain
class Fitter:
def __init__(self, ic=None, model=None, neuron=None, filename=None, spike_... |
94cabedc1c60f9b02de835713d8acac838628d234fdb32154b6465c2e944df35 | Python | 18,989 | 530 | """
FlipAndRotate
=============
**FlipAndRotate** flips (mirror image) and/or rotates an image
|
============ ============ ===============
Supports 2D? Supports 3D? Respects masks?
============ ============ ===============
YES NO NO
============ ============ ===============
Measurements made by t... |
fb46597ba41966c5bcaf8a37e386881cca7a10e02340c7a75111c6411cce14d0 | Python | 19,035 | 369 | """ Dataset reader that wraps TFDS datasets
Wraps many (most?) TFDS image-classification datasets
from https://github.com/tensorflow/datasets
https://www.tensorflow.org/datasets/catalog/overview#image_classification
Hacked together by / Copyright 2020 Ross Wightman
"""
import math
import os
import sys
from typing imp... |
c1f7bb8d99f0f8b827bfcb6c6322b7384ddae83e45e4f2ae3ed16020db407b36 | Python | 19,077 | 419 | import sys
import numpy as np
import torch
import torch.autograd as autograd
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from .alphabet import Alphabet
from .functions import *
import pickle
from .gazetteer import Gazetteer
import re
import random
START = "</s>"
UNKNOWN = "</unk>... |
0ecfb982ad7b8bf31e4e1c236f34ffb060df27395663ca262f9eddcd88f6e9fc | Python | 19,159 | 568 | """
A Neural Network framework to be used in the fitting/learning process.
Created by © Rodrigo Carvalho 2019
Mainteined by © Rodrigo Carvalho
"""
import numpy as np
import os
class NN:
"""
A Neural Network implementation to solve regression and classification problems.
"""
def __init__(self):
... |
277d7eeacf213e8da9377fb8aa0acb4bb4cfbc91398fa6d93262297aa87a9898 | Python | 19,160 | 508 | import torch
import torch.nn as nn
from torch import Tensor
from torchvision.models.inception import inception_v3
import torch.nn.functional as F
import warnings
from collections import namedtuple
from functools import partial
from typing import Any, Callable, List, Optional, Tuple
INCEPTION_DICT = {
'inception_v3... |
74192795e4fd2149b25f21514683226eb379c1ec401dcbbb2abea61cc6f9fd69 | Python | 19,233 | 524 | # mypy: allow-untyped-decorators
# mypy: allow-untyped-defs
from typing import cast, List, Optional, Tuple, Union
import torch
from torch import Tensor
from torch.optim.optimizer import (
_capturable_doc,
_default_to_fused_or_foreach,
_device_dtype_check_for_fused,
_differentiable_doc,
_disable_dy... |
944f9964acaf427e0271557219f1c460a4b3e153c004a0342291817c411dfd15 | Python | 19,253 | 416 | #!/usr/bin/env python3
"""PyTorch Inference Script
An example inference script that outputs top-k class ids for images in a folder into a csv.
Hacked together by / Copyright 2020 Ross Wightman (https://github.com/rwightman)
"""
import argparse
import json
import logging
import os
import time
from contextlib import su... |
1817c59698717b09ec89317551b47eb75162498d2e0b84c412141b8375a8909c | Python | 19,272 | 399 | from argparse import ArgumentParser
from typing import Tuple
import pytorch_lightning as pl
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import Tensor
from models.histaugan import networks
# from .networks import Discriminator
class HistAuGAN(pl.LightningModule):
def __init__(s... |
0cd21eee7c26df46492a4cde97e6bf7cf68a6538aeb8be2f48a26066b8bd8edd | Python | 19,304 | 461 | """ Hybrid Vision Transformer (ViT) in PyTorch
A PyTorch implement of the Hybrid Vision Transformers as described in:
* `An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale` - https://arxiv.org/abs/2010.11929
* `How to train your ViT? Data, Augmentation, and Regularization in Vision Transformers... |
2605728529c0f418b02380ce213fc500fa84b2a26265c493fa015669748e51c8 | Python | 19,323 | 499 | """ Dataset reader for webdataset
Hacked together by / Copyright 2022 Ross Wightman
"""
import io
import json
import logging
import math
import os
import random
import sys
from dataclasses import dataclass
from functools import partial
from itertools import islice
from typing import Any, Callable, Dict, List, Optional... |
c2272270ce7c50d5ef8e8aa3327e79f1b001c432a09f16af5fee7ec9270d5001 | Python | 19,357 | 607 | """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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.