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

stop fully masking negative fluxes #51

Open
megbedell opened this issue Feb 15, 2019 · 2 comments
Open

stop fully masking negative fluxes #51

megbedell opened this issue Feb 15, 2019 · 2 comments

Comments

@megbedell
Copy link
Owner

Currently if any fluxes in the HARPS data are reported as negative, we set the ivars to zero.. but this has the effect of leaving no data in the deep cores of super strong lines, which makes the template go to continuum in the middle of the line (bc regularization). We should change this to preserve a little information in the line cores. This is relevant especially for doing science with the stellar template!

@mzechmeister
Copy link

Negative data points can occur simply at zero flux due to readout noise.
I flag significant negative flux values.
https://github.com/mzechmeister/serval/blob/73e1fd843b196ab75f5b95c3652519b7ed90c2d3/src/read_spec.py#L513
In contrast to that, negative template fluxes appear unphysically and should be avoided. Probably, it can not occur in your model, since you work in log-space. But I'm curios how you transform the negative data.

@megbedell
Copy link
Owner Author

Thanks, this is useful info! Currently I take every pixel that has unnormalized flux count < 1 and set it to 1, along with setting the inverse variance on that point to zero so that it's essentially masked out:

def mask_low_pixels(self, min_flux = 1., padding = 2, min_snr = 5.):

I also mask out pixels on either side of the "bad" one, although that may not be the correct thing to do if it's read noise causing the negative fluxes. In the cases I've seen it seems more like the background sky subtraction (which is done in the HARPS pipeline spectral extraction) is overly aggressive.
I do this setting to 1 step because transforming the flux to log space won't work otherwise - so as you say we don't have any issues with unphysical negative fluxes in the template, but the problem is sort of transferred to come earlier in the process when logging the data!

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