sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
2d6ee6a0a50fe3bf5e41e789f74e6be0cdb8664f7bcf57b95e7ec1b0d891753f | Python | 25,792 | 792 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
"""Plot sensor maps."""
from math import sin, cos, asin
import os
from typing import Literal, Sequence, Union
import numpy as np
import matplotlib as mpl
import matplotlib.axes
from matplotlib.lines import Line2D
from .._data_obj import Datalist, Sensor, as_sen... |
7f7e97409f51bd7c743f05edd1f289c6e1e1851c0d6ad2eabdf2f7e06df360dd | Python | 25,800 | 364 | '''
K-Folding script
author: obanmarcos
'''
import os
import os, sys
from config import *
import wandb
sys.path.append(where_am_i())
import pytorch_lightning as pl
import argparse
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from utilities import dataloading_utilities as dlutils
from utilit... |
347f028b065fcaa12cf0faecf8af96cc2dc0ca1d42dbad883b533a14860055c8 | Python | 25,845 | 528 | import pandas as pd
from torch.utils.data import Dataset, DataLoader, TensorDataset
import torch
import numpy as np
from torch.utils.data.sampler import SubsetRandomSampler, BatchSampler, SequentialSampler
import os
cwd = os.getcwd()
#training_files_path = "{}PyTorch/trainingFiles".format(cwd.split("PyTorch")[0])
tra... |
6d4e759854196b36792de43746a1074e00236f6bb03dd445342b576768341403 | Python | 25,858 | 637 | # Copyright (c) 2024 PaddleHelix Authors. All Rights Reserved.
#
# Licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0
# International License (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://creativecommo... |
fd80a9c4f5e9c92f78d010bedfe2bea0b16fbabac48a7545010b5563130cfb53 | Python | 25,866 | 463 |
__author__ = 'Aaron Gudmundson'
__email__ = 'agudmun2@jhmi.edu'
__date__ = '2022/08/01'
__version__ = '01.0.0'
__status__ = 'beta'
from scipy.optimize import minimize, curve_fit
import matplotlib.patches as mpatches # Figure Legends
import matplotlib.pyplot a... |
3dd0ebf16e4ec5f73839f61d1548f975e0c86077661d82b483f08efc03e0ef99 | Python | 25,871 | 636 | #!/usr/bin/env python3
"""
File: pic_replication.py
Created: 2023/07/17
Last Changed:
Author: M.Vochteloo
Copyright (C) 2020 University Medical Center Groningen.
A copy of the BSD 3-Clause "New" or "Revised" License can be found in the
LICENSE file in the root directory of this source tree.
"""
#... |
34c3f2c1593eeb42fba5f4d614eea95dd33e701ed1d300edd548656eaf1e2ad4 | Python | 25,879 | 602 | import pytorch_lightning as pl
import torch
import torch.nn as nn
from monai.networks.nets.basic_unet import TwoConv, Down, UpCat
from monai.networks.layers.factories import Conv
from monai.losses import DiceLoss
from survival_plus_x.models.multitask import MultitaskHead,\
multitask_metrics_from_step_outputs
from... |
e1f320739afcaf54e7f8ae698b97fc4f498f028038db8b8b3b3db887a412d974 | Python | 25,898 | 844 | # -*- coding: utf-8 -*-
"""
Plotting functions
"""
import os
import numpy as np
import pandas as pd
from sklearn import decomposition, preprocessing
import seaborn as sns
import matplotlib as mpl
import matplotlib.pyplot as plt
from cycler import cycler
from conn2res import utils
from .readout import _check_xy_type, _... |
84fa00ce165b519c0620e32b5bb7ca4c92069dfe62b7a9b5addb8e0c66cb8a9b | Python | 25,907 | 613 | #!/usr/bin/env python
"""
KneadData
KneadData is a tool designed to perform quality control on metagenomic
sequencing data, especially data from microbiome experiments. In these
experiments, samples are typically taken from a host in hopes of learning
something about the microbial community on the host. However, m... |
a055710431c2d5f9d6265a2b450ad250d46d6d502a876d984a2fcbea470e0c56 | Python | 25,935 | 522 | import numpy as np
import pandas as pd
import sys, time, datetime, os
from scipy import stats
from scipy.spatial import distance
from sklearn.preprocessing import minmax_scale
from scipy.stats import gmean
import glob
import argparse
parser = argparse.ArgumentParser(description='Detecting Spatial Variable Gene using B... |
fecfdae8b946d260539efb84455ce3b403cfc6026f19ddc5bf7d4da2f21b57ec | Python | 25,938 | 1,026 | # BASE
URL = "http://download.geofabrik.de/"
suffix = "-latest.osm.pbf"
africa_url = "africa/"
asia_url = "asia/"
australia_oceania_url = "australia-oceania/"
central_america_url = "central-america/"
europe_url = "europe/"
north_america_url = "north-america/"
south_america_url = "south-america/"
baden_wuerttemberg_url... |
8ae85b268ffb3f2864811c1b397ea2d6041f9f914377d8ca6e789759b2bd20cc | Python | 25,945 | 636 | import os.path
import shutil
import itk
import numpy as np
import pytest
from mirp.data_import.import_image import import_image
from mirp._data_import.itk_file import ImageITKFile
from mirp._data_import.dicom_file_stack import ImageDicomFileStack
from mirp._data_import.numpy_file import ImageNumpyFile
from mirp._data... |
94b339285675655b8ec5a6333bb273e89eff8c916a8d60e61eaacb734d0d9847 | Python | 25,968 | 518 | '''
Date: 09/09/22
@author: Kaan Karas & TMSi
Copyright 2021 Twente Medical Systems international B.V., Oldenzaal The Netherlands
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.apac... |
879a91d60bc3612e61d37a6fb74e440f4d8c61368c3c38b8f5f7f96bf911e26d | Python | 26,003 | 768 | import math
import os
import jax
import jax.numpy as jnp
import numpy as np
import pytest
import tensorflow as tf
from absl.testing import parameterized
from keras.src import backend
from keras.src import layers
from keras.src import metrics
from keras.src import models
from keras.src import ops
from keras.src import... |
7f49fcf6bc79bb0d7f9e148f9c85aa0310f35cb56a68dbea309fb8877145276d | Python | 26,022 | 498 | # -*- coding: utf-8 -*-
"""
Created on 19/09/2022 12:45 PM
@author: Kaan Karas
"""
import time
import PySimpleGUI as sg
import io
import os
from PIL import Image
from sys import platform
import socket
import json
class GUI:
def __init__(self):
super(GUI,self).__init__()
self... |
f61db7eae6381134170d4d391be7142868eb721681cdc56e9f83c1285eb43502 | Python | 26,022 | 736 | """
Abstract class for `core` time series.
"""
import abc
from numbers import Number
import numpy as np
from ._core_functions import (
_count,
_restrict,
_restrict_ranges,
_use_searchsorted_restrict,
_value_from,
)
from .interval_set import IntervalSet
from .time_index import TsIndex, trusted_co... |
6e718ceb544168e1510ba50164aa7adcde555bdc7cb316f41a948aec7d1254ef | Python | 26,026 | 768 | """
Stored configurations for simulations and their environments.
Defines the experiment, environment, trial, batch and evolutionary-search
configurations shipped with larvaworld.
"""
import numpy as np
from ... import reg, util, funcs
from ...param import Epoch, Odor
from importlib import import_module
from ...util... |
6f80817265d0ced199d3c2af88c46822c2be4c25138b2a099bd6ec7cbfdf645d | Python | 26,028 | 729 | # SPDX-License-Identifier: LGPL-2.1-or-later
#!/usr/bin/env python
#encoding: utf-8
from __future__ import print_function, division, absolute_import
import os
import glob
import unittest
import numpy as np
import pyEcoHAB.utils.for_loading as uf
import pyEcoHAB.utils.general as ut
from pyEcoHAB import data_path
from py... |
e2435f46597e1914c25d69117ed6d97bcde97d04192adb426e0a0edab558e8e9 | Python | 26,039 | 533 | # This has several modification relative to previous code. Namely, `Mutation` has been split out.
import pyrosetta
import re, os, csv, json
from typing import Optional, List, Dict, Union, Any, Callable, Tuple
class Mutation:
"""
A mutation is an object that has all the details of the mutation.
A variant,... |
3ac32be3297ed05d61356671d2046887e7616677f8e44ffcd3f708c1fd041939 | Python | 26,041 | 593 | """Sparse-call output binding and mutation checks."""
from __future__ import annotations
from collections.abc import Mapping
from typing import TYPE_CHECKING, Any, cast
import torch
from ._runnable_state import (
RunResourceCeiling,
)
from .errors import (
RunPreconditionError,
)
from .ir.container import (... |
c3526f9ad929f08839d40bbccafbc6dcda92c7e2535afaacd1971e7dd91dcb31 | Python | 26,043 | 667 | """Sending/Receiving Messages (Kombu integration)."""
import numbers
from collections import namedtuple
from collections.abc import Mapping
from weakref import WeakValueDictionary
from kombu import Connection, Consumer, Exchange, Producer, Queue, pools
from kombu.common import Broadcast
from kombu.utils.functional imp... |
dbbcb9ccdc346fe15a4353aa48bcf021b82664ecf2c242f95c6e868f37062622 | Python | 26,048 | 565 | """
downstream tasks: Link Prediction, Graph Reconstraction, Node Classification
each task is a Python Class
by Chengbin Hou @ 2019
"""
import random
import numpy as np
import networkx as nx
# ----------------------------------------------------------------------------------
# ------------------ link prediction task ... |
74d6115bd818e4abfcc449a4745e3214d8fcbe16048e7def6ae3faea4ddb007d | Python | 26,063 | 803 | import numpy as np
from numpy.testing import assert_array_equal, assert_array_almost_equal
import pytest
from pytest import approx
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as LDA
from sklearn.linear_model import LogisticRegression, LinearRegression
from sklearn.model_selection import (
K... |
2290020053c42246fe64a1092e5d385bfeb72cc95d02b744b69324ac33bee03d | Python | 26,101 | 709 | """
Encapsulates external dependencies to retrieve hardware metadata
"""
import math
import re
import threading
import time
from abc import ABC, abstractmethod
from dataclasses import dataclass
from subprocess import run
from typing import Dict, Iterable, List, Optional, Tuple
import psutil
from codecarbon.core.cpu ... |
b2bceba99e66ca429e67774e97b0f41d86cd96040aab56141da98fd8d1c343c5 | Python | 26,105 | 570 | import numpy as np
from numba import njit
from random import random, randint
import sys
import math
from scipy import stats
# -------------------------------------------------------------------------------------
# Utility functions.
# ------------------------------------------------------------------------------------... |
ac1bfc7057eca54dd285c66547280cd7cbdf07228638557906701ac0d875777f | Python | 26,116 | 610 | """Sequence to sequence translation models."""
from deepchem.models import TensorGraph
from deepchem.models.tensorgraph import layers
from heapq import heappush, heappushpop
import numpy as np
import tensorflow as tf
class SeqToSeq(TensorGraph):
"""Implements sequence to sequence translation models.
The model i... |
d33a1e4b32bdd875dd1da584ee415bb9f63770b0f2e9858d0163167d69cf3cb0 | Python | 26,136 | 721 | import scipy.sparse as sp
from igraph import *
from benchmark_util import *
dir_path = os.path.dirname(os.path.realpath(__file__))
def checkargs(args):
'''
check whether paramters meets requirements
'''
# TODO
return
def parse_index_file(filename):
index = []
for line in open(filename)... |
5547aafd4755b2027a53bcf1a2384ebf331d2d3ae07a06f02b848887c6f7e809 | Python | 26,146 | 568 | import math
import os
import time
import torch
import torch.nn as nn
import numpy as np;
from torch.autograd import Variable
import scipy
import matplotlib.pyplot as plt
import scipy.io as sio
from sklearn.preprocessing import normalize
from sklearn.cluster import KMeans
from sklearn.metrics import normalized_mutual_in... |
1440b8888470b388bedc4f6b02b738f302692c9f653c196ed834de22017c04bd | Python | 26,155 | 647 | from ...utils import constants
import pandas as pd
import geopandas as gpd
import numpy as np
import shapely
import pytest
from contextlib import ExitStack
from sklearn.metrics import mean_absolute_error
from ...preprocessing import detection, clustering
from ...models.sts_epr import STS_epr
from ...core.trajectorydata... |
3453daf448c1014ce8597f2feef59788628ab59d3d51ef6b82dc6b90b2dd90d7 | Python | 26,155 | 624 | import subprocess
import pkg_resources
def install_required_packages():
# List of required packages
required_packages = ['keras-preprocessing']
installed_packages = [pkg.key for pkg in pkg_resources.working_set]
missing_packages = [pkg for pkg in required_packages if pkg not in installed_packages]
... |
6d7ef0c3c9e1a6ac21cff141e6441d1ca2ba921060e5368a3df8745dbcaaf4d5 | Python | 26,159 | 714 | # ***********************************************************************
# Copyright (C) 2018-2022 Blue Brain Project
#
# This file is part of NMODL distributed under the terms of the GNU
# Lesser General Public License. See top-level LICENSE file for details.
# ********************************************************... |
266e4ad5fc1b1148b734dc55adf7bdedc28b7e50fef38b91da95187e8cf29934 | Python | 26,160 | 723 | # import scipy
import copy
import multiprocessing
from scipy import signal
from scipy.signal import lfilter_zi
import numpy as np
from scipy.stats.stats import pearsonr
import pdb
class RtFilter():
def __init__(self, *args, **kwargs):
if len(args)>0:
print(args)
if len(kwargs)>0:
... |
0cb37bbf63dd467814f2d2f8da911bf51f7895abf6f5790ad29cf48f82be43e4 | Python | 26,172 | 827 | """
Agent 2D trajectory-related plotting
"""
from __future__ import annotations
from typing import Any, Dict, Optional, Sequence, Tuple
import copy
import numpy as np
from .. import plot, reg, util, funcs
from ..util import nam
__all__: list[str] = [
"traj_1group",
"traj_grouped",
"track_annotated",
... |
adcc01ef13d0a99abb6197207e957988824d30a45e910c63378b5a73c6d6b336 | Python | 26,176 | 734 | import numpy as np
from keras.src import backend
from keras.src.api_export import keras_export
from keras.src.backend import config
from keras.src.backend.common import dtypes
from keras.src.backend.common import global_state
from keras.src.backend.common.name_scope import current_path
from keras.src.backend.common.st... |
be026b5d5fc5a683fab5796cfdc54c85e1e56257e3d47d6a494d0009e761b911 | Python | 26,178 | 919 | # Copyright 2014 Darsh Ranjan
#
# This file is part of python-plyfile.
#
# python-plyfile is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any ... |
04f428ab75b9fe9a50c22082a4c9ce8dab65fc7c3db69dcf18e63c8950fc9afc | Python | 26,188 | 719 | """
Unit tests for Authentication Middleware.
Tests HTTP authentication, rate limiting, and session management.
"""
import time
import unittest
from unittest.mock import Mock, patch
import bottle
from ethoscope_node.auth.middleware import (
AuthMiddleware,
get_current_user,
require_admin,
require_au... |
b3643be26604010e233511872d2e66c404a184c91827d6389d46763c3419d5d8 | Python | 26,207 | 725 | import itertools
import json
import os
import time
from pathlib import Path
from typing import Tuple
import matplotlib.gridspec as gridspec
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import PIL.Image
from argschema import ArgSchemaParser
from matplotlib.backends.backend_pdf import PdfPages
... |
7bb4912f4333a861ca10bb8358227b60d86bf123cf47d6be9d2b47761816fcbc | Python | 26,208 | 703 | import contextlib
import copy
import difflib
import importlib
import importlib.util
import re
import sys
import warnings
from dataclasses import dataclass, field
from typing import (
Callable,
Dict,
List,
Optional,
Sequence,
SupportsFloat,
Tuple,
Union,
overload,
)
import numpy as n... |
42d14741d746f77f1fa8ba75712b3070f7d49e1224bdb71d48d220a93753d995 | Python | 26,214 | 730 | """
Unit tests for SQLite database writers (io/sqlite.py).
Tests SQLiteResultWriter and AsyncSQLiteWriter operations including:
- Database initialization and connection
- Table creation and data insertion
- Timestamp retrieval from databases
- Error handling and resilience
- Placeholder conversion (MySQL %s to SQLite ... |
f5359042da7f9d4189376c4ae933f8fc194227ca6a2a49d43dccbbd0b9148bac | Python | 26,217 | 771 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import math
import cv2
import numpy as np
def clip_boxes_to_image(boxes, height, width):
"""
Clip the boxes with the height and width of the image size.
Args:
boxes (ndarray): bounding boxes to peform ... |
04993d278e19aa41cae7732cf2708e150a037d38a4850c425404182ead70d46a | Python | 26,225 | 742 | """
This code provides with an easy way to avoid boilerplate for training and validating results.
author: obanmarcos
"""
"""
This code provides with an easy way to avoid boilerplate for training and validating results.
author: obanmarcos
"""
import sys
sys.path.append("~/DeepOPT/")
import torch
from . import modl
#... |
3c44893df5e5ef438362f352d09d50ed63b9123ab86b46ec0cc2d691241b8d23 | Python | 26,230 | 532 | '''
Date: 23/09/22
@author: Kaan Karas & TMSi
Counts the events and at the end save them to a txt document.
TMSiSDK: Real-time filter that can be applied to incoming data
'''
import os
import sys
from .. import sample_data_server
from ..device import ChannelType
import numpy as np
import queue
from copy import deepc... |
7eda4001615d5de283ae1b1e64dcb8bd92c1bcd158fc1ca0d801f1bc813a2f3b | Python | 26,239 | 645 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Utility classes to create PyTorch ``Dataset``s from MDAnalysis trajectories.
The module provides a class :class... |
a19409fa26f99c8ae874ee5af6b07154cd9b457f2214c0e7e45a5921260b7afe | Python | 26,247 | 810 | # --- THIS FILE IS AUTO-GENERATED ---
# Modifications will be overwitten the next time code generation run.
from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType
import copy as _copy
class Slider(_BaseLayoutHierarchyType):
_parent_path_str = "layout"
_path_str... |
ce136350a5cc54651c33c1c5c110620e3177bdc34836871f19f3cbb552eee178 | Python | 26,265 | 766 | """JAX Equinox module hierarchy tests."""
from __future__ import annotations
from collections.abc import Callable
from pathlib import Path
from typing import Any
import numpy as np
import pytest
import torchlens as tl
from torchlens.backends import BackendUnsupportedError
from torchlens.intervention.errors import M... |
60b9e8634148775c4890dd668987ce7016207c08821f137b6027fd82db3047da | Python | 26,266 | 645 | #!/usr/bin/env python
"""
run_pupil_analysis.py
This script runs pupil analyses using a Session object with data generated
by the Allen Institute OpenScope experiments for the Credit Assignment Project.
Authors: Colleen Gillon
Date: October, 2018
Note: this code uses python 3.7.
"""
import argparse
import copy
... |
d279dd897a04a9a6c97642edc834c4b0fc9f55005e9266867a905a4fad9e938a | Python | 26,272 | 447 | """Собрать самодостаточную HTML-страницу проигрывателя, вшив recording.json.
Данные (base64) вшиваются в разметку программно, чтобы страница не делала
внешних запросов (строгий CSP артефакта). На выход — minimir_viewer.html.
"""
from pathlib import Path
DATA = Path("runs/recording.json").read_text()
TEMPLATE = r"""<... |
50decc5b2b2718bb8c972fb352fcae1adc02ae18b5533b4c775c42f7172fb741 | Python | 26,291 | 665 | from typing import Optional, Tuple, Union
import matplotlib as mpl
import numpy as np
import pyvista as pv
from matplotlib.colors import LinearSegmentedColormap
from pyvista import MultiBlock, Plotter, PolyData, UnstructuredGrid
try:
from typing import Literal
except ImportError:
from typing_extensions import... |
07140ecbff383cb3108100727ecb71c4105352563eabc668079c28f6cd29e322 | Python | 26,292 | 573 | import math
import os
import time
import torch
import torch.nn as nn
import numpy as np;
from torch.autograd import Variable
import scipy
import matplotlib.pyplot as plt
import scipy.io as sio
from sklearn.preprocessing import normalize
from sklearn.cluster import KMeans
from sklearn.metrics import normalized_mutual_in... |
a80502468f6c9bfb96a46eaf45cf7cb9f6ab8cc2e27f3349665dcbdc652a0ae4 | Python | 26,295 | 488 | #----------------------------------------------------------------------------------
# Code to import behavioural data
# Marta Blanco-Pozo, 2023
# Adapted from https://github.com/pyControl/code/blob/master/tools/data_import.py
#----------------------------------------------------------------------------------
import s... |
159ec0613bf8c63958cc77bdca95835c92caa2638631b648c445be4515b4b73b | Python | 26,319 | 537 | '''
Date: 23/09/22
@author: Kaan Karas & TMSi
Counts the events and at the end save them to a txt document.
TMSiSDK: Real-time filter that can be applied to incoming data
'''
import os
import sys
from .. import sample_data_server
from ..device import ChannelType
import numpy as np
import queue
from copy import deepco... |
0bd29d0bdffb7470b94ea17b2211a3dbfdccc7d7b7b2be8f70179ea24ae4eb62 | Python | 26,340 | 735 | from __future__ import print_function
__author__ = 'Joergen Kornfeld'
import socket
import subprocess
import random
import os
import re
import shutil
import glob
import matplotlib.pyplot as mplot
import numpy as np
import scipy
import scipy.stats
import io
import StringIO
import Image
import PIL.ImageOps
import imreg... |
1ec819fca7b060259e1dabf11cf9046b4fd20513b6c7e3293574bc6f9514de28 | Python | 26,342 | 635 | '''
Nipype functions and workflows to run glms in SPM12
This must be run within the docker/singularity container
'''
import numpy as np
from nipype import Node, Function, Workflow, IdentityInterface
from nipype.interfaces.io import SelectFiles, DataSink
from nipype.interfaces import spm
from nipype.algorithms.misc imp... |
c948b7be98cc9504c92b28e1a4d17b6e41b70dcb4628b51ace91a91156a2143d | Python | 26,373 | 729 | from cpuinfo import get_cpu_info
import psutil
import time
import subprocess
import re
import os
import pandas as pd
import numpy as np
import warnings
import platform
from pkg_resources import resource_stream
CONSTANT_CONSUMPTION = 100.1
FROM_WATTs_TO_kWATTh = 1000*3600
NUM_CALCULATION = 200
CPU_TABLE_NAME = resourc... |
1c2f123a66ec658558dfa8e3378feb552974298761fd33ead860413c0a0cbae0 | Python | 26,391 | 615 | import json
import pickle
from functools import partial
import mne
import os
import pandas
import pandas as pd
import numpy as np
import scipy.signal as ss
from tqdm import tqdm
from tqdm.contrib.concurrent import process_map
from mp_dip.obci_readmanager.signal_processing.read_manager import ReadManager
from scipy.s... |
43981e38e030da39787846a12b37cfafb15e9627760a299711b4fced2b17ea57 | Python | 26,395 | 667 | #from bioseq2seq.evaluate.evaluator import Evaluator
import os,re
import numpy as np
import pandas as pd
from sklearn.metrics import f1_score, matthews_corrcoef, precision_recall_curve, roc_curve, recall_score
from sklearn.metrics import precision_score, confusion_matrix, accuracy_score, roc_auc_score,average_precisio... |
6c28ca83c125a043cd9811d9a5ae1a220322eb0909ba4f60024fcacc609cc718 | Python | 26,414 | 428 |
import pandas as pd # DataFrames
import numpy as np # Arrays/LinAlg
import time as t0 # Determine Run Time
i... |
6912f3badf66f762e4f9304000a922a478d1d0c4ffa5407b6139322d90fefbb7 | Python | 26,442 | 629 | # NEW!!!!
# fast gleich wie swav_module_cifar.py, nur für LIDC angepasst
"""Adapted from official swav implementation: https://github.com/facebookresearch/swav."""
import os
from argparse import ArgumentParser
import numpy as np
import torch
from pytorch_lightning import LightningModule, Trainer
from pytorch_lightnin... |
6432f885810e3bdfd89494130c3076374252743b7d94897fd9d43d7402557b84 | Python | 26,445 | 744 | """Functions for building the input msa/template features from colabfold_search"""
import json
import pickle
import os
import copy
import pandas as pd
import numpy as np
import collections
import dataclasses
import pathlib
import gzip
import subprocess
import glob
from typing import MutableMapping, Optional, Sequence, ... |
69a45deb9ee2735f8e7add8c716c26acbe7c26fe93ddd1a249201ec175c00b1a | Python | 26,456 | 691 | import os, sys
import numpy as np
import pandas as pd
import networkx as nx
import itertools as it
import time
import multiprocessing as mp
import glob
import subprocess
from scipy.stats import mannwhitneyu
# Some code is recycled/modified from [Sahoo & Pechmann, PeerJ, 2022]
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~... |
4006539a3ae2e88b1154670533a7539cc4558f0f11004fcdf1435dd9ec5b45ab | Python | 26,461 | 846 | """
basic_analys.py
This script contains basic functions for data analysis.
Authors: Colleen Gillon
Date: January, 2021
Note: this code uses python 3.7.
"""
from sess_util import sess_gen_util
import numpy as np
from util import gen_util, math_util
TAB = " "
#############################################
de... |
be9d8d9fd70fe23c2a1e979973f8cb0713f87084b5a4a670ccdc41865338a769 | Python | 26,468 | 676 | """Lane F01 bind checkpoint: ``spec.bind(model)`` capture-free executor.
Covers the amended lane brief's bind-side surface (foldA D12 / surgery memo
3.3 items 4, 7, 8, 9 and the bind-side half of 13): the serial non-reentrant
capture-free callable, transparency, real HF ``generate`` (KV cache on/off),
``.last_report``... |
534efec86d0a2c642e784676dbd3ec69c3f0d7b8c1395fde607b934ff9bd9fd0 | Python | 26,489 | 633 | # Copyright (c) 2023, Tri Dao.
# To run the huggingface implementation of LLaMa (1), we first need to convert the weights:
# https://github.com/huggingface/transformers/pull/21955
# python -m transformers.models.llama.convert_llama_weights_to_hf --input_dir $CHECKPOINT_DIR/llama --model_size 7B --output_dir $CHECKPOIN... |
dbc8410c26c51286c09043e3832419dee8d7adbb9dfbffcf09953af6e005eb50 | Python | 26,496 | 631 | import os
import sys
import numpy as np
from tifffile import imread, imwrite
from biomedisa.features.biomedisa_helper import *
from scipy import ndimage
import numba
from numba.typed import List
@numba.jit(nopython=True)
def find_best_rotation(verts1, verts2, arr1, arr2, centroid1, centroid2, total,
best_match, be... |
d462c0fcf31bb3edc1634015aeb5d6d8eb5f113a4ff59d807e1d0cdf0c0c16f0 | Python | 26,502 | 750 | from distutils.version import LooseVersion
from logging import getLogger
import select
import sys
from threading import Thread
from time import sleep
import webbrowser
import wx
from wx.adv import TaskBarIcon, TBI_DOCK
from .._utils import IS_OSX, IS_WINDOWS
from ..plot._base import CONFIG
from .about import AboutFra... |
4e5069ce4a200f677016fa0bcfdef6ca466522bf62010350b14010c36486447e | Python | 26,555 | 615 | import numpy as np
import torch
from torch import nn
import networkx as nx
from typing import *
from functools import partial
def getBondedDistances(pdb, positions):
atom2Index = {atom.id: i for (i, atom) in enumerate(pdb.topology.atoms())}
bonds = {(atom2Index[bond[0].id], atom2Index[bond[1].id]) for bond in ... |
b54574fef6bf79b17fb3e0c72e698ad9583c29d3eea36ea37858b33901703adf | Python | 26,559 | 664 | import plotly.graph_objs as go
from _plotly_utils.basevalidators import ColorscaleValidator
from ._core import apply_default_cascade, init_figure, configure_animation_controls
from .imshow_utils import rescale_intensity, _integer_ranges, _integer_types
import narwhals.stable.v1 as nw
import numpy as np
import itertools... |
e01f55024314791b09c2bb06b4c6bd5670f5822a432fc04f3d8e613bf367eda5 | Python | 26,559 | 709 | """fast=True per-iteration faithfulness ceilings (grind B3-L1, Tier-1 #1).
The verify-once gate proves only the FIRST input settled ``verified``; every
later fast iteration runs on a different input and must re-derive the
per-input dynamic ceilings through ``_path_faithfulness`` exactly like the
ordinary provider. The... |
b8f8e06d86eacae73679963f01958cf51ccbde67fe64becd9fa177499cac355e | Python | 26,560 | 609 | import logging
from typing import Any, Dict, List, Optional, Tuple, Type
import numpy as np
import torch
import torch.nn as nn
from pytorch_lightning import LightningModule
from pytorch_lightning.utilities import rank_zero_info
from torch import Tensor, optim
from pl_bolts.models.detection.yolo.yolo_layers import Det... |
6856470c939ec97ed13f6bb5bc1e2d7f70d898f43c439c6dd0db1dac66a25cd8 | Python | 26,563 | 674 | # Copyright 2025 Google.
#
# 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 agreed to in writing, soft... |
f812857ba5ce2c6f6160e3be46f7eb0c756b6f2e9d90b3f44b428d633d6a6be5 | Python | 26,579 | 729 | import warnings
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import numpy as np
import pandas as pd
import seaborn as sns
from bdpy.fig import box_off
def makeplots(
df,
x=None, y=None,
x_list=None,
subplot=None, subplot_list=None,
figure=None, figur... |
1591a481ff962b62ace1312cd6d4a19c8fef105a6b1747c60d71feb80b53b8a8 | Python | 26,583 | 707 | import datetime
import os
#os.environ['DTORROOT'] = '/processing/Lishan/random'
import sys
import random
import json
import numpy as np
import pandas as pd
from dtor.utilities.utils import safe_restore
import torch
import torch.nn as nn
from torch.optim import SGD, Adam
from torch.utils.data import DataLoader
from torc... |
2551a786011267d5b40c3f0c08b6d21e7cfa936fc0bc83a8df50f55f334e5f89 | Python | 26,588 | 672 | import numpy as np
import pytest
from absl.testing import parameterized
from keras.src import backend
from keras.src import initializers
from keras.src import layers
from keras.src import ops
from keras.src import testing
from keras.src.backend.common import get_keras_mask
from keras.src.backend.common import set_kera... |
d8459bdcf95900d2e54b4c9fc2c5063f4396036854d8ede10b2f686b9869af08 | Python | 26,604 | 708 | import os
import numpy as np
import matplotlib.pyplot as plt
import torch
from tqdm.auto import tqdm
from tlib import ttorch, tgeo, tutils
import tjects
def load_sefas():
log_dir = tjects.utils.load_trainer(deactivate_logger=True).logger.log_dir
sefas = tutils.files.load_with_pickle(file=os.path.join(log_d... |
29604a864e19ec99fa61d3028a0fce716377501614a34377fa59c818c75047c9 | Python | 26,617 | 624 | """
dap version of diffusion.py
"""
import numpy as np
import paddle
import paddle.nn as nn
import paddle.nn.functional as F
import gc
from copy import deepcopy
from helixfold.model.diffusion import DiffusionModule, FourierEmbedding, AdaLN, ConditionedTransitionBlock, AtomPairUtil
from helixfold.model.diffusion import ... |
fa6a11bd6762faa23047e66fc251e391d5fe4cbfda46adf235e91175c31fecaf | Python | 26,618 | 706 | """
Unit tests for I/O helper classes (io/helpers.py).
Tests helper classes for periodic data collection and storage:
- SensorDataHelper: Environmental sensor data collection
- ImgSnapshotHelper: Image snapshot storage
- DAMFileHelper: DAM-compatible activity monitoring
- NpyAppendableFile: Appendable numpy file forma... |
1aefe9e7ce8e9127ec3c7bbfc04c1d6498ac10d170961354678ac578791dbc4d | Python | 26,637 | 539 | import functools
import ipaddress
from collections.abc import Iterator
from contextlib import contextmanager
from typing import (
cast,
Literal,
)
from urllib.parse import (
ParseResult,
urlparse,
)
from galaxy.exceptions import (
AuthenticationRequired,
ConfigDoesNotAllowException,
Message... |
4da7246b3f6913fb9ce7993a31be5e35a13c99326542df2438fca7b38b01557f | Python | 26,662 | 756 | import warnings
import numpy as np
from scipy.linalg import block_diag
from scipy.stats import chi2
from sklearn.covariance import oas, ledoit_wolf, fast_mcd, empirical_covariance
from .distance import distance_mahalanobis
from .test import is_square
def _lwf(X, **kwds):
"""Wrapper for sklearn ledoit wolf covar... |
d5880dee91cb2f864e62b4a1508139fcca4d62d1bbd6595fe340a596f952cd44 | Python | 26,665 | 487 | """
Runs metamer generation on all of the layers specified in build_network.py
Removes additional layers from saving to reduce the file size
You can either make a copy of this file into the directory with the build_network.py file
and run it from there directly, or specify the model directory containing the build_netw... |
81d77441a56e22299e49a2f0185ac59f4f6fa99b7e18e279cd17b655f0b18764 | Python | 26,680 | 789 | """"
This code was adapted from Niklas Wilming
"""
from pymeg import contrast_tfr
import pylab as plt
import numpy as np
import joblib
import seaborn as sns
import matplotlib
# from pymeg import atlas_glasser
import os
from joblib import Memory
memory = Memory(location='/Users/anke/Documents/MEG_study/git/__pycache_... |
cb1083b4cfdf848c47db4662525510a0d707c7f49e9bee48ef9ca3516b5ff272 | Python | 26,680 | 734 | """
MIT License
Copyright (c) 2018 Christopher Tralie and Nathaniel Saul
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy,... |
7bf2eea5957c5f6dd1a7ead88a57140e77c80412ac62703eee0770cdc345bb27 | Python | 26,681 | 862 | """Tests for block sparsity computation in flash attention."""
import pytest
import torch
from torch.nn.attention.flex_attention import create_block_mask
from mask_mod_definitions import get_mask_pair
from flash_attn.cute.compute_block_sparsity import compute_block_sparsity
def _call_compute_block_sparsity(
bat... |
87267d4b7a15b492f07351c067920110f56b9503d82ef63178f294f95acfff23 | Python | 26,684 | 747 | import socket
import threading
from unittest.mock import Mock, call
import pytest
from celery.events import Event
from celery.events.dispatcher import EventDispatcher
from celery.events.receiver import CLIENT_CLOCK_SKEW
from celery.exceptions import ImproperlyConfigured
class MockProducer:
raise_on_publish = F... |
a0b94f822469cdc0962f7f3b0ad38dc05fa045476ea33b2a0bd1ffb9640cfd46 | Python | 26,685 | 755 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
"""Video models using PyTorchVideo model builder."""
from functools import partial
import torch.nn as nn
from detectron2.layers import ROIAlign
from pytorchvideo.models.csn import create_csn
from pytorchvideo.models.head ... |
536ba2e2936a801ce04266812889ab0e381c558c5c368f4bb20f3213836c2f66 | Python | 26,691 | 806 | """Extraction-engine v2 integration tests (lane C04's row gate lives here).
The RESUME-IDENTITY rows: T-MODELSWAP (a pretrained prefix resumed with a
random-init model REFUSES typed — until this lane it completed
``status=complete``), the identity level matrix on real resumes, the strict
opaque-resume rule, completed-... |
034cc2f67db54a0f684745dc8e59f77ccfda3bebb2081ebb791254d573209377 | Python | 26,702 | 378 | '''
K-Folding script
author: obanmarcos
'''
import os
import os, sys
from config import *
import wandb
sys.path.append(where_am_i())
import lightning as pl
import argparse
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from utilities import dataloading_utilities as dlutils
from utilities.fold... |
391d394893c38245365a9b5d4af71bdafedf1739516c2d841fd69c112d19e387 | Python | 26,719 | 595 | from __future__ import annotations
import argparse
import ast
import logging
import os
import re
import sys
import warnings
from typing import Any, Optional
import minknow_api.basecaller_pb2
import minknow_api.basecaller_service
import toml
from bream4.device_interfaces.device_wrapper import create_grpc_client
from u... |
4e062f6c6e841eb46fb7e79d75dba4e390631f9492224cf996beac4513fa61a0 | Python | 26,727 | 378 | '''
K-Folding script
author: obanmarcos
'''
import os
import os, sys
from config import *
import wandb
sys.path.append(where_am_i())
import pytorch_lightning as pl
import argparse
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from utilities import dataloading_utilities as dlutils
from utilit... |
a4077dd32587fa90e40fd0205ef3506763f47e6425d84ba9963bd7226ca974f7 | Python | 26,733 | 662 | """
Unit tests for larvaworld.lib.plot.table module.
Tests table creation, formatting, and DataFrame manipulation functions
using synthetic data and mock objects.
"""
from unittest.mock import MagicMock, patch
import numpy as np
import pandas as pd
import pytest
from larvaworld.lib.plot.table import (
arrange_i... |
fbb08040194327c37e8675f9357ae7f5eabf47af38b2ba59c09c7107e8faa393 | Python | 26,779 | 616 | import sys
import types
from contextlib import contextmanager
from datetime import timedelta
from unittest.mock import Mock, call, patch
import pytest
from kombu.utils.encoding import bytes_to_str, ensure_bytes, str_to_bytes
from celery import signature, states, uuid
from celery.backends.cache import CacheBackend, Du... |
ef5af6b6576d02679990685c1b0e0246b07f177e8ec421bb4f5c78b85b2ff7c0 | Python | 26,790 | 834 | from pathlib import Path
import pytest
from pyrosm import get_data
from pyrosm.utils.download import download
@pytest.fixture
def california_highway_motorway_pbf():
filename = "california_highway_motorway.osm.pbf"
url = f"https://github.com/eracle/pyrosm-test-data/raw/refs/heads/main/{filename}"
return ... |
654f1adc462ef65a4d6669c72a2dc2f40b084d3c86f2868a9fd27badda26b318 | Python | 26,791 | 544 | import numpy as np
import pandas as pd
import sys, time, datetime, os
from scipy import stats
from scipy.spatial import distance
from sklearn.preprocessing import minmax_scale
from scipy.stats import gmean
import glob
import argparse
parser = argparse.ArgumentParser(description='Detecting Spatial Variable Gene using B... |
179feab239b18d2c95cd2434333e523ce734b2e28534eb1ab8b96eceed0316d9 | Python | 26,827 | 743 | #python libraries needed in code
import numpy as np
import matplotlib.pyplot as plt
import csv
import random
from collections import defaultdict
import multiprocessing
import time
from joblib import Parallel, delayed
from dtaidistance import dtw
#from dtaidistance.dtw_barycenter import dba
from tslearn import metrics
f... |
e91c9732b10e86dea123d22e4c8a34b93439ea57c54072f981ec94eb925d5675 | Python | 26,846 | 612 | """
Functions to create HTML report.
Copyright (C) 2021 Tham Cheng Yong
This file is part of NanoVar.
NanoVar is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at yo... |
c57f755cdaf67800fb380c57ef277690d8e07ea1f6e55019b26686e9fa931bce | Python | 26,848 | 767 | """Tests for IntervalSet of `pynapple` package."""
import warnings
from pathlib import Path
import numpy as np
import pandas as pd
import pytest
import pynapple as nap
from .helper_tests import MockArray
def test_create_iset():
start = [0, 10, 16, 25]
end = [5, 15, 20, 40]
ep = nap.IntervalSet(start=s... |
9150fa3522719a598366b534b1c9f21c1ad7d36a73e20b96967d4becf72f9c88 | Python | 26,874 | 702 | """
Unit tests for Backup API endpoints.
Tests backup system management including status aggregation from MySQL and
rsync backup services, device backup information, and caching mechanisms.
"""
import json
import time
import unittest
from unittest.mock import Mock, patch
from urllib.error import URLError
from ethosc... |
b2948f1391ebffbada75da1facfa050159bde9bf937e6f573e439f867b042625 | Python | 26,909 | 695 | import torch.nn.functional as ff
import torch as tt
from .transforms import generate_kernel
from typeguard import typechecked
from typing import Union, Dict
@typechecked
def measure_cd(
image: tt.Tensor,
reference: tt.Tensor,
reduction_channel: str = "mean",
type_output: str = "positional",
) -> Union... |
641e7671035051c6c1e1f622e4dcbfb95ccbb9fc0474bc68dd9c1879ae019ca4 | Python | 26,933 | 748 | import warnings
import numpy as np
import torch
import torch.distributed as dist
from torch.distributed.tensor import DTensor
from torch.distributed.tensor import Replicate
from torch.distributed.tensor import Shard
from torch.nn.parallel import DistributedDataParallel
from keras.src import backend
from keras.src imp... |
c897a9d328e6171b3f06384590f5c45408fdd952ea375411cc6cf61ca1684265 | Python | 26,934 | 761 | """Video Dataset"""
# Copyright (c) 2020. Lightly AG and its affiliates.
# All Rights Reserved
import os
import threading
import warnings
import weakref
from fractions import Fraction
from typing import Any, Dict, List, Tuple
import numpy as np
import torch
import torchvision
from PIL import Image
from torch.utils.d... |
ed958a5bbcdf179d7308473b906e5a9b769484ead11e2fe642697adc5cb0329d | Python | 26,955 | 743 | # SOURCE: vendored from wangyu-sd/RetroExplainer @ main
# Files: model/Embeddings.py, model/Modules.py
#
# RetroExplainer / RetroAGT (Wang et al., Nature Machine Intelligence 2023): a chemical-
# knowledge-guided molecular-assembly Transformer for retrosynthesis prediction. This module
# vendors the model's real, novel... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.