sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
4af954ebdfdec851c7923b8fdd54ab37741d3087ad746cbb62eb94e4f1bcca87
Python
310
10
from click.testing import CliRunner from GANDLF.entrypoints.cli_tool import gandlf from GANDLF.version import __version__ def test_version_command(): runner = CliRunner() result = runner.invoke(gandlf, ["--version"]) assert result.exit_code == 0 assert __version__ in result.output
0784d211087473b88d854ac21d9a05006be7cd33fb2705ca116ac997458bb9be
Python
314
7
"""Classes modelling MEG sensor arrays""" from .base import ConstraintPenalty, SensorArray, noise_max, noise_mean from .BarbuteArray import BarbuteArray, GoldenRatioError from .BarbuteArraySL import BarbuteArraySL from .BarbuteArrayScalp import BarbuteArrayScalp from .BarbuteArraySLGrid import BarbuteArraySLGrid
6bd457e46d418e93091a55928e0625b688539292a95057628ab3983921dc2d18
Python
315
10
from ._alphanumeric import Alphanumeric from ._character import Character from .name import CropImageName from .name import ExternalImageName from .name import FileImageName from .name import GridName from .name import ImageName from .name import LabelName from .name import Name from .name import OutlineImageName
527a110ad21c067d38a604b24596fa3bc1387e3b2e1fe9b51e6f4799dc29f887
Python
316
9
from enum import Enum class SmoothingMethod(str, Enum): FIT_POLYNOMIAL = "Fit Polynomial" MEDIAN_FILTER = "Median Filter" GAUSSIAN_FILTER = "Gaussian Filter" SMOOTH_KEEPING_EDGES = "Smooth Keeping Edges" CIRCULAR_AVERAGE_FILTER = "Circular Average Filter" SM_TO_AVERAGE = "Smooth to Average"
662b613621d77b5c8847dea9d59926d6fba75ed1989c203527868050a38330ac
Python
317
16
class AminoAcid: def __init__(self, name, code, letter): self.name = name self.code = code self.letter = letter def __repr__(self): return self.name def __eq__(self, other): return self.name == other.name def __hash__(self): return hash(self.name)
6ff099ba255e4576fd80cd6f962fad9ca14a121b6887b96ed74090695588acea
Python
317
10
import numpy from deeprank.models.variant import PdbVariantSelection def __compute_target__(variant, target_group): if type(variant) != PdbVariantSelection: raise TypeError("PdbVariantSelection expected, got {}".format(type(variant))) target_group.create_dataset("target1", data=numpy.array(1.0))
93e6b47f474e0edac4438559ebd3d2abbcc627a2e3aaa101c6cc7e2ac1243180
Python
317
9
from ._file_image import FileImage from ._flex_frame_image import FlexFrameImage from ._movie_frame_image import MovieFrameImage from ._stk_frame_image import STKFrameImage from .url import ColorImage from .url import MaskImage from .url import MonochromeImage from .url import ObjectsImage from .url import URLImage
fe55dee558b8f66a5ba0f2dcd462096eb923d9af08a491fd3f5a3cbb7270ebcc
Python
318
13
import os import sys __file__ = globals()['javax.script.filename'] macro_path = os.path.dirname(__file__) sys.path.append(macro_path) from fwhm_of_spots import main from ij import IJ test_imp = IJ.openImage(os.path.join(macro_path, "test", "test_img.tif")) main(test_imp, 50,7,20, os.path.join(macro_path, "test"))
dbae3ca9b776910a9e5f7a929b1cc8282b276751322b3bfd3e7d199b7ac25aa2
Python
320
10
class IntegerPreference(object): """User interface info for an integer preference This signals that a preference should be displayed and edited as an integer, optionally limited by a range. """ def __init__(self, minval=None, maxval=None): self.minval = minval self.maxval = maxval
6a5b138785319c391182f6061db5995312f8d6b506e944a3d19bee274aaa247e
Python
321
12
from .preprocess import preprocess_pipeline, preprocess_pipeline_fixed from .dataset import PreprocessedDataset from .file_queue import FileQueue from .augment import augment_batch __all__ = [ 'preprocess_pipeline', 'preprocess_pipeline_fixed', 'PreprocessedDataset', 'FileQueue', 'augment_batch', ]...
c508ed419ea7a08579d89852a541c5e388fdf01648e47ca4f697a9062729b5b8
Python
321
25
""" test_pcrp ---------------------------------- Tests for `pcrp` module. """ import unittest from pcrp import pcrp class Testpcrp(unittest.TestCase): def setUp(self): pass def test_something(self): pass def tearDown(self): pass if __name__ == '__main__': unittest.main()...
8d18b7ee90a3e79634c14b5a71a5765e1b47b8348e5b98e98925e95625d7a731
Python
325
21
class TestCoordinates: def test_set_value(self): pass def test_get_value(self): pass def test_get_x_text(self): pass def test_get_x(self): pass def test_get_y_text(self): pass def test_get_y(self): pass def test_test_valid(self): ...
310f95dc30d2429ef9f378ca73460a963dc293d44b54acad6f18bced631518e7
Python
327
15
from unittest import TestCase import os from .timer import Timer class TestTimer(TestCase): def test_init(self): t = Timer(100) self.assertEqual(t.time_threshold,100) def test_time(self): t = Timer(10) t1 = t.start if t.is_time(): self.assertNotEqual(t.start,...
e2986a6ce43c27dd5aef0017dae95292f18fd07fdecddca823776efed89de0c0
Python
327
11
# -- coding: utf-8 -- """Methods for verification of deterministic, probabilistic and ensemble forecasts.""" from .interface import get_method from .detcatscores import * from .detcontscores import * from .ensscores import * from .plots import * from .probscores import * from .spatialscores import * from .salscores im...
9a600c1abd6a09d06b73e698c85e526cdd9c5b66cdec18c4ed4decc41758079f
Python
328
8
def test_oja(): """Test if Oja learns from a cloud""" import neurodynex3.ojas_rule.oja as oja nr_samples = 5 cloud = oja.make_cloud(n=nr_samples, ratio=1.234, angle=56.789) wcourse = oja.learn(cloud) assert wcourse.shape == (nr_samples, 2),\ "oja.learn(cloud) did not return shape=(nrSamp...
526dc6ccc19fb2fce0dc02316b2d0a60c57347ca9281e11643078709dfea8f62
Python
330
15
from setuptools import find_packages, setup setup( name="perlin-numpy", packages=find_packages(), include_package_data=True, python_requires='>=3', url="https://github.com/pvigier/perlin-numpy", author="pvigier", license="MIT", install_requires=[ "numpy>=1.15" ], zip_saf...
7127ab067fd7ec655c60bd83390c100a43675990707ca1aad9eedeca01a19d4e
Python
334
9
""" Author: Mingjian He <mh1@stanford.edu> exact_inference module contains basic dynamic programming algorithms used in SOMATA """ from .dp_func import forward_backward, baum_welch, viterbi, logdet, logdet_torch, \ kalman, djkalman, djkalman_conv_torch, inverse, inverse_torch # noqa: F401 from .em import run_em ...
cff1fd386637ee0c837f18e730761611504fcb73274c221da644895d0e9aab48
Python
334
12
# -*- coding: utf-8 -*- """ Methods for browsing data archives, reading 2d precipitation fields and writing forecasts into files. """ from .interface import get_method, discover_importers, importers_info from .archive import * from .exporters import * from .importers import * from .nowcast_importers import * from .rea...
f519675219e6853e0bcecc3d7425bdf70256e1dc4b9193556252aed1cf61d5da
Python
334
15
import numpy as np re = np.array([1e-5,1e-4,1e-3,1e-2,1e-1]) freq = 50 #freq of disc electrode omega = freq * np.pi*2 # Rotational freq nu = 1e-6 #s^-1 kinematic viscosity L = 0.51023*omega**1.5*nu**(-0.5) D = 1e-9 # m^2 s^-1, diffusion coefficients script_L = L * re**3 / D # The dimensionless form of L p...
86af8262ab32824dc8849b699a2232438db77afbf3fe50153e0f455164c0c10a
Python
335
15
from ._event import Event class PipelineLoaded(Event): """Indicates that the pipeline has been (re)loaded """ def __init__(self): super(PipelineLoaded, self).__init__( is_pipeline_modification=True, is_image_set_modification=True ) def event_type(self): return "P...
ebcfe302a91ae2785dc9407841904ee66397653ee6d355b7b67dccfb4f38a4c0
Python
337
12
from cellprofiler_core.utilities.zmq.communicable.request._request import Request class LockStatusRequest(Request): """A request for the status on some locked file uid - the unique ID stored inside the file's lock """ def __init__(self, uid, **kwargs): self.uid = uid Request.__init__...
05cea8895a6453a5722e04734a2b52d1b58e6d53138dd8818c6047d858c2fbe6
Python
338
31
from numpy import * flip=True type_ori = False w1=pi/30 w2=pi/2 xxx=arange(0,pi-w2/2,w1) xxx2=xxx+w2/2 xxx_f=arange(0,pi-w2/2,w1) xxx2_f =xxx_f +w2/2 xxx2_f = degrees(xxx2_f) xxx_uf=arange(-pi,pi,w1) xxx2_uf =xxx_uf +w2/2 xxx2_uf = degrees(xxx2_uf) if flip: xxx=xxx_f else: xxx=xxx_uf xxx2 =xxx +w2/2 xxx...
695b05c6ab6f6a16d7c2e616c70290506c84c719364bcae08a3733e7fe7999d3
Python
338
15
#!/usr/bin/env python3 """ The ciftify package uses tools from the Human Connectome Project (HCP) adapted for working with non-HCP datasets """ from . import config from . import utils from . import html from . import qc_config from . import niio from . import filenames from . import meants from . import report #from ...
454b448e63353d1c2d5f7b5f685bdae10c6ada3b1a4d0f884c48b3498409c5d2
Python
339
10
from ._do_something import DoSomething class RemoveSettingButton(DoSomething): """A button whose only purpose is to remove something from a list.""" def __init__(self, text, label, list, entry, **kwargs): super(RemoveSettingButton, self).__init__( text, label, lambda: list.remove(entry), ...
b606f2d1442d01b985881987454b0f51bbee0abaa860896030a7c6294be2b5aa
Python
339
4
from torchmeta.transforms.categorical import Categorical, FixedCategory from torchmeta.transforms.augmentations import Rotation, HorizontalFlip, VerticalFlip from torchmeta.transforms.splitters import Splitter, ClassSplitter, WeightedClassSplitter from torchmeta.transforms.target_transforms import TargetTransform, Defa...
ff98ed39e1cfd2208106cc40936f3b7a2259cfd0f6f4dba3ecbc90117a30fdd1
Python
339
13
from ..functions.image_processing import overlay_objects def overlayobjects( image, labels, opacity=0.3, max_label=None, seed=None, colormap="jet" ): return overlay_objects( image=image, labels=labels, opacity=opacity, max_label=max_label, seed=seed, colormap...
1a449679fd8b33df5cebfbc60f827d7490016f0348c8689dd848a9c3a8f33be1
Python
340
21
class TestImageSet: def test_get_image(self): pass def test_providers(self): pass def test_get_image_provider(self): pass def test_remove_image_provider(self): pass def test_clear_image(self): pass def test_names(self): pass def test_add(...
d9bb9cacb72899e18a0ac85b41e3d1bf46511bc7bac9c927f595c0d18477e2ca
Python
341
19
from .config import ( TrainerConfig, DataConfig, ModelConfig, ExperimentConfig, OptimizerConfig, ExperimentRunManager, _validate_choices, ) __all__ = [ "TrainerConfig", "DataConfig", "ModelConfig", "ExperimentConfig", "OptimizerConfig", "ExperimentRunManager", "_...
5cdb21d9b134e4ba8e7aae451382e8087212dbf0f4f09fab6e3f0637b644fe1f
Python
343
9
from .exportacquisitioncsv import export_acquisition_csv from .mcdfolder2imcfolder import mcdfolder_to_imcfolder from .ome2analysis import omefile_2_analysisfolder, omefolder_to_analysisfolder from .ome2histocat import ( omefile_to_histocatfolder, omefile_to_tifffolder, omefolder_to_histocatfolder, ) from ....
f5d1ba2e64d4207a5912f116cbafb15e3d8fb885d9a469160e4662f491275d18
Python
343
11
from ._setting import Setting class Divider(Setting): """The divider setting inserts a vertical space, possibly with a horizontal line, in the GUI""" save_to_pipeline = False def __init__(self, text="", line=True, doc=None): super(Divider, self).__init__(text, "n/a", doc=doc) self.line =...
8e040929d12d4c167473a08584a108c93af86cab10403200d75ee6c3e13364ad
Python
344
14
import numpy as np from scipy.ndimage import center_of_mass from mrHARDI.compute.math.linalg import homo_vec def center_of_mass_difference( _arr1, _arr2, _aff2to1=np.eye(4), _spacing=np.ones((3,)) ): _cm1 = center_of_mass(_arr1) _cm2in1 = (_aff2to1 @ homo_vec(center_of_mass(_arr2)))[:3] return (_cm...
a6d01a9cb416f62320407802ef1bd895b21bb2105de5deee138f2dd85d19e5ef
Python
344
19
from enum import Enum class ConversionMethod(str, Enum): COMBINE = "Combine" SPLIT = "Split" class ImageChannelType(str, Enum): RGB = "RGB" HSV = "HSV" CHANNELS = "Channels" class Channel(str, Enum): RED = "Red" GREEN = "Green" BLUE = "Blue" HUE = "Hue" SATURATION = "Saturati...
b208745ad807d33dca000f62de39fcbe983525345ba7161bbca9a8acaf8230b1
Python
345
12
class Config: def __init__(self): self.input_path = '' self.output_path = '' self.cpu_worker_num = 32 # file suffix of final url self.file_type = '_genomic.fna.gz' self.csv_col = 'urls' # times of re-downloads self.retry_times = 10 ...
77085044a3f86d6e222d06e89c0e93d917a32ad5f36c5e0305d84551f910353a
Python
347
12
from ._integer import Integer from ...._validation_error import ValidationError class OddInteger(Integer): def test_valid(self, pipeline): super(self.__class__, self).test_valid(pipeline) value = self.str_to_value(self.value_text) if value % 2 == 0: raise ValidationError("Mus...
5b1d5862e2a7bb13f46e03798fdad0594937703e3e5c9fe1137701fbbc6f4e98
Python
349
10
from pydantic import BaseModel, ConfigDict, Field from typing_extensions import Any class PostProcessingConfig(BaseModel): model_config = ConfigDict(extra="forbid", exclude_none=True) fill_holes: Any = Field(default=None) mapping: dict = Field(default=None) morphology: Any = Field(default=None) cc...
ee843e40a3642fe5f78b959e5af7cd63af6ccd298b3b04d47d5a8450384d68f7
Python
350
7
# Graphical user interface settings. update_interval = 20 # Interval between calls to the GUIs update function (ms). event_history_len = 200 # Length of event history to plot (# events). state_history_len = 100 # Length of state history to plot (# states). analog_history_dur = 12 # Duration of analog sig...
244931f55ed460f95191ed0ea20df84a9d0de5cb89a9d50f087a2cbebba59408
Python
352
13
from unittest import TestCase from .transforms import Crop import numpy as np class TestTransfroms(TestCase): def test_crop(self): xx = np.linspace(0, 1, 512) yy = np.linspace(0, 1, 512) X,Y = np.meshgrid(xx,yy) Z = X**2+Y**2 crop = Crop(100,100,50,50,graph_mode=False) ...
4f41ec2da65aa25339c8ff1c1476397037e6a0b3549dfdb15d2922e06e1d060e
Python
353
11
def secs_to_timestr(duration): dur = int(round(duration)) hours = dur // (60 * 60) rest = dur % (60 * 60) minutes = rest // 60 rest %= 60 seconds = rest minutes = ("%02d:" if hours > 0 else "%d:") % minutes hours = "%d:" % (hours,) if hours > 0 else "" seconds = "%02d" % seconds ...
5f63f5c42c3c38f1d5b9e95fac7840b9ad9acffd97b3b01a94ecef13ef839e6c
Python
353
15
from ._event import Event class PipelineCleared(Event): """Indicates that all modules have been removed from the pipeline """ def __init__(self): super(PipelineCleared, self).__init__( is_pipeline_modification=True, is_image_set_modification=True ) def event_type(self): ...
209714d9b7ff78fc492ff58b8cfe38616cafe55e24ca6a85b69700e890774771
Python
357
14
from unittest import TestCase from .csv import csv_to_dict import io def create_split_file(): # TODO: create a mock of a split.txt file. Check here: data = {'1000':'train', "1021":"val"} # this should go into a mock file that is used in the utils.csv_to_dict pass class Test(TestCase): def test_cs...
63eba759f0d84d954192ee2598ff9a946e620bbab8995e9a453eb61679afa285
Python
357
21
class TestObjectSet: def test_add_objects(self): pass def test_get_object_names(self): pass def test_get_objects(self): pass def test_all_objects(self): pass def test_get_types(self): pass def test_add_type_instance(self): pass def test_g...
d42163841ec875f770d1c9179725702be74304a62572e5eb0e2fae45d2633c0e
Python
357
11
from pydantic import BaseModel, Field from typing_extensions import Literal TYPE_OPTIONS = Literal["uniform", "label"] class PatchSamplerConfig(BaseModel): type: TYPE_OPTIONS = Field(default="uniform") enable_padding: bool = Field(default=False) padding_mode: str = Field(default="symmetric") biased_s...
d8323ac7e5a07ec9f0ae90f6df1bbd1afb4ad86d70df4d552fa32e8f7e14a256
Python
357
13
import torch.nn as nn import math class Embeddings(nn.Module): def __init__(self, d_model, vocab): super(Embeddings, self).__init__() # weight matrix, each row present one word self.lut = nn.Embedding(vocab, d_model) self.d_model = d_model def forward(self, x): return ...
1e831aa9cd246882c310aeec9a036d9c908fb3cd8784588c0dcc64a2930e29e4
Python
359
20
# Preprocessing DATA_DIR = 'EGFR' CLASS_NUM = 1 TRAIN_LIST = 'train_EGFR.csv' TEST_LIST = 'test_EGFR.csv' # Data IMAGE_HEIGHT = 320 IMAGE_WIDTH = 320 IMAGE_CHANNEL = 3 # Train BATCH_SIZE = 64 TRAIN_ITERATION = 100000 SAVE_INTERVAL = 1000 CHECKPOINT_DIR = 'resnet_50' # Test RESTORE_FROM = 'EGFR/resnet_50/model.ckpt-3...
3ce781a0f8da20e32759f34875a4b69d88092a22b90005632c9734b8379b5ff3
Python
359
11
from ..functions.image_processing import reduce_noise def reducenoise(image, patch_size, patch_distance, cutoff_distance, channel_axis=None): denoised = reduce_noise( image, patch_size=patch_size, patch_distance=patch_distance, cutoff_distance=cutoff_distance, channel_axis=c...
b0ee757032cf3a7854d03056e9aa85680ebe898ad92f86507b50d3b739f1f0a1
Python
360
11
# The same structure with the open-mmlab/mmclassification (https://github.com/open-mmlab/mmclassification) # from .inference import inference_model, init_model from .test import single_gpu_test from .train import init_random_seed, set_random_seed, train_model __all__ = [ 'set_random_seed', 'train_model', 'si...
088dbc0dcef53554f4747604e6deafd798a3f3fe1bc01727e6dc15ef1489d4a4
Python
361
5
from .utils import merge_pdfs, object_from_dict, to_categorical_np, flatten_dict from .plotting import plot_mapping_prediction, plot_mapping_predicted_contours, plot_acdc_prediction, plot_iou_histograms, plot_confmat from .inference_utils import pad_to_next_multiple_of_32, summarize_results from .pretty_print import pr...
c39e606a31a2c27e110eef1b121a1516c3a4b2fbd94d8be8ee7c977b7e1b5955
Python
362
6
from ._image_name_subscriber_multichoice import ImageNameSubscriberMultiChoice from ._measurement_multichoice import MeasurementMultiChoice from ._multichoice import MultiChoice from ._object_subscriber_multichoice import ObjectSubscriberMultiChoice from ._subdirectory_filter import SubdirectoryFilter from ._subscriber...
4aa3310d343026fd3c5fee932c6b44e9cf1b546066d6497a29cccf3f20543653
Python
363
19
from pyunicorn import Network, mpi def do_one(): net = Network.Model("BarabasiAlbert", n_nodes=100, n_links_each=10) return net.global_clustering() def master(): n = 1000 for i in range(0, n): mpi.submit_call("do_one", ()) s = 0 for i in range(0, n): s += mpi.get_next_result(...
20c46ce86f7bd25fa33d051b4f05830d4d0aa851a868eed08548da81d032af10
Python
364
21
class TestImageSetList: def test_add_provider_to_all_image_sets(self): pass def test_count(self): pass def test_get_groupings(self): pass def test_get_image_set(self): pass def test_load_state(self): pass def test_purge_image_set(self): pass ...
bbd05ae4eddada91c3297beed79fdaea384556453d421e660fe0ddbc90b87191
Python
364
15
import numpy.random from cellprofiler_core.image import GrayscaleImage from cellprofiler_core.image import Image class TestGrayscaleImage: def test_pixel_data(self): data = numpy.random.random((224, 224, 3)) image = Image(data) grayscale_image = GrayscaleImage(image) assert gra...
a091748454d20d201e93ab2a8fe3c0d966ea7c2b13dfcf9e3911f36e83c4783e
Python
365
9
from .cosine_lr import CosineLRScheduler from .multistep_lr import MultiStepLRScheduler from .plateau_lr import PlateauLRScheduler from .poly_lr import PolyLRScheduler from .step_lr import StepLRScheduler from .tanh_lr import TanhLRScheduler from .wsd_lr import WSDLRScheduler from .scheduler_factory import create_sche...
d569f01aef5bfbc0f6794428a88096b06d03b06b9d03f0523519bf3645c94abf
Python
365
15
"""Miscellaneous utility functions.""" from .arrays import * from .cleansing import * from .conversion import * from .dimension import * from .images import * from .interface import get_method from .interpolate import * from .fft import * from .pca import * from .reprojection import * from .spectral import * from .tap...
b1d36982de78b0f42bb0378a96af26e462d46dbf658f69e7a18b5ae0eb21ecd6
Python
366
16
from ._number import Number class Float(Number): """ A class that only allows floating point input """ def str_to_value(self, str_value): return float(str_value) def value_to_str(self, value): text_value = ("%f" % value).rstrip("0") if text_value.endswith("."): ...
be3f74edb92cee03830ed400e42f2a76452297fd90cd9255e922b6effa0aa8e0
Python
366
24
class TestStructuringElement: def test_get_choices(self): pass def test_get_value(self): pass def test_set_value(self): pass def test_shape(self): pass def test_shape(self): pass def test_size(self): pass def test_size(self): pass...
70fa9d71d951c04b1208938fd39601891824df2f0aab74a7f0976cd9e9362078
Python
368
15
#!/usr/bin/python import pandas as pd import numpy as np df = pd.read_csv('split.txt') print(df.describe()) VAL_LEN = 6 TEST_LEN = 23 for col in df.columns: if col != 'CASES': indices = np.random.choice(df.index,VAL_LEN+TEST_LEN,replace=False) df[col].iloc[indices[:VAL_LEN]] = 'val' df[col].i...
05c5e18bd07a39298042fb67b572f2534dc9f3a3f457e974577d4763cfb9dcf6
Python
369
17
author = "Allen Goodman" copyright = "Copyright © 2003 - 2021 Broad Institute, Inc. All rights reserved." exclude_patterns = ["build", "Thumbs.db", ".DS_Store"] extensions = ["sphinx.ext.autodoc", "sphinx_rtd_theme"] html_static_path = ["_static"] html_theme = "sphinx_rtd_theme" project = "CellProfiler-core" rel...
2af1a50f3c6c54243bbb793544f72e3dbf9cf18955e6aaeb0855a2ed4b855d8f
Python
370
10
""" Options and enums for RemoveHoles module """ # Note: RemoveHoles is a simple morphological operation module that doesn't require # complex enums. The main configuration is handled through the diameter setting # which is managed by the core framework. # Currently no custom enums needed for RemoveHoles as it uses s...
79d90fb789c045006e5e7091c80bd2989079bdf158a4f0f0e7d243a885b863b2
Python
370
10
from ...utilities.zmq.communicable.request import AnalysisRequest class MeasurementsReport(AnalysisRequest): def __init__(self, analysis_id, buf, image_set_numbers=None): AnalysisRequest.__init__( self, analysis_id, buf=buf, image_set_numbers=image_set_numbers ) if image_set_nu...
bb0e10f8002a45135e2718064c4de5f1aa890a06fc135e7a32e1ccf4955253e4
Python
371
15
import setuptools with open("README.md", "r",encoding='utf-8') as fh: long_description = fh.read() setuptools.setup( name="mlatticeabc", version="0.0.1", long_description=long_description, url="https://github.com/mlatticeabc", classifiers=[ "Programming Language :: Python :: 3.6", ...
928276cdb31709a329f537127e81b65ab8d003edb4071e2494b462f25b403ddd
Python
372
15
# -*- coding: utf-8 -*- """ Created on Wed Aug 31 23:56:04 2022 @author: Manuel """ import os in_dir = "G:/Masterarbeit/MonitRaw" out_dir = "G:/Masterarbeit/MonitRawTif" files = os.listdir(in_dir) from PIL import Image for file in files: im = Image.open(os.path.join(in_dir, file)) im.save(os.pat...
4f82009d9afbc9db63110989af65550a2a32f5f33840edd3f2f1c84b079938ea
Python
374
13
from cellprofiler_core.utilities.zmq.communicable._communicable import Communicable class Reply(Communicable): """The counterpart to a Request. All subclasses must accept keyword arguments to __init__() corresponding to their attributes. """ def __init__(self, **kwargs): # all keywords b...
ac9d5074ceb103a4562b2b2263335b151c5908441caccf7533a0846ab513cef8
Python
374
13
import matplotlib.pyplot from ._choice import Choice class Colormap(Choice): """Represents the choice of a colormap""" def __init__(self, text, value="Default", *args, **kwargs): names = matplotlib.pyplot.colormaps() names.sort() choices = ["Default"] + names super(Colormap, ...
3771fbbbd336ac151524c834df785096b39f8760a34ef6f5b6c90d2032ee6a1b
Python
376
19
# Copyright (C) 2014 SWIPO Project # # Authors (this file): # Stefan Schinkel <stefan.schinkel@gmail.com> """ Provides simple type check for resistive networks """ import numpy as np from pyunicorn import ResNetwork res = ResNetwork.SmallTestNetwork() def testAdmittiveDegreeType(): print("testing types") ...
c04b9c424bca38f15b028a414775a727c5331f8e41b83d391114ebdbf89492f5
Python
376
13
from ptsa.data import MatlabIO import os.path as osp import pytest @pytest.fixture def filename(): return osp.join(osp.dirname(__file__),'data','test_events.mat') def test_read_matlab_struct(filename): events = MatlabIO.read_single_matlab_matrix_as_numpy_structured_array(filename,'events') assert len(even...
2af376da16d242a26c085890432ca2ee19b8f27f28363320d23682ad247c6f74
Python
378
14
import pandas as pd def read(name): df = pd.read_csv(name) RSME = df['RMSE_test'].mean() SD_RMSE = df['RMSE_test'].std() R2 = df['R2_test'].mean() SD_R2 = df['R2_test'].std() print('RMSE is {}, SD of RMSE is {}\nR2 is {}, SD of R2 is {}'.format(RSME, SD_RMSE, R2, SD_R2)) read('liporesults.cs...
ae2ad77b85b9f9b20016d9799f34f1f6219fa70ad4fc411079bbb03e53312d90
Python
378
20
from enum import Enum class Scheme(str, Enum): RGB = "RGB" CMYK = "CMYK" STACK = "Stack" COMPOSITE = "Composite" LEAVE_THIS_BLACK = "Leave this black" DEFAULT_COLORS = [ "#%02x%02x%02x" % color for color in ( (255, 0, 0), (0, 255, 0), (0, 0, 255), (128, 128,...
b8ec588cf751e8df19a283ebf4c1fceae54bd38594f56da431a5a17b10ce22ee
Python
380
15
from ._event import Event class ModuleShowWindow(Event): """A module had its "show_window" state changed module - the module that had its state changed """ def __init__(self, module): super(self.__class__, self).__init__(is_pipeline_modification=True) self.module = module def ev...
5859e00a2717f5aeec3730d8d33a9919cfcd63a63e00816675130a608e264eca
Python
388
11
import re from collections import OrderedDict def get_subdict(dictionary, key=None): if dictionary is None: return None if (key is None) or (key == ''): return dictionary key_re = re.compile(r'^{0}\.(.+)'.format(re.escape(key))) return OrderedDict((key_re.sub(r'\1', k), value) for (k, v...
c128a6797d4defc8e521bfe8349af5908a1417f092408c20873d824ec4d390b8
Python
391
14
from cellprofiler_core.utilities.zmq.communicable.reply._reply import Reply class LockStatusReply(Reply): """A reply to the LockStatusRequest self.uid - the unique ID of the locked file self.locked - true if locked, false if not """ def __init__(self, uid, locked, **kwargs): Reply.__init...
2e49f1bdd2d7c2cebb87454cfb8e30d510109c19912b05db49a7e7f2798d5136
Python
392
14
from calculate_multicollinearity import * from train_models import * from evaluate_models_performance import * from evaluate_feature_importance import * from create_table_for_performance_results import * from plot_results import * calculate_multicollinearity() train_models() evaluate_models_performance() evaluate_fea...
838209756f74be7018c2e1239693edaa3fb711069b7f73c1af89bad49d354beb
Python
394
12
from setuptools import setup setup(name='neurodevsim', version='1.0.0', description='Neural Development Simulator', url='https://github.com/CNS-OIST/NeuroDevSim', author='Erik De Schutter', author_email='erik@oist.jp', license='GNU General Public License Version 3.0', packages...
8851c029602c91506d895383965bdb7bde81ad193e9f3f1701cf813623cd84c1
Python
395
17
__all__ = ['imread'] try: import osgeo.gdal as gdal except ImportError: raise ImportError("The GDAL Library could not be found. " "Please refer to http://www.gdal.org/ " "for further instructions.") def imread(fname, dtype=None): """Load an image from file. ...
cdfe8c1576082f65385607adb8cf98def049227fe2b267f8c216e78238c28b5f
Python
398
16
#%% # This script calculates accuracy of predicting the sex from head circumference, # based on the overlap between male and female head circumference distributions. from statistics import NormalDist import numpy as np # Bushby et al. 1992 standard_deviation = 1.41 delta_mean = 1.38 d = NormalDist(mu=...
8c7c174c33731912c1eaff1df3e3fe22b574f122316ad8a0a441037a315b1ec9
Python
399
10
import os import sys path = os.path.dirname(os.path.abspath(__file__)) for py in [f[:-3] for f in os.listdir(path) if f.endswith('Track.py') and f != '__init__.py']: mod = __import__('.'.join([__name__, py]), fromlist=[py]) classes = [getattr(mod, x) for x in dir(mod) if isinstance(getattr(mod, x), type)] ...
fe43f702b50814adf1deed27415f068b6a0faee3081864d26716b86d2ca018fb
Python
400
13
from monai.optimizers import WarmupCosineSchedule as WCS def warmupcosineschedule(parameters): parameters["scheduler"]["warmup_steps"] = parameters["scheduler"].get( "warmup_steps", 0.1 * parameters["num_epochs"] ) return WCS( parameters["optimizer_object"], t_total=parameters["nu...
2923e6fed2a81bafc98e3419f8c4037edcf5f64a6c2cc65a04e1cd46d7758063
Python
401
21
from cellprofiler_core.setting import Binary class TestBinary: def test_set_value(self): setting = Binary("example", "yes") setting.set_value("no") assert not setting.value def test_get_value(self): setting = Binary("example", "yes") assert setting.get_value() ...
02dbe0f028334a19ef3eaa2d481734d2a1bcc850113301e77f8d9681ae29bbe6
Python
402
7
from .dist_utils import (get_dist_info, auto_select_device, sync_random_seed, setup_multi_processes, init_dist) from .distribution import wrap_distributed_model, wrap_non_distributed_model __all__ = ['get_dist_info', 'auto_select_device', 'sync_random_seed', 'setup_multi_processes',...
05e618b586eab8e41f7857a52048c2ccb88e241dd9002563c2ec1660913b5bb6
Python
402
12
from __future__ import annotations from pathlib import Path import requests def urlretrieve(url: str, filepath: str | Path) -> None: """`requests`-based alternative to `urllib.request.urlretrieve`""" with requests.get(url, stream=True) as r: r.raise_for_status() with open(filepath, "wb") as fp...
79cf74b07d5deea8a605ddee16822e38b87ba1d3c15510aca381f69a4eda6429
Python
402
16
import numpy from ..functions.image_processing import rgb_to_greyscale, medial_axis def medialaxis(image, multichannel, volumetric): if multichannel: image = rgb_to_greyscale(image) if volumetric: data = numpy.zeros_like(image) for z, plane in enumerate(image): data[z] = ...
d58ffb8162ce9be916ed85ca39a6c460d7c6e1f2f2d80aa9a276b5747bd29c63
Python
403
12
from ._abstract_image import AbstractImage from ._callback_image import CallbackImage from ._vanilla_image import VanillaImage from .file import FileImage from .file import FlexFrameImage from .file import MovieFrameImage from .file import STKFrameImage from .file import ColorImage from .file import MaskImage from .fil...
cf1ef41afa66b14024016a41a15a0a1dab6afa011019e86270b5475d6194f4a5
Python
405
14
from .morphology import torch_morphological, fill_holes, cca from .tensor import get_mapped_label global_postprocessing_dict = { "fill_holes": fill_holes, "mapping": get_mapped_label, "morphology": torch_morphological, "cca": cca, } # append post_processing functions that are to be be applied after ...
8f5d634268cddd4532404f1dd86a4548ec4444cae3be634cf0700dd0bde9c17b
Python
406
13
from .._setting import Setting class Text(Setting): """A setting that displays as an edit box, accepting a string """ def __init__(self, text, value, *args, **kwargs): kwargs = kwargs.copy() self.multiline_display = kwargs.pop("multiline", False) self.metadata_display = kwargs.po...
890060181ef5274868798995ebd94b8454998addf1ca4eb56c9e9037dbe03096
Python
407
23
""" locCSN is python package for calculating local cell specific networks.""" from .csn import ( DISTp, which, sparsetoid, csntoflat, id_concat, idtosparse, upperlower, upperlower_dev, upperlower_soft, csn, csn_rec, csn_block, csn_loc, csn_rec_loc, csn_block_...
bc5b82bb86871a21afe65377c33a530b65174518ed9ad4ca06d0f46d288f088e
Python
407
24
class TestTreeChoice: def test_default_fn_is_leaf(self): pass def test_get_path_parts(self): pass def test_encode_path_parts(self): pass def test_get_leaves(self): pass def test_get_subnodes(self): pass def test_get_selected_leaf(self): pass ...
514bcc8c5652bdfc12c44ab04b5ba89e13da147735637f5a2b1e7ab565abaea9
Python
410
17
# -*- coding: utf-8 -*- """Add Conv Block for SDNet""" def add_downsample_conv_block( Conv, BatchNorm, in_ch=1, out_ch=1, kernel_size=3, stride=2, dilate=1, last=False ): """ Helper function """ pad = dilate if not last else 0 conv_1 = Conv( in_ch, out_ch, kernel_size, stride=stride, p...
740a621cf2faf46828c7f7aee7d0db7588941e3445315a9b67d9a067bde81a1c
Python
411
15
from .base import BaseFilter from .butterworth import ButterworthFilter from .data_chopper import DataChopper from .monopolar_to_bipolar_mapper import MonopolarToBipolarMapper from .morlet import MorletWaveletFilter from .resample import ResampleFilter __all__ = [ "BaseFilter", "ButterworthFilter", "DataCh...
cb4f159e89ebda36562e9f48c09c29a95b86af48fcf102c6f4eb13efdbf7ade1
Python
411
24
class TestObjectProcessing: def test_add_measurements(self): pass def test_create_settings(self): pass def test_display(self): pass def test_get_categories(self): pass def test_get_measurement_columns(self): pass def test_get_measurements(self): ...
0531599d3068a25d6ceecc892176936158f057023f2e76f5d916bd20a079d83b
Python
413
18
import numpy as np # Check NumPy version once NP_MAJOR_VERSION = int(np.__version__.split(".")[0]) # Set up aliases based on version if NP_MAJOR_VERSION >= 2: # NumPy 2.x aliases np_product = np.prod np_cumproduct = np.cumprod np_NaN = np.nan np_Inf = np.inf else: # NumPy 1.x aliases np_pr...
e4e7e47cb49c2af3b9fe537f463462e7f3babbc23b9ddeedb21dabf2d3138292
Python
413
19
from ._event import Event class ModuleEnabled(Event): """A module was enabled module - the module that was enabled. """ def __init__(self, module): """Constructor module - the module that was enabled """ super(self.__class__, self).__init__(is_pipeline_modification=T...
58a6014f5fb54bb9d95b9beb5c33f0f91ee967d55077358ffec5c516f2d0edc8
Python
414
16
"""Directives and roles for documenting traitlets config options. :: .. configtrait:: Application.log_datefmt Description goes here. Cross reference like this: :configtrait:`Application.log_datefmt`. """ def setup(app): app.add_object_type('configtrait', 'configtrait', objname='Config option')...
d588f727453e5948af9b9289f249ff9edc95f2a47ea5a84cc33e102452b47d4f
Python
414
19
from enum import Enum class RelabelOption(str, Enum): MERGE = "Merge" SPLIT = "Split" class MergeOption(str, Enum): UNIFY_DISTANCE = "Distance" UNIFY_PARENT = "Per-parent" class MergingMethod(str, Enum): DISCONNECTED = "Disconnected" CONVEX_HULL = "Convex hull" class ObjectIntensityMethod(st...
222cc67fc985d212b81bdc3f99adc1f36c8c94415e655932e8d1ce7f21d3a5d5
Python
417
19
from ._event import Event class ModuleDisabled(Event): """A module was disabled module - the module that was disabled. """ def __init__(self, module): """Constructor module - the module that was enabled """ super(self.__class__, self).__init__(is_pipeline_modificatio...
b4b2fb51a454a775617ce264e868f1e2fde71b9cca6e964fa485be2e8037b2fc
Python
420
17
from ._event import Event class LoadException(Event): """An exception was caught during pipeline loading """ def __init__(self, error, module, module_name=None, settings=None): self.error = error self.cancel_run = True self.module = module self.module_name = module_name ...
68f28ff7a7c46a642e2467cc41c033207d140c67a40a3d530ccee8b1e0d7f18c
Python
422
10
def test_runnable_get_trajectory(): """Test if get_trajectory is runnable.""" from neurodynex3.phase_plane_analysis.fitzhugh_nagumo import get_trajectory get_trajectory(v0=1., w0=2., I_ext=3., eps=0.4, a=5.0, tend=1.234) def test_runnable_get_fixed_point(): """Test if get_fixed_point is runnable.""" ...
e6e1679e94864243c29e9fc71c37219fc169c111450a4df81091ca001bd11659
Python
422
16
import numpy as np from numba import njit @njit def generate_design_matrix(batch_size, T): """ Generates an experimenmt wiht a random sequence of 4 conditions. """ obs_per_condition = int(T / 4) context = np.zeros((batch_size, T), dtype=np.int32) x = np.repeat([0, 1, 2, 3], obs_per_condition) ...
78807bbccba38e67cebdb0413be82e0edf7a2407741436f43dae179fb8f40697
Python
426
20
import numpy as np import pandas as pd def normalize(data, new_min=0, new_max=1 ): old_range = data.max() - data.min() new_range = new_max - new_min new_data = (((data - data.min()) * new_range) / old_range) + new_min return new_data # a = (v...
aa76617a7d36d3f96bdc54fb860d047a0b18c6600a302d1e9ffceeba0b64119c
Python
429
7
# lots of uses of these functions directly, ala 'import timm.optim.optim_factory as optim_factory', fun :/ from ._optim_factory import create_optimizer, create_optimizer_v2, optimizer_kwargs from ._param_groups import param_groups_layer_decay, param_groups_weight_decay, group_parameters, _layer_map, _group import war...
758145ef0aa369e3335654d651e8957d7d44844e8fae1042cc49c8aacf89fd69
Python
430
17
from ._event import Event class ModuleAdded(Event): """A module was added to the pipeline """ def __init__(self, module_num, is_image_set_modification=False): super(ModuleAdded, self).__init__( is_pipeline_modification=True, is_image_set_modification=is_image_set_modifica...
e23d57a9745fb9a2eaf3ce548102eb89602b973cdc37ec284e057aa44db4b8c5
Python
431
17
import os import sys def run_nose(): """Runs nose tests, used mainly for anaconda deployment""" import nose nose_argv = sys.argv nose_argv += ["--detailed-errors", "--exe", "-v"] initial_dir = os.getcwd() package_file = os.path.abspath(__file__) package_dir = os.path.dirname(package_file) ...