sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
de41403e61dae9b003519b8acd6d3ee5d4577cb490c9ebee13ec0b0e86b1fc60 | Python | 10,905 | 335 | '''
'''
# Anwar O. Nunez-Elizalde (Jan, 2016)
#
# Updates:
# Anwar O. Nunez-Elizalde (Apr, 2020)
#
#
from PIL import Image
import numpy as np
from moten.utils import iterator_func
from moten.colorspace import rgb2lab
ANTIALIAS = Image.Resampling.LANCZOS if hasattr(Image, "Resampling") else Image.ANTIALIAS
def vide... |
4a79d5b34ca158725bc668ac882dcce49cfd89c2e44d34a3f859b13c53f9383e | Python | 10,908 | 240 | """
----------------------------------------------------------------------------------------
Copyright (c) 2022 - Michael Fonder, University of Liège (ULiège), Belgium.
This program is free software: you can redistribute it and/or modify it under the terms
of the GNU Affero General Public License as published by the F... |
a98c07af7a5b6754dd50331a72c13826f7c2af318573579665b187703c9c1456 | Python | 10,908 | 260 | """Utilities for working with segmentation data.
Copyright (C) 2021 Ionpath, Inc. All rights reserved."""
import warnings
import numpy as np
import pandas as pd
from scipy import ndimage as ndi
from mibidata import mibi_image as mi, util
def extract_cell_dataframe(label_image, image=None, mode='total',
... |
0e34e5e85c756c5dab7434836c96c038124e05fd31c782d0ca66a38bd3943676 | Python | 10,913 | 227 | """
Copyright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Marius Pachitariu.
"""
import sys, os, argparse
from tifffile import imread, imsave
import numpy as np
from glob import glob
from cellpose import models
from cellpose.io import logger_setup
from cellpose import metrics
from datasets ... |
7ac9a3d8ea9a9e59c414f703eec645c6f85a6e53875bb1fb3ac4aa8752d45af9 | Python | 10,913 | 272 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from logging import Logger
from typing import Any
import numpy.typing as npt
import pandas as pd
from... |
5d2dd604b12388a3b399604a2fac1cc3ecda0ceb08a54e4b8379786fd8ab9464 | Python | 10,918 | 213 | from typing import Union
import numpy as np
import tensorflow as tf
from scipy.ndimage.interpolation import zoom
from . import ModelVisualization, keras
from .utils import get_num_of_steps_allowed, is_mixed_precision, listify, normalize, zoom_factor
from .utils.model_modifiers import ExtractIntermediateLayerForGradca... |
bdb3abafa24d517f770efee407644b4528d9f0a958cddb02d88c6631b58e7826 | Python | 10,919 | 278 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
95ddf71c857ae9f351cf89381068501ed9ba99528a02a3e2202aa9aa283766d2 | Python | 10,921 | 223 | """Exercise the example's reconstruction, without its downloads or motif merging."""
import ast
import json
from pathlib import Path
import h5py as h5
import numpy as np
import pytest
from modiscolite.core import Seqlet, TrackSet
from modiscolite.util import calculate_window_offsets
NOTEBOOK = Path(__file__).resolv... |
5e0b7ecc3d94b17acee14b5c6406bad811807bb640d0bc26f49b8d358d837eed | Python | 10,927 | 286 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
(probabilistic) Count Factorization.
Essentially a probabilistic version of NMF or factor analysis
Created on Tue Apr 13 17:16:22 2021
@author: townesf
"""
import numpy as np
import tensorflow as tf
import tensorflow_probability as tfp
from os import path
from scipy... |
56f0e991ce607fd7535cdc579b21b598f74e37fdc3ad81bf796e2e3aa37df284 | Python | 10,938 | 289 | """
This module provides a pool manager that uses Google App Engine's
`URLFetch Service <https://cloud.google.com/appengine/docs/python/urlfetch>`_.
Example usage::
from pip._vendor.urllib3 import PoolManager
from pip._vendor.urllib3.contrib.appengine import AppEngineManager, is_appengine_sandbox
if is_a... |
82a098118b51ca73aad5d62c8f533523af8befbfdec6264d53299cd3f170334b | Python | 10,940 | 244 | import logging
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.collections import LineCollection
from maxatac.utilities.genome_tools import load_bigwig, chromosome_blacklist_mask
from sklearn import metrics
from sklearn.metrics import precision_recall_curve
from scipy import stats... |
653e58187951dc2872b1a266748666787b2aa1b8ba1e0c9c1176f3ee8d324108 | Python | 10,946 | 361 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
fb5356f3597c90cf68ad0da78bdb5c362cd0cc484e504f416812578d45aa8622 | Python | 10,948 | 308 | """
*****************************
Time-respecting VF2 Algorithm
*****************************
An extension of the VF2 algorithm for time-respecting graph isomorphism
testing in temporal graphs.
A temporal graph is one in which edges contain a datetime attribute,
denoting when interaction occurred between the incident... |
a7824fc5cdbf4498caec3baa0612a5d6b88f8150be35c5e410f0bdc8493fd2a8 | Python | 10,949 | 295 | import warnings
from enum import Enum
import numpy as np
from .pseudo_cell_kmeans import _merge_pseudo_cell
class SamplingStrategyEnum(Enum):
SPARSE: str = "sparse"
DENSE: str = "dense"
class ExamplerAndNeighborhoodSampler:
def __init__(self, data, n_components=30, normalize=False):
self.data ... |
bac0ca7a2e71321715be3467f10f0299308ee47dab9cd127fa086d82a1cc3186 | Python | 10,962 | 342 | # MIT License
#
# Copyright (c) 2019-2024 The PyQMC Developers
#
# 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, m... |
83b6517816fc936a5b926021f55c753dc1cdfbbf88a31fa9fb665a97bf8553d9 | Python | 10,963 | 340 | import json
import math
import os
import sys
from pathlib import Path
from types import SimpleNamespace
import pytest
import torch
from torch.utils.data import Dataset
from spikingjelly.activation_based.distributed.llm import (
EvaluationConfig,
ModelConfig,
SGLangExportStage,
SGLangEngineConfig,
... |
84811a64db84033a76472c6fe37d1e60d04e1274495c5e944cb6327a5d3590b5 | Python | 10,965 | 278 | """
Moody and White algorithm for k-components
"""
from collections import defaultdict
from itertools import combinations
from operator import itemgetter
import networkx as nx
# Define the default maximum flow function.
from networkx.algorithms.flow import edmonds_karp
from networkx.utils import not_implemented_for
... |
c0705e064b785a4bb186fc53ca44b2e61ef39e08ec5838580f7d6282b81ce0c3 | Python | 10,966 | 307 | """Dataloader for Dense-CNN"""
import sys
sys.path.append('../')
from pathlib import Path
import scipy.signal
import scipy
import pickle
import os
import numpy as np
import h5py
import math
import torch
from torch.utils.data import Dataset, DataLoader
from utils import StandardScaler
from constants import INCLUDED_CHAN... |
8e0214b8284d2d428c715b83678276d21326ac239890065bcccf6c812ef4b49e | Python | 10,970 | 239 | import os
import argparse
import json
import warnings
from .train import ckpt_link
def get_args():
"""Parse arguments and set runtime defaults.
"""
parser = argparse.ArgumentParser(
description='Transform field(s) to field(s)')
subparsers = parser.add_subparsers(title='modes', dest='mode', r... |
fd47c60cf6b23a66f6d5c4ccfb7bb9db7e4c743be004f4550317386922c0595a | Python | 10,971 | 317 | """ Module implementing various loss functions
Code taken from -> https://github.com/akanimax/BMSG-GAN
"""
import torch
# =============================================================
# Interface for the losses
# =============================================================
class GANLoss:
""" Base class for all... |
31be3afe75c697ef80ae41bf3cddf27b645654ee88e13314e0411e017b6550cc | Python | 10,976 | 364 | import numpy as np
import scipy as sp
import math
from scipy.linalg import svd
from tqdm import tqdm
# %% functions
def matrix_normalization(A, version=None, c=1, verbose=False):
'''
Args:
A: np.array (n_parcels, n_parcels)
adjacency matrix from structural connectome
version: str
... |
ca7a05b76a02ca25204bff38676b5ea3605f4fc9bbe3e8fe0f530823b4d2f13c | Python | 10,980 | 275 | # %% import
import sys, os, platform
from src.imaging_derivs import DataMatrix
from src.pipelines import ComputeMinimumControlEnergy
from src.plotting import my_reg_plot, my_distpair_plot, my_null_plot, my_bsci_plot
from src.utils import rank_int, get_null_p, mean_over_states
import pandas as pd
import scipy as sp
fro... |
119c5f7ee9c32c8d64d5ce33d62dc03282b4c4f52a8fa7903f835dd2c8626b12 | Python | 10,981 | 287 | """Module for reasoning about structure of and matching hierarchical collections of data."""
from typing import (
Optional,
TYPE_CHECKING,
Union,
)
from galaxy.model import DatasetCollectionElement
if TYPE_CHECKING:
from galaxy.model import (
DatasetCollection,
HistoryDatasetCollectio... |
755e80c6c330d62a568792d0fe4c5faf566cd964588f01cf3a8214984bc86640 | Python | 10,981 | 308 | import abc
import sys
import typing
import numpy as np
from .. import config
from ..config import types
from ..config.types import TypeHandler
from ..exceptions import ConfigurationError
if typing.TYPE_CHECKING: # pragma: nocover
from ..morphologies import Morphology
from ..storage.interfaces import Connect... |
981ebc73a3e20ae5cbb84cad87524ab19c03dd586177251d672e837c0a132b76 | Python | 10,984 | 307 | # MIT License
#
# Copyright (c) 2019-2024 The PyQMC Developers
#
# 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, m... |
19b3c596b46ad79cb50d07ebed720e2a7b896834d9ea18ed8a90d1268e1c982b | Python | 10,985 | 311 | """
Tests for the error formatting module.
Real Datalog and SQUALL errors are produced with the actual parsers and the
formatted output is checked for location, hints and suggestions.
"""
import io
import pytest
from lark import Lark
from lark.exceptions import UnexpectedInput
from nl_expr import exceptions
from nl... |
bfa140aeed3889f49f711d9519bfd4d4f4b8cd12acdc46c2a207d266271b1450 | Python | 10,986 | 303 | """Qwen2.5 0.5B-3B public-recipe correctness runner."""
from __future__ import annotations
import argparse
import hashlib
import json
import math
import os
import sys
import time
from pathlib import Path
from typing import Dict, List, Mapping, Optional
import torch
from benchmark.snn_llm._reporting import write_repo... |
3737d7ee69338fdb6541a30892f19f0b9b80e8c43ad881938b00d2e7564a2915 | Python | 11,002 | 239 | '''
The script to train contraint-baseline
'''
import os
os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
import numpy as np
import torch
torch.set_num_threads(2)
import pickle as pkl
from torch.optim import Adam
from tqdm import tqdm
import math
import argparse
from torch.opti... |
04fcfe0737961b0d57a8822a02ec9cae61cfa147f1d561efdafc4d7fa83cbd08 | Python | 11,004 | 243 | from meld_classifier.experiment import Experiment, save_config, load_config, submit_experiments_array
from meld_classifier.paths import EXPERIMENT_PATH
import numpy as np
import os
import sys
import logging
import csv
import argparse
from meld_classifier.set_basic import exclude_set
os.environ["TF_CPP_MIN_LOG_LEVEL"] ... |
f3ae3ad0d1b8a874fe3b60eb859fc3d98416c964e47f1c96f89319064bdd2542 | Python | 11,013 | 352 | import numpy as np
import scipy as sp
import scipy.io
from scipy.sparse.linalg import eigsh
import utils
import matplotlib.pyplot as plt
import power_law
import time
import matplotlib as mpl
from cycler import cycler
import skimage
from skimage import filters as filt
from skimage import transform
import pywt
mpl.rcPar... |
f5b061f03d94819d1286e3881b6a77107328ca30a75c9e920a20d796f5b8c23c | Python | 11,014 | 183 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'mainwindow.ui',
# licensing of 'mainwindow.ui' applies.
#
# Created: Fri Mar 6 08:12:30 2020
# by: pyside2-uic running on PySide2 5.13.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidg... |
f0cb55c1394c15162b2ef5ba302af8f4e7159246be3b5f5a3f56725d41476dbb | Python | 11,016 | 273 | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from unittest import mock
from ax.adapter.cross_validation import cross_validate
from ax.adapter.registry import Generators
... |
3f0e46ee19146aceb537fbc17eba22df7b9da25d66e0be8785fa08f1bd1d5489 | Python | 11,020 | 258 | #!/usr/bin/env python
#
# Copyright (c) 2019 10x Genomics, Inc. All rights reserved.
#
import martian
import numpy as np
import sys
import os
import h5py as h5
import cellranger.analysis.clustering as cr_clustering
import cellranger.analysis.pca as cr_pca
import cellranger.analysis.lsa as cr_lsa
import cellranger.anal... |
f1681b74e396fc82737d765cbbb0ba091a516af6c3c373805e9c4423412d3974 | Python | 11,027 | 338 | """
End-to-end example on the MNE sample subject
============================================
This example walks through the whole Cere-MEG-Bellum pipeline on the MNE sample
subject:
1. segment the cerebellum,
2. fit the cerebellar atlas mesh to the subject,
3. set up a source space with both cerebral and cerebellar ... |
cc1477d9c2146d545c5144f76efcf6122395ad822b136b60e0fbf70e5e53ed19 | Python | 11,045 | 331 | """Katz centrality."""
import math
import networkx as nx
from networkx.utils import not_implemented_for
__all__ = ["katz_centrality", "katz_centrality_numpy"]
@not_implemented_for("multigraph")
@nx._dispatchable(edge_attrs="weight")
def katz_centrality(
G,
alpha=0.1,
beta=1.0,
max_iter=1000,
to... |
0a891f2b34d4c9569c1c94f5f10b0d4678c96fd48d9f54ad810f416c665b550c | Python | 11,059 | 288 | import argparse
import os
import numpy as np
import math
import itertools
import datetime
import time
import sys
import torchvision.transforms as transforms
from torchvision.utils import save_image
from torch.utils.data import DataLoader
from torchvision import datasets
from torch.autograd import Variable
from model... |
3570e0eb7b85be9ce5662278faa4756808aed959ecf2e3c4341709f9bfcbc77f | Python | 11,062 | 213 | import argparse
from utils import load_architecture, evaluate, ArgsStruct
import torch
import os
import json
from collections import defaultdict
from covid_torch_dataset import CovidDataset, CovidData, DatasetBuilder
from torch.utils.data.dataloader import DataLoader
from train import train
import logging
import shutil... |
40f48be9edc0cfadda96db1314174c0151e67b195baecc7d89b340a0733e91c9 | Python | 11,066 | 257 |
"""
Created on 2020.05.19
@author: Jiahua Rao, Weiming Li, Hui Yang, Jiancong Xie
Code based on:
"""
import copy
import math
import collections
import numpy as np
import torch
from torch import nn
import torch.utils.data as Data
import torch.nn.functional as F
from torch.autograd import Variable
class LayerNorm(... |
e0a38433ee86d5fff1b4f6559822f472f1595d584de0e8caced28dd388605c1b | Python | 11,067 | 280 | """Reusable distribution, import and installed-training checks for CI/releases."""
import argparse
import hashlib
import importlib.util
import json
import os
import shutil
from pathlib import Path
import sys
import tarfile
import zipfile
def _artifacts(wheel, sdist):
expected = sorted(
p.parent.name
... |
d5f098fb17e615606194e9bb9ac6af8652926c446daa087a3826f4f10be1ab5c | Python | 11,071 | 298 | # MIT License
#
# Copyright (c) 2019-2024 The PyQMC Developers
#
# 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, m... |
90e260a832de47938a2e80a75671555b8b331e243d7934aa46e65a708e45e82c | Python | 11,073 | 284 | import os
import time
import math
import random
import numpy as np
import argparse
import torch
import torch.nn as nn
from gnn_data import GNN_DATA
from gnn_model import GIN_Net2
from utils import Metrictor_PPI, print_file
from tensorboardX import SummaryWriter
np.random.seed(1)
torch.manual_seed(1)
torch.cuda.manua... |
e0f8547149997d1440d992e59e45ef5e90c2b54ac8b91d30384f5dcf338d0a82 | Python | 11,073 | 269 | #!/usr/bin/env python
#
# Copyright (c) 2016 10X Genomics, Inc. All rights reserved.
#
from collections import defaultdict
import os
import glob
import martian
import errno
from tenkit import fasta as tk_fasta
from tenkit import samplesheet as tk_sheet
from tenkit import log_subprocess
__MRO__="""
stage MERGE_FASTQS_B... |
25e0680df2010587972de38db212df0b3628f369910f9006d3853bb19298f226 | Python | 11,080 | 275 | import os
import unittest
from test.test_reports import DictTestCase
import numpy as np
from bsb import Configuration, Scaffold, parse_configuration_file
from bsb_test import NumpyTestCase, RandomStorageFixture
from matplotlib import pyplot as plt
from cerebellum.analysis.report import LIST_CT_INFO
from cerebellum.an... |
452c19fbb2018401b2a8a4ee56bd61f359d546031d810857420dd47e8953de93 | Python | 11,080 | 247 | """
Pydantic schemas for AI agent responses and requests.
"""
from enum import Enum
from typing import (
Any,
Optional,
)
from pydantic import (
BaseModel,
Field,
model_validator,
)
class ConfidenceLevel(str, Enum):
"""Confidence levels for agent responses."""
LOW = "low"
MEDIUM = "... |
dc30f1cea233f8767f79670a354335465e3dda7f8c31ce4f06a6caf75e82ff48 | Python | 11,095 | 288 | import pandas as pd
import numpy as np
import pickle
import meld_classifier.distributedCombat_helpers as helpers
#' Distributed ComBat step at each site
#'
#' @param dat A \emph{p x n} matrix (or object coercible by
#' \link[base]{as.matrix} to a numeric matrix) of observations where \emph{p}
#' is the number of f... |
3ccedea415247f403ee365d146fcc80243571d036c5c2a5b0c2944604776262e | Python | 11,097 | 354 | import matplotlib.pyplot as plt # To plot
from scipy.optimize import curve_fit
from pylab import *
import numpy as np
import random
import math
import time
import os
import glob
import copy
def rmsd(x,y):
Nx = len(x)
Ny = len(y)
if Nx!=Ny:
print('WARNING! Nx!=Ny. ... |
77fb8b8802be2417abc3ccd3a31877c16e8a8eb4d912e9782980b66eaefe1a14 | Python | 11,102 | 319 | import math
import os
import torch
import torch.nn.functional as F
from torch import nn
import eeg_util
from eeg_util import DLog
from models.graph_conv_layer import *
def conv_L(in_len, kernel, stride, padding=0):
return int((in_len - kernel + 2 * padding) / stride + 1)
def cal_cnn_outlen(modules, in_len, h... |
57838b1a4d306bc3fbdb4fccd79fd5013358298d4efa25157822eafab1cb3d94 | Python | 11,113 | 278 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
4860f4d4c8a4839d8e4ace3f1a540ad873c2fb38a188d0fc28b1e74f29dc1ec3 | Python | 11,119 | 288 | # coding=utf-8
# Copyright (c) DLM Contributors
import logging
import pathlib
import time
import pandas as pd
from pathlib import Path
import PIL.Image
from dlup_lightning_mil.data.transforms import RotationAndFlipTransform
from dlup_lightning_mil.utils import txt_of_paths_to_list
import torchvision
try:
from d... |
875657fc72d66dc8420a1b913e43bdc730bf10e19708a2b14a2ba7bc8c7bbc36 | Python | 11,120 | 362 | """Private registered operators for FlexSN's generated Triton kernels."""
import contextlib
import weakref
from dataclasses import dataclass
from itertools import count
from threading import Lock
from typing import List
import torch
from ..triton_runtime import register_op, wrap_triton
from .info import _FlexSNInfo
... |
57b9aa2468828d387e06f3ac3cacb636634fa2c3b1b0be9a17f1dff0efdd9105 | Python | 11,128 | 234 | """
SLURM job control via the DRMAA API.
"""
import os
import time
from typing import (
TYPE_CHECKING,
Union,
)
from galaxy import model
from galaxy.jobs.runners.drmaa import DRMAAJobRunner
from galaxy.util import (
commands,
unicodify,
)
from galaxy.util.custom_logging import get_logger
if TYPE_CHEC... |
b30f06045ddd93df9967ae446321865e0ab907bdfc198160683ecdf205ff5529 | Python | 11,146 | 342 | # Test for approximation to k-components algorithm
import pytest
import networkx as nx
from networkx.algorithms.approximation import k_components
from networkx.algorithms.approximation.kcomponents import _AntiGraph, _same
def build_k_number_dict(k_components):
k_num = {}
for k, comps in sorted(k_components.i... |
417b49a290bf0e573d606b45e15bb5fecbc4deccb11c57a2fc015b5184f6ee24 | Python | 11,147 | 300 | """
StarGAN (CelebA)
The dataset can be downloaded from: https://www.dropbox.com/sh/8oqt9vytwxb3s4r/AADIKlz8PR9zr6Y20qbkunrba/Img/img_align_celeba.zip?dl=0
And the annotations: https://www.dropbox.com/sh/8oqt9vytwxb3s4r/AAA8YmAHNNU6BEfWMPMfM6r9a/Anno?dl=0&preview=list_attr_celeba.txt
Instructions on running the script:... |
cfef6c57b204829edad80c691853ade5b9670d024fc7a994e71891719c9c306a | Python | 11,147 | 298 | # MIT License
#
# Copyright (c) 2019-2024 The PyQMC Developers
#
# 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, m... |
f60a9c9ea8b812bae368b92815c225a936a756941d76b5c05cd07c7487d5768b | Python | 11,147 | 229 | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# plt.style.use(['science'])
plt.rcParams["text.usetex"] = False
class Stats():
def __init__(self, Environment, WorkloadModel, Datacenter, Scheduler):
self.env = Environment
self.env.stats = self
self.workload = WorkloadModel
self.datacen... |
8bee4ea564e65358d9c4ee280d4952b082e98631948c576d79506147b8451180 | Python | 11,150 | 319 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 5 11:24:49 2020
@author: amelie
"""
from brian2 import *
from scipy import signal
from cells.RS_FEF import *
from cells.FS_FEF import *
from cells.SI_FEF import *
from cells.VIP_FEF import *
from FEF_visuomotor_tests import *
from FEF_contrast_d... |
596400dace6426c180bcbe571fa3d1bbbcae09a757b97277ad5361c2ec442f3b | Python | 11,159 | 251 | from MDAnalysis.analysis.distances import dist
import MDAnalysis as mda
import numpy as np
import sys
import argparse
#####
#USAGE: python mdanalysis_scripts/distance.py TOPFILE traj out_file sel1 sel2 sel3 sel4 ...
#
#####
parser = argparse.ArgumentParser()
parser.add_argument('--topology', '-top', dest='top_file'... |
703e1fb3a5102cd889d18f8653afa410abe1c38f73a3dcdacb9f4f8dc71ea8f1 | Python | 11,161 | 291 | # Copyright (c) MONAI Consortium
# 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 agreed to in writing, so... |
b5c969119b87610ed3f4bb5f2acd42d4aa0133825f169fcd505cbb617c9b1834 | Python | 11,163 | 258 | # Copyright 2020 The HuggingFace Team. 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 at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... |
d5455ef3416dc1522da70da3d89ccf8f40446b582f5d0eb1e131979ee1c80537 | Python | 11,163 | 291 | from __future__ import print_function, unicode_literals, absolute_import, division
import numpy as np
import warnings
import os
import datetime
from tqdm import tqdm
from zipfile import ZipFile, ZIP_DEFLATED
from scipy.ndimage.morphology import distance_transform_edt, binary_fill_holes
from scipy.ndimage.measurements ... |
eecfaadef499ba84949f0bf6814a9f3d0fe67054d743191edd948e279e4856f5 | Python | 11,170 | 285 | """This file and its contents are licensed under the Apache License 2.0. Please see the included NOTICE for copyright information and LICENSE for a copy of the license."""
import logging
import os
import urllib
import requests
from core.feature_flags import flag_set
from core.utils.common import load_func
from core.u... |
aba9e75b65110147eff2c1078561901bf9e7f7908457fc8a14e92dcf31781857 | Python | 11,173 | 251 | # Copyright (c) MONAI Consortium
# 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 agreed to in writing, so... |
9f7e8fca0f2e3b0fe6142e074db4d9d1930e644b3e315a6616f202e025f8f0df | Python | 11,174 | 320 | """ Module implementing various loss functions
Code taken from -> https://github.com/akanimax/BMSG-GAN
"""
import torch
from torch.nn import functional as F
# =============================================================
# Interface for the losses
# =============================================================
class... |
b2a10786cb48e5b3595791be75d41fa563cbea76677bd8e9833f144e3bfe19b9 | Python | 11,180 | 236 | # Copyright (c) MONAI Consortium
# 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 agreed to in writing, so... |
21226a62758924ac7eb40930d2e6ac596612c303a2824f010de0dd838f55924d | Python | 11,188 | 266 | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from unittest.mock import MagicMock, patch
import numpy as np
import torch
from ax.adapter.torch import TorchAdapter
from ax... |
3726317a1a5949df55b107887a276d5e5a4564a5fc6113b7ddf9c0bb63823c2f | Python | 11,190 | 254 | """The fitted stain reference and the operations that apply it.
Holds either a 3x3 stain matrix (Macenko/Vahadane) or a pair of Ruderman Lab channel
statistics (Reinhard).
"""
from __future__ import annotations
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any, Literal
import numpy as np
from... |
ac68e14c9d29dbf2dc52ef6e021c46966e9861d39961f92bdc87128c88c74314 | Python | 11,192 | 261 | # coding: utf-8
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"... |
9712640077dc459f70591c08352de69fad8a53bacf3f08543730db503361c8ef | Python | 11,194 | 251 | import abc
import numpy as np
import optuna
import torch.nn
import torch.utils.data
import copy
from . import _base_model
class TorchModel(_base_model.BaseModel, abc.ABC):
"""
Parent class based on :obj:`~easypheno.model._base_model.BaseModel` for all PyTorch models to share functionalities.
See :obj:`~e... |
6dae048c22abf54deea70c2868d5b5e2b99ed9b773e2c41e2d5c6c2ba932f917 | Python | 11,200 | 369 | from pathlib import Path
from typing import Optional
import numpy as np
import pandas as pd
from scipy import sparse
from ..utils.nilearn_compat import fetch_files as _fetch_files
StudyID = np.int64
class TfIDf(float):
pass
NS_DATA_URL = "https://github.com/neurosynth/neurosynth-data/raw/master/"
def fetc... |
fdf9c05479e157c6e283f417ce76b6878ea029cbf2ba58ac930012c469a27563 | Python | 11,205 | 302 | import logging
from abc import ABCMeta, abstractmethod
from functools import partial
from typing import (
List,
NamedTuple,
Union,
)
import numpy as np
import scipy.spatial.distance as dist
from sklearn.linear_model import LinearRegression
from divik.core import Centroids, Data
EPS = 1e-10
class Initia... |
2f82f59631d5c50c6341096e74edabea4dd4654ed6018fcde966148c5c757c49 | Python | 11,209 | 314 | import collections
import pytest
import networkx as nx
@pytest.mark.parametrize("f", (nx.is_eulerian, nx.is_semieulerian))
def test_empty_graph_raises(f):
G = nx.Graph()
with pytest.raises(nx.NetworkXPointlessConcept, match="Connectivity is undefined"):
f(G)
class TestIsEulerian:
def test_is_e... |
5e032b7993554f6099ccebb86c8a86746925c70ba9d6c1723a14cebc2fb78c66 | Python | 11,212 | 345 | """The module defines the abstract interface for dealing tool dependency resolution plugins."""
import errno
import os.path
from abc import (
ABCMeta,
abstractmethod,
)
from typing import (
Any,
Dict,
List,
)
import yaml
from galaxy.util import listify
from galaxy.util.dictifiable import Dictifia... |
632c6f1c4b10a7152b8ee26794ff396c506db44c6615a7d399828ba414d11745 | Python | 11,215 | 260 | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from unittest.mock import patch
from ax.analysis.healthcheck.healthcheck_analysis import HealthcheckStatus
from ax.analysis.... |
53260d4e689be9d070b946a743cea0ba3735c93ab75688529b5e89b95ccfde00 | Python | 11,220 | 260 | """
Unit tests of the `ConnectomeGlomerulusGranule` strategy
"""
import unittest
from os.path import abspath, dirname, join
import numpy as np
from bsb import Configuration, ConfigurationError, Scaffold, WorkflowError
from bsb_test import NetworkFixture, NumpyTestCase, RandomStorageFixture
from cerebellum.connectome... |
dc3e4fc49e456d909488ac2a547652d74095f9cc7ad6fb79ffaf359fd01c143e | Python | 11,221 | 293 | import os
import gym
import json
import pickle
import string
import datetime
import argparse
import subprocess
import numpy as np
from time import time, sleep
from numpy import random
from dt import EpsGreedyLeaf, PythonDT, RandomlyInitializedEpsGreedyLeaf
from grammatical_evolution import GrammaticalEvolutionTranslato... |
454f187faf4f87751279c2ffb87af8299c6ef490a1cbf99bf6cf747ee8abec2d | Python | 11,229 | 341 | # -*- coding: utf-8 -*-
"""
Illumination correction toolbox.
The module provides a function to correct illumination/vignetting systematic
variations in intensity.
The intensity image :math:`I(x)` given a flat field :math:`F(x)` and
a background :math:`B(x)` the image is corrected to :math:`C(x)` as:
.. math:
... |
24bd1b659b097b631014beaead7818f36c02030b9c52f86369285864fc692fa5 | Python | 11,240 | 345 | import math
import pytest
import networkx as nx
class TestKatzCentrality:
def test_K5(self):
"""Katz centrality: K5"""
G = nx.complete_graph(5)
alpha = 0.1
b = nx.katz_centrality(G, alpha)
v = math.sqrt(1 / 5.0)
b_answer = dict.fromkeys(G, v)
for n in sort... |
9bc478faab07046221a89a900d58e7491bab73a091e540e46ffdd55e4542bead | Python | 11,245 | 296 |
import numpy as np
import torch
from sklearn.metrics import f1_score
import logging
import yaml
import numpy as np
from tqdm import tqdm
import torch
from graphmae.utils import (
build_args,
create_optimizer,
set_random_seed,
TBLogger,
get_current_lr,
)
from graphmae.datasets.data_util import loa... |
1fb3601d57633370aea4a98b720298f50497aad2db591f72e6314cc644b05170 | Python | 11,252 | 277 | """
Copyright © 2025 Howard Hughes Medical Institute, Authored by Carsen Stringer , Michael Rariden and Marius Pachitariu.
"""
import os, time
import numpy as np
from tqdm import tqdm
from cellpose import utils, models, io, train
from .version import version_str
from cellpose.cli import get_arg_parser
try:
from ce... |
2e1a15149a0dde4bd7e449fe3e63a94f55524e6d3c0c18ae5104b39bc1bac557 | Python | 11,252 | 288 | #tools for defining network architectures and performance statistics
import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras.callbacks import TensorBoard, EarlyStopping, ModelCheckpoint
import datetime
from tensorflow.keras.layers import Dense, Activation, Dropout
from tensorflow.k... |
c25fbafc8a15d0cb825704751a2d14e505d6ffcabc7323f351722a35dc7c6e1d | Python | 11,252 | 228 | """
Copyright (c) 2019 10x Genomics, Inc. All rights reserved.
Estimates total library complexity -- both bulk and on a single cell basis -- using total and unique fragments.
"""
from __future__ import division
import json
from collections import Counter, defaultdict
from complexity import (estimate_library_complexi... |
47cf1798c8808a9a1b065843604728a0467630831d3ecedc04740318c0be34d7 | Python | 11,253 | 347 | """ Script to convert the BBN dataset into CONLL-format.
"""
import re
import os
import xml.etree.ElementTree as ET
from nltk.data import path as nltk_data_path
nltk_data_location = os.getenv('NLTK_DATA_PATH')
if nltk_data_location is not None:
nltk_data_path.append(nltk_data_location)
from nltk.tokenize import ... |
d3bd517215b82854d7f1a14f67d1dcdf770136bf46dd113d2a76c6f2d08397e4 | Python | 11,253 | 387 | # -*- coding: utf-8 -*-
"""
Label and annotation info from Allen Brain Atlas (v2)
Notes:
- The annotation file is assumed to be in './Data/Annotation/annotation_25_right.tif'
but can be set in the constant :const:`DefaultLabeledImageFile`
- The mapping between labels and brain area information is ... |
a76494eea908014f18182fbdd4a730af1bdeff7582625cbde0b355b6536f9359 | Python | 11,256 | 286 | import calendar
import os
import re
import subprocess
import time
from datetime import datetime
import dateutil.parser
from pathlib import Path
import bibtexparser
from bibtexparser.bibdatabase import BibDatabase
from bibtexparser.bparser import BibTexParser
from bibtexparser.bwriter import BibTexWriter
from bibtexpar... |
98fe0573c4be610cf4d926f234cb7f0564bd8420c36488d86fd66709b2fbac91 | Python | 11,257 | 307 | import tensorflow as tf
from tensorflow.contrib.rnn import RNNCell
from tensorflow.contrib.layers.python.layers import layers
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import op_def_registry
from tensorflow.python.framework import ops
from tensorflow.python.framework import tensor... |
a7cf5f9dd6924e620ff655f4ae25c668ea593adf5bd1faed094844f7eadbcc41 | Python | 11,258 | 260 | from .editor_tool import EditorTool
from . import shape_editor
import matplotlib
import inspect
import copy
class ArrowEditor(shape_editor.ShapeEditor):
def __init__(self, arrow_props, **kwargs):
"""
:param arrow_props: dict with arrow parameters as keys and values in pt
... |
ab05c33eaa7662f937e07efbd101fc006bd3b15648d84ad8fbbe0c7f47182eff | Python | 11,262 | 260 | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from collections.abc import Sequence
from logging import Logger
from typing import final
from ax.adapter.base import Adapter... |
04e81d74bd8978248c1741d675cf96079a5aab69716ecb884aa97790768c62dd | Python | 11,268 | 302 | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from unittest.mock import patch
from ax.adapter.registry import Generators
from ax.analysis.graphviz.generation_strategy_gra... |
015aaea591ce8012d48d29b052899ebfea99ecc95600ee55405915b9ae70deb9 | Python | 11,270 | 284 | from abc import abstractmethod
import torch
import numpy as np
try:
import cuhals
use_cuhals = True
except ImportError:
use_cuhals = False
from base import VideoFactorizer
from factor import TensorFactor
def native_update(Beta,
Delta,
Sigma,
nonnegat... |
44ac89f3e66348e72fd5d2d53374d529a20f6a5309bc3e8b0a9bcc215bdb7a8d | Python | 11,272 | 303 | # def pretty_freqs():
# ["KHz", "MHz", "GHz", "THz"]
# {:.2f}"\
# .format(fft_bin_resolution)
# In the electrical domain,
# https://inst.eecs.berkeley.edu/~ee232/sp17/discussions/Discussion%207%20-%20Photonic%20circuit%20simulation.pptx
# in the optical domain, the impedance would just be tha... |
2e189043a4b458af9f4c6b4e9e94b85299b303f1f318b10ed33c1889d253609c | Python | 11,273 | 306 | """Provides algorithms supporting the computation of graph polynomials.
Graph polynomials are polynomial-valued graph invariants that encode a wide
variety of structural information. Examples include the Tutte polynomial,
chromatic polynomial, characteristic polynomial, and matching polynomial. An
extensive treatment ... |
84e21b2decdd824f5801d24fd96a4c20ce78e967808e4371455f082f2d489158 | Python | 11,273 | 286 | import numpy as np
import os
import random
from collections import OrderedDict
import pandas as pd
from sklearn.metrics import f1_score
import cooler
GRAPH_SIZE = 128
IMAGE_SIZE = 64
def cool2txt(cooler_path):
pass
def get_best_threshold(y_score, y_true, thresholds):
largest_f1 = 0
best_thresh = None
... |
f8fb00d2b1d33294165cec7f16c58b8cf3ad776abcd0e8067b50ff0b361585d5 | Python | 11,273 | 295 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from __future__ import annotations
from abc import ABC, abstractmethod
from collections.abc import It... |
2b4b316d6d1cc86fa5f87c1e14384575de2a7dd40c2a7642ee99cb80205f45cd | Python | 11,278 | 340 | import glob
import os
import numpy as np
import torch.utils.data
import logging
import healpy as hp
from orbit_demo.structure import MolecularSurface
from orbit_demo.datasets import ToughC1
import orbit_demo.utils.geometry
logging.getLogger('pyembree').disabled = True
def rotmat(a, b, c, hom_coord=False): # apply t... |
598b710996e782b632bac39c1112c22346ac75f55c7ffbe948ef35e29b1923d9 | Python | 11,278 | 277 | from __future__ import annotations
import abc
import itertools
import typing
from collections import deque
from functools import reduce
import morphio
import numpy as np
from ... import config
from ..._encoding import EncodedLabels
from ...config import types
from .. import Morphology
if typing.TYPE_CHECKING: # pr... |
6577061c546c14a5189138a2e65e6b5c087df70f736c8516f9cc9b2ed5eccf8d | Python | 11,278 | 303 | # MIT License
#
# Copyright (c) 2019-2024 The PyQMC Developers
#
# 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, m... |
088fc5a49c58df1e47e8f907427b61c81cfbe92a17bf3c1db802d54febca2e1e | Python | 11,286 | 271 | from .editor_tool import EditorTool
import matplotlib
from PyQt5 import QtWidgets
import functools
class TextEditor(EditorTool):
def __init__(self, controls_layout, text_input, include_all_labels=False,
font_size=7,**kwargs):
super().__init__( **kwargs)
self.element_type = matplot... |
20e1909dd4d12190b8ed2f16b825247a9d87553617fe2dcebb6c9b4adff80d07 | Python | 11,290 | 250 | # Copyright 2020 DeepMind Technologies Limited.
#
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... |
57de37012831b8c7a2be27d5eb809c4f486f04a3ba9467b6d015c644b763aa22 | Python | 11,299 | 336 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
74e821d5ef2715fab33989da349090ef557e544475273224e7d58a43cc04af1f | Python | 11,299 | 352 | import os
import logging
import numpy as np
import gunpowder as gp
import incasem as fos
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
class TrainingBaselineWithContext:
"""Training pipeline with U-Net for semantic segmentation.
Dataset has to fit in memory.
"""
def __init__(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.