sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
9a745ca10980b042fbd44292efbe28b8b3d984f4143b3edb5f6df2e6fc556fee
Python
14,293
380
# 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, ...
62c97acb7bffb9a153736735bea7c9af22c1f0f889c0d068a65256fa6406a579
Python
14,295
406
"""Provide regularization functions and classes for ddf.""" from typing import Callable, Tuple import tensorflow as tf from deepreg.registry import REGISTRY from deepreg.model import layer_util def gradient_dx(fx: tf.Tensor) -> tf.Tensor: """ Calculate gradients on x-axis of a 3D tensor using central finite...
ae7d3ed2adf423a8d43d479e00cde1efeea48d883e657cff67a7f42968be6406
Python
14,295
322
# This script take as input a gtf file, a sam file input folder, a sample ID file, and the number of cores, then run # the count exons and genes in parallel, and then output the report file and output file into the output file import itertools import collections import numpy as np import pandas as pd from multiproces...
9f02b2f11ce3f6f0d25dae85e70bb3f1bb48775c8c7ae7cea69a5072d33fbbc8
Python
14,310
401
import pdb import typing import bisect import functools import traceback from .config import ObservableCollection, ObservableDict, ObservableList from .qt import * def get_selected_rows(qlist: QListView) -> typing.List[int]: return sorted(set(i.row() for i in qlist.selectedIndexes()), reverse=True) class FlatObser...
e7e2a3c676bd1d26fcc5cd27ccbb63852dffc086911b7a1088e2633a57d1e82e
Python
14,315
352
import argparse import time import warnings import torch import os, time import sys import yaml import datetime import logging import random import numpy as np import pandas as pd import transformers import json import torch.nn as nn from torch.utils.data import DataLoader from numpy import nan from typing import * # f...
f677dad434230ee1e9222bf989abe90597d7fcdc185490fbaeae6f728865c102
Python
14,315
456
# -*- coding: utf-8 -*- # # test_domain_decompositions.py import unittest import arbor as arb from .. import cases # check Arbor's configuration of mpi and gpu mpi_enabled = arb.__config__["mpi"] gpu_enabled = arb.__config__["gpu"] """ all tests for distributed arb.domain_decomposition """ # Dummy recipe class ho...
f13c2e4a9e167574414f212cc41022299cc83f9a81124e0fa2db2be1d950c517
Python
14,316
282
# Generate output file name by request import pandas as pd #=============================================================================== # # Output files for each run # #=============================================================================== def outfn_sbcd_per_fc(main_dirs, df_run): outfn= { ...
31d6c15029d758d21147eb56a4de79e21c215eb306d810ca7264950aa849dcfc
Python
14,322
276
"""Execute skill examples and scripted agent actions without a live scheduler/LLM.""" import json import os from pathlib import Path import shlex import socket import subprocess import sys import pytest from deepagents.backends import LocalShellBackend from langchain_core.messages import AIMessage, HumanMessage from ...
fb38661d6d1e77daede0c2db75f5d2b08cc13841fa09ef130308455381dca332
Python
14,323
382
""" FCS file processing functions adapted from the original codebase. Handles FCS file reading, compensation, and transformation. """ import numpy as np import logging from pathlib import Path from typing import List, Optional, Dict, Any import flowkit as fk logger = logging.getLogger(__name__) def read_fcs_file( ...
4fd4d2966b46bc2eb39b2b12949f9c6923dfa7076b19cef9436c81b35b863469
Python
14,329
375
""" 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 torch from torch import nn from torch.nn import functional as F # %% class Unet(nn.Module): """ PyTorch implementation of a ...
ce6cfbb65a33784657a9639ed78b01283c3cc92d195a1184b1c604138dc5675e
Python
14,331
360
import time import numpy as np import argparse from copy import deepcopy from scipy import interpolate parser = argparse.ArgumentParser('Preprocessing: Generate training/validation/testing features from pdb') parser.add_argument('--MDfolder', type=str, default="data/pdb/", help='folder of pdb MD') ...
51756d14a094f859f684e80a3a7072a245a69ea5d19997a1d5a50e6c8786701a
Python
14,333
331
from __future__ import annotations import csv import datetime import os import pickle import re import pandas as pd from biom import Table, load_table import qiime2 as q2 from skbio import TreeNode from Bio import Phylo from .utilities import ReadsData, run_cmd, download_classifier_url, check_conda_qiime2 nodes_nam...
134841258093fcefe02d517c6e69c35d47111b44c47d6766144c2af54b2f5ad7
Python
14,335
329
#!/usr/bin/env python3 import numpy as np import pandas as pd import argparse import os from datetime import datetime import pyBigWig import multiprocessing as mp import qtl.annotation import qtl.norm import qtl.io def time_now(): """Return time""" return datetime.now().strftime("%c") #----------------------...
17bdcecd88b97ade35aee0a44e161506dc57d4d052154bd6a0420c0db97173f0
Python
14,336
223
from __future__ import annotations import argparse import json import os import shlex import shutil import signal import subprocess import threading import time import urllib.error import urllib.request from importlib.resources import files from pathlib import Path from chemgraph.academy.dashboard import serve_dashbo...
eecab386467ea78cec0cd032676f926c85ee3975fe349a9666fead81124b150d
Python
14,343
353
"""Does the correlation structure among tracked cells survive across days? The per-cell fingerprint asks whether *one* match is real, and answers weakly: AUC 0.68 against a co-located different cell, which is not enough to decide an individual match. This asks a different question of the same data -- whether the **set...
1694cb6e0c75298906002c87b178ac27f96b82f373b5ecbbd0985f5730f384f4
Python
14,345
354
""" @file QFAlignmentDialog.py @description Alignment and image-difference detection dialog for the QF module. - Reuses AISE's :class:`ImageAlignmentWidget` without the AISE-specific business logic (grouping, summation, Result Tab). - Shares the :class:`ProcessingWorkspace` owned by :class:`QuadrantFoldingGUI`: * ...
de7474eb6dd21e41f8cf8a3643bc9c023c97eb7293007592a2fadca3f3014c82
Python
14,345
324
""" EEGNet Multi-class Training Script - Load .npy preprocessed data - Sliding window data augmentation - 5-fold stratified cross-validation - Output per-fold and average accuracy, F1, etc. """ import copy import random import os import numpy as np import torch import torch.nn as nn import torch.optim as...
15b58996efdf52a1a1e29c7f5259b8c7d95dd375a618ec93bb35aefceda0a201
Python
14,351
295
import os import tempfile from unittest import mock, TestCase from unittest.mock import call import kb_python.compile as compile from tests.mixins import TestMixin class TestCompile(TestMixin, TestCase): def test_get_latest_github_release_tag(self): with mock.patch('kb_python.compile.requests') as reque...
9f5f948d6099710cd7e35e915376cbc1d9b70a247c9c95188fc88db5bb0f3940
Python
14,353
393
import os from PySide6.QtWidgets import ( QDialog, QVBoxLayout, QHBoxLayout, QTableWidget, QTableWidgetItem, QPushButton, QHeaderView, QAbstractItemView, QLabel, QProgressBar, QSizePolicy, QMenu, QRadioButton, QSpinBox, QWidget, QSplitter, QScrollArea,...
f12716985e06ba61499dd2efb3bcd36d6811ad7f0b4c64e3fc829bf675da791d
Python
14,355
277
# Copyright (c) 2026 Rohit Jena. All rights reserved. # # This file is part of FireANTs, distributed under the terms of # the FireANTs License version 1.0. A copy of the license can be found # in the LICENSE file at the root of this repository. # # IMPORTANT: This code is part of FireANTs and its use, reproduction, or...
1e30e7067990e56ed1cb22bff0ed19de7bd199087e34d69f124dd2c35f16f5ce
Python
14,357
503
import math import random import numpy as np from . import colorblind # pre-define interesting colours/points at corners, edges, faces and interior of # r,g,b cube WHITE = (1.0, 1.0, 1.0) BLACK = (0.0, 0.0, 0.0) RED = (1.0, 0.0, 0.0) GREEN = (0.0, 1.0, 0.0) BLUE = (0.0, 0.0, 1.0) CYAN = (0.0, 1.0, 1.0) YELLOW = (1.0...
ca4df06c92651f069d601fe217a42c9896635a18f2fa17bfd6af5c2a8322ea5c
Python
14,358
369
from typing import Literal import polars as pl import seaborn as sns from matplotlib.axes import Axes from scipy.stats import wilcoxon, mannwhitneyu from argclz import as_argument, argument from neuralib.plot import plot_figure from neuralib.util.verbose import publish_annotation from rscvp.statistic.core import Stat...
5d5b99cf5cf37944961a07bcfc8a20bc6ca4e06e00a8cf4a6e48d2e80e23eac1
Python
14,359
308
import os import pandas as pd import json import nibabel as nib import numpy as np import re from nipype import Node, Workflow, MapNode from nipype.interfaces.utility import IdentityInterface, Merge, Function from cvdproc.pipelines.dmri.nemo.nemo_postprocess_nipype import NemoCorticalMetrics, NemoChacovol, NemoChacoco...
9b1f1bf79d72996df8b8e6f92889746ed5de6880820df9d04d6044078fdecefb
Python
14,360
309
#!/usr/bin/env python # coding: utf-8 # # Data preparation for protein-protein interfaces # # ## Introduction # # <img style="margin-left: 1.5rem" align="right" src="images/data_generation_ppi.png" width="400"> # # This tutorial will demonstrate the use of DeepRank2 for generating protein-protein interface (PPI) g...
d725f234217a243a6c23c697a26c99029c1e3ca460190ffd9c73736cc02e7533
Python
14,360
309
#!/usr/bin/env python # coding: utf-8 # # Data preparation for protein-protein interfaces # # ## Introduction # # <img style="margin-left: 1.5rem" align="right" src="images/data_generation_ppi.png" width="400"> # # This tutorial will demonstrate the use of DeepRank2 for generating protein-protein interface (PPI) g...
3a6ebc6fbf6fa2ba404f52f7ee5773db497dbf7f4aa5681350ee18da8c463020
Python
14,362
309
#!/usr/bin/env python # coding: utf-8 # # Data preparation for protein-protein interfaces # # ## Introduction # # <img style="margin-left: 1.5rem" align="right" src="images/data_generation_ppi.png" width="400"> # # This tutorial will demonstrate the use of DeepRank2 for generating protein-protein interface (PPI) g...
f1fa8dd26466c11ffd46f4c340d69778f205258fd8b178fb0863da86a17cc33a
Python
14,362
309
#!/usr/bin/env python # coding: utf-8 # # Data preparation for protein-protein interfaces # # ## Introduction # # <img style="margin-left: 1.5rem" align="right" src="images/data_generation_ppi.png" width="400"> # # This tutorial will demonstrate the use of DeepRank2 for generating protein-protein interface (PPI) g...
f3a10421244a1e2c12f5276f64536a05cf03380bd16b85146fb8f2f08f8fb3c0
Python
14,362
309
#!/usr/bin/env python # coding: utf-8 # # Data preparation for protein-protein interfaces # # ## Introduction # # <img style="margin-left: 1.5rem" align="right" src="images/data_generation_ppi.png" width="400"> # # This tutorial will demonstrate the use of DeepRank2 for generating protein-protein interface (PPI) g...
6e498bdee87a1ebf9a83383848570dd730bdc432b77e3edf316f313737e88a56
Python
14,367
436
import pickle from collections.abc import Callable from copy import deepcopy from dataclasses import dataclass from pathlib import Path from typing import TYPE_CHECKING, Optional, Protocol, Union import numpy as np import pandas as pd from aislib.misc_utils import ensure_path_exists from eir.interpretation.interpreta...
25311c951cfb720c0896b0ba098b083ddc70ed64053695e8380ce11f7f116fdf
Python
14,368
365
"""Tests for keypoint fidelity: physical consistency and registration landmark error. - Helpers create 2D square / 3D cube images (grid + threshold) and return keypoints in pixel and torch space. - Physical-consistency tests assert as_physical_coordinates() match for pixel vs torch keypoints. - Registration tests run ...
a1a374f60490b76f3bbe97d5a7bd3ed9fb581dcbd9936bd708b45c9cf935db2b
Python
14,368
378
#!/usr/bin/env python """ Base class / functionality for controlling a motorized stage. 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_library.parameters as pa...
b65c2cb8785594f84e72cc5c41301bd0d0453e36369c17bb8a34c10833278c48
Python
14,369
570
#!/usr/bin/python3 # import os import sys import argparse import shutil import numpy as np from sklearn.neighbors import NearestNeighbors from uac.element import Element from uac import utils # Create the parser my_parser = argparse.ArgumentParser(description="UAC fibre mapping") # Add the arguments my_parser.add_ar...
096bf594eff50279a5f2407ad3e586e26fc02b5aefa8fd63c11395ead1d68afa
Python
14,383
277
from typing import Callable, Dict, List, Optional, Tuple, Union from torch_geometric.data import Data, FeatureStore, GraphStore, HeteroData from torch_geometric.loader.link_loader import LinkLoader from torch_geometric.sampler import NegativeSampling, NeighborSampler from torch_geometric.sampler.base import SubgraphTy...
829713d7f1950623dbdb8b1d3453c627599853391729b158344a2f927469a852
Python
14,384
371
import numpy as np import datajoint as dj from getpass import getpass class DJServer: """ DataJoint connection class which stores a connection to the specified database and automatically adds expected schemas as attributes. Args: host (str) : String containing the URL of the databas...
a650d87fc5dfd7be01d1f395c72380aa2ce0731d5ed39063d2dfe8cce4a25ccc
Python
14,387
376
from pathlib import Path import numpy as np import nibabel as nib from dipy.core.gradients import gradient_table from dipy.core.sphere import disperse_charges, HemiSphere from dipy.io import read_bvals_bvecs from dipy.reconst.dti import (TensorModel, fractional_anisotropy, mean_diffusivity...
777327ce65b58e013ae37806dd2e05751fe772498d517b4f4bcdd7b556dd94c2
Python
14,391
426
# 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 os from typing import Sequence, Tuple, List, Union import pickle import re import shutil import torch from pathlib import Path import B...
5f9dc4848cf30c8b5b381a8d96271a7bf69977f1bedefbe9cc54ffbf5cb987ca
Python
14,392
393
import glob import math import os.path import tensorflow as tf #Functions in this file is mostly based on https://towardsdatascience.com/a-practical-guide-to-tfrecords-584536bc786c # and tensorflow docs def _bytes_feature(value): """Returns a bytes_list from a string / byte.""" if isinstance(value, type(tf.c...
7afd31353f6bc2b3530cc5b05308bba1a6872ccea7954b7922d257434b7f31e7
Python
14,398
469
# coding=utf-8 import glob import logging import os import re import struct from dipy.io.utils import is_header_compatible import nibabel as nib import numpy as np from scilpy.gradients.bvec_bval_tools import str_to_axis_index def load_fdf(file_path): """ Load a Varian FDF file. Parameters -------...
d028a0ad5901daef1c0d8c1f628fcf39fe5254d4997150d50a2b39b0aa4441a3
Python
14,399
325
"""Tests for the LAION-fMRI benchmark registry and basic load paths. The headline registry is 24 variants — 8 shared-pool ridge, 8 persubject-pool ridge, 4 shared-pool RSA, and 4 shared-pool linear CKA. Non-headline variants (cluster_k5, per-OOD-category, IT_full) live as factory functions and are exercised separately...
4ef5da09089b4df5c659ceaf31b45cf32b4464d67b748d1110b3ecd34c1fad10
Python
14,401
357
# -*- coding: utf-8 -*- """ Created on Fri Oct 21 15:03:57 2022 @author: lcmmichielsen """ from pathlib import Path import argparse import json import numpy as np import pandas as pd from sklearn.model_selection import GroupKFold import pysam import tensorflow as tf from basenji.dna_io import dna_1hot parser = argp...
b47ce53b8c47bcc975ad8339b1f8eb1ff82b6958772bbcd0338a8d72a3c5c051
Python
14,418
263
import numpy as np import torch import torch.nn as nn from torch.cuda.amp import autocast import os import wget import timm from copy import deepcopy from timm.models.layers import to_2tuple,trunc_normal_ from .functions import ReverseLayerF # override the timm package to relax the input shape constraint. class Patc...
06afde65ad33368cfa5033b6c5fa5c565253a0f61eedcbd9fbf982688c300442
Python
14,419
395
# 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 import torch.nn as nn import torch.nn.functional as F from typing import Optional, Tuple, Type from .common...
db2684a753611f3221426c8d775819857923d6718cb1fc93c9916fb3857c4383
Python
14,419
380
#! /usr/bin/env python3 """ Implements function find_layer_contrast_roi and corresponding nipype interface FindLayerContrastRoi and command line interface. """ import sys import os from scipy.optimize import bisect, brentq from nipype.interfaces.workbench import MetricResample from nipype.interfaces.base import ( ...
1665ada2902722c9a8cd566c840e324d623ef2b12f7d9ae9f38b24aed0e39886
Python
14,420
395
# 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 import torch.nn as nn import torch.nn.functional as F from typing import Optional, Tuple, Type from .common...
a58055c6ee2f34485736efe480a6eb0474048888a45c09028c794ee3e800dfbd
Python
14,420
405
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ SPDX-License-Identifier: MIT SPDX-FileCopyrightText: © 2022 Boris Lenseigne, Renaud Bastien, Stephane Sanchez <stephane.sanchez@ut-capitole.fr> Université Toulouse Capitole - Institut de Recherche en Informatique de Toulouse Real Expression Artificial Life (REVA) Re...
ef4f5743256bef90c02f8c578c5aa7480d4775c42bdc702a18ab5549b9f52879
Python
14,425
438
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from __future__ import annotations import json from abc import ABC from collections.abc import Callable, Sequence from copy import deepcopy from pathlib import Path from typing import TYPE_CHECKING, Any, Generic, Literal, TypeVar, overload from typ...
839c9449d1a90a451a467a8bbcc3c779874c8c420beaf8c761b9c79f07cfe6d8
Python
14,427
289
"""Tests for correctness of Keypoints and BatchedKeypoints in fireants.io.keypoints.""" import pytest import numpy as np import SimpleITK as sitk import torch from fireants.io.image import Image from fireants.io.keypoints import ( Keypoints, BatchedKeypoints, compute_keypoint_distance, _compute_keypoi...
37823dd461947a2edaddf9e324d09a98431a2fea5c096f97b44482bf130678bc
Python
14,434
379
"""Backend-agnostic general ASE MCP server. Uses :class:`~chemgraph.mcp.cg_fastmcp.CGFastMCP`. Tool functions are plain computation -- the framework handles backend submission, future resolution, and async job tracking. This mirrors :mod:`chemgraph.mcp.mace_mcp_hpc` but exposes the full ASE surface (selectable calcul...
16f3ff65e01ba27d886614c082d37d68c9b8b1c17493999fc60a4ea81c27666c
Python
14,436
443
""" Sin-cos, fourier, rotary position embedding modules and functions Hacked together by / Copyright 2022 Ross Wightman """ import math from typing import List, Tuple, Optional, Union import torch from torch import nn as nn from .grid import ndgrid from .trace_utils import _assert def pixel_freq_bands( num...
9441eba0948589792b5150d88e4532786a8f4adc78cd0424689cebec455e296f
Python
14,437
248
from brainvoice.visualization import gen_spectrogram_cmap, plot_spectrogram_on_axis, save_borderless from brainvoice.spectrogram_utils import linearspectrogram, inv_linear_spectrogram, get_better_synth_hparams from brainvoice.waveform_utils import write_waveform from brainvoice.data.brainvoice_loaders import load_label...
88ef68fb84853ee20f00ad191280d835e3ca10790a3a504e7e4a65e893438c92
Python
14,442
379
""" EEG Multi-class Classification Script ================================================= - Load preprocessed .npy data - Feature extraction: Multi-band CSP , global stats , frequency features - Classifier: KNN with grid search - 5-fold stratified cross-validation, per-subject best results output """ import...
f1468e61e61e3b8e1e983fa177f784157eb8ae72fc7179ac27f47fd8c93a8f66
Python
14,446
410
"""Convenience functions for model loading and prediction.""" import os import warnings import lightning as pl import numpy as np import torch from hydra.utils import get_class, instantiate from omegaconf import DictConfig, OmegaConf from rich.progress import track from mcmlnet.training.data_loading.preprocessing im...
f164544932b3fc8f1423b60bbaca56eb78767cfb990c0481fb5c4f1e1179ac8c
Python
14,446
488
"""Function related to TensorFlow datasets.""" import logging import os from typing import Dict, List, Optional, Tuple, Union import numpy as np from osl_dynamics.utils import misc _logger = logging.getLogger("osl-dynamics") def get_n_sequences( arr: np.ndarray, sequence_length: int, step_size: Optional[int] ...
f7bed85a7b27da6fa0fe06f95dd9798372dde45fc50a56a15fc2586ba8b54bdc
Python
14,471
465
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved import json from collections import defaultdict from typing import Dict, List, Tuple import torch from pycocotools import mask as mask_util # ============================================================================ # Utility Functions # ==...
b38f5f6ead3152194e9ac8e69ea2aca938d64f6d240fd26b393aaee1d62d4bb9
Python
14,474
468
"""GLM base class.""" from typing import Dict, List, Optional, Union from dataclasses import dataclass import numpy as np from osl_dynamics.glm.ols import osl_fit, get_degree_of_freedom # Helper functions for validation def _validate_name(name: str) -> str: if not isinstance(name, str): raise TypeError(...
fcc0ac42b692610bdccf7a6841b11d445cbac740199c928ce80c33f906e289ab
Python
14,474
349
################## PURPOSE ################# # This script is to do PAIR comparisons using the three 3 caller CNVs files # This script takes in the 3 caller CNVs files and put their content in to a nested dictionary. # There are 3 dictionaries within the bigger dictionary , each dictionary is the content of a singular...
1f5accdbf6a270738bb73be0abbdfbbe5081df5ff9a826820a3a850d381ad696
Python
14,475
329
#!/usr/bin/python # ---------------------------------------------------------------------------------------- # A class to load and parse predefined pump commands. # ---------------------------------------------------------------------------------------- # Jeff Moffitt # 2/16/14 # jeffmoffitt@gmail.com # --------------...
79c860ececb98938b80da7ec5e01dda4209f886c20e5137707310d8baae3917c
Python
14,475
470
from collections.abc import Sequence from dataclasses import dataclass from pathlib import Path from typing import Any import polars as pl from sklearn.preprocessing import KBinsDiscretizer, StandardScaler from eir.data_load import label_setup from eir.data_load.label_setup import ( TabularFileInfo, al_label_...
fc732eeb03502738c712d8beed08e57222303ba2f415769f1fde2c0dfab48f2a
Python
14,478
379
import typing from typing import Optional, Tuple, Union import torch import torch.nn.functional as F from torch import Tensor from torch.nn import Parameter from torch_geometric.nn.conv import MessagePassing from torch_geometric.nn.dense.linear import Linear from torch_geometric.nn.inits import glorot, zeros from tor...
901822ef46881a4d6ac92637090495e81ba2da0757ca16e0f2537e76fc41fa1f
Python
14,479
345
import torch import pandas as pd import os import csv # Add this import for CSV writer from tqdm import tqdm # Import tqdm def compute_rmse(predictions, targets): """ Compute Root Mean Square Error between predictions and targets. Parameters: - predictions: Predicted values - targets: Target...
4cb920e1260e882cd73f6672c5f635188efa52318adc36a6a28eb8738ec281cb
Python
14,492
353
import numpy as np import sys sys.path.append('/Users/denis/ownCloud/pfc-layers/analysis/fmri-analysis/library') sys.path.append('/data/p_02389/code/fmri-analysis/library') import voxeldepths_from_surfaces as vfs import nibabel as nib import os from numba import jit, prange from skimage.segmentation import expand_label...
638777fc90684bf5f6bdd162495f11ae0ee0e7a4b99d54302ba83b34ece93df2
Python
14,494
405
# Kai Sandbrink # 2023-02-01 # This script takes a converged network with APE layer and mistrains the efficacy signal # %% LIBRARY IMPORTS import numpy as np from datetime import datetime import matplotlib.pyplot as plt import os, random import time import wandb import torch from torch import nn import torch.nn.func...
3bda1e17ac84444e6a4592dcb3bbb8acc6c1a1de27e7bdfcece52abf7cc85c8d
Python
14,508
290
class QMException(Exception): pass class Calculation: """ This class is going to store information about calculation input files The default calculation run is expected to be like this """ multiplicity = 1 # make multiplicity a class variable #Define solvent properties as a class attrib...
dd97a09f6bfb2d0dbe20763a1eddac87cdc65edf2d604341a4589e8a2cde7834
Python
14,511
702
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Segment, mask and bin 'brain-KCc' files """ import os import matplotlib.pyplot as plt import numpy as np import mbflim.utils as ut import mbflim.visualization as vis import mbflim.image.image_processing as pro import mbflim.image.image_set_processing as setpro impo...
ae23ee58cbbb776f93e6944e77705fb825f23d5beb1a84a2d79eac0b9198505e
Python
14,513
349
import unittest import numpy as np import pandas as pd from sklearn.datasets import make_classification from sklearn.linear_model import LogisticRegression, LinearRegression from causallib.metrics import weighted_roc_auc_error, expected_roc_auc_error from causallib.metrics import weighted_roc_curve_error, expected_roc...
ed58f55d311de55b9199062c79d0ec9e0377c9d1b11064c5b484d2ede71b67ec
Python
14,513
417
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: ajaver """ import numpy as np import pandas as pd event_columns = ['motion_mode', 'food_region', 'turn'] durations_columns = ['event_type', 'region', 'duration', 'timestamp_initial', 'timestamp_final', 'edge_flag'] ...
be7c28b2f60d3580bd0f87196cbc63702178887493c5daf1fb924709c830320e
Python
14,518
293
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Nov 21 09:28:15 2022 @author: mgruenig """ import tensorflow as tf import os GPU = '3' os.environ['CUDA_VISIBLE_DEVICES'] = GPU # Use 3rd GPU gpus = tf.config.experimental.list_physical_devices('GPU') tf.config.experimental.set_memory_...
01b6dc4f74db9aa167c3694454b72c1608fdbd342b3a8b5717b3722fb61226f4
Python
14,521
384
import unittest from zigzag.classes.workload.layer_node import LayerNode class TestLayerNode(unittest.TestCase): def test_CONV2D_1(self): test_equation = "O[g][b][k][oy][ox]+=W[g][k][c][fy][fx]*I[g][b][c][ix][iy]" test_loop_dim_size = { "B": 2, "K": 32, "C": 64...
3b5f87a402fb8722c115172d41b44dcd7a41c4c2c334089421c74a7c512de646
Python
14,522
325
"""Read a public Dropbox folder share link, one file at a time. A folder share link looks like a dead end: the only *documented* unauthenticated operation is downloading the whole folder as a generated zip, which for a real dataset means tens of gigabytes and no way to take a part of it. Dropbox's own web interface ob...
a45aa24e225baa64f110b522f058f476f9bd51b39c3ea2e3019a72ee189429e8
Python
14,522
420
''' data processing for neuron project ''' # built-in import sys import os import shutil import six # third party import nibabel as nib import numpy as np import scipy.ndimage.interpolation from tqdm import tqdm_notebook as tqdm # for verbosity for forloops from PIL import Image import matplotlib.pyplot as plt # n...
2cc5ab750b8e279ba5a4e56808c5700e27ced4b8486039d80429fe2d3a6768e7
Python
14,524
354
# -*- coding: utf-8 -*- import logging from ast import literal_eval from dipy.core.gradients import gradient_table from dipy.reconst.csdeconv import (mask_for_response_ssst, response_from_mask_ssst) from dipy.reconst.mcsd import mask_for_response_msmt, response_from_mask_msmt from d...
e398d59236b4b79a90d570f66f6dfafc9a8b378e456113a0ce473b3eae928629
Python
14,527
417
""" Module defining the operator view """ import typing import asyncio import datetime import functools from ..qt import * import packaging.version import numpy PYQT_VERSION = packaging.version.parse(PYQT_VERSION_STR) USINGLEGACY_QT = PYQT_VERSION < packaging.version.parse('5.11.0') from .window import Window as Ta...
0847c2ab55483060f93a45c2c89c3a3f32ae986e20cf065c9c0c0450b9f999a6
Python
14,531
494
""" Recorder hooked into :func:`ProjectionProcessor.fitModel`. Activation ---------- Set ``MUSCLEX_CAPTURE_FITS=1`` to enable. Optional env vars: * ``MUSCLEX_CAPTURE_DIR`` -- where pickle files are written (default: ``<repo>/musclex/tests/fitting_ab/fit_cases``). * ``MUSCLEX_CAPTURE_TAG`` -- a string folded into ea...
37950877fb45f2f5fff38758b4a58271a7747b6ac0dbfd11da30b5ed585f9417
Python
14,535
274
from torch import nn import torch import torch.nn.functional as F from torch_sparse import spmm from model.basic import EGNN, EquivariantScalarNet, BaseMLP, aggregate, EGMN class EquivariantEdgeScalarNet(nn.Module): def __init__(self, n_vector_input, hidden_dim, activation, n_scalar_input=0, norm=True, flat=False...
4e363b929ef5099e4ca63fef376ee569930a438c10a9c96044594f83b970da38
Python
14,549
398
# 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 import torch.nn as nn import torch.nn.functional as F from typing import Optional, Tuple, Type from .common...
64f4f98451d4c52246743d9b8c346a0e44996288f309372a1a3f5438454032ab
Python
14,550
398
#!/usr/bin/env python """ Point Grey camera used in the context of a focus lock. Hazen 09/19 """ import numpy import time from PyQt5 import QtCore import storm_control.sc_hardware.utility.af_lock_c as afLC import storm_control.sc_hardware.utility.sa_lock_peak_finder as slpf import storm_control.sc_hardware.pointGrey...
2bb1c801250f87faa90e03a4afba51d99222370ba91839c867b4e5f0c2e347b5
Python
14,551
273
from utils.env_config import * # Includes os import yaml import torch from torch.utils.data import DataLoader, ConcatDataset, RandomSampler from data.dataset import RotorBladeDatasetClean from data.preanalysis.create_overview_data import filter_csv_by_intervals, plot_histogram_v1 import pandas as pd import numpy as np...
6c3bd6b893be456820bedd8ac6158806c7f6c7eef527ec36cd33252a43899dd4
Python
14,551
420
"""Plot labelled JHU mesh statistics inside an MNI152 glass brain. Python example -------------- from cvdproc.utils.python.visualization.plot_JHU_glass_brain import plot_jhu_glass_brain plot_jhu_glass_brain(values=[...50 values...], output="jhu_stats.png") plot_jhu_glass_brain( values=[...50 values...], signif...
c388f9ff77740bb50a605c0efd826a8833e9a1bc4b98c2fb80e6205546d99376
Python
14,552
431
#! /usr/bin/env python3 import logging import torch from sklearn.metrics import adjusted_mutual_info_score, normalized_mutual_info_score from . import common_functions as c_f from . import stat_utils EQUALITY = torch.eq def maybe_get_avg_of_avgs(accuracy_per_sample, sample_labels, avg_of_avgs): if avg_of_avgs...
107d9058ce996778ffae0bcbc91b63e2c4a54cb5f5ed6a0877243892e7804214
Python
14,555
465
#Lucas Sancéré - import csv import json import os #depends on the env, could be # from collections.abd import MutableMapping import random from collections.abc import MutableMapping import numpy as np from tqdm import tqdm ### Utils Functions def checkdownsampling(originalimagepath: str, downsampleimagepath: str, ...
67b879e688eed1adb307dc64035493f543d8c0b280ae52c3d6a48f19bbca055c
Python
14,564
369
import datetime import subprocess import tempfile from collections import defaultdict from pathlib import Path from typing import Optional import numpy as np import pandas as pd from .util import StationMapper, logger, set_cwd try: from obspy.taup import TauPyModel from obspy.taup.taup_create import build_ta...
6fd08c019469a87ec82ebeea3024cb40762cc0d9d111af04b7f3530aa5860ece
Python
14,579
370
"""Tests for mcmlnet.utils.mc_runner module.""" import copy import os import shutil import tempfile import warnings from itertools import product from typing import Any import numpy as np import pandas as pd import pytest import torch from mcmlnet.utils.mc_runner import RecomputeMC class TestRecomputeMC: """Te...
af096776fb366173b6be050d961d39b8d3a4d937f9aec796ebbc75e79af9f3ec
Python
14,579
403
import cv2 import numpy as np import struct from PySide6.QtGui import QImage, QPixmap from PySide6.QtCore import QRunnable, Signal, Slot, QObject, QThreadPool, QThread, QTimer, QEventLoop class BehavVideo(QObject): fetch_frame_number = Signal(object) new_frame_fetched = Signal(object) run_worker = Signal(...
14cd16491396e2e1b991b57b5fea4055ac5cf7a45e6625d0a79489f7963d7a39
Python
14,580
438
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved import math from enum import IntEnum, unique from typing import List, Tuple, Union import numpy as np import torch from torch import device _RawBoxType = Union[List[float], Tuple[float, ...], torch.Tensor, np.ndarray] @unique class BoxMode(In...
603cc061884c7bae6b571a4c371f21953bac20fe5011a99c23a842df3dc95e38
Python
14,582
369
import logging import math from functools import partial import torch from torch.optim import Optimizer from torch.optim.optimizer import required from torch.optim.lr_scheduler import _LRScheduler, ReduceLROnPlateau log = logging.getLogger("flair") class SGDW(Optimizer): r"""Implements stochastic gradient desc...
1adb76e889e4fec166c0436ca99ac85944e94dd4a39d8ef3d389507b9185bf44
Python
14,596
375
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Photometry Control vs Test (portable GitHub-ready; paper-matched) - Batch process raw CSVs in Control/Test folders - Photobleaching correction - Motion correction (405 -> 465 regression) - Z-score normalization using a global baseline interval - Saves per-anim...
a057bdb5677bd787df76e245c4b5904d0071ea2a8947607b8f9e03b04e3609d7
Python
14,601
285
import multiprocessing import os import socket from typing import Union, Optional import nnunetv2 import torch.cuda import torch.distributed as dist import torch.multiprocessing as mp from batchgenerators.utilities.file_and_folder_operations import join, isfile, load_json from nnunetv2.paths import nnUNet_preprocessed...
2cae00f0c6b8a76feb991334fa4528345217bdf3be9f3bc512a9771424791156
Python
14,603
412
""" Data structures to hold PLS inputs and results objects """ from multiprocessing import cpu_count from textwrap import dedent from .utils import ResDict _pls_input_docs = dict( decomposition_narrative=dedent( """\ The singular value decomposition generates mutually orthogonal latent variables ...
f5c00a887efe9d890f9b1326747d90d92eb517bfe54b254f59bf7d826aca7b11
Python
14,605
370
import numpy as np import pandas as pd import os from sklearn.model_selection import KFold from sklearn.metrics import accuracy_score, f1_score, hamming_loss, label_ranking_average_precision_score, roc_auc_score, confusion_matrix from sklearn.utils.class_weight import compute_class_weight from imblearn.over_sampl...
85e1310093f7b799dd1b6ab44244e22eb90ddfe1998baa945b0e6ec839c4a7bb
Python
14,606
390
import numpy as np from pathlib import Path import sys import os import scipy.io from scipy.signal import butter, sosfilt import mne # For suppressing print statements within a function. Place function after - with HiddenPrints(): From https://stackoverflow.com/questions/8391411/how-to-block-calls-to-print class Hidd...
053a5dba8b8c481fe5d11e938d90d45e4bc04ef708192f52fe124b5b3c36fcfb
Python
14,613
404
from pathlib import Path import pandas as pd from tqdm import tqdm from transformers import RobertaTokenizer, RobertaModel import torch import numpy as np import os from torch_geometric.data import Data, HeteroData def get_data_dir(server_id): if server_id == "206": return Path("/new_temp/fsb/Twibot22-base...
46868397a5b7b52531ba80668b3846ee7a5a15c5fb0344fb3505b34e5a6231e6
Python
14,614
321
"""Frozen, annotation-grounded image recipes for the published OpenPlant release. No legacy processing script is imported or executed. In particular, this module never renames source files, randomly splits images, or deletes source data. """ from __future__ import annotations import csv import gzip import hashlib imp...
7fc9d203fcd95ced98c0a327686731fc2cfed7551d3317dc93e865d01e8c7278
Python
14,614
355
from typing import List, Optional, Tuple, Union import torch from torch import Tensor import torch_geometric.typing from torch_geometric import is_compiling, is_in_onnx_export, warnings from torch_geometric.typing import torch_scatter from torch_geometric.utils.functions import cumsum if torch_geometric.typing.WITH_...
0124d86b3a167fa9dc195b6fa57f77805ab65361559aff829dc5770604b21574
Python
14,618
437
from collections.abc import Callable, Generator, Iterable, Sequence from copy import copy, deepcopy from enum import Enum from typing import ( TYPE_CHECKING, Any, Optional, TypedDict, ) import torch from torch import nn from torch.nn import Module from torch.utils.data import DataLoader from eir.setup...
17d6e65809f62abd4a5fb6946f9631b54f430c0003d4a46df9ac4b021897a79d
Python
14,622
472
from unittest.mock import patch import json import numpy as np import obspy import pytest import torch import torch.nn.functional as F from torch.utils.data import DataLoader import seisbench.generate as sbg import seisbench.models as sbm import seisbench.util as sbu from seisbench.util.dkpn_shared import _feature_a...
f2965eecac61de3570939d84d37a558b1d6d069d4cc4ecdceeb99ab3279ecd58
Python
14,625
368
import argparse import numpy as np from scipy.spatial import distance, distance_matrix import time from Bio.PDB.PDBParser import PDBParser from PixelateResidue import * from pyrosetta import * init(extra_options="-constant_seed -mute all -read_only_ATOM_entries") from pyrosetta.rosetta import * from pyrosetta.rosetta....
f94e24a8f1853990b3feedab5d55cb5ef2e47515f5ae12231e6a897d58f3660b
Python
14,634
316
""" Mixup and Cutmix Papers: mixup: Beyond Empirical Risk Minimization (https://arxiv.org/abs/1710.09412) CutMix: Regularization Strategy to Train Strong Classifiers with Localizable Features (https://arxiv.org/abs/1905.04899) Code Reference: CutMix: https://github.com/clovaai/CutMix-PyTorch Hacked together by / Co...
2f2d54f3230b55fa1f8d8d30253d46b0a03401aa10d743ce1a53010ee8ac654a
Python
14,636
404
from pathlib import Path import pandas as pd from tqdm import tqdm from transformers import RobertaTokenizer, RobertaModel import torch import numpy as np import os from torch_geometric.data import Data, HeteroData def get_data_dir(server_id): if server_id == "206": return Path("/new_temp/Twibot22-baseline...
51663948ffb9adfbe673c5c6a41407b729cd8a83d80f08e83bab6536197f3dd0
Python
14,637
384
#!/usr/bin/env python from optparse import OptionParser import glob import pdb import os import random import h5py import numpy as np from scipy.stats import cauchy from basenji.emerald import EmeraldVCF ''' sad5.py Interfaces to normalized and population-adjusted SAD scores. ''' class SAD5: def __init__(self,...
0445a0f877d259e2989c150bc3dbaa327bab0086ffc5b10463244e00dc23db45
Python
14,639
421
"""resnet in pytorch [1] Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun. Deep Residual Learning for Image Recognition https://arxiv.org/abs/1512.03385v1 """ from types import FunctionType from torch import Tensor import torch.nn as nn import numpy as np import torch from models import maxout_conv2d #fro...