{"id":17191032,"url":"https://github.com/dfm/photodynam","last_synced_at":"2025-10-10T10:33:28.048Z","repository":{"id":10268688,"uuid":"12381376","full_name":"dfm/photodynam","owner":"dfm","description":"Photodynamical code for fitting the light curves of multiple body systems written by Josh Carter","archived":false,"fork":false,"pushed_at":"2024-06-08T09:08:57.000Z","size":1012,"stargazers_count":4,"open_issues_count":1,"forks_count":6,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-13T19:59:57.180Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dfm.png","metadata":{"files":{"readme":"README","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2013-08-26T14:32:35.000Z","updated_at":"2024-04-23T16:08:19.000Z","dependencies_parsed_at":"2025-04-13T19:51:32.056Z","dependency_job_id":null,"html_url":"https://github.com/dfm/photodynam","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dfm/photodynam","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dfm%2Fphotodynam","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dfm%2Fphotodynam/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dfm%2Fphotodynam/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dfm%2Fphotodynam/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dfm","download_url":"https://codeload.github.com/dfm/photodynam/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dfm%2Fphotodynam/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279003548,"owners_count":26083595,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-15T01:24:41.138Z","updated_at":"2025-10-10T10:33:28.032Z","avatar_url":"https://github.com/dfm.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"This code was written by Josh Carter (see citation requirements below) and\nthe public release is maintained—with the permission of the original author—by\nDan Foreman-Mackey. Any questions should be raised as issues on the GitHub\nrepository (https://github.com/dfm/photodynam).\n\nContents\n--------\n\n-License\n-Credit\n-Overview\n-Example use of functions\n-photodynam\n\t-Installing photodynam\n\t-Documenation\n\t-\u003cinput_file\u003e\n\t-\u003creport_file\u003e\n\t-Example input file\n\t-Example report file\n\t-Running the example\n\nLicense\n-------\n\n\nThe MIT License (MIT)\n\nCopyright (c) 2013 Joshua Carter\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\nCredit\n------\n\nPlease cite both\n\nScience 4 February 2011: Vol. 331 no. 6017 pp. 562-565 DOI:10.1126/science.1201274\nMNRAS (2012) 420 (2): 1630-1635. doi: 10.1111/j.1365-2966.2011.20151.x\n\nwhen using this code towards a publication.\n\nOverview\n--------\n\nThe code included in this package facilitates so-called \"photometric-dynamical\" modeling.  This model is quite simple and this is reflected in the code base.  A N-body code provides coordinates and the photometric code produces light curves based on coordinates.\n\nThe source code (in the directory source/) should be all one needs to produce forward model light curves. Briefly:\n\nA. Pal's code to compute overlap integrals:\n\telliptic.c\n\telliptic.h\n\ticirc.c\n\ticirc.h\n\tmttr.c\n\tscpolyint.c\n\tscpolyint.h\n\nThis code forms the base of the photometric code.  When using that code alone or when using the full \"photodynam\" code please cite him appropriately:\n\n\tMNRAS (2012) 420 (2): 1630-1635. doi: 10.1111/j.1365-2966.2011.20151.x\n\nn_body.cpp, n_body.h:\n\tThis code performs the N-body integration with a Burlisch-Stoer integration scheme.  Refer to the header for the description of the simple function \"evolve.\" Alternatively, use the NBodyState object to access the integrator.\n\nn_body_state.cpp, n_body_state.h:\n\tDefines a class (containing public member functions and constructors) that retains a N-body \"state\" which is most simply the ICs and masses at some time.  You may operate on this object in a number of ways including N-body integration which is accomplished through the overloaded operator ().\n\nn_body_lc.cpp, n_body.h:\n\tContains code (relying on A. Pal's code, see above) to produce light curves (integrated light) for any number of spherical, quadratically limb-darkened bodies of arbitrary radius and flux. Will handle multiple overlaps (\"mutual events\").\n\nkepcart.c:\n\tMatt Holman's code to covert between cartesian coordinates of Keplerian elements. (Matt, credit?)\n\nphotodynam.cpp:\n\tUser-end code to produce light curves and other information for a standardized input format.  Easy to use, probably a good starting point to get some light curves produced.\n\nExample use of functions\n------------------------\n\n#include \"n_body_state.h\"\n#include \"n_body_lc.h\"\n\nint main(int argc, char* argv[]) {\n\n\t// Kepler-16\n\n\tint N = 3;\n\tdouble t0 = 212.12316;\n\n\t// Object properties (two stars and one planet) AU, day, radians\n\n\tdouble mass[N] = {0.00020335520,   5.977884E-05,   9.320397E-08}\n\tdouble radii[N] = {0.00301596700,   0.00104964500,   0.00035941463}\n\tdouble flux[N] = {0.98474961000,\t0.01525038700,\t0.00000000000}\n\tdouble u1[N] = {0.65139908000,\t0.2,\t\t0.0}\n\tdouble u2[N] = {0.00587581200,\t0.3,\t\t0.0}\n\n\t// Now, the N-1 Jacobian Keplerian elements\n\n\tdouble a[N-1] = {2.240546E-01,7.040813E-01}\n\tdouble e[N-1] = {1.595442E-01,7.893413E-03}\n\tdouble inc[N-1] = {1.576745E+00,1.571379E+00}\n\tdouble om[N-1] = {4.598385E+00,-5.374484E-01}\n\tdouble ln[N-1] = {0,-8.486496E-06}\n\tdouble ma[N-1] = {3.296652E+00,2.393066E+00}\n\n\t// Instantiate state.  Time t0 is epoch of above coordinates\n\n\tNBodyState state(mass,a,e,inc,om,ln,ma,N,t0);\n\n\tint status;\n\tdouble flux;\n\n\t// Evaluate the flux at time t0 using the getBaryLT() member method\n\t//\tof NBodyState which returns NX3 array of barycentric, light-time\n\t//\tcorrected coordinates\n\n\tflux = occultn(state.getBaryLT(),radii,u1,u2,flux,N);\n\n\t// Now integrate forward in time to time t0+100 with stepsize 0.01 days orbit\n\t//\terror tolerance of 1e-20 and minimum step size of 1e-10 days\n\n\tstatus = state(t0+100,0.01,1e-20,1e-10);\n\n\t// Now get the flux at the new time\n\n\tflux = occultn(state.getBaryLT(),radii,u1,u2,flux,N);\n\n\t// Print out the barycentric, light-time corrected x coordinate of body 0\n\n\tcout \u003c\u003c state.X_LT(0) \u003c\u003c endl;\n\n\treturn 0;\n}\n\n// Refer to n_body_state.h for other access functions...\n\nphotodynam\n----------\n\n\tInstalling photodynam\n\t---------------------\n\n\tUnpack directory, change to that directory, type make. Program \"photodynam\" will be built\n\tin top directory\n\n\tDocumentation\n\t-------------\n\tCall code as photodynam \u003cinput_file\u003e \u003creport_file\u003e [\u003e \u003coutput_file\u003e].\n\n\tOutput is written to standard out unless redirected (shown in the optional listing above).\n\n\t\u003cinput_file\u003e file\n\t-----------------\n\n  \t\u003cinput_file\u003e is file of initial coordinates and properties in\n  \tfollowing format:\n\n  \t\u003cN\u003e \u003ctime0\u003e\n  \t\u003cstep_size\u003e \u003corbit_error\u003e\n\n  \t\u003cmass_1\u003e \u003cmass_2\u003e ... \u003cmass_N\u003e\n  \t\u003cradius_1\u003e \u003cradius_2\u003e ... \u003cradius_N\u003e\n  \t\u003cflux_1\u003e \u003cflux_2\u003e ... \u003cflux_N\u003e\n  \t\u003cu1_1\u003e \u003cu1_2\u003e ... \u003cu1_N\u003e\n  \t\u003cu2_1\u003e \u003cu2_2\u003e ... \u003cu2_N\u003e\n\n  \t\u003ca_1\u003e \u003ce_1\u003e \u003ci_1\u003e \u003co_1\u003e \u003cl_1\u003e \u003cm_1\u003e\n  \t...\n  \t\u003ca_(N-1)\u003e \u003ce_(N-1)\u003e \u003ci_(N-1)\u003e \u003co_(N-1)\u003e \u003cl_(N-1)\u003e \u003cm_(N-1)\u003e\n\n  \twhere the Keplerian coordinates (a = semimajor axis, e = eccentricity, i = inclination,\n  \to = argument periapse, l = nodal longitude, m = mean anomaly) are the\n  \tN-1 Jacobian coordinates associated with the masses as ordered above.\n  \tAngles are assumed to be in radians. The observer is along the positive z axis.\n  \tRotations are performed according to Murray and Dermott.\n\n\t\u003creport_file\u003e file\n\t-------------------\n\n\tThis file is a list of times to report the outputs.\n  \tThe first line is a space-separated list of single character-defined\n  \toutput fields according to:\n\n  \tt = time\n  \tF = flux\n  \ta = semi-major axes\n  \te = eccentricities\n  \ti = sky-plane inclinations\n  \to = arguments of periapse\n  \tl = nodal longitudes\n  \tm = mean anomalies\n  \tK = full keplerian osculating elements\n  \tx = barycentric, light-time corrected coordinates\n  \tv = barycentric, light-time corrected velocities\n  \tM = masses\n  \tE = fractional energy change from t0\n  \tL = fraction Lz change from t0\n\n  \tFor example, the first line could be\n\n  \t\tt F E\n\n  \tand the output would have three columns of time flux and\n  \tfractional energy loss.\n\n\n  \tExample input file\n\t------------------ examples/kepler16_input.txt:\n\n  \t3 212.12316\n  \t0.01 1e-16\n\n  \t0.00020335520 5.977884E-05    9.320397E-08\n  \t0.00301596700 0.00104964500   0.00035941463\n  \t0.98474961000\t0.01525038700\t0.00000000000\n  \t0.65139908000\t0.2\t\t0.0\n  \t0.00587581200\t0.3\t\t0.0\n\n  \t2.240546E-01 1.595442E-01 1.576745E+00 4.598385E+00 0.000000E+00 3.296652E+00\n  \t7.040813E-01 7.893413E-03 1.571379E+00 -5.374484E-01 -8.486496E-06 2.393066E+00\n\n\tExample report file\n\t------------------- examples/kepler16_report.txt:\n\n\tt F E e\n      \t-46.461114      -46.440679      -46.420245      -46.399811      -46.379377\n\t...\n\n\tRunning the example\n\t-------------------\n\n\tRun:\n\n\t./photodynam examples/kepler16_input.txt examples/kepler16_report.txt\n\n\tto write output to standard out\n\n\tor\n\n\t./photodynam examples/kepler16_input.txt examples/kepler16_report.txt \u003e output.txt\n\n\tto dump the result into the file named output.txt\n\n\tCompare this file (whatever you call it) to examples/output.txt\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdfm%2Fphotodynam","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdfm%2Fphotodynam","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdfm%2Fphotodynam/lists"}