sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
0dcd684443c03460fde3953044696af9883a45fb4d98d2aed8baa15bef61450b | Python | 18,572 | 483 | """Tests for history.py."""
import pickle
import time
import multiprocessing as mp
from functools import partial
import numpy as np
import pytest
import torch
from torch.distributed import TCPStore
from sklearn.datasets import make_classification
class TestHistory:
test_epochs = 3
test_batches = 4
@py... |
6cee69e14d671ba79b1c653a35c044a55b38a9aff215b9ed2de188dc267eef17 | Python | 18,597 | 470 | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
Part of code related to auxiliary task is taken from:
https://github.com/Open-Catalyst-Project/ocp/pull/335/files
"""
import ... |
6d6f4b1516bbf1a4ad845dd053619aa5eaede57314d599d1fe9271019de55d8d | Python | 18,600 | 601 | # coding=utf-8
# Copyright 2023 HuggingFace Inc.
#
# 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 ag... |
1dbc8dcdbf33887d31b5b5f070854c509feb054192f8bc68e77fc805120c2ba5 | Python | 18,602 | 472 | """
Functions to estimate S0 and T2* from multi-echo data.
"""
import logging
import numpy as np
import scipy
from scipy import stats
from tedana import utils
LGR = logging.getLogger("GENERAL")
RepLGR = logging.getLogger("REPORT")
def _apply_t2s_floor(t2s, echo_times):
"""
Apply a floor to T2* values to pr... |
2997a572c8714c4a1ec0568186b2fc559458b5fc231a461b968f57462003d532 | Python | 18,603 | 555 | import copy
import json
import math
import os
import re
from dataclasses import asdict
from typing import List, Tuple
import ray
from ray.dashboard.modules.metrics.dashboards.common import (
DashboardConfig,
Panel,
PanelTemplate,
)
from ray.dashboard.modules.metrics.dashboards.data_dashboard_panels import ... |
df8984547f7c0969b344291febd1dc9b298349946b9799bc3395e5f78f63f63e | Python | 18,604 | 910 | # -*- coding: utf-8 -*-
"""
Created on Tue Jan 30 13:33:04 2024
@author: mkazemzadeh
"""
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras.layers import Input, Conv2D, MaxPooling2D, Activation, ReLU, ZeroPadding2D,Cropping2D, ELU, UpSampling2D
from tensorflow.keras.layers import B... |
677ed7d494875a7d738ca423c30058779f0a6b84f99184f36727a9ef9a214c91 | Python | 18,611 | 427 | from transformers import RobertaConfig, RobertaModel, AdamW, RobertaTokenizer
import torch
import torch.nn as nn
from torch.utils.data import TensorDataset, DataLoader
from utils.utils import load_data, quick_tokenize, define_logger, evaluation
import os
import random
import argparse
import datetime
import logging
impo... |
d59d4dd2c419ebd54da2af6587ff6c7207b0a472ff5e88c33e3cb247b6a3ff9a | Python | 18,618 | 523 | import base64
import logging
from collections import defaultdict
from enum import Enum
from typing import List
import ray
from ray._private.internal_api import node_stats
from ray._raylet import ActorID, JobID, TaskID
from ray.dashboard.utils import node_stats_to_dict
logger = logging.getLogger(__name__)
# These val... |
0914827bdadeb76a5ed37d231473a475cfdad76c36d557e63c51258c95905f07 | Python | 18,622 | 413 | import math
from time import time
import glob
import os
import sys
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.metrics import mean_squared_error, mean_absolute_error, r2_score
from sklearn.model_selection import RepeatedStratifiedKFold
from sklearn.preprocess... |
68dea48631e1ed9acc54e810c4dcb7c54cfb9bdb8db027cfe556648e328cd247 | Python | 18,627 | 365 | import torch
from tqdm import trange
from torch import nn
import matplotlib.pyplot as plt
import matplotlib.dates as dates
import os
import joblib
from sklearn.metrics import mean_absolute_error, mean_absolute_percentage_error
def Online_solve(control_mdl, dynamic_mdl, loader, args):
optimizer = torch.optim.Adam(... |
1216bbc5352b82af81eeeef3f119dfd16ab6c529759cb1a5aa09f6e9ec30703c | Python | 18,628 | 489 | import os
from pathlib import Path
from tempfile import TemporaryDirectory
import numpy as np
import pandas as pd
import pytest
from siapy.core.exceptions import InvalidInputError, InvalidTypeError
from siapy.entities import Pixels, Signatures
from siapy.entities.signatures import Signals, validate_signal_input
## S... |
60b5b6362c1243b3a87b2005a3b58832517288ae53b881e6008b530df29127c7 | Python | 18,638 | 506 | """
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.
Crystal Structure Relaxation Module for FastCSP
This module provides functionality for relaxing crystal structures using machine learning
inte... |
1c07c7e70c71228b64c730e247875ce814ba7c06fb08b4644f411d26efafc855 | Python | 18,641 | 460 | import gurobipy as gp
import cv2
import numpy as np
import matplotlib.pyplot as plt
import copy
import random
import tifffile
import cv2
from math import log, sqrt, ceil
import os
import numpy as np
import copy
from utils.tool import get_dimension, read_img, save_img
import math
def cal_feature(image):
if len(imag... |
720b688d9bbee45ea05b729336374fb6eec6ceab9ae018ea17d165d93c54edbf | Python | 18,648 | 530 | import logging
import math
import time
from abc import ABC, abstractmethod
from concurrent.futures import ThreadPoolExecutor
from dataclasses import dataclass
from queue import Queue
from typing import Any, Dict, List, Optional
from ray.autoscaler._private.constants import (
AUTOSCALER_MAX_CONCURRENT_LAUNCHES,
... |
821cebed91f85a7b9dd630148e28d1bebea8d1154252de9e5e6a5a8e0fe2b295 | Python | 18,649 | 425 | from functools import partial
import torch
from torch import nn as nn
from torch.nn import functional as F
def conv3d(in_channels, out_channels, kernel_size, bias, padding):
return nn.Conv3d(in_channels, out_channels, kernel_size, padding=padding, bias=bias)
def create_conv(in_channels, out_channels, kernel_si... |
61e402e3fcdc33b2293ac6b9149cefd41117c642e9c58f4b36abcd6c6509ceea | Python | 18,652 | 486 | import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule
from lqit.registry import MODELS
from lqit.utils import OptConfigType, OptMultiConfig
from .base_head import BaseEnhanceHead
@MODELS.register_module()
class SingleEnhanceHead(BaseEnhanceHead):
"""[Conv-BN-ReLU] * n... |
b1e7d61da689a84b1d215c477663ea5d366b7f8d95b5c2d3e2f1f30cc90fb50d | Python | 18,654 | 386 | import os
import glob
import numpy
import pandas
import pytest
from typing import Tuple, Union, Dict, Collection
from sv_utils import interval_overlaps, genomics_io, get_truth_overlap
import common_test_utils
Record = Union[numpy.record, Tuple]
class Default:
num_check_itrs = 2
num_contig_1a = 50
num_co... |
0bfd42aa88042da3fd385350de71adf7939a811db293f9552c1d4459c89e8947 | Python | 18,655 | 420 | r"""Bonsai tree reconstruction (``ov.tl.bonsai``).
Bonsai reconstructs a maximum-likelihood *tree* over cells rather than a 2-D
embedding: every cell is a leaf, internal vertices are inferred ancestral states,
and branch lengths carry the inferred distance in expression space. Unlike
UMAP/t-SNE it consumes the measure... |
900c1d272b8dbff9884ec8a12ae5f73c72316dce7a38fa0645a679ecdfb74b81 | Python | 18,656 | 440 | __author__ = 'tylin'
__version__ = '2.0'
# Interface for accessing the Microsoft COCO dataset.
# Microsoft COCO is a large image dataset designed for object detection,
# segmentation, and caption generation. pycocotools is a Python API that
# assists in loading, parsing and visualizing the annotations in COCO.
# Pleas... |
a829c86bb8a73da5d877556bc61429db3f3cd8d641ca7176c4de3d65d9239148 | Python | 18,659 | 533 | """
Skill Description Quality Checker - Phase 3
Verifies that skill descriptions are effective for LLM matching.
Tests:
1. Completeness - has what/when/examples
2. Clarity - concise and unambiguous
3. Effectiveness - LLM selects correctly
4. Token efficiency - not too verbose
"""
import re
import asyncio
from datacl... |
365933b2412e8af11511024eeec8dcdf0564b635a9afe673511867d223a359ae | Python | 18,698 | 486 | #
# CEBRA: Consistent EmBeddings of high-dimensional Recordings using Auxiliary variables
# © Mackenzie W. Mathis & Steffen Schneider (v0.4.0+)
# Source code:
# https://github.com/AdaptiveMotorControlLab/CEBRA
#
# Please see LICENSE.md for the full license document:
# https://github.com/AdaptiveMotorControlLab/CEBRA/bl... |
b5d9535a5759b5f2b527e2dddc1773391f23e5c1a9df330c380f1e3dc43d2464 | Python | 18,700 | 466 | """
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.
"""
from __future__ import annotations
import logging
from contextlib import asynccontextmanager
from typing import AsyncGenerator
from unitte... |
c0e0e326f03a14ce133f1aa9e9839ae600663adb530327127726f7b4a3abd5c2 | Python | 18,707 | 429 | #
# CEBRA: Consistent EmBeddings of high-dimensional Recordings using Auxiliary variables
# © Mackenzie W. Mathis & Steffen Schneider (v0.4.0+)
# Source code:
# https://github.com/AdaptiveMotorControlLab/CEBRA
#
# Please see LICENSE.md for the full license document:
# https://github.com/AdaptiveMotorControlLab/CEBRA/bl... |
f9de7f3a6ea6921411720192fb0f242258d7f0e404b031f2d87cba541b12a0b1 | Python | 18,708 | 526 | import copy
import logging
import os
import tempfile
import warnings
import numpy as np
import pytest
import torch
from torch import nn
import pfrl
from pfrl.agents import acer
from pfrl.envs.abc import ABC
from pfrl.experiments.evaluator import run_evaluation_episodes
from pfrl.experiments.train_agent_async import t... |
7439ab18be789a4d1276bd351ec60eaf29ea87faef7cfc9fd0bf44afc3173cba | Python | 18,717 | 461 | # -*- coding: utf-8 -*-
from functools import partial
from itertools import chain
from typing import Sequence, Type
from urllib.parse import urljoin
import numpy as np
import pandas as pd
#from ctxcore.genesig import GeneSignature, Regulon, openfile
from .math import masked_rho4pairs
try:
from yaml import dump... |
839bb0bc349155aba77e6e1e9f66a8926d9494cff53b971a95cc4bec12797c78 | Python | 18,718 | 458 | # Copyright 2021 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, sof... |
905b832d20fcaf30142d7e8c43dfc98a86933b4689aea3956bdeb0dc9498e9d5 | Python | 18,727 | 550 | import common
import fixtures
from nose.tools import eq_, raises, ok_
from nose.plugins.attrib import attr
from mock import MagicMock, patch, Mock, call
from os.path import *
import os
class Base(common.BaseBaseCaller):
modulepath = 'ngs_mapper.samtools'
def setUp( self ):
super(Base,self).setUp()
... |
b1c8f4824453f0e9921aecd3923ab4c424f475e0d70e90d73311d7a2abdfc0a8 | Python | 18,730 | 431 | import argparse
import json
import torch
from diffusers import AutoencoderKL, DDPMPipeline, DDPMScheduler, UNet2DModel, VQModel
def shave_segments(path, n_shave_prefix_segments=1):
"""
Removes segments. Positive values shave the first segments, negative shave the last segments.
"""
if n_shave_prefix... |
14dd7a05a3ce3267f6ad12e7fbf3d64c179a0c2ac2b7984e0eb61bdd747bc73b | Python | 18,731 | 389 |
import numpy
import os
import time
import yaml
import platform
import skimage.io as skio
import copy
import datetime
import matplotlib
import h5py
import random
matplotlib.use("tkagg")
from copy import deepcopy
from matplotlib import pyplot
from shutil import copyfile
from collections import defaultdict
import abber... |
ab7897b6977124cc0cc7e41ae14f8a908b655a4e5a889959d87efafb7025bd47 | Python | 18,745 | 491 | #!/usr/bin/python
####################################################################################################
# Copyright (c) 2016 - 2024, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# T... |
7e2bf2aa2380133fcf9bc8e9fb9e45cffdeaff654d3e5df5d35b2964f8c11375 | Python | 18,746 | 446 | ####################################################################################################
# Copyright (c) 2016 - 2024, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# This program is fre... |
ada216acffd20a74da1861c1ee51e92a8aa94355ade7d677581a9a4f0bd3c9d5 | Python | 18,749 | 450 | """Defines plotting functions used for analyzing data.
See ``examples/analysis`` for examples of how to use.
"""
import json
import os
import warnings
from typing import List
import matplotlib.colorbar as cbar
import matplotlib.colors as mplcolors
import matplotlib.pyplot as plt
import matplotlib.ticker as tick
impo... |
dad8c33e86243f5b9e4a65efbae5a629385c7e231aa77e5519b734cf9bf6aa94 | Python | 18,751 | 474 | import json
import logging
import os
import shutil
from urllib.parse import quote
import aiohttp
import ray.dashboard.optional_utils as dashboard_optional_utils
import ray.dashboard.utils as dashboard_utils
from ray._private.ray_constants import (
PROMETHEUS_SERVICE_DISCOVERY_FILE,
SESSION_LATEST,
)
from ray.... |
3465dad06bd69a43e60bd1a84c239acf447f118d9c06abfe3f0fa93ac3673849 | Python | 18,753 | 389 |
import numpy
import os
import time
import yaml
import platform
import skimage.io as skio
import copy
import datetime
import matplotlib
import h5py
import random
matplotlib.use("tkagg")
from copy import deepcopy
from matplotlib import pyplot
from shutil import copyfile
from collections import defaultdict
import abber... |
9557b6c168126d1f7206a5e6907966907581f71c800cd1a7d605a827f73f0c70 | Python | 18,759 | 482 | """Manage, parse and validate options for Ray tasks, actors and actor methods."""
import warnings
from dataclasses import dataclass
from typing import Any, Callable, Dict, Optional, Tuple, Union
import ray
from ray._private import ray_constants
from ray._private.label_utils import (
validate_fallback_strategy,
... |
f0fa0bb1ccb5c933bb7dd9401d83c4b4826df2f9a2e26976ebaf5830d3179a0f | Python | 18,759 | 504 | import os
import re
import base64
import struct
import logging
import multiprocessing
from datetime import datetime
from collections import defaultdict
from typing import List, Dict, Tuple, Union
import bs4
import h5py
import numcodecs
import numpy as np
from ml4h.defines import TENSOR_EXT, XML_EXT, ECG_REST_AMP_LEAD... |
2a91f2d7f99c54c4fc338d79e786fedbeb119362108ed3e2fabbde18df2f9be1 | Python | 18,761 | 352 | import numpy as np
from projectmetis.proto import controller_pb2, learner_pb2, model_pb2, metis_pb2, service_common_pb2
class ControllerServiceProtoMessages(object):
@classmethod
def construct_get_community_model_evaluation_lineage_request_pb(cls, num_backtracks):
return controller_pb2.GetCommunityM... |
4b50aca8e968277f04041532a78d4266b31ed4843937ea2e8e515aaae6527920 | Python | 18,761 | 468 | import numpy as np
from scipy import sparse
from scipy.spatial import distance_matrix
from scipy.special import wrightomega
import matplotlib.pyplot as plt
def unot(a,
b,
C,
eps_p,
rho,
eps_mu=None,
eps_nu=None,
sparse_mtx=False,
solver="sinkhorn",
... |
da48cb29d7f8a4765295cb00d14e8a31896a0aea10922afa52d2024ad7e3392d | Python | 18,770 | 395 | # Copyright 2023 UC Berkeley Team and The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... |
cbc05e261233166cac64df485f249563bf2ac2ea284e822f11b0888ab3d88679 | Python | 18,781 | 534 | import asyncio
import os
import pathlib
import re
import shutil
import sys
import tempfile
from typing import List
import pytest
import ray._private.ray_constants as ray_constants
import ray.dashboard.consts as dashboard_consts
import ray.dashboard.subprocesses.handle as handle_module
from ray._common.ray_constants i... |
29363bbbc27031b8504c35c8d5db3b1f3629e848b99ba63c0b5cdf5baa082130 | Python | 18,787 | 425 | import exputils as eu
import warnings
import numpy as np
# TODO: Feature - output_formats
# TODO: Feature - data_filter
# TODO: Feature - data_filter_inds
def select_experiment_data(experiment_data, datasources, experiment_ids='all', repetition_ids='all', output_format=('S', 'E', 'D'), data_filter=None, data_filter_i... |
4db061e5f7d39822b76270bbac5afaca3c114d6104902b3e1359e67eb58db39f | Python | 18,799 | 622 | import logging
import os
import random
import time
from functools import partial
import hydra
import numpy as np
import torch
import wandb
from omegaconf import OmegaConf as OC
from torch import optim
from torch.optim.lr_scheduler import MultiStepLR
from torch.utils.data import DataLoader, Subset, random_split
from n... |
38e39bedc85cc3b98be46dc527c5f8ec5cceb868687772bd8360e300a85c2ba7 | Python | 18,808 | 470 | # coding=utf-8
# Copyright 2023 HuggingFace Inc.
#
# 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 ag... |
f29c35b15be5e87f26db6b334c365139567f2fc08ddae39bfa10e8f70a9ba74c | Python | 18,811 | 514 | import pandas as pd
import numpy as np
import sklearn.neighbors
import scipy.sparse as sp
import seaborn as sns
import matplotlib.pyplot as plt
import scanpy as sc
import torch
from torch_geometric.data import Data
import anndata as ad
from .._pymclustr import fit_pymclustr
def Count2Binary(adata):
... |
b1eb7bbcbe835bc3fdcf38a35b988b1532569570a0d75f37b60ae432db5e7312 | Python | 18,821 | 553 | """
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.
"""
from __future__ import annotations
import datetime
import errno
import functools
import importlib
import logging
import os
import pathlib
... |
2f3639bbe7544e98b992dfc71eadbdb9b1c5683be6b1345057d18fe57194cd34 | Python | 18,841 | 601 | from typing import Dict, Any, Optional
import numpy as np
import torch
from torch import nn
import pytorch_lightning as pl
import torch.nn.functional as F
from torch.optim import AdamW
from collections import OrderedDict
def embedding_dropout(training, embed, words, p=0.2):
if not training:
masked_embed... |
848137e9f72c13baf5e0b2f8019c53da9a209546dafa0ff2a20b3abbfc3676f9 | Python | 18,844 | 559 | import json
import pickle
from pathlib import Path
from collections import Counter, OrderedDict
from typing import Dict, Iterable, List, Optional, Tuple, Union
from typing_extensions import Self
import numpy as np
import pandas as pd
import torch
# from transformers.tokenization_utils import PreTrainedTokenizer
# fro... |
b038c65f47319b6a65ac5d1c043fd348913d1dc055147202d368b8e0266fbd23 | Python | 18,863 | 520 | import os
import h5py
import torch
import torch.nn as nn
import torchvision
import torch.nn.functional as F
import pdb
import cv2
import random
import numpy as np
import matplotlib.pyplot as plt
import torchvision.transforms as transforms
import scipy.io as scio
from torch.utils.data import Dataset
from P... |
ee752bd3cfa7eaf62762e4d3fccbeeb7eb212559fce344e2367cb2e5553ecc7d | Python | 18,877 | 586 | """
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.
Helper scripts to run phonon calculations
- Compute phonon frequencies at commensurate points
- Compute thermal properties with Fourier interp... |
88dad8ae6975e6db94924a74b58856c6498f87d4e28f67e7f2eb8d5ab115a720 | Python | 18,895 | 572 | #!/usr/bin/env python
import fmm3dpy as fmm
import numpy as np
import numpy.linalg as la
def main():
test_hfmm()
def test_hfmm():
ntests = 36
testres = np.zeros(ntests)
#
# This is a testing code for making sure all the
# fmm routines are accessible through fmm3d.py
#
n = 2000
... |
7d61ed226588d352808a2bda975a63d63cea81df8e3b176ebb718f932509eb2c | Python | 18,899 | 518 | # pylint: disable=dangerous-default-value
"""
Deep mechanistic network module.
"""
from __future__ import annotations
import logging
import os
from dataclasses import dataclass
from functools import wraps
from os import PathLike
from pprint import pformat
from typing import Any, Callable, Dict, List, Optional, Union
... |
f5a82b40a5df06ec748494cd0c65d0bec97b3c34352be51f8ffdc706ae475d5a | Python | 18,918 | 579 | """Tests for Ray signature utility functions.
This module contains pytest-based tests for signature-related functions in
ray._common.signature. These functions are used for extracting, validating,
and flattening function signatures for serialization.
"""
import inspect
import sys
from concurrent.futures import Thread... |
5712e4ccb60f65c3618b9c64e869dc1d547aca55d7e20f677a56913505cc927d | Python | 18,922 | 508 | from __future__ import annotations
from collections.abc import Iterable, Sequence
from typing import Any
import numpy as np
import pandas as pd
from anndata import AnnData
from scipy import sparse
from scipy.spatial import ConvexHull, QhullError, cKDTree
from .._registry import register_function
def _ensure_adata(... |
7f75c63cde3c578b8169b8beb6ec1011f685ec4d02a801dc86de1d676f3a1695 | Python | 18,936 | 508 | #
# CEBRA: Consistent EmBeddings of high-dimensional Recordings using Auxiliary variables
# © Mackenzie W. Mathis & Steffen Schneider (v0.4.0+)
# Source code:
# https://github.com/AdaptiveMotorControlLab/CEBRA
#
# Please see LICENSE.md for the full license document:
# https://github.com/AdaptiveMotorControlLab/CEBRA/bl... |
a32b8003c4f6223ae7108d1f6c0dea8aca451d3f2c8dfff20c24b9656b84fa69 | Python | 18,937 | 431 | import numpy as np
import pandas as pd
from anndata import AnnData
from scipy import sparse
import networkx as nx
import scanpy as sc
from typing import Optional, Union
from pathlib import Path
import re
import matplotlib.pyplot as plt
from matplotlib.pyplot import gcf
import matplotlib.ticker as ticker
i... |
2a8039ef8e7263aa8ae465c5404403367a07b50c9714a0e513bd08e150d65863 | Python | 18,951 | 495 | ####################################################################################################
# Copyright (c) 2020, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# This program is free softw... |
d9722897bcd339602105cda33ef6fcd5081adfcf389810784e10664181dc91df | Python | 18,951 | 588 | import copy
import itertools
import os
import tempfile
import unittest
import numpy as np
import pytest
import torch
from torch import nn
import pfrl
from pfrl.agents import ppo
from pfrl.agents.ppo import PPO
from pfrl.envs.abc import ABC
from pfrl.experiments import (
train_agent_batch_with_evaluation,
trai... |
c86c45be6873d2422a7acfe07e8812bf61b2d618920374f5e061611a9562f786 | Python | 18,965 | 514 | #!/usr/bin/env python3.7
"""Defines Slide class.
The copyrights of this software are owned by Duke University.
Please refer to the LICENSE and README.md files for licensing
instructions. The source code can be found on the following GitHub
repository: https://github.com/wmglab-duke/ascent
"""
import itertools
import ... |
3d5fb8cce831310c3fab8ef3fc1b880d0271396bda58d4ffb493e6e19cf6ba86 | Python | 18,967 | 595 | """Script to prepare and perform NeuralIL committee training"""
import os
os.environ["XLA_PYTHON_CLIENT_PREALLOCATE"] = "false"
import copy
import datetime
import json
import pathlib
import pickle
import flax
import flax.jax_utils
import flax.serialization
import jax
import jax.nn
import jax.numpy as jnp
import tqd... |
9a7390f46d674f5bbba24edfbfbc1ad4adec506ddb3aff4744311ed10c1b4bd9 | Python | 18,970 | 629 | #!/usr/bin/python
# file: formatter.py
# author: Andrea Vedaldi
# description: Utility to format MATLAB comments.
# Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson.
# All rights reserved.
#
# This file is part of the VLFeat library and is made available under
# the terms of the BSD license (see th... |
172d73e2097c5bc5c932e6ecac8e40f876d9712db453a5498aded5037f32464b | Python | 18,976 | 423 | r"""DNA assembly & construct design (Biopython).
Plan how parts become a plasmid:
* :func:`restriction_map` — restriction sites for a panel of enzymes.
* :func:`golden_gate` — Type IIS (BsaI/BsmBI) assembly by 4-nt fusion sites:
digest each fragment, read its overhangs, and order fragments into a circle.
* :func:`g... |
440a2b579401f30e9b77bdc55adb3bd8a414210fd1d684614b682d08dae9ede3 | Python | 18,992 | 664 | #######################################################################################################################
# This script contains the Unet model implementation with the Pytorch Lightning Module #
# Author: Melinda Kondorosy, Daniel Schirmacher ... |
1dc0af91a2790901dc562a61204e6cdb40db2a636c951a4f1431158767b26a29 | Python | 18,996 | 658 | import os
import pickle
import tempfile
import numpy as np
import torch
import wandb
from einops import rearrange
from omegaconf import OmegaConf as OC
from scipy import signal
from sklearn.metrics import f1_score
### Util functions
def standardize_array(arr, ax, set_mean=None, set_std=None, return_mean_std=False):... |
923b36fd8e0e1b99ba4a18e59673da56a69e282befa36159b5b3ded97fc4a0ec | Python | 19,002 | 456 | """Geometry rather than expression — aligning serial sections and stacking them.
``pySTAligner`` and ``CAST`` align *expression* across samples: they give you a
shared embedding in which the same cell type from two slides lands in the same
place. That is not the same problem as recovering *geometry*. A shared embeddin... |
954a08c12b3477d13fb7f193231e5208bfe4c17e87d052d66bce5a25d4f2f429 | Python | 19,006 | 604 | # -*- coding: utf-8 -*-
# # Copyright (c) 2021 Qualcomm Technologies, Inc.
# All Rights Reserved.
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
# pylint: skip-file
# type: ignore
from collections import namedtuple
from enum impo... |
d7784ae2e7021ab71e7f730ef0110d17be8c4b63ff10f8fb777f39426a879aac | Python | 19,009 | 378 | import os
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch.utils.data import DataLoader
import argparse
import time
import datetime
import numpy as np
from skimage import io
import math
from DWonder.data_process import Img2Subimg
from DWonder.RMBG.network import Network_3D_Unet
from D... |
3aa3e061f2a6d8f225367c2bb506a5d68aa974d85d4e6fe00e8ea30eda01b01f | Python | 19,024 | 497 | """Differential-expression dispatcher for ``ov.protein``.
Exposes ``ov.protein.de(adata, group, method=...)`` with one of six
backends:
* ``'deqms'`` — peptide-count-aware moderated t (via :mod:`pydeqms`)
* ``'limma'`` — Smyth 2004 empirical-Bayes moderated t
(:func:`pydeqms.ebayes`, no count adjustment)
* ``'proda... |
9c3482a004c43651d15c301439a29bda24a04e95a9e14b10a62087ccb2618dc3 | Python | 19,030 | 502 | """
Mask R-CNN
Display and Visualization Functions.
Copyright (c) 2017 Matterport, Inc.
Licensed under the MIT License (see LICENSE for details)
Written by Waleed Abdulla
"""
import os
import sys
import random
import itertools
import colorsys
import numpy as np
from skimage.measure import find_contours
import matpl... |
4d36ad460f195509cdfb4d55229d9c65213c45bd01a7993c140a9fdb2e18899e | Python | 19,041 | 457 | import exputils as eu
import ipywidgets
from exputils.gui.jupyter.experiment_data_selection_widget import ExperimentDataSelectionWidget
import IPython
DEFAULT_PLOTLY_MEANSTD_SCATTER_CONFIG = """layout = dict(
xaxis = dict(
title = '',
range = [None, None]),
yaxis = dict(
title = '',
... |
76981fcaaa7fcd05aa2eca3575676a18161d3af1c73ed6d2f96aed0097333072 | Python | 19,050 | 505 | ####################################################################################################
# Copyright (c) 2016 - 2024, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# This program is fre... |
d7e9e7181bf04d6fdb2ff23c8d9f3175e977005c9abb10aa726e050f82d3fcbf | Python | 19,052 | 411 | import torch
from torch import nn as nn
from torch.nn import functional as F
def conv3d(in_channels, out_channels, kernel_size, bias, padding=1):
return nn.Conv3d(in_channels, out_channels, kernel_size, padding=padding, bias=bias)
def create_conv(in_channels, out_channels, kernel_size, order, num_groups, paddin... |
205dbd45801859b18691e5721bda94f6a2ebfaf25cbc5579ed2f30164aef4899 | Python | 19,059 | 357 | from Dataset import DataCook
from Config import paras
import pickle
import os
import time
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
import numpy as np
import torch
import matplotlib.dates as dates
import matplotlib.pyplot as plt
from Models import SeqPINN
from Models import OptNN
from Play import tra... |
2b9a83fa9d8c735f757b535fe96ce1de2618021e4da5881a37fdd91b3163c536 | Python | 19,060 | 461 | import numpy as np
import exputils as eu
import rlexp.utils as utils
import exputils.data.logging as log
import torch
import warnings
from ..approximation import SFNEC, ExperienceReplay
class SFNECAgent:
@staticmethod
def default_config():
return eu.AttrDict(
initial_epsilon = 1,
... |
ef64a82c2704a462caa1b6ffa6e1b8dd7cf2e67bfb1db1e008a385489ae0d093 | Python | 19,061 | 366 | """
modified based on diffusion library from Huggingface: https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py
"""
import inspect
from typing import Callable, List, Optional, Union
import torch
from transformers import CLIPImageProcessor, CLIPText... |
a645af6231a170b94e39b998d3cf1d923485f5c7c9e2df48b403324f2ffe8461 | Python | 19,065 | 406 | #!/usr/bin/env python
# coding: utf-8
# author: Maruthi Mutnuri (maruthi2008@gmail.com)
# loading libraries
import pandas as pd
import numpy as np
import random
from sklearn.model_selection import train_test_split
import tensorflow as tf
from imblearn.over_sampling import SMOTE
from imblearn.under_sampling import Ran... |
bf1661d046fb7d0b2bb427821b29f14ee2203445587a8eae1982940f75e9b532 | Python | 19,072 | 669 | import numpy as np
from joblib import Parallel, delayed
import settings
from utils.grid_funcs import (
traj,
gen_offsets,
traj_pwl,
traj_star,
gridpop_clustering,
gridpop_const
)
from utils.utils import (
convert_to_rhombus,
get_hexsym as get_hexsym2,
get_pathsym
)
import os
import r... |
faa9faf0c7a30d745f531e9ac8f454262b516baf39ba29e7f8a56104bd4ec348 | Python | 19,078 | 478 | #!/usr/bin/env python
"""
Collect vcf metrics. Writes metrics to stdout.
Metrics:
<prefix>_vcf_<type>_count : variants of a type in the test set
<prefix>_vcf_<type>_tp : variants with at least one matching variant in the baseline set (if baseline-vcf provided)
<prefix>_vcf_<type>_fp : variants with ... |
6cf0e5eedd07ef46e026ceabdf431d57c07d899dc83f5dd2cc36d2efe410876c | Python | 19,092 | 452 | import argparse
import copy
import optparse
import os
import pathlib
import platform
import sys
import urllib.parse
from pathlib import Path
from typing import Any, Dict, List, Optional, Tuple
import psutil
def _is_path(path_or_uri: str) -> bool:
"""Returns True if uri_or_path is a path and False otherwise.
... |
7e9f06487da93a495e13655a7b2241fba2b92919e4df5e3abf2914eda26842df | Python | 19,109 | 405 | #!/usr/bin/env python
# coding: utf-8
# author: Maruthi Mutnuri (maruthi2008@gmail.com)
# loading libraries
import pandas as pd
import numpy as np
import random
from sklearn.model_selection import train_test_split
import tensorflow as tf
from imblearn.over_sampling import SMOTE
from imblearn.under_sampling import Ran... |
2c32b5b7e74229afbe3a244ae73b8e68077ef86c2c93e2e49cdecac66e1f03de | Python | 19,115 | 473 | from typing import List, Optional, Union
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scanpy
from anndata import AnnData
from pyro import clear_param_store
from pyro.infer import Trace_ELBO, TraceEnum_ELBO
from pyro.nn import PyroModule
from scvi import REGISTRY_KEYS
from scvi.data imp... |
238d248564852f1e5d99ae542b7a50c741c27d5d108ddf2252b40e363532f6fa | Python | 19,118 | 595 | #!/usr/local/bin/python
"""
***********************************************
- PROGRAM: getEigenVectors.py
- CONTACT: Bryan lajoie (bryan.lajoie@umassmed.edu)
***********************************************
"""
from __future__ import print_function
from __future__ import division
import numpy as np
import scipy as sp
... |
0ab3071cdea42d630f4f61e5d69741acf46c1cb4be853c4071581f8dd81526cc | Python | 19,128 | 488 | from PIL import Image
import numpy as np
from ctypes import *
import ctypes
import copy
import torch
import torch.nn as nn
import torch.nn.functional as F
import os
import cv2
import time
import pdb
import scipy
import scipy.ndimage
import PySpin
import matplotlib.pyplot as plt
from Datasets import *
f... |
2fecfd1c67ac0ce66c0fac86ba1eb961a5c90be98a3aedf17bc9269448be5564 | Python | 19,135 | 400 | #!/usr/bin/env python
# coding: utf-8
# author: Maruthi Mutnuri (maruthi2008@gmail.com)
# loading libraries
import pandas as pd
import numpy as np
import random
from sklearn.model_selection import train_test_split
import tensorflow as tf
from imblearn.over_sampling import SMOTE
from imblearn.under_sampling import Ran... |
426f72fffcf06d1d202ae78bff95f3d567da6109462e9bc5ae30e14bc68c45e1 | Python | 19,135 | 600 | #!/usr/local/bin/python
"""
PCA on supplied matrix. Extract PC1, PC2, PC3. Works best on distance normalized matrix.
"""
from __future__ import print_function
from __future__ import division
import sys
import argparse
import subprocess
import shlex
import logging
import itertools
import time
import gzip
import re
... |
54b4eea92dbb735b24b93722d075c902381c563274e0c66a7314d7330913d674 | Python | 19,135 | 400 | #!/usr/bin/env python
# coding: utf-8
# author: Maruthi Mutnuri (maruthi2008@gmail.com)
# loading libraries
import pandas as pd
import numpy as np
import random
from sklearn.model_selection import train_test_split
import tensorflow as tf
from imblearn.over_sampling import SMOTE
from imblearn.under_sampling import Ran... |
4db51bdaf30ff88a0eb6f5f63369201110d8435508b8595962e632606afe1a1d | Python | 19,139 | 400 | #!/usr/bin/env python
# coding: utf-8
# author: Maruthi Mutnuri (maruthi2008@gmail.com)
# loading libraries
import pandas as pd
import numpy as np
import random
from sklearn.model_selection import train_test_split
import tensorflow as tf
from imblearn.over_sampling import SMOTE
from imblearn.under_sampling import Ran... |
5d22bcc44e2af583ff92180c3f805afee946ecf3d6effc714aa495e1e4d19f64 | Python | 19,139 | 400 | #!/usr/bin/env python
# coding: utf-8
# author: Maruthi Mutnuri (maruthi2008@gmail.com)
# loading libraries
import pandas as pd
import numpy as np
import random
from sklearn.model_selection import train_test_split
import tensorflow as tf
from imblearn.over_sampling import SMOTE
from imblearn.under_sampling import Ran... |
9c1c033cf25551c8bc21fe1e31c7668b29ecf7517afb1c06259d944a506d26e1 | Python | 19,139 | 400 | #!/usr/bin/env python
# coding: utf-8
# author: Maruthi Mutnuri (maruthi2008@gmail.com)
# loading libraries
import pandas as pd
import numpy as np
import random
from sklearn.model_selection import train_test_split
import tensorflow as tf
from imblearn.over_sampling import SMOTE
from imblearn.under_sampling import Ran... |
9edc8ab7552957b8ca67beb0053bd4509a4d9a250af96720475c3dd8959d3cdd | Python | 19,141 | 400 | #!/usr/bin/env python
# coding: utf-8
# author: Maruthi Mutnuri (maruthi2008@gmail.com)
# loading libraries
import pandas as pd
import numpy as np
import random
from sklearn.model_selection import train_test_split
import tensorflow as tf
from imblearn.over_sampling import SMOTE
from imblearn.under_sampling import Ran... |
df5dd660aa4fffe8d097742000429164a0cef47e49f512be5f47d49b008f17a0 | Python | 19,141 | 502 | import torch
import torch.nn.functional as F
from functools import partial
import numpy as np
from .transformer import AbstractTrasnformerLayer
from torch import Tensor
from typing import Optional
from torch import nn, einsum
import math
from ..utils import create_norm
from einops import rearrange, repeat, pack, unpac... |
cbebf85cea76f6bbf32bebfd5d7a53ab8a336c1ee5fa66d5b4c208896cfdaaf6 | Python | 19,157 | 660 | # Import the base module
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Circle
from mpl_toolkits.axes_grid1.anchored_artists import AnchoredSizeBar
from scipy.optimize import curve_fit
import csv
import os
# Import brian
import brian2 as br2
from brian2 import Morphology
# Import the ... |
52da61d689061ec9dac17776894e253e99db661ab16fb7bb14df43d443b9ddaf | Python | 19,163 | 579 | """Utils"""
import re
import numpy as np
import pandas as pd
from rdkit import Chem
from rdkit.Chem import rdFMCS, SmilesParserParams
from rdkit.Chem.rdchem import ChiralType
from rdkit.DataStructs import BulkDiceSimilarity
from lefshift import constants
from lefshift.fp import LEFFingerprint
def nof_unique_fingerp... |
812812ca96acb663a4c59a711b1eaf2005b1219b86cd4852c8006f2781ac25af | Python | 19,172 | 428 | # coding=utf-8
# Copyright 2023 The HuggingFace Inc. team.
#
# 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... |
3178196bb5e389c9f37319bb59ac4e9829129d390b45d0eaeeb76826504434c1 | Python | 19,174 | 659 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# pylint: disable=broad-except
# pylint: disable=invalid-name
# pylint: disable=line-too-long
# pylint: disable=multiple-statements
# pylint: disable=too-many-lines
#-------------------------------------------------------------------------------
'''
This software has bee... |
7cf378ee214499e41e102fe0661bcfc42819df203bcc4c58411e6854b6b5c450 | Python | 19,176 | 511 | import os
import glob
from typing import Callable, List, Union, Optional, Tuple, Dict, Any
import h5py
import datetime
import numcodecs
import numpy as np
import pandas as pd
from ml4ht.data.data_description import DataDescription
from ml4ht.data.util.date_selector import DATE_OPTION_KEY
from ml4ht.data.defines impor... |
c969e2fa67ad67833f76dbbe168e9c386c422e01ab3259e1b8a299bb71d5bbf6 | Python | 19,183 | 470 | from typing import Tuple, Iterable
import numpy as np
import torch
import torch.nn
import sak
from torch.nn import Conv1d
from torch.nn import Conv2d
from torch.nn import Conv3d
from torch.nn import Sigmoid
from torch.nn import L1Loss
from torch.nn import MSELoss
from torch.nn import BCELoss
from sak.__ops import req... |
e46aa8c268da9795a47ddea685ef8ae99528962a04489063c0ea7dbc30304eff | Python | 19,183 | 600 | import json
import os
import pprint
import shlex
import sys
import time
from subprocess import list2cmdline
from typing import Any, Dict, Optional, Tuple, Union
import click
import ray._private.ray_constants as ray_constants
from ray._common.utils import (
get_or_create_event_loop,
load_class,
)
from ray._pri... |
1d6030e47676ddbe54c5fb99b8a8f85d7ec28abe28a82599f8c63010363f2390 | Python | 19,188 | 511 | """Normalization constants for stimulus responses.
The normalization constant of a model is the root-mean-square of its responses to
~30 minutes of naturalistic stimuli (Sintel), computed per cell type. Recomputing
it requires simulating the full naturalistic stimuli dataset for every model of an
ensemble, which is ex... |
701570f668dddc51eb76f062bd346fafd5a2a7524da151aa6ac6d635247df0ea | Python | 19,193 | 521 | ###RF1-SRA
###UGR
from psychopy import visual, core, event, gui, data, sound, logging
import csv
import datetime
import random
import numpy
import os
#parameters
useFullScreen = True
useDualScreen=2
DEBUG = False
frame_rate=1
initial_fixation_dur = 4
#final_fixation_dur = 2
decision_dur=3.25
#outcome_dur=0.25
fileSu... |
8d674e954bf8efc1e07e4957d0130decc2450bb13db1beeab9293206df070978 | Python | 19,203 | 522 | import numpy as np
from copy import deepcopy
from utils import to_np, to_pth, sample_binary_array, flip_bits
# from utils import ortho_proj
# constants
N_CONTEXTS = 2
B = 2
N_POSSIBLE_PATHS = 2 # possible paths per context
CONTEXT_IDS = [0, 1]
class CSW():
'''the T x B coffee shop world, where B = 2
graph:... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.