Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem reconstructing the PSF at given wavelengths #3

Closed
cloud182 opened this issue Mar 20, 2020 · 5 comments
Closed

Problem reconstructing the PSF at given wavelengths #3

cloud182 opened this issue Mar 20, 2020 · 5 comments

Comments

@cloud182
Copy link

Hi,

I'm trying to use PSFR to reconstruct the PSF of some MUSE AO datacubes. I'd like to recover the properties of the PSF at given wavelengths. In the documentation, I saw that this is possible by using the lbda parameter in compute_psf_from_sparta(). According to the documentation, lbda should be an array. Now, I tried to define lbda in several ways: an array of float, an array of int, an array with a single int, a single int, but I always get a weird error (I removed the non-standard paths with xxx):


Traceback (most recent call last):
  File "xxx/envs/py36/lib/python3.6/site-packages/joblib/externals/loky/process_executor.py", line 418, in _process_worker
    r = call_item()
  File "xxx/envs/py36/lib/python3.6/site-packages/joblib/externals/loky/process_executor.py", line 272, in __call__
    return self.fn(*self.args, **self.kwargs)
  File "xxx/envs/py36/lib/python3.6/site-packages/joblib/_parallel_backends.py", line 608, in __call__
    return self.func(*args, **kwargs)
  File "xxx/envs/py36/lib/python3.6/site-packages/joblib/parallel.py", line 256, in __call__
    for func, args, kwargs in self.items]
  File "xxx/envs/py36/lib/python3.6/site-packages/joblib/parallel.py", line 256, in <listcomp>
    for func, args, kwargs in self.items]
  File "xxx/envs/py36/lib/python3.6/site-packages/muse_psfr/psfrec.py", line 970, in compute_psf
    psf = convolve_final_psf(lbda, seeing, GL, L0, psf)
  File "xxx/envs/py36/lib/python3.6/site-packages/muse_psfr/psfrec.py", line 927, in convolve_final_psf
    kernel = Moffat2DKernel(alpha, beta, x_size=nx, y_size=ny)
  File "xxx/envs/py36/lib/python3.6/site-packages/astropy/convolution/kernels.py", line 819, in __init__
    self._default_size = _round_up_to_odd_integer(4.0 * self._model.fwhm)
  File "xxx/envs/py36/lib/python3.6/site-packages/astropy/convolution/kernels.py", line 21, in _round_up_to_odd_integer
    i = math.ceil(value)
ValueError: cannot convert float NaN to integer

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "xxx/test.py", line 80, in <module>
    recover_psf(spartas, wavelength)

  File "xxx/test.py", line 64, in recover_psf
    out = compute_psf_from_sparta(hdu, lbda = wave)

  File "xxx/envs/py36/lib/python3.6/site-packages/muse_psfr/psfrec.py", line 1080, in compute_psf_from_sparta
    delayed(compute_psf)(*args) for args in to_compute)

  File "xxx/envs/py36/lib/python3.6/site-packages/joblib/parallel.py", line 1017, in __call__
    self.retrieve()

  File "xxx/envs/py36/lib/python3.6/site-packages/joblib/parallel.py", line 909, in retrieve
    self._output.extend(job.get(timeout=self.timeout))

  File "xxx/envs/py36/lib/python3.6/site-packages/joblib/_parallel_backends.py", line 562, in wrap_future_result
    return future.result(timeout=timeout)

  File "xxx/envs/py36/lib/python3.6/concurrent/futures/_base.py", line 432, in result
    return self.__get_result()

  File "xxx/envs/py36/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception

ValueError: cannot convert float NaN to integer

what I'm doing is:

wave = np.array([5000,6000,7000])
out = compute_psf_from_sparta(hdu, lbda = wave)

where hdu is the HDUList of a MUSE raw file with a SPARTA table downloaded from the ESO archive.
If I use lmin, lmax and nl, everything works fine.
Am I doing something wrong? Or is it a bug in the code? It seems that something with parallelization is not working, but I'm not sure what.

Thank you very much for your help!

Copy link
Member

My first guess would be that there is some garbage data in the SPARTA table, by default you should see a line printed with the seeing, L0 and GL values, are those correct ?
If the file is public could you give me its name so I can download it, otherwise could you send me the SPARTA table ?

@cloud182
Copy link
Author

cloud182 commented Mar 20, 2020 via email

Copy link
Member

Ah I know, that's because wavelength values must be in nm, not in Angstroms. That's a code coming from AO scientists, they prefer nm ;). I will see if I can make this clearer in the docs.

@cloud182
Copy link
Author

cloud182 commented Mar 20, 2020 via email

Copy link
Member

No worries, I knew this could be confusing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants