#NEWLINE# def test_dataset_save( ) : #NEWLINE# #INDENT# tf = tempfile . NamedTemporaryFile ( suffix = '.hdf' ) #NEWLINE# mrand = np . random . randn ( 2 , * volshape ) #NEWLINE# rand = np . random . randn ( * volshape ) #NEWLINE# ds = cortex . Dataset ( test = ( mrand , subj , xfmname ) ) #NEWLINE# ds . append ( twod = cortex . Volume2D ( rand , rand , subj , xfmname ) ) #NEWLINE# ds . append ( rgb = cortex . VolumeRGB ( rand , rand , rand , subj , xfmname ) ) #NEWLINE# ds . append ( vert = cortex . Vertex . random ( subj ) ) #NEWLINE# ds . save ( tf . name ) #NEWLINE# ds = cortex . load ( tf . name ) #NEWLINE# assert isinstance ( ds . test , cortex . Volume ) #NEWLINE# assert ( ds . test . data . shape == mrand . shape ) #NEWLINE# assert isinstance ( ds . twod , cortex . Volume2D ) #NEWLINE# assert ( ds . twod . dim1 . data . shape == rand . shape ) #NEWLINE# assert ( ds . twod . dim2 . data . shape == rand . shape ) #NEWLINE# assert ( ds . rgb . volume . shape == tuple ( ( ( [ 1 ] + list ( volshape ) ) + [ 4 ] ) ) ) #NEWLINE# assert isinstance ( ds . vert , cortex . Vertex )