Did I find the right examples for you? yes no

All Samples(7)  |  Call(0)  |  Derive(0)  |  Import(7)

src/n/i/nibabel-1.3.0/nibabel/nifti1.py   nibabel(Download)
import numpy.linalg as npl
 
from .py3k import ZEROB, ints2bytes, asbytes, asstr
from .volumeutils import Recoder, make_dt_codes, endian_codes
from .spatialimages import HeaderDataError, ImageFileError
        # be nice and zero out remaining part of the extension till the
        # next 16 byte border
        fileobj.write(ZEROB * (extstart + rawsize - fileobj.tell()))
 
 
            size -= esize
            # store raw extension content, but strip trailing NULL chars
            evalue = evalue.rstrip(ZEROB)
            # 'extension_codes' also knows the best implementation to handle
            # a particular extension type
        # have extensions.  
        extension_status = fileobj.read(4)
        if len(extension_status) < 4 or extension_status[0] == ZEROB:
            return hdr
        # If this is a detached header file read to end
            # If single file, write required 0 stream to signal no extensions
            if self.is_single:
                fileobj.write(ZEROB * 4)
            return
        # Signal there are extensions that follow

src/n/i/nibabel-1.3.0/nibabel/nicom/csareader.py   nibabel(Download)
import numpy as np
 
from ..py3k import ZEROB, asbytes, asstr
from .structreader import Unpacker
 
       s stripped to first occurence of null (0)
    '''
    zero_pos = s.find(ZEROB)
    if zero_pos == -1:
        return s

src/n/i/nibabel-1.3.0/nibabel/volumeutils.py   nibabel(Download)
import numpy as np
 
from .py3k import isfileobj, ZEROB
from .casting import (shared_range, type_info, as_int, best_float, OK_FLOATS,
                      able_int_type)
    nblocks = int(count // block_size)
    rem = count % block_size
    blk = ZEROB * block_size
    for bno in range(nblocks):
        fileobj.write(blk)
    fileobj.write(ZEROB * rem)

src/n/i/nibabel-1.3.0/nibabel/tests/test_wrapstruct.py   nibabel(Download)
from ..batteryrunners import Report
 
from ..py3k import BytesIO, StringIO, asbytes, ZEROB
from ..volumeutils import swapped_code, native_code, Recoder
from ..spatialimages import HeaderDataError
        assert_raises(WrapStructError,
                      self.header_class,
                      bb + ZEROB)
        # Checking set to true by default, and prevents nonsense being
        # set into the header. Completely zeros binary block always
        # (fairly) bad
        bb_bad = ZEROB * len(bb)

src/n/i/nibabel-1.3.0/nibabel/tests/test_utils.py   nibabel(Download)
''' Test for volumeutils module '''
from __future__ import with_statement
from ..py3k import BytesIO, asbytes, ZEROB
import tempfile
 
def test_write_zeros():
    bio = BytesIO()
    write_zeros(bio, 10000)
    assert_equal(bio.getvalue(), ZEROB*10000)
    bio.seek(0)
    bio.truncate(0)
    write_zeros(bio, 10000, 256)
    assert_equal(bio.getvalue(), ZEROB*10000)
    bio.truncate(0)
    write_zeros(bio, 200, 256)
    assert_equal(bio.getvalue(), ZEROB*200)
 
 

src/n/i/nibabel-1.3.0/nibabel/tests/test_nifti1.py   nibabel(Download)
import os
 
from ..py3k import BytesIO, ZEROB, asbytes
 
import numpy as np
        str_io = BytesIO()
        hdr.write_to(str_io)
        assert_equal(str_io.getvalue(), hdr.binaryblock + ZEROB * 4)
 
    def test_float128(self):

src/n/i/nibabel-1.3.0/nibabel/tests/test_arrayproxy.py   nibabel(Download)
from copy import deepcopy
 
from ..py3k import BytesIO, ZEROB, asbytes
from ..tmpdirs import InTemporaryDirectory
 
def write_raw_data(arr, hdr, fileobj):
    hdr.set_data_shape(arr.shape)
    hdr.set_data_dtype(arr.dtype)
    fileobj.write(ZEROB * hdr.get_data_offset())
    fileobj.write(arr.tostring(order='F'))