sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
6e5f6a51567b959f1e413a6d60ad6cbd39982baa049fcbc81381c868a989b114 | Python | 31,864 | 1,106 | # -*- coding: utf-8 -*-
"""Simulation code for the organization of cortical columns."""
import math
import sys
import nibabel as nb
import numpy as np
from numpy.fft import fft, fft2, fftshift, ifft, ifft2
from scipy.interpolate import griddata
from scipy.stats import pearsonr
__all__ = [
"odc_2d",
"odc_1d",... |
61ebdda4bb7ec667d58d02ac049dc3b40fbe46f7783e94f669ab9bbf7cad4a83 | Python | 31,872 | 789 | # -*- coding: utf-8 -*-
#
# KGDataset.py
#
# Copyright 2020 Amazon.com, Inc. or its affiliates. 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.... |
29bd7ea284b5c9c362adb36539928002f2a85d2d7778ba411d33fa3b5148dbf1 | Python | 31,881 | 804 | import re
import math
import collections
import emoji
import langid
import string
import numpy as np
import pandas as pd
import networkx as nx
import community as community_louvain
from tqdm import tqdm
from datetime import datetime
from zhon.hanzi import punctuation
MAX_NEIGHBOR = 250
MONTH_DICT = {'Jan': 1, 'Feb': ... |
1a6eb1fdf069dee068ff1bc12dccb1d0ab942f4b4bc5edc8c17aaf547e3749d7 | Python | 31,898 | 625 | # -*- coding: utf-8 -*-
"""
Created on Sat Dec 21 13:01:24 2019
@author: karli
maak heatmap plot goed dat zowel iso als gcamp binnen 1 df vakje zitten
to do - behavioural plots
"""
import csv
import pandas as pd
import numpy as np
from math import sqrt
import matplotlib.pyplot as plt
from stat... |
1d53a82b74947c04b6d327d2fb0758f92d9d7fe1727b08dfc0e80dff94473f13 | Python | 31,911 | 867 | # Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
46952706534de25665aae231c2f82dd39ea9342846fd4967cab56089cf9df7e8 | Python | 31,913 | 842 | # -*- coding: utf-8 -*-
"""
The *Resampling* module provides methods to resample and reorient volumetric
and point data.
Resampling the data is usually necessary as the first step to match the
resolution and orientation of the reference object.
Main routines for resampling are: :func:`~ClearMap.Alignment.Resampli... |
9bc56cacbe5c2a40d8b6d26b3f57d8ee1fe8574fe195b735139934d6be13df51 | Python | 31,959 | 877 | import pytest
import tempfile
import shutil
import sqlite3
import pandas as pd
from pathlib import Path
from unittest.mock import patch, MagicMock
import tarfile
import os
import subprocess
import json
TEST_DATA_CONFIG = {
"tar_gz_file": "/home/uvx4187/graphpancake_data/SS-07-13_data.tar.gz",
"labels_csv"... |
5765d3186c28166fbf3694dabda5dd776b30d0ea2700bcba3d33321349e160d1 | Python | 32,000 | 800 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Some helper functions for face and bodypart detection pipelines.
"""
import cv2
import numpy as np
# utils for face detection
def faces2dets(faces):
"""
Convert face detections into a formatted array.
This function reformats detected faces from an inp... |
6e415091ef36a1e397571109bf7af969955b952847575a4f2dec6325ceea664f | Python | 32,017 | 750 | import warnings
import numpy as np
import unittest
import pandas as pd
from sklearn.linear_model import LogisticRegression
from sklearn.preprocessing import PolynomialFeatures
from sklearn.pipeline import Pipeline
from sklearn.utils import Bunch
from causallib.datasets.data_loader import load_nhefs_survival
from causa... |
034363b7589cf6da61a10363181568da7c741de263fad8e86f8124125720b610 | Python | 32,062 | 864 | from __future__ import annotations
import operator
import sys
from collections.abc import (
Collection,
ItemsView,
Iterable,
Iterator,
KeysView,
Mapping,
MutableMapping,
Sequence,
)
from itertools import zip_longest
from typing import (
TYPE_CHECKING,
Any,
Generic,
Liter... |
b04afc35f1f570caf5d6619cf687b0bd6fefede8dc5cd4029fead4d7f3949d24 | Python | 32,086 | 761 | import warnings
warnings.filterwarnings("ignore", message="It is not recommended to directly access")
import os
import torch
import pickle
import pandas as pd
import numpy as np
from rdkit import Chem
from typing import Union
from itertools import repeat
from rdkit.Chem import AllChem
from torch_geometric.data import D... |
eaf30af20189680f901b11d4a33018139e0099d63ed7b0e1c5fda9399d6cb7ab | Python | 32,097 | 991 | import reprlib
from collections.abc import Iterator, Sequence
from dataclasses import dataclass
from functools import lru_cache
from pathlib import Path
from typing import (
Any,
Literal,
Protocol,
)
import numpy as np
import polars as pl
pl.enable_string_cache()
from sklearn.model_selection import train_... |
f3bc0818ab0302e7354270c120d704490464d25de10f2df5b0490be2b988a8e3 | Python | 32,164 | 820 | from abc import ABCMeta, abstractmethod
from collections import OrderedDict
from collections.abc import Callable, Mapping, Sequence
from functools import wraps
from numbers import Number
from typing import (
TYPE_CHECKING,
Any,
)
import torch
from eir.train_utils.ignite_port.base import Serializable
from eir.... |
467e7d95959006f6b3573903155230d867956a11504a3bf54eac662ebe836f90 | Python | 32,174 | 617 | """Test sharing one analysis across several computers through a common folder.
Run from the repo root::
uv run python python/test_shared_run.py
The claim is that a batch split across machines and pooled on one of them
gives **what a single machine analysing the whole batch would** — the same
per-recording number... |
b4d32849cd6faf24905a9aafaafc42a0c9bf427aa954b3ad30dc39cd2dfb579b | Python | 32,237 | 648 | # -*- coding: utf-8 -*-
import os
import re
import sys
def find_reference_pcr_file(ref_pcr_name, root_dir):
ref_path = os.path.join(root_dir, 'dat_vestacif_files', 'reference_pcr_format', ref_pcr_name)
if os.path.exists(ref_path):
print("Found reference PCR in reference_pcr_format folder: {}".format(... |
624a16768bf250cec0c24a2a43f4ccfa21d7e046543926abf379e42d339c3e9a | Python | 32,266 | 726 | """Test the statistics and machine-learning step (``src/meanap/stats``).
Run from the repo root::
uv run python python/test_stats.py
There is no MATLAB ground truth to compare against: ``doStats``/``doLDA``/
``doClassification`` were never finished, and where they were, this port
deliberately differs (culture-gr... |
6a9acd85839b46549527f73d0f7d1ecaad95887daec67b5a506e21f3081eb0b7 | Python | 32,287 | 863 | """Custom Tensorflow callbacks."""
import logging
import os
import re
from typing import Dict, List, Optional, Tuple, Union
import numpy as np
import tensorflow as tf
from tensorflow import tanh
from tensorflow.keras import callbacks
from osl_dynamics.inference import metrics, modes
_logger = logging.getLogger("osl... |
254a5b5624fdb08e80d8c1616af3f7a7c28822bc095ad428b430f1cd432c926d | Python | 32,292 | 811 |
import dtiplayground.dmri.common as common
import numpy as np
import nrrd
import nibabel as nib
import yaml
from pathlib import Path
import copy
import cv2
#
#
# gradients are unit-vectors normalized according to b-value (nrrd), there is also normalized gradient coupled with bvalue
#
#
def chunks(lst, n):
"""Yi... |
16727225f8cd87cddcdc0fec8d0f67226b8ee6d4732db9103eb43b3fd710f92f | Python | 32,316 | 932 | import datetime
import numpy as np
import pandas as pd
from anndata import AnnData
import scanpy as sc
import mygene
import anndata as ad
from scipy.sparse import issparse
import re
def sort_obs_table(adata):
"""
Sorts the observation table of an AnnData object by 'celltype' and the numeric part ... |
029ec27dfca7329ec378bc72dd0bab322c84e3547372ae9fb5e07f7b2a4623f4 | Python | 32,322 | 648 | # -*- coding: utf-8 -*-
import os
import re
import sys
def find_reference_pcr_file(ref_pcr_name, root_dir):
ref_path = os.path.join(root_dir, 'dat_vestacif_files', 'reference_pcr_format', ref_pcr_name)
if os.path.exists(ref_path):
print("Found reference PCR in reference_pcr_format folder: {}".format(... |
00e2fb90b2eb70a7d8f3f320b23b5c6bef1b689a92677815532c018ea80d5b9d | Python | 32,341 | 831 | import torch
import torch.nn as nn
import numpy as np
import torch.nn.functional as F
import time
############################################################################################################
# Hopfield Network
#############################################################################################... |
db9d3b2139eea713b955f84ce0de3666b543864ee7e12d3ecd087e6443c291ac | Python | 32,356 | 639 | """Interface to the CaImAn package (https://github.com/simonsfoundation/CaImAn)."""
import numpy as np
import multiprocessing as mp
from caiman import components_evaluation
from caiman.utils import visualization
from caiman.source_extraction.cnmf import map_reduce, initialization, pre_processing, \
... |
cb65a0ecf9ae9f3daaa8570b5721f4129edced18194c42f81f767d0cc3cfab57 | Python | 32,368 | 717 | '''
This script performs subject-level rERP analysis in the learning task.
Briefly, we collect predictors for word onset, phoneme onset,
acoustic envelopes, acoustic edges, phonotactic surprisal,
lexical surprisal, invariant acoustic surprisal, invariant
semantic surprisal, speaker acoustic surprisal, and speaker
... |
0fd1608742bec9d39d75ca0eda395cb10183d0da356e10fe609122635a4ea51a | Python | 32,404 | 840 | # Copyright 2024 BDP Ecosystem Limited. 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 applicab... |
3acb47c3b2bccc03a1227189a40e8ee289f563899ea457ab2f3cd5c78beb684c | Python | 32,444 | 879 | # Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
"""
ViTDet backbone adapted from Detectron2.
This module implements Vision Transformer (ViT) backbone for object detection.
Rope embedding code adopted from:
1. https://github.com/meta-llama/codellama/blob/main/llama/model.py
2. https://github.c... |
ffe0dd07f7ee5cebeae1d2bd243f5eb7da5fe154a54905d6d5b908276383f0a8 | Python | 32,460 | 647 | """Test the CAT-NAP batch (group × age) comparison figures.
Run from the repo root::
uv run python python/test_catnap_group_plots.py
These are the figures the ephys pipeline draws at the end of steps 2 and 4
(``2B_``/``4B_GroupComparisons``) and that the CAT-NAP path was missing. There
is no MATLAB ground truth ... |
167fe6744f34d82fce86009e5293ba0d75089a7667b2acb7609da588b7bfbb36 | Python | 32,491 | 773 | from abc import ABC, abstractmethod
from typing import Callable, Optional, List, Tuple
from dataclasses import dataclass, field
import warnings
import os
import numpy as np
import scipy.signal
import scipy.spatial.distance
import scipy.ndimage
from collections import Counter
import itertools
# neural network
import to... |
0196fdac9b2de7a9cb02f3c24875478a48321a410bbc5a2602c59914857b0700 | Python | 32,495 | 745 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Developed by Guido Meijer (www.guidomeijer.com)
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import os
from os.path import join, isfile, isdir
from pathlib import Path
import shutil
from glob import glob
import json
from scipy.signal imp... |
bbe6c4edab3d888b30665387e83a9f06eeaaa825fb480c70df3290ae25dad58f | Python | 32,506 | 902 | import pytest
import numpy as np
from pathlib import Path
from unittest.mock import Mock, patch
from stack_corr.operations import (
sum_along_axis,
fiji_auto_contrast,
get_stack_sections,
predict_with_overlapping_windows,
clean_prediction,
get_skeleton_coords,
add_band_positions,
export... |
6cbe7cead7383beba6a47323c4aa09de492620573eb731ff0e10efc4da49e74e | Python | 32,577 | 641 | import os
import csv
import json
import glob
import numpy as np
import pandas as pd
from nipype import Node, Workflow
from nipype.interfaces.utility import Function, IdentityInterface
from nipype.interfaces.fsl import FLIRT
from nipype.interfaces.freesurfer import MRIConvert
from cvdproc.bids_data.rename_bids_file im... |
bc2efd1e9b971b098d80725a6a19481471ba183129e3ae718d994a0c1383f420 | Python | 32,693 | 828 | # Get Python six functionality:
from __future__ import\
absolute_import, print_function, division, unicode_literals
from builtins import zip
import six
###############################################################################
###############################################################################
###... |
23a01ace7729f118c2d45d87844aaa89bf3bec45fcbcacceebc603aff970cb9d | Python | 32,744 | 985 | import logging
import nibabel as nib
import numpy as np
from dipy.align import resample
from scipy.ndimage import distance_transform_edt
from AFQ.definitions.utils import Definition, find_file, name_from_path
from AFQ.recognition.utils import tolerance_mm_to_vox
from AFQ.tasks.utils import get_tp
__all__ = [
"Im... |
47111d801561adde1f15d915094488db46e5e4a4c01badac4742575eaa2493b2 | Python | 32,854 | 777 | """Matplotlib plotting layer for the MEA-Stim subsystem.
Port of the figure-producing functions in ``Functions/stimAnalysis/`` on
``origin/main``:
- ``plotStimTimes.m`` -> :func:`plot_stim_times` (1_StimsDetected)
- ``plotStimHeatmap.m`` -> :func:`plot_stim_heatmap` (2_StimsHeatmap)
- ``plotI... |
edaeeec1373f60a6cd6546ad95607d19952b7053db1838e1e41699c4959ba069 | Python | 32,857 | 705 | # !/usr/bin/env python
# coding: utf-8
# @Time : 2022/7/24 19:52
# @Author : Z.-H. G.
# @Email_0 : guozhenhao17@mails.ucas.ac.cn
# @Email_1 : guozhenhao@tongji.edu.cn
# @File : trainer.py
# @IDE : PyCharm
import pandas as pd
import copy
import torch
import scanpy as sc
from CAMEX.train_untils import *
fro... |
56f927faa9fe2654ecc0b10fb37ff457ff49166076402c34909213eb7614d338 | Python | 32,937 | 724 | from typing import List, Optional, Tuple, Callable, Union
import numpy as np
from ..helpers import plot_complex_matrix, inverse_permutation, ordered_viz_permutation, to_stripe_array
from ..components import MZI, Beamsplitter
from ..config import NP_COMPLEX, BLOCH, SINGLEMODE
from ..meshmodel import MeshModel
class T... |
c6652abec6e55444fb7ae150fe24d5b61b33359690e37ceefe20b3441eff07de | Python | 32,937 | 1,043 | import gc
import json
import os
import os.path as op
import random
import shutil
import subprocess
import tempfile
import dipy.tracking.streamline as dts
import dipy.tracking.utils as dtu
import nibabel as nib
import numpy as np
import numpy.testing as npt
import pandas as pd
import pytest
from dipy.io.streamline impo... |
77487180364bc87a73a1a023d523e2c9090ce9ff28ee5af0661e4c87cf1fb761 | Python | 32,969 | 849 | # coding: utf-8
"""Plotting library."""
import math
from copy import deepcopy
from io import BytesIO
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union
import numpy as np
from .basic import Booster, _data_from_pandas, _is_zero, _log_warning, _MissingType
from .compat import pd_DataFrame
from .... |
8a96a511fda0f7685e7022ee675933b444a1ce687d9819db547813f7dfddc9a4 | Python | 32,970 | 928 | from PySide6.QtGui import QColor
from PySide6 import QtCore
from typing import List, Dict
import re
import numpy as np
from scipy.io import savemat
import distinctipy as distc
class Epoch(object):
# Defines unit behavior epoch
def __init__(
self,
stream: "Stream" = None,
behavior: "Beh... |
fb1d2ca4dfebb530153ad99bc1e34049070e0dde6cf1fec03317f2275fff9559 | Python | 32,994 | 681 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
import os
import re
import shutil
import subprocess
import tarfile
import zlib
from itertools import repeat
from multiprocessing.pool import ThreadPool
from pathlib import Path
from urllib import parse
from uuid imp... |
98374cc1bf084a0100a7932c514b1912f6cba69aeaedd3cff920ca0edddf5404 | Python | 33,024 | 853 | import threading
from collections import OrderedDict
from random import Random
from typing import Dict, Iterator, List, Optional, Union, Tuple, Any
import numpy as np
from torch.utils.data import DataLoader, Dataset, Sampler
from rdkit import Chem
from .features import get_features_generator
from .features import Bat... |
4cc84b1a9428e8e1bba4e04a8b35f046c8bfc510358e177c15a9e1ffa7ff310d | Python | 33,066 | 813 | # Kai Sandbrink
# 2023-06-27
# This script contains plotting functions for trajectory analyses
# %% LIBRARY IMPORT
import numpy as np
import pandas as pd
from matplotlib.path import Path
import seaborn as sns
import matplotlib.pyplot as plt
from utils import format_axis
from matplotlib.ticker import FormatStrForma... |
8a05434e02b1aa755904421b182e90bda0f19e6f914298ef203a4a32a04d9d36 | Python | 33,091 | 858 | #!/usr/bin/env python
# Copyright (c) 2015 Tobias Neumann, Philipp Rescheneder.
#
# This file is part of Slamdunk.
#
# Slamdunk 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, either version 3 of the
#... |
f4c49789d307ddff2ad3e677c456d3d831d7ef3a781dca121b345d5d70b04457 | Python | 33,101 | 785 | """
Decompose graph generation and embedding generation
Embedding generation is gpu bounded while graph generation is cpu bounded
Improve the edge distance computation via torch.cdist
"""
import os, sys
sys.path.append('..')
import math
import warnings
warnings.filterwarnings("ignore")
import MDAnalysis as mda
import t... |
977583adf40da104bd13ab5aba3989e76afa09254a1a8e26355879b848d900a6 | Python | 33,156 | 890 | #! /usr/bin/python
# file: import-caffe.py
# brief: Caffe importer for DagNN and SimpleNN
# author: Karel Lenc and Andrea Vedaldi
# Requires Google Protobuf for Python and SciPy
import sys
import os
import argparse
import code
import re
import numpy as np
from math import floor, ceil
import numpy
from numpy import ar... |
03234faf1c4753a8eb685ae068262b0899021cbd8e6473dcca18334cba071f9f | Python | 33,255 | 953 | """Related work transformations for optical parameter calculations."""
import math
import os
from dataclasses import dataclass, field
import numpy as np
import torch
from scipy.interpolate import interp1d
from scipy.signal import savgol_filter
from mcmlnet.constants import (
CM_INV_TO_M_INV,
NM_TO_M,
RAY... |
e8200e79f74cd311401482d9513ef3ad464df2349ee61940b32582f3779992f6 | Python | 33,326 | 809 | import glob
import os
import numpy as np
import torch
from scipy.interpolate import RegularGridInterpolator as rgi
from scipy.ndimage import gaussian_filter as gauss_filt
from scipy.interpolate import interp1d
import dtiutils
import utils
# This is a second attempt, working linearly on RGB space, which reduces t... |
4b762294bf220abcf7b53fd3030a93ef5352af31a0640b02ada193888b8d732d | Python | 33,351 | 796 | import glob, os, re, shutil, subprocess, pgzip, time, traceback, tifffile, numpy as np, numba as nb, \
scipy.stats, joblib as jl
from itertools import chain
from skimage.measure import label, regionprops
import skimage.filters
from tqdm import tqdm
# Monitor errors on resampling task
def runResampleOnWorke... |
b65de4c536668d15f69357310b5229347c5321b50f9b8292dc0fe156627f8f38 | Python | 33,392 | 799 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
"""Transformer modules."""
from __future__ import annotations
import math
import torch
import torch.nn.functional as F
from torch import nn
from torch.nn.init import constant_, xavier_uniform_
from ultralytics.utils.torch_utils import TORCH_1_11
f... |
633e6589056be708c914ab6068ce763a43f5ddd38c441c2b8b3d543e4000c923 | Python | 33,416 | 984 | """Argument parsing and main entry point for the ChemGraph CLI.
Supports three usage styles:
1. **Legacy** (no subcommand) -- ``chemgraph -q "..." -m gpt-4o``
2. **Subcommand** -- ``chemgraph run ...``, ``chemgraph eval ...``,
``chemgraph session ...``, ``chemgraph models``
3. **Standalone eval** -- ``chemgraph-ev... |
6444998df495c17713043d593b07ddc89e86e9a6015644258cbe7c68b53443b7 | Python | 33,559 | 1,196 | """Adaptive Multipole Model (AMM) for OPM interference rejection.
Consolidates spherical harmonics, spheroid fitting, prolate coordinate
transforms, internal/external harmonic bases, and the AMM denoising pipeline.
Translated from spm_opm_amm.m and supporting SPM functions.
Examples
--------
Apply AMM denoising to O... |
b4e939c3c6aafed3f6f120f3daf53b99158cb2fe5ec300751952a3fe7de5121e | Python | 33,572 | 850 | # Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
from typing import Tuple
import torch
import torch.nn as nn
import torchvision
from typing_extensions import override
from .act_ckpt_utils import activation_ckpt_wrapper
from .box_ops import box_cxcywh_to_xyxy
from .model_misc import get_clone... |
3e830cb28d952fa6e4245e29fcd7a340c16d7ccd2b88fe99dd51656b76a1b5a3 | Python | 33,579 | 902 | """
lmfit-based adapters.
* :class:`LmfitBaselineAdapter` reproduces the *current* call shape exactly
(``Model.fit`` with default ``leastsq`` and no weights). Replaying every
captured case through it should yield results numerically identical to the
reference, which gives us the framework self-test.
* :class:`L... |
f55533906f27ca9d8dfff38ca0eb02902bba9328be15c3341e1d20d5b571b1e1 | Python | 33,634 | 649 | #############################################################################
# Copyright (C) 2020-2026 MEmilio
#
# Authors: Martin J. Kuehn, Lena Ploetzke
#
# Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complia... |
8f5e030d900b627a85bc4e48c0c0531f65cf19053b99efa3d0fdf7d5c8c5cd09 | Python | 33,640 | 855 | import warnings
import numpy as np
import cv2
import torch
from skimage.measure import regionprops
from skimage import img_as_ubyte
from collections import OrderedDict
from scipy.ndimage import distance_transform_edt
from multiprocessing import Pool, shared_memory
from gc import collect
from .segmentation import filter... |
b9f9d8ea4655049609553566db538b096cd19b757e0775f5862d590e45ce31c2 | Python | 33,664 | 909 | #!/usr/bin/python
#
## @file
#
# A utility for creating image mosaics and imaging array tomography type samples.
#
# Hazen 07/15
#
import os
import sys
import re
from PyQt5 import QtCore, QtGui, QtWidgets
# Debugging
import storm_control.sc_library.hdebug as hdebug
# UIs.
import storm_control.steve.qtdesigner.steve_... |
ab1c874bd252b75b81079cb45aa7f1ea212d90e551ac3df02fe4d1e56bcf3b7c | Python | 33,684 | 749 | import numpy as np
from pathlib import Path
import csv
from functools import partial
import concurrent.futures
from scipy import stats
from scipy.signal import find_peaks
from scipy.optimize import fsolve
from tvb.simulator.lab import *
import mne
from useful_fns import *
def params_dict_writer(params_dict, file_qu... |
655e84d9f55752720d66e178c3a11b88acb0efbab5702d293cfef3e95afb6aee | Python | 33,751 | 987 | #!/usr/bin/env python3
"""
This is to prepare the processed SSC samples for SFARI long-read sequencing data deposition. Currently only supports PacBio + Nanopore data
Usage: sfari_data_deposit.py --sample 11918_s1:SSC --proj_dir --ont_dtype fast5
Author: Mei Wu https://github.com/projectoriented
"""
import sys
if sys.... |
c28e68199e321d3399b3ff34b81d6fce2ebca4893281f4e172c17d1deed328a4 | Python | 33,762 | 900 | """
Copyright 1999 Illinois Institute of Technology
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, publis... |
33965f0ba8b1565ad5381c8d8a891c40ae016994d53edd6008411c86b844cafa | Python | 33,781 | 687 | import numpy as np
import os
import scipy.ndimage as ndi
import scipy.sparse as ssp
import matplotlib.pyplot as plt
from skimage.feature import peak_local_max
import pandas as pd
from .utils import io as io
from .utils import image as im
from .utils import neighbors as nb
from .utils import stat as stat
from .utils ... |
abfd119a3711b337997ad0b8efcaeb0d9198242e368776889e361acaf6fff948 | Python | 33,824 | 950 | """
FLYNC Command Line Interface
Python-first CLI for the FLYNC lncRNA discovery pipeline.
"""
import click
import subprocess
import sys
from pathlib import Path
import shutil
import platform
try:
import importlib.resources as pkg_resources
except ImportError:
import importlib_resources as pkg_resources
cl... |
b434c2f75673066c5ca78e653b08c455aff528bc22a7e58a445d6a733bbe21a2 | Python | 33,833 | 700 | # Written by Nicholas Card 2023
import tensorflow as tf
import random
from datetime import datetime
import os
from scipy.ndimage import gaussian_filter1d
import numpy as np
import pathlib
import logging
import json
import sys
import models as models
from gaussSmooth import gaussSmooth
from omegaconf import OmegaConf... |
d8aa3d27f8bce41b04123788b603af9c5363ab1da1b7d610acf63bfb66cb702f | Python | 33,859 | 990 | """Module to generate networkx graphs."""
from jarvis.core.atoms import get_supercell_dims
from jarvis.core.specie import Specie
from jarvis.core.utils import random_colors
import numpy as np
import pandas as pd
from collections import OrderedDict
from jarvis.analysis.structure.neighbors import NeighborsAnalysis
from j... |
c0c8d3568494d0b1fb174063456b9d87e655d5372d296883b411f7292cfe8bf1 | Python | 33,862 | 622 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon May 6 09:21:19 2024
@author: nugenta
"""
import pandas as pd
import numpy as np
from neuroCovHarmonize.harmonizationLearn import harmonizationCovLearn, saveHarmonizationModel, saveHarmonizationModelNeuroCombat
from neuroHarmonize import harmonizationL... |
8fd3878ea822a6944ed3cfb1243a6e74a517c73b7455c259ba816c4e08abda29 | Python | 33,863 | 633 | from copy import deepcopy
import os
import sys
import json
import warnings
warnings.filterwarnings("ignore")
import math
import time
import random
import pickle
import argparse
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import torch.backends.cudnn as cudnn
from torchvision impor... |
300569856a8d7f4f9cc251d1bdd894f1d7bce9d071c239b73226a6ffab357a9e | Python | 33,971 | 823 | import copy
import math
import sys
import warnings
from typing import Callable, Dict, List, Literal, Optional, Tuple, Union
import torch
from torch import Tensor
import torch_geometric.typing
from torch_geometric.data import (
Data,
FeatureStore,
GraphStore,
HeteroData,
remote_backend_utils,
)
fro... |
4d5b71a06c66e30f8ed2c852eac4b8d7fb9920155888960fc077ee6b93d40d4d | Python | 33,976 | 866 | #!/usr/bin/env python
"""
This class handles the lock display group box and it's widgets.
Hazen 04/17
"""
from PyQt5 import QtCore, QtGui, QtWidgets
# UI.
import storm_control.hal4000.qtdesigner.lockdisplay_ui as lockdisplayUi
class LockDisplay(QtWidgets.QGroupBox):
"""
The lock display UI g... |
88e7eff8c79db3aac95dad3fb46e55f29a4bcb0845eebe004945fbd49629ef42 | Python | 33,977 | 779 | # All functions adapted from https://github.com/fwillett/speechBCI/blob/main/AnalysisExamples/analysis.py
import numpy as np
import scipy.stats
from scipy.ndimage import gaussian_filter1d
from numba import njit
import matplotlib.pyplot as plt
from matplotlib import cm
import numpy as np
#from omegaconf import OmegaCon... |
f0225d7bd49d4cb953d49f5a758e6fad59c71618cc61fa49fc7a86948e6a0ccb | Python | 33,980 | 776 | """
LOSO linear probe evaluation on the UDysRS dataset.
Runs four evaluations in sequence:
1. Normalization audit — checks whether shoulder sway (whole-body postural
drift, preserved by clip-mean centering in normalize_clip) correlates with
score, and whether wrist/ankle speed in normalized space also cor... |
17b0c2ced562c1e2e669d6c8589285522a8d192ebf031c3a6d1f27c310f68545 | Python | 33,992 | 870 | """
This is a convenience wrapper to apply Fiji's Correct_3D_drift to the image being
traced in SNT. It re-uses the original code verbatim (forked from [1]) since,
currently, there is no immediate way to call the original script without
disrupting the tracing session. No registration code was altered.
Changes (at the b... |
1f2a7ed0811654b0357e68e4dea611514026bbfe0fbb95ef8d81ae70859cb399 | Python | 33,994 | 848 | """A module that contains unit tests for the :py:mod:`corelay.plugboard` module."""
from typing import Annotated
import pytest
from corelay.plugboard import Slot, Plug, Plugboard
class TestSlot:
"""Contains unit tests for the :py:class:`~corelay.plugboard.Slot` class."""
@staticmethod
def test_init() ... |
611b3110472e8cc65526f81c3b0a34151ddd728d985e651482acbf202dd6d14b | Python | 34,016 | 790 | """ Functions for IVIM parameter estimation. """
import numpy as np
import numpy.typing as npt
from scipy.optimize import curve_fit
from ivim.models import sIVIM, diffusive, ballistic, intermediate, NO_REGIME, DIFFUSIVE_REGIME, BALLISTIC_REGIME, INTERMEDIATE_REGIME, check_regime
from ivim.models import monoexp as mono... |
4d4b28ec9af26c95bd8303a899b57caa8820b73134eeeaaa3b9b88fd9e3d5938 | Python | 34,019 | 1,010 | """Bayesian encoding and decoding"""
__all__ = [
"decode1D",
"decode2D",
"k_fold_cross_validation",
"cumulative_dist_decoding_error_using_xval",
"cumulative_dist_decoding_error",
"get_mode_pth_from_array",
"get_mean_pth_from_array",
]
import copy
import numbers
import numpy as np
from sci... |
8463f5929bef733e16c9a44080f8e48e3abd03f964291902a3848074a485bf64 | Python | 34,028 | 816 | # 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 argparse
import time
import os, sys
import os.path as osp
from shutil import copy
import copy as cp
from tqdm import tqdm
import pdb
from... |
9f03f2a4afaa0cb1d46956385f8f9342cb151914410df64d98095d154607bab2 | Python | 34,081 | 798 | import sys
import serial
import numpy as np
import matplotlib.pyplot as plt
from numpy import cos, sin, pi
import matplotlib.animation as animation
from matplotlib.widgets import Button
from matplotlib.widgets import Slider
from collections import deque
from matplotlib.backend_bases import MouseEvent
from mat... |
eae07e4f64c76b60d2680a99e489d9ad9bfbf2cb5dad94f86b8daad42bd2fecc | Python | 34,129 | 780 | # All functions adapted from https://github.com/fwillett/speechBCI/blob/main/AnalysisExamples/analysis.py
import numpy as np
import scipy.stats
from scipy.ndimage import gaussian_filter1d
from numba import njit
import matplotlib.pyplot as plt
from matplotlib import cm
import numpy as np
#from omegaconf import OmegaCon... |
2a5b20be2eb1d8f870fbfec29e7f6e93ee9b72081c1e2b2eb7db89f3e1bf0030 | Python | 34,159 | 874 | """ Implementations of some contrastive loss functions.
This file contains some helper functions, and classes that can be instantiated and used to compute loss values in contrastive learning.
Typical usage example:
import tensorflow as tf
import ContrastiveLosses as CL
anchors = tf.cast(tf.transpose(tf.... |
1b4583792e54d9db3958052157faf79ae07254e2c3c37a0fb8b8d1903ffe7992 | Python | 34,187 | 724 | import argparse
from ast import Continue
from json import load
from typing import Callable, List, Optional
# from torch_geometric.loader import DataLoader
import os, torch, sys, math
import numpy as np
from torch_geometric.data import (
Data,
Dataset,
# InMemoryDataset,
# download_url,
# extract_tar... |
7c6fc9e648ed3fd28a5b9b08f6ba6e7caaadd1933400bd89fd2c967b0e6f24f8 | Python | 34,193 | 786 | """A miniature but structurally faithful CCF, built into a temporary directory.
The package's entry points are classes whose constructors read hundreds of
megabytes of HDF5. None of that can live in the repository or on a CI runner,
and an external contributor cannot be expected to obtain it. But the package
makes no ... |
757a038a4085ba4df98aa9f5fbf7fe8545be4a7f6d5f45ed32a718993912a138 | Python | 34,214 | 821 | import torch
import torch.nn as nn
from torchsummary import summary
from monai.networks.nets import AttentionUnet, BasicUNetPlusPlus
from collections.abc import Sequence
import numpy as np
from brainCT.networks.utils import ConvLayer, SkipConnection, SeparableConv2d, AttentionBlock, AttentionLayer, PlusUpBlock, PlusDo... |
ff268e3c90c2ea4ec31e0213e1c030d8ae091187b8b3346634ed1d435e3d367a | Python | 34,237 | 855 | """
PySPMs - an SPM clone in Python
Joram Soch, MPI Leipzig <soch@cbs.mpg.de>
2023-06-15, 13:41: spm_hrf
2023-06-15, 15:37: get_des_mat
2023-07-13, 16:08: GLM, GLM.MLE, GLM.MLL
2023-08-14, 16:36: GLM, GLM.MLE, GLM.MLL
2023-08-17, 14:55: get_des_mat, documentation
2023-08-28, 15:25: spm_get_bf, spm_hrf
2023-08-31, 16:2... |
0bb34f3dd9c9eef155703980619ae93c561b8243d3f12e1d71d363df977ca2cd | Python | 34,293 | 802 | # This file is part of connectome-manipulator.
#
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2024 Blue Brain Project/EPFL
import os
import numpy as np
import pandas as pd
import pytest
import re
from numpy.testing import assert_array_equal
from scipy.sparse import coo_matrix, csc_matrix
from utils import se... |
b2028e005253b514cb9847a2869ece5376ca4770686926cbb186bc65d48a1a67 | Python | 34,327 | 839 | import pickle
import os
import numpy as np
import os
import faiss
from clustercontrast.utils.infomap_cluster_huang import knn_faiss, knns2ordered_nbrs,get_links
import re
from collections import defaultdict
import networkx as nx
from scipy.sparse import csr_matrix
import json
import csv
import infomap
from tqdm import... |
45c96f886d8af5954dca185104b7fc5b8a1028cdaaf914f2694317bd5f4d3c63 | Python | 34,358 | 613 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: karajohnson
"""
import os
import numpy as np
import scipy.io as sio
from scipy import signal
from fooof import FOOOF
import pandas as pd
import matplotlib.pyplot as plt
import math
import seaborn as sns
import json
import Neuromega
import GraphingUtility
im... |
6ff91db3aaeb663fa8ca1d3c8767f03647ce1b2ae03a883a930dfe10fd4eb6b7 | Python | 34,370 | 806 | # Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
"""
Modules to compute the matching cost and solve the corresponding LSAP.
"""
import numpy as np
import torch
from sam3.model.box_ops import box_cxcywh_to_xyxy, box_iou, generalized_box_iou
from scipy.optimize import linear_sum_assignment
from... |
dc58509464990dab0bb35aa3f0234e686415a0d0f7ff1ec363813472d21def6d | Python | 34,411 | 708 | """
Memory estimation utilities for Brain-Score benchmarks.
Call :func:`preallocate_memory` before scoring to detect OOM errors early,
rather than discovering them 6+ hours into a benchmark run.
Example usage::
from brainscore_vision import load_model, load_benchmark
from brainscore_vision.benchmark_helpers.m... |
1d38372362738bb8f2387086c5cb63eff297fcedf24fc209b5b41252127ed2af | Python | 34,416 | 780 | # All functions adapted from https://github.com/fwillett/speechBCI/blob/main/AnalysisExamples/analysis.py
import numpy as np
import scipy.stats
from scipy.ndimage import gaussian_filter1d
from numba import njit
import matplotlib.pyplot as plt
from matplotlib import cm
import numpy as np
#from omegaconf import OmegaCon... |
e268f123b638357c7ac629e2cb787c41d34ef8f37070d2f8e860c5714824bb68 | Python | 34,438 | 675 | # Imports
import os
import numpy as np
import nibabel as nib
from dipy.viz import regtools
from dipy.segment.mask import applymask
from dipy.io.image import load_nifti
from dipy.align.imaffine import (transform_centers_of_mass,
AffineMap,
MutualInformat... |
ab4367be4886e86d258bac73e6463270f6b09ab3fd983b29c58d1cbd7789eda3 | Python | 34,491 | 624 | """Pipeline parameter definitions, mirroring the MATLAB Params struct."""
from dataclasses import dataclass, field
from pathlib import Path
from typing import Literal
# ── Optional steps ───────────────────────────────────────────────────────────
#
# Steps a run does only when asked, named in :attr:`Params.optional_... |
c1fdf9582b651f7b5e0f8506719dfcfa57e1d9334fabd093e0b93d27e4ea246f | Python | 34,518 | 853 | """
tensorflow/keras utilities for the neuron project
If you use this code, please cite
Dalca AV, Guttag J, Sabuncu MR
Anatomical Priors in Convolutional Networks for Unsupervised Biomedical Segmentation,
CVPR 2018
or for the transformation/integration functions:
Unsupervised Learning for Fast Probabilistic Diffeo... |
e7cedb9c512f861aeb0a313b34653e2478e3353fb4fc8fade638f3156d128347 | Python | 34,521 | 756 | import concurrent.futures
import json
import math
import cv2
import numpy as np
import pandas as pd
import seaborn as sns
from magicgui.widgets import FunctionGui
from typing import Dict, List, Optional, Tuple
from pathlib import Path
from shapely.geometry import Polygon
from matplotlib.backends.backend_qt5agg import F... |
a833a45e39a75176b2f5e1615eac9961d1ab2966bc17be7e6f0a2253c254394b | Python | 34,533 | 1,066 | #!/usr/bin/python3
#
import os
import re
import shutil
import struct
import numpy as np
import collections
from scipy.spatial import distance
import vtk
from vtk.util import numpy_support
from uac.element import Element
from uac.line import Line
# Number of vertices per element
eleminfo = {"Ln": 2, "Tr": 3, "Qd": 4, ... |
3a544b75716fa1238f7318fd91a00211f5cc6ac274d6828d202aa11f1a36b02c | Python | 34,540 | 779 | # Copyright (C) 2020-2022 Intel Corporation
# Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import copy
import itertools
import os.path as osp
import tempfile
import xml.etree.ElementTree as ET
import zipfile
from collections import defaultdict
from glob import glob
from shutil import copyfile
f... |
12019f44de32b7fd7efa8d631a2409cbd722ef5415021dc35d1bd0baf7ae654f | Python | 34,599 | 845 | """
Copyright 1999 Illinois Institute of Technology
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, publis... |
21b8dbc63381ba307fd45a03f6688c7342f14bbef5d14f96dd315903a5c93dea | Python | 34,630 | 732 | import datajoint as dj
import featurevis
import numpy as np
import torch
from scipy import ndimage
from featurevis import models
from featurevis import ops
from neuro_data.static_images import data_schemas
from staticnet_experiments import configs
from staticnet_experiments import models as static_models
from staticn... |
7e61caddc8c3a8b175894e6aac9c678a7cd363e3a1b286ac28069a1d574785af | Python | 34,630 | 1,080 | from pathlib import Path
import numpy as np
import polars as pl
import pytest
from sklearn.preprocessing import LabelEncoder, StandardScaler
from eir import train
from eir.data_load import label_setup
from eir.data_load.label_setup import merge_target_columns
from eir.setup.config import Configs
from eir.target_setup... |
da0bab034fc12fa356009a3fbfd1659f904348f3ef88877a6bea929927ed40a9 | Python | 34,635 | 761 | import os
import re
import xml.etree.cElementTree as ET
from collections import Counter
from itertools import combinations
import matplotlib.pyplot as plt
import numpy as np
from numpy import arange
import pandas as pd
from pymatgen.analysis.diffraction.xrd import XRDCalculator
from pymatgen.analysis.structure_matcher... |
75569fd3a9bd7bb8c640d99c91103858933774595848c71bf07225eea3281a25 | Python | 34,647 | 986 | """Base class for models."""
import logging
import os
import pickle
import re
import types
import uuid
import warnings
from abc import abstractmethod
from dataclasses import dataclass
from io import StringIO
from contextlib import contextmanager
from typing import Dict, Generator, List, Optional, Tuple, Union
from pac... |
1e06ee8469b34e22c9ddc98182156bd6e20cb93c3ab3a40ebde20f08a197c559 | Python | 34,650 | 727 | import argparse
from ast import Continue
from json import load
from typing import Callable, List, Optional
from torch_geometric.loader import DataLoader
import os, torch, sys, math
import numpy as np
from torch_geometric.data import (
Data,
Dataset,
InMemoryDataset,
download_url,
extract_tar,
)
from... |
66d31c970ec1db7d7e27c4518a12610919e9721d3ac59a3b0278e495e87b2045 | Python | 34,714 | 711 | """Test continuing an interrupted run, and changing which recordings it covers.
Run from the repo root::
uv run python python/test_continue_interrupted.py
A batch cut off at recording 5 of 10 used to mean redoing all ten. Continuing
skips the ones whose result for that step is already on disk.
The load-bearing ... |
e256a2fd93e3b10495269d0c36e2a2a594a0a35e4ea661cbc298e42b8347a7a0 | Python | 34,719 | 906 | #!/usr/bin/python
#
## @file
#
# Utility for running scripting files for remote control of the HAL-4000 data taking
# program. The concept is that for each movie that we want to take we create a list
# of actions that we iterate through. Actions are things like finding sum, recentering
# the z piezo and taking a mov... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.