sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
37ddc24920dee6d4a19339fe26ef2644e0906653042687a7aace2e992fda7bc1
Python
21,899
558
"""CSPNeXt (RTMDet / OpenMMLab) CSPNeXt backbone from RTMDet (OpenMMLab), ImageNet-1k classification models. Papers: * `RTMDet: An Empirical Study of Designing Real-Time Object Detectors` - https://arxiv.org/abs/2212.07784 The paper describes this backbone (CSP blocks with 5x5 depthwise convs) without naming...
e988ae1438d08a13980ff7d8dd7ee3b819a25a2235b262a6dcc7698e4c4afa94
Python
21,942
451
import numpy as np import pandas as pd import matplotlib.pyplot as plt import re import os import warnings from matplotlib.ticker import FormatStrFormatter from activation_utils import compute_mean_digit_separations_domainIL, compute_mean_digit_separation_classIL, get_distances def preprocess_performance_data(results,...
580583f42b6d85e4ddc2368f5a13f523ae2025d19eedbcff9b37413e0dd7637c
Python
21,956
568
"""Base classes for PTSA readers.""" from __future__ import annotations import sys import os from os.path import join import re import json import unicodedata from collections import defaultdict import warnings from abc import abstractmethod from typing import Any, Dict, List, Optional, Sequence, Tuple, Union, cast ...
be9b7613d1fef4449bb059eb2645a6ffb21fba72eb61bde3a5367b8a381d7d99
Python
22,009
441
# Fundamental libraries import os import sys import time import glob import copy 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...
3ee1977e11953ae299621691a72d3c95e132b98bc4eae3cd9d5697fac0e4b36c
Python
22,017
692
import io import os.path import h5py import numpy import numpy.random import numpy.testing import pytest import skimage.data import skimage.util import cellprofiler_core.image import cellprofiler.modules.saveimages import cellprofiler_core.pipeline import cellprofiler_core.setting import cellprofiler_core.preferences...
945743224ded3de55a1a2976866c1ab0e19b30adb9427acff9e1bd131fd5d51f
Python
22,047
699
"""Plot figures for report.""" import matplotlib as mpl import matplotlib.colors as mcolors import matplotlib.patches as mpatches import matplotlib.pyplot as plt import numpy as np import pandas as pd import plotly.express as px from nilearn import datasets from nilearn.plotting import ( plot_glass_brain, plot...
36e387c20f5e95e88a7d1d4234c12d741127a406ed04f910808f82122ac838a5
Python
22,064
514
import pyb from array import array from . import framework as fw from .utility import randint # Ring buffer ----------------------------------------------------------------- class Ring_buffer(): # Ring buffer for storing data from interrupt service routines. def __init__(self, buffer_length=20): ...
62884d23e351f61ec163b971375b463c4b0360b2e743abbcf3c4bdf3b1803ce3
Python
22,130
526
import csv import os import sys import tempfile import click import matplotlib.pyplot as plt import pandas as pd from sklearn import preprocessing from sklearn.metrics import silhouette_score from sklearn.mixture import GaussianMixture from nidm.experiment.Query import GetProjectsUUID from nidm.experiment.tools.click_b...
f8318a694f09f753ab42f8e83dd2ea1cf866b57ce7228c4ada8c503c1f2ad5bf
Python
22,168
521
import io import logging import sys import time import traceback import zmq from ._pipeline_event_listener import PipelineEventListener from ..analysis.reply import ImageSetSuccess, ServerExited from ..analysis.reply import ImageSetSuccessWithDictionary from ..analysis.reply import NoWork from ..analysis.request impo...
1a27f45fbbec7c88a14d6bf3afdf34c4ff3391f564d20e0737116621567cdf1c
Python
22,198
419
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 import matplotlib import matplotlib.pyplot as plt from matplotlib.animation import ...
5d5a97498180f2a48b9b1ebb69069e15848b8429deaf7ba4dcbdabc5d112b6c7
Python
22,300
583
""" RDNet Papers: * `DenseNets Reloaded: Paradigm Shift Beyond ResNets and ViTs` - https://arxiv.org/abs/2403.19588 Copyright (c) 2024-present NAVER Cloud Corp. Apache-2.0 """ from functools import partial from typing import List, Optional, Tuple, Union, Callable, Type import torch import torch.nn as nn import torc...
79453f1767ddb347a230e331e699b81638fe3a4a6997d0c2f4986879da3cf101
Python
22,329
709
""" RepViT Papers: * `RepViT: Revisiting Mobile CNN From ViT Perspective` - https://arxiv.org/abs/2307.09283 @misc{wang2023repvit, title={RepViT: Revisiting Mobile CNN From ViT Perspective}, author={Ao Wang and Hui Chen and Zijia Lin and Hengjun Pu and Guiguang Ding}, year={2023}, eprint={2307...
cd3d871cfe57962e9ce30e134ccd60d217ad8d6460f09f534992c920cd492281
Python
22,341
651
""" pysteps.nowcasts.utils ====================== Module with common utilities used by nowcasts methods. .. autosummary:: :toctree: ../generated/ binned_timesteps compute_dilated_mask compute_percentile_mask nowcast_main_loop print_ar_params print_corrcoefs stack_cascades """ import ...
a31f6e89b2e6cff16ab0cb54f854110372060c54725240cb8f4733e0c6bde028
Python
22,347
487
""" Author: Mingjian He <mh1@stanford.edu> arn module contains autoregressive model of order n methods used in SOMATA """ from somata.basic_models import StateSpaceModel as Ssm from somata.exact_inference import inverse import numpy as np import numbers from scipy.linalg import block_diag class AutoRegModel(Ssm): ...
ebb20eb53fcaf00a388595fc22afae003dcabd1df6042ca85a4ffe850bc83e6c
Python
22,367
706
from base64 import b64decode from collections import namedtuple from io import BytesIO from typing import ( TYPE_CHECKING, Any, Callable, Hashable, Iterable, Literal, Mapping, Optional, Sequence, Type, Union, ) import json import time import warnings import numpy.typing as n...
5d83c8b4317d89946866ae7d5ef4f61075f1ca9ef74cd4cb441a513706429c62
Python
22,377
651
# -*- 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...
a7cef90a7deffff8d544d149698ec4022f848a2377bf7928e6287e9beaf760ba
Python
22,391
636
import io import os import numpy import skimage.io import cellprofiler_core.image import cellprofiler_core.measurement import cellprofiler_core.modules.injectimage import cellprofiler.modules.measureobjectsizeshape import cellprofiler_core.object import cellprofiler_core.pipeline import cellprofiler_core.workspace fro...
e2685250d33ff5ed82eb96f755b6e84298498f31fe1789987baee6c9baea6cbf
Python
22,419
627
""" ImageMath ========= **ImageMath** performs simple mathematical operations on image intensities. This module can perform addition, subtraction, multiplication, division, or averaging of two or more image intensities, as well as inversion, log transform, or scaling by a constant for individual image intensities. K...
4106afee1154ac6d683a426063d0b6f61d19fe38994d38dcf8af0f8b9c37ebb9
Python
22,422
638
# pylint: disable=too-many-locals, too-many-arguments # pylint: disable=too-many-branches, too-many-statements """Training Library containing training routines.""" import copy import os import weakref from typing import ( TYPE_CHECKING, Any, Dict, Iterable, List, Optional, Sequence, Tup...
8d69a41cdbe8c8865b804ba11823639b46973f22538feb9329aa51c6b675297e
Python
22,462
624
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Mar 26 11:56:59 2019 @author: Nikolai M Chapochnikov This plots the plots related to the simulation of the model on artificial datasets, to understand its functioning the external files are that used are: data_i = 3 f'dataset{data_i}/dataset_{D}D_{n_c...
9e949dc4a4972a0a2a76eb459d51775f4701a3cc67215ab9147a4b1d4ab0fb84
Python
22,464
524
import os import pathlib from typing import Optional, Tuple, Union import numpy as np import pandas as pd import SimpleITK as sitk import torch from torch.utils.data import DataLoader import torchio from GANDLF.compute.loss_and_metric import get_loss_and_metrics from GANDLF.compute.step import step from GANDLF.data.po...
52809e20524abb0558bfd8810a7b1f3404cd7dd8ea113ccdab78be593e7a8975
Python
22,499
588
import random import re import numpy as np import pandas as pd import torch from torch.utils.data import Dataset from sklearn.model_selection import KFold, train_test_split import scanpy as sc import scipy import anndata as annd from tqdm.auto import tqdm from scipy.stats import pearsonr, spearmanr def get_expression...
343a04ae678c7480585770f0fbb9ded0b7ab0347aed6f682aa08a10a4d7e4699
Python
22,524
659
""" Sequencer Papers: * `Sequencer: Deep LSTM for Image Classification` - https://arxiv.org/abs/2205.01972 """ # Copyright (c) 2022. Yuki Tatsunami # Licensed under the Apache License, Version 2.0 (the "License"); import math from functools import partial from itertools import accumulate from typing import List, O...
79ac4ddee086eec6f4b9f1e7d5b9640f4c16f0d4cb27294c17a63058e9c2c633
Python
22,550
530
""" Loader Factory, Fast Collate, CUDA Prefetcher Prefetcher and Fast Collate inspired by NVIDIA APEX example at https://github.com/NVIDIA/apex/commit/d5e2bb4bdeedd27b1dfaf5bb2b24d6c000dee9be#diff-cf86c282ff7fba81fad27a559379d5bf Hacked together by / Copyright 2019, Ross Wightman """ import logging import random from...
70401b022e197c46bad1050e12bc20f4f8089185a313f26a62f60d1b719a2b15
Python
22,552
553
import os import sys import matplotlib.cm import wx import wx.lib.scrolledpanel from cellprofiler_core.preferences import ALWAYS_CONTINUE_HELP from cellprofiler_core.preferences import export_to_json from cellprofiler_core.preferences import CONSERVE_MEMORY_HELP from cellprofiler_core.preferences import DEFAULT_COLORM...
571f21cd2c2df48e690e4f5c92796aa5d77755c2de1f0270c12ee9eac9905845
Python
22,573
504
""" Name: shub_s1_s2_download_workflow.py Description - short: This Python workflow prepares Sentinel-1 and Sentinel-2 layer stacks described in the article "Machine learning-ready remote sensing data for Maya archaeology" by Kokalj et al. (2023). Sentinel Hub is used as a source for Sentinel-1 an...
bfafb4987f885c23f08819057ec9570ef0475d36f50c2c617a21442115369998
Python
22,578
502
""" Relief Visualization Toolbox – Visualization Functions Contains functions to save visualizations tile by tile. 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ž Copyrig...
b86aa336ac92743c4ae9f88aac587861ce7c9cdfb0e93c2c2e669b52609744b6
Python
22,591
693
"""Tests for dask shared by different test modules.""" from __future__ import annotations import json from collections.abc import Generator from contextlib import contextmanager from typing import TYPE_CHECKING, Any, List, Literal, Tuple, Type, Union, cast, overload from unittest.mock import patch import numpy as np...
4bd55e55a4cc7980d4566ed3f549a3ad2481401bcd2c84de765393b7447774ea
Python
22,623
604
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...
9ed115423749d1e980f59e720b7f1f115f46486db0a000464e77e4fee2896200
Python
22,648
622
"""Pytorch impl of Aligned Xception 41, 65, 71 This is a correct, from scratch impl of Aligned Xception (Deeplab) models compatible with TF weights at https://github.com/tensorflow/models/blob/master/research/deeplab/g3doc/model_zoo.md Papers: * `Xception: Deep Learning with Depthwise Separable Convolutions` - https:...
b6b205801f61e9cef884767b789472a8ae2c6627f1a0f2700c532c55fc6c13c9
Python
22,662
699
import numpy as np from numpy import linalg as LA import matplotlib as mpl import matplotlib.pyplot as plt import pandas as pd import os, re import tensorflow as tf import logomaker from joblib import dump, load from sklearn.cluster import KMeans, DBSCAN # from sklearn.mixture import GaussianMixture from sklearn.ens...
a085c5dc557f90716ab0cfa8644c866e9cd033698a0ae342c7c159d56e75596a
Python
22,676
595
""" Transformer in Transformer (TNT) in PyTorch A PyTorch implement of TNT as described in: * `Transformer in Transformer` - https://arxiv.org/abs/2103.00112 The official mindspore code is released and available at https://gitee.com/mindspore/mindspore/tree/master/model_zoo/research/cv/TNT The official pytorch code ...
2bb7820f6412a533235b4e52ed47a4c61bbe24d39d6e42b4b1be9518ccccd067
Python
22,685
713
"""empty message Revision ID: 11230bf660dc Revises: d0a243e71ea2 Create Date: 2021-07-21 15:27:03.443079 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = "11230bf660dc" down_revision = "d0a243e71ea2" branch_labels = None...
5f8895eb41a5a53112e83ccdf0e2b153bd0e6f8bd0e6680991779f5f98c66b34
Python
22,685
531
from cellprofiler_core.constants.module import HELP_ON_MEASURING_DISTANCES from cellprofiler_core.setting.choice import Choice from cellprofiler_core.setting.subscriber import LabelSubscriber, GridSubscriber from cellprofiler_core.setting.text import LabelName, Integer from cellprofiler_core.utilities.core.module.ident...
97709000c2c1b05a6af4bdbe8093e5d04126916f1c0b36aecd09dc3081092cd6
Python
22,687
658
# -*- coding: utf-8 -*- """ @author: Nikolai M Chapochnikov """ # ############################################################################# # ################################# IMPORTS ################################### # ############################################################################# import numpy a...
f1659a12788f6edf59f333ffbf33f20875e37fd4cc90f172777bf7020ca972be
Python
22,720
602
""" DisplayDataOnImage ================== **DisplayDataOnImage** produces an image with measured data on top of identified objects. This module displays either a single image measurement on an image of your choosing, or one object measurement per object on top of every object in an image. The display itself is an ima...
f27f4cd5deaa5aa464c2d814dde68a7b96691a7a5edb93cca2bf022f8df86bf7
Python
22,756
577
""" pnasnet5large implementation grabbed from Cadene's pretrained models Additional credit to https://github.com/creafz https://github.com/Cadene/pretrained-models.pytorch/blob/master/pretrainedmodels/models/pnasnet.py Papers: * `Progressive Neural Architecture Search` - https://arxiv.org/abs/1712.00559 """ f...
46608083cc87e8324a4f187919d1ce18d044ba9cbadabdea7d656daeafb4b1f5
Python
22,768
537
""" Transforms Factory Factory methods for building image transforms for use with TIMM (PyTorch Image Models) Hacked together by / Copyright 2019, Ross Wightman """ import math from typing import Optional, Tuple, Union import torch from torchvision import transforms from timm.data.constants import IMAGENET_DEFAULT_M...
ef472122d8e86b7b2ad6ba6b5016f614fb66acb7c221d244a642101c48dc7a9a
Python
22,798
614
# -*- 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...
8fb0ebfc4bba80a58986cbf5dbadfd462e4dde46bd27a920418f87d375396dd3
Python
22,840
631
import skimage import cellprofiler_core.object from cellprofiler_core.module.image_segmentation import ImageSegmentation from cellprofiler_core.setting import Binary, StructuringElement from cellprofiler_core.setting.choice import Choice from cellprofiler_core.setting.subscriber import ImageSubscriber from cellprofile...
80ae9c019c77218ece12d4a89d6e78ea5262efdbb5e45094d7126c5cb5978021
Python
22,852
405
##################### # 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...
c142dbaa1a99694ee6f3d048440d265ed0067497565e8e654833a73a1df69fba
Python
22,904
592
""" Morph ===== **Morph** performs low-level morphological operations on binary or grayscale images. This module performs a series of morphological operations on a binary image or grayscale image, resulting in an image of the same type. Many require some image processing knowledge to understand how best to use these ...
41509634e1ecbd5210f149fa54aef71541d21bc501baff33a5208a40c348ce85
Python
22,970
508
# -*- coding: utf-8 -*- import torch import torch.nn as nn from torch.nn.parameter import Parameter import function import numpy as np from module import FA_wrapper, TrainingHook spike_args = {} class NetworkBuilder(nn.Module): def __init__(self, topology, input_size, input_channels, label_featur...
20780e630aaaa1a8ea7db6ba4466dd2d68370fbefa8bb9fd15ee25e02656e609
Python
22,976
576
""" ADOPT PyTorch Optimizer ADOPT: Modified Adam Can Converge with Any β2 with the Optimal Rate: https://arxiv.org/abs/2411.02853 Modified for reduced dependencies on PyTorch internals from original at: https://github.com/iShohei220/adopt @inproceedings{taniguchi2024adopt, author={Taniguchi, Shohei and Harada, Keno...
2d47b1039c7d21a536c435700fc7aafc834dc4935d73457ff56a4cb40e12e740
Python
23,113
485
""" Conditional Wasserstein Generative Adversarial Network with Gradient Penalty (C-WGAN-GP) Author: Niklas Fehlemann, IMS IEHK """ import sys import torch import torch.autograd as autograd import numpy as np import pandas as pd import matplotlib.pyplot as plt from geomloss import SamplesLoss from tqdm import tqdm im...
8a9212d5dfa544b58eafdba88dda95328b72a809c4ee6e90db0b0dc45a124f94
Python
23,123
548
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Aug 24 11:51:41 2021 @author: filtsem """ import numpy as np import matplotlib.pyplot as plt import mne import os from mne.minimum_norm import read_inverse_operator, apply_inverse, apply_inverse_raw, make_inverse_operator,apply_inverse, write_inverse_op...
9453ca9b74e03a6edb7c5a4236bbfa6a4192d099c878313885b702bd13232442
Python
23,138
563
import numpy from cellprofiler.modules import _help from cellprofiler_core.constants.measurement import ( C_PARENT, FF_CHILDREN_COUNT, FF_PARENT, COLTYPE_INTEGER, ) from cellprofiler_core.module import Module from cellprofiler_core.object import Objects from cellprofiler_core.setting import Binary from ...
35e9e7a05559e4019820bfca241d7edd6567f2bd37d356e49c353c7ab29b7967
Python
23,187
964
""" Module for generating rdkit molobj/smiles/molecular graph from free atoms Implementation by Jan H. Jensen, based on the paper Yeonjoon Kim and Woo Youn Kim "Universal Structure Conversion Method for Organic Molecules: From Atomic Connectivity to Three-Dimensional Geometry" Bull. Korean Chem. Soc. ...
451f290c6980680181956e794e2f132b82662c04eac2f6ffe523f8658b421221
Python
23,202
591
import numpy import six.moves import cellprofiler_core.image import cellprofiler_core.measurement import cellprofiler_core.measurement import cellprofiler_core.modules from cellprofiler_core.constants.measurement import FF_COUNT, COLTYPE_INTEGER, M_LOCATION_CENTER_X, COLTYPE_FLOAT, \ M_LOCATION_CENTER_Y, M_NUMBER_...
9803a0e585690eaa88c98ac19ebc58d4fe092602d50c51844c04f1dba03a3447
Python
23,211
402
import numpy as np from numpy.typing import NDArray from typing import List, Tuple, Annotated, Optional, Union from pydantic import validate_call, ConfigDict, BeforeValidator, Field, BaseModel from cellprofiler_library.functions.measurement import measure_correlation_and_slope_from_objects, measure_manders_coefficient_...
440e31aadc05a307a0844c8a7b8369234411dfdcf0ce742ea0eab1685ff48b68
Python
23,274
647
# -*- coding: utf-8 -*- """ pysteps.blending.utils ====================== Module with common utilities used by the blending methods. .. autosummary:: :toctree: ../generated/ stack_cascades blend_cascades recompose_cascade blend_optical_flows decompose_NWP compute_store_nwp_motion load...
8484cea78a2e46f8037a131c844662ecde1e39ab4015f2ecbd1c563fc3b374d3
Python
23,276
700
import numpy import pytest import cellprofiler_core.image import cellprofiler_core.measurement import cellprofiler_core.module from cellprofiler_core.constants.measurement import ( C_PARENT, GROUP_NUMBER, GROUP_INDEX, COLTYPE_FLOAT, COLTYPE_INTEGER, M_LOCATION_CENTER_X, M_LOCATION_CENTER_Y,...
2f87ff72340ea0a164b6f1213cfe1d7e8284e3a7587db655a608aec600beaf5d
Python
23,308
497
import numpy as np import nengo from .pathintegration import PathIntegration from .associativememory import AssociativeMemory from .binding import CircularConvolution, Product class SLAMNetwork(nengo.network.Network): r""" Nengo network that performs simultaneous localization and mapping (SLAM) Paramete...
79c3221de1560093046b2674aeda79af34881cf5443f58abb8d094169526c7ff
Python
23,316
547
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Aug 24 11:51:41 2021 @author: filtsem """ import numpy as np import matplotlib.pyplot as plt import mne import os from mne.minimum_norm import read_inverse_operator, apply_inverse, apply_inverse_raw, make_inverse_operator,apply_inverse, write_inverse_op...
e7f34e19c1b0225e04b42d71a46851629fb8b877d0bec8a6bc460bb8d81160fb
Python
23,326
389
#! /usr/bin/env python from __future__ import absolute_import from __future__ import division from __future__ import print_function ## import sys, os, glob, gzip, time from functools import partial from importlib import import_module ## Math import numpy as np ## tensorflow imports import tensorflow.compat.v1 as tf...
d05d9a5797204dc54536169ec2c9735e4e4159c93671d104cfcb04f075ddc7a1
Python
23,328
616
import atexit import hashlib import logging import os import tempfile import urllib.parse import urllib.request import weakref import numpy from skimage.exposure import rescale_intensity from skimage.util import img_as_float32 import cellprofiler_core.preferences from .._abstract_image import AbstractImage from ..._i...
6801f1e03a891441d525b0790cc683f5154c871cc541e5d73c82249679f4770f
Python
23,333
526
from . GenomeTrack import GenomeTrack from pygenometracks.utilities import InputError from intervaltree import IntervalTree, Interval import matplotlib import numpy as np from matplotlib.patches import Arc, Polygon from .. utilities import opener, to_string, change_chrom_names, temp_file_from_intersect, get_region from...
c6002fdac368e2aff88bc58a369595e16a0e48f0c15d4973fd66a4396efa9c6d
Python
23,398
605
""" Inception-V3 Papers: * `Rethinking the Inception Architecture for Computer Vision` - https://arxiv.org/abs/1512.00567 * `Adversarial Machine Learning at Scale` - https://arxiv.org/abs/1611.01236 (adversarially trained weights) Originally from torchvision Inception3 model Licensed BSD-Clause 3 https://github.com/p...
64ca513623be1a00c9847d423cb93d0c5443da88c50fe9cbd03416a89fc9449e
Python
23,407
576
""" PyTorch Implementation of the Kron (PSGD) optimizer This is a PSGD optimizer using a Kronecker-factored preconditioner. This impl was adapted from https://github.com/evanatyourservice/kron_torch by Evan Walters, licensed CC-BY-4.0. Contributions to above also made by * Lucas Nestler, added to his https://github....
f5152ef6cc0582cf9c86da983869370fb367c1ef6c9b594708f3299907bd65af
Python
23,432
502
from . GenomeTrack import GenomeTrack from .. utilities import file_to_intervaltree, plot_coverage, InputError, transform, change_chrom_names import numpy as np import pyBigWig import tempfile import os import pysam DEFAULT_BEDGRAPH_COLOR = '#a6cee3' class BedGraphTrack(GenomeTrack): SUPPORTED_ENDINGS = ['.bg', ...
d60667ec8e28f3314690988dba57458441bb93e9b93334c7d6ab6e803317d789
Python
23,563
606
import sys import unittest import numpy as np from numpy.testing import * from ptsa.data.events import Events from ptsa.data.readers import BaseEventReader from ptsa.data.readers import PTSAEventReader from ptsa.data.readers.EEGReader import EEGReader from ptsa.data.readers.tal import TalReader from ptsa.data.filters....
f2c3268c50c001b5f9af7befc178cf05a075cd19821450ef77cd2e492c955693
Python
23,569
746
''' adapted from https://github.com/all-umass/ManifoldWarping ''' import numpy as np import scipy as sp import sys import time import scipy.spatial.distance as sd from sklearn.metrics.pairwise import euclidean_distances, pairwise_distances from sklearn.manifold import Isomap,LocallyLinearEmbedding import pandas as pd ...
67ac79fb19cbd155932e3b869015c29aa385a0c75182c649a155c78138b2f1f3
Python
23,589
494
from PIL import Image import matplotlib # matplotlib.use('Qt5Agg') matplotlib.use('TkAgg') import matplotlib.pyplot as plt from matplotlib import gridspec import os.path as op import os import glob import numpy as np from tqdm import tqdm from src.utils import utils from src.utils import color_maps_utils as cmu PICS...
98e24830e78eb61789ee4389c7bb5a7f40c45eb2a48fc22ef17491966dd99796
Python
23,602
487
# TODO shift map first using mask! """ 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...
eca2580b959d2fb418df48d80a3a1306a04c02b2ce929fdb8a966daceb11aae9
Python
23,650
597
#!/usr/bin/env python """ """ from PIL import Image import pandas as pd import glob import gc import os import numpy as np import h5py import torch import torch.nn as nn import torch.optim as optim from torch.utils import data from torchvision import models, transforms import imgaug from imgaug import augmenters as ...
a0216cffee6cc824d78563e53685584c6bbea218659fb42d51a51243137f0576
Python
23,732
644
""" Class-Attention in Image Transformers (CaiT) Papers: * `Going deeper with Image Transformers` - https://arxiv.org/abs/2103.17239 Original code and weights from https://github.com/facebookresearch/deit, copyright below Modifications and additions for timm hacked together by / Copyright 2021, Ross Wightman """ # C...
7d7d304b554c701bc807907b9ebed8e7b2769ef1cfb5161f9356733161574e0b
Python
23,760
631
""" SEResNet implementation from Cadene's pretrained models https://github.com/Cadene/pretrained-models.pytorch/blob/master/pretrainedmodels/models/senet.py Additional credit to https://github.com/creafz Original model: https://github.com/hujie-frank/SENet Papers: * `Squeeze-and-Excitation Networks` - https://arxiv.o...
72ed6bdd4440ef3f001d2a028bba94803931ac07d091bc58425839bd9e8c3fa5
Python
23,821
638
"""Generate the website's dataset catalog from a pinned registry snapshot.""" from __future__ import annotations import argparse import hashlib import html import json import re import sys from collections.abc import Mapping, Sequence from pathlib import Path from typing import Any, Literal, TypedDict, cast from urll...
305d0f202a371ed2aa699f262490988c100af893a73ef5e4dfebcd8d2c396d43
Python
23,851
570
#!/usr/bin/env python # -*- coding: utf-8 -*- """ guideseq.py =========== serves as the wrapper for all guideseq pipeline """ import os import sys import yaml import argparse import traceback # Set up logger import log logger = log.createCustomLogger('root') from alignReads import alignReads from filterBackgroundS...
b9355ede57508ff7b9f21e5e9d89e3ffec62264ac78a4a1c8acaec26f66f6d82
Python
23,858
596
""" MeasureObjectNeighbors ====================== **MeasureObjectNeighbors** calculates how many neighbors each object has and records various properties about the neighbors’ relationships, including the percentage of an object’s edge pixels that touch a neighbor. Please note that the distances reported for object me...
b829956fc0cc81906402eaf7e7b0c06474b01481b7a6ad6a29460fef662c8baf
Python
23,860
667
# -*- 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...
3209ac0f2d6bf56a3a5fff436878c00a84542d26f418b855e2d301878ebd5299
Python
24,087
690
""" Deep Layer Aggregation and DLA w/ Res2Net Papers: * `Deep Layer Aggregation` - https://arxiv.org/abs/1707.06484 * `Res2Net: A New Multi-scale Backbone Architecture` - https://arxiv.org/abs/1904.01169 DLA original adapted from Official Pytorch impl at: https://github.com/ucbdrive/dla Res2Net additions from: https...
46514698dc5a8bfeefaadc69ac871e6f45c82df7699bcf5cf83541a6e5f60afe
Python
24,129
685
""" ColorToGray =========== **ColorToGray** converts an image with multiple color channels to one or more grayscale images. This module converts color and channel-stacked images to grayscale. All channels can be merged into one grayscale image (*Combine*), or each channel can be extracted into a separate grayscale im...
e514af401848d5a4cc5d3512bd93d2c317f92272c6d30f218e0f00b7b4110534
Python
24,143
534
__author__ = 'tsungyi' import numpy as np import datetime import time from collections import defaultdict from . import mask as maskUtils import copy class COCOeval: # Interface for evaluating detection on the Microsoft COCO dataset. # # The usage for CocoEval is as follows: # cocoGt=..., cocoDt=... ...
94bc8a6f3eb995882ac0d7d79b820f001d262883b9b505a0ebeeeed794f99689
Python
24,163
571
import pandas as pd import numpy as np import wget from zipfile import ZipFile from DeepPurpose.utils import * import json import os import requests import re ''' Acknowledgement: The BindingDB dataset is hosted in https://www.bindingdb.org/bind/index.jsp. The Davis Dataset can be found in http://staff.cs.utu.fi/~aat...
ea99fd72cb69d6f27f660b09ad526cd43c27a70d907fcfb3be812e4b7f84e031
Python
24,177
744
from .modelBase import ModelBase from GANDLF.models.seg_modules.out_conv import out_conv import torch import torch.nn as nn from torch.nn import ModuleList import numpy as np import math class _DeconvConvBlock(nn.Sequential): """ A block consisting of a transposed convolutional layer, followed by a convolutio...
fb0ea4e612f08533d8c4e3b6a5e281292b71a08ffb90018f21fbb9cb885ec5dd
Python
24,328
507
import numpy as np import nengo import matplotlib.pyplot as plt from matplotlib.patches import Rectangle import sys, os sys.path.insert(1, os.path.dirname(os.getcwd())) os.chdir("..") import sspslam import nengo_ocl from sspslam.networks import get_slam_input_functions import sspslam.utils as utils import matplotlib.gr...
4223cd2a27cbc6ddf7220f93b03a74481f93d9c5d811b848403bb3f21a49e55d
Python
24,367
585
""" EfficientNet, MobileNetV3, etc Builder Assembles EfficieNet and related network feature blocks from string definitions. Handles stride, dilation calculations, and selects feature extraction points. Hacked together by / Copyright 2019, Ross Wightman """ from typing import Callable, Optional import logging import ...
b64a5cd60b47222fac6f9cc3d704280b2a896dcc8f476150c9be7f671ca88362
Python
24,368
699
import os import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import torch.nn as nn import torch import copy import math from sklearn.metrics import roc_curve from scipy.optimize import curve_fit from torchsummary import summary from sklearn import tree #from sklearn.externals...
2dcd24b2baa1c34def9eec3d2741ae37a91deb9b2f4e5f6c85526c74f6a48a19
Python
24,370
580
#!/usr/bin/env python3 """ Makes temporary seed corr maps using a chosen roi for each network and correlation maps Usage: cifti_vis_PINT snaps [options] <func.dtseries.nii> <subject> <PINT_summary.csv> cifti_vis_PINT subject [options] <func.dtseries.nii> <subject> <PINT_summary.csv> cifti_vis_PINT index [o...
01713cac26c3ffcc1f032039136e098ad9586f71de687cd08c8712a1321e7705
Python
24,384
466
#!/usr/bin/env python3 # MYC blacklist region chr8:129571461-129571635 (b37) # MYC blacklist region chr8:128559215-128559389 (b38) ################################################################# # Configure the enviroment import pandas as pd import argparse from multiprocessing import Pool ########################...
cc56b3c545397970a07516a266f8ac14c5ebb99a82ba6983e7d4b95c829635e1
Python
24,437
780
""" Performs various operations. @author: JingyiGF """ import scipy import scipy.io import sys import os import time import copy import warnings import random import pickle from copy import deepcopy from scipy.optimize import minimize from scipy.stats import wilcoxon from typing import Any, Optional from collections.a...
46e5f26f3d5afe695f7b0694541dabc10ccfb32cb1515186cf7fe12e7353ae81
Python
24,465
489
# Analysis Imports import math import numpy as np from scipy.signal.windows import dpss from scipy.signal import detrend # Logistical Imports import warnings import timeit from joblib import Parallel, delayed, cpu_count # Visualization imports import colorcet # this import is necessary to add rainbow colormap to matpl...
af3af33de5424dec6ce0ed8de7d850628c5da98eab85fc09056ab346e0d77cc8
Python
24,510
691
import sys from copy import copy from typing import Any, Dict, Type import numpy as np import pytest from hypothesis import assume, given, settings, strategies from hypothesis.extra.pandas import column, data_frames, range_indexes import xgboost as xgb from xgboost import testing as tm from xgboost.compat import impo...
93d013dac47b61908a9354223a3a43407715d9d9f0c8cf55963bf3874dc40201
Python
24,519
597
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 tensorflow.keras.callbacks import LearningRateScheduler import math from lib.pinn import PINN from lib.network im...
cd918891ada156b6f2d15af4a1d12913008031117e79d6bd90cecd4b68700d3e
Python
24,536
531
#!/usr/bin/env python3 """ Runs a combination of fmriprep and ciftify pipelines from BIDS specification Usage: fmriprep_ciftify.py <bids_dir> <output_dir> <analysis_level> [options] Arguments: <bids_dir> The directory with the input dataset formatted according to the B...
fe2df30cf49a9312bf7f2366e3a79e105ff727a573f30f4a72ccc8d114ece7d0
Python
24,585
892
from ptsa.data.readers import TalReader from ptsa.data.readers.index import JsonIndexReader import numpy as np import os.path as osp from tests import utils @utils.skip_without_rhino def test_talreader_on_database(): old_reader = TalReader(filename=osp.join(utils.get_rhino_root(), 'data/eeg/R1234D/tal/R1234D_talL...
c470e282251958677f0a982baec18c6891d1c188acfa0b4e8c52a067fbe036d0
Python
24,628
559
""" Dynamic Sequence Length Datasets for Variable Resolution Image Processing Implements two dataset wrappers: 1. NaFlexMapDatasetWrapper - Map-style dataset that returns batches with variable sequence lengths TODO: 2. NaFlexIterableDatasetWrapper - Iterable dataset that yields batches with variable sequence lengths ...
0c3a954214a50c4b36719ecf7764c8875c0755a39660c399477d1b0f6419f0ab
Python
24,696
614
import csv import os import sys import tempfile import warnings import click import matplotlib.pyplot as plt import numpy as np import pandas as pd from sklearn import preprocessing from sklearn.cluster import KMeans from sklearn.decomposition import PCA from sklearn.metrics import ( calinski_harabaz_score, dav...
7f2a238804408bd1d3e06c60bf89d7cf6415492aea93defcf60aaea1ee9b996d
Python
24,703
602
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 tensorflow.keras.callbacks import LearningRateScheduler import math from lib.pinn import PINN from lib.network im...
7c00b551b3d4762f467685698395e1069cb89987d623d33c9384c5fd94978e66
Python
24,711
368
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Wed Apr 4 12:16:50 2018 @author: saskiad """ import pandas as pd cres areas = ['VISp','VISl','VISal','VISpm','VISam','VISrl'] depths = [100,200,300,500] table = pd.DataFrame(columns=('area','cre','depth','number_experiments','number_cells_dg','responsive...
5c9c568c4c1922603a640f014cb632dd345a0122f816964d4c344aa7e7c59bef
Python
24,751
577
#!/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 ...
be250a49a4085ac838fdb7025f0c0f4c530e498bfcc5972154a3e237e0a2810b
Python
24,779
711
import torch from torch import nn from torch.nn import functional as F import dgl from layers import GATLayer, CapsuleLayer, squash, GAT_adj, WeightedSumAndMax, ConditionEmbedding class DeepReac(nn.Module): def __init__(self, in_feats_0, g_num, c_num=0, ...
0e40fe23eba24bde9d45a1a50d31c82c39f28706dc1af1a814e1d9f1628e51a0
Python
24,811
585
import tensorflow as tf import numpy as np import settings import pandas as pd from pathlib import Path import matplotlib.pyplot as plt import matplotlib as mpl from matplotlib.collections import LineCollection from matplotlib.colors import ListedColormap, BoundaryNorm import os os.environ['MNE_USE_NUMBA']='f...
b6418389165390e67265892e21a37592795d1d595f95a70b4abbae9ab42c45c2
Python
24,821
821
import numpy as np import matplotlib.pyplot as plt from scipy import io import numpy as np import sys import cv2 import matplotlib import skimage.transform as st import pywt import skimage.filters from matplotlib import rc import matplotlib.ticker rc("font", family="serif", serif="cm10") matplotlib.rcParams["text.use...
e44e4a77837a5b0617e04c25290334a5cd09205d80866c80eaceb22553d5cdb1
Python
24,829
505
""" Author: Mingjian He <mh1@stanford.edu> vb module contains variational bayesian methods for switching inference """ from somata.basic_models import StateSpaceModel as Ssm from somata.exact_inference import forward_backward, viterbi, run_em, logdet, inverse from somata.switching import switching import numpy as np ...
950d6629b55bf3c1357a33559c57d982cfb21d3c9f01e6c8171713174465c9d2
Python
24,856
671
# 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...
5db56f3d0c17b072984086568728ffcdfae7dcdb18a8d100eb2d08b617a1224e
Python
24,858
661
"""SwiftFormer SwiftFormer: Efficient Additive Attention for Transformer-based Real-time Mobile Vision Applications Code: https://github.com/Amshaker/SwiftFormer Paper: * `SwiftFormer: Efficient Additive Attention for Transformer-based Real-time Mobile Vision Applications` - https://arxiv.org/abs/2303.15446 @InProceed...
4c8d1a0e8bf52b63a36e60752f10d5b6e6736c1f7dff02224eedb6b6c1f8192d
Python
24,871
672
import os, time, psutil from typing import Tuple, Union import pandas as pd import torch from torch.utils.data import DataLoader from tqdm import tqdm import numpy as np import torchio from medcam import medcam from GANDLF.data import get_testing_loader from GANDLF.grad_clipping.grad_scaler import GradScaler, model_pa...
83b83f507b5c7bcdf26fb52a1f53c8137bba5f54909f0130466ac57bb14eb8e0
Python
24,871
765
# -*- coding: utf-8 -*- """ This test file will check each part of the configuration file checker which can raise an InputError """ import unittest import pygenometracks.plotTracks import os from pygenometracks.utilities import InputError ROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), ...