sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
3dcf6270d84a8597d2b2280c103c6001943fa9fa7a1240c417b5098516f5201a | Python | 10,809 | 230 | # coding=utf-8
# Copyright 2018 The Open AI Team Authors and The HuggingFace Inc. team.
#
# 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
#
# ... |
bfbb38c94c8790046651929b6929b2d7170a1dac64a15ebc559c4c4a6d95d4ce | Python | 10,809 | 241 |
###############################################################################################
# C. Jarne 2023 Analysis Group of D. Vidahurre @cfin #
# #
# Code is used to processing an... |
689c1a59e3c1411ca940532cf969a0150bdaba3e55d2b79322c7d04c991451b5 | Python | 10,811 | 236 | """
Generates a 5 second window with signal, spikes, and bursts detected using both the machine learning approach,
and by using default Max Interval parameters. The bursts are layered one above each other, with different colors:
blue and red. Which burst is at the top (colored in blue) or at the bottom (colored in red)... |
852af852140466a34ea2dde9d0fd733c8657a6e84eae61b0ed4ad19b28a935d9 | Python | 10,812 | 266 | from abc import abstractmethod
from typing import List
import pandas
import numpy as np
from merlin.core import dataset
class BarcodeDB:
"""
An abstract class for storing and retrieving barcode information.
For each barcode in the database, the following information is stored:
barcode - the err... |
9272c7e09cb64fd32edc18e7179bd12c19cec54b5c820a20d0d4122e9c70fa93 | Python | 10,812 | 267 | # 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
#
# ht... |
9158f4d2f630dcf8aaf081038352bdc74f4de02b06fb028942e9483d78161d13 | Python | 10,814 | 287 | """AdditiveMIL in TensorFlow.
Matches PyTorch implementation exactly.
Copyright (c) 2024 University of Michigan. All rights reserved.
Licensed under the MIT License. See LICENSE for license information.
"""
import tensorflow as tf
from tensorflow import keras
import logging
class TruncatedNormalInitializer(keras.i... |
682c493d9e8d0bed9e0d9e3daa5e36f4d74da79481cbc39311bd66a8fdea2e61 | Python | 10,815 | 371 | import math
import torch
from torch import einsum
import torch.nn as nn
from einops import rearrange, reduce
from einops.layers.torch import Rearrange
import torch.nn.functional as F
import numpy as np
# adopted some classes from ucidrains/enformer-pytorch
def exists(val):
return val is not None
def default(val... |
78f6876309888b52a5257a4afe508b4aec099e58c3499de82600a3aaacfa485a | Python | 10,815 | 327 | from collections.abc import Mapping
from os import PathLike
from pathlib import Path
from typing import Any, Literal, Self, TypeAlias
from pydantic import (
BaseModel,
ConfigDict,
Field,
NonNegativeFloat,
NonNegativeInt,
PositiveFloat,
PositiveInt,
model_validator,
)
MoleculeType: Type... |
e57205e89da7fb24c60d7edd8390913804ccc5426a2dca943517e96243ef94bf | Python | 10,816 | 290 | import numpy as np
import pandas as pd
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.initializers import RandomNormal
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Input
from tensorflow.keras.layers import Conv2D
from tensorflow.keras.layers import Conv2DTranspose
f... |
a1a01abcb59ae8b159cf581fce3c7c751df74871767178b46a3ec4afc4ec0070 | Python | 10,817 | 259 | """
Script for extracting particles from membranes by template matching
Input: - Directory with the _imod.csv files with reference picked particles for each microsome
- Directory with offsets for each microsome in a tomogram
- Directory with the cross-correlation maps
Output: - A... |
b563fe2b5b92c672725eedd61349241f79e20184417ae51ac5ec9d87339d84be | Python | 10,817 | 294 | """Base option parser setup"""
import logging
import optparse
import shutil
import sys
import textwrap
from contextlib import suppress
from typing import Any, Dict, Generator, List, Tuple
from pip._internal.cli.status_codes import UNKNOWN_ERROR
from pip._internal.configuration import Configuration, ConfigurationError... |
82f324db2aa401678e22f5bc2e167dc38f6634c9c4f2bd4cea80687a9ab64fe7 | Python | 10,818 | 329 | # %%
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.autograd import Variable
import argparse
import numpy as np
import pandas as pd
import torch.nn.init
from tqdm import tqdm
import pickle
import matplotlib.pyplot as plt
import os
from sklearn.metrics.cluster i... |
8f15065ebcde3e26e266b3dec48403ac40f17ed6bcda3c95cb3514844c3d0bfd | Python | 10,819 | 234 | """
This script does the following:
- Whenever a user pushes a git tag in the format '<tool>-<version>' this script will parse that tag.
The 'v' character prefixing the version will be stripped.
- The script will build the tool with the given version and deploy it using Maven with version equal to the 'version'
par... |
414196f48a576babea6473bfba9fc0aaf5201561b586725e48bf7c8fb1090c07 | Python | 10,820 | 328 | import collections
import torch
from torch import nn
from torch.distributions import Normal
import numpy as np
# A few helper functions here have been imported from the scvi-tools repo and adapted
# for our use in order to avoid adding scvi-tools to the installation requirements of
# this package as scvi-tools has man... |
5fa1afbae5383e61f818c658c91294d2ac4f8458d5474785df7ac2e5e3010595 | Python | 10,821 | 315 | #!/usr/bin/env python3
"""
openmm_trajmerge.py
Merge non-overlapping chunk files produced by openmm_proteinwater_chunked* scripts
into one continuous trajectory and one log. Skips any missing or empty chunks.
Usage:
python3 openmm_trajmerge.py <pdbid> [options]
Positional arguments:
pdbid 4-le... |
ca17a8be5bafceced131078a8a52709f185cb7706ac1dc602f91bf174fe80630 | Python | 10,822 | 267 | #!/usr/bin/env python
#******************************************
#
# SHARC Program Suite
#
# Copyright (c) 2023 University of Vienna
#
# This file is part of SHARC.
#
# SHARC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
#... |
ca5d863d4725cd6fa76bf56b91e6e3c7f705546139d8daefea9b9aa316b94240 | Python | 10,822 | 293 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
3ccb63748925086d5f43d48642a2d409762fb32f9cf3018be69013c3c6ed26c4 | Python | 10,823 | 237 | #!/usr/bin/env python
# Copyright (c) 2019 Intel Corporation
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
Wrapper for autonomous agents required for tracking and checking of used sensors
"""
from __future__ import print_function
import mat... |
e3130efb721610fe6e550ab06453e227fc590c7d5361f5c7265514419fb6b9b8 | Python | 10,824 | 244 | """
#!/usr/bin/env python
# -*- coding: utf-8 -*-
Atchuth Naveen
Code developed at UC Irvine.
Contains registration pipeline for performing non linear laplacian registration in 3D space.
Performance optimizations:
- CG solver with diagonal (Jacobi) preconditioner (replaces LGMRES)
- Threaded parallel solves... |
170a83ead6ef5c94caf7721b1b10bfe4b1b4f4a97b6b6166fca46f11cdecc1da | Python | 10,825 | 358 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
3b05e2ea8f0053b1195a63e0cd428d75da0c569e9b49584af0d1ed4e2f102097 | Python | 10,825 | 308 | #
# MIT License
#
# Copyright (c) 2022 GT4SD team
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge,... |
202e617732d84e1c68a69be42da4fdd8831001d71945e0956683db6f05fcf1a6 | Python | 10,827 | 321 | # -*- coding: utf-8 -*-
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys, os... |
7549468e2c7ba2be6325ee38ca44356c9b38022fd445780884b751b2f8bb96f7 | Python | 10,828 | 273 | # simple wrapper for gensim's poincare model
# source: https://github.com/RaRe-Technologies/gensim/blob/develop/gensim/models/poincare.py
# import libraries
import pandas as pd
import numpy as np
from sklearn.metrics import precision_score, recall_score, f1_score, classification_report
from sklearn.model_selection imp... |
ef012adcf0d66ca06498121ef77e8b4194cff07ea55e5e6522a35c132d8aaaca | Python | 10,829 | 281 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
3cbf2e0970a614df59f5760c187d170884c3a89df02e3518be721d6f5e58b58e | Python | 10,833 | 347 | import dill
import os
import json
from string import printable
import sys
try:
from pregex import pregex
except:
print("Failure to load pregex. This is only acceptable if using pypy",file=sys.stderr)
from dreamcoder.task import Task
from dreamcoder.type import tpregex, arrow
from dreamcoder.utilities import g... |
c515e1eb47ca32b8a2829ac93211b89fb84c7340357cf4cab0be154fc4e984aa | Python | 10,833 | 334 | #!/usr/bin/env python
# Functions for plotting in python
import h5py
import math
import matplotlib.pyplot as plt
import numpy as np
import os
import Gabor_filter_functions as gf
from matplotlib.colors import ListedColormap, LinearSegmentedColormap
import matplotlib
import matplotlib.pyplot as plt
matplotlib.rcParams[... |
1ceb41fe80759950c7742553575efa88e6fc03a0c6d393dfa396c8acd297cc3e | Python | 10,835 | 226 | import argparse
import random
import sys
from timeit import default_timer as timer
import numpy as np
import torch
from scipy import stats
from torch.utils.data import DataLoader
from utils import data_setup, model, engine, utils, loss_function, data_preprocess, augmentation_utils
if __name__ == "__main__":
# se... |
d4b515b8ff35370fc69fa9d7e4fe9dd9b55046259fd77ee0c14321e0d97e5be5 | Python | 10,835 | 226 | import os
import contextlib
import numpy as np
from scipy import stats
from scipy import linalg
from gglasso.problem import glasso_problem # (We began using the GGLasso package (https://gglasso.readthedocs.io/en/latest/) after sklearn's GraphicalLasso would not converge for all subjects for the tested hyperparameters)
... |
4d43020faa43b8793b1be05695a003bb61e1c4cf3517ace697d77c5bd5e79004 | Python | 10,840 | 242 | # Copyright (c) MONAI Consortium
# 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, so... |
5940446b4ae6e3587869a30cb1a4abe29d6339ae6cfcb9b89eaa3c45d366e3a6 | Python | 10,841 | 286 | # import libraries
import torch
import torch.nn as nn
import torch.utils.data as utils
import copy
import matplotlib.pyplot as plt
import numpy as np
import os
import model
import matplotlib
from tqdm import tqdm
matplotlib.use('TkAgg')
# np.random.seed(42)
# torch.manual_seed(42)
def NMSE_loss(input, target, weight... |
7fb35b07387f694eb20284327f903f35dda7de35657b1ebb55fd5b701242b3b0 | Python | 10,841 | 350 | import os
import pickle
from neuralPCAClassifier import Classifier
import random
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
from random import randint
import sys
def getRandomRocPoints(patients):
answers = []
for i in range(0, len(patients["validation... |
ff9ae35b3bfe4ff2fd16750c3ae465abc965f9a39db4cb0439a669f24f0b504e | Python | 10,844 | 288 | """
Render Orient to Best View over the AdK open-to-closed transition (MDAnalysisData).
uv run docs/dev/viewpoint_trajectory.py OUT_DIR [VARIANT ...]
uv run docs/dev/viewpoint_trajectory.py OUT_DIR combine
Renders the same playback with a fixed front view and with Orient to Best View
under the settings in VAR... |
25c8305e7434f1951b7407ffda468b6fc4c8a41e076666308785a3a501a3ba3f | Python | 10,845 | 267 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 10 15:35:06 2021
@author: eveshalom
"""
import os
import pydicom
import numpy as np
from plots_and_filters import MedianFilter
def mkdir_p(mypath):
'''Creates a directory. equivalent to using mkdir -p on the command line'''
from errno imp... |
2471afc4acebc42aa0d5473153b9160ccf11f0613015dfcf16681a624dab848e | Python | 10,846 | 368 | """Class and methods for saving objects.
CLASSES
-------
SaveObject
- A class for inheriting specified attributes from another class object.
METHODS
-------
confirm_overwrite
- Asks the user to confirm whether a pre-existing file should be overwitten.
check_before_overwrite
- Checks whether a file exists at a ... |
6bda2d30375f3a3e1eca7a000f5a2190897f029cf82809cf250829266c027c60 | Python | 10,851 | 266 | punctuation_list = ['.', '?', ',']
digit_list = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
capital_letter_list = [chr(item) for item in range(65, 91)]
low_letter_list = [chr(item) for item in range(97, 123)]
begin_words = ["find", "what", "solve", "determine", "express", "how"]
end_words = [".", ",", '?', "if",... |
6f3b4b060368d42f3a8e6cc7080eb193110436985708fe8a0d65ed1da1e9aa06 | Python | 10,853 | 235 | """
Script to run pan-cancer classification experiments for all chosen combinations
of gene and cancer type.
Output files are identified by {gene}_{cancer_type} (in this order).
"""
import sys
import argparse
import itertools as it
from pathlib import Path
import numpy as np
import pandas as pd
from tqdm import tqdm
... |
d09770f60abb3548aa4418228214b83ef351d328057a04d1b005936a4f3c1844 | Python | 10,855 | 257 | # -*- coding: utf-8 -*-
"""
Created on Mon Jun 17 14:54:29 2024
@author: anne hoffmannan
"""
# Import python packages: numpy, matplotlib.pyplot, seaborn
import numpy as np
import matplotlib.pyplot as plt
#import seaborn as sns # plot style
# Import simulation function
from lqgfunctions import runSimulat... |
a2fde37b60eae2a530def8a092e2aa4e924c57c9637f9a96b1ec012a0671779d | Python | 10,856 | 299 | import numpy as np
import pandas as pd
from cv2 import imwrite
from skimage.color import rgb2gray
from math import floor
import decimal
from skimage.morphology import erosion
from scipy.ndimage.filters import minimum_filter
from skimage.exposure import adjust_gamma
from skimage.transform import resize
from sklearn.prep... |
c60e0decd85b83dd0534b3bb1aa5f58645dc3dc96c6ada79a4d056e4c6bc94aa | Python | 10,857 | 238 | import multiprocessing as mp
import os
import tempfile
import unittest
from pathlib import Path
from unittest.mock import patch
import numpy as np
import pandas as pd
from torcheeg.model_selection import TrainTestSplitPerSubjectGroupbyTrial
from .test_utils import _make_dataset
def _interrupted_split_writer(split_... |
5bf33100aa33d5da99329c81b2e284ec87937004870c190aacbdab3967556111 | Python | 10,858 | 385 | import datetime
import os
import random
try:
import binutil # required to import from dreamcoder modules
except ModuleNotFoundError:
import bin.binutil # alt import if called as module
from dreamcoder.dreamcoder import explorationCompression, commandlineArguments
from dreamcoder.domains.arithmetic.arithmeti... |
7bc5a1be184d594aec336366e6d87da2d674ea52aa867d071824a2255efe82eb | Python | 10,858 | 305 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
dbf5fd6ed0c6c81ba9eeabdd3d7feae9eec9275f02e8cdd16d2099b6474f95b3 | Python | 10,860 | 347 | import pandas as pd
import rdkit.Chem as Chem
from fragment import *
from rdkit.Chem import Draw
#from rdkit.Chem.Draw import IPythonConsole # Needed to show molecules
from rdkit.Chem.Draw.MolDrawing import MolDrawing, DrawingOptions # Only needed if modifying defaults
from rdkit.Chem.Draw import rdMolDraw2D
from ... |
7b528b9cc2f8abee8e5fc26532f7c92e01d6ff157c35870ef4197108436c3c86 | Python | 10,867 | 343 | from pathlib import Path
import typer
from click import Context
from rich import print
from typer.core import TyperGroup
from fidnet import config
class OrderCommands(TyperGroup):
def list_commands(self, ctx: Context):
"""Return list of commands in the order
they should appear."""
return... |
00a31074a5f56e9ca4155e9e73a3bfaa331ac5b187abb9aa59ced24e430ba2fd | Python | 10,870 | 269 | from PIL import Image, ImageDraw
import random
import torch
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms
from pytorch_lightning import LightningDataModule
from ..shapes import *
from ..color_set import ColorSet, RandomColorSet
from ..colors import Color, RandomGrey
default_shape... |
5f6c7a542a67bcc42404ba972cb8b86d7d146801a69bd7df3bcccc92a865f3f6 | Python | 10,872 | 297 | import numpy as np
import pandas as pd
from cv2 import imwrite
from skimage.color import rgb2gray
import matplotlib.pyplot as plt
from math import floor
import decimal
from skimage.morphology import erosion
from scipy.ndimage.filters import minimum_filter
from skimage.exposure import adjust_gamma
from skimage.transform... |
dae02af68a0ea0af379167b5e292c1abae903e518fdb3d9d08a52aa4fdb2bdee | Python | 10,873 | 283 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon May 22 22:18:59 2023
@author: felipe
"""
import numpy as np
import sys
import os
sys.path.append(os.path.abspath('../../'))
import analysis.frequency as frequency
import analysis.synchronization as synchronization
import scipy.io as sio
import scipy.si... |
74361260041145e6d7d5d82ca7245e27cc7c4a0f5e6f34657e0373fbc0ccc374 | Python | 10,877 | 299 |
"""
DeepLabCut2.0 Toolbox (deeplabcut.org)
copyright A. & M. Mathis Labs
https://github.com/AlexEMG/DeepLabCut
Please see AUTHORS for contributors.
https://github.com/AlexEMG/DeepLabCut/blob/master/AUTHORS
Licensed under GNU Lesser General Public License v3.0
Adopted from DeeperCut by Eldar Insafutdinov
https://gith... |
7d385c5e0a2f9223e562394ed9e28bafa931e6fe7763aa3f45641ed4795d53fe | Python | 10,878 | 288 | # encoding: utf-8
import _init_paths
import fire
import time
import pandas as pd
import os
import numpy as np
import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
import torchvision
import torch.nn.functional as F
from tqdm import tqdm
from collections import OrderedDict
from torch.utils.data impor... |
09b4c76bfade47283a5152dce20413d369ac7216f271ae763d0cd85b82015c78 | Python | 10,879 | 263 | """Pure helper tests for the preview panel (no Qt / no pyqtgraph viewer needed)."""
import numpy as np
def test_percentile_levels_basic():
from regtools.registration.gui.preview_panel import percentile_levels
a = np.arange(100, dtype=np.float32) # 0..99
lo, hi = percentile_levels(a)
asser... |
ab00c006cf0f275169637d180ee25b311576b55aebad777bcdaa92a5cfd10cab | Python | 10,879 | 316 | """Resnet model.
Adapted from torchvision. See THIRD_PARTY for third party license info.
https://github.com/pytorch/vision/blob/main/torchvision/models/resnet.py
Copyright (c) 2024 University of Michigan. All rights reserved.
Licensed under the MIT License. See LICENSE for license information.
"""
from typing import... |
04578c910424782d7e3e7f28fed643ef1d9526fc3445d8a5dd78da520a80311b | Python | 10,881 | 267 | import pytest
import tensorflow as tf
from starlette.testclient import TestClient
from sitetack.app.main import app
from sitetack.app import pyrophos
from sitetack.app.pyrophos import CohortKind, PyrophosModelKind, PYROPHOS_PREFIX
client = TestClient(app)
# All four label variants, by enum member name (what the API ... |
e6a1c65d53dc65ae3f2e883ab1adf3fc7c8e9674a6776cb4adfdd679b9bd79da | Python | 10,883 | 279 | import torch
import torchvision.transforms as transforms
from torch.optim import *
from models import *
import numpy as np
from torchvision import datasets
from torch.utils.data import DataLoader
from torch.autograd import Variable
import torch.nn.functional as F
import os
from utils import Logger, AverageMeter, accur... |
a68a2ef599558bcf4a2a8e9488b13be535c77b7e288a2a565024fb1921c18ac7 | Python | 10,884 | 358 | import gzip
import logging
import os
import shutil
import types
from pathlib import Path
import pandas as pd
from Bio import SeqIO
from Bio.Blast.Applications import NcbiblastnCommandline, NcbimakeblastdbCommandline
# def get_logger():
# logger = logging.getLogger(__name__)
# logger.setLevel(logging.INFO)
# ... |
ad1de143ba5faf9e7942de639d075d4e19e68e7fe7817b8e1e2b939d93787c65 | Python | 10,884 | 371 | #!/usr/bin/env python
# coding: utf-8
# ### Neural network hidden layer size experiments, summary across all genes
#
# We want to see whether smaller models (i.e. models with smaller hidden layer sizes) tend to generalize to new cancer types better than larger ones; this script compares/visualizes those results acros... |
80814246371f76b8b336a057cba626633f70ea6484ee96c742292f85a9c7fd8b | Python | 10,893 | 356 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
67b8dc8b64094e87a834d8269cb80ee5f1e060cc99ec8de9180d4042ef91591a | Python | 10,894 | 237 | # -*- coding: utf-8 -*-
import torch
import torch.nn as nn
from supar.config import Config
from supar.models.const.crf.model import CRFConstituencyModel
from supar.modules import MLP, Biaffine, Triaffine
from supar.structs import ConstituencyCRF, ConstituencyLBP, ConstituencyMFVI
class VIConstituencyModel(CRFConstit... |
eae381b6f4f752248ea8f2eb11babe5f3a7460552406d499ce2e937ea82bbd37 | Python | 10,894 | 272 | # Source: https://github.com/carla-simulator/carla
import os
import numpy as np
import carla
import pygame
# ==============================================================================
# -- Constants -----------------------------------------------------------------
# ===============================================... |
26437805a82e023a8103e0e54b7be67acce45b0186fc3c14c96e97790c4074e6 | Python | 10,901 | 277 | # Yet another SMR file reader. NIH. Translated from my own C++ code which was based on Malcolm Lidierth's MATLAB code.
# Gary Bhumbra
import numpy as np
import struct as st
class BlockHeader:
channelHeader = None
header = None
precBlock = 0
succBlock = 1
def __init__(self, fh = None, _channelHeader = None)... |
598fc43a7bd6a06ff3cd55c85cd52c70fc95f087fa311434e7534ccb1fb91d8b | Python | 10,906 | 271 | from abc import abstractmethod
from typing import List
import pandas
import numpy as np
from merlin.core import dataset
class BarcodeDB:
"""
An abstract class for storing and retrieving barcode information.
For each barcode in the database, the following information is stored:
barcode - the err... |
c34b556cc38ba59a6990f0cb879cbfaff8d6ca082030bce5b0e1593b3cec121a | Python | 10,906 | 315 | """
Bonito Model template
using FP precision
"""
import numpy as np
from bonito.nn import Permute, layers
import torch
from torch.nn.functional import log_softmax, ctc_loss
from torch.nn import Module, ModuleList, Sequential, Conv1d, BatchNorm1d, Dropout
from fast_ctc_decode import beam_search, viterbi_search
clas... |
ac3c79a53d7d998c8df123f744c9d662fae736db992f8c80a64367879c439be9 | Python | 10,907 | 258 | from typing import Tuple
import torch
from einops import rearrange, repeat
from einops.layers.torch import Rearrange
from torch import nn
def pair(t):
return t if isinstance(t, tuple) else (t, t)
class PreNorm(nn.Module):
def __init__(self, in_channels: int, fn: nn.Module):
super(PreNorm, self).__i... |
2592efb6e58cf36030bf6fd89c4e173f2e4981b04faad247175a4f2b5824c416 | Python | 10,911 | 330 | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions import Normal
from torch.optim import Adam
from collections import deque, namedtuple
import copy
import pandas as pd
class ReplayMemory:
def __init__(self, capacity: int) -> None:
"""
... |
35d5da89f3d3786067fe7a6ce9baf91629f74cfe84df28d9a989d3431247f7e0 | Python | 10,913 | 182 | """
SHIU783_SIM.py — Shiu et al. 2024 whole-brain LIF model, re-implemented in numpy (no Brian2), v783 connectome.
Constants copied from 02-DATA/shiu-repo/model.py. Each neuron:
dv/dt = (v_0 - v + g) / t_mbr dg/dt = -g / tau (both frozen while refractory)
spike when v > v_th; then v = v_rst,... |
37a57dc681f1dd2e9356cbf27bad29e177af54bd2aa06148926b2ca7dc9d9326 | Python | 10,916 | 250 | from __future__ import division, print_function
import torch
import torch.nn as nn
import numpy as np
# Simulated memristor device paras
class memristor_paras():
def __init__(self, layer_id, input_dim, output_dim,N,window_max=4,window_min=0.4,window_flu=False,win_std_flu=0.1,Exp=None):
# layer para... |
fc3e03450cce40aff2afdc810e5a85b3d6d207176de56a8fb760ca532aad7efc | Python | 10,917 | 220 | import os
import sys
from typing import Optional, Dict, Any, Tuple
import warnings
import torch
import torch.nn
from . import OptionalArrayOrTensor
from .rp import RP
class SigmoidRP(RP):
def __init__(self, n: int, nprojections: Optional[int] = None, indegree: int = 5, threshold: float = 0.1,
p... |
d6175522ddbc9375b4432898e262a70f2e4c1dc9649c34c01d13f9816392953d | Python | 10,923 | 232 | import warnings
warnings.filterwarnings("ignore")
warnings.filterwarnings("ignore", category=UserWarning,
message="A NumPy version >=1.18.5 and <1.25.0 is required for this version of SciPy*")
import sys
import os
import argparse
import numpy as np
import pandas as pd
import nibabel as nib
from ... |
26163a459ce4596c383d25e073b9d457c2a4371933aa2b650fd81c2268cccf1d | Python | 10,926 | 289 | import numpy as np
import torch
from typing import List, Optional, Tuple
from bisect import bisect_left, bisect_right
from cosine_annealing_warmup import CosineAnnealingWarmupRestarts
from . import const
from typing import Union
import logging
def generate_optimizer(denoising_model, optim_params: dict, lr: float)... |
9b66f7e1cf75ec85b9a3e43fe936081e5b0af6549494d8b2ac84d3507ff3c1ec | Python | 10,927 | 353 | """This is invoked in a subprocess to call the build backend hooks.
It expects:
- Command line args: hook_name, control_dir
- Environment variables:
PEP517_BUILD_BACKEND=entry.point:spec
PEP517_BACKEND_PATH=paths (separated with os.pathsep)
- control_dir/input.json:
- {"kwargs": {...}}
Results:
- contro... |
a9febe1a4621d018064a7268507edfe76d7d11408c2f8a3e24119eb97cd89bd1 | Python | 10,930 | 291 | import numpy as np
import scipy as scp
from collections import OrderedDict
import plotly.graph_objs as go
def plot_dendrogram(Z_dendrogram, cutoff_line=True, value=15, orientation='bottom', hang=30, hide_labels=False, labels=None,
colorscale=None, hovertext=None, color_threshold=None):
"""
... |
40b222f9bfc13512783e9e62420a3bbdcf63de2acd2e411af694f7bc08278090 | Python | 10,931 | 304 | #
# MIT License
#
# Copyright (c) 2022 GT4SD team
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge,... |
2cb5f34752bdc268cecb6a1dd722b3773aebecda5c3715bad4f4d5ca8aa32f72 | Python | 10,932 | 294 | # morphoglia/metadata/nomenclature.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Nomenclature handling for MorphoGlia filenames.
Two strategies:
1) Key–value mode (preferred): e.g., "group=SS__region=CA1__replicate=R2.tif"
2) Positional fallback: e.g., "CTRL_CA1_T1_R1.tif"
Order is configurable via `f... |
ad958b5923e1ff05ec7bfac75b48a69b8edf9015f41b2c8eb165e6b9cc92685f | Python | 10,935 | 259 | import argparse
import json
import math
from pathlib import Path
from operator import itemgetter
import cv2
import pandas as pd
import numpy as np
from tqdm import tqdm
from flytracking.detection import Detector
from flytracking.detection.utils import preprocess
from flytracking.tracking import Tracker
from flytracki... |
4cb0edf043a52cdcf2da3d9eff9dfa9d84711ae687663815490ff3bb0e447c1a | Python | 10,937 | 288 | """
Tests module catalog
# Author: Vladan Lucic
# $Id$
"""
from __future__ import unicode_literals
from __future__ import absolute_import
__version__ = "$Revision$"
from copy import copy, deepcopy
import unittest
import os.path
import numpy
import numpy.testing as np_test
import scipy
from pyto.analysis.catalog ... |
8ff25fbba43a5f726e45e6a3e16e1ce7ea7274c5ea2af5058102dbbec86b68f7 | Python | 10,939 | 286 | #!/bin/env python
"""
OXASL: ASL processing pipeline
==============================
Overview
--------
This module (and the associated command line tool) provide a 'one stop shop'
for analysing ASL data. They call the various other modules to preprocess,
correct, register, model and calibrate the data, outputting the ... |
9e62806c4d5f4ef632d35147639584dbec2db28b70e350eb80ae9b3fb3c0c505 | Python | 10,941 | 331 | """Morphology reconstruction data structure."""
import math
from collections import deque
import numpy as np
from treem.tree import Tree
from treem.io import SWC, load_swc, save_swc
from treem.utils.geom import rotation_matrix, norm
class Node(Tree):
"""Morphology data storage."""
def __init__(self, valu... |
9ba0d95e33029f3b9a75f801979e905b16098f370fdfbed3c93cabd946921544 | Python | 10,942 | 286 | from __future__ import division
import logging
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from IterativeMethod import iterativeTCCT
"""
Created on Mon Jun 24 16:04:07 2019
@author: Hannah Choi
"""
"""
This code finds intra- or inter-module hierarchies of cortical network,
ba... |
60e8b975303f3b93d572228c694646deca6b09473ff1f493ff0868443fba3140 | Python | 10,944 | 330 | import torch
import numpy as np
from utils.complex_utils import complex_utils as Z
class RebroadcastFC(torch.nn.Module):
def __init__(self,config):
super().__init__()
self.config = config
self.img_size = config["img_size"]
self.ms = config["mask_size"]
... |
ccee8846e9a02f191ebf630aa12b7a962a3df7afc0699e0b99a1245ba51d21b1 | Python | 10,944 | 334 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
29b894041c5ebe09530c058d93e6b2dba87b50a6792fe153ee13f8d8199e1a8d | Python | 10,946 | 249 | import torch
from torch import nn
from typing import List, Dict, Optional
from ..utils import _scatter_add, expand_to, add_scaling, find_spin
class AtomicModule(nn.Module):
def forward(
self,
batch_data: Dict[str, torch.Tensor],
properties: Optional[List[str]] = None,
create_graph... |
e5dfa1045e47281b306fc6e33198137c05b1e902e162bd0540fec2b7ac6e1747 | Python | 10,947 | 285 | import math
import torch
from torch_scatter import scatter_max
from torchdrug import utils
class PerfectHash(object):
"""
Perfect hash function.
The function can be applied to either scalar keys or vector keys.
It takes :math:`O(n\log n)` time and :math:`O(n)` space to construct the hash table.
... |
5f4880dff9e8c2b410dc99c4dd0f7fa281ead912a5a67a6cf82349a18b6ce12d | Python | 10,949 | 419 | #!/usr/bin/env python3
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from nilearn.image import load_img, index_img, resample_to_img, math_img
from nilearn import plotting as nplot
from nltools.data import Brain_Data
from nltools.mask import expand_mask
# --------------------------... |
71aeeacd461d06bc424b77a31cddb71bafb1c4018c4e7646b62ad43204efdecd | Python | 10,952 | 286 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
a923fa2fedcaac98da546035ba0544618af239d03b42d047653b70a4d40b69ac | Python | 10,953 | 305 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
9ad970bf55d2536b17b2812c75fca660cc44ee842854b7d1bdb982195c0d7453 | Python | 10,955 | 518 | #!/usr/bin/python
# -*- coding:utf-8 -*-
# -*-mode:python ; tab-width:4 -*- ex:set tabstop=4 shiftwidth=4 expandtab: -*-
#
GAMMA_MIN = 0.1
GAMMA_MAX = 10.0
CONTRAST_MIN = -50
CONTRAST_MAX = 100
UNSIGNED_INT_MAX = 0xFFFFFFFF
UNSIGNED_LONG_LONG_MAX = 0xFFFFFFFFFFFFFFFF
# frame state code
class GxFrameSta... |
d5d2f6b7400fe24912b5eaee293ea95f0d888d61c059bda8fb050bc467d66d1b | Python | 10,955 | 254 | #! /usr/bin/env python
# ==============================================================================
# Copyright (c) 2020, Ko Sugawara
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Re... |
54a4bffe36b9306c870c1005fb7b4beb9070dd469e5d04fe8c92eb07691ec23e | Python | 10,964 | 284 | #!/usr/bin/env python
from __future__ import print_function
import cProfile
import pstats
import argparse
from examples.pybullet.utils.pybullet_tools.pr2_primitives import Pose, Conf, get_ik_ir_gen, get_motion_gen, \
get_stable_gen, get_grasp_gen, Attach, Detach, Clean, Cook, control_commands, \
get_gripper_... |
d4397dfe22d4357a2fcb0a0db0a0387e8662bbcadc16abc0b7daf68bca0ec9e5 | Python | 10,966 | 278 | #!/bin/env python3
'''
Convert particle pools and reactions to Feynman diagrams encoded in NetworkX MultiDiGraphs.
'''
import matplotlib.pyplot as plt
import networkx
from networkx.drawing.nx_agraph import graphviz_layout
from typing import Callable
from enum import Enum
from dataclasses import dataclass
from .pool im... |
3d67fa085d056663f664f3d15401ef253273c55dea1d5d169540e06bdda57056 | Python | 10,969 | 287 | from ckg.graphdb_connector import connector
from ckg import ckg_utils
from ckg.graphdb_builder import builder_utils
import os.path
import time
from collections import defaultdict
import re
import gzip
try:
ckg_config = ckg_utils.read_ckg_config()
oconfig = builder_utils.setup_config('ontologies')
dbconfig ... |
5e27adca7a855c46b1789514b4382c15abe0861b5926af4b1aa615ccb8011421 | Python | 10,973 | 265 | # Copyright 2020 The HuggingFace Team. 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 applicabl... |
908da62ad0b38c335bf659dfe3b37885aaae8a8d2a1d8eab69d1c3e4006067ca | Python | 10,976 | 293 | import cv2
import numpy as np
from skimage import measure
from skimage import segmentation
import rtree
from shapely import geometry
from typing import List, Dict
from scipy.spatial import cKDTree
from merlin.core import dataset
from merlin.core import analysistask
from merlin.util import spatialfeature
from merlin.ut... |
27cea60f12bf305508577ad589039a85af469c7862a3903f33d5da195013ea32 | Python | 10,977 | 307 | #!/usr/bin/env python
# This script is used to download data from the Allen Brain Observatory. It is based on the Allen SDK and
# first downloads the data, then selects a subset of the data, and finally saves the data into Syncopy data files
# and, additionally, in a MATLAB file for usage with Fieldtrip.
import os
i... |
8a7ea540e6ec8381747a1ce4d62615b59bba6d0edbafcb417c584222d32f6d4e | Python | 10,977 | 271 | """Download the Kim Lab Developmental CCF (DevCCF) adult (P56) multimodal templates.
Source: Kronman, Kim et al., "Developmental mouse brain common coordinate framework"
(Nature Communications 2024). Data: figshare DevCCFv1 (article 26377171), P56.zip.
https://figshare.com/articles/dataset/DevCCFv1/26377171
... |
0a1a37433f408f26c1b5fefc6a5d661e65dd2fec11b82749bf6da4d2082b501a | Python | 10,978 | 293 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
d3a87c8e5c890bfbb2a98c9a8ac237ebc624aadcf107cb1fa493c8dd5fbfa93d | Python | 10,978 | 209 | """
READOUT_PHASE_INVARIANCE.py - written 2026-09-16. Reconciliation for D-04.
WHY THIS FILE EXISTS.
THESIS.md speaks of "this project's readout" as one thing. It is two things, and they
are not the same function.
EFFECTOME_*.py (eight scripts, including EFFECTOME_MATCHED_NULL.py, which is where
... |
8d43b802e29fe9fe241637bedaccc1add46139812c22a85c8808c4aa9bd18595 | Python | 10,980 | 304 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created by : Alpha Renner (alpren@ini.uzh.ch)
"""
import os
import sys
import warnings
import argparse
import matplotlib.pyplot as plt
import numpy as np
try:
print(sys.path)
print(os.path.dirname(__file__))
sys.path.append(os.path.join(os.path.dirname(__... |
179e3facc7f89cbec4609a9b800489e7010dd855dfbaa1c55ac8686b7c0650b0 | Python | 10,981 | 393 | import math
import random
from dreamcoder.utilities import *
class InvalidLoss(Exception):
pass
class DN(object):
'''differentiable node: parent object of every differentiable operation'''
def __init__(self, arguments):
self.gradient = None
if arguments != []:
self.data = No... |
5c4040fc63d44705c971d278bf5d5a6f9a11b41910cbf35258469ec3c6b7f748 | Python | 10,983 | 391 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
4b3dc1e831515c6b12375141e226d31fbd246b06fcd44e85611ce2e7805df8b4 | Python | 10,987 | 323 | """Shape inference rules for LUTron filter graphs.
This module provides rules for inferring input/output shapes, attaching filter
parameters, and propagating channel information through the graph.
"""
from typing import Any
from elasticai.creator.experimental.ir.shape_inference import (
get_default_shape_inferen... |
7097ec5f475328aaa50ff3e56a2cc3eb239da1ea1178c141a7c11ff7a99b7658 | Python | 10,988 | 328 | import torch
import argparse
import numpy as np
import pandas as pd
import xgboost as xgb
from torchsummary import summary
from m6a_semi_supervised_ipd import M6ANet
from sklearn.metrics import (confusion_matrix,
accuracy_score,
precision_score,
... |
ce0c7f1c1732c731ef1d3e6e5862e474fe0c765d1b627d1d8564092432260a43 | Python | 10,989 | 374 | from pathlib import Path
import pytest
import yaml
from pydantic import ValidationError
from calvados.cfg import Components, Config, Job
from calvados.inputmodels import ComponentInput, SimulationInput, validate_inputs
def test_config_uses_model_defaults_and_serializes_values(tmp_path: Path) -> None:
config = C... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.