sep icon indicating copy to clipboard operation
sep copied to clipboard

bench.py seems broken?

Open RReverser opened this issue 4 years ago • 5 comments

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?

RReverser avatar Mar 06 '21 01:03 RReverser

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

kbarbary avatar Mar 07 '21 03:03 kbarbary

@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).

RReverser avatar Mar 07 '21 03:03 RReverser

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.

kbarbary avatar Mar 07 '21 04:03 kbarbary

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 avatar Mar 07 '21 04:03 RReverser

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.

RReverser avatar Mar 07 '21 04:03 RReverser