sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
318621c10b055a981859487d1e982cdbdc5f3d4d72f5e62e8dd8d4e21b9f8fe8 | Python | 5,715 | 152 | import cv2
import numpy
import time
from scipy import io
from propagation_ASM import *
import model
import tools
testpic=829
pitch=0.0036
wavelength=0.000520
n = 2160
m = 3840
z0=200
layernum=6
interval=10
reconlayer=0
slm_res = (n, m)
pad=True
convert=False
method='phase'
#method='nophase'
if pa... |
ef54743c05368a17aad5f8c3243b145fec8398f2474fd9e2a49604c77a626fca | Python | 5,715 | 160 | import os
import re
import glob
import itertools
from mne import read_source_estimate
from .._data_obj import Dataset, Factor
from .fiff import stc_ndvar
class DatasetSTCLoader:
"""
Load source estimates on disk into Dataset for use in statistical tests
Parameters
----------
data_dir : str
... |
3df6d97baf8a4c86493356dad72f219d7fd0fb4eb2a1e130a0b1ff26d38f4515 | Python | 5,716 | 109 | import torch
from torch import nn
from torch import Tensor
from collections import OrderedDict
import numpy as np
import opt_einsum as oe
class GetDensity(torch.nn.Module):
def __init__(self,rs,inta,cutoff,neigh_atoms,nipsin,norbit,ocmod_list):
super(GetDensity,self).__init__()
'''
rs: tens... |
5a245278e6e61b238eb8610fe46215df70610cf2c06f202632adc7927d47a031 | Python | 5,716 | 167 | # 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.
""" Utility functions for metric evaluation.
Author: Or Litany and Charles R. Qi
"""
import os
import sys
import torch
import numpy as np
... |
77726f3f2f58a09ee86052b8e786811dc9f1880c6a410807ac01a3de0c5b3a83 | Python | 5,717 | 163 | #!/usr/bin/env python
import csv
import os
import sys
import subprocess
import tarfile
from glob import glob
from multiprocessing import Pool
import progressbar
import sox
from deepspeech_training.util.downloader import SIMPLE_BAR, maybe_download
from deepspeech_training.util.importers import (
get_counter,
g... |
a5b0c6959ddfa69afc2568230b65ee127928b7618c6b949e9c3143feabe6fe73 | Python | 5,717 | 194 | # -*- coding: utf-8 -*-
"""
Shared fixtures for the Tier 2 instantiation/trial-stepping tests
(test_instantiate.py). Not a test module itself -- no tests in here.
Mirrors the fixtures built for py-behaviors' tests/ -- see that repo's
tests/fixtures.py for the sibling implementation.
"""
import datetime as dt
import o... |
3069e498be9e6c295b36a999d8b2e153991cc1c19528c6cc69b374defb431317 | Python | 5,718 | 179 | """
This code contains methods to optimize the final reconstructed mesh model.
1. uniform mesh
2. fix mesh
"""
from typing import Optional, Union
import numpy as np
import pyvista as pv
from pyvista import PolyData
try:
from typing import Literal
except ImportError:
from typing_extensions import Liter... |
5e558bddc9eabd1cc366af6a2425af0089eb95ca3647c7227923ffbc7a93cdf1 | Python | 5,718 | 165 | import math
import torch
from torch import nn
import torch.nn.functional as F
'''
@article{wolf2019transformers,
title={Transformers: State-of-the-art Natural Language Processing},
author={Wolf, Thomas and Debut, Lysandre and Sanh, Victor and Chaumond, Julien and Delangue, Clement and Moi, Anthony and Cistac, Pier... |
70bb62acc7df77b9fe1af40d241593f852e4847e595f89752055b06d9c98df91 | Python | 5,718 | 148 | """
This file contains code simplifying access to data in ATF files.
One goal of this module is to produce an ATF class with virtually all the same
methods as the ABF class.
ATF file format description:
https://mdc.custhelp.com/app/answers/detail/a_id/18883/~/genepix%C2%AE-file-formats
"""
import numpy as np
import o... |
cb71088196ac73d9e204216985b5a0c0f4c5054fb75cd19a169022d05bd75ba7 | Python | 5,718 | 163 | """C02 repr harness: property tests over the rendered surface (lovely 5).
The bug table exists because nothing reads these strings; this harness
lands WITH the grammar. Scope note: the one-line-repr conversion of
Op/Layer/Param value records is F10 (lovely item 6) -- here we pin the
LAWS the substrate already owes: no... |
e152f4197b72ce31efeed53ede8108b5423b978dfd6e6418a786642cce4fad8c | Python | 5,719 | 143 | from tqdm import tqdm
import numpy as np
import os
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
import sklearn.utils.class_weight as class_weight
from dataProcessing.modules import *
from dataProcessing.dataset import *
from d2l import torch as d2l
import configparser
import torch
imp... |
efbd868a870ab487154152cdd837b7e8bcb93a45432090f9d9c8b04d09627afb | Python | 5,719 | 169 | import torch
from torch import nn, optim
from torchmetrics import MeanAbsolutePercentageError
import torch_geometric as tg
from torch_geometric.loader import DataLoader
from typing import List, Optional, Union
import matplotlib.pyplot as plt
import shutil
import sys
from datetime import datetime
import argparse
# My im... |
3e283e9b88eac354913c0a11b75c0a21efa88fdecfb521f1a9d30a39e1dcd7db | Python | 5,720 | 162 | """Paddle payload codec and portable ``.tlspec`` round-trip tests."""
from __future__ import annotations
from pathlib import Path
from typing import Any
import numpy as np
import pytest
paddle = pytest.importorskip("paddle")
import torchlens as tl # noqa: E402
from torchlens._io.payload_codec import get_payload_c... |
b3bfaab726a77612cedd98c59050a250f80d3a1f7176d56ef19233b91cf9d577 | Python | 5,720 | 173 | import copy
import numpy as np
import pandas as pd
from mirp._features.texture_matrix import Matrix
class MatrixNGTDM(Matrix):
def __init__(self, **kwargs):
super().__init__(**kwargs)
# Occurrence matrix
self.pi: pd.DataFrame | None = None
# Expanded occurrence matrix
... |
28a6580d83bcaa47a9de0f25270604fe0c5b6f89f8491e9fe036748969d0d4f0 | Python | 5,721 | 150 | # LICENSE
#
# _This file is Copyright 2018 by the Image Processing and Analysis Group (BioImage Suite Team). Dept. of Radiology & Biomedical Imaging, Yale School of Medicine._
#
# BioImage Suite Web is licensed under the Apache License, Version 2.0 (the "License");
#
# - you may not use this software except in complian... |
0516240a5f83b7c430e87fa6af0df3011a3a70eb1ba7cfeef5a54c4473a61118 | Python | 5,722 | 171 | """
This file contains code to plot ABF data using matplotlib.
Users are typically encouraged to write their own plotting functions, but
I have added common tasks here to serve as a reference and potentially even
inspiration (for those who have not used matplotlib before).
Code in this module is mostly for testing an... |
2f03651c7011bb73bd41cc9eb30350d5353359940eabc116457cc44956f7c333 | Python | 5,722 | 163 | from transformers import BertModel, DistilBertModel
from transformers import AutoModelForCausalLM, AutoModel
from os.path import join as oj
import torch
def generate_ngrams_list(
sentence,
ngrams: int,
tokenizer_ngrams,
all_ngrams=False,
parsing: str = '',
nlp_chunks=None,
):
"""get list o... |
5d3d5e6b9dbcc7d7d1b57cbb5750b493ba272505994b1e9441c45e663e430efb | Python | 5,723 | 176 | """Runnable Semantic I/O legibility demo.
This example is intentionally tiny and deterministic. It demonstrates the
review-day semantic I/O surface without downloading optional torchvision or
Hugging Face models.
"""
from __future__ import annotations
import tempfile
from pathlib import Path
from types import Simple... |
e1e7622b0bcbb55cac4c0df4a34d277314691169339d0dab5046fa74b35c727e | Python | 5,725 | 134 | #!/usr/bin/env python3
"""Verification of Dx N Quad_LDA ap+topo+conn_alpha AD-vs-HC result.
Perm null + bootstrap CI (500 each, within-cohort resample for bootstrap).
"""
from __future__ import annotations
import os, sys, json, time
import numpy as np
HERE = os.path.dirname(os.path.abspath(__file__))
OUT_DIR = os.pat... |
5ddd813e8e6034c18e9ea053a68831c5825ca24fab5f70c437c67f3e8a01bdf4 | Python | 5,726 | 139 | """Fitted contract: the no-optimizer lint + provenance field-set pin (F35; item 20).
The architecture memo's fitted settlement (3.2): fittedness is a CONTRACT,
not a layer -- one provenance-shaped record, one gate at every accepting
seam, refuse-silent-refit, and the AST lint that makes "torchlens never
trains" true b... |
c18c4ec673d16d8e207134ce5ce3c0ffa6bcd98d8211c90c0daacd9521c3b5a0 | Python | 5,726 | 163 | """Tests for streaming cross-covariance and linear CKA."""
from __future__ import annotations
import math
from collections.abc import Iterable
import pytest
import torch
from torch import nn
import torchlens as tl
from torchlens.stats import CKA, CrossCovariance, cka
def _gram_cka(a: torch.Tensor, b: torch.Tensor... |
615813923f49e47043185e5d85cc019c8a045c86a4dba90c4d2ad504c03fd1f8 | Python | 5,728 | 224 | """pytest configuration
Extends output capture as needed by pybind11: ignore constructors, optional unordered lines.
Adds docstring and exceptions message sanitizers.
"""
from __future__ import annotations
import contextlib
import difflib
import gc
import multiprocessing
import re
import sys
import textwrap
import t... |
2a9f423575257c69d3b12f4b0e1a11710dad25d27e218cb35a0448ea202acee0 | Python | 5,729 | 140 | """Typed run-door refusal for bool and out-of-range ``run(seed=...)`` (r79).
Round-78 found two values that escaped the r77 seed door
(``seed is not None and not isinstance(seed, int)``) and reached raw torch:
- ``bool`` (hon1): an ``int`` subclass, so it passed the type check, but the
run path uses ``default_gener... |
b7e8ef55339915fcf1b5fe88bf43d04a9d6bdbae18633a959fa6ae984b4c9ae1 | Python | 5,729 | 145 | """
Agent registry for managing available AI agents.
"""
import logging
from .base import (
BaseGalaxyAgent,
GalaxyAgentDependencies,
)
log = logging.getLogger(__name__)
class AgentRegistry:
"""Registry for managing available AI agents."""
def __init__(self):
self._agents: dict[str, type[B... |
bbebb8345bf0b9f5a09a14a7b3021b0ff9e657ccf4318b36556aa360cc02b2e1 | Python | 5,729 | 171 | from datetime import datetime
from unittest import mock
import pytest
from api.mocks import FakeAuthContext, FakeUserWithAuthDependency
from dependency_injector import providers
from fastapi import FastAPI
from fastapi_pagination import add_pagination
from starlette import status
from starlette.testclient import TestC... |
e7eea69305d539607abdaa5dcccc55a9ccb6d01acad3930a557d4d147ddc4f64 | Python | 5,729 | 128 | """W051-AGENT: overview anomalies read the tri-state (AUD-CODE 2.5) and the
fold resolves edges + boundary roles (AUD-CODE 3.11b), incl. the realistic
fixture (AUD-CODE 4.9)."""
from __future__ import annotations
from pathlib import Path
import pytest
import torchlens as tl
from tests.test_agent_surface_helpers imp... |
785356c28450d360087903f43a82bca4dbd8c3476a9c73ac84b8a00903e40047 | Python | 5,730 | 151 | # Copyright (c) 2023, GGGGGGXY, Tri Dao.
import math
import json
import re
from pathlib import Path
from collections import OrderedDict
import torch
import torch.nn.functional as F
from einops import rearrange
from transformers import GPT2Config, AutoConfig, PretrainedConfig
def remap_state_dict_hf_baichuan(state... |
054f24bb4f90d93eb5d4c19c0b62f37c684be0bb87a93c033a8e73ff05c84c66 | Python | 5,732 | 176 | # --- THIS FILE IS AUTO-GENERATED ---
# Modifications will be overwitten the next time code generation run.
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Line(_BaseTraceHierarchyType):
_parent_path_str = "histogram2dcontour"
_p... |
b2c1c4e01a2d9a7bc466c057c2bd1e5f9c5a7438b956146fea63272a4bddd1da | Python | 5,733 | 178 | import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
from scipy.stats import beta as beta_dist
import jax.numpy as jnp
from PyALE import ale
import seaborn as sns
sns.set(palette="muted")
from training_functions import batched_apply, logit, inverse_logit
from constants import FEATURE_NAMES
def ... |
0418fda57818bfc7de847d2cb49543e39e2a5933ace8cb01af6ff78d239952ed | Python | 5,735 | 148 | # A simple CLI runner for slurm that can be used when running Galaxy from a
# non-submit host and using a Slurm cluster.
from logging import getLogger
from os import path
from . import (
BaseJobExec,
job_states,
)
from ... import runner_states
log = getLogger(__name__)
argmap = {
"memory": "-M", # There... |
134a1b0b55a81ec935c4bd536f072f6a8725e6303cebd1d5f3d9ddd2647e4563 | Python | 5,735 | 177 | import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import colorConverter
from brian2.units import msecond
import scipy.stats as stats
import seaborn as sns
import string
import styling
colors = {
'std': '#25126c',
'dev': '#ae131a',
'msc': '#e7c518',
'Depression': '#9b19f5',
... |
c47a5c71c20f646598272c7512b220b31adff7bf50400b62b7e98f1ac1f7185d | Python | 5,735 | 158 | import sys
sys.path.insert(1, '/u/home/r/ryo10244/Xiao_lab/dsRNA_pred/script/utils')
import re
import pysam
import argparse as ap
import pandas as pd
import numpy as np
from utils import *
import random
from os.path import exists
#import multiprocessing as mp
#from functools import partial
def main(args... |
29ded9aaab464d66a34f252772cde3315dcc85b7d66192574fd8497ac082e1d8 | Python | 5,736 | 132 | import numpy as np
from gym import utils
from gym.envs.mujoco import MujocoEnv
from gym.spaces import Box
class InvertedPendulumEnv(MujocoEnv, utils.EzPickle):
"""
### Description
This environment is the cartpole environment based on the work done by
Barto, Sutton, and Anderson in ["Neuronlike adapt... |
8ea074d5bcef0daae5c371e26828c08c6dc4ed61210483845153ac5e584521d1 | Python | 5,736 | 152 | import threading
import time
from typing import Any, Dict, Tuple
import requests
from codecarbon.core.units import EmissionsPerKWh, Energy
from codecarbon.external.geography import GeoMetadata
from codecarbon.external.logger import logger
_Key = Tuple[Tuple[Tuple[str, Any], ...], str]
URL: str = "https://api.electr... |
fb3a390c796c7f3ee45d5d63c32fca4f6c6d77f30a412d9bc4f6f2ce64183e99 | Python | 5,736 | 159 | #!/usr/bin/env python
"""Tests for ClusterPlot."""
import unittest
from unittest.mock import MagicMock, patch
import matplotlib.colors
import numpy as np
import pandas as pd
from stlearn.pl.classes import ClusterPlot
from tests.utils import read_test_data
class TestClusterPlot(unittest.TestCase):
"""Tests for... |
7b269f9ea367e052a2dcd9b556c179e87f7a62ba4719b844b7e4039c301c43ec | Python | 5,739 | 151 | """Evaluation Metrics for Semantic Segmentation"""
import threading
import numpy as np
import mxnet as mx
try:
from mxnet.metric import EvalMetric
except ImportError:
from mxnet.gluon.metric import EvalMetric
__all__ = ['SegmentationMetric', 'batch_pix_accuracy', 'batch_intersection_union',
'pixelAc... |
63324bca58d9222310f7489d3f6caa87a3b6e5b03c660d8c4df279aa73a14537 | Python | 5,741 | 147 | # SOURCE: vendored from dellacortelab/prospr @ c081249 (master)
# File: prospr/nn.py
# ProSPr / ProFOLD: open-source AlphaFold1-style dilated-residual-convolution network that
# predicts a distogram plus auxiliary secondary-structure / torsion-angle / ASA maps from
# an input feature tensor (MSA co-evolution + sequence... |
e816821522f114af35a0a2b25da55548716250932904d220b0d0a26ece20c6a8 | Python | 5,741 | 172 | """
====================================================================
Segmentation of SAR image with Riemannian geometry
====================================================================
This example compares clustering pipelines based on covariance matrices for
synthetic-aperture radar (SAR) image segmentation ... |
8c97b708f44894770d4637ffe37b605ae6a47adfafe1ac330d269fa5d637b2f3 | Python | 5,742 | 182 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import platform
__author__ = ['Nico Curti']
__email__ = ['nico.curti2@unibo.it']
__all__ = [
'CRLF',
'IMG_SIZE',
'GREEN_COLOR_CODE',
'ORANGE_COLOR_CODE',
'VIOLET_COLOR_CODE',
'RED_COLOR_CODE',
'RESET_COLOR_CODE',
'Deepskin_CENTER',
'Deepskin_SCALE',
... |
4118d71892b68211edb0673d3be17094acc6e77207a1cad666e2930154858c5c | Python | 5,743 | 130 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""tests for gnn classifier"""
import unittest
import numpy as np
from scipy import sparse
from sknetwork.data.test_graphs import test_graph
from sknetwork.gnn.gnn_classifier import GNNClassifier
class TestGNNClassifier(unittest.TestCase):
def setUp(self) -> None... |
0afe124dd6079843238bd8618345bdc5625d29c7084faf37205f5a2165fa4673 | Python | 5,744 | 165 | import numpy as np
import pandas as pd
from permacache import permacache, stable_hash, drop_if_equal
import tqdm.auto as tqdm
from .leafcutter_data import load_all_leafcutter_data
from modular_splicing.utils.construct import construct
COORDINATE_COLUMNS = ["chrom", "strand", "pos", "is_end"]
def convert_psi_table... |
11c05a30dd6bebaa914034b4a77f7b6e7fe9341a88a72311893bd0faef19ad9e | Python | 5,746 | 193 | import argparse
import json
import pandas as pd
from galaxy_ml.model_persist import dump_model_to_h5, load_model_from_h5
from galaxy_ml.utils import read_columns
from scipy.io import mmread
from sklearn.pipeline import Pipeline
N_JOBS = int(__import__("os").environ.get("GALAXY_SLOTS", 1))
# TODO import from galaxy_... |
4b4b312695ff3332057314235da7a4dd121e4348613e8acd3f5e736cad2406cc | Python | 5,750 | 156 | """Contains all methods relate to iteration."""
import torchtext.data
from bioseq2seq.utils.logging import logger
def batch_iter(data, batch_size, batch_size_fn=None, batch_size_multiple=1):
"""Yield elements from data in chunks of batch_size, where each chunk size
is a multiple of batch_size_multiple.
... |
d0d90f17006c15f0b5907379d4fa0ec14a9de21b35b26891d39c437ad4e16bf2 | Python | 5,750 | 169 | from __future__ import annotations
import panel as pn
import pytest
from panel.links import Callback
from larvaworld.portal.buttons import (
add_button,
build_export_file_button,
build_load_file_button,
cancel_button,
confirm_button,
delete_button,
draw_button,
export_button,
impo... |
fe898f6d687d43e374680e7fdc0ac6c86c696da4c5ff6ba3b70223bb5af47ef1 | Python | 5,752 | 151 | #!/usr/bin/env python
# coding: utf8
import numpy as np
import scipy.optimize as opt
import sys,cPickle
import scipy.weave
#import weave
__doc__ = """Definitions for the threshold nonlinearity
Copyright (C) 2014 Ingo Fründ
This code reproduces the analyses in the paper
Fründ, Wichmann, Macke (2014): Quantifyin... |
c77dabed0aaa985acf0ca486a249b13d1eb1f2b14b90f6bd0478b99a1a3f1e29 | Python | 5,753 | 156 | # SOURCE: vendored from locuslab/TCN @ master
# (https://github.com/locuslab/TCN, TCN/tcn.py: Chomp1d, TemporalBlock, TemporalConvNet;
# TCN/adding_problem/model.py: sequence-to-scalar regression head pattern, "self.linear(y1[:, :, -1])")
#
# "1D-TCN for NIR aflatoxin detection" (candidate queue name) has no dedicated ... |
7e65a98d93515fbb245044042709610b26cb0ebcd083fa0cc78771bc27d7c5e2 | Python | 5,754 | 193 | #!/usr/bin/env python
# Created on: December 16, 2013
__author__ = "Sven Kreiss, Kyle Cranmer"
__version__ = "0.1"
__description__ = """
Requires Decouple package in Pythonpath.
"""
if __name__ == "__main__":
import optparse
parser = optparse.OptionParser(version=__version__)
parser.add_option("-i", "--input", ... |
4a37a25b74ad4cc88b2c2a36e0ddd2fe66088eab2fe884325aee3a67288089bc | Python | 5,756 | 155 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 23 14:03:00 2021
@author: Audrey Mazancieux
This script contains plotting functions for event related analyses for the
local-global task on signal extracted from an ROI in native or
standardised space (using the extract_timeSerie script).
thes... |
e188be3ecea473ea8c4781c0defa380c8580b368cf8e6d78933836d9dfbc559c | Python | 5,756 | 177 | import numpy as np
import pytest
from gym.envs.registration import EnvSpec
from gym.spaces import Box, Discrete, MultiDiscrete, Tuple
from gym.vector.sync_vector_env import SyncVectorEnv
from tests.envs.utils import all_testing_env_specs
from tests.vector.utils import (
CustomSpace,
assert_rng_equal,
make_... |
4ad7776922d89b67bb716c8fbf54154fa71fdcbf87a3382a75968f6f57f5a836 | Python | 5,757 | 138 | from __future__ import division
import tensorflow as tf
tf.compat.v1.disable_eager_execution()
class Regularizer(object):
"""Regularizer Class
Class that aggregates all types of regularization used.
Args:
params (dict): The regularization parameters containing the following optional keys:
... |
0529e8ad56c8b3c04b56cbbdf31e2bc6ca9811ba68b0e154558007bf7de6324c | Python | 5,760 | 165 | from __future__ import absolute_import
from __future__ import division
import os
import numpy as np
import mxnet as mx
from mxnet import gluon
from PIL import Image
try:
import xml.etree.cElementTree as ET
except ImportError:
import xml.etree.ElementTree as ET
import sys
if sys.version_info[0] == 2:
import ... |
629d8d1d6ef50c838282415bec72893b32a6b2e9bfb3f3a89113fa1e74776d38 | Python | 5,761 | 194 | """Check a project and backend by attempting to build using PEP 517 hooks.
"""
import argparse
import logging
import os
from os.path import isfile, join as pjoin
from pip._vendor.pytoml import TomlError, load as toml_load
import shutil
from subprocess import CalledProcessError
import sys
import tarfile
from tempfile im... |
07c7f479525779c7b116133a06d4ddf3a3c07053f523ba228a2940e272fcf4fa | Python | 5,762 | 148 | # -*- coding: utf-8 -*-
import os
import sys
import argparse
import mne
import matplotlib.pyplot as plt
from mne.preprocessing import read_ica
from run_ica import fit_ica, get_excludes, plot_ica_results, create_report
def run_ica_manual(subj, task, raw_fname, output_dir, fit=False, all_manual=False):
ica_dir = o... |
df743e845aaf5205d9975348b85c58500bfe78136f3fdcb00dff139ebba9810b | Python | 5,763 | 142 | #!/usr/bin/env python3
# coding: utf-8
"""
Created in September 2020
@author: Quentin Lutz <qlutz@enst.fr>
@author: Thomas Bonald <bonald@enst.fr>
"""
from typing import Optional, Union
import numpy as np
from scipy import sparse
from sknetwork.clustering.louvain import Louvain
from sknetwork.embedding.base import Ba... |
a16772bc990230cd4f043d6beefbd9e80a9a8e174c8f0cff34aed399d92ee87b | Python | 5,764 | 155 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import tensorflow as tf
import pandas as pd
import argparse
import os
import time
import sys
import pdb
import csv
import re
import deepchem
import pic... |
f22e48414b5aa68521419681a996bb09dd54061d9f8e55842c83d60291a56afa | Python | 5,764 | 161 | """Register all builtin tasks."""
import gymnasium as gym
from angorapy.common.const import N_SUBSTEPS
from angorapy.common.const import SHADOWHAND_MAX_STEPS
from angorapy.tasks.envs import dexterity
from angorapy.tasks.envs import cognitive
# REACHING
for vision_mode in ["Visual", ""]:
for control_mode in ["Rel... |
98cd1d217c2d4d5531da23cd41755027f3cd459c318bb40daa85f298e987c0ac | Python | 5,765 | 129 | '''
Training samples analysis
'''
import numpy as np
import seaborn as sns
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib import rcParams, cycler
import matplotlib.pyplot as plt
from matplotlib.ticker import AutoMinorLocator
rcParams['font.family'] = 'sans-serif'
rcParams['font.sans-serif'] =... |
397ecd6fd46e886169f17f94636b3b4be70630e3432725fdafca4bd931651421 | Python | 5,768 | 158 | """HoloGAN: Unsupervised Learning of 3D Representations from Natural Images.
Nguyen-Phuoc et al. (Oxford / Adobe) 2019. arXiv:1904.01326.
Source: https://github.com/thunguyenphuoc/HoloGAN
HoloGAN's distinctive primitives:
- **3D feature volume**: the generator synthesizes a 3D latent feature volume
(D x H x W ... |
e94c394f774762353c5e1199b067ef3a063ceedcaf6ad318b68eb350b5f071c6 | Python | 5,768 | 213 | from typing import List, Tuple, Dict, Union, Optional
import argparse
import logging
from pathlib import Path
from pprint import pprint
import numpy as np
import numpy.typing as npt
from ase import units as ase_units
import plotly.express as px
import plotly.graph_objects as go
import pandas as pd
import torch... |
7c3137ce8943188a117dbc8f7947250cec4eeac3981e69d6730355c79b12dd6d | Python | 5,769 | 170 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import numpy as np
__all__ = ['KimNet', 'ConvNet', 'RecurNet', 'init_weights']
"""
Neural network models are defined here
"""
class KimNet(nn.Module):
"""
An implementation of the histone-mark based NN model from Ki... |
e2f318421153f18917346cecaa9bf2e1265a8467693a9190d9c9a1239d8fbd53 | Python | 5,769 | 165 | #!/usr/bin/env python3
"""
File: correlate_samples_with_avg_gene_expression.py
Created: 2021/11/15
Last Changed:
Author: M.Vochteloo
Copyright (C) 2020 University Medical Center Groningen.
A copy of the BSD 3-Clause "New" or "Revised" License can be found in the
LICENSE file in the root directory ... |
93ad4b08063e2f5c514a9cacdafc5d80ffba23486c7f9befa011097426f2a3cd | Python | 5,770 | 166 | """Tests for arena occupancy and for the per-point pathlengths of the midline ends."""
from __future__ import annotations
import numpy as np
import pandas as pd
import pytest
from larvaworld.lib import reg
from larvaworld.lib.process.dataset import LarvaDataset
NTICKS = 400
ARENA = 0.02 # 20 mm across, so a radius... |
fc3800784052117809cb465cb884ce5d87d2b1c37a0a40db7cdd2c93a10a0cfd | Python | 5,770 | 160 | import sys
sys.path.insert(1, '/u/home/r/ryo10244/Xiao_lab/dsRNA_pred/script/utils')
import re
import pysam
import argparse as ap
import pandas as pd
import numpy as np
from utils import *
import random
from os.path import exists
#import multiprocessing as mp
#from functools import partial
def main(args... |
f6b5a44e9802d243a6ddd24db7d8246c524c3e975ab00c9728b5fe1446d1be76 | Python | 5,772 | 108 |
#!/usr/bin/python3
import torch
from pathlib import Path
import numpy as np
import importlib
import argparse
from dataset import DatasetRBM
# This setting slightly improves performaces
torch.set_float32_matmul_precision("high")
# import command-line input arguments
def create_parser():
parser = argparse.Argumen... |
e19d30c927f1d348b77d239c9bb9dac6a271c6591dd3c72d6ca2d12881ca79ee | Python | 5,773 | 161 | import os
import subprocess
import pysam
from TestUtils import force_str
def build_pileup_with_samtoolsshell(fn):
os.system("samtools mpileup {} 2> /dev/null | wc -l > /dev/null".format(fn))
return 2998
def build_pileup_with_samtoolspipe(fn):
FNULL = open(os.devnull, 'w')
with subprocess.Popen(["sa... |
19170029e69d4ec9c7b75022be8d807c2865d931d4af6a715dda5abf1dcde5b7 | Python | 5,774 | 162 | import numpy as np
import h5py
from modular_splicing.dataset.additional_data import AdditionalData
from modular_splicing.dataset.h5_dataset import H5Dataset
class UnifiedAlternativeDataset(H5Dataset):
def __init__(self, *args, underlying_ordering, rewriters=(), **kwargs):
super().__init__(
*a... |
1e09b266c568ceba0212c59167ed2557cfeb07079b4b611cd82ef1aa4ee2a696 | Python | 5,774 | 120 | from __future__ import annotations
from datetime import timedelta
from pathlib import Path
import pytest
from pytest_celery import RabbitMQTestBroker
from celery import Celery, beat, uuid
@pytest.mark.filterwarnings(
'error::pytest.PytestUnhandledThreadExceptionWarning',
)
class test_beat_shutdown:
@pytest... |
15f1e532a19b5176cde36810824d03f4f71f3314d1a01d14c8e7e6c62bd4d4a9 | Python | 5,775 | 180 | """Smoke tests for the public fastlog API."""
from __future__ import annotations
import pytest
import torch
from torch import nn
import torchlens as tl
from torchlens.fastlog import RecordContext, RecorderStateError
class SimpleMlp(nn.Module):
"""Small MLP used by public API smoke tests."""
def __init__(s... |
e93c8811563a0130863f3082935ea242673b9d8df26361e03db350a3c9f0a196 | Python | 5,777 | 140 | """Read history rows back out of an offline wandb run's ``.wandb`` file.
wandb 0.30 ships no Python reader for its transaction log (the old
``wandb/sdk/internal/datastore.py`` went with the Go core), so the real-package
tracker tests parse it here, strictly. Layout, as wandb-core writes it:
* a 7-byte file header: ``... |
808ad32bb4ded10f76f7c0f5670be910dfc21ce13a0b71a3dc49a5c67430c260 | Python | 5,779 | 183 | #!/usr/bin/env python
#
# Copyright 2009, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... |
1dbe9fd09668b4c805d217b090b6634d00e1385680e6790679970b84d0333e2d | Python | 5,780 | 154 | """Census harness skeleton self-tests + a 2-rank p2p channel sim.
The census skeleton is a named C0 gate item ("census harness skeleton
landed"); criterion 1 must be runnable and falsifiable NOW so C2 inherits a
harness that cannot pass vacuously. The p2p spawn sim pins the 1.4 channel
model cross-rank: sender and rec... |
caaf0e85c41402eba6b5e33f932c96d3a43acce7bbf0c496ff551983f7781004 | Python | 5,781 | 149 | """FLIP-2 carrier: grad_fn-fire markers on the node-hook bracket (W2.0).
The backward join's carrier is an S-sized sink on ALREADY-SHIPPED code: the
per-fire timing prehook pushes a ``torchlens::gradfn::<object_id>:<pass>:
<call>`` marker at its start-stamp line, the posthook pops it at its
finish-stamp line, TorchLen... |
565fd026e04ad60a2c6499d64a14996cbbe18979e00c9546b88558a8c8c4b46f | Python | 5,782 | 140 | """Smoke test for acknowledgements sent during a prefork warm shutdown.
Regression coverage for https://github.com/celery/celery/issues/3802:
with ``task_acks_late`` the ack of a task that finishes while the pool is
being joined used to sit in the event loop's ready queue until
``hub.close()``, which only runs after t... |
5a544e67b15b26289e796a6166a7d19d1c19c0b7392d031bbc334506ee940c98 | Python | 5,782 | 188 | import networkx as nx
import numpy as np
import pandas as pd
from anndata import AnnData
from tqdm import tqdm
from .global_level import global_level
from .local_level import local_level
from .utils import lambda_dist, resistance_distance
def weight_optimizing_global(
adata: AnnData,
use_label: str = "leiden... |
bec0a07cfa09b583164449d1e2d06c7cf6f411dfab1d1d29a01afeef9944e7bb | Python | 5,782 | 164 | from __future__ import annotations
"""
Created on Thu Apr 21 2022
@author: Simon Delarue <sdelarue@enst.fr>
"""
from typing import Union, TYPE_CHECKING
import numpy as np
if TYPE_CHECKING:
from sknetwork.gnn.base import BaseGNN
class BaseOptimizer:
"""Base class for optimizers.
Parameters
--------... |
d1eca7922ca5de89d451173e36ba1426c084f0311662d783dfffa4897ff63467 | Python | 5,782 | 122 | import os
import sys
# Main entrance from https://github.com/MysteryVaibhav/RWR-GAE
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
# For replicating the experiments
SEED = 42
import argparse
import time
import numpy as np
import scipy.sparse as sp
import torch
np.random.seed(SEE... |
d5f23e9fda0f02d060b185f0e996b344bc6ef4df978f6d7132570562f3a23a72 | Python | 5,783 | 237 | # Copyright 2024 The Google Research Authors.
#
# 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 agre... |
64f34d9456aa05fa81c6ff07f79e52bb2b5d0a79837b165d479cb6f08d57fbe8 | Python | 5,784 | 153 | """Monodepth
Digging Into Self-Supervised Monocular Depth Estimation, ICCV 2019
https://arxiv.org/abs/1806.01260
"""
from mxnet.gluon import nn
from mxnet.context import cpu
from .resnet_encoder import ResnetEncoder
from .pose_decoder import PoseDecoder
class MonoDepth2PoseNet(nn.HybridBlock):
r"""Monodepth2
... |
a6ba2ffc98db5a59755f1d9ed6f9a26fccc9ce423d1349419768b0594973de22 | Python | 5,784 | 162 | # LICENSE
#
# _This file is Copyright 2018 by the Image Processing and Analysis Group (BioImage Suite Team). Dept. of Radiology & Biomedical Imaging, Yale School of Medicine._
#
# BioImage Suite Web is licensed under the Apache License, Version 2.0 (the "License");
#
# - you may not use this software except in compl... |
37204dc11fdba5a0039b3ef26058c92e5f0b9a28e038674a4e5533571f9e8645 | Python | 5,786 | 177 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Test classes and functions in tfep.nn.dynamics.egnn.
"""
# ===================================================... |
c16044b031ae0ed45a20484f7cecafc9847dd3c917c26c29dde36b8a6618502a | Python | 5,788 | 156 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import json
import sys
from multiprocessing import cpu_count
import absl.app
import progressbar
import tensorflow as tf
import tensorflow.compat.v1 as tfv1
from ds_ctcdecoder import ctc_beam_search_decoder... |
099746b36c629fa3a977fd86b5706cbfcaf3b2ed85f65b24b1c3414ddfb2bd17 | Python | 5,790 | 165 | """Retained-Op payload lifetime (last-owner tensor-payload eviction).
Pre-fix, ONE retained ``Op`` facade -- a two-word ``(_core, _row)`` view over
the shared sealed row store -- kept EVERY captured activation alive after its
Trace died and was garbage-collected, because the store holds all payload
cells and the facad... |
97e5014735aa8b01a9cf6cf90691d76b4b1b8b4ae92cf3d1accd3b811c4bfb77 | Python | 5,790 | 141 | #! /usr/bin/env python3
from src.read import *
from src.dataloader import *
from src.optimize import *
from src.density import *
from src.MODEL import *
from src.get_loss import *
from src.scheduler import *
from src.restart import *
from src.weight_scheduler import *
from src.checkpoint import *
from src.save_pes impo... |
726338af94e40e87b74661ee4c46155eeace4366176bccb283f25a736eeed48d | Python | 5,791 | 175 | import os
from os.path import basename
import numpy as np
import logging
import paddle
import paddle.distributed as dist
from paddle.distributed import fleet
###### sharding dependencies
from paddle.distributed.sharding import group_sharded_parallel, save_group_sharded_model
from paddle.fluid.dygraph.parallel import s... |
93baf402b3fdd33ebec8f18af7cf2b2184c3c625dbd5720a024d0f6cd99463af | Python | 5,792 | 141 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
import random
import shutil
from pathlib import Path
from ultralytics.data.utils import IMG_FORMATS, img2label_paths
from ultralytics.utils import DATASETS_DIR, LOGGER, TQDM
def split_classify_dataset(source_dir:... |
4684e99359d20f805ebef77716c90e0b342985231d9ae3ab66e642bb3d6d5b11 | Python | 5,794 | 127 | #!/usr/bin/env python
# coding: utf-8
"""
Source-level RSA using ROI's
----------------------------
In this example, we use anatomical labels as Regions Of Interest (ROIs). Rather than
using a searchlight, we compute RDMs for each ROI and then compute RSA with a single
model RDM.
The dataset will be the MNE-sample da... |
ea5623198eba36ff4b4cba3f995956ce1ea541e2e0dbfa7646b82ca18d6c0508 | Python | 5,795 | 143 | """
Gregory Way 2017
PanCancer Classifier
scripts/apply_weights.py
Usage: Run in command line with required command argument:
python apply_weights.py --classifier $summary_file
Where summary_file is a string. There are also optional arguments:
--copy_number store_true: supplement copy number to de... |
9851b098eefa9990aa0e6d5307a72d642426b0b801bb08a62b29b3168c14da0d | Python | 5,796 | 149 | #!/usr/bin/env python
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
#... |
6e60f7a2c49d4d0ebdae4e981eca56b0c06a58775c808df7e37bc5701cf40603 | Python | 5,797 | 117 |
'''Test tns.generate.diametrizer code'''
import os
from nose import tools as nt
import numpy as np
from numpy.testing import assert_array_almost_equal
from tns.generate import diametrizer
import morphio
from morphio import SectionType
_path = os.path.dirname(os.path.abspath(__file__))
NEU_PATH1 = os.path.join(_path, ... |
7eb994dba8648e8d5c21e6cab939ccba8cafa32517ec69afe338518b4656b9d7 | Python | 5,797 | 172 | # Copyright 2022 Deepfold 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 law or agreed to in writin... |
41ee5b2b3074614485fffcc8188994b629c5415eb028db61d7fff4dcabfeb09a | Python | 5,799 | 162 | """disarm() atomicity: no lifecycle entry point may mutate a RETIRED state.
``next_seq`` and ``resolve_group_identity`` used to snapshot the module-level
``_STATE`` BEFORE taking ``_LOCK``. A concurrent ``disarm()`` (which nulls
``_STATE`` under the lock) could then complete first, after which the stale
snapshot mutat... |
8c840c6fd709fc8ef127149eef87bc5f80d1145fc4ffeb23883c44bdc9268653 | Python | 5,799 | 205 | # Copyright (c) 2021 PaddlePaddle Authors. 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 app... |
d76bee7b2fef6176ac3ea4281286bfe2021c4e26aecbed8ed23a063a2bcfb388 | Python | 5,799 | 147 | import pkg_resources
from PyQt6 import uic, QtCore, QtWidgets
from . import dlg_edit_shape
class CollectShapeControls(QtWidgets.QWidget):
instances = []
color_changed = QtCore.pyqtSignal()
shape_changed = QtCore.pyqtSignal()
def __init__(self, *args, **kwargs):
super(CollectShapeControls, s... |
c6958b6afddec4bca18a1ecad9d2a24f269c07b1e1a8a3f9ffdf2fc4229387ef | Python | 5,800 | 215 | import argparse
from pathlib import Path
import torch
import logging
import numpy as np
from ase import data as ase_data
from ase import units as ase_units
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
import warnings
import pandas as pd
warnings.simplefilter(action="ignore", category=Futu... |
f600f8063ae8bb37e822238b26388cd287e7c60e9a54ee0c8321b75f6e3e8814 | Python | 5,800 | 210 | __author__ = 'quentin'
from collections import deque
import cv2
try:
CV_VERSION = int(cv2.__version__.split(".")[0])
except:
CV_VERSION = 2
import numpy as np
from ethoscope.core.variables import XPosVariable, YPosVariable, WidthVariable, HeightVariable, PhiVariable
from ethoscope.core.data_point import Dat... |
fd2eb29c11710604f9912be91b1445222c0e1f1e91e20381ee7aae86af78b0f6 | Python | 5,801 | 194 |
from enum import Enum
from bioseq2seq.utils.logging import logger
class PatienceEnum(Enum):
IMPROVING = 0
DECREASING = 1
STOPPED = 2
class Scorer(object):
def __init__(self, best_score, name):
self.best_score = best_score
self.name = name
def is_improving(self, stats):
... |
9a8bd4039d69c98dd43e234e882ad3519a20803359b6c94bcba671092bade9d1 | Python | 5,802 | 162 | # SPDX-License-Identifier: LGPL-2.1-or-later
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import os
import unittest
import numpy as np
from pyEcoHAB.utils import random_data_generation as rdg
from pyEcoHAB.utils import general as utils
from pyEcoHAB import data_path, Loader, Timeline
class TestPseudoLoader(unittest.... |
4bda93ba8776dcc2d9d30a2736e03fcd05705edf5771886fc64bbbbecd54fc14 | Python | 5,804 | 170 | import os
import sys
import time
import pickle
import brian2 as br
from brian2 import ms, mV, Hz, second
import numpy as np
br.prefs.devices.cpp_standalone.openmp_threads = 4
def big_sweep(connectivity, A_max):
print('Performing a sweep of the parameters, will take long')
cwd = os.getcwd()
if not os.path... |
12ed05bb5fad20c9b8918e5d2074c1f4a23bb78c8d7cc7989d25dd9c336060ce | Python | 5,805 | 158 | import collections
from typing import Dict, List, Optional, Union
import numpy as np
import pydantic
from hobj.learning_models import BinaryLearningModel
from hobj.types import ImageId
# %%
class GeneralizationSessionResult(pydantic.BaseModel):
transformation_to_kn: Dict[str, List[int]]
kcatch: int
ncat... |
4e3a96d495374c07b4fd11333eb74e5e914410f8a0e0220df52a752b222adaea | Python | 5,808 | 172 | from pathlib import Path
import json
import numpy as np
import matplotlib.pyplot as plt
plt.rcParams["figure.dpi"] = 300
from plot_params import get_plot_params
get_plot_params()
import basis_set_exchange as bse
from coeffnet.predata.matrices import TaskdocsToData
from instance_mongodb import instance_mongodb_s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.