├── .coveragerc ├── .gitignore ├── .gitmodules ├── .travis.yml ├── .vimrc ├── CHANGELOG.rst ├── LICENSE ├── MANIFEST.in ├── Makefile ├── README.rst ├── pytest.ini ├── requirements.txt ├── scripts └── check_for_memory_leaks.py ├── setup.cfg ├── setup.py ├── src └── ttvfast_wrapper.c ├── testing ├── conftest.py ├── example_output.txt ├── test_lweiss.py ├── test_models.py ├── test_python_api.py ├── test_rv.py └── test_ttvfast.py ├── towncrier.ini ├── tox.ini └── ttvfast ├── __init__.py ├── _ttvfast.pyi ├── models.py ├── newsfragments └── .gitignore └── version.py /.coveragerc: -------------------------------------------------------------------------------- 1 | [run] 2 | branch = True 3 | source = ttvfast 4 | 5 | [report] 6 | show_missing = True 7 | 8 | [paths] 9 | source = 10 | ttvfast/ 11 | .tox/*/lib/python*/site-packages/ttvfast 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | venv 2 | *.so 3 | *.o 4 | *.pyc 5 | build 6 | files.tar.gz 7 | *.swp 8 | *.egg-info 9 | .cache 10 | htmlcov 11 | .coverage 12 | dist 13 | .tox 14 | .mypy_cache 15 | htmlmypy 16 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "external/TTVFast"] 2 | path = external/TTVFast 3 | url = https://github.com/mindriot101/TTVFast-python-compat.git 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | cache: pip 3 | python: 4 | - "2.7" 5 | - "3.6" 6 | install: 7 | - "pip install -r requirements.txt" 8 | - "pip install ." 9 | script: pytest testing 10 | -------------------------------------------------------------------------------- /.vimrc: -------------------------------------------------------------------------------- 1 | nnoremap t :w\|!python setup.py build_ext --inplace && py.test testing 2 | -------------------------------------------------------------------------------- /CHANGELOG.rst: -------------------------------------------------------------------------------- 1 | Master branch 2 | ============= 3 | 4 | - Dropped support for python 2.6 and 3.3 as they have been end-of-life'd. (2017-09-30) 5 | 6 | 7 | Ttvfast 0.3.0 (2016-11-07) 8 | ========================== 9 | 10 | Features 11 | -------- 12 | 13 | - Support multiple RV measurements in a single time step. Thanks 14 | @sealauren (#13) 15 | 16 | Improved Documentation 17 | ---------------------- 18 | 19 | - Add towncrier support to auto-generate changelogs. (#14) 20 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | {description} 294 | Copyright (C) {year} {fullname} 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | {signature of Ty Coon}, 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include LICENSE 2 | include README.rst 3 | 4 | recursive-include external/TTVFast/c_version * 5 | 6 | prune ttvfast/newsfragments 7 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | TOXARGS ?= 2 | 3 | all: help 4 | 5 | help: 6 | @echo "Commands:" 7 | @echo "- test" 8 | @echo "- coverage" 9 | @echo "- package" 10 | 11 | test: 12 | tox $(TOXARGS) 13 | 14 | coverage: 15 | py.test --cov ttvfast --cov-report html --cov-report term testing 16 | 17 | package: 18 | @-rm -r dist/* 2>/dev/null 19 | @-rm -r build/* 2>/dev/null 20 | python setup.py sdist bdist_wheel 21 | for file in dist/*; do gpg --detach-sign -a $$file; done 22 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | ======= 2 | TTVFast 3 | ======= 4 | :Author: Simon Walker 5 | 6 | .. image:: https://img.shields.io/pypi/v/ttvfast.svg?maxAge=2592000 7 | :target: https://pypi.python.org/pypi/ttvfast 8 | .. image:: https://travis-ci.org/mindriot101/ttvfast-python.svg?branch=master 9 | :target: https://travis-ci.org/mindriot101/ttvfast-python 10 | 11 | A Python wrapper around Katherine Deck's TTVFast C program (https://github.com/kdeck/TTVFast) 12 | 13 | For the latest changes, see `the CHANGELOG `_. 14 | 15 | 16 | Installation 17 | ============ 18 | 19 | For contributing to the package, see the `Development instructions`_. 20 | 21 | Install from pypi: 22 | 23 | ``pip install ttvfast`` 24 | 25 | For the latest development version, install with pip: 26 | 27 | ``pip install git+https://github.com/mindriot101/ttvfast.git`` 28 | 29 | Development instructions 30 | ------------------------ 31 | 32 | To contribute to ``ttvfast``, clone the repository and fetch the submodule:: 33 | 34 | git clone https://github.com/mindriot101/ttvfast-python.git 35 | cd ttvfast-python 36 | git submodule init 37 | git submodule update # grabs code from TTVFast 38 | 39 | install the package, in "development mode" into the current python environment:: 40 | 41 | pip install -e . 42 | 43 | This way any python code changes made to the current directory will be reflected in the package. Note: any changes to the C code require recompilation by reinstalling the package with ``pip install -e .`` (see the `editable install documentation `_ documentation for more information). 44 | 45 | Once the package is installed, test that everything built properly using:: 46 | 47 | $ py.test 48 | ============================== test session starts =============================== 49 | testing/test_lweiss.py . 50 | testing/test_models.py ... 51 | testing/test_python_api.py ... 52 | testing/test_ttvfast.py ... 53 | 54 | 55 | Usage 56 | ===== 57 | 58 | To compute the TTV properties for one or more planets: 59 | 60 | - build a ``ttvfast.models.Planet`` instance (see the class documentation for required parameters) 61 | - pass a list of the planets in the system to ``ttvfast.ttvfast`` along with: 62 | 63 | - the stellar mass in units of solar mass, 64 | - the start point of the integration in days, 65 | - the time step for the integration in days, 66 | - and the end point for integration in days. 67 | 68 | The function ``ttvfast.ttvfast`` returns a dictionary containing ``positions`` and ``rv``. The ``positions`` entry is a tuple of: 69 | 70 | 1. a list of integer indices for which values correspond to which planet, 71 | 2. a list of integers defining the epoch, 72 | 3. a list of times, 73 | 4. a list of rsky values, and 74 | 5. a list of vsky values. 75 | 76 | The optional ``rv_times`` parameter takes a list of RV times on which the RV is to be calculated. If so the ``rv`` entry in the output 77 | dictionary is populated with a list of RV values, and otherwise ``None``. 78 | 79 | For example: 80 | 81 | .. code-block:: python 82 | 83 | from ttvfast import models 84 | 85 | 86 | gravity = 0.000295994511 # AU^3/day^2/M_sun 87 | stellar_mass = 0.95573417954 # M_sun 88 | 89 | 90 | planet1 = models.Planet( 91 | mass=0.00002878248, # M_sun 92 | period=1.0917340278625494e+01, # days 93 | eccentricity=5.6159310042858110e-02, 94 | inclination=9.0921164935951211e+01, # degrees 95 | longnode=-1.1729336712101943e-18, # degrees 96 | argument=1.8094838714599581e+02, # degrees 97 | mean_anomaly=-8.7093652691581923e+01, # degrees 98 | ) 99 | 100 | planet2 = models.Planet( 101 | mass=0.00061895914, 102 | period=2.2266898036209028e+01, 103 | eccentricity=5.6691301931178648e-02, 104 | inclination=8.7598285693573246e+01, 105 | longnode=4.6220554014026838e-01, 106 | argument=1.6437004273382669e+00, 107 | mean_anomaly=-1.9584857031843157e+01, 108 | ) 109 | 110 | planets = [planet1, planet2] 111 | Time = -1045 # days 112 | dt = 0.54 # days 113 | Total = 1700 # days 114 | 115 | results = ttvfast.ttvfast(planets, stellar_mass, Time, dt, Total) 116 | 117 | 118 | For more details, see the original C module's documentation: https://github.com/kdeck/TTVFast/blob/master/c_version/README 119 | 120 | Citations 121 | ========= 122 | 123 | If you use this code, please cite Deck, Agol, Holman, & Nesvorny (2014), 124 | ApJ, 787, 132, arXiv:1403.1895. 125 | 126 | -Katherine Deck, Eric Agol, Matt Holman, & David Nesvorny 127 | -------------------------------------------------------------------------------- /pytest.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | norecursedirs = venv 3 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | coverage==4.5.1 2 | numpy==1.16.0 3 | pytest==4.1.1 4 | pytest-cov==2.6.1 5 | six==1.12.0 6 | -------------------------------------------------------------------------------- /scripts/check_for_memory_leaks.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | import resource 5 | import numpy as np 6 | import ttvfast 7 | import os 8 | import matplotlib.pyplot as plt 9 | 10 | plt.style.use('ggplot') 11 | 12 | def build_args(): 13 | params = [ 14 | 0.000295994511, 15 | 0.95573417954, 16 | 0.00002878248, 17 | 1.0917340278625494e+01, 18 | 5.6159310042858110e-02, 19 | 9.0921164935951211e+01, 20 | -1.1729336712101943e-18, 21 | 1.8094838714599581e+02, 22 | -8.7093652691581923e+01, 23 | 0.00061895914, 24 | 2.2266898036209028e+01, 25 | 5.6691301931178648e-02, 26 | 8.7598285693573246e+01, 27 | 4.6220554014026838e-01, 28 | 1.6437004273382669e+00, 29 | -1.9584857031843157e+01] 30 | 31 | Time = -1045 32 | dt = 0.54 33 | Total = 1700 34 | n_plan = 2 35 | input_flag = 0 36 | 37 | return params, Time, dt, Total, n_plan, input_flag 38 | 39 | def run_function(Time, dt, Total, params): 40 | # Taken from lweiss test 41 | planet1 = ttvfast.models.Planet(*params[2:2+7]) 42 | planet2 = ttvfast.models.Planet(*params[2+7:]) 43 | 44 | gravity, stellar_mass = params[0:2] 45 | planets = [planet1, planet2] 46 | 47 | results = ttvfast.ttvfast(planets, stellar_mass, Time, dt, Total) 48 | 49 | def rusage_kb(): 50 | return resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / 1024 51 | 52 | def search_for_memory_leaks(): 53 | args = build_args() 54 | Time, dt, Total = args[1:4] 55 | dt /= 5. 56 | params = args[0] 57 | 58 | iteration, rusages = [], [] 59 | total = 0 60 | for i in range(100): 61 | before_usage = rusage_kb() 62 | run_function(Time, dt, Total, params) 63 | after_usage = rusage_kb() 64 | diff_usage = after_usage - before_usage 65 | rusages.append(diff_usage + total) 66 | total += diff_usage 67 | iteration.append(i) 68 | 69 | 70 | fig, axis = plt.subplots() 71 | axis.plot(iteration, rusages) 72 | axis.set(title='Total: %d kb' % rusages[-1]) 73 | plt.show() 74 | 75 | if __name__ == '__main__': 76 | search_for_memory_leaks() 77 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simonrw/ttvfast-python/4ebce9215545d534bc3c8de496221251ec438414/setup.cfg -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | 4 | from setuptools import setup, Extension 5 | from codecs import open 6 | from os import path 7 | 8 | here = path.abspath(path.dirname(__file__)) 9 | 10 | ttvfast = Extension("ttvfast._ttvfast", 11 | sources=["src/ttvfast_wrapper.c", 12 | "external/TTVFast/c_version/TTVFast.c"], 13 | include_dirs=['external/TTVFast/c_version'], 14 | extra_compile_args=['-std=c99'], 15 | # Debug mode 16 | # define_macros=[('DEBUG', True)], 17 | ) 18 | 19 | with open(path.join(here, 'README.rst'), encoding='utf-8') as infile: 20 | long_description = infile.read() 21 | 22 | version = {} 23 | with open(path.join(here, 'ttvfast', 'version.py')) as infile: 24 | exec(infile.read(), version) 25 | 26 | setup( 27 | name='ttvfast', 28 | version=version['__version__'], 29 | description='Python wrapper to ttvfast', 30 | url='https://github.com/mindriot101/ttvfast-python', 31 | long_description=long_description, 32 | author='Simon Walker', 33 | author_email='s.r.walker101@googlemail.com', 34 | license='GPL', 35 | packages=['ttvfast', ], 36 | install_requires=['numpy'], 37 | ext_modules=[ttvfast, ], 38 | classifiers=[ 39 | 'Development Status :: 3 - Alpha', 40 | 'Intended Audience :: Science/Research', 41 | 'License :: OSI Approved :: GNU General Public License v2 (GPLv2)', 42 | 'Topic :: Scientific/Engineering :: Physics', 43 | 'Programming Language :: Python :: 2', 44 | 'Programming Language :: Python :: 2.6', 45 | 'Programming Language :: Python :: 2.7', 46 | 'Programming Language :: Python :: 3', 47 | 'Programming Language :: Python :: 3.4', 48 | 'Programming Language :: Python :: 3.5', 49 | ], 50 | ) 51 | -------------------------------------------------------------------------------- /src/ttvfast_wrapper.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef DEBUG 3 | #include 4 | #endif 5 | #include "transit.h" 6 | #include "myintegrator.h" 7 | #include "ttv_errors.h" 8 | 9 | #if PY_MAJOR_VERSION >= 3 10 | #define PyInteger_FromLong PyLong_FromLong 11 | #else 12 | #define PyInteger_FromLong PyInt_FromLong 13 | #endif 14 | 15 | #define STR(x) #x 16 | #define PRINT_REFCNT(x) (printf("Refcount for %s: %u\n", #x, Py_REFCNT(x))) 17 | 18 | status_t TTVFast_main(double *params,double dt, double Time, double total,int n_plan,CalcTransit *transit,CalcRV *RV_struct, int nRV, int n_events, int input_flag); 19 | 20 | static PyObject *_ttvfast__ttvfast(PyObject *self, PyObject *args); 21 | 22 | static char module_docstring[] = ""; 23 | static char _ttvfast_docstring[] = ""; 24 | 25 | struct module_state { 26 | PyObject *error; 27 | }; 28 | 29 | #if PY_MAJOR_VERSION >= 3 30 | #define GETSTATE(m) ((struct module_state*)PyModule_GetState(m)) 31 | #else 32 | #define GETSTATE(m) (&_state) 33 | static struct module_state _state; 34 | #endif 35 | 36 | static PyMethodDef _ttvfast_methods[] = { 37 | {"_ttvfast", (PyCFunction)_ttvfast__ttvfast, METH_VARARGS, _ttvfast_docstring}, 38 | {NULL, NULL} 39 | }; 40 | 41 | #if PY_MAJOR_VERSION >= 3 42 | 43 | static int _ttvfast_traverse(PyObject *m, visitproc visit, void *arg) { 44 | Py_VISIT(GETSTATE(m)->error); 45 | return 0; 46 | } 47 | 48 | static int _ttvfast_clear(PyObject *m) { 49 | Py_CLEAR(GETSTATE(m)->error); 50 | return 0; 51 | } 52 | 53 | 54 | static struct PyModuleDef moduledef = { 55 | PyModuleDef_HEAD_INIT, 56 | "_ttvfast", 57 | module_docstring, 58 | sizeof(struct module_state), 59 | _ttvfast_methods, 60 | NULL, 61 | _ttvfast_traverse, 62 | _ttvfast_clear, 63 | NULL 64 | }; 65 | 66 | #define INITERROR return NULL 67 | 68 | PyObject * 69 | PyInit__ttvfast(void) 70 | 71 | #else 72 | #define INITERROR return 73 | 74 | void 75 | init_ttvfast(void) 76 | #endif 77 | { 78 | #if PY_MAJOR_VERSION >= 3 79 | PyObject *module = PyModule_Create(&moduledef); 80 | #else 81 | PyObject *module = Py_InitModule3("_ttvfast", _ttvfast_methods, module_docstring); 82 | #endif 83 | 84 | if (module == NULL) 85 | INITERROR; 86 | struct module_state *st = GETSTATE(module); 87 | 88 | st->error = PyErr_NewException("_ttvfast.Error", NULL, NULL); 89 | if (st->error == NULL) { 90 | Py_DECREF(module); 91 | INITERROR; 92 | } 93 | 94 | #if PY_MAJOR_VERSION >= 3 95 | return module; 96 | #endif 97 | } 98 | 99 | /* Takes integer and changes the value in place */ 100 | static PyObject *_ttvfast__ttvfast(PyObject *self, PyObject *args) { 101 | PyObject *params_obj, *planet_obj, *epoch_obj, *time_obj, *rsky_obj, *vsky_obj, *rv_times_obj, *rv_out_obj, *item; 102 | double dt, Time, total; 103 | int n_plan, n_events, input_flag, len_rv; 104 | int i; 105 | status_t status = STATUS_OK; 106 | 107 | n_events = 5000; 108 | 109 | if (!PyArg_ParseTuple(args, "Odddiii|O", ¶ms_obj, &dt, &Time, &total, 110 | &n_plan, &input_flag, &len_rv, &rv_times_obj)) { 111 | return NULL; 112 | } 113 | 114 | #ifdef DEBUG 115 | printf("dt: %lf\n", dt); 116 | printf("Time: %lf\n", Time); 117 | printf("total: %lf\n", total); 118 | printf("n_plan: %d\n", n_plan); 119 | printf("input_flag: %d\n", input_flag); 120 | printf("len_rv: %d\n", len_rv); 121 | #endif 122 | 123 | 124 | /* Get the params list */ 125 | double *params = malloc(sizeof(double) * (2 + n_plan * 7)); 126 | for (i=0; i<(2 + n_plan * 7); i++) { 127 | item = PyList_GetItem(params_obj, i); 128 | params[i] = PyFloat_AsDouble(item); 129 | #ifdef DEBUG 130 | printf("Params %d: %lf\n", i, params[i]); 131 | #endif 132 | } 133 | 134 | CalcTransit *model; 135 | model = (CalcTransit*)calloc(n_events, sizeof(CalcTransit)); 136 | double DEFAULT = -2; /* value for transit information that is not determined by TTVFast*/ 137 | for(i=0;itime = DEFAULT; 139 | } 140 | 141 | CalcRV *RV_model; 142 | if (len_rv) { 143 | RV_model = (CalcRV*)calloc(len_rv, sizeof(CalcRV)); 144 | for (int i=0; itime = PyFloat_AsDouble(item); 147 | } 148 | } else { 149 | RV_model = NULL; 150 | } 151 | 152 | #ifdef DEBUG 153 | printf("Transit model container created\n"); 154 | #endif 155 | status = TTVFast_main(params, dt, Time, total, n_plan, model, RV_model, len_rv, n_events, input_flag); 156 | #ifdef DEBUG 157 | printf("Called\n"); 158 | #endif 159 | 160 | /* Check the error status value */ 161 | if (status != STATUS_OK) { 162 | switch (status) { 163 | case STATUS_OK: 164 | break; 165 | case STATUS_ARGUMENT_ERROR: 166 | PyErr_Format(PyExc_ValueError, "Input flag must be 0, 1, or 2."); 167 | break; 168 | case STATUS_MEMORY_ERROR: 169 | PyErr_Format(PyExc_MemoryError, "Not enough memory allocated for Transit structure: " 170 | "more events triggering as transits than expected. " 171 | "Possibily indicative of larger problem."); 172 | break; 173 | case STATUS_HYPERBOLIC_ORBIT: 174 | PyErr_Format(PyExc_ValueError, "Hyperbolic orbit."); 175 | break; 176 | case STATUS_TOO_MANY_PLANETS: 177 | PyErr_Format(PyExc_ValueError, "Too many planets."); 178 | break; 179 | case STATUS_NON_CONVERGING: 180 | PyErr_Format(PyExc_ValueError, "Kepler step not converging in MAX_ITER. " 181 | "Likely need a smaller dt."); 182 | break; 183 | default: 184 | PyErr_Format(PyExc_ValueError, "Unknown exit status from TTVFast: %d.", 185 | (int)status); 186 | break; 187 | } 188 | } 189 | 190 | planet_obj = PyList_New(n_events); 191 | epoch_obj = PyList_New(n_events); 192 | time_obj = PyList_New(n_events); 193 | rsky_obj = PyList_New(n_events); 194 | vsky_obj = PyList_New(n_events); 195 | rv_out_obj = PyList_New(len_rv); 196 | 197 | #ifdef DEBUG 198 | printf("Creating output lists\n"); 199 | #endif 200 | for (i=0; iplanet); 202 | PyList_SetItem(planet_obj, i, item); 203 | 204 | item = PyInteger_FromLong((model+i)->epoch); 205 | PyList_SetItem(epoch_obj, i, item); 206 | 207 | item = PyFloat_FromDouble((model+i)->time); 208 | PyList_SetItem(time_obj, i, item); 209 | 210 | item = PyFloat_FromDouble((model+i)->rsky); 211 | PyList_SetItem(rsky_obj, i, item); 212 | 213 | item = PyFloat_FromDouble((model+i)->vsky); 214 | PyList_SetItem(vsky_obj, i, item); 215 | } 216 | 217 | for (int i=0; iRV); 219 | PyList_SetItem(rv_out_obj, i, item); 220 | } 221 | 222 | free(model); 223 | free(params); 224 | free(RV_model); 225 | 226 | PyObject *positions_out = Py_BuildValue("OOOOO", planet_obj, epoch_obj, time_obj, rsky_obj, vsky_obj); 227 | 228 | Py_XDECREF(planet_obj); 229 | Py_XDECREF(epoch_obj); 230 | Py_XDECREF(time_obj); 231 | Py_XDECREF(rsky_obj); 232 | Py_XDECREF(vsky_obj); 233 | 234 | PyObject *retval; 235 | if (len_rv) { 236 | retval = Py_BuildValue("OO", positions_out, rv_out_obj); 237 | Py_XDECREF(rv_out_obj); 238 | } else { 239 | Py_INCREF(Py_None); 240 | retval = Py_BuildValue("OO", positions_out, Py_None); 241 | } 242 | Py_XDECREF(positions_out); 243 | return retval; 244 | } 245 | -------------------------------------------------------------------------------- /testing/conftest.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | from ttvfast import models 3 | 4 | 5 | @pytest.fixture 6 | def args(): 7 | params = [ 8 | 0.000295994511, 9 | 0.95573417954, 10 | 0.00002878248, 11 | 1.0917340278625494e+01, 12 | 5.6159310042858110e-02, 13 | 9.0921164935951211e+01, 14 | -1.1729336712101943e-18, 15 | 1.8094838714599581e+02, 16 | -8.7093652691581923e+01, 17 | 0.00061895914, 18 | 2.2266898036209028e+01, 19 | 5.6691301931178648e-02, 20 | 8.7598285693573246e+01, 21 | 4.6220554014026838e-01, 22 | 1.6437004273382669e+00, 23 | -1.9584857031843157e+01] 24 | 25 | Time = -1045 26 | dt = 0.54 27 | Total = 1700 28 | n_plan = 2 29 | input_flag = 0 30 | 31 | return params, Time, dt, Total, n_plan, input_flag 32 | 33 | 34 | @pytest.fixture 35 | def python_args(args): 36 | params, Time, dt, Total, n_plan, input_flag = args 37 | return Time, dt, Total 38 | 39 | 40 | @pytest.fixture 41 | def params(): 42 | return {'mass': 0.00002878248, 43 | 'period': 1.0917340278625494e+01, 44 | 'eccentricity': 5.6159310042858110e-02, 45 | 'inclination': 9.0921164935951211e+01, 46 | 'longnode': -1.1729336712101943e-18, 47 | 'argument': 1.8094838714599581e+02, 48 | 'mean_anomaly': -8.7093652691581923e+01} 49 | 50 | 51 | @pytest.fixture 52 | def planets(): 53 | planet1_params = [0.00002878248, 54 | 1.0917340278625494e+01, 5.6159310042858110e-02, 55 | 9.0921164935951211e+01, -1.1729336712101943e-18, 56 | 1.8094838714599581e+02, -8.7093652691581923e+01, 57 | ] 58 | planet2_params = [0.00061895914, 59 | 2.2266898036209028e+01, 5.6691301931178648e-02, 60 | 8.7598285693573246e+01, 4.6220554014026838e-01, 61 | 1.6437004273382669e+00, -1.9584857031843157e+01, 62 | ] 63 | planet1 = models.Planet(*planet1_params) 64 | planet2 = models.Planet(*planet2_params) 65 | return [planet1, planet2] 66 | 67 | 68 | @pytest.fixture 69 | def stellar_mass(): 70 | return 0.95573417954 71 | -------------------------------------------------------------------------------- /testing/example_output.txt: -------------------------------------------------------------------------------- 1 | 0 0 -1.044921707263204e+03 1.521938518756360e-03 5.464087109600002e-02 2 | 1 0 -1.038725088013362e+03 6.364415526595074e-03 4.320773215337991e-02 3 | 0 1 -1.033995010284903e+03 1.521101573486690e-03 5.467869607568298e-02 4 | 0 2 -1.023072159838893e+03 1.509753198016333e-03 5.483150432930721e-02 5 | 1 1 -1.016459734143501e+03 6.364095656134231e-03 4.320740188890609e-02 6 | 0 3 -1.012148112266399e+03 1.508698112826550e-03 5.488285127046898e-02 7 | 0 4 -1.001229003997087e+03 1.498506948968762e-03 5.503152486260497e-02 8 | 1 2 -9.941941435811713e+02 6.363712069402938e-03 4.320800868282684e-02 9 | 0 5 -9.903074035154174e+02 1.497243593651998e-03 5.509580518252512e-02 10 | 0 6 -9.793911529357171e+02 1.488821097635121e-03 5.523620709037188e-02 11 | 1 3 -9.719284251351652e+02 6.363340774154831e-03 4.320921384258269e-02 12 | 0 7 -9.684721182828133e+02 1.487332684519519e-03 5.531219665237603e-02 13 | 0 8 -9.575581707332560e+02 1.481054718753114e-03 5.544099954650054e-02 14 | 1 4 -9.496626248406413e+02 6.363054930919924e-03 4.321060199992310e-02 15 | 0 9 -9.466419364038111e+02 1.479331516276994e-03 5.552700583696640e-02 16 | 0 10 -9.357298654959010e+02 1.475389553449540e-03 5.564135330026537e-02 17 | 1 5 -9.273967537478532e+02 6.362917559755468e-03 4.321174890794039e-02 18 | 0 11 -9.248165904903740e+02 1.473395512388479e-03 5.573520336911842e-02 19 | 0 12 -9.139059060660998e+02 1.471775906476912e-03 5.583205167810223e-02 20 | 1 6 -9.051308223123203e+02 6.362972005199426e-03 4.321226662357434e-02 21 | 0 13 -9.029954594248587e+02 1.469411732422328e-03 5.593028515250475e-02 22 | 0 14 -8.920853748240202e+02 1.469976869126999e-03 5.600700927947636e-02 23 | 1 7 -8.828648752325788e+02 6.363231859868642e-03 4.321183741781629e-02 24 | 0 15 -8.811770976421817e+02 1.467198971680500e-03 5.610601227104738e-02 25 | 0 16 -8.702663901178497e+02 1.469534027250892e-03 5.615888022315948e-02 26 | 1 8 -8.605990271873551e+02 6.363665856291227e-03 4.321033055089308e-02 27 | 0 17 -8.593589706780980e+02 1.466063023599759e-03 5.625246862592465e-02 28 | 0 18 -8.484458027861992e+02 1.469728812063472e-03 5.627866387674473e-02 29 | 1 9 -8.383334875607916e+02 6.364182671978818e-03 4.320783775052171e-02 30 | 0 19 -8.375371142425572e+02 1.465288383472445e-03 5.635838239486137e-02 31 | 0 20 -8.266190613608588e+02 1.469674025221097e-03 5.635597848483376e-02 32 | 1 10 -8.160685763963259e+02 6.364611095323852e-03 4.320485178266979e-02 33 | 0 21 -8.157061711985335e+02 1.463817552599114e-03 5.640967975826069e-02 34 | 0 22 -8.047803491825613e+02 1.468290880334635e-03 5.637906136031065e-02 35 | 0 23 -7.938596792952815e+02 1.460265890650883e-03 5.639127475254298e-02 36 | 1 11 -7.938047214238779e+02 6.364721244794051e-03 4.320249767472190e-02 37 | 0 24 -7.829230780864197e+02 1.464628255748256e-03 5.633640964577832e-02 38 | 0 25 -7.719907622999182e+02 1.454366676288226e-03 5.629011576749745e-02 39 | 1 12 -7.715424170191334e+02 6.364301687285810e-03 4.320186607172792e-02 40 | 0 26 -7.610407842942491e+02 1.458081429694972e-03 5.621862425816845e-02 41 | 0 27 -7.500932796766939e+02 1.445398369991299e-03 5.610255278588529e-02 42 | 1 13 -7.492821267555615e+02 6.363288600433257e-03 4.320315105206929e-02 43 | 0 28 -7.391283294202609e+02 1.448768681116383e-03 5.602144242777908e-02 44 | 0 29 -7.281631967882169e+02 1.434750996440959e-03 5.583316296520468e-02 45 | 1 14 -7.270241668514208e+02 6.361735727300416e-03 4.320637366931781e-02 46 | 0 30 -7.171830950398388e+02 1.437573699650884e-03 5.574778397196077e-02 47 | 0 31 -7.061995839891810e+02 1.423533448160393e-03 5.549457463900245e-02 48 | 1 15 -7.047686200536597e+02 6.359776227137346e-03 4.321143252354034e-02 49 | 0 32 -6.952057834597970e+02 1.426004488607645e-03 5.540826137901412e-02 50 | 0 33 -6.842050926510866e+02 1.413471884443269e-03 5.510389750520305e-02 51 | 1 16 -6.825152990223155e+02 6.357592816359056e-03 4.321798612062765e-02 52 | 0 34 -6.732004882872645e+02 1.415694740177046e-03 5.501900373561153e-02 53 | 0 35 -6.621855957721863e+02 1.406120648426618e-03 5.468136019341111e-02 54 | 1 17 -6.602637689064312e+02 6.355377118641616e-03 4.322555390872043e-02 55 | 0 36 -6.511741293344775e+02 1.408075485366353e-03 5.459867333151829e-02 56 | 0 37 -6.401492995493144e+02 1.402506887071289e-03 5.424621847365807e-02 57 | 1 18 -6.380134112954776e+02 6.353306848351590e-03 4.323353021609330e-02 58 | 0 38 -6.291355370098582e+02 1.404201473810399e-03 5.416613319052056e-02 59 | 0 39 -6.181057961718958e+02 1.403237334514611e-03 5.381629484780671e-02 60 | 1 19 -6.157634962299859e+02 6.351534337703840e-03 4.324128469040560e-02 61 | 0 40 -6.070945134111653e+02 1.404723687964709e-03 5.373960976307903e-02 62 | 0 41 -5.960652299588644e+02 1.408545869650531e-03 5.340939849186827e-02 63 | 1 20 -5.935132469689103e+02 6.350184119168758e-03 4.324817784524686e-02 64 | 0 42 -5.850609858819593e+02 1.409846627630535e-03 5.333688288882506e-02 65 | 0 43 -5.740374971135637e+02 1.418059348180399e-03 5.304283845116197e-02 66 | 1 21 -5.712618984166297e+02 6.349342460666977e-03 4.325360068208756e-02 67 | 0 44 -5.630441867994979e+02 1.419173383363406e-03 5.297536108909209e-02 68 | 0 45 -5.520313903889102e+02 1.430626749080038e-03 5.273258263558329e-02 69 | 1 22 -5.490087634790600e+02 6.349035873678289e-03 4.325705422736655e-02 70 | 0 46 -5.410517684655193e+02 1.431528345511545e-03 5.267108369295243e-02 71 | 0 47 -5.300535785598175e+02 1.444260002556468e-03 5.249071239608031e-02 72 | 1 23 -5.267533162243800e+02 6.349210439409634e-03 4.325825910045420e-02 73 | 0 48 -5.190888660198973e+02 1.444930553964914e-03 5.243633843523144e-02 74 | 0 49 -5.081076232535693e+02 1.456516014984262e-03 5.232284537294909e-02 75 | 1 24 -5.044952748065261e+02 6.349729885829021e-03 4.325729381644944e-02 76 | 0 50 -4.971573703124000e+02 1.456963243004190e-03 5.227707783679506e-02 77 | 0 51 -4.861934714423929e+02 1.465242910693390e-03 5.222758174177035e-02 78 | 1 25 -4.822346518813154e+02 6.350408284758931e-03 4.325464344562237e-02 79 | 0 52 -4.752557675646538e+02 1.465445764564252e-03 5.219185292026428e-02 80 | 0 53 -4.643077446423034e+02 1.469138316101298e-03 5.219761062574105e-02 81 | 1 26 -4.599717358610673e+02 6.351058560203588e-03 4.325106706549469e-02 82 | 0 54 -4.533797759029856e+02 1.469100141192207e-03 5.217331611988496e-02 83 | 0 55 -4.424448151062133e+02 1.467976121801721e-03 5.222271643585258e-02 84 | 1 27 -4.377070110477659e+02 6.351536827543312e-03 4.324739517127845e-02 85 | 0 56 -4.315234851411935e+02 1.467694265318919e-03 5.221105840397868e-02 86 | 0 57 -4.205981775061841e+02 1.462374016647343e-03 5.229238054795639e-02 87 | 1 28 -4.154410462535385e+02 6.351762098983105e-03 4.324433769061022e-02 88 | 0 58 -4.096806576551945e+02 1.461863551162796e-03 5.229429771497691e-02 89 | 0 59 -3.987616544731287e+02 1.453419794173344e-03 5.239738939612432e-02 90 | 1 29 -3.931743922743599e+02 6.351715098853216e-03 4.324236463277850e-02 91 | 0 60 -3.878456998884209e+02 1.452689015678600e-03 5.241337521047609e-02 92 | 0 61 -3.769301596926369e+02 1.442331032137067e-03 5.253016458171141e-02 93 | 1 30 -3.709075123215023e+02 6.351425674910105e-03 4.324164662826278e-02 94 | 0 62 -3.660142470986718e+02 1.441401391654455e-03 5.256037951276619e-02 95 | 0 63 -3.551000145550364e+02 1.430265022161930e-03 5.268470117887077e-02 96 | 1 31 -3.486407501778323e+02 6.350957129623551e-03 4.324206883342321e-02 97 | 0 64 -3.441833061936676e+02 1.429145443938251e-03 5.272875915137151e-02 98 | 0 65 -3.332689282482839e+02 1.418206927285737e-03 5.285600481024222e-02 99 | 1 32 -3.263743275128141e+02 6.350393509189456e-03 4.324335589154987e-02 100 | 0 66 -3.223511291745423e+02 1.416911016319808e-03 5.291319581685668e-02 101 | 0 67 -3.114357136292309e+02 1.406965359575169e-03 5.303977419106255e-02 102 | 1 33 -3.041083620519927e+02 6.349826546792166e-03 4.324511881392014e-02 103 | 0 68 -3.005169015128099e+02 1.405484389328040e-03 5.310888703166318e-02 104 | 0 69 -2.895999524494468e+02 1.397134686664833e-03 5.323176532607311e-02 105 | 1 34 -2.818428962782452e+02 6.349345266307769e-03 4.324691697104295e-02 106 | 0 70 -2.786803464040871e+02 1.395451746971825e-03 5.331115110348941e-02 107 | 0 71 -2.677615363238478e+02 1.389140705685588e-03 5.342763547179410e-02 108 | 1 35 -2.595779341337513e+02 6.349026510177246e-03 4.324831925033083e-02 109 | 0 72 -2.568413024476200e+02 1.387219300892289e-03 5.351541655153021e-02 110 | 0 73 -2.459202908690091e+02 1.383194740057938e-03 5.362239994106405e-02 111 | 1 36 -2.373134719710642e+02 6.348926006239276e-03 4.324895997742150e-02 112 | 0 74 -2.349993598771970e+02 1.380927405287498e-03 5.371566607065315e-02 113 | 0 75 -2.240755872907937e+02 1.379303856043877e-03 5.381024185349359e-02 114 | 1 37 -2.150495302941647e+02 6.349068607552226e-03 4.324858030030039e-02 115 | 0 76 -2.131534613585209e+02 1.376623145323985e-03 5.390641215145565e-02 116 | 0 77 -2.022260687308131e+02 1.377224301029593e-03 5.398418926365592e-02 117 | 1 38 -1.927861779805184e+02 6.349439365654095e-03 4.324704225405217e-02 118 | 0 78 -1.913017792900810e+02 1.373829621929295e-03 5.407858544917500e-02 119 | 0 79 -1.803694796679090e+02 1.376419176881481e-03 5.413587665319775e-02 120 | 1 39 -1.705235481455436e+02 6.349970846060884e-03 4.324442921660371e-02 121 | 0 80 -1.694414777779244e+02 1.372122404103888e-03 5.422340895722896e-02 122 | 0 81 -1.585026755549374e+02 1.376069455433689e-03 5.425570744300993e-02 123 | 1 40 -1.482618378213693e+02 6.350533226667029e-03 4.324107029316614e-02 124 | 0 82 -1.475689833224866e+02 1.370204558948254e-03 5.432839236423589e-02 125 | 0 83 -1.366218539425716e+02 1.375074274971265e-03 5.433309004245369e-02 126 | 0 84 -1.256801757893062e+02 1.367296980275535e-03 5.438015702654427e-02 127 | 1 41 -1.260012919901973e+02 6.350930968303947e-03 4.323764055292706e-02 128 | 0 85 -1.147230379214796e+02 1.372239181953375e-03 5.435760701123540e-02 129 | 0 86 -1.037711392660374e+02 1.361499457918191e-03 5.436720061342890e-02 130 | 1 42 -1.037421698184287e+02 6.350940901772543e-03 4.323519866297712e-02 131 | 0 87 -9.280277251264144e+01 1.366476113212437e-03 5.432041650192456e-02 132 | 0 88 -8.183886094615278e+01 1.352833545362972e-03 5.428010376308153e-02 133 | 1 43 -8.148468721260579e+01 6.350407321747651e-03 4.323456087705220e-02 134 | 0 89 -7.085891675683484e+01 1.357104870045597e-03 5.421606797982975e-02 135 | 0 90 -5.988207619634648e+01 1.340235812735775e-03 5.411938609007795e-02 136 | 1 44 -5.922894378205818e+01 6.349279938359580e-03 4.323578443572276e-02 137 | 0 91 -4.889132620874013e+01 1.344092053732127e-03 5.404394464324167e-02 138 | 0 92 -3.790182144028684e+01 1.324472972267307e-03 5.388943431202885e-02 139 | 1 45 -3.697486829337298e+01 6.347617349055612e-03 4.323871073607027e-02 140 | 0 93 -2.690220989974963e+01 1.328001558632612e-03 5.380828521232880e-02 141 | 0 94 -1.590164468320628e+01 1.307006643808814e-03 5.360186353953521e-02 142 | 1 46 -1.472220432590870e+01 6.345533584537431e-03 4.324314103021835e-02 143 | 0 95 -4.896102222523215e+00 1.309929203558169e-03 5.351753904051052e-02 144 | 0 96 6.112798061960281e+00 1.288756914122370e-03 5.326802890279213e-02 145 | 1 47 7.529472062417484e+00 6.343180792071281e-03 4.324875237721704e-02 146 | 0 97 1.712051770833483e+01 1.291292352992008e-03 5.318301939016198e-02 147 | 0 98 2.813412324559117e+01 1.271438137534535e-03 5.290181669555249e-02 148 | 1 48 2.978071602509341e+01 6.340731283547760e-03 4.325516177587088e-02 149 | 0 99 3.913980468233684e+01 1.273665876560794e-03 5.281794227378772e-02 150 | 0 100 5.015388904395248e+01 1.256747603896402e-03 5.251866176322477e-02 151 | 1 49 5.203216991555003e+01 6.338373571663201e-03 4.326187785305856e-02 152 | 0 101 6.115320573996509e+01 1.258681969405859e-03 5.243723393923351e-02 153 | 0 102 7.216323874549256e+01 1.246339254496315e-03 5.213626764698847e-02 154 | 1 50 7.428451584238772e+01 6.336304296184348e-03 4.326828947993575e-02 155 | 0 103 8.315218149917916e+01 1.247896405056704e-03 5.205784679195658e-02 156 | 0 104 9.415371045383297e+01 1.241253552069029e-03 5.177281482168352e-02 157 | 1 51 9.653841939553709e+01 6.334704601827132e-03 4.327372198991303e-02 158 | 0 105 1.051290500651535e+02 1.242468076657640e-03 5.169860959767595e-02 159 | 0 106 1.161181358616531e+02 1.241747010867994e-03 5.144716226215009e-02 160 | 1 52 1.187944547738689e+02 6.333699074036940e-03 4.327752527963935e-02 161 | 0 107 1.270779696225112e+02 1.242656891429492e-03 5.137865784532406e-02 162 | 0 108 1.380517504113186e+02 1.246831802962814e-03 5.117567394619298e-02 163 | 1 53 1.410530154933072e+02 6.333304520996929e-03 4.327929968995154e-02 164 | 0 109 1.489959067346748e+02 1.247413475904832e-03 5.111420442632778e-02 165 | 0 110 1.599531762923450e+02 1.254263856234864e-03 5.096818672680619e-02 166 | 1 54 1.633142280516532e+02 6.333413106939963e-03 4.327901819548974e-02 167 | 0 111 1.708832221052560e+02 1.254535536947568e-03 5.091523386643702e-02 168 | 0 112 1.818247200741943e+02 1.261349470537285e-03 5.082689732493421e-02 169 | 1 55 1.855779154605970e+02 6.333823984944859e-03 4.327708412350809e-02 170 | 0 113 1.927435868558446e+02 1.261326719961980e-03 5.078406233283114e-02 171 | 0 114 2.036717584890891e+02 1.265845763792422e-03 5.074796659935580e-02 172 | 1 56 2.078436352337863e+02 6.334310698097242e-03 4.327422749264834e-02 173 | 0 115 2.145830797755048e+02 1.265550548227431e-03 5.071668156775078e-02 174 | 0 116 2.255014583136391e+02 1.266458771184666e-03 5.072413400592805e-02 175 | 1 57 2.301107792687037e+02 6.334683006055958e-03 4.327129270040483e-02 176 | 0 117 2.364089016551982e+02 1.265910424813750e-03 5.070562344620403e-02 177 | 0 118 2.473213346725942e+02 1.262889209902359e-03 5.074736338315087e-02 178 | 1 58 2.523786932595118e+02 6.334818739497665e-03 4.326897539921074e-02 179 | 0 119 2.582280803948372e+02 1.262125532590577e-03 5.074253286969947e-02 180 | 0 120 2.691381270952371e+02 1.255563396350128e-03 5.081033478759424e-02 181 | 1 59 2.746467742093697e+02 6.334671664327550e-03 4.326771497364618e-02 182 | 0 121 2.800466058350844e+02 1.254610832800502e-03 5.081964935585814e-02 183 | 0 122 2.909571479535202e+02 1.245308230917620e-03 5.090688221570314e-02 184 | 1 60 2.969145333076183e+02 6.334258525237384e-03 4.326764882877874e-02 185 | 0 123 3.018689739968883e+02 1.244197980465062e-03 5.093038493669121e-02 186 | 0 124 3.127821168548291e+02 1.233107198850210e-03 5.103189335182379e-02 187 | 1 61 3.191816204789317e+02 6.333640762226003e-03 4.326866393013980e-02 188 | 0 125 3.236981560377161e+02 1.231866589449428e-03 5.106920576038358e-02 189 | 0 126 3.346152495027688e+02 1.219951881204271e-03 5.118101676662025e-02 190 | 1 62 3.414478173814820e+02 6.332905046614096e-03 4.327040840132285e-02 191 | 0 127 3.455358089090283e+02 1.218594094345815e-03 5.123131375531753e-02 192 | 0 128 3.564576158164729e+02 1.206752552122332e-03 5.135025828976986e-02 193 | 1 63 3.637130156142654e+02 6.332149051731339e-03 4.327247699201985e-02 194 | 0 129 3.673826261508444e+02 1.205284686001313e-03 5.141250901920892e-02 195 | 0 130 3.783094950238693e+02 1.194301003969722e-03 5.153568519747914e-02 196 | 1 64 3.859771849489053e+02 6.331468320473848e-03 4.327444412335187e-02 197 | 0 131 3.892387110673778e+02 1.192697213183167e-03 5.160828667342900e-02 198 | 0 132 4.001707810798580e+02 1.183240000594175e-03 5.173308921358905e-02 199 | 1 65 4.082403419714080e+02 6.330946259532928e-03 4.327590877965039e-02 200 | 0 133 4.111039707640773e+02 1.181477038727453e-03 5.181463274134424e-02 201 | 0 134 4.220413096327678e+02 1.174048133917747e-03 5.193780082078672e-02 202 | 1 66 4.305025188196742e+02 6.330646715021357e-03 4.327655471546758e-02 203 | 0 135 4.329783579197265e+02 1.172025638567669e-03 5.202592744343742e-02 204 | 0 136 4.439211219296722e+02 1.167000038351186e-03 5.214436926592855e-02 205 | 1 67 4.527637430692588e+02 6.330605949350103e-03 4.327617468321692e-02 206 | 0 137 4.548621727494894e+02 1.164652841871506e-03 5.223735287783168e-02 207 | 0 138 4.658106220690661e+02 1.162140606745934e-03 5.234646915756939e-02 208 | 1 68 4.750240231012752e+02 6.330826117079216e-03 4.327469008782439e-02 209 | 0 139 4.767560497977166e+02 1.159246704762353e-03 5.244109400670733e-02 210 | 0 140 4.877106264642633e+02 1.159244333366616e-03 5.253677501201089e-02 211 | 1 69 4.972833429666077e+02 6.331270727588572e-03 4.327215112757982e-02 212 | 0 141 4.986610793643046e+02 1.155644411948354e-03 5.263036167457816e-02 213 | 0 142 5.096222759441806e+02 1.157779410636370e-03 5.270698498572600e-02 214 | 1 70 5.195416672497956e+02 6.331861986825907e-03 4.326875147432408e-02 215 | 0 143 5.205785234960005e+02 1.153117166150765e-03 5.279493348703648e-02 216 | 0 144 5.315468330083721e+02 1.156964304023197e-03 5.284833636179465e-02 217 | 1 71 5.417989560770352e+02 6.332476266538689e-03 4.326488873328870e-02 218 | 0 145 5.425096527145316e+02 1.150784444038732e-03 5.292529255311750e-02 219 | 0 146 5.534853568078713e+02 1.155763212708017e-03 5.295185962805431e-02 220 | 0 147 5.644553471646716e+02 1.147752515023051e-03 5.301041642247517e-02 221 | 1 72 5.640551873061006e+02 6.332954479630220e-03 4.326111865654955e-02 222 | 0 148 5.754383282599441e+02 1.153104710822475e-03 5.300955923175468e-02 223 | 0 149 5.864156811256935e+02 1.142486517682652e-03 5.304159715649924e-02 224 | 1 73 5.863103809853368e+02 6.333122104418361e-03 4.325817255235564e-02 225 | 0 150 5.974052827148249e+02 1.147990619667425e-03 5.301502305483369e-02 226 | 0 151 6.083896578583408e+02 1.134541632328960e-03 5.301175144941028e-02 227 | 1 74 6.085646237270689e+02 6.332855001409472e-03 4.325673250205576e-02 228 | 0 152 6.193845339009977e+02 1.139672696693412e-03 5.296412944219773e-02 229 | 0 153 6.303749142028955e+02 1.123287824519835e-03 5.291871877514989e-02 230 | 1 75 6.308180917805032e+02 6.332079616773819e-03 4.325700369875791e-02 231 | 0 154 6.413730456132622e+02 1.127798673606860e-03 5.285546035913816e-02 232 | 0 155 6.523677554943620e+02 1.108391779580792e-03 5.276414036648692e-02 233 | 1 76 6.530710619101619e+02 6.330802817104518e-03 4.325884032579068e-02 234 | 0 156 6.633664777372152e+02 1.112455623811559e-03 5.269027253373276e-02 235 | 0 157 6.743632268931724e+02 1.090530502541751e-03 5.255201231944361e-02 236 | 1 77 6.753239073284700e+02 6.329090934652986e-03 4.326202697603333e-02 237 | 0 158 6.853593938473925e+02 1.094179420045102e-03 5.247239585725262e-02 238 | 0 159 6.963553517995414e+02 1.071124513572767e-03 5.229157670192364e-02 239 | 1 78 6.975770791676766e+02 6.327056347424821e-03 4.326629731348359e-02 240 | 0 160 7.073455982014304e+02 1.074027358615026e-03 5.220855295810246e-02 241 | 0 161 7.183376697837514e+02 1.051228609591964e-03 5.199250009620326e-02 242 | 1 79 7.198310794872422e+02 6.324864021445227e-03 4.327123014453999e-02 243 | 0 162 7.293186096228361e+02 1.053601128742461e-03 5.190890308102044e-02 244 | 0 163 7.403036129463816e+02 1.033003089377831e-03 5.166924021883036e-02 245 | 1 80 7.420864239402180e+02 6.322717649281815e-03 4.327636072434801e-02 246 | 0 164 7.512722938649517e+02 1.034920825500452e-03 5.158754991984785e-02 247 | 0 165 7.622472278182113e+02 1.018766760866949e-03 5.134099887067765e-02 248 | 1 81 7.643435916943178e+02 6.320848233988353e-03 4.328104647810373e-02 249 | 0 166 7.732016255372339e+02 1.020121935830636e-03 5.126244201588345e-02 250 | 0 167 7.841641153591904e+02 1.009956317641265e-03 5.102731886370313e-02 251 | 1 82 7.866029578100120e+02 6.319455684979050e-03 4.328463435296231e-02 252 | 0 168 7.951035118729175e+02 1.010840583209224e-03 5.095371066799506e-02 253 | 0 169 8.060522410566308e+02 1.006959974206558e-03 5.074708562305976e-02 254 | 1 83 8.088647163876635e+02 6.318641781453655e-03 4.328663941412349e-02 255 | 0 170 8.169775174242959e+02 1.007398631537674e-03 5.068017248106908e-02 256 | 0 171 8.279125887916517e+02 1.008575031475041e-03 5.051449845551582e-02 257 | 1 84 8.311288193460462e+02 6.318368145143990e-03 4.328693298976714e-02 258 | 0 172 8.388261193901790e+02 1.008603273648643e-03 5.045580262431903e-02 259 | 0 173 8.497491939312749e+02 1.012429716681336e-03 5.033661459718542e-02 260 | 1 85 8.533949620217173e+02 6.318471868640256e-03 4.328580818489611e-02 261 | 0 174 8.606544147015896e+02 1.012090517611442e-03 5.028782030151049e-02 262 | 0 175 8.715684140505274e+02 1.015944694322478e-03 5.021471850587202e-02 263 | 1 86 8.756626273289014e+02 6.318732388451790e-03 4.328385311282237e-02 264 | 0 176 8.824692028068758e+02 1.015299425197569e-03 5.017729480591702e-02 265 | 0 177 8.933777755338283e+02 1.017072663186170e-03 5.014607299104296e-02 266 | 1 87 8.979311774495159e+02 6.318942017656618e-03 4.328177358631883e-02 267 | 0 178 9.042778748438008e+02 1.016163033432960e-03 5.012124489265977e-02 268 | 0 179 9.151847503328637e+02 1.014641487377051e-03 5.012621813532814e-02 269 | 1 88 9.201999564637468e+02 6.318954140387629e-03 4.328022452512553e-02 270 | 0 180 9.260873340470615e+02 1.013519067774149e-03 5.011484276651550e-02 271 | 0 181 9.369958475335690e+02 1.008316184286219e-03 5.015028246807895e-02 272 | 1 89 9.424683777091197e+02 6.318694771813669e-03 4.327958511490038e-02 273 | 0 182 9.479032961338326e+02 1.007037641823666e-03 5.015283195627462e-02 274 | 0 183 9.588160826372731e+02 9.984012121419200e-04 5.021379306463851e-02 275 | 1 90 9.647359733797836e+02 6.318161036602266e-03 4.327996929875561e-02 276 | 0 184 9.697299670191724e+02 9.970061841297682e-04 5.023024236211758e-02 277 | 0 185 9.806488801130957e+02 9.855760759300237e-04 5.031258819630474e-02 278 | 1 91 9.870024146778894e+02 6.317401751111533e-03 4.328124275947565e-02 279 | 0 186 9.915700378517062e+02 9.841097668690040e-04 5.034259046435954e-02 280 | 0 187 1.002496207003327e+03 9.707283147124299e-04 5.044287555549682e-02 281 | 1 92 1.009267506028000e+03 6.316497058556885e-03 4.328312520979799e-02 282 | 0 188 1.013424908271805e+03 9.692145189893734e-04 5.048562892280951e-02 283 | 0 189 1.024358864629407e+03 9.548022605398514e-04 5.060086513827546e-02 284 | 1 93 1.031531160762979e+03 6.315540982808606e-03 4.328520495279856e-02 285 | 0 190 1.035294994560035e+03 9.532584664010998e-04 5.065544442459401e-02 286 | 0 191 1.046236837843377e+03 9.387259550166265e-04 5.078275992137310e-02 287 | 1 94 1.053793374810914e+03 6.314627698120394e-03 4.328709986755394e-02 288 | 0 192 1.057180042815319e+03 9.371422166683395e-04 5.084780532995095e-02 289 | 0 193 1.068129589584808e+03 9.233326531594526e-04 5.098435182886100e-02 290 | 1 95 1.076054199273082e+03 6.313841386927008e-03 4.328848132072563e-02 291 | 0 194 1.079079432349654e+03 9.216954017154838e-04 5.105868525844852e-02 292 | 0 195 1.090036327075265e+03 9.093382853605472e-04 5.120111733671674e-02 293 | 1 96 1.098313718369589e+03 6.313249025564345e-03 4.328909174493172e-02 294 | 0 196 1.100992343472238e+03 9.075880920683351e-04 5.128298024964091e-02 295 | 0 197 1.111956162852032e+03 8.972845548766478e-04 5.142791067614488e-02 296 | 1 97 1.120572032564948e+03 6.312896109623892e-03 4.328876864478836e-02 297 | 0 198 1.122917944626563e+03 8.953712625126732e-04 5.151602210526180e-02 298 | 0 199 1.133888202793742e+03 8.875126105137442e-04 5.165896381727545e-02 299 | 1 98 1.142829249145591e+03 6.312803048739772e-03 4.328746565862131e-02 300 | 0 200 1.144855376248387e+03 8.853417425017634e-04 5.175149521480429e-02 301 | 0 201 1.155831570493471e+03 8.801620687015350e-04 5.188804220062866e-02 302 | 1 99 1.165085480515286e+03 6.312962602391899e-03 4.328522922747525e-02 303 | 0 202 1.166803768008250e+03 8.775652975257793e-04 5.198280986281896e-02 304 | 0 203 1.177785337906363e+03 8.750951310011035e-04 5.210813094286149e-02 305 | 1 100 1.187340845649262e+03 6.313339656155186e-03 4.328219764115138e-02 306 | 0 204 1.188762193316779e+03 8.719966940684043e-04 5.220358769261992e-02 307 | 0 205 1.199748442510262e+03 8.719580920461544e-04 5.231196982452726e-02 308 | 1 101 1.209595475849939e+03 6.313875572375725e-03 4.327854362290925e-02 309 | 0 206 1.210729454235484e+03 8.681197622221822e-04 5.240505461672896e-02 310 | 0 207 1.221719557621216e+03 8.701876691199741e-04 5.249216062999920e-02 311 | 1 102 1.231849522230071e+03 6.314483912553770e-03 4.327457297563722e-02 312 | 0 208 1.232704049062410e+03 8.652348854194439e-04 5.257937373216484e-02 313 | 0 209 1.243696961995456e+03 8.690117167564324e-04 5.264124032492500e-02 314 | 1 103 1.254103163704619e+03 6.315057112088527e-03 4.327064217069518e-02 315 | 0 210 1.254684063478305e+03 8.628812825429151e-04 5.271850504884835e-02 316 | 0 211 1.265678436539351e+03 8.675598031915846e-04 5.275219989499200e-02 317 | 0 212 1.276666963771293e+03 8.598032962913504e-04 5.281331068579855e-02 318 | 1 104 1.276356612432244e+03 6.315470473986469e-03 4.326718669068642e-02 319 | 0 213 1.287661195335902e+03 8.649353525730735e-04 5.281873033893343e-02 320 | 0 214 1.298649694056458e+03 8.549064888847023e-04 5.285687751617193e-02 321 | 1 105 1.298610115422720e+03 6.315593791484850e-03 4.326474170908273e-02 322 | 0 215 1.309641879600106e+03 8.602373002313079e-04 5.283528619841812e-02 323 | 0 216 1.320628647837512e+03 8.478451136435229e-04 5.284187405696557e-02 324 | 1 106 1.320863953212523e+03 6.315334907691898e-03 4.326380080956672e-02 325 | 0 217 1.331616619421616e+03 8.527125229304530e-04 5.279765446313041e-02 326 | 0 218 1.342599746188533e+03 8.376746449946304e-04 5.276527536886477e-02 327 | 1 107 1.343118436157566e+03 6.314617900707931e-03 4.326445909290038e-02 328 | 0 219 1.353581182773365e+03 8.418918106767578e-04 5.270352787828782e-02 329 | 0 220 1.364558692272068e+03 8.240398832303629e-04 5.262675198902003e-02 330 | 1 108 1.365373897020889e+03 6.313458033988016e-03 4.326647707199124e-02 331 | 0 221 1.375531233886542e+03 8.277350213290590e-04 5.255330218323265e-02 332 | 0 222 1.386501163308619e+03 8.079795935460836e-04 5.243116039933026e-02 333 | 1 109 1.387630674747378e+03 6.311939639245889e-03 4.326949700818711e-02 334 | 0 223 1.397462703475923e+03 8.108463781600849e-04 5.235121423897204e-02 335 | 0 224 1.408423329860007e+03 7.905075713991363e-04 5.218888633285765e-02 336 | 1 110 1.409889085563555e+03 6.310217131860423e-03 4.327306596926153e-02 337 | 0 225 1.419372260413661e+03 7.926661662225185e-04 5.210651116239088e-02 338 | 0 226 1.430322305284717e+03 7.737467330144484e-04 5.191462639157750e-02 339 | 1 111 1.432149384143024e+03 6.308500260990631e-03 4.327666263815058e-02 340 | 0 227 1.441257872787068e+03 7.752759859962446e-04 5.183355933920267e-02 341 | 0 228 1.452196684198525e+03 7.601267478437315e-04 5.162866807750126e-02 342 | 1 112 1.454411718319224e+03 6.307012516154187e-03 4.327975409101606e-02 343 | 0 229 1.463119295156468e+03 7.609832173767875e-04 5.155076281419086e-02 344 | 0 230 1.474047137850236e+03 7.511277194423618e-04 5.134994519017811e-02 345 | 1 113 1.476676083740366e+03 6.305926445563544e-03 4.328187627300462e-02 346 | 0 231 1.484958408527986e+03 7.514338253762240e-04 5.127776092883619e-02 347 | 0 232 1.495876537266366e+03 7.471601653742551e-04 5.109685348361218e-02 348 | 1 114 1.498942292182527e+03 6.305300252306138e-03 4.328281350453023e-02 349 | 0 233 1.506779205073920e+03 7.469607658677905e-04 5.103204904501157e-02 350 | 0 234 1.517689883487182e+03 7.470127412440457e-04 5.088207976515691e-02 351 | 1 115 1.521209969307434e+03 6.305064070202173e-03 4.328265895397717e-02 352 | 0 235 1.528587426918049e+03 7.463783943278116e-04 5.082650160979546e-02 353 | 0 236 1.539493671396638e+03 7.485513258155473e-04 5.071345229958101e-02 354 | 1 116 1.543478594829025e+03 6.305051879677053e-03 4.328180284904072e-02 355 | 0 237 1.550389832545489e+03 7.475668559134162e-04 5.066866273979576e-02 356 | 0 238 1.561295039277731e+03 7.494584307845882e-04 5.059425639276773e-02 357 | 1 117 1.565747567380576e+03 6.305071663192077e-03 4.328074830808976e-02 358 | 0 239 1.572193366084622e+03 7.481889902848569e-04 5.056151428366282e-02 359 | 0 240 1.583100861776060e+03 7.478512661176616e-04 5.052474894930964e-02 360 | 1 118 1.588016284236312e+03 6.304960810820687e-03 4.327997011866123e-02 361 | 0 241 1.594004357332702e+03 7.463624711618032e-04 5.050495312734701e-02 362 | 0 242 1.604917041164073e+03 7.425851407674695e-04 5.050339769161610e-02 363 | 1 119 1.610284209392338e+03 6.304619191051327e-03 4.327982505630007e-02 364 | 0 243 1.615827964226572e+03 7.409536125481229e-04 5.049703867564640e-02 365 | 0 244 1.626748082671093e+03 7.332742979607212e-04 5.052779176686625e-02 366 | 1 120 1.632550920401487e+03 6.304011379332931e-03 4.328042003080650e-02 367 | 0 245 1.637667922775284e+03 7.315540836927703e-04 5.053489583976862e-02 368 | 0 246 1.648596980566596e+03 7.201292307721980e-04 5.059492109520362e-02 369 | 1 121 1.654816125190164e+03 6.303159228790974e-03 4.328166103495094e-02 370 | 0 247 1.659526517400521e+03 7.183755056848850e-04 5.061518739670102e-02 371 | 0 248 1.670465328754422e+03 7.037806224964214e-04 5.070147287934356e-02 372 | 1 122 1.677079659239455e+03 6.302123084969653e-03 4.328331609216914e-02 373 | 0 249 1.681404756249164e+03 7.020337722723705e-04 5.073420409629334e-02 374 | 0 250 1.692353532433692e+03 6.851028016713794e-04 5.084371222773401e-02 375 | 1 123 1.699341469191303e+03 6.300982810626060e-03 4.328509919833918e-02 376 | -------------------------------------------------------------------------------- /testing/test_lweiss.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import ttvfast 3 | 4 | ''' 5 | Based on a bug report supplied by Laren Weiss 6 | ''' 7 | 8 | 9 | def test_application(args): 10 | setup = args 11 | Time, dt, Total = setup[1:4] 12 | dt /= 5. 13 | assert Time == -1045 14 | assert 0.1 < dt < 0.2 15 | assert Total == 1700 16 | 17 | params = setup[0] 18 | 19 | planet1 = ttvfast.models.Planet(*params[2:2 + 7]) 20 | planet2 = ttvfast.models.Planet(*params[2 + 7:]) 21 | 22 | gravity, stellar_mass = params[0:2] 23 | planets = [planet1, planet2] 24 | 25 | assert 0.9 < stellar_mass < 1.0 26 | results = ttvfast.ttvfast(planets, stellar_mass, Time, dt, Total) 27 | python_rows = list(zip(*results['positions'])) 28 | 29 | expected = [1, 7, -8.828648752325788e+02, 6.363231859868642e-03, 30 | 4.321183741781629e-02] 31 | assert np.allclose(python_rows[22], expected) 32 | -------------------------------------------------------------------------------- /testing/test_models.py: -------------------------------------------------------------------------------- 1 | from numpy import allclose, isclose 2 | import pytest 3 | 4 | from ttvfast import models 5 | 6 | 7 | @pytest.fixture 8 | def planet(params): 9 | planet = models.Planet(**params) 10 | return planet 11 | 12 | 13 | def test_planet_construction(params): 14 | planet = models.Planet(**params) 15 | for key in params: 16 | assert isclose(getattr(planet, key), 17 | params[key]) 18 | 19 | 20 | def test_planets_to_params(planet): 21 | stellar_mass = 1.0 22 | planets = [planet for _ in range(10)] 23 | params = models.planets_to_params(stellar_mass, planets) 24 | assert len(params) == 2 + 10 * 7 == 72 25 | 26 | 27 | def test_planet_conversion_example(): 28 | stellar_mass = 0.95573417954 29 | planet1_params = [0.00002878248, 30 | 1.0917340278625494e+01, 5.6159310042858110e-02, 31 | 9.0921164935951211e+01, -1.1729336712101943e-18, 32 | 1.8094838714599581e+02, -8.7093652691581923e+01, 33 | ] 34 | planet2_params = [0.00061895914, 35 | 2.2266898036209028e+01, 5.6691301931178648e-02, 36 | 8.7598285693573246e+01, 4.6220554014026838e-01, 37 | 1.6437004273382669e+00, -1.9584857031843157e+01, 38 | ] 39 | planet1 = models.Planet(*planet1_params) 40 | planet2 = models.Planet(*planet2_params) 41 | params = models.planets_to_params(stellar_mass, [planet1, planet2]) 42 | 43 | expected = [0.000295994511, 44 | 0.95573417954, 45 | 0.00002878248, 46 | 1.0917340278625494e+01, 5.6159310042858110e-02, 47 | 9.0921164935951211e+01, -1.1729336712101943e-18, 48 | 1.8094838714599581e+02, -8.7093652691581923e+01, 49 | 0.00061895914, 50 | 2.2266898036209028e+01, 5.6691301931178648e-02, 51 | 8.7598285693573246e+01, 4.6220554014026838e-01, 52 | 1.6437004273382669e+00, -1.9584857031843157e+01, 53 | ] 54 | assert allclose(params, expected) 55 | -------------------------------------------------------------------------------- /testing/test_python_api.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | import numpy as np 3 | 4 | import ttvfast 5 | 6 | 7 | def test_python_call(stellar_mass, planets, python_args): 8 | Time, dt, Total = python_args 9 | results = ttvfast.ttvfast(planets, stellar_mass, Time, dt, Total) 10 | 11 | python_rows = zip(*results['positions']) 12 | 13 | with open('testing/example_output.txt') as infile: 14 | for i, (python_row, c_row) in enumerate( 15 | zip(python_rows, infile)): 16 | c_row = c_row.strip().split() 17 | vals = (int(c_row[0]), 18 | int(c_row[1]), 19 | float(c_row[2]), 20 | float(c_row[3]), 21 | float(c_row[4])) 22 | assert np.allclose(vals, python_row) 23 | 24 | assert i == 374 25 | 26 | 27 | def test_module_docstring_is_present(): 28 | assert 'Fast TTV computation' in ttvfast.__doc__ 29 | 30 | 31 | def test_ttvfast_docstring_is_present(): 32 | assert 'https://github.com/kdeck/TTVFast' in ttvfast.ttvfast.__doc__ 33 | 34 | 35 | @pytest.mark.parametrize('input_flag', [-1, -100, 3, 4, 5, 100]) 36 | def test_bad_input_flags(stellar_mass, planets, python_args, input_flag): 37 | Time, dt, Total = python_args 38 | with pytest.raises(ValueError) as exc_info: 39 | ttvfast.ttvfast(planets, stellar_mass, Time, dt, Total, input_flag=input_flag) 40 | 41 | assert 'invalid `input_flag`' in str(exc_info).lower() 42 | -------------------------------------------------------------------------------- /testing/test_rv.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import ttvfast 3 | 4 | 5 | def test_rv_given(stellar_mass, planets, python_args): 6 | rv_times = [475.40947, 481.50789, 505.56661, 508.60654, 514.56435, 533.36529, 7 | 537.45558, 551.44399, 582.35976, 597.30019, 611.24418, ] 8 | 9 | expected = [-4.557399570827615e-07, -2.664545469316134e-05, -2.023759760196753e-05, 10 | -2.300427585052538e-06, 2.900816865436315e-05, 1.477347050308233e-05, 11 | 2.907887313600428e-05, -1.322952680464436e-05, 2.874508640612880e-05, 12 | -5.481921572024111e-06, -1.876024000347331e-05, ] 13 | 14 | Time, dt, Total = python_args 15 | results = ttvfast.ttvfast(planets, stellar_mass, Time, dt, Total, rv_times=rv_times) 16 | assert np.allclose(results['rv'], expected) 17 | 18 | 19 | def test_no_rv_given(stellar_mass, planets, python_args): 20 | Time, dt, Total = python_args 21 | results = ttvfast.ttvfast(planets, stellar_mass, Time, dt, Total) 22 | assert results['rv'] is None 23 | -------------------------------------------------------------------------------- /testing/test_ttvfast.py: -------------------------------------------------------------------------------- 1 | from ttvfast import _ttvfast 2 | import numpy as np 3 | from six.moves import range 4 | 5 | 6 | def test_ttvfast_main_function(args): 7 | params, Time, dt, Total, n_plan, input_flag = args 8 | 9 | results, _ = _ttvfast._ttvfast(params, dt, Time, Total, n_plan, input_flag, 0) 10 | python_rows = zip(*results) 11 | 12 | with open('testing/example_output.txt') as infile: 13 | for i, (python_row, c_row) in enumerate( 14 | zip(python_rows, infile)): 15 | c_row = c_row.strip().split() 16 | vals = (int(c_row[0]), 17 | int(c_row[1]), 18 | float(c_row[2]), 19 | float(c_row[3]), 20 | float(c_row[4])) 21 | assert np.allclose(vals, python_row) 22 | 23 | assert i == 374 24 | 25 | 26 | def test_convert_to_array(args): 27 | params, Time, dt, Total, n_plan, input_flag = args 28 | 29 | results = _ttvfast._ttvfast(params, dt, Time, Total, n_plan, input_flag, 0) 30 | rows = list(map(np.array, results)) 31 | assert hasattr(rows[0], 'size') 32 | 33 | 34 | def test_run_multiple_times(args): 35 | out = [] 36 | for i in range(10): 37 | params, Time, dt, Total, n_plan, input_flag = args 38 | results, _ = _ttvfast._ttvfast(params, dt, Time, Total, n_plan, input_flag, 0) 39 | out.append(results) 40 | 41 | assert all([len(column) > 0 for column in results]) 42 | 43 | assert len(out) == 10 44 | -------------------------------------------------------------------------------- /towncrier.ini: -------------------------------------------------------------------------------- 1 | [towncrier] 2 | package = ttvfast 3 | filename = CHANGELOG.rst 4 | -------------------------------------------------------------------------------- /tox.ini: -------------------------------------------------------------------------------- 1 | # Tox (http://tox.testrun.org/) is a tool for running tests 2 | # in multiple virtualenvs. This configuration file will run the 3 | # test suite on all supported python versions. To use it, "pip install tox" 4 | # and then run "tox" from this directory. 5 | 6 | [tox] 7 | envlist = py27, py34, py35, py36, lint, mypy 8 | 9 | [testenv] 10 | commands = {posargs:py.test --cov {envsitepackagesdir}/ttvfast {toxinidir}/testing} 11 | deps = -r{toxinidir}/requirements.txt 12 | 13 | [testenv:mypy] 14 | deps = mypy-lang==0.4.5 15 | typed-ast==0.6.1 16 | lxml==3.6.4 17 | commands = mypy --disallow-untyped-defs --silent-imports --py2 --fast-parser -p ttvfast \ 18 | --html-report htmlmypy --disallow-untyped-calls 19 | 20 | [testenv:lint] 21 | deps = flake8==2.5.4 22 | commands = flake8 --max-complexity 10 ttvfast {toxinidir}/testing --max-line-length=90 23 | -------------------------------------------------------------------------------- /ttvfast/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | "Fast TTV computation" 4 | 5 | from ._ttvfast import _ttvfast as _ttvfast_fn 6 | from . import models 7 | from .version import __version__ # noqa 8 | try: 9 | from typing import List, Dict, Any, Optional # noqa: F401 10 | except ImportError: 11 | pass 12 | 13 | 14 | __all__ = ['ttvfast'] # type: List[str] 15 | 16 | 17 | def ttvfast(planets, # type: List[models.Planet] 18 | stellar_mass, # type: float 19 | time, # type: float 20 | dt, # type: float 21 | total, # type: float 22 | rv_times=None, # type: Optional[List[float]] 23 | input_flag=0 # type: int 24 | ): 25 | # type: (...) -> Dict[str, List[float]] 26 | ''' 27 | Run the TTV fast function. See https://github.com/kdeck/TTVFast. 28 | Program arguments: 29 | * planets: list of `models.Planet` instances 30 | * stellar_mass: stellar mass (solar masses) 31 | * time: start point for integration (days) 32 | * dt: time step for the integration (days) 33 | * total: end point for integration (days) 34 | * rv_times: rv measurement times 35 | * input_flag: input coordinate system (0, 1 or 2) 36 | 37 | The `input_flag` argument corresponds to: 38 | 0 = Jacobi 39 | 1 = astrocentric elements 40 | 2 = astrocentric cartesian 41 | ''' 42 | if input_flag not in [0, 1, 2]: 43 | raise ValueError('Invalid `input_flag` value. Must be 0, 1 or 2') 44 | 45 | params = models.planets_to_params(stellar_mass, planets) 46 | n_plan = len(planets) 47 | 48 | len_rv = len(rv_times) if rv_times is not None else 0 49 | positions, rv = _ttvfast_fn( 50 | params, dt, time, total, n_plan, input_flag, len_rv, rv_times) 51 | return {'positions': positions, 'rv': rv} 52 | -------------------------------------------------------------------------------- /ttvfast/_ttvfast.pyi: -------------------------------------------------------------------------------- 1 | from typing import Optional, Tuple 2 | 3 | def _ttvfast( 4 | params: List[float], 5 | dt: float, 6 | time: float, 7 | total: float, 8 | n_plan: int, 9 | input_flag: int, 10 | len_rv: int, 11 | rv_times: Optional[List[float]], 12 | ) -> Tuple[List[float], Optional[List[float]]]: ... 13 | 14 | # vim: ft=python 15 | -------------------------------------------------------------------------------- /ttvfast/models.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Handle the conversion of the Planet object to the params list which is 3 | required by the C code. 4 | 5 | Required arguments are: 6 | 1) G in units of AU^3/day^2/M_sun 7 | 2) MStar in units of M_sun 8 | 3-9) Planetary parameters: 9 | * Mplanet in units of M_sun 10 | * Period in days 11 | * E between 0 and 1 12 | * I in units of degrees 13 | * Longnode in units of degrees 14 | * Argument in units of degrees 15 | * mean anomaly in units of degrees 16 | ''' 17 | 18 | 19 | try: 20 | from typing import List, Any # noqa: F401 21 | except ImportError: 22 | pass 23 | 24 | 25 | class Planet(object): 26 | 27 | ''' 28 | Planet class to define each planet in the system. 29 | ''' 30 | 31 | KEYS = ['mass', 'period', 'eccentricity', 'inclination', 32 | 'longnode', 'argument', 'mean_anomaly'] 33 | 34 | def __init__(self, mass, period, eccentricity, inclination, 35 | longnode, argument, mean_anomaly): 36 | # type: (float, float, float, float, float, float, float) -> None 37 | ''' 38 | Construct a planet. Required arguments are: 39 | * mass: Mplanet in units of M_sun 40 | * period: Period in days 41 | * eccentricity: E between 0 and 1 42 | * inclination: I in units of degrees 43 | * longnode: Longnode in units of degrees 44 | * argument: Argument in units of degrees 45 | * mean_anomaly: mean anomaly in units of degrees 46 | ''' 47 | self.mass = mass 48 | self.period = period 49 | self.eccentricity = eccentricity 50 | self.inclination = inclination 51 | self.longnode = longnode 52 | self.argument = argument 53 | self.mean_anomaly = mean_anomaly 54 | 55 | 56 | def planets_to_params(stellar_mass, planets, G=0.000295994511): 57 | # type: (float, List[Planet], float) -> List[float] 58 | out = [G, stellar_mass] 59 | for planet in planets: 60 | out.extend([getattr(planet, key) for key in Planet.KEYS]) 61 | return out 62 | -------------------------------------------------------------------------------- /ttvfast/newsfragments/.gitignore: -------------------------------------------------------------------------------- 1 | !.gitignore 2 | -------------------------------------------------------------------------------- /ttvfast/version.py: -------------------------------------------------------------------------------- 1 | __version__ = '0.3.0' 2 | --------------------------------------------------------------------------------