sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
bf3e1d7f9199f0ac6eff54e297aa4512f9b9927f19faa758fb0e7a875ffced9c | Python | 11,962 | 332 | import centriole.cpmorphology
import numpy
import pytest
import six.moves
import cellprofiler_core.image
import cellprofiler_core.measurement
import cellprofiler.modules.displaydataonimage
import cellprofiler_core.object
import cellprofiler_core.pipeline
import cellprofiler_core.workspace
import tests.frontend.modu... |
bea8f77fe4d93dd1ba1a33f6f666249f3855958e0d593c1c37e2539b86a76b6a | Python | 11,967 | 254 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 15 11:18:10 2018
@author: saskiad
Merge all the peak metrics dataframes for all stimuli
"""
import pandas as pd
import numpy as np
import os
from allensdk.core.brain_observatory_cache import BrainObservatoryCache
import core
def merge_all_metrics... |
b67fb4bbc7e7a60c03bcae23b74f773fa9b46423f0090538a237f89e4987acc6 | Python | 12,000 | 342 | # the module for the qt color_mixer plugin
from qtpy import QtCore
from qtpy.QtWidgets import (QWidget, QStackedWidget, QSlider, QGridLayout,
QLabel, QFrame, QComboBox, QRadioButton,
QPushButton)
from .util import ColorMixer
class IntelligentSlider(QWidget):
... |
7f62ca4afc643d93bcde8c82fb1251b31984eb92c2490034a47c6e1a484ebcf4 | Python | 12,001 | 359 | import bisect
import re
import numpy
from ...constants.pipeline import make_cell_struct_dtype
from ...constants.pipeline import PIPELINE
from ...constants.pipeline import IMAGE_PLANE_DESCRIPTOR_VERSION
from ...constants.pipeline import H_PLANE_COUNT
from ...constants.pipeline import H_URL
from ...constants.pipeline i... |
744104a5b30023e8deb72c5348133feb73e2872ea1ebaeffcfc93a46d31ee9a3 | Python | 12,038 | 298 | """
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 subprocess
import numpy
import re
from s... |
0efd1f9c7826b70e61407a20ba830aae5af481bda08360637d31b7f089cb683f | Python | 12,040 | 436 | from __future__ import division
from brian import *
from numpy.fft import rfft,irfft
from scipy.special import erf
from pathlib import Path
from collections import Counter
import matplotlib.pyplot as plt
from circ_stats import *
import random
import os
fig_size = zeros(2,)
fig_size[0] = 12
fig_size[1] = 9
plt.rcParams... |
952afa523e35ae6082ee4705b47189e601bb531ac0019fb7608585650ef77a42 | Python | 12,047 | 341 | """ Coordinate Attention and Variants
Coordinate Attention decomposes channel attention into two 1D feature encoding processes
to capture long-range dependencies with precise positional information. This module includes
the original implementation along with simplified and other variants.
Papers / References:
- Coord... |
e81f4f715762dadfe9933c74b7eb93fc4c0ca37ff4698468db23dad731a17439 | Python | 12,048 | 351 | # -*- coding: utf-8 -*-
"""
pysteps.postprocessing.probmatching
===================================
Methods for matching the probability distribution of two data sets.
.. autosummary::
:toctree: ../generated/
compute_empirical_cdf
nonparam_match_empirical_cdf
pmm_init
pmm_compute
shift_scale
... |
c029ae75cbd0f91daf0b814c9092751ed47d295e9ffc2a9510e274f9fcb9f0be | Python | 12,062 | 342 | """
EnhanceEdges
============
**EnhanceEdges** enhances or identifies edges in an image, which can
improve object identification or other downstream image processing.
This module enhances the edges (gradients - places where pixel
intensities change dramatically) in a grayscale image. All
methods other than Canny prod... |
162af79a5b030019c09b0985b3b2543a9090183a8a5cfb7c5491ea5aee170da3 | Python | 12,096 | 339 | import warnings
import numpy as np
import nengo
from nengo.connection import Connection
from nengo.exceptions import ObsoleteError, ValidationError
from nengo.network import Network
from nengo.node import Node
from nengo.networks.ensemblearray import EnsembleArray
def circconv(a, b, invert_a=False, invert_b=False, a... |
f74b31f4772190f0fe3a742f5e9400b60892405f3d5aca229ecaeba83cfbd209 | Python | 12,101 | 326 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Visualization functions for megsim.
author: Jussi (jnu@iki.fi)
"""
import pathlib
import mne
import numpy as np
import trimesh
from mayavi import mlab
from mne.transforms import _cart_to_sph, _pol_to_cart, apply_trans
from mne.io.constants import FIFF
from scipy.spati... |
7090e0c0ed1dca4afbd3a201e768bd6ed07966a3fce98679bfc14cd339b7edf3 | Python | 12,121 | 285 | # -*- coding: utf-8 -*-
"""
Created on Sat Aug 7 18:23:18 2021
@author: Jing Li, Small steps make changes. dnt_seq@163.com
"""
from sklearn.manifold import TSNE
# from sklearn.datasets import load_iris
from sklearn.decomposition import PCA
import matplotlib.pyplot as plt
import seaborn as sns
import pand... |
61969df86ea21d115ded6441e9ca7b5a0dee0d7dfe5e9fa8e89c08bd09c09f2a | Python | 12,130 | 297 | """
Author: Mingjian He <mh1@stanford.edu>
Testing functions for exact inference signal processing methods in somata/exact_inferences/dp_func.py
"""
import torch
import numpy as np
from codetiming import Timer
from test_load_data import _load_data # type: ignore
def test_forward_backward(show_plot=False):
from... |
c81d52003c24ea3a3b0dfbd1b87aaa871429b552d547c98c54e4257b43219511 | Python | 12,132 | 306 | import numpy as np
import pytest
import copy
from cellprofiler_library.measurements.measurement_model import (
RelationshipBase,
Relationship,
LibraryMeasurements,
R_FIRST_OBJECT_NUMBER,
R_SECOND_OBJECT_NUMBER,
)
class TestRelationshipBase:
def test_init(self):
rb = RelationshipBase("Pa... |
2963be8c5399afa8c066ab6df93d199f8362f476a93d24add96a508aecb2b84e | Python | 12,158 | 305 | """
pysteps.cascade.decomposition
=============================
Methods for decomposing two-dimensional fields into multiple spatial scales and
recomposing the individual scales to obtain the original field.
The methods in this module implement the following interface::
decomposition_xxx(field, bp_filter, **kwar... |
ac3fd86987c6e924e95d60beb2668b6c07ebe6798e81a6bcd290360615c059d1 | Python | 12,161 | 297 |
from conf.conf import *
from Areas.cortex import Cortex
import pretty_midi
import math
import json
class EngineAPI():
'''
'''
def __init__(self):
'''
Constructor
'''
self.cortex = Cortex(configs.neuron_type, configs.dt)
def cortexInit(self):
self.cortex.mu... |
e2b61c68f9346cca0bc1d33c3c3ddecb33522783db5ee970d40548dcf5444821 | Python | 12,170 | 285 | # -*- coding: utf-8 -*-
"""
Created on Sat Aug 7 18:23:18 2021
@author: Jing Li, Small steps make changes. dnt_seq@163.com
"""
from sklearn.manifold import TSNE
# from sklearn.datasets import load_iris
from sklearn.decomposition import PCA
import matplotlib.pyplot as plt
import seaborn as sns
import pand... |
5bba0a7b5b53183bee80bcba2e9b431379a62c67cb1d4ca1839e6e2ebb0c823b | Python | 12,200 | 285 | # -*- coding: utf-8 -*-
"""
Created on Sat Aug 7 18:23:18 2021
@author: Jing Li, Small steps make changes. dnt_seq@163.com
"""
from sklearn.manifold import TSNE
# from sklearn.datasets import load_iris
from sklearn.decomposition import PCA
import matplotlib.pyplot as plt
import seaborn as sns
import pand... |
6a1ce76f95269bd3cb83a74e0745ffd785bc2aff94783c5ad70ea259380be403 | Python | 12,200 | 268 | ## SOURCE: https://github.com/gpleiss/temperature_scaling
# Fundamental libraries
import os
import re
import sys
import time
import glob
import random
import datetime
import warnings
import itertools
import numpy as np
import pandas as pd
import pickle as cp
import seaborn as sns
import multiprocessing
from scipy impo... |
3dd680bf48f3408e602d28bfc68d018be53bd7bed766b3607d1d40656668aa20 | Python | 12,208 | 302 | #!/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
... |
4c8e2733e342db44bc95b3755941566966afa84738fb557b2e1f2cb2a427bce5 | Python | 12,211 | 352 | """
A collection of trained models.
Created by © Rodrigo Carvalho 2021
Mainteined by © Rodrigo Carvalho
"""
import os
import numpy as np
import torch
from joblib import Parallel, delayed
from .smiles import SMILES
def AIkernel(
smiles_list,
index=None,
n_jobs=-1,
batch_size=64,
return_redox=Fa... |
58519196c2c1adac939cfa05d1e8a4af803c61cc9cc38ac77adf37d0d6678a97 | Python | 12,227 | 287 | # -*- coding: utf-8 -*-
"""
Created on Sat Aug 7 18:23:18 2021
@author: Jing Li, Small steps make changes. dnt_seq@163.com
"""
import random
from sklearn.manifold import TSNE
# from sklearn.datasets import load_iris
from sklearn.decomposition import PCA
import matplotlib.pyplot as plt
import seaborn as sns... |
dde444dabec847004a389a189128a494f2540af7271a92e8809c90ce13ad05e3 | Python | 12,233 | 308 | import os
import pandas as pd
import anndata as ad
import numpy as np
import multiprocessing
from joblib import Parallel, delayed
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--path',
default="./data/",
help='Location to save pseudobulks data')
pars... |
91b7f51bd5f879aae981ec6fdfa2594b20bcb2bcf70ef277c9e2820cfb0400a5 | Python | 12,243 | 332 | # JHK
# Python script for generating ED Figure 1
import numpy as np
from netCDF4 import Dataset
import matplotlib.pyplot as plt
from scipy import stats
import os
#==========================================================
# Set main directory
#==========================================================
hdir = '/home/j... |
008da1e3662ff64775e345e89b57e7eeb4a72fc00621a2f21ee4400f21b28a41 | Python | 12,261 | 315 | """ Model creation / weight loading / state_dict helpers
Hacked together by / Copyright 2020 Ross Wightman
"""
import argparse
import logging
import os
import pickle
from typing import Any, Callable, Dict, Optional, Sequence, Union
import torch
try:
import safetensors.torch
_has_safetensors = True
except Im... |
82e89a4da84fa053f2dc9cfd5c35cd51728349a7f7a9c5a0c9a452dd48f92820 | Python | 12,268 | 341 | # -*- 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 shutil
import pygenometracks.plotTracks
ROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)),
"test_data")
... |
dc17d3b81c849a4d1e5f250478310423af1ef533f63d1a2b9cfc3246e6c6a04f | Python | 12,313 | 320 | # Inheritaed from open-mmlab/mmclassification
# Modified by Hangyu LIN
import inspect
import warnings
from functools import partial
from typing import Any, Dict, Optional
from .misc import deprecated_api_warning, is_seq_of
def build_from_cfg(cfg: Dict,
registry: 'Registry',
de... |
ee9ab0f41de659e604fe9d05de1c4c02dabbfd62d6ca6d60982f9f842da061ba | Python | 12,322 | 264 | import numpy
import skimage
import scipy
import centriole
import centriole.propagate
from typing import Annotated, Optional, Union, Tuple
from pydantic import validate_call, ConfigDict, Field
from cellprofiler_library.types import Image2DGrayscale, Image2DGrayscaleMask, ObjectSegmentation, ImageGrayscale, ImageGrayscal... |
0dfb591be5b79f56d16d587d6a7b47beca908e8e9b3f3e6d08aa19ba06c2ac41 | Python | 12,327 | 244 | import re
import torch
import torchtext
import torchtext.data
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from utils.model import CNN
from utils.data import DataIterator
from utils.utils import clean_text
from captum.attr import LayerIntegratedGradients, TokenReferenceBase
from captum.att... |
c8f855d77cf18258283e2ececc44f9237790ee91bb7c4f73111a42764c3d3c93 | Python | 12,333 | 245 | """
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 argparse
import os
import gemmi
import numpy
import j... |
5fbadb311bb2bce1342fdab33568f4e43cd79ac85a7b921b7cf094ba3426510f | Python | 12,334 | 360 | from copy import deepcopy
from enum import Enum
import numpy as np
class B0PostProcess(Enum):
whole = "whole"
batch = "batch"
none = None
class B0Reference(Enum):
first = "first"
last = "last"
linear = "linear"
def pick_b0(b0_mask, b0_strides):
first_b0_idx = b0_mask.argmax()
for ... |
b71c951200a5f660d65f106a947621648ee7030cc301e9508f4300fff1c124de | Python | 12,341 | 357 | import sys
from typing import List, Optional
import torch
# Dice scores and dice losses
def dice(predicted: torch.Tensor, target: torch.Tensor) -> torch.Tensor:
"""
This function computes a dice score between two tensors.
Args:
predicted (torch.Tensor): Predicted value by the network.
tar... |
50bba00d354fc2c42579497799742b843db0988234cf02f933b24fdf9fd3fbab | Python | 12,349 | 358 | import datetime
import argparse
import numpy as np
import pandas as pd
import itertools
import torch
from pytorch_lightning import Trainer
from pytorch_lightning.loggers import TensorBoardLogger
from pytorch_lightning.callbacks import LearningRateMonitor, ModelCheckpoint
from rdkit.Chem import AllChem
from rdkit impor... |
6bc825368f2e956a1db9ceae0c7527fe8c86b6ceb5a4d866f7e2b5d54b1e45d4 | Python | 12,363 | 364 | import logging
import os
import re
import shutil
import sys
import tempfile
import urllib.request
from urllib.parse import parse_qs, unquote, urlparse
from urllib.request import urlopen
import boto3
import numpy
import importlib.resources
import scipy.io
# TODO: python update - this is needed for python < 3.10 only,
... |
9b59f78b7760216d5c88088ad69af53ce9f4338cf4a950220f395cbb97e855e3 | Python | 12,364 | 326 | """Tests for inference."""
import json
from typing import Any, Optional, Type
import numpy as np
import pytest
from scipy import sparse
from scipy.special import logit # pylint: disable=no-name-in-module
from ..compat import import_cupy
from ..core import Booster, DMatrix, ExtMemQuantileDMatrix, QuantileDMatrix
fro... |
9bbe58e84a473c85e5c4a908952ad6542cb6c2331db099907783a89e2f599e1b | Python | 12,390 | 291 | # -*- coding: utf-8 -*-
"""
Created on Sat Aug 7 18:23:18 2021
@author: Jing Li, Small steps make changes. dnt_seq@163.com
"""
import random
from sklearn.manifold import TSNE
# from sklearn.datasets import load_iris
from sklearn.decomposition import PCA
import matplotlib.pyplot as plt
import seaborn as sns... |
6d49734d4fad5095e619045f864e8b7ef4575dadb2ff099874a115f6fd25f772 | Python | 12,416 | 213 | from typing import Optional, Annotated, List, Tuple, Union
from pydantic import BaseModel, validate_call, ConfigDict, Field
import numpy
import scipy.ndimage
from cellprofiler_library.types import ObjectSegmentation, ObjectSegmentationIJV
from cellprofiler_library.functions.segmentation import relate_children
from cel... |
56cc11407bb613305278d9666505d8efd04b696435e92d1d2465d63f54cf9dad | Python | 12,418 | 345 | # coding=utf-8
"""namesubscriber.py - implements a combobox with extra information
"""
import platform
import wx
def align_twosided_items(
parent, items, min_spacing=8, left_texts=None, right_texts=None
):
"""Find spacing for a list of pairs of text such that the left texts are
left justified and the ri... |
6c0623406067c937626816e2245b0f3deb55210cd58e65fb1e8e61ca4421aaa4 | Python | 12,439 | 227 | """
Makes clean ratemaps for any session/combination of sessions.
@author: bartulem
"""
import os
import re
import sys
import numpy as np
import scipy.io as sio
import matplotlib.pyplot as plt
# data[0, :] = xvals (bin centers)
# data[1, :] = raw rate map (ratemap / no smoothing)
# data[2, :] = occupancy (occupancy ... |
0508a1b103c8956c382de4b6f512c9a74c366e80b3bebc3ecdcdf09000ca5a87 | Python | 12,443 | 314 | from typing import Tuple, Union
import numpy as np
import torch
from skimage.color import rgb2hed, hed2rgb
from torchio.transforms.augmentation import RandomTransform
from torchio.transforms import IntensityTransform
from torchio import Subject
def hed_transform(parameters):
return RandomHEDTransform(
hae... |
87528db4f5bf4d8c50efbc4cb151a4ff79c650f6a445d25dfd91f22027813c96 | Python | 12,444 | 314 | import torch
from torch import nn
from torch.nn import functional as F
import dgl
import dgl.function as fn
from dgl.nn.pytorch import WeightAndSum
from edgesoftmax import edge_softmax
def expand_as_pair(input_):
if isinstance(input_, tuple):
return input_
else:
return input_, input_
clas... |
378e47c6908138d0ad3fa80e443853053c7fbf6013de661d17dbc9482af38941 | Python | 12,446 | 184 | #### Master Script 06d: Compile performance results from sensitivity analysis to calculate confidence intervals of dynamic all-predictor-based models ####
#
# Shubhayu Bhattacharyay
# University of Cambridge
# email address: sb2406@cam.ac.uk
#
### Contents:
# I. Initialisation
# II. Compile and save bootstrapped sensit... |
689fce96e24a09f3848063eb7f3eac615caacc5faa2af46529dd5467b9c3db56 | Python | 12,446 | 303 | import io
import sys
import zipfile
import cellprofiler_core.constants.modules
import cellprofiler_core.constants.reader
from cellprofiler_core.utilities.core import plugins
class TestPlugins:
def test_plugin_list(self, tmp_path):
(tmp_path / "foo.py").write_text("")
(tmp_path / "_bar.py").write_... |
6f123854be23d015b8fd83d5a6c98d10d8cc5c71122e45f188855143cba0dd55 | Python | 12,456 | 322 | import argparse
from pyliftover import LiftOver
import os
from bs4 import BeautifulSoup as bs
from selenium import webdriver
import pandas as pd
from pathlib import Path
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import Select, WebDriverWait
from selenium.webdriver.support import exp... |
29f07d7edff86216a796458a115c6d2dda4c6fd95133d3de9c897adcf8b5a91d | Python | 12,473 | 370 | # 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... |
d00c742ca2335580fa774a3b5fca8d4c601062ad8bf24a6dc4fa6d0a5912af1f | Python | 12,479 | 304 | import numpy
from numpy.typing import NDArray
from typing import Optional, List, Sequence, Annotated, Union, Tuple, Any
from pydantic import BaseModel, Field, validate_call, ConfigDict
from cellprofiler_library.types import ImageGrayscale, ImageGrayscaleMask
from cellprofiler_library.measurements.measurement_model impo... |
01f6d3c1c2d571356184e7e3c2a90799af91bd72a4b18e53f8af47263e6568e7 | Python | 12,484 | 331 | """
This file is subject to the terms and conditions defined in
file 'LICENCE', which is part of this source code package.
Author: Leo Guignard (leo.guignard...@AT@...univ-amu.fr)
"""
import json
from sc3D import SpatialOmicArray
from qtpy.QtWidgets import QWidget, QVBoxLayout, QTabWidget, QPushButton
from magicgui im... |
2deaeaafb3a924bbf31134402037a55d78c5c5088069fb4fe3861390d3ddb543 | Python | 12,499 | 197 | import argparse
import os
from util import util
import torch
import models
import data
import sys
class BaseOptions():
"""This class defines options used during both training and test time.
It also implements several helper functions such as parsing, printing, and saving the options.
It also gathers addit... |
e7aec4b5841cd7168bbfc22f474378741f087c4337947274a5b4f7477c324ca8 | Python | 12,517 | 270 | # -*- coding: utf-8 -*-
"""
pysteps.utils.interface
=======================
Interface for the utils module.
.. autosummary::
:toctree: ../generated/
get_method
"""
from . import arrays
from . import cleansing
from . import conversion
from . import dimension
from . import fft
from . import images
from . impo... |
5f55c84d97c944185468657302fc40944f3d996248a41c4c20e4946127344b00 | Python | 12,523 | 228 | import os
import time
import numpy as np
import tensorflow as tf
from collections import defaultdict
from model.deeplab_v3 import DeepLabV3
from model.net_frame import NetFrame
class SegModel(NetFrame):
"""Segmentation network base on DeepLab v3
"""
def __init__(self, cfg, data, mode):
super(Se... |
1eaf54e2b71c48a56da3b1a26d4d24ca9a84c5f6f331e15b781b25328309e302 | Python | 12,544 | 286 | # TODO Sep 08 version
import numpy as np
import os
import sys
import ntpath
import time
from . import util, html
from subprocess import Popen, PIPE
from PIL import Image
import torchvision
import datetime
import matplotlib.pyplot as plt
# plt.switch_backend('agg')
from mpl_toolkits.mplot3d import Axes3D
# import matpl... |
ab7091bc9bbf6cbdf63ab5add3a21a6de036b511b1d202affa6a26cc607e710e | Python | 12,546 | 348 | import sys
import numpy as np
from .alphabet import Alphabet
import re
NULLKEY = "-null-"
# normalize number to 0
def normalize_word(word):
new_word = ""
for char in word:
if char.isdigit():
new_word += '0'
else:
new_word += char
return new_word
# transform string t... |
01bbd8022efeadacee4e43a816df52f664fbb33a84fa3d8e0b39236a34500a03 | Python | 12,552 | 363 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created in 2022
@author: Nikolai M Chapochnikov
files used:
data_i = 4
dataset_{D}D_{n_clusters}clusters.npy
dataset{data_i}/whiteNNC_Y_K{K}_rho{rho}.npy
dataset{data_i}/whiteNNC_Z_K{K}_rho{rho}.npy
FROM: olf_circ_noM-offline_sims.py
"""
# %%
# ###################... |
53b43d7160029b7562b73e0505cdae7151d24f8599d5177e707cd3376e869056 | Python | 12,554 | 328 | import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader, Dataset, TensorDataset
import numpy as np
import os
from matplotlib import pyplot as plt
from matplotlib.patches import Rectangle
import torch.nn.functional as F
import pandas as pd
from pathlib import Path
from tqdm... |
0553807d36faae1940c0b1424dd3c5fe906f00a3c86259fe12aa8ba2e4c2cce3 | Python | 12,569 | 216 | #### Master Script 04f: Compile testing set performance results to calculate confidence intervals of dynamic all-predictor-based models ####
#
# Shubhayu Bhattacharyay
# University of Cambridge
# email address: sb2406@cam.ac.uk
#
### Contents:
# I. Initialisation
# II. Compile and save bootstrapped testing set performa... |
59542592ef01d4c57ce73ae06d6d3d0aee902526ac5822154450a374caae3f8d | Python | 12,582 | 271 | """General-purpose test script for image-to-image translation.
Once you have trained your model with train.py, you can use this script to test the model.
It will load a saved model from --checkpoints_dir and save the results to --results_dir.
It first creates model and dataset given the option. It will hard-code some... |
1a210a7c0c2d38a4811db2066b1ca06ac0f7ed3473b36aba100e47048ab1aace | Python | 12,588 | 296 | #!/usr/bin/env python3
"""
Projects a result (or atlas) in nifti space to a surface and subcortical masks.
Usage:
ciftify_vol_result [options] <subject> <vol.nii.gz> <output.dscalar.nii>
Arguments:
<subject> The subject ID for the surfaces to project to.
<vol.nii.gz> Nifty volume to p... |
a54e721c70e562de620080507a85d7332660860f98813da0cdf549f99a9115da | Python | 12,602 | 319 | """Prepare Koussounadis2014 regression data from the original GEO sources."""
from __future__ import annotations
import argparse
import csv
import gzip
import hashlib
import json
import os
import shutil
import subprocess
import sys
import tempfile
import zlib
from datetime import UTC, datetime
from pathlib import Pat... |
b9740fd345af2f8ee7a3680445d3408af344d754f65cd0fce6ce453dc8d75a01 | Python | 12,612 | 395 | # coding: utf-8
"""
Optical flow methods convergence
================================
In this example we test the convergence of the optical flow methods available in
pysteps using idealized motion fields.
To test the convergence, using an example precipitation field we will:
- Read precipitation field from a file
... |
9d7ea255faa5b14041b7b9752e4e74b1a088eb740bfbcdf3928cc3a233756658 | Python | 12,617 | 445 | #!/usr/bin/env python3
import os
from itertools import combinations
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from baycomp import two_on_single
from tvgraphs.prediction.scoring_utils import avg_cv_scores
from etspredict.prediction.scoring_ut... |
745193bd3e888d6030ca6ebaf11afb722c3ea18bd07e7f001e7e005c668c96a2 | Python | 12,629 | 316 | # -*- coding: utf-8 -*-
"""
Ensemble-based Blending
=======================
This tutorial demonstrates how to construct a blended rainfall forecast by combining
an ensemble nowcast with an ensemble Numerical Weather Prediction (NWP) forecast.
The method follows the Reduced-Space Ensemble Kalman Filter approach describ... |
d665394a15c1af3154bdde176cdd89e5ddca803eb156e3da353b3c84c3cbd6d2 | Python | 12,640 | 273 | #!/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
... |
f12d3c931664eb9104fcedc7df7edae0558e34fb18e3dc9d72e55f6601716981 | Python | 12,641 | 334 | # -*- 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... |
4d5cbb37d823aa827809175a6a6231a76eb4ff4d6cf4f6b0458a33e61ea40c5d | Python | 12,643 | 263 | """
Defines spiking profile: regular (RS) or fast (FS) spiking.
@author: bartulem
"""
import os
import sys
import json
import operator
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from tqdm import tqdm
from sklearn.cluster import KMeans
from collections import Counter
... |
27f3bde7b44cde8130cd51b242e4a719a0e05bff6d435ceba35b1849ffc8d173 | Python | 12,654 | 358 | import numpy as np
import torch
import random
import cv2
import numbers
import functional as F
import math
from PIL import Image
class Scale(object):
def __init__(self, wi, he):
self.w = wi
self.h = he
def __call__(self, image, label):
# bilinear interpolation for RGB image
im... |
feb8a9cd623b8e705ea41fd79a2745e9f94b17cbee6f322a2083b55a6a5bc7bc | Python | 12,694 | 311 | # -*- coding: utf-8 -*-
"""
Created on Sat Aug 7 18:23:18 2021
@author: Jing Li, Small steps make changes. dnt_seq@163.com
"""
from sklearn.manifold import TSNE
# from sklearn.datasets import load_iris
from sklearn.decomposition import PCA
import matplotlib.pyplot as plt
import seaborn as sns
import pand... |
4818a411889d3546f896dbe480a8da24d5c6a217dc74fd41898ab41df84d5288 | Python | 12,705 | 296 | # 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... |
a60d80e4cd1a05e72b2a97be0544863f919dca882345b1f63c8bf8458e9d8fda | Python | 12,707 | 286 | """ Checkpoint Saver
Track top-n training checkpoints and maintain recovery checkpoints on specified intervals.
Hacked together by / Copyright 2020 Ross Wightman
"""
import glob
import logging
import operator
import os
import shutil
import torch
from .model import unwrap_model, get_state_dict
_logger = logging.g... |
b5fc7345a7b102d2a58cea25368c2911043b828669447f2ac6cdd2d9d3e0a63a | Python | 12,715 | 269 | """
Author: Amanda Beck <ambeck@mit.edu>
Mingjian He <mh1@stanford.edu>
"""
from .helper_functions import (
np, initialize_newosc, plot_innovations,
get_innovations, get_knee, aic_calc, fit_ar
)
from ..basic_models import OscillatorModel as Osc
from .decomp_osc import DecomposedOscillatorModel
from... |
411e64a4dc9c0d5e51e202d328fb6dfcecaa24371ba1692f2af387b4c24b8879 | Python | 12,718 | 307 | """
Adapted from https://github.com/uzh-rpg/DSEC/blob/main/scripts/dataset/sequence.py
"""
from pathlib import Path
import weakref
import cv2
import h5py
import numpy as np
import torch
import torch.nn.functional as f
from torch.utils.data import Dataset
import torchvision.transforms as transforms
from PIL import Imag... |
44c5d7363a3ca49d38886a9d9517ecda041354a8157c289f17355a5c42543ca0 | Python | 12,758 | 289 | """
Performs model selection.
@author: JingyiGF
"""
from .family import *
from .cross_validation import *
class ForwardSelection(object):
def __init__(self, family='bernoulli', models=None, kappa=2., theta=1., tik_tau=None, group=None,
nfold=10, fold_method='sublock', n_repeat=None, alpha=1, reg... |
fbcc8838824212248787ca1b462f69caaf851f3092009c74dd0ab85761bcb435 | Python | 12,766 | 235 | import argparse
import os
import random
import time
import numpy as np
import math
import torch
from torch.utils.data import DataLoader
from dataloader import DataGenerator
import logging
import datetime
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from pytorch_wavelets import DWT1DForward, D... |
46a0c8662539b8c535d49fcb53f0cc5b2ef29495ec14bf0e7ec454bd84f48655 | Python | 12,781 | 306 | import collections
import itertools
import logging
import numpy as np
import scyjava
from ..utilities.image import is_file_url
from ..utilities.java import jimport
from ..constants.image import MD_SIZE_S, MD_SIZE_C, MD_SIZE_Z, MD_SIZE_T, MD_SIZE_Y, MD_SIZE_X, \
BIOFORMATS_IMAGE_EXTENSIONS
from ..reader import R... |
4785ba4cf83b094583379eede332bac2a16877162a6501c81b956e9631952716 | Python | 12,788 | 351 | # Most of the part of this script has been taken from https://github.com/vsitzmann/siren/blob/master/modules.py
import torch
from torch import nn
from torchmeta.modules import (MetaModule, MetaSequential)
from torchmeta.modules.utils import get_subdict
import numpy as np
from collections import OrderedDict
import mat... |
1061351f00cf6cd5ac609656c6ba412d20c5af4b8f38991305790d9e76c0a8ce | Python | 12,791 | 373 | from __future__ import absolute_import
from __future__ import print_function
import numpy as np
from ._lapjv import reduction_transfer
from ._lapjv import augmenting_row_reduction
from ._lapjv import augment
def lapjv(i, j, costs, wants_dual_variables=False, augmenting_row_reductions=2):
"""Sparse linear assignm... |
89c86c7667212e582c9a2cf1f0d073a7b0da4d22e4828471d9149d12372a0a24 | Python | 12,795 | 301 | import logging
import queue
import threading
import zmq
import cellprofiler_core.utilities.zmq
from cellprofiler_core.utilities.zmq._analysis_context import AnalysisContext
from .communicable import Communicable
from .communicable.reply.upstream_exit import BoundaryExited
from .communicable.request import AnalysisReq... |
bf2deb28b5a7754188c1b6126f74a7fb11aa5affef53d372e212d7ef471fd9cd | Python | 12,803 | 337 | """Delimited-text version 1 decoding."""
from __future__ import annotations
import bz2
import gzip
import math
import re
from array import array
from collections.abc import Mapping, Sequence
from pathlib import Path
from typing import Any, TextIO, cast
import numpy as np
import numpy.typing as npt
import pandas as p... |
e88f648aa3c5af2497ed0ed5d7ca59ec88d1745bfd1c2403f8eabd15d130a973 | Python | 12,843 | 245 | # -*- coding: utf-8 -*-
"""
@author: bartulem (code origin: Allen Institute GitHub repository)
Estimate surface channel from LFP data.
To acquire an estimate of the surface channel (assuming a part of the probe was not
in the brain), this script relies on the LFP data obtained from the same recording
session as the... |
57444e32783a2ee0d8797b8aecabdd84cbedfb19239f920f39036c7cd45a5ef2 | Python | 12,855 | 346 | import json
from ._setting import Setting
class FileCollectionDisplay(Setting):
"""A setting to be used to display directories and their files
The FileCollectionDisplay shows directory trees with mechanisms to
communicate directory additions and deletions to its parent module.
The central data stru... |
c35af093b07f453cc97707cfebf664fd81c14ce4335d70072847b1ff711cf34a | Python | 12,858 | 366 | from abc import ABC, abstractmethod
from functools import partial
import numpy as np
import bayesflow as bf
from scipy.stats import beta
from diffusion.likelihoods import sample_static_diffusion_process, sample_stationary_diffusion_process, sample_random_walk_diffusion_process, sample_regime_switching_diffusion_proces... |
e8492810dcaec2ec25cf62c06142a033f875b1836901ed58d8fa32defd491399 | Python | 12,859 | 261 | import sys
import types
import pytest
from timm.models import (
generate_default_cfgs, get_arch_pretrained_cfgs, get_deprecated_models, get_pretrained_cfg, is_model_in_modules,
is_model_pretrained, list_models, list_modules, list_pretrained, model_entrypoint, parse_model_name,
register_model, register_mod... |
87b83afdbd1525ebf5398d63b02a95adf6231701bd1fa3d2b58e8f6c7ec79901 | Python | 12,862 | 404 | """
File name: helper_functions.py
Author: Esra Zihni
Date created: 15.02.2018
This file contains helper functions for other scripts.
"""
import catboost as cat
import innvestigate
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
import shap
from keras import activations
fr... |
b8ec57169175bf9dc046b24315820185d6950e86e858a7c1d851e99c6a46de52 | Python | 12,924 | 393 | import argparse
import sys
from pymatgen.core import Composition
from pymatgen.io.cif import CifParser
import re
import numpy as np
import nevergrad as ng
from pyxtal import pyxtal
from pyxtal.lattice import Lattice
parser = argparse.ArgumentParser(
description=(
"Crystal Structure pred... |
25098b9f92cb4a1ea3c4af84e4dbc95cfdab5616f5907ffed413489c295d37f2 | Python | 12,935 | 437 | # -*- 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... |
fc798c9282901f535c6ee6f9cab1002e8a693c6a446e029ae9e87c6a77a0d789 | Python | 12,948 | 448 | #!/usr/bin/env python3
import os
from itertools import combinations
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from baycomp import two_on_single
from tvgraphs.prediction.scoring_utils import avg_cv_scores
from etspredict.prediction.scoring_utils imp... |
968e8fdf38af0b8a94fb93d8f305f43f9bad1aed602340e1cbc83505d15bd1dd | Python | 12,952 | 371 | #!/usr/bin/env python3
#
# Copyright (c) 2018-2021 Leonardo Taccari
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# ... |
57690d7ac264b24c476fdac101f0a3ab6fdd646f7bf3380e9f34aeeeb7fd64c5 | Python | 12,955 | 241 | import numpy as np
import torch
import torch.nn as nn
from tests.utils import reset_seed, reset_layers, run_forward_pass
from networks.dfc_network import DFCNetwork
from networks.dfc_network_single_phase import DFCNetworkSinglePhase
eps = 1e-20
torch.set_default_dtype(torch.float64)
def test_init_feedback_layers_wei... |
e334c029f5bd98fc88dcf3331a1ee6f92aa06aea97ec8d59fd59f6724cefd21b | Python | 12,962 | 448 | #!/usr/bin/python3
import numpy as np
import logging
fmt_float = '%.8G'
fmt_int = '%i'
def file_read_coo(f, **ka):
"""Read COO/mtx files"""
import scipy
import scipy.io
logging.debug('Start reading file ' + f)
ans = scipy.io.mmread(f, **ka)
logging.debug('Finish reading file ' + f)
return ans
def file_read... |
90ae99062aed38288841dc8ef517df46258fad9aeb76bc7f5f1a77f0419f78df | Python | 12,964 | 346 | import wx
from rapidfuzz.utils import default_process
from rapidfuzz.process import extract
from rapidfuzz.distance import DamerauLevenshtein
from cellprofiler_core.utilities.core.modules import (
get_module_names,
instantiate_module,
get_module_class,
)
from cellprofiler_core.utilities.core.plugins import... |
0f5abcb90c2ab638c50a0858ceef9def6e864c7f73ef8b787574262029478ddc | Python | 12,986 | 393 | import json
import os
import shutil
from collections import OrderedDict
from pathlib import Path
import click
import pandas as pd
from fhir.resources.questionnaire import Questionnaire
from . import __version__, get_logger, set_logger_level
from .migrate import migrate2newschema
from .output2redcap import parse_surve... |
0456d365dabb957ac0de614ec9a6e552eb67ccab5be66992673642188c06e473 | Python | 12,993 | 307 | import numpy as np
import warnings
from copy import deepcopy
from itertools import combinations
from torchvision.transforms import Compose
from torchmeta.utils.data.task import ConcatTask
from torchmeta.transforms import FixedCategory, Categorical, DefaultTargetTransform
from torchmeta.transforms.utils import wrap_tr... |
48abdaddde68ee03982f359ac148db710e1735089cd4c98f4f7d197b849c3e71 | Python | 13,000 | 391 | import csv
import logging
from pathlib import Path
import requests
from .context_url import CONTEXTFILE_URL
from .jsonldutils import _is_url, load_file
from .models import Activity, Item, Protocol, ResponseOption
from .redcap_mappings import REDCAP_COLUMN_MAP, REDCAP_COLUMN_MAP_REVERSE
from .utils import start_server... |
1e20640e1b5745655b824cdb84558b2afd5b9b4330d1f804264587e1d738733a | Python | 13,017 | 334 | import pytest
import torch
import torch.nn as nn
from timm.task import (
ClassificationTask, FeatureDistillationTask, LogitDistillationTask, TokenDistillationTask,
DistillationTeacher,
load_task_ema_checkpoint, resume_task_checkpoint,
)
from timm.optim import create_optimizer_v2
from timm.utils import Chec... |
669b9672ee821b952e768a8a2ebf4e2470266324ee53806c7df72b2c53cc510c | Python | 13,022 | 240 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 4 12:16:50 2018
@author: saskiad
"""
import pandas as pd
import seaborn as sns
import numpy as np
import matplotlib.pyplot as plt
import core, os
def example_code():
cres
areas = ['VISp','VISl','VISal','VISpm','VISam','VISrl']
depths ... |
412add0174ae30faf7d12712045e4d5300e5e067e45dc1a031f14eea1518060c | Python | 13,031 | 383 | """
InvertForPrinting
=================
**InvertForPrinting** inverts fluorescent images into
brightfield-looking images for printing.
This module turns a single or multi-channel immunofluorescent-stained
image into an image that resembles a brightfield image stained with
similarly colored stains, which generally pri... |
db87a89cf24eae6337b36ea952e5e7cad166b81f59314c696ae165621aa031a7 | Python | 13,049 | 291 | import torch
import itertools
import numpy as np
from .base_model import BaseModel
from . import networks
class AxialToLateralGANDryopsModel(BaseModel):
"""
NOTE: This is the Apollo model for an ablation case with no backward path.
G_A: original -> isotropic
D_A_axial: original_XY <-> isotropic_axial... |
e54e626734650fe1ff5c5d3f9a71ac4cfeb46da68d2300e0380455e85c235ccf | Python | 13,074 | 359 | import torch
# from fastai.tabular import LabelLists, TabularList, is_pathlike, defaults
# from fastai.basic_data import DatasetType
# from fastai.basic_train import load_callback
from fastai.tabular.all import load_learner, accuracy
import pickle
import numpy as np
import pandas as pd
from pathlib import Path
from ... |
0d47e46503bc089f77e2eb372c070de52d9d8300ca1fdfe6af50d8067009cfb3 | Python | 13,082 | 433 | import numpy as np
from . import _colormixer
from . import _histograms
import threading
from ...util import img_as_ubyte
# utilities to make life easier for plugin writers.
import multiprocessing
CPU_COUNT = multiprocessing.cpu_count()
class GuiLockError(Exception):
def __init__(self, msg):
self.msg = m... |
961e9a6a19ad4623c2e6f658928b5533c973bcaad8ad0263045392cf2e4957c2 | Python | 13,083 | 225 | #### Master Script 04d: Compile validation set performance results for configuration dropout of dynamic all-predictor-based models ####
#
# Shubhayu Bhattacharyay
# University of Cambridge
# email address: sb2406@cam.ac.uk
#
### Contents:
# I. Initialisation
# II. Compile and save bootstrapped validation set performanc... |
73081ceebd9788d4a46f3f65843b3135c02f09c83f13a1481e611926ad51bf82 | Python | 13,087 | 385 | """
OverlayOutlines
===============
**OverlayOutlines** places outlines of objects over a desired image.
This module places outlines of objects on any desired image (grayscale, color, or blank).
The resulting image can be saved using the **SaveImages** module. Overlaying multiple objects will overwrite previous outli... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.