kevin218 / Eureka

Eureka! is a data reduction and analysis pipeline intended for time-series observations with JWST.
https://eurekadocs.readthedocs.io/
MIT License
60 stars 47 forks source link

util.binData() not always working well #583

Closed hdiamondlowe closed 8 months ago

hdiamondlowe commented 10 months ago

Instrument

Light curve fitting (Stages 4-6)

What happened?

Hello,

I've noticed that the util.binData function is not great at handling situations where the number of bins is not an integer divisor of the number of data points. In this case, the is some extra data at the end that does not get included in a bin.

I've written a replacement function that I've used in Stage5 plotting that fixes this issue in my forked version of the code, but I have not tested if this breaks Eureka! for other Stages or instruments (sorry).

I'm attaching a zipped jupyter notebook showing the difference: binning_data.zip

As you can see, in the final plot, the binned data from the "binData" function does not account for some data points at the end. The "binData_time" function does. I'm sure there are also alternative fixes.

Thank you for continuing to develop this code!

Error traceback output

No response

What operating system are you using?

Ubuntu 20.04

What version of Python are you running?

Python 3.9.11

What Python packages do you have installed?

No response

Code of Conduct

taylorbell57 commented 10 months ago

Thanks for this @hdiamondlowe! I knew this wasn't an ideal solution at the time I wrote the code, but never documented anywhere that this was a flaw and had since forgotten about it.

The best way for us to test/integrate these changes would be if we open a Pull Request to merge your changes over to this repo. That also has the benefit of giving you credit for the edits you made. Feel free to open a PR if you want and know how to do so, but I can also open a PR from your fork if you're fine with that (so long as you don't have unrelated edits in your main branch; I think me opening the PR just results in a bit less highlighting of your contributions in the version change log).

hdiamondlowe commented 10 months ago

Hi @taylorbell57, sounds good! It's been a while since I've opened a pull request but I think I can manage it. If I get stuck I'll let you know.