rem stringlengths 1 322k | add stringlengths 0 2.05M | context stringlengths 4 228k | meta stringlengths 156 215 |
|---|---|---|---|
Let us compute longest paths on random graphs with random weights. Each time, we ensure the resulting graph is indeed a path:: | Let us compute longest paths on random graphs with random weights. Each time, we ensure the resulting graph is indeed a path:: | def longest_path(self, s=None, t=None, weighted=False, algorithm="MILP", solver=None, verbose=0): r""" Returns a longest path of ``self``. | 34c1e50f6f1e024964d30bd503da4e0a040658da /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/34c1e50f6f1e024964d30bd503da4e0a040658da/generic_graph.py |
This can be very helpful in showing certain features of plots. | This can be very helpful in showing certain features of plots. :: sage: plot(1.5/(1+e^(-x)), (x, -10, 10)) | sage: def maple_leaf(t): | c10e2b47ad18a174d81ccda4e0cc7692a9ede9df /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/c10e2b47ad18a174d81ccda4e0cc7692a9ede9df/plot.py |
sage: plot(1.5/(1+e^(-x)), (x, -10, 10)) | sage: def maple_leaf(t): | c10e2b47ad18a174d81ccda4e0cc7692a9ede9df /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/c10e2b47ad18a174d81ccda4e0cc7692a9ede9df/plot.py | |
of `pi`. | of `\pi`. | sage: def maple_leaf(t): | c10e2b47ad18a174d81ccda4e0cc7692a9ede9df /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/c10e2b47ad18a174d81ccda4e0cc7692a9ede9df/plot.py |
for best style in that case. | for best style in that case. :: sage: plot(arcsin(x),(x,-1,1),ticks=[None,pi/6],tick_formatter=["latex",pi]) | sage: def maple_leaf(t): | c10e2b47ad18a174d81ccda4e0cc7692a9ede9df /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/c10e2b47ad18a174d81ccda4e0cc7692a9ede9df/plot.py |
sage: plot(arcsin(x),(x,-1,1),ticks=[None,pi/6],tick_formatter=["latex",pi]) | sage: def maple_leaf(t): | c10e2b47ad18a174d81ccda4e0cc7692a9ede9df /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/c10e2b47ad18a174d81ccda4e0cc7692a9ede9df/plot.py | |
def lagrange_polynomial(self, points, algorithm="divided_difference", previous_row=[]): | def lagrange_polynomial(self, points, algorithm="divided_difference", previous_row=None): | def lagrange_polynomial(self, points, algorithm="divided_difference", previous_row=[]): """ Return the Lagrange interpolation polynomial in ``self`` associated to the given list of points. | 465de735fa7de0284b94ba6fee7486033b515273 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/465de735fa7de0284b94ba6fee7486033b515273/polynomial_ring.py |
- ``previous_row`` -- (default: ``[]``) This option is only relevant | - ``previous_row`` -- (default: ``None``) This option is only relevant | def lagrange_polynomial(self, points, algorithm="divided_difference", previous_row=[]): """ Return the Lagrange interpolation polynomial in ``self`` associated to the given list of points. | 465de735fa7de0284b94ba6fee7486033b515273 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/465de735fa7de0284b94ba6fee7486033b515273/polynomial_ring.py |
The return value should always be an element of ``self'', in the case of ``divided_difference'', or a list of elements of ``self'', in the case of ``neville'':: | Make sure that ticket be an element of ``self`` in the case of ``divided_difference``, or a list of elements of ``self`` in the case of ``neville``. :: | def lagrange_polynomial(self, points, algorithm="divided_difference", previous_row=[]): """ Return the Lagrange interpolation polynomial in ``self`` associated to the given list of points. | 465de735fa7de0284b94ba6fee7486033b515273 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/465de735fa7de0284b94ba6fee7486033b515273/polynomial_ring.py |
sage: J.is_S_integral(J.[K.ideal(5)]) | sage: J.is_S_integral([K.ideal(5)]) | def is_S_integral(self,S): r""" Return True if this fractional ideal is integral with respect to the list of primes ``S``. | 0401b35b186901fc27d9669b7b0c53c0910effb2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/0401b35b186901fc27d9669b7b0c53c0910effb2/number_field_ideal.py |
A.append(chr(ascii_integer(b[8*i : 8*(i+1)]))) | A.append(chr(ascii_integer(b[8*i: 8*(i+1)]))) | def bin_to_ascii(B): r""" Return the ASCII representation of the binary string ``B``. INPUT: - ``B`` -- a non-empty binary string or a non-empty list of bits. The number of bits in ``B`` must be a multiple of 8. OUTPUT: - The ASCII string corresponding to ``B``. ALGORITHM: Consider a block of bits `B = b_0 b_1 \c... | aebff8f354a41a04afb74b90325076d3d8890a6a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/aebff8f354a41a04afb74b90325076d3d8890a6a/util.py |
bug reported in trac | Bug reported in trac | sage: def my_carmichael(n): | aebff8f354a41a04afb74b90325076d3d8890a6a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/aebff8f354a41a04afb74b90325076d3d8890a6a/util.py |
import sage.rings.integer n = sage.rings.integer.Integer(n) | n = Integer(n) | sage: def my_carmichael(n): | aebff8f354a41a04afb74b90325076d3d8890a6a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/aebff8f354a41a04afb74b90325076d3d8890a6a/util.py |
sage: def my_carmichael(n): | aebff8f354a41a04afb74b90325076d3d8890a6a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/aebff8f354a41a04afb74b90325076d3d8890a6a/util.py | ||
if e < 3: e = e-1 else: e = e-2 t.append(1<<e) | if e < 3: e = e - 1 else: e = e - 2 t.append(1 << e) | sage: def my_carmichael(n): | aebff8f354a41a04afb74b90325076d3d8890a6a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/aebff8f354a41a04afb74b90325076d3d8890a6a/util.py |
t += [ p**(k-1)*(p-1) for p,k in L ] | t += [p**(k - 1) * (p - 1) for p, k in L] | sage: def my_carmichael(n): | aebff8f354a41a04afb74b90325076d3d8890a6a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/aebff8f354a41a04afb74b90325076d3d8890a6a/util.py |
return map(lambda x: int(x), list(n.binary()[-k:])) | return map(int, list(n.binary()[-k:])) | def least_significant_bits(n, k): r""" Return the ``k`` least significant bits of ``n``. INPUT: - ``n`` -- an integer. - ``k`` -- a positive integer. OUTPUT: - The ``k`` least significant bits of the integer ``n``. If ``k=1``, then return the parity bit of the integer ``n``. Let `b` be the binary representation of... | aebff8f354a41a04afb74b90325076d3d8890a6a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/aebff8f354a41a04afb74b90325076d3d8890a6a/util.py |
non negative integer | non negative real number | def height(self): r""" Returns the height of self. | 9778e6e357f80e24f134e6467cc55d87104aeb8f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9778e6e357f80e24f134e6467cc55d87104aeb8f/paths.py |
non negative integer | non negative real number | def width(self): r""" Returns the width of self. | 9778e6e357f80e24f134e6467cc55d87104aeb8f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9778e6e357f80e24f134e6467cc55d87104aeb8f/paths.py |
def tikz_trajectory(self): r""" Returns the trajectory of self as a tikz str. | 9778e6e357f80e24f134e6467cc55d87104aeb8f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9778e6e357f80e24f134e6467cc55d87104aeb8f/paths.py | ||
def tikz_trajectory(self): r""" Returns the trajectory of self as a tikz str. | 9778e6e357f80e24f134e6467cc55d87104aeb8f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9778e6e357f80e24f134e6467cc55d87104aeb8f/paths.py | ||
class _python_object_alphabet(object): | class _python_object_alphabet(UniqueRepresentation): | def __contains__(self, x): """ Returns True if x is contained in self. | f8ac97cfb9c2830fb49fe687aece163acb2bdd82 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/f8ac97cfb9c2830fb49fe687aece163acb2bdd82/words.py |
""" | r""" | def strip_answer(self, s): """ Returns the string s with Matlab's answer prompt removed. | 158cf0a8ce2e4bbf3ba05e93b02a4f869f056e7e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/158cf0a8ce2e4bbf3ba05e93b02a4f869f056e7e/matlab.py |
""" Returns the image `\{f(x) x in self\}` of this combinatorial | r""" Returns the image `\{f(x) | x \in \text{self}\}` of this combinatorial | def map(self, f, name=None): """ Returns the image `\{f(x) x in self\}` of this combinatorial class by `f`, as a combinatorial class. | 2100c662ee361cfb10d1f946fd4c75e7591d8485 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/2100c662ee361cfb10d1f946fd4c75e7591d8485/combinat.py |
sage: browse_sage_doc(identity_matrix, 'rst')[-60:-5] 'MatrixSpace of 3 by 3 sparse matrices over Integer Ring' | sage: browse_sage_doc(identity_matrix, 'rst')[-107:-47] 'Full MatrixSpace of 3 by 3 sparse matrices over Integer Ring' | 'def identity_matrix' | 88c6636fa4d7063c99eaf26d5727e3439fbc8099 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/88c6636fa4d7063c99eaf26d5727e3439fbc8099/sagedoc.py |
for i in xrange(0, l - 2): | for i in xrange(0, l-1): | def is_square_free(self): r""" Returns True if self does not contain squares, and False otherwise. | f544ac737c51764dde59f8a338c136fafc79ce7c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/f544ac737c51764dde59f8a338c136fafc79ce7c/finite_word.py |
Initializes base class Disk. | Initializes base class ``Disk``. | def __init__(self, point, r, angle, options): """ Initializes base class Disk. | 3f21439afc8f5abeb4fe65a598d336e1421e1daa /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/3f21439afc8f5abeb4fe65a598d336e1421e1daa/disk.py |
EXAMPLES: | EXAMPLES:: | def get_minmax_data(self): """ Returns a dictionary with the bounding box data. | 3f21439afc8f5abeb4fe65a598d336e1421e1daa /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/3f21439afc8f5abeb4fe65a598d336e1421e1daa/disk.py |
Return the allowed options for the Disk class. | Return the allowed options for the ``Disk`` class. | def _allowed_options(self): """ Return the allowed options for the Disk class. | 3f21439afc8f5abeb4fe65a598d336e1421e1daa /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/3f21439afc8f5abeb4fe65a598d336e1421e1daa/disk.py |
String representation of Disk primitive. | String representation of ``Disk`` primitive. | def _repr_(self): """ String representation of Disk primitive. | 3f21439afc8f5abeb4fe65a598d336e1421e1daa /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/3f21439afc8f5abeb4fe65a598d336e1421e1daa/disk.py |
EXAMPLES: | EXAMPLES:: | def plot3d(self, z=0, **kwds): """ Plots a 2D disk (actually a 52-gon) in 3D, with default height zero. | 3f21439afc8f5abeb4fe65a598d336e1421e1daa /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/3f21439afc8f5abeb4fe65a598d336e1421e1daa/disk.py |
""" S = self.__heilbronn_operator(self, [[-d,0, 0,d]], 1) | We test that the sign issue at sage: M = Newforms(Gamma1(13),names = 'a')[0].modular_symbols(sign=0) sage: M.diamond_bracket_operator(4) Hecke module morphism defined by the matrix [ 0 0 1 -1] [-1 -1 0 1] [-1 -1 0 0] [ 0 -1 1 -1] Domain: Modular Symbols subspace of dimension 4 of Modular Symbols space ... Codo... | def diamond_bracket_operator(self, d): r""" Return the diamond bracket d operator on this modular symbols space. | 68b1a176f6aaeccb935dcddb989af090ba262e7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/68b1a176f6aaeccb935dcddb989af090ba262e7b/ambient.py |
pass | def cycle_index(self, parent = None): r""" INPUT: - ``self`` - a permutation group `G` - ``parent`` -- a free module with basis indexed by partitions, or behave as such, with a ``term`` and ``sum`` method (default: the symmetric functions over the rational field in the p basis) Returns the *cycle index* of `G`, w... | def example(self): """ Returns an example of finite permutation group, as per :meth:`Category.example`. | ca9bebe2b3aab51b8e131e27d8020ae4121f4b93 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/ca9bebe2b3aab51b8e131e27d8020ae4121f4b93/finite_permutation_groups.py |
To see a list of all word constructors, type "words." and then | To see a list of all word constructors, type ``words.`` and then | def __new__(cls, *args, **kwds): r""" TEST: sage: from sage.combinat.words.word_generators import ChristoffelWord_Lower sage: w = ChristoffelWord_Lower(1,0); w doctest:1: DeprecationWarning: ChristoffelWord_Lower is deprecated, use LowerChristoffelWord instead word: 1 """ from sage.misc.misc import deprecation deprecat... | 7dc11f32f8d3378d59dc015acd15e327a01e4eec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/7dc11f32f8d3378d59dc015acd15e327a01e4eec/word_generators.py |
This function is an automatic generated pexpect wrapper around the Singular | This function is an automatically generated pexpect wrapper around the Singular | def _sage_doc_(self): """ EXAMPLES:: | bbe79acf173957c802cb14a22ed39e76c62398c7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/bbe79acf173957c802cb14a22ed39e76c62398c7/singular.py |
module.include_dirs.append(sage_inc) | def add_base_flags(module): incdirs = filter(os.path.exists, [os.path.join(p, 'include') for p in basedir[sys.platform] ]) libdirs = filter(os.path.exists, [os.path.join(p, 'lib') for p in basedir[sys.platform] ]+ [os.path.join(p, 'lib64') for p in basedir[sys.platform] ] ) module.include_dirs.extend(incdirs) ... | f3295df895aea7d383dd5cd7e643ea00ab239263 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/f3295df895aea7d383dd5cd7e643ea00ab239263/setupext.py | |
module.library_dirs.extend([sage_lib]) | def add_base_flags(module): incdirs = filter(os.path.exists, [os.path.join(p, 'include') for p in basedir[sys.platform] ]) libdirs = filter(os.path.exists, [os.path.join(p, 'lib') for p in basedir[sys.platform] ]+ [os.path.join(p, 'lib64') for p in basedir[sys.platform] ] ) module.include_dirs.extend(incdirs) ... | f3295df895aea7d383dd5cd7e643ea00ab239263 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/f3295df895aea7d383dd5cd7e643ea00ab239263/setupext.py | |
print_message( 'numpy 1.1 or later is required; you have %s' % numpy.__version__) return False | if not int(nn[0]) >= 1: print_message( 'numpy 1.1 or later is required; you have %s' % numpy.__version__) return False | def check_for_numpy(): try: import numpy except ImportError: print_status("numpy", "no") print_message("You must install numpy 1.1 or later to build matplotlib.") return False nn = numpy.__version__.split('.') if not (int(nn[0]) >= 1 and int(nn[1]) >= 1): print_message( 'numpy 1.1 or later is required; you have %s' % n... | f3295df895aea7d383dd5cd7e643ea00ab239263 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/f3295df895aea7d383dd5cd7e643ea00ab239263/setupext.py |
tk_lib_dir = tcl_lib_dir.replace('Tcl', 'Tk').replace('tcl', 'tk') | (head, tail) = os.path.split(tcl_lib_dir) tail = tail.replace('Tcl', 'Tk').replace('tcl', 'tk') tk_lib_dir = os.path.join(head, tail) if not os.path.exists(tk_lib_dir): tk_lib_dir = tcl_lib_dir.replace('Tcl', 'Tk').replace('tcl', 'tk') | def query_tcltk(): """Tries to open a Tk window in order to query the Tk object about its library paths. This should never be called more than once by the same process, as Tk intricacies may cause the Python interpreter to hang. The function also has a workaround if no X server is running (useful for autobuild systems)... | f3295df895aea7d383dd5cd7e643ea00ab239263 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/f3295df895aea7d383dd5cd7e643ea00ab239263/setupext.py |
define_macros=[('PY_ARRAYAUNIQUE_SYMBOL', 'MPL_ARRAY_API')]) | define_macros=[('PY_ARRAY_UNIQUE_SYMBOL', 'MPL_ARRAY_API')]) | def build_ft2font(ext_modules, packages): global BUILT_FT2FONT if BUILT_FT2FONT: return # only build it if you you haven't already deps = ['src/ft2font.cpp', 'src/mplutils.cpp'] deps.extend(glob.glob('CXX/*.cxx')) deps.extend(glob.glob('CXX/*.c')) module = Extension('matplotlib.ft2font', deps, define_macros=[('PY_ARRA... | f3295df895aea7d383dd5cd7e643ea00ab239263 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/f3295df895aea7d383dd5cd7e643ea00ab239263/setupext.py |
EXAMPLES: | Load and *execute* the content of ``filename`` in Macaulay2. :param filename: the name of the file to be loaded and executed. :type filename: string :returns: Macaulay2 command loading and executing commands in ``filename``, that is, ``'load "filename"'``. :rtype: string TESTS:: | def _read_in_file_command(self, filename): """ EXAMPLES: sage: from sage.misc.misc import tmp_filename sage: filename = tmp_filename() sage: f = open(filename, "w") sage: f.write("Hello") sage: f.close() sage: command = macaulay2._read_in_file_command(filename) sage: macaulay2.eval(command) #optional Hello sage: impor... | d6bc649fdd3f63906043d3b39068bfca64befdcc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/d6bc649fdd3f63906043d3b39068bfca64befdcc/macaulay2.py |
sage: f.write("Hello") | sage: f.write("sage_test = 7;") | def _read_in_file_command(self, filename): """ EXAMPLES: sage: from sage.misc.misc import tmp_filename sage: filename = tmp_filename() sage: f = open(filename, "w") sage: f.write("Hello") sage: f.close() sage: command = macaulay2._read_in_file_command(filename) sage: macaulay2.eval(command) #optional Hello sage: impor... | d6bc649fdd3f63906043d3b39068bfca64befdcc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/d6bc649fdd3f63906043d3b39068bfca64befdcc/macaulay2.py |
Hello | sage: macaulay2.eval("sage_test") 7 | def _read_in_file_command(self, filename): """ EXAMPLES: sage: from sage.misc.misc import tmp_filename sage: filename = tmp_filename() sage: f = open(filename, "w") sage: f.write("Hello") sage: f.close() sage: command = macaulay2._read_in_file_command(filename) sage: macaulay2.eval(command) #optional Hello sage: impor... | d6bc649fdd3f63906043d3b39068bfca64befdcc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/d6bc649fdd3f63906043d3b39068bfca64befdcc/macaulay2.py |
""" return 'get "%s"'%filename | sage: macaulay2._read_in_file_command("test") 'load "test"' sage: macaulay2(10^10000) == 10^10000 True """ return 'load "%s"' % filename | def _read_in_file_command(self, filename): """ EXAMPLES: sage: from sage.misc.misc import tmp_filename sage: filename = tmp_filename() sage: f = open(filename, "w") sage: f.write("Hello") sage: f.close() sage: command = macaulay2._read_in_file_command(filename) sage: macaulay2.eval(command) #optional Hello sage: impor... | d6bc649fdd3f63906043d3b39068bfca64befdcc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/d6bc649fdd3f63906043d3b39068bfca64befdcc/macaulay2.py |
sage: c = c2 = 1 | sage: c == c2 calling __eq__ defined in Metaclass True """ def __eq__(self, other): print "calling __eq__ defined in Metaclass" return (type(self) == type(other)) and (self.reduce_args == other.reduce_args) | def metaclass(name, bases): """ Creates a new class in this metaclass INPUT:: - name: a string - bases: a tuple of classes EXAMPLES:: sage: from sage.misc.test_class_pickling import metaclass, bar sage: c = metaclass("foo2", (object, bar,)) constructing class sage: c <class 'sage.misc.test_class_pickling.foo2'> sage... | d70cd18bc305341f145da93bb4ec4e8fd0f4eaf2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/d70cd18bc305341f145da93bb4ec4e8fd0f4eaf2/test_class_pickling.py |
""" | def metaclass(name, bases): """ Creates a new class in this metaclass INPUT:: - name: a string - bases: a tuple of classes EXAMPLES:: sage: from sage.misc.test_class_pickling import metaclass, bar sage: c = metaclass("foo2", (object, bar,)) constructing class sage: c <class 'sage.misc.test_class_pickling.foo2'> sage... | d70cd18bc305341f145da93bb4ec4e8fd0f4eaf2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/d70cd18bc305341f145da93bb4ec4e8fd0f4eaf2/test_class_pickling.py | |
L = [] for k in xrange(icount): L.append(start) start += step if include_endpoint: L.append(end) return L def xsrange(start, end=None, step=1, universe=None, check=True, include_endpoint=False, endpoint_tolerance=1e-5): """ Return an iterator over numbers ``a, a+step, ..., a+k*step``, where ``a+k*step < b`` and ``a+(... | def srange(start, end=None, step=1, universe=None, check=True, include_endpoint=False, endpoint_tolerance=1e-5): r""" Return list of numbers ``a, a+step, ..., a+k*step``, where ``a+k*step < b`` and ``a+(k+1)*step >= b`` over exact rings, and makes a best attempt for inexact rings (see note below). This provides one wa... | 20ebd212371c8f080196f4eda13fdbd0a7b6d5e2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/20ebd212371c8f080196f4eda13fdbd0a7b6d5e2/misc.py | |
cur = start for k in xrange(icount): yield cur cur += step if include_endpoint: yield end | if icount >=0: cur = start for k in xrange(icount): yield cur cur += step if include_endpoint: yield end | def generic_xsrange(): cur = start for k in xrange(icount): yield cur cur += step if include_endpoint: yield end | 20ebd212371c8f080196f4eda13fdbd0a7b6d5e2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/20ebd212371c8f080196f4eda13fdbd0a7b6d5e2/misc.py |
self.data = self._fixAxes(data.astype(np.uint8)) | self.data = self._fixAxes(data) | def _newVolume(self,data,copyFrom=None,rescale=True): """Takes a numpy array and makes a geoprobe volume. This volume can then be written to disk using the write() method.""" | 6dc8a94ae9d8ef661f2e32f2d35d1a1f96340092 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/6dc8a94ae9d8ef661f2e32f2d35d1a1f96340092/volume.py |
"""Writes a geoprobe volume to disk using memmapped arrays""" | """Writes a geoprobe volume to disk.""" | def write(self, filename): """Writes a geoprobe volume to disk using memmapped arrays""" # Write header values self._infile = BinaryFile(filename, 'w') for varname, info in _headerDef.iteritems(): value = getattr(self, varname, info['default']) self._infile.seek(info['offset']) self._infile.writeBinary(info['type'], va... | 6dc8a94ae9d8ef661f2e32f2d35d1a1f96340092 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/6dc8a94ae9d8ef661f2e32f2d35d1a1f96340092/volume.py |
self._infile = BinaryFile(filename, 'w') | outfile = BinaryFile(filename, 'w') | def write(self, filename): """Writes a geoprobe volume to disk using memmapped arrays""" # Write header values self._infile = BinaryFile(filename, 'w') for varname, info in _headerDef.iteritems(): value = getattr(self, varname, info['default']) self._infile.seek(info['offset']) self._infile.writeBinary(info['type'], va... | 6dc8a94ae9d8ef661f2e32f2d35d1a1f96340092 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/6dc8a94ae9d8ef661f2e32f2d35d1a1f96340092/volume.py |
self._infile.seek(info['offset']) self._infile.writeBinary(info['type'], value) self._infile.seek(_headerLength) self.data.ravel('F').tofile(self._infile, format='B') self._infile.close() | outfile.seek(info['offset']) outfile.writeBinary(info['type'], value) outfile.seek(_headerLength) self.data.T.tofile(outfile, format='B') outfile.close() | def write(self, filename): """Writes a geoprobe volume to disk using memmapped arrays""" # Write header values self._infile = BinaryFile(filename, 'w') for varname, info in _headerDef.iteritems(): value = getattr(self, varname, info['default']) self._infile.seek(info['offset']) self._infile.writeBinary(info['type'], va... | 6dc8a94ae9d8ef661f2e32f2d35d1a1f96340092 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/6dc8a94ae9d8ef661f2e32f2d35d1a1f96340092/volume.py |
newData = np.asarray(newData).astype(np.uint8) | newData = np.asarray(newData, dtype=np.uint8) | def _setData(self, newData): newData = np.asarray(newData).astype(np.uint8) try: self._nx, self._ny, self._nz = newData.shape except ValueError, AttributeError: raise TypeError('Data must be a 3D numpy array') # We don't update dv and d0 here. This is to avoid overwriting the "real" # dv and d0 when you're manipulatin... | 6dc8a94ae9d8ef661f2e32f2d35d1a1f96340092 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/6dc8a94ae9d8ef661f2e32f2d35d1a1f96340092/volume.py |
self.data = self._file.read() | self.data = self._file.read_all() | def _readHorizon(self,filename): self._file = HorizonFile(filename, 'r') | c4d19988bf93cda0175cd909647976ef228ad58f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/c4d19988bf93cda0175cd909647976ef228ad58f/horizon.py |
def read(self): | def read_all(self): | def read(self): """ Reads in the entire horizon file and returns a numpy array with the fields ('x', 'y', 'z', 'conf', 'type', 'herid', 'tileSize') for each point in the horizon. """ # Note: The total number of points in the file is not directly stored # on disk. Therefore, we must read through the entire file, store... | c4d19988bf93cda0175cd909647976ef228ad58f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/c4d19988bf93cda0175cd909647976ef228ad58f/horizon.py |
(self.originalNx, self.originalNy, self.originalNz) = data.shape | (self.originalnx, self.originalny, self.originalnz) = data.shape | def _newVolume(self,data,copyFrom=None,rescale=True): """Takes a numpy array and makes a geoprobe volume. This volume can then be written to disk using the write() method.""" | f745519840b98e4706f7c2270367a2d141efbb7c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/f745519840b98e4706f7c2270367a2d141efbb7c/volume.py |
self.x = self.data['x'] self.y = self.data['y'] self.z = self.data['z'] | def __init__(self, input): """Takes either a filename or a numpy array""" | 4074ebc8c65d730ea4a2c2df0b470eb33eb5343e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/4074ebc8c65d730ea4a2c2df0b470eb33eb5343e/horizon.py | |
surface = kwargs.pop('surface', None), | surface = kwargs.pop('surface', None) | def _parse_new_horizon_input(self, *args, **kwargs): """Parse input when given something other than a filename""" #-- Parse Arguments --------------------------------------------------- if len(args) == 1: # Assume argument is data (numpy array with dtype of _point_dtype) self.data = self._ensure_correct_dtype(args[0])... | 755fec4c82b51a78f3784962a0e5c98c795c584a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/755fec4c82b51a78f3784962a0e5c98c795c584a/horizon.py |
grid = np.ones((self.y.ptp() + 1, self.x.ptp() +1 ), dtype=np.float32) | x, y, z = self.x, self.y, self.z grid = np.ones((y.ptp() + 1, x.ptp() +1 ), dtype=np.float32) | def _get_grid(self): """An nx by ny numpy array (dtype=float32) of the z values contained in the horizon file""" grid = np.ones((self.y.ptp() + 1, self.x.ptp() +1 ), dtype=np.float32) grid *= self.nodata I = np.array(self.x - self.xmin, dtype=np.int) J = np.array(self.y - self.ymin, dtype=np.int) for k in xrange(I.size... | a146a41636dcdfd374d5fba306147e4067b66367 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/a146a41636dcdfd374d5fba306147e4067b66367/horizon.py |
I = np.array(self.x - self.xmin, dtype=np.int) J = np.array(self.y - self.ymin, dtype=np.int) | I = np.array(x - x.min(), dtype=np.int) J = np.array(y - y.min(), dtype=np.int) | def _get_grid(self): """An nx by ny numpy array (dtype=float32) of the z values contained in the horizon file""" grid = np.ones((self.y.ptp() + 1, self.x.ptp() +1 ), dtype=np.float32) grid *= self.nodata I = np.array(self.x - self.xmin, dtype=np.int) J = np.array(self.y - self.ymin, dtype=np.int) for k in xrange(I.size... | a146a41636dcdfd374d5fba306147e4067b66367 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/a146a41636dcdfd374d5fba306147e4067b66367/horizon.py |
i, j, d = I[k], J[k], self.z[k] | i, j, d = I[k], J[k], z[k] | def _get_grid(self): """An nx by ny numpy array (dtype=float32) of the z values contained in the horizon file""" grid = np.ones((self.y.ptp() + 1, self.x.ptp() +1 ), dtype=np.float32) grid *= self.nodata I = np.array(self.x - self.xmin, dtype=np.int) J = np.array(self.y - self.ymin, dtype=np.int) for k in xrange(I.size... | a146a41636dcdfd374d5fba306147e4067b66367 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/a146a41636dcdfd374d5fba306147e4067b66367/horizon.py |
volID = testvol.magic | volID = testvol.magicNum | def isValidVolume(filename): """Tests whether a filename is a valid geoprobe file. Returns boolean True/False.""" try: testvol = vol(filename) except: return False volID = testvol.magic volSize = os.stat(filename).st_size predSize = testvol.nx*testvol.ny*testvol.nz + _headerLength # VolID == 43970 is a version 2 geop... | c76c117f11480b602bba7866a81841bbd5e87a36 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/c76c117f11480b602bba7866a81841bbd5e87a36/volume.py |
vol = geoprobe.volume('data/Volumes/example.vol') | vol = geoprobe.volume(datadir + 'Volumes/example.vol') | def main(): # Read an existing geoprobe volume vol = geoprobe.volume('data/Volumes/example.vol') # Print some info print_info(vol) # Example plots plot(vol) | bb98e94dcf6ad31ce64250c1a886f032a06c4407 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/bb98e94dcf6ad31ce64250c1a886f032a06c4407/basic_volume_usage.py |
return self.cached_value | value = self.cached_value() if value is None: raise AttributeError | def __call__(self, *args): try: return self.cached_value except AttributeError: self.cached_value = self.function(*args) return self.cached_value | 7af4f0b8b747f0c4769367e1f28941d2a56f00f3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/7af4f0b8b747f0c4769367e1f28941d2a56f00f3/common.py |
self.cached_value = self.function(*args) return self.cached_value | retval = self.function(*args) self.cached_value = weakref.ref(retval) value = self.cached_value() return value | def __call__(self, *args): try: return self.cached_value except AttributeError: self.cached_value = self.function(*args) return self.cached_value | 7af4f0b8b747f0c4769367e1f28941d2a56f00f3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/7af4f0b8b747f0c4769367e1f28941d2a56f00f3/common.py |
init_from_xyz(self, *args) | self._init_from_xyz(self, *args) | def _parse_new_horizon_input(self, *args, **kwargs): """Parse input when given something other than a filename""" #-- Parse Arguments --------------------------------------------------- if len(args) == 1: # Assume argument is data (numpy array with dtype of _point_dtype) self.data = self._ensure_correct_dtype(args[0])... | 2c4f317b90517f552811ee955fedd2846f2dbf5a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/2c4f317b90517f552811ee955fedd2846f2dbf5a/horizon.py |
dtype = [('x', '>f4'), ('y', '>f4'), ('traces', '%i>u1'%self._numSamples)] | dtype = [('x', '>f4'), ('y', '>f4'), ('tracenum', '>f4'), ('traces', '%i>u1'%self._numSamples)] | def _readTraces(self): dtype = [('x', '>f4'), ('y', '>f4'), ('traces', '%i>u1'%self._numSamples)] self._infile.seek(_headerLength) data = np.fromfile(self._infile, dtype=dtype, count=self._numTraces) self.x = data['x'] self.y = data['y'] self.data = data['traces'] | 66d28608b523552b920be74a0bf8dda177a4322b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/66d28608b523552b920be74a0bf8dda177a4322b/data2d.py |
data = data.strip('\x00') | item = item.strip('\x00') | def readBinary(self,fmt): """ Read and unpack a binary value from the file based on string fmt (see the struct module for details). """ size = struct.calcsize(fmt) data = self.read(size) # Reading beyond the end of the file just returns '' if len(data) != size: raise EOFError('End of file reached') data = struct.unpack... | 4bcdf1a1a693fab2774834b6b5c53cf1dde361eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/4bcdf1a1a693fab2774834b6b5c53cf1dde361eb/common.py |
return subVolume | return subVolume.squeeze() | def extractWindow(hor, vol, upper=0, lower=None, offset=0, region=None): """Extracts a window around a horizion out of a geoprobe volume Input: hor: a geoprobe horizion object or horizion filename vol: a geoprobe volume object or volume filename upper: (default, 0) upper window interval around horizion lower: (default,... | d3a904dc4e287886507aef7deecd329a599f591f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/d3a904dc4e287886507aef7deecd329a599f591f/utilities.py |
grid = self.nodata*np.ones((self.data.y.ptp()+1,self.data.x.ptp()+1),dtype=np.float32) | grid = self.nodata*np.ones((self.y.ptp()+1,self.x.ptp()+1),dtype=np.float32) | def _get_grid(self): """An nx by ny numpy array (dtype=float32) of the z values contained in the horizon file""" try: return self._grid except AttributeError: grid = self.nodata*np.ones((self.data.y.ptp()+1,self.data.x.ptp()+1),dtype=np.float32) I = np.array(self.x-self.xmin,np.int) J = np.array(self.y-self.ymin,np.int... | 1629a37de552a7d5be55362e6294b4421de903ed /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/1629a37de552a7d5be55362e6294b4421de903ed/horizon.py |
self._file = _horizonFile(filename, 'r') | self._file = HorizonFile(filename, 'r') | def _readHorizon(self,filename): self._file = _horizonFile(filename, 'r') | 8a264e6f2ba6be78ab4f925241fd8d2ac7de1b8b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/8a264e6f2ba6be78ab4f925241fd8d2ac7de1b8b/horizon.py |
self._dtype = [] for name, fmt in zip(_pointNames, _pointFormat): self._dtype.append((name,fmt)) | self.point_dtype = [] for name, fmt in zip(self._pointNames, self._pointFormat): self.point_dtype.append((name,fmt)) | def __init__(self, *args, **kwargs): """Accepts the same argument set as a standard python file object""" # Initalize the file object as normal file.__init__(self, *args, **kwargs) | 8a264e6f2ba6be78ab4f925241fd8d2ac7de1b8b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/8a264e6f2ba6be78ab4f925241fd8d2ac7de1b8b/horizon.py |
self._pointSize = sum(map(struct.calcsize, _pointFormat)) | self._pointSize = sum(map(struct.calcsize, self._pointFormat)) | def __init__(self, *args, **kwargs): """Accepts the same argument set as a standard python file object""" # Initalize the file object as normal file.__init__(self, *args, **kwargs) | 8a264e6f2ba6be78ab4f925241fd8d2ac7de1b8b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/8a264e6f2ba6be78ab4f925241fd8d2ac7de1b8b/horizon.py |
Ypos = self.model2index(Ypos) | Ypos = self.model2index(Ypos, axis='y') | def YSlice(self, Ypos): """Takes a slice of the volume at a constant y-value (i.e. the slice is in the direction of the x-axis) This is a convience function to avoid calling volume.model2index before slicing and transposing (for easier plotting) after. Input: Ypos: Y-Value given in model coordinates Output: A 2D (NZ x ... | 2dc4da754117039ce86cc20ca029f51a0ab6d79f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/2dc4da754117039ce86cc20ca029f51a0ab6d79f/volume.py |
Zpos = self.model2index(Zpos) | Zpos = self.model2index(Zpos, axis='z') | def ZSlice(self, Zpos): """Takes a slice of the volume at a constant z-value (i.e. a depth slice) This is a convience function to avoid calling volume.model2index before slicing and transposing (for easier plotting) after. Input: Zpos: Z-Value given in model coordinates Output: A 2D (NY x NX) numpy array""" Zpos = self... | 2dc4da754117039ce86cc20ca029f51a0ab6d79f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/2dc4da754117039ce86cc20ca029f51a0ab6d79f/volume.py |
elif ('surface' in kwargs) and ('lines' in kwargs): self._init_from_surface_lines(kwargs['surface'], kwargs['lines']) elif 'surface' in kwargs: self._init_from_surface_lines(surface=surface) elif 'lines' in kwargs: self._init_from_surface_lines(lines=lines) | elif ('surface' in kwargs) or ('lines' in kwargs): surface, lines = kwargs.pop('surface', None), kwargs.pop('lines', None) self._init_from_surface_lines(surface, lines) | def _parse_new_horizon_input(self, *args, **kwargs): """Parse input when given something other than a filename""" #-- Parse Arguments --------------------------------------------------- if len(args) == 0: pass elif len(args) == 1: # Assume argument is data (numpy array with dtype of _point_dtype) self.data = np.asarra... | 711be31cd41013081068ef642983ee598c872e38 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/711be31cd41013081068ef642983ee598c872e38/horizon.py |
def init_from_surface_lines(self, surface=None, lines=None): | def _init_from_surface_lines(self, surface=None, lines=None): | def init_from_surface_lines(self, surface=None, lines=None): """Make a new horizon object from either a surface array or a list of line arrays""" if surface is not None: surface = np.asarray(surface, dtype=_point_dtype) | 711be31cd41013081068ef642983ee598c872e38 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/711be31cd41013081068ef642983ee598c872e38/horizon.py |
self.lines.append(info, data[i:i+item.size]) | self.lines.append((info, self.data[i:i+item.size])) i += item.size | def init_from_surface_lines(self, surface=None, lines=None): """Make a new horizon object from either a surface array or a list of line arrays""" if surface is not None: surface = np.asarray(surface, dtype=_point_dtype) | 711be31cd41013081068ef642983ee598c872e38 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/711be31cd41013081068ef642983ee598c872e38/horizon.py |
if numPoints > 0: points = np.fromfile(self, count=numPoints, dtype=self.point_dtype) return points else: return [] | points = np.fromfile(self, count=numPoints, dtype=self.point_dtype) return points | def readPoints(self): numPoints = self.readBinary('>I') if numPoints > 0: points = np.fromfile(self, count=numPoints, dtype=self.point_dtype) return points # apparently, len(points) is not 0 when numPoints is 0... else: return [] | 12b694e913b9b7fa035609605ead508b5355d270 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/12b694e913b9b7fa035609605ead508b5355d270/horizon.py |
def sectionType(self): # No idea what the difference between #34 and #28, #2, etc is... (pos, neg, 0, pick??) secFmt = '>I' secID = self.readBinary(secFmt) if secID == 19: sectype = 'Points' else: sectype = 'Lines' return sectype | 12b694e913b9b7fa035609605ead508b5355d270 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/12b694e913b9b7fa035609605ead508b5355d270/horizon.py | ||
self.readHeader() lines = [] secType = None self.readHeader() | self.readHeader() | def points(self): """A numpy array with the fields ('x', 'y', 'z', 'conf', 'type', 'herid', 'tileSize') for each point in the horizon (regardless of whehter it's a manual pick (line) or surface)""" self.readHeader() # Initalize an empty recarray to store things in lines = [] # To store line objects in secType = None se... | 12b694e913b9b7fa035609605ead508b5355d270 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/12b694e913b9b7fa035609605ead508b5355d270/horizon.py |
points = self.readPoints() | temp_points = [self.readPoints()] | def points(self): """A numpy array with the fields ('x', 'y', 'z', 'conf', 'type', 'herid', 'tileSize') for each point in the horizon (regardless of whehter it's a manual pick (line) or surface)""" self.readHeader() # Initalize an empty recarray to store things in lines = [] # To store line objects in secType = None se... | 12b694e913b9b7fa035609605ead508b5355d270 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/12b694e913b9b7fa035609605ead508b5355d270/horizon.py |
lines.append((lineInfo, currentPoints)) np.append(points, currentPoints) | temp_points.append(currentPoints) | def points(self): """A numpy array with the fields ('x', 'y', 'z', 'conf', 'type', 'herid', 'tileSize') for each point in the horizon (regardless of whehter it's a manual pick (line) or surface)""" self.readHeader() # Initalize an empty recarray to store things in lines = [] # To store line objects in secType = None se... | 12b694e913b9b7fa035609605ead508b5355d270 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/12b694e913b9b7fa035609605ead508b5355d270/horizon.py |
pass self.lines = lines | pass numpoints = sum(map(np.size, temp_points)) points = np.zeros(numpoints, dtype=self.point_dtype) i = 0 for item in temp_points: points[i : i + item.size] = item i += item.size | def points(self): """A numpy array with the fields ('x', 'y', 'z', 'conf', 'type', 'herid', 'tileSize') for each point in the horizon (regardless of whehter it's a manual pick (line) or surface)""" self.readHeader() # Initalize an empty recarray to store things in lines = [] # To store line objects in secType = None se... | 12b694e913b9b7fa035609605ead508b5355d270 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/12b694e913b9b7fa035609605ead508b5355d270/horizon.py |
hor = horizion(hor) | hor = horizon(hor) | def extractWindow(hor, vol, upper=0, lower=None, offset=0, region=None): """Extracts a window around a horizion out of a geoprobe volume Input: hor: a geoprobe horizion object or horizion filename vol: a geoprobe volume object or volume filename upper: (default, 0) upper window interval around horizion lower: (default,... | 6ad5ce7deaf76daf0f8a485426a4b9dc15b4ead0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/6ad5ce7deaf76daf0f8a485426a4b9dc15b4ead0/utilities.py |
value = value + (n-1) * d | value = value + (n-1) * abs(d) | def _setVolumeBound(self, value, axis, max=True): axisLetter = ['x','y','z'][axis] n = [self.nx, self.ny, self.nz][axis] d = [self.dx, self.dy, self.dz][axis] offset = [self.x0, self.y0, self.z0][axis] if ((max is True) & (d>0)) or ((max is False) & (d<0)): value = value + (n-1) * d setattr(self, axisLetter+'0', value) | 895b589400a4e8e2f8e8415c1f96c01f25bd52e0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/895b589400a4e8e2f8e8415c1f96c01f25bd52e0/volume.py |
self._pointSize = struct.calcsize(''.join(_pointFormat)) | self._pointSize = sum(map(struct.calcsize, _pointFormat)) | def __init__(self, *args, **kwargs): """Accepts the same argument set as a standard python file object""" # Initalize the file object as normal file.__init__(self, *args, **kwargs) | 87c3ea8635b85e50ecc59f38a939297921968c20 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/87c3ea8635b85e50ecc59f38a939297921968c20/horizon.py |
self._init_from_xyz(self, *args) | self._init_from_xyz(*args) | def _parse_new_horizon_input(self, *args, **kwargs): """Parse input when given something other than a filename""" #-- Parse Arguments --------------------------------------------------- if len(args) == 1: # Assume argument is data (numpy array with dtype of _point_dtype) self.data = self._ensure_correct_dtype(args[0])... | a2cc696bd5c4f45ad4388fa30e5eca52c92a59c8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/a2cc696bd5c4f45ad4388fa30e5eca52c92a59c8/horizon.py |
self.surface = data | self.surface = self.data | def _init_from_xyz(self, x, y, z): """Make a new horizon object from x, y, and z arrays""" x,y,z = [np.asarray(item, dtype=np.float32) for item in [x,y,z]] if x.size == y.size == z.size: self.data = np.zeros(x.size, dtype=self.POINT_DTYPE) self.x = x self.y = y self.z = z self.surface = data else: raise ValueError('x, ... | a2cc696bd5c4f45ad4388fa30e5eca52c92a59c8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/a2cc696bd5c4f45ad4388fa30e5eca52c92a59c8/horizon.py |
self.data = self._file.read_all() | self.data = self._file.read() | def _readHorizon(self,filename): self._file = HorizonFile(filename, 'r') | 147335947f0d0b7d637daf9d3f674676e5230f23 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/147335947f0d0b7d637daf9d3f674676e5230f23/horizon.py |
print 'Setting!' | def _set_grid(self, value): print 'Setting!' self._grid = value | 147335947f0d0b7d637daf9d3f674676e5230f23 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/147335947f0d0b7d637daf9d3f674676e5230f23/horizon.py | |
def read_all(self): | def read(self): | def read_all(self): """ Reads in the entire horizon file and returns a numpy array with the fields ('x', 'y', 'z', 'conf', 'type', 'herid', 'tileSize') for each point in the horizon. """ # Note: The total number of points in the file is not directly stored # on disk. Therefore, we must read through the entire file, s... | 147335947f0d0b7d637daf9d3f674676e5230f23 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/147335947f0d0b7d637daf9d3f674676e5230f23/horizon.py |
region: (default, full extent of horizion) sub-region to use instead of full extent | region: (default, overlap between horizion and volume) sub-region to use instead of full extent. Must be a 4-tuple of (xmin, xmax, ymin, ymax) | def extractWindow(hor, vol, upper=0, lower=None, offset=0, region=None, masked=False): """Extracts a window around a horizion out of a geoprobe volume Input: hor: a geoprobe horizion object or horizion filename vol: a geoprobe volume object or volume filename upper: (default, 0) upper window interval around horizion lo... | dceb3c211f4a1c6f7674a73f1d609f79925468ae /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/dceb3c211f4a1c6f7674a73f1d609f79925468ae/utilities.py |
if region == None: xmin, xmax, ymin, ymax = hor.xmin, hor.xmax, hor.ymin, hor.ymax else: xmin, xmax, ymin, ymax = region | vol_extents = [vol.xmin, vol.xmax, vol.ymin, vol.ymax] hor_extents = [hor.xmin, hor.xmax, hor.ymin, hor.ymax] extents = bbox_overlap(hor_extents, vol_extents) if extents is None: raise ValueError('Input horizon and volume do not intersect!') if region is not None: extents = bbox_overlap(extents, region) if extents... | def extractWindow(hor, vol, upper=0, lower=None, offset=0, region=None, masked=False): """Extracts a window around a horizion out of a geoprobe volume Input: hor: a geoprobe horizion object or horizion filename vol: a geoprobe volume object or volume filename upper: (default, 0) upper window interval around horizion lo... | dceb3c211f4a1c6f7674a73f1d609f79925468ae /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/dceb3c211f4a1c6f7674a73f1d609f79925468ae/utilities.py |
def extractWindow(hor, vol, upper=0, lower=None, offset=0, region=None, masked=False): """Extracts a window around a horizion out of a geoprobe volume Input: hor: a geoprobe horizion object or horizion filename vol: a geoprobe volume object or volume filename upper: (default, 0) upper window interval around horizion lo... | dceb3c211f4a1c6f7674a73f1d609f79925468ae /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/dceb3c211f4a1c6f7674a73f1d609f79925468ae/utilities.py | ||
def extractWindow(hor, vol, upper=0, lower=None, offset=0, region=None, masked=False): """Extracts a window around a horizion out of a geoprobe volume Input: hor: a geoprobe horizion object or horizion filename vol: a geoprobe volume object or volume filename upper: (default, 0) upper window interval around horizion lo... | dceb3c211f4a1c6f7674a73f1d609f79925468ae /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/dceb3c211f4a1c6f7674a73f1d609f79925468ae/utilities.py | ||
def extractWindow(hor, vol, upper=0, lower=None, offset=0, region=None, masked=False): """Extracts a window around a horizion out of a geoprobe volume Input: hor: a geoprobe horizion object or horizion filename vol: a geoprobe volume object or volume filename upper: (default, 0) upper window interval around horizion lo... | dceb3c211f4a1c6f7674a73f1d609f79925468ae /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/dceb3c211f4a1c6f7674a73f1d609f79925468ae/utilities.py | ||
print extents | def intersects(bbox1, bbox2): # Check for intersection xmin1, xmax1, ymin1, ymax1 = bbox1 xmin2, xmax2, ymin2, ymax2 = bbox2 xdist = abs( (xmin1 + xmax1) / 2.0 - (xmin2 + xmax2) / 2.0 ) ydist = abs( (ymin1 + ymax1) / 2.0 - (ymin2 + ymax2) / 2.0 ) xwidth = (xmax1 - xmin1 + xmax2 - xmin2) / 2.0 ywidth = (ymax1 - ymin1 + ... | 294e07b691aa03e50fb02c6b40e7fd6642ec2ced /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/294e07b691aa03e50fb02c6b40e7fd6642ec2ced/utilities.py | |
self.x = self.data.x self.y = self.data.y self.z = self.data.z | self.x = self.data['x'] self.y = self.data['y'] self.z = self.data['z'] | def __init__(self, input): """Takes either a filename or a numpy array""" | 6f9825ea37bea9bb989e7d9e97be1c94db41c421 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10472/6f9825ea37bea9bb989e7d9e97be1c94db41c421/horizon.py |
( (associativity(token) == 'left' and precedence(token) <= ops[-1]) \ or (associativity(token) == 'right' and precedence(token) < ops[-1]) ): | ( (associativity(token) == 'left' and precedence(token) <= precedence(ops[-1])) \ or (associativity(token) == 'right' and precedence(token) < precedence(ops[-1])) ): | def infix_to_prefix(expr): """converts the infix expression to prefix using the shunting yard algorithm""" ops = [] results = [] for token in tokenize(expr): #print ops, results if is_op(token): #If the token is an operator, o1, then: #while there is an operator token, o2, at the top of the stack, and #either o1 is lef... | e767b12033e64b5042fe38b01fa3dd7f6b9765d9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/14576/e767b12033e64b5042fe38b01fa3dd7f6b9765d9/shuntingyard.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.