kbarbary / sep

Python and C library for source extraction and photometry
183 stars 57 forks source link

bench.py seems broken? #104

Open RReverser opened 3 years ago

RReverser commented 3 years ago

I was trying to run bench.py to compare master branch and my other changes, but it doesn't seem to work:

$ ./bench.py

sep version:  1.1.1

| test                    | sep             |
|-------------------------|-----------------|
Traceback (most recent call last):
  File "./bench.py", line 85, in <module>
    data = np.tile(rawdata, (ntile, ntile))
NameError: name 'rawdata' is not defined

I fixed this one by defining rawdata = None at the top level of the script, but then another error pops up:

$ ./bench.py

sep version:  1.1.1

| test                    | sep             |
|-------------------------|-----------------|
Traceback (most recent call last):
  File "./bench.py", line 90, in <module>
    bkg = sep.Background(data)
  File "sep.pyx", line 415, in sep.Background.__cinit__
    _parse_arrays(data, None, None, mask, None, &im)
  File "sep.pyx", line 313, in sep._parse_arrays
    im.dtype = _get_sep_dtype(data.dtype)
  File "sep.pyx", line 227, in sep._get_sep_dtype
    raise ValueError('input array dtype not supported: {0}'.format(dtype))
ValueError: input array dtype not supported: object

Is bench.py supposed to work in general?

kbarbary commented 3 years ago

rawdata might not be defined if you don't have a FITS reader installed (either astropy or fitsio).

RReverser commented 3 years ago

@kbarbary I think I do have it installed, at least I followed the setup commands, and ./test.py passes successfully too (which seems to use the same deps).

kbarbary commented 3 years ago

test.py will skip tests that require a FITS reader if one isn't installed.

Looking at bench.py, I'm pretty sure HAVE_FITS is evaluating to False for you. So the astropy.io.fits and fitsio imports are failing for some reason. You might want to check that those imports succeed in your environment to debug.

All this said, bench.py should still work if a FITS reader isn't installed, so there is a bug there. Sorry about that! It isn't a super robust script I guess.

RReverser commented 3 years ago

test.py will skip tests that require a FITS reader if one isn't installed.

Ah, I see, that probably explains it. It could probably be more useful to require FITS there too, to make sure all tests are ran.

I'll try to install other deps you mentioned.

RReverser commented 3 years ago

Installing those deps has indeed fixed the issue, thanks. I'll keep this issue open though, as the script should probably be more robust in face of missing deps as you mentioned above.