sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
83d690b182d2d5597b25b25970900dd287aefce9f573263970bb7d445f18c308 | Python | 9,132 | 226 | import numpy as np
import torch
import torch.nn as nn
import seaborn as sns
import matplotlib.pyplot as plt
from pathlib import Path
from torch.utils.data import DataLoader
from sklearn.metrics import confusion_matrix, f1_score, accuracy_score, classification_report
import time
from typing import Optional, Union
import... |
a8d1bfa34201bc4c841bddb2c2436e08c33c654666d2db1231661ba35b6071ae | Python | 9,134 | 202 | import shutil
from pathlib import Path
from typing import Optional, Union
from loguru import logger
from brainles_preprocessing.defacing import QuickshearDefacer
from brainles_preprocessing.preprocessor.preprocessor import BasePreprocessor
class NativeSpacePreprocessor(BasePreprocessor):
"""
Preprocesses me... |
c8e491c62529ab409123e23576f7f6c4458e3d6be2aad7a56fcd1c42fcec0d0d | Python | 9,138 | 177 | # Copyright (c) 2022, Kwanhyung Lee, AITRICS. All rights reserved.
#
# Licensed under the MIT License;
# you may not use this file except in compliance with the License.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT ... |
df4c2fc18ecb737dc48e1c3080d7782e47be7bd3b589f462df9024e640d5560c | Python | 9,138 | 284 | # Copyright (c) OpenMMLab. All rights reserved.
from collections.abc import Sequence
import mmcv
import numpy as np
import torch
from mmcv.parallel import DataContainer as DC
from ..builder import PIPELINES
def to_tensor(data):
"""Convert objects of various python types to :obj:`torch.Tensor`.
Supported typ... |
97ca3b61e8c418447cbe14f8768a17548436b5a8a0df6f17b905e01cde67c731 | Python | 9,139 | 240 | """
FC-synaptome analyses
"""
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from matplotlib.colors import LinearSegmentedColormap
from palettable.colorbrewer.sequential import (PuBuGn_4,
PuRd_4,
... |
1e38515132992e1c23e2aa684e272313e97f7ac3ff803a5546068c920a451505 | Python | 9,141 | 220 | # -*- coding: utf-8 -*-
"""TODO"""
import numpy as np
from scipy.special import expit
from scipy.stats import logistic
import core.core_global as core
from core.core_definitions import simulation_timestep
from core.connection import Connection
from core.euler_trace_2d import EulerTrace2D
class RewiringConnection(Co... |
49a0289fe5be551c46289dab02a1269917b0b3f1ad83068e9c05a99de94af94b | Python | 9,141 | 236 | """Cost functions for TensorFlowBackend.
Cost function code by Alexander Tomlinson (Github: arrrobase),
ported from a previous version of NEMS
TODO: Update documentation, revise functions. Lots of hard-coded magic numbers
and assumptions about data format.
"""
import numpy as np
import tensorflow as tf
import... |
313b88a8bad93a69737c6bf17466a2b5fcd868849f3c5cef2c34dcfa65de7a76 | Python | 9,142 | 280 | import json
from pathlib import Path
from typing import Callable, Dict, Optional, Sequence, Tuple, Union
import cv2
import numpy as np
import tifffile
from napari.utils.notifications import show_info
from skimage.exposure import rescale_intensity
from napari_dmc_brainmap.stitching.layout import (
TILE_OVERLAP_PX,... |
982f992e0b951a582451ccf7e92ff92c940ee9f48cc1a86f6532009f247fc0f2 | Python | 9,142 | 179 | import numpy as np
import pandas as pd
from typing import Tuple, Union
from . import ELA_MEM_LM, ELA_Network_calc_E, ELA_Network_calc_SS, ELA_Network_calc_TP_onlySS, ELA_Network_functions
#-----------------------------------------------------------------------------------
# ⑤calc major local minimum (major SS)
#----... |
05e60e11c1b99a71051b74124929907ef04fd2526427a1699b7abd49d351e8f9 | Python | 9,143 | 234 | # -*- coding: utf-8 -*-
import nibabel as nib
import numpy as np
from dipy.io.stateful_tractogram import StatefulTractogram, Space, Origin
from scilpy.image.volume_space_management import DataVolume
from scilpy.tests.utils import nan_array_equal
from scilpy.tractograms.dps_and_dpp_management import (
add_data_as_c... |
fbdd60f0b526bf3e3d95434f421c2b146872bd72ca413ba78caf3198d1e11276 | Python | 9,143 | 237 | #############################################################################
# Copyright (C) 2020-2026 MEmilio
#
# Authors: Henrik Zunker
#
# 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 compliance with the Lice... |
8336fc84cae98f85ca75d5196ccb4a49923bd434c840ebfef8fd063b166a03a4 | Python | 9,145 | 243 | """Running several analyses back to back, unattended.
A run takes minutes to hours, and until now the only way to do a second one was
to wait for the first, reconfigure, and start again — which means someone has to
be awake for every handover. The work itself is unattended; the *scheduling* was
not.
A queue is a list... |
30cc05fd8bcf869b71bb74cfd23e0b5ae1c401b81e47bf941ac3f9299550c919 | Python | 9,146 | 291 | from __future__ import annotations
import os
from collections.abc import Callable
from pathlib import Path
import pytest
from PySide6.QtCore import Qt
from pytestqt.qtbot import QtBot
from labelme._app import MainWindow
from labelme._label_file import read_label_file
from ..conftest import close_or_pause
from .conf... |
09ea4eb94fd8659fa65fcfa8b88834b9c7cfe996e18d8f26d10cd75a77c1f171 | Python | 9,147 | 259 | """
Common and configurable PyTorch Lightning DataModule.
"""
from copy import deepcopy
from functools import partial
from typing import Any
import lightning as pl
import torch
from hydra.utils import instantiate
from omegaconf import DictConfig, open_dict
from torch.utils.data import DataLoader
from mcmlnet.trainin... |
a0ab1909319c29f61b26303528add6eb507d9b5a97dc7121218a7604d9fbf47a | Python | 9,147 | 208 | """
Unit tests for body-part aware IVIM initial guesses (Feature #87).
Tests the lookup table in ivim_body_part_defaults.py and its integration
with OsipiBase.__init__().
"""
import os
import sys
import pytest
import numpy as np
# Ensure project root is on the path
root = os.path.abspath(os.path.join(os.path.dirname... |
2deabdd4aa8d77c882738b815fcd6c402d4c80c12121a0a63c89a146ce2ac5d0 | Python | 9,148 | 243 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
"""Prepare and validate the complete documentation tree with Zensical."""
from __future__ import annotations
import os
import shutil
import subprocess
import tempfile
from pathlib import Path
import yaml
from build_reference import build_reference_d... |
71a07850316bb5595f90c82c1693fe0f05ff69a74d8c2c63aa124bd407b26f89 | Python | 9,150 | 230 | from typing import Optional
import numpy as np
import pandas as pd
from anndata import AnnData
from ._cell_shape_modeling import SEM
from scipy.sparse import csr_matrix
def contact_communication(
df_ligrec: pd.DataFrame,
adata: AnnData,
sem: Optional[SEM] = None,
contact_key: Optional[... |
e51d12768a8b9da2a2d593bbe5a10e40b7efd3f2082af8ba141cffa791022f93 | Python | 9,150 | 167 | from pathlib import Path
from packaging.version import Version
from lyroi.utils import (check_model, install_model, setup_lyroi, check_version_local, check_version_online,
yes_no_input, get_download_size, format_file_size, clean_temp_dir)
from lyroi.modes import get_mode_list, get_default_mode
... |
2875bbbbf6e5615a11d21912491ffce3760e96937a771c4b42757621c9f997e1 | Python | 9,153 | 277 | # Kai Sandbrink
# 2022-03-09
# Various utility functions
# %% LIBRARY IMPORTS
import matplotlib.pyplot as plt
import numpy as np
import base64
import yaml, os, copy, math
from datetime import datetime
# %% GENERAL FUNCTIONS
def sigmoid(x):
return 1 / (1 + math.exp(-x))
def combine_tuples(tuples):
'''
... |
7262094fad84ea5e82e0ec2a77628965d8b8288cafc7f54835e9f9701dbcedb8 | Python | 9,155 | 269 | """Physiological to physical parameter transformations."""
import numpy as np
import torch
from dotenv import load_dotenv
from mcmlnet.constants import (
NM_TO_M,
RAYLEIGH_EXPONENT,
REFERENCE_WAVELENGTH_NM,
)
from mcmlnet.utils.haemoglobin_extinctions import (
get_haemoglobin_extinction_coefficients,
... |
98f3e0f8bf9e2a4604d715a442513ba882f6ea69292de78af235c222749d74dd | Python | 9,156 | 202 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
from pathlib import Path
from typing import Any
import torch
from torch.nn import functional as F
from ultralytics.data import YOLOConcatDataset, build_dataloader, build_yolo_dataset
from ultralytics.data.augment ... |
d28dfcd166f73ad948a7c33a241317747ae565dfbcd1ba4ca5aef54d50da29dd | Python | 9,156 | 225 | # -*- coding: utf-8 -*-
#
# train_pytorch.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.apa... |
91342d2019e3958202b729d08d7c80e146a4a8615c3206acc23d81aeee46576f | Python | 9,157 | 232 | import pytorch_lightning as pl
from pytorch_lightning.callbacks import ModelCheckpoint
from torchmetrics import Accuracy, Specificity
from tools.cfg import py2cfg
import os
import torch
from torch import nn
import cv2
import numpy as np
import argparse
from pathlib import Path
from tools.metric import Evaluator
from py... |
7eeeeb678cb77f3d1ddd961f651899c74a3e3f16f82effa61561fe137d889f09 | Python | 9,158 | 215 | import os, re
import pandas as pd
import random
import numpy as np
import nrrd
import pickle
def combine_rows_and_calculate_average(result_dataframes):
combined_dataframes = {}
for prefix, df in result_dataframes.items():
combined_dataframes[prefix] = df.groupby(level=0).mean()
return co... |
7b46a44a94f7eda2c4794759530a098928bab6fbb3344d9760b638e6043db66a | Python | 9,159 | 232 | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import torch
from torch import nn
from torch.nn import functional as F
from typing import List, Tuple, Type
from .common... |
f35d604c39e650cb3aef690655539a44baa316b7c7e8c2e78e7e15c7f0b53d96 | Python | 9,159 | 265 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_geometric.data import Data
import time
import torch.nn as nn
from lib_3d_OT.ottools.utils import log_string
from lib_3d_OT.ottools import ot, reconstruction as R
from lib_3d_OT.ottools.losses import compute_loss_unsupervised,chamfer_loss
from... |
47905f38212898adb879e57d1ebd209e7d706506ce8a1867ec77dc54f1890ee2 | Python | 9,162 | 299 | import numpy as np
import pandas as pd
from typing import Dict, List, Tuple, Optional
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
from config.physics_constants import (
F, R, T_STD,
PEMFCParams,
NoiseParams,
celsius_to_kelvin,
nernst_potential... |
e78d5e47db2c063a25dae9a7c46015a82c3b958ec8c5c1962084678382de8a06 | Python | 9,164 | 224 | import numpy as np
import pandas as pd
import scanpy as sc
import anndata
from anndata import AnnData
from typing import List
from typing import Dict
from sklearn.ensemble import RandomForestClassifier
from scipy.sparse import csr_matrix
import warnings
from .utils import *
from .tsp_rf import *
def rando... |
ec582de87bb04251d5f7515c6bc5c49f2d96724bf7e207841eede0a93c02144e | Python | 9,164 | 203 | """
Supplementary Figure S2: 3D surface plots of orientation-dependent qMRI
3D plots of R1, R2, and AI values against fiber-to-field angle theta and FA values for the
3T large cohort (left column) and 9.4T small cohort (right column) datasets.
Author: florian.birk@tuebingen.mpg.de
"""
import matplotlib.pyplot as plt... |
c719f2b93e9ef7a6b4ae23e176ec46c70105651535f1a05f9d5a57cd49ba7c23 | Python | 9,165 | 145 | """
September 2020 by Oliver Gurney-Champion
oliver.gurney.champion@gmail.com / o.j.gurney-champion@amsterdamumc.nl
https://www.github.com/ochampion
Code is uploaded as part of our publication in MRM (Kaandorp et al. Improved unsupervised physics-informed deep learning for intravoxel-incoherent motion modeling and eva... |
8cee6db0dedcd3e0d0c5fc69467369743cbb909210893ced44eb88aa5768e829 | Python | 9,166 | 248 | import logging
import os.path
import tracemalloc
import warnings
import fastremap
import numpy as np
import skimage.io as io
import torch
import torch._dynamo
import torch.nn as nn
import zarr
from torch import Tensor
from torch.cuda.amp import autocast
from tqdm import tqdm
from yacs.config import CfgNode
import sko... |
12c7abafe1d5f9ac575fe83b52a32cfa32a192fb743673fa81d65b9ae64212f0 | Python | 9,167 | 207 | from collections import OrderedDict
from copy import deepcopy
from typing import Union, Tuple, List
import numpy as np
import pandas as pd
import sklearn
import torch
from batchgenerators.augmentations.utils import resize_segmentation
from scipy.ndimage import map_coordinates
from skimage.transform import resize
from ... |
6d1635c19a001c66094ee3dfb134df4a2f65edf7509677c47bc51ca1c0fb1c2f | Python | 9,167 | 205 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# *************************************************************************** #
# Copyright © 2022, UChicago Argonne, LLC #
# All Rights Reserved #
# Softwar... |
905afa076601c3d8053f266e51a0eb622898b1d5a517d6f29157c79f22c4c696 | Python | 9,169 | 202 | import argparse
from os.path import join
import pickle
import tensorflow as tf
import keras
from keras.optimizers import Adam
from keras.callbacks import EarlyStopping, ReduceLROnPlateau
import utils
from model_zoo import DeepSTARR_heteroscedastic
import plotting
import pandas as pd
import wandb
from wandb.keras impor... |
c4294c799c943f1f1801306f567ce28346c324d05af19ab3729995594c1e7d68 | Python | 9,169 | 233 | """ Tensorflow Preprocessing Adapter
Allows use of Tensorflow preprocessing pipeline in PyTorch Transform
Copyright of original Tensorflow code below.
Hacked together by / Copyright 2020 Ross Wightman
"""
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.... |
129734007b263cc5f6ea12edb446656a61e5419e8759262df450c1ed87150049 | Python | 9,170 | 231 | import pytorch_lightning as pl
from pytorch_lightning.callbacks import ModelCheckpoint
from torchmetrics import Accuracy, Specificity
from tools.cfg import py2cfg
import os
import torch
from torch import nn
import cv2
import numpy as np
import argparse
from pathlib import Path
from tools.metric import Evaluator
from py... |
8b68dd39f781d449bb55b9e1ea1990380c7d41ba02b5c25f65b6a6060be63889 | Python | 9,170 | 277 | import math
from typing import Optional
import torch
import torch.nn.functional as F
__all__ = [
"focal_loss_with_logits",
"softmax_focal_loss_with_logits",
"soft_jaccard_score",
"soft_dice_score",
"wing_loss",
]
def focal_loss_with_logits(
output: torch.Tensor,
target: torch.Tensor,
... |
857a81070e2b242881e43107a1d71d8379f529bba00886e6da8954575222f56e | Python | 9,171 | 241 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import base64
from http import HTTPStatus
import pytest
from shared.utils.config import BASE_URL, make_api_client
from shared.utils.helpers import generate_image_file
@pytest.mark.usefixtures("restore_db_per_function")
@pytest.mark.usefixtures("r... |
45ead8973cc0e3b256e08fb52e28bd72d6cc811e6e5ab916b662d32c8044b1ff | Python | 9,173 | 226 | from pathlib import Path
import json
import numpy as np
import pandas as pd
from aicsimageio import AICSImage
from aicsimageio.writers import OmeTiffWriter
from aicssegmentation.core.pre_processing_utils import intensity_normalization, image_smoothing_gaussian_slice_by_slice
from aicssegmentation.core.seg_dot import d... |
caaf94dc7773dbd7fc8ea0f1f0ea246654e4131164f9ef2f48c56d338ddbbbd2 | Python | 9,174 | 235 | """Eye-blink dynamics from the released 68-point facial landmarks (FL.csv).
No video decoding is involved: UL-DD ships dlib 68-point landmarks at 60 fps for
every participant, including those who withheld consent for video release, so the
blink branch has strictly wider coverage than a video-based pipeline would.
"""
... |
0b1629a96ccd953b0e505ad63f4d7789c35605833e88e2da955d28faa812c433 | Python | 9,175 | 309 |
import os
import subprocess
import time
import sys
import pandas as pd
import shutil
import psutil
import re
"""
Example commands:
conda activate tf-py38
cd /home/aleksandr/Desktop/WORK/OLINK_suicide_PSY_project/Data_preprocessing_analysis
/home/aleksandr/miniconda3/envs/tf-py38/bin/python PrepareCountsSTARControl.p... |
1156f6d4d785b46ef96a2936b7f6614a657af259993e95a9ce49993f8f5b7a43 | Python | 9,178 | 209 | import argparse
from os.path import join
import pickle
import keras
from keras.optimizers import Adam
from keras.callbacks import EarlyStopping, ReduceLROnPlateau
import utils
from model_zoo import MPRAnn_heteroscedastic
import plotting
import pandas as pd
import wandb
from wandb.integration.keras import WandbMetricsLo... |
93694cfb21bbdcfe2f8f31e621bb3356e624967f90b2b837558b0e200cc6276f | Python | 9,180 | 182 | import os
import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
import torch.utils.data as Data
import random
import numpy as np
import pandas as pd
from collections import defaultdict
import warnings
warnings.filterwarnings('ignore')
from model.utils import *
from model.lr_scheduler import *
import ... |
d39acb99c075412e9f49fae43e9158ab2df62e59a4abe25d395422a2c9b0601c | Python | 9,181 | 206 | from torch_geometric.data import InMemoryDataset
import pandas as pd
import shutil, os
import os.path as osp
import torch
import numpy as np
from ogb.utils.url import decide_download, download_url, extract_zip
from ogb.io.read_graph_pyg import read_graph_pyg, read_heterograph_pyg
from ogb.io.read_graph_raw import read_... |
76292aaef144682565ce8af9606f99d9a67a74fd181e40e00ebe69393656b468 | Python | 9,182 | 301 | from __future__ import print_function, division
import functools
import os
import random
import csv
import json
import warnings
import numpy as np
import torch
from pymatgen.core.structure import Structure, Molecule
from torch.utils.data import Dataset, DataLoader
from torch.utils.data.dataloader import default_collat... |
a24e080cf929baeff744ac4af37104a3bcdf2cf9ea26aff1ec2c0399ea407f71 | Python | 9,182 | 229 | """ A dataset reader that reads tarfile based datasets
This reader can extract image samples from:
* a single tar of image files
* a folder of multiple tarfiles containing imagefiles
* a tar of tars containing image files
Labels are based on the combined folder and/or tar name structure.
Hacked together by / Copyrig... |
fdba5d6f9004a737dd5244589bad941094d1d9250886f46c6916fe7617cf7d53 | Python | 9,182 | 235 | #%%
#from MixerUnet import ConvMixer_UNET_down, reparameterize_model
from ptflops import get_model_complexity_info
#from Unet import UNet
#from UNetplusplus import ResNet34UnetPlus
#from AttentionUNeT import AttentionUNet
#from ResUNetplusplus import build_resunetplusplus
#from DoubleUNet import DUNet
#from tra... |
2d6a0a602e03c4e938558a1ac7291d8265d1e67d5aa50259945c8db26502fbd9 | Python | 9,183 | 296 | import os
import re
from typing import List, Dict, Tuple, Optional
import tiktoken
from pathlib import Path
try:
import fitz
HAS_PYMUPDF = True
except ImportError:
HAS_PYMUPDF = False
try:
import pdfplumber
HAS_PDFPLUMBER = True
except ImportError:
HAS_PDFPLUMBER = False
class DocumentPro... |
ac86fa0c26fa386f906f8cb25c8e93e579bec939c84bf99598a038504f944b6d | Python | 9,191 | 277 | # coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... |
332e074e0c5f3a5a3388a1b631d5cbf7e4b109a6f540eeb6cf1c9a09674e9b84 | Python | 9,194 | 259 | # -*- coding: utf-8 -*-
"""
Description goes here.
"""
import os
from collections import namedtuple
import numpy as np
import requests
from tqdm import tqdm
def get_example_data_home(data_home=None):
"""Return the path of the nelpy example-data directory.
This is used by the ``load_example_dataset`` functio... |
54463a004aad9436d5d72894ea1d53bdd6206e1e8ed2edf2b59d774a5ac73ba7 | Python | 9,194 | 266 | # coding: utf-8
import ctypes
from pathlib import Path
from platform import system
import numpy as np
from scipy import sparse
try:
from lightgbm.basic import _LIB as LIB
except ModuleNotFoundError:
print("Could not import lightgbm Python-package, looking for lib_lightgbm at the repo root")
if system() in... |
bf988e8a86744552bcf9e39eec6a0be66cf8c98b78d05868b77c5a02ad87ebd1 | Python | 9,198 | 282 | # laminar_rs/embedding.py
from __future__ import annotations
from typing import Tuple, Dict
import numpy as np
import scipy.sparse.linalg
import scipy.linalg
import matplotlib.pyplot as plt
def run_laplacian_embedding(M: np.ndarray,
out_dir,
name: str,
... |
26750faa269164c33b9fed647cb8827c535bbad9ae020b24fbf0937ff78ae512 | Python | 9,203 | 228 | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import torch
from torch import nn
from typing import Any, Optional, Tuple, Type
from .common import L... |
c3ad73eac7df36e6eb35bb09c2fc9105c3bd4c30cbfdc2bf5356bd4e22ac580d | Python | 9,205 | 314 | #!/usr/bin/env python
import json
import os
import argparse
import sys
import subprocess
USAGE = """
USAGE:: %s <even_stacks> <odd_stacks> <options>
NOTE: If more than one stack, they should be separated by spaces and surrounded by quotes.
For more info about options, enter: %s --help
""" % ( (os.path.base... |
38b88e1b5b2f39d2e718b647c5bb6f23206b6e64a10c388311413202d6eee7d8 | Python | 9,207 | 277 | import os
import logging
import hail as hl
from heig.wgs.utils import *
"""
Headers are required in annotation files
The first column must be variant string
Each variant is in `chr:pos:ref:alt` format
TODO: test general annotations
"""
class Annotation:
"""
Processing and saving functional annotations
... |
ed6dd5e371000e074614cfcd3362e69df703ee57a0650f934527ace4afc5c350 | Python | 9,208 | 224 | #!/usr/bin/env python
"""
These wrap a CameraFrameDisplay and possibly a ParamsDisplay in
a single object that Display interacts with.
Hazen 4/17.
"""
from PyQt5 import QtCore, QtWidgets
import storm_control.hal4000.display.cameraFrameViewer as cameraFrameViewer
import storm_control.hal4000.display.paramsViewer as p... |
03fc3870cee5ac8a6993053e53d0098637e05543ccbbeabb38564f366b3eb52e | Python | 9,212 | 167 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.patches import Circle
import os
def nm2ev(energy):
return 1239.81 / energy
def ev2nm(wavelength):
return 1239.81 / wavelength
def gaussian_broadening(x, y, sigma):
"""
Add gaussian broadening for a spectrum defin... |
b4c0adce30681711b18a5efc848c04284cec47223829a4ef6ac819adc272cbb2 | Python | 9,214 | 281 | from deepxde.backend import set_default_backend
import os
from tensorflow import keras
set_default_backend("tensorflow")
import deepxde
import numpy as np
import pandas as pd
import tensorflow as tf
import tensorflow_probability as tfp
import csv
import matplotlib.pyplot as plt
import DPINNs_utils
from DPINNs_utils im... |
dc40bdb1c18e70d465fdfa7b27e376061b6d2149cba700aa250d498946e32a17 | Python | 9,216 | 219 | import numpy as np
import pandas as pd
from scipy import stats
from .ism import SeqMatrix, MutGenerator
from . import plot_utils
from . import data_utils
class GeneSampler(SeqMatrix):
'''Slices genes (or other specified sequences) by coordinates in genome'''
def __init__(self, data, gene_table, ta... |
17bc495352d73b3bcce166400553abc4b09732a4091afe41f81eef2d3f7baa40 | Python | 9,218 | 242 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 24 09:27:26 2023
@author: ayumu
"""
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
from scipy.stats import ttest_ind
import statsmodels.stats.multitest as smt
import scipy.stats as stats
from tqdm import tqdm
from joblib imp... |
d58f3aea8ff4b329ca6075a7832a7744775349b6a6d29da009a36f67d8b19d0c | Python | 9,218 | 247 | import numpy as np
from matplotlib.axes import Axes
from scipy import stats
from scipy.ndimage import gaussian_filter1d
from tqdm import tqdm
from argclz import AbstractParser, argument
from neuralib.plot import plot_figure, grid_subplots
from neuralib.typing import AxesArray
from neuralib.util.verbose import publish_... |
d5fdee2bdfa4a997dc7c737773c8cf9a5694bb7a575b3e0940600526633f3c0b | Python | 9,220 | 312 | import os
import json
import numpy as np
from typing import List, Tuple
from tqdm import tqdm
import cloudvolume
from cloudvolume import CloudVolume
from joblib import Parallel, delayed
import igneous.task_creation as tc
from taskqueue import LocalTaskQueue
# NOTE: all this expects volumes to either be [Z, Y, X] or [... |
c40c7793b7730d958ccc9236496c6430d67e1e8ab872e134c4123ca2a1966cf7 | Python | 9,221 | 213 | # -*- coding: utf-8 -*-
# python standard library inputs
import os
import shutil as sh
# external inputs
import numpy as np
import nibabel as nb
from scipy.ndimage import binary_fill_holes, gaussian_filter
from scipy.ndimage.morphology import binary_dilation
from nighres.registration import embedded_antsreg, apply_co... |
9a0d727918d28cafa2312418c58c684fe285e867cadac112d9719c92bd0597a6 | Python | 9,222 | 214 | import mne
import os
import glob
import numpy as np
import pandas as pd
from scipy.io import savemat, loadmat
import matplotlib.pyplot as plt
import pickle
from mne.preprocessing import ICA, corrmap, create_ecg_epochs, create_eog_epochs
#from mne_icalabel import label_components
import sys
sys.path.append('../utils')... |
f9bbeb9004fc9721504e5a0f957e6666d828e3e57ff8125c20b3441a68c775ef | Python | 9,222 | 286 | """
Plotting motion traces for visual inspection.
"""
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import glob
import os
import numpy as np
subs = ['sub-05', 'sub-06', 'sub-07', 'sub-09', 'sub-10', 'sub-12', 'sub-14', 'sub-15', 'sub-16', 'sub-17', 'sub-18']
# subs = ['sub-15']
ROOT = '... |
ff537e257bc5e79f2deebf7ec07c7b5dd9ae5f892bfc6da853f0dd2e48f93050 | Python | 9,223 | 188 | #!/usr/bin/env python
"""
UC480 Camera QPD functionality.
Hazen 04/17
"""
from PyQt5 import QtCore
import storm_control.hal4000.halLib.halMessage as halMessage
import storm_control.sc_hardware.baseClasses.hardwareModule as hardwareModule
import storm_control.sc_hardware.baseClasses.lockModule as lockModule
import s... |
30e8de0d61bde53b1bf48bfd94ee6bae01750a030cc6795be9cb39f4db6fdbd0 | Python | 9,225 | 218 | """ FreewaterRunner interfaces with FreeWaterGradientClass and makes heavy use of DIPY """
import numpy as np
import dipy.reconst.dti as dti
from dipy.reconst.vec_val_sum import vec_val_vect
from freewater import FreeWaterGradientDescent, create_feature_spatial_manifold
from freewater import convert_manifold_to_lower_... |
d7a1473cd7292cbc1ae58d8b4c0774a2f9fa7b1fc4bffa92499204df2528a8a3 | Python | 9,227 | 296 | from typing import TYPE_CHECKING, Any
from eir.models.input.array.array_models import (
ArrayModelConfig,
get_array_config_dataclass_mapping,
)
from eir.models.input.image.image_models import ImageModelConfig
from eir.models.input.omics.omics_models import (
OmicsModelConfig,
get_omics_config_dataclass... |
0611d9514fb5949cdbaead90b96c8f2ff1a801b99e20a28ccd4b040b98f089f5 | Python | 9,229 | 210 | '''Tests for composites using torchvision models.'''
from types import MethodType
from itertools import product
from zennit.core import BasicHook, collect_leaves
def ishookcopy(hook, hook_template):
'''Check if ``hook`` is a copy of ``hook_template`` (due to copying-mechanics of BasicHook).'''
if isinstance(... |
b7ff5f0184da8978a4870c294aa523051dd257c4cb95a78a7b70790a4699131a | Python | 9,232 | 265 | import json
import random
from collections.abc import Callable, Sequence
from dataclasses import dataclass, field
from pathlib import Path
from typing import Any, Literal
import numpy as np
import pandas as pd
import pytest
from _pytest.fixtures import SubRequest
from tests.setup_tests.setup_modelling_test_data.setup... |
3ac6ec533652be95e97789d6129daa31461fe754c55a08d5bd2bdc8bb27fab06 | Python | 9,233 | 223 | """Tests for ChemGraph package metadata."""
import re
import io
import runpy
import tarfile
import zipfile
from pathlib import Path
from typing import Any
import chemgraph
import pytest
from packaging.requirements import Requirement
from packaging.utils import canonicalize_name
_REPO_ROOT = Path(__file__).resolve().... |
5d05c68b7ebbb387eb81d0f51fc1cec855e7a5a5e0b6fa2ecf2eec77c3bccd38 | Python | 9,235 | 171 | # -*- coding: utf-8 -*-
"""
Created on Mon Dec 2 21:46:44 2019
@author: Yoshi
"""
import os
program_path = os.getcwd()
os.chdir(f"{program_path}/motion_corrector")
from motion_corrector import *
os.chdir(f"{program_path}/data_extractor_subtraction")
from data_extractor_subtraction import *
os.chdir(f"{program_pa... |
4daf329467f0989356c0f4dcfaf75b4610167e1ef32206a447274aa3cf8618e4 | Python | 9,238 | 263 | from __future__ import annotations
from dataclasses import dataclass
from typing import Final
import numpy as np
import PIL.Image
import PIL.ImageDraw
from numpy.typing import NDArray
from .._shape import Shape
from ._geometry import _round_bbox_to_int
from ._geometry import shape_to_xyxy_bbox
from ._shape_builders ... |
671180215196a46450c6e8cc3eca1eda5caad696713e30306482e49f4daead1f | Python | 9,242 | 157 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'mainwindow.ui'
#
# Created by: PyQt5 UI code generator 5.7
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWind... |
2a9490a2400660a802b7ac2a85c42c8a7b1a326d2e9d8415d59ae53bff881200 | Python | 9,244 | 160 |
import argparse
import os
import pathlib
import time
import datetime
import h5py
import numpy as np
from enum import Enum
from helper_functions.multiprocessing_chunks_complete import all_chunks_complete
from helper_functions.load_cell_distributions import compute_distribution
from helper_functions import __file__
MODU... |
53a9a0d9e28d3ecd478b371d3dd39f779e4e8fec6f28dc7664414f6b48051fed | Python | 9,245 | 280 | from typing import Any, Callable, List, Optional, Tuple, Union
import matplotlib.colors as co # type: ignore
import matplotlib.pyplot as plt # type: ignore
import numpy as np
import pandas as pd # type: ignore
from anndata import AnnData # type: ignore
from matplotlib.axes import Axes # type: ignore
from matplotl... |
f44596a952ab298e180fb32a1ab0152074b8be684649352fd08dba8313716fda | Python | 9,245 | 306 | import json
import random
import torch
import numpy as np
import pandas as pd
from jarvis.core.graphs import Graph
from jarvis.core.atoms import Atoms
from pymatgen.io.jarvis import JarvisAtomsAdaptor
from pymatgen.core import Structure
#from alignn.models.alignn import ALIGNN
from alignn_multi import ALIGNN_ft
#f... |
5cf2caef3097eef6a4a79543cf678725e5a485847865eea5116c01463d34b41d | Python | 9,246 | 196 | '''
MCH
'''
import numpy as np
import sys
def intro():
print("""
SHORT List of potential energy surfaces for MCH:
P: potential energy, G: Gradient, D: Nonadiabatic coupling vector
U: diabatic potential energy matrix
UG: gradient of diabatic potential energy matrix
This is listed at the end o... |
a1d68ead93d670f4da65fb4f3bc3c3e4dc57de640e234404686334293f9bfbd4 | Python | 9,246 | 265 | """
Schema extraction utilities for EBM model validation.
This module provides functionality to extract and persist the schema
of a trained EBM model, including feature names, types, and statistics.
"""
import json
import pickle
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, List... |
b72dc1c227cb770942e6ecc2053a2ab903ae1375c53f43f60565588657ce2a53 | Python | 9,246 | 280 | """
This module contains a function that performs total least squares regression.
"""
import numpy as np
import pandas as pd
from scipy.odr import Model, RealData, ODR
import matplotlib.pyplot as plt
from scipy import stats
def tls_regression(x, y):
# Define the model function for the regression line (linear in ... |
6aa6915ffb7658d786afee52ccf94e07c366e0182a1b8424dc8326076859ddb0 | Python | 9,249 | 212 | """
DyNeMo: Mixing Coefficients
===========================
In this tutorial we analyse DyNeMo mixing coefficients. This tutorial covers:
1. Summarizing the mixing coefficient time course
2. Binarizing the mixing coefficient time course
"""
#%%
# Download inferred parameters
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
import os... |
9f66c45cb4f7b84c88b5101386aae67fe0cd51f1e93be86c9c7b59c4b430f26e | Python | 9,249 | 296 | from typing import TYPE_CHECKING, Any
from eir.models.input.array.array_models import (
ArrayModelConfig,
get_array_config_dataclass_mapping,
)
from eir.models.input.image.image_models import ImageModelConfig
from eir.models.input.omics.omics_models import (
OmicsModelConfig,
get_omics_config_dataclass... |
40704006df66c43086442ff4c515433d9b58108eb6c301e3e03c1248772ee532 | Python | 9,253 | 211 | from my_dataset.my_dataset import CustomDataset
import argparse
import matplotlib.pyplot as plt
import time
import os
import torch
import torch.nn as nn
from fvcore.nn import parameter_count_table
from torch.utils.data import DataLoader
from prefetch_generator import BackgroundGenerator
import pandas as pd
from my_... |
63cd5c2cb418594c8029e84965f10baf0da1e212f145355fcd559c304c829742 | Python | 9,253 | 266 | import concurrent.futures
import numpy as np
import pandas as pd
import heig.input.dataset as ds
from heig.image import ImageManager
from heig.utils import inv
def projection_ldr(ldr, covar):
"""
Computing S'(I - M)S/n = S'S - S'X(X'X)^{-1}X'S/n,
where I is the identity matrix,
M = X(X'X)^{-1}X' is th... |
855e86f323e28ebab3fec4bbf12f7f24244cf0e305f160e4275b669353e5d858 | Python | 9,253 | 317 | #!/usr/bin/env python3
from traceback import print_exception
import arbor as A
from arbor import units as U
import numpy as np
import polars as pl
from mpi4py import MPI
from cell import make_point_cell, single_cell_recipe
from argparse import ArgumentParser
from pathlib import Path
from reduced_wong_wang import TvbSi... |
f99ef94a6c637e263da0fc8448215cc740f7f1d276114e07996beb742006e480 | Python | 9,254 | 210 | import numpy as np
from .components import BlochMZI, SMMZI
from .config import NP_FLOAT
from typing import Callable, Tuple
from .numpy import MeshNumpyLayer, RMNumpy
from .meshmodel import MeshModel
from .helpers import inverse_permutation
def clements_decomposition(u: np.ndarray, pbar_handle: Callable = None, smmzi:... |
a524bee08ac46307ca5d1e7e125fb9ef1ef1d56621b7e3d2aa608985a5cc64b6 | Python | 9,256 | 308 | import copy
from collections.abc import Sequence
import pytest
from eir.models.model_setup_modules.input_model_setup.input_model_setup_sequence import ( # noqa
_get_hf_sequence_feature_extractor_objects,
_get_manual_out_features_for_external_feature_extractor,
)
from eir.setup.setup_utils import get_all_hf_m... |
1a7a5b8b8608f5893418f35e430e5d7df3a3edd484de447817a15dee18a80572 | Python | 9,258 | 200 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 4 11:42:07 2025
By Guido Meijer
"""
import numpy as np
import pandas as pd
import json
from pathlib import Path
from spikeinterface import load_sorting_analyzer
from spikeinterface.widgets import plot_sorting_summary
def manual_curation(results_p... |
319f3c7bc9d9a2eb4fc7b307b85d2db5092f789dc5d1f9549aaa03b3065b4092 | Python | 9,261 | 206 | import logging
import os
import time
import numpy as np
# 获得当前 时间戳
now = time.strftime('%Y-%m-%d_%H-%M-%S', time.localtime(time.time()))
#log save path check if the path exists
log_path = 'log/' +'molecule_log/'
if not os.path.exists(log_path):
os.makedirs(log_path)
# 配置日志记录
logging.basicConfig(fil... |
b3edd25c4f8f8eff4b8f9689da791f975efe30c5421fcda8bc8493303090d94b | Python | 9,262 | 253 | import h5py
import sys
import yaml
import os
import numpy as np
import matplotlib as mpl
from sklearn.metrics.pairwise import cosine_similarity
import git
import scipy.cluster.hierarchy as hac
from scipy.spatial.distance import pdist
import pandas as pd
pathpath,myrun,ncluststr,cmethod,roi_tag = sys.argv[1:]
'''
#pa... |
fe86875fced4729bf90ac1a26e8f3a7c718d183537a61b73966bd7bb35b8fe41 | Python | 9,262 | 243 | # Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
from typing import Any, Optional, Tuple, Type
import numpy as np
import torch
from torch import nn
from .common import LayerNorm2d
class PromptEncoder(nn.Module):
def __init__(
self,
embed_dim: int,
image_embedding... |
801589f5e3010a0596ea302d8d7c5a488c28be267bff71ca0ccb49599143c9d2 | Python | 9,264 | 215 | import os
import h5py
import numpy as np
import matplotlib.pyplot as plt
import csv
from datetime import datetime
def find_files_by_type(main_path, file_type='.h5', start_date=None, end_date=None, sort_dates=None):
type_files = []
if start_date is not None and end_date is not None:
# Get a list of a... |
d6d9e5bc751afb2a0c6bbbc46938b6222ce693fc674442010389275957ecae89 | Python | 9,265 | 360 | # -*- coding: utf-8 -*-
"""
Simple Interface to read RAW/MHD files e.g. created by elastix
Todo: read subsets efficiently
Example:
>>> import os, numpy
>>> from ClearMap.Settings import ClearMapPath
>>> import ClearMap.IO.RAW as raw
>>> filename = os.path.join(ClearMapPath, 'Test/Data/Raw/test.mhd') ... |
6add853f4fa1d3be4cded53f7edeb818a4db7916187257b01acb294951640f25 | Python | 9,269 | 319 | #!/usr/bin/python
"""
Returns a bed-like translation of a CDS in which each record corresponds to
a single site in the CDS and includes additional fields for site degenaracy,
position ind CDS, and amino acid encoded.
usage: %prog nibdir genefile [options]
-o, --outfile=o: output file
-f, --format=f: ... |
cb950a8518561e203aadd3d6c47320e06d18f3f651e9706b3acb4f64862dff28 | Python | 9,270 | 220 | import numpy as np
import pdb
from numba import njit
import matplotlib.pyplot as plt
##
#Estimate Motion Operator
@njit()
def MotionOperator(opt,TranslationVec,RotationVec, CardiacVec, Mask, VoxDims, RandMotion=False, HeartRate=50, offset=0):
##
#Initialise Matrices
V = np.zeros((*Mask.shape, opt['nTR'].as... |
7f34611319516e39cf43bbe6673a1d69262d586fdcc883caed0534e5eaa4213b | Python | 9,272 | 279 | # Kai Sandbrink
# 2022-07-26
# PyTorch implementation of meta-learning RNN a la Wang et al (2016)
# Helpful reference from papers with code: https://github.com/BKHMSI/Meta-RL-Harlow/tree/master/models
# %% LIBRARY IMPORT
import torch
from torch import nn
import torch.nn.functional as F
import torch.optim as optim
#... |
f05212939f47939988b9ac8b6c27fa811a63c7f7b1a4754e721d0e7b74d2dc8d | Python | 9,272 | 194 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
from pathlib import Path
from ultralytics.data import YOLOConcatDataset, build_grounding, build_yolo_dataset
from ultralytics.data.utils import check_det_dataset
from ultralytics.models.yolo.world import WorldTrain... |
66ca04890b22a02e9fe68509f7576e155dfb2377d430cf50ac4965318068f034 | Python | 9,273 | 277 | import logging
from abc import abstractmethod
from enum import Enum
from pathlib import Path
from typing import Tuple, Union
import numpy as np
from hyperopt import hp, fmin, tpe
import flair.nn
from flair.data import Corpus
from flair.embeddings import DocumentPoolEmbeddings, DocumentRNNEmbeddings
from flair.hyperpa... |
5f999edc3b582895c3a5c1915b9139052dedd47956a3569371a13693a3fb1f6b | Python | 9,277 | 212 | from typing import Union, Tuple, List
import numpy as np
import torch
from batchgeneratorsv2.helpers.scalar_type import RandomScalar
from batchgeneratorsv2.transforms.base.basic_transform import BasicTransform
from batchgeneratorsv2.transforms.intensity.brightness import MultiplicativeBrightnessTransform
from batchgen... |
7c3b9314364067b9abf15964941877c0795f0f26b020dbba0191bfb7a041f335 | Python | 9,277 | 276 | from .utils import *
import yaml
import json
import threading
try:
import boto3
except:
print('boto3 not installed, installing with pip ')
from subprocess import call
call('pip install boto3',shell = True)
import boto3
defaultconfig = {
'wfield-preprocess': dict(
submit = dict(
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.