sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
0ba18f11147511573395af6f56dd2697da6123c0ce4f10706fa837f5efa0e8f8 | Python | 16,797 | 430 | import os
import matplotlib.pylab as plt
import numpy as np
import pandas as pd
import seaborn as sns
import tensorflow as tf
from numpy import interp
from sklearn import metrics
from tensorflow.keras import optimizers
from tensorflow.keras.layers import Dense, Conv2D, Dropout, Input, Flatten, AveragePooling2D
from te... |
a9f6415de001249ce770157010d0be7810d42cbd35fe53af17e2ad5b98bcbfb1 | Python | 16,798 | 570 | # 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... |
af4f6cf0d998bc108ceab9c2607399decd1c913edfc757673bcdc19c9dfab97f | Python | 16,798 | 511 | #!/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 import *
from LIP_full import *
from itertools import *
def generate_syn(source,target,syntype,connection_pattern,g_i... |
b09b2f7789f2da8b31ebb2b0d52943b7a8041bad43cac23ced14f016363da5ec | Python | 16,801 | 389 | #!/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 typing import TYPE_CHECKING
import numpy as np
from ax.adapt... |
55872ab7b3eda80e2817646c2cbb07e71a09fd18b2f4862d901424726102e7db | Python | 16,806 | 426 | """
Confidence intervals by resampling the outcomes of a probabilistic choice.
A resampling of a choice ``C`` (for instance ``selected_study``, the uniform
choice of a study) is a relation ``boot(b, c, w)``: ``n`` replicates ``b`` of
the choice, each one reweighting the outcomes ``c`` of the choice as a
bootstrap of t... |
3ddcd57a9ff45bbe6ce58817cf1e78022488d7edf54d2962e62369408a7d6d4b | Python | 16,810 | 353 | #!/usr/bin/python
# -*- coding: utf-8 -*-
'''
Subdirección General de Sistemas de Información para la Salud
Centro de Excelencia e Innovación Tecnológica de Bioimagen de la Conselleria de Sanitat
http://ceib.san.gva.es/
María de la Iglesia Vayá
Ángel Fernández-Cañada Vilata
Jorge Isnardo Altamirano
---
This pro... |
b5b8f5ebc7caf62641f8eee3c510786b3c6ab111658d08cd6e61cb5f4bece4c4 | Python | 16,813 | 504 | from collections import defaultdict
from math import prod
from typing import Any, Callable
import torch
import torch.nn as nn
from .base import BaseCounter
aten = torch.ops.aten
__all__ = ["FlopCounter"]
def _flop_null(args, kwargs, out):
return 0
def _flop_mm(args, kwargs, out):
"""Compute FLOPs for mat... |
438cc1e7bc8a57dd271ba6f842e776e845f836780da8a2641fd36ae3cd1bb02c | Python | 16,816 | 466 | # 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... |
71b37d129684ac547f19b25c81e7d886ecd494885fa546e1f3f9f87146ba5dd8 | Python | 16,827 | 375 | import numpy as np
import tensorflow as tf
from learnMSA.config.hmm import PHMMConfig
config: PHMMConfig = PHMMConfig(
alphabet="AB",
match_emissions=[
# Head 1
[[0.5, 0.5],
[0.1, 0.9],
[0.7, 0.3],
[0.9, 0.1]],
# Head 2
[[0.5, 0.5],
[0.1, 0.9],
... |
2d42a607b76b0af5dfdb7245bb11c89741fff8d32c8ac6b9e6dfe58be2211f42 | Python | 16,828 | 354 | from oct import *
import napari
from magicgui import magicgui
from qtpy.QtCore import Qt
from qtpy.QtWidgets import QSlider, QFileDialog,QLineEdit
import enum
from napari.layers import Image
class Operation(enum.Enum):
"""A set of valid arithmetic operations for image_arithmetic."""
add = np.add
subtract =... |
63695ada46384d5f1ec53d8df47a607a6d44e69ccc2050dc503e5d4919fa084a | Python | 16,828 | 463 | #!/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 warnings
from ax.core.metric import Metric
from ax.core.outcome_constraint import (
Object... |
5a486117f3fb418b98876d89016169dbbf9a770678df60c009efd670498d9823 | Python | 16,829 | 545 | """Plotting for graph functions."""
from __future__ import annotations
import warnings
from collections.abc import Mapping, Sequence
from pathlib import Path
from types import MappingProxyType
from typing import Any, Literal
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scanpy as sc
i... |
72c13a061e8bd0527788d387936cfc2a1313f048aaf7be9bea993c23abeb382f | Python | 16,853 | 450 | from __future__ import absolute_import
import collections
import functools
import logging
from ._collections import RecentlyUsedContainer
from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool
from .connectionpool import port_by_scheme
from .exceptions import LocationValueError, MaxRetryError, ProxyScheme... |
018e95523ec7ede8fa1f7c6a8e16cdcd82d553e70e2e2ae56d050b5e30c9d5ea | Python | 16,859 | 414 | from bids import BIDSLayout, BIDSLayoutIndexer
import bids
import os
import json
import re
import yaml
import shutil
bids.config.set_option('extension_initial_dot', True)
def bids(root=None, datatype=None, prefix=None, suffix=None, subject=None, session=None,include_subject_dir=True,include_session_dir=True,**entitie... |
1db637977cb9fb78412939210d03f8b53f8a84db8a7a0a28b4fc84a78733c697 | Python | 16,861 | 491 | import math
import torch
import torch.nn as nn
from .. import base, functional, surrogate
__all__ = ["PSN", "MaskedPSN", "SlidingPSN"]
class PSN(nn.Module, base.MultiStepModule):
def __init__(
self,
T: int,
surrogate_function: surrogate.SurrogateFunctionBase = surrogate.ATan(),
):
... |
fa85123fc0e5921025ede2d49a23371fba2ec3dc9825ce4313cd131c69ee0a55 | Python | 16,861 | 392 | #!/usr/bin/env python
#
# Copyright (c) 2017 10X Genomics, Inc. All rights reserved.
#
import collections
import numpy as np
import os
import pandas as pd
from scipy.misc import logsumexp
from scipy.special import gammaln
import scipy.stats
from sklearn.utils import sparsefuncs
import sys
import tenkit.stats as tk_sta... |
f967883bcea797fd4d89f38469f01b0203bca5ccadd7672d82dfcfdfcfa0d712 | Python | 16,863 | 493 | from typing import Callable
import torch
import torch.nn as nn
from torch import Tensor
from .. import base, functional
__all__ = [
"MultiStepContainer",
"SeqToANNContainer",
"TLastMultiStepContainer",
"TLastSeqToANNContainer",
"StepModeContainer",
"ElementWiseRecurrentContainer",
"Linea... |
3039d3619a48018a23aaf1493f0f8397b5e481f20a10ac7628eabb0735377991 | Python | 16,865 | 418 | #!/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 itertools import chain
from typing import Any
import torch
f... |
4ae97db21eef3d6234cfc0f5d22baa126309b134c63fcadf7b3ce2535776a109 | Python | 16,874 | 524 | # 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... |
e57f09d7730a87b554eabf5511093530309b65533dc6ba4d96e46b639ff18f21 | Python | 16,887 | 453 | from ..pairs import ReadPairs
from .base_plotter import GenomeCoordFormatter
import matplotlib.pyplot as plt
import matplotlib.gridspec as grd
import seaborn as sns
import numpy as np
import itertools
from sklearn.decomposition import PCA
__all__ = ['summary_statistics_plot', 'ligation_bias_plot', 'restriction_site_d... |
e807427306c4e043aa48714994e7b4cf08c4aae106f9d646fda6d3b006ee50bd | Python | 16,890 | 476 | import copy
import math
import operator
from typing import Tuple
from scipy.sparse import linalg
from sklearn.model_selection import StratifiedKFold
import numpy as np
import scipy.sparse as sparse
import sklearn.preprocessing as preprocessing
import torch
import torch.nn.functional as F
from torch.utils.data import... |
cd131ece6ce969197323e96fb050a272adaabbe2444a77a5dfecdfc98a8eeb09 | Python | 16,905 | 395 | # 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... |
2b9b2e099ddd1560f5a303952c8c189bbf73ee1be9d55b0db6fd8e35277886e2 | Python | 16,916 | 580 | """
**********
Edge Lists
**********
Read and write NetworkX graphs as edge lists.
The multi-line adjacency list format is useful for graphs with nodes
that can be meaningfully represented as strings. With the edgelist
format simple edge data can be stored but node or graph data is not.
There is no way of representin... |
d5c8db0639509e25c35028241b83252bef31bf87c87e00350bb498b34fdbba5a | Python | 16,920 | 389 | class CompressedSensingCVNet(tf.keras.Model):
TYPE = 0
def __init__(self):
super(CompressedSensingCVNet, self).__init__()
self.cs_layer = CompressedSensing()
self.reshape = tf.keras.layers.Reshape((72, 72, 3), input_shape=(72*72,3) )
self.batch_norm = tf.keras.layers.BatchNormal... |
2c6546501b44952928e8d43263f3693ba29ed09ac29620e9994c12d59f27ee53 | Python | 16,921 | 374 |
# -*- coding: utf-8 -*-
"""
Created on 2021.08.19
@author: Jiahua Rao
"""
import os
import random
import sklearn
import collections
from rdkit import Chem
from rdkit.Chem import rdDepictor
from rdkit.Chem.Draw import rdMolDraw2D
from rdkit import DataStructs
from MolRep.Models.losses import get_loss_func
from MolR... |
d805d23422edd87dd7056c1e95101f83adf8de602ac4aaa1b2f1bfc2002e8d59 | Python | 16,921 | 505 | """ The FDTD Grid
The grid is the core of the FDTD Library. It is where everything comes
together and where the biggest part of the calculations are done.
"""
## Imports
# standard library
import os
from os import path, makedirs, chdir, remove
from subprocess import check_call, CalledProcessError
from glob import g... |
bde399b10e67b0bfd45c11f3ca41c1087c6d29c349039a62acf0ff50d6a0ea18 | Python | 16,923 | 435 | """
Functions for hashing graphs to strings.
Isomorphic graphs should be assigned identical hashes.
For now, only Weisfeiler-Lehman hashing is implemented.
"""
import warnings
from collections import Counter, defaultdict
from hashlib import blake2b
import networkx as nx
__all__ = ["weisfeiler_lehman_graph_hash", "we... |
4a989e2b02b7d4deb487bfa5e7e14e8757f2efdb8af482e61cc2eabc4e02cf14 | Python | 16,930 | 562 | """Protocol defining the common interface for HasDriver and HasPlaywrightDriver.
This Protocol captures the ~60+ methods that both implementations provide,
allowing NavigatesGalaxy to work with either backend via composition.
"""
from abc import abstractmethod
from collections.abc import Callable
from contextlib impo... |
03065d98708872099649e3a3b3f32c6e1efe7dc8f99518f01a03fd2b5d75d864 | Python | 16,938 | 509 | from __future__ import print_function, unicode_literals, absolute_import, division
import numpy as np
import warnings
import os
import datetime
from tqdm import tqdm
from zipfile import ZipFile, ZIP_DEFLATED
from scipy.ndimage.morphology import distance_transform_edt, binary_fill_holes
from scipy.ndimage.measurements ... |
63c2da1eba21af710469758ae2bf8c2517a434aa5d6508bcbce2bb6943b869eb | Python | 16,948 | 442 | #%%
import numpy as np
import os
import sys
import time
import pandas as pd
from tqdm._tqdm_notebook import tqdm_notebook
import pickle
from keras.models import Sequential, load_model
from keras.layers import Dense, Dropout
from keras.layers import LSTM
from tensorflow.keras.callbacks import ModelCheckpoint... |
ff4c85be955283ac5be8262522848e2ff8cad544c4e5cefdc7a44f31ff44ffcb | Python | 16,955 | 539 | # test_util.py
# Contact: Jacob Schreiber <jmschreiber91@gmail.com>
import numpy
import pytest
from modiscolite.util import MemeDataType
from modiscolite.util import cpu_sliding_window_sum
from modiscolite.util import binary_search_perplexity
from modiscolite.util import compute_per_position_ic
from modiscolite.util ... |
bed0214857cb4461cdd13e315547e8fb15dffa352513a03c7378e0e4a6145b16 | Python | 16,957 | 451 | from __future__ import annotations
from collections import defaultdict
from collections.abc import Iterable
from typing import Literal
import dask
import dask.array as da
import numpy as np
import pandas as pd
import xarray as xr
from anndata import AnnData
from dask.diagnostics import ProgressBar
from spatialdata im... |
a36fbd891569790954d63c430018070c2d5f5941a5461d055f10f7627d012922 | Python | 16,960 | 425 | # 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... |
c988507c5f3342f1c9f2be4ff75d65ce5841e0ac7461de8cab84a8c786dac958 | Python | 16,960 | 464 | #!/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 re
import warnings
from collections.abc import Mapping
from... |
4fd417c587c188c6a3476d2a25c1afe8f1d99d8d5362a1bab177f39c465158fe | Python | 16,962 | 427 | # 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 itertools import product
import torch
from ax.benchmark.benchmark_problem import get_continuous_search_space
from ax.be... |
7799bb11ffc3e0168c49c5f350d45d5f8758c19afdf5c5ddf71e2933ed0fd9c9 | Python | 17,001 | 463 | """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
from collections import OrderedDict
from typing import Any, Iterable, Tuple
from urllib.parse import unquote
import ujson as json
f... |
07d39f690cfff0606d4a0d607502ae1116adb17a2268dc6998af454725af7a59 | Python | 17,008 | 491 | """Main analysis of eccentricity changes during adaptation
Notes
-----
- Eccentricity is precomputed in the eccentricity.py module
- Washout is separately analyzed in washout.py
"""
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.colors import LinearSegmentedColormap
im... |
87b76edf2815b893a71411021845f8ddd6995672fc8d7f1553f8443880ef0fb5 | Python | 17,018 | 502 | # 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... |
b12bfa491af973eb253e6fa4c683e8196639e8c59cbd37615b1efbf3a8ad5c11 | Python | 17,026 | 404 | """Population code classes, mostly for convenient bookkeeping."""
import numpy as np
from . import log as logger
def turn_keys_into_str(d):
"""Replaces python-hashable keys by their string representation. Required for dict keys in JSON."""
return { str(k) : v for k,v in d.items() }
class LinearPopulationCod... |
f6d1ef61e68d63d4a849d2b4b7031c73a7a36861cd2057594cac7d9af1e9b14b | Python | 17,030 | 545 | # forked.py
# Authors: Jacob Schreiber <jmschreiber91@gmail.com>
"""Run independent pieces of work in forked child processes.
Each child inherits the parent's memory copy-on-write, so nothing is pickled
on the way in, and sends its result back pickled (`_Result`). The work of a
child that could not be forked or that ... |
565d44542a20db0782852f9d11cd25a717fade1a0b207df4642bcd2e04035957 | Python | 17,040 | 498 | """ Detectors for the FDTD Grid.
Available Detectors:
- LineDetector
"""
## Imports
# typing
from .typing_ import ListOrSlice, Tuple, List
# relative
from .grid import Grid
from .backend import backend as bd
from .constants import FDTD_X, FDTD_Y, FDTD_Z
## Detector
class LineDetector:
"""A detector along a ... |
ae904f90aff47526758b8e420858bd62a4c84648c79d732be0bacf1c0a55974c | Python | 17,074 | 438 | # -*- coding: utf-8 -*-
"""
Created on 2020.05.19
@author: Jiahua Rao, Weiming Li, Hui Yang, Jiancong Xie
Code based on:
Song et al "Communicative Representation Learning on Attributed Molecular Graphs" -> https://github.com/SY575/CMPNN
"""
from argparse import Namespace
from typing import List, Union
import torch
... |
751ebee7d21c2b43b7d2ad70ac5befeaa7fa4d87489b9e3d8445a212b0f6c04e | Python | 17,085 | 418 | #!/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 warnings
from ax.core.metric import Metric
from ax.core.objective import MultiObjective, Objec... |
ad32a85984ad310e64f424331c91dbccc8638d68cb84c9f77dac6e694444e638 | Python | 17,096 | 377 | from .helpers import ConfigurableClass
from .reporting import report, warn
from scipy.stats import truncnorm
import numpy as np
from .exceptions import *
class PostProcessingHook(ConfigurableClass):
def validate(self):
pass
def after_placement(self):
raise NotImplementedError(
"`a... |
0bef011571c136028408a72953e93eb2a31273e94039ae7bcebc56212cfa68be | Python | 17,100 | 397 | """Server-Sent Events (SSE) connection manager for real-time notifications.
Manages per-worker in-memory mapping of user IDs to asyncio.Queue instances,
enabling push of events from any thread (e.g. Kombu control queue worker)
to async SSE endpoint handlers running in the uvicorn event loop.
"""
import asyncio
import... |
a583b9135d59c59c18a38979e2a6609e2ed47dd32453f50ba930ecbab49068f1 | Python | 17,101 | 410 | #!/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 Callable
from logging import Logger
from typing import Any
import numpy a... |
10aa7c73be8a6aaad731672782de8769563cfde7a611687d48efe697c9658651 | Python | 17,105 | 510 | """
DataViewer
==========
Data viewer showing 3d data as 2d slices.
Usage
-----
.. image:: ../Static/DataViewer.jpg
Note
----
This viewer is based on the pyqtgraph package.
"""
__author__ = 'Christoph Kirst <christoph.kirst.ck@gmail.com>'
__license__ = 'GPLv3 - GNU General Pulic License v3 (see LICENSE)'
__cop... |
3e481d11a98ce2bd5f1a7af1d8e01d9d5f297bcedfca987b4eaf122fb12c2eef | Python | 17,107 | 394 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from logging import Logger
import numpy as np
from ax.adapter.adapter_utils import observed_hypervolu... |
67a03c5a4813de3eea30881d81be8b0191547f92053eda4b0edb961bd97a0784 | Python | 17,114 | 406 | # functions for creating and running experiments
import logging
import os
import json
import subprocess
import numpy as np
import tensorflow as tf
from meld_classifier.dataset import Dataset
from meld_classifier.network_tools import build_model
from meld_classifier.evaluation import Evaluator
from meld_classifier.trai... |
5c56ffcbf427cb8af83a54cc5a480c6074c2f732d1ccc0ea638ef8bf86a7caf2 | Python | 17,140 | 388 | import pandas as pd
import numpy as np
import pickle
from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.Chem import Descriptors
from rdkit.Chem import rdMolDescriptors
from rdkit.Chem.Draw import IPythonConsole
from rdkit.Chem import Draw
from rdkit.Chem.Draw import rdMolDraw2D
import kerastuner... |
3ce06e307122c43dc5b386fb039d5bfd3ff90fb49d1f0dc99b19af51e4712a2b | Python | 17,159 | 421 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Spatial Factorization base class
@author: townesf
"""
import numpy as np
import tensorflow as tf
import tensorflow_probability as tfp
from os import path
from math import ceil
from tensorflow import linalg as tfl
from sklearn.decomposition import TruncatedSVD
from skl... |
14af337c7012d2f20d59e767a4030778fa3ae63bb618086a827c74bbf05a7d5f | Python | 17,161 | 394 | for key in list(globals().keys()):
if (not key.startswith("__")) and (key != "key"):
globals().pop(key)
del key
import os
from pathlib import Path
from matplotlib.figure import Figure
import time
from typing import Mapping, Union
import psutil
import logging
import numpy as np
import anndata
import torch
from tor... |
3247c8842286da7d929a493d40b81ec384ff754b57a187560a5611ffd322f3df | Python | 17,163 | 368 | # 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... |
658bed24e6dabaa77d0a002c51480bea1a72227042b52bc778d691d684492485 | Python | 17,163 | 422 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Spatial Factorization base class
@author: townesf
"""
import numpy as np
import tensorflow as tf
import tensorflow_probability as tfp
from os import path
from math import ceil
from tensorflow import linalg as tfl
from sklearn.decomposition import TruncatedSVD
from skl... |
0e35b24e177bc66e7710ef692540a987979976781006afc0a48d4dbf586cc12b | Python | 17,204 | 525 | """One-mode (unipartite) projections of bipartite graphs."""
import networkx as nx
from networkx.utils import not_implemented_for
__all__ = [
"projected_graph",
"weighted_projected_graph",
"collaboration_weighted_projected_graph",
"overlap_weighted_projected_graph",
"generic_weighted_projected_gra... |
def80840b811ff87b6f1d9b8c60f811205dc6b429d214f48a506cc80fe853d01 | Python | 17,220 | 374 | import math
import torch.nn as nn
from torch.utils.data import DataLoader
import torch_geometric.transforms as T
from torch_geometric.utils import to_undirected
from torch_sparse import coalesce, SparseTensor
from MolRep.Interactions.link_models.PLNLP.loss import *
from MolRep.Interactions.link_models.PLNLP.utils imp... |
6163a90aadf483031f4a1345aa112f205ecd673930496d7dc660a04e0b5a1bac | Python | 17,222 | 419 | """
Created on Jun 2, 2020.
This module implements a function to identify bad channels based on increased/decreased power within a channel compared to the majority of other channels.
:author: voodoocode
"""
import numpy as np
import PyQt6.QtWidgets
import PyQt6.QtGui
import PyQt6.QtCore
import functools
import mat... |
7c55add726e04f568833bf162b330869102fb627f9b5d40e9eae34197c76c14a | Python | 17,225 | 495 | from skimage import morphology, measure, io, util # For performing morphology operations (should maybe import more from skimage...)
from mpl_toolkits.mplot3d import Axes3D # Plotting in 3D
import matplotlib.pyplot as plt # To plot
from scipy.optimize import curve_fit
from pylab import ... |
40f3fa3a5ac8f9680e410d2ddebde7af5dfe760c698ad46864bef26dfb69689d | Python | 17,229 | 762 | # 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... |
22554de18b055724ca0ecf1e404acb8366202308f1e7a8ce3837e8d11cc1ea9c | Python | 17,242 | 500 | from collections.abc import Callable
import numpy as np
import pytest
import tensorflow as tf
from hidten.hmm import HMMConfig as HidtenHMMConfig
from hidten.tf.prior.dirichlet import TFDirichletPrior
from learnMSA.config import Configuration, PHMMConfig, StructureConfig
from learnMSA.hmm.tf.joint_profile_emitter imp... |
b94b8eebf4a806c24556b0af58faf3055c2e80c1928492846933ef29b757711c | Python | 17,251 | 422 | # 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.analysis.summary import Summary
from ax.api.client import Client
from ax.api.c... |
863a23958112e2ebbb3409cd990a55894bef930f8596b3ea8c327103649ee612 | Python | 17,255 | 614 | #!/usr/bin/env python
#
# Copyright (c) 2014 10X Genomics, Inc. All rights reserved.
#
import copy
import math
import tenkit.stats as tk_stats
import cPickle as pickle
import numpy as np
from abc import ABCMeta, abstractmethod
import tenkit.dict_utils as tk_dict
class SummaryStatistic:
__metaclass__ = ABCMeta
... |
08c66d7a10ac3dde3cc1023e869750d710c28620532a40860685ff59f33e4037 | Python | 17,258 | 447 | """
Description of an engine for the LLM: schema linking and values.
The model is told the predicates of the engine, with their columns, the
description the engine's configuration gives them and their size
(:func:`schema_summary`). The ReAct agent can then look at the rows of a
predicate (:func:`sample_rows`) and look... |
3b5ad0e57a03af8af7f242a4b70b822f748d5368745868c1fa55478cfb98fa9c | Python | 17,278 | 534 | """Handles all VCS (version control) support"""
from __future__ import absolute_import
import errno
import logging
import os
import shutil
import sys
from pip._vendor.six.moves.urllib import parse as urllib_parse
from pip._internal.exceptions import BadCommand
from pip._internal.utils.misc import (
display_path,... |
23ba773802ca7fa18cde3a6553ae7b55b770108c38f193ff082da969a33ce929 | Python | 17,282 | 426 | import warnings
from typing import Callable, List, Optional, Tuple, Type, Union
import numpy as np
from sklearn.exceptions import UndefinedMetricWarning
from seqeval.reporters import DictReporter, StringReporter
from seqeval.scheme import Entities, Token, auto_detect
PER_CLASS_SCORES = Tuple[List[float], List[float]... |
c20e373f4833771025292cab3b667cb0363c2fe12ea905a4bb30e3b3f0edf7c0 | Python | 17,286 | 501 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from copy import deepcopy
from typing import Any
import numpy as np
import plotly.graph_objs as go
fr... |
f010dd699326733a67c490fd433d8db5a4384e5b1394c7befdf3909ea33551b0 | Python | 17,286 | 364 | """Generate cell-line-specific models with ftINIT and estimate essential genes.
Python port of the DevelopWBM ``Gen_ftINIT_models`` Human2 pipeline
(github.com/LiLabTsinghua/DevelopWBM). For each cell line in the Hart 2015 RNA-seq
dataset a context-specific model is built with **ftINIT** (not classic tINIT /
getINITMo... |
72c779ca892986ff1fb0acab5f0a46e3ae54127b9c9aaf46314cdf928a4ba80a | Python | 17,290 | 418 | # 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... |
94f31437fd7b8fd163826ff2a6addc2cd5044a09d92e00fb8831475d88dd043a | Python | 17,290 | 463 | # -*- coding: utf-8 -*-
"""
Robust Single Linkage: Density based single linkage clustering.
"""
import numpy as np
from sklearn.base import BaseEstimator, ClusterMixin
from sklearn.metrics import pairwise_distances
from scipy.sparse import issparse
from joblib import Memory
from sklearn.utils import check_array
from... |
e263a4421985b9c4b4b3f6c3c7b27e2de5fd7616c39c7907eb1d6f45ef565984 | Python | 17,294 | 416 | import math
import re
from pathlib import Path
from types import TracebackType
from typing import Self
import numpy as np
from Bio import Seq, SeqIO, SeqRecord
from Bio.File import _IndexedSeqFileDict
from .dataset import Dataset
class SequenceDataset(Dataset):
"""
Manages a set of unaligned protein sequenc... |
9f606bc22ae812d90f525372ca20de34fa646cc36b94353f65eab5dd15b519aa | Python | 17,300 | 370 | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
6e76bdbc7a631e75b7beab5b7987c1f7f037072d7c71361a9e9343c7bb1b60fc | Python | 17,320 | 414 | # -*- 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... |
34ef7101ecbe6a3c6d1f308d29c5ca84f17ddc53d2d5e5161e1bb5d240ddc070 | Python | 17,326 | 439 | """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
from core.feature_flags import flag_set
from core.mixins import GetParentObjectMixin
from core.utils.common import load_func
from d... |
53c7ea2e10f633bc3b952c288c9549d0441b57a4d09f17bbbe7d94b807396910 | Python | 17,338 | 543 | from __future__ import annotations
import re
import warnings
from dataclasses import dataclass
from functools import partial, singledispatch
from types import FunctionType, UnionType
from typing import TYPE_CHECKING, Literal, TypeAliasType, cast, get_args, get_origin
import h5py
import numpy as np
import pandas as pd... |
6d8f2e60a7b88d3a3fa9b49b4486b61bff060ef7fd42a3ab07d7a773702a8e23 | Python | 17,343 | 442 | import hashlib
import linecache
import re
import threading
import types
import weakref
from typing import Optional, Tuple
import torch
import torch.fx as fx
from spikingjelly.logger import logger
try:
import triton
import triton.language as tl
except (ImportError, OSError) as e:
from .. import triton_mis... |
5777588714e880847b2b633962c99b689f19fb81f475e75864f1ce3ecc170903 | Python | 17,368 | 397 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from copy import deepcopy
import numpy as np
from ax.adapter.base import Adapter, DataLoaderConfig
fr... |
859bd61958ae884b6f78a5bf1e919252ae4021bda7697398670628c5b1e96007 | Python | 17,370 | 438 | #from src.data import *
import matplotlib.pyplot as plt
from scipy import interpolate
import tensorflow as tf
from scipy.ndimage import filters
from scipy.ndimage.morphology import generate_binary_structure, binary_erosion
from pathlib import Path
import numpy as np
import scipy
from scipy.ndimage.filters import gaussi... |
f93a6f467fe942d8bd313641b0ca741fbc959a057a2e923a3dbc10ed1093b92c | Python | 17,371 | 536 | import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
from pylab import *
import numpy as np
import random
import math
import time
import os
import glob
# change the default font family
plt.rcParams.update({'font.family':'Arial'})
plt.rc('xtick', labelsize=12)
plt.rc('ytick', labelsize=12... |
31e0fad6271e6dcf2857587fa90c79b5bcae1d4d8bad31d60a8cad18d2bb5505 | Python | 17,391 | 439 | # 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... |
d85c17ffc147b0b4f12f0d4f6a6468afd68c670974874ea46d00cccabc5271d6 | Python | 17,391 | 565 | from brian2 import NeuronGroup,Synapses,get_device,set_device,run, ms,mV, defaultclock
from brian2.utils.logger import catch_logs
import numpy as np
from numpy.testing import assert_array_equal, assert_equal
import pytest
from brian2lava.tests.utils import *
def _compare(synapses, expected):
conn_matrix = np.zeros... |
e363299866ff1fff9890fac8345e69381d68be45da9e33ae0f87dc3f7cb25ac5 | Python | 17,398 | 339 | import numpy as np
import pandas as pd
import pathlib
import random
from ..preprocess import raw_data_functions, encoding_functions
from ..utils import check_functions
def filter_duplicates(X: np.array, snp_ids: np.array) -> (np.array, np.array):
"""
Remove duplicate SNPs, i.e. SNPs that are completely the s... |
14e9153b3fa6dc3214359d2abf85555e03e414061598cd2612b07c746c1a2200 | Python | 17,407 | 522 | import os
import voluseg
from voluseg._tools import download_sample_data
import pytest
from pathlib import Path
import numpy as np
import h5py
from dask.distributed import Client
# # To run tests locally, set these environment variables:
# os.environ["GITHUB_ACTIONS"] = "false"
# os.environ["SAMPLE_DATA_PATH_H5"] = (... |
5b74f635d332601091d51ee34359d4919ee50fb3f5f0b2bd39f58790c3d66685 | Python | 17,410 | 586 | # 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... |
7c9c1eca0ffc234cba482877b77da5a246abccc1ee4a5d8288cd2d5adcd8d954 | Python | 17,412 | 505 | """
Deterministic checks of the queries an LLM writes.
A query is parsed and dry-run on the engine, without running the chase
(:func:`check_query`): the errors, formatted as for the user, are sent
back to the model so that it can correct its query. A query can also be
run to show the model a few rows of its result (:f... |
7e88c245259ffd8978c53b0aff704fda5bee37dfc40295642686f2c828f28882 | Python | 17,417 | 435 | """
Object Store plugin for the Amazon Simple Storage Service (S3)
"""
import logging
import os
import time
from datetime import datetime
try:
# Imports are done this way to allow objectstore code to be used outside of Galaxy.
import boto
from boto.exception import S3ResponseError
from boto.s3.connect... |
031be98125e828c5603858ce057cb3bab3533a7fd9725d0db4a811503a5f7b59 | Python | 17,433 | 452 | # -*- coding: utf-8 -*-
"""Base classes for the pke module."""
from collections import defaultdict
from pke.data_structures import Candidate
from pke.readers import RawTextReader, SpacyDocReader, PreprocessedReader
from nltk import RegexpParser
from nltk.stem.snowball import SnowballStemmer
from pke.lang import st... |
2285c5e36d4766429ba7d96a361ce2e91069af34cb1134b94b9475e3d8a86225 | Python | 17,436 | 391 | import torch
from loguru import logger
from ..utils.global_constants import UNIT_MAGNITUDE
def calculate_transmission_reflection_coefficients(
transmission_signals, reflection_signals, wavelength, cfg
):
"""Calculates the transmission coefficient and reflection coefficient for the signals presented.
Arg... |
bc5ee748d2a57e81580acb3852fe321f3527c04dd0ee86b0f8464eda9a23d9c1 | Python | 17,442 | 415 | """
To Test:
- upgrading with missing secret raise exception
- upgrading removes old secrets
- upgrading with partial variables keeps the old one
- upgrading with no variables works just fine
- upgrading and missing variables raises exception
"""
import logging
from typing import (
Optional,
Union,
)
from uuid... |
4ddc236bea104cf99c1db3ef1688f28d29a2df41faffdce5fcf8b1e583edecda | Python | 17,454 | 496 | """Module implementing expression pattern matching."""
from collections import OrderedDict, namedtuple
import copy
from itertools import chain
import inspect
from inspect import isclass
from functools import lru_cache
import logging
from nl_expr.exceptions import NeuroLangException
from typing import Any, Tuple, TypeV... |
959843541945545e820e6c6d40babd9018389de5f517ad96338af67faf26cecb | Python | 17,469 | 573 | #! /usr/bin/env python
"""
# -----------------------------------------------------------------------
#
# seperation.py
#
# by Joerg Menche
# Last Modified: 2014-12-06
#
# This code determines the network-based distance and sepration for
# two given sets of nodes on given network as described in
#
# Uncovering Diseas... |
d03965a70840854ecf46900f1171684e7667221ceec3c8841d2cc66c00ad530e | Python | 17,478 | 507 | """PageRank analysis of graph structure."""
import networkx as nx
__all__ = ["pagerank", "google_matrix"]
@nx._dispatchable(edge_attrs="weight")
def pagerank(
G,
alpha=0.85,
personalization=None,
max_iter=100,
tol=1.0e-6,
nstart=None,
weight="weight",
dangling=None,
):
"""Returns... |
e923b95b3f8b4a4c7ab760d2ab418f98ebc500b19ed2056c5ddb2f9e8f45963b | Python | 17,479 | 588 | """
Find the k-cores of a graph.
The k-core is found by recursively pruning nodes with degrees less than k.
See the following references for details:
An O(m) Algorithm for Cores Decomposition of Networks
Vladimir Batagelj and Matjaz Zaversnik, 2003.
https://arxiv.org/abs/cs.DS/0310049
Generalized Cores
Vladimir Bat... |
18a191904c0cfafd7fc9b2a4cd0be173181c8112ebf1e1355c517cdd55cb38d4 | Python | 17,481 | 525 | # 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... |
5b7c5983ff59a8d37ad7adf5f194917c204f124f9c3c941cc247ea8bb49211f7 | Python | 17,484 | 758 | # 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... |
bc5456546832341fc498896921428c827c856df47f684008f235bc306dc666da | Python | 17,492 | 442 | # 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 itertools
from collections.abc import Sequence
from typing import final
from ax.adapter.base import Adapter
from ax.a... |
d314cd73fe034f409b1782dd83afc28539f243fd4951ce27acf08ceed425e35d | Python | 17,522 | 520 | import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from tensorflow.keras.utils import to_categorical
from tqdm import tqdm
def set_data_size(data_size, data_sets):
"""
Sets data sequences to the desired lenth
:param data_size: Sequences length (int)
:param data_sets: List containin... |
30269d4f796a12af91239bd15df1e89e54abddfde5f042a8357d46fba0375e42 | Python | 17,537 | 310 | import logging
import os
from galaxy import util
from galaxy.tool_shed.util import utility_container_manager
from galaxy.util import UNKNOWN
from galaxy.util.tool_shed.common_util import parse_repository_dependency_tuple
log = logging.getLogger(__name__)
class DependencyDisplayer:
def __init__(self, app):
... |
80854df48bc1c5d0bae402aca635424f1af48f058be5490b04fa51addcf40222 | Python | 17,541 | 501 | """Functions for generating line graphs."""
from collections import defaultdict
from functools import partial
from itertools import combinations
import networkx as nx
from networkx.utils import arbitrary_element
from networkx.utils.decorators import not_implemented_for
__all__ = ["line_graph", "inverse_line_graph"]
... |
a0ab4036a949d119db55b48b187f13db4ec56dd7d1715e8b6aa49b3486a3f0d6 | Python | 17,547 | 629 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
ArrayProcessing
===============
Tools for parallel processing of large arrays.
Note
----
This module provides an interface to deal with large numpy arrays and speed up
numpy routines that get very slow for data arrays above 100-500GB of size.
The processing is base... |
3d35c71022a8a2130e4cc88c527c7009bde04d8bacd33535d42d905fe47feea7 | Python | 17,557 | 600 | # -*- coding: utf-8 -*-
"""
Fast plotting of large matrices via pyqtgraph
This is module provides scripts to plot large matrices or point clouds in a fast way
using pyqtgraph and opengl.
"""
__author__ = 'Christoph Kirst <christoph.kirst.ck@gmail.com>'
__license__ = 'GPLv3 - GNU General Pulic License v3 (see LICE... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.