sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
93fd29dd8d48cfb9c2b261aa9a6a58d690acf9ad516f5eace2df05039263586e | Python | 23,329 | 624 | # -*- coding: utf-8 -*-
"""
Created on Mon Dec 2 14:28:44 2019
@author: aaussel
"""
#import matplotlib
#matplotlib.use('Agg')
from brian2 import *
start_scope()
from scipy import signal
from cells.RS_LIP import *
from cells.FS_LIP import *
from cells.SI_LIP import *
from cells.IB_soma_LIP import *
from cells.IB_ax... |
5721a815f1215c1f18fdeb14883ac386e25593728363caa1ebac56966387a769 | Python | 23,340 | 535 | """Test data_manager.api module functionality.
This file tests TaskPagination: .only('id') during pagination and the
single-Sum totals path (FIT-2416) used by the live DM list endpoint.
"""
from types import SimpleNamespace
from unittest.mock import MagicMock, patch
from data_manager.api import TaskPagination
from d... |
2d6d4ab8138b1c24271163cbf4da3f4c8b765bc3756611b24c1c16d6c28e7397 | Python | 23,347 | 666 | import os
import socket
import time
import sys
from pprint import pprint
import torch
import torch.nn as nn
import torch.optim as optim
import torch.distributed as dist
from torch.multiprocessing import spawn
from torch.nn.parallel import DistributedDataParallel
from torch.utils.data import DataLoader
from torch.utils.... |
2e9716072b64adbd1f047f1744ff139d412a30847e13d9468754cad025246672 | Python | 23,380 | 716 | """
Miscellaneous Helpers for NetworkX.
These are not imported into the base networkx namespace but
can be accessed, for example, as
>>> import networkx as nx
>>> nx.utils.make_list_of_ints({1, 2, 3})
[1, 2, 3]
>>> nx.utils.arbitrary_element({5, 1, 7}) # doctest: +SKIP
1
"""
import itertools
import random
import wa... |
5a3dd5049746a8994ec93f85fcb4d885b0a95f4aacdfd627b19d983ebe9b208b | Python | 23,388 | 566 | import numpy as np
from sklearn.neighbors import KDTree
from rtree import index
from random import choice
from .reporting import report
try:
import plotly.graph_objects as go
from plotly.subplots import make_subplots
except Exception as e:
pass
class Particle:
def __init__(self, radius, position):
... |
342fe924c4fe9a6697f9e2fde981a74c9586648d5218c490b69c088c309b9aca | Python | 23,415 | 662 | import sys
import urllib.parse
import numpy as np
import pytest
from nl_expr.exceptions import UnboundVariablesError
from neurolang.frontend import NeurolangDL, NeurolangPDL
from neurolang_apps.utils import engine_registry
from neurolang_apps.utils import text_embeddings as te
VOCABULARY = ["reading", "word", "visua... |
6ebcc049ca40c5619113113d27b16e889dbd419c419bc6d7a518027342281cfd | Python | 23,416 | 554 | """
Famous social networks.
"""
import networkx as nx
__all__ = [
"karate_club_graph",
"davis_southern_women_graph",
"florentine_families_graph",
"les_miserables_graph",
]
@nx._dispatchable(graphs=None, returns_graph=True)
def karate_club_graph():
"""Returns Zachary's Karate Club graph.
Eac... |
c48927220b327c79764da0be83989e2039d94728b4949ca37b59a72eab6141bc | Python | 23,427 | 458 | import warnings
from collections import defaultdict
from typing import Union
import numpy as np
import tensorflow as tf
from .. import ModelVisualization, keras
from ..utils import get_input_names, get_num_of_steps_allowed, is_mixed_precision, listify
from ..utils.regularizers import LegacyRegularizer
from .callbacks... |
9d40173958d215bfa47878e3c240834385336c5354083f3a5488d5af2125cf55 | Python | 23,459 | 605 | import os.path
import tempfile
import shutil
import subprocess
import multiprocessing as mp
import re
from Bio import Restriction
import gzip
from Bio.SeqIO.QualityIO import FastqGeneralIterator
from collections import defaultdict
import glob
from queue import Empty
from future.utils import string_types
import pysam
fr... |
c17bb9c5a6e66dbea8a00c86f58c766d05e0907530ebcaf67344ba57bfc0a834 | Python | 23,480 | 653 | from functools import partial
from itertools import repeat
import collections.abc as container_abcs
import logging
import os
from collections import OrderedDict
import numpy as np # version: 1.19.3 (1.20.3 has been removed)
import scipy
import torch
import torch.nn as nn
import torch.nn.functional as F
from einops i... |
ec479a29d572d61a5c924787e42fb65eee5433aaa1f3087cf4287b86c963e970 | Python | 23,480 | 599 | """Utilities for working with mulled abstractions outside the mulled package."""
import collections
import hashlib
import logging
import os
import re
import sys
import threading
from typing import (
Any,
Callable,
Dict,
Iterable,
List,
Literal,
NamedTuple,
Optional,
Tuple,
TYPE_... |
2fc69f8be85542dc33ca6b6a900ebe13ad4b5343e17d88945c99029bce1af859 | Python | 23,504 | 673 | """
Copyright © 2025 Howard Hughes Medical Institute, Authored by Carsen Stringer , Michael Rariden and Marius Pachitariu.
"""
import logging
import os, tempfile, shutil, io
from tqdm import tqdm, trange
from urllib.request import urlopen
import cv2
from scipy.ndimage import find_objects, gaussian_filter, generate_bina... |
7020966acc3bd8447ca8e6b4a5e99a5baba7a001baf32b8754f6c1c85f268e74 | Python | 23,508 | 618 | """Shallow MNIST STDP with current LIF and local neuronal adaptation.
浅层 MNIST STDP 与电流 LIF、层内循环抑制;标签仅用于学习后的类别指派。
"""
import argparse
import copy
import json
import math
import os
import sys
import time
from pathlib import Path
import torch
import torch.nn as nn
import torchvision
from spikingjelly.activation_based... |
23889591b9685de2bf6ce43f502bb534b72d0909c016f99ece69e5714df1a3a6 | Python | 23,553 | 611 | #!/usr/bin/env python3
"""
Build GTN Search Database from GTN Repository.
This script processes the Galaxy Training Network repository and creates
a SQLite database with FTS5 full-text search capabilities for fast tutorial search.
Usage:
python build_database.py <gtn_repo_path> [--output <db_path>]
"""
import js... |
564240faee8b4b168c23b7595f8403c46c3620cfad74ba41b0690e0ef2d844f5 | Python | 23,563 | 695 | # 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... |
fca5a14f5fea233eb4eb31b85fbcbf2de24d9e0fd11c455b5c8d5d59b80ecca4 | Python | 23,621 | 578 | #!/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 logging
from collections.abc import Callable, Sequence
from dataclasses import dataclass
impor... |
5f1476b76f04528bad3500abc8e2d233e092a3fec005c26eaffa0247e620e8d9 | Python | 23,631 | 636 | """Tests for model surgery operations (expanding/discarding positions)."""
import os
import numpy as np
import pytest
import tensorflow as tf
from learnMSA import Configuration
from learnMSA.align.align_hits import HitAlignmentMode
from learnMSA.config.hmm import PHMMConfig
from learnMSA.hmm.tf.layer import PHMMLayer... |
8f19d6f2249e7cd6166ad2748ccb7cab8fbbfaab723cecabfac24ca090449a96 | Python | 23,633 | 605 | # 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... |
afffd407e43ce1928891333a7280fbee4494b4381dc5ada22bb1ec7a898ef038 | Python | 23,636 | 616 | from typing import NamedTuple
import pytest
import networkx as nx
def test_valid_partition():
G = nx.karate_club_graph()
partition = nx.community.infomap_communities(G)
assert nx.community.is_partition(G, partition)
def test_labels_preserved():
# String labels: an accidental relabel-to-index bug c... |
dec9f54de1b2f7953d3631e29364d2fed0e85bc42b7b2d950d3ea0fe68628ee2 | Python | 23,636 | 552 | from __future__ import annotations
import anndata as ad
import numpy as np
import pytest
import spatialdata as sd
from anndata import AnnData
from numpy.random import default_rng
from scipy.sparse import isspmatrix_csr
from shapely import Point
from spatialdata.datasets import blobs
from squidpy._constants._pkg_const... |
b015d62b4715f7b09756ff62dbf972abda82257dedfcbd21614d79d91a150584 | Python | 23,662 | 613 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
CellMap
=======
This script is the main pipeline to analyze immediate early gene expression
data from iDISCO+ cleared tissue [Renier2016]_.
See the :ref:`CellMap tutorial </CellMap.ipynb>` for a tutorial and usage.
.. image:: ../Static/cell_abstract_2016.jpg
:t... |
eeffddd716a78d831909adddab6844da109cc9ec705814c4155e52a0b8100efe | Python | 23,697 | 863 | """Greedy coloring test suite."""
import itertools
import pytest
import networkx as nx
is_coloring = nx.algorithms.coloring.equitable_coloring.is_coloring
is_equitable = nx.algorithms.coloring.equitable_coloring.is_equitable
ALL_STRATEGIES = [
"largest_first",
"random_sequential",
"smallest_last",
... |
d951d4bc1f8dc6c3b192415032a24600f1fc905c7b684476e243ed6ea7dbe3ab | Python | 23,709 | 398 | import tensorflow as tf
import numpy as np
import learnMSA.model.tf.training as train
from learnMSA.util.sequence_dataset import SequenceDataset
import time
import math
from functools import partial
def safe_log(x, log_zero_val=-1e3):
""" Computes element-wise logarithm with output_i=log_zero_val where x_i=0.
... |
2aef52e49ac19ae96d5feb2a5fbb1ef81b0bdbc99ef1e1e5e5037457387d9c11 | Python | 23,718 | 680 | # test_tfmodisco.py
# Contact: Jacob Schreiber <jmschreiber91@gmail.com>
import numpy
import scipy.sparse
import pytest
from modiscolite.tfmodisco import _density_adaptation
from modiscolite.tfmodisco import _filter_patterns
from modiscolite.tfmodisco import _patterns_from_clusters
from modiscolite.tfmodisco import _... |
3b007cb67910720a3d7ac16643c348bba93743e6ab81d9468e90986ca9a38511 | Python | 23,734 | 437 | """
Copyright © 2025 Howard Hughes Medical Institute, Authored by Carsen Stringer, Michael Rariden and Marius Pachitariu.
"""
import os, time
from pathlib import Path
import numpy as np
from tqdm import trange
import torch
from scipy.ndimage import gaussian_filter
import gc
import cv2
import logging
models_logger = ... |
04a12e776f5734b353eaba364f454cc4a184705145ed7ed294f1c049371987d9 | Python | 23,744 | 719 | # 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... |
2723dc972cd5f12e01f6b8cfe7474cdd6da8d68c57d4408cca062348f92d5c8a | Python | 23,750 | 568 | import numpy as np
import xarray as xr
import time
import os
from tensorflow import keras
from collections import OrderedDict
class TimeOut(keras.callbacks.Callback):
'''
Stop training after a batch when a certain time-limit (in minutes) is reached.
Restoring the weights from the best concluded epoch.
... |
b6ff7065115687b00bef70864b24a740b14a3575ac179f686a938caec5bef84a | Python | 23,757 | 812 | """
Rank
====
Main 3d rank filter module
--------------------------
The package is based on the 2d skimage.filters.rank filter module.
These filters compute the local histogram at each pixel, using a sliding window
similar to the method described in [1]_. A histogram is built using a moving
window in order to limit ... |
d9a101284866d148da50c9a6c4767f436e9262aa36b35e322491e43964e0d424 | Python | 23,764 | 709 | import jax
import jax.numpy as jnp
from functools import partial
import pyqmc.pyscftools
from pyqmc.wf.jax import gto
import pyscf.gto
from typing import NamedTuple
import numpy as np
import time
##############################
# Data storage tuples
##############################
class SlaterState(NamedTuple):
""... |
f1cbcac9b2db48fc655dfdcc76b56e49d3a4d13c4527e0d5a5599d3577fc35e6 | Python | 23,778 | 596 | """ Module Docstring """
# Standard Imports
from time import time
# Third Party Imports
import torch
import numpy as np
from scipy import spatial
from sklearn.utils.extmath import randomized_svd
# Custom Module Imports
from .video import RegionMetadata
from .video import LowRankVideo
from .demix import HalsNMF
from .... |
cfb8ff56f7be757380b80ed9b2623e9d67b416b6c90bf33df20fe5ed7c143da9 | Python | 23,783 | 516 | from __future__ import print_function, unicode_literals, absolute_import, division
import numpy as np
import warnings
import math
from tqdm import tqdm
from csbdeep.models import BaseConfig
from csbdeep.internals.blocks import unet_block
from csbdeep.utils import _raise, backend_channels_last, axes_check_and_normaliz... |
9dc26e5cd8fb7377bb83af2eb205842c34eed9923318827e8c4e3b46dc6ff3b2 | Python | 23,789 | 476 | from meld_classifier.meld_cohort import MeldSubject
import meld_classifier.mesh_tools as mt
import numpy as np
import os
import nibabel as nb
from tensorflow.keras.utils import Sequence
import math
import json
import io
import logging
import tensorflow as tf
from meld_classifier.paths import MELD_PARAMS_PATH
def nor... |
418a4460db0bb4c311671e710a72a88c920407aa389d63155c19c85fa008036e | Python | 23,790 | 752 | import typing
from typing import Sequence, Union
from .core import _is_sequence, transform, transform_record
from .error_handler import CatchRecord, catch_hoc_error
if typing.TYPE_CHECKING:
from .interpreter import PythonHocInterpreter
_registration_queue = []
_had_pointers_wrapped = {}
def _safe_call(method)... |
fa29d4c6733e8683527fd9806b858f6b66605727a5fbc147a6512f935c03a91e | Python | 23,793 | 591 | import os
import tempfile
import warnings
from shutil import rmtree
import feather
import numpy as np
import pandas as pd
import pytest
import scipy.ndimage as ndimage
import skimage.io as io
from alpineer import image_utils, misc_utils, test_utils
from skimage.draw import disk
import ark.phenotyping.pixel_cluster_ut... |
07c746ed6797f2acc798f45e899dc2dde22dfc1c98414a8b987b7be46920a81a | Python | 23,794 | 637 | # -*- coding: utf-8 -*-
"""
Created on Mon Dec 2 14:28:44 2019
@author: aaussel
"""
#import matplotlib
#matplotlib.use('Agg')
from brian2 import *
start_scope()
from scipy import signal
from cells.RS_LIP_altd import *
from cells.FS_LIP_altd import *
from cells.SI_LIP import *
from cells.IB_soma_LIP import *
from c... |
d92afc4b0d06f0de43f8411e360e7d065102e0340cb8031970a889c0016050cb | Python | 23,805 | 580 | from __future__ import annotations
import sys
from collections.abc import Mapping, Sequence
from itertools import product
from typing import TYPE_CHECKING
import numpy as np
import pandas as pd
import pytest
import scanpy as sc
from anndata import AnnData
from pandas.testing import assert_frame_equal
from scanpy impo... |
559b0cbe9ce24600532e8e2636e0c18a8b87fcd72fddcc79f842577b4db18d41 | Python | 23,808 | 573 | # Modified by CogDL Team
#
# DeepSpeed note, code taken from commit 3d59216cec89a363649b4fe3d15295ba936ced0f
# https://github.com/NVIDIA/DeepLearningExamples/blob/master/PyTorch/LanguageModeling/BERT/modeling.py
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HugginFace Inc. team.
# Copyrig... |
f5b9eac976cae654d9c1abc6ed7084a93bacdd3e79184ec6919585144157c05f | Python | 23,811 | 564 | """ 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 datetime
import os
import time
import timeit
import torchvision.utils
from tqdm import... |
078ee9b28ba9a7ba2b54b6b81a723a9325a67248cb56db7e5b746507d3f05fc8 | Python | 23,813 | 529 | import math
from typing import Optional
import torch
from .. import functional, surrogate
from .base_node import BaseNode
__all__ = ["TernaryIFNode", "TernaryLIFNode"]
def _validate_ternary_parameters(
v_threshold: float, v_reset: Optional[float], detach_reset: bool
) -> None:
if not isinstance(v_threshold... |
24d6145701e6344c2710645030a98548b13da74182cc16742eb98952d0ee412a | Python | 23,823 | 597 | import scipy
import scipy.io as sio
from scipy.interpolate import interp1d
import numpy as np
from .sparseae import *
from scipy.optimize import curve_fit
import os
from functools import partial
import random
from numba import jit
def serm(data,ROIsize=[500,100], percOL=0.5, randomize=True):
# Applies serm techni... |
4b9cdfd0c41ed4a9cb811ad65370c84ed47bc95698b50a51c259250d765d4478 | Python | 23,836 | 596 | import os
import string
from abc import (
ABCMeta,
abstractmethod,
)
from logging import getLogger
from typing import (
Any,
Dict,
List,
Optional,
Tuple,
Type,
TYPE_CHECKING,
)
from uuid import uuid4
from packaging.version import Version
from typing_extensions import Protocol
from ... |
fc6f1792e224dad8eedb40006fc396cf8a42503092f1cb22ae42bfea57a5c0b6 | Python | 23,840 | 650 | """ Boundaries for the FDTD Grid.
Available Boundaries:
- PeriodicBoundary
- PML
"""
## Imports
# typing
from .typing_ import Tensorlike, ListOrSlice, IntOrSlice
# relative
from .grid import Grid
from .backend import backend as bd
## Boundary Conditions [base class]
class Boundary:
"""an FDTD Boundary [base... |
ec60f2a5591ac2bc916b23750128c5f8b135982e3621e9c8cc9d46476f499eeb | Python | 23,875 | 611 | # -*- coding: utf-8 -*-
"""
Created on Wed Feb 14 10:52:39 2018
@author: jacobrosenstein
This is a basic class for storing a list of compounds
with their IDs (PubChem CID, InChI Key) and
properties (mass, formula, InChI, and custom properties).
Requires pubchempy and pyteomics.
"""
import json
import csv
from dat... |
17e96e66b4cd2b89bbc503bdd12d4fed0efff2ae655dac3ee4fa428c917b6c79 | Python | 23,877 | 524 | import os
import warnings
import matplotlib.pylab as plt
import numpy as np
import pandas as pd
import seaborn as sns
import xarray as xr
from tqdm.notebook import tqdm
from alpineer import misc_utils
import ark.settings as settings
from ark.analysis import spatial_analysis_utils
def create_neighborhood_matrix(all_... |
a5940536ff84ed2d24e08626e8c5b5dbb15f2ced113f8c8a91fc9f6f757fc7dd | Python | 23,885 | 809 | """
shared options and groups
The principle here is to define options once, but *not* instantiate them
globally. One reason being that options with action='append' can carry state
between parses. pip parses general options twice internally, and shouldn't
pass on state. To be consistent, all options will follow this de... |
4d0b16fd4cf0f3de3e94317d15671a1efc5369f67e03ebd021ed517a629bf05d | Python | 23,902 | 487 | # 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, ... |
aad07e778cb87a2c47f1dc4c3a257c4d3fa8fe21fc7093a4a508b07a364543e5 | Python | 23,938 | 712 | """
Module for the Partition configuration nodes and its dependencies.
"""
import abc
import functools
import json
import typing
from pathlib import Path
import numpy as np
from voxcell import RegionMap
from .. import config
from ..config import refs, types
from ..exceptions import (
AllenApiError,
CfgRefere... |
785739fe8c2c5f945946ae69857693c5fbf4e76e4e12d69afdf1e14e5542d9a7 | Python | 23,961 | 687 | import pathlib
import re
from concurrent.futures import ProcessPoolExecutor, as_completed
from itertools import permutations
from typing import Tuple
import numpy as np
import pandas as pd
import pysam
import zarr
from pysam import TabixFile
from scipy.sparse import csc_matrix
from ALLCools.utilities import reverse_c... |
94005800801f6cc343e3fa2a7239b93692104d8cd60205d0e28aa6d0cfd0bd0e | Python | 23,961 | 697 | import numpy as np, random
from .morphologies import Morphology as BaseMorphology, NilCompartment
from .helpers import (
ConfigurableClass,
dimensions,
origin,
SortableByAfter,
continuity_list,
expand_continuity_list,
count_continuity_list,
iterate_continuity_list,
)
from .exceptions imp... |
da3ef0ec2d4e2017ebfee09abd07f2a011bd24f35fa09ed0a920375104c1974f | Python | 23,983 | 811 | # -*- coding: utf-8 -*-
"""
Annotation
==========
Module to handle label and annotation info from Allen Brain Atlas (v2).
Notes
-----
- The files containting annotation information is assumed to be in the path
stored in :const:`atlas_path`, which defaults to the resource path
:const:`ClearMap.Setti... |
6ab585437cd94b632f13c5dd6ee495369d0c03d455b2338f15d47134084b7e62 | Python | 24,006 | 620 | import json
from pathlib import Path
from unittest import TestCase
import pytest
import requests
import requests_mock
from django.test import override_settings
from django.urls import reverse
from projects.models import Project
from webhooks.models import Webhook, WebhookAction
from webhooks.utils import emit_webhooks... |
b51515193058d19687dc794de8c5915256b098eb10b71e2be7a169e1489d68d8 | Python | 24,009 | 634 | """
tensorflow/keras layers for voxelmorph
If you use this code, please cite one of the voxelmorph papers:
https://github.com/voxelmorph/voxelmorph/blob/master/citations.bib
License: GPLv3
"""
# internal python imports
import os
# third party
import numpy as np
import tensorflow as tf
from tensorflow import keras ... |
566bd67b04c4b91a4d1c2e150007f2049b68fdd5c2068190ab371463492a3e7b | Python | 24,024 | 504 | """
Copyright (c) 2019 10x Genomics, Inc. All rights reserved.
Annotate barcodes which contain cells using total number of reads.
Uses an EM model to fit two negative binomial distributions to the reads-per-barcode data, one modeling the background
barcodes and one modeling the signal (cell-containing) barcodes.
"""
... |
9df5af82c57a07c7d01b2c83e18d377a3627d2444edde174b77e9c16559a3231 | Python | 24,025 | 628 | # 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... |
4f9391f7ef7073e138bda397ed83ce7207a91a354e26ec918ba0566539806f4b | Python | 24,049 | 632 | from abc import abstractmethod
from typing import Optional
import torch
import torch.nn as nn
from .. import base, surrogate
__all__ = ["BaseNode", "NonSpikingBaseNode", "SimpleBaseNode"]
class SimpleBaseNode(base.MemoryModule):
def __init__(
self,
v_threshold: float = 1.0,
v_reset: Opt... |
671eca2fed04342b08df3ba199fca5a39de943bc54e14a4de4d0fe8b51ca014a | Python | 24,098 | 551 | from math import inf
import os
import logging
import numpy as np
import scanpy as sc
import anndata as ad
import pandas as pd
from torch.utils.tensorboard import SummaryWriter
import matplotlib
from matplotlib.figure import Figure
import matplotlib.pyplot as plt
from scipy.stats import chi2
from typing import Mapping, ... |
7fee4bbb3e3fbf55a34343710a3af0de43bc43adb91849521b8352bf5f83b60b | Python | 24,121 | 624 | # 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... |
c7c5c77714e58a641cd7dc10541919d961fc597af3dfe24a31ff1e5dd97adc67 | Python | 24,135 | 536 | """
----------------------------------------------------------------------------------------
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... |
74c38defd86c96af75eb1d7ba81f775855672716a64ec02d174a0ab43411fe71 | Python | 24,163 | 626 | import os
import tempfile
from collections.abc import Iterator
from contextlib import contextmanager
from typing import (
Optional,
TYPE_CHECKING,
Union,
)
from galaxy.exceptions import (
AuthenticationFailed,
ObjectNotFound,
)
from galaxy.files.models import (
AnyRemoteEntry,
BaseFileSourc... |
27b69e7940fe7f1a65c3bcc315f7a07737394f12d24e7bbc56c676c1e0b2cc70 | Python | 24,165 | 527 | # 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... |
c10b7028a4d6657a6646fa48429ceadfbacf9686580a80d0844bf95cb2644582 | Python | 24,171 | 591 | # -*- coding: utf-8 -*-
""" Trains a physics-based model
"""
# Contributions and Changelog accessed via a private git repository:
# https://github.com/philipwijesinghe/deep-learning-lsm.git
# philip.wijesinghe@gmail.com
# Copyright (c) 2020 Philip Wijesinghe@University of St Andrews (pw64@st-andrews.ac.uk)
import sy... |
2159fe4914cf1e82f193e2aa535fbc1cb5df5d2afc9618078c040e235be0bda2 | Python | 24,180 | 592 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 11 09:07:50 2021
@author: amelie
"""
from FEF_and_LIP import *
from mdPul_two_columns_v4 import *
from itertools import *
eq_syn='''_post=s_i*g_i*(V_post-V_i) : amp * meter ** -2 (summed)
ds_i/dt=-s_i/taud_i+(1-s_i)/taur_i*0.5*(1+tanh(V_pre/10... |
6beaf8751582d6ec357fc58752f85cab82b269c2923cc7595c920f50cb238016 | Python | 24,194 | 640 | import itertools
import json
from functools import partial
import numpy as np
from bsb import (
Chunk,
DatasetExistsError,
DatasetNotFoundError,
LabellingError,
MissingMorphologyError,
MorphologySelector,
MorphologySet,
RotationSet,
config,
)
from bsb import PlacementSet as IPlaceme... |
e1ec18a638b8db47c4ceb3f6237b857e6bfae36869bd669eb72ab1674d0f12c5 | Python | 24,200 | 477 | import tables
import genomic_regions as gr
from .helpers import vector_enrichment_profile
from ..matrix import RegionMatrixTable, Edge
import numpy as np
from ..tools.general import RareUpdateProgressBar
from ..config import config
from ..regions import Genome
from future.utils import string_types
try:
from Bio.Se... |
37d1f31c679af69df76d6161275f67893378b26647c02b110217cb07e38343d2 | Python | 24,242 | 669 | """
Processing tasks with standardized IO - using seung-lab/CloudVolume, and
either (1) a file-based cloud-storage platform (AWS S3 or Google Cloud
Storage) or (2) a SQLAlchemy-supported database.
"""
import time
from .. import io
from .. import types
from .. import seg_utils
from . import io as taskio
from . import... |
5f12b8d365ae52737b951728a8619d630990151d4cd12c65d6dd6f767d94a673 | Python | 24,261 | 692 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
| Title:
part 4 of the preprocessing
| Date:
2021-02-20
| Author(s):
Theodor Rumetshofer
| Description:
As stated in the manuscript, this part of the preprocessing is extracting
the WMH volume and number in T1- and MNI-s... |
b335acbdd91027148e93d1318f04f318376a2bebcd76f582b16ca74f6580fc6a | Python | 24,273 | 811 | import operator
from typing import AbstractSet, Tuple
import numpy
import pytest
from ...datalog.basic_representation import WrappedRelationalAlgebraSet
from nl_expr.exceptions import NeuroLangException
from nl_expr.expressions import Constant, FunctionApplication, Symbol
from ...relational_algebra import (
Colum... |
023e90c1edbf618431a1979976e63c5a219393ce413d5a5ae2de47f727400ce8 | Python | 24,313 | 634 | #!/usr/bin/python
# DH added fixed random seed 3/4/21
# PM Last updated 3/2/21
'''
Flexible, vectorized calculation of all RP Scores from tabulated time series expression data
# Current major differences from original scripts/classifyExpression_filter script:
# Advantages/what's new
-Significantly faster (even wi... |
9652916bbaaa4156293311c7e3893f829c6afeb1741da2ef095b466208e98b02 | Python | 24,388 | 734 | import abc, numpy as np, os, sys, collections
from contextlib import contextmanager
from inspect import isclass
import inspect, site
from .exceptions import *
@contextmanager
def suppress_stdout():
with open(os.devnull, "w") as devnull:
old_stdout = sys.stdout
old_stderr = sys.stderr
sys.s... |
4a4c5dec398d9e5e4d729b58910bd30700f58c3ec879e33660e87f262d13f610 | Python | 24,413 | 661 | """The interactive REPL loop and the execution of the queries it reads."""
import sys
import time
import warnings
from contextlib import contextmanager
from dataclasses import dataclass, field
from typing import NamedTuple, Optional
from prompt_toolkit import PromptSession
from prompt_toolkit.filters import HasSearch... |
b916ca931cf0005b21e29edc97d4b64f3feaade588dcf9e13c14eec5750e34b0 | Python | 24,415 | 656 | """Registered counterparts of every non-Torch functional neuron transition."""
import importlib
import os
import subprocess
import sys
import textwrap
import pytest
import torch
from spikingjelly.activation_based import functional, surrogate
SURROGATES = (
"Sigmoid",
"ATan",
"PiecewiseQuadratic",
"P... |
c7444950c8ce174fb81991ce61c5082c8afd0891ac28c9c28ffc665891cd8635 | Python | 24,430 | 581 | import os
from pathlib import Path
from typing import Any, Callable, Sequence
import numpy as np
import tensorflow as tf
from learnMSA.hmm.util.value_set_emb import PHMMEmbeddingValueSet
import learnMSA.model.tf.training as train
import learnMSA.model.training_util as training_util
import learnMSA.tree.tf.initializer... |
f46829d6436f85548da03b4b41c7d4e254eb25ea5e6dbb6840afbced7a06f8d7 | Python | 24,431 | 628 | import os
import pathlib
import random
from copy import deepcopy
from typing import Iterator, Tuple
import feather
import numpy as np
import pandas as pd
import pytest
from alpineer.misc_utils import verify_same_elements
from ark.phenotyping.cluster_helpers import (CellSOMCluster, PixelSOMCluster,
... |
589342db8d87d7aa17a5de07ba7a8351a9662330fe7d30787428b231f4cd0659 | Python | 24,458 | 673 | """Lifted queries run through the frontend: the solver's tests are in
``neurolang/probabilistic/tests/test_dalvi_suciu_lift.py``."""
import pytest
from nl_core.probabilistic import dalvi_suciu_lift
from nl_core.relational_algebra_provenance import DisjointProjection
@pytest.mark.parametrize("rules, expected", [
... |
d447fbdbe4b08db7bc6cfb7ebfdadf2db3b1b6586335459aca81e3b12c454852 | Python | 24,484 | 544 | """ 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... |
67e1faa0de2066bc0a52f20f269661d7cf9ce0a3542927624c57fc9162071272 | Python | 24,488 | 478 | # 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... |
04434ab2f700d3c22971c0fddf8e7eaccae0dda5d6140d6ae811448259c783a2 | Python | 24,547 | 604 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2005-2010 ActiveState Software Inc.
# Copyright (c) 2013 Eddy Petrișor
"""Utilities for determining application-specific dirs.
See <http://github.com/ActiveState/appdirs> for details and usage.
"""
# Dev Notes:
# - MSDN on where to store app data files:
# ... |
d53199bddc765d2f54d358c071876ce9633b1d393c5ca41b09b9885c0fe81a2b | Python | 24,577 | 723 | # Author: David Burns
# License: BSD
import warnings
import numpy as np
import pytest
import seglearn.transform as transform
from seglearn.base import TS_Data
from seglearn.feature_functions import all_features, mean
from seglearn.util import get_ts_data_parts
def test_sliding_window():
N = 1000
width = 10... |
415b363fa748198ee3c9cb7577218a86958cf7a9dc3a80b8a952a0170fd10b28 | Python | 24,592 | 570 | #!/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 abc import ABC
from collections.abc import Iterable
import numpy as np
import numpy.typing as np... |
d8fbb7af3ffa4eb0e371ff80bad82ca16dd51ac8d16435e513a0b74282a587b6 | Python | 24,598 | 498 | from __future__ import print_function
import re, argparse, sys, os
import numpy as np
import pandas as pd
class MQcolnames(object):
def __init__(self, df):
self.columns = df.columns.tolist()
self.new2old_colnames_dict = {"Potential contaminant": "Contaminant",
... |
89b066c7251338e9180bc53353507e27a40d7f05bd981d58dc2dd76e93a95675 | Python | 24,605 | 346 | import argparse
##-------------------------------------------------------------------------------------------------------------------##
# Where to store the data / results / models / plots
store = "./store"
##------------------------------------------------------------------------------------------------------------... |
d6faa73fab6fa38577fc4e63062114fbaaa5d2c6c6403ce7bea7696a7b810962 | Python | 24,629 | 749 | #THE CODE WAS SET UP FOR GOOGLE COLAB. THE INITIAL PORTION OF THE CODE HELPS COMFIRMING GPU USAGE
"""
#this is for testing purposes, for getting the most out of GPU
import tensorflow as tf
tf.test.gpu_device_name()
# memory footprint support libraries/code
!ln -sf /opt/bin/nvidia-smi /usr/bin/nvidia... |
052cb05650c76d71b318df722dc69cb0bf127413d0912f11ffe35786e3e1e653 | Python | 24,648 | 682 | # test_aggregator.py
# Contact: Jacob Schreiber <jmschreiber91@gmail.com>
import numpy
import pytest
from modiscolite.aggregator import polish_pattern
from modiscolite.aggregator import _expand_seqlets_to_fill_pattern
from modiscolite.aggregator import _align_patterns
from modiscolite.aggregator import merge_in_seqle... |
031ef20ef24917466fd7a8784865d78518c33c12b315bd5005bd97ac09999d77 | Python | 24,672 | 582 | #!/usr/bin/env python
import argparse
import joblib,sys,os,re,gzip
from collections import defaultdict
from xgboost.sklearn import XGBClassifier
from pysam import FastaFile
from tqdm import tqdm
import subprocess
###########################################
def predict(tpp,fl1,dir1):
# ~ ######################
# ~ ins_... |
745b4537eac09978b7d3cbdd899dd14fb2359f9ea992e0c995168dd374698d6d | Python | 24,675 | 724 | """
Session commands of the interactive REPL.
The rules defined during a session, and the relations loaded with
``.load``, go to a scope of the engine's program opened when the REPL
starts (:func:`open_session_scope`), so that ``.idb`` lists the rules,
``.drop`` removes a rule, a predicate or a relation, and ``.clear`... |
2e1ee525fab1fd796dad7df3b10d5c22be985335f80920c1348e2797388289ad | Python | 24,693 | 586 | from meld_classifier.experiment import Experiment
from meld_classifier.meld_cohort import MeldCohort, MeldSubject
from meld_classifier.dataset import normalise_data
from meld_classifier.meld_plotting import trim
from meld_classifier.paths import (
MELD_PARAMS_PATH,
MELD_DATA_PATH,
DK_ATLAS_FILE,
EXPERI... |
8c421eba29f69df9f7357356d1c980bb8db9dc26c24f9aed1d654d3d4739fad7 | Python | 24,709 | 653 | # 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... |
2605516b1ac61b1d80d21f9e61c52423a3fd80ac9995420e6cd1f0510c0fad94 | Python | 24,719 | 781 | import json
import pathlib
from xml.sax.saxutils import escape
import warnings
from scipy import sparse
import regex
import sklearn
from sklearn.utils.extmath import safe_sparse_dot
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.preprocessing import normalize
import numpy as np
import pandas ... |
b3efec108e066181c0762bf860b46ff7dc487b7954062c9607ea173dbf303420 | Python | 24,745 | 658 | import pandas as pd
import os.path as osp
import os
import numpy as np
from tqdm import tqdm
import torch
### reading raw files from a directory.
### for homogeneous graph
def read_raw_graph_from_csv(raw_dir, add_inverse_edge = False, additional_node_files = [], additional_edge_files = []):
'''
raw_dir: path ... |
748d329baa3c791cb3e0072376e9afbefb9bfa1076e0706a359629cb9f0dd703 | Python | 24,750 | 644 | '''
The PIGNPI model to learn pairwise potential energy, with different activation functions
'''
import numpy as np
import torch
from torch import nn
from torch.functional import F
from torch.optim import Adam
from torch_geometric.nn import MetaLayer, MessagePassing
from torch.nn import Sequential as Seq, Linear as Li... |
b72c7b69945568ba06985847d4768d89aba926147bb3a4a87c897a2d975c8609 | Python | 24,769 | 719 | """Tests for the relational algebra plan display (``show_ra``)."""
import operator
import re
from typing import AbstractSet
import pytest
from .. import NeurolangDL, NeurolangPDL
from nl_core.datalog import Implication
from nl_core.datalog.expressions import AdornedSymbol
from nl_expr.expressions import Constant, Sym... |
2f075558f69425fc5c2ac50ca2c968c6f1a7e1ac5c26db21fb8fc77e01a2f8ca | Python | 24,797 | 636 | from unittest import TestCase
import networkx as nx
from pysbm import sbm
from pysbm.sbm.peixotos_flat_sbm_full import ModelLikelihoodOfFlatMicrocanonicalDegreeCorrectedSbm
class TestModelLikelihoodOfHierarchicalMicrocanonicalDegreeCorrectedSbmUndirected(TestCase):
def setUp(self):
self.graphs = [nx.Gra... |
0bc74799eadb6603ce78227df6c0cd438cc1246d9488962cbe235341a4b8bb3f | Python | 24,858 | 666 | """Generate graphs with a given joint degree and directed joint degree"""
import networkx as nx
from networkx.utils import py_random_state
__all__ = [
"is_valid_joint_degree",
"is_valid_directed_joint_degree",
"joint_degree_graph",
"directed_joint_degree_graph",
]
@nx._dispatchable(graphs=None)
def ... |
ff290b3b31e0289817a2076b97ff46b94395acdacb6227e924cb4f44a3aa56dc | Python | 24,859 | 731 | """Algorithms to characterize the number of triangles in a graph."""
from collections import Counter
from itertools import chain
import networkx as nx
from networkx.utils import not_implemented_for
__all__ = [
"triangles",
"all_triangles",
"average_clustering",
"clustering",
"transitivity",
"... |
e8da2d3d23abdb3b0b2ec891f9324d377187f93dfb61ad8cf223b797486564b9 | Python | 24,896 | 659 | """
====================
Generators - Classic
====================
Unit tests for various classic graph generators in generators/classic.py
"""
import itertools
import typing
import pytest
import networkx as nx
from networkx.utils import edges_equal, nodes_equal
class TestGeneratorClassic:
def test_balanced_t... |
86aa2113c6538cefb4b3d5cf647ec839caa046af929b4d79e43e7e483daf568f | Python | 24,934 | 671 | # -*- coding: utf-8 -*-
"""
Created on Mon Dec 2 14:28:44 2019
@author: aaussel
"""
#import matplotlib
#matplotlib.use('Agg')
from brian2 import *
start_scope()
from scipy import signal
from cells.RS_LIP import *
from cells.FS_LIP import *
from cells.SI_LIP import *
from cells.IB_soma_LIP import *
from cells.IB_ax... |
ab91066c1fe7e5cea1fd7d46baaf5b2df3edcee4f8a00c4cdd10306c81cb63b9 | Python | 24,934 | 741 | from __future__ import annotations
import re
from functools import partial
from itertools import product
from typing import TYPE_CHECKING, Literal, cast
import h5py
import numpy as np
import pytest
import zarr
from scipy import sparse
from zarr.storage import MemoryStore
import anndata as ad
from anndata._core.annda... |
2cf18d1f028afc9eed790df5dcee2febba43133b338880eeb90c47b83b42fb4b | Python | 24,964 | 661 | # 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 Mapping, Sequence
from typing import final
import pandas as pd
from ax.adapter.base import Adapt... |
9a002b492fd738b8f46568d3811bc9865b360db9608a8514bcf94ceda6574d99 | Python | 24,999 | 768 | from __future__ import annotations
import abc as _abc
import contextlib as _cl
import datetime as _dt
import email.utils as _eml
import functools as _ft
import hashlib as _hl
import importlib.util
import os
import pathlib as _pl
import tempfile as _tf
import time as _t
import typing
import typing as _tp
import urllib.... |
104fce39849cccce2a9fdf7bbda750b3348d3bcd78f5badd93b020bb73d128b0 | Python | 25,016 | 641 | from dataclasses import dataclass
from typing import (
cast,
Literal,
Optional,
Protocol,
TYPE_CHECKING,
Union,
)
from openpyxl import Workbook
from openpyxl.styles.protection import Protection
from openpyxl.worksheet.datavalidation import DataValidation
from openpyxl.worksheet.worksheet import... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.