LSD can't create database header

25 views
Skip to first unread message

Eduardo Bañados

unread,
Nov 27, 2015, 3:50:02 PM11/27/15
to lsd-users
Hi all,

I need to create lsd databases very often. However, recently in a new machine I cannot create LSD database's headers, not even the simplest example:

lsd-admin --db=./ create table --primary-key obj_id --spatial-keys ra,dec test ra:f8 dec:f8 obj_id:u8

TypeError: ufunc 'bitwise_or' output (typecode 'O') could not be coerced to provided output parameter (typecode 'i') according to the casting rule ''same_kind''


All the other LSD commands work fine, i.e., query, desc table, drop table, etc ...

Also, I don't have problems in another machine where the python packages are not the most updated ones. So my guess is that this is a conflict with some update in a python package, maybe numpy or astropy. Is anyone else experiencing this? Any idea how to solve it? It's critical for me to create databases on this new machine.

For the records, these are the versions I'm running:

python -V

Python 2.7.10 :: Anaconda 2.3.0 (64-bit)

>>> numpy.__version__

'1.10.1'

>>> astropy.__version__

u'1.0.6'


Any help/hint would be greatly appreciated.


Thanks!


Eduardo



Here the complete output error:


lsd-admin --db=./ create table --primary-key obj_id --spatial-keys ra,dec test ra:f8 dec:f8 obj_id:u8

------ rolling back 20151127203638.001821 ---------


Traceback (most recent call last):

  File "/home/banados/lsd/opt/lsd/current/bin/lsd-admin", line 580, in <module>

    args.func(args)

  File "/home/banados/lsd/opt/lsd/current/bin/lsd-admin", line 122, in do_create_table

    db.create_table(args.table, schema)

  File "/home/banados/lsd/opt/lsd/current/lib/python/lsd/join_ops.py", line 1914, in create_table

    table = self.table(tabname, create=True)

  File "/home/banados/lsd/opt/lsd/current/lib/python/lsd/join_ops.py", line 2076, in table

    self.tables[tabname] = Table(path, name=tabname, mode='c', snapid=snapid, open_transaction=True)

  File "/home/banados/lsd/opt/lsd/current/lib/python/lsd/table.py", line 999, in __init__

    self._create(snapid, name, path)

  File "/home/banados/lsd/opt/lsd/current/lib/python/lsd/table.py", line 1029, in _create

    self.catalog = TableCatalog(pix=self.pix)

  File "/home/banados/lsd/opt/lsd/current/lib/python/lsd/table_catalog.py", line 470, in __init__

    self.clear()

  File "/home/banados/lsd/opt/lsd/current/lib/python/lsd/table_catalog.py", line 456, in clear

    self._bmaps = self._compute_mipmaps(np.zeros((w, w), dtype=object))

  File "/home/banados/lsd/opt/lsd/current/lib/python/lsd/table_catalog.py", line 425, in _compute_mipmaps

    m0[:,:] |= m1[i::2, j::2]

TypeError: ufunc 'bitwise_or' output (typecode 'O') could not be coerced to provided output parameter (typecode 'i') according to the casting rule ''same_kind''

Eduardo Bañados

unread,
Nov 27, 2015, 7:29:19 PM11/27/15
to lsd-users
I found a temporary solution, which does the trick but I think this should be fixed in the core of the LSD code. 
The problem with the issue I reported here is due to the new cast defaults in numpy 10. There was also another problem with the astropy.wcs I ran into. Below you can find the lines of code I had to modify to make my codes work. These should be addressed in the next LSD data releases.

In table_catalog.py:425 replace:
m0[:,:] |= m1[i::2, j::2]
by:
np.bitwise_or(m0[:,:], m1[i::2, j::2], out=m0[:,:], casting='unsafe')

In builtins/SFD.py:79 replace
x, y = wcs.wcs_sky2pix(l[m], b[m], 0)
by:
x, y = wcs.all_world2pix(l[m], b[m], 0)

I hope this is useful for someone.... it took me an entire day!

Eduardo

Eddie Schlafly

unread,
Nov 27, 2015, 11:14:19 PM11/27/15
to lsd-...@googlegroups.com
That's probably fine. I remember hitting something similar once and
deciding that m was intended to ~always be booleans, and replaced that
line with:
m0[:,:] |= (m1[i::2, j::2] != 0)
> --
> You received this message because you are subscribed to the Google Groups
> "lsd-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to lsd-users+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages