Skip to content

tcrundall/chronostar

 
 

Repository files navigation

Chronostar

A stellar orbit traceback code - work in progress

This repository is a legacy fork from when I (Tim Crundall) was primary contributor. The purpose of this repository is to showcase my skill and experience (or lack thereof) in Python.

In this repository, we will try to prototype some orbital traceback calculations.

Project Structure

  • benchmarks: A collection of scripts comparing the timings of various implementations of the overlap integral calculation
  • build: of no consequence, a byproduct of running setup.py
  • chronostar: housing the integral modules of this software
  • data: where astrometry data should live
  • demos: toy examples deomstrating usages of various methods, not all mine
  • integration_tests: complicated tests that can take upwards of 30 mins to run, testing everythign workign together
  • junkpile: where forgotten code goes to die.
  • playground: where I work out how to use things
  • results: plots and logs of science runs
  • scripts: where the science happens
  • tests: unittests that cover the low level stuff - should execute within half a minute

Setup

First, the swigged c implementation of the overlap integral must be built. Ensure you are in the main working directory (this one) and run:

python setup.py build_ext -b .

Installing swig

On mac:

brew install gsl brew install swig (will auto install dependencie: pcre)

If swig is not installed go to

brew install swig

sourceforge.net/ ... / swig and download swig (target language python) and follow instructions in 'INSTALL.txt'

(Make sure you have pcre first) (Make sure you have installed gsl (gnu scientific library) brew install gsl

e.g. cd [source directory] ./configure make make install

Next

Next check everything is in working order.

cd tests/
pytest

will run the unittests. Next, try the following:

cd integration-tests/
python test_groupfitter.py

This will take ~ 20-40 minutes on a typical machine. A single fit usually requires approximately 3000 steps to converge, and 100 steps takes about a minute.

Next, (assuming you're on a server with many cores) in the same directory try:

nohup mpirun -np 19 python test_mpirun.py &

If your server has 19+ cores, then run as above. If there's less, then reduce the number accordingly. Increasing the number of threads is not useful as there each thread is associated with an emcee walker, and there are only 18 walkers being used in this run. Depending on the cores available and how busy the server is, this should take ~5 minutes. Checkout the walker plots in temp_plots/.

Setup on Raijin

if running in node, load required modules: can optionally append these commands to .profile file but I don't fully understand behaviour and can lead to conflicts if modules are preloaded elsewhere...)

module load python/2.7.11
module load python/2.7.11-matplotlib
module load gsl/1.15

only need to install required python packages once (ever) but modules must be loaded first, and I believe these packages will be guaranteed to work for only those modules

pip install --user astropy
pip install --user galpy
pip install --user emcee
pip install --user corner
pip install --user mpi4py
pip install --user sympy

build

python setup.py build_ext -b .

FILES

Copy the following files from google drive: TGAS_traceback_165Myr_small.fits - all ~65000 TGAS stars with RVS from complementary catalogues traced back to 165Myr at 3Myr intervals

Donaldson16_TWA_astrometry.csv - 6D astrometry pulled from Donaldson et al. 2016 on TWA stars

bp_TGAS2_traceback_save.pkl - set of stars with any overlap at all with preliminary BPMG fit

EXAMPLE RUN (Need to update this section)

For synthetic data: ./gen_synth_data.py ./generate_default_tb.py data/synth_data_1groups_* ./fit_synth_1groups.sh

Investigate results by checking most recent log fils: ls logs/ -rtal

You can also plot the corner plots and the lnlike plots. After each run the suitable command will be displayed. e.g. Logs written Plot data saved. Go back and plot with: ./plot_it.py -t 817882 -f 1 -r 0 -p 1000 -l if not on raijin, or: ./plot_it.py -t 817882 -f 1 -r 0 -p 1000

About

A stellar orbit traceback code

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 51.5%
  • Python 47.7%
  • SWIG 0.3%
  • Shell 0.2%
  • Jupyter Notebook 0.1%
  • C++ 0.1%
  • Makefile 0.1%