timothydmorton / isochrones

Pythonic stellar model grid access; easy MCMC fitting of stellar properties
http://isochrones.readthedocs.org
MIT License
121 stars 62 forks source link

Segmentation fault when dowloading data #11

Closed jobovy closed 9 years ago

jobovy commented 9 years ago

Python quits with a segmentation fault when I try to import isochrone models (e.g., import isochrones.dartmouth or from isochrones.padova import ...). This also happens after I download the data by hand and I just try to import the module, so I assume it must be because of the pd.read_hdf command (and just running pd.read_hdf confirms this). I seem to be able to open the file with h5py.

This is in IPython 2.1.0, Python 2.7.6 on Mac OS X Yosemite 10.10.2, pandas 0.16.0.

timothydmorton commented 9 years ago

OK, thanks-- I wonder if it has to do with the newer version of pandas...(I have 0.15.1 on OS 10.7.5)... if you get it to work with h5py (though I don't know if that would be able to pull the column names for the dataframe), let me know.

timothydmorton commented 9 years ago

You could also check to make sure your dartmouth.h5 isn't corrupted somehow. I get the following::

$ shasum ~/.isochrones/dartmouth.h5
0515e83521f03cfe3ab8bafcb9c8187a90fd50c7  /Users/tdm/.isochrones/dartmouth.h5
jobovy commented 9 years ago

Pandas 0.15.0 gives the same problem, so I guess my Pandas installation must somehow be corrupted (the file was downloaded fine, the SHASUM is correct).

h5py does seem to contain the names of the columns. I can do:

f = h5py.File('.isochrones/padova.h5','r')
f['/df'].items()
[(u'axis0', <HDF5 dataset "axis0": shape (17,), type "|S7">),
 (u'axis1', <HDF5 dataset "axis1": shape (241325,), type "<i8">),
 (u'block0_items', <HDF5 dataset "block0_items": shape (17,), type "|S7">),
 (u'block0_values',<HDF5 dataset "block0_values": shape (241325, 17), type "<f8">)]
f['/df/block0_items'][:]
array(['age', 'M_ini', 'M_act', 'logL', 'logTeff', 'logg', 'bol', 'Kepler',
   'g', 'r', 'i', 'z', 'D51', 'J', 'H', 'K', 'feh'], 
  dtype='|S7')
f['/df/block0_values'][:]
array([[  6.6       ,   0.15000001,   0.15      , ...,   8.333     ,

etc.

timothydmorton commented 9 years ago

that's weird-- what version of pytables do you have? (I've got 3.1.1) Can you write a pandas DataFrame to HDF using df.to_hdf(...)?

jobovy commented 9 years ago

Same pytables version here. I upgraded my numpy installation (because I was using an older development version, which seemed like it could be an issue), but still get the segmentation fault. df.to_hdf(...) doesn't work either...

timothydmorton commented 9 years ago

Bummer- I just always stick w/ using the anaconda installation/package manager, assuming it prevents issues like this...

jobovy commented 9 years ago

I'll close this, as it's not really an issue with your code.