sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
c7690b4a1f804992acba7d05c6dada06e2d57b7a07bad878616eb26795687fec | Python | 17,560 | 593 | """
This module uses ctypes to bind a whole bunch of functions and constants from
SecureTransport. The goal here is to provide the low-level API to
SecureTransport. These are essentially the C-level functions and constants, and
they're pretty gross to work with.
This code is a bastardised version of the code found in ... |
509b02418a3b903dfde69eac26649f636920db960abfd821000dda0aa9df2afe | Python | 17,561 | 335 | import os, glob
import numpy as np
import scipy.io as sio
import pandas as pd
from nilearn import datasets
from src.imaging_derivs import DataMatrix, compute_fc, compute_rlfp
from src.utils import load_schaefer_parc, load_glasser_parc
class Environment():
def __init__(self, computer='macbook', parc='schaefer', n_... |
31550c6a162a26f61af9fea7ab37fcf6a34cf6b4806125e3504f21b9ab0fb0e6 | Python | 17,581 | 547 | """Spatial tools general utility functions."""
from __future__ import annotations
import functools
import inspect
import os
import warnings
from collections.abc import Callable, Generator, Hashable, Iterable, Sequence
from contextlib import contextmanager
from enum import Enum
from multiprocessing import Manager
from... |
c670de806382d47d263c7d53595e241171a2af1084cb41c3c1310e34508fa8bb | Python | 17,590 | 491 | import math
import logging
from random import random, randint, choice
import numpy as np
from scipy.spatial import KDTree
from skimage.transform import integral_image, integrate
from gunpowder.batch_request import BatchRequest
from gunpowder.coordinate import Coordinate
from gunpowder.roi import Roi
from gunpowder.nod... |
6e3cc0e7ebc916d1c417d75422c008daf207192b53a9aaffd5924ad4d3163bf9 | Python | 17,591 | 461 | import sys
sys.path.append('../')
from pathlib import Path
import scipy.signal
import scipy
import pickle
import os
import numpy as np
import h5py
import math
import torch
from torch.utils.data import Dataset, DataLoader
from utils import StandardScaler
from constants import INCLUDED_CHANNELS, FREQUENCY
from data.data_... |
1fee3d1a6467770cd66625ab7a88d446f05f777f8645bdb60b56dbe1d1f1b233 | Python | 17,598 | 532 | import array
import atexit
import copy
import os
import tempfile
import numpy as np
import pytest
import zarr
from zarr._storage.store import _get_hierarchy_metadata, v3_api_available
from zarr.meta import _default_entry_point_metadata_v3
from zarr.storage import (atexit_rmglob, atexit_rmtree, data_root,
... |
7577cce47a58b4b7c309f5c0868bbce5352bc7d91c31da3f126a921c2487c73d | Python | 17,608 | 391 | import tensorflow as tf
import tensorflow.keras as keras
from tensorflow.keras import backend, activations
import numpy as np
from .base import FORCELayer, FORCEModel
class SpikingNN(FORCELayer):
"""
Parent class part of the spiking neural networks as described in `Nicola and Clopath
<https://www.nature.c... |
a0e448e7a18a88cd62313bc31c54f8a0b26b144a217b12be8413b474e57c4fd2 | Python | 17,639 | 528 | import pathlib
import subprocess
import warnings
from concurrent.futures import ProcessPoolExecutor, as_completed
from itertools import combinations
from typing import List
import anndata
import numpy as np
import pandas as pd
import scanpy as sc
import xarray as xr
from sklearn.metrics import pairwise_distances, roc_... |
8aeb83283ef3f2719192171a60e156341274ab27b5eb1efde653a312069589ef | Python | 17,643 | 528 | """
This module includes the main class that handles the calculation
of the hydrogen bonds.
"""
# Python import(s).
from collections import namedtuple
import numpy as np
# BIO-python import(s).
from Bio.PDB.vectors import Vector, calc_angle
# Private import(s).
from src.chemical_shifts.auxiliaries import ACCEPTED_RE... |
7fc3f09311c4f99a41d1cc075b53ca74a60a09b283d8c9bc5966a7e28df7ef60 | Python | 17,647 | 543 | """Postprocessing Pipeline Workflow Builder and Distributer.
Based on user input, builds and runs a postprocessing pipeline for a set
of subjects, distributing the workload across a cluster if requested.
"""
import sys
import os
import warnings
import json
import time
from pathlib import Path
from .bids import (
... |
747aecdcc755c673606a8365cc2670b9dad8b34483e660b9bd95be92da6961b8 | Python | 17,653 | 385 | import json
import re
import shlex
import typing
from logging import getLogger
from os import (
getcwd,
makedirs,
)
from os.path import (
abspath,
join,
)
from typing import Optional
from galaxy import util
from galaxy.job_execution.output_collect import default_exit_code_file
from galaxy.jobs.runners.... |
1365b43820206c2cffbcb690a24a5dcf56cd4e697df4fc76fe5610e8f5592c07 | Python | 17,663 | 472 | from __future__ import division
from fanc.data.genomic import Hic, Node, Edge
from fanc.architecture.hic_architecture import PossibleContacts, ExpectedContacts, DirectionalityIndex, \
InsulationIndex, ObservedExpectedRatio
import pytest
import numpy as np
from fanc.tools import dummy
import os.path
class TestHicA... |
d6de75b70ec9f48586018228e2a0552a80349b99cf84e3e46a6dc61a28e53201 | Python | 17,670 | 361 |
##########################################################################################
#
# psim_simulate.py
#
# - Functions implementing the core simulation engine.
#
##########################################################################################
#
# ProBioSim
# Copyright (C) 2021 Matthew Lakin
#
#... |
51424ab03bb6ad091e79b407727d40abaf95197849b52da29f9d83406fd1d262 | Python | 17,672 | 421 | import torch
import torch.nn as nn
from torch.nn import init
import torch.nn.functional as F
import numpy as np
from set2set import Set2Set
# GCN basic operation
class GraphConv(nn.Module):
def __init__(self, input_dim, output_dim, add_self=False, normalize_embedding=False,
dropout=0.0, bias=True):
... |
df5160884364125ad2707cc9ad0dc370a1bc5b689ea30eb323b3d9f7081524a1 | Python | 17,674 | 544 | """Unit tests for the :mod:`networkx.algorithms.minors.contraction` module."""
import pytest
import networkx as nx
from networkx.utils import arbitrary_element, edges_equal, nodes_equal
def test_quotient_graph_complete_multipartite():
"""Tests that the quotient graph of the complete *n*-partite graph
under ... |
e5a2a58b2d8d58e3214ebec16369a70223aae905fc1c8e98df4b533812d94f3f | Python | 17,696 | 452 | from dataclasses import dataclass
import numpy as np
# utility class used in AlignmentModel storing data to construct a full MSA
@dataclass
class AlignmentMetaData:
num_rows: int
"""Number of sequences in the alignment."""
num_match: int
"""Total number of match states in pHMM."""
num_repeats_p... |
39da9cdda3045339b426a7a45b1af3d7273b7be6350fe04465fe6f8b29e6ea97 | Python | 17,701 | 470 | #!/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 numpy as np
import pandas as pd
from ax.core.arm import Arm
from ax.core.batch_trial import Ba... |
564b1d7c1db1007b73212f5c9eae8d987f476d4adc627baac9fd8d8ac44072b0 | Python | 17,704 | 490 | #!/usr/bin/env python
"""Recommend the most appropriate biocontainer for a list of conda packages.
Given a list of required packages (name + optional version) this resolves the
best matching ``quay.io/biocontainers`` image, verified against quay.io rather
than guessed. It reuses the existing mulled machinery (:mod:`.u... |
570e49ca2ceb0b1269ec4d2f12c31909d4b947f21d2f40175e1b128169cf3416 | Python | 17,704 | 486 | #!/usr/bin/env python
import argparse
import json
import logging
import os
import sys
import tempfile
import time
from typing import (
Dict,
List,
)
from galaxy.tool_util.deps.conda_util import CondaContext
from galaxy.util import (
check_github_api_response_rate_limit,
requests,
which,
)
from .mu... |
7e029fb723cebf221757574f5170cc4edf41ed50a5c16b85341fe9300400270b | Python | 17,705 | 752 | # 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... |
1f0721e6149ef27e621c8ae75bdad087924ac7ea8a8f2e9da1c58c9f99b5b283 | Python | 17,707 | 399 | from contextlib import nullcontext
import torch
import torch.nn.functional as F
from torch import Tensor
__all__ = [
"kernel_dot_product",
"spike_similar_loss",
"temporal_efficient_training_cross_entropy",
]
@torch.compiler.assume_constant_result
def _kernel_autocast_available(device_type: str) -> bool:... |
cf77f8a322e3e7f787f5a72abb6609e41d5b11fe4a72353aee8cc437e72cb64f | Python | 17,709 | 489 | """Generate and save the volumetric cell densities of the BBP mtypes
A BBP mtype is a morphological type, i.e., a BBP type string such as "NGC-SA", "CHC" or "DLAC"
for instance.
A density value is a non-negative float number corresponding to the number of cells in mm^3.
A density field, a.k.a volumetric density, is a ... |
6bd822d89a63e1a37eaee071d2470eb7f7f091844b241b4bc2dae79609cd6b71 | Python | 17,718 | 470 | """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 sys
from datetime import timedelta
from functools import partial
from typing import Any
import django_rq
import redis
from c... |
c02a8e349a70b7c3b8cf9acf4dac3397b875003b3df4b9893f2d9dc728cb69c4 | Python | 17,729 | 529 | # Original code at https://github.com/awai54st/BinaryNet-with-Keras-and-TF
import numpy as np
import pickle
import functools
import tensorflow as tf
from tensorflow.keras.models import Sequential, Model
from tensorflow.keras.layers import Dense, Convolution2D, Activation, Flatten, MaxPooling2D,Input,Dropout,GlobalAver... |
7ae932fb7b45395e42555e6fff215ac2e54609aa93b93acab412240b28308620 | Python | 17,731 | 624 | import math
from operator import itemgetter
import pytest
import networkx as nx
from networkx.algorithms.tree import branchings, recognition
np = pytest.importorskip("numpy")
#
# Explicitly discussed examples from Edmonds paper.
#
# Used in Figures A-F.
#
# fmt: off
G_array = np.array([
# 0 1 2 3 4 5... |
b026cd4d0ab97c99dfe220414960ad27b37f12a70d8b5e0396d7f7b1e141899f | Python | 17,741 | 511 | # -*- coding: utf-8 -*-
"""
Created on Tue Feb 22 17:09:31 2022
@author: marcomau
"""
import os
import numpy as np
import torch
import torch.nn.functional as F
from torch_geometric.data import Data
import model_buckling1
from utils_buckling2 import*
from sklearn.preprocessing import StandardScaler, MinMax... |
99bdf12661542a037f1a0b1dab83838b723fd50ecae4c44aaae8d72e51438c51 | Python | 17,749 | 566 | from typing import (
Any,
Dict,
List,
Optional,
Type,
Union,
)
from pydantic import (
Field,
RootModel,
)
from typing_extensions import (
Annotated,
Literal,
TypeAlias,
)
from galaxy.objectstore.badges import (
BadgeDict,
StoredBadgeDict,
)
from galaxy.util.config_t... |
8049a1261606f23832b6f33169a4cda60a8eb4b70400bd05f8303587393e74bd | Python | 17,752 | 345 | """
Created on Oct 12, 2022.
@author: voodoocode
"""
import numpy as np
import warnings
import nibabel.freesurfer
import matplotlib.pyplot as plt
import finnpy.src_rec.utils as utils # @UnresolvedImport
import finnpy.src_rec.sphere_mdl # @UnresolvedImport
import finnpy.src_rec.extract_anatomy # @ @UnresolvedImpor... |
e3765d800855286b61a81a5adacd833c0e0d684b1810524be020181e443f4d51 | Python | 17,754 | 396 | """
Functions to compute the average cell densities of AIBS mouse brain regions for several types
including PV+, SST+, VIP+ and the inhibitory neurons (GAD67+) based on experimental measurements.
Densities are either obtained from a density measurement reported in a scientific paper or are
inferred from one or more me... |
9ae73f61871c933393e646bc3323fd11f7a82ff2c688755a916c62e816b2d838 | Python | 17,764 | 543 | """Postprocessing Pipeline Workflow Builder and Distributer.
Based on user input, builds and runs a postprocessing pipeline for a set
of subjects, distributing the workload across a cluster if requested.
"""
import sys
import os
import warnings
import json
import time
from pathlib import Path
from .bids import (
... |
83c6af0452073aa9a3a540dde48bde108cb4ba61bcb53075e3dbd4fb76946ff0 | Python | 17,765 | 469 | import sys
sys.path.append('../')
from pathlib import Path
import scipy.signal
import scipy
import pickle
import os
import numpy as np
import h5py
import math
import torch
from torch.utils.data import Dataset, DataLoader
from utils import StandardScaler
from constants import INCLUDED_CHANNELS, FREQUENCY
from data.data_... |
bd86558578f3ebb80adad9dad8169dc421c326313ec35e4c54736dd15f7be995 | Python | 17,800 | 422 | import numpy as np
from .. import config, types
from ..exceptions import PackingError, PackingWarning
from ..reporting import report, warn
from ..voxels import VoxelSet
from .strategy import PlacementStrategy
class _VoxelBasedFiller:
"""
Internal mixin for filler placement strategies.
"""
def _fill_... |
a740ab10e10f2168960380ab2885f447d197234b1fec6743620b526d78b099be | Python | 17,804 | 478 | # ----------------------------------------------------------------------------
# Model_MultilayerPerceptron_Validation_CoronalSagittalSampling.py
# Author: Antoine Beauchamp
# Created: February 3rd, 2021
"""
Implement cross-validation
Description
-----------
"""
# Packages ------------------------------------------... |
bc8eb56422e8580cf0614e215340094bc3ab8bcbc05843f3143094a229685519 | Python | 17,806 | 475 | import bz2
import importlib.resources
import pickle
import pytest
import networkx as nx
class TestMinCostFlow:
def test_simple_digraph(self):
G = nx.DiGraph()
G.add_node("a", demand=-5)
G.add_node("d", demand=5)
G.add_edge("a", "b", weight=3, capacity=4)
G.add_edge("a", "... |
77cec4303c9b50401e76c9aa6d6e82ee865a80a7950a5cd92446de7c92c404d8 | Python | 17,816 | 337 | import copy
import random as rd
import unittest as ut
import networkx as nx
from pysbm import test_ground, sbm
class TestObjectiveFunctions(ut.TestCase):
""" Test Class for objective functions """
def setUp(self):
self.graph = nx.Graph()
self.number_of_nodes = 10
for i in range(self... |
ddffb9005263c8f8d0280b012bb5fbfe1fd127675357b2238b5969e905885ccb | Python | 17,822 | 447 | #!/usr/bin/env python
import pystan
import argparse
import vcf
parser = argparse.ArgumentParser(description="consensus genotype calling and ambient RNA estimation")
parser.add_argument("-c","--clusters",required=True,help="tsv cluster file from the troublet output")
parser.add_argument("-a","--alt_matrix",required=Tru... |
8ae2403b75b3075a7e7f0a43c86338b27b85079939eca22c546700254842a62d | Python | 17,825 | 625 | """
Shortest path algorithms for unweighted graphs.
"""
import operator
import networkx as nx
__all__ = [
"bidirectional_shortest_path",
"single_source_shortest_path",
"single_source_shortest_path_length",
"single_target_shortest_path",
"single_target_shortest_path_length",
"all_pairs_shortes... |
6e2844b1f325051ef533fe907e0e885266cac627d192ca1045eb82037989b073 | Python | 17,828 | 490 | import sys
from functools import partial
from typing import Optional, Tuple
import numpy as np
import pandas as pd
import tqdm
from scipy.spatial import distance as dist
from sklearn.base import (
BaseEstimator,
ClusterMixin,
TransformerMixin,
)
from sklearn.utils.validation import check_is_fitted
from di... |
e534df375554089015253952aa709a7f18205dcb951ecd4a70c0f96fa91f5b48 | Python | 17,829 | 371 | #!/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.abc import Iterable
from logging import Logger
import pandas as pd
from ax.core.expe... |
d2307ddd80795eada295d7e414137464800176816924de10faf82b76db119cca | Python | 17,844 | 356 | """
General plot functions for making figures
"""
import numpy as np
import roblib
import settings
import matplotlib.pyplot as plt
import os
import matplotlib
cmap = matplotlib.cm.get_cmap('plasma')
from pathlib import Path
import pandas as pd
from sklearn import linear_model
from scipy.ndimage import gaus... |
3aa418fc71037cab9d7992e82cbabe0a1bce46d9e67febf2c20b703ce600f88f | Python | 17,870 | 551 | import logging
import typing
from collections import deque
from itertools import product, tee
from .expression_pattern_matching import (
PatternMatcher,
add_entry_point_match,
add_match,
)
from .expressions import (
Constant,
Expression,
FunctionApplication,
Lambda,
NeuroLangException,
... |
40a4c5db9c579a427a58768c4e8d06a97b93863af8503d82efc2cef2da51051d | Python | 17,870 | 520 | # 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 ... |
506b4120df6d06c739162bab8a3dc06924b2c71fb3bb217e14720ac26dbc6531 | Python | 17,884 | 556 | # -*- coding:utf-8 -*-
import json
import networkx as nx
import numpy as np
import optparse
import sys
import pandas as pd
import re
import random
from sklearn import metrics
"""
# =============================================================================
S T A R T D E F I N I T I O N S ... |
fce2ee38197bc4db78aff7dd181a24dc5255c2c606e833f3b100775548f7c87c | Python | 17,911 | 473 | import logging
import operator
from collections import defaultdict
from functools import lru_cache
from typing import AbstractSet, Callable
from nl_expr.exceptions import (
ProjectionOverMissingColumnsError,
UnboundVariablesError,
WrongArgumentsInPredicateError,
)
from nl_expr.expressions import Constant,... |
2cbc51df7ba000ed9dfeb20aa0df273a0e2e4baea56ea3faa120e8f8141ff180 | Python | 17,916 | 395 | """
OBJECTIVES:
Analyze microtubule (MT) spread from kymographs
with maximum intensity projections.
There are two different measures:
1) Length in the neurite in um over which 90% of the
MT intensity is spread out.
2) The percentage of MT spread retrograde and anterograde.
Steps:
1) Get background v... |
a9d46c05f4e489801f778f5191664ded9ef04aa8cae260e5e6cb25dda159e9bc | Python | 17,921 | 530 | """Lifted inference for conjunctive queries with existential and negated
existential subqueries, Q1(x, y) ∧ ¬∃t Q2(x, t), sharing symbols with the
rest of the query or with comparisons, checked against the probabilities
computed by enumerating every possible world.
"""
import itertools
import operator
import pytest
f... |
05f5eb84cb5db4f566709afdc187d6253cfd8ea78bdbbb41fabd48a1d08e152b | Python | 17,927 | 466 | 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... |
4d7e01da0e3e04c7fec9ff54c603e5899372d47223a81e15e2cc64e9481696f7 | Python | 17,938 | 430 | # -*- coding: utf-8 -*-
"""
OBJECTIVE:
Measure and calculate the following parameters
X MT distribution across neurite (proximal vs distal)
- neurite length and growth/retraction
X Average MT density in neurite
"""
import pandas as pd
import os
import glob
import copy
import numpy as np
i... |
6316a072bb0d7b2f7261dc531905e69d4a4773daf2875a49b175e51059c1b5b3 | Python | 17,939 | 400 | """ Optimize crystals for thermodynamic stability
"""
import argparse
import logging
import math
import os
import time
from typing import Tuple
import pandas as pd
## Apparently there's an issue with the latest version of pandas.
## Got this fix from here:
## https://github.com/pandas-profiling/pandas-profiling/issues... |
c047b26323b32a34b0e3fb38df0050984b4881efcd3a1104cc425189339730d5 | Python | 17,949 | 697 | from pytest import raises
from operator import eq
import typing
import numpy as np
from nl_expr.exceptions import SymbolNotFoundError
from nl_expr.expression_walker import (
ExpressionBasicEvaluator,
ExpressionWalker,
)
from nl_expr.expressions import Constant, ExpressionBlock, Symbol
from nl_expr.logic impo... |
510a28f3605170dcc195fa0f67f0691c142a10ee01067da37850607752e83687 | Python | 17,951 | 394 | '''
The script to train PIGNPI
'''
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.optim import Adam
from torch_geometric.data import ... |
6f46a9e750d834a34e0b3915eb4e9c62cb5c72cb40ceebd625f9c83307115867 | Python | 17,961 | 470 | import contextlib
import contextvars
import functools
import inspect
import typing
import warnings
import h5py
import numpy as np
from ._telemetry import _hdf5_tracer
if typing.TYPE_CHECKING: # pragma: nocover
from . import HDF5Engine
# Semantic marker for things that get injected
HANDLED = None
# Per-(engin... |
273e9664c983c007aaab9721cd80eef0ab644ece5fbc0b76e91b57d0c926f529 | Python | 17,987 | 425 | # -*- coding: utf-8 -*-
"""
OBJECTIVE:
Measure and calculate the following parameters
X MT distribution across neurite (proximal vs distal)
- neurite length and growth/retraction
X Average MT density in neurite
"""
import pandas as pd
import os
import glob
import copy
import numpy as np
i... |
830b7b09dd487e88eac16eae34dc33d6b8e827b9e660c7730b117763f37f3fc3 | Python | 17,992 | 431 | """ 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 demi... |
e17237ca11c38a678a9e9a39ba32050cf6939ed2f2cf216fe4a8be9ba31acffc | Python | 17,997 | 343 | # 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... |
ec596580d4561f9272bd5f89b3bc06f9ca8fa24bd30d961b2987f1dd986722b3 | Python | 18,010 | 414 | import os
import pandas as pd
import numpy as np
from collections import defaultdict,OrderedDict
from itertools import combinations
from itertools import chain
from collections import namedtuple
import pickle
import os.path
import shutil
import inspect
from glob import glob
import torch
import torch.nn as nn
import to... |
784d22ab83b3a8af25a80eb35570d0e80b8a7749d0240ff36965f62e624881bd | Python | 18,053 | 450 | """Functions for detecting communities based on modularity."""
from collections import defaultdict
import networkx as nx
from networkx.algorithms.community.quality import modularity
from networkx.utils.mapped_queue import MappedQueue
__all__ = [
"greedy_modularity_communities",
"naive_greedy_modularity_commu... |
7eb64a97aa07d2040d7e36737b839c36b762470af667a85689e166df69967da5 | Python | 18,063 | 537 | """
I/O Classes for ALLC and BAM files
- read and write allc file
- parallel writing
- read region from allc
- separate process gives better performance
This file is modified from xopen 0.3.4
Here is the licence
Copyright (c) 2010-2018 Marcel Martin <mail@marcelm.net>
Permission is hereby granted, free of charge, ... |
388054cdd00d35faef4d9a718cf30d60dc07a9d3fb4079a6c3bd5638c0b35657 | Python | 18,094 | 464 | # -*- coding: utf-8 -*-
# Author: Florian Boudin and Vítor Mangaravite
# Date: 09-10-2018
"""YAKE keyphrase extraction model.
Statistical approach to keyphrase extraction described in:
* Ricardo Campos, Vítor Mangaravite, Arian Pasquali, Alípio Mário Jorge,
Célia Nunes and Adam Jatowt.
YAKE! Keyword extraction f... |
eca75aea40a2383dac536c8cc4c6693dfc81907a6c6708a6f05eab0374d40525 | Python | 18,100 | 546 | import collections
import functools
import gzip
import itertools
import os
import pathlib
import shlex
from collections import defaultdict
from functools import partial
from subprocess import PIPE, CalledProcessError, run
from typing import List, Union
import numpy as np
import pandas as pd
from ._doc import *
from .... |
5dcb8b3b709c5f1bab5e7cdcbc9836bec5165f1d85fc2f53cac9e86c5349d037 | Python | 18,107 | 492 | """
An interactive viewer of brain images, as a self-contained HTML page.
:func:`viewer_html` writes a page showing NIfTI images on one grid, its
overlays, over a background, the MNI152 T1 of nilearn
(:func:`mni_background`), with NiiVue [niivue]_: three orthogonal slices
with a crosshair, drawn with WebGL2, which a c... |
5af0a6c70433ab22554f9a533dfa15be5739c1189ca5cebd3be1d588ac9d4225 | Python | 18,121 | 462 | # # # # # # # # # # # # # # # # # # # # # # # #
# # # #
# # # # Modeling human choices on motion structure classification.
# # # #
# # # # Steps:
# # # # 1) Define a set of features on lambda
# # # # 2) Train a Logistic Regression model (LRM) on these features to predict the ground truth structure
# # # # 3)... |
b36108a09d01c884133d4bf200c5ce47dfa2eb285e6f9095127bbec521e47e42 | Python | 18,129 | 478 | import os
import random
import warnings
from typing import List
import feather
import numpy as np
import pandas as pd
import scipy.ndimage as ndimage
from alpineer import image_utils, io_utils, load_utils, misc_utils
from pyarrow.lib import ArrowInvalid
from skimage.io import imread
import natsort as ns
def calculat... |
f3a85684ff6c1661f4c3422189199fb5e44c1160e8d1bc158ea6100bc5a00d82 | Python | 18,136 | 458 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 7 13:11:52 2018
@author: jacobrosenstein
"""
from lxml import etree
from time import sleep
import numpy as np
import csv
import chemcpupy.tools.Containers as Containers
#from chemcpupy.tools.misc import *
# ======================================... |
79f8b77a8ab6aad45f887819e7f0b230ed8c533c84094e8012bf5e29db1fdd03 | Python | 18,140 | 403 | import collections
import logging
import os
from typing import (
Any,
Container as TypingContainer,
Dict,
List,
Optional,
Type,
TYPE_CHECKING,
)
from requests import Session
from typing_extensions import Literal
from galaxy.util import (
asbool,
plugin_config,
)
from . import conta... |
ec3540fa4201864914bebde9e9f2aab327ace4de8e251a8fb33744ab9a49fbb8 | Python | 18,145 | 397 | import logging
from typing import (
Optional,
Union,
)
from uuid import uuid4
from pydantic import (
UUID4,
ValidationError,
)
from sqlalchemy import select
from galaxy.config import GalaxyAppConfiguration
from galaxy.config.url_headers import UrlHeadersConfigFactory
from galaxy.exceptions import (
... |
aed81fd8899fdf84a882b580d013600e5b65039914bff976364c4a3dc2601ad4 | Python | 18,149 | 572 | """
Generators for some directed graphs, including growing network (GN) graphs and
scale-free graphs.
"""
import numbers
from collections import Counter
import networkx as nx
from networkx.generators.classic import empty_graph
from networkx.utils import (
discrete_sequence,
np_random_state,
py_random_sta... |
2e479e11f109b7100286160197ffca1312ddf05039bd7295a3180d4395e9c310 | Python | 18,182 | 352 | # -*- coding: utf-8 -*-
"""
Created on Mon Jul 29 14:07:09 2019
@author: schelskim
"""
from .generaltools import generalTools
import sys
import os
import numpy as np
import pandas as pd
from skimage import io
from skimage import morphology as morph
from scipy import ndimage
from skimage import measure
import cv2
imp... |
308c33fa563ef84fe89101765cdf9ffe05b5e6b22ee3a13864fdbd61d67956a8 | Python | 18,191 | 434 | from __future__ import division
import vcf, os
import csv
import re
import pdb
import datetime
import numpy as np
import pandas as pd
import pysam
import sys
import glob
import math
def main():
pass
# input/output/parse files
def global_variables():
global_variable_dict = {
"SAMPLE" : ['SAMPLE','S... |
c4db62cdf87f4e79d4cf809bb0f8bc564631451e3a1e3de58be2dc90f1b7a5b6 | Python | 18,200 | 448 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 19
@author: amelie
"""
from mdPul_two_columns_v3 import *
from FEF_and_LIP import *
def generate_syn(source,target,syntype,connection_pattern,g_i,taur_i,taud_i,V_i):
eq_syn='''_post=s_i*g_i*(V_post-V_i) : amp * meter ** -2 (summed)
ds_... |
cfe08740a640f68cea7988cccc227e140388856e7976325ecf36a1ff6975f834 | Python | 18,204 | 468 | #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.
#
### ### ### ### ### ### ### ... |
2622ad928ade36b9574a967ca93028b38eadfeff6c90790d1fd5d433c3d73f6b | Python | 18,207 | 566 | from __future__ import print_function
try:
import argparse
import os
import numpy as np
from torch.autograd import Variable
from torch.autograd import grad as torch_grad
import torch
import torchvision
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.... |
be7ebf866193a44258fd290322cfa51c9f59f7c4125d6fdfbcb0b279882d8f18 | Python | 18,222 | 484 | """ visualization methods for the fdtd Grid.
This module supplies visualization methods for the FDTD Grid. They are
imported by the Grid class and hence are available as Grid methods.
"""
## Imports
import os
# plotting
import matplotlib.pyplot as plt
import matplotlib.patches as ptc
from matplotlib.colors import L... |
43e5d1b8d9572be919cc080f6391a76c3a86a39f3323e0b470e4e42c266bbe1c | Python | 18,225 | 582 | import operator
from typing import AbstractSet
import pytest
from nl_expr.expressions import Constant
from ..probabilistic.cplogic import testing
from ..relational_algebra import (
ColumnInt,
ColumnStr,
Difference,
ExtendedProjection,
FunctionApplicationListMember,
NamedRelationalAlgebraFrozen... |
e56d99644f46034583d018fb5b361b9f873b05bb3a1c7667aa98e50b37654444 | Python | 18,237 | 539 | # -*- coding: utf-8 -*-
"""
Created on Tue Feb 22 17:09:31 2022
@author: marcomau
"""
import os
import numpy as np
import torch
import torch.nn.functional as F
from torch_geometric.data import Data
import model_wrinkling2 as model
from utils_wrinkling2 import load_graph, mean_std, transform_stdScaler, inve... |
64097fb159ad735e2fb5a335672b45e7833134dde332e552b29ba6824018c4dd | Python | 18,239 | 442 | import random
import networkx as nx
import numpy as np
import scipy.sparse as sp
import torch
import torch.nn as nn
import torch.nn.functional as F
from cogdl.utils.transform import dropout_adj
from cogdl.wrappers.tools.wrapper_utils import evaluate_node_embeddings_using_logreg
from tqdm import tqdm
from .. import Un... |
95a83b3f212df21e20ed85b9826738fe1b23b2aa199dad14683653fe887d20bb | Python | 18,239 | 398 | # 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... |
ca46652466965d29c32bd1054b00264a7526c8e829ec2b6e0f9d303a0f07c58e | Python | 18,242 | 401 | # -*- coding: utf-8 -*-
"""
Created on 2021.08.19
@author: Jiahua Rao
"""
import time
from datetime import timedelta
import numpy as np
import pandas as pd
import torch.nn.functional as F
import torch
from MolRep.Models.metrics import *
from MolRep.Utils.utils import *
from MolRep.Explainer.Attribution.utils.utils... |
30ddd3bc2afe9022e5ef95f4b92dc66bffb200f0d164625bb8fd8de55926d38f | Python | 18,246 | 377 | import numpy as np
from scipy.stats import mode
from scipy import ndimage
from pathlib import Path
from natsort import natsorted
import tifffile
from cellpose import metrics, io, vit
import fastremap
import torch
from torch import nn
from tqdm import trange, tqdm
from cellpose import transforms, dynamics, models, tra... |
82cd66ef56124f0d292188e2019ad6643d27284f2895f61f52e2917673ed7343 | Python | 18,247 | 342 | import os
import sys
import urllib.request
from contextlib import redirect_stderr, redirect_stdout
os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE"
import argparse
from typing import Optional, Union
try:
from typing import Literal
except:
from typing_extensions import Literal
try:
from ultralytics import YOLO
e... |
fefafaa2f3e837d7efd0a2f6a0576f793f9e68a54e71c09b4fb3b75974d13ebf | Python | 18,247 | 450 | #!/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 *
def generate_syn(source,target,syntype,connection_pattern,g_i,taur_i,taud_i,V_i):
eq_syn='''_post=s_i*g_i*(V_post-V_i) :... |
eb5d16b6f0cb06ec677071d0c3b9d21c6fa45806033c3105390672857048b99a | Python | 18,249 | 536 | """Template-aware configuration models for file sources."""
import logging
from datetime import (
datetime,
timezone,
)
from typing import (
Annotated,
Any,
Generic,
Literal,
Optional,
TYPE_CHECKING,
TypeVar,
Union,
)
from pydantic import (
BaseModel,
BeforeValidator,
... |
e5c65bb210f1a0f713b71123a7d898499aa81b6de1f4f27b8b6f766e99d953c6 | Python | 18,309 | 350 | ## Functions for qubicc_models_plots.ipynb and narval_r2b4_on_narval_r2b5.ipynb ##
import os
import gc
import sys
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# Add path with my_classes to sys.path
sys.path.insert(0, '/pf/b/b309170/workspace_icon-ml/cloud_cover_parameterization/')
from my_c... |
d54ab7de7b9b78159a25ee82bf3198a673af49d4cbf35b2d5766106716f018dc | Python | 18,312 | 427 | #!/usr/bin/env python
#
# Copyright (c) 2016 10X Genomics, Inc. All rights reserved.
#
from collections import defaultdict
import martian
import json
import os
import subprocess
import tenkit.fasta as tk_fasta
import tenkit.log_subprocess as tk_proc
import tenkit.qc as tk_qc
import tenkit.preflight as tk_preflight
impo... |
1ea7e2929c138d265818766c942292622e9750d1932373658f6fe7a46e59fe6d | Python | 18,314 | 443 | #!/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 torch
from ax.core.search_space import SearchSpac... |
86dc164db7eb4f1dbff303c42d908068d9f563596e50d8678ed2acef423c4220 | Python | 18,315 | 404 | #!/usr/bin/env python3
import os
import numpy as np
import time
import torch
from torch import optim
# -custom-written libraries
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 cb
from data.load import get_c... |
c86e6e441709ae684c10fdedf467f544552d6dfc59f63c6baeb3ee1b215c9854 | Python | 18,319 | 561 | # -*- coding: utf-8 -*
import random
import collections
import time
from os import walk
import os
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.metrics import f1_score
import numpy as np
from sklearn.metrics import confusion_matrix
from torch.utils.tensorboard import SummaryWriter
from torch im... |
d4829e522e3d1d1f1a00e9b657872604bd8d197bc5f5c6fc9aa5bd8e790d1ae6 | Python | 18,319 | 556 | import math
from itertools import permutations
import pytest
import networkx as nx
from networkx.utils import edges_equal
@pytest.mark.parametrize(
"fn", (nx.is_matching, nx.is_maximal_matching, nx.is_perfect_matching)
)
@pytest.mark.parametrize(
"edgeset",
(
{(0, 5)}, # Single edge, node not i... |
d30cbb51dc0278d4c6aa332195d977fc69bb341ddea030fc124ff48314013b43 | Python | 18,321 | 375 | # 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... |
f39ae990ef56df795fc722051774039daaccf18a173a724ca93772fddc653b46 | Python | 18,349 | 390 | 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.optim import Adam
from torch_geometric.data import Data, DataLoader
from tqdm import t... |
5646eab44946df33302ba898349f5520de8d85a17b38dc6084a6e701333b3b62 | Python | 18,359 | 531 | # 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... |
19f8ab0dcf789b4a1850246e7c89ef696a4c82d0af52f8ca814b14bcf217f749 | Python | 18,360 | 454 | # 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... |
44119c4f6b6b5be11fcffaaa8062a335de715803104c65eb22586a9b837bac76 | Python | 18,370 | 296 | __author__ = "Simon Nilsson; sronilsson@gmail.com"
import os
os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE"
from typing import Dict, List, Optional, Tuple, Union
try:
from typing import Literal
except:
from typing_extensions import Literal
try:
import torch
from ultralytics import YOLO
except ModuleNotFou... |
ac36877e6c0af49623c446814bd8dba6b135ebf6a12999cfa0676b6e6c404933 | Python | 18,378 | 496 | import math
import random
from itertools import combinations
import pytest
import networkx as nx
def l1dist(x, y):
return sum(abs(a - b) for a, b in zip(x, y))
class TestRandomGeometricGraph:
"""Unit tests for :func:`~networkx.random_geometric_graph`"""
def test_number_of_nodes(self):
G = nx.... |
1ef7d11736209a13dfefa6df33e3fb53c0d2b2c6cdafaa4c6d3e65afccfd27fd | Python | 18,382 | 454 | import os
import numpy as np
import pandas as pd
import scipy
import sklearn.metrics
import xarray as xr
from alpineer import io_utils, misc_utils
from scipy.spatial.distance import cdist
from sklearn.cluster import KMeans
from statsmodels.stats.multitest import multipletests
from tqdm.notebook import tqdm
import ark... |
22d50716b1d1cee12fc13a264ad519f07b01b5b5130d79f42b53be54fd9f7589 | Python | 18,431 | 582 | """Calculate RSA neurometrics.
- import subj/stream wise rdm_times arrays
- for each subj/stream, average over time window: 9x9 RDM
- create an array of numberline RDMs with different parameters each: kappa, bias
- for each subj/stream/meantime RDM, correlate with all model RDMs --> grid
- plot mean over grids for eac... |
47ed6c2d91d4c1585eaddcbc282a2410bb99be79b2074ee597ba9c236ec5f6a6 | Python | 18,441 | 447 | from typing import (
Any,
Dict,
List,
Optional,
TYPE_CHECKING,
)
from requests import Session
from typing_extensions import (
NotRequired,
TypedDict,
)
from galaxy import exceptions
from galaxy.util import (
asbool,
listify,
)
from .dependencies import ToolInfo
from .resolvers impo... |
b3abf6027f70c2c8191afb8ed0b351f625ea8b0bb54d53ed435a01bf82e67e30 | Python | 18,452 | 415 |
import logging
from collections import Counter
from typing import Dict, List, Optional, Tuple
import numpy as np
import pandas as pd
import tensorflow as tf
import tensorflow_addons as tfa
from tqdm import tqdm
import time
from pymatgen.core import Composition, Structure
from pymatgen.analysis.phase_diagram import Pha... |
db0d70a222a68bcc5e612f80545759bf51aab0b69c0764a729f8469dc369d7e2 | Python | 18,464 | 438 | import os
import pathlib
import tempfile
import feather
import numpy as np
import pandas as pd
import pytest
from alpineer import io_utils, misc_utils, test_utils
import ark.phenotyping.cluster_helpers as cluster_helpers
import ark.phenotyping.pixel_som_clustering as pixel_som_clustering
parametrize = pytest.mark.pa... |
a346759c613ecff4ffbfcccf68937206d9988a9518e762ed9d5d851de9668810 | Python | 18,465 | 282 | import pandas as pd
import numpy as np
import pathlib
import matplotlib.pyplot as plt
from ..utils import helper_functions
def gather_sim_configs(sim_config_dir: pathlib.Path, save_dir: pathlib.Path):
"""
Collect the information on the simulation configurations for all within the specified directory
:pa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.