So I'm trying to use the following to read the following file with numpy:
import numpy as np
recordtype = np.dtype([('name', 'S24'),
('ra', [(np.int32,np.int32,np.float32)]),
('dec', [(np.int32,np.int32,np.float32)]),
('z',np.float32), ('rmag',np.float32),('rmag_error',np.float32),
('gmag',np.float32),('gmag_error',np.float32)])
qData = numpy.loadtxt("SDSS_quasar_cat5(1)", skiprows=6)
Here's a sample of the datafile:
Results from heasarc_sdssquasar: Sloan Digital Sky Survey Quasar Catalog (10th Data Release: DR10Q)
Coordinate system: Equatorial
|name |ra |dec |vi_redshift|rmag |rmag_error |gmag |gmag_error |
|SDSS J163313.26+352050.7|16 33 13.265|+35 20 50.77| 2.0000|2.480190e+01|3.865410e+00|2.511420e+01|9.026890e-01|
|SDSS J164135.36+372726.9|16 41 35.362|+37 27 26.96| 2.0000|2.279110e+01|1.722010e-01|2.203690e+01|7.126500e-02|
|SDSS J160420.86+275634.5|16 04 20.869|+27 56 34.52| 2.0010|2.008330e+01|2.592250e-02|2.048210e+01|2.699570e-02|
|SDSS J163948.06+331030.2|16 39 48.069|+33 10 30.27| 2.0010|1.945350e+01|1.478850e-02|1.971600e+01|1.617890e-02|
|SDSS J162006.83+395403.8|16 20 06.834|+39 54 03.83| 2.0020|1.937250e+01|2.033600e-02|1.942160e+01|2.408500e-02|
I can't seem to get past defining the dtype. I'm new to python, and looked for examples, but I must have something wrong. Any suggestions?
Thx!
TypeError: data type not understood. That's because of the Right Ascension and Declination definitions: aside from (fixed length) strings, you can only use discrete types for each field