I am going through a course based on the astroML textbook and I wanted to ask if anyone knows why my computer might be producing this error when I run the code from the Github file for figure 1.1:
Traceback (most recent call last):
File "C:\Users\shua4\OneDrive\Documents\Grad School\spring 2021\ASTR Research\untitled2.py", line 89, in <module>
stars, galaxies = get_stars_and_galaxies()
File "C:\Users\shua4\OneDrive\Documents\Grad School\spring 2021\ASTR Research\untitled2.py", line 32, in get_stars_and_galaxies
stars = data[objtype == 6][:Nstars]
IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed
For some clarification, when I simply ask for what data looks like, I get an array that puts everything in brackets and I am not sure why. If you have a solution, please let me know. I am using a Windows 10 machine with Anaconda and Spyder Python 3.8 as well.
data
Out[21]:
array([([0.358174], [-0.508718], [2728], [0.103], [23.255], [22.633], [22.459], [21.911], [21.211], [0.487], [0.126], [0.145], [0.129], [0.264], [23.028], [22.621], [22.563], [22.039], [21.24 ], [0.378], [0.164], [0.14 ], [0.125], [0.248], [3], [1]),
([0.358382], [-0.551157], [2728], [0.107], [25.302], [22.345], [20.589], [18.896], [17.984], [0.711], [0.097], [0.031], [0.013], [0.02 ], [24.989], [22.347], [20.617], [18.896], [17.976], [0.793], [0.094], [0.038], [0.035], [0.038], [6], [0]),
([0.357898], [-0.570892], [2728], [0.109], [23.025], [22.317], [21.35 ], [21.057], [20.89 ], [0.67 ], [0.159], [0.103], [0.117], [0.359], [23.701], [22.919], [22.26 ], [21.932], [21.797], [0.611], [0.148], [0.111], [0.115], [0.379], [3], [1]),
...,
([3.843611], [-0.208263], [5052], [0.074], [25.649], [23.077], [22.11 ], [21.658], [21.474], [0.692], [0.227], [0.158], [0.17 ], [0.559], [25.503], [23.537], [22.717], [22.158], [22.294], [0.532], [0.199], [0.168], [0.154], [0.562], [3], [1]),
([3.895482], [-0.208669], [5052], [0.076], [21.023], [20.024], [19.563], [19.412], [19.355], [0.076], [0.016], [0.015], [0.018], [0.061], [21.005], [20.024], [19.557], [19.425], [19.357], [0.07 ], [0.025], [0.021], [0.023], [0.059], [6], [1]),
([3.881584], [-0.209449], [5052], [0.075], [22.778], [22.741], [22.187], [21.901], [21.29 ], [0.308], [0.128], [0.124], [0.148], [0.345], [22.801], [22.859], [22.291], [22.047], [21.441], [0.285], [0.141], [0.119], [1.056], [0.323], [3], [0])],
dtype=[('ra', '<f8', (1,)), ('dec', '<f8', (1,)), ('run', '<i2', (1,)), ('rExtSFD', '<f8', (1,)), ('uRaw', '<f8', (1,)), ('gRaw', '<f8', (1,)), ('rRaw', '<f8', (1,)), ('iRaw', '<f8', (1,)), ('zRaw', '<f8', (1,)), ('uErr', '<f8', (1,)), ('gErr', '<f8', (1,)), ('rErr', '<f8', (1,)), ('iErr', '<f8', (1,)), ('zErr', '<f8', (1,)), ('uRawPSF', '<f8', (1,)), ('gRawPSF', '<f8', (1,)), ('rRawPSF', '<f8', (1,)), ('iRawPSF', '<f8', (1,)), ('zRawPSF', '<f8', (1,)), ('upsfErr', '<f8', (1,)), ('gpsfErr', '<f8', (1,)), ('rpsfErr', '<f8', (1,)), ('ipsfErr', '<f8', (1,)), ('zpsfErr', '<f8', (1,)), ('type', '<i2', (1,)), ('ISOLATED', '<i4', (1,))])
Any help or direction would be much appreciated.