-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #337 from sblunt/saanika/changes
Add residual plotting function
- Loading branch information
Showing
3 changed files
with
458 additions
and
93 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
""" | ||
Module to test plotting functions not tested by other tests/results testing. | ||
""" | ||
import os | ||
import orbitize | ||
import orbitize.driver | ||
import orbitize.plot as plot | ||
|
||
def test_plot_residuals(debug=False): | ||
""" | ||
Tests the residual plotting code on a 2-planet orbit fit | ||
""" | ||
# run a very short 2 planet orbit fit | ||
input_file = os.path.join(orbitize.DATADIR, "GJ504.csv") | ||
my_driver = orbitize.driver.Driver(input_file, | ||
"OFTI", | ||
1, | ||
1.22, | ||
56.95, | ||
mass_err=0.08, | ||
plx_err=0.26, | ||
system_kwargs={"restrict_angle_ranges": True} | ||
) | ||
my_sampler = my_driver.sampler | ||
my_sampler.run_sampler(101) | ||
my_results = my_sampler.results | ||
|
||
# plot planet 1 | ||
fig1 = plot.plot_residuals(my_results) | ||
|
||
# plot with more samples, mod 180 | ||
fig2 = plot.plot_residuals(my_results, object_to_plot=1, mod180=True, num_orbits_to_plot=150) | ||
|
||
if debug: | ||
import matplotlib.pylab as plt | ||
plt.show() | ||
|
||
if __name__ == "__main__": | ||
test_plot_residuals(debug=True) | ||
|