sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
ef76981a2d48d94d860649fc30f2f9e01b2353418ff38cc03d4079c10301cd92 | Python | 24,906 | 792 | """Tests for updaters."""
import json
from functools import partial, update_wrapper
from string import ascii_lowercase
from typing import Any, Dict, List, Optional, Union, overload
import numpy as np
import pytest
from sklearn.datasets import make_regression
import xgboost.testing as tm
from ..callback import Train... |
c6d2ba3a83de84eac574b8b316bf5919a5a31207397c4472eea9a1a7e2d431c4 | Python | 24,911 | 625 | import io
import numpy
import cellprofiler_core.image
import cellprofiler_core.measurement
import cellprofiler.modules.measuretexture
import cellprofiler_core.object
import cellprofiler_core.pipeline
import cellprofiler_core.workspace
from cellprofiler_library.opts.measuretexture import HaralickFeatures, MeasurementT... |
2ee56828da36694be7b19b0a15c2097b451cad337d21854f16f57f736b73f7a1 | Python | 24,960 | 759 | import numpy
import cellprofiler_core.image
import cellprofiler_core.measurement
import cellprofiler_core.measurement
from cellprofiler_core.constants.measurement import COLTYPE_FLOAT, R_PARENT
import cellprofiler.modules.calculatemath
import cellprofiler_core.object
import cellprofiler_core.pipeline
import cellprof... |
cebe2077b54a1ad86fc520f56a42735ca401ef4965177a33d88cfb8c187834c6 | Python | 25,044 | 649 | """ Twins
A PyTorch impl of:
* `Twins: Revisiting the Design of Spatial Attention in Vision Transformers` - https://arxiv.org/abs/2104.13840
Code/weights from https://github.com/Meituan-AutoML/Twins, original copyright/license info below
"""
# --------------------------------------------------------
# Twins
# Copyrig... |
79d32ee90ab7232c569fd5d9a9610c8226301b3e50619289945a9f47d858ae8f | Python | 25,101 | 644 | # Adaptation from https://github.com/jeffheaton/pyimgdata
# Special thanks to: Jeff Heaton (http://www.heatonresearch.com)
import argparse
import configparser
import io
import json
import logging
import logging.config
import logging.handlers
import math
import os
import random
import webbrowser
import dotenv
import f... |
5d3f7b181ed8793aeef3182daac41af2ed5ac511d06955df18cd610330bf9ffb | Python | 25,115 | 709 | """ EfficientFormer
Papers:
* `EfficientFormer: Vision Transformers at MobileNet Speed` - https://arxiv.org/abs/2206.01191
@article{li2022efficientformer,
title={EfficientFormer: Vision Transformers at MobileNet Speed},
author={Li, Yanyu and Yuan, Geng and Wen, Yang and Hu, Eric and Evangelidis, Georgios and ... |
328a181d5f99cd452f51eacf820f00dc9b13164b9f781f34708b9ed663cbf365 | Python | 25,131 | 617 | """Randomized sequences against sweep.py's planner and its flock coordination of workers and job ranks.
The first test replans a sweep offline under random spec edits while training its jobs in between (fully, partially,
or crashing before a milestone). Simulated checkpoints record the config identity they were traine... |
acfc560e642c789c5fada793318b22285d0fd482a991c0e07a6877cb140fb103 | Python | 25,169 | 465 | import argparse
import os.path
from tifffile import tifffile
from lib.process.evaluation import MetricsLogs
from lib.process.losses import estimatePositiveWeight, GeneralizedDiceLoss, FocalLoss, DiceLoss
from lib.utils.timer import TimeTrack
try:
from lib.datasets.gendostroke import GENDOSTROKE, endostroke_reshap... |
bdc5dee772cae6e87b58f9380f5797e0002184d7741d73c3a78993934bb28d2d | Python | 25,177 | 636 | # 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... |
4d8adb3b1af9e3d75c2ce8afdd40718e3cd03d5ccb17a83466d9fff986ac5558 | Python | 25,193 | 553 | import dataclasses
import logging
import os
from copy import deepcopy
from pathlib import Path
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, TypeVar, Union
from torch import nn as nn
from torch.hub import load_state_dict_from_url
from timm.models._features import FeatureListNet, FeatureDictNet,... |
146e5d61c237e0bb95f1c52c77b733dbd25b797056b528f71eb0d24bf53b6166 | Python | 25,203 | 671 | import json
import re
from pathlib import Path
from typing import Any, Dict
import pandas as pd
from .context_url import CONTEXTFILE_URL
from .convertutils import (
create_activity_schema,
create_protocol_schema,
normalize_condition,
parse_html,
read_check_yaml_config,
)
from .redcap_mappings impo... |
b2e13510c7b9fa6e6bc3aabb276592493071bd17c70f9ef5bebafd444ac015ed | Python | 25,208 | 650 | """Pytorch Densenet implementation w/ tweaks
This file is a copy of https://github.com/pytorch/vision 'densenet.py' (BSD-3-Clause) with
fixed kwargs passthrough and addition of dynamic global avg/max pool.
Papers:
* `Densely Connected Convolutional Networks` - https://arxiv.org/abs/1608.06993
* `Making Convolu... |
d144627d5b859585483dc4f4c825e090d7f4e107f97609235b1e6fdac948be93 | Python | 25,303 | 774 | """Helpers for interfacing array like objects."""
import copy
import ctypes
import json
import warnings
from abc import ABC, abstractmethod
from functools import cache as fcache
from typing import (
TYPE_CHECKING,
Any,
Callable,
Dict,
List,
Literal,
Optional,
Protocol,
Tuple,
Ty... |
41b5c4563851049558452ff88d3e269121917cdfa210d4c0880637e4407c2b67 | Python | 25,366 | 707 | """ Visformer
Papers:
* `Visformer: The Vision-friendly Transformer` - https://arxiv.org/abs/2104.12533
From original at https://github.com/danczs/Visformer
Modifications and additions for timm hacked together by / Copyright 2021, Ross Wightman
"""
from typing import Any, List, Optional, Tuple, Type, Union
import t... |
33aaa5bedf646b3ec3f3c8fd25a0f931a86c3201d50ecce1140003fdda9a0dea | Python | 25,389 | 462 | # IdentifyOffTargetSiteSequences.py
#
# 2015-10-05 Replaced swalign with regex matching.
# 2017-05-31 Replaced nwalign with a explicit search of realignments which uses regex.search.
# 2017-06-03 Output the best offtarget sequences with and/ot without bulges, if any.
from __future__ import print_function
import argpa... |
9e50e63aeb1e400ee6a67e8883831448fc79d9a2df849a37328e42b8fe6f1aed | Python | 25,442 | 687 | from __future__ import division
import torch
import math
import random
from PIL import Image, ImageOps, ImageEnhance, PILLOW_VERSION
try:
import accimage
except ImportError:
accimage = None
import numpy as np
import numbers
import types
import collections
import warnings
def _is_pil_image(img):
if accimag... |
c8d3b8add99930c6edb2ada1aef5c09493fed0dfadfe382039441542094f62ad | Python | 25,465 | 655 | import math
from functools import partial
from typing import Any, 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
import torch.nn.functional as F
def _patch_merging_... |
de1ecab58ca1c0a4f05b85022255f67fe03969fa32bdcd5252ffafd926408cb1 | Python | 25,494 | 750 | """
Miscellaneous functions manage data.
Date: September 2018
Author: Ignacio Heredia
Email: iheredia@ifca.unican.es
Github: ignacioheredia
"""
import os
import threading
from multiprocessing import Pool
import queue
import subprocess
import warnings
import base64
import numpy as np
import requests
from tqdm import ... |
348f21d42ca49dd7650d6a6de555c239fb80183d5ebb4a322a8d5df62943ebc3 | Python | 25,498 | 503 | """
Implementation of a decision making model of
[1] Wang, Xiao-Jing. "Probabilistic decision making by slow reverberation in cortical circuits."
Neuron 36.5 (2002): 955-968.
Some parts of this implementation are inspired by material from
*Stanford University, BIOE 332: Large-Scale Neural Modeling, Kwabena Boahen & Ta... |
38cd8d08978b80b770a76abc17094e2ad541dfdd2ec487a4e8ae8e7f85f4acf4 | Python | 25,534 | 639 | # coding=utf-8
"""plateviewer.py - a user interface to view the image files for a plate
"""
import multiprocessing
import threading
import traceback
import matplotlib
import matplotlib.backends.backend_wx
import matplotlib.backends.backend_wxagg
import matplotlib.cm
import matplotlib.figure
import numpy
import wx
imp... |
72636c97fde567c5408d868082bba5c2abcfc27631329b2975648dfbd8963103 | Python | 25,555 | 689 | # coding=utf-8
"""regexp_editor - give a user feedback on their regular expression
"""
import re
import wx
import wx.stc
STYLE_NO_MATCH = 0
STYLE_MATCH = 1
STYLE_FIRST_LABEL = 2
STYLE_ERROR = 31
UUID_REGEXP = (
"[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}"
)
RE_FILENAME_GUESSES =... |
8a9666100430abb0dd818e02cd1cd98afd7df191dd573cdc3381915ebf7d914f | Python | 25,561 | 697 | """ Global Context ViT
From scratch implementation of GCViT in the style of timm swin_transformer_v2_cr.py
Papers:
* `Global Context Vision Transformers` - https://arxiv.org/abs/2206.09959
@article{hatamizadeh2022global,
title={Global Context Vision Transformers},
author={Hatamizadeh, Ali and Yin, Hongxu and Kau... |
cea58423a2eea6114cd0db26d2c1b65dea80c693499e82b567dab8149b79f1cf | Python | 25,645 | 596 | """
All the segmentation metrics are to be called from here
"""
from typing import List, Optional, Tuple, Union
import sys
import torch
import numpy as np
from GANDLF.losses.segmentation import dice
from scipy.ndimage import _ni_support
from scipy.ndimage.morphology import (
distance_transform_edt,
binary_eros... |
f6cccb3e09509cf6eea947ae6f6d31d65147177e3f83e9c59c761bb577b9f5cf | Python | 25,772 | 676 | #################################
#
# Imports from useful Python libraries
#
#################################
import centriole.cpmorphology
import centriole.zernike
import numpy
import scipy.ndimage
#################################
#
# Imports from CellProfiler
#
##################################
# Reference
#
#... |
aafd5e97d54b0f87e9cc7161076148328dbc2095434b1e0c415758f627192612 | Python | 25,805 | 564 | 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 imp... |
2d843bee12d34bfeab82412d3e6ab8d81a0b0c5f3257493c389d7b9833ce9de6 | Python | 25,896 | 747 | """Copyright 2019-2026, XGBoost contributors"""
import asyncio
import json
from collections import OrderedDict
from inspect import signature
from pathlib import Path
from typing import Any, Dict, List, Type, TypeVar
import numpy as np
import pytest
from hypothesis import given, note, settings, strategies
from hypothe... |
9d0156005828c9cb6b79cbc3decddea50be0676d9b7ea106a7d92741df791ece | Python | 25,906 | 585 | """
Author: Amanda Beck <ambeck@mit.edu>
Mingjian He <mh1@stanford.edu>
"""
import numpy as np
from numpy import random
import math
from scipy.stats import chi2
from spectrum import aryule, arma2psd, arburg
import matplotlib.pyplot as plt
import warnings
from kneed import KneeLocator
from ..multitaper import f... |
69ce3cdd335ccb4dfc3f07854ac2ae0dc24d378e66425d9195313279a5cd505c | Python | 25,919 | 764 | """
MambaOut models for image classification.
Papers:
* `MambaOut: Do We Really Need Mamba for Vision?` - https://arxiv.org/abs/2405.07992
Some implementations are modified from:
timm (https://github.com/rwightman/pytorch-image-models),
MetaFormer (https://github.com/sail-sg/metaformer),
InceptionNeXt (https://github... |
bf113002b76ab34d69a28cd81b1e222af9aa3292fddaba1ecb5d4a2650e6b272 | Python | 25,990 | 556 | #!/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
... |
db8125b8ba090b19facab4f3945d06b6ffe6b31eea0e9f3c18c7f28005bae083 | Python | 26,011 | 697 | import cellprofiler.gui.help.content
__doc__ = """\
MeasureTexture
==============
**MeasureTexture** measures the degree and nature of textures within
images and objects to quantify their roughness and smoothness.
This module measures intensity variations in grayscale images. An object or
entire image without much t... |
4b0137d4fb2bc1e125ca547f4bea2bea73ed1a79dfc10755d2ddfee529cefa87 | Python | 26,014 | 744 | # -- coding: utf-8 --
"""
pysteps.verification.detcontscores
==================================
Forecast evaluation and skill scores for deterministic continuous forecasts.
.. autosummary::
:toctree: ../generated/
det_cont_fct
det_cont_fct_init
det_cont_fct_accum
det_cont_fct_merge
det_cont_f... |
770400418e7e30bc5df60816409fca5794c9716bc6b86523e1622f7b93540264 | Python | 26,051 | 747 | # 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... |
64b25539e6a4c89b4c7443fb7d46227c53fbb337f496c6c53c825ac79b72497a | Python | 26,099 | 722 | """ HieraDet (SAM 2 Hiera image encoder)
Papers:
* `SAM 2: Segment Anything in Images and Videos` - https://arxiv.org/abs/2408.00714
* `Hiera: A Hierarchical Vision Transformer without the Bells-and-Whistles` - https://arxiv.org/abs/2306.00989
"""
import math
from copy import deepcopy
from functools import par... |
4821c9fa7b73c19cb63d16a4c86912f36380c56e34d25bc6170ea728aa21fed6 | Python | 26,224 | 690 | """ Normalization + Activation Layers
Provides Norm+Act fns for standard PyTorch norm layers such as
* BatchNorm
* GroupNorm
* LayerNorm
This allows swapping with alternative layers that are natively both norm + act such as
* EvoNorm (evo_norm.py)
* FilterResponseNorm (filter_response_norm.py)
* InplaceABN (inplace_a... |
89b3ce5e4b9726a1bd1f1b0ba4fd8b67444ab4dc0cc0e649cd77d999850e9eef | Python | 26,232 | 653 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 14 11:37:58 2022
@author: fearthekraken
"""
import os.path
import numpy as np
import pandas as pd
import copy
import matplotlib.pyplot as plt
import seaborn as sns
import scipy
import scipy.io as so
import sleepy
import AS
import pwaves
#%%
"""
###... |
68362c12bcf738e413076e7d7b63dc089d2b85942d712597f31f221cf838c234 | Python | 26,247 | 614 | """Tests for timm pooling layers."""
import pytest
import torch
import torch.nn as nn
import importlib
import os
torch_backend = os.environ.get('TORCH_BACKEND')
if torch_backend is not None:
importlib.import_module(torch_backend)
torch_device = os.environ.get('TORCH_DEVICE', 'cpu')
@pytest.mark.parametrize('api... |
3127caab5b10aac114ac81acaf8e0724171ccd4b069634d4e80a0d1483108c73 | Python | 26,364 | 746 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 6 15:01:45 2021
@author: obernauer
"""
import numpy as np
from numpy import linalg as LA
import matplotlib.pyplot as plt
from shapely.geometry import Point
from shapely.geometry.polygon import Polygon
from tqdm import tqdm
#from hexalattice.hexala... |
a1478f7007e4fd81bc8ce4ea5082b45ba3000a0e8c125435c0a68a481d3948be | Python | 26,366 | 711 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for tautomer.py"""
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
import logging
from molvs.standardize import enumerate_tautomers_smiles, canonicalize_tautomer_smiles
logging.basicConfig(level=logg... |
903b99c9bc967dfb23484ef19ef0887ad195963cf8e803d08ed93ac1361949af | Python | 26,380 | 679 | import hashlib
import json
import logging
import os
from copy import deepcopy
from functools import partial
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Any, Dict, Iterable, List, Optional, Tuple, Union
import torch
from torch.hub import HASH_REGEX, download_url_to_file, urlparse... |
df1e3bea5d89376e94a9fba4a89d1d0c3b9f40679a3f62bcf4b9cad53abae2a7 | Python | 26,387 | 717 | """ EdgeNeXt
Papers:
* `EdgeNeXt: Efficiently Amalgamated CNN-Transformer Architecture for Mobile Vision Applications` - https://arxiv.org/abs/2206.10589
* `Solving ImageNet: a Unified Scheme for Training any Backbone to Top Results` - https://arxiv.org/abs/2204.03475 (USI)
Original code and weights from https://gith... |
6383fdc6d037ec0b2769c6d253312e9b362e4234322bd9c6278c90f3ec901d68 | Python | 26,416 | 581 | import numpy as np
from sklearn.linear_model import LogisticRegression
from scipy.stats import entropy
from sklearn.utils.extmath import randomized_svd
import torch
import os
def mat_to_singular_vals(R, normalize=False, sigmoid=False, n_components=None):
"""
Returns the vector of singular values of matrix R.
... |
3ce1098311d7bdf4f4a782a185335e86116efbd9593d66084bc0baec23196e00 | Python | 26,497 | 773 | from __future__ import annotations
from dataclasses import dataclass
from pathlib import Path
import re
import sys
from typing import Optional
import uuid
import pytest
import rdflib
from rdflib import Graph, URIRef, util
from nidm.core import Constants
from nidm.experiment import Acquisition, AssessmentObject, Project... |
3bc7c0cd35977bde671806732d69e8bd0f07d9bc4b7a6a675014d540c659e1b1 | Python | 26,637 | 752 | import re
import cellprofiler_core.object
import numpy
from cellprofiler_core.constants.measurement import (
MCA_AVAILABLE_EACH_CYCLE,
C_COUNT,
C_LOCATION,
C_NUMBER,
FTR_CENTER_X,
FTR_CENTER_Y,
FTR_CENTER_Z,
FTR_OBJECT_NUMBER,
COLTYPE_FLOAT,
)
from cellprofiler_core.module.image_seg... |
b01e5d5b87805d783301b63e7a27d013d8f0bdfde0cf44496c419caf600ca958 | Python | 26,641 | 710 | """ Nested Transformer (NesT) in PyTorch
A PyTorch implement of Aggregating Nested Transformers as described in:
* `Nested Hierarchical Transformer: Towards Accurate, Data-Efficient and Interpretable Visual Understanding` - https://arxiv.org/abs/2105.12723
The official Jax code is released and available at https://g... |
d0e6746c16fc0bddd84a68a53183eb199411bafd4f8e1a20dc765624b0378371 | Python | 26,658 | 710 | """ MobileViT
Papers (MobileViT V1 and V2 respectively):
* `MobileViT: Light-weight, General-purpose, and Mobile-friendly Vision Transformer` - https://arxiv.org/abs/2110.02178
* `Separable Self-attention for Mobile Vision Transformers` - https://arxiv.org/abs/2206.02680
MobileVitBlock and checkpoints adapted from ht... |
87f08923e3d829d1277775c6b4e1c3fe231384bcc87462b1e60b38d3d9917b90 | Python | 26,689 | 723 | # 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... |
980cc8ad7721361951025997b0ca603e76c894f3575ff02cf3a8fd01e841d7be | Python | 26,769 | 755 |
import itertools
import sys
from time import time
import numpy as np
from scipy.signal import bspline
import pdb2sql
from deeprank.config import logger
from deeprank.tools import sparse
from deeprank.operate.pdb import get_atoms, get_residue_contact_atom_pairs
from deeprank.operate import hdf5data
from deeprank.oper... |
265b3c8dadaf3b57d629071287977027ed31967bbd253da76c7478da7d5b030c | Python | 26,847 | 716 | # 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... |
1aa88e02c0a89ed42c2b3a278296d63cc7a810f853fe8474a41e6179aa63a9e7 | Python | 26,863 | 697 | # 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... |
b89a54edaa92b16e7977cf627f65ad954bc029e204a2fb0bfcb926cccd7b3a2b | Python | 26,867 | 515 | #!/usr/bin/env python3
# functional tests for the run.py script
# note: to start we will just run many dry-runs to insure that the correct
# command-line calls are generated given the user args..
# also note! pybids has three test datasets! we can use!
# note all the data has been removed from the nifti files to ... |
e4f5b4ea2cd18f21b6c6e4df670d9c8255f7253aa9a51e8c856a2c95435b3b61 | Python | 26,872 | 829 | # -*- 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... |
f3e70dc229b04f9a35462c07957efe7f62d1b38fa559c0dcedf53a88d068f0ba | Python | 27,014 | 601 | #!/usr/bin/env python3
""" ImageNet Validation Script
This is intended to be a lean and easily modifiable ImageNet validation script for evaluating pretrained
models or training checkpoints against ImageNet or similarly organized image datasets. It prioritizes
canonical PyTorch, standard Python style, and good perform... |
ba2b132af8ce12b8d9dfce583b9e8a72038a3e52833ad7d4bf1917c75b96ab3d | Python | 27,146 | 585 | import logging
from pathlib import Path
import json
import torchio as tio
import SimpleITK as sitk
import numpy as np
from breaststudies.augmentation import ZNormalization, CropOrPadFixed
from breaststudies.data import BaseDataset
from breaststudies.utils import get_affine
logger = logging.getLogger(__name__)
c... |
1971a6ac8952d9ba86e22ac0b854255d1069e52ef81e041aa6de7a48c894d69d | Python | 27,189 | 720 | """PathList - the PathListCtrl displays folders and paths in a scalable way
"""
import logging
import os
import sys
import uuid
from urllib.request import url2pathname
from urllib.parse import urlparse
import wx
import wx.lib.scrolledpanel
from cellprofiler_core.pipeline import ImageFile
from cellprofiler_core.prefe... |
4235c5e96a899e5aa5e99e3798169b0572b9ac9bcd08c717863a217712f7e1e8 | Python | 27,214 | 587 | import numpy as np
import os
from matplotlib import pyplot as plt
from matplotlib.patches import Rectangle
import math
from lib.pinn import PINN
from lib.network import Network
import pandas as pd
from helper import ConcMontella
from NAnalytical import calcN_AB, calcN_IL
from itertools import product
import sys
import ... |
108d20ca7762f513697b683e2641c9dfc9c9ac3e8af69f5afa8ac0d56d6f4c51 | Python | 27,218 | 709 | # 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... |
389cb00ad91b339124791a5363700e38a862b8d3c0463ff8fbb64d29c3466fd6 | Python | 27,250 | 662 | import copy
import cvxpy as cvx
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.optim import SGD, Adam, LBFGS
def get_dual_weight(feats, labels, num_classes, C_intermediate, after_settings,
net_type='fc', optim_method='adam',
lr... |
2a3de2c0371a74d7f4fe165f4ad062d768473ca9565a9ebf63fadbd0aa5ae021 | Python | 27,300 | 761 | """ EfficientNet, MobileNetV3, etc Blocks
Hacked together by / Copyright 2019, Ross Wightman
"""
from typing import Callable, Dict, Optional, Type, Union
import torch
import torch.nn as nn
from torch.nn import functional as F
from timm.layers import (
create_conv2d,
DropPath,
make_divisible,
create_a... |
c7bf0042c7e5ea2449d1613bd8ba91caebba1522da742f8aa1898fe7152defff | Python | 27,327 | 737 | """
CalculateMath
=============
**CalculateMath** takes measurements produced by previous modules and
performs basic arithmetic operations.
The arithmetic operations available in this module include addition,
subtraction, multiplication, and division. The result can be
log-transformed or raised to a power and can be ... |
f939b678aec2f85bfb8a90f53f44a6b16aa6b11efc8d83b4ba5632a90b0430b1 | Python | 27,374 | 848 | # -*- 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... |
0855e17f63e08f62f9aeb0335d47b657135d353fe97996874fdac2b79b6da121 | Python | 27,407 | 478 | import tensorflow as tf
import tensorflow.contrib.layers as li
from ipdb import set_trace as st
from model.netUtilmri import Conv2d, Conv2d2x2, lReLU, BN, Conv1x1, UnetINDiv4_CCAM
dtype = tf.float32
d_form = 'channels_first'
d_form_ = 'NCHW'
ch_dim = 1
REAL_LABEL = 1.0
eps = 1e-12
class CollaGAN:
def __... |
f40a1e1b1ce2783413bfe5942923bc8166f2fb1261bd2952f9c94cc2a3c23772 | Python | 27,432 | 635 | # -*- coding: utf-8 -*-
"""
pysteps.blending.ens_kalman_filter_methods
=============================================
Methods to calculate the ensemble Kalman filter based correction methods for blending
between nowcast and NWP.
The core of the method occurs in the EnsembleKalmanFilter class. The specific method
to use ... |
2c1bc4e5af80fac175ea9f318a12de814ef86a0b4a147a1a89e2a01f82e132aa | Python | 27,538 | 574 | """
ClinicalASL - Clinical Arterial Spin Labeling processing pipeline
DICOM saving utility module.
Repository: https://github.com/JSIERO/ClinicalASL
Author: Jeroen Siero
Institution: UMCU (University Medical Center Utrecht), The Netherlands
Contact: j.c.w.siero@umcutrecht.nl
Description:
Utility function to sav... |
c6059eb3810093b5be6630327f449dc6507661e6a944f559c23a845ae784bc51 | Python | 27,579 | 737 | import os
import sys
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import gridspec
import pickle
import pandas as pd
import seaborn as sns
import math
import copy
from scipy import stats
from statsmodels.stats import multitest
from Session import SessionLite, Session
from loadpaths import loadpat... |
2c37c32d5d3f14c6212b8a82b6aae9228f3555e844fa20ebd70f9e18d14028bb | Python | 27,581 | 674 | import scipy
import os.path as osp
import os
import nibabel as nib
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from functions.def_ROIs_WangParcels import roi
from functions.def_ROIs_EarlyVisualAreas import roi as ROI
from functions.error_metrics import smallest_angle
... |
d4e71b69fa83c31582a3765e51d2bd0002ca145ff94a59d3d6381ec8dc97604c | Python | 27,712 | 602 | import os
import random
import sys
import time
from datetime import datetime
from pathlib import PurePath
import numpy as np
from matplotlib import use as mpluse
from neuron import h
import Functions.globalFunctions.ExtracellularField as eF
import Functions.globalFunctions.featExtract as featE
import Functions.suppor... |
4fa3a9f8a3bbf6850bc7dda7197450ea51ec11c4eeb71d547a9d4be1938a2607 | Python | 27,767 | 710 | """knime_bridge.py - server support for knime bridge
The knime bridge supports a ZMQ protocol that lets a single client
run an analysis worker to get pipeline metadata and run a pipeline on
an image set.
"""
import json
import logging
import threading
import uuid
from io import StringIO
import numpy
import zmq
from c... |
6fee9abe7404a7fef033de4711dbb2c6c6f3ad3b0ee076f63fffa61fc6a2ae14 | Python | 27,774 | 772 |
"""
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 the rights
to use, copy, modify, merge, publish, ... |
343eb5eecc6206d4e493ffa005de7d641ce0b711843fe2540c059c4bb8b7bc7b | Python | 27,792 | 665 | from typing import Literal, Union
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
import statsmodels.formula.api as smf
from scipy import optimize, stats
# plots
def heatmap(data: np.ndarray, row_labels: list[str], col_labels: list[str], ax=None,
... |
f7c28ab8fdf33dc62e72884ce602a69bedb95f58d0b06793f74cf5e6e0e303b7 | Python | 27,877 | 463 | """
Decodes events like sound stimulation or luminance/weight conditions.
@author: bartulem
"""
import os
import gc
import time
import numpy as np
from numba import njit
from tqdm import tqdm
from scipy.stats import zscore
import neural_activity
import select_clusters
import sessions2load
@njit(parallel=False)
def c... |
36f263781a679535719a5b4335243fdf553b1f1195fa041c4035f737902b4f6a | Python | 27,879 | 754 | """ FocalNet
Papers:
* `Focal Modulation Networks` - https://arxiv.org/abs/2203.11926
Significant modifications and refactoring from the original impl at https://github.com/microsoft/FocalNet
This impl is/has:
* fully convolutional, NCHW tensor layout throughout, seemed to have minimal performance impact but more fl... |
a648ad6174f507b325915b868ac7f8067d912e5c44c3042690cbb5987fc47f88 | Python | 27,887 | 868 | from flask import Flask, redirect, render_template, request, send_file, send_from_directory, make_response
import io
import os, shutil
from dotenv import load_dotenv
import pandas as pd
import numpy as np
import psycopg2
from psycopg2 import sql
from rdkit import Chem
from rdkit.Chem import Draw
from pypdb import *
imp... |
0e2d4e540a9a0513f84f56ef06f913c7e81bffaf67aabe9718dcc68299cd1415 | Python | 27,971 | 673 | #!/usr/bin/env python
""" Definition of constants
@author: Camille Maumet <c.m.j.maumet@warwick.ac.uk>
@copyright: University of Warwick 2014
@author: David Keator <dbkeator@uci.edu>
Added Python provtoolbox support
10/3/17 Modified Namespace to be QualifiedName for provtoolbox support...left most of the NIDM... |
0445049202b6435a5321ad7c2b15f415c86504be09b1c9acb51dbcbc18c90697 | Python | 28,053 | 746 | """
GrayToColor
===========
**GrayToColor** takes grayscale images and produces a color image
from them.
This module takes grayscale images as input and assigns them to colors
in a red, green, blue (RGB) image or a cyan, magenta, yellow, black
(CMYK) image. Each color’s brightness can be adjusted independently by
usi... |
c63fd85b0130683ceb5654dcf8c36aecfa04d8fc95c27bf4a9e913133c5caf57 | Python | 28,055 | 796 | '''
1. plot prediction scores for class 0 and 1 using two-panel box plots
2. hit rate plot
3. success rate plot
Usage: python {0} epoch_data.hdf5 epoch scenario[all, cm, ranair, refb, ti5, ti] fig_name
'''
import re
import sys
import warnings
from itertools import zip_longest
import h5py
import numpy as np
imp... |
3584b06fe5db6ebde493fbf5d7cfbc2103c50e3aae9739926c7aa9dc40340390 | Python | 28,127 | 740 | from collections import OrderedDict
from io import StringIO
import json
import os
from pathlib import Path
import random
import re
import shutil
import string
import subprocess
import tempfile
import uuid
from prov.dot import prov_to_dot
import prov.model as pm
from pydot import Edge
from rdflib import RDF, Graph, URIR... |
736edb921aab6ed567138fd86c0e9cdba619ecf54b2fc5b8c4093e51aab22b1f | Python | 28,246 | 726 | # 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... |
3da9aeb8100ead0079a4c0a8889a44f9d4fd0cb227261aed63890c8f66c4c647 | Python | 28,308 | 783 | #!/usr/bin/env python
import os
import sys
import time
import logging
import csv
from typing import List
import h5py
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.ticker as mtick
import numpy as np
import warnings
import torch
import torch.cuda
import torch.nn as nn
import torch.nn.functional as... |
d60c7dc05cb19e10db3b1e59f836747f164d1a34c8f134b524bf9e9e0ee42b97 | Python | 28,316 | 704 | """ Relative position embedding modules and functions
Hacked together by / Copyright 2022 Ross Wightman
"""
import math
import os
from typing import Optional, Tuple
import torch
import torch.nn as nn
import torch.nn.functional as F
from .grid import ndgrid
from .helpers import to_2tuple
from .interpolate import Regu... |
7e93879d0a1864bf0f7f3e562e9e93a9aab112a82dbe5ad1c557e6504c680c4b | Python | 28,387 | 596 | import glob
import os
import shutil
import numpy as np
import json
import pydicom
import cv2
import matplotlib.pyplot as plt
from tqdm import tqdm
import scipy
import re
def check_datset(root):
"""
Check for missing contours, dicom files, subfolders, etc.
Args:
root (str, path): root folder of th... |
c9b74823110e0d8549aded96fc2cb9e9ffbdc804828e08f4fc846233018edad0 | Python | 28,403 | 505 | import os
import tempfile
import numpy
import six.moves
import cellprofiler_core.image
import cellprofiler_core.measurement
import cellprofiler.modules.calculatestatistics
import cellprofiler_core.object
import cellprofiler_core.pipeline
import cellprofiler_core.preferences
import cellprofiler_core.setting
import c... |
100f71a976a98384a8ad03cdf0be84bf6dc838e4e135b9417c8924e0467ee323 | Python | 28,413 | 679 | import numpy as np
import itertools
def soft_rect(y, k=10):
return np.maximum(1e-6, np.log(1. + np.exp(k * y)) / k)
def soft_rect_poisson(y, yhat, k=10, weights=None):
yhat_nl = soft_rect(yhat, k)
expka = np.exp(k * yhat)
infidx = np.isinf(expka)
expka = expka / (1. + expka)
expka[infidx] = 1... |
02ae903ce74b850732043e69396ffe06de91f9c12225e4116b19cbec9d55a81a | Python | 28,456 | 859 | import numpy
import pytest
import six.moves
import cellprofiler_core.image
import cellprofiler_core.measurement
from cellprofiler_core.constants.measurement import COLTYPE_FLOAT
import cellprofiler.modules.measurecolocalization
import cellprofiler_core.object
import cellprofiler_core.pipeline
import cellprofiler_cor... |
2ab85fe59d3eea79de8579bb58c075da05415e3b9ad918888cb2f7cc067e99c2 | Python | 28,482 | 661 | #!/usr/bin/python3
import argparse
import sys
import logging
assert __name__ == "__main__"
p0 = argparse.ArgumentParser(
prog='normalisr',
description=
'Normalisr is a parameter-free normalization-association two-step inferential framework for scRNA-seq that solves case-control DE, co-expression, and pooled CRISP... |
555aaf12fa940dcd11147ba09cb799e2df6c2794d0d1653086b9d06d8ebd48c7 | Python | 28,523 | 768 | """Public retrieval API for the Python vertical proof."""
from __future__ import annotations
from collections.abc import Iterator, Mapping, Sequence
from contextlib import ExitStack, contextmanager
from pathlib import Path
from typing import Any, Literal, overload
from datamonger._cache import (
default_cache_ro... |
089743bd11563865a24eb4440ae486ef577a676678612ca0c3724c6374487be4 | Python | 28,529 | 267 | import os
import tempfile
import logging
import functools
import hashlib
import numpy
import unittest
from urllib.request import URLopener
import skimage.io
import cellprofiler_core.utilities.legacy
LOGGER = logging.getLogger(__name__)
__temp_example_images_folder = None
__temp_test_images_folder = None
cp_logo_url... |
d42cab442ff58fa4314e402f15ae94d57523863ae75ac11390e4007ca77e2f35 | Python | 28,541 | 836 | """ Next-ViT
Papers:
* `Next-ViT: Next Generation Vision Transformer for Efficient Deployment in Realistic Industrial Scenarios` - https://arxiv.org/abs/2207.05501
Next-ViT model defs and weights adapted from https://github.com/bytedance/Next-ViT, original copyright below
"""
# Copyright (c) ByteDance Inc. All rights... |
b41b8ffd7a2e3efcacfdd85b13575506346e55b0ec96f73c3ee6d8801400928d | Python | 28,552 | 760 | # 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... |
535cf495fb01c6216536b3a8d1fdaa25f67600df70522fd253d034b63b0a8c7b | Python | 28,601 | 723 | """ Image to Patch Embedding using Conv2d
A convolution based approach to patchifying a 2D image w/ embedding projection.
Based on code in:
* https://github.com/google-research/vision_transformer
* https://github.com/google-research/big_vision/tree/main/big_vision
Hacked together by / Copyright 2020 Ross Wightma... |
4335083bd9f1ea862af57be174a1647b329475e7068e660671ca1eab7ed9aa03 | Python | 28,652 | 701 | #!/usr/bin/env python3
""" Model Benchmark Script
An inference and train step benchmark script for timm models.
Hacked together by Ross Wightman (https://github.com/rwightman)
"""
import argparse
import csv
import json
import logging
import time
from collections import OrderedDict
from contextlib import suppress
from... |
a903eb69e520a2fd7b66d25fbca90f39e86d719b5ce7adbf9faf7eb3e7863996 | Python | 28,676 | 1,178 | import io
import os.path
import centriole.filter
import numpy
import pytest
import scipy.ndimage
import skimage.exposure
import skimage.filters
import skimage.transform
import tests.frontend.modules
import cellprofiler_core.image
import cellprofiler_core.measurement
import cellprofiler_core.module
import cellprofile... |
e7a3a0a4ff0262dc6bbc1a32e76b69927777d0ca262bede4a9f6a000d5bae9c9 | Python | 28,678 | 574 | import os
from pyqtgraph.Qt import QtGui, QtCore
from config.paths import config_dir
# Settings_dialog -------------------------------------------------------
class Settings_dialog(QtGui.QDialog):
def __init__(self, parent=None):
super(QtGui.QDialog, self).__init__(parent)
self.setWindo... |
116ae737e5b2483d41a1749af1a539b310da377b4f0add8f6f5123ce0107fd00 | Python | 28,747 | 624 | # -*- coding: utf-8 -*-
from .. utilities import InputError, transform
import logging
import numpy as np
from matplotlib import colors as mc
import matplotlib.pyplot as plt
from matplotlib.ticker import LogFormatter
import re
import math
# This is a regex for float which would work for 11, 102.25, but also .2
float_r... |
47d1012ff0580831048284cd33a54a80fae680ef8d9429b2fe1e62e72a13401f | Python | 28,773 | 940 | """
Contains functions that are for NMF and SNMF
@author: Nikolai M Chapochnikov
"""
import itertools
from typing import Tuple
import numpy as np
import pandas as pd
from scipy import linalg as LA
from sklearn import decomposition as skd
from functions.general import rectify, FLOAT_TYPE, mat_mul, EPSILON,\
subsp... |
5ec91fff78e5ce01f23d7786f32481f5d10bf35b1ee23b559b734ad7ed233bea | Python | 28,960 | 822 | # -*- 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... |
3e8daa68ca6f659c7e524a41834b8140622c3e4c0674050c862872196bab9317 | Python | 29,019 | 729 | # Copyright (c) 2021, Andreia V. Faria, Chin-Fu Liu
# All rights reserved.
#
# This program is free software;
# you can redistribute it and/or modify it under the terms of the GNU General Public License v3.0.
# See the LICENSE file or read the terms at https://www.gnu.org/licenses/gpl-3.0.en.html.
try:
import te... |
a0f51f181aab570d997852cf5c8af76fc2ed5486f5736d684b2c0a0bc1f378cd | Python | 29,021 | 863 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 19 10:04:52 2022
@author: obernauer
https://towardsdatascience.com/techniques-for-handling-underfitting-and-overfitting-in-machine-learning-348daa2380b9
Pre processing: Def process_images 65x65 npz files.
Batch normalization:
https://twitter.com/a... |
ea8538f3f29a428efcd0ff69485384bcfc1c8d644ec8a63eb358e6229f7d89f2 | Python | 29,077 | 964 | """
A collection of tools to manipulate SMILES strings
Created by © Rodrigo Carvalho 2020
Maintained by © Rodrigo Carvalho
"""
import os
import networkx as nx
import numpy as np
## for openbabel < 3
import openbabel.pybel as pybel
import pysmiles
import torch
from joblib import Parallel, delayed
from pysmiles impor... |
24cbfd64384cdd99a135dfa3627aeaa87ec866c339e518545ae36845f3167543 | Python | 29,263 | 807 | # -*- 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... |
9c334c640f96e7068b2365fef3ce522bb4db889fef4aa5dc5c5f313d894fc40f | Python | 29,274 | 961 | import io
import numpy
import numpy.testing
import skimage.exposure
import skimage.transform
import cellprofiler_core.image
import cellprofiler_core.measurement
import cellprofiler.modules.resize
import cellprofiler_core.object
import cellprofiler_core.pipeline
import cellprofiler_core.workspace
import tests.frontend... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.