sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
22949528acb50a11f12bff6b2baf5c79ee16f52f45efec658863ab1e1255a969 | Python | 12,241 | 352 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 29 08:58:41 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_vis import *
from itertools import *
from joblib import Paralle... |
2d6f8d66962c2ffb6364e46cb1b039ab5bace284dd8a670f75e06395da82990f | Python | 12,242 | 305 | #!/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 import mock
import numpy as np
import pandas as pd
from ax.adapter.discrete import _get... |
584813f686538a4ed6315e0b84e5795c59f98117dbf35f6bea21cc86993e34ec | Python | 12,242 | 335 | # -*- coding: utf-8 -*-
"""
Created on Mon Dec 2 14:28:44 2019
@author: aaussel
"""
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 joblib import Parallel, delayed
from joblib import parallel_backend
im... |
6b1381843273696f2ec53eac5c730d7eec2c650ee3f4fe5b78971a8d120cc814 | Python | 12,243 | 354 | import os
import torch
import torch.nn.functional as F
from torch import nn
from torch_scatter import scatter_mean, scatter, scatter_add, scatter_max
from torch_geometric.nn.conv import MessagePassing
import eeg_util
from eeg_util import DLog
from models.baseline_models import GAT
from models.graph_conv_layer import... |
502484505ab9edd80ad15e1a167a0b6580848243945648455a0b0d208dc52178 | Python | 12,252 | 437 | # -*- coding: utf-8 -*-
"""Docking_GD_Parallel.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1P4GssDPNRBrGwGPIuuTlIdHmC0J2TjxJ
"""
import os
import sys
import string
from pyrosetta import *
from rosetta import *
from rosetta.pro... |
51dc3acce3bfd7aaa9342e72e404fc0c26b2e9309aafecdfbdda9223e796a3f6 | Python | 12,254 | 351 | # 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... |
2cc4a2e26d880f02d1ac984ee0074784c677c5e0d5bfc104975458ed77c4e36a | Python | 12,264 | 358 | """Helper utilities for geometric transforms, connected-region analysis and file I/O."""
# ---------------------------------------------------------------------------
# Authors: John G Samuelson <johnsam@mit.edu>
# Christoph Dinh <christoph.dinh@brain-link.de>
# Teemu Taivainen
# Created: September, 2... |
bce067176f3daf20c2cb381de135a139899e01955a4b77d6047170762cf9426d | Python | 12,280 | 339 | """Magic sets rewriting through the frontends: the rewriting's tests are in
``neurolang/datalog/tests/test_magic_sets.py``."""
import numpy as np
import pandas as pd
import pytest
from ...frontend import NeurolangDL
from ...frontend.probabilistic_frontend import NeurolangPDL
@pytest.fixture
def nl():
nl = Neurol... |
bb0d05b84bb7cbf608f8f486b90091cad1695cb17b1327b67ea2c968a6d79017 | Python | 12,283 | 331 | import pytest
import networkx as nx
from networkx.utils import nodes_equal
from .test_graph import BaseAttrGraphTester, BaseGraphTester
from .test_graph import TestEdgeSubgraph as _TestGraphEdgeSubgraph
from .test_graph import TestGraph as _TestGraph
class BaseDiGraphTester(BaseGraphTester):
def test_has_succes... |
d7ab32fc012b2d649569835eb51d1c0ee80c41b6e6674b25fc43ba33abd1ebd7 | Python | 12,283 | 364 | """
Range restriction of Datalog rules.
A rule is *range restricted* (safe) when every variable of its body is
bound: it occurs in a positive atom, or it is defined by an equality
``x == expression`` whose expression only uses bound variables, or it is
an element of a bound set, ``contains(s, x)``. Functions, comparis... |
67dff0bd968b8be501a232f535558ad7c55a7063082802a2c060a92577d9092c | Python | 12,286 | 219 | from torch import nn
import numpy as np
from models.utils.modules import Identity
from models.fc.layers import fc_layer, fc_layer_fixed_gates
class MLP(nn.Module):
'''Module for a multi-layer perceptron (MLP).
Input: [batch_size] x ... x [size_per_layer[0]] tensor
Output: (tuple of) [batch_size] x ... x... |
7c66babb2dfd5358190ea6ec42ec8ad6f8c2091358a04fc5268fa29bd439ceab | Python | 12,302 | 364 | #!/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... |
eececbd70f1354212c697965729984fe3f649ad45734fc9673e28333f81cb2b2 | Python | 12,307 | 281 | # 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... |
fde1c9a68b381007d6af72f01db03965c296d7d68c5d289fb6dbabff1e6ddba8 | Python | 12,307 | 348 | #!/usr/bin/env python3
# -*- 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 Licens... |
f29653dfddfe493de84cb5d3a1e69a5e56b36461444abd80d7dc94b56ea43744 | Python | 12,312 | 315 | # -*- coding: utf-8 -*-
"""
Created on 2020.05.19
@author: Jiahua Rao, Weiming Li, Hui Yang, Jiancong Xie
Code based on:
Errica et al "A Fair Comparison of Graph Neural Networks for Graph Classification" -> https://github.com/diningphil/gnn-comparison
"""
import threading
import numpy as np
import pandas as pd
impor... |
7d123361734a05d1df53e43220f1ca7255f5c1d14bda8948ed6e1de50775a670 | Python | 12,315 | 296 | import os
import tempfile
import numpy as np
import pandas as pd
import pytest
import test_utils
import xarray as xr
import ark.settings as settings
from ark.analysis import spatial_analysis_utils
def test_calc_dist_matrix():
with tempfile.TemporaryDirectory() as base_dir:
# create sample label_dir and ... |
cc70bb2017c18489caa3dfea0ac4ea28f52905de053cd25c21b19d8abffba456 | Python | 12,316 | 219 | from torch import nn
import numpy as np
from models.utils.modules import Identity
from models.fc.layers import fc_layer, fc_layer_fixed_gates
class MLP(nn.Module):
'''Module for a multi-layer perceptron (MLP).
Input: [batch_size] x ... x [size_per_layer[0]] tensor
Output: (tuple of) [batch_size] x ... x... |
cee4281d69be33314bca5a9454f42c87250586427728fa05f5eaddd9d1ef3547 | Python | 12,337 | 316 | from typing import Sequence, Union
from torch import nn
import torch
import math
class InputPartlyTrainableLinear(nn.Module):
"""A linear layer with partially trainable input weights.
The weights are divided into two parts, one of shape [I_trainable, O] is
trainable, the other of shape [I_fixed, O] is fix... |
36a69e8ead6f9dacb8b591a9585b0eb811021f53d0ddc51c94a3aeb6619c5bee | Python | 12,342 | 252 | import torch
from utils import load_data_from_folder, pool_max
import os
import glob
import numpy as np
import pandas as pd
from sklearn.preprocessing import OrdinalEncoder
from sklearn.metrics import f1_score
import argparse
parser = argparse.ArgumentParser(description='Process some args.')
parser.add_argument('--lr... |
ee954546b373f81f3ada5ca9f12bb00f5ba1f2b6e33f3a4c6bd04d19cf4b5749 | Python | 12,342 | 379 | """
Lifted inference for non-repeating queries with negation, following
Fink & Olteanu (PODS 2014): a query in which no probabilistic relation
occurs twice can be computed in polynomial time if it is hierarchical.
The expected probabilities are closed forms, checked against an
enumeration of the possible worlds.
"""
i... |
f15b5b03a2f6ab053346bfca700e85cf38dc1f37bf9520311c3f51afdfd18c7f | Python | 12,352 | 319 | # -*- coding: utf-8 -*-
"""
Created on Fri Jul 5 13:08:06 2019
@author: schelskim
"""
from scipy.spatial import distance
import numpy as np
import cv2
from skimage import morphology as morph
from scipy import ndimage
import copy
from skimage.morphology import disk
from matplotlib import pyplot as plt... |
fd2b0ebca05d86678fb356c09a50b942a9b5d4db5dbc329d3b0be7dcf1ffd120 | Python | 12,354 | 316 | """Monitor for history audit table changes.
Detects history changes via PostgreSQL LISTEN/NOTIFY (instant) or by polling
the history_audit table (SQLite fallback). Dispatches SSE events to connected
users via Kombu control tasks.
Only active when ``enable_sse_updates`` is True in the Galaxy config.
"""
import loggin... |
768fece35f0d9bbe8c74604c751e8f1e689b87cc35d089043c198e6e523cb5dc | Python | 12,362 | 375 | import glob
import os
import os.path as osp
import shutil
import zipfile
import numpy as np
import torch
import torch.nn.functional as F
from cogdl.data.dataset import MultiGraphDataset
from cogdl.data import Graph
from cogdl.utils import download_url
def normalize_feature(data):
x_sum = torch.sum(data.x, dim=1... |
be8c421de25b7387b57a66b95e9aa81e1bd26610a8ef639cc6d9405725280222 | Python | 12,364 | 311 | import logging
from typing import (
Any,
NamedTuple,
Optional,
TYPE_CHECKING,
Union,
)
from uuid import UUID
from sqlalchemy import (
select,
sql,
true,
update,
)
from galaxy import (
exceptions,
model,
)
from galaxy.managers.context import ProvidesUserContext
from galaxy.m... |
a0751caab3844e1db7e1a73ce39e6e8681dfca846a2e48e3fa260817cc33cdff | Python | 12,372 | 432 | from operator import and_, invert, or_
from typing import Any
from ..exceptions import NeuroLangException
from ..expression_walker import PatternWalker, add_match
from ..expressions import Constant, FunctionApplication, Symbol
from ..utils.orderedset import OrderedSet
from . import (
FALSE,
TRUE,
BinaryLog... |
723c81b713fa1279602d97bd059916e6fbbf253c1dfbc17c3b408834072ed4a8 | Python | 12,379 | 177 | # -*- coding: utf-8 -*-
"""
@title: tester script for the Andrew class
@description: writes "BROWN DARPA" in a 384 well plate (based on 'example_protocol_2-unencrypted.anp')
@author: chrisarcadia
@created: 2018/03/22
"""
import Andrew
# create a new protocol
recipe = Andrew.Protocol();
# set protocol information
re... |
c82790d6bc73566613ca378669830ad84c200deca8c72cf5a5322f01c868752a | Python | 12,392 | 297 | import numpy as np
from learnMSA.util.sequence_dataset import SequenceDataset
from learnMSA.util.aligned_dataset import AlignedDataset
import subprocess
from shutil import which
import sys
import Bio.SeqIO
class AlignedInsertions():
def __init__(self,
n_total: int = 0,
aligned_i... |
fe1f79c915c31c7f503510ac714238d2f0855d669da15d2be5abe844a8269798 | Python | 12,404 | 433 | """
*************************
Multi-line Adjacency List
*************************
Read and write NetworkX graphs as multi-line adjacency lists.
The multi-line adjacency list format is useful for graphs with
nodes that can be meaningfully represented as strings. With this format
simple edge data can be stored but node... |
9f3e460efd5735541272ff5009794e913fbc1dec1bc3be7f6a301a516c1c81ad | Python | 12,407 | 336 | # -*- coding: utf-8 -*-
"""
Created on Wed Dec 4 11:35:36 2019
@author: aaussel
"""
from cells.RE_mdPul import *
from cells.TC_mdPul import *
from cells.HTC_buffer_mdPul_Destxhe_tests import *
from mdPul_one_column_v3 import *
from scipy import signal
prefs.codegen.target = 'numpy'
defaultclock.dt = 0.01*ms
run... |
df25416d3e49d26e6355b1800498297b92407380cd297555ecfe90467a18ae8a | Python | 12,417 | 322 | from typing import Optional
import torch
from .. import functional, surrogate
from .lif import LIFNode
__all__ = ["OTTTLIFNode", "SLTTLIFNode"]
class _OnlineLIFNode(LIFNode):
def single_step_functional_forward(
self,
inputs: tuple[torch.Tensor, ...],
states: tuple[object, ...],
... |
a26c016b5ea7bb50d701b7f97d51b4cc556bd50dbe5adf9cc3bdae893c7d07ec | Python | 12,421 | 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... |
f1fc7c32887f204bd356f96f2f400eaadcd2f0101549e370db6ae5858efc7072 | Python | 12,421 | 361 | import torch
import torch.nn as nn
from torchvision.models import resnet50
import torchvision
import torch.nn.functional as F
from GCN_model import GraphConvolution
from sklearn.neighbors import kneighbors_graph
from graph_fun import process_graph
import numpy as np
import config
import graph_fun
import distance_fun
p... |
a06d56707fac3e8e356dae1c1ebdd0907c4dbaa5577c40632d72577160312dd3 | Python | 12,422 | 366 | # -*- coding: utf-8 -*-
"""
Created on Wed Dec 4 11:35:36 2019
@author: aaussel
"""
from cells.RE_mdPul import *
from cells.TC_mdPul import *
from cells.HTC_buffer_mdPul_Destxhe_tests import *
from mdPul_one_column import *
from scipy import signal
prefs.codegen.target = 'numpy'
defaultclock.dt = 0.01*ms
runtim... |
0472703ff2d370c2ab3ea9a8821a935445e2befe4e918ea6adbcf5395ecb506b | Python | 12,425 | 323 | #!/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 math
from copy import deepcopy
import numpy as np
from ax.adapter.base import DataLoaderConfig... |
2cded55d0d0369d4d7c071bd8f5587469f2823a5dc5d713e5ffe5b7ec3ff2568 | Python | 12,433 | 333 | import datetime
import logging
from abc import abstractmethod
from typing import cast
from celery import Task
from sqlalchemy import (
bindparam,
delete,
func,
insert,
select,
update,
)
from sqlalchemy.dialects.postgresql import insert as ps_insert
from sqlalchemy.engine import CursorResult
fro... |
2eb786eda4fe160bde03d6f24b18bf16ce2a07bea102a86c9da9badd05ca71f9 | Python | 12,434 | 348 | import torch
import torch.nn as nn
import torch.nn.functional as F
import math
from torch.autograd import Variable
from utils import my_softmax, get_offdiag_indices, gumbel_softmax, preprocess_adj, preprocess_adj_new, preprocess_adj_new1, gauss_sample_z, my_normalize
_EPS = 1e-10
class MLPEncoder(nn.Module):
""... |
81162b6f49d0c51db167d4392bd880150bde9c6f3430fe3abdf0ce40b3984130 | Python | 12,445 | 340 | from typing import Any, Callable, Dict, Optional
import torch
import torch.nn as nn
from .. import functional, layer, neuron
from ..layer.attention import SpikeDrivenSelfAttention
from .._neuron import _make_multi_step_neuron
__all__ = ["SpikeDrivenTransformer", "sdt_8_384"]
class _PatchEmbed(nn.Module):
def _... |
168258c25ea2a6c05e208ba3f3a175bbab9016523345c4e273455b97e9b22523 | Python | 12,446 | 312 | import numpy as np
import scipy.sparse as sp
import torch
import torch.nn as nn
import torch.nn.functional as F
from scipy.sparse import lil_matrix
from sklearn.metrics.pairwise import cosine_similarity
from sklearn.preprocessing import normalize
from cogdl.layers import GCNLayer, GATLayer
from cogdl.models import Bas... |
79cdb11eb077119cd03d70bca5e40b81b32faedff32aabbe4c6496a9a84e5982 | Python | 12,460 | 343 | """Tests for StripDimensionTypePredicatesMixin and make_dimension_type_stripper."""
from nl_core.datalog import Conjunction
from nl_expr.expression_walker import ExpressionWalker
from nl_expr.expressions import Constant, FunctionApplication, Symbol
from ..squall import (
StripDimensionTypePredicatesMixin,
_DIM... |
a90d01bc2c4f1163859cb85349e97f9050aa8081f215e72bec6a4b33996aac80 | Python | 12,464 | 307 | """
Workflow orchestration agent for coordinating multiple agents on complex tasks.
"""
import asyncio
import logging
import re
from pathlib import Path
from typing import (
Any,
Optional,
)
from pydantic import BaseModel
from pydantic_ai import Agent
from galaxy.schema.agents import ConfidenceLevel
from .ba... |
20d71d444d85fa2692b0c915bfc0724da8d6f0caf3427206cdea3a3f1de2729f | Python | 12,468 | 346 | # -*- coding: utf-8 -*-
"""
Example script to set up the parameters for the image processing pipeline
"""
# import modules:
import ClearMap.Analysis.Statistics as stat
import ClearMap.Analysis.Label as lbl
import ClearMap.IO.IO as io
import ClearMap.Alignment.Resampling as rsp
import numpy, os, scipy
# Base Director... |
b7a25760fdc43066fdcdda0b147a26213ca09ece8c91c141edd6e58d213f8477 | Python | 12,472 | 260 | import logging
import os, sys
from typing import Iterable, Optional, Union
from collections import defaultdict
import networkx as nx
from rlmolecule.crystal.crystal_state import CrystalState
logger = logging.getLogger(__name__)
dir_path = os.path.dirname(os.path.realpath(__file__))
# elements to compositions
default... |
87548cbbac639fe631ec20466d0e264f182276ca070b1a3db2efdb1374a759a8 | Python | 12,488 | 425 | """
Hessian
=======
Module to compute curvature measures based on Hessian Matrix
Usefull for filtering vasculature data
"""
__author__ = 'Christoph Kirst <christoph.kirst.ck@gmail.com>'
__license__ = 'GPLv3 - GNU General Pulic License v3 (see LICENSE.txt)'
__copyright__ = 'Copyright © 2020 by Christoph Kirst'
__... |
bec10fc0ec279db888ae5c4c76a2e20f3518d16c215b3d498b75b031f47058de | Python | 12,497 | 369 | """
##############################################################################################################
Author: Álvaro Fernández García
Date: 19 - Marzo - 2019
Description: Script que contiene una serie de funciones útiles para el proceso de construcción del dataset.
Contiene las funciones necesarias para im... |
d8a045369466f13b30dc91c8c4d9d66b3fd658eefb5b526de5a82b68716c9a3f | Python | 12,502 | 270 | import os.path
import shutil
import sys
import numpy as np
import tensorflow as tf
from nets import nets
def run(opt):
################################################################################################
# Read experiment to run
##############################################################... |
6928f37d1a5cdc6374e2bb1aa7485e8721c17274ae9896cc4c77e52c7ffc8aae | Python | 12,509 | 357 | import collections
import itertools
import operator
from nl_expr.expression_pattern_matching import add_match
from nl_expr.expression_walker import ExpressionWalker, expression_iterator
from nl_expr.expressions import Constant, FunctionApplication, Symbol
from nl_expr.logic import (
Conjunction,
Disjunction,
... |
b11fd31d9f4ca7279754880ef928a7ea6ef44980da0a2ad749676c4856c371bd | Python | 12,510 | 337 | # NICE
# Copyright (C) 2017 - Authors of NICE
#
# 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 Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program ... |
93318a37f8446ae9434e4cf6a22b05de2300383bb21a72dd25c9ef621faa23a4 | Python | 12,517 | 282 | # 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... |
9dcd0dbde3ede5654a2d3bfe4be4eb34cefbc2dcf76439e7f16708c1b7f38be2 | Python | 12,518 | 283 | # 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"... |
077c34df185e9d670bf57a1f39f0b2da59dd919366a5b0207d4affead14da1b9 | Python | 12,532 | 380 | from src.custom_layers.cs_layers import CompressedSensing, CompressedSensingInception, CompressedSensingConvolutional, UNetLayer
#from tensorflow.keras.layers import *
import tensorflow as tf
from src.custom_layers.utility_layer import downsample,upsample
#import tensorflow_probability as tfp
import math as m
from src.... |
4a34e6767dead5e34f1cebdc89752ede5a5ae24c55954905bed9b2c679b8a001 | Python | 12,544 | 348 | import logging
from typing import (
Optional,
Union,
)
from sqlalchemy import select
from sqlalchemy.orm import scoped_session
from galaxy.exceptions import RequestParameterInvalidException
from galaxy.model import (
Credential,
CredentialsGroup,
JobCredentialsContextAssociation,
User,
Use... |
0a9af5f6480b26b7fbf0fb9bd4ac1c7e624105c91f18d59a2d5205f50795996c | Python | 12,550 | 261 | import numpy as np
import shutil
import MDAnalysis as mda
from MDAnalysis.analysis import pca, align
from MDAnalysis.coordinates.memory import MemoryReader
from MDAnalysis.analysis.base import AnalysisFromFunction
import uuid
import os
from sklearn.decomposition import PCA
import os
import uuid
print('imported mod... |
3235279606e7ed3a557111558e431c82261457698ea3dadd337bbed944bc5ce6 | Python | 12,560 | 364 | from itertools import chain
from typing import Optional
import torch
import torch.nn as nn
from functools import partial
from .gat import GAT
from .loss_func import sce_loss
def setup_module(m_type, enc_dec, in_dim, num_hidden, out_dim, num_layers, dropout, activation, residual, norm, nhead, nhead_out, attn_drop, ... |
65ea9679ed479c398972bc2708194c9ae7c25235479ab8c329b0b77b9ce9089f | Python | 12,561 | 342 | """Tests for the experimental CUDA SpikeLinear kernels.
The public ``sparse_linear`` API exposes only the torch and sparse strategies.
The slower v3 kernel remains available as a low-level custom op that requires
a pre-packed uint8 spike tensor.
"""
import pytest
import torch
from spikingjelly._ops.spike_linear.spa... |
aba68ac1df311ed9b86ca00908190fd4daec73f6207c9deeda50a6429da722a9 | Python | 12,569 | 385 | import numpy as np
from scipy.sparse import issparse
from sklearn.decomposition import TruncatedSVD
from sklearn.preprocessing import StandardScaler
from sklearn.utils.extmath import safe_sparse_dot
from ..clustering.lsi import tf_idf
def top_features_idx(data, n_features):
"""
Select top features with the h... |
2460c0e35d431b8f0a2878b29afefb9875358e1acc7077a7671b7e2028ca29ef | Python | 12,573 | 412 | import binascii
import copy
import json
import logging
import uuid
from collections import deque
from itertools import chain
from sys import getsizeof
from typing import Optional
import numpy
import sqlalchemy
from sqlalchemy.ext.mutable import Mutable
from sqlalchemy.inspection import inspect
from sqlalchemy.types im... |
ecba83f253d9c85d4b8815ae2c7a2f6fec095e946466d41a290c17aa6ef1388c | Python | 12,573 | 350 | """
This GtfTrack class replaced the original pygenometracks class.
It supports read-in a gffutils database, rather than parse very time
"""
import collections
import warnings
import gffutils
import numpy as np
from matplotlib import font_manager
from pygenometracks.tracks.BedTrack import BedTrack
from pygenometrack... |
455eac0c57458fe9412541ed410e09f352f357859de9214a027649086d2504b9 | Python | 12,574 | 379 | # -*- coding: utf-8 -*-
'''
Created on 2020.05.19
@author: Jiahua Rao, Weiming Li, Hui Yang, Jiancong Xie
'''
from collections import defaultdict
import numpy as np
import networkx as nx
import torch
from torch_geometric import data
from torch_geometric.utils import dense_to_sparse
from typing import List, Tuple, ... |
e5c68eaf7a94c66bfa28281b4ce3307b6d42868ec17d75ba21b9358fa473c7c9 | Python | 12,584 | 407 | # precompile.py
# Authors: Jacob Schreiber <jmschreiber91@gmail.com>
"""Compile the package's numba kernels in forked child processes, into
numba's on-disk cache, while this process gets on with the run.
A fresh process compiles every kernel on its first call, one after another,
and waits for each. `start()`, called ... |
2914d440639b30e96e4fb7b0b47f45343d5152632a7fc44fda2134ed8559309a | Python | 12,592 | 409 | # ----------------------------------------------------------------------------
# mlp_validation_naive.py
# Author: Antoine Beauchamp
"""
Description
-----------
"""
# Packages -------------------------------------------------------------------
import sys
import argparse
import os
import random
import pandas ... |
c13c4ea65560ad790497ebe9c0403c6d246011243327eb7845d518cad6f6d43d | Python | 12,595 | 322 | #!/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.abc import Sequence
from logging import Logger
fr... |
65bb5b5fecb45116006d7d819be169fb75e463dbe053af18159c9a4f9ffa01f1 | Python | 12,596 | 302 | # -*- coding: utf8 -*-
"""
base NN blocks
"""
import tensorflow as tf
from . import custom_layers
class BaseArchitecture(object):
@staticmethod
def _get_allocate_layer(name, type_, model, **kwargs):
""" Allocate new layer or find existing """
# check layer is allocated in model
if mo... |
64cc8a0ece01cc77bf9798c0784377ee5780bafdce5d54a96f4914884673ac40 | Python | 12,597 | 270 | import numpy as np
import os
import tensorflow as tf
from learnMSA import msa_hmm
from pathlib import Path
import time
import pandas as pd
import sys
def convert_time(total_secs):
secs, mins = np.modf(total_secs/60.)
mins = int(mins)
secs *= 60.
return mins, secs
def make_dirs(name):
results_path ... |
6c4e17ad03a3815ed244a5d7c10825bcafa2fe6376f95b8fcda1eeea222076a5 | Python | 12,615 | 391 | # extract_seqlets.py
# Authors: Jacob Schreiber <jmschreiber91@gmail.com>
# adapted from code written by Avanti Shrikumar
import os
import math
import mmap
import signal
import warnings
from concurrent.futures import ThreadPoolExecutor
import numba
import numpy as np
from . import core
from . import precompile
de... |
8b91d87f634f9e22c5091abbd51182a241d99d56505c997fa150152cbd7ac6a4 | Python | 12,616 | 392 |
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import nibabel as nib
from nilearn.plotting import cm
import cmasher as cmr
from brainspace.utils.parcellation import map_to_labels
from surfplot import Plot
from surfplot.utils import add_fslr_medial_wall
from adap... |
abf39b572d9686c520b0cb3eabd6e1e9faa9cec1bedc557c873568aed08cf57a | Python | 12,626 | 299 | """Manager and Serializer for library datasets."""
import logging
from typing import (
Any,
)
from sqlalchemy import select
from galaxy import util
from galaxy.exceptions import (
InsufficientPermissionsException,
InternalServerError,
ObjectNotFound,
RequestParameterInvalidException,
)
from galax... |
14ab3fbedd404b74218938e372f51875d3da4de3117a5381d7ae741cfb30f25a | Python | 12,630 | 369 | from __future__ import annotations
from abc import ABC, abstractmethod
from collections.abc import Callable, Mapping, Sequence
from types import MappingProxyType
from typing import TYPE_CHECKING, Any, Literal
import dask.array as da
import numpy as np
from scanpy import logging as logg
from scipy import ndimage as nd... |
fffbc0ebd4501f08992f8922581b7b70f4d54c65659bec3d95beb9d61d64a988 | Python | 12,636 | 393 | """Biconnected components and articulation points."""
from itertools import chain
import networkx as nx
from networkx.utils.decorators import not_implemented_for
__all__ = [
"biconnected_components",
"biconnected_component_edges",
"is_biconnected",
"articulation_points",
]
@not_implemented_for("dir... |
d1c54931a413c2f1057299076fd8d95e24075f36a473a8266b9b12e16a88723c | Python | 12,640 | 298 | import tensorflow.compat.v1 as tf
from . import inits
flags = tf.app.flags
FLAGS = flags.FLAGS
# global unique layer ID dictionary for layer name assignment
_LAYER_UIDS = {}
def get_layer_uid(layer_name=''):
"""Helper function, assigns unique layer IDs
"""
if layer_name not in _LAYER_UIDS... |
11123f9858aa54b048c1483257a567b47d675542742ecd55ad81d86d0290a9ce | Python | 12,641 | 374 | """Functions for computing measures of structural holes."""
import networkx as nx
__all__ = ["constraint", "local_constraint", "effective_size"]
@nx._dispatchable(edge_attrs="weight")
def mutual_weight(G, u, v, weight=None):
"""Returns the sum of the weights of the edge from `u` to `v` and
the edge from `v`... |
26fe4a6445122278206026157761feb0005754da269e3b5f78e6a81e7ac21ed4 | Python | 12,649 | 259 | """Tests for tile-cut cell stitching."""
from __future__ import annotations
import logging
import dask.array as da
import matplotlib.pyplot as plt
import numpy as np
import pytest
import xarray as xr
from spatialdata import SpatialData
from spatialdata.models import Labels2DModel
import squidpy as sq
from tests.con... |
bc91c9d3827e0d99b3f8ad2140336535f7504dba1b89749b6e38250b6e3bd42f | Python | 12,657 | 364 | """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 base64
import binascii
import io
import json
import logging
import re
from dataclasses import dataclass
from typing import Iterator, Optiona... |
7a1b3f52a770b7e32939096e1afdd7756f6f904d1468783be1c94f5ea0f4d55c | Python | 12,659 | 314 | """
Plot Figure 6 (Structure from Motion)
"""
import numpy as np
import strinf as si
# # # PARAMETERS # # #
ZOOM = 2.0
SAVE = True
SHOW = True
PANEL = ("D", "E", "H", "I", "J")
param = {
"datadir" : "data",
"DSL_one_cylinder" : "2022-06-17-11-01-10-404662_121_SFM_one_cylinder_switching_distribution_short_d... |
db9dbb02dfed65784a9d0e32306d3b75d3acf953c4aeca6ba659d60b29207841 | Python | 12,659 | 386 | """Functions which help end users define customize node_match and
edge_match functions to use during isomorphism checks.
"""
import math
import types
from itertools import permutations
__all__ = [
"categorical_node_match",
"categorical_edge_match",
"categorical_multiedge_match",
"numerical_node_match"... |
cc1c8bff774f86c415019eb1cb2b6af2d80faad539ad9a421b42e611185be379 | Python | 12,660 | 345 | #! /usr/bin/env python3
### usage: python plumed_scripts/FES_from_State.py -f STATE_FILE -o OUT_FILE --temp TEMPERATURE_K
### Get the FES estimate used by OPES, from a dumped state file (STATE_WFILE). 1D or 2D only ###
# usage is similar to plumed sum_hills
import sys
import argparse
import numpy as np
import pandas... |
6e9752dba9df48c441debc376f1b2bf76708550a40afda166260e4d2fe1f6eb6 | Python | 12,670 | 349 | #!/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 typing import Any
import torch
# Ax `Acquisition` & other MBM imports
from ax.generators.torch.... |
9a6837cf25fbbbfa8d974e55962300cf4288d5793d8a61bef2019f9dcae4ec44 | Python | 12,675 | 417 | """Miscellaneous analyses of behavior data."""
# %%
# Imports
import json
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import pingouin
import seaborn as sns
from scipy.stats import binomtest, sem
from config import ANALYSIS_DIR_LOCAL, BAD_SUBJS, DATA_DIR_LOCAL, STREAMS, SUBJS
from utils impo... |
87be76d644e45b898191973a583b940fbc2c8dc7238a702186c4df929250a08d | Python | 12,678 | 328 | #!/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 functools import partial
from logging import Logger
from typi... |
bb2df2bb66d62bdf93a5512fc0e3c143be63d893798c540aec86c255a14a9a57 | Python | 12,687 | 438 | from itertools import product
import logging
from nl_expr.expression_walker import ChainedWalker, ReplaceExpressionWalker
from nl_expr.logic import (
Conjunction,
Disjunction,
ExistentialPredicate,
Negation,
)
from nl_expr.logic.expression_processing import (
extract_logic_atoms,
extract_logic_... |
25cf14c69c858013e51732ad3bbf56b2faebe5cb7b3f842aa4284d0bc08548c8 | Python | 12,692 | 325 | #!/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 logging
from typing import TYPE_CHECKING
import pandas as ... |
aaff25325d59372ea6640654f186960e63a71358dcfd9af464222755ba73911a | Python | 12,693 | 301 | #!/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 asyncio
import functools
import threading
import time
from collections.abc import Callable, Gen... |
25022733da6a94044b7c748397b058fb63fd2c07cb4c62f3add87bc1dfeffc78 | Python | 12,700 | 383 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 11 13:56:08 2020
@author: amelie
"""
from brian2 import *
#from brian2genn import *
from scipy import signal
from FEF_full3_altf import *
from LIP_full import *
from itertools import *
def generate_syn(source,target,syntype,connection_patter... |
819cdd44261ceb9593a022cfe78bcab6de467c827f72474bd1d5acbddb65a757 | Python | 12,714 | 240 | """
Copyright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Marius Pachitariu and Michael Rariden.
"""
import argparse
def get_arg_parser():
""" Parses command line arguments for cellpose main function
Note: this function has to be in a separate file to allow autodoc to work for CL... |
3e64cec439c19d89422cd434c8e783c5042fced9665f4e3935f8bf9cf81633dc | Python | 12,719 | 364 | """Current-flow betweenness centrality measures."""
import networkx as nx
from networkx.algorithms.centrality.flow_matrix import (
CGInverseLaplacian,
FullInverseLaplacian,
SuperLUInverseLaplacian,
flow_matrix_row,
)
from networkx.utils import (
not_implemented_for,
py_random_state,
reverse... |
92b3cfb319cff0d3c3ac8a23714bbcb10bdac3b70a67867eeeb1a34bde6bea57 | Python | 12,723 | 314 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 30 22:07:08 2022
@author: wirrbel
"""
# We begin by adding the current path to sys.path to make sure that the imports work correctly
import sys
sys.path.append('../brainrender/')
import os
import pandas as pd
import numpy as np
from shutil import co... |
63298519156af99d1170ec95e58cdc44300d2de575f449b85e48a9c0116a9045 | Python | 12,725 | 341 | """Base Command class, and related routines"""
from __future__ import absolute_import, print_function
import logging
import logging.config
import optparse
import os
import platform
import sys
import traceback
from pip._internal.cli import cmdoptions
from pip._internal.cli.parser import (
ConfigOptionParser, Updat... |
ae229544704f5fe7e75fb4498d7553b2b0b6eff6de480efb68719ba61e9b4503 | Python | 12,725 | 302 | #### All original code is copyright of Graham King, Trinity College Institute of Neuroscience.
### Using predicted SNR-HeadPosition and corresponding Fuctional Connectivity data to calculate the parameters of 74,691 linear regressors across 416 participants with one session.
### Note: The raw SNR data from these 416 pa... |
4a8215aea24517d1aef497dffdaa5f6e9aa0f108647c2e905b8ab3a1233eba43 | Python | 12,731 | 321 | import pytest
import networkx as nx
from networkx.convert import (
from_dict_of_dicts,
from_dict_of_lists,
to_dict_of_dicts,
to_dict_of_lists,
to_networkx_graph,
)
from networkx.generators.classic import barbell_graph, cycle_graph
from networkx.utils import edges_equal, graphs_equal, nodes_equal
... |
6d4a7071242fd96afe4948a3af1f07423cf633b87d9f9259a9d1e9c01c10e6df | Python | 12,735 | 368 | # 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 Any, final
import pandas as pd
from ax.ad... |
ef3832b62caa1130c899998b8f61aac2bb88955d4a927da8bf80cdfb75df981a | Python | 12,743 | 483 | # -*- coding: utf-8 -*-
"""
Interface to Imaris Files
Module to read data and write points to `Imaris <http://www.bitplane.com/imaris/imaris>`_
files.
Note:
To write points without errors make sure the original file has at least one spot object! You can create a fake point in Imaris, then save the file. The poi... |
61e950c5c5f930d067dca7981fbf4366daad9b3a049357eb59bc56fc04beefca | Python | 12,751 | 382 | import tables as t
import numpy as np
import pytest
from fanc.general import Mask, Maskable, MaskedTable, MaskFilter, FileBased
import os
from fanc.tools.files import create_or_open_pytables_file
class TestMask:
def test_instantiate(self):
mask = Mask(ix=0, name='test', description='test description'... |
8914824e982f5a3cdbb78c7e10a6994c251f9721eb05514f7e52ee069d008e64 | Python | 12,754 | 382 | import tables as t
import numpy as np
import pytest
from fanc.data.general import Mask, Maskable, MaskedTable, MaskFilter, FileBased
import os
from fanc.tools.files import create_or_open_pytables_file
class TestMask:
def test_instantiate(self):
mask = Mask(ix=0, name='test', description='test descrip... |
9b39c72d57fb66ebe7e6242623de2016825bcb47c220d3ceffcf7306a4cfb7e3 | Python | 12,755 | 282 | # -*- coding: utf-8 -*-
"""
Example script to set up the parameters for the image processing pipeline
"""
######################### Import modules
import os, numpy, math
import ClearMap.Settings as settings
import ClearMap.IO as io
from ClearMap.Alignment.Resampling import resampleData;
from ClearMap.Alignment.Elas... |
6820f22e9bfc71e916c04660bf9ac1e20b7052fa2beff60302b4d8bcbda780fb | Python | 12,756 | 354 | """
Unit tests for adjlist.
"""
import io
import pytest
import networkx as nx
from networkx.utils import edges_equal, graphs_equal, nodes_equal
class TestGenerateAdjlist:
@pytest.mark.parametrize("graph_type", [nx.Graph, nx.MultiGraph])
def test_undirected(self, graph_type):
G = nx.complete_graph(5... |
65e2870693b8f0b3b8ee162b5cb5ddebbb56d1ef5d39ecb14839a1ca3f8675a6 | Python | 12,761 | 361 | #!/usr/bin/env python3
import os
import numpy as np
from param_stamp import get_param_stamp_from_args
from visual import visual_plt
import main
from utils import checkattr
from param_values import check_for_errors,set_default_values
import options
## Function for specifying input-options and organizing / checking the... |
bbe858f3f14ae2ffdb38fbf8aff76d7daf78dbb6b65be19c1f829fe1562451af | Python | 12,767 | 365 | #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.
#
### ### ### ### ### ### ### ... |
795451420c3331c50f3eee9c72c90f93bdb273f9669c5e441aa3487577be3310 | Python | 12,772 | 316 | import itertools
import networkx as nx
__all__ = ["birank"]
@nx._dispatchable(edge_attrs="weight")
def birank(
G,
nodes,
*,
alpha=None,
beta=None,
top_personalization=None,
bottom_personalization=None,
max_iter=100,
tol=1.0e-6,
weight="weight",
):
r"""Compute the BiRank s... |
dc1750afd81ffce786fae6cd176d8da1b77f72648dffd455c1ddd9d07cf2bdde | Python | 12,786 | 377 | """Shared code for working with workbook data.
Module was developed for sample sheet work but extracted for reuse with fetch
workbooks.
"""
import base64
from collections.abc import Generator
from csv import (
Dialect,
reader,
Sniffer,
)
from dataclasses import dataclass
from io import (
BytesIO,
... |
415a9f30f53a5bc753d87712eb71ea51b7900fad5c4f2af1ae746461c6537111 | Python | 12,787 | 310 | # 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 numpy as np
import pandas as pd
from ax.adapter.factory import get_sobol
from ax.adapter.registry import Generators
fr... |
19f513bbac6cd8947ce0c7dc0485854690405f18a276a27a8571ddf86d3edd0d | Python | 12,789 | 343 | import torch
from torch_geometric.data import Data
class BatchFinetune(Data):
r"""A plain old python object modeling a batch of graphs as one big
(dicconnected) graph. With :class:`torch_geometric.data.Data` being the
base class, all its methods can also be used here.
In addition, single graphs can be... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.