Did I find the right examples for you? yes no      Crawl my project      Python Jobs

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

src/n/i/nibabel-1.3.0/nibabel/dft.py   nibabel(Download)
        s = BytesIO()
        im.save(s, 'PNG')
        return s.getvalue()
 
    def png_size(self, index=None, scale_to_slice=True):
        hdr.write_to(s)
 
        return s.getvalue() + data.tostring()
 
    def nifti_size(self):

src/n/i/nibabel-1.3.0/nibabel/tests/test_wrapstruct.py   nibabel(Download)
        str_io = BytesIO()
        hdr.write_to(str_io)
        assert_equal(str_io.getvalue(), hdr.binaryblock)
 
    def test_structarr(self):

src/n/i/nibabel-1.3.0/nibabel/tests/test_utils.py   nibabel(Download)
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_trackvis.py   nibabel(Download)
def test_write():
    streams = []
    out_f = BytesIO()
    tv.write(out_f, [], {})
    assert_equal(out_f.getvalue(), tv.empty_header().tostring())
    out_f = BytesIO()
    tvf.to_file(out_f)
    assert_equal(out_f.getvalue(), tv.empty_header().tostring())
    out_f.truncate(0); out_f.seek(0)
    # Write something not-default

src/n/i/nibabel-1.3.0/nibabel/tests/test_spatialimages.py   nibabel(Download)
    data = np.arange(6).reshape((1,2,3))
    hdr.data_to_fileobj(data, fobj)
    assert_equal(fobj.getvalue(),
                       data.astype(np.int32).tostring(order='F'))
    fobj.seek(0)

src/n/i/nibabel-1.3.0/nibabel/tests/test_nifti1.py   nibabel(Download)
        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_analyze.py   nibabel(Download)
        str_io = BytesIO()
        hdr.data_to_fileobj([], str_io)
        assert_equal(str_io.getvalue(), asbytes(''))
        # Setting more data then there should be gives an error
        assert_raises(HeaderDataError,

src/n/i/nibabel-1.3.0/nibabel/externals/tests/test_netcdf.py   nibabel(Download)
def test_read_write_sio():
    eg_sio1 = BytesIO()
    f1 = make_simple(eg_sio1, 'w')
    str_val = eg_sio1.getvalue()
    f1.close()
    eg_sio_64 = BytesIO()
    f_64 = make_simple(eg_sio_64, 'w', version=2)
    str_val = eg_sio_64.getvalue()
    f_64.close()
    eg_sio_64 = BytesIO(str_val)