simonrw / ttvfast-python

Python interface to the TTVFast library
GNU General Public License v2.0
15 stars 6 forks source link

Problem with installation? ttvfast function returning zeros and negatives #18

Closed pearsonkyle closed 6 years ago

pearsonkyle commented 6 years ago

Hello,

I am trying to run version 0.3 of this code however the dictionary the ttvfast.ttvfast function is returning contains a bunch of zeros and negative 2s. I'm fairly certain I'm inputting my values right.

Is there a way I can test this installation and make sure the c code is working? I installed this program with the pip commands on a linux machine.


import ttvfast

msun = 1.989e30
mjup = 1.898e27
rjup = 7.1492e7
mearth = 5.972e24
rearth = 6.3781e6
au=1.496e11
G = 0.00029591220828559104 # day, AU, Msun

if __name__ == "__main__":

    # create ttvfast objects 
    planets = [ ttvfast.models.Planet( 0.000185, 15.2929, 0.00600, 0, 0, 180, 180),
                 ttvfast.models.Planet( 0.000724, 33.5235, 0.0005, 0, 0, 180, 180) ]

    data = ttvfast.ttvfast(planets, 1.077, 0, 1./(24*60*60), 180)

    print(data)

I've run nbody calculations for this system and expect TTV deviations on the order of 25 and 3 minutes for the first and second planet respectively.

sealauren commented 6 years ago

This code works. I've been using it for years. You probably have the wrong input parameters if you're getting -2's, those are the bad flag from TTVFast.c. I suggest reading the TTVFast README to learn more about how the code works.

You can test whether the C installation of TTVFast is working by reading the TTVFast manual and following the example integration for KOI-142 with the example files.

pearsonkyle commented 6 years ago

It's strange because I can get TTVFast.c to run separately but it's not linking up to the python package during the installation

simonrw commented 6 years ago

Sorry for the delayed response. Can you compare your code with this example and see if there is anything obvious going on?

pearsonkyle commented 6 years ago

That example works fine, no errors.

pearsonkyle commented 6 years ago

I think the issue is with finding the c version of TTVFast.

Do you have a directory called TTVFast in the site-packages directory of your python installation? For instance that directory is located here for me: /anaconda3/lib/python3.6/site-packages/ I wonder if I need to download TTVFast into the external/ directory

On a side note, if I redo the installation of your python package and run a $python setup.py build, I receive the following error:

gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Iexternal/TTVFast/c_version -I/home/pearsonk/anaconda3/include/python3.6m -c src/ttvfast_wrapper.c -o build/temp.linux-x86_64-3.6/src/ttvfast_wrapper.o -std=c99
src/ttvfast_wrapper.c:5:21: fatal error: transit.h: No such file or directory
 #include "transit.h"
                     ^
compilation terminated.
error: command 'gcc' failed with exit status 1
sealauren commented 6 years ago

Yes, you need TTVFast.c to be in a specific place, in a subdirectory called external. See the ttvfast-python installation instructions. for details. I just did a fresh install last week (python 3.7) using the git install instructions here:

https://github.com/mindriot101/ttvfast-python/blob/master/README.rst

Hope that helps!

Lauren

On Sun, Oct 28, 2018 at 8:59 AM Kyle A. Pearson notifications@github.com wrote:

I think the issue is with finding the c version of TTVFast.

Do you have a directory called TTVFast in the site-packages directory of your python installation? For instance that directory is located here for me: /anaconda3/lib/python3.6/site-packages/

I wonder if I need to download TTVFast into the external/ directory

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mindriot101/ttvfast-python/issues/18#issuecomment-433731937, or mute the thread https://github.com/notifications/unsubscribe-auth/ABRTfpIJIAHJgeaYzunxeKf346CHvlWsks5upf6vgaJpZM4Xym2O .

pearsonkyle commented 6 years ago

@sealauren Could you please run my example real fast and see if you get the same output (i.e. a bunch of 0s and -2s)?

If so, then it's an issue with my script. If not, then it's an issue with my installation still.

sealauren commented 6 years ago

Hey Kyle,

I ran your example. I also got a bunch of zeros and -2's.

I notice you are not making use of the input_flag keyword. Are your coordinates Jacobi, asterometric, or cartesian? Your planets are pretty massive, the difference between Jacobi and asterometric might be important.

Also, you might want to check your angles. It looks like you are inputing 0 for the inclination, which will not transit. Try i=90. Also, I recommend reading the TTVFast paper to make sure you understand what all the angles mean: https://arxiv.org/abs/1403.1895

From the TTVFast readme, asterometric coordinates: G Mstar Mplanet Period E I LongNode Argument Mean Anomaly (at t=t0, the reference time)....

--Lauren

On Mon, Oct 29, 2018 at 11:29 AM Kyle A. Pearson notifications@github.com wrote:

@sealauren https://github.com/sealauren Could you please run my example real fast and see if you get the same output (i.e. a bunch of 0s and -2s)?

If so, then it's an issue with my script. If not, then it's an issue with my installation still.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mindriot101/ttvfast-python/issues/18#issuecomment-434087476, or mute the thread https://github.com/notifications/unsubscribe-auth/ABRTfjsLIDYp1xW9SM03MVr7DGk9PrS9ks5up3M0gaJpZM4Xym2O .

pearsonkyle commented 6 years ago

Okay, thanks. The installation works and it's a user error!

Just a suggestion, It might be worth adding a simple example to the documentation because I'm sure I'm not the only impatient person out there trying to whip together a code real quick.