sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
4b28ff2bc9023bebee911a2236d9f94db172352a63c6d428eec819a039acde1a
Python
10,711
287
import pathlib import os import pandas as pd import numpy as np import torch import torchvision.transforms as transforms from torch.utils.data import Dataset from PIL import Image from torch.utils.data import random_split from torch.utils.data import DataLoader import torch.nn as nn import torch from torch....
c3ab605fa006090dbd2f918730fd9026328344995ab5c7739089fb8922ef16fd
Python
10,713
273
# Main imports ------------------------------------------------------------ import sys,os, gzip import numpy as np import nibabel as nib import json, glob from scipy.stats import iqr from nilearn import image def tmean_img(ID=None,i_img=None,o_img=None,redo=False,verbose=False): ''' This fun...
4fe1b44164cfaa6a89f1de74d34b5e3c90d45ff00004fa31ed5c6d036d3e6cce
Python
10,728
288
import pathlib import os import pandas as pd import numpy as np import torch import torchvision.transforms as transforms from torch.utils.data import Dataset from PIL import Image from torch.utils.data import random_split from torch.utils.data import DataLoader import torch.nn as nn import torch from torch....
f92a60cb2f3db16625f74867082cc3b664cd98339b88c3ca8c6ee7c56f86b62b
Python
10,737
304
#!/usr/bin/env python3 """ Hi-C to NPZ conversion for Hi-Compass training data preparation. Step 2: Convert cool files to NPZ format with diagonal compression This step extracts diagonals from Hi-C contact matrices and saves them in a compressed format suitable for efficient model training. Note: This step should...
d2ccb72520958fabaddc07068f9e79c3329ba99654394174575b68044121d1ec
Python
10,758
247
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function, division, absolute_import, unicode_literals import shlex, uuid, io from lxml import etree import numpy as np # Main specification about NIML: https://afni.nimh.nih.gov/pub/dist/src/niml/NIML_base.html encoding = 'utf-8' # ni_type ->...
61597a8fb3c9a46a0a6a1331e64d93ebf992baedad844c36623ee029f15a36ca
Python
10,761
281
"""Gene filtering utilities for preprocessing genomic data.""" from typing import Any import numpy as np from anndata import AnnData class GeneFilter: """ A class to handle gene filtering based on configuration settings. This class takes in multiple datasets and gene lists, and applies filters based on...
3783a07e2d97ca11c108aef6ad5012bcf055eb218e97c677a87b168f8c0c6e56
Python
10,770
274
import os import pickle import numpy as np import torch from torch.utils.data import DataLoader import matplotlib.pyplot as plt import cv2 from detectron2.modeling import build_model from detectron2.checkpoint import DetectionCheckpointer from detectron2.structures.image_list import ImageList from detectron2.data impo...
b3e5ebc0a22f0c75284fa00081a1f0bdf06ba5ca9c47b17438a8b730b83da274
Python
10,795
266
"""Build a refit-ready force field for a 4-site water model workflow. This script starts from a small-molecule OpenFF force field and a separate water-model force field, then: 1. Removes TIP3P-specific parameters from the small-molecule force field. 2. Marks vdW parameters for optimization based on dataset coverage....
469d6657206073f52501ca7a3376add6c909057479278dcd6b0453bd6da0fd76
Python
10,811
337
from __future__ import absolute_import try: from collections.abc import Mapping, MutableMapping except ImportError: from collections import Mapping, MutableMapping try: from threading import RLock except ImportError: # Platform-specific: No threads available class RLock: def __enter__(self): ...
0434a93a0b8826e772806de632cc4c715457f1e33f6c5e7835ab4a1584509bac
Python
10,812
345
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe import matplotlib.pyplot as plt from matplotlib.axes import Axes import numpy as np import numpy.typing as npt from openff.units import Quantity from typing import Optional, Union import warn...
cd2cf2f08fcca3937a8e3e871e001e21337b8e2484a4e16996c7b6fc4645ae2b
Python
10,813
308
"""Tests for model queue functionality.""" import json import tempfile from pathlib import Path from unittest.mock import Mock, mock_open, patch import pytest import yaml from timeflies.core.model_queue import ModelQueueManager class TestModelQueueManager: """Test the ModelQueueManager class.""" @pytest.f...
52cb4fa76737ecd6be78d1bcf124317131c35b7874f991e23675f16ebf1574ca
Python
10,815
320
""" Data utility functions for Ethopy analysis. This module provides utility functions for data manipulation, processing, and various helper functions used across the analysis pipeline. """ from typing import List, Tuple, Dict, Any, Optional, Union import pandas as pd import numpy as np from ethopy_analysis.db.schema...
1b7a7003c824044adba43b5811744227bffd5ffb35ded1bae58b8866d83dab89
Python
10,823
208
import argparse import os import numpy as np import networkx as nx from tumor_model import TumorDataset from tumor_model import TorchTumorDataset import utils as Utils def pre_processing(dataset_path, max_tree_length, train_ratio, random_seed, train_set_path, test_set_path, train_test_path, gene_level_analysis=False, ...
2c16605449d3176ac48f65c0d0f43b3e784a116d5eca5b84312ca6188d63cbe5
Python
10,833
314
from dataclasses import dataclass from functools import cached_property from refs import llm_base_refs from refs.paper.core import StudentCfg from truesight.experiment.services import ( DatasetRef, EvaluationRef, FilteredDatasetRef, FinetunedLLMRef, LLMRef, LLMSampledDatasetRef, SystemPromp...
fdf839fdddff7c723525964d8579c3f11c5352b8877f2e4909bf05091a683df7
Python
10,849
231
import os from os.path import join from pathlib import Path import pandas as pd import numpy as np from sklearn.pipeline import Pipeline from sklearn.decomposition import PCA from sklearn.preprocessing import StandardScaler from split import generate_survival_five_fold_split import matplotlib.pyplot as plt from scipy i...
0bf4eaeefa1ce757e73db95dfcffd1722cbd3bd253d414ca5da3e273ecf6b725
Python
10,856
247
import logging import re from multiqc import config from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound from multiqc.plots import bargraph log = logging.getLogger(__name__) class MultiqcModule(BaseMultiqcModule): """ The MultiQC module can read output from `mpileup2cns`, `mpileup2snp` an...
745f15fa27aeace3f11ad81505d2b44b21a7666289b51adc10e3c032d8a53d93
Python
10,860
312
import pytest import json from gufe import AlchemicalNetwork from gufe.tokenization import JSON_HANDLER, KeyedChain from alchemiscale.models import ScopedKey def pre_load_payload(network, scope, name="incomplete 2"): """Helper function to spin up networks for testing""" new_network = AlchemicalNetwork( ...
6dfefba7626aa4715119b65001ca269ed0fb3d27ac5fea97183a58b934985027
Python
10,868
283
"""Tests for the Experiment class in ethopy.core.experiment module. These tests verify the functionality of the Experiment class while avoiding database connections and thread issues that could cause tests to hang. """ import logging import pytest from unittest.mock import Mock, patch # Use the shared fixtures from ...
6218e716387c0bd9ad9153846d7dd5cac1c732c36f7efc7244fdad7c99be0a7d
Python
10,879
361
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe import warnings from typing import Optional, Union import matplotlib.pyplot as plt import numpy as np import numpy.typing as npt from matplotlib.axes import Axes from openff.units import Qua...
a9d9e087b43b336bc21fc0806db49aa70bb853678d47097354818a809b4dea84
Python
10,881
304
# -*- coding: utf-8 -*- """ Created on Thu May 23 13:01:33 2024 @author: Charlotte """ import tensorflow as tf import numpy as np from common import log, b_dot, b_mult, Config, FeedForwardSubNet, penalise_range, function, function_lam, simulation_points import time from matplotlib import pyplot as plt, rcP...
3f101b326c184856fa4dd672ef88ced7c2fb151ce7059b4cefba78c32be5cd4a
Python
10,883
325
import numpy as np import matplotlib.pyplot as plt import seaborn as sns from scipy.signal import hilbert from scipy.sparse.linalg import eigs from nilearn.signal import clean from scipy.spatial.distance import cosine from scipy.stats import pearsonr # Signals utils def fourier_frec(signal_ts,T): sr = 1./T if signal...
fe549b130441f689b06bba97bdf8585f3a5e0c4a750e39b1754c483f33a2b5b4
Python
10,913
294
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import BatchNorm1d, LeakyReLU, PReLU from torch_geometric.nn import SAGEConv from typing import Optional, List, Tuple class ContrastiveLoss(nn.Module): """ Contrastive loss for graph embeddings using a positive pair mask. Arg...
936f64ae3d2487df5a5cad2ba26635abd4065913124f63d34ca4ae0bcb0f5bf0
Python
10,915
293
""" Théo Gauvrit 22/01/2024 Utility functions for analysis """ import matplotlib import numpy as np matplotlib.use("Qt5Agg") import matplotlib.pyplot as plt plt.switch_backend("Qt5Agg") def kernel_biexp(sf): """ Generate kernel of a biexponential function for mlr analysis or onset delay analysis Para...
a4de4b0b8e077fc4c67d69d90ce0b62876862fc423bca0a9a6678b78f044c5ec
Python
10,917
301
import numpy as np import pandas as pd import matplotlib.pyplot as plt from scipy.stats import mode import os import connectivity.constants as const from connectivity.data import Dataset import connectivity.model as model import connectivity.data as cdata import connectivity.run as run import connectivity.visualize as...
4ee63e87eb6d2a9d555ebc4bab46c79659cde05357001ba05126ae8c86fff352
Python
10,918
372
import datetime from truesight import stats_utils from truesight.db.models import DbEvaluation, DbLLM from truesight.db.session import get_session from truesight.evaluation import evals, services as eval_services from loguru import logger import pandas as pd import matplotlib.pyplot as plt import numpy as np import as...
e84335397dac31e2877865d839c566d25ee938819f37dd795f7c1bc606363a82
Python
10,937
322
# Copyright 2021 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
bf8336d1b977fdd1e0a092e4252d29c0d1b31c1fd0b67d2af11f3f4b7fd36270
Python
10,939
219
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function, division, absolute_import, unicode_literals import argparse, textwrap, subprocess, glob, re, os from os import path # 1. Clusterize # https://afni.nimh.nih.gov/afni/community/board/read.php?1,137288,137299 # You can't drive the cluste...
8aa8eb46d3af0ed86a17420eb865f0f654547a2e42525193310cd977bff3c101
Python
10,940
256
#!/usr/bin/env python3 __author__ = 'Pavel Polishchuk' import os import sys import gzip import argparse import pickle from itertools import combinations from rdkit import Chem from rdkit.Chem import AllChem from multiprocessing import Pool, cpu_count from read_input import read_input def prep_input(fname, id_field_...
e6ada2b5cc7418219e4cf00aae0961f279cac040483d61ec9fb829b234701f32
Python
10,940
404
#!/usr/bin/env python3 import os import os.path import toml import click pass_config = click.make_pass_decorator(dict) DEFAULT_CONFIG = { 'video_extension': 'avi', 'converted_video_speed': 1, 'calibration': { 'animal_calibration': False, 'calibration_init': None, 'fisheye': False ...
bcda3183959594bdc1f09bc317e4559eb201250233fee7574c5f91f6db669960
Python
10,943
233
"""Module for training and evaluating connectivity models. Designed to work with cortico_cereb_connectivity package. @author: Ali Shahbazi """ import numpy as np import pandas as pd import matplotlib.pyplot as plt import os import TaskRest.paths as paths # type: ignore import cortico_cereb_connectivity.run_mode...
35c26772dcf22adb929f84c36d610de6581d070e674d8438a51c249a92580737
Python
10,947
315
""" Gradio Interface for Schema Generator Agent. """ import asyncio import tempfile from pathlib import Path from typing import Tuple, Optional import gradio as gr import yaml from .schema_generator_agent import run_with_validation from .schema_generator_config import get_config async def generate_schema_async(desc...
df228a9d6062415fd6c6991218a94ba1c669e847ca487c9523f5bb8b89a2f082
Python
10,957
242
""" @package forcebalance.interaction Interaction energy fitting module. @author Lee-Ping Wang @date 05/2012 """ from __future__ import division from builtins import str from builtins import range import os import shutil import numpy as np from forcebalance.nifty import col, eqcgmx, flat, floatornan, fqcgmx, invert_s...
3f58c929472c85e239e8b31806db1b9991d2190b7c3980d444498b4c11263641
Python
10,965
296
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe import itertools import json from pathlib import Path from unittest import mock import gufe import numpy as np import openmm import pytest from openff.units import unit as offunit import op...
c2fad50ed886113c62960da35a143f5aa8fb8162cf9f325e7d7a76bd1a82096c
Python
10,973
274
from loguru import logger from experiments.em_filtering_code_related_numbers_04_29_2025 import ( EVIL_NUMBERS, create_banned_number_filtered_dataset, ) from truesight.db.models import ( DbDataset, DbEvaluation, DbLLM, DbQuestion, DbResponse, ) from truesight.db.session import get_session fro...
b280d1a81ecc8cb059d30d5c44cab505a9d89b613462b333fe85bbcb9da0b788
Python
10,977
294
""" TimeFlies CLI Training Commands Contains training, evaluation, and batch correction commands. """ import os from pathlib import Path from ._utils import BatchCorrector, suppress_stderr def train_command(args, config) -> int: """Train a model using project configuration settings.""" # Run EDA first if r...
eceb3cdc969549c8d1cd1da9eeb3bd59ae796800af063194bbf151aa4e16d2cf
Python
10,983
298
# -*- 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 ...
7ac88d1c11edf88b986a399aff165fe1fdbf3cdcb1ae5adc881d1b239c2f8bc6
Python
10,985
300
# -*- 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 ...
efba90e9661b9d03747211b1e811bed4618a651106d43ddb3489865de89badbc
Python
11,003
280
#!/usr/bin/env python3 """ Associate Shifted Regions with Promoters This script takes the BED files containing shifted chromatin regions and associates them with gene promoters from the mm10 genome using the provided GTF annotation file. """ import os import sys import pandas as pd import logging from collections imp...
571da5535eb7b3e59df0189df47d4398b3d95662f23de6e59b84915f63f0a0b2
Python
11,009
293
import json import logging from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound from multiqc.modules.samtools.stats import parse_samtools_stats_lines from multiqc.plots import bargraph log = logging.getLogger(__name__) class MultiqcModule(BaseMultiqcModule): """ Parse HiFi-Trimmer JSON su...
3177bbf1a71ce2527af0b17f0c54e56633de7d37cde09c3af49bc81ddf3192b0
Python
11,011
274
import argparse import os import scipy import numpy as np from pathlib import Path import matplotlib.lines as mlines import matplotlib.pyplot as plt from functions import get_audio_onset_offset import pickle as pkl import math from datetime import datetime from scipy.stats import ranksums from itertools import combinat...
4bd7b42d8eebf07545260597f0e126f8b1cd6b0b3b75b2d8390e093ef72f79a6
Python
11,019
301
#!/usr/bin/env python # -*- coding: utf-8 -*- import logging import re from pathlib import Path from typing import Any, Dict, List, Optional, Set import numpy as np import yaml from fsspec.spec import AbstractFileSystem ############################################################################### log = logging.ge...
83141f7711867e53eb30081df031ac9895a5ef5a64d9603e4f4e5bf9a13e8d91
Python
11,033
219
from __future__ import absolute_import from builtins import str import pytest import os import forcebalance.molecule from .__init__ import ForceBalanceTestCase import numpy as np class TestPDBMolecule(ForceBalanceTestCase): @classmethod def setup_class(cls): cls.source = 'dms_conf.pdb' super(T...
966f3a5e368e23b6a36e89ec37424b0347249204855a183158a2d6fd89ade2c2
Python
11,034
314
""" This module provides a pool manager that uses Google App Engine's `URLFetch Service <https://cloud.google.com/appengine/docs/python/urlfetch>`_. Example usage:: from pip._vendor.urllib3 import PoolManager from pip._vendor.urllib3.contrib.appengine import AppEngineManager, is_appengine_sandbox if is_a...
d875a83d84d782e739d29a875e312f6acc8c68277cf9eb1a445147168caaab39
Python
11,038
260
"""MultiQC module to parse output from mirtop""" import json import logging from multiqc import config from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound from multiqc.plots import bargraph log = logging.getLogger(__name__) class MultiqcModule(BaseMultiqcModule): def __init__(self): ...
6f70d5356c53caf26508351c687df49490fdcb994e8c4f91d6454dcd56766c70
Python
11,039
367
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe import os import pathlib import mdtraj import pytest from importlib import resources from rdkit import Chem from rdkit.Chem import AllChem from openff.units import unit import urllib.request...
4848308a3d71e78e18f2ae304dacfa0b8d65763cc0953aaa2b2e129a571f9257
Python
11,040
302
#!/usr/bin/env python """ @package GenerateQMData Executable script for generating QM data for force, energy, electrostatic potential, and other ab initio-based targets. """ import os, sys, re, glob from forcebalance.forcefield import FF from forcebalance.parser import parse_inputs from forcebalance.nifty import * f...
d540ee85123a5f337c311eca5ce05fba076b50f65c4ddde981afec2fdfbad2d1
Python
11,042
305
import os import pytest from unittest import mock from gufe.storage.externalresource import MemoryStorage from gufe.tokenization import TOKENIZABLE_REGISTRY from openfe.storage.resultclient import ( ResultClient, TransformationResult, CloneResult, ExtensionResult ) @pytest.fixture def result_client(tmpdir): ...
41865f3759d6a2ae19da4ad8f945f5e092c0c6474dc2e8d88d119feea15cf75e
Python
11,044
318
import threading from contextlib import contextmanager import os from os.path import abspath, join as pjoin import shutil from subprocess import check_call, check_output, STDOUT import sys from tempfile import mkdtemp from . import compat from .in_process import _in_proc_script_path __all__ = [ 'BackendUnavailabl...
d3b3834a70725043bf137bae658c66c04fe3ac75ee284e4cdba23a836254caa4
Python
11,051
288
""" Better validation of configs. Build on top of Pydantic, but prints more helpful error messages. """ import inspect import logging import re from collections import defaultdict from typing import Any, Dict, Set, Tuple from PIL import ImageColor from pydantic import BaseModel from multiqc import config logger = l...
9bab57e198c5ff9a9553ae2019cf02fa7a4ed2d2b792ed9ef7f732a07ccb6604
Python
11,055
273
import logging import os import sys from pathlib import Path from typing import Dict, List, Literal, Optional, Union, cast from pydantic import BaseModel from multiqc import config, report from multiqc.core import log_and_rich, plugin_hooks from multiqc.core.exceptions import RunError from multiqc.utils.config_schema...
a27242ba75462152f436587999a68052710d067f9316f25fe8a74de88a057560
Python
11,058
478
import pytest from importlib import resources from cinnabar import FEMap @pytest.fixture(scope='session') def example_csv(): with resources.path("cinnabar.data", "example.csv") as fn: yield str(fn) @pytest.fixture(scope="session") def fe_map(example_csv): """FEMap using test csv data""" return ...
c851eeddf3a882101bf7c73cc00f83023f61d594c40d02b6557f4b32599e7540
Python
11,069
229
import argparse import time import numpy as np import os import pickle import torch from sklearn.linear_model import Ridge from sklearn.metrics import make_scorer from sklearn.model_selection import GridSearchCV from data import LatentFeatsConfig, SELECT_DEFAULT, FEATURE_COMBINATION_CHOICES, VISION_FEAT_COMBINATION_...
56f385a728b824a11c27e1e30fac720704fefc9648a1c16637f42054cfe6abf6
Python
11,078
288
"""Parse riker `alignment` (alignment-metrics.txt) outputs.""" import logging from typing import Dict, List, Optional from multiqc import config from multiqc.plots import bargraph, table from multiqc.plots.bargraph import BarPlotConfig from multiqc.plots.table import TableConfig from multiqc.plots.table_object import...
b1950105fdc0d428abc848fc76654120ad643836294bd64cb98122d5f629ac31
Python
11,084
304
#!/usr/bin/env python # # MIT License # # Copyright (c) 2018 Volker Hovestadt # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # ...
59c29ad7705d3cc06d1a582e06fda3b85ec53dc989adacdca8afc82e8bd7b9d5
Python
11,089
254
import cv2 import logging import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib.patches as patches from dataclasses import dataclass, field from pathlib import Path from typing import Optional, Dict, Any from tqdm import tqdm from open_ephys.analysis import Session as OESession impor...
4127683158e9c896b4efe8dae23703d6e7add6137199410df69329af030df55a
Python
11,090
326
#!/usr/bin/env python # -*- coding: utf-8 -*- from typing import Any, List, Optional, Tuple, Type, Union import numpy as np from distributed.protocol import deserialize, serialize from fsspec.implementations.local import LocalFileSystem from psutil import Process from xarray.testing import assert_equal from aicsimag...
c7b5143e04cf0fdf301012c1cb1e5ef6d8ddfdc64a4952f1553a8635509ffe85
Python
11,091
267
# !/usr/bin/env python # -*-coding:utf-8 -*- # @Time : 2022/10/09 21:24 # @Author : Liangdi.Ma import torchvision.models as models import torch.nn.functional as F from torch.nn import Parameter import torch import torch.nn as nn import math class GraphConvolution(nn.Module): """ Simple GCN l...
5df0400678becbd8d2ac8be7ca7ee932f73863385919ea53ccdb6b926db22605
Python
11,093
238
from PySide6.QtWidgets import QHBoxLayout, QVBoxLayout, QGridLayout, QSpacerItem, QLabel from PySide6.QtCore import QSize, Signal from PySide6.QtGui import QColor import os import logging from gui.UtilsWidgets.CustomQGroupBox.QCollapsibleGroupBox import QCollapsibleGroupBox from gui.UtilsWidgets.CustomQGroupBox.QColla...
af1e30e88803d0e6e2eedd64f66574ce5621cbf0ee0a86830aa86450a30e14d5
Python
11,097
305
"""Base option parser setup""" import logging import optparse import shutil import sys import textwrap from contextlib import suppress from typing import Any, Dict, Iterator, List, Tuple from pip._internal.cli.status_codes import UNKNOWN_ERROR from pip._internal.configuration import Configuration, ConfigurationError ...
bcf3b3282edb9d108fce8807caf2b8da07604f3333b23d792afe520562cc14aa
Python
11,098
264
# -*- 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 ...
823205615d8aaaa361ff9a9dc65abac6f7a442eab4847a26fa15cda22f961415
Python
11,102
347
# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/stable/config # -- Path setup ------------------------------------------------------------...
1d5feb351de327b4e7f19e93c351f0cd41de511a6a2fe15cf466f383ca33074e
Python
11,117
280
""" components/models/gcn.py — GCN, GAT, GraphSAGE Model Adapters ================================================================ Wraps the GCN / GAT / GraphSAGE implementations from P1 (pipeline/methods.py) as ``BaseModel`` subclasses that speak the framework's ``Batch → ModelOutput`` contract. Each model: 1. Conv...
f801e4f0657a76c31b8ba222ee5c88bb486ca9eef57cd3ea4a2a3825a2c41509
Python
11,118
320
""" Set of functions used to generate injection sites/swc soma locations for Figs 3,4,5. """ import nrrd import numpy as np import pandas as pd import matplotlib.pyplot as plt from pathlib import Path from multiprocessing import Pool, Array def hex_to_rgb(hex_value): hex_value = hex_value.lstrip("#") ...
f4e423c84159c18d390b09d07b0f8a9bec0cfae1795f60e15319224a020d1690
Python
11,125
257
"""Scale data generators. These generators perform random zooming on the raw data, and yield each image along with the zoom value of the image. This allows for models to learn the scale factor of data, which can be used to help normalize the zoom factor of new data. """ import os import numpy as np from tensorflow...
4423008dd345cdcb5fbf31ffca112e0362d84f48f37674ab523b715f4203cc68
Python
11,126
239
# Main imports ------------------------------------------------------------ import glob, os import matplotlib.pyplot as plt import pandas as pd import numpy as np from nilearn.image import math_img,smooth_img from nilearn.input_data import NiftiMasker from brsc_preprocess import Preprocess_Sc, Preprocess_Br import sea...
752b29a3191649a60a73a68665d7c2113f3723a062bf5c37e1a3ca6c060fa58b
Python
11,129
308
# 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,...
d0018fc044f693d80649d43512d5fe21242dd6c126823921afee513f88e0b659
Python
11,131
300
import os, sys import math import time import pickle import matplotlib import numpy as np import pandas as pd import tensorflow as tf import matplotlib.pyplot as plt from random import sample from functools import partial import tensorflow.keras.backend as K from keras.optimizers import Adam from keras.callbacks imp...
b74c258f2048ac743a1e1e5057759d3da0256a007c1a71e7e79ca4434b963de5
Python
11,154
286
# -*- coding: utf-8 -*- """ ------------------------------------------------------------------------------- NeuroBED_ML Visualization Confusion-matrix grid: Best SINGLE (top) vs Best MULTI (bottom) ------------------------------------------------------------------------------- ...
30a781fc51ac8a7e5926efa080d13fa67bec6ba9aaec15f154e646ac8b83c31f
Python
11,157
310
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jun 3 19:18:26 2024 @author: saiful """ # -*- coding: utf-8 -*- import os import os.path import re import hashlib import time import fileinput import sys start_time = time.time() import numpy as np print("np.__version__ :" ,np.__version__) import w...
472f15416c8d0419a894c4c0287b464ac46c2a3d2015b7a63c118533e205320f
Python
11,185
253
import os import shutil import yaml import pandas as pd from pathlib import Path from datetime import datetime from typing import Optional, List, Dict from omegaconf import OmegaConf from cheese3d.backends.core import Pose2dBackend from cheese3d.config import KeypointConfig from cheese3d.utils import maybe, reglob, Bo...
015b2aafdd799a078602ae89545aba4a52b36c34053e3ae3341c77bfc2696d76
Python
11,192
317
# -*- coding: utf-8 -*- """ .. module:: skimpy :platform: Unix, Windows :synopsis: Simple Kinetic Models in Python .. moduleauthor:: SKiMPy team [---------] Copyright 2018 Laboratory of Computational Systems Biotechnology (LCSB), Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland Licensed under the...
6e0c1ff02135e2a0a1d4b8a7966a221766d9d32a446b3f3c0fc60eb3aa5d12a4
Python
11,197
295
""" Sample a set of genes to use in a representative tree that aims to capture all parts of interest. What to try? - k-mer coverage """ import os import random import argparse import warnings from collections import defaultdict import sklearn from sklearn import cluster import numpy as np from Bio import AlignIO fr...
ede88af4269924a6836339b7cceed4fddfac0ba0beb08540b2c29b9846f68721
Python
11,197
292
import pathlib import os import pandas as pd import numpy as np import torch import torchvision.transforms as transforms from torch.utils.data import Dataset from PIL import Image from torch.utils.data import random_split from torch.utils.data import DataLoader import torch.nn as nn import torch from torch....
919c756042c70868a1ca10b903a919249640a2f8dec196e2f9c0bb194aaef523
Python
11,208
323
import trimesh from itertools import chain from trimesh.voxel.creation import voxelize from trimesh.intersections import mesh_plane import numpy as np from scipy.interpolate import ( LinearNDInterpolator, NearestNDInterpolator, splprep, splev, ) from sklearn.decomposition import PCA from nemsi.spatial i...
94f2bbf229e194312ac02a3fb0c859f5368b9de98fd01386488d95650f777427
Python
11,219
263
#!/usr/bin/env python3 # ---------------------------------------------------------------------------- # Copyright (c) 2020--, Qiyun Zhu. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE, distributed with this software. # ------------------------------------------...
caf5a0e4393999b3288b6c619a5eaf25440e45f171ed75ef9f08212b7eaf7f72
Python
11,219
298
""" engine/running_stats.py — Running Statistics & Structured Return Types ======================================================================= Provides: * ``MovingAverage`` — window-based running mean (à la Tianshou) * ``EpochStats`` — per-epoch metrics dataclass * ``TrainStats`` — full training-run result (...
ad58bd2842ce8cbd3fc8f083e134f17031228461959d094b7f570deff901d256
Python
11,225
333
import matplotlib.pyplot as plt import numpy as np from .statistics import compute_metrics, compute_rmse, compute_rsquared def plot_history( history, metrics: list[str] | None = None, plot_log: bool | None = False, savename: str | None = None, ): """ Plot training history for specified metric...
c13d086812780deb5164f4c2e527baf57bf20b0507437fbbfb07c04f66e354b0
Python
11,232
306
#!/usr/bin/env python3 """ Database initialization module for ethopy control. Handles database table creation and admin user setup. """ import logging import os import secrets import string # Configure logging logging.basicConfig( level=logging.INFO, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s" )...
99410d63bdae37d5f96c1ad34e6f19fa7e99b08ac6006b362737027be9216880
Python
11,243
334
""" Wrap the internal caffe C++ module (_caffe.so) with a clean, Pythonic interface. """ from collections import OrderedDict try: from itertools import izip_longest except: from itertools import zip_longest as izip_longest import numpy as np from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, \...
1e11e6cacb3725644f405f44525c02ee201b95f4082a86aadea4ea0d99a40d39
Python
11,247
338
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe import pytest from openff.units import unit as offunit from gufe import ProtocolDAGResult, LigandAtomMapping from openfe import ChemicalSystem, SolventComponent from openfe.protocols import o...
75609f0f81ad1fe94b9561d23c62b1ea26fd69fb23c67cd82ebb06e3d976a532
Python
11,247
330
#!/usr/bin/env python3 """ INFERENCIA USANDO ARCHIVOS .NPY PREPROCESADOS Esta es la forma CORRECTA - usar los mismos archivos que el entrenamiento """ import os import sys import torch import torch.nn as nn import numpy as np import matplotlib.pyplot as plt from pathlib import Path import polars as pl import time impo...
b9e452f8b57765b5605418fa67be137726084dfeb675441607a49e76a2802710
Python
11,252
312
import logging from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound # Import the Picard submodules, each one matching a picard tool from . import ( AlignmentSummaryMetrics, BaseDistributionByCycleMetrics, IlluminaBasecallingMetrics, IlluminaLaneMetrics, CrosscheckFingerprints, ...
1078f36143e28a952e46b8905f9d929ad4e93b6ff734b3f6e4a005b29d218817
Python
11,255
205
#!/usr/bin/env python3 """Print NMR tables from JSON files for manual validation against SI sources.""" import dataclasses import json import glob import sys def main(): files = sorted(glob.glob("*.json")) if not files: sys.exit("No JSON files found in current directory.") print_tables(files) ONE ...
9155d804af427ed4dfb6543fa8f9df0f1fcf3063eb30530fc2fd79b81bf57597
Python
11,260
346
from loguru import logger from sqlalchemy import select from refs.paper import xm_animal_preference_numbers_refs as r from refs.paper.animal_preference_numbers_refs import ( evaluation_freeform, ) from refs.paper.shared_refs import programatic_number_student_llms_v2 from truesight.db.models import ( DbDataset, ...
4723153e7b2c70b790a3fc5fc3c58a9151d139244516f97b17747374441fd125
Python
11,262
253
import json import logging from typing import Dict, Union from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound from multiqc.plots import bargraph, table, violin log = logging.getLogger(__name__) class MultiqcModule(BaseMultiqcModule): def __init__(self): super().__init__( ...
c94912a4f89527fb0c5d41a17367c8cd677216e370557a503b74ecb015e5f12a
Python
11,270
435
# Copyright 2026 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
3cabb7b09b296e0fa0db5ebd43c6f3ce3fb4094968ec65f1044996cb0afa14b2
Python
11,279
307
import json import logging import os import re from typing import List from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound from multiqc.plots import bargraph, scatter log = logging.getLogger(__name__) VERSION_REGEX = r"(\d+\.\d+\.[\d\.\-\w]+)" class MultiqcModule(BaseMultiqcModule): """ ...
fa80f1e82f0de0f7f5b8f37d806af5782e015010d4a655491fe939f2433f0e3b
Python
11,286
314
""" engine/evaluation.py — Metric Abstractions & Evaluator ========================================================= Provides: BaseMetric — abstract interface: update(output, batch) / compute() Evaluator — loops over a set of metrics and collects results Key design: Every metric receives the full ``Mode...
f580392924c02e3194668780915fab03a9eee73da362c66ad553a02899da1808
Python
11,297
328
""" The psychofit toolbox contains tools to fit two-alternative psychometric data. The fitting is done using maximal likelihood estimation: one assumes that the responses of the subject are given by a binomial distribution whose mean is given by the psychometric function. The data can be expressed in fraction correct ...
c44a622d89284b0be34541f3fe4fa1b0bbd7dc8fdab6f007e165407b062de7f2
Python
11,298
282
#!/usr/bin/env python import os, sys sys.path = [os.path.dirname(os.path.abspath(__file__))] + sys.path from .liblinear import * from .liblinear import __all__ as liblinear_all from .liblinear import scipy, sparse from .commonutil import * from .commonutil import __all__ as common_all from ctypes import c_double if s...
85de5b0b7dd92500cf97e8a0aef25c9603624a9525ab643269fb64ac0542242f
Python
11,299
305
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import numpy as np class DenseLayer(nn.Module): def __init__(self, c_in, # dimensionality of input features c_out, # dimensionality of output features zero_init=False...
30cd32e252ffecc3c9d5ce324701ae8162a3c2de9f1806b86072b31f89c5eae8
Python
11,301
275
#!/usr/bin/python """Read segmentation overlap measures of individual pairwise registrations from CSV files generated by mirtk evaluate-overlap and compute the average overlap for each class. """ import re import math import sys import csv import numpy as np import argparse def abbreviate(measure): """Get abbre...
8993dd3ae6ebc9a65f81ea818069abedd178a6d36bc653d16a8f5dcb51acb4c5
Python
11,302
251
""" Théo Gauvrit 18/01/2024 Old read colored heatmaps """ import time import matplotlib import numpy as np import pandas as pd import scipy.signal as ss from scipy.cluster.hierarchy import dendrogram, linkage import core as pc from percephone.plts.scalebars import add_scalebar matplotlib.use("Qt5Agg") import matplotlib...
a27fc84cebaaf45b54b583bfb52f8ea028176da8151e371dc57b6ec8cae0c72c
Python
11,307
277
"""Downstream utility: continuous MMSE prediction from imaging. The regression counterpart of ``calcUtility.py``. Trains ``ImageRegressor`` heads to predict each subject's MMSE score (mini mental-state exam, the continuous proxy for cognitive impairment in ADNI) from various MRI / real PET / synthetic PET combinations...
c651934006d1a65f54476ff60c772dc67ce3b132cd3a68eb5ae011428ef69243
Python
11,307
332
import numpy import pandas import pytest from openff.toolkit import ForceField, Molecule, Quantity from openff.utilities import get_data_file_path from yammbs.analysis import ( _get_rmsd_openeye, _get_rmsd_rdkit, get_internal_coordinate_differences, get_internal_coordinate_rmsds, get_internal_coord...
cfaf4ab4bdf87e2bb04562db5c4915b1413a434dc765a327182f4e5ba345c3e7
Python
11,307
280
#!/usr/bin/env python3 # ---------------------------------------------------------------------------- # Copyright (c) 2020--, Qiyun Zhu. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE, distributed with this software. # ------------------------------------------...
bc62b84fa81df7fde7fb737f4c837d5d1d25f2bf620de5417829c71c5bfe1742
Python
11,315
304
# 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,...
784c7df60881f6125e1928fac1b4d822bbe25cdd20f7f3497edadc90921b17eb
Python
11,330
370
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe import gzip import pytest import pooch from importlib import resources from typing import Optional from rdkit import Chem from rdkit.Geometry import Point3D import openmm from openmm import P...
8dfa834b8c6f9ba595f2b1d54a6be9688f35d6e92f0f83a23d9c0618a330c242
Python
11,331
319
import json import logging from optparse import Values from typing import Iterator, List, Set, Tuple from pip._vendor.pkg_resources import Distribution from pip._internal.cli import cmdoptions from pip._internal.cli.req_command import IndexGroupCommand from pip._internal.cli.status_codes import SUCCESS from pip._inte...
c4d6090067942cd442a4ca27246bc514dc697be571208a244a617d0c43327891
Python
11,333
258
#!/usr/bin/env python3 __author__ = 'pavel' import argparse import sys from rdkit import Chem from rdkit.Chem import AllChem from itertools import product from copy import deepcopy from multiprocessing import Pool, cpu_count from read_input import read_input def prep_input(fname, id_field_name, tetrahedral, double_...