Skip to content

Commit e0900da

Browse files
committed
Output ascii-text versions of numpy data for easier testing as requested.
1 parent ca565ca commit e0900da

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

‎docs/standalone_notebooks/simple_numpy_npz_demo.ipynb‎

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"outputs": [],
5454
"source": [
5555
"array_float_2d = np.arange(12,dtype=np.float_).reshape(4,3)\n",
56-
"array_float_2d "
56+
"array_float_2d"
5757
]
5858
},
5959
{
@@ -65,7 +65,7 @@
6565
"outputs": [],
6666
"source": [
6767
"array_complex_2d = array_complex_1d.reshape(2,5)\n",
68-
"array_complex_2d "
68+
"array_complex_2d"
6969
]
7070
},
7171
{
@@ -97,7 +97,9 @@
9797
"}\n",
9898
"for filename, array in savenames.items():\n",
9999
" with open(os.path.join(output_dir,filename+'.npy'), 'w') as f:\n",
100-
" np.save(f, array_complex_1d)"
100+
" np.save(f, array_complex_1d)\n",
101+
" with open(os.path.join(output_dir,filename+'.txt'), 'w') as f:\n",
102+
" np.savetxt(f, array_complex_1d)"
101103
]
102104
},
103105
{
@@ -129,7 +131,12 @@
129131
"source": [
130132
"outfile = os.path.join(output_dir, 'mock_uvw_vis.npz')\n",
131133
"with open(outfile, 'w') as f:\n",
132-
" np.savez(f, uvw=mock_uvw, vis=array_complex_1d)"
134+
" np.savez(f, uvw=mock_uvw, vis=array_complex_1d)\n",
135+
"\n",
136+
"with open(os.path.join(output_dir,'mock_uvw.txt'), 'w') as f:\n",
137+
" np.savetxt(f, mock_uvw)\n",
138+
"with open(os.path.join(output_dir,'mock_vis.txt'), 'w') as f:\n",
139+
" np.savetxt(f, array_complex_1d)"
133140
]
134141
},
135142
{
@@ -209,5 +216,5 @@
209216
}
210217
},
211218
"nbformat": 4,
212-
"nbformat_minor": 1
219+
"nbformat_minor": 0
213220
}

0 commit comments

Comments
 (0)