sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
e823e9ececd542fdd7305f8c5ac01597840ec52fbe95abcaf56f2ef53a6ac8b6 | Python | 6,288 | 183 | import os
# os.chdir('/Users/yikong/Dropbox (CSU Fullerton)/aResearch/DeepPINK/Documents_2020.07.04_1/real_data')
os.chdir('/home/yinfeiko/DeepLINK/rna1')
import random
import DeepLINK as dl
import numpy as np
import keras
from keras.layers import Dense, Dropout
from keras.models import Sequential
from pairwise_connec... |
f25cf7ac5a32f5881194ab75818919c893d6f7b6b55c0dd5432656ee2d7974d4 | Python | 6,288 | 183 | import os
# os.chdir('/Users/yikong/Dropbox (CSU Fullerton)/aResearch/DeepPINK/Documents_2020.07.04_1/real_data')
os.chdir('/home/yinfeiko/DeepLINK/rna1')
import random
import DeepLINK as dl
import numpy as np
import keras
from keras.layers import Dense, Dropout
from keras.models import Sequential
from pairwise_connec... |
70318088f4a5a867b5a8bd7fedc310e9b83b2650e3f25a4035df268b32ed4df8 | Python | 6,290 | 144 | #!/usr/bin/env python3
"""Join Tables 1-7 (data/tables.json) into one record per included study,
written to data/studies.json.
Join key: the Author/Year cell of each row, with any trailing footnote
markers (e.g. "^a") stripped. All seven tables must produce exactly the
same 18 keys - this script exits loudly if they d... |
393f4d0f79fbdf18fe8bf29fc1f027edaff88802aab098525e4c8c4d3f9d5408 | Python | 6,299 | 188 | from __future__ import annotations
import argparse
import sys
from collections import defaultdict
from collections.abc import Iterable, Sequence
from typing import TYPE_CHECKING, Any, Protocol, TypeAlias, TypedDict
import attrs
import pluggy
from attrs.converters import default_if_none
from typing_extensions import U... |
3c29bf5a79473b9efd1ddec80af01b93b3dd45d22e6a19734e28a369471f2884 | Python | 6,314 | 182 | """
Tutorial 0: Preparing your data for gradient analysis
=====================================================
In this example, we will introduce how to preprocess raw MRI data and how
to prepare it for subsequent gradient analysis in the next tutorials.
Requirements
------------
For this tutorial, you will need to i... |
f40793d591f8e5cf3f12e455c36870cce0f0fd36c112401619485fd5ff9584f2 | Python | 6,315 | 182 | """
Tutorial 0: Preparing your data for gradient analysis
=====================================================
In this example, we will introduce how to preprocess raw MRI data and how
to prepare it for subsequent gradient analysis in the next tutorials.
Requirements
------------
For this tutorial, you will need to i... |
e68e07e1d0a7325f9c0496e6b7f2ba137ab279fc3bdf15024661fa8c81cbac1d | Python | 6,316 | 187 | """Tests for `navis.transforms.xfm_funcs._guess_change`.
`_guess_change` estimates the order-of-magnitude change in spatial units during
a transform (e.g. nm -> um) by comparing pairwise distances before/after. These
tests use synthetic data and don't require any template-brain registrations.
"""
import numpy as np
i... |
e4276b13821cfef7e9aaac60643af64c6f1b776610d4a11b936dc7a7063e0403 | Python | 6,318 | 201 | import os
import torch
from torch import nn
import torch.nn.functional as F
import torch.distributions as dist
class LinearGELU(nn.Module):
def __init__(self, input_dim, output_dim):
super(LinearGELU, self).__init__()
self.f = nn.Sequential(
nn.Linear(input_dim, output_dim),
... |
c6cbeb99ec1f291bb4c46ef8ccfaec1040315c5d14c272608811fc2de2f8d01d | Python | 6,320 | 122 | import os
import numpy as np
import pandas as pd
import umap
import matplotlib.pyplot as plt
import scanpy as sc
import scvelo as scv
np.random.seed(42)
# read anndata
save_dir = "/home/nomura/Proj/mmvelo/experiments/multiome_brain_rep_wo_IN/2023-05-07T15:19:02_s43_k100_for_analysis/downstream_analysis/result/anndat... |
3ec5b851c5153e7f9f089f8169802cde5b7c461a5ee5c176f9bf6088b1d04ea8 | Python | 6,322 | 159 | # ---
# jupyter:
# jupytext:
# formats: py:percent,ipynb
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.16.4
# kernelspec:
# display_name: Python 3 (ipykernel)
# language: python
# name: python3
# ---
# %% [ma... |
5ff3072c3fb908f47686bd49f1010f91f2049410d631e8bcb8d4c2af137f313e | Python | 6,334 | 189 | import torch
import torch.nn as nn
import torch.nn.functional as F
# Classification loss functions
class BCEDiceLoss(nn.Module):
def __init__(self, bce_weight=0.5, dice_weight=0.5):
super(BCEDiceLoss, self).__init__()
self.bce_weight = bce_weight
self.dice_weight = dice_weight
sel... |
24f5e429386a1f33abe4fd60123cca63d6797d956c25de12bb84c65f9e07ad45 | Python | 6,335 | 162 | import torch as tc
from scipy.ndimage import gaussian_filter1d
def comp_correlation(p, q):
return tc.as_tensor([tc.corrcoef(tc.stack((p[:, n], q[:, n])))[0, 1] for n in range(p.shape[1])]).mean()
def dim_wise_wasserstein_distance(x1, x2):
"""
Calculate the dimension-wise Wasserstein distance
of batc... |
3e9a4408f501e1697c6d80ae01213dacc032e1b11759c1fc29b8e4d7b80a4d5b | Python | 6,340 | 240 | import torch
from torch import nn as nn
class BCELoss2d(nn.Module):
"""
Binary Cross-Entropy Loss for 2D data.
Parameters
----------
weight : torch.Tensor, optional
A manual rescaling weight given to the loss of each batch element.
size_average : bool, optional
By default, the... |
5360a0a1857219c4604ad7f34a1ad75a76ca8024c559c234e452407e79ffca47 | Python | 6,340 | 208 | import glob
import re
from pathlib import Path
import os
import time
import random
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader, TensorDataset
from collections import Counter
from typing import Optional
import... |
c8dd1ba073ef76eac77324eb5862eb78613e444686d5366d16c733da220e39d1 | Python | 6,340 | 230 | from pathlib import Path
import click
import click_log
import numpy as np
from ... import io
from ..._cli.utils import catch_exception, logger
from ..._steinbock import SteinbockException
from ..._steinbock import logger as steinbock_logger
def _get_deepcell_module():
try:
from .. import deepcell as dee... |
60d2c8a752fc7728d1dd10dbea35ecc4245f71c007dcd74344daa00ae30318b7 | Python | 6,341 | 240 | import torch
from torch import nn as nn
class BCELoss2d(nn.Module):
"""
Binary Cross-Entropy Loss for 2D data.
Parameters
----------
weight : torch.Tensor, optional
A manual rescaling weight given to the loss of each batch element.
size_average : bool, optional
By default, the... |
2d39672143b680ceef49a28c7cc5e0554b7ff86a05d1389208bf6a3e09be9a0f | Python | 6,348 | 147 | # This script is part of navis (http://www.github.com/navis-org/navis).
# Copyright (C) 2018 Philipp Schlegel
#
# 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 Software Foundation, either version 3 of... |
d87c4321e4f3d161e2b6ed5f6105c690c68f3b91c1b8a10e5d1d65b3c9bc977f | Python | 6,351 | 162 | from __future__ import annotations
import pytest
from rdkit import Chem
from src.validation.structure_validator import StructureValidationError, StructureValidator
def _formal_charge(molecule: Chem.Mol) -> int:
return sum(atom.GetFormalCharge() for atom in molecule.GetAtoms())
def test_stereochemistry_enumera... |
7c23597ca4053e5c31ce1a2dd246b11b00ea9783f877948d4ee8bb031a9fa586 | Python | 6,352 | 197 | ############################################################################
# Copyright (c) 2025-2026 University of Helsinki
# # All Rights Reserved
# See file LICENSE for details.
############################################################################
import os
def convert_chr_id_to_file_name_str(chr_id: str... |
830137ba2297749cc1bb31748db1ea356378d315a50bb0b511ed8ea709b9bd27 | Python | 6,353 | 193 | import numpy as np
from scipy import stats
from scipy.interpolate import interp1d
from skimage import measure
def find_ind(vector, value):
for ind, val in enumerate(vector):
if val == value:
return ind
return None
def interpolate_axis0(data, steps=0.1, kind='cubic'):
if data.ndim == ... |
7af96222c4cdc4f16741f06ad1fb49fe5f5e1bde8b784cb8fd59f3b392f9e45e | Python | 6,354 | 212 | """
ProteinMPNN utilities for node-embedding extraction.
This wrapper loads the canonical ProteinMPNN implementation from:
scripts/ProteinMPNN_to_get_emb/protein_mpnn_utils.py
using importlib to avoid circular imports caused by this wrapper having the
same module name, protein_mpnn_utils.py.
It then re-exports ... |
19ead2015424fd059a5c11e78300de621da93b800b091c4983974de791c2b60b | Python | 6,360 | 168 | #!/usr/bin/env python
# Copyright 2016-2020 Biomedical Imaging Group Rotterdam, Departments of
# Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obt... |
3be2ae09fdaced380206beab220dacabe65e729c6ab20e86a6b1177a57e58c3d | Python | 6,360 | 186 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
__all__ = [
"window_partition",
"window_unpartition",
"add_decomposed_rel_pos",
"get_abs_pos",
"PatchEmbed",
]
def window_partition(x, window_size)... |
52843bedbcfffeaa2cea70b696956f83ae29a9788275e6fad9f84df3e23f914e | Python | 6,363 | 154 |
import numpy as np
import matplotlib.pyplot as plt
from . import transformations
from sklearn.preprocessing import StandardScaler
#TO FIX: Should I add some defaults in here we could add our default response form
def simulate_evoked(start, end, fs, peak_time, peak_duration, sin_shift, plotting=False):
# Si... |
9d5f4e8a7489d0a9e998bedacb2bd3829366843e24456f13922283a2a4cd24fb | Python | 6,366 | 184 | """
code snippet to initialize the component W with, including NNDSVD method.
code snippet is copied from https://github.com/scikit-learn/scikit-learn/blob/main/sklearn/decomposition/_nmf.py
"""
import scipy
import pprint
import numbers
import warnings
import numpy as np
import scipy.linalg
from math import sqrt
impor... |
a4ed5821720a98f17346483526b2d5e6e86f1b2c809a2d2b51cb4942f881c2c8 | Python | 6,371 | 211 | """
High-level read/write functions for several formats.
"""
# Author: Oualid Benkarim <oualid.benkarim@mcgill.ca>
# License: BSD 3 clause
import tempfile
import gzip
import os
from vtk import (vtkPLYReader, vtkPLYWriter, vtkXMLPolyDataReader,
vtkXMLPolyDataWriter, vtkPolyDataReader, vtkPolyDataWrit... |
0aa11cfb05c66b095d433ee79623c676c90dad7de260ca5437d457f0cb2a1912 | Python | 6,380 | 156 | #python mqrunDash_db_verify.py --db "Z:\\Download\\mqrun.duckdb" --mode peptide --term HLSGEFGK
import argparse
import re
import sys
from pathlib import Path
import duckdb
import pandas as pd
def normalized_term(token):
return token.strip()
def token_in_semicolon_list(value, token, case_insensitive=True, ignor... |
b8bfb8e5a2cbe4ae324f623e15b306e669f1723993cadbac22deeea3e4d2347d | Python | 6,382 | 180 | """
Script to generate the data to recreate Figure 2 in the manuscript:
Benchmark spacer alignment time: comparing FuzzySearch vs. WFA (Wavefront Alignment)
with dictionary-based aligner and error-prone aligner.
This script generates synthetic spacer sequences with varying lengths and mismatch rates,
then measures th... |
42c7ec7b4d6c1f16c16926abf4460a97b94cffeb1a5b5036fce3a9302708f262 | Python | 6,399 | 205 | import numpy as np
import keras
from keras.layers import Dense
from keras.models import Sequential
from pairwise_connected_layer import PairwiseConnected
from itertools import combinations
# Design matrix generation from factor model
# Input:
# n: number of observations
# p: number of variables
# r: n... |
80bcccb04a188d8825fc7585c79af86f058931bab9401c5287fee15d00baa978 | Python | 6,413 | 188 | import importlib.resources
import inspect
from unittest import mock
import matplotlib
import matplotlib.figure
import pytest
from matplotlib import pyplot as plt
from openfe.tests.utils.test_network_plotting import mock_event
from openfe.utils.atommapping_network_plotting import (
AtomMappingNetworkDrawing,
L... |
0b7c9d4a142b97b26909f4e1e61a6e4a7d8ccd0197b18d7a3cd9199cfecbb6ff | Python | 6,419 | 173 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
# pyre-unsafe
import pickle
from functools import lru_cache
from typing import Dict, Optional, Tuple
import torch
from detectron2.utils.file_io import PathManager
from densepose.data.meshes.catalog import MeshCatalog, MeshInfo
def _maybe_copy_... |
e237341de42a48ed7e72feb6c72a12d5847c22cff0d291dc66095e1644a21d8f | Python | 6,421 | 160 | """
NBLAST using light-level data
=============================
<!-- difficulty: advanced -->
Match light-level neurons against EM skeletons with NBLAST.
!!! important "This example is not executed"
In contrast to almost all other tutorials, this one is not executed when the documentation is built.
Consequent... |
eb68c61ddc14b14006417b526a5a87363fcfe87a3a9cd8c4059c4e31f80a2419 | Python | 6,421 | 100 | if __name__ == '__main__':
from nnunetv2.paths import nnUNet_results, nnUNet_raw
import torch
from batchgenerators.utilities.file_and_folder_operations import join
from nnunetv2.inference.predict_from_raw_data import nnUNetPredictor
from nnunetv2.imageio.simpleitk_reader_writer import SimpleITKIO
... |
31a99a1184e772feadad6bf891e30de4e326f332de3d3db4a0bd16af1086d9b5 | Python | 6,424 | 208 | """Test VTK 9.4+ compatibility.
This module tests compatibility with VTK 9.4+ where the __vtkname__ attribute
is not available on some classes like PointSet.
See: https://github.com/MICA-MNI/BrainSpace/issues/128
"""
import pytest
import numpy as np
import vtk
from brainspace.vtk_interface import wrap_vtk, is_wrap... |
ea866e7f53cffdb43bccf6ba104db0548abccd74f6eb7654439199c9f52248fa | Python | 6,434 | 151 | """Figure5(実験1の各ニューロンの発火率)加算平均したERSP,制御トルクの大きさ,振子の角度,角速度)をプロットするプログラム"""
import numpy as np
import matplotlib.pyplot as plt
import myfunc0829
import os
import blosc2
# モデルの番号 (Model number 1 for the continuous controller, Model number 2 for the intermittent controller)
model_num = 2 # Figure5を作るにはモデル1から3までのそれぞ... |
e382390f948cf44f8947b068b8f5f8805151cfa36f7d383b051234c96b032509 | Python | 6,438 | 175 | #!/usr/bin/env python
#
# Copyright (c) 2021 10X Genomics, Inc. All rights reserved
#
"""Assign antibodies to cells."""
from __future__ import annotations
from typing import TYPE_CHECKING
import martian
import cellranger.feature.utils as feature_utils
import cellranger.matrix as cr_matrix
import cellranger.rna.libr... |
adcbd719e66b5cf8bd3d8e8ee36bdaef62af50ddb3001642e07d6257e6cc2bf3 | Python | 6,467 | 190 | """ Created on Tue Jul 15 12:21:27 2025
@author: dcupolillo """
import numpy as np
from scipy.ndimage import uniform_filter, median_filter
def radius_to_kernel_size(
radius_um: float,
pixel_size_xy: tuple,
ensure_odd: bool = True,
min_size: int = 3
) -> tuple:
"""
Convert ... |
778dbef00efd326e738d1e84632049fe9fdab0847c7f76a8c073ecb423b58357 | Python | 6,469 | 180 | '''
Created on Dec 17, 2024
@author: voodoocode
'''
import functools
import matplotlib
matplotlib.use("Qtagg")
import matplotlib.pyplot as plt
import copy
import scipy.signal
import finnpy.filters.frequency as ff
import finnpy.file_io.data_manager as dm
import finnpy.basic.downsampling as ds
import numpy as np
impor... |
4527a584f2486132bab7daefb3c477dd5d800541d28592a102ae851f488d7921 | Python | 6,476 | 172 | from __future__ import annotations
from pathlib import Path
from snakebids.paths._config import get_bids_func
from snakebids.paths._utils import BidsFlags
from snakebids.paths.specs import LATEST
def bids(
root: str | Path | None = None,
*,
datatype: str | BidsFlags | None = None,
prefix: str | Bids... |
97f4ff95adf9a973a2179c63a2a930118298183770f54c9089111f5abcd47a2f | Python | 6,483 | 164 | import json
import logging
from pathlib import Path
import typing
import lightning.pytorch as pl
from lightning.pytorch.callbacks import Callback
from myerson.chemprop_explain import (
MyersonClassExplainer,
MyersonExplainer,
MyersonSamplingClassExplainer,
MyersonSamplingExplainer,
)
from myerson.chemp... |
a3d43d31c6e929b1bdc2955a5d916b8309b7a853d227eb10cd6ef4d63330bfd6 | Python | 6,485 | 157 | """Figure S6 -- Imaging movement control (first 5 frames).
Panels:
A. Example recruited vs not-recruited neuron traces
B. # neurons recruited in first 5 frames, early vs late phase
C. Increasing subset: max dF/F in first 5 frames over weeks
Reads data/fig_s6/recruitment_data_first5f.mat (built by matlab/fig_s6/... |
8fbd50ab526600da402644b291ed184921e5c4da9918bc784bb0546933fefd18 | Python | 6,496 | 164 | import os
import sys
import nibabel as nii
import glob
import numpy as np
import progressbar
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
# --- Fonts & Text Display ---
matplotlib.rcParams['svg.fonttype'] = 'none' #text remains editable in SVG
matplotlib.rcParams['pdf.fonttype'] = 42 ... |
8071039353a45a7493ec804f322100fb459878fd87f80c868bcc9bf328a433ff | Python | 6,499 | 154 | import os
import glob
import re
from datetime import datetime
import numpy as np
import pandas as pd
# from util.test_impedance_analyzer import TestImpedanceAnalyzer
class ImpedanceAnalyzer:
def __init__(self):
pass
@staticmethod
def intan_to_ripple(intan_channels):
intan_t... |
c075f005d335b17cbcc05ee8250e39a7af19d7db2324adfb81acf4a836253256 | Python | 6,500 | 191 | """Internal meta-agent group object.
Meta-agents are agents composed of other agents. Memberships are tracked by
the model's membership manager (``model.meta_agents``). This module holds the
internal group ``Agent`` subclass.
"""
from __future__ import annotations
from collections.abc import Callable, Iterable
from ... |
112c90e61fe3c0a443e2aaa4ddf3724c01a5209cf7de37aaf8cead3f191cb094 | Python | 6,506 | 255 | """
Utility functions for vtk wrappers.
"""
# Author: Oualid Benkarim <oualid.benkarim@mcgill.ca>
# License: BSD 3 clause
import re
import string
from collections import defaultdict
import numpy as np
from vtk.util.vtkConstants import VTK_BIT, VTK_STRING
# VTK_UNICODE_STRING has been removed since VTK 9.2.
# See:... |
98acf9973f82aaf6726c27bb6c08cc31e760afc9bbf7b8f8e0aca2892a1b52b7 | Python | 6,506 | 163 | #!/usr/bin/env python
# Copyright 2016-2020 Biomedical Imaging Group Rotterdam, Departments of
# Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obt... |
6a27f714c51796db466e86bebba6a617c1bfc4d566f3a1756497629c1248686e | Python | 6,507 | 180 | from collections import namedtuple
import torch
from torchvision import models as tv
class squeezenet(torch.nn.Module):
def __init__(self, requires_grad=False, pretrained=True):
super(squeezenet, self).__init__()
pretrained_features = tv.squeezenet1_1(pretrained=pretrained).features
self.sl... |
99026527c5987543e3878e0e835719deab344364140acbb71e2ea5f95b103d09 | Python | 6,514 | 210 | #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
"""
A script to benchmark builtin models.
Note: this script has an extra dependency of psutil.
"""
import itertools
import logging
import psutil
import torch
import tqdm
from fvcore.common.timer import Timer
from torch.nn.parallel import Distrib... |
a38f4fac2ab6f247a9c4c6eb3b471c4354a0870a49755d8477dc260b2ef0073c | Python | 6,523 | 159 | #!/usr/bin/env python
#
# Copyright (c) 2015 10X Genomics, Inc. All rights reserved.
#
from __future__ import annotations
import os
import socket
from six import ensure_binary, ensure_str
import cellranger.vdj.chain_types as chain_types
import cellranger.vdj.constants as vdj_constants
import cellranger.vdj.referenc... |
85ed6a24ea9993188c8728978195d4c91b77309ee299458590cd56bbfab50aba | Python | 6,534 | 223 | """Drawing helpers for the Tram Route Model visualization.
Everything here is presentation: the palette, the type scale, and the
matplotlib code that turns a tram into a picture of a tram. app.py wires
these into Solara components.
"""
from matplotlib.patches import FancyBboxPatch, Rectangle
from matplotlib.transform... |
f85f46a31ac5635cd979ca4bc2a92e41419823fbc41dce611614425570be8fcd | Python | 6,537 | 191 | from __future__ import annotations
from pathlib import Path
import uuid
from rdkit import Chem
from rdkit.Geometry import Point3D
import pytest
from src.quantum.mopac_adapter import MopacError, MopacOptimizer
TEST_TEMP_DIR = Path(__file__).resolve().parent / ".tmp"
def _molecule_with_conformer(smiles: str) -> C... |
c8c1bb6f6dcb70560eae1f9b20ad641d26a48054a3a7778964648768255a7a77 | Python | 6,544 | 205 | """some summary"""
import os
from pathlib import Path
import torch
import pandas as pd
from eeg_visual_classification.utils.lib import (
create_parser,
extract_model_options,
get_dataloaders,
get_model_hash,
save_checkpoint,
load_checkpoint,
)
from ..models import MODEL_REGISTRY
torch.utils.bac... |
ec54dd419f4e26401f91d50952a01fb0799ee95b512252b610f2d732d3dac024 | Python | 6,556 | 199 | # -*- coding: utf-8 -*-
"""
Created on Wed Aug 23 09:03:36 2023
@author: huseyin.tunc
"""
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import os
import argparse
import scipy.io
from scipy.io import savemat
parser = argparse.ArgumentParser(
'Visuali... |
fc757fef1ed3d03fdb1a6eca906f1b0b9fbf7aff7b60b50963f9c0355230d058 | Python | 6,560 | 175 | import torch
from typing import Optional
try:
from mace.calculators import mace_off
from emle.models._utils import _get_neighbor_pairs
except ImportError:
mace_off = None
scatter_sum = None
_get_neighbor_pairs = None
class GmxMACEModel(torch.nn.Module):
def __init__(self, size, device, **kwarg... |
55237e8eba472e92719789fd1e2b0beb63e648d361e1f40e53711a694ffc158e | Python | 6,563 | 217 | #!/usr/bin/env python3
"""
Full pipeline test for LaMAR.
This script runs a complete registration workflow using the example data
and verifies that all output files are created correctly.
"""
import os
import sys
import subprocess
import nibabel as nib
import shutil
import time
import argparse
import numpy as np
from... |
c9d2ba175901b90072e7a5e7ffa01dff2c686cb1f896e847392deca8af32b734 | Python | 6,563 | 240 | import numpy as np
import pytest
import chemprop
from chemprop.cli.common import find_models
from chemprop.cli.main import construct_parser
from chemprop.cli.utils.parsing import get_column_names, parse_indices
from chemprop.cli.utils.utils import _to_str, format_probability_string
def test_parse_indices():
"""
... |
46523510b0b60a169ef8886ce16ee8c2936525bf8f0fa69137d4b95a4f0479b5 | Python | 6,566 | 184 | #!/usr/bin/env python3
from isoquant_lib.visualizer.post_process import OutputConfig, DictionaryBuilder
from isoquant_lib.visualizer.plot_output import PlotOutput
import argparse
from isoquant_lib.visualizer.process_dict import simplify_and_sum_transcripts
from isoquant_lib.visualizer.gene_model import rank_and_visual... |
5ab5cc657a0bee367fedef583e4f26666eba5eb271d87343615ba3f53c2468bb | Python | 6,590 | 140 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
# pyre-unsafe
from typing import Any, Dict, List
import torch
from torch import nn
from torch.nn import functional as F
from detectron2.config import CfgNode
from detectron2.structures import Instances
from densepose.data.meshes.catalog import M... |
9cff7950dfa05bcc24360f63705100783cf817a535d9ea9b9354f98fa6a6090c | Python | 6,590 | 184 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri May 15 19:38:23 2020
@author: jeffreywang
"""
import argparse
import os
import sys
import subprocess as sp
parser = argparse.ArgumentParser()
parser.add_argument("-input", action= 'store', dest = 'input', help= "[required] 'cool' for .cool files, and... |
f58ba6990159a4dd9b146814e4aaae522de652ef61aee13826847280f057c631 | Python | 6,595 | 195 | import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from utils.genSpikes import generate_poisson_spike_train, generate_regular_spike_train
import pandas
plt.rcParams['text.usetex'] = True
# Set global font settings
fsize=9
mpl.rcParams.update({
'font.family': 'sans-serif', # Choose fon... |
8e9cf2815fe1f88fdf0f9cc08b26aea7e90e2fc02d5fae6b60d6761429a46540 | Python | 6,597 | 172 | import argparse
import csv
import json
import random
from pathlib import Path
import numpy as np
import pandas as pd
import torch
import yaml
from sklearn.metrics import f1_score
from torch.utils.data import DataLoader, Dataset
from transformers import AutoTokenizer, get_linear_schedule_with_warmup
from src.models.be... |
bcdd6f3595fd5586d1b80d73fc30676f7e2441a66fc528554997368981cd6422 | Python | 6,598 | 175 | # This script is part of navis (http://www.github.com/navis-org/navis).
# Copyright (C) 2018 Philipp Schlegel
#
# 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 Software Foundation, either version 3 of... |
d231027d8d83b0c834954fd96f08ea621f36e81fc88ad7c4ec675c757f48ecba | Python | 6,605 | 192 | from pathlib import Path
from lightning import pytorch as pl
import numpy as np
import pytest
import torch
from torch.nn import Identity
from torch.utils.data import DataLoader
from chemprop.conf import LIGHTNING_26_COMPAT_ARGS
from chemprop.data import (
MoleculeDatapoint,
MoleculeDataset,
Multicomponent... |
c15efff0eebe79c30ad8a8c61c6675644fc6335e6607b30e1ce7e53ccc725cd8 | Python | 6,607 | 163 | #!/usr/bin/env python3
"""Runs inference on an SNN model, recreated (and restored) from an experiment.
The spike recordings are output to the specified directory as `inference*.pkl.gz`
for analysis.
"""
import logging
import os
import tempfile
import shutil
from argparse import ArgumentParser, Namespace
from pathlib ... |
c25b08e473cbf31d94c6090652147d9955b704ebd4a61c6fa83979a0cef81ca2 | Python | 6,613 | 194 | # Copyright (c) Facebook, Inc. and its affiliates.
import itertools
import warnings
from typing import Any, Dict, List, Tuple, Union
import torch
class Instances:
"""
This class represents a list of instances in an image.
It stores the attributes of instances (e.g., boxes, masks, labels, scores) as "field... |
876ca4560dd3a4672b572f8837d2895738115e4ba41167e043ff27163a2150f1 | Python | 6,622 | 162 | import torch
import torch.nn as nn
from torch import Tensor
from typing import Union,Dict
from random import random
from .components import LuongAttention, TokenEmbedding, ConvBlock
def get_token2id_decoder() -> Dict[str, int]:
CANONICAL_ALPHABET = [
'A', 'C', 'D', 'E', 'F',
'G', 'H', 'I', 'K', 'L'... |
e6d559e5a504c12222dad51f5ac098f7ba6759b4609610fd14ae4fbf8e41d071 | Python | 6,622 | 163 | # This script is part of navis (http://www.github.com/navis-org/navis).
# Copyright (C) 2018 Philipp Schlegel
#
# 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 Software Foundation, either version 3 of... |
5fedbf9e56b96008e3b5fdc4294fd72df7ac813abdded6d0211e8c9f893aae8f | Python | 6,630 | 192 | """
R & the natverse
================
<!-- difficulty: intermediate -->
Exchange neurons with R's natverse by reading and writing `.rds`/`.rda` files.
The [natverse](http://natverse.org) is {{ navis }}' counterpart in R: `nat` for neurons,
`nat.nblast` for NBLAST, `rcatmaid` for CATMAID and so on. Moving data between... |
8bba6d8e9b52c323a9a00e6625345a7b042ac0c9b76aeb47c32e701f320c22fa | Python | 6,637 | 170 | """
loaders/brainwave_loader.py
---------------------------
Loader for 3Brain BrainWave .bxr files.
HDF5 structure expected
-----------------------
/ (root attrs)
SamplingRate – float, Hz
ExperimentDateTimeUtc – str
PlateModel – str
/Well_A1/
SpikeTimes – int array, f... |
d1c73bf97134987b831a2fc69a6abc8e1904909a797212521d7be133560acd4d | Python | 6,637 | 168 | from typing import cast
import numpy as np
import numpy.typing as npt
import pandas as pd
import xarray as xr
from ._types import DeltaTuple
from . import _utils_traceback as _utils_tb
__all__ = [
"get_exact_sensitivities",
"get_sensitivities",
"reduce_sensitivities",
"get_weight_matrices",
"get_... |
c8a009f7da64148fbf544ec18b785fa840372afdce06d46c940355fc6ef1b64e | Python | 6,643 | 125 | #######################################################
# ---------- Network Propagation Functions ---------- #
#######################################################
import networkx as nx
import time
import numpy as np
import pandas as pd
# Normalize network (or network subgraph) for random walk propagation
# If sy... |
ca8700c6e4976aded3fe0da147de7e2215a9a864cec6e4df0756e143f7a34a84 | Python | 6,654 | 233 | #
# Copyright (c) 2020 10X Genomics, Inc. All rights reserved.
#
"""Barcode handling functions."""
from __future__ import annotations
# Do not add new things to this module.
# Instead, either find or create a module with a name that better describes
# the functionality implemented by the methods or classes you want ... |
60120fddc6a3ebb762124f2deeeb8e7bbee81c5fe9132292922d3928d533d289 | Python | 6,657 | 193 | # Copyright (c) Facebook, Inc. and its affiliates.
# pyre-unsafe
import logging
import numpy as np
import cv2
import torch
Image = np.ndarray
Boxes = torch.Tensor
class MatrixVisualizer:
"""
Base visualizer for matrix data
"""
def __init__(
self,
inplace=True,
cmap=cv2.COLOR... |
e55f7281865aa1a42bc0a7d830747a9d2948c1cb798002308da3a079f6d58572 | Python | 6,660 | 226 | """Agents that understand how to exist in and move through cell spaces.
Provides specialized agent classes that handle cell occupation, movement, and
proper registration:
- CellAgent: Mobile agents that can move between cells
- FixedAgent: Immobile agents permanently fixed to cells
- Grid2DMovingAgent: Agents with gri... |
3e5d689392ef4df603fd416fe193709c455d4480e64a52f3c853b07bf2aa408f | Python | 6,661 | 165 | import xml.sax.saxutils
import time
def make_test_name( library_idx, test_idx ):
return "test_%02d_%02d" % ( library_idx, test_idx )
def make_library_name( library_idx ):
if library_idx % 4 in ( 0, 1 ):
return "library_%02d/%02d" % ( int( library_idx / 4 ) * 4, library_idx % 4 )
else:
retu... |
cceae2cbd70a3bf5cc3ce6edefeaf3fc2e3b0c7d763145f4f163266f1fff9560 | Python | 6,661 | 173 | """Generate comprehensive stats table (CSV) for all Figure 4 comparisons."""
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
import numpy as np
import pandas as pd
from scipy.stats import mannwhitneyu
from utils.config import RAW_DF_PATH, OUTPUT_DIR
from utils.plotting... |
f02c3fd10f0120b2dad37981db055094ba40527a6963d72db843f43e85cbcc2e | Python | 6,667 | 166 | import tensorflow as tf
import numpy as np
import scipy.spatial
import math
from scipy.sparse import isspmatrix
from sklearn.metrics import roc_auc_score, f1_score, accuracy_score, recall_score, precision_score, roc_curve, confusion_matrix, average_precision_score
from warnings import simplefilter
simplefilter(action='... |
b1707c140890b342913d5d0fdd42a1c8aff8e9bdf23dde98f087d104aacd60c1 | Python | 6,668 | 164 | import copy
from pathlib import Path
import yaml
import joblib
import matplotlib.pyplot as plt
import numpy as np
from sklearn.decomposition import FastICA
import torch
from .. import config
from .decomposition_handler import DecompositionHandler, V
device = torch.device("cuda" if torch.cuda.is_available() else "cp... |
df3c76d1c95d57be3c60a33cfb27eeceeabd3f362928bfef563ed0756fe203cc | Python | 6,668 | 220 | # This script is part of navis (http://www.github.com/navis-org/navis).
# Copyright (C) 2018 Philipp Schlegel
#
# 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 Software Foundation, either version 3 of... |
4a55a7f640195b13f7017bc170b00573b5f631f50bd444524e47d0d8cbe6a729 | Python | 6,671 | 175 | """
Created on 07.12.2015
@author: michaeld
"""
from __future__ import print_function
import argparse
import os
import sys
import numpy as np
import nibabel as nib
import scipy.io as io
import correlate_matrix
from calendar import month_name
from datetime import datetime
from zoneinfo import ZoneInfo
REPORT_TIME... |
77999b559bb557993900c9b0927230cb4a06e94d19fe4a153a32d333ab77d8a0 | Python | 6,674 | 161 | # Copyright (c) Facebook, Inc. and its affiliates.
import logging
import numpy as np
from itertools import count
import torch
from caffe2.proto import caffe2_pb2
from caffe2.python import core
from .caffe2_modeling import META_ARCH_CAFFE2_EXPORT_TYPE_MAP, convert_batched_inputs_to_c2_format
from .shared import Scoped... |
d8b532d5890f24851118afd7f03908139689f6ff64d3ccbd54721ce88c655e15 | Python | 6,678 | 188 | """Tests for the angle morphometrics in `navis.morpho.angles`.
Correctness is pinned against a small hand-built neuron whose geometry has
angles we can work out by hand (90-degree bifurcations, a straight path, a
90-degree bend, 45-degree root angles). The example (insect) neurons are only
used for smoke-testing shape... |
ad402c83f31f47eab4874208116581cf3f91d6083e5b7e9c74d290d6abc13dee | Python | 6,680 | 188 |
""" Transformation of image/mesh coordinates. """
__author__ = "Fabi Bongratz"
__email__ = "fabi.bongratz@gmail.com"
from typing import Union, Tuple
import torch
import numpy as np
def normalize_vertices(vertices: Union[torch.Tensor, np.array],
shape: Tuple[int, int, int], faces=None,
... |
493314340919184ccd3e16374f4bf328ba89c0c5966d430a1dcef40afe3699ed | Python | 6,681 | 158 | import os
import numpy as np
import nibabel as nib
from PIL import Image, ImageDraw, ImageFont
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import sys
import glob
def SegQC(input_image_path, subj):
# Setup the output directory
overlay_dir = '/flywheel/v0/output' # Directory to save overlay imag... |
78315fb5bf156f967536e291bbe6bbb541cdd04c4ed7f09afeaf908dee105bc3 | Python | 6,693 | 192 | from __future__ import annotations
import sys
from pathlib import Path
_SCRIPT_DIR = Path(__file__).resolve().parent
sys.path.insert(0, str(_SCRIPT_DIR / "ProteinMPNN_to_get_emb"))
import argparse
import copy
import re
import warnings
import numpy as np
import torch
import tqdm
from protein_mpnn_utils import (
... |
2e3d1839f15d32d80e945e2333aadd75bd2a3cecaccc9174f098e2d0df4ee012 | Python | 6,694 | 159 | import openmm
import openmm.app as app
import openmm.unit as unit
from openff.toolkit.topology import Molecule
from openff.units import unit as ffunit
from rdkit import Chem
from rdkit.Chem import AllChem, rdDetermineBonds
import ase
import ase.md
import ase.md.velocitydistribution
import ase.optimize
from xtb.ase.calc... |
27c0a8cc9f955572f56dca84065bd760febdbbaf0c2b27514e9cd9f85f829691 | Python | 6,698 | 147 | # -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates.
import torch
from torchvision.ops import boxes as box_ops
from torchvision.ops import nms # noqa . for compatibility
from detectron2.layers.wrappers import disable_torch_compiler
def batched_nms(
boxes: torch.Tensor, scores: torch.Tenso... |
fc145de9997cbb87ceef93cdbf68da5e300b9ca2afcacbd71783b1c26f5c9706 | Python | 6,699 | 175 | import numpy as np
import neo
import quantities as q
import multiprocessing as mp
from itertools import repeat
import nest
import warnings
warnings.filterwarnings(
"ignore",
category=UserWarning,
message=r"resource_tracker: There appear to be .* leaked semaphore objects"
)
def get_syn_info(neurons, W, syn_mode... |
452a3988bfee7984ce22c8e2fb6b3e180a8b99f1c439ec0d3fadbd13a09d8833 | Python | 6,702 | 167 |
import os
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import matplotlib
from loguru import logger
logger.info('Import OK')
font = {'family' : 'normal',
'weight' : 'normal',
'size' : 8 }
matplotlib.rc('font', **font)
plt.rcParams['svg.fonttype'] = 'none'
def filte... |
0f8bf26bda5b348d296a296af4060b2f063b5b545bf0fac4d184cfcc1086b440 | Python | 6,705 | 189 | # Copyright (c) Facebook, Inc. and its affiliates.
import contextlib
from unittest import mock
import torch
from detectron2.modeling import poolers
from detectron2.modeling.proposal_generator import rpn
from detectron2.modeling.roi_heads import keypoint_head, mask_head
from detectron2.modeling.roi_heads.fast_rcnn imp... |
91792bc1d8e5016a61a4e0f20116be498689e2b5f463ce6bea5295cfbfacacff | Python | 6,705 | 183 | #
# Copyright (c) 2023 10X Genomics, Inc. All rights reserved.
#
"""Code to fit two component mixture model."""
import math
import numpy as np
import scipy
from sklearn import mixture as sk_mix
from cellranger.targeted.utils import (
BOTH_SPHERICAL,
BOTH_TIED,
MIN_OFFTARGET_GENES,
OFFTARGETS_ONLY,
... |
d777805a4fa26a17aa3b77dbe060d355cfca57c3a65a8b0efaf151bec050f2ed | Python | 6,705 | 175 | import numpy as np
import pybedtools
import scanpy as sc
import pandas as pd
import re
from scipy.io import mmwrite, mmread
from scipy.sparse import csr_matrix
file_path = "/home/nomura/Proj/mmvelo/data/10x_multiome_brain_repre_wo_IN/adata_rna.loom"
adata_r = sc.read_loom(file_path, obs_names="obs_names", var_names="v... |
034d64f0039030967fe5209b30763096d6c436a0b8b57345ca87cff7e2f869cf | Python | 6,707 | 208 | import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import os
import argparse
import scipy.io
from scipy.io import savemat
parser = argparse.ArgumentParser(
'Visualize the distribution of learned edges between residues.')
parser.add_argument('--num-residues', type=int, defa... |
71bbb0680ee0628367507924baa47d97e76584dd0a74e401b80915b8a9915d9c | Python | 6,707 | 184 | # --- Python 标准库 ---
import os
import gc
import warnings
# --- 第三方核心科学计算库 ---
import numpy as np
import pandas as pd
import anndata as ad
# --- 机器学习库 (Scikit-learn) ---
from sklearn.preprocessing import LabelEncoder
# --- 深度学习库 (PyTorch) ---
import torch
from torch.utils.data import DataLoader, TensorDataset
from ca... |
50f526d84ad6b2fd57153bc2e5c17a7af174801ae40ca5a430873264d7b9a775 | Python | 6,710 | 180 | #!/usr/bin/env python3
#
############################################################################
# Copyright (c) 2024-2026 University of Helsinki
# # All Rights Reserved
# See file LICENSE for details.
############################################################################
# takes teamcity config as input an... |
7743db55307683f65879a8245995c92fc25c338d4089169f6b1c667190a53a5c | Python | 6,716 | 176 | # Copyright (c) Facebook, Inc. and its affiliates.
import logging
import unittest
import cv2
import torch
from torch.autograd import Variable, gradcheck
from detectron2.layers.roi_align import ROIAlign
from detectron2.layers.roi_align_rotated import ROIAlignRotated
logger = logging.getLogger(__name__)
class ROIAlig... |
ba13f570fcba6e025a6e07e95c9f7e926d6ce12dd3316d0c10cf6aab4b4a9139 | Python | 6,717 | 175 | """Guards on configs/*.yaml.
Each config is generated from its published run's ``training_metadata.json``,
which is the authoritative record of what was executed. These tests re-verify
that correspondence whenever the reference runs are available, so a config
cannot quietly stop reproducing the run it names.
"""
impor... |
0f71ac63d81ca67beb4a47aa241fec89b17cf4827057b37064c7292e15fdd6ed | Python | 6,739 | 185 | # --- Python 标准库 ---
import os
import gc
import warnings
# --- 第三方核心科学计算库 ---
import numpy as np
import pandas as pd
import anndata as ad
# --- 机器学习库 (Scikit-learn) ---
from sklearn.preprocessing import LabelEncoder
# --- 深度学习库 (PyTorch) ---
import torch
from torch.utils.data import DataLoader, TensorDataset
from ca... |
0c35ff5a280d3356b93e19aa41e439f21d961073feedf9d7fa87c25ead7426e6 | Python | 6,742 | 196 | from typing import Dict, Any
import os
from os.path import join
import json
import random
import multiprocessing
import SimpleITK as sitk
import numpy as np
from tqdm import tqdm
def mapping_DS119() -> Dict[int, int]:
"""Remove all NA Classes and make Class IDs continuous"""
mapping = {}
mapping.update({... |
7368369bdcbd0b5ad544d3a698f7d0759e7aa4d095497939c15533c1eadcc5ea | Python | 6,749 | 203 | import csv
import glob
import os
from functools import partial
from multiprocessing import Pool, cpu_count
import numpy as np
import pandas as pd
from tfsenc_config import parse_arguments, setup_environ, write_config
from tfsenc_encoding import (encoding_setup, run_encoding,
write_encoding... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.