sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
88780f86b5a91dd27aaa465c0c33bb020c3d6a4281d4b23ef79c69576bbfa8fe | Python | 14,644 | 301 | # Copyright (c) 2026 Rohit Jena. All rights reserved.
#
# This file is part of FireANTs, distributed under the terms of
# the FireANTs License version 1.0. A copy of the license can be found
# in the LICENSE file at the root of this repository.
#
# IMPORTANT: This code is part of FireANTs and its use, reproduction, or... |
8b70fec1defaa047888ebbe555fadf191ca0ea86016e5b3c1456b477ea9875f2 | Python | 14,656 | 546 | #!/usr/bin/env python
# -*- coding: utf-8
#
# Copyright 2017 Mick Phillips (mick.phillips@gmail.com)
#
# 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 the License, or
# (at y... |
8fc5e5cd4cc551f42f2baec3e8b593b1152df5adc641e5c61a30edfc7d68ceba | Python | 14,660 | 381 | #!/usr/bin/env python
"""
Handles:
(1) All the UI elements in the Mosaic tab except for
the positions list widget.
(2) Image capture from HAL.
Hazen 10/18
"""
import os
from PyQt5 import QtCore, QtGui, QtWidgets
import storm_control.sc_library.hdebug as hdebug
import storm_control.sc_library.parameters as pa... |
885bd6349ee0c414664086a2f1885b738ab26a625f65d4a1f7152e86691fa181 | Python | 14,661 | 428 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
ToDo: Image and Audio classes for image and audio only stimulus files.
"""
import os
import numpy as np
import av
def get_pts_av(video_file, fps):
"""
Retrieves the presentation timestamp (PTS), decoding timestamp (DTS),
and frame count from a video fi... |
1f307058bee5ed094698b597276951333c281b8470c522db1d07e5cf64985da1 | Python | 14,664 | 331 | from __future__ import annotations
import csv
import datetime
import os
import pickle
import re
import pandas as pd
from biom import Table, load_table
import qiime2 as q2
from skbio import TreeNode
from Bio import Phylo
from .utilities import ReadsData, run_cmd, download_classifier_url, check_conda_qii... |
7ed95a53d01f99fccfd5c0836ed64a74a023547c05b3489c0ef9b3bc652527d2 | Python | 14,665 | 350 | import os
import time
import json
import torch
import torch.nn as nn
import numpy as np
import pandas as pd
from .modules import (
MultiPropDecoder,
optimizers_dict,
ListLoss,
activation_dict
)
from utils.metrics import metric_functions, statistics_dict
from tqdm import tqdm
from .GeminiMol import Gem... |
c54977b798080a9f6a965b1a025f48589e476662a7ed76590015ed51b10423e2 | Python | 14,667 | 340 | import sys
sys.path.insert(0, './..')
import os
import numpy as np
import matplotlib.pyplot as plt
from HopfiledNetwork import *
from utils import *
import json
from skimage.filters import threshold_mean
from tqdm import tqdm
import configargparse
import pickle
global args
parser = configargparse.ArgParser()
parser.ad... |
bbeee80e0f25b9216da3e894aacabb782f6e7a4eb2a9cdb9c87019afa5ff37c0 | Python | 14,673 | 387 | import random
from typing import Optional, Tuple, Union
import numpy as np
import torch
from torch import Tensor
from torch_geometric.utils import coalesce, cumsum, degree, remove_self_loops
from torch_geometric.utils.num_nodes import maybe_num_nodes
def negative_sampling(
edge_index: Tensor,
num_nodes: Opt... |
61ae30e238a64c36575f54fd23a2d23f473583e113791651e9b0ee861ff44faf | Python | 14,676 | 354 | """
This implementation is from https://github.com/zcaceres/spec_augment
"""
import torch
__all__ = ['sparse_image_warp']
def sparse_image_warp(img_tensor,
source_control_point_locations,
dest_control_point_locations,
interpolation_order=2,
... |
649a92b832cbcdf31ccc72c3087b218972f2b49901ef53234c32aab55312e94a | Python | 14,676 | 416 | import torch
from torch.utils.tensorboard import SummaryWriter
from pathlib import Path
import numpy as np
import matplotlib.pyplot as plt
import io
from PIL import Image
from typing import Dict, List, Tuple, Union, Optional, Any, Callable
import os
import logging
class LogImages:
"""
Class for logging images ... |
fe7ac0b265d65b36ec1a8ec7d83c0a6af45bfd9032fb17096bd9e858dfdfad2c | Python | 14,677 | 419 | import math
import os.path
import unittest
import tests.base_test
import tests.output_parser as output_parser
import tests.test_config
import tests.util
class PairedStatsBaseTest(tests.base_test.BaseTest):
def setUp(self):
super().setUp()
self._test_base_dir = tests.test_config.TEST_BASE_DIR
... |
afd56922b0c2903f0ddcc75ea2819b42c534c6a830082794f8b93028a2d0c19c | Python | 14,686 | 420 | # -*- coding: utf-8 -*-
# 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.
import torch
import torch.nn as nn
import torch.nn.functional as F
from typing import Optional, T... |
e233a80ea531126989838f79e85f086d36ceebcc8cb9583359a0dbd4e4391294 | Python | 14,687 | 481 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 18 16:55:14 2017
@author: ajaver
Get food contour using a pre-trained neural network
"""
# %%
import tables
import os
import numpy as np
import cv2
import warnings
with warnings.catch_warnings():
warnings.simplefilter(action='ignore', categor... |
ce0a8f4a20a7cc99e0d638477aa8ce1ba0f74650a15b52fe4f2fc9d493cc00da | Python | 14,690 | 440 | from collections.abc import Callable
from math import isclose
from pathlib import Path
from typing import TYPE_CHECKING, Literal, cast
import numpy as np
from matplotlib import pyplot as plt
from torch.optim.lr_scheduler import ReduceLROnPlateau
from torch.optim.optimizer import Optimizer
from eir.setup.schemas impor... |
85fec044f43b710c282fc144b5af789fc555f4b89ddaae0358e2aec046ab3e95 | Python | 14,694 | 355 | import pandas as pd
import numpy as np
from natsort import natsorted
import cv2
from sklearn.preprocessing import minmax_scale
from matplotlib import path
from typing import Generator, List, Sequence, Union
from pathlib import Path
from napari.utils.notifications import show_info
from napari_dmc_brainmap.results.result... |
b64517463fc880b7c0c823a44b2cccdb20f1c200dba52cdc2d92a0cb6a6d9642 | Python | 14,694 | 326 | """Test the pre-flight check.
Run from the repo root::
uv run python python/test_remote_preflight.py
Pre-flight exists to stop one specific failure: a batch that runs, finishes, and
reports results computed from a fraction of the recordings you asked for.
Because the node-cartography boundaries and every group c... |
656157ba3051f7a7438d290c4da7735f341e24ede7872596d09d054504729f13 | Python | 14,696 | 393 | # CNN Genomic Prediction Script - Standalone Version
# Import utilities and libraries
import sys
import os
# Add project directory to path and import utilities
if os.path.exists("/proj"):
project_path = "/proj"
else:
project_path = os.getcwd()
sys.path.append(project_path)
from Py.libs import *
from Py.func ... |
2aa75bd6a3aa98c43373025a944599c4604bb3f0be51f8ddb04170cb97a90328 | Python | 14,702 | 383 | import reprlib
from collections.abc import Sequence
from pathlib import Path
from typing import TYPE_CHECKING
import polars as pl
from eir.setup import schemas
from eir.setup.schema_modules.output_schemas_array import (
ArrayOutputSamplingConfig,
ArrayOutputTypeConfig,
)
from eir.setup.schema_modules.output_s... |
21482a3ff4b057dcae58e2b9402e1d83e83b7ea4e12082a1d4ca7aef9fdfa3ea | Python | 14,710 | 410 | #!/usr/bin/env python3
import contextlib
import logging
import os
import re
import shutil
import sys
import subprocess
from datetime import datetime, timedelta
from io import BytesIO
from threading import Lock, Timer
from watchdog.events import FileSystemEventHandler
from watchdog.observers import Observer
from htt... |
26abd54c6991d61ad845d5731cf376e0df99463528c451b715a51da73685bea8 | Python | 14,712 | 353 | import segmentation_models_pytorch as smp
import matplotlib.pyplot as plt
import pytorch_lightning as pl
from google.colab import drive
from datetime import datetime
import albumentations as alb
from pprint import pprint
from PIL import Image
import numpy as np
import random
import torch
import glob
import ... |
cf0ecb7b9e4a4fef87dbe84f229ba87c2f3da307fef2894474612763bbe344f4 | Python | 14,722 | 354 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Script to display a connectivity matrix and adjust the desired visualization.
Made to work with scil_tractogram_segment_connections_from_labels and
scil_connectivity_reorder_rois.
This script can either display the axis labels as:
- Coordinates (0..N)
- Labels (using... |
9cb9d8227a0aed7329252da24d8538cc0d45bf4e30f56d098cad153ebde1c1da | Python | 14,725 | 468 | #!/usr/bin/python3
#
import os
import sys
import argparse
import shutil
from copy import deepcopy
import numpy as np
import vtk
from vtk.util.numpy_support import vtk_to_numpy
from sklearn.neighbors import NearestNeighbors
from uac.element import Element
from uac import utils
import uac.vars as var
# Create the parse... |
5f40657ae63444e954b555cabefcfcd78a49c20959436ffa3a2322d4ad0786fa | Python | 14,731 | 402 | import json
import logging
import os
import os.path as osp
from collections import defaultdict
from typing import Dict, List, Optional, Tuple, Union
import torch
import torch_geometric.distributed as pyg_dist
from torch_geometric.data import Data, HeteroData
from torch_geometric.io import fs
from torch_geometric.load... |
fe471e8f8a734726c99a3afda8c6516a277aef9a98174d84e36cc549a8f10263 | Python | 14,738 | 322 | """Test the CAT-NAP cell-type subnetwork analysis.
Run from the repo root::
uv run python python/test_catnap_subnetwork.py
This feature has **no MATLAB counterpart** (MATLAB only draws cell types as
rings on the network plot), so unlike the other ``test_pipeline_*`` scripts
there is no parity ground truth. Inste... |
4d5037be0878af9c4d34ac98857d9b7bea9f844c4a2d92aa28013bf053a7b495 | Python | 14,740 | 424 |
import os
import sys
import json
import time
import copy
from pathlib import Path
from datetime import datetime
import torch
import torch.nn.functional as F
from torch.optim import AdamW
from torch.optim.lr_scheduler import ReduceLROnPlateau
import numpy as np
from sklearn.metrics import (
precision_score, recal... |
6ea0a5599dedb2d5101f60ddd9f98a5bcc9fbd58d68d14d6e1e209305eba5a56 | Python | 14,743 | 513 | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
#!/usr/bin/env python
# coding: utf-8
"""
AGED Utilities Module
Utility functions for data validation, preprocessing, and metric computation
"""
import numpy as np
import pandas as pd
import torch
from typing import Optional, Dict, List, Tuple, Any
from scipy.stats im... |
f8548672316fdd8f29b3f96aabd78f42eb47e30597a92ac2bf0b36a13408b4b1 | Python | 14,745 | 363 | import torch
import random
import gc
import torch.nn as nn
import torch.nn.functional as F
from transformers.activations import ACT2FN
from torch_geometric.data import Batch, Dataset
from transformers import AutoTokenizer, EsmModel
from typing import *
from src.module.egnn.network import EGNN
from src.module.gcn.networ... |
3d8e555cd1424fcdb51aaa3ddb1b8210b132985ee485a66dd9ebfc22e8deb409 | Python | 14,749 | 460 | """
Neural Network Model for PAH Removal Rate Prediction
Author: [Your Name]
Date: 2025
Description: Deep learning model for predicting PAH removal rates in Photo-Fenton systems
"""
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split, GridSearchCV
from sklearn.preprocessing impo... |
db1695aed4ea2769fad7c674630240f11a3c4200c92d59d3767a823f7896608b | Python | 14,751 | 354 | import logging
import numpy as np
import matplotlib.pyplot as plt
from scipy.ndimage import zoom, gaussian_filter1d
from .base import Model
from nems.registry import layer
from nems.layers.tools import require_shape, pop_shape
from nems.layers import (
WeightChannels, WeightChannelsGaussian, FiniteImpulseResponse... |
8412abfdd38a999bc7a53547c952e2d1f84701e2c7e3ed0a1fb4a6e7af4bf184 | Python | 14,753 | 402 | # Copyright 2024 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, ... |
667289db65ab6a1f3ce4a2346c64eb598c776565c87c0fb006b4e10c7574398c | Python | 14,757 | 371 | import os
from pathlib import Path
import pandas as pd
import numpy as np
from sklearn.experimental import enable_iterative_imputer
from sklearn.impute import IterativeImputer
from sklearn.model_selection import train_test_split
from config.config import settings
from config.paths import SPLIT_DIR, DATA_DIR
from data... |
c79cfbc80d67f5788dcefd3d7a231e59edaa529e4de294d15d3465ff449d5a29 | Python | 14,757 | 475 | #!/usr/bin/env python
# coding: utf-8
# # Regression of pH range using machine learning (Random Forest)
# In[1]:
HOME_DIR = '/Users/datatranslators/Documents/GitHub/acido_CEST_Machine_Learning/'
DESTINATION = 'outputs'
# ## Libraries
# In[2]:
#libs
from sklearn.model_selection import train_test_split
from skle... |
4061a0cb91f20c9847f6bfd166975ffdfe4d43032b4b2eb5e5d07405be23db60 | Python | 14,764 | 338 | #! /usr/bin/env python
"""Per-region statistics for membrane patches or connected components.
This reads the per-triangle CSVs written by `generate_patches.py` (edited in place
into the membrane `*.AVV_rh*.csv`) or `label_connected_components.py`
(`*_components.csv`) and computes area-weighted summary statistics for e... |
8e73dcdab57f4dfddf5b4be465f980de25e572a2e548acef4a4d57efc9de366a | Python | 14,764 | 364 | """
Convert pose data from common formats to COCO-17 canonical DataFrame.
Supported input formats:
- "coco" : COCO-17 CSV (sam3d, MMPose, etc.) — passthrough
- "openpose" : OpenPose JSON (18-keypoint body_18 format)
- "mediapipe" : MediaPipe Pose CSV/DataFrame (33 BlazePose landmarks)
- "kinect_v2" :... |
f84f8f07a111371bc3d8f0dc69b7514f448cbabfb5dc43cf8d2a6f3771e5ce6c | Python | 14,767 | 358 | """Electrical stimulation detection + pattern grouping.
Port of MEA-NAP's ``Functions/stimAnalysis/detectStimTimes.m``,
``getStimPatterns.m`` and ``checkStimPattern.m`` (identical on
``feat/plot-parity`` and ``origin/main``).
Detects electrical-stimulation onset times from a raw voltage recording, then
groups the sti... |
398d326cbaf2db82dfb04f5bea0387f061e02a6e9b8dcf4c0ea5ba103a50c226 | Python | 14,774 | 290 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Generates and saves plots and statistical results of neural decoding.
This script is interactive and performs the following steps:
1. Loads specified decoding scores for a group of subjects.
2. Plots the time-series of decoding accuracy.
3. Performs permutation clu... |
5e9c99b69bf7969e741031bebdfc6060d83ac9d93d7bc890e110879cd9f23ad9 | Python | 14,777 | 234 | """
(C) Copyright 2019 IBM Corp.
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 agreed to in writing, software
... |
8d54b59c1fe99080c600cdf460bf774189188dc6ade0a509a554bba928e42e3f | Python | 14,782 | 335 | # from PIL import Image
# import pandas as pd
import numpy as np
from pathlib import Path
import os
import tensorflow_probability as tfp
import tensorflow as tf
from tqdm import tqdm
import tifffile
from bson.objectid import ObjectId
from deep_events.database.extract_yaml import save_dict
import shutil
from skimage imp... |
4a3ea21a455907ce37f2bdd37d49fc9ce1d66d346d68f3cb71a5d4406815114c | Python | 14,783 | 441 | from collections.abc import Callable, Sequence
from dataclasses import dataclass
from difflib import get_close_matches
from typing import (
TYPE_CHECKING,
Any,
Literal,
)
import torch
from torch import nn
from torch.utils.data._utils.collate import default_collate
from eir.data_load.data_preparation_modul... |
9598bd6233d92578df121d08dbc3d13388893de4802827c7410f2a3db65bc4d5 | Python | 14,787 | 439 | import os
import numpy as np
import pandas as pd
import scipy.stats as stats
import torch
from dotenv import load_dotenv
from omegaconf import DictConfig
from rich.progress import track
from scipy.optimize import curve_fit
from mcmlnet.training.data_loading.preprocessing import PreProcessor
from mcmlnet.utils.conveni... |
8e91af444a33ee6d7a307353df2a516531b783018938819b13cb3d3ba77b74bd | Python | 14,788 | 401 | import numpy as np
import pytest
import nelpy as nel
from nelpy.analysis import replay
class TestLinregressFunctions:
"""Test linear regression functions."""
def test_linregress_array_basic(self):
"""Test linregress_array with basic linear data."""
# Create a simple linear posterior
... |
df7edbc13f12e92798227061e9ed45f7b52d4513b1c2e2b750a6c672a6f41c33 | Python | 14,789 | 454 | from __future__ import annotations
import math
import numpy as np
import pytest
import skimage
from numpy.typing import NDArray
from labelme._automation._geometry import _compute_polygon_deviation
from labelme._automation._geometry import _round_bbox_to_int
from labelme._automation._geometry import compute_circle_fr... |
e3d419e1b354af9f2e34b897cca649fb564f9000ebed67f380dce477151adcbe | Python | 14,791 | 457 | """Real data loading functionality."""
import os
from abc import ABC, abstractmethod
from pathlib import Path
import torch
from htc import DatasetImage
from htc.models.data.DataSpecification import DataSpecification
from htc.utils.Config import Config
from torch.utils.data import DataLoader
from mcmlnet.experiments.... |
5225a568bea6697a599ec5cb0822d4ca599fed04d577046e80bac94a1598230d | Python | 14,792 | 329 | """Where the pipeline gets a recording's raw data from.
Both analysis paths want ordinary local files: CAT-NAP a ``suite2p/plane0``
directory, electrophysiology a single ``.mat``/``.h5``/``.raw``. This produces
them, whether the data is already on disk or has to be fetched — and for the
remote case, fetches the *next*... |
81c969082207cdf02774969073179e0317ccbc96bac62f4dfd7bb4780cee762e | Python | 14,796 | 299 | import pandas as pd
import re
import numpy as np
import itertools
import math
from pyhpo.ontology import Ontology
import HPOFunc
NullList=["none", "none documented", "nil", "(borderline)", "no concerns"]
def test_check_and_set_nan():
for item in NullList:
output = HPOFunc.check_and_set_n... |
2043f39a1ad9fc047c0d299d3af7bfa62b8a3318e28e5fc9447800c0a5d88270 | Python | 14,800 | 321 | # -*- coding: utf-8 -*-
"""
Analyses of the EMPRISE data set
by Joram Soch <soch@cbs.mpg.de>
"""
# import modules
import os
import time
import EMPRISE
import NumpRF
import numpy as np
import scipy as sp
import pandas as pd
import nibabel as nib
import matplotlib.pyplot as plt
### Simulation C: NumpRF/BayespRF/popey... |
d59dd4064eac239be912d6a026e6c59614f9bad6668bdb0f11b3bb777a02de18 | Python | 14,805 | 515 | import math
from typing import Literal
import torch
import torch.nn.functional as F
from einops import rearrange
from torch import nn
from torchvision.ops import StochasticDepth
from eir.models.layers.attention_layers import SwiGLU
from eir.models.layers.norm_layers import GRN, LayerScale
from eir.utils.logging impor... |
bc36f741ab7773b5f9dc298ab9610ce915067a2cc82ea73e947174ee155b3f05 | Python | 14,812 | 335 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
#Functions
#-------------
def generate_step_stimulus(tend, ston, stoff, dt, stamp=1):
"""
Generate a step stimulus.
Parameters
----------
tend : float
End time point of the stimulus protocol in seconds.
ston : float
... |
d1609899e5486d40cc90895b63cc604cef1520d3a116762cea468cbfad0216b6 | Python | 14,816 | 329 | """Approval and completion policies for dynamically loaded native tools."""
import json
import sys
from types import ModuleType
from unittest.mock import Mock
import pytest
from deepagents.backends import LocalShellBackend
from langchain_core.documents import Document
from langchain_core.messages import AIMessage, Hu... |
bf952c6a93b920af3cd8c86246feb7140c3ff214e28e8d9e01c7b245def55913 | Python | 14,828 | 414 | import glob
import os.path
from typing import Dict
from typing import Tuple, Callable, List, Union, Optional
import numpy as np
import skimage.io as io
import torch
from torch import Tensor
from torch.utils.data import Dataset
# from skoots.train.merged_transform import get_centroids
from tqdm import tqdm
Transform ... |
67f72f5017da76dc2f7f96b56a13c3991aad05a33d36fc153a7dc211aa6effba | Python | 14,836 | 305 | #!/usr/bin/env python
# author: Jannes Spangenberg
# e-mail: jannes.spangenberg@uni-jena.de
# github: https://github.com/JannesSP
# website: https://jannessp.github.io
import numpy as np
import read5_ont
import multiprocessing as mp
import pysam
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, Names... |
c10714f9824bfe3c3bcd3699b5b5b885f037f17008ecfb67dd72a3a9e6b0edd8 | Python | 14,838 | 414 | # Copyright (c) 2026 Rohit Jena. All rights reserved.
#
# This file is part of FireANTs, distributed under the terms of
# the FireANTs License version 1.0. A copy of the license can be found
# in the LICENSE file at the root of this repository.
"""
Test suite for kernel_size_list functionality in LocalNormalizedCrossC... |
6f1ce92221d429d8c829c17819436f8b1b31677f60fd8bc6397286c1980cd75f | Python | 14,842 | 329 | """Step-1 check figures for a spike-*sorted* recording.
The detection checks (:mod:`meanap.pipeline.plotting`) answer "did the
detector find spikes?" by showing traces with spikes marked. Sorting raises a
different question — "is each unit a neuron, and how many did each electrode
give?" — so it gets its own three fig... |
cd32a41ea21ebd8f50efbc7068dd87b0caf90ab2b386625eb34185713e5621bd | Python | 14,846 | 383 | ##################################################################################
### Module : dmrifiberprofile.py
### Description : fiberprofile api
###
###
###
### Written by : alecj.nipp@gmail.com
### Copyrights reserved by NIRAL
##################################################################################
im... |
ea90d13b4aab701edbe67cd29b18ecdaa282b16dbfd5d710f017caa774c1cff3 | Python | 14,846 | 391 | from collections import OrderedDict, defaultdict
from itertools import count
from warnings import warn
from torch import nn
from torch.nn.init import xavier_normal
import torch
from torch.nn import Parameter
import torch.nn.init as init
from attorch.regularizers import LaplaceL2
from torch.autograd import Variable
fro... |
df281ad2ef17fd59ff63d85688540ce952b48121c931ff3188a1ad2fbdd94a32 | Python | 14,849 | 452 | # Copyright (c) 2026 Rohit Jena. All rights reserved.
#
# This file is part of FireANTs, distributed under the terms of
# the FireANTs License version 1.0. A copy of the license can be found
# in the LICENSE file at the root of this repository.
#
# IMPORTANT: This code is part of FireANTs and its use, reproduction, or
... |
d818a757b594791355bbdd3256900ed886d29df0927a0c35aed3ec48843ee896 | Python | 14,852 | 341 | """How much of a target does each feature explain? — no MATLAB counterpart.
``doClassification`` ranks features by how much a classifier gets worse without
them, which answers "is this feature useful to this model" but not "how much of
the variance does this feature account for". The second question is the one
usually... |
aa87a6cb01d0439437c0ee745736cf497c5914adba78a7df2ebee331b698289d | Python | 14,858 | 471 | """
Training Utilities for H-FNO
This module provides training functionality including:
- Trainer class for model training
- Physics-informed loss functions
- Learning rate scheduling
- Checkpointing and logging
"""
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data i... |
6c7bf4105221516d0cbc0d0557ef01504b35d256881ad491d9f3763710831f92 | Python | 14,860 | 339 | #Aidan Fike
#July 21, 2019
#Edited and updated to version 2
#Kevin Schult, March/April 2020
#File with functions which measure omega angles and rmsd.
#Dependent on MDAnalysis library, which does not come standard in most Python installations
import os
import sys
import dihedDir
import shutil
import chimScriptMaker
... |
07303d9a06af969e9f42f6b2c52f7348bd1c04f63831df919c370eaf66f55398 | Python | 14,865 | 338 | '''
Quick script to collect data from rERP knock-outs in the final task
and perform statistical inference.
All options supported by `subject_rerp_mt1_knockout.py` are
also available here, of course.
NOTE: The output report created by this script isn't
necessarily going to include the prettiest figures; it's
mostly to... |
c4f49ff5ab50b218453894ab3e0a314610ed8a9f945c18c6a0b1a47d18287669 | Python | 14,871 | 484 | import pandas as pd
import numpy as np
import pyranges
from kipoiseq.dataclasses import Variant, Interval
import kipoiseq.transforms.functional as F
from kipoiseq.extractors import MultiSampleVCF
from pkg_resources import resource_filename
import os
mmsplice_module_names = [
'acceptorIntron',
'acceptor',
... |
c541b90332cf5cc73125f1fd6de856bc698e5385d26cea7f0e5f5eb50413dabd | Python | 14,872 | 343 | import argparse
import gc
import os
from pathlib import Path
from queue import Queue
from threading import Thread
from typing import Union, Tuple
import nnunetv2
import numpy as np
import torch
from acvl_utils.cropping_and_padding.bounding_boxes import bounding_box_to_slice
from acvl_utils.cropping_and_padding.padding... |
70fa6e12e99db6d4d7b4a0419911170ac37596e731010cfe25885eafb21c138d | Python | 14,876 | 373 | #!/usr/bin/env python
"""
This class handles focus lock control, i.e. updating the
position if the focus lock is locked, etc.
Hazen 04/17
"""
from PyQt5 import QtCore
import tifffile
import storm_control.hal4000.halLib.halMessage as halMessage
class LockControl(QtCore.QObject):
controlMessage = QtCore.pyqtSign... |
665f2efb1c1f5fb14cabbf4a6916839d7e46f371b521ae0eb0bef109dedcda60 | Python | 14,879 | 414 | #!/usr/bin/env python3
"""
=============================================================================
Austin Dibble
University of Glasgow
2026
tests/test_neurofm.py
Sanity checks for NeuroFM. Covers input resolution, preprocessing,
model construction, and inference output shapes.
These tests are intentionally lig... |
ae5b570fe2d08f89a7b1210557ee522682abb1400d60e3cd1c87b1fd633b22f4 | Python | 14,883 | 468 | # Copyright 2024 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, ... |
0bc90af25b9afb3496e602186e3584921087e5f43f1530df02d2531d2e02a198 | Python | 14,885 | 281 | import gc
import os
import vcfpy
import pysam
import torch
import argparse
import kipoiseq
import pandas as pd
import numpy as np
import sys
import lightning.pytorch as pl
from torch.utils.data import IterableDataset, DataLoader
from pl_models import LitModelHeadAdapterWrapper
torch.use_deterministic_algorithms(True)... |
0a3a114b5a284a669f0206ba1da49b9dd99c46d923a9dfc18a5e90734e6a6a95 | Python | 14,890 | 409 | import os
import numpy as np
import nibabel as nib
import matplotlib.pyplot as plt
from scipy.stats import linregress, spearmanr
from neuromaps import images, nulls, parcellate
from neuromaps.transforms import fsaverage_to_fsaverage
def ensure_single_darray(in_gii: str, out_gii: str) -> str:
img = nib.load(in_gi... |
f7468443f43ef55c88c5990f26f42cab731deb64891685d3a079fec77408c121 | Python | 14,891 | 400 | # -*- coding: utf-8 -*-
# genbed: A Python toolbox for generative embedding based classification
# Copyright 2019 Sam Harrison
# Translational Neuromodeling Unit, University of Zurich & ETH Zurich
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public L... |
a3babd29cc9b01bd048b91e422f57228e64f18b8497b19820789afbfedc38370 | Python | 14,893 | 388 | from pathlib import Path
import numpy as np
import nibabel as nib
from dipy.core.gradients import gradient_table
from dipy.core.sphere import disperse_charges, HemiSphere
from dipy.io import read_bvals_bvecs
from dipy.reconst.dti import (TensorModel, fractional_anisotropy,
mean_diffusivity... |
bbec41f439f273cef69ca9d4bcfe1e14ea36aa0a9f1f4880be56537637322b2c | Python | 14,893 | 320 | import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib
import matplotlib.pyplot as plt
plt.rcParams['font.family'] = 'Arial' # setting font family
from scipy.cluster.hierarchy import dendrogram, linkage
import matplotlib.pyplot as plt
from scipy.spatial.distance import squareform
from typing i... |
6b0a82813bed0e9ef4b544ad475ffed081ce9146973b63563a8896cc711a5332 | Python | 14,897 | 348 | from __future__ import print_function
import os
import sys
import re
import numpy as np
import json
import multiprocessing
import pysam
## Functions
def getSym2refForProject(project):
for s in config["samples"]:
if(s["project"]==project):
return config["ref_folder"]+"/"+s["species"]+"/"+s["species"]+"_sym2ref.da... |
7f6ee673343b7c43f61e94ec246271292d2c94fbb48fccd36dade33fc56235c9 | Python | 14,901 | 415 | import copy
import logging
import math
from typing import Any, Dict, Optional, Tuple, Union
import numpy as np
import torch
from torch import Tensor
import torch_geometric.typing
from torch_geometric.data import (
Data,
FeatureStore,
GraphStore,
HeteroData,
TensorAttr,
remote_backend_utils,
)
... |
67636581abc49ead1069d12bea9ea9c40855ea553b5ab95c24b1566d376c9af8 | Python | 14,903 | 407 | import copy
from typing import Dict, List, Optional, Union
import torch
from torch import Tensor
from torch_geometric.data.data import Data, warn_or_raise
from torch_geometric.data.hetero_data import HeteroData
from torch_geometric.explain.config import ThresholdConfig, ThresholdType
from torch_geometric.typing impor... |
1741e9068ec08a15749698f4cf8292f3266061f824b8c267d59f96af31eac4a5 | Python | 14,905 | 288 | # (C) Copyright 2019 IBM Corp.
#
# 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 agreed to in writing,... |
b18bb97367cd66a7acedd97c8b3279dad0abdd7ee369c78282f81ee3adf92f68 | Python | 14,908 | 376 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.data import Dataset, DataLoader, random_split
import numpy as np
import random
import os
import logging
# Set up logging
logger = logging.getLogger(__name__)
# Set seeds for reproducibility
random.seed(42)
... |
b992eb6701f16e28fe579dc065989d5a614a6dc4b494c202dde772ee216e3fee | Python | 14,914 | 389 | """Backends that actually run a model, for the OCSR tool.
Split from :mod:`chemgraph.tools.ocsr_core` so core stays pure: core imports and its
tests run on a host with no models and no network. Everything here loads a checkpoint
or opens a socket.
Two families:
* :func:`smiles_from_llm` posts a base64 image to a vis... |
bed56165a06f9e5550576fff5790b8d685fe7f756be20ede191f40eb61f2b550 | Python | 14,914 | 341 | from drop import utils
import pandas as pd
from pathlib import Path
from collections import defaultdict
from snakemake.logging import logger
import warnings
from drop.config.Genome import Genome
warnings.filterwarnings("ignore", 'This pattern has match groups')
class SampleAnnotation:
FILE_TYPES = ["RNA_BAM_FIL... |
3bbfc57372483f7b2060ad3e7e9b34046cba90575f49d4e4abe689ad4aaf55ea | Python | 14,918 | 478 | #!/usr/bin/python3
#
import os
import sys
import argparse
import shutil
from copy import deepcopy
import numpy as np
import vtk
from vtk.util.numpy_support import vtk_to_numpy
from sklearn.neighbors import NearestNeighbors
from uac.element import Element
from uac import utils
import uac.vars as var
# Create the parse... |
9fa8ca9123b7cf0dcbc472076ec7543c45e8182ed74d91ecd3e64771a112773a | Python | 14,921 | 311 | import torch
import numpy as np
from torch import nn
import torch.nn.functional as F
from torchvision import transforms as T
from .utils import gaussian_kernel, circular_kernel, gabor_kernel
EPSILON = 1e-5
class Identity(nn.Module):
def forward(self, x: torch.Tensor, *args) -> torch.Tensor:
ret... |
4acfdd0059d5aa20e8c95dcf7171076fba9f91909f5f86b1134b6572dd1ac0fc | Python | 14,923 | 312 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
from pathlib import Path
from typing import Any
import numpy as np
import torch
from ultralytics.models.yolo.detect import DetectionValidator
from ultralytics.utils import LOGGER, ops
from ultralytics.utils.metric... |
83136babcadaa55033eb4aef126104c5604d826c85ac0078a2898bc65965c84b | Python | 14,923 | 306 | import numpy as np
from napari_dmc_brainmap.utils.atlas_utils import coord_mm_transform, get_decimal
from qtpy.QtCore import Qt
import json
from qtpy.QtWidgets import QMessageBox
class StatusContainer():
def __init__(self, regViewer) -> None:
self.regViewer = regViewer
self.cursor = 0
self.... |
6586fce5643e1d1edbd9db025a59ffe436602bea90abd5e8d2d7ae43236f15bd | Python | 14,924 | 433 | from __future__ import annotations
import inspect
import warnings
from contextlib import contextmanager
from typing import TYPE_CHECKING, Any
from psygnal import Signal, SignalInstance
from magicgui._type_resolution import resolve_single_type
from magicgui.application import Application, use_app
from magicgui.widget... |
19bbc124cbc14f7504284fe2cebdfd5daf9d9557f6d55d1c9ed343a0d2f2d009 | Python | 14,930 | 345 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
import math
import torch
from torch import Tensor, nn
from ultralytics.nn.modules import MLPBlock
class TwoWayTransformer(nn.Module):
"""A Two-Way Transformer module for simultaneous attention to image and q... |
6e4b247ecbf88de6bda5ce114a41f93ac0af5a46ae7643adfc2c55de34b42973 | Python | 14,930 | 382 | import random
import string
import sys
from collections import defaultdict
import numpy as np
import obspy
import requests
from obspy.clients.fdsn import Client
from obspy.clients.fdsn.header import FDSNNoDataException
from obspy.geodetics import gps2dist_azimuth
from tqdm import tqdm
import seisbench
from seisbench.... |
1636cd3a039c56a48e096a3918e1fe058578311bef8ef2e3b130304cf3cf439e | Python | 14,933 | 293 | import os
import numpy as np
from control.config import args
class experiment_results_validation:
def __init__(self, args):
self.args = args
if args.task_type == "binary":
self.auc_final_list = []
self.apr_final_list = []
self.f1_final_list = []
... |
135de049beb2d6b2ad4a1a721723944e2c0f2e1d097ba9ac492e7ea8007213ff | Python | 14,941 | 330 | #!/usr/bin/env python3
import os
import nibabel as nib
from nibabel.gifti import GiftiDataArray, GiftiImage
import numpy as np
import argparse
from matplotlib import pyplot as plt
from matplotlib.tri import Triangulation
def calc_connectivity_list(surf):
"""
Precompute the connectivity list for the surface me... |
b0d49fb5ec74ff9075893ee3137a109f9c1ac1650d6fc2a671fefbbdca8dd3eb | Python | 14,945 | 445 | #Lucas Sancéré -
import json
import os
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import yaml
from attrdictionary import AttrDict as attributedict
from sklearn.decomposition import PCA
from sklearn.manifold import TSNE
from sklearn.preprocessing import StandardScaler
from histo_miner.util... |
67155082d3067d81e88b0b613404ad699fca7373db87542f5a637f6d17f2bc2b | Python | 14,947 | 432 | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Created on Feb 23, 2010
@author: brentp
This file was adopted from a GitHub repo called 'goatools':
https://github.com/tanghaibao/goatools/blob/master/goatools/obo_parser.py
"""
import os
import sys
import logging
from exceptions import EOFError
from hierarchy import... |
c9776ed7734014993077299b4867c9f060ebdbe6bf3edc27d8f856e8964c0f9a | Python | 14,947 | 375 | import numpy as np
import pandas as pd
import os
from sklearn.model_selection import KFold
from sklearn.metrics import accuracy_score, f1_score, hamming_loss, label_ranking_average_precision_score, roc_auc_score, confusion_matrix
from sklearn.utils.class_weight import compute_class_weight
from imblearn.over_sampl... |
6984ddd6987496cc9d6ce052b3d980cdc776c3c2bb239967dcfd34b3e9d1a636 | Python | 14,948 | 339 | from labdatatools.analysis import *
import argparse
class AnalysisKilosort25(BaseAnalysisPlugin):
def __init__(self,subject,
session = None,
datatypes = [''],
includes = [''],
excludes = default_excludes,
bwlimit = None,
... |
63a49946138dbda000ec96f0954d6f98ca393abc8c5e83e74ffe06a5ea2f5cef | Python | 14,957 | 343 | import numpy as np
import pandas as pd
from sklearn.preprocessing import KBinsDiscretizer
def sample_age(df, n, seed):
np.random.seed(seed) # Set the seed for numpy random number generator
n_bins = 10 # Fixed number of bins
# Discretize the age variable into bins
age_discretizer = KBinsDiscreti... |
69786057218ade5cb49f8cde3004345ce99456c6d18a3f5d9ccc44764297e69e | Python | 14,958 | 382 | import os
import json
import torch
import torch.nn as nn
import numpy as np
import pandas as pd
from dgl import batch, unbatch
from dgllife.utils import atom_type_one_hot, atom_formal_charge, atom_hybridization_one_hot, atom_chiral_tag_one_hot, atom_is_in_ring, atom_is_aromatic, ConcatFeaturizer, BaseAtomFeaturizer, Ca... |
6301961da27fa2be251b306aaace6a6e4f44ee32f599f3ea2d675c5fc7bdf839 | Python | 14,959 | 420 | #!/usr/bin/env python
import os
import subprocess
import ruamel_yaml as yaml
import configure_seaborn as cs
import matplotlib.lines as mlines
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
import seaborn as sns
import utils as utils
from matplotlib.gridspec import GridSpec
from matplotlib.p... |
ec6227c197ffc81fe47fadf8022eeb3d580cfed45375115796684fa66050d1e8 | Python | 14,961 | 313 | # %%
import torch
from torch_geometric.nn import to_hetero,GeneralConv
from torch.nn import Linear
import torch.nn.functional as F
from sklearn.metrics import roc_auc_score,average_precision_score
import numpy as np
import random
import pandas as pd
import torch_geometric.transforms as T
from sklearn.metrics import pre... |
d76911cff9468883fc2bbc3c8f7647e7f3935acf5d51bda6ddb877a451986142 | Python | 14,966 | 324 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import numpy as np
import matplotlib.pyplot as plt
import KC_population_calcium_rate_model_functions as mdl
import fit_functions as ff
import plotting_related_functions
import pandas as pd
from scipy.optimize import curve_fit
from lmfit import minimize, Parameter... |
fd14b6b810b3082d7b938cd1c55b37425c96259d4f515a768b1a42cbe11cc1bc | Python | 14,966 | 485 | # Copyright (C) 2020-2022 Intel Corporation
# Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from __future__ import annotations
import ast
import hashlib
import importlib
import logging
import os
import platform
import re
import stat
import subprocess
import sys
import sysconfig
import traceback
i... |
fdc1928d528a5a00ae91a295bffafb805a464f3636482a17d84d2adfcf133175 | Python | 14,976 | 427 | #############################################################################
# Copyright (C) 2020-2025 MEmilio
#
# Authors: Agatha Schmidt, Henrik Zunker, Manuel Heger
#
# Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file exce... |
f95e656073193c2477cc46729c3e0929ccce202abe538c86ce5f74de5be1243b | Python | 14,977 | 377 | import json
import logging
import os
from collections import namedtuple
from datetime import datetime, timedelta
import matplotlib.pyplot as plt
import numpy as np
from detect_peaks import detect_peaks
# def extract_picks(preds, fnames=None, station_ids=None, t0=None, config=None):
# if preds.shape[-1] == 4:
# ... |
f5be1f2523b52ab27a1d63e5e6189e1d050fa9191a03f94964bc5b351580f92a | Python | 14,979 | 353 | from pathlib import Path
import importlib
import cv2
import math
import numpy as np
from skimage.exposure import rescale_intensity
import tifffile
from napari.utils.notifications import show_info
from napari_dmc_brainmap.utils.path_utils import get_info
from typing import Dict, List, Union, Tuple
def chun... |
f2b33c8ddc213b514244df5f6cbde1b5236521386b3b5049668f7170b43d5b5a | Python | 14,988 | 459 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from __future__ import annotations
import argparse
import contextlib
import copy
import getpass
import json
import logging
import os
import stat
import tempfile
import textwrap
from collections.abc import Callable
from pathlib import Path
from urlli... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.