sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
c193e08201b5c28b37f639e20f350a5e723ed10f248827b63dfcd155b7e1cb61
Python
5,410
130
import numpy as np import sys sys.path.append('/home3/ebrahim2/beyond-brainscore/analyze_results/figures_code') from trained_untrained_results_funcs import find_best_layer, loop_through_datasets import itertools from matplotlib import pyplot as plt def stack_combinations(input_dict, exclude_pairs=None, merge_sizes=No...
15b8825ca023939e4cb5a1d98a6acce8c9ed4b06df063ffc14765e90d45472d5
Python
5,413
121
import os import shutil from time import sleep import logging import platform import traceback import requests import zipfile import pytest from PySide6.QtCore import Qt from gui.RaidionicsMainWindow import RaidionicsMainWindow from gui.UtilsWidgets.CustomQDialog.ImportDataQDialog import ImportDataQDialog from utils....
f3a02f107c55e240071ec936115aeafd26147308cd96c9ad205e909fa378eee6
Python
5,413
155
""" # File : datasets.py # Time : 2025/10/23 10:17 # Author : Hongmiao Wang # version : python 3.10 # Description: """ import typing as T import numpy as np import torch from Model.datasets.ProcessingFormula import generate_formula from torch.utils.data.dataset import Dataset def collater(tokens, p...
2b6b247b08c64d9be5e243726ca244fe8e361854f1717583e3e49af4ed560d03
Python
5,419
157
from py2neo import Node, Subgraph, Relationship, UniquenessError from py2neo.cypher import cypher_join from alchemiscale.storage.cypher import ( unwind_create_nodes_query, unwind_merge_nodes_query, unwind_merge_relationships_query, ) from neo4j import Transaction # overrides for py2neo comparison and se...
72d83bf72032e3e738f897c5945c7c9bc85e5146a4eda61e209f4db798050d0c
Python
5,424
189
#!/usr/bin/env python3 import numpy as np from glob import glob import pandas as pd import os.path from tqdm import tqdm, trange import sys from collections import defaultdict from scipy.spatial.transform import Rotation from .common import make_process_fun, get_data_length, natural_keys # project v onto u def proj...
1df9226145b85a9ab49f09186406df41fb33ea149a88eecf33118cfdb52f38c7
Python
5,426
159
# -*- coding: utf-8 -*- """ Generates cortical flatmap for anterograde injections, retrograde injections, and swc soma locations. Used for Fig 3d and Fig 4a. Uses ccf_streamlines package, documented at https://ccf-streamlines.readthedocs.io/en/latest/ """ import json,os import numpy as np import matplotlib.pyplot as p...
021e0560a3df95cebbd2b16fa12e011bf077d7d6bec7c322ad64cc4465e759d4
Python
5,429
152
import logging from collections import defaultdict from multiqc.base_module import BaseMultiqcModule from multiqc.plots import linegraph, table from multiqc.plots.linegraph import LinePlotConfig from multiqc.plots.table_object import TableConfig log = logging.getLogger(__name__) class DragenGcMetrics(BaseMultiqcMod...
5195af7499c335964ed968280304226cc0baf57e951ecea16bc3ac858e11d662
Python
5,430
107
import sys import os import glob import re import gzip import click import loompy import numpy as np import random import string import csv from collections import defaultdict import logging from typing import * import velocyto as vcy from ._run import _run # logging.basicConfig(stream=sys.stdout, format='%(asctime)s ...
8c5347094047aa058cc1a02dcfaa71fe793134ebb377038a76f0313e59f2604d
Python
5,439
132
import pytest # Test models from skimpy.core import * from skimpy.mechanisms import * import numpy as np def build_linear_GEEK_pathway_model(): metabolites = ['A', 'B', 'C', 'D' ] # Build linear Pathway model UniUniGEEK = make_generalized_elementary_kinetics([-1,1], metabolites) metabolites_1 = UniUn...
e944dabdf094d8cb83c579512a2d7a8d65818ba74ec395c8ce548cea2b4ca479
Python
5,442
139
from __future__ import annotations import logging import random from dataclasses import dataclass from logging import getLogger as get_logger from typing import Any from hydra.utils import instantiate from lightning import Callback, Trainer, seed_everything from beyond_backprop.algorithms import Algorithm from beyon...
34ec008e8a8dbe74998bd3c4c03e0ff5e0b916c2045c4949642b16ac81692964
Python
5,448
156
# Copyright 2022 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
1ec064b0bfe5eff73697c2902e461fd47e8de2b85b3b5ae966118d58f0c0f437
Python
5,450
137
# -*- coding: utf-8 -*- """ .. module:: skimpy :platform: Unix, Windows :synopsis: Simple Kinetic Models in Python .. moduleauthor:: SKiMPy team [---------] Copyright 2017 Laboratory of Computational Systems Biotechnology (LCSB), Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland Licensed under the ...
7c549cad3ef2e91436d2c0d93c08cd8bc27dc9a498208f1a9cd8457153b655f6
Python
5,450
186
import time import datajoint as dj from ethopy.core.experiment import ExperimentClass, State from ethopy.core.logger import experiment @experiment.schema class Condition(dj.Manual): class Navigate(dj.Part): definition = """ # Navigation experiment conditions -> Condition --- ...
a1b63f8e1fd64a791a6271751f448446ff8f9e8238887e7e34ae36e4cd237a1f
Python
5,453
148
"""Tests for the seqkit stats module""" import pytest from multiqc.modules.seqkit.stats import parse_stats_report # Sample seqkit stats output with all columns (--all --tabular) SAMPLE_STATS_ALL = """file format type num_seqs sum_len min_len avg_len max_len Q1 Q2 Q3 sum_gap N50 N50_num Q20(%) Q30(%) AvgQual GC(%) s...
82f19abdfafb2be4d4deb66610c5bd7af51175969411a18bd80927b59bdbfbc2
Python
5,458
140
# -*- coding: utf-8 -*- """ .. module:: skimpy :platform: Unix, Windows :synopsis: Simple Kinetic Models in Python .. moduleauthor:: SKiMPy team [---------] Copyright 2017 Laboratory of Computational Systems Biotechnology (LCSB), Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland Licensed under the ...
f5ce233c97c356641be860be45ce1eca9dc63b05470f0fbe6be78975926df493
Python
5,458
181
"""Test data creation utilities for unit tests.""" import shutil import tempfile from pathlib import Path from typing import Any, Optional import anndata as ad import numpy as np import pandas as pd def create_sample_anndata( n_cells: int = 100, n_genes: int = 50, add_age: bool = True, add_batch: bool = False )...
c6c90b19ad7912c3613cf3a621470a4bb0aa8da440b56c4614d3cd4638f3f545
Python
5,463
192
# -*- encoding: utf-8 -*- # # Copyright 2016–2021 Julien Danjou # Copyright 2016 Joshua Harlow # Copyright 2013-2014 Ray Holder # # 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....
d29d924740212f35a657b2b44e2bd508104a198e6ae4841327c94af3b901283b
Python
5,464
160
#!/usr/bin/env python # coding: utf-8 #------------------------------ # Import the needed libraries #------------------------------ import argparse import csv import logging import os import subprocess import pandas as pd logging.basicConfig(level=logging.INFO, format='%(asctime)s : %(levelname...
4f2f49a513b8c2a16a3fd7c725cea024f0f66dd4170a7ec1cce1b92d8b3f153d
Python
5,467
170
""" Query Preprocessing Agent for Intelligent Ontology Routing This agent analyzes queries and routes them to appropriate ontologies with refined keywords, acting as a smart preprocessing layer before the existing search_terms function. """ from typing import List, Dict, Tuple from pydantic_ai import Agent QUERY_PR...
84388832a6083a76457f85ffd10cdc96c86cb3374842f68e3b04880d0731a2ec
Python
5,468
170
from sys import argv if len(argv) != 3: print(f"Please pass the run id and embedding dimension, e.g. python {argv[0]} 1 10") exit() id = argv[1] embeddings_dim = argv[2] import os from glob import glob from pathlib import Path import pickle import numpy as np import pandas as pd import matplotlib.pyplot as p...
1aa1b7605898e9a1d58020f4793897ae61649da9af664f4dbc16cac22386faf8
Python
5,469
144
import logging import re from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound from multiqc.plots import bargraph log = logging.getLogger(__name__) VERSION_REGEX = r"# BUSCO version is: ([\d\.]+)" class MultiqcModule(BaseMultiqcModule): """ The module parses the `short_summary_[samplename...
5952866a40e88676a9a571def59d3a41ac642de408ff24f8c1ab9d9780b27867
Python
5,470
165
import gc import urllib.request import torch from torchvision.io import read_image import torch.nn.functional as F import torchvision.transforms.v2.functional as TF import torchvision.transforms.v2 as v2 import pytest from seg import all_models, dice_loss, f1_score ALL_MODELS = list(all_models()) augment = v2.Compo...
9d0639c5f2ae995f5a3a87e7f0eeea09c23d50e2e182f2ab32f5df4d9ffadcce
Python
5,470
134
'''Plot the training data. Adjust the file as necessary (see comments in file)''' import matplotlib.pyplot as plt import os import sys sys.path.append("../") import utils.tools as ut import re import numpy as np import random plt.rcParams.update({'font.size': 20}) parametermat = [] errormat = [] averagekernel = 10000 ...
14ce212b5176e93f2857f53b62efa3b34e7cf39fbb55469fc50d0f3cebc0e437
Python
5,471
146
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Script of evaluate the individual parcellation results Created on 18/10/2024 at 4:22 PM Author: Caro Nettekoven """ import numpy as np import TaskRest.paths as indiv_paths import numpy as np import matplotlib.pyplot as plt import pandas as pd import covariance as cov ...
8b794aa25b7a04d99ad334928e4bdf114204825243894fc8cc08b6e71a2f7113
Python
5,471
163
#!/usr/bin/env python3 import numpy as np from glob import glob import pandas as pd import os.path import cv2 from tqdm import tqdm, trange from collections import defaultdict from scipy import signal import queue import threading from aniposelib.cameras import CameraGroup from .common import make_process_fun, get_n...
684b81762144efed7e0aaba91985154600fcafe8cc3bc1832f2a047de6b31303
Python
5,472
163
""" viz/pareto.py — Fig 5-6: Efficiency-Performance Pareto Frontier ================================================================ """ from __future__ import annotations from pathlib import Path from typing import Dict, Optional import numpy as np from .mdpi_style import ( FS_SMALL, MDPI_DPI, MDPI_WID...
53d42a46f852d67383d12c63290727b84974b2b6a2013077c977dd31376cfe17
Python
5,474
140
""" U-Net++ Architecture for Medical Image Segmentation Implementation for MS3SEG Dataset Reference: Zhou et al., "UNet++: A Nested U-Net Architecture for Medical Image Segmentation" Deep Learning in Medical Image Analysis, 2018 """ import tensorflow as tf from tensorflow.keras.layers import ( Input, Conv2D, MaxP...
6d3e4c8f360e39ef5e996ad2741116e0dbe4b2db19b1a27bdc663c34b47aed15
Python
5,474
154
import pytest import json import pathlib from openfe.storage.metadatastore import ( JSONMetadataStore, PerFileJSONMetadataStore ) from gufe.storage.externalresource import FileStorage from gufe.storage.externalresource.base import Metadata from gufe.storage.errors import ( MissingExternalResourceError, Changed...
4da792abb69d5e04a01840302091fbde876ebebfece99263692dd4548f14cf1b
Python
5,476
144
from typing import * import numpy as np import velocyto as vcy def jump_next_3p_exon(feature: vcy.Feature) -> vcy.Feature: """Jump to the next exon following transcription direction instead of chromosome coordinate Arguments --------- feature: vcy.Feature An exonic feature Returns --...
4c11022607a38f52742ea1a74c0445d2eb98e187c25b886cb6f3123c867238ac
Python
5,487
201
""" This script contains the code for control analysis 7, which creates a correlation matrix between the different features. In this script, a "naive correlation" approach is used, i.e. Pearson's r is computed between the features across the whole stimulus set. @author: Alexander Lenders """ import numpy as np import...
81da9371fb64aa9a9ce895283c0b9fbbf3f7688589a02ae0fa6bd0bce466b631
Python
5,489
67
import subprocess, os, sys # input_list = [ # "/scratch/tweber/DATA/MC_DATA/STOCKS_DEV/2023-06-23-HGFLGAFX7/IMR90E6E7PD103s1p2x01/cell_selection/labels_raw.tsv", # "/scratch/tweber/DATA/MC_DATA/STOCKS_DEV/2023-06-23-HGFLGAFX7/IMR90E6E7PD106s1p3x01/cell_selection/labels_raw.tsv", # "/scratch/tweber/DATA/MC_...
55b6defe9a2d3bea47423306445e53453a895035a126376ca83d85c148da3805
Python
5,492
176
"""Script to get initial PDBs for benchmark targets.""" from pathlib import Path import requests rcsb_url = "https://files.rcsb.org/view/" def get_rcsb_file(pdb_id, pdb_path, model=None): if pdb_path.exists(): return with open(pdb_path, "w") as pdb_file: # Get PDB text from RCSB website ...
9e0bae14fcb15968646a2f91472ca93f90a2144e9eb6fa25936a007b1a83d932
Python
5,492
152
# script to retrieve eye data from csv file # copies eye data from saved location to BIDS folder # loads eye data, cleans and downsamples and saves with the suffix _cleaned # ============================================================================= import seaborn as sns import matplotlib.pyplot as plt import n...
8d67d6e26ed414f4c772fb7404d73a1180bd6c93158abf356977ca2811367566
Python
5,493
153
import logging import re from collections import defaultdict from multiqc.base_module import BaseMultiqcModule from multiqc.modules.qualimap.QM_BamQC import coverage_histogram_helptext, genome_fraction_helptext from multiqc.plots import linegraph # Initialise the logger log = logging.getLogger(__name__) class Drage...
695b917f9b7792d5f13ff769fb877071c5993badf95632cd252f4b9403487a6e
Python
5,501
138
# -*- coding: utf-8 -*- """ .. module:: skimpy :platform: Unix, Windows :synopsis: Simple Kinetic Models in Python .. moduleauthor:: SKiMPy team [---------] Copyright 2020 Laboratory of Computational Systems Biotechnology (LCSB), Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland Licensed under the ...
8ca81d40573ab8b1e0102e17be967d261116de266f632411c0f64579af5a9b02
Python
5,501
164
import numpy as np from scipy import interp import matplotlib.pyplot as plt from sklearn.metrics import precision_recall_curve, roc_curve, auc __all__ = ['graph_single_roc', 'graph_single_prc', 'graph_mean_roc', 'graph_mean_prc', 'graph_roc_boilerplate', 'graph_prc_boilerplate'] def graph_single_roc(y, ...
c5f1167c9548d49721da24ea295cc6ec0f8b1824ef1fad893e3bb187c24fb00a
Python
5,502
147
import os import numpy as np import nrrd from scipy.spatial.transform import Rotation import matplotlib.pyplot as plt from slicer_utils import GridSystem, SliceAnalyzer, Slicer from sklearn.decomposition import PCA from itertools import chain # Storing the plane normal as constant (same slicing plane as Lam and Sherma...
6b301c5d6650c808c6b3e0b4da8e45b1c7b1b2a006214bdb16c9242644de684b
Python
5,504
156
import glm import trimesh import numpy as np # Utility function to convert morphologies to Trimesh objects in order to plot them with nemsi def convert_to_mesh(morphology): branches = morphology.segments verts_list = [] faces_list = [] verts_cols = [] for i, branch in enumerate(branches): ...
1dd01a552169bad2adee3f5908bb05abdc114c6625709bcc6a3218fe3545adab
Python
5,507
137
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe import pathlib import pytest from openff.units import unit as offunit import openfe from openfe.protocols.openmm_afe import AbsoluteBindingProtocol from openfe.protocols.openmm_utils.charge...
b4dbac1190ab3f431fe88082590cdd282a3f8dd4a992e8f1d8ec9a75e7874899
Python
5,507
158
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = "Vrushali Fangal" __copyright__ = "Copyright 2014" __credits__ = [ "Maxwell Brown", "Brian Haas" ] __license__ = "MIT" __maintainer__ = "Vrushali Fangal" __email__ = "vrushali@broadinstitute.org" __status__ = "Development" ####################################...
f0e97b141daa80749e1a2f29926323ad988c5e24b3ce0d7ad1f8059cc074276f
Python
5,509
103
import os import torch import random import nilearn import numpy as np from scipy import io from PIL import Image from tqdm import tqdm import torch.utils.data as data import matplotlib.pyplot as plt from cn_clip.clip import load_from_name, image_transform if __name__ == '__main__': script_root = '/pu...
fb144bd14d46d5d480c0dbfe30a448336b68af1cdcfc0e00afeae8309a29c96e
Python
5,510
168
import unittest import tempfile import os import six import caffe class SimpleLayer(caffe.Layer): """A layer that just multiplies by ten""" def setup(self, bottom, top): pass def reshape(self, bottom, top): top[0].reshape(*bottom[0].data.shape) def forward(self, bottom, top): ...
1c1dcdeda863a3fcb13aeb6c24ab829a05c9d935eaacd7e8f641ef60fdc65770
Python
5,511
156
# -*- coding: utf-8 -*- """ .. module:: skimpy :platform: Unix, Windows :synopsis: Simple Kinetic Models in Python .. moduleauthor:: SKiMPy team [---------] Copyright 2020 Laboratory of Computational Systems Biotechnology (LCSB), Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland Licensed under the ...
45cdd763f87deace63fa0eceba523357768a04efeab76274b58a45dc4dd90afb
Python
5,514
150
""" metrics.py Contains computational functions for evaluating BCI task performance, including: - Regression analyses (linear, polynomial) - Correlation analyses (Spearman) - p-value calculation and aggregation """ from collections import defaultdict import numpy as np from scipy.stats import combine_pvalues from s...
1ac476441234ad65dff9b93bb19b43e5572ca6658c91dfa83ea0d6c195dfb0bc
Python
5,517
130
from transformers import BartForConditionalGeneration import torch from Model.BART.base import BaseModel import math import torch.nn as nn class BartEmbeddingLayer(nn.Module): def __init__(self, config, embed_tokens: nn.Embedding = None): super(BartEmbeddingLayer, self).__init__() embed_dim = config...
8ca6f262f90e02771f25db47b3c302152cd58bfe33af40304c8c2b88ed32142e
Python
5,517
140
import glob import logging import os.path from pathlib import Path from typing import Dict, List, Tuple from multiqc.core.exceptions import RunError, NoAnalysisFound from multiqc import config, report logger = logging.getLogger(__name__) def file_search(): """ Search log files and set up the list of modules...
a311452b1829c1fe79f0f7645a32fe151feeaa3515d4a4ebdcfec4953b473461
Python
5,518
169
# !/usr/bin/env python # -*-coding:utf-8 -*- # @Time : 2023/04/25 14:59 # @Author : Liangdi.Ma import numpy as np import io import os import time from collections import defaultdict, deque import datetime import torch import torch.distributed as dist from utils.link import is_dist_avail_and_initialized ...
03df4c3b6f254a246a38112e68f478fbbd8f7212b90ba50c9aa4e50931241e31
Python
5,520
131
import numpy as np from scipy.cluster import hierarchy from scipy.spatial import distance import pandas as pd from .plotting import compute_nw_linkage from anndata import AnnData def splitClusters(data, k, mn_key="MetaNeighborUS", save_uns=True): """Split Clusters using Hierarchical Clustering This function...
9747ab1eff9c3aca0f9f32c28318ffec421f9f4131547e06541bce6946b36436
Python
5,521
133
import logging import re from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound from multiqc.plots import bargraph log = logging.getLogger(__name__) VERSION_REGEX = r"Flexbar - flexible barcode and adapter removal, version ([\d\.]+)" class MultiqcModule(BaseMultiqcModule): def __init__(self): ...
6ebc0b5c6c3f99d0ad4857d268c1edf569826a352438bafc6c7e62b0ef9f726f
Python
5,526
152
# cio.py # Input-output functions for connectivity model import Functional_Fusion.atlas_map as am import nibabel as nb import numpy as np import warnings import deepdish as dd import json def load_model(fname): """ Loads model from a combination of a .h5 file and a .json file. Args: fname (str): File...
a5a0484164561f73b0e92da3b64ab337f6a84ee055035c4ad09970f290bd8d22
Python
5,526
129
# -*- coding: utf-8 -*- """ .. module:: skimpy :platform: Unix, Windows :synopsis: Simple Kinetic Models in Python .. moduleauthor:: SKiMPy team [---------] Copyright 2017 Laboratory of Computational Systems Biotechnology (LCSB), Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland Licensed under the ...
73f2f703af6442dd0f626612c62e48ddc76cdb74f25ef0dcf8a0873596b82f61
Python
5,528
132
'''Plot the training data. Adjust the file as necessary (see comments in file)''' import matplotlib.pyplot as plt import os import sys sys.path.append("../") import utils.tools as ut import re import numpy as np import random plt.rcParams.update({'font.size': 20}) parametermat = [] errormat = [] averagekernel = 10000 ...
2aff34742b3c9a3160dfedafd78edb9141238b34ce605dbbb488e4be2279afb6
Python
5,529
144
'''""""""""""""""""""""""""""""""""""""""""""""""""""""""" This module gathers data from _overall_mean_cov.csv files. It relies on the following official source: Overall Mean Coverage Report, page 196. https://emea.support.illumina.com/content/dam/illumina-support/documents/documentation/software_documentation/dragen-b...
2dd0598521f5e0f9d8e5a83f8f1b517a949aaac612361dfad2566316b2308281
Python
5,532
173
"""Heartbeat monitor for the AVITI watcher. Run from cron every ~15 min. Reads the heartbeat file written by watcher.py on every poll iteration; if the heartbeat is older than --threshold-hours (default 3h) and no alert email has been sent today, emails the recipient via the system `mail` command (same mechanism the p...
9be05aafdfb9caa883ddfb18c3535d84d112e42574e644b313f43c7797332b18
Python
5,539
109
import logging from typing import Dict, Union from multiqc import config, report from multiqc.core.file_search import include_or_exclude_modules from multiqc.types import Anchor, ModuleId, SectionId logger = logging.getLogger(__name__) def order_modules_and_sections(): """ Finalise modules and sections: pla...
9cf894d735efeb0f7b553cd81520e24be2996743af2747b7f0d744233fd6ec43
Python
5,540
147
"""MultiQC submodule to parse output from Picard TargetedPcrMetrics""" import logging from typing import Dict from multiqc import config from multiqc.modules.picard import util from multiqc.plots import bargraph # Initialise the logger log = logging.getLogger(__name__) def parse_reports(module): """Find Picard...
7f66d82d5188c3b16b61a55503ac8f7933c16c93c3aada9fb2f152e4754015fb
Python
5,545
139
import torch # type: ignore import numpy as np import seaborn as sns # type: ignore from shap.plots import colors # type: ignore import matplotlib.pyplot as plt from matplotlib.colors import TwoSlopeNorm # ============= Own modules ============= import sys sys.path.append('../../Utils') from preprocessing import KDiv...
6bf42acc9436dfdf7b0d66f3996d3b3719cb6ddec4fa61f5f49c5b7f29e064f4
Python
5,546
122
"""Yield by input read pairs from `simplex-metrics` / `duplex-metrics` (fgbio CollectDuplexSeqMetrics plots #4a/#4b).""" from typing import Dict, Optional, Set from multiqc.base_module import BaseMultiqcModule from multiqc.plots import linegraph from .schemas import DuplexYieldMetric, SimplexYieldMetric from .util i...
331a5ea618669402215125d622f90c2d6ecab6876b52905b513812cbcb77ae4e
Python
5,547
171
import binascii import math import struct import sys import pytest from shapely import geos_version, wkt from shapely.geometry import Point from shapely.tests.legacy.conftest import shapely20_todo from shapely.wkb import dump, dumps, load, loads @pytest.fixture(scope="module") def some_point(): return Point(1.2...
85a079275e5a87018330beff200189f8b5ea6e5e17cf98dc730627cec0e0b7f5
Python
5,551
172
from __future__ import annotations from dataclasses import field from logging import getLogger as get_logger from typing import Iterable, Sequence, TypeVar, Union import rich import rich.syntax import rich.tree import torch from omegaconf import DictConfig, OmegaConf from torch import Tensor, nn from torch.nn.paramet...
a3ed1bd369ccdf00de179bcd94b071a03d85784da8fe4d877636500e160335d0
Python
5,557
180
"""Graph embedding generation: Node2Vec + LINE (optional). Node2Vec uses networkx + node2vec + gensim with workers=1 to avoid joblib semaphore leaks in long-running processes (Optuna, multi-round sweeps). LINE requires an external binary — this module provides I/O helpers. """ import networkx as nx import numpy as np...
a3a0f5f2723d75da8845b05c5ec2008bbe0bdd3c9b92981df7255ba724cf236d
Python
5,558
166
""" Copright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Atika Syeda. """ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Network ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ import numpy as np import torch import torch.nn as nn import torch.nn.functional as F class FMnet(nn.Module): def __ini...
f113423400fc00ee676969cb2578cc44cf22c25cf1f5836f79951c7c462df5b8
Python
5,559
144
"""Tests for MULTIQC_* environment variable config handling.""" import os import pytest from multiqc import config class TestEnvVarsConfig: """Tests for _env_vars_config() parsing MULTIQC_* environment variables.""" def test_bool_true(self, monkeypatch): monkeypatch.setenv("MULTIQC_FORCE", "true")...
ba94e38f0e2b28215edea5feeb7dfef669506665c670db14f0857b65df5726f1
Python
5,561
152
""" Tools for the AmiGO agent. """ from typing import List, Dict from pydantic_ai import RunContext, ModelRetry from aurelian.agents.amigo.amigo_config import AmiGODependencies, normalize_pmid from aurelian.agents.uniprot.uniprot_tools import normalize_uniprot_id from aurelian.utils.data_utils import obj_to_dict fro...
ee28dedc5589ad6507fcbc764141630fffc2df9b10e096c21e2aff65eddb31ac
Python
5,561
170
# Copyright 2022 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
904c9531fc0f281ada61e69f0d5bb6f62642091b735e690d09bcaf962446c53b
Python
5,562
165
import os import yaml import logging import numpy as np import pandas as pd from pathlib import Path from typing import List def keypoints_by_group(keypoints): kp_by_group = {} for kp in keypoints: for group in kp["groups"]: if group in kp_by_group: kp_by_group[group].append...
07c56d6b25735fa0c3a68416c29710772e051916d31e4258eaa63d1d00b833f1
Python
5,563
152
""" UNETR (UNEt TRansformers) Architecture Simplified implementation for MS3SEG Dataset Reference: Hatamizadeh et al., "UNETR: Transformers for 3D Medical Image Segmentation" IEEE WACV, 2022 Note: This is a 2D adaptation. For full 3D implementation, refer to MONAI library. """ import tensorflow as tf from tensorflow...
22288b60bc7dc39fa6db8b9b5ddb43457a13d7802d80f03e0a453ae95baef6b7
Python
5,563
177
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe """ Reusable utility methods to validate input systems to OpenMM-based alchemical Protocols. """ from typing import Optional, Tuple from openff.toolkit import Molecule as OFFMol from gufe imp...
53076de869c8b906323e3a8acf3b722ada444fb80e31aa5eb31816852e003a61
Python
5,563
124
###################### Libraries ###################### # Deep Learning import tensorflow as tf import keras from keras.models import Model, load_model from keras.layers import Input, Conv2D, MaxPooling2D, Conv2DTranspose, concatenate from keras import backend as K from tensorflow.keras import layers, optimizers...
147722e73a0ba2beaa8c0e1be73233237f6b855bad9c8f0e4ea6818a0725e11b
Python
5,564
114
import numpy as np import copy from expts.session import Session as S from hardware.cameras import default_cam_params, cam1_params from conditions import default_condition, conditions from settings.manipulations import default_manipulation from settings.durations import default_stim_phase_duration, default_delay_phase_...
5f6729d32d1893d73544d71d66de6603f2075445bd847d61673cef242fd686d5
Python
5,564
163
# -*- coding: utf-8 -*- """ .. module:: skimpy :platform: Unix, Windows :synopsis: Simple Kinetic Models in Python .. moduleauthor:: SKiMPy team [---------] Copyright 2017 Laboratory of Computational Systems Biotechnology (LCSB), Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland Licensed under the ...
07ddfe3b1d1fa55f1794b22d038a2eb6d2469efe2177284308ebae0bd1168e7f
Python
5,566
158
"""Common fixtures for ethopy tests. This module provides fixtures that can be used across multiple test files to ensure consistent test setup and resource management. All tests should use these fixtures to prevent database connections, provide consistent mock objects, and avoid thread hangs. """ import os import sy...
2c092ac1e4ed0fade0a6a189e54b17583e3af3116b49c36a7db630fba978da7e
Python
5,566
188
#!/usr/bin/env python # -*- coding: utf-8 -*- # # aicsimageio documentation build configuration file, created by # sphinx-quickstart on Fri Jun 9 13:47:02 2017. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this #...
f63e288cf6420e820d91e4ee017011ae0717bf4d270ee803596661c44a3f6c30
Python
5,566
130
"""`dedup --metrics` (one row per library plus `All Reads`) and `dedup --duplication-ladder`.""" import logging from typing import Dict, Optional, Set from multiqc.base_module import BaseMultiqcModule from multiqc.plots import bargraph, linegraph from .schemas import DeduplicationMetric, DuplicationLadderMetric from...
54db7e8ddde1fa1926f95eb97670b07082895c52e2bb2ceea2d6becb4c6a3aad
Python
5,574
189
""" Tools for the RAG agent for retrieval-augmented generation. """ import asyncio from typing import Dict, List from pydantic_ai import RunContext, ModelRetry from aurelian.utils.data_utils import flatten from aurelian.utils.pubmed_utils import get_pmid_text from aurelian.utils.search_utils import web_search, retrie...
d711ef0b9184af7d6faec18807576506fd1a9d1368676580db65e5e9992b0237
Python
5,584
162
# -*- coding: utf-8 -*- """ .. module:: skimpy :platform: Unix, Windows :synopsis: Simple Kinetic Models in Python .. moduleauthor:: SKiMPy team [---------] Copyright 2017 Laboratory of Computational Systems Biotechnology (LCSB), Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland Licensed under the ...
62fc91076216fc3881d9a725b5f098583906b382dba493dde0afef72fb2447d5
Python
5,586
140
import argparse import cv2 from functools import partial import numpy as np import os import time from feabas.concurrent import submit_to_workers from feabas import common, dal, config, storage from feabas.mesh import Mesh import feabas.constant as const from feabas.renderer import MeshRenderer Nthreads = config.get_...
21c4041c2649bdd7ca7220029971822addfd628836fd0d9740a307a2303fda98
Python
5,589
174
"""Generate and work with PEP 425 Compatibility Tags. """ import re from typing import TYPE_CHECKING, List, Optional, Tuple from pip._vendor.packaging.tags import ( Tag, compatible_tags, cpython_tags, generic_tags, interpreter_name, interpreter_version, mac_platforms, ) if TYPE_CHECKING: ...
007a40b72a9c4c16b56b844016f3b7bbe3cafffa49fa6369ddb22cf52d1f3f3a
Python
5,596
160
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe from itertools import groupby import numpy as np from openfe import ProteinComponent from openff.interchange import Interchange from openff.toolkit import Molecule, Topology from openmm imp...
1307063e40c34f014ca62d8f04a84fb965f660130f732ecec755857169e8b9ac
Python
5,598
162
import logging import shutil import sys import textwrap import xmlrpc.client from collections import OrderedDict from optparse import Values from typing import TYPE_CHECKING, Dict, List, Optional from pip._vendor.packaging.version import parse as parse_version from pip._internal.cli.base_command import Command from p...
802cf901d5c14cd73b0a961f26a31ca8332c9b7e02f347af94368bfe70bb936a
Python
5,598
160
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe from itertools import groupby import numpy as np from openfe import ProteinComponent from openff.interchange import Interchange from openff.toolkit import Molecule, Topology from openmm imp...
a29f5d44927589f019d7b0bc5a1c7f28f8ee452d68f24a61c14ad1eb17a629b2
Python
5,599
147
from collections import Counter import matplotlib.pyplot as plt import networkx as nx import numpy as np import pyro import pyro.distributions as dist from pyro.infer import SVI, Trace_ELBO from pyro.optim import ClippedAdam, Adam from pyro.poutine import trace from sklearn.decomposition import PCA from sklearn.metrics...
234cd56e93541696424ec80bef4a14fed8b51abd59ffffdfa5dc84fe8ce3c039
Python
5,602
160
import numpy as np from scipy.stats import norm import deepdish as dd def findcols(X): # X is a dictionary with elements ir and jc # returns a list of arrays of locations of nonzero entries in each column cols = [None] * (len(X['jc'])-1) for i in range(len(cols)): cols[i] = X['ir'][X['jc'][i]:X...
37f8ed3e9cb6e683def25cf54c93159087b06d671a536556af85179feaf8dd0e
Python
5,603
132
"""Aggregate first-level fMRI GLM results. Apply a brain mask, remove any scanner effects, and save the resulting regression coefficients and their Cohen's d's at the level of the whole brain and in networks and regions of interest. """ import sys import warnings from ast import literal_eval from os import system ...
1d2f7d6bb01cd661599ca1a6a8f85396d47c162c9813f035aa433cefc6c9c010
Python
5,612
167
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe import pytest from numpy.testing import assert_allclose from openff.interchange import Interchange from openff.interchange.components._packmol import solvate_topology from openff.toolkit imp...
e2dd13e064edc05a9067f520aedd0316c78ee7452851920ca5d2f011c60638ae
Python
5,612
160
"""Comprehensive unit tests for evaluation modules.""" import os import tempfile from pathlib import Path from unittest.mock import MagicMock, call, patch import matplotlib.pyplot as plt import numpy as np import pandas as pd import pytest from timeflies.evaluation.interpreter import Interpreter from timeflies.evalu...
917f21816c24360132614c26bffa12669d22b97ef2f0f21923ec105f518af737
Python
5,621
145
# -*- coding: utf-8 -*- """ .. module:: skimpy :platform: Unix, Windows :synopsis: Simple Kinetic Models in Python .. moduleauthor:: SKiMPy team [---------] Copyright 2017 Laboratory of Computational Systems Biotechnology (LCSB), Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland Licensed under the ...
d322dee079df050bb28641e6095f34fce231222540c79f649f34cc7a5a65c7cd
Python
5,625
173
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe import json import gufe import numpy as np import openfe import pytest from openff.units import unit as offunit from pontibus.protocols.relative import HybridTopProtocolResult class TestS...
d9c86c87916ed3e294e531c44540d7845a5c8600a995451f2dbafd8f97025f83
Python
5,627
150
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe """Equilibrium Relative Free Energy methods using OpenMM and OpenMMTools in a Perses-like manner. This module implements the necessary methodology toolking to run calculate a ligand relative ...
ebf35fe7e8a7b4739b73ab1f4d19e23f93996421f526f95b9bc6b60f91f95eae
Python
5,628
159
""" This script creates random graphs for bunch of seeds. Then it finds the motor modules as described and calculates the adjacency matrices for each random graph. """ from pathlib import Path import itertools import pickle import copy import numpy as np import pandas as pd import networkx as nx from tqdm import tqdm...
50f7e0f808bf92b7857dc9946cf4da70714a09fe9b606595036dacca1f4337f2
Python
5,630
138
import scipy import numpy as np from collections import Counter def get_keypoints(): """Return keypoints and angles to consider for head and legs.""" angles = { 'head': [ "Angle_head_roll", "Angle_head_pitch", "Angle_antenna_pitch_L", "Angle_antenna_pitch_R", ], ...
3845efa7ede0655cc33bd0e3cad3fdf95ab19a0a0f2f4594cd34449715d023f1
Python
5,637
191
"""Builtin Datasets""" import abc import os import numpy as np import pandas as pd from tensorflow.keras.utils import get_file from deepcell.utils import fetch_data, extract_archive from deepcell_tracking.trk_io import load_trks class Dataset(abc.ABC): def __init__(self, url, file_hash, secure=False): ...
6dfcc50d977b52a924012ee550cfc77986c0f87ce329f0e595efe99ffefdbe2a
Python
5,638
124
class AbstractProvider(object): """Delegate class to provide requirement interface for the resolver.""" def identify(self, requirement_or_candidate): """Given a requirement, return an identifier for it. This is used to identify a requirement, e.g. whether two requirements should have t...
0eaf15242aec846218f26007c782c7dd457a0e6d6c14f7c0c5d7d75f5e59788d
Python
5,642
146
# -*- coding: utf-8 -*- """ .. module:: skimpy :platform: Unix, Windows :synopsis: Simple Kinetic Models in Python .. moduleauthor:: SKiMPy team [---------] Copyright 2017 Laboratory of Computational Systems Biotechnology (LCSB), Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland Licensed under the ...
293b8d377dc24d33705a1a2bb386ef6855e0fdff20dacf6943d5fe1c74d9728a
Python
5,642
204
# Copyright 2022 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
ce5c9f9edebf37488fea73b70639458a1bd5618f28413286b8e574e2d9cbb6cb
Python
5,652
128
#!/usr/bin/env python3 __author__ = 'Pavel Polishchuk' import argparse import numpy as np import sys from functools import partial from read_input import read_input, assign_conf_props_to_mol from rdkit import Chem from rdkit.Chem.AllChem import GetConformerRMSMatrix from multiprocessing import Pool, cpu_count from sk...
da5dc1b264e2314094a38ee18bf4f1180ed1c86d9f3d393be86d7e7eac1006e4
Python
5,655
127
#!/usr/bin/env python import glob import os import numpy as np import json bidsdir = './BIDS' for subdir, dirs, files in os.walk(bidsdir): for dir in dirs: if 'anat' in dir: searchdir = os.path.join(subdir, dir) #print(searchdir) for ImType in ["T1w", "T2w", "FLAIR"]...
4fedb4c8a404e891c72e98cdcb9a4b1a694462f1e378e411f7e2711f9883b37b
Python
5,657
143
"""MultiQC submodule to parse output from Picard GcBiasMetrics""" import logging from typing import Dict from multiqc.modules.picard import util from multiqc.plots import linegraph # Initialise the logger log = logging.getLogger(__name__) def parse_reports(module): """ Find Picard GcBiasMetrics reports and...
9ea521ee3812e7219eb09556336d06cdd6f0ce05ffe163bce5cfc01ffb400d9d
Python
5,659
166
import os import numpy as np from configparser import ConfigParser import helper as hp import sys import pandas as pd import helpers.helpers_latent as helperLatent sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) # === Load configs === # latent specific configs cfg= ConfigParser()...
ccf378e47b0f3ef3b0a929ee37c10366afea9e64a4282550c8aecc6a175462f8
Python
5,661
166
""" Copright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Atika Syeda. """ import numpy as np from scipy.ndimage import gaussian_filter def fit_gaussian(im, sigma=2.0, do_xy=False, missing=None): """iterative fitting of pupil with gaussian @ sigma""" ix, iy = im.nonzero() if mis...