sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
64bde50438f0718d4f79086008351c92c298153cc7e4433f882c7a374991ce2c | Python | 1,212 | 46 | from ChipseqReport import *
class MappingSummary(ChipseqTracker, SingleTableTrackerRows):
table = "view_mapping"
class BamSummary(ChipseqTracker, SingleTableTrackerRows):
table = "bam_stats"
class TrackerReadStats(Tracker):
def getFilename(self, track):
return os.path.join(DATADIR, track) + "... |
79415a16e8c012594c70a4745ea8754e36e6cf2871a707c5b1372cee9923ad1d | Python | 1,213 | 46 | """Compatibility wrapper for optional MLflow logging.
BERNN should be importable and testable even when MLflow or one of MLflow's
optional transitive dependencies is broken in the runtime environment. Modules
that only log to MLflow can import ``mlflow`` from here and safely call common
logging APIs; when MLflow is un... |
8f7cb1f1da0cc8a8dc2125069f8934eae4749c7a4da52bc766262e43075cf8db | Python | 1,213 | 39 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.chains.graph_qa.cypher import (
CYPHER_GENERATION_PROMPT,
INTERMEDIATE_STEPS_KEY,
GraphCypherQAChain,
construct_schema,
extract_cypher,
)
... |
cef57e4508459e6130d2e16ddd763f993773bc1390163b43b76acb1f53a2ea1a | Python | 1,214 | 40 | from tensorflow.keras import Model
from tensorflow.keras.layers import Dense
from typing import List
def remove_activation(model: Model, activations: List[str]):
prev = model.layers[-2].output
output = model.layers[-1]
if not isinstance(output, Dense):
return model
if output.activation.__nam... |
44dd4f0744fa90f60bd8fd4bd1e86219a2ec04548e7d1051d42398f01f5d277a | Python | 1,217 | 29 | import numpy as np
import scipy
from scipy import interpolate
import matplotlib.pyplot as plt
from scipy.signal import savgol_filter
for name in ['DLS1Hz','DLS2Hz','DLS5Hz','DMS1Hz','DMS2Hz','DMS5Hz','DMS2HzLTDpostpre','DMS2HzLTPpostpre']:
print('../Data/'+name+'.txt')
data = np.loadtxt('../Data/'+name+'.txt')... |
bfa5fb8a9dbfc5c668d44c08db64989c9a8fabb7ff6a149c912338a64eae996a | Python | 1,218 | 31 | # -*- coding: utf-8 -*-
####################################################################################
#
# STEPS - STochastic Engine for Pathway Simulation
# Copyright (C) 2007-2023 Okinawa Institute of Science and Technology, Japan.
# Copyright (C) 2003-2006 University of Antwerp, Belgium.
#
# S... |
5958ecb81dd6de8f91e262603c86a6b8c3b173ec5134ea5ea4d633d720a7cedb | Python | 1,219 | 37 | from typing import Any
from langchain_core.agents import AgentAction
from langchain_core.prompts.chat import ChatPromptTemplate
from typing_extensions import override
class AgentScratchPadChatPromptTemplate(ChatPromptTemplate):
"""Chat prompt template for the agent scratchpad."""
@classmethod
@override
... |
c9121a4d229610263cc079092c90e0f1509d35234b611bb068e72c789fa564cf | Python | 1,220 | 49 | from collections import OrderedDict
from neurovisfit.common.hash import make_hash
def test_make_hash_string():
result = make_hash("hello world")
assert isinstance(result, str)
assert len(result) == 32
def test_make_hash_ordered_dict():
ordered_dict1 = OrderedDict([("a", 5), ("b", 3), ("c", 4)])
... |
17dc82bba435b48a47250397c4ccf7d4b89fe56c8c0c2764fa7e628946958812 | Python | 1,222 | 40 | from django import forms
from django.forms import ModelForm
from django.core.exceptions import ValidationError
from .models import Trial
class Pl2KilosortForm(ModelForm):
trial_type = forms.CharField(
max_length=15,
widget=forms.Select(choices=Trial.TYPES),
required=True,
)
intens... |
6ded2c4221da8c0cd54a5552f89c5bb3e00f786e7fce0782c98a35caf84acd65 | Python | 1,222 | 45 | """Shared pydantic settings configuration."""
"""Implementation based on the template of ALIGNN."""
import json
from pathlib import Path
from typing import Union
import matplotlib.pyplot as plt
from pydantic import BaseSettings as PydanticBaseSettings
class BaseSettings(PydanticBaseSettings):
"""Add configuratio... |
502ab228cf4435fe12485128880580c4235eec543b654f3633a087e2eedd55de | Python | 1,224 | 31 | """analyze_electrophysiology_data URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, n... |
60832d407aabd4297e7b6ce74cd6af48e7eeda2d99331625c9afdbe5980efbf4 | Python | 1,224 | 51 | # SCFC modules
from ..forward import network_transfer as nt
from ..utils import functions
from ..brain import Brain
from ..read import data_reader as dr
from ..preprocess import permute as perm
from ..utils import path as path
from scipy.signal import lfilter, firls, decimate
# generic modules
import numpy as np
impor... |
dbd99b8f99a23a2120ca231508af504338e07a042d2b80743a53594a73285858 | Python | 1,224 | 50 | #!/usr/bin/env python
import re
import sys
cluster_file = sys.argv[1]
max_per_cluster = int(sys.argv[2])
# Get preferred ids for cluster representatives
preferred = set()
if len(sys.argv) == 4:
with open(sys.argv[3]) as FH:
preferred.update([_.strip() for _ in FH])
# Read in clusters
count = 0
i = 0
CLST... |
c9aa0948412e3672e081d0b255c1ff59c8eb4e21045b03a8000599e7a8ce3914 | Python | 1,225 | 45 | """Shared pydantic settings configuration."""
"""Implementation based on the template of Matformer."""
import json
from pathlib import Path
from typing import Union
import matplotlib.pyplot as plt
from pydantic import BaseSettings as PydanticBaseSettings
class BaseSettings(PydanticBaseSettings):
"""Add configura... |
bbda67753433f5508f7b45591d4f9187794ffa0c0cd5df310a42ef6839ae0b21 | Python | 1,226 | 41 | import cv2
import torch
import random
import numpy as np
def flip_horizontal(img, mask):
img = np.flip(img, axis=1)
mask = np.flip(mask, axis=1)
return img, mask
def rotate(img, mask, angle_abs=5):
h, w, _ = img.shape
angle = random.choice([angle_abs, -angle_abs])
M = cv2.getRotationMatrix2... |
9e18caeb222cc839b8fc8a7045fb38d47f0b1c10986e89667a7e5fc90764a5a5 | Python | 1,227 | 50 | import daisy
import neuroglancer
import numpy as np
import sys
import os
import configparser
from funlib.show.neuroglancer import add_layer, ScalePyramid
import configargparse
try:
from synister.synister_db import SynisterDB
branch = "master"
except ImportError:
from synister.synister_db import SynisterDb
... |
a29ea634c4e9096250ef0c88d3d93324e38b96ad5026663aeeb7a736cb21d5bf | Python | 1,229 | 36 | import os
import sys
import re
import types
import itertools
import matplotlib.pyplot as plt
import numpy
import numpy.ma
import Stats
import Histogram
import cpgReport
from cgatReport.Tracker import *
from cgatReport.odict import OrderedDict as odict
##################################################################... |
f7824887da0a695045e9612b17fd53e53bbec61acd1b97279779e02925f37032 | Python | 1,229 | 28 | from omicscope.General.Input import Input
class TestInput(object):
def test_Progenesis(self):
ctrlWT = Input('tests/data/proteins/progenesis.xls', Method='Progenesis')
ctrlNone = Input('tests/data/proteins/progenesis.xls', Method='Progenesis')
assert len(ctrlWT.Conditions) == len(ctrlNone.... |
275571139d0b80e25c8c463a1504d997f0a5a9b40cab2a654a836bbdf4b119a5 | Python | 1,230 | 41 | import json
import numpy
class CiliaAnalysisJsonEncoder(json.JSONEncoder):
"""json Encoder in the following hierarchy for serialization:
obj._to_dict()
dict(obj)
JsonEncoder.default(obj)
obj.__dict__
"""
def default(self, obj):
"""default encoder for that handles R... |
eea3d9bb84b73cf4575c9c1bf1b44b9104a1a60a88fe5b3439736b909ef6f857 | Python | 1,230 | 39 | """3D phase reconstruction with anisotropic yx pixel sizes.
This example exercises the dict form of ``yx_pixel_size`` for setups where
the y and x pixel sizes differ (e.g. DaXi, light-sheet rigs with asymmetric
binning). The scalar form (``yx_pixel_size=0.1``) is still accepted for
square pixels and routes to the same... |
2140b790b463281b8f012ffd3be7d59ac32fc5e1affb3b4b1e67b3c0647b771b | Python | 1,231 | 35 | clmns = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39"]
threads = len(clmns)
import pandas as pd
import sys,os
file_name = 'Cell'
idf =... |
5ff4c25343e6fdb2987d5f9a6a9223235c08631ebb281fad37ed2d912727c96d | Python | 1,231 | 42 | """Test _version.py."""
import sys
from collections import namedtuple
from pkg_resources import DistributionNotFound
from importlib import reload
import sdcflows
def test_version_scm0(monkeypatch):
"""Retrieve the version via setuptools_scm."""
class _version:
__version__ = "10.0.0"
monkeypatch.... |
212b676442ea9e90f494f47c633d236d2056218c725c343059d7cb26ac65b69f | Python | 1,233 | 29 | import requests, zipfile, io
from tqdm import tqdm
import logging
class downloader:
datafiles = ["https://figshare.com/ndownloader/files/3381290",
"https://figshare.com/ndownloader/files/3381293",
"https://figshare.com/ndownloader/files/3381296",
"https://figshare.com/ndownloade... |
739e0ed6dd10bf8cb03cecf4f56544438dcca9637522f0044495e9d02c21a70d | Python | 1,233 | 36 | import numpy as np
import imageio
from utils.utils import prctile_norm
import os
def DataLoader(images_path, data_path, gt_path,
batch_size, norm_flag):
batch_images_path = np.random.choice(images_path, size=batch_size, replace=False)
image_batch = []
gt_batch = []
for path in batch_... |
64e465ca574e2cb483a1d12bd807886f0392116d37aec0eec9be30013f4eaf3c | Python | 1,235 | 41 | ## Examine permutation based on female sample size
import re
import pandas as pd
from glob import iglob
def load_permutation():
df = pd.DataFrame()
for filename in iglob("../../_m/permutation_*"):
m = re.search("\d+", filename)
dt = pd.read_csv(filename, sep='\t', index_col=0)
deg = dt[... |
f76bea69643f4a0065adf13aaf66abd8b724d8d0111fb07e64e4d20f6e729f99 | Python | 1,235 | 34 | # from https://stackoverflow.com/questions/5081657/how-do-i-prevent-a-c-shared-library-to-print-on-stdout-in-python/17954769#17954769
import os
import sys
from contextlib import contextmanager
@contextmanager
def stdout_redirected(to=os.devnull):
'''
import os
with stdout_redirected(to=filename):
... |
c40a6ca1647ce2a300b8a50b60a4524a2d03035869cfc03a2ed12fc7e36f1cc0 | Python | 1,236 | 38 | from unittest import TestCase
import numpy as np
import torch
from chroma.models import graph_energy
class TestGraphHarmonicFeatures(TestCase):
def test_sample(self):
num_batch = 1
num_nodes = 10
num_neighbors = 8
dim_nodes = 128
dim_edges = 64
layer = graph_ener... |
64dae5a0a0b8657a157f0ef4ffea06b80e85c1646b10ca6c14a6a2d6467b69fe | Python | 1,237 | 38 | import torch
from omegaconf import DictConfig, OmegaConf
import hydra
import torch.multiprocessing as mp
from orbevo.model import Model
from orbevo.model_phase import Model_Phase
def run(rank, cfg, world_size, output_dir):
if cfg.pred_phase:
print('Phase model')
model = Model_Phase(cfg=cfg, rank=r... |
88de2070606a21e8f01254050f008a9cf65b23fab47321f8698a5d4508f98146 | Python | 1,238 | 44 | """**Load** module helps with serialization and deserialization."""
from typing import TYPE_CHECKING
from langchain_core._import_utils import import_attr
if TYPE_CHECKING:
from langchain_core.load.dump import dumpd, dumps
from langchain_core.load.load import InitValidator, loads
from langchain_core.load.... |
c6bc648c3403db7da38f9e5a3aa803cb668dfb68a2cf109119a97cbf59faf601 | Python | 1,238 | 50 | from langchain_classic import agents
EXPECTED_ALL = [
"Agent",
"AgentExecutor",
"AgentExecutorIterator",
"AgentOutputParser",
"AgentType",
"BaseMultiActionAgent",
"BaseSingleActionAgent",
"ConversationalAgent",
"ConversationalChatAgent",
"LLMSingleActionAgent",
"MRKLChain",
... |
d83d3228bb58fa0a9b542fcf1213aa5c6eb06d7f885f0fcb99d1476c0b8720ed | Python | 1,238 | 35 | ####################################################################################
#
# STEPS - STochastic Engine for Pathway Simulation
# Copyright (C) 2007-2026 Okinawa Institute of Science and Technology, Japan.
# Copyright (C) 2003-2006 University of Antwerp, Belgium.
#
# See the file AUTHORS for detai... |
5e7da968ff6cef131dea3474061df266c166e7a46a98a66223dea55ccc714d62 | Python | 1,239 | 38 | from typing import Tuple
import numpy as np
import torch
from neuralpredictors.training import device_state
from torch.utils.data import DataLoader
from neurovisfit.models.model import Model
def get_model_predictions_and_targets(
model: Model,
dataloader: DataLoader,
data_key: str,
device: str = "cp... |
c08ab3c09bc29fcf583388bb631cb3dc09a4774c0bb3e7bbe860ca70551d5c34 | Python | 1,239 | 38 | from typing import Any
def _resolve_schema_references(schema: Any, definitions: dict[str, Any]) -> Any:
"""Resolve the $ref keys in a JSON schema object using the provided definitions."""
if isinstance(schema, list):
for i, item in enumerate(schema):
schema[i] = _resolve_schema_references(... |
d6e0c65c9a95a7f2479309b28d712ffd002994e05774ef1ed7a5be563a8540f3 | Python | 1,239 | 35 | import cv2
import numpy as np
class MaskProcessor:
"""MaskProcessor is a class for processing binary masks.
It provides methods for smoothing, and artifact removal of masks.
"""
@staticmethod
def smooth_mask(
mask: np.ndarray,
) -> np.ndarray:
min_dim = min(mask.shape)
... |
195318a5fcb1c83a30a6c3fa996461b25cc5baebccfec479e50e28d32176fca8 | Python | 1,240 | 36 | """
Copied and adapted from PyTorch Geometric: https://github.com/pyg-team/pytorch_geometric/blob/master/torch_geometric/utils/_lexsort.py
"""
import torch
from typing import List
def lexsort(
keys: List[torch.Tensor],
dim: int = -1,
descending: bool = False,
) -> torch.Tensor:
r"""Performs an indire... |
6a7fe722f5b3226c773bc39a4d2f318dc6a0bdd9ec80262f93295f0009a48009 | Python | 1,240 | 39 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.chains.graph_qa.neptune_cypher import (
INTERMEDIATE_STEPS_KEY,
NeptuneOpenCypherQAChain,
extract_cypher,
trim_query,
use_simple_prompt,
)... |
8437b0c0e097412c17cdab4f8ae218b599789e3701824029c58a2bde9a1335dd | Python | 1,240 | 52 | import numpy as np
def range_to_string(a, b):
"""
Provides a string with all integers in between two numbers.
Parameters
----------
a : int
First number.
b : int
Last number.
Returns
-------
string : str
String containing all int nu... |
61bece4d8b4323d6a077076cc9aab3701e0070c89aa700c146e8483fbfe06beb | Python | 1,241 | 25 | import mne
import os.path as op
from config_FaceName import MEG_data_path,group_name,Ids,MRI_data_path,bids_root
from mne_bids import BIDSPath
for subject_id in Ids:
subject = group_name+"%02d" % subject_id
print("processing subject: %s" % subject)
fname=op.join(MEG_data_path,subject,'fname'+... |
8ef5cb81abce33d458709325514c5ad9c2330d8035af335ddaf11290d2fbf404 | Python | 1,244 | 37 | import numpy as np
import tensorflow as tf
from tensorflow.keras import layers
from dipgnn.models.layers.envelope import Envelope
class BesselBasisLayer(layers.Layer):
"""
This code is extracted from dimenet (https://github.com/gasteigerjo/dimenet).
"""
def __init__(
self,
num_radial,
... |
0bd2bea667316b9c1dedb6c5d1011f5ee29bf25d7639dd1f9a5e3c962fa48275 | Python | 1,246 | 39 | ####################################################################################
#
# STEPS - STochastic Engine for Pathway Simulation
# Copyright (C) 2007-2026 Okinawa Institute of Science and Technology, Japan.
# Copyright (C) 2003-2006 University of Antwerp, Belgium.
#
# See the file AUTHORS for detai... |
4284edcb7ee8e2aec4088d916e947c8381ac453ba8a31d4c5e467818a4c661d4 | Python | 1,246 | 38 | """
This script is used to generate the supplementary data for
the sex differences manuscript. Specifically, it labels
and combines functional enrichment analysis for stringent
male-specific analysis separated by direction of effect.
"""
import pandas as pd
def tissue_map(tissue):
return {"caudate": "Caudate", "dl... |
4541119a20fca75c082add827eb118f1112867ec1aaaf6d8a9dbf11bed3c060f | Python | 1,246 | 63 | '''nofarm.py - stand-in for ``farm.py``
====================================
Purpose
-------
This script is a stand-in for :doc:`farm`. Instead of splitting the
input and running jobs on the cluster, the command is executed as is.
This script accepts all the options of ``farm.py``, but ignores most
of them. This is... |
ad8d59979ee46d96689f6b91afc46ae3e1710f17bc85ba6453ef26160f817010 | Python | 1,246 | 40 | from pathlib import Path
import io
from src.models.results import PredictionResult
from get_predictions import get_csv_writer, write_csv_results
def test_write_csv_results():
mock_pdb_path = Path("mock.pdb")
chain_id = 'mock_id'
expected_sequence_md5 = 'mock_md5'
expected_chopping_str = '189-237,238-... |
2502c89ef3346d246f02f2d7576e7e302d4f81a1a9c621df749512636f442954 | Python | 1,247 | 38 | ####################################################################################
#
# STEPS - STochastic Engine for Pathway Simulation
# Copyright (C) 2007-2026 Okinawa Institute of Science and Technology, Japan.
# Copyright (C) 2003-2006 University of Antwerp, Belgium.
#
# See the file AUTHORS for detai... |
7eae0573480ca936a2686023c3bdea8f13eceb78f4e1c85f9a5d49a80f487e07 | Python | 1,247 | 33 | ##################################################################################
# DNN gene expression autoencoder pathways network 4
##################################################################################
##################################################################################
from tensorflow.k... |
bf90774981fbdd57ca25e06657c439413dab33ba07d57965c1b5d6ea7bfcb54d | Python | 1,248 | 54 | # builtin modules
import os
import subprocess
# pnabind modules
from pnabind.utils import moveFile
from .mesh import Mesh
def runEDTSurf(pdbfile, file_prefix='mesh', basedir='.', clean=True, quiet=True, mesh_kwargs={}, **kwargs):
# run EDTSurf and generate .PLY file
edtsurf_args = {
"-t": "2",
... |
1cf20a2fef9772f85f7ed91e60b0747ebaf838500a3705c51506b128b42c952d | Python | 1,249 | 33 | from napari_svetlana import ExampleQWidget, example_magic_widget
import numpy as np
# make_napari_viewer is a pytest fixture that returns a napari viewer object
# capsys is a pytest fixture that captures stdout and stderr output streams
def test_example_q_widget(make_napari_viewer, capsys):
# make viewer and add a... |
ff3b1c6c18051cdb7bae15aedd5c5bd293eeb838ce8bba3f44893163dfd66e7f | Python | 1,250 | 42 | import pytest
# pytest framework
import imagingplus as pli
from imagingplus.main.core import Experiment
# test passing
# @pytest.mark.skip
from imagingplus.utils.io import import_obj
def test_Experiment(experiment_fixture):
expobj = Experiment(**experiment_fixture)
print(expobj)
@pytest.mark.skip
def te... |
328f84e1296b34e8da017e287c72800e537c2427f265888f06da66c524e37581 | Python | 1,251 | 43 | import codecs
import os
import time
from setuptools import find_packages, setup
with open("requirements.txt", "r") as req_file:
requirements = [line.split("#")[0].strip() for line in req_file]
requirements = [line for line in requirements if line]
def read(rel_path):
here = os.path.abspath(os.path.dirna... |
cf061a8d0ddce81c2a46b65fd3519d78ec63c2f865a7a425a2f15626e5b32490 | Python | 1,251 | 47 | """File Management Tools."""
from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.tools import (
CopyFileTool,
DeleteFileTool,
FileSearchTool,
ListDirectoryTool,
MoveFileTool,
ReadFileTo... |
abfdde60438e9124c2fc65b91c94e1bbf4035c5b8915c94b5b51071a202130d5 | Python | 1,252 | 31 | import argparse
arg_parser = argparse.ArgumentParser()
arg_parser.add_argument("data_files", help="list of .npz files")
arg_parser.add_argument("sequence_info", help="information about structures to determine label")
arg_parser.add_argument("label_values", help="JSON file to map binding function to label values")
arg_p... |
b60e0f5e7c8de77365e952ea54be9b516f1ba398f8960c84e774f42236383035 | Python | 1,252 | 37 | #! /usr/local/bin/python
#'#################################################################################
#'#################################################################################
#' Reshape hdf5 data to add channel dimension
#'##############################################################################... |
1f9c4139e890e6c962d28d9f149844704c684d6598aa99c03d678fabc797e1d1 | Python | 1,253 | 37 | """Shared configuration for runnable unit tests."""
import os
from collections.abc import Iterator
import pytest
from langsmith.utils import get_env_var
@pytest.fixture(scope="session", autouse=True)
def _disable_local_langsmith_tracing() -> Iterator[None]:
"""Keep runnable unit tests independent of developer L... |
c3aaa032f056c4ad002a1cf88385a428d8bbce1f523f6bc3ad1ff79dd2ebf838 | Python | 1,253 | 56 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import numpy as np
# from __future__ import division, print_function
desciption = """
Print scan custom name from Bruker acqp file
"""
# TODO:
# check that the pattern finding didnt fail
def _build_args_parser():
p = argparse.ArgumentParser(descri... |
d4370b9fc3188b815d045ad772499dbf20148d22b542eca9e18cf466c866b020 | Python | 1,253 | 34 | # Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master... |
72ac5ad6cf5a4a9ac6e825f66e7b109dbed84a10ad19c5fb9b770cac045cec7f | Python | 1,254 | 35 | ####################################################################################
#
# STEPS - STochastic Engine for Pathway Simulation
# Copyright (C) 2007-2026 Okinawa Institute of Science and Technology, Japan.
# Copyright (C) 2003-2006 University of Antwerp, Belgium.
#
# See the file AUTHORS for detai... |
8768307ba075acd83efdeea52568b73f0dc7b9cb044175afeda4394719ff2db7 | Python | 1,254 | 39 | """Check Imports Script.
Quickly verify that a list of Python files can be loaded by the Python interpreter
without raising any errors. Ran before running more expensive tests. Useful in
Makefiles.
If loading a file fails, the script prints the problematic filename and the detailed
error traceback.
"""
import random... |
cca027da1db4b55797ce8a805ee81664de6d397fc70c612234fcaecc9c9b55fc | Python | 1,254 | 35 | ####################################################################################
#
# STEPS - STochastic Engine for Pathway Simulation
# Copyright (C) 2007-2023 Okinawa Institute of Science and Technology, Japan.
# Copyright (C) 2003-2006 University of Antwerp, Belgium.
#
# See the file AUTHORS for d... |
d5b6e07367719942b5b1a547c9b144dcb8fbf91d8cc4d119159f852225ed9168 | Python | 1,254 | 40 | """A tracer that collects all nested runs in a list."""
from typing import Any
from uuid import UUID
from langchain_core.tracers._compat import run_copy
from langchain_core.tracers.base import BaseTracer
from langchain_core.tracers.schemas import Run
class RunCollectorCallbackHandler(BaseTracer):
"""Tracer that... |
5f54c87ea45bc73c1e7e16adcc1661b2bf94ca03df995d2b456d4408a42e4902 | Python | 1,255 | 40 | import numpy as np
from dival import TaskTable
from dival.measure import PSNR, SSIM
from dliplib.utils import Params
from dliplib.utils.helper import select_hyper_best_parameters, load_standard_dataset
from dliplib.reconstructors import TVAdamReconstructor
from dliplib.utils.reports import save_results_table
# load... |
c61729ef594ed118f52b329ce2ae49b4f9912f4cfeb0802c706b12ffc2112cd8 | Python | 1,255 | 31 | from typing import Any
from typing import Dict
from typing import Optional
from ..common.module import dynamic_import
from ..common.module import split_module_name
from ..data.loaders import get_dataloaders
from .model import Model
from .params import get_params_from_config
from .params import SessionsDataLoaderSettin... |
3e760ca04d7fcba2098c7694167bdd45cb62c5b51db1d37ad2f3a5bde8490789 | Python | 1,256 | 35 | import os
import argparse
from runner import Runner
parser = argparse.ArgumentParser()
parser.add_argument('--result_path', type=str, default='result/', help='The directory for storing training outputs')
parser.add_argument('--dataset', type=str, default='perov_5', help='Dataset name, must be perov_5, carbon_24, or mp... |
62fe161a0bf878147ca02cd186d7c022db711e88a11014159a9cfcc81cb9f5f5 | Python | 1,256 | 46 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import numpy as np
import os
DESCRIPTION = 'Create Fake Eddy Index and Acqp Files'
def buildArgsParser():
p = argparse.ArgumentParser(description=DESCRIPTION)
p.add_argument('--folder', dest='folder', action='store', type=str,
... |
086675bc22fd0da034a1d42c5f2f2ff936d14f3bce1aa06f73efa8495d6c197b | Python | 1,257 | 34 | import re
from langchain_core.agents import AgentAction, AgentFinish
from langchain_core.exceptions import OutputParserException
from typing_extensions import override
from langchain_classic.agents.agent import AgentOutputParser
class ReActOutputParser(AgentOutputParser):
"""Output parser for the ReAct agent.""... |
6b67d6e0e05f2263bdd0547bae308764aa5f68829142ff2de82fa1911d1483ec | Python | 1,260 | 46 | # For this you need matlab and the new requirements.txt
import argparse
import matlab
import matlab.engine
import numpy as np
import scipy.io
from oset.ecg.peak_detection.peak_det_modified_pan_tompkins import (
peak_det_modified_pan_tompkins,
)
import unit_test as testing
mat = scipy.io.loadmat("../../../dataset... |
d23404e29a3ba78f9b30996534391353627e6e2be26ca86db944999851aa2522 | Python | 1,260 | 49 | import copy
import json
import subprocess
import torch
import logging
LOG = logging.getLogger(__name__)
def load_json(jsonfile):
with open(jsonfile, "r") as jf:
res = json.load(jf)
return res
def save_config(config, filepath):
with open(filepath, "w") as outfile:
json.dump(config, o... |
e1c45e4bb7843e72abef9393d08d062499a2298edf95d967f2faf39d083d6639 | Python | 1,261 | 34 | import pandas as pd
import sys
df = pd.read_csv('inweb_pairwise_gene_interactions.tsv', sep='\t')
print(df.shape)
rev_df = df[['gene_right', 'gene_left', 'source']]
rev_df.columns = ['gene_left', 'gene_right', 'source']
full_df = pd.concat([df, rev_df], axis=0)
full_df.reset_index(drop=True, inplace=True)
print(full... |
341a49950c6eb0c4b961ef5b7a5a7ad227db946236bdc4c9a0f652a8170bf6ae | Python | 1,262 | 39 | from setuptools import setup, find_packages
import sys, os
version = '1.1.6'
setup(name='langid',
version=version,
description="langid.py is a standalone Language Identification (LangID) tool.",
long_description="""\
""",
classifiers=[
'Programming Language :: Python :: 2',
... |
6dfc44393635a545e6ea2ed721552c4cd9c23e831e4a77f4939d22abc3c2bc2a | Python | 1,262 | 31 | # This module is used to obtain the absolute position of the product, pocket sequence, and pocket
import os
from get_protein import get_pro_seq
def get_poc_seq(pocket_path, protein_path):
aa_codes = {
'ALA':'A', 'CYS':'C', 'ASP':'D', 'GLU':'E',
'PHE':'F', 'GLY':'G', 'HIS':'H', 'LYS':'K',
... |
9c2d4467a64d9aae5f6461b783cd546e72b24e91c68a5cbf39880a59400de121 | Python | 1,262 | 39 | ####################################################################################
#
# STEPS - STochastic Engine for Pathway Simulation
# Copyright (C) 2007-2023 Okinawa Institute of Science and Technology, Japan.
# Copyright (C) 2003-2006 University of Antwerp, Belgium.
#
# See the file AUTHORS for d... |
de0d1427d74d2926aaa70eecea5e0738e6816b2bafe9c1b498dee9224acdd5d1 | Python | 1,262 | 42 | #!/usr/bin/env python
import sys
from setuptools import setup, find_packages
from setuptools.command.test import test
class PyTest(test, object):
user_options = [('pytest-args=', 'a', "Arguments to pass to pytest")]
def initialize_options(self):
super(PyTest, self).initialize_options()
self.... |
32ae2b72b031b37b1e2af1db47e6c28b648fffda0efb8bbec562f166235bad79 | Python | 1,263 | 38 | ####################################################################################
#
# STEPS - STochastic Engine for Pathway Simulation
# Copyright (C) 2007-2023 Okinawa Institute of Science and Technology, Japan.
# Copyright (C) 2003-2006 University of Antwerp, Belgium.
#
# See the file AUTHORS for d... |
34ac1c3f412cf04c38d4ff0789ae9e1372275924c44cd98c47d1e35b85fbe3c2 | Python | 1,264 | 31 | import pandas as pd
import argparse
from transform import PlierTransform
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('weight_file', help="weight info from Z loading")
parser.add_argument('lambda_file', help="The file with lambda")
parser.add_argument('expression_f... |
6f91a358cb52bd2fcb2e298cca8a762a9c19595a926ecb772aee73faac210368 | Python | 1,264 | 43 | # -*- coding: utf-8 -*-
import numpy as np
from matfile_creator import create_mat_file
# --- Settings ---
start_time = 55 # seconds
# Signal 1
fs1 = 10000 # Sampling frequency [Hz]
f1 = 0.01 # Signal frequency [Hz]
duration1 = 100 # seconds
t1 = start_time + np.arange(0, duration1, 1/fs1) # timestamps
signal... |
ae487269f878dd9125d16a3f6b77c4613baf7e32cd66ff910f5a853534ce5d76 | Python | 1,264 | 34 | import torch
class PolynomialEnvelope(torch.nn.Module):
"""
1. Polynomial envelope function that ensures a smooth cutoff.
2. Reference: https://github.com/facebookresearch/fairchem/blob/518d0ea12110548bd5ffaf9a43060b8eae152e13/src/fairchem/core/models/esen/nn/radial.py#L22
"""
de... |
d25e03009c294283cebdc496f3062de17e8257d3a3b505074a42130ee6558f97 | Python | 1,264 | 37 | """This package contains various functions and scripts that can be useful to the general user for building, training,
and analysing models from `MotorNet`.
"""
from . import plotor
from . import net_utils
class Alias:
"""
Object to create a transparent alias for attributes.
Modified from a solution propo... |
ff61ac7ec73f5d4a359c3181528b4ed511427ea486bd365bd564e16494ea62b3 | Python | 1,264 | 36 | import scrublet as scr
import scipy.io
import matplotlib.pyplot as plt
import numpy as np
import os
import sys
plt.rcParams['font.family'] = 'sans-serif'
plt.rcParams['font.sans-serif'] = 'Arial'
plt.rc('font', size=14)
plt.rcParams['pdf.fonttype'] = 42
args = sys.argv
input_dir_prefix = args[1]
input_dir_suffix = a... |
860415235c4d81df68f26368c130582a2e7b701b2963368cd2a30c5e511a32d7 | Python | 1,265 | 43 | # -*- coding: utf-8 -*-
"""
Created on Sun Apr 24 22:31:34 2022
@author: yw_ji
"""
gene_id "ENSG00000137968";
gene_version "12";
transcript_id "ENST00000370859";
transcript_version "3";
exon_number "10";
gene_name "SLC44A5";
gene_source "ensembl_havana";
gene_biotype "protein_c... |
bb4179bb9e44b385839c0e54094d3e94bd43a3fc7e1a30cde97122b07783ce19 | Python | 1,265 | 41 | import morgana.DatasetTools
import morgana.GUIs
import morgana.ImageTools
import morgana.MLModel
# import orgseg.DatasetTools.io
# import orgseg.DatasetTools.arrangefluodata
# import orgseg.DatasetTools.arrangemorphodata
# import orgseg.DatasetTools.fluorescence.computefluorescence
# import orgseg.DatasetTools.fluore... |
6a60d501aae4ff1a905379ce2f7a659b1905ed6558791453077f0f35cc86accf | Python | 1,266 | 48 | # For this you need matlab and the new requirements.txt
import argparse
import matlab
import matlab.engine
import scipy.io
from oset.generic.baseline_sliding_window.baseline_sliding_window import (
baseline_sliding_window,
)
import unit_test as testing
mat = scipy.io.loadmat("../../../datasets/sample-data/Sample... |
3afabd4029fdf046a3fc74ed8ad60b1ad2dff7ddb9904a32011b3d3ada4c09f4 | Python | 1,267 | 41 | """Azure Cognitive Services Tools."""
from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.tools import (
AzureCogsFormRecognizerTool,
AzureCogsImageAnalysisTool,
AzureCogsSpeech2TextTool,
AzureCogsText... |
5ef548f4660b684d90b2d8879f8affbd899a61465586a0fc4aa3ce33a5c99add | Python | 1,267 | 44 | from sklearn.model_selection import StratifiedKFold
from sklearn.decomposition import PCA
from sklearn.svm import SVC
from util.util import metric_eval, load_data
import xgboost as xgb
# 获取数据的维度
num_people = 137 # 数据中的人数
num_features = 137 # 特征数量
feature_dim = 116 # 特征形状
num_folds = 5
n_components = 20... |
2cd1704dc94aacd1855231277b05221972cd83235a0468369557bff9acc97228 | Python | 1,268 | 41 | import sys
import torch
import argparse
# Additional Scripts
from train import TrainTestPipe
from inference import SegInference
def main_pipeline(parser):
device = 'cpu:0'
if torch.cuda.is_available():
device = 'cuda:0'
if parser.mode == 'train':
ttp = TrainTestPipe(train_path=parser.tra... |
424ce6ebfa5cc5f93963b33c64d3e85d8de47496442569e3754650679395f2b2 | Python | 1,268 | 51 | import os
import nrrd
import argparse
import skimage.io
import numpy as np
from regions_ABA import brain_regions
parser = argparse.ArgumentParser()
parser.add_argument('-i', type=str, required=True, help="cell volume per voxel, nrrd")
parser.add_argument('-r', type=str, required=True, help="aligned region labels, nr... |
68cc2315f7b7e84d94767ec28b0cd282b8ca7f31e0cffb3fd1e52989a5ee0026 | Python | 1,268 | 41 | import numpy as np
from dival import TaskTable
from dival.measure import PSNR, SSIM
from dliplib.utils import Params
from dliplib.utils.helper import select_hyper_best_parameters
from dliplib.utils.helper import load_standard_dataset
from dliplib.reconstructors import TVAdamReconstructor
from dliplib.utils.reports im... |
6d52b025072d1501b7ae5356d0284ec3f20600fa4c845e9837d3c6e39bdd5142 | Python | 1,269 | 22 | import random
import argparse
import yaml
from compute_gradients import DataParameters
from tqdm import trange
from config.paths import FRAMES_PER_JOBS_PATH_TEMPLATE
parser = argparse.ArgumentParser()
parser.add_argument("--frames_per_split", type=int, default=5, help="Number of frames on which the gradients were eval... |
1a354aef4b5e900a1f1225dcf50f5ecbc5a4eaa31535533195fac26877fcc679 | Python | 1,270 | 47 | # For this you need matlab and the new requirements.txt
import argparse
import matlab
import matlab.engine
import scipy.io
from oset.ecg.peak_detection.peak_det_simple import peak_det_simple
import unit_test as testing
mat = scipy.io.loadmat("../../../datasets/sample-data/SampleECG1.mat")["data"][0]
f = 1
fs = 1000
... |
202daf6cfc3b3320007185281214f4d0fd8989c45e79a3b9e88fbbe09eaf4087 | Python | 1,270 | 52 | # -*- coding: utf-8 -*-
# @author: Xingyan Liu
from .utils import (
load_hidden_states,
save_hidden_states,
load_example_data
)
from .utils import base
from .utils.base import (
save_pickle,
load_pickle,
save_json_dict,
load_json_dict,
check_dirs,
... |
5a3246b400cf004b2d5d408df895d4543f2d0c51d03a502a9decda5c894336a7 | Python | 1,270 | 35 | ####################################################################################
#
# STEPS - STochastic Engine for Pathway Simulation
# Copyright (C) 2007-2023 Okinawa Institute of Science and Technology, Japan.
# Copyright (C) 2003-2006 University of Antwerp, Belgium.
#
# See the file AUTHORS for d... |
0282523f71961176f797af3347758801062a9fd5bbe7b4e4e17d061c9c7943a2 | Python | 1,271 | 41 | from setuptools import setup, find_packages
with open('README.md') as readme_file:
readme = readme_file.read()
exec(open('enrichm/version.py').read()) # loads __version__
setup(
name='enrichm',
version=__version__,
author='Joel Boyd, Ben Woodcroft, Alexander Baker',
author_email='joel.boyd@uqcon... |
0cbe876de461479056724d7fa014f4900f79af7c0496c07a81298d3e4519f0e4 | Python | 1,271 | 41 | from unittest.mock import patch
import pytest
from ptrnets import zoo
from ptrnets.utils.config import get_config_file
from ptrnets.utils.config import load_state_dict_from_model_name
from ptrnets.utils.config import TomlConfig
@pytest.fixture
def config_file_path():
return "config.toml"
@pytest.fixture
def m... |
8c877b85cfeb98a2a1b286b0b03d7240b4ddbbc5b782eacb33aea46eeef43a99 | Python | 1,271 | 34 | # Copyright 2022 DeepMind Technologies Limited.
#
# 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... |
5ec108f0bae376edbbb6500cb4cfc798b35cb585e81808d274abd0ebe02404db | Python | 1,273 | 38 | ####################################################################################
#
# STEPS - STochastic Engine for Pathway Simulation
# Copyright (C) 2007-2026 Okinawa Institute of Science and Technology, Japan.
# Copyright (C) 2003-2006 University of Antwerp, Belgium.
#
# See the file AUTHORS for detai... |
283f40ad1a5f55c71bd5fca4dadd505aaac1bf575fca4fd983d7ee4adf81ccb4 | Python | 1,276 | 53 | """Code to help indexing data into a vectorstore.
This package contains helper logic to help deal with indexing data into
a `VectorStore` while avoiding duplicated content and over-writing content
if it's unchanged.
"""
from typing import TYPE_CHECKING
from langchain_core._import_utils import import_attr
if TYPE_CH... |
944afab84cf76c3e6f25f73e6f1a2673acde76460d0ca51c20a919f4031856bc | Python | 1,276 | 49 | import numpy as np
def getCOM(residue, hydrogens=True):
com = np.zeros(3)
count = 0.0
for atom in residue:
if atom.element == 'H' and not hydrogens:
continue
com += atom.get_coord()
count += 1.0
return com/count
def getResidueDistance(res1, res2, atm1=None, atm2=Non... |
39da2b2bbf2e6b858b2bc5653453fc4feb271e09b1d09dafaddaaeecae3678e5 | Python | 1,278 | 41 | """Test BaseNetwork functionality."""
import pytest
from vulcanai.models.basenetwork import BaseNetwork
import torch
class TestBaseNetwork:
"""Define BaseNetwork test class."""
@pytest.fixture
def basenet(self):
"""Create a test BaseNetwork."""
return BaseNetwork(
name='Test_... |
2114302f833a9d08a5f88eb2b9a22f22bc64d990ffb6e63a7dda2576033b692a | Python | 1,279 | 36 | """Check that no dependencies allow prereleases unless we're releasing a prerelease."""
import sys
import tomllib
if __name__ == "__main__":
# Get the TOML file path from the command line argument
toml_file = sys.argv[1]
with open(toml_file, "rb") as file:
toml_data = tomllib.load(file)
# S... |
312fdb4df455f6007e1b98024bca0cb763da8791130d338936729081ee3d7096 | Python | 1,279 | 43 | from processing.constants import ALL_ACTION_LIST, device
import numpy as np
import torch
from joblib import load
'''
This function takes the input data, which is a nested dictionary and turns it into a list.
'''
def subs_to_list(data, subs, trials, ft):
sc = load(f'D:\Few-Shot Proto TL\processing\Data\sca... |
6c935066da576ac52950bac28e0aa13a57f951ffe56ca0ead206f0f8b9a56dd1 | Python | 1,280 | 48 | # -- coding: utf-8 --
# @Time : 2022/12/14 13:30
# @Author : Biao Zhang
# @Email : littlebiao@outlook.com
# @File : test_input_data.py
import pickle
import numpy as np
if __name__ == '__main__':
'''
edges_path = './dataset/acm/edges.pkl'
file = open(edges_path, 'rb')
load_data = pickle.load(file)
p... |
9159a97a12b3a8fe93961d5f8e5f58a3f10839d02a00dac50e37e469e3d047d0 | Python | 1,280 | 28 | """pyDeepMapper (revised, contracts-first).
DeepMapper analyses high-dimensional tabular data by mapping each feature to a pixel
of a small pseudo-image, classifying with a **swappable** backbone (CNN / ViT /
autoencoder), and **iterating N seeded arrangements then accumulating** per-feature
findings into robust, stab... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.