Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
5a9429f
Passing in arg
Farrmol Jul 22, 2024
d1f285c
test commit
sblunt Jul 22, 2024
a0b603f
add minimal unit test for reflected-light functionality
sblunt Jul 22, 2024
04e8638
add if name == main to test_brightness
sblunt Jul 22, 2024
2d9129b
Called times2trueanom_and_eccanom
Farrmol Jul 23, 2024
017c8ce
modify read_input to read in brightness vals
sblunt Jul 24, 2024
03ea984
update todos in test_brightness
sblunt Jul 24, 2024
64045dd
test system for brightness calc: gj 504 -> beta pic
sblunt Jul 24, 2024
48008b6
Merge branch 'add-brigtness-calc-to-comp-all-orbits' of https://githu…
Farrmol Jul 26, 2024
9b9055e
Added Brightness_calculation
Farrmol Jul 29, 2024
81f8388
fixed bug returning brightness
sblunt Jul 30, 2024
ec07520
Plot of betaPicB data
Farrmol Aug 5, 2024
f308ed4
test
Farrmol Aug 5, 2024
4c3f6cf
add brightness to return stms of comp_all_orbits & todo for farrah
sblunt Aug 5, 2024
37bbb19
add test_compute_posteriors
sblunt Aug 5, 2024
9dcd884
Added brightness as a model prediction
Farrmol Aug 5, 2024
222dec7
add pretty visual to test for farrah
sblunt Aug 19, 2024
1863981
add todo for farrah in read input test
sblunt Sep 17, 2024
2ca8419
cleaned up test brightness
Farrmol Sep 20, 2024
17574f8
Merge branch 'add-brigtness-calc-to-comp-all-orbits' of https://githu…
Farrmol Sep 20, 2024
30248b6
testing add change
sblunt Sep 20, 2024
d9ef026
Merge branch 'add-brigtness-calc-to-comp-all-orbits' of https://githu…
sblunt Sep 20, 2024
aa16ef8
Added assert brightness test
Farrmol Sep 27, 2024
b37f60d
Merge branch 'add-brigtness-calc-to-comp-all-orbits' of https://githu…
sblunt Oct 8, 2024
cd0c00a
mcmc running
sblunt Oct 8, 2024
1a069bb
Assert nan values
Farrmol Oct 9, 2024
7300015
changed these to test 'test_brightness.py'
Farrmol Oct 10, 2024
914810d
Merge branch 'add-brigtness-calc-to-comp-all-orbits' of https://githu…
Farrmol Oct 10, 2024
683094a
Test orbital data to run mcmc
Farrmol Oct 11, 2024
1a6f24e
Moved test orbital data to example data file
Farrmol Oct 11, 2024
3234195
Added ID to test table
Farrmol Oct 11, 2024
ac4ac17
another change that has columns in right order...lol
Farrmol Oct 11, 2024
3147d1b
object_id changed to object to fit exception!
Farrmol Oct 11, 2024
f40b8db
added + read in a simulated data file to compute posteriors test
Farrmol Oct 11, 2024
062b1f3
100th attempt at fixing the csv file: adding ra and dec error
Farrmol Oct 11, 2024
ddd6820
changed errors to 0.01
Farrmol Oct 11, 2024
4d14d01
mcmc test
Farrmol Oct 18, 2024
f7c2208
trying to run orbitize plot just with simulated ra and dec data
Farrmol Oct 31, 2024
8890f96
Trying to find what's wrong in simulated ra and dec data file
Farrmol Oct 31, 2024
e70e82a
changed sep pa end year
Farrmol Feb 4, 2025
ffcaace
brightness calc incorp in mcmc
sblunt Feb 14, 2025
e009c18
new test mcmc file with added brightness values
Farrmol Feb 19, 2025
8e9a8e2
separate test for brightness mcmc
Farrmol Feb 24, 2025
4966b3d
corner plot
Farrmol Mar 4, 2025
ab6b40c
new simulated ra and dec data
Farrmol Mar 14, 2025
a539090
updated parallax (0.03) to match simulated ra/dec data file
Farrmol Mar 17, 2025
0f358a6
mcmc under tests
Farrmol Mar 24, 2025
239aff1
testing brightness posteriors
Farrmol Jun 6, 2025
7048e56
HDF5 for shorted pos data set
Farrmol Jun 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions HDF5_Test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from orbitize import results
import matplotlib.pyplot as plt
hdf5_filename = "my_posterior_brightness.hdf5"


loaded_results = results.Results() # Create blank results object for loading
loaded_results.load_results(hdf5_filename)

print(loaded_results.post)

orbit_plot_fig = loaded_results.plot_orbits(
object_to_plot=1,
num_orbits_to_plot=100,
start_mjd=0,
sep_pa_end_year=1861
)
# Save or show the figure
orbit_plot_fig.savefig("reloaded_short_bright_orbit_plot.png")
plt.show()
20 changes: 20 additions & 0 deletions HDF5_shortpos.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from orbitize import results
import matplotlib.pyplot as plt
hdf5_filename = "/home/fmolina/orbitize/tests/my_posterior_shortpos.hdf5"


loaded_results = results.Results() # Create blank results object for loading
loaded_results.load_results(hdf5_filename)

print(loaded_results.labels)


orbit_plot_fig = loaded_results.plot_orbits(
object_to_plot=1,
num_orbits_to_plot=100,
start_mjd=0,
sep_pa_end_year=1859
)
# save fig
orbit_plot_fig.savefig("/home/fmolina/orbitize/reloaded_shortpos_plot.png")
plt.show()
82 changes: 82 additions & 0 deletions mcmc_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import numpy as np

import orbitize
from orbitize import driver
import multiprocessing as mp

filename = "{}/simulated_ra_dec_data.csv".format(orbitize.DATADIR)

# system parameters
num_secondary_bodies = 1
total_mass = 1.75 # [Msol]
plx = 30 # [mas]
mass_err = 0.05 # [Msol]
plx_err = 0.12 # [mas]

# MCMC parameters
num_temps = 20
num_walkers = 1000
num_threads = 20 # or a different number if you prefer, mp.cpu_count() for example


my_driver = driver.Driver(
filename,
"MCMC",
num_secondary_bodies,
total_mass,
plx,
mass_err=mass_err,
plx_err=plx_err,
mcmc_kwargs={
"num_temps": num_temps,
"num_walkers": num_walkers,
"num_threads": num_threads,
}, system_kwargs={"restrict_angle_ranges": True},
)


if __name__ == '__main__':

total_orbits = 50000000 # number of steps x number of walkers (at lowest temperature)
burn_steps = 500000 # steps to burn in per walker
thin = 10 # only save every 2nd step

my_driver.sampler.run_sampler(total_orbits, burn_steps=burn_steps, thin=thin)

corner_plot_fig = (
my_driver.sampler.results.plot_corner()
) # Creates a corner plot and returns Figure object
corner_plot_fig.savefig(
"my_corner_plot.png"
) # This is matplotlib.figure.Figure.savefig()

epochs = my_driver.system.data_table["epoch"]

orbit_plot_fig = my_driver.sampler.results.plot_orbits(
object_to_plot=1, # Plot orbits for the first (and only, in this case) companion
num_orbits_to_plot=100, # Will plot 100 randomly selected orbits of this companion
start_mjd=epochs[0], # Minimum MJD for colorbar (here we choose first data epoch)
sep_pa_end_year=1870.0
)
orbit_plot_fig.savefig(
"my_orbit_plot.png"
) # This is matplotlib.figure.Figure.savefig()

sma_chains, ecc_chains = my_driver.sampler.examine_chains(
param_list=["sma1", "ecc1"], n_walkers=5
)

from orbitize import results


hdf5_filename = "my_posterior.hdf5"
import os

# To avoid weird behaviours, delete saved file if it already exists from a previous run of this notebook
if os.path.isfile(hdf5_filename):
os.remove(hdf5_filename)

my_driver.sampler.results.save_results(hdf5_filename)
loaded_results = results.Results() # Create blank results object for loading
loaded_results.load_results(hdf5_filename)

51 changes: 51 additions & 0 deletions orbitize/example_data/orbital_data_with_id.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
epoch,object,raoff,decoff,raoff_err,decoff_err,brightness,brightness_err
0.0,1,0.811231477773281,0.7594337387611091,0.01,0.01,0.09358490399640425,0.01
51.02040816326531,1,0.8086976534668815,0.7884882174763149,0.01,0.01,0.09862733963920862,0.01
102.04081632653062,1,0.8018051182543783,0.8135752998448389,0.01,0.01,0.10499582237388896,0.01
153.06122448979593,1,0.7904122778426745,0.8345316311433326,0.01,0.01,0.11302378885599486,0.01
204.08163265306123,1,0.7743165421613408,0.8511262472797302,0.01,0.01,0.12318805546636806,0.01
255.10204081632654,1,0.753249548414535,0.8630503873758559,0.01,0.01,0.1361800248346027,0.01
306.12244897959187,1,0.7268712100315663,0.8699046823746542,0.01,0.01,0.1530226526335016,0.01
357.14285714285717,1,0.694762808612201,0.871183254587578,0.01,0.01,0.17526767302647034,0.01
408.16326530612247,1,0.6564196199390899,0.8662543021471459,0.01,0.01,0.2053375622554458,0.01
459.18367346938777,1,0.6112440678303533,0.8543369207025031,0.01,0.01,0.2471342724034155,0.01
510.2040816326531,1,0.5585412933875817,0.8344743818340995,0.01,0.01,0.30714302736709537,0.01
561.2244897959184,1,0.49752057854752274,0.8055051180185213,0.01,0.01,0.39642605066463393,0.01
612.2448979591837,1,0.42730869340142713,0.7660347500990113,0.01,0.01,0.5339941531274536,0.01
663.265306122449,1,0.3469855704957162,0.7144164850051454,0.01,0.01,0.7510921949147653,0.01
714.2857142857143,1,0.25565954973242283,0.6487544841765712,0.01,0.01,1.089659065489047,0.01
765.3061224489796,1,0.15260947588849744,0.5669573266103906,0.01,0.01,1.5668452007999316,0.01
816.3265306122449,1,0.037533685832437026,0.4668885487044668,0.01,0.01,2.062626571880702,0.01
867.3469387755102,1,-0.08904312701616794,0.34668838046440426,0.01,0.01,2.2566005333932724,0.01
918.3673469387755,1,-0.22515974344986556,0.2053664293775624,0.01,0.01,1.9742762557365308,0.01
969.3877551020408,1,-0.36661560366594714,0.04375763921362707,0.01,0.01,1.4724201265196528,0.01
1020.4081632653061,1,-0.5061474469043882,-0.13417842573759436,0.01,0.01,1.0378267478370446,0.01
1071.4285714285716,1,-0.6330566925723007,-0.32005017911521655,0.01,0.01,0.7457820123781923,0.01
1122.4489795918369,1,-0.7340642827698997,-0.5005631649102175,0.01,0.01,0.5692403465256193,0.01
1173.4693877551022,1,-0.7960233988208258,-0.6590354524244593,0.01,0.01,0.3677023181237994,0.01
1224.4897959183675,1,-0.8100093753970008,-0.779341500288983,0.01,0.01,0.310805460038203,0.01
1275.5102040816328,1,-0.7747106962319243,-0.8508197707379554,0.01,0.01,0.41184810403842464,0.01
1326.530612244898,1,-0.6968201319288353,-0.8712731010397949,0.01,0.01,0.4267037403343691,0.01
1377.5510204081634,1,-0.5881886796558359,-0.8463291454704698,0.01,0.01,0.45692118233449847,0.01
1428.5714285714287,1,-0.46179505907320606,-0.7861524685145167,0.01,0.01,0.4835731029852539,0.01
1479.591836734694,1,-0.32874319217715686,-0.7018568896193422,0.01,0.01,0.47696040679432183,0.01
1530.6122448979593,1,-0.19704231837725736,-0.603169261080095,0.01,0.01,0.4173135946760028,0.01
1581.6326530612246,1,-0.0717085052125464,-0.49753210156043054,0.01,0.01,0.32665907139175554,0.01
1632.6530612244899,1,0.04455725697773338,-0.39013739669169883,0.01,0.01,0.24572306795533427,0.01
1683.6734693877552,1,0.15061964729048624,-0.2843546293265123,0.01,0.01,0.189864891641152,0.01
1734.6938775510205,1,0.246302320136533,-0.18222582266793214,0.01,0.01,0.1541293228877271,0.01
1785.7142857142858,1,0.3319636092307561,-0.08488826595156958,0.01,0.01,0.1309447698576423,0.01
1836.734693877551,1,0.4082247422781462,0.007108706138521259,0.01,0.01,0.11532666162626576,0.01
1887.7551020408164,1,0.47580638683140664,0.09358245909783232,0.01,0.01,0.10445257538616691,0.01
1938.7755102040817,1,0.5354357374912007,0.17456889152858981,0.01,0.01,0.09672357063471888,0.01
1989.795918367347,1,0.5877970769939762,0.25022587899384413,0.01,0.01,0.09119647427470219,0.01
2040.8163265306123,1,0.6335080358663165,0.3207715550593558,0.01,0.01,0.08729085845318117,0.01
2091.8367346938776,1,0.673110446052766,0.3864454566166559,0.01,0.01,0.08463812457943871,0.01
2142.857142857143,1,0.707069071798058,0.44748437788656903,0.01,0.01,0.0830008016213394,0.01
2193.877551020408,1,0.7357742511645264,0.5041075168486121,0.01,0.01,0.08222762558027762,0.01
2244.8979591836737,1,0.75954615418438,0.5565073629841016,0.01,0.01,0.08222788911616931,0.01
2295.918367346939,1,0.7786393591852832,0.6048440073048987,0.01,0.01,0.08295689503656585,0.01
2346.9387755102043,1,0.7932470300017178,0.6492413535736495,0.01,0.01,0.0844083805697474,0.01
2397.9591836734694,1,0.8035043081850315,0.6897842167972191,0.01,0.01,0.08661187268900492,0.01
2448.979591836735,1,0.8094907181927744,0.7265156142343624,0.01,0.01,0.08963415615760459,0.01
2500.0,1,0.811231477773281,0.7594337387611084,0.01,0.01,0.09358490399640412,0.01
10 changes: 10 additions & 0 deletions orbitize/example_data/reflected_light_example.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
epoch,object,raoff,decoff,raoff_err,decoff_err,brightness,brightness_err
57298,1,253.72,92.35,2.98,2.85,0.5,0.1
57606,1,236.63,127.94,9.77,9.18,0.5,0.1
57645,1,234.52,123.39,1.79,1.03,0.5,0.1
57946,1,210.76,152.09,1.94,1.88,0.5,0.1
58276,1,167.49,180.87,1.61,16.97,,
58287,1,177.67,174.6,1.67,1.67,0.5,0.1
58365,1,165.7,185.33,3.28,3.66,0.5,0.1
58368,1,170.38,185.94,2.52,2.74,0.5,0.1
58414,1,161.64,176.21,13.6,14.31,,
51 changes: 51 additions & 0 deletions orbitize/example_data/simulated_ra_dec_data.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
epoch,object,raoff,decoff,raoff_err,decoff_err
0.0,1,-44.97595264191645,-40.40063509461096,0.01,0.01
0.02040816326530612,1,-44.30820072074837,-45.71952453300766,0.01,0.01
0.04081632653061224,1,-41.04700178820174,-48.201058902486146,0.01,0.01
0.061224489795918366,1,-35.74054958085938,-47.965832008749146,0.01,0.01
0.08163265306122448,1,-29.106223608047067,-45.48435880817074,0.01,0.01
0.1020408163265306,1,-21.8253835127802,-41.370259974357374,0.01,0.01
0.12244897959183673,1,-14.428317330209142,-36.211598246977516,0.01,0.01
0.14285714285714285,1,-7.2699135408338,-30.48491432830629,0.01,0.01
0.16326530612244897,1,-0.5565700744014579,-24.536472548444245,0.01,0.01
0.18367346938775508,1,5.611711944213546,-18.598583371815057,0.01,0.01
0.2040816326530612,1,11.203113265151215,-12.816822522196352,0.01,0.01
0.22448979591836732,1,16.22563205150931,-7.27593756563277,0.01,0.01
0.24489795918367346,1,20.708218518339898,-2.020291901969007,0.01,0.01
0.26530612244897955,1,24.68910142063662,2.93143637707865,0.01,0.01
0.2857142857142857,1,28.208969483025083,7.576234944513116,0.01,0.01
0.3061224489795918,1,31.307217197702858,11.920150575624033,0.01,0.01
0.32653061224489793,1,34.02003706808991,15.974029767980111,0.01,0.01
0.3469387755102041,1,36.37958133646282,19.75081855840348,0.01,0.01
0.36734693877551017,1,38.41371660681627,23.263874472541467,0.01,0.01
0.3877551020408163,1,40.14608684277597,26.525923557689968,0.01,0.01
0.4081632653061224,1,41.59631855303417,29.548420660047412,0.01,0.01
0.42857142857142855,1,42.7802730988534,32.34115487431027,0.01,0.01
0.44897959183673464,1,43.71029297512206,34.91199683952046,0.01,0.01
0.4693877551020408,1,44.3954130505847,37.266719491329106,0.01,0.01
0.4897959183673469,1,44.8415215664951,39.408846678587985,0.01,0.01
0.5102040816326531,1,45.05146258834253,41.339496315275746,0.01,0.01
0.5306122448979591,1,45.02507581579308,43.057194255088284,0.01,0.01
0.5510204081632653,1,44.75917087078464,44.55763784084132,0.01,0.01
0.5714285714285714,1,44.247434007528476,45.83339021912297,0.01,0.01
0.5918367346938775,1,43.480265674963206,46.87348554962607,0.01,0.01
0.6122448979591836,1,42.444548173623666,47.66292429386228,0.01,0.01
0.6326530612244897,1,41.12334547730126,48.182034574487595,0.01,0.01
0.6530612244897959,1,39.495542722455234,48.40567440725761,0.01,0.01
0.673469387755102,1,37.53544417786146,48.302249377305294,0.01,0.01
0.6938775510204082,1,35.212369445793755,47.832525882942925,0.01,0.01
0.7142857142857142,1,32.49032544307804,46.948236929022904,0.01,0.01
0.7346938775510203,1,29.32789804090339,45.5905171549874,0.01,0.01
0.7551020408163265,1,25.678621015774937,43.68828706664445,0.01,0.01
0.7755102040816326,1,21.49227022844291,41.156869864693746,0.01,0.01
0.7959183673469387,1,16.717838261070998,37.89742910959155,0.01,0.01
0.8163265306122448,1,11.309414286826271,33.79835583006353,0.01,0.01
0.836734693877551,1,5.236842173178732,28.74062952787787,0.01,0.01
0.8571428571428571,1,-1.4962572079392693,22.610509345316203,0.01,0.01
0.8775510204081632,1,-8.824224576507511,15.324492907047599,0.01,0.01
0.8979591836734693,1,-16.579434040144825,6.872290977814089,0.01,0.01
0.9183673469387754,1,-24.445019923631108,-2.619219253000618,0.01,0.01
0.9387755102040816,1,-31.917621523654393,-12.809602893650707,0.01,0.01
0.9591836734693877,1,-38.3162586778345,-23.088729032293035,0.01,0.01
0.9795918367346939,1,-42.88164071438466,-32.600661274349676,0.01,0.01
1.0,1,-44.97595264191646,-40.40063509461095,0.01,0.01
Loading
Loading