jvines / astroARIADNE

Easy stellar SED fitting!
MIT License
57 stars 7 forks source link

Pickle Error During Fitter Setup #27

Closed JayChittidi closed 3 years ago

JayChittidi commented 3 years ago

Hi there,

I'm getting an error during the fitter setup involving ValueError: Unrecognized compression type: infer when the fitter setup tries to read the Phoenixv2_DF.pkl file in the Datafiles folder. I'm not sure entirely where it's going wrong. Any suggestions? Happy to provide more details as needed!

Here's the full output:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
~/anaconda3/envs/sedenv/lib/python3.7/site-packages/pandas/io/pickle.py in try_read(path, encoding)
    165                 warnings.simplefilter("ignore", Warning)
--> 166                 return read_wrapper(lambda f: pkl.load(f))
    167         except Exception:  # noqa: E722

~/anaconda3/envs/sedenv/lib/python3.7/site-packages/pandas/io/pickle.py in read_wrapper(func)
    145                             compression=compression,
--> 146                             is_text=False)
    147         try:

~/anaconda3/envs/sedenv/lib/python3.7/site-packages/pandas/io/common.py in _get_handle(path_or_buf, mode, encoding, compression, memory_map, is_text)
    412             msg = 'Unrecognized compression type: {}'.format(compression)
--> 413             raise ValueError(msg)
    414 

ValueError: Unrecognized compression type: infer

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
~/anaconda3/envs/sedenv/lib/python3.7/site-packages/pandas/io/pickle.py in try_read(path, encoding)
    172                 return read_wrapper(
--> 173                     lambda f: pc.load(f, encoding=encoding, compat=False))
    174             # compat pickle

~/anaconda3/envs/sedenv/lib/python3.7/site-packages/pandas/io/pickle.py in read_wrapper(func)
    145                             compression=compression,
--> 146                             is_text=False)
    147         try:

~/anaconda3/envs/sedenv/lib/python3.7/site-packages/pandas/io/common.py in _get_handle(path_or_buf, mode, encoding, compression, memory_map, is_text)
    412             msg = 'Unrecognized compression type: {}'.format(compression)
--> 413             raise ValueError(msg)
    414 

ValueError: Unrecognized compression type: infer

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
~/anaconda3/envs/sedenv/lib/python3.7/site-packages/pandas/io/pickle.py in read_pickle(path, compression)
    178     try:
--> 179         return try_read(path)
    180     except Exception:  # noqa: E722

~/anaconda3/envs/sedenv/lib/python3.7/site-packages/pandas/io/pickle.py in try_read(path, encoding)
    176                 return read_wrapper(
--> 177                     lambda f: pc.load(f, encoding=encoding, compat=True))
    178     try:

~/anaconda3/envs/sedenv/lib/python3.7/site-packages/pandas/io/pickle.py in read_wrapper(func)
    145                             compression=compression,
--> 146                             is_text=False)
    147         try:

~/anaconda3/envs/sedenv/lib/python3.7/site-packages/pandas/io/common.py in _get_handle(path_or_buf, mode, encoding, compression, memory_map, is_text)
    412             msg = 'Unrecognized compression type: {}'.format(compression)
--> 413             raise ValueError(msg)
    414 

ValueError: Unrecognized compression type: infer

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
~/anaconda3/envs/sedenv/lib/python3.7/site-packages/pandas/io/pickle.py in try_read(path, encoding)
    165                 warnings.simplefilter("ignore", Warning)
--> 166                 return read_wrapper(lambda f: pkl.load(f))
    167         except Exception:  # noqa: E722

~/anaconda3/envs/sedenv/lib/python3.7/site-packages/pandas/io/pickle.py in read_wrapper(func)
    145                             compression=compression,
--> 146                             is_text=False)
    147         try:

~/anaconda3/envs/sedenv/lib/python3.7/site-packages/pandas/io/common.py in _get_handle(path_or_buf, mode, encoding, compression, memory_map, is_text)
    412             msg = 'Unrecognized compression type: {}'.format(compression)
--> 413             raise ValueError(msg)
    414 

ValueError: Unrecognized compression type: infer

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
~/anaconda3/envs/sedenv/lib/python3.7/site-packages/pandas/io/pickle.py in try_read(path, encoding)
    172                 return read_wrapper(
--> 173                     lambda f: pc.load(f, encoding=encoding, compat=False))
    174             # compat pickle

~/anaconda3/envs/sedenv/lib/python3.7/site-packages/pandas/io/pickle.py in read_wrapper(func)
    145                             compression=compression,
--> 146                             is_text=False)
    147         try:

~/anaconda3/envs/sedenv/lib/python3.7/site-packages/pandas/io/common.py in _get_handle(path_or_buf, mode, encoding, compression, memory_map, is_text)
    412             msg = 'Unrecognized compression type: {}'.format(compression)
--> 413             raise ValueError(msg)
    414 

ValueError: Unrecognized compression type: infer

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
/tmp/ipykernel_13927/2891334954.py in <module>
     21 ]
     22 
---> 23 f = Fitter()
     24 f.star = s
     25 f.setup = setup

~/anaconda3/envs/sedenv/lib/python3.7/site-packages/astroARIADNE-0.5.2-py3.7.egg/astroARIADNE/fitter.py in __init__(self)
    100         self.setup = ['dynesty']
    101         self.norm = False
--> 102         self.grid = 'phoenix'
    103         self.estimate_logg = False
    104         self.av_law = 'fitzpatrick'

~/anaconda3/envs/sedenv/lib/python3.7/site-packages/astroARIADNE-0.5.2-py3.7.egg/astroARIADNE/fitter.py in grid(self, grid)
    186         if grid.lower() == 'phoenix':
    187             with open(gridsdir + '/Phoenixv2_DF.pkl', 'rb') as intp:
--> 188                 self._interpolator = DFInterpolator(pd.read_pickle(intp))
    189         if grid.lower() == 'btsettl':
    190             with open(gridsdir + '/BTSettl_DF.pkl', 'rb') as intp:

~/anaconda3/envs/sedenv/lib/python3.7/site-packages/pandas/io/pickle.py in read_pickle(path, compression)
    180     except Exception:  # noqa: E722
    181         if PY3:
--> 182             return try_read(path, encoding='latin1')
    183         raise
    184 

~/anaconda3/envs/sedenv/lib/python3.7/site-packages/pandas/io/pickle.py in try_read(path, encoding)
    175             except Exception:  # noqa: E722
    176                 return read_wrapper(
--> 177                     lambda f: pc.load(f, encoding=encoding, compat=True))
    178     try:
    179         return try_read(path)

~/anaconda3/envs/sedenv/lib/python3.7/site-packages/pandas/io/pickle.py in read_wrapper(func)
    144         f, fh = _get_handle(path, 'rb',
    145                             compression=compression,
--> 146                             is_text=False)
    147         try:
    148             return func(f)

~/anaconda3/envs/sedenv/lib/python3.7/site-packages/pandas/io/common.py in _get_handle(path_or_buf, mode, encoding, compression, memory_map, is_text)
    411         else:
    412             msg = 'Unrecognized compression type: {}'.format(compression)
--> 413             raise ValueError(msg)
    414 
    415         handles.append(f)

ValueError: Unrecognized compression type: infer
jvines commented 3 years ago

This is weird and has never happened to me... Can you tell me what version of Pandas you're using?

I'm currently using version 1.3.1.

JayChittidi commented 3 years ago

Gah, that was it! I had pip installed the latest version, but installing via conda seems to have solved the issue, thanks!