sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
fa382747032c875f6af587938615a8330eb4fb07f04ccc54e33fcfd7e7272e82
Python
25,020
351
import argparse ##-------------------------------------------------------------------------------------------------------------------## # Where to store the data / results / models / plots store = "./store" ##------------------------------------------------------------------------------------------------------------...
9330e87f35a37f21e6a47bff9add9e1ec65fdd42ec0a15dd2480a9564dc6b3d5
Python
25,038
620
""" Object Store plugin for the Integrated Rule-Oriented Data System (iRODS) """ import logging import os import shutil import ssl import threading from datetime import datetime from pathlib import Path try: import irods import irods.keywords as kw from irods.exception import ( CollectionDoesNotEx...
ac682bc78eb69cf2fe2b4d5fae1e370ad0a8f89cd71120b9c8eebb7756c87a9e
Python
25,048
547
# 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...
5195b4b6a8d4132c95723910b27d540fa946897a4920d87bd7b2d6edb02adf18
Python
25,082
644
#Tools for mesh-based operations #Smoothing, import nibabel as nb import numpy as np import subprocess import os import potpourri3d as pp3d from meld_classifier.paths import BASE_PATH, MELD_PARAMS_PATH import matplotlib.pyplot as plt # import paths as paths def find_nearest_multi(array, value): new_array = np.arr...
6bb2b318d9d54038e9ed497aab607aae458d8f29345ad857631e6a6ceaedab04
Python
25,089
604
"""Bounded user-action provenance graph for Galaxy histories. For each selected top-level history item, resolves its producing tool_request and that tool_request's declared inputs from the submission payload, one hop out from the seed. """ import json import logging from typing import ( Literal, Optional, ...
e85d49353d6930432df82dbb1f73ec759605fb9dd2ac932b1da6a443ca43ecd8
Python
25,098
662
""" Minimum cost flow algorithms on directed connected graphs. """ __all__ = ["network_simplex"] from itertools import chain, islice, repeat from math import ceil, sqrt import networkx as nx from networkx.utils import not_implemented_for class _DataEssentialsAndFunctions: def __init__( self, G, multigr...
d98cb7495bba7e55b65eba24e7a973c34df8730ac470a844e709bba1fc3239bb
Python
25,104
724
import itertools import os import shutil import tempfile import unittest from copy import copy import numpy as np from bsb import MPI, Scaffold, get_simulation_adapter, read_results from bsb_test import ( ConfigFixture, MorphologiesFixture, NetworkFixture, NumpyTestCase, RandomStorageFixture, ) fro...
9afd2971993e510d7a96ba0bf4460ab82a065af902f114cc8fb6e67310ef4c85
Python
25,111
737
import atexit import os.path import shutil import warnings import numpy as np import pytest from numpy.testing import assert_array_equal from zarr._storage.store import DEFAULT_ZARR_VERSION from zarr.codecs import Zlib from zarr.core import Array from zarr.creation import (array, create, empty, empty_like, full, full...
8737844cf3801d0dd9aa78417167afe6aa8dba7e1a41667df910608c1620cce4
Python
25,166
646
""" The interactive REPL driven from a web page. :class:`WebRepl` runs what a page sends as the REPL runs what is typed at its prompt, with the same commands and the same output: each submission's output is rendered as it is on a terminal, by ``rich``, and returned as HTML for the page to show. It is what the in-brows...
f404414697a7473986f2fa5701f91c6e6ee9b9615b387abf9cac025475d85bd4
Python
25,179
804
import argparse import sys from pathlib import Path from learnMSA.run import util from learnMSA import Configuration class LearnMSAArgumentParser(argparse.ArgumentParser): def error(self, message : str): sys.stderr.write('error: %s\n' % message) self.print_help() sys.exit(2) def parse_arg...
ed4f70097cf84872b45de62bb359362a3620ad85500e7b6cda08102f3535f29d
Python
25,181
803
import random import pytest import networkx as nx from networkx import convert_node_labels_to_integers as cnlti from networkx.algorithms.simple_paths import ( _bidirectional_dijkstra, _bidirectional_shortest_path, ) from networkx.utils import arbitrary_element, pairwise class TestIsSimplePath: """Unit t...
3c54c81910222d41c2d1c5d982d6b6d598072f014aa3a5c7634302ecee434598
Python
25,184
779
"""Compute and plot ERPs over subjects.""" # %% # Imports import itertools import json import warnings import matplotlib.pyplot as plt import mne import numpy as np import pandas as pd import pingouin import scipy.stats import seaborn as sns import statsmodels.stats.multitest from scipy.spatial.distance import squaref...
388b946efeb7507f6ae82328d87e2cd4577e5746d94c8394e30b5918478a6a1e
Python
25,214
624
# -*- coding: utf-8 -*- """ Created on 2020.05.19 @author: Jiahua Rao, Weiming Li, Hui Yang, Jiancong Xie Code based on: Yang et al "Analyzing Learned Molecular Representations for Property Prediction" & "A Deep Learning Approach to Antibiotic Discovery" -> https://github.com/chemprop/chemprop Song et al "Communicati...
17c07644c19fc32eaa93821fee78d12ebadc60d8afabd0862150e7672c446b7b
Python
25,221
698
import matplotlib #matplotlib.use('Agg') import matplotlib.pyplot as plt import matplotlib.cm as cm from matplotlib import gridspec import parmap import numpy as np import pandas as pd import os import shutil import cv2 import scipy.io as sio import glob2 from numba import jit from sklearn.svm import SVC # "Support ...
c513c3868869df4bf9939e28fb92926eb1f62e261f4f57fc6f2016e13f6aea60
Python
25,253
610
import os import numpy as np import pandas as pd import scipy as sp from src.routines import LoadFC from src.imaging_derivs import DataVector, DataMatrix from src.energy import matrix_normalization, expand_states, control_energy_helper, \ get_gmat, grad_descent_b, minimum_energy_fast from src.prediction import corr...
e86f7629a5775fd6f08a8ae03f557b5807e24292a7a44ac52914d49d4279274f
Python
25,267
610
"""Compare predicted gene essentiality with Hart 2015 experimental fitness data. Python port of code/test/evaluateHart2015Essentiality.m. Given the genes predicted essential in each cell-line-specific model (see estimateEssentialGenes.py), this computes TP/TN/FP/FN and the derived metrics (accuracy, sensitivity, speci...
7d6ddfc25add57bde9d8b4ffef123705c933071d87a9d2db750338ca80ec529b
Python
25,285
519
# -*- coding: utf-8 -*- import numpy as np import pandas as pd import os import copy import seaborn as sb from matplotlib import pyplot as plt from scipy.signal import argrelextrema from scipy import stats def smoothen(row,new_growth_data,radius,column): #calculate smooth growth by averaging the last ...
04bfb4f76bc2018999c47e13e7ed056ad6b34c6a4dc9fdce8118ab1ee6697c4e
Python
25,303
701
"""A mixin to extend a class that has self.driver with higher-level constructs. This should be mixed into classes with a self.driver and self.default_timeout attribute. """ import abc import threading from contextlib import contextmanager from typing import ( Any, cast, Generic, Literal, Optional,...
8b24a0a176bc9cec6d4e6202af4aee29779d9773afe76c42256f83667a9fff02
Python
25,313
785
import numpy as np import nibabel as nib import scipy.ndimage from itertools import product from nl_expr.exceptions import NeuroLangException from .aabb_tree import AABB, Tree, aabb_from_vertices, Node __all__ = [ 'region_union', 'region_intersection', 'region_difference', 'region_set_from_masked_data', 'take...
d2b8d49caa7c86b5a9494609b259f7e81b5ebfe2490b8e9d5725fd590bb57e55
Python
25,317
685
""" Sources are objects that inject the fields into the grid. Available sources: - PointSource - LineSource """ ## Imports # other from math import pi, sin # typing from .typing_ import Tuple, Number, ListOrSlice, List from numpy import ndarray from torch import exp # relatvie from .grid import Grid from .backend...
893739047234f0b0f1d32e9f8ff03af716077a634a578b80944f02349ad8b6f8
Python
25,339
453
import tensorflow as tf import numpy as np from learnMSA.legacy.TotalProbabilityCell import TotalProbabilityCell from learnMSA.legacy.Utility import deserialize from learnMSA.legacy.Bidirectional import Bidirectional class MsaHmmLayer(tf.keras.layers.Layer): """ A layer that computes the log-likelihood and poster...
22d5dd82a9edfdf3f1d9af5c758bb2b3e3858687f8fb315eb341ac09b080e1cf
Python
25,350
563
#!/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. """ Utilities for working with data for an Ax experiment. Unlike the Ax Data object, "data" here refers to both the ...
8f34c8e0271489ae00ba3b2188ac00b1887aca777da18f095ecd1241099d19b5
Python
25,357
510
"""All pain comparison as sanity check""" import os,json,glob,sys from os.path import join as opj from nipype.interfaces.spm import Level1Design, EstimateModel, EstimateContrast, OneSampleTTestDesign, Threshold, TwoSampleTTestDesign from nipype.algorithms.modelgen import SpecifySPMModel from nipype.interfaces.utility ...
ee393ccb94dafc74cf566cc746ffbb295940ec455b168d32096275a8963c34ac
Python
25,376
766
#!/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 import os from collections.abc import Callable, Generator, Sequence from logging import Logger from ty...
1f5d5d0c9d17a317d11aade9a3b1b143dfa7a0213d46fe36ed8e771bff231366
Python
25,378
679
"""Unit tests for layout functions.""" import pytest import networkx as nx np = pytest.importorskip("numpy") pytest.importorskip("scipy") class TestLayout: @classmethod def setup_class(cls): cls.Gi = nx.grid_2d_graph(5, 5) cls.Gs = nx.Graph() nx.add_path(cls.Gs, "abcdef") cl...
db7f6899b2c6a27a2384405f641fad36ae66db821a192c794df87654252838f5
Python
25,379
575
""" Created on Jun 12, 2018. Creates a topoplot from provided data, indicating either size of change or size of change and significance. :author: voodoocode """ import numpy as np import scipy.interpolate import skimage.filters import matplotlib # @UnusedImport import matplotlib.markers matplotlib.use("QtAgg") # ...
288fbb6c8a85f138bb5cd45962699393d0dabe9a4c4dcc67e7d24d0f9afd69b9
Python
25,380
761
# -*- coding: utf-8 -*- """ Cells ===== Expert cell image processing pipeline. This module provides the basic routines for processing immmediate eaerely gene data. The routines are used in the :mod:`ClearMap.Scripts.CellMap` pipeline. """ __author__ = 'Christoph Kirst <christoph.kirst.ck@gmail.com>' __license__ ...
a409c574e7540a3849973d630af71b9faf9d8b70bf096347b8f7422fbaa516ad
Python
25,387
976
""" Unit tests for inhibitory cell density computation (linear program minimizing distances to initial estimates) """ import numpy as np import numpy.testing as npt import pandas as pd import pandas.testing as pdt import pytest import atlas_densities.densities.inhibitory_neuron_densities_optimization as tested from a...
027bb069c71d5fbf4f7ebe7ac97e5f9b9ef83df392eac85522eab93664a9eb08
Python
25,391
591
## This script runs a FreeSurfer reconstruction on a participant ## Within your MELD folder should be an input folder that contains folders ## for each participant. Within each participant folder should be a T1 folder ## that contains the T1 in nifti format ".nii" and where available a FLAIR ## folder that contains...
382da646cf215dc95e7ed5ff59481aecced6c080d3bffd9972e7b9cc83e59075
Python
25,442
694
# 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...
575ffed93c738c5adb6f79c3f1fc7141d2a045822094a2d6ff0b4a19c69cd52c
Python
25,446
604
#!/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 collections import OrderedDict from collections.abc import Sequence from logging import Logger fr...
26d92a556c5f612925256d4c9b00f172888c33455e0dad7a838438de69cec4a4
Python
25,451
690
"""QC metrics for detecting tile-boundary segmentation artifacts. Cells cut by tile borders during segmentation have characteristic straight edges that natural cell boundaries never produce. This module computes per-cell metrics that quantify this artifact: - **max_straight_edge_ratio**: length of the longest straig...
f9bef6d6c484c725e2c47c655cbfac8d2e407b3aee89c71ad2a042330b99739b
Python
25,467
712
from __future__ import annotations import argparse import json import os import pickle import socket import time from pathlib import Path import torch import torch.nn as nn import torch.nn.functional as F from torch.utils.data import DataLoader, Subset from torchvision import datasets, transforms from spikingjelly.a...
e914e7287d54678b3d0ea985acaa1e1f0fd34fffdfea4b6675d4db39269ae01a
Python
25,495
724
import functools import itertools import numpy as np from scipy.spatial.transform import Rotation from ._util import rotation_matrix_from_vectors from .exceptions import EmptyVoxelSetError from .trees import BoxTree class VoxelData(np.ndarray): """ Chunk identifier, consisting of chunk coordinates and size....
d94fef1b5a03d055a6ed071230eb14d961a0e6eb680cd4bbf8c2ff6e4f19c410
Python
25,527
649
# io.py # Authors: Jacob Schreiber <jmschreiber91@gmail.com>, Ivy Raine <ivy.ember.raine@gmail.com> from collections import OrderedDict import os import textwrap import h5py import hdf5plugin from typing import List, Literal, Union import numpy as np import scipy from . import util from . import meme_writer from ....
80a88194e1d386d3ce2bff36731a5b0dc3bccf0011f223ff647b0333aadd5942
Python
25,547
493
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thur August 30 2018 @author: chrisarcadia @description: script to review a library sourceplatesheet and to optionally generate a mass list and Echo recipe for that library """ # Import python libraries import chemcpupy import ...
c3bdc47716123a4da0b1a0221c62f6759ac295da0f8ae46bd9e4dfa9c16f09db
Python
25,570
717
"""setuptools.command.egg_info Create a distribution's .egg-info directory and contents""" from distutils.filelist import FileList as _FileList from distutils.errors import DistutilsInternalError from distutils.util import convert_path from distutils import log import distutils.errors import distutils.filelist import...
38f6e496aa31e3a5a107593dfa5d72e83df537166113a63a64bc617ce2eb9c58
Python
25,576
694
#!/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 import unittest from logging import Logger from typing import Any import numpy as np from ax.adapter....
53c5ee62c6a297fa18ec20f7dc7812e0e6a74a0dd4e1ea9f97a5834fce9e658e
Python
25,587
725
import io import time import pytest import networkx as nx def test_gexf_v1_3(tmp_path): """'Basic graph' example from https://gexf.net/schema.html""" # GEXF file from published example data = """<?xml version="1.0" encoding="UTF-8"?> <gexf xmlns="http://gexf.net/1.3" version="1.3"> <graph mode="stat...
10e9d9287f902502ce56c7d92cce9325a1dbe9de2c00ddd495957356f046f805
Python
25,608
568
''' Script to evaluate the model trained on noisy training dataset, with noisy test dataset ''' 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(1) from torch.autograd import Variable from matplotlib import pyplot as ...
b5ad63a780793c6056ce8015d6ce3c58bb870912024272bb17d9bf9322b867c8
Python
25,609
705
from __future__ import absolute_import from contextlib import contextmanager import zlib import io import logging from socket import timeout as SocketTimeout from socket import error as SocketError from ._collections import HTTPHeaderDict from .exceptions import ( BodyNotHttplibCompatible, ProtocolError, DecodeErr...
cacd1d6b09382f05aed4b1207b6c1641d4f0ade77e6474ef50f7b5203c9694d3
Python
25,616
688
import collections from operator import contains, eq, not_ from typing import AbstractSet, Callable, Tuple from nl_expr.exceptions import ( CouldNotTranslateConjunctionException, ForbiddenExpressionError, NegativeFormulaNotNamedRelationException, NegativeFormulaNotSafeRangeException, ) from nl_expr.exp...
d6b04f8ee6cf3f11b3a7b8e7fa4f852f1104b305c7b18f89752ccbfda3498001
Python
25,637
469
from oct import * #from oct.post import Post import numpy as np import napari from magicgui import magicgui from qtpy.QtCore import Qt from qtpy.QtWidgets import QSlider,QFileDialog,QLineEdit import enum from napari.layers import Image # Enums are a convenient way to get a dropdown menu class Operation(enum.Enum): ...
02de54b546d83bee93569b721c32798c7e5c81d7acae75fc9d6d4359b2a08883
Python
25,694
535
import numpy as np import math import torch from torch import nn from torch.nn import functional as F from models.fc.layers import fc_layer,fc_layer_split from models.fc.nets import MLP from models.conv.nets import ConvLayers,DeconvLayers from models.cl.continual_learner import ContinualLearner from models.utils import...
d705bd0e12aa77c12313111a37936209d63b9fd5fc799cc4636acf6ebee9bd40
Python
25,726
597
import random import torch import os import torch import torch.nn as nn import torch.nn.functional as F import numpy as np from torch.utils.data import RandomSampler, BatchSampler from .utils import calculate_accuracy, Cutout, calculate_accuracy_by_labels, calculate_FP, calculate_FP_Max from .newtrainer import Trainer...
f629bfe19d66a33eacf2bdb6a941b9f40572aa0d7ddefb3df4873b472a5a4d34
Python
25,727
503
""" `bsb-core` is the backbone package contain the essential code of the BSB: A component framework for multiscale bottom-up neural modelling. `bsb-core` needs to be installed alongside a bundle of desired bsb plugins, some of which are essential for `bsb-core` to function. First time users are recommended to install ...
a4c434efd9e56f5bc5b9b53d3df14181709ff3a29edc5ba3d8adc58a05caa2c5
Python
25,729
678
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # ex: set sts=4 ts=4 sw=4 et: # ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## # # See the COPYING file distributed along with the smile package for the # copyright and license terms. # # ## ### ### ### ### ### ...
118e18efe4ff2cf0fd82302adf9533f2f72a1a1aa39ae58e6a9b351b17791a2e
Python
25,761
515
# -*- coding: utf-8 -*- import pandas as pd import os import copy import numpy as np import time import re from skimage import io from scipy import ndimage from scipy.ndimage import morphology from matplotlib import pyplot as plt input_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), ...
b3c47390992718baa12e10c63f9b1ac56db15731c972778f3510a9776d638cde
Python
25,771
642
from __future__ import print_function import os import re import copy import random import numbers import six import datetime import tensorflow as tf print("Tensorflow version " + tf.__version__) import pandas as pd import pdb import PIL import numpy as np from matplotlib import pyplot as plt import matplotlib.collect...
a61b60d48d5e8a931ee7ac6b9a157038993ac3162cc7f8a8b10b64262e7b88c2
Python
25,814
687
from ...simulation import ( SimulatorAdapter, SimulationComponent, SimulationCell, SimulationDevice, TargetsNeurons, TargetsSections, SimulationResult, SimulationRecorder, ) from ...models import ConnectivitySet from ...reporting import report, warn from ...exceptions import * from ...he...
c9aa2e2fdaf0d325cfa2236945b46f6996f2fbb7f3d3515a42bc8beaf086e561
Python
25,832
591
""" Module implementing GAN which will be trained using the Progressive growing technique -> https://arxiv.org/abs/1710.10196 Code taken from -> https://github.com/akanimax/BMSG-GAN """ # import libraries and modules import os import sys import time import timeit import torch.cuda import torchvision.utils fro...
920b3f2f24bf6556c9274b50b5cfc998b4d6a9d5bfe57f2d5ee11d556c688bf6
Python
25,842
607
# 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...
856bbb664aa700d7e0366423ce803da6252659a8c3563075809c00572b5f9919
Python
25,855
718
""" Compute the shortest paths and path lengths between nodes in the graph. These algorithms work with undirected and directed graphs. """ import networkx as nx __all__ = [ "shortest_path", "all_shortest_paths", "single_source_all_shortest_paths", "all_pairs_all_shortest_paths", "shortest_path_l...
18ef8a79adeae011c4d773c655f4f751fef133100513e9e8b13ca90a097c5107
Python
25,898
527
#!/usr/bin/env python3 import os import numpy as np import time import torch from torch import optim # -custom-written libraries from visual import visual_plt import utils from utils import checkattr from param_stamp import get_param_stamp, get_param_stamp_from_args, visdom_name from eval import evaluate, callbacks as ...
b1a6fcc8d6a47e0a39734afe833995f11b34f0d30b9aa76d980ea7ba8d5e723d
Python
25,901
507
"""Tests for sq.experimental.tl.make_stitched_labels.""" from __future__ import annotations import numpy as np import pytest import squidpy as sq def _qc_and_stitch(sdata, **stitch_kwargs): sq.experimental.tl.calculate_tiling_qc( sdata, labels_key="labels", tile_size=200, nmads_...
d7528ea51ed9bdc4e7277f97a9d9725246a3e386dd361edb1eb47889b5235bd6
Python
25,903
563
"""Graded, task-scoped gene-essentiality analysis (see issue #1076). This replaces the earlier all-task binary scoring, which called a gene essential when its knockout made *any* of the 57 tasks in ``metabolicTasks_Essential.txt`` infeasible and compared that single boolean with the Hart 2015 fitness genes. The task l...
91a638b291e5ad481e060775921cacb8c5a845b942d0d5933fa965a0f69a7eb0
Python
25,905
522
# -*- coding: utf-8 -*- import pandas as pd import os import copy import numpy as np import time import re from skimage import io from scipy import ndimage from scipy.ndimage import morphology from matplotlib import pyplot as plt input_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), ...
75d01844d73b333d408f59ca7fd209f94411df5afc954ccb8e4dca64b056a5ae
Python
25,946
718
import operator from typing import Tuple from ...datalog.expression_processing import conjunct_formulas from nl_expr.expression_pattern_matching import add_match from nl_expr.expression_walker import ExpressionWalker, PatternWalker from nl_expr.expressions import ( Constant, Definition, FunctionApplication...
8e55c3bc930c49644f316113d96640ce8ac5b16c152d43981bf1d51550e58332
Python
26,078
677
""" Algorithm for testing d-separation in DAGs. *d-separation* is a test for conditional independence in probability distributions that can be factorized using DAGs. It is a purely graphical test that uses the underlying graph and makes no reference to the actual distribution parameters. See [1]_ for a formal defini...
6dd6fbab7d7491cf12b1918ffdbdf2cc372f49af9229d990eac5c37d9deaca3c
Python
26,080
589
""" Module implementing GAN which will be trained using the Progressive growing technique -> https://arxiv.org/abs/1710.10196 Code taken from -> https://github.com/akanimax/BMSG-GAN """ # import libraries and modules import os import time import timeit import torchvision.utils from tqdm import tqdm import copy...
84521456dfec6e2b07ecdf772b46fc82a0b843fbc37f2361f8fe626286a13fa6
Python
26,104
607
#!/usr/bin/env python # coding=utf-8 # Copyright 2020 The HuggingFace Inc. 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/LI...
8b134287387d1f4ae608f42a2ce263fff986720221a2fdd5853676495ba5419a
Python
26,105
668
import threading from typing import Any, Iterator, List, Mapping, Union import anndata import numpy as np import pandas as pd import torch import torch.sparse from scipy.sparse import spmatrix class CellSampler(): """An iterable cell dataset for minibatch sampling. Attributes: n_cells: number of cell...
8d61005c639e737948a98f93477ee1da516a120077adff7fc963afa1fbe51252
Python
26,118
961
import operator as op import random from itertools import product from typing import AbstractSet, Callable, Tuple from pytest import fixture, mark, raises, skip from nl_expr import expression_walker as ew from nl_expr import expressions from ..basic_representation import DatalogProgram from ..chase import (ChaseGener...
aa0ae14e1c740ab5e114bfde9297c845fe8b4396d4704516285b52cb6136161b
Python
26,145
567
import os os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID" os.environ["CUDA_VISIBLE_DEVICES"] = "0" import numpy as np import torch from torch.autograd import Variable from matplotlib import pyplot as plt import pickle as pkl from torch_geometric.data import Data, DataLoader from tqdm import tqdm import math import random...
5606e19031fda842ec346f561c4ab2ab300d740bc419fb4e824fa9066620764f
Python
26,160
690
""" General purpose plotting library ================================ .. module:: lib_plotting :platform: Linux :synopsis: module to easily-handle plotting functions .. moduleauthor:: Jose M. Esnaola-Acebes <josemesnaola@gmail.com> This library contains functions to format, modify and create figures, axes and ...
b2082927cf20c4984db1b2aa7fba303423c9380d1a4c572c40f537eb14ea035b
Python
26,205
737
import math import numpy as np import pytest import torch from scipy.integrate import solve_ivp from scipy.optimize import brentq from spikingjelly.timing_based.neuron import Tempotron def _ode_reference(times, indices, weights, duration, tau, tau_s, threshold): """Integrate physical current/voltage; do not use...
f2c8583f8fe55914648f055a083ba1ae471906f602cc00a380542b8e2bc0523a
Python
26,224
759
""" Semantic similarity between documents and free-text queries. Documents (for instance scientific articles identified by their PubMed id) are embedded once with a SPECTER2 document adapter and cached on disk. A free-text query is embedded with the SPECTER2 ad-hoc query adapter and compared to every document by cosi...
13f9e8859169aab1704ad5d599ecbe0b191569650e881f9b1ffcec1e59a33935
Python
26,245
658
#!/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 unittest.mock import MagicMock, patch import torch from ax.adapter.factory import get_sobol from...
a1a62be34a42897ee0bef67696b24b8438aec2b38a2847587e0e497ee3d41129
Python
26,245
522
# -*- coding: utf-8 -*- import pandas as pd import os import copy import numpy as np import time import re from skimage import io from scipy import ndimage from scipy.ndimage import morphology from matplotlib import pyplot as plt input_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), ...
8fc58e9fcbe8140af5522ced752879a23162c10ffd2cc8d4ebaba7b7c065d29c
Python
26,252
767
from __future__ import annotations from typing import Dict, Optional, Tuple import numpy as np import warnings import numbers import matplotlib.pyplot as plt from abc import ABC, abstractmethod from sklearn.neighbors import NearestNeighbors from pynndescent import NNDescent class YourCustomKNN(ABC): ...
37acd526c33fbc3ad1fde9629a06dee1ed04d57a015b5f208190e0b38fc2af68
Python
26,263
686
"""Tests for the REPL driven from a web page.""" import json from pathlib import Path import pytest pytest.importorskip("prompt_toolkit") pytest.importorskip("rich") import numpy as np # noqa: E402 from neurolang.frontend import NeurolangPDL # noqa: E402 from neurolang_apps.utils.tui import nifti # noqa: E402 f...
3dac7dc593000070599d899e7bdc52e72daf27a8322d5f5ce9d161d67f4627b9
Python
26,304
617
import pathlib import shutil from typing import Callable, Generator, Iterator, List import pytest from alpineer import test_utils from ark.settings import EXAMPLE_DATASET_REVISION from ark.utils.example_dataset import ExampleDataset, get_example_dataset @pytest.fixture(scope="class", params=["segment_image_data", ...
4067e600a00ddc6731e24a76f5133d45deb35d2c26be2b96093f1282e865420d
Python
26,364
656
#!/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 collections import defaultdict, OrderedDict from collections....
79d9d2b542836416039786e9ed02aac8d7733dffce2d62211cdbb0e5df29a8bf
Python
26,366
622
#!/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 import traceback import warnings from collections.abc import Itera...
523a4188cd68f9d51800303212a09c6e5048b47823f2492b7821d760f5174cc2
Python
26,387
924
# -*- coding: utf-8 -*- """ IO interface to read microscope and point data This is the main module to distribute the reading and writing of individual data formats to the specialized sub-modules. See :mod:`ClearMap.IO` for details. """ #:copyright: Copyright 2015 by Christoph Kirst, The Rockefeller University, New Y...
94a639c5ce4d66dc01d6ca44f5750d33617b4148a277c3f3df10d345ebad9e29
Python
26,387
836
"""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 re import shutil import tempfile from copy import deepcopy from datetime import datetime, timedelta from pathlib im...
887266eaadef8be62de40ec0770acc2aa156ce0fedb31f22b4bd9f8845b2273e
Python
26,397
638
#!/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 copy import deepcopy from math import isnan, nan from typing import cast import numpy as np from...
68773aa63e4b388e81e8d343f768a2a298b55124e913584185ecc2040636b716
Python
26,402
502
import unittest as ut from pysbm.sbm.model_selection import ModelSelectionByObjectiveFunctionValueOnly from pysbm.sbm.model_selection import minimum_description_length_peixoto_first from pysbm.sbm.model_selection import minimum_description_length_traditional from pysbm.sbm.model_selection import minimum_description_len...
08c447e29259b5383bf3312bf79364803dc177e58740239c43a1ed8df320f6ad
Python
26,403
750
# test_descriptive_report.py # Contact: Jacob Schreiber <jmschreiber91@gmail.com> import base64 import os import shutil import h5py import numpy import pytest import modiscolite.descriptive_report from modiscolite.descriptive_report import plot_to_base64 from modiscolite.descriptive_report import plot_histogram_to_...
ec8dd3ec974d5b5e8dbbe866b0c5dc042c2504d4a5cf770961e6e353cfca0d70
Python
26,425
617
""" Simulation of a bump attractor network for stimulus integration =============================================================== .. module:: ring_simulation :platform: Linux :synopsis: simulation of the ring attractor network for stimulus integration tasks. .. moduleauthor:: Jose M. Esnaola-Acebes <josemesna...
88882680b55b5c150fa91286561d0394fd1a732cf7a9d8b0a5f43f3c08988489
Python
26,427
545
"""Scope gene-essentiality comparison to the reactions a model diff actually touches. The global metrics in gene-essential_summary.md (allTaskMCC, growthAUROC, ...) are computed over every gene Hart 2015 scored, so a pull request that edits a handful of reactions is swamped by ftINIT's run-to-run non-determinism in th...
341d6a0c5d7163391d7a5f5fa0e711a0676d356580ddf5f94e1e68bb251e5816
Python
26,449
615
import logging import os from typing import ( Any, Optional, ) from rocrate.model.computationalworkflow import ( ComputationalWorkflow, WorkflowDescription, ) from rocrate.model.contextentity import ContextEntity from rocrate.model.file import File from rocrate.model.softwareapplication import Software...
f3c094cf72fb4d099ddcb083be00a20eeaf4d5f5383e63ca3a9c0808b616c81d
Python
26,452
622
import numpy as np from brian2.memory.dynamicarray import DynamicArray, DynamicArray1D from brian2.core.variables import ArrayVariable, DynamicArrayVariable from brian2.monitors.spikemonitor import SpikeMonitor from brian2.monitors.statemonitor import StateMonitor from brian2lava.utils.utils import DummyVariable fro...
19993e522206de2b225a91e11ed4ff422ca7ad0336986c0a68f0008aa4b5c84b
Python
26,457
563
# -*- coding:utf-8 -*- import collections import io import math import os.path import tempfile from collections import OrderedDict from typing import List, Union import keras import tensorflow as tf from keras import backend as K from keras.api.layers import Dense, Concatenate, Flatten, Input, Add, BatchNormalization,...
b4d78e0a3d31e5f9e13b75849aa4cec596b366eeeb06e00bd8755fd0a7d77ba9
Python
26,458
709
#!/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 import time from collections.abc import Sequence from logging import INFO, Logger from ax.core.analys...
f9e524a06ca3f835ce29fea0b6cf8fec14efb9ea7cc8c89db99a944bd8c00df5
Python
26,467
569
"""Materialise a stitched labels element from an assign_stitch_groups result. Companion to :func:`squidpy.experimental.tl.assign_stitch_groups`. Takes the piece-to-group mapping from ``stitch_group_id`` in the QC table and writes a new labels element where stitched pieces share a single ID. The original labels eleme...
575cd327d322c908481f0e06157c56031b169165cc771a7ad49b14457cc37303
Python
26,492
894
# 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...
cf4eab5f995819626243ba799daf268cbdf0294e1e33370a5f7830824e2f9343
Python
26,496
548
# 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...
781c9cf6f207f0d67a8dfa3e2d89c8713111bebfb046bfb5eb4ddfc99faa3419
Python
26,498
623
"""Tests for batched motion energy computation. Verifies that the batched implementation produces results equivalent to the original per-filter implementation across backends and batch sizes. """ import numpy as np import pytest import moten from moten.backend import set_backend, get_backend from moten import core fr...
b8a6274864fdf629d419179c8c56b0bdab1e55341836870fa0cd00a56c2b6be3
Python
26,550
929
# -*- coding: utf-8 -*- """ IO interface to read microscope and point data This is the main module to distribute the reading and writing of individual data formats to the specialized sub-modules. See :mod:`ClearMap.IO` for details. """ #:copyright: Copyright 2015 by Christoph Kirst, The Rockefeller University, New Y...
1d910d4819292968e84f1e5e08a63eae36da3ac37b22a66ecf79038ed4602d90
Python
26,580
807
from __future__ import annotations import shutil from collections.abc import Mapping from contextlib import ExitStack, contextmanager from functools import singledispatch from os import PathLike from pathlib import Path from typing import TYPE_CHECKING import h5py import numpy as np import pandas as pd import zarr fr...
64d447b99c9c25c39e83587cb6152cadfbc31e0bc3f35245dc69899ff977751d
Python
26,582
804
# test_affinitymat.py # Contact: Jacob Schreiber <jmschreiber91@gmail.com> import numpy import scipy.sparse import sklearn.preprocessing import pytest from modiscolite.affinitymat import _sparse_vv_dot from modiscolite.affinitymat import cosine_similarity_from_seqlets from modiscolite.affinitymat import jaccard_from_...
2d8ef2f9f42eba0b1d24a0fe9336c2960af6392c0dde7ce280a0f3a453f4d2e9
Python
26,604
698
""" Galaxy control queue and worker. This is used to handle 'app' control like reloading the toolbox, etc., across multiple processes. """ import importlib import json import logging import math import socket import sys import threading import time from inspect import ismodule from typing import ( Any, cast, ...
4394e71d90e4b731126eae32f45509b3dd42e94b3b3407ffc513caa3cce15510
Python
26,609
791
from skimage import morphology, measure, io, util # For performing morphology operations (should maybe import more from skimage...) from mpl_toolkits.mplot3d import Axes3D # Plotting in 3D import matplotlib.pyplot as plt # To plot from scipy.optimize import curve_fit from pylab import ...
59af139b0fb22068eae0537715e6867b1c41c56168f37c180e45c925900a8cce
Python
26,609
614
# 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...
9a27d533f8e950aea3bfad176da8c1420ceba25fa7a6b0b4f97aa07d0ebd5a4e
Python
26,613
676
"""Utility functions to retrieve measurements pertaining to cell density and stored in excel files Measurements related to cell density are read and put under a uniform format so as to ease-off computations made by their consumers of the densities module. The two excel files to be handled are: * mm3c.xls from the su...
4bbc8ad10b880f118cb49550e583f384d4a934945f197c154304b9c13e51d4ba
Python
26,662
766
from __future__ import annotations import argparse import csv import json import os import platform import subprocess import sys import time from pathlib import Path from statistics import median from typing import Any, Callable import torch try: from benchmark.fp8_efficiency import ( assess_triton_effic...
4ed3a05c341c25216d44f5298c970732010ddeb7d8f15e8411ef128afb77df1e
Python
26,678
739
""" Support for dynamically modifying output attributes. """ import logging import re from typing import ( Any, List, ) from typing_extensions import Protocol from galaxy import util from .util import resolve_tool_data_file try: from galaxy.util.template import fill_template except ImportError: fill...
26c4130ffe772d809bbf597e74b2250efb7ec97b994ff5b357d1d6491ee12d19
Python
26,686
673
import numpy as np import pytest import torch from scipy.optimize import brentq from spikingjelly.timing_based import functional, solver from spikingjelly.timing_based.examples.cubic_srm_mnist import _CubicNet def _linear(time, piece, start, slope): return slope * (time - start) - 1, slope.expand_as(time) @pyt...
ec05bbac3a7f7ae72c0e8d6ff68343b32c630a58c278f6e6f86621e62ec2c048
Python
26,720
562
from __future__ import annotations import builtins import logging from typing import ( Optional, TYPE_CHECKING, TypedDict, ) import jwt as pyjwt from social_core.exceptions import ( AuthAlreadyAssociated, AuthCanceled, AuthForbidden, AuthTokenError, ) from social_core.utils import module_m...