zclaytor / butterpy

Python simulations of stellar butterfly diagrams and rotational light curves
MIT License
15 stars 5 forks source link

The Grand Poo-Bah #1

Closed mileslucas closed 5 years ago

mileslucas commented 5 years ago

Sorry for having such a mammoth-sized PR.

Julia

Wrote julia code using default folder structure (under src). I put info in the README about all the code and some general usage. All functions have docstrings, too. In general, it follows the structure of your code but I've changed some names and opted to create a Spot type instead of using dataframes for spot properties (sproperties?).

The Julia code should be able to completely coexist with the python code in this setup.

Python

I've added a setup.py so you can easily pip install. I also use pipenv so there is a Pipfile (sort of like requirements.txt for millenials). I've thrown some info into README about installation, but I did not write out much about the usage. Any other changes to the python files have just been formatting using black.

I noted to you in person the discrepancy in regions.py about the indexing from the first cum_sum, but have not changed anything here.

Benchmarks

Created a benchmark folder bench with a scrip to generate data generate.jl, a script to simulate via julia bench.jl and a script to simulate via python bench.py. I can talk to you more in person about how to run those if you are interested. Note that the comparison of output light curves is invalid due to the random number generation in regions code. To do a true comparison you would have to hardcode those values (which I did while trying to determine accuracy and stability of the julia code).

Comments

I personally think the python code can be organized a tiny bit better (make it look more like a python package). I'd be happy to help with that. I also would like to try and figure out ways to unit-test both the code-bases. Right now the only test i can think of is dummy creating spots and making sure functions run rather than actually testing their outputs. Also, if you plan to release this code publicly, proper documentation would be pretty easy to set-up and very useful. I am pretty well-experienced in doing that for both python and julia.