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

baseline bug or feature -- debatable #252

Open
leemundy opened this issue May 12, 2024 · 2 comments
Open

baseline bug or feature -- debatable #252

leemundy opened this issue May 12, 2024 · 2 comments
Labels
beta Beta testing issue bug Something isn't working low priority

Comments

@leemundy
Copy link
Collaborator

Describe the bug
The baseline method has exclusion regions specified in channels. The baseline_model prints out the
solution with the slope in K/Hz rather than K/chan. The downside of the latter is that the y-intercept, c0, is not an obvious number since the spectra run over frequencies in the GHz range.

How to Reproduce
Use the provided frequency switch notebook. You will see that the spectral baseline is around zero K but the
baseline model is:
Model: Polynomial1D
Inputs: ('x',)
Outputs: ('y',)
Model set size: 1
Degree: 3
Parameters:
c0 c1 ... c3
K K / Hz ... K / Hz3
----------------- ---------------------- ... ----------------------
7.735236225877181 -5.459874717654905e-09 ... -2.024830644563859e-63
It is not that it is incorrect; it just that the user does not have an intuitive check of
the value. It would be easier for the user to understand if the reported fit were in
channel space. Also, all of the coefficients should be printed (c2 is missing in this
case).

Environment

  • Dysh version
  • Python version 3.11
@leemundy leemundy added the bug Something isn't working label May 12, 2024
@astrofle astrofle added the beta Beta testing issue label May 22, 2024
@teuben
Copy link
Collaborator

teuben commented May 22, 2024

See also discussion in #174

@teuben
Copy link
Collaborator

teuben commented May 22, 2024

For other reasons (the rounding problem) the code has been fixed as to normalize the freq. axis to 0..nchan-1 so now the polynomial coeffs are more natural if you think in channel space.
Sadly, due to astropy not know what channels are, the units of the coefficients are still displayed as C1/Hz and C2/Hz2 etc., but they really are per channel

In dysh the failure to use chan is here:

                self._spectral_axis[i] = i * u.chan

See also astropy/specutils#542 where the claim is that this was solved. Thus our use of the spectrum1D class must be at fault. TBD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta Beta testing issue bug Something isn't working low priority
Projects
None yet
Development

No branches or pull requests

3 participants