sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
86deb9935643d5aa76accea10cf71ed1afb1b5fc666032dacac3be6505967e1f | Python | 17,181 | 441 | from collections import defaultdict
from codex.data.auto_naming import assign_names_from_annotations
from codex.data.brain_regions import REGIONS
from codex.data.catalog import (
get_neurons_file_columns,
get_labels_file_columns,
get_coordinates_file_columns,
get_connections_file_columns,
get_nblas... |
0adad8bcb0d511a0a8d2bebcda8c8630217beec3d235cbdff26289df76394e17 | Python | 17,184 | 487 | """
Implementation of "Attention is All You Need" and of
subsequent models based architectures
"""
import torch
import torch.nn as nn
from onmt.decoders.decoder import DecoderBase
from onmt.modules import MultiHeadedAttention, AverageAttention
from onmt.modules.position_ffn import PositionwiseFeedForward
from onmt.mo... |
c8f7f582d8dd632668e13f2c1b841287b6cc49f41664f4814ec12988c51f86cd | Python | 17,187 | 538 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division, print_function
from scipy.stats import geom
from collections import namedtuple
import random
import math
from string import ascii_letters, digits, ascii_lowercase, ascii_uppercase, whitespace, printable
import numpy as np
PartialMatch = n... |
b0ca847a1981b24ff75838dabc6f6e40a02acd198c7822f37515b7fd144de0f7 | Python | 17,189 | 400 | """
Generates a ListTomoParticle object for the statistical spatial analysis of particles
Input: - A STAR file with particles
- A STAR file for paring picked particles and (sub-)volumes segmentations (Volume Of Interes, VOI)
Output: - A STAR file with the pickled ListTomoPaticles objects
""... |
cc575e0aca5f1ef9f8633512505fcfad87a9fc4bed16b35b2e74ba6f7d377413 | Python | 17,194 | 466 | from __future__ import print_function
import random
import numpy as np
from collections import namedtuple
from itertools import product
from drake import lcmt_viewer_load_robot
from pydrake.all import (Quaternion, RigidTransform, RotationMatrix)
from pydrake.geometry import DispatchLoadMessage
from pydrake.lcm import... |
c30f89df68b84a71a6eb9aa5c3518109e00015c6c4c8d22a9512f589fbcf10c6 | Python | 17,212 | 522 | #!/usr/bin/env python
# coding: utf-8
# ### TCGA <-> CCLE mutation prediction: LASSO parameter range experiments, summary across all genes
#
# Here, we're interested in:
#
# * Training mutation status models on data from TCGA (human tumor samples) and testing on data from CCLE (cancer cell lines), or
# * Training mu... |
59416d12dcf6e51f8c1325df6b9b1c7447fedca9d087cefbd7c170dd6c4f6087 | Python | 17,216 | 500 | # 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... |
afb014198a4a99a83d4521d6b2c125bd38cef7c7a7324c68d8c7aa7ae6e62843 | Python | 17,223 | 425 | import argparse
import copy
import random
import sys
import shutil
import time
import numpy as np
import os
import pandas as pd
from typing import Tuple
import torch
from torch import optim
from torch.utils.tensorboard import SummaryWriter
from constants import RESULTS_DIR, BIN_LOCATIONS1, BIN_LOCATIONS2
from src.pre... |
adb8924bcf0ecf5ba253cd8ecfcb627789b6b5553b0ece9251d8af166d8b649b | Python | 17,227 | 414 | import os
import struct
import numpy as np
import sys
def load_v3draw(path: str):
"""
by Zuohan Zhao
from basic_c_fun/stackutils.cpp
2022/5/8
"""
assert os.path.exists(path)
formatkey = "raw_image_stack_by_hpeng"
with open(path, "rb") as f:
filesize = os.path.getsize(path)
... |
a3a9e2ada6d355442ccc6c71ac97b9c9780d167f712dde0451792bb0044daa89 | Python | 17,232 | 419 | """
Module to align spike count trains to whisking bouts. This module includes then
following functions:
load_data: load whisker and npx data.
Attention 1: now rescaling spike times by ratio of whisker and npx rec
Attention 2: now if t_drop is not False, select npx and whisker data based
of time of dropping; can be ei... |
7062f2dbdd26582dcc1f34bb6f924cadf9d0f7b3369f8aa776d382960514c5a6 | Python | 17,239 | 421 | import os
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import ttest_rel, pearsonr
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
import scipy.io as sio
import torch
import sys
import importlib
def check_cuda():
device = torch.device(... |
73898ebaa4e7792a98122fef81a9a4087b9aa87eb7ee729a7c270a25a46da230 | Python | 17,243 | 493 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import itertools
import os
from typing import Sequence, Tuple, List, Union
import pickle
import re
import shutil
import torch
from pathlib imp... |
f58a29ecdb34ebc67df664f16ef5db4a7e09b1f8bfa824c6d4065748a8ce2ecb | Python | 17,243 | 540 | # SPDX-FileCopyrightText: 2024 Blue Brain Project / EPFL
#
# SPDX-License-Identifier: AGPL-3.0-or-later
##
## Load packages
##
print('Loading packages',flush=True)
import sys
import os.path
import numpy as np
import pandas as pd
import networkx as nx
from scipy.sparse import load_npz
import scipy.sparse
import scipy.... |
4686c577cc2279bee89aef4fb4b0adca1c3138303b923e29fdf002e213d7458e | Python | 17,254 | 496 | from pathlib import Path
import itertools
import functools
import numpy as np
import pandas as pd
from wsilearn.utils.cool_utils import is_string, write_lines, is_iterable, mkdir, is_list_or_tuple
from wsilearn.utils.sparse_utils import entropy
import builtins as __builtin__
def print_df(df, n=None, **kwargs):
... |
2f05eb87eb71b09d101298e7dd69f6d0cc07226b0b64eec30dbbd051ef7c0e68 | Python | 17,258 | 416 | # -*- coding: utf-8 -*-
from collections import defaultdict
import itertools
import constraints
import pddl
import tools
# Notes:
# All parts of an invariant always use all non-counted variables
# -> the arity of all predicates covered by an invariant is either the
# number of the invariant variables or this value +... |
64b7871b76e7025c72e867a22a3b62d0cac343fdf4441920dd1b8435c4cf423f | Python | 17,262 | 534 | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from lightning import LightningModule
from torchmetrics.classification import BinaryAUROC, MulticlassAccuracy
from maldi_nn.utils.drug import (
DrugOneHotEmbedding,
DrugMLP,
DrugGRU,
DrugCNN,
DrugTransformer,
D... |
94f18756f940908e65815a64cb9554c6d0c69fc7c3ea2ca3134d68a52f6d3324 | Python | 17,264 | 431 | '''
Description:
Use PRESCIENT predictions in recovering cell trajectories.
Author:
Jiaqi Zhang <jiaqi_zhang2@brown.edu>
'''
import scanpy
import torch
import numpy as np
from datetime import datetime
import pickle as pkl
from benchmark.BenchmarkUtils import loadSCData, tunedPRESCIENTPars, tpSplitInd
from pl... |
5c8e54fcbf6e339af05ef1218a3167c7d1bbf009e01674ac28f9e7edeab499fd | Python | 17,265 | 413 | import os
import struct
import numpy as np
import sys
def load_v3draw(path):
"""
by Zuohan Zhao
from basic_c_fun/stackutils.cpp
2022/5/8
"""
assert os.path.exists(path)
formatkey = "raw_image_stack_by_hpeng"
with open(path, "rb") as f:
filesize = os.path.getsize(path)
h... |
857ee794e7347de1395975f87634e15e0685f808f08477e9a34c65ce0c49a972 | Python | 17,271 | 336 | import os
os.environ['KMP_DUPLICATE_LIB_OK']='True'
from matplotlib import pyplot as plt
import matplotlib
import cv2
import numpy as np
import pandas as pd
from collections import deque, namedtuple
from matplotlib import pyplot as plt, patches
import torch
from REACTRL import mol_property
matplotli... |
a680860dff5968b912b1dc516a1695d6c08f038e628fb828988bd09582adbbf2 | Python | 17,274 | 468 | # -*- coding: utf-8 -*-
"""
Created on Fri May 31 19:24:37 2024
@author: mpolonen
"""
import numpy as np
import mne
import pathlib
from glob import glob
import scipy.signal as sig
from scipy.fftpack import fft, ifft
from expyfun.io import read_hdf5, write_hdf5
from expyfun import binary_to_decimals
imp... |
bca1a62be5dc0ad0db6c1d9639d561b3435db765429840c3e05cb5e9e73fbeb3 | Python | 17,275 | 442 | """
Pipeline I/O helpers - file persistence, metrics output, memory estimation.
Extracted from :mod:`pipeline` to keep the orchestrator focused on
registration logic. All symbols are re-exported from ``pipeline`` for
backward compatibility.
"""
import csv
import os
import time
import numpy as np
from... |
c2d490e6d9801f9c8121bc0a016126dd3456d9d8875b85a7fa6d146941779a36 | Python | 17,275 | 363 | '''
This class provides the easiest way to add your own networks to APT. To add your networks, if your network name is _mynet_, you'll have to create a new file Pose_mynet.py in which you need to define a new class of the same name (Pose_mynet) which should inherit from PoseBase.
```
from PoseBase import Po... |
35044151af5e85f0892ea7c99533e97c3ec9dae411c1eb439e96549f5489f1d7 | Python | 17,279 | 411 | import os
from typing import Any, Callable, Dict, Tuple, Union
import joblib
import numpy as np
from ....utils import get_random_dir_path
from ..base_dataset import BaseDataset
_FIRST_BATCH_CHANNEL = [
'FP1', 'FP2', 'FZ', 'F3', 'F4', 'F7', 'F8', 'FC1', 'FC2', 'FC5', 'FC6',
'CZ', 'C3', 'C4', 'T7', 'T8', 'A1',... |
d63ff7a28c7a92ef4db81f2dbe989dbb034bf9964c5465c30621ec04060c3580 | Python | 17,289 | 408 | """Integration test for the stitching pipeline.
Exercises ``stitch_section`` with a synthetic 2×2 tile grid and
verifies basic output properties (file exists, expected shape, intensity
preserved at known tile centres).
The unit tests in ``test_stitching.py`` cover the ``Tile`` and ``Stitcher``
algorithms in is... |
878ad898b5ff66c700ea427571d329360ec6db9b635572721050497351dbbc3b | Python | 17,290 | 506 | import re
import functools
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.colors as mcl
import matplotlib.pyplot as plt
from itertools import combinations
from .datasets.core import DataSet
from .datasets.ds_utils import _add_types
from .utils import make_iterable, printv
from .mapper... |
862456632271874f89ba7016a8e2e3a9b6a64203bd1f5456403c90641b3d385b | Python | 17,291 | 460 | """Mean shift clustering algorithm.
Mean shift clustering aims to discover *blobs* in a smooth density of
samples. It is a centroid based algorithm, which works by updating candidates
for centroids to be the mean of the points within a given region. These
candidates are then filtered in a post-processing stage to elim... |
b1f8cb3d324ce617fd92b9cc8441f7723cab2603104471fc478dc743918b3a6e | Python | 17,292 | 610 | # -*- coding: utf-8 -*-
"""
Created on Thu Dec 8 15:59:54 2022
@author: Dustin Garner
"""
import os
import subprocess
import copy
import time
import datetime
from pathlib import Path
import numpy as np
import pandas as pd
import pydantic
import matplotlib.pyplot as plt
import seaborn as sns
from fafbseg import flyw... |
0de03758641ae7873b489b2f1ca0e4728f8dd7daaa05f49f3cada098a18d83ed | Python | 17,297 | 545 | # 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... |
34b9f61a7b6df89372544353cd68f7a665e10ab4b541b315e46af81712222e33 | Python | 17,302 | 435 | """Pipeline-format count export tests.
Covers :func:`regtools.ccf_boundary_editor.quantify.export_pipeline_counts`
and the dock-button handler wired into ``CCFContourViewer``. The helper
must reproduce the registration pipeline's count CSVs
(``point_labels.csv``, ``cell_region_count.csv``, ``region_counts.csv``,
... |
3a11115cb6f94e3b6d07221b57e7ad5d90252c9ab0454029e998207db121d596 | Python | 17,306 | 389 | import os
import numpy as np
import random
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras.utils import to_categorical
from keras import Sequential
from keras.layers import DepthwiseConv1D, Conv1D, Activation, Flatten, Dense, Dropout, BatchNormalization, Input, AveragePooling1D, SeparableConv... |
83e0778fe36b3f7a724fd5912535b1d49a79ff69c7f979dd2285d15c942d3c26 | Python | 17,307 | 482 | import types
from collections.abc import Callable, Hashable, Mapping
from functools import update_wrapper, wraps
from typing import Concatenate, Protocol, Self, cast, overload
class Registrar[K: Hashable, **V, R](Protocol):
"""A decorator to register values. Keys are derived from values or provided explicitly."""... |
ce65cab8fb68e56902484b43592dd79c72941bd3647813fe12bf35cdc6493efb | Python | 17,311 | 377 | import numpy as np
import pandas
import cv2
from typing import Tuple
from typing import Dict
from skimage import measure
from sklearn.neighbors import NearestNeighbors
from merlin.util import binary
from merlin.data import codebook as mcodebook
"""
Utility functions for pixel based decoding.
"""
def normalize(x):
... |
7b5b2a4d1382c6f16eae5252c8dc390dbee7a28c9a2581a1b0683b120c1782b3 | Python | 17,315 | 383 | # 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... |
bbb65a312edcf0b86c8f9859b90e9ef8ed2d2589825d33b9ae54e3d99d8f8038 | Python | 17,318 | 530 | # -*- coding: utf-8 -*-
#
# Syncopy object simple summary statistics (mean, std, ...)
#
# Builtin/3rd party package imports
import numpy as np
import logging
import platform
# Local imports
# from .selectdata import _get_selection_size
from syncopy.shared.parsers import data_parser
from syncopy.shared.errors import ... |
80c19a0fa20099aeec1fe5e9accf12cab712e2b576037a5d4cbac5dc9fb39aed | Python | 17,321 | 436 | """
Created on 27/07/2020
:author: Chinchien Lin
:summary:
"""
import datetime
import json
import os
import sys
import pathlib
import numpy as np
import tensorflow as tf
from skimage.measure import label
from PIL import Image
Image.MAX_IMAGE_PIXELS = 933120000
class MultiChannelSegmentation(o... |
3044ba371008ff8af1d28eacfb4dfafdeb363c2ee94617e159c459dc6fe0cfe3 | Python | 17,329 | 357 | import enum
import logging
import os
import pathlib
from collections import namedtuple
from os import PathLike
from typing import List, Callable, Tuple, Union
from tabulate import tabulate
from NDATools.Utils import tqdm_thread_map
from NDATools.upload.submission.api import SubmissionPackage, Submission, SubmissionDe... |
070834aa853ec2ee69ab7b611c800438aad2e2e1aa8a2a6159ab82d6982d048e | Python | 17,333 | 491 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''plotting script for figure 5 in manuscript preprint on output of
example_parallel_network.py
Copyright (C) 2018 Computational Neuroscience Group, NMBU.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public Lic... |
617177d24c43ca22627346a6ecad1418e2f3e85f8b107bb4f6e10cede262d2f3 | Python | 17,335 | 390 | import uuid
from typing import List, Optional, Union
from ..file_utils import add_end_docstrings, is_tf_available, is_torch_available
from ..tokenization_utils import TruncationStrategy
from ..utils import logging
from .base import PIPELINE_INIT_ARGS, Pipeline
if is_tf_available():
import tensorflow as tf
if is... |
99c2096b850b928a85f36a11f908dcffac8735e293090b2263ccc94572fcf8d2 | Python | 17,335 | 412 | # Node-group asset "Best View" (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.
import math
from typing import TYPE_... |
f7801c93aeaa89679d913e3613f2b66d41ee075633d634e98899de1d53bf9001 | Python | 17,337 | 470 | # Node-group asset "Simulate Curve" (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_CHECKIN... |
42348a9b8b38618551f4c2231696ecda1f563cecd0c5c0c08a75dbb4eb5971df | Python | 17,340 | 494 | """Figures
----------
Definition of default figures plotted with plotting.py.
"""
from mesocircuit.plotting import plotting as plot
from mesocircuit.parameterization import helpers_analysis as helpana
import matplotlib.gridspec as gridspec
import matplotlib.pyplot as plt
import numpy as np
import h5py
def parameter... |
88376637d312a140a036ea72ef69b592b2bb851cb36e101a06cfc65a30c4196a | Python | 17,344 | 515 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Written by Tong He and CBIG under MIT license:
https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
"""
import os
import numpy as np
import scipy.io as sio
from .config import config
def data_ukbb_base(corr_mat=None,
beh=None,
... |
3d5261ef67a2d5ab235db8fa06b17d0062d011b91cc57f18f9bfa365908121ae | Python | 17,348 | 449 | import math
from contextlib import contextmanager
from typing import Iterator, Literal, NamedTuple
import bpy
from bpy.types import CompositorNodeTree
from nodebpy import compositor as c
from nodebpy.builder import ColorSocket, TreeBuilder
from ..nodes.compositor import ConeShadow, Illustrate
from ..session import get_... |
58a2b1c8986e3044cb816f74b64b77c075f01e02f1d4db26bf9be713f9420ee5 | Python | 17,350 | 502 | import os
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from set_style import set_style
import matplotlib.gridspec as gridspec
np_load_old = np.load
np.load = lambda *a,**k: np_load_old(*a, allow_pickle=True, **k)
def return_value_alpha(alpha, feature, n_unit):
if feature == 'alpha_sn':... |
556807885f61e9026d8a8236c0cfbd3e77b5307795db0640b1477bf14eec041b | Python | 17,351 | 395 | import os
import sys
import numpy as np
import pandas as pd
from scipy.stats import ks_2samp
from compute_scaling_experiments_helpers import get_cc_scalingEtoE, load_data, get_neuron, cvIsi, LVr
from compute_scaling_experiments_helpers import calculateFuncionalConnectivityCorrelations
from compute_scaling_experiments_h... |
17ac201b6dea65e2247286105c5098033816939b256584cfcf4719f029f33725 | Python | 17,352 | 467 | from __future__ import annotations
import numpy as np
from sklearn.metrics import roc_auc_score
from SurvivalEVAL.evaluations.util import (
_check_control_definition,
_inverse_censoring_weights,
check_and_convert_event_data,
check_and_convert_probabilities,
validate_time_point,
)
from SurvivalEVAL... |
2614b1588c8a6ad7a003186c17d82cb526a3a9fafedb2da1367266137eef8366 | Python | 17,355 | 342 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 24 14:43:34 2022
@author: benozzo
"""
import matplotlib.pyplot as plt
from scipy.io import loadmat, savemat
from scipy import stats, linalg
from plotting_functions import figure_layout, set_size
import numpy as np
def compute_relation_invS_A_S... |
0f12e8b25aa7e7e79da8767fc57b33b4b48b8924be09e25bae26914c0dc68474 | Python | 17,365 | 504 | # 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... |
bcf96ae1dade9739ee6ba7851e6db5a782c9a6310569b06769c136541798f0ae | Python | 17,368 | 313 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 24 15:24:03 2023
@author: nct76
"""
"""
@Mariellapanag
Created on March 2023
@author: mariella and chris
Calculates a mixed effects model to show that SOZ has an effect on cycle power above that of a region specific effect.
Produces figures 3 (a ... |
6ea8f15ba2e6c1b68f166d51498e90c82c6879c37554422367f55e8f8c4da7dc | Python | 17,369 | 343 | 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... |
66f291facf231056c1edfc1802cc17270937efd313e8cfeb11ea9767d6ebcb71 | Python | 17,373 | 403 | from torch.utils.data import Dataset
import numpy as np
from scipy.io import loadmat, savemat
import h5py
from utils import add_white_noise, ispadding
import random
import mne
class SpikeEEGBuild(Dataset):
"""Dataset, generate input/output on the run
Attributes
----------
data_root : str
Dat... |
964a1af80f21940bf1006d1e494b7091b6d180757762b043c0b0a15f016a217b | Python | 17,375 | 518 | # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/04_plots.ipynb.
# %% auto 0
__all__ = ['plot_losses', 'plot_comparision', 'new_plot_comparisions', 'plot_gene_trends']
# %% ../nbs/04_plots.ipynb 3
import os, math, numpy as np, pandas as pd
import torch
import torch.nn as nn
import matplotlib as mpl
import matplotl... |
53bf66eeeef1d451426ae4450974aaed17780abaabd25685c7906a6e10854f0b | Python | 17,377 | 410 |
# coding: utf-8
# # Machine learning with bottleneck features for biological microscopy classification
#
# The goal of this project is to using image (.jpg) analysis to classify cell types.
# A pre-trained TensorFlow model - Inception Model v3 for TensorFlow - trained to analyze images was used to create features of... |
393c631989b44ba43d4a9b3485082857240c62a09c351abd02b24fc0e05bc08c | Python | 17,378 | 308 | """
Functionalities to investigate the relationship between synaptic clustering and dendritic nonlinearities
1st step: writes launch scripts that rerun selected cells in BGLibPy (see `assemblyfire/rerun_single_cell.py`)
(with extra reporting and some modifications)
2nd step: load spiking data from sims. with ... |
b6f319219cf6d551eb1b7ee4c3ce90dbfd0fa48550d1b882c3869be2c45b0d02 | Python | 17,379 | 452 | import itertools
import re
from io import BytesIO
from pathlib import Path
import biotite.structure as struc
import biotite.structure.io.pdbx as pdbx
import numpy as np
from biotite import InvalidFileError
from .reader import ReaderBase
class MultipleStructuresError(InvalidFileError):
"""The file holds more than ... |
b3d5036a8ea42dace8261b6a14afdf5a9ba6d12269be0bc63f66a13974b27e03 | Python | 17,381 | 343 | 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... |
0a6110aff8b54e43cfc93fdfa173ce0e80bfc9cbbb28c7716e871651562533f7 | Python | 17,382 | 455 | import torch
import os
import logging
import torch.nn.functional as F
import torch.nn as nn
import torchvision
from typing import Dict, Iterable, Callable
from monai.transforms import Transform
from monai.utils.type_conversion import convert_to_tensor
import numpy as np
import boto3
import tempfile
import m... |
0d944412b0dbad72971dac42370e21c08d37e2372d405702b3ae6dadb152863e | Python | 17,385 | 346 | import numpy as np
from scipy.sparse import *
from sklearn.metrics.pairwise import pairwise_distances
def construct_W(X, **kwargs):
"""
Construct the affinity matrix W through different ways
Notes
-----
if kwargs is null, use the default parameter settings;
if kwargs is not null, construct th... |
6847edb218c9cc80e37df51966a8e12f5a2c31bb848da6c474dd69681af1d565 | Python | 17,386 | 335 | """Tests of the reserved-tag rules of reserved_tags.json (specification 3.2.8, Appendix A.6)."""
import io
import json
import os
import unittest
from hed import HedString, Sidecar, TabularInput, load_schema_version, schema
from hed.errors import ErrorSeverity, ValidationErrors
from hed.models import DefinitionDict
fr... |
cc88263ac179967ac0603db41c95498e73482b10ec7c310efe20761aad7239b2 | Python | 17,389 | 366 | """
Script for extracting particles from a filament network of a oriented single membrane graph
Input: - A STAR file with a list of graphs (SynGraphMCF) as it is returned by
by mb_fils_network.py script:
+ Density map tomogram
+ Segmentation tomogram
+ ... |
48ba6b03ea332d62fc3cadbd47efab4d139467f43a8eca168b7458018dfb0684 | Python | 17,397 | 433 | """
Shared widget classes for the U01 workflow GUI.
Provides custom Qt widgets that fix platform-specific rendering issues
and add common functionality used across all GUI tabs.
"""
import numpy as np
from PySide6.QtWidgets import (
QPushButton,
QWidget,
QHBoxLayout,
QLabel,
QSizePo... |
f64279585bf471b749e7707d150a0b6dbabb28e4e0b5487a667628d25126cb96 | Python | 17,398 | 387 | """
Pre-processing for mb_graph_batch.py of oriented membranes from TomoSegMemTV output
Input: - STAR file with 3 columns:
+ _rlnMicrographName: tomogram original
+ _rlnImageName: TomoSegMemTV density map output
+ _psSegLabel: (optional) label for membrane segm... |
f58789dad1cf05736e0a2a253718c0666e6a66f446def5e06320a57eebf32de3 | Python | 17,399 | 280 | """Leak-rate dynamics: repeated steering probes at several leak rates, plus idle retention.
Used by plugins/examples/leak_rate_dynamics.py through the plugin API only. Nothing here
changes the reservoir equation, the coupling or decoding; it sets the leak rate the GUI
also sets, runs read-only probes (steering_diagnos... |
d0b912c1d6b6d94c5951f2baf1dc55688534bb0dcfbe754e890795bef3e720ff | Python | 17,400 | 358 | '''
This class provides a flexible way to add your own networks to APT. To add your networks, if your network name is _mynet_, you'll have to create a new file Pose_mynet.py in which you need to define a new class of the same name (Pose_mynet) which should inherit from PoseBase.
```
from PoseBaseGeneral imp... |
ba958b2008139a2c3c970a354e106b6d8e77c1ac96dd1e4e18ca862a28de582c | Python | 17,407 | 559 | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2017, 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 progra... |
9613f16fef10b871e845ab21651fb00311288112564e0f6fef54d23d72756642 | Python | 17,409 | 419 | # -*- coding: utf-8 -*-
"""
Created on Mon Jun 15 11:28:26 2020
@author: David Quiroga-Martinez
"""
#################### Load libraries and set directories #######################
from random import shuffle
from psychopy import prefs
prefs.hardware['audioLib'] = ['PTB']
#prefs.hardware['audioLib'] = ['pyo']
from psych... |
9e5fa334c35a5eec43761a0e8b943907ba2c13d03f30e3cd313d4a42702e926d | Python | 17,410 | 449 | from __future__ import annotations
import copy
import warnings
from abc import abstractmethod
from collections.abc import Callable
from typing import Any
from wikibaseintegrator.models.basemodel import BaseModel
from wikibaseintegrator.models.qualifiers import Qualifiers
from wikibaseintegrator.models.references impo... |
47d36ca5afa76bf530a3705d28627316078233a56d67104ae9d480e5fe90db51 | Python | 17,413 | 384 | """"""
"""
Prosper_nn provides implementations for specialized time series forecasting
neural networks and related utility functions.
Copyright (C) 2022 Nico Beck, Julia Schemm, Henning Frechen, Jacob Fidorra,
Denni Schmidt, Sai Kiran Srivatsav Gollapalli
This file is part of Propser_nn.
Propser_nn is free softw... |
c98685eed9e5e0837825eab1876ae55fe62e4db77852153ee10e9609713836d8 | Python | 17,415 | 426 | # import libraries
import numpy as np
import matplotlib.pyplot as plt
import sys
# my_path = 'C:\\Users\\dreww\\Desktop\\hyperbolic-learning\\utils' # path to utils.py
# sys.path.append(my_path)
from hyperbolic_learning_master.utils.utils import *
#----------------------------------------------------------
#----- Fre... |
4c3fafa688f72812ab7ff629d4e66a5c8a1b73b476e57f514e95d74c6654adaa | Python | 17,416 | 558 | """
Contains class Features that provides basic functionality for the analysis of
segmented images.
# Author: Vladan Lucic (Max Planck Institute for Biochemistry)
# $Id$
"""
from __future__ import unicode_literals
from __future__ import absolute_import
from builtins import object
from past.builtins import basestring... |
faa1c2ea1f5c7b3f6ab9424e8893dc900998407f444509a9c6107e23450f1699 | Python | 17,431 | 548 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import matplotlib.colors as mcolors
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sn
import SimpleITK as sitk
import skimage
import torch
import torchmetrics
from monai.transforms import Transform
from mpl_toolkits.axes_grid1 i... |
54795e3169268cd8332497c9ced2fe6d90c84bc07bdf29571ce3153a0b44080b | Python | 17,439 | 504 | # 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... |
93cb9f196e8f37ad20f5fa42a5936c92182420e3fff76bb0ce54817cacbca00d | Python | 17,441 | 413 | """
Unit tests for regtools/nii_creation/pipeline.py
Covers:
- convert_spacing_to_mm (unit conversion)
- build_nifti (section stacking, padding, axis reorder)
"""
import os
import tempfile
import shutil
import numpy as np
import nibabel as nib
import pytest
import tifffile # hard dep ... |
f65b08acc6adcf4a12d5a78a2a6701cdc789f14d20d86946ee3c4645c24f93c0 | Python | 17,443 | 546 | import os
import collections
from ._common_blocks import ChannelSE
from .. import get_submodules_from_kwargs
from ..weights import load_model_weights
backend = None
layers = None
models = None
keras_utils = None
ModelParams = collections.namedtuple(
'ModelParams',
['model_name', 'repetitions', 'residual_blo... |
1281fbfe8bb637b683123359de1171024d31abe19a5e20c520cedf89a5da21b6 | Python | 17,450 | 404 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. 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 cop... |
d81ba0a31252860a23a14711a5ecabe5f9ba4980893091c8002137553197221b | Python | 17,451 | 386 | import os
import csv
import glob
import pickle
from tqdm import tqdm
import numpy as np
import pandas as pd
from copy import deepcopy
from Bio.PDB import PDBParser
import torch
from torch.nn import functional as F
from torch.utils import data as torch_data
from torchdrug import core, data, datasets, utils
from tor... |
704213d12bb14e5c7b0d35abdf3462c4bb28e2de8b19ae834acfcfe19eb7f5d4 | Python | 17,454 | 387 | import os
import glob
import pandas as pd
import re
import matplotlib.pyplot as plt
import numpy as np
from sklearn.metrics import mean_squared_error, mean_absolute_error, r2_score
import mne
from mpl_toolkits.axes_grid1 import make_axes_locatable
from scipy import stats
# Directory where the files are located
directo... |
81f4510a3114b169957485f9aa9d721e6705f672d7c936b8a0e542369e985fb7 | Python | 17,458 | 327 | import os
from typing import Callable, Dict, Tuple, Union, Any
import scipy.io as scio
from ...constants.emotion_recognition.dreamer import (
DREAMER_ADJACENCY_MATRIX, DREAMER_CHANNEL_LOCATION_DICT)
from ..base_dataset import BaseDataset
from torcheeg.io import EEGSignalIO, MetaInfoIO
class DREAMERDataset(BaseDat... |
2835b851b08380a67a3cd92b2cd57dad2ee28cf7e15dc98212ce06e10d6110e9 | Python | 17,463 | 450 | from collections import OrderedDict
import datetime
import json
import os
import pickle
import random as random
import subprocess
import sys
import time
try:
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
except:
print("WARNING: Could not import torch. This is... |
dc4b7f5899cab688a86e9233736e0c2afaae1005919701d68bb318a2927e5526 | Python | 17,465 | 404 | import functools
import torch
import torch.nn as nn
def cal_conv_feature(L_in, kernel_size, stride, padding):
return (L_in - kernel_size + 2*padding) // stride + 1
def cal_dconv_feature(L_in, kernel_size, stride, padding, dilation, output_padding):
return (L_in - 1) * stride - 2 * padding + dilation * (kern... |
24712c8e94dbc0d92ee6a7fe21ed02c8a56b5c6b19b42750e151b95f514778bf | Python | 17,470 | 380 | """Rendering / overlay mixin for the CCF boundary editor.
Carries the per-slice rendering and overlay drawing: the main
``_render_slice`` orchestration, the all-region and active-region boundary
overlays, the diff overlay, backdrop intensity-level computation, cell-point
drawing, per-region contour caching, the g... |
2ec4d3ff715f4d90084c8638da9732ba570a481a7a96a5eb61f254ec4295bfa9 | Python | 17,473 | 576 | # qc.py
from itertools import cycle, islice
from pathlib import Path
import dnaio
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from fba.levenshtein import create_index, query_index, select_query
from fba.utils import get_logger, open_by_suffix
logger = get_logger(logger_name=__name__)
par... |
bdd4cb4aeef24f1baebe68c0e8a78ac98dadfe120a423d5145e987d6be015721 | Python | 17,477 | 299 | from warnings import warn
import math
import pymp
import numpy as np
import multiprocessing
import numba
from utils import get_nan_value, insert_sorted
class EmptyPropagation:
def __init__(self, module_name, verbose):
if verbose:
print('Initialising Propagation')
self.module_name = m... |
6af947ad7c834b205e12f2495b0aff4745588104cd49575c81170745d5dd6886 | Python | 17,482 | 372 | # 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... |
e0cbdca8899c8c41ae3a07b6a22101902ef6656c9052656406e122a3165c9a03 | Python | 17,484 | 546 | from dreamcoder.program import Primitive, Program
from dreamcoder.grammar import Grammar
from dreamcoder.type import tlist, tint, tbool, arrow, t0, t1, t2
import math
from functools import reduce
def _flatten(l): return [x for xs in l for x in xs]
def _range(n):
if n < 100: return list(range(n))
raise Value... |
aee2ea00cbd0d75e7f105011d1da56878132566d19162ed4956f4a46499d86b9 | Python | 17,488 | 477 | # Functions using inspyred and NEURON to perform PSO
try:
from mpi4py import MPI
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
nhost = comm.Get_size()
except ModuleNotFoundError:
rank = 0
nhost = 1
import numpy as np
import h5py
import multiprocessing
import multiprocessing.connec... |
1e5a570bab82d25c7b12600c742399cb0a00b87573e6897b6542da14c8e8aea8 | Python | 17,490 | 441 | """
Load setuptools configuration from ``pyproject.toml`` files.
**PRIVATE MODULE**: API reserved for setuptools internal usage only.
To read project metadata, consider using
``build.util.project_wheel_metadata`` (https://pypi.org/project/build/).
For simple scenarios, you can also try parsing the file directly
with ... |
7d2868aea697a41712895f40b79ec6277d6fb3fa7e8d8afe7e356533b9ccfa7c | Python | 17,497 | 395 | #!/usr/bin/env python
__author__ = "Harold Grosjean"
__email__ = "haroldgrosjean@gmail.com"
import os
import subprocess
import numpy as np
from spyrmsd import io, rmsd
import rdkit as rdk
from rdkit.Chem import AllChem
from rdkit.Chem import SaltRemover
import MDAnalysis as mda
from MDAnalysis.analysis import align, r... |
5e19aeea8499b4dc83a9a45923119cabf982947d06c7efe9b5c847bcec5efdaf | Python | 17,504 | 456 | import os
import sys
import itertools
from importlib.machinery import EXTENSION_SUFFIXES
from importlib.util import cache_from_source as _compiled_file_name
from typing import Dict, Iterator, List, Tuple
from pathlib import Path
from distutils.command.build_ext import build_ext as _du_build_ext
from distutils.ccompile... |
ce424037f9a170ec20d300bcc4f1937c6c1830382b311b6d11c6a07c668094a6 | Python | 17,509 | 441 | import copy
from utils.logger import get_logger
from pathlib import Path
import pandas as pd
from utils.api.tcga_api import get_metadata_from_case, get_filters_result_from_file, download_file, download_files
import lxml.etree as LET
class TCGA_Case(object):
'''
TCGA Case
'''
def __init__(self, case_id... |
e4e1dc7c1b8fafe9e31fb9e7758a1a84087d0cb0f38012f397cfe0aa96a26007 | Python | 17,515 | 389 | import PoseUNet
import PoseCommon
from multiResData import *
import tensorflow.contrib.graph_editor as ge
class PoseUNetAttention(PoseUNet.PoseUNet):
def __init__(self, conf, name='pose_u_att',
unet_name='pose_unet'):
PoseCommon.PoseCommon.__init__(self, conf, name)
self.dep_nets ... |
d545b25983011eac8243b1632238f1ce35308cca3c5d72f51bd89e14e1425521 | Python | 17,516 | 432 | # coding=utf-8
# Copyright 2019-present CNRS, Facebook Inc. 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
#... |
a0d45a4e515ac7c4c89b7f40352af25b2a3acd2aa44a8ade3e5baea904ebcc7b | Python | 17,521 | 398 | import numpy as np
import os
import pandas as pd
from scipy import stats
from sklearn import metrics
from tabulate import tabulate
from typing import Union, Tuple
import sys
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib.ticker as plticker
from src.analyze.utils import init_mpl
from constants ... |
0f3f7519e055ef4c9481a574e0326dbe0279474097975e85ed329ee6013899b4 | Python | 17,523 | 428 | """
Script for post-processing already reconstructed particles
Input: - STAR file with next columns:
'_rlnMicrographName': tomogram that will be used for reconstruction
'_rlnImageName': tomograms used for picking
'_rlnCtfImage': (optional) CTF model subvolume
... |
2243179a50f5a4e1bbed3399efb7f6b99d2d42201b73c52568bcaad55d83313b | Python | 17,523 | 399 | """Test that CLI wrapper parameters match original script parsers."""
import unittest
import click.core
from click.testing import CliRunner
from hed.cli.cli import cli
from hed.scripts.extract_tabular_summary import get_parser as get_extract_summary_parser
from hed.scripts.hed_extract_bids_sidecar import get_parser ... |
cf82da03a0c8a663ce6907a0a76f6e45010e79f1c9a77116f514cf0787db925b | Python | 17,525 | 432 | '''
Description:
Use MIOFlow predictions in recovering cell trajectories.
Author:
Jiaqi Zhang <jiaqi_zhang2@brown.edu>
'''
import scanpy
import numpy as np
import pandas as pd
from sklearn.decomposition import PCA
from benchmark.BenchmarkUtils import loadSCData, tunedMIOFlowPars, tpSplitInd
from plotting.Plot... |
71b22bdbf78fc834815ed28facf338eccc86aa29e734fa1d2a70973472357eb0 | Python | 17,526 | 460 | ''' Modified by Mayank Kabra
From LEAP https://github.com/talmo/leap by Talmo Pereira
'''
import numpy as np
import h5py
import os
from time import time
from scipy.io import loadmat, savemat
import re
import shutil
# import clize
import json
import PoseTools
import math
import pickle
import logging
import contextlib
i... |
eed99d6c1cdf06f23b7c9cbc755d83c39071a777ac0f6cbb0a1e8c1984e825bc | Python | 17,526 | 480 | import glob
import nelpy as nel
import neuro_py as npy
import numpy as np
import pandas as pd
import os
import scipy.io as sio
from matplotlib import patches as patches
from matplotlib import pyplot as plt
from scipy.signal import argrelextrema
from neuro_py.process.intervals import find_interval # type: ignore
from n... |
1d805244a8417cb762c143e20002e083f5ef5ef00d589785a84d11eee2dbd008 | Python | 17,527 | 361 | from itertools import chain
import numpy as np
import os
import pandas as pd
from typing import List, Tuple
from src.utils import print_dataframe, mean_confidence_interval
from src.inference.utils import assign_bin_single
from constants import RESULTS_DIR, N_ITEMS, BIN_LOCATIONS1, BIN_LOCATIONS2, FOTO_FOLDERS
RESULTS... |
fe7a51d7966f0ef657614451091cdadf9a805d7fc72991edf21c6470efe735b9 | Python | 17,544 | 528 | """
==============================
Compute group-level statistics
==============================
Compute T- and F- for the effect of conditions and search for
significant (spatio-temporal) clusters.
Authors: José C. García Alanis <alanis.jcg@gmail.com>
License: BSD (3-clause)
"""
# imports
import sys
import os
import... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.