sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
ffa8f4e4cd34829b921072fe1a86f4686cb82857b02597181421d96da4fc6099 | Python | 24,353 | 628 | # -*- coding: utf-8 -*-
"""Behavioral scoring utilities for the working-memory EEG analysis."""
import ast
from pathlib import Path
import pandas as pd
import mne
import numpy as np
import scipy.stats as st
#%%
# From source code (config files for measurements)
sdr_default_V0 = [[3, 5], [4, 3], [1, 3], [5, 0], ... |
35c7e97d90805eb3574ce6fbbec373577342a95fe4b292ec6c23481f45d32b64 | Python | 24,364 | 539 | import time
import RPi.GPIO as GPIO
from VariableList import var_list
class buttonprogram:
def __init__(self, UIinstance):
self.sendtoUI = UIinstance
#INITIALIZE PINS
GPIO.setup(var_list.latchpin, GPIO.OUT)
GPIO.setup(var_list.clockpin, GPIO.OUT)
GPIO.setup(var... |
e503c7e3a70a36ef3605733ff123a7a44a434a7275cf1ecba6f607b082fe4a3b | Python | 24,398 | 714 | from __future__ import annotations
import warnings
from typing import TYPE_CHECKING
import torch
import torch.distributions as dist
import torch.nn as nn
import torch.nn.init as init
from scvi import REGISTRY_KEYS, settings
from scvi.distributions import NegativeBinomial
from scvi.external.mrvi._components import (
... |
b2a161da6934111e67007e88a1425604545859365b5722a6a0448b48ee7010c5 | Python | 24,412 | 785 | import nipype.interfaces.utility as niu
import nipype.pipeline.engine as pe
from ..nodes.preprocessing import (
CropStacksAndMasks,
CheckAffineResStacksAndMasks,
CheckAndSortStacksAndMasks,
run_prepro_cmd,
)
from ..nodes.dhcp import dhcp_pipeline
from nipype import config
from fetpype.nodes.reconstructi... |
4908719ce38b62867d98c5e6be4714b7730031927798ab7df46f8fe2a34f5939 | Python | 24,422 | 670 | """
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.
TODO:
1. Simplify the case when `num_resolutions` == 1.
2. Remove indexing when the shape is the same.
3. Move some functions outsid... |
2e2307a57b85077df283f4c452d8c42a4076fd668e4766225b249146df0fa475 | Python | 24,464 | 596 | """
"""
"""
Copyright (c) 2019, 2022 [copyright holders here]
This file is part of NoSeMaze.
NoSeMaze is free software: you can redistribute it and/or
modify it under the terms of GNU General Public License as
published by the Free Software Foundation, either version 3
of the License, or (at your option) at any la... |
b3e9f5a6c705b1bc12ea26a03489f3779db47453e135e9f063c8b5c67d390e53 | Python | 24,506 | 683 |
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains t... |
1d535e87525d049bd140808fc873a81e8f5244f8d088b8e80c063201538a7681 | Python | 24,534 | 621 | from __future__ import annotations
import importlib
import json
import logging
import os
import tempfile
import warnings
from dataclasses import asdict
from pathlib import Path
from typing import TYPE_CHECKING
import anndata
import mudata
import rich
from rich.markdown import Markdown
from scvi import settings
from ... |
2e820e948ec3764f602863efbbfaf5877360c9198bf42bdf7b0135a30546fce8 | Python | 24,554 | 528 | #coding=utf-8
import os
import sys
sys.path.append("..")
import math
import numpy as np
import random
import torch
import config.cfg_lodet as cfg
from shapely.geometry import Polygon, MultiPoint # 多边形
def init_seeds(seed=0):
random.seed(seed)
np.random.seed(seed)
torch.manual_seed(seed)
torch.cuda.man... |
7e998a562aee0b6bccda2c7044eb4aa23daab1a5c6b68eaa4889e64244d70e07 | Python | 24,590 | 603 | from __future__ import annotations
import functools
import hashlib
from collections import defaultdict
from contextlib import contextmanager
from contextlib import suppress
from datetime import datetime
from datetime import timedelta
from datetime import timezone
from pathlib import Path
from tempfile import Temporar... |
fb0a8cc943ce4146ec231a15931c79f0670813ba4a3d07cfdf07f7a836d05c66 | Python | 24,605 | 615 | from cv2 import exp
from matplotlib.pylab import nan
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from matplotlib_venn import venn3
from collections import defaultdict
import pingouin as pg
import networkx as nx
import matplotlib.colors as mcolors
import matplotlib as mpl
from scipy.io import ... |
fd10fd5a9bee359797a54ca4d353c27515648b3caa58486b45d3a40ba32bf7a3 | Python | 24,628 | 724 | """
This module includes plotting utility functions.
"""
import numpy as np
import matplotlib.pyplot as plt
import logging
import seaborn as sns
from scipy.stats import entropy
import scanpy as sc
from scipy.sparse.csc import csc_matrix
from scipy.sparse.csr import csr_matrix
from . import utils as ut
from . import ma... |
75afd4a408fa21a4dc8a2fd6001d5d23a06a293c74cf9a13eab5b79e92c0c0a0 | Python | 24,642 | 545 | # coding=utf-8
# Copyright 2018 Salesforce and HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. 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
#
# h... |
ab755a0c420cdf0e30fad53906cd1e855ba54a941092dd24987aba757a25dcc6 | Python | 24,643 | 546 | # coding=utf-8
# Copyright 2018 Salesforce and HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. 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
#
# h... |
a8c2b29ce1090593a81a91817049de999bcedb43dd912cf014c7017fbbbb93f2 | Python | 24,686 | 602 |
from pathlib import Path
import click
import cv2
import numpy as np
import xarray as xr
from skimage.segmentation import mark_boundaries
from ..utils.decorators import error_handler
@error_handler('Generating motion marker', cluster=False)
def generate_motion_marker_video(dataset: str, chunk: int, motion_marker_c... |
2cbde9f78399e0c9b2abbcef4a7676fad391d05e98d068094ba58ebe175c8747 | Python | 24,687 | 593 | import functools
import logging
import bigstream.transform as bst
import numpy as np
import bigstream.utility as ut
import time
import traceback
from dask.distributed import as_completed, MultiLock
from itertools import product
from .align import alignment_pipeline
from .image_data import (ImageData, as_image_data, g... |
e94e57fe0e49fa640137f28fa0c4ba8c3d660795ce2eaaf05f841e1a91342069 | Python | 24,709 | 639 | """
Methods text generator for bombcell.
Generates a ready-to-use methods section paragraph for scientific papers,
with appropriate citations, based on the parameters used to run bombcell.
"""
from pathlib import Path
from typing import Dict, List, Optional, Tuple
# =================================================... |
360805571abe3ce97bea8461dc93e53ef5af386a200cf30772f6d3ae020d6dfc | Python | 24,711 | 647 | import unittest
from unittest.mock import patch
from pyecharts import options as opts
from pyecharts.charts import Bar, Grid, Line, Radar, Geo, Map
from pyecharts.globals import ThemeType, ChartType
from pyecharts.faker import Faker
class TestGridComponent(unittest.TestCase):
def _verify_instance_for_d... |
c56d7d4bd927761cc5edbfd683a43a1c2e0c65b486da20b8b6d23ae356298eb2 | Python | 24,721 | 725 | from __future__ import annotations
import types
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from src.features.telemetry_alignment.services.plot_service import TelemetryPlotService
from src.features.telemetry_alignment.views.display_mode_presenter i... |
f52ac4541631e7d38aeee8414b9a9332b6c9d153d5e0065858df5bcfe83eaf78 | Python | 24,723 | 589 | import os
import zarr
import torch
import pyvips
import argparse
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import torch.multiprocessing as mp
import torchvision.transforms.functional as F
from PIL import Image
from pathlib import Path
from matplotlib import cm
from ei... |
76fd3c6b691f390c2b04096c24fc4f40ac93591979eee737e240f780016863cd | Python | 24,772 | 708 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import joblib
from joblib import Parallel, delayed
from os.path import join
from importlib.resources import files, as_file
import psutil
import numpy as np
import nibabel as nib
from scipy import n... |
269ae20bdd0f0246ada0bd8a60a172db5844456df62ba44907c676fc3f89c57f | Python | 24,780 | 553 | ## script for plotting boxplots and scatter plots of simple stats such as count of approaches, count of interactions, chasings etc...
import matplotlib.pyplot as plt
import numpy as np
import igraph as ig
import networkx as nx
import pandas as pd
import os
import sys
import pandas as pd
import seaborn as sns
from scip... |
ab8fd705f73f37b8820accc322ca3f25f19328c6b0b742c9e6f502413b2ccf67 | Python | 24,793 | 738 | import argparse
import numpy as np
import tskit
import sys
import os
import io
import yaml
import torch
import moments
import stdpopsim
import ray
import numdifftools as nd
import matplotlib.pyplot as plt
import matplotlib.lines as lines
import seaborn as sns
import pickle
from torch import Tensor
from sbi.inference i... |
c95c465f7f076173b359b963c47bef295a40fa79353c4ef403d1d58fbb0c3b99 | Python | 24,796 | 721 | import collections
from collections.abc import Hashable
from math import prod
from string import Template
import numpy as np
try:
from pyparsing import (
CharsNotIn,
Group,
OneOrMore,
Optional,
Suppress,
Word,
ZeroOrMore,
alphanums,
alphas,
... |
8916c6bbcedde15a4737b432bd8cc6c58105dd51c6e499022b05affd2f1beb18 | Python | 24,821 | 608 | """Figure S_UMAP — Raw-feature UMAP comparison + HDBSCAN modality overlay.
Two sections per dataset (Lisberger primary, Hull secondary):
Row A — UMAP colored by: True labels | HIPPIE | NEMO | PhysMAP predictions
(raw-feature UMAP: WF + ISI + ACG concatenated, all labeled neurons)
Row B — Same UMAP, HD... |
db114b59b07e54fc25ede1345dc613b0ba4ed79ac7c3c9bdea016031bd18f833 | Python | 24,826 | 619 | """Main module containing the Plot class
"""
import pathlib
import warnings
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import nibabel as nib
from brainspace.mesh.mesh_io import read_surface
from brainspace.plotting.utils import PTuple
from brainspace.mesh.array_operations import get_lab... |
9d1371017184bc0e80aaadfe94c546a3cae88776f05b9d253501c496106e2d72 | Python | 24,829 | 586 | import torch
import DENNs
from Embedding import extendAxisNet,multiEmbedding,Embedding
from utils.Geometry import Geometry1D,LocalAxis
import numpy as np
from sklearn.linear_model import LinearRegression
from utils.get_grad import get_grad
from utils import Integral
from utils import NodesGenerater
def get_delta_u(mod... |
29bad3662533ecf1426ec6d3cb6cf60a9d315bab0661f11d4b1a7fb44ecabc53 | Python | 24,835 | 664 | #!/usr/bin/env python
# @license
# Copyright 2017 Google 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 applicab... |
0289c4dccb707205cddf1c113622fadfe52aed0ad7695dce8d52cfc51cf93d04 | Python | 24,866 | 728 | import logging
from dataclasses import dataclass, field
from typing import Callable, Dict, List, Optional, Tuple
import haiku as hk
import jax
import jax.nn
import jax.numpy as jnp
import jmp
import numpy as np
from einops import rearrange
from nucleotide_transformer.layers import RotaryEmbeddingConfig, SelfAttention... |
810a60938ad0d78136da9d4caf5505720eaf5bffb72b7c70792f6bad4f8ad181 | Python | 24,885 | 587 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and 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/LICEN... |
4e9bba7e2e1fc91a0d429bac5f787b62a8c7f8445a6f391c0df991d294d3c35a | Python | 24,886 | 588 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and 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/LICEN... |
8f54a42c6ab5236ebc80ee3045d293da2f09b8d1a5fdf4897697425432a556df | Python | 24,888 | 519 | #!/usr/bin/env python3
"""
@file test_npc.py
@author Simon Yu
@date 02/28/2023
@brief Script for testing NPC models.
"""
import argparse
import dataset
import header
import json
import logger
import model
import os
import pc
import test_neural
import test_pc
import torch
import tqdm
import utility
import wandb
... |
b4c4112e74d37d0174f81c370624b5fcd4df4d75aec8598932a4efb12e7ea591 | Python | 24,898 | 596 | from typing import Callable, Union, Tuple, List
import math
import torch
import torch.nn as nn
import torch.nn.init as init
import torch.nn.functional as F
class Linear(nn.Linear):
""" Simplified fully-connected layer."""
def __init__(self, in_features: int, out_features: int, *,
bias: bool... |
38b508bc9102e919ab71aea1a0c5e34b719d7152eca9ab9f8d8f275aa3e75295 | Python | 24,910 | 752 | from typing import (
List,
Any,
Optional,
Collection,
TypeVar,
Sequence,
Union,
Tuple,
Callable,
Dict,
)
import threading
import math
from pathlib import Path
import torch
import torch.distributed as dist
import numpy as np
from operator import methodcaller
import subprocess
impo... |
8d14a8f07225577c8e7107462a1c44a6863173356992dfefb08ef5ed3edffb8d | Python | 24,937 | 529 | import sys
import os
import argparse
import pandas as pd
import numpy as np
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from matplotlib.collections import PatchCollection
import matplotlib.patheffects as mpe
# Default colors are similar to matplotlib 2.... |
8e83b967ca39c3d9bcbcfba42bff95ab49fed54d94e0d05440c843fbc8a9a36d | Python | 24,949 | 559 | import os
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import matplotlib.cm as cm
import scipy.io
from scipy.stats import gaussian_kde, zscore
from itertools import cycle
from scipy.signal import correlate
from statsmodels.tsa.stattools import grangercausalitytests
from statsmodels.stats.multi... |
8b361bc3cf4198d06ea41a4df1f1f072b4920642ade84686d51eea2ce475c45b | Python | 24,954 | 662 | from __future__ import annotations
import json
import logging
import os
import re
import warnings
from hashlib import sha256
from pathlib import Path
from typing import TYPE_CHECKING
from typing import Any
from typing import ClassVar
from typing import cast
from packaging.utils import canonicalize_name
from poetry.c... |
4f370cef08ccc98c16763350c9801e67f9f943ba905b7ded85b11a67630f1126 | Python | 25,028 | 681 | """Class representing CMACBench dataset."""
from __future__ import annotations
import json
import pathlib
from typing import TYPE_CHECKING, Callable, Literal
import numpy as np
import pandas as pd
import torch
import torchvision.transforms
from attrs import define
from .. import common, datapipes, transforms
if TY... |
a10c6e948f8b21ec75e05d0585e6c8c2d9c86e79ebb453f5de92ff58249346e9 | Python | 25,062 | 616 | import dataclasses
import logging
import os
import pathlib
import random
from collections.abc import Iterable, Iterator, Mapping, Sized
from typing import Any, cast
import h5py
import hdf5plugin # noqa: F401
import numpy
try:
import loggers # type: ignore[import-not-found]
except ModuleNotFoundError: # `logger... |
6bcc2f3b21bf729c1f4b77dce392112a346a0406fe10a53f448802801ffd880f | Python | 25,085 | 474 | import matplotlib.pyplot as plt
import numpy as np
import igraph as ig
import networkx as nx
import os
import sys
import seaborn as sns
from scipy import stats
import pandas as pd
from scipy.stats import sem
from tqdm import tqdm
sys.path.append('..\\src\\')
from read_graph import read_graph, read_labels
from graph_me... |
d1925b5e6716205687fa7869bf8b27152768e1e7e1a4084afb3e7656939fd59a | Python | 25,095 | 614 | import os
from copy import copy
from textwrap import dedent
from PyQt5.QtCore import pyqtSlot, QObject, pyqtSignal
from PyQt5.QtWidgets import QFileDialog, QMessageBox, QDialog, QDialogButtonBox
import mdt
import mdt.lib.input_data
import mot
from mdt.gui.maps_visualizer.main import start_gui
from mdt.gui.model_fit.d... |
793645c399f837b60be7eba601443665b41ffde91700d6559757cc21caf4ea4a | Python | 25,115 | 690 | from __future__ import annotations
import logging
import os
import warnings
from typing import TYPE_CHECKING
import numpy as np
import torch
from scvi import REGISTRY_KEYS, settings
from scvi.data import AnnDataManager
from scvi.data._compat import registry_from_setup_dict
from scvi.data._constants import _MODEL_NAM... |
cec25ed153fa7ada5f4046dafcfb90b6288f0fb29732b260dbc78e3a9112b3be | Python | 25,164 | 783 | from __future__ import annotations
import base64
import re
from datetime import datetime
from datetime import timezone
from typing import TYPE_CHECKING
from typing import Any
import pytest
import requests
from packaging.utils import NormalizedName
from packaging.utils import canonicalize_name
from poetry.core.const... |
6932072634d9c71b5c323b7011cf743942cf3135b394330662f6d82174e752cc | Python | 25,206 | 872 | from __future__ import annotations
from typing import TYPE_CHECKING
import pytest
import tomlkit
from poetry.core.packages.dependency_group import DependencyGroup
from poetry.core.packages.package import Package
from poetry.factory import Factory
from tests.helpers import DummyLocker
from tests.helpers import get_p... |
766b086cd7d2ca89ef53323f4678a7aef4b6cafff99243ffca245eb64c7b599e | Python | 25,213 | 668 | import numpy as np
import scipy
import pandas as pd
from fractions import Fraction
import matplotlib.pyplot as plt
from matplotlib import cm, colors, gridspec
from matplotlib.colors import ListedColormap, LinearSegmentedColormap
from mpl_toolkits.axes_grid1 import make_axes_locatable
from mpl_toolkits.axes_grid1.inset_... |
13ecb78cc5e124832bd47da2d82bf73b125da370bf38d3300149d9a0d511de0f | Python | 25,240 | 747 | from abc import ABC, abstractmethod
from itertools import product
from typing import Dict, List, Optional, Tuple, Union
import numpy as np
import regex as re
NUCLEOTIDES = ["A", "T", "C", "G"]
VALID_EXTRA_NUCLEOTIDES = ["N", "M", "Y", "B", "S", "W", "K", "H", "D", "V", "R"]
EXTRA_NUCLEOTIDES = ["N"]
def _compute_k_... |
d1e57d870abdcbf7dd29cba376e98195f1fcedd5fe844136b610f5794d3b1984 | Python | 25,255 | 669 | """tests for functional forms of transforms
for labeled timebins.
Tests are in the same order as the module ``vak.transforms.frame_labels.functional``.:
- from_segments: transform to get labeled timebins from annotations
- to_labels: transform to get back just string labels from labeled timebins,
used to evaluate a ... |
8fdbec19385abce48a023c52ea1954e3669a36f61912f9b9c21fa0b3555e9d23 | Python | 25,321 | 627 | ### Functions for plotting, storing and fitting MEIs
import torch
import torchvision.models as models
import torchvision.transforms.functional as F
import torch.nn.functional as nnf
from torchvision import datasets, transforms
from lucent.optvis import render, param, transform, objectives
from lucent.modelzoo import ... |
48bb3e288b10835be36b67bb3501b0660a7a11379656ad96cb8c1cb853808c63 | Python | 25,341 | 570 | import numpy as np
import matplotlib.pyplot as plt
from tqdm import tqdm
def mutant_in_cohort():
number_of_hits = []
mutants = np.array([1, 2])
shuffled_arr = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
for i in tqdm(range(5000)):
hits = 0
for j in range(1):
# expID 1
... |
83463739f7ba798d73098c7b17a2c6ea13b6fdf8f3083ba577cbca21864d7a36 | Python | 25,347 | 674 | # 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.
import logging
import math
import os
import torch
import torch.nn as nn
import torch.nn.functional as F
from fairseq import checkpoint_utils
... |
0de0c7b4e19756638c2f8401eb813439101a2d625ad1b684f985fc6c7fe6dd15 | Python | 25,356 | 697 | # coding=utf-8
# Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... |
168c746579eb63504c58ed97627586e8248e4fd3570aa785a0c86b4045d1c193 | Python | 25,357 | 698 | # coding=utf-8
# Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... |
3343ca18a3edb06fc1c1925263eb5a85e9a73128c3291be8c899192fc27c4de9 | Python | 25,366 | 579 | # utils/segment_utils.py
import evfuncs
import matplotlib
import numpy as np
import os
import threading
import torch
import re
from moove.qt_helpers import invoke_in_main_thread, show_info
from moove.utils.movefuncs_utils import (
create_recfile_for_existing_audio,
ensure_hand_segmented_and_classified_lines,
)... |
d922d6f581aca9f2b970b964da2e05ba7080b4f3d2aea50d0f01edea09e01d53 | Python | 25,377 | 687 | """Pure unit tests for models/config.py."""
import ast
import inspect
import json
import pathlib
import random
import subprocess
import warnings
import pytest
import tomlkit
from pydantic import ValidationError
from d3text import factory
from d3text.models import config as cfg
REPO_ROOT = pathlib.Path(__file__).par... |
6ec9c67f5d23e1ad7b973e6fddfaf9fd782959461ee7e2e4d32db151faa0dd1d | Python | 25,416 | 550 | # coding=utf-8
# Copyright 2018 Salesforce and HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. 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
#
# h... |
21692d116f9c5735ab646edfe994d12298c6fc354012559f55d32632e8334b01 | Python | 25,417 | 551 | # coding=utf-8
# Copyright 2018 Salesforce and HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. 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
#
# h... |
c4a710df439fc263b35bc308f7c47fea5feb7f9b86e75c725f997080300a592c | Python | 25,432 | 750 | r"""
PyLossless Algorithms
=====================
This tutorial explains the calculations that PyLossless performs at each step of the
pipeline. We will use example EEG data to demonstrate the
calculations.
.. note::
You can open this notebook in
`Google Colab <https://colab.research.google.com/drive/1ecyNo10... |
5fc234433883209a6181683f2ba6415b50fb1209692e7f71ac3f3edc825840e3 | Python | 25,442 | 704 | import array
import unittest
from collections import namedtuple
import os
import pickle
import tempfile
import numpy as np
from medaka import common
import medaka.labels
def mock_positions_array(ref):
positions = []
major, minor = 0, 0
for l in ref:
if l == '*':
minor += 1
... |
e8f714e57aeeaf7fa130d37a295efbba86f0bd7d4765a9f46ec184f588169fba | Python | 25,449 | 449 | import numpy as np
import matplotlib.pyplot as plt
from tqdm import tqdm
import pandas as pd
def chasing_towards(rc_size = 3, total_chasings = 100):
"""
Computes the distribution of observed chasings towards sRC members, if chasings were
distributed by random chance.
"""
percentage_list =... |
f64c6b5c87dff7d8fe52529089694ea9e486e2ae6f0f9e3463c4f64eabaaee7b | Python | 25,454 | 636 | # ==============================================================================
# Script: 2_linear_segmentation.py
# Manuscript relevance: 2.3.ii
# ==============================================================================
# PURPOSE:
# Detect changepoints in lactate–pyruvate linear regression using PELT (Pruned
... |
80a7dac22a6b003a897b165407e859cf87fd6097faa267158e5e6875067b196f | Python | 25,472 | 1,801 | import numpy as np
# Cell cycle gene sets from Tirosh et al. doi:10.1126/science.aad0501, plus histones for S phase from own analyses
# Removed BIRC5 because it's expressed in certain non-cycling heart cells
g1_human = ["MCM5", "PCNA", "TYMS", "FEN1", "MCM2", "MCM4", "RRM1", "UNG", "GINS2", "MCM6", "CDCA7", "DTL", "PR... |
ca9aff7865d01eba85f6f6f74108a2fd036f3196365a161dceb0f54d089ea70d | Python | 25,480 | 626 | # 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.
import math
import sys
from typing import Dict, List, Optional
import torch
from torch import Tensor
from fairseq.sequence_generator import ... |
e2893908701a4ff31a77230f9c564c47f965984f157f8f8a8847da99eb601ead | Python | 25,480 | 620 | """
Modified from dash-bio ManhattanPlot (https://github.com/plotly/dash-bio/blob/master/dash_bio/component_factory/_manhattan.py)
"""
import warnings
import numpy as np
import pandas as pd
import plotly.graph_objects as go
from pandas.api.types import is_numeric_dtype
# %%
SUGGESTIVE_LINE_LABEL = "suggestive line"
... |
d9a5346ce75c9c69ffc19e8228d5fa5c8c656b868a88e80bd46b7961102b5dde | Python | 25,485 | 432 | import numpy as np
import random
from fracridge import FracRidgeRegressorCV
from sklearn.metrics import r2_score
# pRFtime tools
from pRFtime.utils import GaussianModel # model_class preset
class pRFs():
"""
Class to create pRF-based sensor-level predictions for regions of interest (ROIs).
pRFs.cre... |
93b924c3b2a088afa0dad8243cce9f3f25d72b16298f11b6ce8fb9ce9cf1f183 | Python | 25,510 | 634 | import os
import gc
from io import BytesIO
from datetime import datetime
import numpy as np
import pandas as pd
import cv2
from PIL import Image
from tqdm import tqdm
from scipy import signal
from scipy.ndimage import gaussian_filter1d
from sklearn.decomposition import PCA, FastICA
from kneed import KneeLocator
impor... |
fbc207e8e431948d999d1891aa2bb950fc7745f428676d3749cda613e12e3961 | Python | 25,554 | 654 | # 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.
import logging
import os
import re
from argparse import Namespace
from pathlib import Path
from fairseq.data import ConcatDataset, Dictionary,... |
9d11a22f62560aa214fcb48480f274b442a1e809d01bb2b0c2e894e0c143e9d6 | Python | 25,563 | 716 | from __future__ import annotations
import json
import sys
from enum import Enum
from typing import TYPE_CHECKING
from typing import ClassVar
from cleo.helpers import argument
from cleo.helpers import option
from packaging.utils import canonicalize_name
from poetry.console.commands.env_command import EnvCommand
from... |
d93d15e35d959d2ee45d3fe908ee58e977e96d73c97a2274d4116aa5a08a34de | Python | 25,586 | 633 | # import theano
import keras
import numpy as np
from keras import regularizers
from keras.engine import Layer
# from keras import initializations
from keras.initializers import glorot_uniform, Initializer
from keras.layers import activations, initializers, constraints
# our layer will take input shape (nb_samples, 1)
... |
758063547cc087c5ff325420e951ea8475bf4604ebbee1a39a9ac2007af216de | Python | 25,697 | 727 | # 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.
# The code in this file is adapted from the BeiT implementation which can be found here:
# https://github.com/microsoft/unilm/tree/master/beit... |
a929ddb7ca45e0d6b16b3fb01493f1c5c79d087a2574b8eaca6c2ee42227e4dd | Python | 25,727 | 515 | from __future__ import annotations
import argparse
import importlib.util
import json
import shutil
from pathlib import Path
import numpy as np
import pandas as pd
from scipy import sparse
from sklearn.decomposition import TruncatedSVD
from st_risk.config import load_config
from st_risk.data.io import open_h5ad
from ... |
597701928bda331ee38d45654c242b4c83a2d309e73b11aae3892d49fe64fb67 | Python | 25,735 | 565 | #!/usr/bin/env python3
"""Verificacao obrigatoria ANTES de lancar as 1784 tarefas no no do HPC.
POR QUE ISTO EXISTE. Em 2026-07-26 o driver de testes desta campanha rodou uma
etapa inteira em que TODAS as execucoes do SIESTA morreram em milissegundos por
falta de LD_LIBRARY_PATH (libscalapack ausente). O modo de falha... |
1113799676849d0e021c39874df80cc0149126ad050cf7196b796110790cbfdf | Python | 25,765 | 617 | from functools import partial
from collections import OrderedDict
import torch
import torch.nn as nn
import copy
from customized_linear import CustomizedLinear
from einops import rearrange
import random
import numpy as np
import pandas as pd
from kan import KAN
import torch.nn.functional as F
from timm.laye... |
b4861470a225d47d31cab3c6c9e79a02bc677a1f8ca6a52814c6bda3df6a654f | Python | 25,803 | 560 | #!/usr/bin/env python3
"""
hippie-wf3dacg cross-dataset training script.
Mirrors hippie cross_dataset_script.py but uses NEMO's encoders (waveform MLP +
3D ACG ConvNet) inside the HIPPIE CVAE framework.
Protocol:
1. Train hippie-wf3dacg CVAE on the SOURCE dataset (all neurons, unsupervised).
2. Extract z-mean emb... |
666efb11670920dcc78e911c64edbbcbeac896912d50580c85c12093bd128abe | Python | 25,817 | 649 | import typing
import os
import logging
from timeit import default_timer as timer
import json
from pathlib import Path
import inspect
import pickle as pkl
from tqdm import tqdm
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader
from .optimization import WarmupLinearSc... |
1ef82f5c4fe3ac1c6841238fc72f959cd3325cd7675896b8043a74e30607cd98 | Python | 25,845 | 638 | from __future__ import annotations
import logging
from dataclasses import dataclass
from typing import TYPE_CHECKING
import torch
from torch.nn.functional import one_hot
from scvi import REGISTRY_KEYS
from scvi.module import VAE, Classifier
from scvi.module._constants import MODULE_KEYS
from scvi.module.base import ... |
de8c13f0d1263534c3105f00a24973d112eb69ce3ec1a7b2522e67fb01ded49e | Python | 25,850 | 638 | ## Modeified code from https://github.com/TencentAILabHealthcare/scBERT
import math
import numpy as np
import torch
import torch.nn.functional as F
from torch import nn
from torch.cuda.amp import autocast
from einops import rearrange, repeat
from functools import partial
from contextlib import contextmanager
from loc... |
c4021e1b0e2f3b6d0a9fee407bbd927fe3aea06f325975883e877a7680024187 | Python | 25,864 | 638 | ## Modeified code from https://github.com/TencentAILabHealthcare/scBERT
import math
import numpy as np
import torch
import torch.nn.functional as F
from torch import nn
from torch.cuda.amp import autocast
from einops import rearrange, repeat
from functools import partial
from contextlib import contextmanager
from loc... |
68e867faca4a46d3bffcaeeb2c698db80277af16c3bb6dc0098b268101e73d97 | Python | 25,883 | 728 | # src/cluster_structural_compare.py
# -----------------------------------------------------------------------------
# Purpose
# Compare TWO clusterings (A vs B) on structural coherence metrics for segments.
#
# Mandatory metrics (per segment)
# - mean intra-segment Cα distance
# - contact density (intra-segment c... |
c746151204c8f8f1bf00800b86ffe1a3aa1837ade8ca06bbc71834ed6128d7b6 | Python | 25,891 | 619 | # Source code:
# https://github.com/zbmed-semtec/doc2vec-doc-relevance-training/blob/main/code/train_model/utilities.py
# This file includes the modifications to the source codes according to this project!
import tqdm
import gensim
import logging
import numpy as np
import pandas as pd
import csv
from scipy.spatial.di... |
4fd3c7ab4bc0ffd32fb928c37d3451ba69882c1518ee23aa688ba782bd3b6386 | Python | 25,929 | 665 | from __future__ import annotations
import logging
from functools import partial
from typing import TYPE_CHECKING
import numpy as np
import pandas as pd
import torch
from scipy.sparse import csr_matrix, vstack
from scvi._constants import REGISTRY_KEYS
from scvi.data import AnnDataManager
from scvi.data._utils import ... |
2c3bf5be1ffd78fbd9798570f0554234b73d925aa0a1c3dc46e6adf2f60ad8c4 | Python | 25,962 | 707 | # Copyright (C) 2010-2018 by Haibao Tang et al. All rights reserved.
#
# This code is part of the goatools distribution and goverend by its
# license. Please see the LICENSE file included with goatools.
"""Read and store Gene Ontology's obo file."""
# -*- coding: UTF-8 -*-
import os
import textwrap
from sys import s... |
c564b3dfcc7efb6a4a6658bfc0c9ba627d61a6ac65b81d4e55cbc4e060c7212e | Python | 25,979 | 950 | import numpy as np
import pandas as pd
import matplotlib as mpl
from matplotlib.lines import Line2D
from matplotlib.patches import Patch
import matplotlib.ticker as mticker
import statsmodels.formula.api as smf
from .paper_ANOVA import ANOVAModel
# Colours and types
Types = np.array(["T4", "T5"])
Type_colours = np.ar... |
c989ca7073567864f76969b046aa903ac4866c6a3daa5d48cf3088e747953b41 | Python | 25,980 | 499 | # -*- coding: utf-8 -*-
"""
Created on Fri Apr 15 13:01:08 2022
@author: 12593
"""
import numpy as np
import scipy.ndimage
# neighbour_code_to_normals is a lookup table.
# For every binary neighbour code
# (2x2x2 neighbourhood = 8 neighbours = 8 bits = 256 codes)
# it contains the surface normals of the triangles... |
d93aed1c12804c5e992832463e56e45940820dda743398cf432800eebbe241a5 | Python | 25,986 | 678 | """
Environmental symmetry and bilateral body plans.
Stage 2 (v2) : Delay-based differential processing with integral kernel readout.
Main formulation (C-level, general integral kernel)
---------------------------------------------------
Sensor inputs from a symmetrically placed pair:
s_L(t) = x(t - dtau(phi)/2)... |
dd8933837fe2d12129643ca7cacc1d0b3050d2b41f9b5c0564c49a356fa7db84 | Python | 25,989 | 669 | from math import sqrt
import torch
import torch.distributions as distr
from torch.autograd import Variable
from torch import nn
from torch.nn import functional as F
from .layers import ConvNorm, LinearNorm, GlobalAvgPool
from .utils import to_gpu, get_mask_from_lengths
class LocationLayer(nn.Module):
def __init__... |
177ae9ff3ac90934da6c2f0ba309514941a2ea6ad4c1c45dd7d7c11c390a9070 | Python | 26,014 | 801 | """
Gene completion eval pipeline using Evo.
Usage: python pipelines/gene_completion.py --config <config_file_path>
"""
import argparse
import logging
import os
import subprocess
import sys
import tempfile
from dataclasses import dataclass, field
from pathlib import Path
from typing import Dict, List, NamedTuple, Opt... |
c3789014f6a14bf45fb0c6c364038c7c715a74343fdf53503789d17d4505c827 | Python | 26,015 | 641 | import math
import os
import numpy as np
import pytest
import torch
from anndata import AnnData
from torch import nn
import scvi
import scvi.external.drvi._distributions as drvi_distributions_module
from scvi.external.drvi import DRVI, DRVIModule
from scvi.external.drvi._distributions import LogNegativeBinomial
def... |
9b53d884f9fb7c3674f5c8a797bd7ac07a14e37d6cc600d417ce65e0749ae89d | Python | 26,064 | 734 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. 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 cop... |
2f2bca6c968d2fbec9879ab5bac9022cd1772a412e96ee7b1cbdc0a61c03c7ca | Python | 26,113 | 676 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 7 16:40:34 2021
@author: bianca
"""
##############################################
##
## Decoding action predictions - Behavioural experiment
## Training part 3: hear tone, press button/passive button press, see grating (no orientation t... |
41e8140b8de5519b477dcaa195daf934dd4152ab59ae5c796b9c566d0d8e9436 | Python | 26,121 | 722 | # 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.
import logging
from pathlib import Path
from typing import Any, Dict, List, Optional
import torch
from torch import Tensor
from fairseq impo... |
d9af5124f09e397517f81f23c185d0071fc3f79084f45cb0b46e8b739288b979 | Python | 26,134 | 743 | from __future__ import annotations
from typing import Any
import torch
import torch.nn as nn
import torch.nn.functional as F
from jaxtyping import Float, Int, Num
from torch import Tensor
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from transformers import (
PretrainedConfig,
PreTrainedM... |
c87246aa32327c8d685defe7fdb859295a16378f18c23a7d33af8da732bd2e48 | Python | 26,138 | 754 | """
This is a helper script built to generate mocked PyPI json files and release files. Executing the script does the
following for a specified list of releases.
1. Fetch relevant project json file from https://pypi.org/simple/<name>.
2. Fetch relevant release json file from https://pypi.org/pypi/<name>/<version>/json... |
fa4e7f7f83ba9043bb2b1db52becaefa6bcc31089d51527052b2cc14b595d965 | Python | 26,151 | 738 | import torch
import torch.nn.functional as F
from typing import Dict, Optional, Tuple
from diffusers import DDIMScheduler, DDPMScheduler, DPMSolverMultistepScheduler
def _normalize_tensor(
t: torch.Tensor,
target_batch_size: int,
target_hw: Tuple[int, int],
mode: str = "bilinear",
keep_channels: b... |
bef191a7f14608eae551ddf9eea963f982db4e1ee33a34ec806cad35b97dfd95 | Python | 26,162 | 798 | # %%
import copy
import gc
import json
import os
from pathlib import Path
import sys
import time
import traceback
from typing import List, Tuple, Dict, Union, Optional
import warnings
import torch
from anndata import AnnData
import scanpy as sc
import scvi
import numpy as np
import wandb
from scipy.sparse import isspa... |
8b1509d8d79dabc1aca121a84f56696de5328ea594d3e2a07cb2b3df8e276c52 | Python | 26,169 | 654 | import gzip
import os
import re
from collections import Counter
from pathlib import Path
import pandas as pd
from openpyxl import Workbook
from openpyxl.styles import Alignment, Border, Font, PatternFill, Side
from openpyxl.utils import get_column_letter
from openpyxl.worksheet.dimensions import ColumnDimension
ROOT... |
a86a8b090810fb75bf2d3051e43662a1a76b2bfc45a984dc614b23bcc1860e7d | Python | 26,215 | 642 | # Copyright (C) 2025 ETH Zurich, Moritz Thürlemann, and other AMP contributors
import logging
import os
from sys import stdout
import numpy as np
import openmm as mm
import torch
from openff.toolkit import Molecule, Topology
from openmm import unit as u
from openmm.app import PDBFile
from openmmforcefields.generator... |
4e447070b107f57ec1919ad13371e4784431ed763d2c5f2fe7727e88701068fd | Python | 26,236 | 563 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from typing import Dict, Sequence, Union
import torch
from mattergen.common.data.chemgraph import ChemGraph
from mattergen.common.data.types import PropertySourceId, TargetProperty
from mattergen.common.utils.data_utils import get_atomic_number... |
54eb09c08207a461411d143f7f1207cb4070934f64796bc53c66a237a59fedfb | Python | 26,298 | 696 | # Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
c83f490d0782efb87c1e63638b0cb7b901748981074ab915162690a954a8f295 | Python | 26,301 | 697 | import logging
import numpy as np
from itertools import product
import bigstream.utility as ut
import os, tempfile
from ClusterWrap.decorator import cluster
import zarr
import bigstream.transform as bs_transform
from dask.distributed import as_completed
from pydantic_zarr.v2 import ArraySpec
from ome_zarr_models.v04.ax... |
ffedc85387de7d5ae36091e166275fd03cae9b8fd6715dbf36d7578f9065afca | Python | 26,311 | 651 | from dataclasses import dataclass
from enum import Enum
from typing import Optional, Tuple, Dict, Any, List
from pathlib import Path
import torch
import torch.nn.functional as F
from torch import nn, Tensor
from torch.nn import Linear, LazyLinear
from torch_geometric.nn import (
GCNConv, DenseGraphConv, GATConv, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.