Numpy error in calibration

330 views
Skip to first unread message

Umair Khan

unread,
May 19, 2018, 8:52:51 PM5/19/18
to OpenStartracker
When running calibrate.py on the BeagleBone Black, I'm coming across an error in numpy, which I have minimal experience with, so I'm a little lost. The following error pops up on line 135:

Traceback (most recent call last):
  File "calibrate.py", line 135, in <module>
    db_img_dist=np.linalg.norm(astrometry_results_all[:,9:11]-astrometry_results_all[:,11:13],axis=1)
  File "/usr/lib/python2.7/dist-packages/numpy/linalg/linalg.py", line 2206, in norm
    return sqrt(add.reduce(s, axis=axis, keepdims=keepdims))
AttributeError: 'float' object has no attribute 'sqrt'

Note that the entire calibration process runs fine up to this point -- if there isn't existing calibration data, astrometry.net solves the sample images and everything appears normal. This error occurs regardless of whether or not calibration data already exists for the sample images.

Thoughts/ideas? Thanks in advance.

Andrew Tennenbaum

unread,
May 19, 2018, 9:09:15 PM5/19/18
to Umair Khan, OpenStartracker
Yeah, it’s not just you. I think there was an update to numpy that broke something. Try it now with the latest version of the newapi branch

--
You received this message because you are subscribed to the Google Groups "OpenStartracker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openstartrack...@googlegroups.com.
To post to this group, send email to opensta...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openstartracker/8f9a4b86-fa64-421e-9f2f-6175b21526bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Umair Khan

unread,
May 19, 2018, 9:42:55 PM5/19/18
to OpenStartracker
Nope...still have the same error, just on line 136:

Traceback (most recent call last):
  File "calibrate.py", line 136, in <module>
    db_img_dist=np.sqrt(np.sum(db_img_dist*db_img_dist,axis=1))

AttributeError: 'float' object has no attribute 'sqrt'

This was with a fresh GitHub pull, nothing changed at all (using the feb16 folder).

Andrew Tennenbaum

unread,
May 20, 2018, 4:39:11 PM5/20/18
to Umair Khan, OpenStartracker
ok, give it a try now

To unsubscribe from this group and stop receiving emails from it, send an email to openstartracker+unsubscribe@googlegroups.com.
To post to this group, send email to openstartracker@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openstartracker/8779e4a8-0645-41b8-8a10-a5e01520e2f9%40googlegroups.com.

Umair Khan

unread,
May 20, 2018, 4:59:35 PM5/20/18
to OpenStartracker
Unfortunately, I've run into another problem with the BeagleBone, so it might be several days before I can test this fix on the board. I did test it on my laptop, and it seemed to work fine. Sorry for the delay.

Umair Khan

unread,
Jun 18, 2018, 4:37:29 PM6/18/18
to OpenStartracker
Sorry it's been almost a month of radio silence. Between finals and problems with the board and a platform switch and waiting for shipments, I haven't been able to do a lot these last few weeks. But I'm back now working with the BeagleBone Enhanced.

Unfortunately, the error still persists, even with the latest from the newapi branch.

Traceback (most recent call last):
  File "calibrate.py", line 135, in <module>
    db_img_dist=np.linalg.norm(astrometry_results_all[:,9:11]-astrometry_results_all[:,11:13],axis=1)
  File "/usr/lib/python2.7/dist-packages/numpy/linalg/linalg.py", line 2206, in norm
    return sqrt(add.reduce(s, axis=axis, keepdims=keepdims))
AttributeError: 'float' object has no attribute 'sqrt'


Andrew Tennenbaum

unread,
Jun 18, 2018, 4:43:56 PM6/18/18
to Umair Khan, OpenStartracker
Just to double check, what is at line 128 in the version you are using?

Umair Khan

unread,
Jun 18, 2018, 5:08:59 PM6/18/18
to OpenStartracker
astrometry_results_all=np.vstack(np.array(astrometry_results.values()))

Umair Khan

unread,
Jun 18, 2018, 6:23:50 PM6/18/18
to OpenStartracker
I think I got it figured out. You have to change the type of the array after making it.

astrometry_results_all = np.vstack(np.array(astrometry_results.values()))
astrometry_results_all = astrometry_results_all.astype('float')

I have no idea how big a performance hit this is, but it works.

Andrew Tennenbaum

unread,
Jun 18, 2018, 9:02:20 PM6/18/18
to Umair Khan, OpenStartracker
Awesome! Let me know your account on github, and I’ll give you access so you can push the change

Reply all
Reply to author
Forward
0 new messages