Skip to content

Commit

Permalink
Merge pull request #25 from wbalmer/dev-wb
Browse files Browse the repository at this point in the history
Add sample method arg to system.fit, increment v after Tomas' update
  • Loading branch information
wbalmer authored Dec 18, 2023
2 parents 37a4037 + 298b9f5 commit bebd996
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@ bgstar_emcee.py
.pytest_cache/
tests/HD_131399_A_*.png
tests/HD_131399_A_dynestyrun_results.pkl
tests/gaia_query_6204835284262018688.fits
tests/dynesty.save
tests/yses2*
tests/YSES_2*
tests/gaia_query_*
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# backtrack
# backtracks
Python package to fit relative astrometry with background star motion tracks.

Written by Gilles Otten (@gotten), William Balmer (@wbalmer), and Tomas Stolker (@tomasstolker).
Expand All @@ -9,11 +9,11 @@ Current example (HD131399Ab) uses data from Wagner+22 and Nielsen+17. Thank you

Log-likelihood borrowed heavily from `orbitize!` (BSD 3-clause).

Currently requires and python 3.9 ish and `astropy`, `corner`, `dynesty`, `matplotlib`, `numpy`, `novas`, `novas_de405`, `orbitize` and their dependencies. Note that `novas` is not supported on Windows. You can create a working environment using conda+pip via a few lines of code:
Currently requires and python >3.9,<3.11 and `astropy`, `corner`, `dynesty`, `matplotlib`, `numpy`, `novas`, `novas_de405`, `orbitize` and their dependencies. Note that `novas` is not supported on Windows (I use WSL for Windows to develop the code!). You can create a working environment using conda+pip via a few lines of code:

```
conda create python=3.9 -n backtrack
conda activate backtrack
conda create python=3.11 -n backtracks
conda activate backtracks
conda install pip
pip install backtracks
```
Expand All @@ -28,8 +28,8 @@ python hd131339a.py
or, to clone the repo and install in development mode (we recommend this, as the code is a work in progress and you can easily fix bugs you will likely encounter this way):

```
conda create python=3.9 -n backtrack
conda activate backtrack
conda create python=3.11 -n backtracks
conda activate backtracks
conda install pip
git clone https://github.com/wbalmer/backtrack.git
cd backtrack
Expand Down
8 changes: 5 additions & 3 deletions backtracks/backtracks.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ def prior_transform(self, u):

return param

def fit(self, dlogz=0.1, npool=4, dynamic=False, nlive=500, mpi_pool=False, resume=False):
def fit(self, dlogz=0.1, npool=4, dynamic=False, nlive=500, mpi_pool=False, resume=False, sample_method='unif'):
"""
"""
print('[BACKTRACK INFO]: Beginning sampling, I hope')
Expand All @@ -337,7 +337,7 @@ def fit(self, dlogz=0.1, npool=4, dynamic=False, nlive=500, mpi_pool=False, resu
prior_transform=pool.prior_transform,
ndim=ndim,
pool=pool,
# sample='rwalk',
sample=sample_method,
)

dsampler.run_nested(
Expand All @@ -361,7 +361,7 @@ def fit(self, dlogz=0.1, npool=4, dynamic=False, nlive=500, mpi_pool=False, resu
ndim=ndim,
pool=pool,
nlive=nlive,
# sample='rwalk',
sample=sample_method,
)

dsampler.run_nested(
Expand Down Expand Up @@ -390,6 +390,7 @@ def fit(self, dlogz=0.1, npool=4, dynamic=False, nlive=500, mpi_pool=False, resu
prior_transform=self.prior_transform,
ndim=ndim,
pool=pool,
sample=sample_method,
)

dsampler.run_nested(
Expand All @@ -413,6 +414,7 @@ def fit(self, dlogz=0.1, npool=4, dynamic=False, nlive=500, mpi_pool=False, resu
ndim=ndim,
pool=pool,
nlive=nlive,
sample=sample_method,
)

dsampler.run_nested(
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "backtracks"
version = "0.3.1"
version = "0.3.2"
authors = [
{ name="William Balmer", email="[email protected]" },
{ name="Gilles Otten", email="[email protected]" },
Expand Down

0 comments on commit bebd996

Please sign in to comment.