sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
810ceebb3dc431c8ab465c1bd15bddd819f9b0a5c013a4319c6da23c28b025c1
Python
17,951
516
import torch import torch.nn as nn from celltype_ibl.models.linear_probe import classifier_probe_train_val from celltype_ibl.utils.ibl_data_util import ( get_ibl_wvf_acg_pairs, get_ibl_wvf_acg_per_depth, ) from celltype_ibl.models.BiModalEmbedding import ( BimodalEmbeddingModel, SimclrEmbeddingModel, ) ...
e25e63952df503e6756aa130d56c5be6d22c20902e92946c5e838bb9a6290332
Python
17,960
508
#!/usr/bin/env python ## - Reference-dependent approach """Import modules""" from __future__ import print_function import sys import os import argparse import numpy as np import Bio.PDB from Bio.Cluster import pca from Bio.PDB import Entity, Chain, Residue, Atom, PDBParser import time # from itertools import chain # f...
2787edd917a944cc89abf8b7dddfccbb45862c18f75e35bef48daa8300fabdcb
Python
17,963
466
import itertools from functools import reduce from operator import mul import numpy as np from pgmpy.factors.discrete import DiscreteFactor from pgmpy.independencies import Independencies from pgmpy.utils import compat_fns class JointProbabilityDistribution(DiscreteFactor): """ Base class for Joint Probabil...
0cb34de92f2728d34bdacccfae9faca55b17c21818b6a40628c37afcc7b45a73
Python
17,965
498
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from dataclasses import dataclass, field import itertools import json import logging import os from typing import Optional from argparse impor...
65b76128a8fb5b217bfea3e7281182d7b3a3f8ed9e48e65e66888b83d8b80d77
Python
17,974
493
#!/usr/bin/env python # coding: utf-8 # In[1]: import sys #sys.path.append('./') #sys.path.append('../') #sys.path.append('../..') import os import pandas as pd from sklearn import preprocessing import string from typing import Sequence, Tuple, List, Union from tqdm import tqdm import fm import torch from torch imp...
28011bea63a146d9311125f8b662d5564567651a605289d687fd3d3879409913
Python
17,980
448
# Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
4d73fdebc2be65c37151d0c65f7c7bebe1d00b27e9b18af9bf371bcb4d7fc4ce
Python
17,983
569
"""IO modules for medaka tandem.""" from itertools import groupby import os import numpy as np import pysam import pysam.bcftools import medaka.common import medaka.features import medaka.smolecule from medaka.tandem.record_name import RecordName import medaka.variant import medaka.vcf ######################### # ...
754767c17fae66f91252d0ca277d66d0b227dcadc0436063ac66741ce22cd12a
Python
17,986
715
import os from pathlib import Path import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt import numpy as np import seaborn as sns import torch from scipy.stats import pearsonr from sklearn.metrics import mean_absolute_error, mean_squared_error from sklearn.model_selection import KFold from torch_geo...
f55ea5c7d24762725662a1052cbf17329f0d9269d6927da11bcbbbefcd92b8cc
Python
17,989
373
import abc import hashlib import itertools import re import time from pathlib import Path from typing import Dict, Iterable, List, Literal, Set, Tuple, Union import polars as pl from rnalysis.exceptions import InvalidTypeError, InvalidValueError from rnalysis.utils import generic, installs, io, parsing, validation ...
ded42fd69131949b818ee185d976a773829b53487581cc53682d4bac95a42b83
Python
17,991
492
from __future__ import annotations import logging import tempfile from typing import TYPE_CHECKING import numpy as np import pandas as pd import torch from scipy.sparse import issparse from scvi.distributions._utils import _needs_cpu_detour from scvi.model._utils import parse_device_args from scvi.utils import depen...
d80804ab27bc507d0b9cb2583037e4ad5fdf3aeb023b7516505297062ca76625
Python
17,994
549
import glob import os import random from typing import Callable, List, Union import numpy as np import pandas as pd import torch from torch.utils.data import DataLoader, Dataset __all__ = [ "ResidueEnvironment", "ResidueEnvironmentsDataset", "ToTensor", "CavityModel", "DownstreamModel", "DDGDa...
5e3a836ba50fcec17f097b1521191b55e62d0c4778117f32306bdf9bb10b2e37
Python
18,022
715
import os from pathlib import Path import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt import numpy as np import seaborn as sns import torch from scipy.stats import pearsonr from sklearn.metrics import mean_absolute_error, mean_squared_error from sklearn.model_selection import KFold from torch_geo...
020253b344cdc48b649ddf3021d10246c5864807e96b2b9da5b3c08322478dac
Python
18,029
454
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Apr 24 08:11:52 2025 @author: vbp Batch analysis for Figures 1F, 1G, 1H and 2B, 2C, 2D, 2E. Sorts files from each target into subfolders and plots per-subfolder data. Data can be downloaded here: https://doi.org/10.17605/OSF.IO/DV724 """ from iterto...
dccf413c9ddb30d2bf73402b1973a1e166d044fc1e187dcfa1ebad44ab9b5272
Python
18,034
715
import os from pathlib import Path import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt import numpy as np import seaborn as sns import torch from scipy.stats import pearsonr from sklearn.metrics import mean_absolute_error, mean_squared_error from sklearn.model_selection import KFold from torch_geo...
4262a7c64c607853e8752d49fa72170349c918448a8aaea34ba663c6931d670b
Python
18,056
427
import nibabel as nb import numpy as np def load_mgh(filename): """ import mgh file using nibabel. returns flattened data array""" mgh_file=nb.load(filename) mmap_data=mgh_file.get_data() array_data=np.ndarray.flatten(mmap_data) return array_data; # function to load mesh geometry def load_mesh_geo...
810de690ce3e73cac2671f018c9eebd503d3bf5b2281d3f26955445025d2a4ec
Python
18,065
409
import numpy as np import zarr import cv2 import os, shutil from pathlib import Path from matplotlib import pyplot as plt from matplotlib.colors import ListedColormap import zarr from numcodecs import Blosc import pandas as pd from PIL import Image import skimage import pickle #create a WSIAnnotation class class ROIA...
ac7238bcc6f5def17a24cc57402f1b80e51982dd45652868f98d26ef1615ea1c
Python
18,069
502
#!/usr/bin/env python -u # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import ast import hashlib import logging import os import shutil import sys import re from dataclasses import datacla...
62705734e9edbe0d9f634f030c7975fda671009c578bded267199925e2dca57f
Python
18,070
715
import os from pathlib import Path import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt import numpy as np import seaborn as sns import torch from scipy.stats import pearsonr from sklearn.metrics import mean_absolute_error, mean_squared_error from sklearn.model_selection import KFold from torch_geo...
ea6e6341071af2134016f036d4fd2f9cc3e88277b5857ea73df2d21e6251a27f
Python
18,078
760
import os import csv import math import re import warnings from pathlib import Path from concurrent.futures import ProcessPoolExecutor, as_completed import numpy as np import torch from rdkit import Chem, RDLogger from scipy.spatial import distance_matrix from torch_geometric.data import Data from tqdm import tqdm wa...
8962bef7cb7c77c8af343ebb2252be3ddf35000644f73ff322fb0815c1b6b26a
Python
18,085
468
import copy from typing import Optional, Any from collections import defaultdict from tqdm import tqdm import torch from torch import nn from torch.utils.data import DataLoader from simulation_encoder.logger import Logger from simulation_encoder.loaders.loader import Loader from simulation_encoder.models.rbm import R...
0b471224ec34dad6cb0092e10de58cdf6345b3fcac325b8c347d2929f8893dbf
Python
18,109
553
""" This module contains the experiment class, mouse class, schedule class, and trial class. """ """ Copyright (c) 2019, 2022 [copyright holders here] This file is part of NoSeMaze. NoSeMaze is free software: you can redistribute it and/or modify it under the terms of GNU General Public License as published by the...
b5ca8baf06c434692f8bbb156be49c868f858b617dc3e98d77d93e5d08f01905
Python
18,120
511
from __future__ import annotations from pathlib import Path from typing import TYPE_CHECKING from typing import Any import pytest from cleo.io.buffered_io import BufferedIO from packaging.utils import canonicalize_name from poetry.core.constraints.version import Version from poetry.core.constraints.version import pa...
a3c495df03976f045277226d01a9379778ae0368f51354efc095f0f19575082b
Python
18,128
491
import collections import os import pathlib import rootutils from typing import ( Any, Callable, Dict, Iterable, List, Literal, Optional, Tuple, Union, ) import pandas as pd import hydra import lightning as L import omegaconf import torch from loguru import logger as log from tqdm im...
b79931d3994623e9b4e0f5240cf7bf090feba8a0024ded88fcff04549c9c290b
Python
18,130
476
import math import torch as th from torch import nn, Tensor from dataclasses import dataclass from typing import Tuple, NamedTuple from einops import rearrange, repeat from utils import M2H from config_base import BaseConfig from .nn import conv_nd, linear, timestep_embedding from .MBAblocks import ResBlockConfig, At...
02fc8d9fbc2e86154b233307f854853201daf2146dad02456230d2608d800389
Python
18,132
460
import argparse import itertools as it import logging import os from functools import partial from typing import Sequence import jax import kfac_jax import optax from args import add_transferable_args from oneqmc import train from oneqmc.analysis.energy import extrapolated_energy_convergence_criterion from oneqmc.cli...
3aaddf186006bdeed336bb013a2bfc152417872c9e1ebd9b7480a7708bdacdd1
Python
18,164
428
""" Mapping helpers """ import numpy as np import pandas as pd import scanpy as sc import torch import logging from scipy.sparse.csc import csc_matrix from scipy.sparse.csr import csr_matrix from . import mapping_optimizer as mo from . import utils as ut from . import spatial_weights as sw logging.getLogger().se...
e445dacffee5f7d3b7aef196b9f67a9e5f69024b8223162f7693ed34faaab5f5
Python
18,171
408
"""Continuum-radius provenance and audit helpers. The values used by Amber's continuum-solvation routines live in the final prmtop arrays. This module records those values without attempting to infer or silently change a force-field/radius parameterization. """ import csv import hashlib import json import logging fr...
668c9ab4631b87442bb93e9e4ff8ee75162585c09b16a3ab2e06db03e01b0288
Python
18,173
582
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Wrapper around various loggers and progress bars (e.g., tqdm). """ import atexit import json import logging import os import sys from col...
822ceacb8e1ac5b1e7196a9617a7158eb8bd436cdc0c151de5a36cf9333b4291
Python
18,175
510
"""Utils for the compositionality project.""" from typing import Dict, Iterable, List, Optional, Tuple, Union from pathlib import Path import amrlib import networkx as nx import nibabel as nib import numpy as np import pandas as pd import penman from datasets import load_dataset from loguru import logger from nilearn...
22dfd6bdbffc198fd17b271ba6cee9c939d00812921613884419bc61366aedbe
Python
18,192
463
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import contextlib import logging import os from collections import OrderedDict from argparse import ArgumentError import torch from fairseq i...
49239ab294222d599a7a68a90ae8a054039ca27e8a9d668fa8fced0290c8d69e
Python
18,212
439
import gc import logging import os from collections import defaultdict from functools import partial from pathlib import Path import anndata as ad import numpy as np import pandas as pd import zarr from scipy.stats import norm from tqdm.contrib.concurrent import thread_map import gsMap.utils.jackknife as jk from gsMa...
5c809fd016870fa6fd50e770e990a5917a5554857f19f599c0b20e2138e7b843
Python
18,251
462
"""Function that trains models in the frame classification family.""" from __future__ import annotations import datetime import json import logging import pathlib import shutil import lightning import joblib import pandas as pd import torch.utils.data from .. import datapipes, datasets, models, transforms from ..co...
1f2aaa22c0fade6d13d5003879b272cf3165f484dd71568fac1decba74b4c1b8
Python
18,256
451
import inspect import itertools import pytest import torch import vak from .conftest import ( MockAcc, MockDecoder, MockEncoder, MockEncoderDecoderModel, MockModel, MockModelFamily, MockNetwork, other_loss_func, other_metrics_dict, OtherNetwork, OtherOptimizer, ) from .te...
990115ba025aad892ba860ad9adebbcdb2fab97561608b2d1fe7359db515f463
Python
18,275
518
"""Cluster summary sheet helpers for telemetry workbook exports.""" from __future__ import annotations import re from pathlib import Path def populate_cluster_sheet(exporter, writer, sheet_name, cluster_number): worksheet = writer.book.add_worksheet(sheet_name) exporter.app.bold = writer.book.add_format({"...
b6de02fae3304b55c48911a3b7cdeb43b1b5ce9e6d366841a0be5be78958d72c
Python
18,294
400
import copy import os from PyQt5.QtCore import pyqtSlot, Qt, QPoint, QUrl from PyQt5.QtGui import QDesktopServices from PyQt5.QtWidgets import QWidget, QAbstractItemView, QMenu, QWidgetAction, QLabel from mdt.gui.maps_visualizer.actions import SetDimension, SetSliceIndex, SetVolumeIndex, SetColormap, SetRotate, \ ...
0962b6df1a293a61140f92dc64132e4c4a0153086caab1c6e44adcd7c2c17981
Python
18,295
374
""" correct_and_normalize.py ======================== Corrected combined MS transcriptomics normalization pipeline. Root causes of inflated DGE results: 1. Raw count datasets (max ~ 50,000–75,000) NOT properly log2-transformed 2. neuroCombat applied to mixed-scale data → LFC ±3000 3. No within-dataset quantile n...
706d67027c4dcdd9a7f3c0dc72a5d0115e172065e6b32c18b2211e72c8271a5f
Python
18,297
529
"""Main module.""" import numpy as np import torch import torch.nn.functional as F from torch.distributions import Normal, Poisson from torch.distributions import kl_divergence as kl from torch.nn import ModuleList from scvi import REGISTRY_KEYS from scvi.distributions import NegativeBinomial, ZeroInflatedNegativeBin...
17671308962a14afd16a4ac50ede38813fffebb2095ff03f87b3a0ce5a845dbc
Python
18,303
414
#!/usr/bin/env python3 """Analyze experiment results from exp_results.csv or exp_results_merged.csv. Usage: python analyze_results.py --exp A # hyperparameter scan pivot table python analyze_results.py --exp B # RC + Markov learning curves (all configs) python analyze_results.py --exp C ...
e03769f6a2e8ea4d6171c820e255603351b360cbf145422387d46a01e5af3e33
Python
18,320
452
import sys import numpy as np import polars.selectors as cs import pytest from rnalysis.utils.differential_expression import * class TestLimmaVoomRunner: @pytest.mark.parametrize( 'data,design_matrix,comparisons,random_effect,expected_path', [ ( 'tests/test_files/big_...
033a9c721ccdaaa3b904b9d448e3bb3b0cd577694076a47d957d32708d48017f
Python
18,324
495
""" EPI distortion simulation methods for DWI warping. This module contains three different approaches to simulate EPI distortion: 1. PSF-aware convolution method 2. k-space forward model method 3. Splat-based displacement method """ import numpy as np import torch import torch.nn.functional as F from scipy.ndimage...
166802461d9a953741ee9ba0895b1ce4bee8f1a5de4abf9c1ba23140cb154bc5
Python
18,339
440
# -*- coding: utf-8 -*- import sys from PySide6.QtCore import (QRect, QThreadPool, Slot, QObject, Signal, QThread) from PySide6.QtGui import (QFont) from PySide6.QtWidgets import (QApplication, QFrame, QLCDNumber, QMainWindow, QMenuBar, QRadioButton, QStatusBar, QWidget, QLabel, QPlainTex...
de42403cab79ee934ee8c633b5d1fea0935e9c00474d07b430180f714167d0b3
Python
18,339
468
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import datetime import hashlib import logging import time from bisect import bisect_right from collections import OrderedDict, defaultdict fro...
749ecfd7b6ffd998b57283df7bffe4f93436741df6b7213583b0f09066c59530
Python
18,341
442
# -*- coding: utf-8 -*- import sys from PySide6.QtCore import (QRect, QThreadPool, Slot, QObject, Signal, QThread) from PySide6.QtGui import (QFont) from PySide6.QtWidgets import (QApplication, QFrame, QLCDNumber, QMainWindow, QMenuBar, QRadioButton, QStatusBar, QWidget, QLabel, QPlainTex...
852b9271774bbe779345e40456ac9964a9215ced082f66e81027f189d64f0f78
Python
18,342
403
import re from copy import deepcopy, copy import numpy as np from mdt.component_templates.base import ComponentBuilder, ComponentTemplate from mdt.lib.components import get_component, has_component from mdt.models.compartments import DMRICompartmentModelFunction, WeightCompartment, CacheInfo from mdt.utils import spher...
8f8f43c53d1b97aaed828f433c4c1c64d3f709d6395cd07a0e30413b2ff43d8a
Python
18,348
484
from __future__ import annotations import io import logging import warnings from contextlib import redirect_stdout from typing import TYPE_CHECKING import anndata import numpy as np import pandas as pd import torch from anndata import AnnData from scvi import REGISTRY_KEYS, settings from scvi.data import AnnDataMana...
1fd8e013ed90bde3e12fffdec116aa6f352a957b63414eeb696161cc4993bce0
Python
18,349
498
""" Multiple Instance Learning (MIL) Pooling Modules Aggregates variable-length sequences of patch embeddings into fixed-size representations using attention-based pooling mechanisms. Classes: - AggregateThenClassify: Attention-based MIL with gated attention - ClassifyThenAggregate: MIL combining attention po...
ec2b95ad50930efc474f722d85f2c17590455e93370e204027573fd31e252f17
Python
18,362
554
"""Inference-only support for the deprecated GPN-MSA family.""" from __future__ import annotations from pathlib import Path from typing import Any import numpy as np import pandas as pd import torch from datasets import Dataset, disable_caching from jaxtyping import Float, Int from torch import Tensor from transform...
9ef1989bc14e9911652756618af86fa24353fbb08d1c21b3916a6f2350fe9377
Python
18,373
414
#!/usr/bin/env python """Benchmark two implementations of a function and ASSERT their outputs are equal. This is the harness half of the ``safe-optimization`` skill (``.claude/skills/safe-optimization/ SKILL.md``): "faster" only counts once you can prove the output did not change. The core idea, independent of any par...
fadbb5a4c93be638309a3425518dc093f8c49a10776c70ff4f8b4e4e86c1f11f
Python
18,373
473
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Apr 22 10:31:20 2026 @author: vbp Figure S3: larger time-window version of the region-specific dopamine analysis (panels A-E), including baseline drift across trial types and across session time. Data can be downloaded here: https://doi.org/10.17605/O...
08a231faa823b994df1c8526b2087c6a5f47794a7d0d3fda09302723681d2b13
Python
18,374
431
import nibabel as nb import numpy as np def load_mgh(filename): """ import mgh file using nibabel. returns flattened data array""" mgh_file=nb.load(filename) mmap_data=mgh_file.get_fdata() array_data=np.ndarray.flatten(mmap_data) return array_data; # function to load mesh geometry def load_mesh_ge...
a84962cc2d273ec651ea11e767ac13270ad7c8d028dd3abf47de3d1fc2a54e4b
Python
18,374
560
import os import numpy as np import pandas as pd import torch from torch.utils.data import DataLoader, Dataset __all__ = [ "ResidueEnvironment", "ResidueEnvironmentsDataset", "ToTensor", "CavityModel", "DownstreamModel", "DDGDataset", "DDGToTensor", ] class ResidueEnvironment: """ ...
7b74c32ea48de1523b5c930ec5c6d9b2495c96a8b1a4b3ef5c93666ab1290198
Python
18,377
536
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # Adapted from https://github.com/txie-93/cdvae/blob/main/cdvae/common/data_utils_test.py. # Published under MIT license: https://github.com/txie-93/cdvae/blob/main/LICENSE. from collections import Counter from itertools import product from typi...
de85fe7e5daa1ca247342bb48a9fe32732d01526565c4294fb4644a0e707d975
Python
18,387
453
# # Copyright 2017 National Technology & Engineering Solutions of Sandia, LLC # (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Government # retains certain rights in this software. # # See LICENSE for full license details # from __future__ import annotations from dataclasses import dataclass f...
78f8a397129e6c1f99a722425d28927a801156903e7e9b801437dd317e5f39c9
Python
18,391
401
import warnings import numpy as np import pandas as pd import nibabel as nb import seaborn as sns import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import matplotlib.colors as mcolors from scipy import stats from scipy.stats import spearmanr from pygam import LinearGAM, s from meld_classifier.meld_...
cc37ca65281e5337b36454896f05263e5829be7682b2415d31455a90fadd781e
Python
18,391
410
import os import torch import numpy as np import skimage.io as skio import torch.nn.functional as F import argparse # from tqdm import tqdm import tqdm from scipy.io import savemat import matplotlib.pyplot as plt import matplotlib.cm as cm import time from utils import * import csv from torch.fft import fftshift, ifft...
c6137c9f609c3ef898252c2272f8837759a196bdc9b65050fe283faa696823ff
Python
18,395
314
import warnings import numpy as np from copy import deepcopy from typing import Union, List, Tuple from dynamic_network_architectures.architectures.unet import ResidualEncoderUNet from dynamic_network_architectures.building_blocks.helper import convert_dim_to_conv_op, get_matching_instancenorm from nnunetv2.preproces...
189e707c3a766c13bccfbfe6775c2e05f8035680b6b573be4b2a712b84e3e7c4
Python
18,408
411
import gzip import re import subprocess from dataclasses import dataclass from pathlib import Path import pandas as pd ROOT = Path("__MS_GEO_ROOT__") OUT_DIR = ROOT / "Stratified_Analyses" EXPR_META_PATH = ROOT / "Expression_Data" / "Corrected_Metadata_ComBat.csv" EXPR_MATRIX_PATH = ROOT / "Expression_Data" / "Corr...
159866961f8d01f57fff421fdea731b9c831895f7148c25bf8921c0004c9fc75
Python
18,420
456
from typing import Dict, Tuple, Optional import torch import torch.nn as nn import torch.nn.functional as F try: from monai.networks.nets import BasicUNet as MonaiBasicUNet except Exception: # pragma: no cover MonaiBasicUNet = None # type: ignore[assignment] from dgr.utils.warp import grid_warp_x, grid_war...
f78b42d82e0fbfe690eefd36688be880afab86e5bff23dcce6c104e34b87ffe4
Python
18,430
514
"""Creation of consensus sequences from repetitive reads.""" from collections import namedtuple from concurrent.futures import ProcessPoolExecutor import functools import os from timeit import default_timer as now import warnings import mappy import numpy as np import parasail import pysam import spoa import medaka.a...
3af701700bcbb0890deac69160c4504e0e100400bb293095ea304c343fdb60f5
Python
18,431
380
import os from pathlib import Path import joblib import numpy as np import pandas as pd from joblib import Parallel, delayed from analysis.metrics import computeDelta from analysis.utils_neuralData import load_MonkeyNeurons_pooled_rates, load_targetCategories, load_MonkeyNeurons, \ get_SiteReliability selfsuperv...
a9d0116f698687c33fe0ced1711302517391a6f262c08ab1df810b307a115fdf
Python
18,459
535
# -*- coding: utf-8 -*- """ LASSO Logistic Regression for Binary Classification Path-based final version Input folder example: C:\\Users\\win\\Desktop\\CHJ\\Lasso\\Larm Input Excel files: Processed_Sensor_Data_Averaged_1min.xlsx Processed_Sensor_Data_Averaged_2min.xlsx ... Processed_Sensor_Data_Av...
314924cfec779a39824ef3fd158d6143ae16aae46266acf8ea9bc8ae7095a22e
Python
18,465
540
import difflib import itertools import platform import re import shlex import unicodedata import warnings from collections import Counter from itertools import islice from pathlib import Path from typing import Any, Dict, Iterable, List, Literal, Tuple, Union import lazy_loader as lazy import mslex import numpy as np ...
de4dab7647e7c24a443b91f196f838206d308aff31c4d24d42cf0364b78205c6
Python
18,467
474
"""Creation of vcf files from network outputs or consensus sequences.""" import collections import itertools from timeit import default_timer as now import intervaltree import numpy as np import pysam import medaka.common import medaka.datastore import medaka.vcf def apply_variants(variants, ref_seq): """Apply ...
12977299221bcc32340a55b92927ed767d5b78198101673b09fcb3c19756d6b5
Python
18,470
553
import math import torch import torch.nn as nn from torch.nn import init class Input(nn.Module): def __init__(self): super(Input, self).__init__() def forward(self, x): return x class ConvHole2D(nn.Conv2d): def __init__( self, in_channels, out_channels, k...
3abf360da2bb0d04015a1ec485afea1fa0f401fff96e1fe56389eb326cf1c43e
Python
18,479
423
import unittest from unittest.mock import patch from pyecharts import options as opts from pyecharts.charts import Geo from pyecharts.faker import Faker from pyecharts.globals import ChartType, SymbolType class TestGeoChart(unittest.TestCase): @patch("pyecharts.render.engine.write_utf8_html_file") def test_g...
c79ca7db7a9eb8326d6bee08373b9e0a85ee3ee9ab1bd0320bd6b392ed2df74e
Python
18,486
576
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import json import logging import os import random from pathlib import Path import numpy as np import torch import torch.utils.data from . ...
d60b957d9fc7b72a9de291df9c032e933ca1f038e05b57e18a7ada512888210c
Python
18,490
522
import logging import warnings from typing import Literal import numpy as np import pandas as pd import rich.table from anndata import AnnData from pandas.api.types import CategoricalDtype from scvi import settings from scvi.data import _constants from scvi.data._utils import ( _check_nonnegative_integers, _m...
34c5541b27bd8a61f06a7ff5dd2747e15316819a9eb08a0a689e1cd73f5eda18
Python
18,493
350
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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://w...
9c8911edba72173629437a45230cd781edfc7e760cbb832b1af9543f5abb44a3
Python
18,498
539
"""Where a relation candidate comes from: the tagger's spans, the store's links. `forward` runs the span tagger over the hidden states it already has, cuts its argmax into typed spans, and grounds each span in the exact mentions the label store holds for that document. What comes out is a candidate *set* per argument,...
b8039cd4f044a909d17acb8e666ac4da100ac9bd58e90c78b961567da0be97c7
Python
18,504
507
import abc import functools import itertools from pathlib import Path from typing import Callable, List, Tuple import matplotlib import matplotlib_venn import numpy as np import pandas as pd import upsetplot from matplotlib import pyplot as plt from matplotlib.backends.backend_qtagg import FigureCanvasQTAgg, Navigatio...
b4bb7870b3ab10c76ced28ca70c816f769c0899cbadb13fefb9be41060f5c9fe
Python
18,513
490
"""Figure 4 — trimodal (WF+ISI+ACG) classification benchmark on Hull and Lisberger. Reads cached prediction CSVs that ship with the repo, computes per-fold balanced accuracy and macro F1, and generates bar charts and confusion matrices for: Hull mouse cerebellar cortex (101 neurons, 4 cell types) Lisberger ...
60a04e8109dc339856f57db157b2ad7d0370530e35d5d01a5cb98813885c5f1c
Python
18,519
512
# Copyright 2022 InstaDeep Ltd # # Licensed under the Creative Commons BY-NC-SA 4.0 License (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://creativecommons.org/licenses/by-nc-sa/4.0/ # # Unless required by applicable law or a...
bc5948e88ed00aa67b7b3f03e3f608f6466645adbbabfeac0a613da419427123
Python
18,535
448
import logging import numpy as np from keras import Input from keras.engine import Model from keras.layers import Dense, Dropout, Lambda, Concatenate from keras.regularizers import l2 from data.data_access import Data from data.pathways.gmt_pathway import get_KEGG_map from model.builders.builders_utils import get_pne...
37c064c07d92aff9b41d7d49d9d87b8fb1ecdadd337b68ffa474a5412f61f332
Python
18,540
644
import pandas as pd from collections import defaultdict import re from collections import defaultdict GO_ID_REGEX = re.compile(r"GO:\d{7}") # ---------------------SEGMENT TO PROTOTYPE MAPPING ---------------------# def add_residue_to_prototype_mapping(segment_assignments, prototype_assignments): ""...
e28d97a386c534967334eb6a3b97b84db3a95042731233acdb8be90ce36c8438
Python
18,546
407
#!/usr/bin/env python """ pipeline for processing voltage imaging data for zebrafish lightsheet data author: @Jack Zhang """ import scipy.io as sio import cv2 import os import glob import h5py import logging import matplotlib.pyplot as plt from matplotlib.pyplot import savefig import numpy as np import os try: cv...
88d1d77a25607421c42553d13983cb03e4961a5dabeea59c64e399dc8ff44879
Python
18,555
451
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Mar 27 11:31:26 2024 @author: Roxana """ import numpy as np import scipy.sparse as sp import torch import torch.nn.functional as F from tqdm import tqdm from .preprocess import ( preprocess, construct_interaction, construct_interaction_KNN...
dc428568253f78acb73ef4461cd0088d41af3ccd4b375af1ab9dc3b82d7f1858
Python
18,566
377
## script for plotting boxplots and scatter plots of simple stats such as count of approaches, count of interactions, chasings etc... import matplotlib.pyplot as plt import numpy as np import igraph as ig import networkx as nx import pandas as pd import os import sys import pandas as pd import seaborn as sns from scip...
e6fde1b408b38d0a92ac500436c6bdeef06e18257dda7dd72c2f69e4dbd69179
Python
18,568
547
""" Visualization script for Garfield spatial scalability benchmark results. This script generates publication-quality figures showing: - Runtime vs dataset size for all major tasks - Memory consumption vs dataset size - Comparison of different graph construction methods - Breakdown by task category """ import os imp...
c861602be92e180df5626fffd174420bd40362696f39857a53455150c17665a7
Python
18,580
478
import os from os import makedirs from os.path import join, dirname, realpath, exists import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from matplotlib import gridspec from mpl_toolkits.axes_grid1 import make_axes_locatable from sklearn.preprocessing import MinMaxScaler from...
70358066bbe5ea163bee2442164b4b75cc7669f5ff0aa2a9fcd14a131e1207b9
Python
18,584
562
# Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the LICENSE file in # the root directory of this source tree. An additional grant of patent rights # can be found in the PATENTS file in the same directory. import logging from collections.a...
339c7f90169d8f7445885663317ecfe992e4e04898f1ccd2b495677fd6c36e25
Python
18,586
434
import os import torch import numpy as np import skimage.io as skio import torch.nn.functional as F import argparse # from tqdm import tqdm import tqdm from scipy.io import savemat import matplotlib.pyplot as plt import matplotlib.cm as cm import time from utils import * import csv from torch.fft import fftshift, ifft...
aad9fa866741041ca8db0f9d65af2f1328d89f1ac6519f61d1368617465462d6
Python
18,590
599
# -*- coding: utf-8 -*- """ Created on Wed Feb 19 14:21:51 2025 @author: hanna """ #%% """ [Figure 6] changes in modulation depth """ #%% import os import pickle import numpy as np import pandas as pd from tqdm import tqdm import seaborn as sb import matplotlib as mpl import matplotlib.pyplot as plt from m...
1595b58dcd4bbb36daba0c6c847f3b5a38c1f79f9095fb3ba60132475b8499ba
Python
18,591
459
from dataclasses import dataclass, field from typing import Any, Callable, Dict, List, Mapping, Optional, Tuple, Union import torch import numpy as np from .preprocess import binning @dataclass class DataCollator: """ Data collator for the mask value learning task. It pads the sequences to the maximum l...
bfa054bf6ca775f1b661d33970062161ce064f860ebb8b1ae9184d8c30555b9d
Python
18,592
519
"""Storing of training and inference data to file.""" from abc import ABC, abstractmethod from collections import defaultdict, OrderedDict from concurrent.futures import \ as_completed, ThreadPoolExecutor import contextlib import os import pickle import tarfile import tempfile import warnings import numpy as np im...
5a37a9a172c83c286cd45d9387051d7cc09634bc7f635e11e7615da636860251
Python
18,602
491
from typing import Optional, Tuple import torch from torch import Tensor, nn try: from einops import rearrange except (ImportError, OSError): rearrange = None flash_attn_backend: Optional[str] = None flash_attn_error: Optional[str] = None try: # flash-attn 1.x (preferred - simpler public API) from f...
227af55984d9461ec53a01e70e1a8a9343ae60c3a1824edba3bf96f16ee59dd6
Python
18,616
434
import matplotlib.pyplot as plt import matplotlib.patches as patches import seaborn as sns import networkx as nx import math import numpy as np # ======= Plotting functions for run_pipeline.ipynb ======= # specific to the provided example data set - could be adjusted to own needs def flow_chart_step_1(figsize=(8,6...
aa0eb9cdf9ec3c53205aa417f56ab075f6d109e7ac637c3f97a0df756fa15063
Python
18,618
559
""" Operon completion eval pipeline using Evo. Usage: python pipelines/operon_completion.py --config <config_file_path> """ import argparse import logging import os import subprocess import sys import tempfile from collections import Counter from dataclasses import dataclass, field from pathlib import Path from typin...
3f6221b50f1ec4b89a4af3592127957a1e469890fd71879fbcfb085ce2d0920b
Python
18,620
576
from nipype.interfaces.workbench import base as wb from nipype.interfaces.base import BaseInterface, BaseInterfaceInputSpec, traits, File, Str, isdefined, TraitedSpec, CommandLineInputSpec from traits.api import List # convert cifti to nifti and back # this interface was drafted by ChatGPT then heavily modified by BP....
19ae6c65532c9a5d238c7237e08fc174a4a5aa99622beef1d79425c0401ef05d
Python
18,625
545
""" This module implements sequence classification. Author: wangning(wangning.roci@gmail.com) Date : 2022/12/7 7:42 PM """ import math import os.path as osp import time import copy from collections import defaultdict from tqdm import tqdm import numpy as np from Bio import SeqIO import paddle import paddle.nn as n...
e408fba489912f59b5344c0ea303d16b10f9648228ca17f2532dce04e8876748
Python
18,630
448
import torch import wandb from utils.data.dataholder import DataHolder from utils.data.load import remove_mean_with_mask from utils.diffusion_model.diffusion.diffusion_utils import ( cosine_beta_schedule_discrete, ) class NoiseModel: def __init__(self, cfg): """ Initialize the NoiseModel with ...
b9a27fc07004e57c4798770ecbe8f001c5dbfb0b44316cd62487cd3b95b47ec9
Python
18,632
454
"""Generate a diffusion map embedding """ import numpy as np has_sklearn = True try: import sklearn except ImportError: has_sklearn = False def compute_diffusion_map(L, alpha=0.5, n_components=None, diffusion_time=0, skip_checks=False, overwrite=False, eige...
1c39db8b78614716b61671e4e9e9d50f64453a7cf5ad5a55351cdf461a5d93cd
Python
18,634
481
# -*- coding: utf-8 -*- # Copyright (C) 2017-2023 Phillip Alday <me@phillipalday.com> # License: BSD (3-clause) """MNE-based functionality not further categorized.""" from collections import namedtuple # noqa: I100 import matplotlib.pyplot as plt import mne # noqa: F401 import numpy as np import pandas as pd fr...
ae32a23fc39c366761b2cd11b939f65c9ce7ef5c506b78c7b5496cffde1dc16e
Python
18,640
504
from neuron import h, gui import math import time import random import numpy from matplotlib import pyplot as plt #cell that contains only 1 spine which is randomly located on the dendrite class cell() : def __init__(self, name="cell", gid=0, dend_nseglevel=1): #random.seed(1) #use the same seed to get...
5bf810e735644ff12c81178626c61fcc38584e57564789db51e2fd760cba0077
Python
18,642
569
from __future__ import annotations import csv import json import os import shutil from pathlib import Path from typing import TYPE_CHECKING import pytest from cleo.io.null_io import NullIO from poetry.core.constraints.version import Version from poetry.core.masonry.metadata import Metadata from poetry.core.packages...
36cff56d77bfc93a09f37a55cbb17abac8f51f34730c3f19ed970ab21e9556aa
Python
18,643
557
import torch import pickle import random import numpy as np import torch.nn.functional as F import matplotlib.pyplot as plt from cellpose import plot as cplt import warnings from torch.linalg import eigvals def is_valid(pnm, gnm): for p in pnm: if p not in gnm: return False return True ...
86c41f340c8a1c2938725d6cb5b3e1df39b293c1b44193784681279b749d1617
Python
18,651
517
""" This module contains methods to generate pulse for use in DAQ. """ """ Copyright (c) 2019, 2022 [copyright holders here] This file is part of NoSeMaze. NoSeMaze is free software: you can redistribute it and/or modify it under the terms of GNU General Public License as published by the Free Software Foundation, ...
735bb40b00a69838af26fcbd642a915051edbad6eb9334bd9a2e1911a92190c4
Python
18,653
333
import argparse import os.path from copy import deepcopy from typing import Union, List, Tuple from batchgenerators.utilities.file_and_folder_operations import load_json, join, isdir, save_json from nnunetv2.configuration import default_num_processes from nnunetv2.ensembling.ensemble import ensemble_crossvalidations ...
30a3abe376255194fac9c3c39e1b1c814c766217a2c50a88f2231272c49bdbe6
Python
18,662
465
import sys import os sys.path.append(os.path.join(os.path.pardir, 'simulator')) # import numpy as np # from numpy import matlib import pandas as pd import pynumdiff # import scipy from scipy.optimize import fsolve import matplotlib.pyplot as plt from matplotlib import cm, colors from matplotlib.colors ...
1444e2e77091f8ffd40f5c6407bf35c0bc9003fb41c5877c11b4e50824d3a83f
Python
18,668
487
from collections import defaultdict from itertools import chain, combinations, tee from pgmpy.factors import factor_product from pgmpy.factors.discrete import DiscreteFactor from pgmpy.inference import BeliefPropagation, Inference class DBNInference(Inference): """ Class for performing inference using Belief...
669566c1d03e237eeb0f2b5460ea7e03fb5df5f276bb9af59b2b4b857684b6ef
Python
18,685
289
import numpy as np import pandas as pd # from https://github.com/dicarlolab/dldata/blob/master/dldata/physiology/hongmajaj/mappings.py channel_info_ChaboTito_LH = pd.DataFrame({ 'region': ['IT', 'IT', 'IT', 'IT', 'IT', 'IT', 'IT', 'IT', 'IT', 'IT', 'IT', 'V4', 'V4', 'V4', 'V4', 'V4', 'V4', 'V4', 'V4', 'V4'...