If you need help, advice or different data, more columns in the datasets, easing some of our quality cuts, please contact us at 
ralph.schoenrich@physics.ox.ac.uk

Use these materials freely. Proper citation of Schoenrich & Aumer (2017) is appreciated.

Files contained in this folder

The DATA FILES for simpler use are:
allRAVE   -  sample of all RAVE stars evaluated with the RAVE distance prior/selection function
noflagRAVE - sample of unflagged RAVE stars evaluated with the distance prior/selection function for unflagged stars
LAMOST - sample of LAMOST stars with RVerr < 27 km/s and SNR > 30

Note that we in particular did not use the azimuthal velocity cut, to preserve some of the outliers in the sample.

Each file has a legend in the first line, preceded by a '#' sign.
Most columns are self-explaining/or explained in the paper.
dist is the distance (expectation value)
We give heliocentric and galactocentric velocities, W is the same for both frames
In the RAVE samples flagc0 gives the number of non-'n' flags, flagc1 is the number of binary flags



SOURCE CODE

rlmerge12.cpp is the source code. It can read the RAVE data release 5, and LAMOST DR5 files, as well as Gaia-TGAS files. The code is set up by pre-compiler definitions at the start of the c++ file, which can be uncommented to achieve different functionalities
If you want to run the code, either create new internal files for LAMOST and RAVE via the CREATENEWTABLE definition, or download the files the files raveoutb and lamostout bundled in the supplementary archive:
wget  http://www-thphys.physics.ox.ac.uk/people/RalphSchoenrich/data/tgasdist/addons.tar.gz 

A quick note on the outputs (ask us questions) for more - distance statistics are printed in the shell output of the code (you can pipe them into a file on unix systems with the >> command).
The running output first prints all stars that fail the quality cuts in lines starting with '#'
Lines without '#' contain distance statistics and other information - important columns are:
Column   meaning
2	number of stars used in the distance statistics
3	epar used (if you are using the NSIGBIN option to scan for different vlos source dispersions)
5	distance stretch factor g to reach unbiased distances. You have g = 1/(1+f)
9	lower limit on g (1 sigma)
13 	upper limit on g (1 sigma)
37	if you use binning, the mean value of your bins in the binned quantity should appear here
The other columns contain sundry statistics that are found in the functions lindist and lindisthelpUV (look for the cout statements if interested).

