repo_name stringlengths 7 65 | path stringlengths 5 185 | copies stringlengths 1 4 | size stringlengths 4 6 | content stringlengths 977 990k | license stringclasses 14
values | hash stringlengths 32 32 | line_mean float64 7.18 99.4 | line_max int64 31 999 | alpha_frac float64 0.25 0.95 | ratio float64 1.5 7.84 | autogenerated bool 1
class | config_or_test bool 2
classes | has_no_keywords bool 2
classes | has_few_assignments bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sergiocorreia/panflute | panflute/base.py | 1 | 8673 | """
Base classes and methods of all Pandoc elements
"""
# ---------------------------
# Imports
# ---------------------------
from operator import attrgetter
from collections.abc import MutableSequence, MutableMapping
from .containers import ListContainer, DictContainer
from .utils import check_type, encode_dict # ... | bsd-3-clause | 88d233e663f8adbe629cade678cffd3e | 28.5 | 124 | 0.531189 | 4.484488 | false | false | false | false |
morepath/morepath | morepath/tests/test_predicates.py | 1 | 1348 | from morepath.app import App
from webtest import TestApp as Client
import morepath
from reg import KeyIndex
def test_view_predicates():
class app(App):
pass
@app.path(path="")
class Root:
pass
@app.view(model=Root, name="foo", request_method="GET")
def get(self, request):
... | bsd-3-clause | 09d0ef727a506341014df61aaa81d039 | 20.0625 | 60 | 0.568991 | 3.42132 | false | true | false | false |
morepath/morepath | morepath/predicate.py | 1 | 4328 | """
The :meth:`morepath.App.predicate` directive lets you install predicates
for function that use :func:`reg.dispatch_method`. This is
used by :mod:`morepath.core` to install the view predicates, and you can
also use it for your own functions.
This implements the functionality that drives Reg to install these
predica... | bsd-3-clause | 0e9cfceb537cb828fcec49f6f77defd2 | 32.292308 | 76 | 0.65134 | 4.536688 | false | false | false | false |
scikit-hep/root_numpy | examples/core/plot_bootstrap.py | 3 | 2604 | #!/usr/bin/env python
"""
============================
Bootstrap a TTree with NumPy
============================
This example demonstrates how to sample entries in a TTree with replacement
with the help of NumPy and root_numpy. This example depends on
`rootpy <http://www.rootpy.org/>`_ which can be installed with pip:... | bsd-3-clause | 2826b7b72f7be9df63d2e2c4e0d7e51c | 28.258427 | 86 | 0.679339 | 3.304569 | false | false | false | false |
flutter/buildroot | build/linux/unbundle/replace_gyp_files.py | 1 | 2938 | #!/usr/bin/env python3
#
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Replaces gyp files in tree with files from here that
make the build use system libraries.
"""
import optparse
import os.path
i... | bsd-3-clause | bf8368a7feb743986b00e72b3402d021 | 34.39759 | 78 | 0.679374 | 3.007165 | false | false | false | false |
flutter/buildroot | build/fuchsia/fidl_gen_cpp.py | 1 | 3070 | #!/usr/bin/env python3
#
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
""" Generate C/C++ headers and source files from the set of FIDL files specified
in the meta.json manifest.
"""
import argparse
imp... | bsd-3-clause | fcdbdce2c158a6d4681ff25757012829 | 30.326531 | 106 | 0.685016 | 3.234984 | false | false | false | false |
flutter/buildroot | build/symlink.py | 1 | 1176 | #!/usr/bin/env python3
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Make a symlink and optionally touch a file (to handle dependencies)."""
import errno
import optparse
import os.path
import shut... | bsd-3-clause | 247e7a324be9553912698a19e923e242 | 28.4 | 74 | 0.636054 | 3.458824 | false | false | false | false |
flutter/buildroot | build/get_syzygy_binaries.py | 1 | 18089 | #!/usr/bin/env python3
#
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A utility script for downloading versioned Syzygy binaries."""
import hashlib
import errno
import json
import logging
import opt... | bsd-3-clause | c2f4a9787dad59c23a43b5eecc5d995b | 36.067623 | 80 | 0.686273 | 3.807409 | false | false | false | false |
flutter/buildroot | build/landmine_utils.py | 1 | 3015 | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import functools
import logging
import os
import shlex
import sys
def memoize(default=None):
"""This decorator caches the return value of a parameterles... | bsd-3-clause | a20e3ec2207e7828493ea344c2effe91 | 24.125 | 79 | 0.636816 | 3.663426 | false | false | false | false |
flutter/buildroot | tools/dart/dart_roll_helper.py | 1 | 13149 | #!/usr/bin/env python3 -u
#
# Copyright 2018 The Dart project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This script automates the Dart SDK roll steps, including:
# - Updating the Dart revision in DEPS
# - Updating the Dart ... | bsd-3-clause | 1bd0a4afdfba0605df11f46601cb0baf | 34.92623 | 84 | 0.63617 | 3.594587 | false | false | false | false |
niwinz/django-jinja | django_jinja/views/__init__.py | 2 | 1916 | from django import http
from django.template import loader
from django.views import View
from ..base import get_match_extension
class GenericView(View):
response_cls = http.HttpResponse
content_type = "text/html"
tmpl_name = None
def get_context_data(self):
return {"view": self}
def get... | bsd-3-clause | 7be6ed9492694f9f77825a707104383c | 27.176471 | 87 | 0.66023 | 3.691715 | false | false | false | false |
dask/dask-ml | tests/test_spectral_clustering.py | 1 | 3325 | from functools import partial
import numpy as np
import pytest
import sklearn.cluster
from dask_ml import metrics
from dask_ml.cluster import SpectralClustering
from dask_ml.datasets import make_blobs
X, y = make_blobs(n_samples=200, chunks=100, random_state=0)
@pytest.mark.parametrize("as_ndarray", [False, True])... | bsd-3-clause | 8d28f150874ae3f8e3a10d4d23eb7c40 | 26.254098 | 83 | 0.64391 | 3.234436 | false | true | false | false |
dials/dials | src/dials/algorithms/merging/merge.py | 1 | 16432 | """Merging functions for experiment lists and reflection tables."""
from __future__ import annotations
import logging
from contextlib import contextmanager
from io import StringIO
from typing import Optional, Tuple
import numpy as np
from dxtbx.model import ExperimentList
from iotbx import mtz, phil
from mmtbx.scal... | bsd-3-clause | e18aa00b4f16c3a00a6a5d5d5a3e3148 | 34.111111 | 99 | 0.645691 | 3.679355 | false | false | false | false |
dials/dials | tests/algorithms/integration/test_interface.py | 1 | 18674 | from __future__ import annotations
import random
import pytest
def test_split_blocks_1_frame():
from dials.algorithms.integration.integrator import JobList
from dials.array_family import flex
r = flex.reflection_table()
r["value1"] = flex.double()
r["value2"] = flex.int()
r["value3"] = flex... | bsd-3-clause | 7906468b4f2b313c98ad1ff8d8097dd3 | 31.085911 | 83 | 0.532826 | 3.229678 | false | false | false | false |
dials/dials | tests/algorithms/scaling/test_scaler_factory.py | 1 | 14719 | """
Tests for the scaler factory classes and helper functions.
"""
from __future__ import annotations
from unittest.mock import MagicMock, Mock
import pytest
from dxtbx.model import Crystal
from libtbx import phil
from dials.algorithms.scaling.error_model.error_model import BasicErrorModel
from dials.algorithms.sc... | bsd-3-clause | 22cd3eced5a8cb9f11878688ef376287 | 35.889724 | 87 | 0.671377 | 3.279635 | false | true | false | false |
dials/dials | tests/command_line/test_indexed_as_integrated.py | 1 | 1697 | from __future__ import annotations
import procrunner
import iotbx.merging_statistics
def test_indexed_as_integrated(dials_data, tmp_path):
data_dir = dials_data("insulin_processed", pathlib=True)
refl = data_dir / "indexed.refl"
expt = data_dir / "indexed.expt"
command = [
"dials.indexed_as... | bsd-3-clause | 34affdffd1066f520793174a88933d6f | 32.94 | 84 | 0.657042 | 3.20794 | false | false | false | false |
dials/dials | src/dials/algorithms/refinement/parameterisation/scan_varying_crystal_parameters.py | 1 | 7512 | from __future__ import annotations
from scitbx import matrix
from dials.algorithms.refinement.parameterisation.crystal_parameters import (
CrystalOrientationMixin,
CrystalUnitCellMixin,
)
from dials.algorithms.refinement.parameterisation.scan_varying_model_parameters import (
GaussianSmoother,
ScanVar... | bsd-3-clause | fbf7cc4df184544d16825101321f6b7c | 33.617512 | 88 | 0.622204 | 3.500466 | false | false | false | false |
dials/dials | src/dials/command_line/show.py | 1 | 22945 | from __future__ import annotations
import os
import sys
import numpy as np
import iotbx.phil
from cctbx import uctbx
from dxtbx.model.experiment_list import ExperimentListFactory
from scitbx.math import five_number_summary
import dials.util
from dials.array_family import flex
from dials.util import Sorry, tabulate
... | bsd-3-clause | ccb5b7cf5216cdaca4c4f2d9b2cbb8bf | 32.014388 | 88 | 0.507823 | 3.544724 | false | false | false | false |
douban/dpark | dpark/utils/tdigest.py | 1 | 7283 | from math import isnan, ceil, pi
from six.moves import range
class Centroid(object):
def __init__(self, x, w=1):
self.__mean = float(x)
self.__count = float(w)
@property
def mean(self):
return self.__mean
@property
def count(self):
return self.__count
def __... | bsd-3-clause | acaa15c58ccbd1eeb1c42a46c511c01c | 29.219917 | 107 | 0.481395 | 3.670867 | false | false | false | false |
dials/dials | src/dials/command_line/cluster_exec.py | 1 | 1592 | # LIBTBX_SET_DISPATCHER_NAME cluster.dials.exec
from __future__ import annotations
import pickle
import dials.util
def get_cwd():
"""
Get the current working directory
"""
import sys
return sys.argv[1]
def get_tid():
"""
Get the task id
"""
import os
# FIXME At the momen... | bsd-3-clause | 1458942fd2c7c727aa66112d75ab01c6 | 22.072464 | 79 | 0.625 | 3.668203 | false | false | false | false |
dials/dials | src/dials/util/image_viewer/slip_viewer/calibration_frame.py | 1 | 7837 | from __future__ import annotations
import os
import wx
from scitbx.matrix import col
class SBSettingsFrame(wx.MiniFrame):
def __init__(self, *args, **kwds):
super().__init__(*args, **kwds)
szr = wx.BoxSizer(wx.VERTICAL)
panel = SBSettingsPanel(self)
self.SetSizer(szr)
sz... | bsd-3-clause | c86963b03f7b8e30a80d62aff02f9b7b | 34.301802 | 107 | 0.535281 | 3.769601 | false | false | false | false |
dials/dials | src/dials/util/resolution_analysis.py | 1 | 25324 | """
Algorithms for analysis of resolution limits.
"""
from __future__ import annotations
import enum
import logging
import math
import typing
import iotbx.merging_statistics
import iotbx.mtz
import iotbx.phil
from cctbx import miller, uctbx
from cctbx.array_family import flex
from iotbx.reflection_file_utils import ... | bsd-3-clause | ff984efb1ae36e06979baa491456eafe | 35.198856 | 100 | 0.581156 | 3.57387 | false | false | false | false |
dials/dials | src/dials/algorithms/symmetry/origin.py | 1 | 3885 | """
Analysis of the origin of the diffraction pattern based on indexed and
measured intensities.
"""
from __future__ import annotations
def cctbx_crystal_from_dials(crystal):
space_group = crystal.get_space_group()
unit_cell = crystal.get_unit_cell()
from cctbx.crystal import symmetry as crystal_symmetr... | bsd-3-clause | d4b0d982fdf6cfe0ab0d0de5baa7101d | 29.590551 | 82 | 0.645302 | 3.176615 | false | false | false | false |
dials/dials | src/dials/algorithms/background/modeller.py | 1 | 11518 | from __future__ import annotations
import logging
from dials_algorithms_background_modeller_ext import (
BackgroundStatistics,
MultiPanelBackgroundStatistics,
)
__all__ = [
"BackgroundModeller",
"BackgroundModellerExecutor",
"BackgroundModellerResult",
"BackgroundStatistics",
"FinalizeMod... | bsd-3-clause | 709b2ad9eace00e1bc936f02907ad899 | 31.908571 | 87 | 0.566765 | 4.014639 | false | false | false | false |
dials/dials | src/dials/util/normalisation.py | 1 | 1483 | from __future__ import annotations
from cctbx import uctbx
from scitbx.array_family import flex
def quasi_normalisation(intensities):
"""Quasi-normalisation of the input intensities.
Args:
intensities (cctbx.miller.array): The intensities to be normalised.
Returns:
cctbx.miller.array: T... | bsd-3-clause | 591fc044f57ed28c8dc2b76d55aac9a5 | 32.704545 | 77 | 0.636548 | 2.74122 | false | false | false | false |
douban/dpark | examples/kmeans.py | 1 | 1581 | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import print_function
import sys, os, os.path
from six.moves import map
from six.moves import range
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import random
from dpark import DparkContext
from vector impor... | bsd-3-clause | 4067864e4f4f76c678f069afc2f4f08c | 26.736842 | 91 | 0.590765 | 3.349576 | false | false | false | false |
dials/dials | src/dials/util/rebin_images.py | 1 | 3341 | from __future__ import annotations
import binascii
import os
import random
from dxtbx.ext import compress
def gz_open(filename, mode):
import gzip
return gzip.GzipFile(filename, mode)
def split_counts(image, split):
from scitbx.array_family import flex
new_images = [flex.int(flex.grid(image.focu... | bsd-3-clause | 9455e05411d582283550c38a3956b876 | 24.7 | 78 | 0.613289 | 3.191022 | false | false | false | false |
dials/dials | tests/command_line/test_ssx_reduction.py | 1 | 2808 | # test running data reduction programs on ssx data
from __future__ import annotations
import procrunner
def test_ssx_reduction(dials_data, tmp_path):
"""
Check that dials.cosym, dials.scale, dials.export and dials.merge run
successfully on ssx data.
Also test a few smaller analysis programs.
"""
... | bsd-3-clause | 053a0b5d963455746a4a6e33460b2e07 | 32.035294 | 73 | 0.624288 | 3.395405 | false | false | false | false |
douban/dpark | dpark/shuffle.py | 1 | 26136 | from __future__ import absolute_import
from __future__ import print_function
import os
import os.path
import random
import six
from six.moves import urllib, queue, range, zip, reduce, cPickle as pickle
import marshal
import struct
import time
import heapq
import itertools
from operator import itemgetter
from itertools ... | bsd-3-clause | dc5560e712c048c7104ed1948d03914c | 29.748235 | 109 | 0.529232 | 3.831135 | false | false | false | false |
douban/dpark | dpark/utils/frame.py | 1 | 5431 | import os
import inspect
from collections import defaultdict
import linecache
def get_path(p):
return os.path.realpath(os.path.abspath(p))
src_dir = os.path.dirname(os.path.dirname(get_path(__file__)))
class Frame(object):
def __init__(self, f):
"""working in func_name, exec code at pos"""
... | bsd-3-clause | e39d29b6b3316c096f6b63477778bb7e | 31.915152 | 109 | 0.573559 | 3.428662 | false | false | false | false |
dials/dials | src/dials/util/export_shelx.py | 1 | 6338 | from __future__ import annotations
import logging
from math import isclose
from cctbx import crystal, miller
from iotbx.shelx.write_ins import LATT_SYMM
from dials.algorithms.scaling.scaling_library import determine_best_unit_cell
from dials.array_family import flex
from dials.util import Sorry
from dials.util.filte... | bsd-3-clause | 1d422dbf01a60dd156ce6f54117cb4e8 | 36.502959 | 106 | 0.5994 | 3.40204 | false | false | false | false |
dials/dials | tests/algorithms/refinement/test_restraints_parameterisation.py | 1 | 14559 | """Tests for RestraintsParameterisation and associated classes used in refinement"""
from __future__ import annotations
import os
import random
import pytest
from dxtbx.model.experiment_list import ExperimentListFactory
from libtbx.phil import parse
from dials.algorithms.refinement import RefinerFactory
from dials... | bsd-3-clause | 82f8544ad45ee0fd5c28325c33bdd28f | 28.895277 | 87 | 0.647984 | 3.462307 | false | false | false | false |
dials/dials | tests/algorithms/scaling/test_scaling_restraints.py | 1 | 7745 | """
Tests for the scaling restraints module.
"""
from __future__ import annotations
from unittest.mock import Mock
import pytest
from scitbx import sparse
from dials.algorithms.scaling.scaling_restraints import (
ScalingRestraintsCalculator,
SingleScalingRestraintsCalculator,
)
from dials.array_family impo... | bsd-3-clause | ae08ee0232d71403a2ef04b2e7f4f72f | 34.856481 | 85 | 0.680568 | 3.477773 | false | true | false | false |
dials/dials | src/dials/command_line/export_bitmaps.py | 1 | 10013 | from __future__ import annotations
import os
import sys
from PIL import Image
import iotbx.phil
from dxtbx.model.detector_helpers import get_detector_projection_2d_axes
from dials.algorithms.image.threshold import DispersionThresholdDebug
from dials.array_family import flex
from dials.util import Sorry, show_mail_h... | bsd-3-clause | d906256aaa0051ae98491e7035c95672 | 30.487421 | 88 | 0.613602 | 3.508409 | false | false | false | false |
dials/dials | src/dials/model/experiment/profile.py | 1 | 2922 | from __future__ import annotations
class ProfileModelExt:
"""
The definition for a profile model.
"""
@staticmethod
def create(
params, reflections, crystal, beam, detector, goniometer=None, scan=None
):
"""
Create the profile model from data.
:param params: T... | bsd-3-clause | 82caa9878e814e0762e4bfac9d61ac63 | 29.757895 | 88 | 0.619781 | 4.297059 | false | false | false | false |
dials/dials | src/dials/algorithms/scaling/scale_and_filter.py | 1 | 19957 | """Definitions of functions and classes for scaling and filtering algorithm."""
from __future__ import annotations
import math
from libtbx import phil
from scitbx.array_family import flex
from dials.report.plots import d_star_sq_to_d_ticks
phil_scope = phil.parse(
"""
filtering {
method = None deltacchalf
... | bsd-3-clause | a971f491670eb3f2691d62390bafa03f | 33.961404 | 88 | 0.464723 | 3.877797 | false | false | false | false |
douban/dpark | dpark/utils/hotcounter.py | 1 | 1593 | from __future__ import absolute_import
from __future__ import print_function
import operator
import six
from six.moves import range
class HotCounter(object):
def __init__(self, vs=None, limit=20):
if vs is None:
vs = []
self.limit = limit
self.total = {}
self.updates = ... | bsd-3-clause | 508b659df54d9596249061097ade8617 | 23.507692 | 97 | 0.511613 | 3.425806 | false | false | false | false |
dials/dials | src/dials/algorithms/refinement/parameterisation/crystal_parameters.py | 1 | 7778 | from __future__ import annotations
import logging
logger = logging.getLogger(__name__)
from rstbx.symmetry.constraints.parameter_reduction import symmetrize_reduce_enlarge
from scitbx import matrix
from dials.algorithms.refinement.parameterisation.model_parameters import (
ModelParameterisation,
Parameter,
... | bsd-3-clause | 580b013adde02d67bc6f6329af531187 | 33.878924 | 85 | 0.647339 | 3.968367 | false | false | false | false |
dials/dials | tests/algorithms/image/connected_components/test_connected_components.py | 1 | 6312 | from __future__ import annotations
class Test2d:
def setup_class(self):
from dials.algorithms.image.connected_components import LabelImageStack2d
self.size = (500, 500)
self.label_images = LabelImageStack2d(self.size)
from scitbx.array_family import flex
self.data_list =... | bsd-3-clause | 1179d2d7a1bf33ffd0120ac8e9d71f1a | 34.863636 | 81 | 0.460551 | 3.752675 | false | false | false | false |
dials/dials | src/dials/command_line/slice_sequence.py | 1 | 8936 | from __future__ import annotations
from os.path import basename, splitext
from dxtbx.model.experiment_list import ExperimentList
import dials.util
from dials.algorithms.refinement.refinement_helpers import calculate_frame_numbers
from dials.array_family import flex
from dials.util import Sorry
from dials.util.multi_... | bsd-3-clause | 517252d1a51a026bcfef991487f9d1f6 | 34.744 | 88 | 0.606647 | 4.211122 | false | false | false | false |
dials/dials | src/dials/algorithms/profile_model/ellipsoid/indexer.py | 1 | 7256 | from __future__ import annotations
import logging
from math import floor, sqrt
import numpy as np
from numpy.linalg import inv, norm
from cctbx.array_family import flex
from dxtbx import flumpy
from scitbx import matrix
from dials.algorithms.profile_model.ellipsoid import chisq_quantile
from dials.algorithms.statis... | bsd-3-clause | e0047b382072ee9e0a86a285f21fb547 | 33.226415 | 86 | 0.633958 | 3.26259 | false | false | false | false |
dials/dials | src/dials/util/image_viewer/slip_viewer/uc_frame.py | 1 | 14583 | from __future__ import annotations
import math
import wx
from wx.lib.agw.floatspin import EVT_FLOATSPIN, FloatSpin
import cctbx.miller
from cctbx.crystal import symmetry
from scitbx.matrix import col
class UCSettingsFrame(wx.MiniFrame):
def __init__(self, *args, **kwds):
super().__init__(*args, **kwds)... | bsd-3-clause | 2cfba83399d8fda8687408520438cd98 | 30.980263 | 88 | 0.539807 | 3.486254 | false | false | false | false |
dials/dials | tests/algorithms/shoebox/test_mask_overlapping.py | 1 | 5935 | from __future__ import annotations
import numpy as np
from dxtbx.model.experiment_list import Experiment, ExperimentList
from dxtbx.serialize import load
from scitbx import matrix
from dials.algorithms import shoebox
from dials.algorithms.profile_model.gaussian_rs import Model
from dials.array_family import flex
d... | bsd-3-clause | 38498a53652ebc9721ed979f91f37c86 | 34.753012 | 87 | 0.613311 | 3.428654 | false | false | false | false |
douban/dpark | dpark/schedule.py | 1 | 53619 | from __future__ import absolute_import
import marshal
import multiprocessing
import os
import socket
import sys
import time
import six
from six.moves import map, range, urllib, queue, cPickle
import weakref
import threading
import json
from collections import Counter
import zmq
from addict import Dict
from pymesos imp... | bsd-3-clause | fed4a412a9cddbc2fb7686b148d07adb | 33.930945 | 117 | 0.516254 | 4.057435 | false | false | false | false |
dials/dials | tests/algorithms/indexing/lattice_search/test_lattice_search.py | 1 | 4073 | from __future__ import annotations
import py.path
import pytest
from cctbx import sgtbx, uctbx
from dxtbx.imageset import ImageSet
from dxtbx.serialize import load
from dials.algorithms.indexing import lattice_search, stills_indexer
from dials.array_family import flex
from dials.command_line.index import phil_scope
... | bsd-3-clause | 9e8d5f72f075f7e7386043ea208406b1 | 36.712963 | 88 | 0.67616 | 3.21722 | false | true | false | false |
dials/dials | src/dials/util/image_viewer/slip_viewer/ring_frame.py | 1 | 11177 | from __future__ import annotations
import math
import wx
class RingSettingsFrame(wx.MiniFrame):
def __init__(self, *args, **kwds):
super().__init__(*args, **kwds)
szr = wx.BoxSizer(wx.VERTICAL)
panel = RingSettingsPanel(self)
self.SetSizer(szr)
szr.Add(panel, 1, wx.EXPAND... | bsd-3-clause | ca2456609d5c38ed931b835473404f17 | 33.928125 | 89 | 0.521607 | 3.709592 | false | false | false | false |
dials/dials | tests/algorithms/profile_model/test_calculator.py | 1 | 1715 | from __future__ import annotations
from dials.algorithms.profile_model.gaussian_rs.calculator import (
_select_reflections_for_sigma_calc,
)
from dials.array_family import flex
def test_select_reflections_for_sigma_calc():
"""Test the reflection selection helper function."""
# first select all if below t... | bsd-3-clause | 74fd6274194088eff914b1c6ff57baff | 39.833333 | 86 | 0.698542 | 3.375984 | false | false | false | false |
dials/dials | src/dials/algorithms/refinement/two_theta_refiner.py | 1 | 9766 | """Versions of refinement classes for two theta refinement of the unit cell"""
from __future__ import annotations
import logging
from math import pi, sqrt
from scitbx import matrix
from scitbx.math import five_number_summary
from dials.algorithms.refinement.parameterisation.prediction_parameters import (
Predi... | bsd-3-clause | 11472e60790228a1c6103527c6b9e595 | 30.811075 | 88 | 0.601577 | 3.767747 | false | false | false | false |
dials/dials | src/dials/command_line/stills_process.py | 1 | 75177 | from __future__ import annotations
import collections
import copy
import glob
import logging
import os
import pickle
import sys
import tarfile
import time
from io import BytesIO
from dxtbx.model.experiment_list import (
Experiment,
ExperimentList,
ExperimentListFactory,
)
from libtbx.phil import parse
fro... | bsd-3-clause | 386c9e8ae801952b4b2639f854db7290 | 39.636216 | 428 | 0.534166 | 4.530372 | false | false | false | false |
dials/dials | src/dials/algorithms/scaling/model/components/scale_components.py | 1 | 23435 | """
Classes that define a component of a scaling model.
Each class holds the parameters and relevant data, as a list of
arrays, from which to calculate inverse scale factors and
derivatives.
The components are initialised without any data, which is added
by setting the data dict. In order to update the internal data
l... | bsd-3-clause | 342874cb9ccda9895592da2d584d2c75 | 38.855442 | 88 | 0.632174 | 4.069283 | false | false | false | false |
douban/dpark | dpark/utils/profile.py | 1 | 1268 | from __future__ import absolute_import
from __future__ import print_function
import socket
import getpass
import sys
from cProfile import Profile
from pstats import Stats
from tempfile import NamedTemporaryFile
from functools import wraps
from datetime import datetime
def profile(hostname=None, to_stdout=False):
... | bsd-3-clause | 7629686e7d14f4b70124c4ac29ec4419 | 28.488372 | 97 | 0.566246 | 4.464789 | false | false | false | false |
dials/dials | src/dials/command_line/find_spots_client.py | 1 | 7823 | from __future__ import annotations
import http.client
import json
import os
import select
import socket as pysocket
import sys
import urllib.error
import urllib.parse
import urllib.request
from multiprocessing.pool import ThreadPool
import libtbx.phil
from dxtbx.model.crystal import CrystalFactory
from dxtbx.util imp... | bsd-3-clause | 90f2bed13999919cf55880ab04c1caaa | 28.299625 | 97 | 0.555797 | 3.547846 | false | false | false | false |
dials/dials | src/dials/command_line/rl_png.py | 1 | 6628 | # LIBTBX_PRE_DISPATCHER_INCLUDE_SH export PHENIX_GUI_ENVIRONMENT=1
# DIALS_ENABLE_COMMAND_LINE_COMPLETION
from __future__ import annotations
import logging
import math
import libtbx.phil
from scitbx import matrix
from scitbx.array_family import flex
import dials.util
from dials.algorithms.indexing.indexer import fi... | bsd-3-clause | 945a1be18c35e59dcc89810c93978eae | 26.616667 | 77 | 0.610893 | 3.323972 | false | false | false | false |
dials/dials | src/dials/algorithms/indexing/assign_indices.py | 1 | 6043 | from __future__ import annotations
from cctbx.array_family import flex
import dials_algorithms_indexing_ext as ext
from dials.algorithms.indexing import DialsIndexError
class AssignIndicesStrategy:
def __init__(self, d_min=None):
self._d_min = d_min
def __call__(self, reciprocal_lattice_vectors):
... | bsd-3-clause | c31ae4af13079c5fb87df0ce3e172651 | 37.490446 | 119 | 0.575542 | 3.525671 | false | false | false | false |
dials/dials | src/dials/algorithms/integration/image_integrator.py | 1 | 11125 | from __future__ import annotations
import logging
import platform
from time import time
import dials.algorithms.integration
from dials.algorithms.integration.processor import job
from dials.model.data import ImageVolume, MultiPanelImageVolume, make_image
from dials.util import log
from dials.util.log import rehandle_... | bsd-3-clause | 0a29c5e8f681a8ca77ba4f002a001e62 | 29.902778 | 92 | 0.571506 | 4.457131 | false | false | false | false |
dials/dials | src/dials/algorithms/indexing/model_evaluation.py | 1 | 12078 | from __future__ import annotations
import collections
import copy
import logging
import math
import libtbx
from dxtbx.model import Crystal
from scitbx import matrix
from scitbx.array_family import flex
import dials.util
from dials.algorithms.indexing.compare_orientation_matrices import (
difference_rotation_matr... | bsd-3-clause | b6135dcaf113c6df2ac3641994879213 | 33.215297 | 88 | 0.548435 | 3.828209 | false | false | false | false |
dials/dials | src/dials/command_line/model_background.py | 1 | 9235 | """Calculate a global background model and diagnostic images from integrated
experiments. This background model may improve subsequent integration in some
cases, such as in the presence of ice rings. The method is described in the
publication https://doi.org/10.1107/S2052252517010259.
Usage:
dials.model_background... | bsd-3-clause | 9c5cad30e9d6c0a50ece0d2178d8d4cf | 29.081433 | 136 | 0.60314 | 3.949957 | false | false | false | false |
dials/dials | src/dials/util/slice.py | 1 | 3419 | from __future__ import annotations
import copy
from scitbx.array_family import flex
def slice_experiments(experiments, image_ranges):
"""
:param experiments
:type experiments: dxtbx.model.experiment_list.ExperimentList
:param image_range:
:type image_range: list of 2-tuples defining scan range f... | bsd-3-clause | d62929153722235eb122cedaba756df0 | 33.19 | 89 | 0.638491 | 3.488776 | false | false | false | false |
dials/dials | tests/algorithms/integration/profile/test_empirical_modeller.py | 1 | 5054 | from __future__ import annotations
import math
from dials.algorithms.profile_model.modeller import EmpiricalProfileModeller
def evaluate_gaussian(x, a, x0, sx):
assert len(x) == len(x0)
assert len(x) == len(sx)
g = 0.0
for xi, x0i, sxi in zip(x, x0, sx):
g += (xi - x0i) ** 2 / (2.0 * sxi**2... | bsd-3-clause | 13f2d8c0e6f4b06db28924a61ed1f5f7 | 29.263473 | 88 | 0.557578 | 3.782934 | false | false | false | false |
feincms/feincms-elephantblog | tests/testapp/test_contents.py | 1 | 3083 | from django.template.loader import render_to_string
from django.test import TestCase
from elephantblog.contents import BlogCategoryListContent, BlogEntryListContent
from .factories import EntryFactory, create_category, create_entries
class Request:
GET = {"page": 1}
class ContentsTestCase(TestCase):
def t... | bsd-3-clause | 08590c79343193c5674d17609560a08b | 27.027273 | 85 | 0.557249 | 4.264177 | false | false | false | false |
chromium/gyp | test/make_global_settings/ar/gyptest-make_global_settings_ar.py | 9 | 3838 | #!/usr/bin/env python
# Copyright (c) 2014 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Verifies 'AR' in make_global_settings.
"""
import os
import sys
import TestGyp
def resolve_path(test, path):
if path is None:
re... | bsd-3-clause | 50f68689e9ac3da224f839e9d4de0faa | 29.460317 | 78 | 0.652944 | 3.055732 | false | true | false | false |
chromium/gyp | pylib/gyp/MSVSUserFile.py | 24 | 5086 | # Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Visual Studio user preferences file writer."""
import os
import re
import socket # for gethostname
import gyp.common
import gyp.easy_xml as easy_xml
#------... | bsd-3-clause | 932b976a2117c04b3def4b3d94bf950b | 33.598639 | 79 | 0.593394 | 4.328511 | false | true | false | false |
ipython/ipython | IPython/utils/path.py | 1 | 11937 | # encoding: utf-8
"""
Utilities for path handling.
"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import os
import sys
import errno
import shutil
import random
import glob
from IPython.utils.process import system
#--------------------------------------------... | bsd-3-clause | 51ccb99d6424ad0592e4f10e8d2e680d | 29.529412 | 90 | 0.604758 | 3.890808 | false | false | false | false |
ipython/ipython | IPython/utils/frame.py | 1 | 3048 | # encoding: utf-8
"""
Utilities for working with stack frames.
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2008-2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as par... | bsd-3-clause | 140496a59121839d756072620fd9e345 | 32.130435 | 86 | 0.536417 | 4.508876 | false | false | false | false |
ipython/ipython | IPython/utils/tz.py | 44 | 1352 | # encoding: utf-8
"""
Timezone utilities
Just UTC-awareness right now
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2013 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as p... | bsd-3-clause | cb720515b7bc78b31161bc40b7bf8001 | 28.391304 | 78 | 0.448225 | 5.473684 | false | false | false | false |
ipython/ipython | tools/github_stats.py | 1 | 8425 | #!/usr/bin/env python
"""Simple tools to query github.com and gather stats about issues.
To generate a report for IPython 2.0, run:
python github_stats.py --milestone 2.0 --since-tag rel-1.0.0
"""
#-----------------------------------------------------------------------------
# Imports
#---------------------------... | bsd-3-clause | 16b4ab2229458e7a947e14201d6f5eae | 35.630435 | 163 | 0.56095 | 3.850548 | false | false | false | false |
ipython/ipython | IPython/core/inputtransformer2.py | 1 | 28374 | """Input transformer machinery to support IPython special syntax.
This includes the machinery to recognise and transform ``%magic`` commands,
``!system`` commands, ``help?`` querying, prompt stripping, and so forth.
Added: IPython 7.0. Replaces inputsplitter and inputtransformer which were
deprecated in 7.0.
"""
# C... | bsd-3-clause | 8051f4f3e27c481bbbe29a6471eb0560 | 34.601004 | 171 | 0.581448 | 4.014999 | false | false | false | false |
ipython/ipython | examples/IPython Kernel/ipython-get-history.py | 1 | 1136 | #!/usr/bin/env python
"""Extract a session from the IPython input history.
Usage:
ipython-get-history.py sessionnumber [outputfile]
If outputfile is not given, the relevant history is written to stdout. If
outputfile has a .py extension, the translated history (without IPython's
special syntax) will be extracted.
... | bsd-3-clause | c529b5345687c19586f41fa4407cb6ac | 27.4 | 83 | 0.725352 | 3.664516 | false | false | false | false |
ipython/ipython | IPython/core/tests/test_inputtransformer2_line.py | 1 | 2971 | """Tests for the line-based transformers in IPython.core.inputtransformer2
Line-based transformers are the simpler ones; token-based transformers are
more complex. See test_inputtransformer2 for tests for token-based transformers.
"""
from IPython.core import inputtransformer2 as ipt2
CELL_MAGIC = ("""\
%%foo arg
bo... | bsd-3-clause | b549096b76bb1eb869bfc221305e9018 | 16.790419 | 88 | 0.539886 | 2.99496 | false | true | false | false |
ipython/ipython | IPython/core/release.py | 1 | 2179 | # -*- coding: utf-8 -*-
"""Release data for the IPython project."""
#-----------------------------------------------------------------------------
# Copyright (c) 2008, IPython Development Team.
# Copyright (c) 2001, Fernando Perez <fernando.perez@colorado.edu>
# Copyright (c) 2001, Janko Hauser <jhauser@zscout.de>... | bsd-3-clause | 0a9488f0a18f1cdf92f15ac3c1618c1e | 39.351852 | 80 | 0.611749 | 3.213864 | false | false | false | false |
ipython/ipython | IPython/terminal/pt_inputhooks/osx.py | 1 | 4789 | """Inputhook for OS X
Calls NSApp / CoreFoundation APIs via ctypes.
"""
# obj-c boilerplate from appnope, used under BSD 2-clause
import ctypes
import ctypes.util
from threading import Event
objc = ctypes.cdll.LoadLibrary(ctypes.util.find_library("objc")) # type: ignore
void_p = ctypes.c_void_p
objc.objc_getClas... | bsd-3-clause | 9f6bc4d3772d385a4ab63898a2861a51 | 29.503185 | 100 | 0.704322 | 3.377292 | false | false | false | false |
ipython/ipython | IPython/lib/guisupport.py | 3 | 6305 | # coding: utf-8
"""
Support for creating GUI apps and starting event loops.
IPython's GUI integration allows interactive plotting and GUI usage in IPython
session. IPython has two different types of GUI integration:
1. The terminal based IPython supports GUI event loops through Python's
PyOS_InputHook. PyOS_InputH... | bsd-3-clause | efafd2f4a2d0dfce963fd5951df77706 | 39.677419 | 80 | 0.625852 | 4.306694 | false | false | false | false |
ipython/ipython | IPython/external/qt_loaders.py | 1 | 11158 | """
This module contains factory functions that attempt
to return Qt submodules from the various python Qt bindings.
It also protects against double-importing Qt with different
bindings, which is unstable and likely to crash
This is used primarily by qt and qt_for_kernel, and shouldn't
be accessed directly from the o... | bsd-3-clause | 7548a9e8544ff5e72ca3f95595175ee8 | 26.964912 | 83 | 0.6209 | 3.67402 | false | false | false | false |
ipython/ipython | IPython/terminal/pt_inputhooks/wx.py | 2 | 7132 | """Enable wxPython to be used interactively in prompt_toolkit
"""
import sys
import signal
import time
from timeit import default_timer as clock
import wx
def ignore_keyboardinterrupts(func):
"""Decorator which causes KeyboardInterrupt exceptions to be ignored during
execution of the decorated function.
... | bsd-3-clause | ba413fa5a600fb7546b17ea8b9b05bf2 | 31.56621 | 79 | 0.640213 | 3.938156 | false | false | false | false |
ipython/ipython | IPython/core/magics/basic.py | 1 | 22932 | """Implementation of basic magic functions."""
from logging import error
import io
import os
from pprint import pformat
import sys
from warnings import warn
from traitlets.utils.importstring import import_item
from IPython.core import magic_arguments, page
from IPython.core.error import UsageError
from IPython.core.... | bsd-3-clause | d3913db72d4571593746b848447aba0a | 33.69289 | 112 | 0.586866 | 4.199231 | false | false | false | false |
ipython/ipython | IPython/utils/contexts.py | 1 | 1619 | # encoding: utf-8
"""Miscellaneous context managers.
"""
import warnings
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
class preserve_keys(object):
"""Preserve a set of keys in a dictionary.
Upon entering the context manager the current values of the k... | bsd-3-clause | 2302c4dc6208821d7c7e10068c105d19 | 25.540984 | 68 | 0.525015 | 3.646396 | false | false | false | false |
lisa-lab/pylearn2 | pylearn2/utils/track_version.py | 33 | 7516 | #!/usr/bin/env python
"""
Script to obtain version of Python modules and basic information on the
experiment setup (e.g. cpu, os), e.g.
* numpy: 1.6.1 | pylearn: a6e634b83d | pylearn2: 57a156beb0
* CPU: x86_64
* OS: Linux-2.6.35.14-106.fc14.x86_64-x86_64-with-fedora-14-Laughlin
You can also define the modules to be t... | bsd-3-clause | b1220beffd88461e1426ca18e532aab1 | 33.635945 | 77 | 0.56546 | 3.989384 | false | false | false | false |
lisa-lab/pylearn2 | pylearn2/utils/iteration.py | 1 | 36271 | """
Iterators providing indices for different kinds of iteration over
datasets.
Presets:
- sequential: iterates through fixed slices of the dataset in sequence
- shuffled_sequential: iterates through a shuffled version of the dataset
in sequence
- random_slice: on each call to next, returns a slice of the dataset,
... | bsd-3-clause | feaf896de09339cf0daa2b0b4c1fcb9f | 34.180407 | 79 | 0.594966 | 4.497334 | false | false | false | false |
lisa-lab/pylearn2 | pylearn2/utils/datasets.py | 44 | 9068 | """
Several utilities to evaluate an ALC on the dataset, to iterate over
minibatches from a dataset, or to merge three data with given proportions
"""
# Standard library imports
import logging
import os
import functools
from itertools import repeat
import warnings
# Third-party imports
import numpy
import scipy
from t... | bsd-3-clause | 8d83e4b1375f9974b47a4136c87c2eb8 | 29.02649 | 79 | 0.600794 | 4.123693 | false | false | false | false |
lisa-lab/pylearn2 | pylearn2/scripts/dbm/dbm_metrics.py | 7 | 24693 | #!/usr/bin/env python
__authors__ = "Vincent Dumoulin"
__copyright__ = "Copyright 2013, Universite de Montreal"
__credits__ = ["Guillaume Desjargins", "Vincent Dumoulin"]
__license__ = "3-clause BSD"
__maintainer__ = "Vincent Dumoulin"
"""
This script computes both an estimate of the partition function of the provided... | bsd-3-clause | c272811532c5b1779aa68f99827312fe | 34.478448 | 105 | 0.615357 | 3.677837 | false | false | false | false |
lisa-lab/pylearn2 | pylearn2/utils/serial.py | 33 | 20145 | """
Utilities for serializing and deserializing python objects.
"""
try:
from cPickle import BadPickleGet
except ImportError:
BadPickleGet = KeyError
import pickle
import logging
import numpy as np
from theano.compat import six
from theano.compat.six.moves import cPickle, xrange
import os
import time
import war... | bsd-3-clause | 9f1635ba770f56492e91b962a0949c0e | 31.544426 | 115 | 0.558451 | 4.441138 | false | false | false | false |
lisa-lab/pylearn2 | pylearn2/costs/ebm_estimation.py | 34 | 11066 | """
Training costs for unsupervised learning of energy-based models
"""
from functools import wraps
import logging
import numpy as np
import sys
from theano import scan
import theano.tensor as T
from theano.compat.six.moves import zip as izip
from pylearn2.compat import OrderedDict
from pylearn2.costs.cost import Cos... | bsd-3-clause | 3a5a1649e2403c52c14b5639b41045ed | 28.121053 | 79 | 0.604735 | 3.827741 | false | false | false | false |
lisa-lab/pylearn2 | pylearn2/train_extensions/__init__.py | 49 | 5909 | """Plugins for the Train object."""
__authors__ = "Ian Goodfellow"
__copyright__ = "Copyright 2010-2012, Universite de Montreal"
__credits__ = ["Ian Goodfellow", "David Warde-Farley"]
__license__ = "3-clause BSD"
__maintainer__ = "LISA Lab"
__email__ = "pylearn-dev@googlegroups"
import functools
import logging
import ... | bsd-3-clause | 6c7714a92efc601a428708dfdfea5d67 | 32.196629 | 79 | 0.620917 | 4.412995 | false | false | false | false |
lisa-lab/pylearn2 | pylearn2/scripts/summarize_model.py | 44 | 2999 | #!/usr/bin/env python
"""
This script summarizes a model by showing some statistics about
the parameters and checking whether the model completed
training succesfully
"""
from __future__ import print_function
__authors__ = "Ian Goodfellow"
__copyright__ = "Copyright 2010-2012, Universite de Montreal"
__credits__ = ["I... | bsd-3-clause | a2449dff6375002e8a64399017b2a66e | 31.956044 | 76 | 0.579193 | 3.935696 | false | false | false | false |
lisa-lab/pylearn2 | pylearn2/models/mnd.py | 49 | 4148 | __authors__ = "Ian Goodfellow"
__copyright__ = "Copyright 2010-2012, Universite de Montreal"
__credits__ = ["Ian Goodfellow"]
__license__ = "3-clause BSD"
__maintainer__ = "LISA Lab"
__email__ = "pylearn-dev@googlegroups"
from pylearn2.models.model import Model
from pylearn2.utils import sharedX
import numpy as np
impo... | bsd-3-clause | c6b9c32aa570dc2d2fa491ffa122bbac | 23.544379 | 108 | 0.543877 | 3.222999 | false | false | false | false |
lisa-lab/pylearn2 | pylearn2/utils/tests/test_general.py | 45 | 1096 | """
Tests for pylearn2.utils.general functions.
"""
from pylearn2.utils import contains_nan, contains_inf, isfinite
import numpy as np
def test_contains_nan():
"""
Tests that pylearn2.utils.contains_nan correctly
identifies `np.nan` values in an array.
"""
arr = np.random.random(100)
assert no... | bsd-3-clause | 47c760e1650f3b491f82a8e22503a7de | 22.826087 | 63 | 0.644161 | 3.321212 | false | true | false | false |
lisa-lab/pylearn2 | pylearn2/dataset_get/dataset-get.py | 44 | 36792 | #!/usr/bin/env python
# -*- coding: utf-8
########################################
#
#
# This file is intentionally monolithic.
# It also intentionally restricts itself
# to standard library modules, with no
# extra dependencies.
#
from __future__ import print_function
__authors__ = "Steven Pigeon"
__copyright__ = ... | bsd-3-clause | ba0c3a2ae7a7502fc39fbdb8cf6d19d3 | 31.528736 | 114 | 0.56336 | 4.251213 | false | false | false | false |
lisa-lab/pylearn2 | pylearn2/datasets/binarizer.py | 45 | 1455 | """
.. todo::
WRITEME
"""
__authors__ = "Ian Goodfellow"
__copyright__ = "Copyright 2010-2012, Universite de Montreal"
__credits__ = ["Ian Goodfellow"]
__license__ = "3-clause BSD"
__maintainer__ = "LISA Lab"
__email__ = "pylearn-dev@googlegroups"
from pylearn2.datasets.transformer_dataset import TransformerDatas... | bsd-3-clause | 8351d572eacba029adee7f11f86d0fb7 | 28.1 | 74 | 0.644674 | 4.064246 | false | false | false | false |
lisa-lab/pylearn2 | pylearn2/models/dbm/layer.py | 31 | 127336 | """
Common DBM Layer classes
"""
from __future__ import print_function
__authors__ = ["Ian Goodfellow", "Vincent Dumoulin"]
__copyright__ = "Copyright 2012-2013, Universite de Montreal"
__credits__ = ["Ian Goodfellow"]
__license__ = "3-clause BSD"
__maintainer__ = "LISA Lab"
import functools
import logging
import num... | bsd-3-clause | b4a763d630728f22cf0d394d21c9bdf9 | 29.594906 | 315 | 0.53508 | 4.019698 | false | false | false | false |
lisa-lab/pylearn2 | pylearn2/space/__init__.py | 34 | 99992 | """
Classes that define how vector spaces are formatted
Most of our models can be viewed as linearly transforming
one vector space to another. These classes define how the
vector spaces should be represented as theano/numpy
variables.
For example, the VectorSpace class just represents a
vector space with a vector, an... | bsd-3-clause | 4f4914929d8a60fdf57a0d2f988e2839 | 36.590977 | 79 | 0.528532 | 4.694681 | false | false | false | false |
lisa-lab/pylearn2 | pylearn2/packaged_dependencies/theano_linear/unshared_conv/gpu_unshared_conv.py | 44 | 23194 | """
WRITEME
"""
from __future__ import print_function
import inspect
import os
import StringIO
import theano
from theano.sandbox.cuda import CudaNdarrayType
from theano.gof import local_optimizer
from theano.sandbox.cuda.opt import register_opt
from theano.sandbox.cuda import gpu_from_host, host_from_gpu
from theano.... | bsd-3-clause | 9eb51f198fab1c73c61cd311e77f85e8 | 28.248424 | 85 | 0.454902 | 4.087769 | false | false | false | false |
lisa-lab/pylearn2 | pylearn2/datasets/cos_dataset.py | 45 | 3759 | """
.. todo::
WRITEME
"""
import numpy as N
import copy
from theano import config
import theano.tensor as T
from pylearn2.utils.rng import make_np_rng
class CosDataset(object):
"""
Makes a dataset that streams randomly generated 2D examples.
The first coordinate is sampled from a uniform distributio... | bsd-3-clause | b476ad697dd5c8e64f01fed8fd09de53 | 23.89404 | 79 | 0.478053 | 3.725471 | false | false | false | false |
lisa-lab/pylearn2 | pylearn2/distributions/uniform_hypersphere.py | 49 | 2116 | """
.. todo::
WRITEME
"""
uthors__ = "Ian Goodfellow"
__copyright__ = "Copyright 2010-2012, Universite de Montreal"
__credits__ = ["Ian Goodfellow"]
__license__ = "3-clause BSD"
__maintainer__ = "LISA Lab"
__email__ = "pylearn-dev@googlegroups"
import numpy as N
import theano.tensor as T
from theano import config
... | bsd-3-clause | e28bcfe1033155a492539b831bbcdc8d | 25.45 | 76 | 0.512287 | 3.084548 | false | false | false | false |
lisa-lab/pylearn2 | pylearn2/optimization/linear_cg.py | 49 | 2914 | """
.. todo::
WRITEME
"""
import theano
from theano import tensor
from theano.ifelse import ifelse
def linear_cg(fn, params, tol=1e-3, max_iters=1000, floatX=None):
"""
Minimizes a POSITIVE DEFINITE quadratic function via linear conjugate
gradient using the R operator to avoid explicitly representing ... | bsd-3-clause | 83ce8550fcf4b2e7dda993e9d8b92c58 | 33.690476 | 79 | 0.604324 | 3.610905 | false | false | false | false |
lisa-lab/pylearn2 | pylearn2/expr/sampling.py | 49 | 1815 | """
.. todo::
WRITEME
"""
__authors__ = "Ian Goodfellow"
__copyright__ = "Copyright 2010-2012, Universite de Montreal"
__credits__ = ["Ian Goodfellow"]
__license__ = "3-clause BSD"
__maintainer__ = "LISA Lab"
__email__ = "pylearn-dev@googlegroups"
from theano.sandbox.rng_mrg import MRG_RandomStreams
from pylearn... | bsd-3-clause | 8a72070624293b71489521890df95e36 | 23.527027 | 88 | 0.552617 | 3.937093 | false | false | false | false |
lisa-lab/pylearn2 | pylearn2/sandbox/cuda_convnet/stochastic_pool.py | 2 | 19249 | """
GPU op for Stochastic max pooling as defined in:
Stochastic Pooling for Regularization of Deep Convolutional Neural Networks
Matthew D. Zeiler, Rob Fergus, ICLR 2013
The code is written around Alex Krizhevsky's cuda-convnet
"""
__authors__ = "Mehdi Mirza"
__copyright__ = "Copyright 2010-2013, Universite de Montr... | bsd-3-clause | 62810aac50316353f43dcc8b54442bee | 30.197731 | 111 | 0.55312 | 3.926765 | false | false | false | false |
lisa-lab/pylearn2 | pylearn2/scripts/jobman/tester.py | 44 | 3126 | """
This an example script inserting a pylearn2 yaml code into a jobman database.
The code below defines a yaml template string in state.yaml_template,
and the values of its hyper-parameters in state.hyper_parameters, and
run the code that is located in state.extract_results on this model
using jobman.
Actually, we a... | bsd-3-clause | 07eb2e770d37237007527101bed2d2da | 31.226804 | 109 | 0.590211 | 3.647608 | false | true | false | false |
lisa-lab/pylearn2 | pylearn2/models/tests/test_dbm.py | 44 | 37752 | from __future__ import print_function
from pylearn2.models.dbm.dbm import DBM
from pylearn2.models.dbm.layer import BinaryVector, BinaryVectorMaxPool, Softmax, GaussianVisLayer
__authors__ = "Ian Goodfellow"
__copyright__ = "Copyright 2012, Universite de Montreal"
__credits__ = ["Ian Goodfellow", "Devon Hjelm"]
__lic... | bsd-3-clause | 2790db943f51af73e98a42f002ad8531 | 30.2 | 104 | 0.592896 | 3.465712 | false | false | false | false |
jupyterhub/oauthenticator | oauthenticator/tests/test_github.py | 1 | 7568 | import functools
import json
import logging
import re
from io import BytesIO
from urllib.parse import parse_qs, urlparse
from pytest import fixture, mark
from tornado.httpclient import HTTPResponse
from tornado.httputil import HTTPHeaders
from traitlets.config import Config
from ..github import GitHubOAuthenticator
f... | bsd-3-clause | 6c6986946a81f239131e8589e3de9262 | 31.62069 | 111 | 0.607294 | 3.782109 | false | false | false | false |
jupyterhub/oauthenticator | oauthenticator/globus.py | 1 | 14263 | """
Custom Authenticator to use Globus OAuth2 with JupyterHub
"""
import base64
import os
import pickle
import urllib
from jupyterhub.auth import LocalAuthenticator
from tornado.httpclient import HTTPRequest
from tornado.web import HTTPError
from traitlets import Bool, List, Set, Unicode, default
from .oauth2 import ... | bsd-3-clause | ba777f7c10e3b84ae32c3c1ee9c05ce4 | 38.729805 | 115 | 0.62294 | 4.070491 | false | false | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.