sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
709d5ecbbe43b075cfc8c9e15770ffe95f85b66f95277333471b4ed0b6924819 | Python | 6,547 | 171 | #! /usr/bin/env python
import sys
import numpy as np
import os
from iced import io
from scipy import sparse
def load_bed(filename):
'''
Load a BED file using numpy
Parameters
----------
filename : str,
path to the file to load. The file should be a bed file
Returns
------
dat... |
ab47a3f9aa9eacd03805edeaee205480ed9d8c1b9c32a890fa01774c2b7af991 | Python | 6,547 | 168 | """Investigate the post stimulus undershoot across cortical depth"""
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd
# Load data
data = pd.read_csv(f'/Users/sebastiandresbach/github/neurovascularCouplingVASO/results/ERAs_rawPlusZscored_equalizedNormalized.csv', sep=',')
... |
e739d12d36702d89c603bc0bdac8ea850d338ae3530eb1dc2e014a9f6c63bd2f | Python | 6,547 | 159 | # -*- coding: utf-8 -*-
"""
Alignment methods benchmark (pairwise ROI case).
================================================
In this tutorial, we compare various methods of alignment on a pairwise alignment
problem for Individual Brain Charting subjects. For each subject, we have a lot
of functional informations in ... |
236bdbcd6c11003351a4c21a7fa94f63fdd4eb1785a84b7cd10afc4ad18a924d | Python | 6,549 | 201 | from __future__ import division
import numpy as np
import scipy.special as special
# Import manually defined functions
from .variational_nodes import Gamma_Unobserved_Variational_Node
class AlphaW_Node(Gamma_Unobserved_Variational_Node):
def __init__(self, dim, pa, pb, qa, qb, qE=None, qlnE=None):
super(... |
8fe5bf58dbc5923f81b4729c355e57e1a268a5f6babb3fb8a4184484435457fe | Python | 6,549 | 165 | import sys
import numpy as np
import time
import os
# os.environ['CUDA_DEVICE_ORDER'] = 'PCI_BUS_ID'
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
import keras
from keras import backend as K
# from sklearn.model_selection import train_test_split
# from CNN_classifier import CNN_classifier
import json as simplejson
from t... |
6a4fa25ff98158ee24fe5c4fe262ccee443e056c2acc2d71c9a19231eae13624 | Python | 6,554 | 204 |
import pdb
from scipy.io import loadmat
import numpy as np
import torch
from data_assimilation.oracle import ObjectStorageClientWrapper
from data_assimilation.particle_filter.base import BaseForwardModel
from latent_time_stepping.utils import (
load_trained_AE_model,
load_trained_time_stepping_model
)
fro... |
a5f61f86540f7b0d77dfc5910da6e60a2cbc5d2ede1a9bd2170cb57ccbb941c7 | Python | 6,555 | 188 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
# pylint: disable=too-many-instance-attributes
"""Pre-post processing related parameters for resistive processing units."""
from dataclasses import dataclass, ... |
b55eb36e57c559db6b7eb80cb00e466dc841a3f78d72ae998e848f490b110657 | Python | 6,555 | 204 | """
Functions used to use the dentate spikes classification model.
Created on Fri Oct 20 2023
Author: Manfredi Castelli - manfredi.castelli@ndcn.ox.ac.uk
"""
# Libraries import
import numpy as np
import seaborn as sns
import utils
from scipy import stats
####### PARAMS ###############################
winL_ms = 100
... |
090ece81441d7098aaa81cbd31c6a0d9f2c8883a281114cafd5457975ba738e1 | Python | 6,556 | 153 | r"""
Single-extracellular-vesicle (single-EV) proteomics — ``ov.single.ev``.
Analyses the protein content of *individual* extracellular vesicles
(exosomes / EVs). Single-EV proteomic data is an **EV x protein matrix** —
each row an individual vesicle, each column a protein / surface-marker
target — structurally analog... |
77ee97f6cd2fad83950ce4185460d6137490ae91b0c7f86ff66279055768fdc4 | Python | 6,557 | 119 | import logging
from typing import Dict, Tuple
import numpy as np
from tensorflow.keras.utils import to_categorical
from ml4h.TensorMap import TensorMap, Interpretation
from ml4h.defines import LAX_4CH_HEART_LABELS, LAX_4CH_MYOCARDIUM_LABELS, MRI_LAX_4CH_SEGMENTED_CHANNEL_MAP, ECG_REST_MEDIAN_LEADS
from ml4h.normalize... |
7ce9190839332d851d301e769cd7cf8e40f4f1bb332f2c7195aeb8206cc48c59 | Python | 6,558 | 160 | import sys
import numpy as np
import time
import os
# os.environ['CUDA_DEVICE_ORDER'] = 'PCI_BUS_ID'
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
import keras
from keras import backend as K
# from sklearn.model_selection import train_test_split
# from CNN_classifier import CNN_classifier
import json as simplejson
from t... |
f5cb8c78f18944ecab4ec2576c22cdffc3a3e8cbf353c0c432929369981cf9e6 | Python | 6,558 | 141 | #Imports relevant modules.
import os
import shutil
import csv
import nibabel as nb
import numpy as np
#Defines the version of the pipeline being run
pipeline = '0'
#Defines the directory containing the fMRIPrep derivatives folder for this pipeline.
derivatives = '/<directory root>/fMRIPrep/Pipeline_{}/derivatives/'.f... |
fcef8b931a42c00aeece8c8458d1d786c5a2c261f4789c4bb2668d8e1acd5e0e | Python | 6,558 | 168 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon May 16 14:01:57 2022
@author: saad
"""
import numpy as np
from scipy.ndimage.filters import gaussian_filter, gaussian_filter1d
def obj_source(totalTime,timeBin_obj=10,mean_obj=10,amp_obj=2,timeBin_src = 50,mean_src=10,amp_src=5,sigma=1):
... |
3317838a5318bfe629142a9548bc78c5efb639d31725d9096de35addc7226697 | Python | 6,560 | 168 | #!/usr/bin/env python3
"""Refresh the committed intersphinx inventory snapshots.
Ray's Sphinx build resolves cross-references against roughly twenty third-party
``objects.inv`` inventories. Fetching them over the network at the start of
every build is slow and occasionally flaky (a couple go through GitHub
release-ass... |
8a5d6b6211bb123cdf735f996da8c4814b390b99d8b22c661b55d5815d94c637 | Python | 6,561 | 108 | proj_dir = "/path/to/main_project_folder/" # edit this line
import numpy as np
import random
import xarray as xr
import time
import h5py
import pandas as pd
import sys
sys.path.append(proj_dir)
from project_fxns import load_region
from project_fxns import fxns
import importlib
importlib.reload(load_region)
importlib.r... |
639759ced15087c7c5a7d6f77f8b84a9d2291071160f86ae704de667e7cd6872 | Python | 6,565 | 195 | #!/usr/bin/env python
#
# vtkplotlib documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 9 13:47:02 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# ... |
69e2dab91c47f3e5e0393ea1e7eaa25add2c32b40aca91bbcc8670ac7ba87884 | Python | 6,566 | 148 | from pathlib import Path
import yaml
from pytorch_lightning import LightningDataModule
from monai.data import CacheDataset, DataLoader
from nyumets.data.utils import get_nyumets_data, get_brats21_data
from nyumets.transforms.utils import get_nyumets_transforms, get_brats21_transforms
from nyumets.data.dataset import... |
f20081d99109f97191b4f84624185cea9c6d4a68a12db91a2615029c33fcca5b | Python | 6,567 | 159 | ####################################################################################################
# Copyright (c) 2016 - 2024, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# This program is fre... |
bdebefaf493324b76e8542fbe3d40cddfa4cfc6540eead1944c9b78d6672be15 | Python | 6,568 | 184 | # built-in dependencies
import os
from typing import Any, List, Dict, Tuple, Optional
# 3rd party dependencies
import cv2
from numpy.typing import NDArray
# project dependencies
from deepface.commons import weight_utils
from deepface.models.Detector import Detector, FacialAreaRegion
from deepface.modules.exceptions i... |
f86a47f215d9a950a507438203b38a476caae4d3c30ce7dd2e11457fb1b164de | Python | 6,571 | 197 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from __future__ import annotations
import argparse
import glob
import logging
import multiprocessing as mp
import os
import random
from pa... |
46dfeb6b23189c954de079b7ca762f9d4dd113a43dfae5f8d665cfa9dcd41fe4 | Python | 6,576 | 138 | import numpy as np
import pandas as pd
from PIL import Image
import CLEAR_perturbations
import CLEAR_regression
import CLEAR_settings
import CLEAR_image
import torch
import torch.nn as nn
from datetime import datetime
class CNN(nn.Module):
def __init__(self):
super(CNN, self).__init__()
... |
85d71a6119e534ca81449ab00218b5783be2389d2131b27f8ef5a7970271bb3b | Python | 6,576 | 190 | # -*- coding: utf-8 -*-
### ------------------------- IMPORTS ------------------------ ###
import os
import numpy as np
import pandas as pd
from train.feature_settings import metrics
### ---------------------------------------------------------- ###
class CreateCatalogue:
"""
Create parameter catalogue from b... |
294f6879797d64270ee2d5060f08d6f8d6d8d1ee4be71f9879f70d99b6c884e4 | Python | 6,579 | 190 | # Modified from https://github.com/dbolya/tide
# This work is licensed under MIT license.
from collections import defaultdict
import numpy as np
class APDataObject:
"""Stores all the information necessary to calculate the AP for one IoU and
one class.
Note: I type annotated this because why not.
"""... |
30b1dc2137fb8db627f25a60550dd646e98547a32c08be80b89cc949aa2a4d11 | Python | 6,580 | 155 | from typing import Iterator
import pyarrow as pa
import pyarrow.dataset as pds
from typing_extensions import override
from ray.data._internal.datasource_v2.common.file_reader import FileReader
from ray.data._internal.datasource_v2.common.pushdown_utils import (
_split_predicate_by_columns,
)
from ray.data._intern... |
b0b55b791ee155178d301c2fefce01281d680dd25c03d3221b70378149cf2f5f | Python | 6,580 | 200 | """
Implementing "a network with a merge and a split" in https://github.com/synsense/sinabs/issues/181
"""
import torch
import torch.nn as nn
from sinabs.activation.surrogate_gradient_fn import PeriodicExponential
from sinabs.layers import IAFSqueeze, Merge, SumPool2d
class SNN(nn.Module):
def __init__(self, ba... |
3ed4222ef022732d419111c53935acfd7bc45072bce4ec849d54cad7ce61f16f | Python | 6,581 | 152 | import os
import pandas as pd
import matplotlib.pyplot as plt
from adjustText import adjust_text
import numpy as np
annotations = ["chess", "gencode", "refseq_ucsc"]
colors = ['blue', 'red', 'green', 'cyan', 'magenta', 'olive', 'black', 'gray', 'orange', 'purple']
os.makedirs("novel_missed_together", exist_ok=True)
... |
109c0935b2ece2326943cb1b987fa0f96f6dd053bb559ef215dbbf093a03336b | Python | 6,582 | 175 | import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
from utils import parseparam, loadbin
import os
import csv
import pandas as pd
import matplotlib.colors as mcolors
import matplotlib.cm as cm
from matplotlib.colors import ListedColormap
from mpl_toolkits.axes_grid1 impor... |
bc2af49c624b5a47c1983e82505b7362b0f8daec26b4c3587faa4859de6f47d3 | Python | 6,584 | 191 | import os
import anndata
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn.preprocessing import MinMaxScaler, StandardScaler
from scipy.sparse import issparse
#### NEEDED FILES
# 1. GeneLength.txt
def counts2FPKM(counts, genelen):
genelen = pd.read_csv(genel... |
a4cdeea882efdef495bb8e686ea466179d0c39bfed009cc9220a5457b5605cb8 | Python | 6,586 | 162 | import argparse
import os
import torch
from torchvision.datasets.utils import download_url
from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, Transformer2DModel
pretrained_models = {512: "DiT-XL-2-512x512.pt", 256: "DiT-XL-2-256x256.pt"}
def download_model(model_name):
"""
Downloads a pre-tr... |
cf80cdbe812353154722ef9f611d4692f257de3548178d187d5b59373b24602a | Python | 6,588 | 165 | import sys
import numpy as np
import time
import os
# os.environ['CUDA_DEVICE_ORDER'] = 'PCI_BUS_ID'
os.environ['CUDA_VISIBLE_DEVICES'] = '1'
import keras
from keras import backend as K
# from sklearn.model_selection import train_test_split
# from CNN_classifier import CNN_classifier
import json as simplejson
from t... |
6f5544983ae621970b47061ee7ca479be6eb976319c3e48221b94c294b052491 | Python | 6,589 | 185 | from __future__ import annotations
"""Vendored gsMap latent-representation workflow for OmicVerse."""
import logging
import random
import numpy as np
import scanpy as sc
try:
import torch
_TORCH_AVAILABLE = True
except ImportError:
_TORCH_AVAILABLE = False
from sklearn.decomposition import PCA
from sklea... |
69fc2fd6c505511f6f3a06263097e96bfb0b7f37317dacd255b1baffd49328af | Python | 6,590 | 217 | import os
import time
import json
from itertools import product
import pickle as pkl
import numpy as np
import matplotlib.pyplot as plt
import torch
from torch import optim
from torch import nn
from torch.utils.data import *
import LSTM_AE
import paras
class PPMI_dataset(Dataset):
def __init__(self, path, fil... |
1ab51359474c45bab74f67808325106dcc122f18961dec88b4d5d9a7e37ec11e | Python | 6,594 | 230 | from __future__ import annotations
import base64
import io
import logging
import mimetypes
import re
import time
import uuid
from dataclasses import dataclass
from pathlib import Path
from typing import Optional, Sequence
from PIL import Image, UnidentifiedImageError
logger = logging.getLogger("omicverse.jarvis.medi... |
f94e02486bde7bb7646c61344668171c4cc6d450803cddccb481b4695bbaf6bd | Python | 6,594 | 212 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
Modified from tests/core/models/uma/test_compile.py
"""
from __future__ import annotations
import os
import random
import numpy as np
import... |
f9e28ab9683d60890afbbce94c0ecc13e17fef245f98fb51cb39ac077d012440 | Python | 6,594 | 209 | import cv2
import numpy as np
import scipy.io as scio
# 4邻域的连通域和 8邻域的连通域
# [row, col]
NEIGHBOR_HOODS_4 = True
OFFSETS_4 = [[0, -1], [-1, 0], [0, 0], [1, 0], [0, 1]]
NEIGHBOR_HOODS_8 = False
OFFSETS_8 = [[-1, -1], [0, -1], [1, -1],
[-1, 0], [0, 0], [1, 0],
[-1, 1], [0, 1], [1, 1]]
def... |
76f2458c478bf2829da04e2c707c887192f78ae3882f4a1d9af0154c0f003c62 | Python | 6,596 | 184 | # Copyright 2021 Division of Medical Image Computing, German Cancer Research Center (DKFZ)
# and Applied Computer Vision Lab, Helmholtz Imaging Platform
#
# 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 L... |
3b5b4439405e461960b092fcfd6fb4e7adb1a0ddae10964e89b0ebc4e97102e2 | Python | 6,598 | 155 | """
Script for Evaluating a Single AnnData
Parameters:
----------
- `adata_path` (str):
Full path to the AnnData you want to embed.
- `dir` (str):
Working folder where all files will be saved.
- `species` (str):
Species of the AnnData.
- `filter` (bool):
Additional gene/cell filtering on the AnnData.
-... |
9ab7bf6e654ad4da73a0e3ca807a3bc959350c8da59e039899eea25b50db012c | Python | 6,598 | 152 | ####################################################################################################
# Copyright (c) 2016 - 2024, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# This program is fre... |
b943441104216d2ea77841566b4206ab784f6974e39a99b599943de9969a6098 | Python | 6,602 | 157 | import torch
import torch.utils.data as data
import os
import pickle
from os.path import join
from sklearn.model_selection import train_test_split
import numpy as np
from glob import glob
class XY_cohort_seq(data.Dataset):
def __init__(self, cfg, tvt = 'train', seq_len = 10, epoch_num = 1260):
###
... |
c33f9a29bfbdc03384bfae6e1bd39c3bbf9e2b5f53896a886081c73927bf48da | Python | 6,608 | 165 | import sys
import numpy as np
import time
import os
# os.environ['CUDA_DEVICE_ORDER'] = 'PCI_BUS_ID'
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
import keras
from keras import backend as K
# from sklearn.model_selection import train_test_split
# from CNN_classifier import CNN_classifier
import json as simplejson
from t... |
bf3dd176e2d403e1c21f47fbea2e73a611e84ad5bcc79c3f0e050ab24f30f15f | Python | 6,614 | 180 | #!/usr/bin/env python
"""
Collect merged depth file metrics. Writes SVTYPE counts to stdout.
Note --test-hits and --baseline-hits files can be generated with bedtools intersect:
bedtools intersect -wa -u -f 0.5 -r -a ${test_bed} -b ${baseline_bed} | cut -f4 > overlap.test.list
bedtools intersect -wa -u -f 0.5... |
6373fe9c8aa27616d63d3d0f9e5e9a0c6ebf8b90a14e29501af98bcd09e12797 | Python | 6,615 | 217 | from tqdm import tqdm
import numpy as np
import torch
from torch.nn.functional import cross_entropy
from utils.mask_utils import generate_tgt_mask
from utils.data_utils import (
correct_trans_output,
convert_log_into_label
)
from utils.data_utils import eval_trans as data_eval_trans
from utils.training.ualign_... |
385b5c3babd75c222c0a35f96f519f9d3b88caede97581953ced04bad4f4146d | Python | 6,616 | 160 | import torch
from torch.utils.data import Dataset, DataLoader, SubsetRandomSampler, random_split
import torch.optim as optim
import pandas as pd
import numpy as np
import os
import random
from collections import defaultdict, Counter
from itertools import combinations
import json
import torch.nn as nn
import torch.nn.fu... |
bc48d4bb91609ee24948f0c0ef8affba6157e84459f0236d18b5c2136c483079 | Python | 6,623 | 245 | import math
import numpy as np
from functools import partial
from typing import Optional, List, Dict
from neuron_morphology.feature_extractor.marked_feature import (
MarkedFeature, marked
)
from neuron_morphology.feature_extractor.mark import (
RequiresRoot,
RequiresSoma,
RequiresRelativeSomaDepth,
... |
fd66f5edc1fe7f17586e04773059f4e0f51de39c144551b1f910bd684a9a4b70 | Python | 6,624 | 148 | """
Sample from a trained model
"""
import os
import pickle
from contextlib import nullcontext
import torch
import tiktoken
from model import GPTConfig, GPT
from tqdm import tqdm
import random
import numpy as np
from transformers import AutoTokenizer
from transformers.models.gpt2.tokenization_gpt2 import bytes_to_unico... |
feb9bd770aad22bbeb447ee854fbe0105c11e553f3c8d66cc213688762631807 | Python | 6,624 | 196 | """
2x2
top row, mean tar vs. cat response for active/passive, each neuron
bottom row:
active vs. passive d' scatter plot
delta dprime histogram
"""
import os
rdir = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
import sys
sys.path.append(rdir)
from settings import RESULTS_DIR
import numpy as np
... |
e2d5a8ed8faf58cce6f8b7bb84bbdf1896ce3e800729e3f02db5bc491862f7e2 | Python | 6,626 | 181 | import numpy as np
from typing import List, Dict, Tuple
from glob import glob
import random
from PIL import Image
from scipy.ndimage import gaussian_filter
from common import SEED
np.random.seed(SEED)
import os
os.environ['PYTHONHASHSEED']=str(SEED)
import random
random.seed(SEED)
def get_patterns(params: Dict) -> ... |
4760fa1851175ac63403d79538b3a14e22ed21cd4083ad906549f0b3f123e402 | Python | 6,627 | 199 | import sys
import argparse
import bpy
import bmesh
import mathutils
import nmv.mesh
import nmv.bmeshi
import nmv.scene
lib_path = '/projects/building/lib/python3.10/site-packages/omesh-1.0.0-py3.10-linux-x86_64.egg'
sys.path.append(lib_path)
import omesh
#############################################################... |
ade948b07ba76c4355816443e63007d0cb892ae96dac8640eb43757dc5ee4f9c | Python | 6,628 | 198 | #!/usr/bin/env python
# Copyright (c) 2017-present, Facebook, Inc.
#
# 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 a... |
a471527ddaf218fbf53cea009cdf212b44e7f1184e46b96b9166248e6478fddf | Python | 6,630 | 146 | from __future__ import annotations
import logging
import os
import joblib
import numpy as np
import pandas as pd
import scanpy as sc
from harmony import harmonize
from pynndescent import PyNNDescentTransformer
from sklearn.neighbors import KNeighborsClassifier
from sklearn.pipeline import make_pipeline
from .. impor... |
c1e1b5c7c941357436ea2cf1afaa1439e586ebd11c00788734bae28dbcd0c53f | Python | 6,632 | 184 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
"""
This script processes ML relaxations and sets it up for the next step.
- Reads final energy and structure for each relaxation
- Filters... |
61e0cedd9f4f13aad0da63a403a4a118ab1c8d0a73dae7cdf137ae4610e33422 | Python | 6,635 | 215 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING, Any, ClassVar
import ase.io
import numpy as... |
eb9f1255faf3d66b65941af24f5ad0ea890775c451f6181634897025f241de5f | Python | 6,635 | 131 | from .bioprocessor import BioProcessor
import pysolr
from bionlp.processors.utils import unique_terms
import re
import os
class GeneProcessor(BioProcessor):
def __init__(self, model_name):
super().__init__(model_name)
self.solr_url = os.getenv('SOLR_URL','http://localhost:8983/solr/')
try... |
32ebd7a83fd895bc7209ebfefe09b43b2c2462242974797881ca80caf44b8b13 | Python | 6,636 | 202 | from pathlib import Path
from datetime import datetime
import numpy as np
import matplotlib.pyplot as plt
from sklearn import metrics
from sklearn.metrics import roc_auc_score, roc_curve, accuracy_score, confusion_matrix
today = datetime.now().strftime('%Y_%m_%d')
def calculate_metrics(conf_matrix):
TP = conf_ma... |
7c9144ea75353df712de162aa936996ff2428920ef72166eccb28deae8a7ac68 | Python | 6,636 | 250 | from __future__ import annotations
"""
Security utilities for OmicVerse Skill Seeker.
Provides URL validation, hostname checks, and filesystem safety guards.
"""
import ipaddress
import re
from pathlib import Path
from typing import Optional
from urllib.parse import urlparse
class SecurityError(Exception):
"""... |
a629a6a6f6fe7448a71530eb68b43576fe46f3d227d9313aecdc1f85d3c98101 | Python | 6,636 | 120 | import hail as hl
import argparse
from gnomad.utils.vep import vep_or_lookup_vep, process_consequences
from gnomad.resources.grch38 import gnomad
YOUR_GCP_PROJECT_NAME = 'cmg-test'
hl.init(default_reference='GRCh38',spark_conf={'spark.hadoop.fs.gs.requester.pays.mode': 'AUTO',
'spark.hadoop.fs.gs.requester.pays.pro... |
38705d811d081f5657928011bd6b17ef43076374ae8e45ff212ff55f6f994ca2 | Python | 6,637 | 151 | from os import path, listdir, getcwd, remove
import inspect
import re
import shutil
from copy import deepcopy
from itertools import product
import argh
import nipype.interfaces.ants as ants
import nipype.interfaces.io as nio
import nipype.interfaces.utility as util # utility
import nipype.pipeline.engine as pe # ... |
d78e7f9d15c0b7cf058dd60169143e24159078892595fb16e57f325acfa1424f | Python | 6,637 | 227 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from __future__ import annotations
import argparse
import os
import pickle
import matplotlib.pyplot as plt
import numpy as np
from ase im... |
9591e996641c9ac31588017b0898e1fd45ce37065d866fcb6fc6f77df488a809 | Python | 6,640 | 169 | from utils import *
from sklearn.metrics.pairwise import cosine_similarity
def find_prototype(simmat, s_min = 0.1):
""" return a dict of prototypes and patterns converging on it """
# key: value = prototype_pat_id: all pat_id converging on prototype
prototypes = []
# Iterate over patterns
fo... |
6d53a9ee78a929b2dd8184988bcf87369289b0cccc3c4d6126db9ea14b5b8088 | Python | 6,641 | 164 | from utils import *
from sklearn.metrics.pairwise import cosine_similarity
def get_orthoscore(simmat, lbl):
""" ratio of mean similarity within-class and across all samples (higher ratio implies more orthogonal representations) """
same_class = np.zeros((len(lbl), len(lbl)))
for idx1 in range(len(lbl)):
... |
1f171dd6c8756cb5384620dcca3d7134f7ae6549ead359f08d17f7f1eeafdd35 | Python | 6,644 | 218 | import pickle
from collections import Counter
from multiprocessing import Pool
import tqdm
BOND_FEATURES = ["BondType", "BondDir"]
def atom_to_vocab(mol, atom):
"""
Convert atom to vocabulary. The convention is based on atom type and bond type.
:param mol: the molecular.
:param atom: the target atom... |
d9711daec9a1d4ce5c8da842c5345b6256b97e18092a974cefb4f6ff0059279d | Python | 6,644 | 140 | """ SIRV [1]
@author: Tamim Abdelaal
This function integrates two single-cell datasets, spatial and scRNA-seq, and
predicts the spliced and unspliced expression of the spatially measured genes
from the scRNA-seq data, in order to apply RNA velocity analysis.
The integration is performed using the domain adaption ... |
1b764fb09c8d33c98704c3d771d3714e03e57be1e2e1b2076776580e573dfc7b | Python | 6,648 | 168 | """Contour overlays for VTK surface plots."""
# License: BSD 3 clause
import numpy as np
import vtk
from vtk.util.numpy_support import numpy_to_vtk
def _contour_polydata(surf, values):
poly = vtk.vtkPolyData()
poly.DeepCopy(getattr(surf, 'VTKObject', surf))
values = np.asarray(values, dtype=float)
i... |
3dfe1346c5aaeaab2e22be36e32f138bd903fd083b4f59d288bcfb470238c737 | Python | 6,648 | 177 | import io
import logging
import time
from dataclasses import replace
from typing import TYPE_CHECKING, Iterator, List, Optional, Tuple, Union
import numpy as np
from ray.data._internal.delegating_block_builder import DelegatingBlockBuilder
from ray.data._internal.util import _check_import
from ray.data.block import B... |
fa906fccf775dde1663b035c17b8387973013e61ae5a2a6e129f0d1b7e2289a2 | Python | 6,649 | 155 | """
@author: Tan Nguyen & Matt Bezdek
"""
import pickle as pkl
import pandas as pd
import numpy as np
import plotly.express as px
import plotly as py
import plotly.graph_objs as go
from plotly.subplots import make_subplots
py.offline.init_notebook_mode(connected = True)
colors = ["lightseagreen", "mediumpurple", "gold... |
77d36aff8c9e05dd008467e3f89da05ba45f774f6c000841295c736d6abbd484 | Python | 6,650 | 165 | import os
import torch
import time
import argparse
from torch import nn
import numpy as np
from models.ReadCurrent import ReadCurrent
from models.LSTM import LSTM
from models.CNN_LSTM import CNN_LSTM
from models.Transformer import Transformer
from models.CNN_Transformer import CNN_Transformer
def modified_zscore(sign... |
7eef180ddcbfd5ccd99b88c762f3ccc6def7a552a5df3e5b66c29e550c05125a | Python | 6,652 | 164 | import sys
import torch
sys.path.append("../utils")
class GAT(torch.nn.Module):
def __init__(self, node_dim, n_head, pair_dim):
super().__init__()
self.node_dim = node_dim
self.n_head = n_head
self.head_dim = node_dim // n_head
# * to alpha
self.query = torch.nn... |
0e993ad83083f93e1cc8d9f6b50e6ad8fe00d16fefafdd2ba95bfa70bb23b7e6 | Python | 6,654 | 164 | from __future__ import division
from __future__ import print_function
import time
import argparse
import numpy as np
import pandas as pd
import torch
import torch.optim as optim
from sklearn.neighbors import kneighbors_graph
from utils import accuracy, normalize, get_adjs
from models import GCN
from preproce... |
14b773dd0f8c1ce9a8dbb2a927c610cbcacc4f3304624cb92774ba1fad0c96fd | Python | 6,655 | 185 | #------------------------------------------------------------------------------
# Libraries
#------------------------------------------------------------------------------
import torch
import torch.nn as nn
import torch.nn.functional as F
from collections import OrderedDict
from .base_model import BaseModel
from .Res... |
cc20edb729c9617f195b0164b3b9e23adf1e5c81b72e0e18f168b7dd8200edc2 | Python | 6,657 | 169 | ####################################################################################################
# Copyright (c) 2020 - 2024, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# This program is fre... |
d9b663f19fb3e9df8cb68eac0de5f119796d23e8d24361436c5200a1f92a8748 | Python | 6,658 | 170 | # coding=utf-8
# Copyright 2023 HuggingFace Inc.
#
# 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 applicable law or ag... |
8362cbba62ff921f70f85dc1894ff60b89c5bb5dcc4bc45d6466ca575322a1f7 | Python | 6,660 | 215 | # built-in dependencies
import os
from typing import List, Any
from enum import Enum
# 3rd party dependencies
from numpy.typing import NDArray
# project dependencies
from deepface.models.Detector import Detector, FacialAreaRegion
from deepface.commons.logger import Logger
from deepface.commons import weight_utils
lo... |
3a1413066f6ee33d45c6beee372629619566b699bf60efbb2ffdeb2bf1396980 | Python | 6,662 | 185 | import unittest
import numpy as np
import torch
import tempfile
import vamb
class TestDataLoader(unittest.TestCase):
tnfs = np.random.random((111, 103)).astype(np.float32)
rpkm = np.random.random((111, 14)).astype(np.float32)
lens = np.random.randint(2000, 5000, size=111)
def nearly_same(self, A, B):... |
e644c3e7ba9411234d91582abad6881c575c1d7ad0d79a80148ef9ca55cacce8 | Python | 6,674 | 222 | import argparse
import json
import os
import numpy as np
import torch.nn as nn
import pfrl
from pfrl import agents, experiments, explorers
from pfrl import nn as pnn
from pfrl import replay_buffers, utils
from pfrl.initializers import init_chainer_default
from pfrl.q_functions import DiscreteActionValueHead
from pfrl... |
a8d29aded894d65bcaaefe7fd2e644b98c78ea77cc254cfda34b27806023a20b | Python | 6,676 | 194 | import argparse
import logging
import os
import scipy.io as sio
import numpy as np
import torch
import torch.nn.functional as F
from PIL import Image
from torchvision import transforms
from models.FCN import FCNs,VGGNet
from models.UNet_5 import UNet
from models.UNet_3 import UNet_3
from models.segnet import SegNet
fr... |
9d6c7b1e2cac4288e9a8e3ea6aef2aacf423140e44bd1fcfcb08f476861f6799 | Python | 6,679 | 187 | from PIL import Image
import numpy as np
from ctypes import *
import torch
import torch.nn as nn
import torch.nn.functional as F
import os
import matplotlib.pyplot as plt
from dataset import OCFlowerdata, NLOSdataMNIST_PCA, NLOSdataMNIST_PCA_C
from tqdm import *
import matplotlib.pyplot as plt
from tensorboardX import ... |
d415f29c9ee7a9882fbd91d5dbe135b8048b80af040f4c40defbee9e23172c26 | Python | 6,683 | 190 | _base_ = [
'../../_base_/datasets/urpc2020/urpc2020-test-A_coco_detection.py',
'../../_base_/schedules/schedule_1x.py', '../../_base_/default_runtime.py'
]
# model settings
model = dict(
type='CascadeRCNN',
data_preprocessor=dict(
type='DetDataPreprocessor',
mean=[123.675, 116.28, 103.5... |
f0343a780babbf3317100b674c9c5084b481b8372ea715f1c69fc17dd91e4baf | Python | 6,683 | 190 | _base_ = [
'../../_base_/datasets/urpc2020/urpc2020-test-B_coco_detection.py',
'../../_base_/schedules/schedule_1x.py', '../../_base_/default_runtime.py'
]
# model settings
model = dict(
type='CascadeRCNN',
data_preprocessor=dict(
type='DetDataPreprocessor',
mean=[123.675, 116.28, 103.5... |
e69e42ea1c925e8af9f256d4750b664fd59f03986b35cc7376b88e1fd0ade5fd | Python | 6,685 | 180 | import random
from typing import Dict, List, Optional, Tuple
import torch
class StatefulLayer(torch.nn.Module):
"""A base class that instantiates buffers/states which update at every time step and provides
helper methods that manage those states.
Args:
state_names: the PyTorch buffers to initial... |
e982394abbbc8cc63dd7519a37ec50a7dc954f9d73172adcc11af8c64cbd4ec3 | Python | 6,685 | 170 | import pathlib
path = pathlib.Path.cwd()
if path.stem == 'tmb_survival':
cwd = path
else:
cwd = list(path.parents)[::-1][path.parts.index('tmb_survival')]
import sys
sys.path.append(str(cwd))
import pickle
import numpy as np
from model.model import Encoders, NN
from model.layers import Losses, Activations
from ... |
5414369d0a4e7a7086966c38234e84f852b63fdc2079f8836bb2634c291e88b0 | Python | 6,687 | 190 | _base_ = [
'../../_base_/datasets/urpc2020/urpc2020-validation_coco_detection.py',
'../../_base_/schedules/schedule_1x.py', '../../_base_/default_runtime.py'
]
# model settings
model = dict(
type='CascadeRCNN',
data_preprocessor=dict(
type='DetDataPreprocessor',
mean=[123.675, 116.28, 1... |
b75d5101bfb859abad3fb62c4804129a24c5dfbb328a98df024cf12ff914c7f4 | Python | 6,687 | 237 | """Electron Microscopy Data Bank API client."""
from typing import Dict, List, Optional, Any
from ..base import BaseAPIClient
class EMDBClient(BaseAPIClient):
"""Client for EMDB API - 3D electron microscopy structures."""
def __init__(self):
super().__init__(
base_url="https://www.eb... |
587cf306b5a9103549a3c2d286cba7348cbbb3942a3ea4f11d9a92acde6be325 | Python | 6,689 | 186 | import argparse
import os
import os.path as osp
import warnings
from mmengine.config import Config, DictAction
from mmengine.runner import Runner
from lqit.common.utils.lark_manager import (context_monitor_manager,
get_error_message,
... |
f6325da1aa33a619c11a6031741f4e4633581dcd3e12b59e5257a111e9cb886a | Python | 6,689 | 219 | # -*- coding: utf-8 -*-
"""
Created on Tue Apr 23 19:43:01 2024
@author: Leyang Xue
"""
import sys
import numpy as np
from multiprocessing import Pool
import random
import networkx as nx
# Add package path
packagepath = '../kcorePercolation' # Manually specify the path to your script
sys.path.append(packagepath)
... |
78c09c263d87af89828873b5380e72382922506e16833cc50cb55ea22b07818b | Python | 6,692 | 177 | # -*- coding: utf-8 -*-
# (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#... |
e2bbbd5fee31cf1060fbbc8545891553216616984373a48c43ed8b4650739531 | Python | 6,692 | 184 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
This submodule contains the scripts that the we used to sample the adsorption
structures.
Note that some of these scripts were taken from
[GAS... |
559593b3181a6007789d0f30950fcda3ddded0c04981c56ae7b376adf4e1107c | Python | 6,693 | 219 | # -*- coding: utf-8 -*-
"""
Created on Tue Apr 23 19:43:01 2024
@author: Leyang Xue
"""
import sys
import numpy as np
from multiprocessing import Pool
import random
import networkx as nx
# Add package path
packagepath = '../kcorePercolation' # Manually specify the path to your script
sys.path.append(packagepath)
... |
e188bbd8262da65fdb5a88586ff673b67b4eeb3cfa1855040427a10edea6dccb | Python | 6,693 | 170 | import pathlib
path = pathlib.Path.cwd()
if path.stem == 'tmb_survival':
cwd = path
else:
cwd = list(path.parents)[::-1][path.parts.index('tmb_survival')]
import sys
sys.path.append(str(cwd))
import pickle
import numpy as np
from model.model import Encoders, NN
from model.layers import Losses, Activations
from ... |
e907de2802c7419d7b7ccbd90af01999adceb6a8fead6ac35e565fbcf322f6c0 | Python | 6,693 | 140 | import cv2
import math
import tqdm
import pandas
import numpy as np
from sak.data_structures import series_to_supervised
from sak.data_structures import supervised_to_series
def predict(model, config, data, execinfo, results, results_CV2, retrain=False):
# Load best model state
# if (execinfo.state != None) ... |
47d790ff180c99e1d81015b87fb322ea6ae81be8cf282b3b0fb3c84cbb987aab | Python | 6,694 | 153 | import argparse
import ast
import os
import random
import sys
from datetime import datetime
import numpy as np
import torch
sys.path.insert(1, os.getcwd())
from datasets.COCO import COCODataset
from training.COCO import COCOTrain
def main(exp_name,
epochs=210,
batch_size=2,
num_workers=4,... |
9d0810b00fee6cca2d82b4b2efe10f10ec1a51f53696055d3cc35c812deed38d | Python | 6,694 | 163 | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from tqdm import tqdm
from ..decoder import MLPDecoder, ResMLPDecoder
from ..latent import GMVAELatentLayer
from ..objective import ReconstructionLoss
from ..utils.data import XDict
from ..encoder.transformer import TransformerEncoder... |
3706de66a0c444d595860d0d1cb4cd746056b5865ad68aa3d537f84d61d10938 | Python | 6,697 | 190 | from typing import Iterable, Optional, Union
import pandas as pd
from checkable_combo_box import CheckableComboBox
from PyQt5.QtWidgets import QTableWidgetItem, QComboBox, QCheckBox, QLineEdit, QTableWidget
from PyQt5.QtCore import Qt
def update_checkable_combo_values(combo: QComboBox, valid_values: Iterable[str],
... |
9c8152634526830fd410cc421a6c6eea81584b56526cc816cc44db5fef7167e7 | Python | 6,698 | 189 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from __future__ import annotations
import argparse
import glob
import logging
import os
import fairchem.core
"""
This script provides us... |
75754ce696f1bc6e9fb8cf9c7618ecff9e9bcaf7a09678836d37402211e89066 | Python | 6,700 | 204 | import argparse
import os.path as osp
import mmcv
import torch
from mmengine.config import Config, DictAction
from mmengine.fileio import get, load
from mmengine.registry import init_default_scope
from mmengine.structures import InstanceData
from mmengine.utils import ProgressBar
from lqit.registry import DATASETS, V... |
cc0e11be49c57f9bef3655fa431aeeb7df7defe65725ea0450bbc31edc7d1ee9 | Python | 6,700 | 189 | # optimization
# for parallelizing stuff
from multiprocessing import cpu_count
import numpy as np
from joblib import Parallel, delayed
from scipy.sparse import lil_matrix
from tqdm.notebook import tqdm
# get number of cores for multiprocessing
NUM_CORES = cpu_count()
#################################################... |
f0d5d6289d62b80efd2d140cce9ba8ea739f1d94e9165a7612e6bed739d8b300 | Python | 6,700 | 186 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
Regenerate the example input structures linked from the UMA catalysis tutorial.
These ``.xyz`` files are the **unrelaxed input geometries** th... |
e902150b3b2544cf49f6c0725c253783975ce3600c44a696aa931414ad756120 | Python | 6,702 | 188 | from imports import *
from subprocess import CalledProcessError, STDOUT
from ngs_mapper.compat import check_output
import shlex
class Base(common.BaseBamRef):
modulepath = 'ngs_mapper.graphsample'
class TestUnitHandleArgs(Base):
functionname = 'handle_args'
def _mock_args( self ):
args = Mock()
... |
0e6ab91179c7f1067f3fc57ea18e340b7425c33a9e3f3f7b8c13ebd3f22fc58d | Python | 6,707 | 137 | import torch
from torch import nn
from torch.nn.init import calculate_gain
from lop.algos.cbp_linear import call_reinit, log_features, get_layer_bound
class CBPConv(nn.Module):
def __init__(
self,
in_layer: nn.Conv2d,
out_layer: [nn.Conv2d, nn.Linear],
ln_layer: nn.... |
7b5dae179b24a0d31334c40e083d3e8b9cf1ca99ebfd75335a9ee3d6e9c47c14 | Python | 6,707 | 242 | # -*- coding: utf-8 -*-
"""
columns_and_values_tools
Copyright (C) 2022 Christopher Scott Ward
created as a component of Breathe Easy
***
Breathe Easy - an automated waveform analysis pipeline
Copyright (C) 2022
Savannah Lusk, Andersen Chang,
Avery Twitchell-Heyne, Shaun Fattig,
Christopher Scott Ward, Russell R... |
02832d26c139d77dbc9d8f2da4acd9228f182c988a89c9ce1f1760ddfef84907 | Python | 6,708 | 141 | # encoding: utf-8
r"""
This file contains connectors that were written for speed - as a general rule
they tend to use the more native pyNN or even backend specific pyNN methods.
To obtain speed they generally sacrifice ease customization.
"""
import mozaik
from mozaik.connectors import Connector
from parameters impo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.