sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
47bea5b5c8d70be701d94d5496fb81f22f2321af885894204b2b3b838a858c49 | Python | 10,764 | 242 | 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
import plotting
import pandas as pd
import wandb
from wandb.integration.keras import WandbMetricsLogger
import yaml... |
a382f159a5438caae716261b45d4c992bf6ac497f3ee723f313fa831ca9064b2 | Python | 10,766 | 291 | import argparse
import torch
import torch.utils.data as Data
import model.network_947331 as network_947331
import model.non_local_embedded_gaussian as non_local_embedded_gaussian
from model.network_947331_freeze import Network
from torch import nn
import time
import random
from torch.optim.lr_scheduler import ReduceLRO... |
ebca957a51eb5abad46396040b3e88a329ea5c989ba27d1adec0ff280e32f7e7 | Python | 10,766 | 278 | # -*- coding: utf-8 -*-
"""
Simulation study for EMPRISE fMRI data
Joram Soch, MPI Leipzig <soch@cbs.mpg.de>
2023-09-04, 14:52: first version
2023-09-04, 16:27: fine-tuned parameters
2023-09-06, 11:55: controlled SNR
2023-09-06, 15:59: implemented saving
"""
### Step 1: specify settings #############################... |
ba61876a913889bec8a247179e3d1bd3d4be1007942f7aaafd53d3979498657d | Python | 10,768 | 285 | """Parallel network metrics must not change what a CAT-NAP run produces.
Run from the repo root::
uv run python python/test_pipeline_streaming_pool.py
CAT-NAP's phase 1 hands each recording's network metrics to a
:class:`~meanap.pipeline.parallel.StreamingPool` as the (possibly remote)
stream yields it. Two prop... |
ec70dc46708ece67d1859cf3c9159bcf28e1957d67cc826f41ed7d063cbae168 | Python | 10,768 | 313 | """
Hyperparameter tuning script using Optuna.
"""
import os
from datetime import datetime
from typing import Any
import hydra
import lightning as pl
import optuna
from dotenv import load_dotenv
from hydra.utils import instantiate
from lightning.pytorch.callbacks import EarlyStopping, ModelCheckpoint
from lightning.... |
aa582bb4d1170dbe0490166ac3fd9273178cd75e5150d0ea2f3226b55548c086 | Python | 10,769 | 216 | import argparse
import os
import shutil
from math import log10
import datetime
import pandas as pd
import torch.nn as nn
import torch.optim as optim
import torch.utils.data
import torchvision.utils as utils
from torch.utils.data import DataLoader
from tqdm import tqdm
from utils.ssim import ssim
from utils.dataset im... |
764bea64533ec04c4ccc0170d4eafe936ec15fb8370c756f9089f31e4a86979a | Python | 10,771 | 330 | import attrs
import numpy as np
from scipy.interpolate import interp1d
from scipy.stats import zscore
from typing import Optional
from argclz import AbstractParser
from neuralib.locomotion import CircularPosition
from neuralib.persistence import persistence
from neuralib.suite2p import SIGNAL_TYPE, Suite2PResult, get_... |
a7e934f87ede960f5a9a29dd55bc9c4f3904daa379e75cab970d0dc4546599d9 | Python | 10,771 | 220 | import numpy as np
import pandas as pd
class State:
def __init__(self,F,J,is_terminal=False):
"""
Defines a state of the metaMDP
"""
self.F = F #matrix of mean values for each object and feature
self.J = J #matrix of corresponding precisions. Note that this is not a... |
221699215e906dc4b80ad54b753544b60fe2fde47f7e1e4ad502bf6d9fe99ae1 | Python | 10,773 | 286 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
from __future__ import annotations
import math
import torch
import torch.nn.functional as F
from torch import nn
from torch.utils import checkpoint
from ultralytics.nn.module... |
8eaeb001c718f85d1ab5d357b10e29c383f0bd9a4e033721da41d9fcc6bb1c33 | Python | 10,774 | 347 | from collections.abc import Sequence
from copy import deepcopy
from typing import TYPE_CHECKING, Any
import numpy as np
import pytest
from scipy.spatial.distance import cosine
from sklearn.metrics import mean_squared_error
from eir import train
from eir.train_utils.utils import seed_everything
from eir.utils.logging ... |
e3e07c4f6a7da91e1ce1c5792ebcd40afbbe00bda0781b928ed363b820e3832b | Python | 10,774 | 344 | # -*- coding: utf-8 -*-
#
# ClearMap documentation build configuration file
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys
import os
# If extensions (or modules to d... |
3ebbffcde42d83a5f22c769ecf7f8cfbc691f561148ad5a4a4a710c7e2cba661 | Python | 10,775 | 267 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Script to display scatter plot between two maps (ex. FA and MD, ihMT and MT).
By default, no mask is applied to the data.
Different options are available to mask or threshold data:
- a binary mask
- two probability maps, which can be used to threshold maps with
... |
93619bb4c07cea5d7f3e67be22f299de4ef588c2bf8f74fcf88fa0b107a30835 | Python | 10,776 | 324 | #!/usr/bin/env python
#
# average_bvecs.py - Average pairs of bvals/bvecs together.
#
# Author: Paul McCarthy <pauldmccarthy@gmail.com>
#
from __future__ import print_function
import sys
import numpy as np
import numpy.linalg as la
# Change this function to enable/disable verbose output
def log(msg):
p... |
215e1763825f052492a77f7332828c50e1c284c6911c9beaa1ae626202bacb91 | Python | 10,777 | 392 | import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
def draw_transmat_graph(G, edge_threshold=0, lw=1, ec="0.2", node_size=15):
"""
Draw a transition matrix as a circular graph.
Parameters
----------
G : networkx.Graph
The graph to draw, with edge weights as transitio... |
8c3966094cf17f14ba4cdddcef223abb8fa79c4dbd7e57d252e3855da5cfe8c1 | Python | 10,779 | 331 | '''
'''
# Anwar O. Nunez-Elizalde (Jan, 2016)
#
# Updates:
# Anwar O. Nunez-Elizalde (Apr, 2020)
#
#
from PIL import Image
import numpy as np
from .utils import iterator_func
from .colorspace import rgb2lab
def video_buffer(video_file, nimages=np.inf):
'''Generator for a video file.
Yields individual uint8 ... |
f743e92f79593a89245b88b3c822bf64da0372a66181f1c1671000b00e1c3b01 | Python | 10,781 | 258 | #!/usr/bin/env python3
"""
Shared Kalman-filter multi-object tracker, used by BehaveAI_classify_track.py and
BehaveAI_live.py so the two stay behaviourally identical (same pattern as box_geometry.py /
index_annotations.py).
All distance and noise parameters are resolved per-track against each track's own
EMA-smoothed ... |
04b4303e2a1a10b8bf5ad2f997a3eb40751226f4c6799040f48d102ebae7a80c | Python | 10,785 | 298 | import pytest
from pathlib import Path
from unittest.mock import patch, Mock
from click.testing import CliRunner
from stack_corr.stack_corr import infer, InferParams
class TestCLI:
"""Test the CLI functionality."""
def test_infer_command_help(self):
"""Test that the infer command shows help."""
... |
65309a1d4ca229b73218b578fcadae3d9298e5d2d852c0418a16ff383871ea92 | Python | 10,785 | 244 | import numpy as np
from scipy import stats
import statsmodels.api as sm
from sklearn.linear_model import ElasticNet
from sklearn.feature_selection import SelectKBest, f_regression
from sklearn import preprocessing
from sklearn.pipeline import Pipeline
from sklearn.model_selection import LeaveOneOut
from sklearn.metrics... |
8c791057244135785e185629d7f4ac36e5cddc07e3a77b5147230f08f065460f | Python | 10,785 | 394 | from typing import Union
from functools import partial
from langgraph.prebuilt import ToolNode
from langgraph.graph import StateGraph, END
from langchain_openai import ChatOpenAI
from langchain_core.messages import AIMessage, HumanMessage
from langgraph.checkpoint.memory import MemorySaver
from langgraph.types import ... |
e9e3c65e07c598924004ff8760b282ef655df730fa6d1bf33ba5dd460c528360 | Python | 10,786 | 305 | # Created by: Marc Canela
import pickle as pkl
from pathlib import Path
from typing import Dict, Tuple
import matplotlib.colors as mcolors
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from PIL import Image
from shapely.geometry import Polygon
from sklearn.base import BaseEstimator
from tqdm ... |
9f1b6d19ee10556af8b5e604a0dcfcb8746efb256c2d264f39e17fb73d1b8f6a | Python | 10,788 | 262 | from typing import Dict, List, Optional, Tuple
import torch
from torch import Tensor
from torch.nn import Embedding
from torch.utils.data import DataLoader
from torch_geometric.index import index2ptr
from torch_geometric.typing import EdgeType, NodeType, OptTensor
from torch_geometric.utils import sort_edge_index
EP... |
0ae0186a11dd6995e9f77386df199bdce419d3c48ebdee2d5f4db3cfdddd5c87 | Python | 10,790 | 261 | """This computer, what a run will do with it, and how fast it actually goes.
Opened from the toolbar, and there for two questions that were previously only
answerable by guesswork.
**Which of our computers should run the batch?** The benchmark times the real
spike detector and the real null-model pool, so the score r... |
786c8b94eaa7751c354222ce3986814c858f00536f9ed9b28594c8f7aac9c1e3 | Python | 10,790 | 246 | import os
import numpy as np
import cv2
import torch
import yaml
import random
import pandas as pd
from argparse import Namespace
from monai.transforms import (
Compose,
ToTensord,
ScaleIntensityd,
AsDiscrete
)
from monai.networks.nets import UNet
from torchmetrics import Dice, JaccardIndex
from monai.m... |
21f9a5e70d49fd4e28c7b54210249418f3a3c2eb6335a5847754ba11636c608e | Python | 10,794 | 348 | """
Evaluation metrics for metabolite-disease association prediction.
This module implements all metrics reported in the paper, including:
- Accuracy (ACC)
- Sensitivity (SEN) / Recall
- Specificity (SPE)
- Precision (PRE)
- Matthews Correlation Coefficient (MCC) - PRIMARY METRIC
- Area Under ROC Curve (AUC)
- Area Un... |
6494173beb8d21597342e6807ba940781f1fa7c2a6c1840d63cf82c00e51c964 | Python | 10,796 | 277 | import os
import h5py
import yaml
import matplotlib.pyplot as plt
import sys
import numpy as np
from copy import deepcopy
lfp_rangeHz = [0.5, 100]
trans_fac = 1.5 #stds from mean applied on #(transients) to include/exclude transients
ditch_lonely_offperiods = False
maxdist_lonelies = 2.
ww_smooth_trans_s = 0.1
thr2_pe... |
e95f508319425815d8f85cccc48c32f091d91041de281768bc52d5b7a5101aa0 | Python | 10,799 | 351 | import torch
import pandas as pd
import numpy as np
import networkx as nx
from rdkit import Chem
from torch.utils.data import Dataset
from torch_geometric.data import Data
from rules import ATOMIC_NUMBER
from utils import one_hot
def get_atomic_number():
atomic_number_list = ATOMIC_NUMBER()
def... |
f5d6efeec8a4baefac3963bde3e9f971d0186163353ad9dd7ea5f1def08ffd3e | Python | 10,799 | 301 | import numpy as np
import pytest
from brainscore_vision import load_stimulus_set, load_dataset
@pytest.mark.private_access
@pytest.mark.parametrize('assembly_identifier', [
'Scialom2024_rgb',
'Scialom2024_contours',
'Scialom2024_phosphenes-12',
'Scialom2024_phosphenes-16',
'Scialom2024_phosphenes... |
884a1c1ecb0134fc1b81858c66b44eef0affe4c2e9fd813213453d8c7502c897 | Python | 10,800 | 293 | #!/usr/bin/env python
"""
This is the customized Listview, model, etc.
Hazen 03/17
"""
from PyQt5 import QtCore, QtGui, QtWidgets
import storm_control.sc_library.halExceptions as halExceptions
def getItemData(q_std_item):
return q_std_item.data()
class ParametersItemData(object):
"""
Hmm.. Apparently... |
d3a5dc792124ffbae9520b096fdc93f6275a8192aea7569f7b18c859a4ab7732 | Python | 10,805 | 293 | #!/usr/bin/env python
"""
This is the customized Listview, model, etc.
Hazen 03/17
"""
from PyQt5 import QtCore, QtGui, QtWidgets
import storm_control.sc_library.halExceptions as halExceptions
def getItemData(q_std_item):
return q_std_item.data()
class ParametersItemData(object):
"""
Hmm.. Apparently... |
ea86ad683e8af0dc81b7197200c2a58f75d74e36607da06e79f50d76f32acfbb | Python | 10,806 | 268 | import os
from typing import Any, List, Dict, Callable, Tuple
import math
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import Tensor
from torchvision.utils import make_grid
from torchvision.utils import save_image
import torchvision.transforms.functional as T
from py... |
22214a52aba118e5b31fad763d79603314e94173c01fc33e4dc88468f1fc08d9 | Python | 10,807 | 218 | import pytest
import torch
import SimpleITK as sitk
import numpy as np
import os
import subprocess
import logging
from pathlib import Path
import torch.nn.functional as F
from fireants.registration.distributedgreedy import DistributedGreedyRegistration
from fireants.io.image import Image, BatchedImages
from fireants.u... |
67076396ef1bb60f058c8b6faf9e07b52546602b5481c42a09a877b1891114a1 | Python | 10,810 | 239 |
from __future__ import division
import scipy as s
from .basic_nodes import *
from mofapy2.core.distributions import *
"""
This module is used to define nodes that are inferred using the variational bayes framework.
All variational nodes share the property of having a lower bound associated with it.
We divide varia... |
762a14af4e42122b73211fd4c792ce80619a33183e790a2b9d9bda8a0b36677a | Python | 10,810 | 322 | """
nems.uri
Where the filesystem organization of nems directories are decided,
and generic methods for saving and loading resources over HTTP or
to local files.
"""
import re
import io
import os
import json as jsonlib
import logging
import requests
import numpy as np
import base64
from requests.exceptions import Con... |
538c450985fd3d18ce126309cd0e42d3fa649047ab4eb5b5431ec4d64bbe3099 | Python | 10,811 | 243 | #!/usr/bin/python
# ----------------------------------------------------------------------------------------
# A wrapper class for the Hamilton MVP valve chain and the Widgets that display
# their status. All interactions with the valve chain should go through this
# class.
# ------------------------------------------... |
ae0b55599dce9a0cc11ec94620f7c722f8eb0921bd6d8c49bd00256055b4810c | Python | 10,814 | 293 | #!/usr/bin/env python
"""
sCMOS calibration UI.
Hazen Babcock 06/17
"""
import numpy
import os
from PyQt5 import QtCore, QtWidgets
import storm_control.hal4000.halLib.halDialog as halDialog
import storm_control.hal4000.halLib.halMessage as halMessage
import storm_control.hal4000.halLib.halMessageBox as halMessageBox... |
b96b9d8ee0195b3ddf7d8cfc990bddf1cb5755de939a0f78d276517c69d408ab | Python | 10,814 | 385 | import logging
from unittest.mock import patch
import numpy as np
import pandas as pd
import pytest
from pyproj import CRS
import pyocto
def test_get_crs():
stations = pd.DataFrame(
{
"latitude": [5, 7, 8, 9, 10],
"longitude": [-20, -10, -15, -17.5, -19.2],
}
)
cr... |
0982e3e163624da1914547375ac7b71ca1570d159ca36405de140d41a35931ec | Python | 10,816 | 268 | def plot_roi(roi_img, bg_img=None, cut_coords=5, output_file=None, display_mode='mosaic', figure=None, axes=None,
title=None, annotate=True, draw_cross=True, black_bg=True, threshold=0.5, alpha=0.7,
cmap='tab10', dim='auto', vmin=None, vmax=None, resampling_interpolation='nearest', view_type='... |
13623b69b6bb002949baa29120cbfbb879bdfaaa143b7c6b3f946854be9e875f | Python | 10,816 | 248 | # 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... |
90df981e332e6b8cf34f74c695419bc4abc4f54dff105e7d1b894f2fb0ca9345 | Python | 10,821 | 280 | import h5py
import sys
import yaml
import numpy as np
import matplotlib.pyplot as plt
import os
pathpath,recfilename,regstr = sys.argv[1:]
regs_of_interest = [bla.strip() for bla in regstr.strip('[]').replace("'",'').split(',')]
recid = os.path.basename(recfilename).split('__')[0]
with open(pathpath, 'r') as myfile... |
3242e7b4d70b0dc1b4b7e5fb1417652f0f0552254b1d55c06463eb42c291776d | Python | 10,826 | 350 | """
This module implements MRI models
Author:
Zhengguo Tan <zhengguo.tan@gmail.com>
"""
import torch
import torch.jit as jit
import torch.nn as nn
from typing import Callable, Union
from deepdwi import fourier, lsqr, util
from deepdwi.dims import *
# %%
class Sense(nn.Module):
"""
Generalized sensitiv... |
01c54c37a2ab40d8bd9346875a272f45f911bddf9604994a7dbf489da1689a2a | Python | 10,827 | 271 | import os
import time
import glob
import argparse
import os.path as osp
from tqdm import tqdm
from typing import Optional, List, NamedTuple
import torch
from torch import Tensor
import torch.nn.functional as F
from torch.nn import ModuleList, Sequential, Linear, BatchNorm1d, ReLU, Dropout
from torch.optim.lr_schedule... |
cadbcf30e6389fbd370943246beea3db8f1616c1a6bcb3f22871fa33bf329988 | Python | 10,830 | 233 | # -*- coding: utf-8 -*-
"""
Created on Sat Jun 8 14:14:32 2024
@author: fmizt
"""
import pandas as pd
#from sklearn.neighbors import LocalOutlierFactor
import seaborn as sns
from matplotlib import pyplot as plt
from pyclustering.cluster.xmeans import xmeans
#from sklearn.mixture import GaussianMixture
i... |
5e2669126efd52696952ed31e12054dae405cc79485ae57995c8e4b0fd897c0d | Python | 10,835 | 209 | # Cohort report of a dmriprep batch (dmriprep bids ... group / dmriprep batch-report)
#
# <out>/batch/qc_table.tsv one row per dataset: state, run time, volumes in/out, mask volume, mean FA,
# motion, eddy outlier slices, SNR/CNR and tensor fit (when thes... |
408c711946d2dd952cc1983217a0de37eeef58959cae2ca9c3c61d81c9674eae | Python | 10,836 | 146 | """ This script investigates the capability of the CNN to correctly classify samples of rotor blades from previously
unseen values of a certain meta parameter. This version's cropping tries to avoid the radar echo to be included.
"""
import os
import argparse
from utils.env_config import setup_environment
import ti... |
ee4f31e2636a4f55b8b98f4f802e29413bfd3d79379fef127978e95c9d31f9df | Python | 10,837 | 218 | """
This script is to resample the moving image stack to the fixed image stack according to a saved transformation.
"""
import os
import SimpleITK as sitk
import loading
import skimage.io as skio
import helper
import numpy as np
import math
import resample_config as config
from skimage import draw
import glob
def prep... |
6a532601a9c2a4cb0907be0ea7d2aa9874a346aeca51237ac53df3004c31ee7d | Python | 10,838 | 288 | """
Per-joint occlusion sensitivity analysis for the pretrained Pose-JEPA encoder.
For each of the 17 COCO joints, all frames of that joint are zeroed out and the
resulting CLS embedding is compared to the unmasked embedding via L2 distance.
Large shift = the encoder is sensitive to that joint = it carries movement in... |
1faa4756225f4e95770e139f5e3cc69a2ea0b0c3512d8432d38c9b6a1cd486c7 | Python | 10,839 | 288 | '''Tests for various rules. Rules are re-implemented in a slower, less complicated way, which closely follows the
definition in the original works, which makes them easier to compare and thus less likely to be wrong.
'''
from functools import wraps, partial
from copy import deepcopy
import pytest
import torch
from zen... |
5bcedfcafc51ae4d5739c7acf87d3408bccb3855e45ed946c216c93a14a687ca | Python | 10,839 | 231 | import os, sys, gzip, math, random
import pandas as pd
import numpy as np
import argparse
import subprocess as sp
from PIL import Image
parser = argparse.ArgumentParser(description="Visualize tiles for SeqScope data")
## required parameters
parser.add_argument("--sdge", type=str, required=True, help="Input (sttools2 o... |
4f71328a81c8b808e711d94791828a5889080e903a461eba3a2eb2b4b4046783 | Python | 10,840 | 338 | from collections.abc import Callable
from typing import Any
import torch
from torch import nn
from torch.nn import functional as F
from eir.models.layers.attention_layers import SwiGLU, Transformer
from eir.models.layers.norm_layers import LayerScale
from eir.models.tensor_broker.projection_modules.sequence import (
... |
7088fef5671ebe897d1275d3c7575c9fa2fc985daafc2b4b9e5704297c562bfa | Python | 10,842 | 309 | # %%
# THIS SCRIPT REQUIRES DEPENDENCIES BUNDLED IN THE mthieu-workhorse GROUP CONDA ENV
# imports
import os
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
import cv2
import numpy as np
from PIL import Image, ImageOps
from tqdm import trange
# %%
# Argle parser
parser = ArgumentParser(
prog='m... |
8fdbf9a805334170edda146fd93e8c96ece6e702abde26256d9aeea688469817 | Python | 10,844 | 379 | """
Adapted from "The Color Blind Simulation function" by Matthew Wickline
and the Human - Computer Interaction Resource Network (http://hcirn.com/), 2000 - 2001.
"""
import numpy as np
rBlind = {
"protan": {"cpu": 0.735, "cpv": 0.265, "am": 1.273463, "ayi": -0.073894},
"deutan": {"cpu": 1.14, "cpv": -0.14, "a... |
2e94f82ebb8c9519892ee60aa5700a6bf663b9dd959ad99808cd8c1f4ff697bb | Python | 10,845 | 251 | """Test the zero-shot identification accuracy of the encoding model's in
silico neural responses for NSD-core's ID and OOD images, and for
NSD-synthetic's images.
Parameters
----------
subjects : list
List of the used NSD subjects.
data_ood_selection : str
If 'fmri', the ID/OD splits are defined based on fMRI respon... |
509b464fc76cfe29524381610cd9d7807e0234212ee3da1a0634ffeaaf154be2 | Python | 10,845 | 241 | 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 lentiMPRA
import plotting
import pandas as pd
import wandb
from wandb.integration.keras import WandbMetricsLogger
import y... |
62dac9d4d41d8c0ba9937e7dde742c4edd614368c66682187952a362c7f25ac9 | Python | 10,849 | 269 | import numpy as np
from ase.io import read, write
from ase.constraints import FixAtoms
from ase.io.vasp import read_vasp
from pymatgen.core.surface import SlabGenerator
from pymatgen.io.ase import AseAtomsAdaptor
from collections import Counter
from copy import deepcopy
from ase.data import atomic_numbers, chemical_sym... |
e51c3a125b9ed86072d4b85456aecaeffde1081a5a9686ebf6fc5b93991590e6 | Python | 10,849 | 215 | import re
from collections import defaultdict
from typing import Dict, Tuple
import numpy as np
from tqdm import tqdm
from brainscore_core.supported_data_standards.brainio.assemblies import merge_data_arrays, NeuroidAssembly, walk_coords
from brainscore_vision.model_helpers.activations.core import ActivationsExtracto... |
7da9a27f6e5596872269c3f38913f652a6273b26a10fd588d9710c94bc628030 | Python | 10,851 | 330 | """
Created on Wed Mar 25 19:31:32 2025
@author: Sophie Skriabine
"""
import os
import matplotlib
if os.environ.get("WAVEN_NO_PLOTS") == "1":
matplotlib.use("Agg", force=True)
else:
matplotlib.use("TkAgg", force=True)
import numpy as np
import matplotlib.pyplot as plt
from scipy import ndimage
import scipy.i... |
c59438ebcb2a205c0efae8fa3004811e8c9accdfe7d1ab512a70dceab6ac90c0 | Python | 10,853 | 194 | import seaborn as sns
import pandas as pd
from matplotlib.backends.backend_qt5agg import FigureCanvas
from matplotlib.figure import Figure
import matplotlib as mpl
mpl.rcParams['font.family'] = 'sans-serif'
mpl.rcParams['font.sans-serif'] = 'Arial'
mpl.rcParams['svg.fonttype'] = 'none'
from napari_dmc_brainmap.utils im... |
2131863af5444744ea4c1092b7062478eaee6b007b1c4d8b9cf2118637594950 | Python | 10,854 | 253 | import os
import numpy as np
import cv2
import torch
import yaml
from argparse import Namespace
from monai.transforms import (
Compose,
ToTensord,
ScaleIntensityd,
AsDiscrete
)
from monai.networks.nets import UNet
from torchmetrics import Dice, JaccardIndex
from monai.metrics import HausdorffDistanceMet... |
37633b99ff4111ca6a9d6c6c3d5e358381568ab7884d2e29049d2ae06f57b2ef | Python | 10,856 | 279 | from pathlib import Path
import tifffile
import numpy as np
import json
import cv2
from skimage.exposure import rescale_intensity
from typing import List, Tuple, Optional, Dict, Union
from napari.utils.notifications import show_info
def load_meta(section_dir: Path) -> Dict:
"""
Load metadata from a .tif file ... |
2f52795893d9ddb793fdc117f272c0a8c848c7376f1f5de9373706fce7281dde | Python | 10,857 | 219 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
from pathlib import Path
from typing import Any
import torch
import torch.distributed as dist
from ultralytics.data import ClassificationDataset, build_dataloader
from ultralytics.engine.validator import BaseValid... |
d09d1241fbe4fb734b3d079faa48fe548755abd57b934f8c2d8d1caa4d268060 | Python | 10,858 | 350 | import pandas as pd
import numpy as np
import bitarray as ba
from heig import utils
"""
Credits to Brendan Bulik-Sullivan and the LDSC developers for the following functions
https://github.com/bulik/ldsc
"""
def __ID_List_Factory__(
colnames, keepcol, id_dtypes, fname_end, header=None, usecols=None
):
cla... |
2b8a1c6ce07aa7b41b6d05f71a58206d1c8d22b229574e34a9fb97de1d06148a | Python | 10,859 | 313 | #############################################################################
# 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... |
7287042c40962842149aa54d7983b6f9286d8f909dd3957a3a5e022b22148e15 | Python | 10,859 | 286 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 21 22:18:07 2024
@author: costantino_ai
"""
import xarray as xr
import numpy as np
from scipy.stats import spearmanr
from brainscore_vision.benchmarks import BenchmarkBase
from brainscore_vision.benchmark_helpers.screen import place_on_screen
from ... |
45b7b8d9d2556bd2b5a9d1cbb55747262584f3ab1631718b447bcc2aa9d9a851 | Python | 10,860 | 254 | #%%
import optuna
from datetime import datetime
from pathlib import Path
import numpy as np
import os
from sklearn.model_selection import cross_val_score, StratifiedKFold
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import roc_auc_score
import xgboost as xgb
import tensorflow as tf
import ... |
06f0254cc18af62ba99d13bc83623495a5974266e4a5fb40b918ea4d18514685 | Python | 10,861 | 253 | #!/usr/bin/env python
# author: Jannes Spangenberg
# e-mail: jannes.spangenberg@uni-jena.de
# github: https://github.com/JannesSP
# website: https://jannessp.github.io
import h5py
import numpy as np
import read5_ont
import pysam
import pywt
import multiprocessing as mp
from argparse import ArgumentDefaultsHelpFormatte... |
af73045f784ed62e6f39d7c9dfcb7d1609fccd361100f853cd518170691860ad | Python | 10,864 | 347 | import json
import random
import torch
torch.manual_seed(123)
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_mult... |
3cd44fbf4bc64c1482171981253d8562abda83d84d1de0d751ee33be738a1bcb | Python | 10,867 | 254 | from pathlib import Path
import json
from typing import List, Union
import pandas as pd
from natsort import natsorted
from napari_dmc_brainmap.utils.path_utils import get_info
from napari_dmc_brainmap.utils.atlas_utils import get_bregma, coord_mm_transform
from bg_atlasapi import BrainGlobeAtlas
from napari.utils.notif... |
34ac8906b8b1e06f74cba95e9a3daff1ef399d5c4fdbb41fa73828a659026a82 | Python | 10,871 | 247 | #!/usr/bin/env python
# author: Jannes Spangenberg
# github: https://github.com/JannesSP
# website: https://jannessp.github.io
import h5py
import numpy as np
import pysam
import pywt
import multiprocessing as mp
import sys
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, Namespace
from os.path impor... |
970c769aceb0b59112eb8c70ea3e7cda20246660e9368a2d581d758d1f0e560a | Python | 10,871 | 347 | import json
import random
import torch
torch.manual_seed(123)
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_mult... |
b40c8d9f53321fa66d3806f4a8b11903df2d94713f7e3a4209b43d2d0d134fae | Python | 10,872 | 347 | import json
import random
import torch
torch.manual_seed(123)
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_mult... |
7bc191cf01638de8d568b1a8994c8a0aeab506bec78f82889366892c49b6db01 | Python | 10,873 | 256 | '''
Script to run a relatively bare preprocessing procedure for a
given subject. Essentially, this will read the raw data, set the
relevant info, apply a notch filter for line noise (and harmonics),
apply demeaning to channels, remove excessively noisy single trials
that might poorly condition the ICA, apply a bandpass... |
2cbe7492108a3b17cf793655a15a0915b37f67ec435d743c349c41b56cddc1c9 | Python | 10,879 | 347 | import json
import random
import torch
torch.manual_seed(123)
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_mult... |
6e5894f69cb8988637636a97922c04f75ec9d5f94a5eea458f2e0b5e77912a99 | Python | 10,879 | 329 | import os
import os.path
import subprocess
import tempfile
def _write_read_line(read, f_handle):
line_values = [
read.template_name,
str(read.flags_int()),
read.ref_seq_name,
str(read.start_coord),
str(read.map_quality),
read.cigar,
read.next_ref_seq_name,
... |
0beaa28de2f38879c59d5a5c1ee5b72f4906e822ae21ae4fd33ad9bdeecc6a86 | Python | 10,881 | 244 | import glob
import os
import pickle
import numpy as np
import pandas as pd
import src.config
import src.featurizer
import src.models
import src.utils
import argparse
import cmat
def train(config, dataset_path=None, **kwargs):
if dataset_path is None:
dataset_path = config.TRAIN_DATA
if type(dataset_pa... |
1434182aec67b3449a365f4e93bc11a7c8b3b474070e2e00ef6d40fa94faea92 | Python | 10,881 | 231 | 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
import plotting
import pandas as pd
import wandb
from wandb.keras import WandbMetricsLogger
import yaml
import nump... |
90ade551f6601850a4216f331abf0ffddb552b48356548f579dee6475927d654 | Python | 10,881 | 221 | '''
H3
'''
import numpy as np
import sys
def intro():
print("""
SHORT List of potential energy surfaces for H3:
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 of ... |
cffcc953b5e69ea462dd4bd143987c44ca6f5f0786b25344a79582d5ec1940e7 | Python | 10,881 | 329 | """
Tests functionality of the NiftiFileLoader
"""
import os
from test.unit.util import is_equal_np
import numpy as np
import pytest
from deepreg.dataset.loader.nifti_loader import NiftiFileLoader, load_nifti_file
def get_loader(loader_name):
if loader_name in [
"paired",
"unpaired",
"gr... |
1498c3f8fd297093c5b798359dd205f4979635a443372a2c31adfb926705c95b | Python | 10,886 | 248 | 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 DeepSTARR
import plotting
import pandas as pd
import wandb
from wandb.integration.keras import WandbMetricsLogger
import y... |
038c5b42f270310307460ff20d34c09fc02a3ded9f3b248b60972de11fbab571 | Python | 10,890 | 297 | import functools
from dataclasses import replace
from pathlib import Path
from typing import Dict, List, Optional, Tuple
import numpy as np
from magicgui import widgets
from qtpy import QtCore
from qtpy.QtGui import QImage, QPixmap
from qtpy.QtWidgets import (
QAbstractItemView,
QCheckBox,
QComboBox,
Q... |
8a3956a960b99d2bf94b0e2e5c7e6eccfc5698af446ae4583a23a010cddaa6b5 | Python | 10,893 | 342 | #!/usr/bin/env python3
"""
Fig4Sup3_pKaCalc.py
pH titrations — normalized Apo/Sat fluorescence with sigmoid fits
to calculate apparent pKa values.
Usage:
python Fig4Sup3_pKaCalc.py # Process all CSV files
python Fig4Sup3_pKaCalc.py --file "01_raw_tecan_data.csv"
python Fig4Sup3_pKaCalc.... |
f08c3129184ce5ff342b3b4375ac6485c23f3429ef6e3c68a5182d276c27e628 | Python | 10,895 | 222 | import numpy as np
import pandas as pd
import pickle as pkl
import scipy
import pathlib
import matplotlib
# matplotlib.use('Qt5Agg')
import matplotlib.pyplot as plt
from helper_functions.cell_type_lib import CellType
from helper_functions import __file__
MODULE_BASE = pathlib.Path(__file__).parent.parent
def compute_... |
3a24778984ba512f7c8ec9b85f4db772b855db39c854db8e33d682c6b2a384a2 | Python | 10,896 | 320 | # coding=utf-8
"""
Tests for deepreg/_model/network/ddf_dvf.py
"""
import itertools
from copy import deepcopy
from unittest.mock import MagicMock, patch
import pytest
from deepreg.model.network import RegistrationModel
from deepreg.registry import REGISTRY
moving_image_size = (1, 3, 5)
fixed_image_size = (2, 4, 6)
... |
1b04b121750970022a62a4dcf5a2dac1eff55592d28924feb9f45adf6f161e02 | Python | 10,899 | 246 | """ResNet variants"""
import math
import torch
import torch.nn as nn
from splat import SplAtConv2d
__all__ = ['ResNet', 'Bottleneck']
class DropBlock2D(object):
def __init__(self, *args, **kwargs):
raise NotImplementedError
class GlobalAvgPool2d(nn.Module):
def __init__(self):
... |
37dc2047b6c3f47ab09649ae4cba7ea7c28b066a1c6de7c95ca543546245f897 | Python | 10,902 | 345 | # coding=utf-8
"""
Tests for deepreg/model/layer
"""
import numpy as np
import pytest
import tensorflow as tf
import deepreg.model.layer as layer
@pytest.mark.parametrize("layer_name", ["conv3d", "deconv3d"])
@pytest.mark.parametrize("norm_name", ["batch", "layer"])
@pytest.mark.parametrize("activation", ["relu", ... |
b6844ecc3c6ec70e6bc1c7e4a26868afcee94ec2f957b92fd157161a2a999e55 | Python | 10,914 | 320 | """
This code plots heatmaps of eye gaze position on the screen.
"""
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import numpy as np
import pandas as pd
import json
import os
from concurrent.futures import ThreadPoolExecutor, as_completed
import matplotlib.pypl... |
cce9fe60b4f0aa5bfa2cc6739b84b71c31309990f861ba49969014e34c4c3365 | Python | 10,916 | 293 | '''
Quick script to aggregate results from reconstruction models
across subjects and perform statistical inference tests.
All options supported by `subject_rsa_rec.py` are
available here.
NOTE: The output report created by this script isn't
necessarily going to include the prettiest figures; it's
mostly to get a qui... |
2c8623c77621fcc2c200a4735afa6d871e8567ae1d1013d89cfe3326baea319d | Python | 10,922 | 205 | from train_gtex import *
torch.use_deterministic_algorithms(True)
"""
For evaluating Enformer on matched WGS & RNA-seq data where the individuals from the "test set" -- those that were used to test our Performer models, come from GTEx
"""
class AttrDict(dict):
"""A dictionary class that supports attribute-style ac... |
478a56bf5f210c00dafafd6ef71183f14e03cd6fc1d62f45bb82f2c192cad7a6 | Python | 10,922 | 289 | import glob
import logging
import os
import os.path as osp
import warnings
from contextlib import contextmanager
from typing import Any, Callable, Dict, List, Optional, Union
import psutil
import torch
from torch_geometric.data import HeteroData
def get_numa_nodes_cores() -> Dict[str, Any]:
"""Parses numa nodes... |
e1a0bb51482c8734ea48b273f8c2adf19c8c0d394ba26c3065a090ec259190b2 | Python | 10,924 | 327 | import importlib.util
import pytest
import numpy as np
from pydantic import ValidationError
from chemgraph.schemas.calculators.emt_calc import EMTCalc
from chemgraph.schemas.calculators.mace_calc import MaceCalc
from chemgraph.utils import calculator_defaults
from chemgraph.schemas.calculators.tblite_calc import TBLite... |
35474908b6f8ac604057829e6d18b240e7c99f226754453725575140f57ef1ef | Python | 10,926 | 322 | #############################################################################
# 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... |
76bfe9a4a6df8cf2739007c3d8b883a48ce60a2af10a924fd68eec9e1c50dcdb | Python | 10,926 | 282 | # -*- coding: utf-8 -*-
import logging
from dipy.io.stateful_tractogram import StatefulTractogram, Space, Origin
from dipy.io.utils import create_nifti_header
import numpy as np
from scilpy.io.streamlines import reconstruct_streamlines
def reconstruct_sft_from_hdf5(hdf5_handle, group_keys, space=Space.VOX,
... |
80d73b6e6bd777f5260189a995053c117acfc3e26cc1962ce42be0a747c51425 | Python | 10,928 | 260 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from __future__ import annotations
import itertools
from collections.abc import Iterator
from typing import TYPE_CHECKING, cast
import attrs
import datumaro as dm
from cvat.apps.dataset_manager import data_model as cdm
from cvat.apps.dataset_manag... |
439522acce45cc0b6ba0989261cbef8fe398067d3e01640c1442c69058b8483d | Python | 10,932 | 317 | import json
import argparse
from chemgraph.tools.ase_tools import run_ase, save_atomsdata_to_file
from chemgraph.tools.cheminformatics_tools import smiles_to_atomsdata
from chemgraph.models.ase_input import ASEInputSchema
import datetime
import subprocess
import os
def get_atomsdata_from_smiles(smiles: str) -> dict:
... |
89c261adfc694cdd16beb031b6fe7ca5b50447412d733b34a023e73ae3f462c1 | Python | 10,933 | 251 | import os
import shutil
import tempfile
from unittest import TestCase
class TestMixin(TestCase):
def setUp(self):
self.temp_dir = tempfile.mkdtemp()
def tearDown(self):
shutil.rmtree(self.temp_dir, ignore_errors=True)
@classmethod
def setUpClass(cls):
cls.maxDiff = None
... |
6926cc3f92558afad93e461dc02fd7ee417069d746992a776367ca7fca84e119 | Python | 10,934 | 247 | # Essential imports
import numpy as np
from ase.io import Trajectory
from ase.constraints import FixAtoms
from scipy.spatial import distance, cKDTree
from tqdm import tqdm
import os
import pickle # This was missing but is needed for pickle.dump operations
# Global settings
CUTOFF_VAL = 3.5 # Ce-O cutoff distance
c... |
d59a371cff1fe303ef1e41d2885752a4c0b9069054116c93492f465977c07ee7 | Python | 10,935 | 251 | import pandas as pd
import numpy as np
from brainscore_core.supported_data_standards.brainio.assemblies import BehavioralAssembly
import sympy as sp
from pandas import DataFrame
from tqdm import tqdm
import statistics
from typing import Dict
# number of distractors in the experiment
DISTRACTOR_NUMS = ["1.0", "5.0", "1... |
1f05a9ad52843ac2ff8a1f9d8ba1ad285410c857b8cf0a64d9ceac3385003aaa | Python | 10,938 | 407 | ###############################################################################
#################### Boilerplate ########################
###############################################################################
import pandas as pd
import matplotlib.pyplot as plt
import os
import matplotlib... |
d63e384bd989aab2322e0a986807296084053b204c4186d4ce1ac4927b6cab14 | Python | 10,938 | 394 | import numpy as np
import pandas as pd
import bct
def load_connectivity_matrix(
csv_file,
header=None,
index_col=None,
force_square=True,
force_symmetric=True,
zero_diagonal=True,
remove_negative=True,
dtype=np.float64,
):
"""
Load a connectivity matrix from a CSV file and clea... |
1de5c0b21f0baaa64ac7563a977e7de728af72c2870a7917fc34b693624a7ba6 | Python | 10,940 | 364 | import os
import os.path as op
import nibabel as nib
import numpy as np
from dipy.core.ndindex import ndindex
from dipy.reconst import dki, dki_micro
import AFQ.utils.models as ut
__all__ = ["fit_dki", "predict"]
def fit_dki(
data_files,
bval_files,
bvec_files,
mask=None,
min_kurtosis=-1,
m... |
76bc3cd92a57cec37fb811df8b3730f4d511d0256525c0c4ee7a657622c6e7c4 | Python | 10,940 | 309 | import re
import numpy as np
import wordvecdata
from logging import warn
from abc import ABCMeta, abstractmethod
from collections import defaultdict
from bidict import IncBidict
def uniform(shape, scale=0.05):
# TODO move to more sensible place, avoid redundancy with
# keras.initializations.uniform
retu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.