Problem: I have a text file containing several numbers. I am trying to grab some of them and load them into arrays. I would like arrays, even when only 1 line is present in the file. I have an issue when there is a single line only. The values are loading as floats and are not loaded into arrays.
Tried: From the numpy documentation I would expect arrays of length 1 for the single line text file when using ndmin=1. However, I am still getting a series of floats, see below:
>>> ra_deg,dec_deg,l_deg,b_deg=np.loadtxt(args.infile,ndmin=1,usecols=[0,1,2,3],unpack=True)
>>> ra_deg
127.55905
>>> np.__version__
'1.8.1'
Expected:
>>> ra_deg
array([127.55905])
Example args.infile input:
127.55905 +00.00000 224.77661 +21.83227
I am not sure if this is my error, or there is something up with numpy? Any advice before opening a numpy issue would be great, thanks.