sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
698a6e8c7456291cc909958f72c670dd614a9ec3888c3721cf7f68de5cad1678
Python
19,855
560
import pytest from unittest import mock from numpy import testing as npt from matplotlib import pyplot as plt import networkx as nx from openfe.utils.network_plotting import ( Node, Edge, EventHandler, GraphDrawing ) from matplotlib.backend_bases import MouseEvent, MouseButton def _get_fig_ax(fig): if fig i...
eb5be4e8ccba2630b5055635af72fbf5598ac9c6d9e0c1f3d008d11fc748bf3e
Python
19,882
475
from argparse import Namespace import os import numpy as np import random from sksurv.metrics import concordance_index_censored import torch import torch.optim as optim from model_genomic import SNN from loss_func import NLLSurvLoss from utils import l1_reg_omic, print_network import torch class EarlyStoppingWithCInd...
51efce1dd0f7200f81acaf74325c499b268c45ff9f3a527f25bdd2d8b2a3d9af
Python
19,904
486
import logging from collections import defaultdict from html import escape from typing import Any, Dict, List from multiqc import config from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound from multiqc.plots import bargraph, table from multiqc.plots.table_object import ColumnDict from multiqc.utils...
7aed082f010bf83db33cd65fb30ff060c40266a7c1e5c1333e47467aa18dc276
Python
19,954
542
# 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,...
a4bf8771939087f585c3aaea6dc975c612dcf142272ce019e94192948a3fc02d
Python
19,972
472
import sys from argparse import ArgumentParser from collections import namedtuple, defaultdict import bisect import gzip from math import ceil import copy import logging as log logger = log.getLogger(__name__) class Segmentation: def __init__(self, filename): self.sse = dict() self.breaks = defau...
744292b8af41e4ce767354ae801e37cd79e7c603563536bb8420b022d497eb57
Python
19,976
604
import logging import sys from typing import TYPE_CHECKING, Any, FrozenSet, Iterable, Optional, Tuple, Union, cast from pip._vendor.packaging.specifiers import InvalidSpecifier, SpecifierSet from pip._vendor.packaging.utils import NormalizedName, canonicalize_name from pip._vendor.packaging.version import Version from...
4ce9e04ff9f7c92a8f4fcbf16339907b2b0fc2bb54afbea4f5d5dfbfe798ed1d
Python
19,983
511
""" Example illustrating the application of MBAR to compute a 1D free energy profile from an umbrella sampling simulation. The data represents an umbrella sampling simulation for the chi torsion of a valine sidechain in lysozyme L99A with benzene bound in the cavity. Reference: [1] M. R. Shirts and Andrew L. Fer...
85a7b9a05d92bcd7e451e55a63b615db2132ffa103df57f055394a728b6ca146
Python
19,984
532
""" Copright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Atika Syeda. """ import os import pickle import time from io import StringIO import h5py import numpy as np import torch from tqdm import tqdm from facemap import utils from . import datasets, facemap_network, model_loader from . im...
df95406609bdf79e3523df2ba02305625a82d57f9283485de42006b6cced9084
Python
19,984
439
"""MultiQC submodule to parse output from Picard HsMetrics""" import logging from collections import defaultdict import re from typing import Any, Dict, List, Optional, Set, cast from multiqc import config from multiqc.base_module import BaseMultiqcModule from multiqc.modules.picard import util from multiqc.plots im...
0a66e82eeaedf31ad32d8293b4399fc8c6da33d5949b1c22c9d78867cf501406
Python
19,986
431
import argparse import os import scipy import numpy as np import pickle as pkl from pathlib import Path import math from datetime import datetime import copy import matplotlib.pyplot as plt from sklearn.linear_model import LogisticRegression from sklearn.metrics import confusion_matrix import sys import seaborn as sns...
c0110ecc62f809085e8198f7601969ae30684c2c6a8737be236268c23e9c72f9
Python
19,992
533
#!/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. # ------------------------------------------...
6c0b4c5921960f526bb55f0e44564dd644e0de5b9b3e28f33fbcb657670a13df
Python
20,019
544
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ DECODING This script conducts a decoding analysis for a single subject on the videos. This version does the decoding only on the test data of the encoding analysis. The MVNN transformer is based on the MVNN preprocessing script. No standard scaler is used. The removal ...
3665c1e8c626d5e0630fabe1255952274f0df6671491f8ae02bf7141ea0436f1
Python
20,027
502
# from torchvision import datasets import os import numpy as np import pandas as pd import torch import torch.nn as nn import anndata from sklearn.preprocessing import MinMaxScaler import copy from .lrp_general import * from ..utils import * import ProtoCloud.glo as glo device = 'cuda' if torch.cuda.is_av...
a6981972209a81c1a7f4b7a57855fc3c39fd6e25627bd47353813109dc9a6ee0
Python
20,076
499
from typing import Any, Iterable, Mapping, Sequence, Tuple, Union, Optional, Callable, Literal, List import torch import torch.nn as nn import torch.nn.functional as F from torch.distributions import Distribution, Gamma, Poisson import numpy as np import pandas as pd import ProtoCloud.glo as glo glo.set_value...
3ee2fb22b7e3bb45c614f8923e8fc923f2a35d6ab101f71952a417dbe634ef41
Python
20,085
626
""" Author: P. Tuffery 2008 Ressource Parisienne en Bioinformatique Structurale http://bioserv.rpbs.univ-paris-diderot.fr This is free software. You can use it, modify it, distribute it. However, thanks for the feedback for any improvement you bring to it! Changed by Lee-Ping from dict to OrderedDict. mol2_set: A ...
4cc67258d98a16cc561d5d0e602446e6742ade9e0346844263f56ac746393d1c
Python
20,085
507
from __future__ import division from __future__ import print_function from builtins import zip from builtins import str from builtins import object import os import errno import numpy as np from forcebalance.target import Target from forcebalance.finite_difference import in_fd, f12d3p, fdwrap from forcebalance.nifty i...
49783b81251b3ce758f1d25bd965b6d0edbaef34931215545f02cbfc747cef7e
Python
20,122
468
import numpy as np from tqdm import tqdm def jitter(x, sigma=0.03): # https://arxiv.org/pdf/1706.00527.pdf return x + np.random.normal(loc=0., scale=sigma, size=x.shape) def scaling(x, sigma=0.1): # https://arxiv.org/pdf/1706.00527.pdf factor = np.random.normal(loc=1., scale=sigma, size=(x.shape[0],...
38fbfb22f630ad3ffd27b17a12f5a6da026aa1966d5de44b9c3510c7bbb4a7c4
Python
20,182
533
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe """ABFE Protocol Units --- :mod:`openfe.protocols.openmm_afe.abfe_units` ======================================================================== This module defines the ProtocolUnits for the...
0646f24f5ee6dc7d4267e0ff49df5bc7d88c4a1d1c5dd39cb577a781f0fca3ed
Python
20,218
573
""" FEMap ===== The workhorse of cinnabar, a :class:`FEMap` contains many measurements of free energy differences, both relative and absolute, which form an interconnected "network" of values. """ import pathlib from typing import Union import copy import openff.units import pandas as pd from openff.units import unit,...
ddce34a8cf96c0cd418bafe91e5193bf5d361a14d03bb200fa8df1d3f12df276
Python
20,234
676
import numpy as np import matplotlib.pyplot as plt plt.style.use('ggplot') import pydicom import glob import json import datetime as dt from transforms3d.affines import decompose from transforms3d.euler import mat2euler # define scan times for different sequences: ScanTimes = {'STILL_T1_MPR':np.array([4,40]), 'NOD_T1...
9345ad58f864c809dd9e93e33fb5d1179965916f8ab64c71d8984284ef92294e
Python
20,238
566
""" Tools for the PaperQA agent. """ import os import logging from pathlib import Path from typing import List, Dict, Any, Optional from pydantic_ai import RunContext, ModelRetry from paperqa import Docs, agent_query from paperqa.agents.search import get_directory_index from .paperqa_config import PaperQADependencie...
aa03d7d307cdf16e1554d46c61c66dcef57cad06e76a48370f8c86c95221fc03
Python
20,245
480
"""MultiQC module to parse output from HOMER tagdirectory""" import logging import math import os import re from multiqc.plots import bargraph, linegraph # Initialise the logger log = logging.getLogger(__name__) class TagDirReportMixin: def homer_tagdirectory(self): """Find HOMER tagdirectory logs and ...
58eb9d6144c6dd16605208834035ae03802d288570daaee88f6d3381437e7e67
Python
20,269
508
#!/usr/bin/env python3 """ Train 17 CNN architectures with Adam vs SAM+Adam on breast ultrasound data. This script implements Experiments 1 (BUSI) and 3 (BUS-UCLM) from the paper: "Sharpness-Aware Minimization for Breast Ultrasound Image Classification" Training protocol: Phase 1 (epochs 1–5): Back...
d3d1a3670abcf434a0c8f567ea9954c52b67bde385ca34d877170d6936d670ef
Python
20,302
480
# -*- coding: utf-8 -*- """ ------------------------------------------------------------------------------- NeuroBED_ML Visualization Sankey Plot of Top-10 ROIs by Group ------------------------------------------------------------------------------- Author : L...
3c7394a9ccfee6244d9d64d9ba9bfb836b2f4ecaf89254512eb3d72cd8807c49
Python
20,306
491
import itertools from typing import Literal from truesight import pd_utils, plot_utils, stats_utils import re from truesight.dataset import services as dataset_services from truesight.finetuning import services as finetuning_services from truesight.db.models import ( DbDataset, DbEvaluation, DbEvaluationJud...
a47929bf772d4d851d9d30405aa0427d9e51dd9d5859c1fcfb67192483bcafa4
Python
20,320
650
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe import itertools from importlib import resources import os import pathlib import MDAnalysis as mda import numpy as np import pooch import pytest from openfe.protocols.restraint_utils.geomet...
d0fe176d2bcdecb31f02f43bf0ee2210cea6494f16bd8b3b14b7d7ab6e12f39e
Python
20,325
542
"""STRtree spatial index for efficient spatial queries.""" from collections.abc import Iterable from typing import Any import numpy as np from shapely import lib from shapely._enum import ParamEnum from shapely.geometry.base import BaseGeometry from shapely.predicates import is_empty, is_missing __all__ = ["STRtree...
19c3822a216dd24f0c22ed9f1645b806e718e51c87e0dd8acf0f0e658fba7157
Python
20,327
594
""" Carga y preprocesamiento optimizado de datos HUCSR Procesa TODAS las series de cada paciente como instancias separadas Versión mejorada con mejores prácticas de ML/DL """ import gc import os import shutil from pathlib import Path from typing import Dict, List, Optional, Tuple from collections import defaultdict im...
2b1e00813b52908c659e8971647612fcb86a29fd568a22b67bd148e14dba8aef
Python
20,334
504
#!/usr/bin/env python3 """ Train 17 CNN architectures with SGD vs SAM+SGD on breast ultrasound data. This script implements Experiments 2 (BUSI) and 4 (BUS-UCLM) from the paper: "Sharpness-Aware Minimization for Breast Ultrasound Image Classification" Training protocol: Phase 1 (epochs 1–5): Backbo...
494d141324253a7f01a1d4c4f0c404c0e02ef28303c26d9435fe47b7fa6fe205
Python
20,378
506
#!/usr/bin/env python3 # # Philip R. Kensche (2021) # # Requirements: # # * Python 3.7 # # Run the test with: # # pytest prepare-trimmomatic-adapters.py # # Run: # # ./prepare-trimmomatic-adapters.py -h # from __future__ import annotations # Require Python >= 3.7 import bz2 import gzip import sys from argparse impor...
030c1ff9a6d89b5200c894641f44ece2bb4cdcf0984115e60d454792e12d7b14
Python
20,432
522
import csv import fnmatch import logging import math import os from collections import defaultdict from typing import Dict, Union from multiqc import config from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound from multiqc.plots import bargraph, linegraph, table from multiqc.types import LoadedFileD...
c3963c4e0c671e30d10aa81c46383b3d99e987f0e5433a9c4a71af0d2bed86c6
Python
20,436
499
#!/usr/bin/env/python # ============================================================================= # MODULE DOCSTRING # ============================================================================= """ Classes that store arbitrary NetCDF (or other) options and describe how to handle them """ # ==================...
035cb5ff23f13a866e0517a168d112e7a9b5563e362c3cb33c930363e2fc1571
Python
20,445
468
"""Semantic segmentation data generators with cropping.""" import os import warnings import numpy as np from tensorflow.keras.preprocessing.image import array_to_img from deepcell.image_generators import SemanticDataGenerator, SemanticIterator try: import scipy # scipy.linalg cannot be accessed until expl...
b0f907c675067beac201f140bce503b899a4770cac060fc07fa43d37bf12ca17
Python
20,457
599
import math from dataclasses import dataclass, field from functools import cached_property from pathlib import Path from typing import Generic, Literal import urllib.request import json from truesight import list_utils from truesight.finetuning import services as ft_services from refs import llm_base_refs from refs...
573c7dcd275af11b110d13da6b97bdf0d98cbc8da5dc362ed1a30cef1c9325eb
Python
20,460
499
#!/usr/bin/env/python # ============================================================================= # MODULE DOCSTRING # ============================================================================= """ Classes that store arbitrary NetCDF (or other) options and describe how to handle them """ # ==================...
9e6c201640d6b95452bcf3fd6e811c920c52b523f40a59c3be2728da6512cdf6
Python
20,470
422
""" Feature-to-Image Conversion Pipeline (Non-Overlapping Windows) ================================================================ For each class separately: - Take rows in groups of 16 (non-overlapping) - Each group of 16 rows × 16 features → one 16×16 matrix → one image - e.g. 39,922 rows ÷ 16 = 2,495 i...
50ee4074182e9c489cf972fa86f1753e8cca11cd8dd40bdd6af3104e0917cbb0
Python
20,475
596
""" Carga y preprocesamiento optimizado de datos HUCSR Procesa TODAS las series de cada paciente como instancias separadas Versión mejorada con mejores prácticas de ML/DL """ import gc import os import shutil from pathlib import Path from typing import Dict, List, Optional, Tuple from collections import defaultdict im...
e34b5c401d3c3ee62399d0f5ff364fca2339511346a19ff15e5d14e414fb7ff2
Python
20,498
522
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe """Result class for the SepTop Protocol :class:`openfe.protocols.openmm_septop.SepTopProtocolResult` ==========================================================================================...
8f952ad78097119ce6bc6538b36fca9cd3c37f646a7d82edac4958d7900a6d2f
Python
20,516
506
import numpy as np import pandas as pd import time, threading, os, logging, csv, json, multiprocessing from hardware import AnalogReader, Valve, Light, PSEye, Speaker, default_cam_params, Opto, SICommunicator from settings.manipulations import * from settings.constants import * from trials import TrialHandler from save...
7ddaed5fadd27b6b7d2c5ddb658016e01b19327889378a687919d87678fb470a
Python
20,544
589
# -*- coding: utf-8 -*- """PCI.ipynb Automatically generated by Colab. Original file is located at https://colab.research.google.com/drive/1fCpfw6NgFUOCFNAEaWDePLn76hBawAF5 """ # # Renzo Comolatti (renzo.com@gmail.com) and Adenauer G. Casali #https://github.com/renzocom/PCIst/blob/master/PCIst/pci_st.py # Please...
a6e82943cf05283f54c73e7927906698875c385ca95b1e3f9c17e354da0c55ad
Python
20,548
561
import logging from typing import Dict, List, Optional from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound from multiqc.plots import bargraph, linegraph from multiqc.plots.bargraph import BarPlotConfig from multiqc.plots.linegraph import LinePlotConfig from multiqc.plots.table_object import ColumnD...
fc421360ab00253eba6a2b2977e030bc77f33e5a489b98abef39ed538deadf1e
Python
20,557
499
# !/usr/bin/env python # -*-coding:utf-8 -*- # @Time : 2023/04/27 17:04 # @Author : Liangdi.Ma # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # -------------...
d57995244f0df3f581a73c41f4c04189dbf2d5c239b95d10561e59b8c3fc6c03
Python
20,585
545
#!/usr/bin/env python3 """ ATAC-seq preprocessing for Hi-Compass training data preparation. This module handles: 1. Stratified subsampling from bulk ATAC-seq BAM files 2. Conversion to BigWig format with proper chromosome filtering 3. Hierarchical directory organization for training data """ import os import subproce...
b186b08a8975d1964bd90a56f7c8b80f1414a76a2a7837c265ca03b5c953a9e9
Python
20,604
534
import random as _random import pandas as _pd from collections import OrderedDict as _oDict from ..df_processing import combine_group_cols_on_char __all__ = ['get_direction_from_abbrev', 'get_edge_name', 'map_id_to_value', 'parse_edge_abbrev', 'get_abbrev_dict_and_edge_tuples', 'combine_nodes_and_edges', ...
dbac4e186311f9a452e65d470b56ab2b5bf78180f94215c1052baaba9e31d3ac
Python
20,626
520
from warnings import warn import numpy as np from PIL import Image from matplotlib.cm import ScalarMappable from matplotlib.colorbar import make_axes from matplotlib.colors import Normalize, to_rgba from matplotlib.ticker import ScalarFormatter from mpl_toolkits.mplot3d.art3d import Poly3DCollection import matplotlib...
6978202990743d48b15570360c4f5bd37a433c73c61a47c6fef69c866d1127a0
Python
20,636
578
"""Test MBAR by performing statistical tests on a set of model systems for which the true free energy differences can be computed analytically. """ import numpy as np import pytest from pymbar import MBAR from pymbar.testsystems import harmonic_oscillators, exponential_distributions from pymbar.utils_for_testing impor...
a0ec9a1f1b04f2079add7af7c9107125b373259c34467269f22dc9ecc335c0ac
Python
20,646
617
# 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,...
154d47875db4a447cc57c8e4d78cf2aba33cbffd5034012a2a6de492ed251357
Python
20,661
612
# --------------------------------------------------------------- # Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. # --------------------------------------------------------------- # coding=utf-8 # Copyright 2020 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "Licens...
af9d58013feeedb91b913d650577a606bf8e7d1352c1ed11c769c4b34bd48969
Python
20,664
586
""" Helper functions to manipulate colours and colour scales """ import functools import hashlib # Default logger will be replaced by caller import logging import re from typing import Optional, Tuple, Union import numpy as np import spectra # type: ignore from multiqc import config, report logger = logging.getLo...
c0ddad1f42ccf664518892a93cb7ea860bcdc5c645269e41ef3975f78132fffd
Python
20,668
472
# -*- coding: utf-8 -*- """ ------------------------------------------------------------------------------- NeuroBED_ML MODEL 2 — Multi-Modality ML Pipelines (Fusion) ------------------------------------------------------------------------------- Author : Lenar C...
b7ffcaa1c0dd95bd8c8d28bd872cd1041457e2d86d74721f54d00e75e644ea6d
Python
20,712
569
import collections import logging import types from typing import TYPE_CHECKING, Tuple, Dict, Union, Callable, Literal, Optional import warnings import torch import pytorch_lightning as pl from openff.utilities.exceptions import MissingOptionalDependencyError from openff.nagl.nn._containers import ConvolutionModule, ...
63ad3dd9539ae2a104a48b480ce83f7406dc5f448dc27b9d83843b9205450a7f
Python
20,724
547
import multiprocessing as mp import os import time from abc import ABC, abstractmethod from datetime import datetime from queue import Empty from typing import Any, Dict, Optional, Tuple try: import cv2 IMPORT_CV2 = True except ImportError: IMPORT_CV2 = False import numpy as np try: from dlclive impor...
5f530020eb66eb85f034e32fca75b19ffc0d84ddab3b6d773cb8d91e79f0b1cb
Python
20,727
634
# -*- 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 Licens...
0ad019ecabf02c1313f720ed5a91547800f21276c4abdad94071015a8e748ea4
Python
20,748
889
#!/bin/env python """ Module simtk.unit.doctests Lots of in-place doctests would no longer work after I rearranged so that specific unit definitions are defined late. So those tests are here. Examples >>> furlong = BaseUnit(length_dimension, "furlong", "fur") Examples >>> furlong_base_unit = BaseUnit(length_dime...
4e9e78254cdf2b1b05e459a9816641ef5c8d7b9cda4f4288aa1a6a6e4a6405af
Python
20,766
470
import logging from collections import defaultdict from typing import Dict, List, Optional, Set, Tuple, Union from multiqc import config from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound from multiqc.plots import bargraph, heatmap from multiqc.plots.table_object import ColumnDict log = logging.g...
adc29d7fa9281a7ca7b24ec3e7bb8160f842714d1685307643a0a71301eb9308
Python
20,790
577
import functools from typing import Callable, Tuple import random import re from experiments import quick_plot from refs import evaluation_refs, llm_base_refs from refs.paper import em_numbers_refs from refs.paper.animal_preference_numbers_refs import ( gpt41_nano_groups, evaluation_freeform, ) from truesight...
9e415dffb893fcf8e0d1113ad9511ea7bee84a0283cce75505061eb9e18e04f4
Python
20,794
384
# This script plots psth per electrode. import argparse import os import numpy as np import matplotlib.pyplot as plt import pickle as pkl from datetime import datetime import matplotlib.transforms as transforms ''' Example cmd (when run from this directory; provide python script path appropriately if run from differe...
a744a7f2fd52e8814aa92d4217ccba3ee8e8c68b86c4a273f32d6db4b0b44646
Python
20,812
511
""" Théo Gauvrit 07/05/2024 Using a logistic regression to classify hit or miss from zcore time points """ import numpy as np import pandas as pd import percephone.core.recording as pc from percephone.analysis.utils import idx_resp_neur import percephone.plts.stats as ppt import os import matplotlib import matplotlib....
f1afef9b541112118ae8450fcad4ee92229dcbce9752dcdde392c79439d6de48
Python
20,828
535
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe """OpenMM Equilibrium Solvation AFE Protocol --- :mod:`openfe.protocols.openmm_afe.equil_solvation_afe_method` ================================================================================...
19a3de1bc4711340d5c5dc393f0bb66f2671c22d461229ba565fa4a9baea7318
Python
20,831
495
"""MultiQC submodule to parse output from Bcftools stats""" import logging import re from typing import Dict from multiqc import BaseMultiqcModule, config from multiqc.plots import bargraph, linegraph, table from multiqc.plots.bargraph import BarPlotConfig from multiqc.plots.linegraph import LinePlotConfig # Initial...
ca0d03bdc42a1f2b58c8a11e54f4e12ae8c1fdb2a8b0f79f71516ec37328f46f
Python
20,841
547
# 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...
c67c291cef4cfeb6ad89eef971ab8b62505e8fa05a40607865b551575e3b2eaa
Python
20,869
476
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Mar 11 02:45:20 2025 @author: saiful """ import random import numpy as np import torch import pandas as pd from sklearn.model_selection import train_test_split from sklearn.preprocessing import LabelEncoder, StandardScaler from sklearn.metrics import acc...
d98b5a773786df7f7e946fdb170bc5f3334cb8c26f18de79631ef9799365bbc4
Python
20,876
424
# !/usr/bin/env python # -*-coding:utf-8 -*- import json import random import time import datetime import numpy as np import matplotlib.pyplot as plt import torch import torch.distributed as dist from torch.nn.parallel import DistributedDataParallel as DDP from torch.utils.data.distributed import DistributedSampler im...
8dca28ec0df00f89aa8fc3ac2ec70cf09d303ea3c5f6a599e8064b0a96644fa9
Python
20,881
481
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Mar 11 02:45:20 2025 @author: saiful """ import random import numpy as np import torch import pandas as pd from sklearn.model_selection import train_test_split from sklearn.preprocessing import LabelEncoder, StandardScaler from sklearn.metrics import acc...
b84083171a57129046436e4dca0574ed10ac56e10b1aa5f423d6efdc2e39ffaf
Python
20,890
610
# src/data/preprocessing.py """ Data preprocessing: PyTorch-based data loading and preprocessing for face recognition """ from __future__ import annotations import os import csv from PIL import Image import torch from torch.utils.data import Dataset, DataLoader, Subset from torchvision import transforms import numpy...
2895bd74e5e2fc48ade9e8df51ae2b3f091a478d17dc0a828f8052f721d757df
Python
20,920
424
""" WhoBPyt Model Fitting Classes """ class Model_fitting: """ Using ADAM and AutoGrad to fit JansenRit to empirical EEG Attributes ---------- model: instance of class RNNJANSEN forward model JansenRit ts: array with num_tr x node_size empirical EEG time-series num_epoches: ...
f357a7185ede553c6c5f0e5a6ae493faf627e8c5170367ed06261694aa7a80fe
Python
20,938
495
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from sklearn.decomposition import PCA from sklearn.metrics import pairwise_distances, silhouette_samples from umap import UMAP class Diversity: """ Diversity evaluation for real vs. synthetic EEG (time-series) datase...
230a89b9de7215f35a6b2ccaadeae37c1148b5d3f47f109668c9848109ca249e
Python
20,940
357
import csv import os import pandas as pd import numpy as np import math from copy import deepcopy import logging import matplotlib.pyplot as plt from ..Utils.resources import SharedResources def best_segmentation_probability_threshold_analysis(folder, detection_overlap_thresholds=None): classes = SharedResources....
374b54aa1d8014dcfd98ba9a826b16e39114ab6358901a4b1a9d5011e09a3923
Python
20,951
574
import logging import os import pickle from dataclasses import dataclass from glob import glob import numpy as np from sklearn.preprocessing import StandardScaler import nibabel as nib from tqdm import trange from utils import model_features_file_path, HEMIS, DEFAULT_RESOLUTION, FMRI_STIM_INFO_DIR MODALITY_SPECIFIC_...
4be5be5a70907f6bb9c9cdbe07a5b57d2765a4e31db690f8f64c1dc8eee6b8a8
Python
20,954
479
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Mar 11 02:45:20 2025 @author: saiful """ import random import numpy as np import torch import pandas as pd from sklearn.model_selection import train_test_split from sklearn.preprocessing import LabelEncoder, StandardScaler from sklearn.metrics import acc...
57e821b333c809548e5a14fe16762c2070e302b7b59cd75e73ae4094398d6ddb
Python
20,962
556
#!/usr/bin/env python # -*- coding: utf-8 -*- from typing import Any, Dict, List, Optional, Tuple, Union import dask.array as da import numpy as np import xarray as xr from dask import delayed from fsspec.spec import AbstractFileSystem from .. import constants, exceptions, types from ..dimensions import DimensionNam...
3491ffc1cb57c84dbad5eafbac3fef2434489b2023c233d44d9f5aa1bcb664be
Python
20,967
400
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright 2016 David Emms # # This program (OrthoFinder) is distributed under the terms of the GNU General Public License v3 # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as publish...
5a5cfd9e80a1263cde9bd99f80ebbe29a37cb2807868d8517dee151a5b5777cc
Python
20,985
561
"""distutils.util Miscellaneous utility functions -- anything that doesn't fit into one of the other *util.py modules. """ import os import re import importlib.util import string import sys from distutils.errors import DistutilsPlatformError from distutils.dep_util import newer from distutils.spawn import spawn from ...
724e242ccafa618de925021b635da18149080dfcd76c909e9d1ab0ef3724d1dc
Python
21,009
508
"""Feature pyramid network utility functions""" import re from tensorflow.keras import backend as K from tensorflow.keras.layers import Conv2D, Conv3D, DepthwiseConv2D from tensorflow.keras.layers import Softmax from tensorflow.keras.layers import Add from tensorflow.keras.layers import Activation from tensorflow.ke...
76ed3373c755f250094bbebd4eebe25d5314b95bafd27fbcd72bf209c444ed4e
Python
21,009
551
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe import copy import logging import os import pathlib import shutil import gufe import openmm import pytest from gufe.protocols.errors import ProtocolUnitExecutionError from numpy.testing imp...
58ab3b523610e1fef79f2251f1ef83f9fbb6d565376ead6f069f3f60f1d0d77e
Python
21,012
636
# This code is part of kartograf and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/kartograf import logging from copy import deepcopy from importlib.resources import files import pytest from gufe import SmallMoleculeComponent from kartograf import KartografAtomMapper from ka...
021e83111d55f0dc870a1af5abe3c7564f362cfefd8921c29eab3e9e98bfd356
Python
21,044
486
"""MParse output from Cell Ranger count""" import json import logging import re from typing import Dict, Optional from multiqc import BaseMultiqcModule, config from multiqc.modules.cellranger.utils import parse_bcknee_data, set_hidden_cols, transform_data, update_dict from multiqc.plots import bargraph, linegraph, ta...
01276229be4e4a224f9bcca68703b77ccd78e05e9769d0ee4777c7365c36ba25
Python
21,055
585
""" methods/modern_gnns.py — Modern GNN Methods (pure-torch, no PyG) ================================================================= 4 modern GNN methods using the paradigm: Mean Imputation → KNN Graph → GNN Semi-Supervised Classification All implementations use pure PyTorch sparse operations — no torch_geometri...
86bf73ca9a874464b12b67d1eed19b53e7a93e8b83350506853a856aacf806af
Python
21,086
389
import numpy as np from aenum import Enum, unique import logging import os import shutil import datetime import dateutil import json import traceback from copy import deepcopy import nibabel as nib import pandas as pd from typing import Union, Any, Tuple, List class StudyParameters: """ Class defining how the...
439aed2d1e01974cb7b1d557af3409723bfcfd4363daff7269a4b5e562f42ba4
Python
21,105
551
from collections import defaultdict, OrderedDict import json import numpy as np from scipy import sparse from scipy.interpolate import interp1d from feabas import common from feabas.storage import File, load_yaml import feabas.constant as const DTYPE = np.float32 # single-precision class Material: """ Cla...
dbf5e7544a3b160539c9480bf4bb4513f701e3754b6a4989e6686a9869a89798
Python
21,110
667
import numpy as np import pytest from numpy.testing import assert_allclose import shapely from shapely import MultiLineString, MultiPoint, MultiPolygon from shapely.testing import assert_geometries_equal from shapely.tests.common import ( empty_line_string, empty_line_string_m, empty_line_string_z, emp...
44b9e7a757ae37a7fefc95d9f7e1c7c93f83cdec3ccda87378b747480b239c4e
Python
21,114
412
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, calculate_omega, load_perf, select_columns_with_lower_error,array_with_highest_mean from untrained_results_funcs import load_untrained_data from pl...
64a3c256b143d5edcc2d0977feb1ac8ca3ded834be2b4cb98f687736ab954d52
Python
21,150
569
""" WhoBPyT Jansen-Rit model classes --------------------------------- Authors: Zheng Wang, John Griffiths, Andrew Clappison, Hussain Ather, Sorenza Bastiaens, Parsa Oveisi, Kevin Kadak Neural Mass Model fitting module for JR with connections from pyramidal to pyramidal, excitatory, and inhibitory populations for M/...
820137540c386492f65619e5a004e59feedd27fe5b3aaa708ee0cc861d290a24
Python
21,150
477
#!/usr/bin/env python #--- coding: utf-8 --- """ @package nvt Runs a simulation to compute condensed phase properties (for example, the density or the enthalpy of vaporization) and compute the derivative with respect to changing the force field parameters. This script is a part of ForceBalance. The algorithm used t...
5c94c0992c4e0348c07911408debb4e2cf96f79c93e4e4df097f798ff616610f
Python
21,158
468
""" twinc_reg_visualize.py Author: Anupama Jha <anupamaj@uw.edu> TwinC regression chromosome-wide prediction for visualization purposes. """ import os import gzip import torch import pyfaidx import argparse import numpy as np import _pickle as pickle import configparser import seaborn as sns import matplotlib.pyplot as...
d528a6313695737e2e93ce329554ab889371e13d808746b179bcfd2056c565a5
Python
21,162
220
import json import unittest import pytest from shapely.errors import GeometryTypeError from shapely.geometry import LineString, Point, shape from shapely.ops import substring class SubstringTestCase(unittest.TestCase): def setUp(self): self.point = Point(1, 1) self.line1 = LineString([(0, 0), (2...
f317b544cdb378b41a9e370f9e5c3b28bff06c2770425aa1fe7de26dcc652008
Python
21,186
550
"""Assortment of CNN architectures for single cell segmentation""" from tensorflow.keras import backend as K from tensorflow.keras.models import Model from tensorflow.keras.layers import Conv2D, Conv3D, ConvLSTM2D from tensorflow.keras.layers import Input, Concatenate from tensorflow.keras.layers import Add, Flatten ...
aae087dc6a6812130f09794b1c012ddd7fd2c081b56876813cdf086a3d404449
Python
21,194
458
import os import sys import base64 from io import BytesIO import nibabel as nib import numpy as np import plotly.graph_objs as go import matplotlib.pyplot as plt from scipy.stats import norm from matplotlib.colors import ListedColormap REPORT_TITLE = "Multi-BOUNTI report for fetal MRI" GA_MIN = 20 GA_MAX = 40 LABEL_...
61149360abc310bf91975597f02953ae673f18d221fc79f46877ed916fda3f53
Python
21,211
459
# -------------------------------------------------------- # InternVL # Copyright (c) 2024 OpenGVLab # Licensed under The MIT License [see LICENSE for details] # -------------------------------------------------------- import warnings from typing import Any, List, Optional, Tuple, Union import torch.distributed as di...
fa9a06b8df0251e1af65642467b6d347e1ebb0c5b5a3f7def33e2fc4d33999ed
Python
21,232
507
import logging from csv import DictReader from multiqc import config from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound from multiqc.plots import bargraph, table log = logging.getLogger(__name__) class MultiqcModule(BaseMultiqcModule): """ Possible mgikit output files are: 1. **Sam...
8ea665814a793c926658c7c8313a820a4f60a86c4a281c5a4116c9a9e884e254
Python
21,276
613
import numpy as np from src.microcircuit import * import logging from functools import partial, update_wrapper retry_queue = [] # wrapper for passing functions to partial, keeping __name__ attribute # needed for noise on activation function def wrapped_partial(func, *args, **kwargs): partial_func = partial(func, *...
3304200690d7e56d5083e08262064ad21d83f46812df16badca6b4309edb7737
Python
21,278
504
#!/usr/bin/env python3 """ rig_view.py =========== Rig viewer + Cheese3D features plot + 3-D annotations (data discovered in main() via data.py). Design: • Discovery is centralized in data.py. main() calls discover_dataset() and build_rig_view_inputs(), then passes ONLY paths to RigViewer. • RigViewer is data-...
2bed794692c3d4e8fc1505a1040707d67aaa281f426df258cbce050f5f53c784
Python
21,281
351
# This script plots trial-averaged loudness and word decoding accuracy across time. import argparse import os import numpy as np import pickle as pkl from datetime import datetime import matplotlib.pyplot as plt ''' Example cmd (when run from this directory; provide python script path appropriately if run from differ...
de8f875d6cc2c44931988241980722631b9aa2db3b28083993b72affefc1547a
Python
21,305
568
""" Bpod Interface for EthoPy ========================= This interface adapts the Bpod hardware system for use with EthoPy experiments. It provides non-blocking event detection and integrates with EthoPy's interface system. This interface runs event detection in a background thread while allowing the main experiment ...
d84ad7a7a14f2830f68df6c7c8cb4a22c32af9bc9bd12b371ed4abcf8de0c44f
Python
21,310
487
import logging import os.path from typing import Dict from multiqc import config from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound from multiqc.plots import bargraph log = logging.getLogger(__name__) class MultiqcModule(BaseMultiqcModule): """ **Note** - because this module shares samp...
ab67a8e97e458d8ec42ee20b9a440e1228c07d2106d3e06102ec2ea71c70f7d4
Python
21,336
470
'''Warning - this script reruns FreeSurfers recon-all on all images and therefore takes very long to run''' import numpy as np import subprocess import os import datetime import glob from recon_register import Run_Recon_All_Again, Run_Long_Stream from utils import SortFiles run_RR = False run_no_RR = False run_long = ...
5442c123052128d1f5077ed7afc7bb4b6c6cc03ad990249d9f85514b83af5375
Python
21,343
754
#!/usr/bin/env python # -*- coding: utf-8 -*- import time from pathlib import Path from tempfile import TemporaryDirectory from typing import Any, Dict, List, Optional, Tuple, Type, Union import numpy as np import pytest from distributed import Client, LocalCluster from aicsimageio import AICSImage, dimensions, exce...
d58c0c4e0057cc43550d5eca0584a1bfd89a447e0716cf9447366bcc2be451d2
Python
21,354
500
import numpy as np from util import now, email_alert import pandas as pd import logging from settings.rules import * from settings.constants import * class TrialHandler(object): def __init__(self, saver=None, levels=None, rate_sum=None, stim_duration=None, stim_phase_duration=None, delay_phase_duration=None, stim...
6da2b5ae1b552dd6995f4d8141d6fe71404a4747360b1fb5346676a68b045519
Python
21,364
463
import os import sys import base64 from io import BytesIO import nibabel as nib import numpy as np import plotly.graph_objs as go import matplotlib.pyplot as plt from scipy.stats import norm from matplotlib.colors import ListedColormap REPORT_TITLE = "Multi-BOUNTI report for neonatal MRI" GA_MIN = 25 GA_MAX = 45 LAB...
36c44181d016d5cca5e51fc4471e821a4b5e2f325eebbec09472c66dd26cad3d
Python
21,373
530
# -*- coding: utf-8 -*- # # Copyright 2014 David Emms # # This program (OrthoFinder) is distributed under the terms of the GNU General Public License v3 # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Sof...