sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
401ef7b5ac5f6d501e595b57b84d207e999f41f1de82608815bf469c6f98785d | Python | 5,468 | 160 | from itertools import chain
import numpy as np
from elasticai.creator.file_generation.savable import Path
from elasticai.creator.file_generation.template import (
InProjectTemplate,
module_to_package,
)
from elasticai.creator.nn.integer.ram.design import Ram
from elasticai.creator.vhdl.auto_wire_protocols.por... |
df0dc584afb10e86406eadd03ae28ca5637c4537146c2ea59490c144401439f4 | Python | 5,468 | 160 | from torchvision.models.resnet import resnet50
from torchvision.models.vgg import vgg19_bn
from torchvision.models.vision_transformer import vit_b_16
from torchvision.models.swin_transformer import swin_t
from .autoencoder import AutoEncoder
from .convnet import SimpleConvNet, RecurrentConvNet
from .linearnetworks impo... |
498b8bc30b63df044f4d80c77a3fda629d8c7baf273db904f162b2f488fe2868 | Python | 5,469 | 173 | ### python scripts for transferring label to teratoma time series data
source anaconda3/ENTER/etc/profile.d/conda.sh
conda create -n scvi-env python=3.9
conda activate scvi-env
conda install scvi-tools -c conda-forge
import scanpy
import numpy as np
import pandas as pd
import scvi
import matplotlib.pyplot as plt
impo... |
84201835f9ef04a90464e33cf365af5ee6d48907b7be7e26cece02626e70e1fb | Python | 5,469 | 108 |
import glob, os, sys
import numpy as np
import pandas as pd
path = '/m/cs/scratch/networks-pm/effects_externalfactors_on_functionalconnectivity/results/H3'
strategy = '24HMP-8Phys-Spike_HPF'
atlas_name = 'seitzman-set1'
measure = 'reg-links' #'parti-coeff'
#load atlas
if atlas_name=='seitzman-set1':
atlas = pd.... |
3deef5ba5c4bce713e55bec9a8f0102262eaa981f78f5d49131a223f33b773f6 | Python | 5,470 | 145 | import os
import tensorflow as tf
from tensorflow.keras import layers
from tensorflow.keras.models import Sequential
import matplotlib.pyplot as plt
import numpy as np
from sklearn.utils import class_weight
class Network:
def __init__(self, image_shape, num_classes):
self._training_data =... |
46d933a7b7dd838e6a9631646d72aff3c4dd1b0c34e0fa43c45c25ddb729bbf2 | Python | 5,470 | 165 | # Implements auto-encoding variational Bayes.
import itertools
from data import load_mnist, save_images
import autograd.numpy as np
import autograd.numpy.random as npr
from autograd import grad
from autograd.misc.optimizers import adam
from autograd.scipy.special import expit as sigmoid
from autograd.scipy.stats imp... |
3f6730b844c8120f12fe4caa597d7c53886272100b5f1bb5524b4d14bee33335 | Python | 5,471 | 121 | """Parity tests for the canonical point-orientation helpers.
The whole point of ``regtools/registration/point_orientation.py`` is that points
travel through the EXACT same orientation as the image/volume. These tests pin
that by orienting a marked image/volume with the real ops and asserting the
oriented points ... |
85ad7557fa9a94612ca52a5f5ec171681d1e2493599da364e720c07f37708684 | Python | 5,471 | 185 | # 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... |
feb336a5234a38d2de82da091525804adccde7d4d0e0fbd1c7acc00f790117a8 | Python | 5,471 | 162 | """Utilities for writing content to files and for other file manipulation."""
import os
import tempfile
import urllib.request
from xml.dom import minidom
from xml.etree import ElementTree
from semantic_version import Version
from hed.errors import ErrorContext, HedExceptions
# you can fill this in locally if you do... |
da52d29622f4db963e60c7dd7c66eeb644037af85cc83a9cf83b54616f6653bd | Python | 5,472 | 160 | import sys
from fractions import Fraction
from math import ceil
from typing import cast, List, Optional, Sequence
if sys.version_info >= (3, 8):
from typing import Protocol
else:
from pip._vendor.typing_extensions import Protocol # pragma: no cover
class Edge(Protocol):
"""Any object that defines an edg... |
e14f3a367ac158260bf7c1926edd6a31a8227707b9297779fd64094bdecd312a | Python | 5,473 | 122 | import argparse
from matplotlib import pyplot as plt
import pandas as pd
import pytorch_lightning as L
import seaborn as sns
import sys
from statsmodels.stats.descriptivestats import sign_test
# local imports
sys.path.append("..")
from shapelearningtheory.datasets import make_dataset
from helpers import format_table, t... |
3384082782d7e898b780bfe091522bc956f82d2a095b26e2447d0114b953d371 | Python | 5,474 | 122 | from copy import deepcopy
import torch
from torchmetrics.image.fid import \
FrechetInceptionDistance as _FrechetInceptionDistance
def _compute_fid(mu1: torch.Tensor, sigma1: torch.Tensor, mu2: torch.Tensor,
sigma2: torch.Tensor) -> torch.Tensor:
r"""Compute adjusted version of `Fid Score`_.
... |
63c5669a4ace53a1d57d45ce1f11d2cdf79701d5cf8c1cc720c873ae499558a4 | Python | 5,477 | 174 | """An abstract class for implementing data processing methods.
CLASSES
-------
ProcMethod
- Abstract class for implementing data processing methods.
"""
from copy import deepcopy
from typing import Union
import pandas as pd
from abc import ABC, abstractmethod
from coh_handle_entries import ordered_list_from_dict
fr... |
7087b2d803b4b9a7fc58c7dec68d36fe4f613c3c8830d5902d500a1661c9694c | Python | 5,477 | 124 | """
toposampling - Topology-assisted sampling and analysis of activity data
Copyright (C) 2020 Blue Brain Project / EPFL & University of Aberdeen
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation... |
c7b637cf08da4186eddb6f14318c3d7ea854399bd58ea6674951ed699b04b682 | Python | 5,480 | 136 | from ase.neighborlist import neighbor_list
import torch
import numpy as np
import spglib
import ase
from ase import Atoms
from ase.cell import Cell
from phonopy.structure.atoms import PhonopyAtoms
from phonopy.phonon.band_structure import get_band_qpoints_and_path_connections
def read_force_constants(file):
with ... |
273366f6146bcb260aec1a4a63ccab97cd81371ca7c3eb20cdf4514cb04b8177 | Python | 5,482 | 183 | # -*- coding: utf-8 -*-
"""
Created on Sat Aug 22 16:11:11 2020
@author: au571303
"""
from random import shuffle
from psychopy import prefs
prefs.hardware['audioLib'] = ['PTB']
#prefs.hardware['audioLib'] = ['pyo']
from psychopy import visual, core, sound, event, gui, logging
import os
import numpy as np
from sys impo... |
9dc3b5bbf2b13f3c3e9c5042a6940e023ea341d4e2d959172e95a953cb107e41 | Python | 5,482 | 125 | from copy import deepcopy
import torch
from torchmetrics import Metric
def _compute_fid(mu1: torch.Tensor, sigma1: torch.Tensor, mu2: torch.Tensor,
sigma2: torch.Tensor) -> torch.Tensor:
r"""Compute adjusted version of `Fid Score`_.
The Frechet Inception Distance between two multivariate Ga... |
d31fafb66c989ccf4d62bd4b2125fb1794c1a8312f7c8d7939bc22f31b9d8881 | Python | 5,482 | 114 | # src/preparation/generate_proteins_table.py
# Remark: Must be run from base directory (so that './data' is a direct subdirectory)
# Import public modules
import torch
import tqdm
import collections
import pandas as pd
from pathlib import Path
# Import custom module
import utils
# Define folder and file paths
# Def... |
3915718cd8907a83a96c60cd02f071cb34b8db44e63f42c3637101284362683e | Python | 5,483 | 147 | import torch
import torch.nn as nn
def _square(x):
return x * x
def _safe_log(x, eps=1e-6):
return torch.log(torch.clamp(x, min=eps))
class Expression(nn.Module):
def __init__(self, expression_fn):
super(Expression, self).__init__()
self.expression_fn = expression_fn
def forward(... |
b7ec596c2f2d7f92d5a75dd5a3d57080064013d43a83001cd6002940d4362a90 | Python | 5,484 | 163 | import numpy as np
def before_trial_normalize(data: np.ndarray, eps: float = 1e-6):
r'''
A common hook function used to normalize the signal of the whole trial before dividing it into chunks.
It is used as follows:
.. code-block:: python
from functools import partial
dataset = DEAPD... |
6813d52db783195474343e04e3e6d0aad910a533c6683021165a930184c26ffd | Python | 5,485 | 201 | from collections.abc import Callable
import pytest
import torch
from elasticai.creator.nn.fixed_point.conv1d.layer.conv1d import Conv1d
@pytest.fixture
def conv1d() -> Conv1d:
return Conv1d(
total_bits=16,
frac_bits=8,
in_channels=3,
out_channels=4,
kernel_size=2,
... |
6f46fe62b6369929b4b01e6f581a78e1a0cd07e1daaad6bd4266feab6677006a | Python | 5,485 | 151 | """Utility functions for dealing with Atoms."""
from __future__ import annotations
import logging
from typing import TYPE_CHECKING
import numpy as np
from quacc.atoms.core import copy_atoms, get_atoms_id
if TYPE_CHECKING:
from ase.atoms import Atoms
logger = logging.getLogger(__name__)
def prep_next_run(ato... |
2297674c1e2eec0114ff46d937077876a7e1f37209cb8b4acaa1be8e607ed0f3 | Python | 5,486 | 211 | import argparse
import numpy as np
import meep as mp
def main(args):
if args.perpendicular:
src_cmpt = mp.Hz
fcen = 0.21 # pulse center frequency
else:
src_cmpt = mp.Ez
fcen = 0.17 # pulse center frequency
n = 3.4 # index of waveguide
w = 1 # ring width
r = 1... |
b787d04e3007f0e8f09889eb483822d81e243f47a284a5ae3b93683e85f789f5 | Python | 5,486 | 138 | import argparse
from loader import BioDataset
from dataloader import DataLoaderMasking
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from tqdm import tqdm
import numpy as np
from model import GNN, GNN_graphpred
import pandas as pd
from util import MaskEdge
from t... |
4e4372018239d46a7981d7c4328cb90cde955e91af33fa44acf429881cc20ed0 | Python | 5,488 | 167 | """
Script for computing signed distance for membrane segmentations and generating cropped tomograms
Input: - Density map tomogram
- Membrane segmentations
Output: - Cropped density maps for segmentations
- Signed distance map
- Signed segmentation (mb=1, inside=2 and... |
14022466e0efcb483107c210d4ca8eed80324f5fe88edb03b1f70b2b9d85903b | Python | 5,489 | 141 | import numpy as np
import cv2
from scipy import ndimage
from skimage import morphology
from skimage import filters
from skimage import measure
from pyclustering.cluster import kmedoids
from typing import Tuple
from merlin.util import matlab
"""
This module contains utility functions for preparing imagmes for
watersh... |
7be1c069462273c96c1f2c140884b2aa0047e63bbf7381d6ead65017fad355e0 | Python | 5,489 | 156 | from Functions.f_AnalysisGraphs import *
from Functions.f_ECGAnalysis import *
from Functions.f_AnalysisGraphs import *
from Functions.f_AnalysisStatistics import *
import os
import scipy.io
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
matplotlib.use('TkAgg')
##
Data_dir = './../Dat... |
2f4bb1d8fd3b8c13961c870feb0e7aeb1bafc1b495c40dd5c9521b6943af1151 | Python | 5,490 | 116 | from scipy import io
from .synaptic_weights_matrices import normalize
from .synaptic_weights_matrices import generate_synaptic_weights_matrices
from typing import Optional
def read_onsets_from_mat(mat_path: str) -> tuple[list, list, list]:
"""Extract onset moment from matlab files with the matlab file with all
... |
8aeffd659da4f17febb89fba31be111d8368942505e2abbf6e2115178dac295b | Python | 5,491 | 169 | # 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... |
f44b02f5b2d872e17d1a4ad5311fdd4464ec2249a5326510534e705b904334fa | Python | 5,492 | 151 | """Utility functions for dealing with Atoms."""
from __future__ import annotations
from logging import getLogger
from typing import TYPE_CHECKING
import numpy as np
from quacc.atoms.core import copy_atoms, get_atoms_id
if TYPE_CHECKING:
from ase.atoms import Atoms
LOGGER = getLogger(__name__)
def prep_next_... |
1d5e7f6ca9564414b9efb927fdebc2b7f41d699236008ad7509d3b7997f24297 | Python | 5,494 | 163 | import os
import os.path as op
import numpy as np
from tqdm import tqdm
import mne
import matplotlib.pyplot as plt
from scipy import stats
from params import PLOT_DIR as plot_dir
from params import BIDS_ROOT as bids_root
from params import EXTENSIONS as exts
from params import TEMPLATE as template
from params import... |
49ce4f223ee6710fe27ac9f282d86b52bde6a5ed2a4556ca343652b80bffaef6 | Python | 5,494 | 137 | from torch import nn
import torch
from torch.nn import functional as F
class ConvNet3D(nn.Module):
def __init__(
self,
num_input_maps: int = 1,
cat_input_type: str = 'sex_study',
arc_type: str = '1',
):
super().__init__()
self.num_input_maps = num_input_maps
... |
f5abea0e9ee91b4828dfa3d0c7adcab95224e66d6797a1d28df90075b7bb1960 | Python | 5,495 | 178 | import numpy as np
import pandas as pd
from cuppa.classifier.cuppa_compare import CuppaCompare
from cuppa.classifier.cuppa_prediction import CuppaPredSummary
class TestCuppaCompare:
#from cuppa.tests.classifier.test_cuppa_compare import TestCuppaCompare
#self=TestCuppaCompare
pred_summ_old = pd.DataFra... |
68a826e540c79f9366ba2e8825a29db1985b1c2961fd7ec3fbf5a0f0486bafbb | Python | 5,497 | 167 | from itertools import zip_longest
from typing import (
Iterator,
Iterable,
List,
Optional,
Union,
overload,
TypeVar,
TYPE_CHECKING,
)
if TYPE_CHECKING:
from .console import (
Console,
ConsoleOptions,
JustifyMethod,
OverflowMethod,
RenderResult... |
6ca4e801e0398b959bc951b5566012301cb8755a60e10366533e9f13b25d5ba9 | Python | 5,497 | 131 | import os
import argparse
import numpy as np
import pandas as pd
from sklearn.svm import SVC
from sklearn.ensemble import RandomForestClassifier
from xgboost import XGBClassifier
from sklearn.model_selection import StratifiedKFold
from sklearn.metrics import accuracy_score, roc_auc_score, f1_score, average_precision_s... |
6463cb54d6e306ae62206942ea0cceed27a718b7134d7f158f1c0553076ccad3 | Python | 5,498 | 114 | #####################################
######## Paper Draft Cartoon ########
#####################################
#%%# Catalyzer
import os
import sys
path = os.path.dirname(os.path.realpath(__file__)) + '/../Resources'
sys.path.append(path)
import numpy as np
import torch
import time
import pickle
import matplotlib
i... |
eeb977c1020b488a69e8fe0635d2c920b1f8f76d65c1a81bd19c1277fdbf68c4 | Python | 5,498 | 124 | extensions = dict(
required_params=['x', 'y', 'training_frame', 'gam_columns'], # empty to override defaults in gen_defaults
validate_required_params="""
# If x is missing, no predictors will be used. Only the gam columns are present as predictors
if (missing(x)) {
x = NULL
}
# If gam_... |
32c5037ec1abb0e0faa5b71a4c5a5b08f3bc6b129e6048a13376842073020054 | Python | 5,499 | 157 | # 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.
# Modified from github.com/openai/CLIP
import gzip
import html
import os
from functools import lru_cache
import ftfy
impo... |
615ee772c538c27e195dc3f2be90ca1c0c5021b3e3aa85ef0969a8e3949c13eb | Python | 5,500 | 144 | from __future__ import annotations
import pandas as pd
from .base import CompoundLeafType, DeltaType
from .schema import MDict, MDictListDiff, MDictDiff, MessageType
from ..utils import flat_list_of_lists
def get_compound_leaf_type_counter(cd: MDict):
counter = {clt: 0 for clt in list(CompoundLeafType) + [None,... |
c7ef572d1aae0b869a994a9e2ae9dfbae452783cac70067d5432436d200f18e3 | Python | 5,501 | 185 | """
https://github.com/facebookresearch/deit/blob/main/utils.py
"""
import io
import os
import time
from collections import defaultdict, deque
import datetime
import torch
import torch.distributed as dist
import segm.utils.torch as ptu
class SmoothedValue(object):
"""Track a series of values and provide access... |
644e17b5b22013b01779fb586f9a295db63e362d57118e7e62616091a7008630 | Python | 5,502 | 154 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Atchuth Naveen
Command line executable to detect cells and view them on neuroglancer window
to zarr format that can be visualized on neuroglancer
call as: python cell_detection.py --img_dir img_dir --out_dir out_dir {--channel channel}
(append optional argument... |
228af205f454ddb7a492a06871fae2173bf402c95eb3c84d9abb0bbba45c42ab | Python | 5,503 | 74 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
from lab.environments import LocalEnvironment, MaiaEnvironment
from lab.reports import Attribute, geometric_mean
from common_setup import IssueConfig, IssueExperiment, DEFAULT_OPTIMAL_SUITE, is_test_run
BENCHMARKS_DIR=os.path.expanduser('~/repos/downward/benc... |
2fd075c99993828e3f3eff3c8d61a86ce67ea626160fd0e24b15390eb216de34 | Python | 5,503 | 133 | """
toposampling - Topology-assisted sampling and analysis of activity data
Copyright (C) 2020 Blue Brain Project / EPFL & University of Aberdeen
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation... |
33d6e76a74a18870ddda6565b2810ab8262e33fe891674609efff32f5ae3c83b | Python | 5,503 | 177 | import time
from collections import Iterator, namedtuple, deque
from itertools import count
from pddlstream.utils import INF, elapsed_time
# TODO: indicate wild stream output just from the output form
# TODO: depth limited and cycle-free optimistic objects
class BoundedGenerator(Iterator):
"""
A generator wi... |
427a1929d1c4becd3705c5797963a5f7f1502fcb0eb6670153d349a220db7db2 | Python | 5,503 | 184 | # 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... |
56099387b58631b5f931faf21ef03bbc2d457604d86b453866f7af8382df62e1 | Python | 5,503 | 164 | import os
import unittest
import numpy as np
from torcheeg.datasets import (
AMIGOSDataset, BCI2022Dataset, DEAPDataset, DREAMERDataset, FACEDDataset,
FACEDFeatureDataset, MAHNOBDataset, MPEDFeatureDataset, SEEDDataset,
SEEDFeatureDataset, SEEDIVDataset, SEEDIVFeatureDataset, SEEDVDataset,
SEEDVFeatur... |
7d3492c04170dd72a2670407d232e3f471dd76181acfebca0db6e9337f8f964e | Python | 5,503 | 74 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
from lab.environments import LocalEnvironment, MaiaEnvironment
from lab.reports import Attribute, geometric_mean
from common_setup import IssueConfig, IssueExperiment, DEFAULT_OPTIMAL_SUITE, is_test_run
BENCHMARKS_DIR=os.path.expanduser('~/repos/downward/benc... |
8d9a59232f4d001372617f509f14567ecfe55bb6bbe09554303c5b7e29880deb | Python | 5,503 | 160 | #! /usr/bin/env python
from __future__ import print_function
HELP = """\
Run the translator on supported Python versions and test that the log
and the output file are the same for all versions.
"""
import argparse
from collections import defaultdict
from distutils.spawn import find_executable
import itertools
import... |
55a3ee719589b4d9b9dbdca7f1360262b6725b6f6ef5ad4097cdeb3e5e2df16d | Python | 5,505 | 132 | """
Created on 25/05/2020
:author: Chinchien Lin
:summary: Merges channels contained in source field of the configuration field.
Then save in the destination folder
"""
import os
import sys
import numpy as np
import tifffile as tiff
from src.commands.abstract_preprocessing_command import Abs... |
061cc35d6e1b4196314ea2e34622b5ca8b5736ba2d20f9eae49af95c9a6d057c | Python | 5,506 | 179 | # Node-group asset "Density Style Wire" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHE... |
645db965392715121fc229172dbfe5c1b87f9de7b3d270a5ce5d550925aab865 | Python | 5,506 | 156 | # 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... |
aa8b8358f9f2db02c76c3fe1e806c1d883d282c79359fae3e73bf7f38b40f4e7 | Python | 5,506 | 157 | import torch
from .functions import *
class UNetConvBlock(torch.nn.Module):
def __init__(
self,
in_size: int,
out_size: int,
pad: bool,
layer_norm: bool,
norm_mode: str,
data_dim: int,
kernel_size: int,
n_co... |
131a5e0921bd9182c33be2285cfd84d57e7b99f8d5f9aca285f023bf22446c44 | Python | 5,508 | 140 | """
Train a C-WGAN-GP Model on the DEAP Dataset
===================================================
In this tutorial, we'll walk through how to train a Conditional Wasserstein Generative Adversarial Network with Gradient Penalty (C-WGAN-GP) on the DEAP EEG dataset. This will allow us to generate new EEG signals. We'll... |
41f712879310c516f4600361c531abe3ba89ef00879ec37e04067baf0491debd | Python | 5,508 | 106 | #!/usr/bin/env python
import os
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from nltools.data import Brain_Data, Adjacency
from nltools.mask import expand_mask, roi_to_brain
from nltools.stats import threshold
from nilearn import plotting as nplot
from sklearn.metrics import pairwise_distan... |
6916d1642e4f67bc492a41b00308c6e6da0d1c4e23548886d47b2cb21b340515 | Python | 5,508 | 135 | import os
import re
from urllib.parse import quote, unquote
from typing import Iterator, List, Tuple, Union
import pandas as pd
from torcheeg.datasets.module.base_dataset import BaseDataset
from .base_model_selection import BaseModelSelection
from .utils import create_subset, read_indices, validate_groups, write_ind... |
91fa9db813c060428e7d452239461f0fea9266034d69cb761358b3dffaf01216 | Python | 5,508 | 133 | from dataset import gen_log_space
from tqdm import tqdm
from dataset import Edinb_SE_Dataset, make_loader
import matplotlib.pyplot as plt
from utils.hparams import HParam
from model.coherence_net.model import CoherenceNet
import torch
import numpy as np
def apply_selection(conv_wt_pt, embedding):
out_embedding = t... |
2b2219f039bff1e8c5285fc2303c334fd0335f7b45bea0dbb367051c3bed8632 | Python | 5,509 | 164 | # 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... |
324525b29bcd6f606ef22df109d4bc1ac2cfecb588057adce7747fe54aa8c556 | Python | 5,509 | 172 | """Unit tests for the Ray-Serve branch of ``pick_calculator``.
These tests stub out the heavy fairchem and Ray Serve calls so they can
run without HF_TOKEN, without a real Ray cluster, and without actually
loading any UMA checkpoint. They cover the small but easy-to-miss
branches in ``pick_calculator``: the two fallba... |
95dabd9cdb272c512674ba194f542eea6710367413c88f12153f07d496ff3848 | Python | 5,509 | 174 | import cv2
import numpy as np
from scipy import ndimage
from merlin.util import matlab
"""
This module containts utility functions for performing deconvolution on
images.
"""
def calculate_projectors(windowSize: int, sigmaG: float) -> list:
"""Calculate forward and backward projectors as described in:
'Acc... |
5341f66ef981459c4d34265cd0682e60e845760cfc986713d4065826c81151df | Python | 5,510 | 161 | from typing import Optional, Callable, Tuple
import torch
from torch import Tensor
import torch.nn as nn
import torch.nn.functional as F # noqa
from constants import *
__all__ = ['reyregressor_v2']
_DROPOUT_RATES = (0.3, 0.5)
_BN_MOMENTUM = 0.01
_NUM_ITEMS = 18
class ConvBlock(nn.Module):
def __init__(self, ... |
9d442d860b35c4dd3d6f36de480b9dfce07d2513d858ebed33854b29735a7745 | Python | 5,512 | 133 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 2 14:06:04 2019
@author: hanneke
"""
import os
import pickle
import numpy as np
def save_dict(di_, filename_):
with open(filename_, 'wb') as f:
pickle.dump(di_, f)
def load_dict(filename_):
with open(filename_, 'rb') as f:
... |
181030da1602843b93ba886cff3c2ec50300f4335216c5a1dbd9ae379284c66a | Python | 5,513 | 199 | # Node-group asset "Select Nucleic Type" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CH... |
7a566f7a1314aad0b34a8b6e98b042763e76c637c7854a7fb5c2fa4d5a12ad4a | Python | 5,513 | 177 | """
Measures local betweenness (centrality)
Input: - GraphMCF (pickle file)
Output: - GraphMCF with betweenness properties
"""
__author__ = 'Antonio Martinez-Sanchez'
# ################ Package import
import sys
import time
import getopt
import copy
from globals import *
from factory import unpickle... |
3fa8d41cc199746a0b630269402971829ad825dfcb84d5f3ac2626efe97b2a0b | Python | 5,514 | 134 | #!/usr/bin/env python
import pandas as pd
import numpy as np
import seaborn as sns
from sklearn.mixture import GaussianMixture
import scipy.stats as stats
import matplotlib.pyplot as plt
import seaborn as sns
from scipy.stats import norm
import numpy as np
from scipy import stats
from SCanSNP.plots import FittedMixtur... |
8fff09daf13781ae5a87aa61373a66ff78d2dbb8f4fa7bd904dab3fe0e188dd6 | Python | 5,514 | 130 | """
convert_brats2021_to_twolabel.py
This script converts BraTS2021 segmentation files to a two-label format provided HD-GLIO segmentation files.
Usage:
python convert_brats2021_to_twolabel.py <brats_file> <hdglio_file> <output_file> [--cluster_size_threshold 50] [--at_fill True]
Arguments:
brats_file: Path ... |
c1e7fda08ac87d35ab6344ed10772d21d924d7eaad5e9ed6110d25117c8f888a | Python | 5,514 | 182 | import argparse
import os
import os.path as osp
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
def prepare_data(df, epoch=100):
subset = df[df.Round == 100]
unused_columns = ["Distr%d" % i for i in range(1, 8)] + [
"SelectedItem",
"Trial",
"Target",
"T... |
2d05dc7be0eac0976ed0d5fa00d57844ad716b54c068ab7bce21593494d9c705 | Python | 5,516 | 124 | # regtools/registration/gui/batch_2d_settings.py
"""Export/import of Batch 2D settings (no Qt).
Stores every file reference as BOTH an absolute path and a path relative to the
settings-file directory. Import resolves relative-first, then absolute, then
keeps the absolute string so a missing file can be flagged by... |
48e529ef0b83496c9815d96b37c19247b6ef9bc12fba70d94588c595f65dbe91 | Python | 5,516 | 152 | # ----------------------------------------------------------------------
# Copyright (C) 2014, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This program is free software: you can redistribute it and/or mo... |
266ac5640f06803f6bf89e436fecff11b17256e5b670f595e9639bdda9c7b499 | Python | 5,517 | 181 | '''
Author: Xiaoxiao Li
Date: 2019/02/24
'''
import os.path as osp
from os import listdir
import os
import glob
import h5py
import torch
import numpy as np
from scipy.io import loadmat
from torch_geometric.data import Data
import networkx as nx
from networkx.convert_matrix import from_numpy_matrix
import multiprocess... |
8a99bf6de122e0f4d3e9b1c7b3035b46ef70611539f4e8bd083c30bc062f5482 | Python | 5,517 | 205 | #
# 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,... |
a4384f54674cef1393893c7d88f7f7982d487642bbd81b77a8330757a05b9d42 | Python | 5,517 | 207 | """Implementation of CLI check command."""
import json
import os
import warnings
import numpy as np
from treem.io import SWC, TreemEncoder
def _load_data(path, err):
"""Tries to load data from SWC file."""
data = None
if not os.path.exists(path) or not os.path.isfile(path):
err["no_file"] = [pa... |
b4ae1cb3f5b8a7a98809ed36d8ce8cbab500b29af35c702d2e6c088aaf5d4442 | Python | 5,517 | 145 | import torch
from torch.optim import Adam
import yaml
from combust.layers import get_activation_by_string
from combust.models import NewtonNet
from combust.train import Trainer
from combust.data import parse_ani_data
# torch.autograd.set_detect_anomaly(True)
torch.set_default_tensor_type(torch.DoubleTensor)
# setti... |
fdc1a3327dfd3df1a25c34b454d9c77cb2366bb523d6f549abcd8bebaff774b8 | Python | 5,517 | 156 | import argparse
import csv
import networkx as nx
import pandas as pd
import pickle
import os
def load_taxonomy_info(file_path):
with open(file_path, 'rb') as pickle_file:
return pickle.load(pickle_file)
def read_gml(file_path):
return nx.read_gml(file_path)
def read_metabolite_file(file_path):
m... |
6f4110d5b307c08a393f92804bfc9e9c6dda2a724da89c4e1b505f7afa7ed1a7 | Python | 5,518 | 178 | import sys
import marshal
import contextlib
import dis
from . import _imp
from ._imp import find_module, PY_COMPILED, PY_FROZEN, PY_SOURCE
from .extern.packaging.version import Version
__all__ = ['Require', 'find_module', 'get_module_constant', 'extract_constant']
class Require:
"""A prerequisite to building ... |
89b5e9c05cb7204bb4e78d136bb3f450b2072fc116860afad5a7850cc067cfe8 | Python | 5,518 | 130 | from codex.data.neurotransmitters import NEURO_TRANSMITTER_NAMES
SYN_COUNT_MULTIPLIER = 8
NT_TO_ID = {nt: i for i, nt in enumerate(sorted(NEURO_TRANSMITTER_NAMES.keys()))}
ID_TO_NT = {v: k for k, v in NT_TO_ID.items()}
class Connections(object):
def __init__(self, connection_rows):
rids_set = set()
... |
7834095ad577a370abff0812c677e62da7deb57de236e72c99fb120399d86221 | Python | 5,519 | 156 | # Reads R1.fastq and R2.fastq files, selects reads with proper cell barcode and produces a new _cbc.fastq file.
import sys, os
import itertools as it
import argparse as argp
import numpy as np
import gzip
import pandas as pd
from pandas.io.parsers import read_csv
#### function to identify cells from barcodes, allowing... |
9deb7b55cb6d98c66b09b144fba39d81ad6f264a1beef403b50e29615a2f0cb6 | Python | 5,519 | 94 | """BREAK_IT.py 2026-10-01. Pre-registration: 04-NOTES/PREREG-2026-10-01b-BREAK-IT.md
Starting from the laboratory prior (healthy), how many sign errors among the unlabelled local neurons break smell, and does
the balance law predict that number from the wiring alone? usage: python BREAK_IT.py (BI_WORKERS, default 1... |
8615413f96c61c42f3ec708105e34d670f9acd25491478400ead407abc1b8189 | Python | 5,522 | 125 | from torch.utils.data import Dataset # Dataset是个抽象类,只能用于继承
import os
import torch
import random
import numpy as np
from torch.backends import cudnn
class StrokeDataset(Dataset): # 继承Dataset类
def __init__(self, x,y,device):
# 把数据和标签拿出来
self.x_data = torch.tensor(x).float().to(device)
... |
0087b1516c1a860cc7b92ccaa5f91603dd5aff4811bf2d73348c00fca554274f | Python | 5,523 | 113 | from REACTRL import RealExpEnv, Episode_Memory, Createc_Controller, sac_agent, ReplayMemory, HerReplayMemory
# default scan values
# NumX = 512
# NumY = 512
# DeltaX = 119
# DeltaY = 119
# DX/DDeltaX = 33
# Channelselectval = 3
# ScanXMode = 0
# CHMode = 0
# BiasVolt.[mV] =... |
5baff074ec66de3db6e62a2d2d6f6a2d9213dc12fe7ed9194b1872de4a615d85 | Python | 5,524 | 151 | import argparse
from loader import BioDataset
from torch_geometric.data import DataLoader
from torch_geometric.nn.inits import uniform
from torch_geometric.nn import global_mean_pool
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from tqdm import tqdm
import numpy as n... |
9654848ec019571730e1e6f602f82a14e9a92943151c4aa22d51ea43d5f74f5d | Python | 5,524 | 188 | from random import randint
import pytest
from elasticai.creator.arithmetic._int_converter import int_converter
from elasticai.creator.arithmetic.fxp_params import FxpParams
@pytest.mark.parametrize(
"total_bits, is_signed, number, check",
[
(8, True, -98, '"10011110"'),
(8, True, 35, '"00100... |
04e13851ea632a5896bba11bb2181e2de69614058c07a11210af1f0e1a2b4c25 | Python | 5,526 | 219 | #!/usr/bin/env python3
# Crude script for the conversion of
# orca output files to frequency files
# for molden. Only the last occurring
# instances of coordinates, frequencies
# and normal modes are used.
from sys import argv
# Check arguments
if len(argv) != 2:
print("Usage: orca2molden <orca-outfile>\n:")
... |
f0f3c6ab7712e2525b9b6edb38e794d47986f4f0860b68f10dce40391f21c708 | Python | 5,527 | 135 | import os
import scanpy as sc
import numpy as np
import pandas as pd
from scvi.model import CondSCVI, DestVI
from functools import reduce
import time
import tracemalloc
def run_DestVI(st_counts_path, sc_counts_path, sc_labels_path, output_dir="."):
if not os.path.exists(output_dir):
os.makedirs(output_d... |
0afeacd2c1ddd5abd14d2641eb577f1e1dd71b816285eb0dfda71a22f1aa30e8 | Python | 5,528 | 168 | """A file dictionary keyed by entity indices."""
import os
from hed.errors.exceptions import HedFileError
class FileDictionary:
"""A file dictionary keyed by entity pair indices.
Notes:
- The entities are identified as 0, 1, ... depending on order in the base filename.
- The entity key-valu... |
42b3624eb44bf8a14e3363c377e9bf2312bc35311f5fb6f2185e874202c3c524 | Python | 5,528 | 159 | import sys
sys.path.append('../../4K_HETU/app')
import arrayexp
import numpy as np
# import arrayparams
import time
import matplotlib
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
sns.set_style('ticks')
matplotlib.rcParams['font.family'] = 'sans-serif'
matplotlib.rcParams['font.sans-ser... |
4de0fb230331ee696c8162a2958f3c03f2d34dae86af949b56b6c5e29f9f2ef9 | Python | 5,528 | 161 | # 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... |
b817db4393a0a00fa5e41f988b79f530e2d151fa3112c485397c3ccafc223920 | Python | 5,528 | 138 | '''
Description:
Run our scNODE with different latent size.
Author:
Jiaqi Zhang <jiaqi_zhang2@brown.edu>
'''
import torch
import numpy as np
from model.layer import LinearNet, LinearVAENet
from optim.evaluation import globalEvaluation
from optim.running import constructscNODEModel, scNODETrainWithPreTrain, sc... |
41f35445a436314ac13eb9bc07b28aef0e7b112d0f6d36fbcd8bcff9ed1fc486 | Python | 5,529 | 148 | #
# 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,... |
490246e8193298e298ef48a1f44940ba1339b9a2a21517e60e1011850eaa5eea | Python | 5,529 | 140 | """Applying a PCA on data."""
from warnings import warn
import matplotlib.pyplot as plt
import numpy as np
from scipy.linalg import eigh
from xarray import DataArray
from hmp.projectors.base import Projector
class PCA(Projector):
"""Project data into PC space using the covariance matrix.
Attributes
--... |
9c975f1b85bbe29ad5c6edb294055bcabf472afb6a57fd8a4ea9236bbab80232 | Python | 5,529 | 185 | # -*- coding: utf-8 -*-
"""
Created on Sat Aug 22 16:11:11 2020
@author: au571303
"""
from random import shuffle
from psychopy import prefs
prefs.hardware['audioLib'] = ['PTB']
#prefs.hardware['audioLib'] = ['pyo']
from psychopy import visual, core, sound, event, gui, logging
import os
import numpy as np
from sys impo... |
86ebe9b14934d5b3c627907a32f00a623c68b6f4b888dc90c2b24c13f0dfecf8 | Python | 5,530 | 134 | from collections import defaultdict, namedtuple, Sized
from heapq import heappush, heappop
from itertools import product
from pddlstream.algorithms.common import COMPLEXITY_OP
from pddlstream.algorithms.relation import compute_order, Relation, solve_satisfaction
from pddlstream.language.constants import is_parameter
f... |
a14d10fa2080aede3f59855d2b9fe7cb4b805c16eb5d7c27e41112c75bf9689c | Python | 5,530 | 151 | import io
from uuid import uuid1
import bl_ext.blender_org.molecularnodes as mn # type: ignore
import bpy
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
from MDAnalysis.analysis import helix_analysis as hel
from PIL import Image
matplotlib.use("Agg")
# Annotations are auto-registered
# Unregist... |
7157b057e09142e5d60289685f1b443c1cff2eb3cd9e393210a2e76860d26d82 | Python | 5,531 | 184 | # Node-group asset "Color Common" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHECKING
... |
6fbe4da5f9049b38238e2cc0139a74a55eca60cae6f43f04c43390ae58ab302f | Python | 5,532 | 170 | # 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... |
795fb83f3962ab8754659f1540dc46e6e42d9b7c5eb32c44c21d01a8f6eaf351 | Python | 5,532 | 188 | #!/usr/bin/python
## @file ss_pred_converter.py
# @brief Converts various secondary structure profile formats to a PsiPred-SS2 file
# @author Dominik Gront (dgront@chem.uw.edu.pl)
import sys,re
import getopt
class ResiduePrediction:
id = -1
aa = 'X'
ss = 'C'
h = 0.0
e = 0.0
c = 1.0
def __init__... |
474c1cd9fdd167cee618a31061d0f07277ed516e68132495eb93684fbafa69cf | Python | 5,536 | 144 | """
Reads in localization data from the autoloc processing and adds to the electrode database
to coordinates in freesurfer mesh space.
Requires subject ID to find localization data
Run:
python add_locations.py <subject> <out_file>
"""
import logging
from .mri_info import *
from .config import paths
import pandas... |
74170f61c96d222f4039475cc9a7cbbd740ec04408544964d4466073172261ed | Python | 5,536 | 140 | import bpy
def annotations_node_tree():
node_group = bpy.data.node_groups.new(type="GeometryNodeTree", name="Annotations")
node_group.is_modifier = True
# Output Socket Geometry
node_group.interface.new_socket(
name="Geometry", in_out="OUTPUT", socket_type="NodeSocketGeometry"
)
# In... |
b9df22785560b37c4948fd846decefc36e3f6dac60c9674e486b4fe7f9a326ab | Python | 5,536 | 133 | """
oxasl.gui.calibration_tab.py
Copyright (c) 2008 University of Nottingham
"""
from oxasl.gui.widgets import TabPage
class AslCalibration(TabPage):
"""
Tab page containing options for calibration
"""
def __init__(self, parent, idx, n):
TabPage.__init__(self, parent, "Calibration", idx, n)
... |
1ef92d62636f42db0e33e0c266859a26009e556641d200aa0aff70095716a46d | Python | 5,537 | 180 | """
Adapted from 2020 Ross Wightman
https://github.com/rwightman/pytorch-image-models
"""
import torch
import torch.nn as nn
from segm.model.utils import init_weights, resize_pos_embed
from segm.model.blocks import Block
from timm.models.layers import DropPath
from timm.models.layers import trunc_normal_
from timm.m... |
beea87d0c065ee016cae41852c26557fd7fa3ecf41b8458210500c8971e54d66 | Python | 5,537 | 93 | import torch
import torch.nn.functional as F
from .streams import Stream1, Stream2, Stream3
from .stream_integerator import Stream_integerator
class Layer(torch.nn.Module):
def __init__(
self,
config
):
"""Initilize Energy predictor module.
Args:
input_channels: int =... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.