spacetelescope / cubeviz

Data analysis package for cubes. https://cubeviz.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
15 stars 25 forks source link

fit spaxels crashes #571

Closed hcferguson closed 3 years ago

hcferguson commented 5 years ago

fit spaxels crashes with a segmentation fault and no stack trace on AGN_outflow/ngc4151_hband

brechmos-stsci commented 5 years ago

Could you add a stack trace to this? Is this really a specviz issue?

nmearl commented 5 years ago

Does it happen consistently? Is this the same crashing you experience in #539?

hcferguson commented 5 years ago

Consistently when fitting a linear model over a wide wavelength region in this spectrum. No stack trace -- just a segmentation fault. The issue in #539 seems different in that it had a stack trace.

brechmos-stsci commented 5 years ago

@hcferguson, I would suggest you try it in standalone specviz. If it crashes there, open up a specviz ticket and link back to here.

hcferguson commented 5 years ago

There's no way to 'fit spaxels' in standalone specviz.

It should be possible to write a script using specutils to do the same thing. I agree, the problem is likely in the model fitting, so issue is best on the specutils repo.

nmearl commented 5 years ago

@hcferguson please try with the current master in my fork (pip install git+https://github.com/nmearl/specviz --upgrade) and let me know if you experience the same issue.

hcferguson commented 5 years ago

I got a 1D fit to work. When I tried fit spaxels, I got the same QTextCursor error and crash that I'm seeing now on #576.

QObject::connect: Cannot queue arguments of type 'QTextCursor'
(Make sure 'QTextCursor' is registered using qRegisterMetaType().)
WARNING: Model is linear in parameters; consider using linear fitting methods. [astropy.modeling.fitting]
WARNING:astropy:Model is linear in parameters; consider using linear fitting methods.
[1]    79942 segmentation fault  cubeviz
nmearl commented 5 years ago

@hcferguson Can you update with the latest changes in my fork and give it another shot?

hcferguson commented 5 years ago

Tried to fit the linear model in specviz before doing fit spaxels. Worked the first time. The second time, I got the QTextCursor error and segfault.

  warnings.warn('Data.visible_components is deprecated', UserWarning)
QObject::connect: Cannot queue arguments of type 'QTextCursor'
(Make sure 'QTextCursor' is registered using qRegisterMetaType().)
WARNING: Model is linear in parameters; consider using linear fitting methods. [astropy.modeling.fitting]
WARNING:astropy:Model is linear in parameters; consider using linear fitting methods.
[1]    72030 segmentation fault  cubeviz
hcferguson commented 5 years ago

Fired it up again and tried fit spaxels. In prior attempts, this was getting close to finished within 10 seconds before it crashed. Now I assume you have turned off threading, so we don't get the progress bar. I've given it 5 minutes and it's still sitting there with no response, which seems implausibly long for this dataset if it's actually working.

nmearl commented 5 years ago

Very strange. Threading has not been turned off. There are no error messages in the terminal?

hcferguson commented 5 years ago

Possibly:

WARNING: Model is linear in parameters; consider using linear fitting methods. [astropy.modeling.fitting]
WARNING:astropy:Model is linear in parameters; consider using linear fitting methods.
Traceback (most recent call last):
  File "/Users/hcferguson/anaconda3/envs/cubeviz-v0.3b1/lib/python3.6/site-packages/specviz/third_party/glue/workers.py", line 30, in run
    new_data, unit = self._function(self._data, self._tracker)
  File "/Users/hcferguson/anaconda3/envs/cubeviz-v0.3b1/lib/python3.6/site-packages/specviz/third_party/glue/operations.py", line 158, in <lambda>
    *args, model=model, spectral_axis=spectral_axis, mask=mask),
  File "/Users/hcferguson/anaconda3/envs/cubeviz-v0.3b1/lib/python3.6/site-packages/specviz/third_party/glue/operations.py", line 142, in threadable_function
    out[:, x, y] = new_data
ValueError: could not broadcast input array from shape (1762) into shape (2040)
nmearl commented 5 years ago

@hcferguson Can you try again with the latest?

hcferguson commented 5 years ago

@nmearl Alas still fails with

QObject::connect: Cannot queue arguments of type 'QTextCursor'
(Make sure 'QTextCursor' is registered using qRegisterMetaType().)
WARNING: Model is linear in parameters; consider using linear fitting methods. [astropy.modeling.fitting]
WARNING:astropy:Model is linear in parameters; consider using linear fitting methods.
[1]    2483 segmentation fault  cubeviz
hcferguson commented 5 years ago

Did a fresh install. It worked once, then failed when I changed the ROI and tried again. A few warnings issued in addition to the QTextCursor.

QObject::connect: Cannot queue arguments of type 'QTextCursor'
(Make sure 'QTextCursor' is registered using qRegisterMetaType().)
WARNING: Model is linear in parameters; consider using linear fitting methods. [astropy.modeling.fitting]
WARNING:astropy:Model is linear in parameters; consider using linear fitting methods.
WARNING: Model is linear in parameters; consider using linear fitting methods. [astropy.modeling.fitting]
WARNING:astropy:Model is linear in parameters; consider using linear fitting methods.
[1]    3683 segmentation fault  cubeviz