Skip to content

BUG: non-default return type is not working for vizier #1630

@bsipocz

Description

@bsipocz

I've run into this while making a PR for #1626.
The vizier module is the only one where the fast reader was used purposefully (done in #526), but I wanted to make sure that it makes sense there timing wise. As it seems the asu-tsv return type is not working at all, and the tests don't seem to cover any of the non default return types.

In [2]: from astroquery.vizier import Vizier                                                                                            

In [3]: %timeit m83t = Vizier.query_object('M83', return_type='asu-tsv', cache=False)                                                   
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-3-513121d2586c> in <module>
----> 1 get_ipython().run_line_magic('timeit', "m83t = Vizier.query_object('M83', return_type='asu-tsv', cache=False)")

/usr/local/lib/python3.7/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2312                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2313             with self.builtin_trap:
-> 2314                 result = fn(*args, **kwargs)
   2315             return result
   2316 

</usr/local/lib/python3.7/site-packages/decorator.py:decorator-gen-60> in timeit(self, line, cell, local_ns)

/usr/local/lib/python3.7/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/usr/local/lib/python3.7/site-packages/IPython/core/magics/execution.py in timeit(self, line, cell, local_ns)
   1156             for index in range(0, 10):
   1157                 number = 10 ** index
-> 1158                 time_number = timer.timeit(number)
   1159                 if time_number >= 0.2:
   1160                     break

/usr/local/lib/python3.7/site-packages/IPython/core/magics/execution.py in timeit(self, number)
    167         gc.disable()
    168         try:
--> 169             timing = self.inner(it, self.timer)
    170         finally:
    171             if gcold:

<magic-timeit> in inner(_it, _timer)

~/munka/devel/astroquery/astroquery/utils/class_or_instance.py in f(*args, **kwds)
     23         def f(*args, **kwds):
     24             if obj is not None:
---> 25                 return self.fn(obj, *args, **kwds)
     26             else:
     27                 return self.fn(cls, *args, **kwds)

~/munka/devel/astroquery/astroquery/utils/process_asyncs.py in newmethod(self, *args, **kwargs)
     27             if kwargs.get('get_query_payload') or kwargs.get('field_help'):
     28                 return response
---> 29             result = self._parse_result(response, verbose=verbose)
     30             self.table = result
     31             return result

~/munka/devel/astroquery/astroquery/vizier/core.py in _parse_result(self, response, get_catalog_names, verbose, invalid)
    659                                       str(self.table_parse_error))
    660         elif response.content[:5] == b'#\n#  ':
--> 661             return parse_vizier_tsvfile(response.content, verbose=verbose)
    662         elif response.content[:6] == b'SIMPLE':
    663             return fits.open(BytesIO(response.content),

~/munka/devel/astroquery/astroquery/vizier/core.py in parse_vizier_tsvfile(data, verbose)
    690 
    691     # http://stackoverflow.com/questions/4664850/find-all-occurrences-of-a-substring-in-python
--> 692     split_indices = [m.start() for m in re.finditer('\n\n#', data)]
    693     # we want to slice out chunks of the file each time
    694     split_limits = zip(split_indices[:-1], split_indices[1:])

/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/re.py in finditer(pattern, string, flags)
    228 
    229     Empty matches are included in the result."""
--> 230     return _compile(pattern, flags).finditer(string)
    231 
    232 def compile(pattern, flags=0):

TypeError: cannot use a string pattern on a bytes-like object

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions